Skip to content

fix(cli): clean error (not a traceback) when run outside a rendered project - #93

Merged
eduralph merged 1 commit into
mainfrom
fix/92-clean-no-config-error
Jun 21, 2026
Merged

fix(cli): clean error (not a traceback) when run outside a rendered project#93
eduralph merged 1 commit into
mainfrom
fix/92-clean-no-config-error

Conversation

@eduralph

Copy link
Copy Markdown
Owner

Summary

Closes #92. Running the console script from a directory with no pdca.toml raised an uncaught FileNotFoundError — the user saw a full Python traceback that reads like a crash (seen contributing into the Wyrd instance; works from wyrd-pdca/, not its parent):

Traceback (most recent call last):
  ...
  File ".../config.py", line 234, in _find_root
    raise FileNotFoundError("no pdca.toml found at or above … — run inside a rendered project")
FileNotFoundError: no pdca.toml found at or above /home/eddie/wyrd/wyrd — run inside a rendered project

The message was already helpful; only the surfacing was wrong.

Fix

cli.main() wraps Config.load():

  • FileNotFoundError → print its message (no pdca.toml found … — run inside a rendered project), exit 2.
  • malformed pdca.toml (ValueError / tomllib) → pdca: invalid pdca.toml — …, exit 2.

No traceback either way. --help and a valid in-project run are unchanged. Template-side, so every instance (gramps included) gets it on the next copier update.

Verification

  • Offline suite green: 154 tests OK — new CliSurface.test_no_pdca_toml_is_clean_error_not_traceback (outside a project, status exits 2 with one clean line, no Traceback).
  • Manual repro from /tmp: prints the one-line message, exit=2.

🤖 Generated with Claude Code

…roject (#92)

Running the console script from a directory with no pdca.toml raised an uncaught
FileNotFoundError — the user saw a full Python traceback (config._find_root →
Config.load → cli.main) that reads like a crash. The message was already helpful;
only the surfacing was wrong.

cli.main() now wraps Config.load(): a FileNotFoundError prints its message ("no
pdca.toml found … — run inside a rendered project") and a malformed pdca.toml
(ValueError / tomllib) prints "pdca: invalid pdca.toml — …"; both exit 2, no
traceback. --help and a valid in-project run are unchanged.

Test: CliSurface.test_no_pdca_toml_is_clean_error_not_traceback — outside a
rendered project, `status` exits 2 with one clean line and no "Traceback".
Suite green (154).

Closes #92.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Eduard Ralph <15236434+eduralph@users.noreply.github.com>
@eduralph
eduralph merged commit 2b6ea22 into main Jun 21, 2026
2 checks passed
@eduralph
eduralph deleted the fix/92-clean-no-config-error branch June 21, 2026 01:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CLI: dumps a Python traceback when run outside a rendered project (no pdca.toml)

1 participant