Skip to content

test(cli): add import-graph, v2-path, and stdout-purity guards - #124

Merged
jmgilman merged 1 commit into
masterfrom
feat/cli-ux-p1-guards
Jun 8, 2026
Merged

jmgilman merged 1 commit into
masterfrom
feat/cli-ux-p1-guards

Conversation

@jmgilman

@jmgilman jmgilman commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Summary

P1 / PR-1.6 (final foundation PR) of the CLI UX overhaul. Adds three CI tripwires that keep the foundation's boundaries enforced structurally instead of by review. All three are green on the current charm-free graph — they exist to catch regressions in the routing (P3) and charm/styling (P4) phases.

The guards

  • cli/internal/ui/guard_test.go
    • TestManagerImportGraphHasNoCharm — runs go list -deps ./cmd and fails if the operator manager's import graph contains charm|lipgloss|huh|bubble|ultraviolet|colorprofile|charmbracelet|ogmigo|kugo|internal/cardano/tx. Charm is confined to cli/internal/ui; the manager must never pull it (or the CLI-only heavy deps) in.
    • TestNoLegacyCharmPaths — bans github.com/charmbracelet/(lipgloss|huh|log) v0/v1 paths anywhere under cli/, so the eventual v2 (charm.land/*) adoption in P4 can't silently regress to a v0/v1 API.
  • cli/internal/cli/purity_test.go
    • TestNoRawStreamWrites — bans raw os.Std* / writer-less fmt.Print* / lipgloss.Print* / fmt.Fprint*(commandContext.out|err) in cli/internal/cli, with a per-line // ui-passthrough-ok pragma escape hatch. Full comment lines are skipped (so prose mentioning os.Stdout doesn't trip it); helper writers that take an io.Writer parameter are intentionally not matched (they receive cc.io.Data() once routing lands).

Interim pragmas

P1 routes nothing through cc.io yet, so the guard is green only because the 24 existing raw-write sites (connect/devnet/down/info/install/list/orphan/run/up/version/wallet/wallet_fund) are tagged // ui-passthrough-ok. This is the intended "tag-now, remove-in-P3" lifecycle: the routing phase strips most pragmas as it moves each line onto cc.io.Data/Encode/Status. The run/exec child passthrough and the wallet_fund os.Stdout swap keep theirs permanently.

Testing

  • gofmt/go vet/go build clean; golangci-lint 0 issues (the import-graph loop uses strings.SplitSeq; the pragma is spaced for revive); moon run root:check + moon run root:test green; git diff --check clean.
  • Verified the import-graph guard is genuinely green (go list -deps ./cmd has no banned deps and no cli/internal/*).

Completes the P1 foundation series (1.1 #119, 1.2 #120, 1.3 #121, 1.4 #122, 1.5 #123 merged → 1.6). After this, the foundation is in place; the remaining overhaul phases (P2 RunE thinning, P3 routing + JSON shapes, P4 spinners + charm) build on it.

🤖 Generated with Claude Code

P1 foundation (PR-1.6, final) of the CLI UX overhaul. Add three CI tripwires
that keep the foundation's boundaries enforced structurally instead of by
review:

- cli/internal/ui/guard_test.go: TestManagerImportGraphHasNoCharm runs
  `go list -deps ./cmd` and fails if the operator manager's graph contains
  charm/lipgloss/huh/bubble/ultraviolet/colorprofile/charmbracelet/ogmigo/kugo/
  internal/cardano/tx (charm is confined to cli/internal/ui, never the
  manager). TestNoLegacyCharmPaths bans github.com/charmbracelet/(lipgloss|huh|
  log) v0/v1 paths anywhere under cli/ so the eventual v2 (charm.land/*) adoption
  cannot regress.
- cli/internal/cli/purity_test.go: TestNoRawStreamWrites bans raw os.Std* /
  writer-less fmt.Print* / lipgloss.Print* / fmt.Fprint*(commandContext.out|err)
  in cli/internal/cli, allowing a per-line "// ui-passthrough-ok" pragma.

All three are green on the current charm-free graph. Because P1 routes nothing
through cc.io yet, the 24 existing raw-write sites (connect/devnet/down/info/
install/list/orphan/run/up/version/wallet/wallet_fund) are tagged
"// ui-passthrough-ok" as an interim; the routing phase removes most pragmas as
it moves each line onto cc.io.Data/Encode/Status. Helper writers that take an
io.Writer parameter are intentionally not matched.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jmgilman
jmgilman merged commit f9dbf7c into master Jun 8, 2026
12 checks passed
@jmgilman
jmgilman deleted the feat/cli-ux-p1-guards branch June 8, 2026 15:31
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