Skip to content

feat(cli): friendlier feedback — human error messages, typo suggestions, help examples#63

Merged
huyplb merged 1 commit into
mainfrom
feat/cli-ux-phase2
Jul 11, 2026
Merged

feat(cli): friendlier feedback — human error messages, typo suggestions, help examples#63
huyplb merged 1 commit into
mainfrom
feat/cli-ux-phase2

Conversation

@huyplb

@huyplb huyplb commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Summary

Phase 2 of the CLI UX improvement plan (friendlier feedback), building on Phase 1 (#62):

  • New format/friendlyError.ts: rewrites raw driver/network error signatures (ECONNREFUSED, ENOTFOUND, ETIMEDOUT, Postgres/MySQL/Oracle auth failures, unknown database) into a one-line cause + suggestion (e.g. "Can't reach 127.0.0.1:5432 — is the database running and reachable? Try fox doctor."). Errors this CLI throws itself (already written to be readable) pass through unchanged. Swept all 11 call sites — line commands and every TUI screen/hook — that previously inlined e instanceof Error ? e.message : String(e).
  • Enabled commander's showSuggestionAfterError()fox comapre now suggests Did you mean compare? instead of a bare "unknown command" error.
  • fox --help now ends with a handful of copy-pasteable examples (interactive UI, save a connection, compare, dry-run migrate, apply migrate, CI-friendly JSON output).

Test plan

  • cd apps/web && npx tsc --noEmit — clean
  • cd apps/cli && npx tsc --noEmit -p tsconfig.json — clean
  • npx vitest run from repo root — 241 passed, 2 skipped (was 232; +9 new tests covering friendlyError's pattern matches and passthrough behavior)
  • Manually verified: fox --help renders the examples block; fox comapre prints error: unknown command 'comapre' + (Did you mean compare?) and exits 1.

🤖 Generated with Claude Code

…ns, help examples

- New format/friendlyError.ts: rewrites raw driver/network error signatures
  (ECONNREFUSED, ENOTFOUND, ETIMEDOUT, dialect-specific auth failures, unknown
  database) into a one-line cause + suggestion; every error this CLI throws
  itself passes through unchanged. Swept all 11 call sites (line commands and
  TUI screens/hooks) that previously did `e instanceof Error ? e.message :
  String(e)` inline onto this one helper.
- commander's showSuggestionAfterError() — a mistyped command now gets a
  "Did you mean X?" instead of a bare "unknown command" error.
- `fox --help` now ends with a handful of copy-pasteable examples.
@huyplb huyplb merged commit dc6338b into main Jul 11, 2026
4 of 6 checks passed
@huyplb huyplb deleted the feat/cli-ux-phase2 branch July 11, 2026 07:35
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.

1 participant