Repository navigation
fix(cli): report NotInitializedError without a stack trace - #1228
Conversation
status, list and push reject with NotInitializedError when teamai is not initialized, and nothing caught it, so users saw a Node stack trace. Catch it once at the top level and print the message with exit code 1, as env list already does. Other errors are rethrown unchanged. Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com> Signed-off-by: jay23606 <4602056+jay23606@users.noreply.github.com>
|
No findings in the specified PR diff. The PR description documents sufficient testing: three passing built-CLI E2E tests and representative real-CLI runs verifying the error message and exit codes. The full suite and provider × agent matrix are explicitly deferred to CI. Review was read-only; I did not run, build, or install PR code. |
|
@jay23606 Lint & Test is failing on all Node versions in |
Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com> Signed-off-by: jay23606 <4602056+jay23606@users.noreply.github.com>
|
No findings in the specified PR diff. The PR description documents sufficient testing: three passing built-CLI E2E tests and representative real-CLI runs confirming the error message and exit codes. The full suite and provider × agent matrix are explicitly deferred to CI. The earlier review reported no findings, so none require resolution. Review was read-only; I did not run, build, or install PR code. |
Fixes #1227
Change
status,listandpushreject withNotInitializedErrorwhen teamai is not initialized, and nothing caught it, so users saw an uncaught Node stack trace.src/index.tsnow callsprogram.parseAsync()and catchesNotInitializedErroronce at the top level: it prints the message withlog.errorand sets exit code 1, the same outcomeenv listalready gives. Any other error is rethrown unchanged.Added
src/__tests__/e2e/not-initialized-exit.test.ts, which runs the built CLI with an empty HOME forstatus,listandpush --dry-run, and asserts exit 1, the message, and no stack trace.Design choice
Catching once at the top level (as the issue suggests) rather than in each command. The alternative is a per-command catch in
status,listandpush, asenv-commands.tsdoes. The top-level catch covers any future command that callsrequireInit(); the per-command option is more local but has to be repeated.Before and after
Before (test run on
upstream/main8dc60b0, build from that tree):After (same test,
npx vitest run --config vitest.e2e.config.ts src/__tests__/e2e/not-initialized-exit.test.ts --retry 0):Real CLI runs after the fix (empty HOME):
Other checks:
npx tsc --noEmitexit 0,npm run lintexit 0,src/__tests__/cli-path.test.ts13/13 passed.Not verified: the full e2e suite and the provider and agent matrix. Those run in CI.
🤖 Generated with Claude Code