score-compose icon indicating copy to clipboard operation
score-compose copied to clipboard

feat: improve error message clarity when no workloads are available

Open kotahorii opened this issue 4 months ago • 1 comments

Summary

Improves the error message shown when users run score-compose generate without any workloads, making it clearer and more actionable.

Changes

  • Better error messages: Replaced the confusing "the project is empty, please provide a score file to generate from" with contextual messages
  • Smart detection: Added logic to detect if score.yaml exists in the current directory
    • If score.yaml exists: Shows "no workloads to generate from. Did you mean to run: score-compose generate score.yaml"
    • If no score.yaml: Shows "no workloads to generate from. Please specify a score file, e.g., score-compose generate score.yaml"
  • Enhanced testing: Updated and added test cases to properly handle the init command's default behavior and new error message logic

Problem Addressed

The original error message "the project is empty, please provide a score file to generate from" was confusing because:

  1. It didn't clearly indicate what the user should do next
  2. It didn't suggest the most common case (using score.yaml)
  3. Users weren't sure if they needed to create a file or specify an existing one

Testing

  • All existing tests pass
  • Added new test case TestGenerateWithScoreYamlPresent to verify behavior when score.yaml is present
  • Updated TestGenerateWithoutScoreFiles to use --no-sample flag to properly test the no-file scenario

Fixes #287

🤖 Generated with Claude Code

Co-Authored-By: Claude [email protected]

kotahorii avatar Aug 02 '25 16:08 kotahorii

Hi @kotahorii, The DCO check is failing because your commit is missing a sign-off.

rabelmervin avatar Aug 08 '25 13:08 rabelmervin