Skip to content

feat(cli): add spinner utility and success/info helpers to DashboardCommand#918

Merged
aaight merged 1 commit intodevfrom
feature/spinner-utility-and-success-info-helpers
Mar 16, 2026
Merged

feat(cli): add spinner utility and success/info helpers to DashboardCommand#918
aaight merged 1 commit intodevfrom
feature/spinner-utility-and-success-info-helpers

Conversation

@aaight
Copy link
Copy Markdown
Collaborator

@aaight aaight commented Mar 16, 2026

Summary

  • Installs ora ESM-native spinner package and creates withSpinner(message, fn) utility in src/cli/dashboard/_shared/spinner.ts
  • Adds this.success(msg) and this.info(msg) helper methods on DashboardCommand base class with colored emoji prefixes
  • Spinner is auto-suppressed when --json flag is present, NO_COLOR env var is set, or CI env var is set

Changes

  • package.json — added ora dependency
  • src/cli/dashboard/_shared/spinner.ts (new) — exports withSpinner(message, fn, options?) and isSilentMode(options?) utilities
  • src/cli/dashboard/_shared/base.ts — added this.success(msg), this.info(msg), and this.withSpinner(message, fn) protected helpers on DashboardCommand
  • tests/unit/cli/dashboard/spinner.test.ts (new) — unit tests for withSpinner (success, failure, silent mode) and isSilentMode
  • tests/unit/cli/dashboard/base.test.ts — added tests for success, info, and withSpinner helpers

Test plan

  • ora package installed and importable in ESM context
  • withSpinner(message, fn) shows animated spinner during async fn execution and clears on success/failure
  • Spinner is automatically suppressed when --json flag is present, NO_COLOR=1, or CI=1
  • DashboardCommand.success(msg) prints green ✓ prefix
  • DashboardCommand.info(msg) prints blue ℹ prefix
  • Unit tests for withSpinner (success, failure, silent mode) and success/info helpers — all pass
  • Full unit test suite passes (5453 tests)
  • Lint passes (biome check)
  • TypeScript type check passes

Card

https://trello.com/c/69b845f8a51b096157ce85fa

🤖 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

Clean, well-structured addition of a spinner utility and success/info helpers. Implementation is correct, well-tested, CI passes, and the code fits naturally into the existing _shared/ module.

Minor Observations

  • Misleading JSDoc in spinner.ts:6: The comment "--json flag would be passed (NO_COLOR env var is set)" conflates two separate concerns. The --json flag detection happens in DashboardCommand.withSpinner() (which passes silent: true), not in isSilentMode(). The NO_COLOR env var is a separate, independent condition. Consider rewording to: Explicitly requested via silent option (e.g., when --json flag is present).

  • NO_COLOR spec compliance (very minor): The NO_COLOR spec says the variable should be honored when present, regardless of value — including empty string. The current check if (process.env.NO_COLOR) misses NO_COLOR="". A more spec-compliant check would be if ('NO_COLOR' in process.env). This is a very minor edge case unlikely to matter in practice.

  • Unused import: afterEach is imported but unused in spinner.test.ts — not flagged by biome, so no action needed.

Overall this is a clean PR. The spinner utility is well-designed with proper silent mode detection, the base class integration is minimal and non-intrusive, and the test coverage is thorough.

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

@aaight aaight merged commit 02f8999 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