Skip to content

feat: add Charm Bracelet CLI UX with structured logging#8

Merged
jflowers merged 1 commit into
mainfrom
002-charm-ux
Apr 6, 2026
Merged

feat: add Charm Bracelet CLI UX with structured logging#8
jflowers merged 1 commit into
mainfrom
002-charm-ux

Conversation

@jflowers

@jflowers jflowers commented Apr 6, 2026

Copy link
Copy Markdown
Contributor

Summary

Upgrades all CLI output from plain fmt.Printf to lipgloss-styled rendering matching the Unbound Force ecosystem (uf doctor, gaze). Adds structured logging for the MCP server.

Styling (US1-US3)

  • internal/ui/ — Centralized Styles struct with renderer-aware pipe/NO_COLOR detection
  • Doctor — Color-coded indicators, rounded summary box, plain-text fallback when piped
  • Cellslipgloss/table with per-row status coloring (green/yellow/red/gray) + --json flag
  • Setup, init, version, stats, query — Consistent styled output using shared style system
  • All 8 CLI commands use ui.NewStyles(w) — zero raw fmt.Printf for user-facing output

Logging (US4)

  • charmbracelet/log — Structured logging with Logger interface (2 methods: Info, Warn)
  • Per-repo log file.unbound-force/replicator.log created on serve startup, truncated each session
  • Tool call instrumentation — Each MCP tools/call logged with tool name, duration, success/error
  • Graceful degradation — Log file failure falls back to stderr-only (bootstrap exception)

Tests

  • 11 new tests in internal/ui/ (styles + table)
  • 14 tests in internal/doctor/ (format + checks)
  • 7 tests in internal/hive/format_test.go (cells table)
  • 6 tests in cmd/replicator/serve_test.go (logging lifecycle)
  • 9 tests in internal/mcp/server_test.go (tool call logging)
  • All 200+ tests pass across 15 packages

- Centralized lipgloss style system (internal/ui/) with pipe-safe
  renderer detection matching the uf/gaze ecosystem
- Doctor: color-coded indicators, rounded summary box, plain fallback
- Cells: bordered lipgloss/table with per-row status coloring + --json flag
- Setup, init, version, stats, query: consistent styled output
- MCP server: charmbracelet/log structured logging with per-repo
  log file at .unbound-force/replicator.log (truncated on startup)
- Logger interface for testable MCP tool call instrumentation
- 200+ tests across 15 packages, all passing
@jflowers jflowers merged commit 8444b33 into main Apr 6, 2026
1 check passed
@jflowers jflowers deleted the 002-charm-ux branch April 6, 2026 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants