Skip to content

internal/ holds cmd-only code; CLI packages belong in cmd/internal #742

Closed

Description

@David-Noble-at-work

internal/ at the repository root is importable by the whole module. cmd/internal/ is importable only by
the commands. Every package under internal/ is imported only by cmd/, so the wider visibility buys
nothing and misplaces the code.

Measured

Package Imported by cmd/ Imported by pkg/ or other internal/
internal/console 3 files 0
internal/credentials 2 files 0
internal/manifest 4 files 0
internal/registry 4 files 0

The clearest case is internal/console

It is a Bubble Tea terminal UI — charmbracelet/bubbletea, bubbles/spinner, bubbles/textinput, plus
model.go, session.go, and styles.go. That is CLI presentation, and its only consumers are
cmd/writ/writ/migrate_cmd.go and cmd/writ/writ/migrate/. It belongs beside the other CLI plumbing in
cmd/internal/.

The other three need a judgment, not a sweep

credentials, manifest, and registry are domain packages that happen to have only command consumers
today. The visibility argument applies to them equally, but "used only by cmd right now" is weaker than "is
CLI code": a future pkg/ consumer would be legitimate for a manifest parser and not for a Bubble Tea
model. Each should be moved or left deliberately, with the reason recorded.

Why it matters beyond tidiness

Root internal/ invites a pkg/ package to import CLI presentation, which would drag Bubble Tea into the
library surface. cmd/internal/ makes that a compile error instead of a review comment.

Acceptance

  • internal/console lives under cmd/internal/
  • Each remaining root-internal package is either moved or has its placement justified in writing
  • No pkg/ package can import CLI presentation code

Plan and design documents

Kind Document
Plan docs/plans/feature/782-writ-workflow-verify.md
Design Command Line Interface — One Convention, Every App
Design Graph and Trace Integrity § Verification
Design Graph and Trace Integrity § Tier 2: Signature
Design Audit, Reconciliation, and Recovery

Metadata

Metadata

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions