Skip to content

feat(cli): add --format, --columns flags and contextual empty-state messages#925

Merged
aaight merged 1 commit intodevfrom
feature/flexible-output-formats
Mar 16, 2026
Merged

feat(cli): add --format, --columns flags and contextual empty-state messages#925
aaight merged 1 commit intodevfrom
feature/flexible-output-formats

Conversation

@aaight
Copy link
Copy Markdown
Collaborator

@aaight aaight commented Mar 16, 2026

Summary

Implements flexible output formats for the CASCADE CLI dashboard commands, enabling scripting and pipeline use cases.

  • --format flag added to DashboardCommand.baseFlags with options: table (default), json, csv, compact
  • --json flag preserved as a backward-compatible alias for --format json
  • --columns flag added for filtering which columns to display (e.g. --columns id,status,agent)
  • printCsv() — outputs header row + comma-separated values with RFC-compliant quoting for commas/quotes/newlines
  • printCompact() — outputs one-line-per-row in key=value format for quick scanning
  • outputFormatted() helper on DashboardCommand that dispatches to the right formatter based on flags
  • Empty-state messages with contextual suggestions added to all list commands (e.g. "No runs found. Try cascade runs trigger --project <id> --agent-type <type>")
  • Spinner suppression extended to suppress for non-table formats (csv, compact, json) to avoid polluting piped output

Files Changed

  • src/cli/dashboard/_shared/format.ts — added printCsv(), printCompact(), updated printTable() with optional emptyMessage
  • src/cli/dashboard/_shared/base.ts — added format/columns base flags, resolveFormat(), filterColumns(), outputFormatted() helpers
  • src/cli/dashboard/runs/list.ts — migrated to outputFormatted with empty-state message
  • src/cli/dashboard/projects/list.ts — migrated to outputFormatted with empty-state message
  • src/cli/dashboard/users/list.ts — migrated to outputFormatted with empty-state message
  • src/cli/dashboard/agents/list.ts — migrated to outputFormatted with empty-state message
  • src/cli/dashboard/definitions/list.ts — migrated to outputFormatted with empty-state message
  • src/cli/dashboard/webhooklogs/list.ts — migrated to outputFormatted with empty-state message

Test plan

  • All 3084 unit tests pass (npm test)
  • Lint passes (npm run lint)
  • Type checking passes (npm run typecheck)
  • New tests added: printCsv() (7 tests), printCompact() (5 tests), emptyMessage for printTable() (1 test), resolveFormat() (6 tests), filterColumns() (5 tests), outputFormatted() (8 tests), spinner suppression for non-table formats (1 test)

Trello card

https://trello.com/c/0T4i38Gl/445-as-a-user-i-want-flexible-output-formats-so-that-i-can-use-cli-output-in-scripts-and-pipelines

🤖 Generated with Claude Code

🕵️ claude-code · claude-sonnet-4-6 · run details

Copy link
Copy Markdown
Collaborator

@nhopeatall nhopeatall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

LGTM — Clean, well-structured implementation of flexible output formats for CLI dashboard commands.

The PR correctly:

  • Adds --format (table/json/csv/compact), --columns, and backward-compatible --json flags to the base command
  • Implements RFC-compliant CSV quoting and ANSI-stripping for both CSV and compact formatters
  • Preserves original API response objects for JSON output (pagination wrappers, full definition objects) while using processed rows for tabular formats
  • Extends spinner suppression to all non-table formats to avoid polluting piped output
  • Consistently migrates all 6 list commands with contextual empty-state messages
  • Comprehensive test coverage (33 new tests covering all formatters, flag resolution, column filtering, and integration)

No blocking or should-fix issues found.

🕵️ claude-code · claude-opus-4-6 · run details

@aaight aaight merged commit b94c20f into dev Mar 16, 2026
6 checks passed
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.

2 participants