internal/ui has no package state: ui.UI holds the streams, terminal
flags, run log, status line, cleanup stack and interrupt flag, and its
functions are methods. ui.Main makes the run's UI on devvm's own
streams, owns signals, recovers Die and runs the cleanups; ui.New makes
one on other streams. cmd/devvm passes it to cli.Execute, and every cli
command gets it through its constructor.
Only cmd/devvm and internal/cli import internal/ui (a depguard rule).
Each other package defines the small UI interface it needs, which its
constructor takes, filling fields tests set:
- gitprotect.New, secrets.NewStore, from.NewLookup: a warn func
- ubuntu.New: LoggedCmd, Note
- netpolicy.NewProxy: Note, Warn, Ask, Confirm, StdinIsTerminal; its
log lines drop control characters themselves (oneLine)
- sshagent.New: Info, Note, Warn, LogWriter
- tools.New: Info, Warn, LogNote, Status, LoggedCmd, AddCleanup
- lima.New, smolvm.New: Info, Warn, LoggedCmd (their Runner's Run),
WithSteps, AddCleanup, Interrupted; lima LogNote and ubuntu's too
- backends.Registry: lima's and smolvm's
- vm.NewEnv: all of the above, Say, Stdout, Stderr; Env has Stdout,
LogNote, LogWriter, LoggedCmd, AddCleanup, Interrupted fields
- build.Builder: Terminal and LogNote fields
- sshconfig.New: its caller sets what it prints and asks
ui's tests build their own UI over buffers and run in parallel; other
packages' tests use small fakes; cli's unit tests a UI over buffers.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Tests set fields; no test outside internal/proxy and internal/ui assigns
a package var.
- backend.Review: Unreviewed and Warn, with Require and Allowed as its
methods; Registry embeds it, set by backends.Registry (a test build
reads DEVVM_UNREVIEWED); build.Builder.Review, sshconfig.Config.Review,
and Tools.Build takes the review with the backend
- netpolicy.Log: Path and Tick (NewLog), with Write and WriteBlocked;
Proxy.Terminal for Choose and SelfCheck
- vm.Env.Terminal, sshconfig.Config.Terminal
- cli: setup's terminal check and backend picker are fields of setup;
versionOf takes the release's version
- from.Registry.RetryDelay, ubuntu.Finder.RetryDelay, lima.Lima.OCIWait
- msg's tests use real messages, not entries added to docs and specs
The tests these free run in parallel. AGENTS.md: test seams are fields;
internal/proxy's globals and internal/ui's process-wide state are the
exceptions.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
- devvm --version (and a hidden devvm version) prints the version alone:
the one release builds set with -ldflags -X .../internal/cli.version,
else Go's build info without the v, else (devel). No -v shorthand.
- devvm help [COMMAND], --help and -h stay Cobra's.
- devvm completion bash|zsh|fish prints Cobra's script (no powershell).
Completion offers image names after the +-joined parts given (base,
the toolchains, the user's layers, the agents), shared tools for
remove, backend names for --backend, all/none for --ports, and never
file names.
- Tests: version.txtar, completion.txtar, help cases in root.txtar;
TestJoined, TestVersionFromRelease, TestVersionFlagHasNoShorthand;
more exit codes in TestExecuteExitCodes; docgen tests know the
completion page and keep version and __complete out.
- Docs: commands.md "devvm itself" and "Shell completion"; the CLI
reference regenerated (devvm_completion.md, --version on devvm.md).
- Converted: cli.bats "doctor: all there; --version prints VERSION"
(its --version half; doctor waits for doctor). No messages added.
Co-Authored-By: Claude Opus 5.5 <[email protected]>