Skip to content

Compact CLI and MCP output by default#2

Open
andrei-hasna wants to merge 1 commit into
mainfrom
improve-compact-cli-output
Open

Compact CLI and MCP output by default#2
andrei-hasna wants to merge 1 commit into
mainfrom
improve-compact-cli-output

Conversation

@andrei-hasna

Copy link
Copy Markdown
Contributor

Summary

  • Make noisy CLI surfaces compact by default: hooks list, hooks search, hooks docs, and log list/search/tail/errors now show capped, scannable summaries with detail hints.
  • Add gradual-disclosure paths via --limit, --all, --verbose, existing --json, hooks info <name>, and full docs with hooks docs <name> --verbose.
  • Make MCP list/search/docs/registered/profile/log/agent tools compact by default with explicit compact:false or verbose:true full-detail escape hatches.
  • Keep machine-readable/full-detail behavior covered by tests, including preserving the legacy 50-row default for full MCP log rows.
  • Use bun:sqlite directly for the local hook event DB so tsc --noEmit uses the DB type expected by migrations/retention.

Before / After

Worst noisy command captured before this branch:

hooks docs checkbugs: 157 lines before -> 19 lines after
hooks list:            62 lines before -> 25 lines after
hooks search check:    27 lines before -> 15 lines after

Current hooks list default now starts as:

Available hooks (39, showing 20):

  gitguard          [PreToolUse Bash] Git Safety
  branchprotect     [PreToolUse Write|Edit|NotebookEdit] Git Safety
  checkpoint        [PreToolUse Write|Edit|NotebookEdit] Git Safety
  ...

  Showing a compact subset. 19 more hidden; use --limit, --all, --verbose, or hooks info <name>.

Current hooks docs gitguard now previews useful content instead of dumping the full README:

README Preview:

  Claude Code hook that blocks destructive git operations.

README has 31 lines. Use hooks docs gitguard --verbose for the full README, or --json for machine-readable output.

Compatibility

  • Existing CLI --json paths for list/search/docs remain full machine-readable outputs.
  • MCP tools now default compact, but full-detail paths are explicit and tested with compact:false or verbose:true.
  • Adversarial review found a compatibility issue where full MCP log outputs would have defaulted to 20 rows; fixed by keeping 20 compact rows but preserving the legacy 50-row default for compact:false.

Validation

  • bun run typecheck
  • bun test (660 pass, 0 fail)
  • bun run build

Adversarial reviewer focused on CLI compatibility, output ergonomics, and token bloat; required findings were reconciled before opening this PR.

@andrei-hasna
andrei-hasna force-pushed the improve-compact-cli-output branch from e90b611 to 14edb82 Compare June 24, 2026 06:07
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