Skip to content

feat: unified CLI output style + polling countdown/realtime indicator#29

Merged
riglar merged 1 commit into
devfrom
feat/unified-cli-output
Jun 22, 2026
Merged

feat: unified CLI output style + polling countdown/realtime indicator#29
riglar merged 1 commit into
devfrom
feat/unified-cli-output

Conversation

@riglar

@riglar riglar commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Why

Output was inconsistent across commands — every command hand-rolled its own layout from colors/symbols, the keyValue() helper was unused, section headers were split between a full-width ruler and nothing, and the status→colour→symbol logic was copy-pasted in three places. This consolidates all rendering behind one layer with a documented style, and while in results-polling.service.ts adds the live polling feedback that was requested (countdown + Realtime connection state).

The visual language is a Claude Code-style tree: section headings with branch groups of indented detail rows.

⏺ devicecloud.dev
  ⎿ user   tom@devicecloud.dev
    org    DeviceCloud
    env    dev

What changed

Canonical rendering layer

  • src/utils/ui.ts (new) — section / branch / fields (ANSI-aware aligned key/values) / status / success / info / warn / running / note. Returns strings, so callers keep routing through logger and the --json gate.
  • src/utils/styling.ts — single statusPalette (the one source of truth for status colour+symbol; formatStatus and ui both use it); sectionHeader reimplemented to the look; stripAnsi exported for column alignment. Removed dead/old-look helpers: box, listItem, keyValue, full-width dividers.
  • STYLE_GUIDE.md (new) — the rules + a cookbook; pointer added in CLAUDE.md.

All commands migrated off bespoke layouts: status, list, whoami, login, logout, switch-org, upgrade, upload, live (all sub-commands), cloud. The live polling display + final results table also use the shared palette now.

Polling UX (results-polling.service.ts + realtime-gateway.ts)

  • Live countdown to the next backstop poll, ticking once a second under the status display.
  • For logged-in users, an indicator of whether Realtime is connected. The gateway now exposes isConnected() and an onConnectionChange hook.

Notable decisions

  • Status words and field labels are now lowercase (matching the agreed design). This is why three integration assertions were updated (Binary IDbinary id, the list "showing… " line). Easy to revert if you'd rather keep uppercase.
  • dcd live's post-start hints now sit under a ⏺ Next steps heading.

Testing

  • Full suite: 147 passing.
  • pnpm typecheck and pnpm lint clean (0 errors).
  • Smoke-tested dcd live and dcd whoami rendering by hand.

🤖 Generated with Claude Code

Introduce a single rendering layer so every command renders consistently,
in a Claude Code-style tree (⏺ section headings, ⎿ branch groups), and
surface live polling state to the user.

Output style:
- Add src/utils/ui.ts: the canonical layer (section/branch/fields/status/
  success/info/warn/note) on top of styling.ts.
- Centralise the status→colour→symbol mapping in styling.ts (statusPalette);
  formatStatus and ui both build on it. Reimplement sectionHeader to the ⏺
  look. Export stripAnsi for ANSI-aware column alignment.
- Migrate every command (status, list, whoami, login, logout, switch-org,
  upgrade, upload, live, cloud) and the polling display off hand-rolled
  colors/symbols layouts onto ui.
- Remove dead/old-look helpers: box, listItem, keyValue, full-width dividers.
- Add STYLE_GUIDE.md (rules + cookbook) and a pointer in CLAUDE.md.

Polling UX:
- results-polling.service.ts now shows a live countdown to the next backstop
  poll and, for logged-in users, whether Realtime is connected, ticking once
  a second under the status display.
- realtime-gateway.ts exposes isConnected() and an onConnectionChange hook.

Labels are now uniformly lowercase, dim and column-aligned; updated three
integration assertions that pinned the old wording. Full suite (147) passes;
typecheck and lint clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@claude

claude Bot commented Jun 22, 2026

Copy link
Copy Markdown

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

@riglar
riglar merged commit 09d59e9 into dev Jun 22, 2026
6 checks passed
@riglar
riglar deleted the feat/unified-cli-output branch June 24, 2026 07:38
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