--network learn runs a VM on the internet tier while it records the hosts
it reaches beyond its allowlist, shown as internet (learning). devvm
network lock picks which of them go into the VM's own rules, ticking only
reviewed registries on 443 and listing risky hosts apart, then gives the
VM the allowlist tier at once. learn is per VM only. The lock command
names its docs page in its about.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A command's metadata moves from hand-kept tables into the command itself:
an about (docs page, help group, why no --json) set as its Cobra
Annotations. msg.commandDocs, commandGroups and withoutJSON are gone;
TestDocLinks reads the links from the generated CLI reference, and help
output and the reference are byte-identical. AGENTS.md's cli and vm rows
point at new doc.go package comments.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Customizing a new VM shows the four tiers in order, each with what it
reaches (Tier.Desc, which devvm setup's network picker shares), the
summary's tier chosen, through the UI's PickOne (vm.Env.PickOne). Where
the picker can't show, the VM keeps the summary's tier. net_ask,
net_about and net_tier_unknown go; network_default_open, _internet,
_allowlist and _none become net_tier_*; net_tier_help is the picker's.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Refusals and help that need a person now say 'in a terminal without
--no-input', as no_terminal_fetch and no_terminal_delete did: each
message names the command to run, so the condition sits in it rather
than being added by UI.Refused. size_pending is for a stopped VM;
size_pending_running keeps the restart hint for a running one. setup's
size question goes through a Reporter the tests make (msg.Fake).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The ask setting is gone: a new VM's summary shows its tier (--network,
else the saved tier, else allowlist) and customizing it asks for the
tier, with Enter keeping the one shown, so ask added nothing.
- settings.NetworkChoices is the tiers alone; settings.NetworkDefault
(allowlist) replaces NetworkAsk, checked against netpolicy.TierDefault.
- chooseNet takes --network, then the saved tier; customize asks for the
tier whenever --network didn't give it (netpolicy.Proxy.Choose takes
the tier shown, and net_tier_unknown names it).
- devvm network -g ask and devvm setup's ask choice are gone; ask is a
usage error (arg_not_choice). net_ask_global and network_default_ask
removed.
- A saved "ask" in config.toml or settings.json is refused like any
value that isn't a tier.
- Docs: safety/network, using/settings, using/images, getting-started
commands and first-vm, the cli skill, devvm network's and up's help.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The command line names the four network tiers. --network TIER (open,
internet, allowlist or none) chooses a new VM's tier, checked before
anything runs (arg_not_choice). devvm network open|internet|allowlist|none
gives the folder's VM a tier through Net.SetTier, and devvm network -g
takes the tiers and ask. config.toml's and settings.json's network is ask
or a tier (settings.NetworkChoices, checked against netpolicy.TierNames
by a test, since settings can't import netpolicy).
The question on creation is Proxy.Choose(vm): net_about says what each
tier reaches, net_ask asks for one (Answer, AnsweredBy("--network")),
Enter or a refusal gives allowlist, and an answer that isn't a tier is
warned of (net_tier_unknown) and asked again. devvm setup's picker
offers ask and the four tiers (network_default_open, _internet,
_allowlist, _none). On an existing VM, --network is ignored with the
devvm network TIER command that changes it.
devvm network --json: policy is the tier or unenforced, and each policy
file whose denies alone apply (internet and none) has denies_only: true,
as the text output's "(denies only)", so a script can tell a file's
denies from all of its rules without knowing the tier rules.
Messages reworded: net_tier_backend (--network open), net_open_policy
(devvm network allowlist), net_about, net_ask, network_default*,
net_default_failed, network_failed, setting_already's and
widen_parent_vm*'s descriptions. safety/network's "Choosing a tier"
replaces its on/off section; docs, the cli skill, testscripts and e2e
use the new forms, and e2e's internet and none checks go through devvm
network.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Every question is a msg.Question that declares what answers it where
devvm can't ask: AnsweredBy("--force") names a flag or command, which the
refusal names (no_input), and RefusedWith(msg.X(...)) gives a question no
flag answers its own refusal. msg.AnswerFor and its table go.
The Reporter's Ask, Confirm and Answer, and the UI's Secret, take a
Question and return a *msg.Refusal where they can't ask: with --no-input,
without a terminal, or at the end of the input, one refusal for all three
causes. Commands return it through the failure path (showFailure ->
UI.Refused: the question, then the refusal); nothing dies on an unanswered
question any more. Questions with a usual answer fall back on it instead:
network policy on, restart no, history import later, the Include line
warned, an unenforced VM stopped, the first run's size kept.
Gone: confirmed() in cli (4 callers), force_needed and no_input_terminal,
vm.Env.CanAsk and ui.CanAsk, vm's interactive, setup's terminal, the
Reporter's StdinIsTerminal/StdoutIsTerminal and the Fake's StdoutTerminal,
and every caller's terminal check (18 in vm, netpolicy, build and
sshconfig; 3 CanAsk; 1 interactive; 2 in cli). The picker's check
(CanPick) stays in the picker, which keeps its choices with --no-input
too; setup and the first run's agents and the new-VM summary still read
CanPick, because what they save or say depends on whether the picker
showed.
A Question's About context (the network policy's, a secret's howto, the
restart's changes, the size's host) is said only when it's asked.
devvm update asks before its tools change, so a refusal leaves the VM as
it is.
The CLI tests answer through a terminal (ttyin) or, explicitly, with a
test build's DEVVM_PIPED_ANSWERS=1, a line of input each.
Tests: ui's TestConfirm, TestAsk, TestAnswer, TestPromptsOnlyAtATerminal,
TestSecret, TestNoInput, TestNoTerminal, TestNoAnswer, TestPipedAnswers,
TestRefusedInterrupted, TestPickNoInput; msg's TestQuestionRefused,
TestQuestionAbout; cli's agreement test TestQuestionsDeclareAnswers (every
AnsweredBy names devvm's flags and commands, every RefusedWith a message,
no Question made otherwise) and TestCheckAnswer; vm's
TestSizeChoiceRefused; testscript prompts.txtar (each cause, a refusal of
its own, piped answers).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
msg.Reporter is what every package below cli prints and asks through:
Info, Say, Note, Warn, Status, Ask, Confirm, Answer, the terminal checks
and CanPick, the run log (LogNote, LogWriter, LoggedCmd, WithSteps),
Stdout, Stderr, AddCleanup and Interrupted, under the UI's signatures.
*ui.UI implements it (a compile-time check in ui), and msg.Fake is the
tests': quiet as its zero value, its On funcs and fields record and
answer.
The six UI interfaces (tools, netpolicy, lima, registry, sshagent, vm)
are gone, and the copied output and prompt func fields of tools.Env,
tools.Making, gitprotect.Protector, secrets.Store, netpolicy.Proxy,
from.Lookup, backend.Review, lima.Lima, sshagent.Agent, vm.Env,
vm.SizeChoice, vm.AgentsChoice, vm.LayersChoice, vm.NetworkChoice,
vmssh.Forwards, build.Env and sshconfig.Config: each embeds the
Reporter. Lima's and the shared tools' Warn, which says where the run
log is too, is a method of their own over it; vm's interactive check is
a function over it. The pickers (build.Env.Pick, vm.Env's PickFeatures
and PickParts, the choices' Pick) and vm.Env.CanAsk stay fields: they
carry types of their own or cli's answer. The test UIs of tools,
netpolicy, lima, registry, build and vm become msg.Fake.
Coverage baselines raised: internal/backend/lima, internal/msg,
internal/tools.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Commands fail by returning: RunE returns the error, as failed(err, what)
when it may not be a message (replacing fail and the direct Die calls in
cli), and a.env returns its failure. checkLayout returns its error from the
root's PersistentPreRunE. execute alone prints a failure (showFailure): a
backend.LoggedError with the run log's end (ui.ErrorLogged, which replaces
DieLogged), a message as it is, else what failed or output_failed, with a
corrupt file's message as names mode shows it. Exit codes stay 0, 1, 2, 130.
Die is now the UI's own die, for where no command can return: a question
without an answer, a run log that can't be opened. Error prints nothing once
the run is interrupted.
After INT, TERM or HUP, Main waited only for the logged command and then ran
the cleanups while the command's own code still ran. It now also waits for
the command to return, up to returnGrace (2 s), when there are cleanups to
run; a run without cleanups ends at once, so the proxy and the other
background processes still stop as soon as they are told to. A start's
undoStart stays registered once interrupted (interruptCleanup), as the
cleanups now run after the start returned.
Tests: TestSignalsWaitForTheCommandBeforeTheCleanups (failed on the old
ordering), TestSignalsWaitForAStuckCommandAWhile,
TestSignalsWithoutCleanupsEndAtOnce, TestExecuteShowsEachFailure;
DieLogged's tests are ErrorLogged's.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
NewRoot makes one app for the run's UI and hands it to every command.
The app makes each service the first time a command asks for it and
keeps it, or its error, for the rest of the run: devvm's folders
(dirs), a test build's overrides, the secrets store, the backends'
registry, the shared tools, the VM environment (vmEnv) and the image
builder of the backend new VMs get (builder). The retention that runs
before a command and the command itself share them.
- paths.FromEnv: 23 of 24 calls go through a.dirs; partNames, which the
parser's flag and word checks call before any command, keeps its own.
- The registry is made once (8 newRegistry calls and newEnv's).
- builder(u) (6 calls) and cli's newBuilder are gone: a.builder and the
per-backend builders in images, space and gc are vm.Env.Builder,
exported, the only builder. setup's feature choice takes a build.Env
of its folders and prompts alone.
- The shared tools are made once (newTools and vm.NewEnv's), and the
secrets store once (companyProxy's, newTools', vm.NewEnv's and
_proxy's): vm.NewEnv takes the run's tools and store.
- withEnv (46 calls) is a.env; autoRetain, retainOrphans and gc
--orphans use the run's VM environment.
- thisHost and readOverrides' other callers read the overrides once
(a.host); space and gc --caches time out on the registry's host.
TestAppMakesEachServiceOnce checks that one run makes each service once
and that the VM environment and builder share the run's registry and
tools; TestAppKeepsAFailure that a failure is kept.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Base's size was read from assets/base.yaml four ways: vm.BaseDisk's
line scanner (a new VM's smallest disk), SizeChoice.Fitted's same scanner
for CPUs and memory (devvm size -g and setup's question), Lima's
buildSize regexes (base's build size), and limactl create reading disk:
from the template on its input. Now backend.BaseCPUs, BaseMemoryGiB and
BaseDiskGiB are the one source:
- vm checks new VMs' disks against backend.BaseDiskGiB, and Fitted fits
BaseCPUs and BaseMemoryGiB; SizeChoice has no Assets any more.
- Lima's buildSize uses the constants; its Origin carries base's disk as
a step of its own ("disk", its GiB), which originOf requires and
createArgs passes as --disk=, so base's key still hashes it, and the
--from conversion's VM gets it too.
- base.yaml sets no cpus, memory or disk, and is hashed only into Lima's
key as Lima's settings.
Tests: TestBuildImageBaseSize (pinned on the old code: base created with
4 CPUs, 8 GiB and a 100 GiB disk, now all flags and none in base.yaml),
TestBaseSize, TestOriginOfRefuses' no disk and bad disk; the limactl stub
reads create's --disk=. Docs: internals/images.md, internals/lima.md,
contributing.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A msg.M always renders as its text: String, Error, Parts and Segments no
longer read DEVVM_MESSAGES, and Line is gone. internal/ui reads names mode
in newStyle, with each stream's color, and shows messages as names through
the style (message, segments, line, valueParts). ui.New takes the function
it reads the environment with, so tests make a names-mode UI without
t.Setenv. Messages shown as data go through UI.Text or Table.Text (doctor
--json, ls's image cell, setup's network choices); vm.PickRow.Desc is a
msg.M that cli renders. A config.toml value's refusal keeps its message
(state.CorruptError.Msg, Shown), so fail shows its names in names mode.
Tests: ui TestNamesMode; state TestFiles covers Msg and Shown; Go tests
compare NamesOf or Names, and drop t.Setenv("DEVVM_MESSAGES") outside ui,
msg's TestNames and the testscript runner. The structure test lists
DEVVM_MESSAGES in internal/ui/style.go only; ui.UI's method limit is 47
(Text).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
devvm setup chooses default layers, as it chooses new VMs' coding
agents: settings' layers key (config.toml's layers = [...], or
settings.json's, saved by devvm setup), bottom first, each name checked
as a layer's (not base or a shared tool's).
- devvm setup --layers LIST|none saves them without asking; a name that
isn't a layer is a usage error with a did-you-mean, and config.toml's
are refused (set_in_config). In a terminal, setup asks for them last,
after the agents (layers_help), with each layer's description.
- A new VM's picker checks setup's layers under Layers ("from devvm
setup"), and they keep their order at the bottom of the image, with
what's added on top. Without a terminal a new VM gets them; --layers
replaces them and --layers none gives none. A devcontainer.json's
layers go on top.
- A default layer whose script is gone is skipped with a warning
(default_layer_gone); one the backend can't run fails before anything
is built, naming the layer and both ways out (default_layer_lacks).
- pick_setup_agent becomes pick_from_setup, for agents and layers;
desktop_no_layer names devvm setup --layers too.
Code: settings.KeyLayers, Defaults.Layers, checkLayers, layerKind;
vm.LayersChoice (Set, Ask), creation.addSetupLayers,
requireSetupLayers, inOrder; cli addLayersFlag, setup's --layers and its
completion.
Tests: TestReadConfig, TestConfigRefused, TestPrecedence,
TestReadSaved; TestLayersChoice, TestUpParts (setup's layers, --layers
replacing them, --layers none, a gone layer), TestUpSetupLayerLacks,
TestUpPicker (setup's layers checked, their order kept); TestSetupLayers,
TestSetupAsks, TestSetupConfigSets; setup.txtar (--layers, none, unknown
names, a new VM getting them, --layers and --layers none replacing them,
a gone layer warned, config.toml's layers refused and given to a new VM).
Docs: settings (config.toml's layers key, devvm setup's fifth question
and flag, Layers for new VMs), images (what a new VM gets), customizing,
desktop, commands, first VM; the CLI reference.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
devvm runs every VM on Lima, so the command line has no backend choice:
- --backend is gone from devvm, build, rebuild, images, images rm, gc,
space, doctor and setup (addBackendFlag, addBackendFilterFlag, setup's
own, checkFlagValue's case, its completion); a removed flag now fails
as an unknown flag (exit 2).
- devvm setup no longer asks for or saves a default backend; config.toml
and settings.json have no backend key (settings.KeyBackend, Values and
Defaults' Backend, checkBackend, Value.With, Source.File, FromFlag).
- Tables lose BACKEND: ls, images (both tables), space (both tables);
doctor's FEATURE table is FEATURE and SUPPORT for Lima. space's images
row is freed by images rm.
- --json keeps every backend field (ls, images, tool records, space,
doctor's backend, backend_source "built-in" and every backend's
features).
- The registry keeps Lookup, For and Default: For(d, vm) gives a VM its
recorded backend and a new VM NewVMs, else Default; tests set NewVMs.
vm.Env's lookups lose the flag parameter, found.flagIgnored and
Options.Backend.
- Messages removed: backend_unknown, backend_unknown_default,
default_backend, backend_help, doctor_backend_from,
backend_flag_ignored; backend_unknown_vm stays (a VM's recorded
backend), linked to backends#a-vms-backend.
- Docs: Backends' choosing section becomes "A VM's backend"; settings,
setup, images, gc, space, doctor, commands and install pages lose
--backend and BACKEND; Contributing gains "How a backend plugs in".
- Tests: unit tests for For, settings, setup, doctor's table, the
tables; CLI scripts check --backend as an unknown flag on devvm,
build, restart, images, gc, space, doctor and setup, and a config.toml
backend key as unknown; e2e's table checks lose the column.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Lima is devvm's only backend. The backend architecture stays (Backend,
Caps, Features, Review/Require, the registry, backendtest.Fake), so
another backend is an addition.
State from a smolvm VM reads as an unknown backend (backend_unknown_vm,
gc_orphans_unknown); nothing migrates it. The image keys of
layers/docker.sh, layers/nix.sh and features/desktop.sh change, so images
rebuild once.
Lima's port forwarder moves off smolvm's files first: newForwarderCmd and
forwarderMain from internal/cli/smolvmports.go to limaports.go, and
assets/container/ports.sh to assets/guest/ports.sh (sent by the forwarder
at run time, so no image key changes).
Removed:
- internal/backend/smolvm (4,070 lines with tests), _smolvm-ports, its
registry entry, registry.Experimental and backend_experimental.
- The decider: backend.Decider/UsesDecider, Confinement.Decider and
DeciderToken, internal/proxy/decider.go and its test, the proxy's
-decider, -decider-to and -decider-token-file, netpolicy's
KeyDeciderPort, KeyDeciderToken and deciderToken, the decider port in
vm's forwarding and UsedPorts.
- backend.AgentStarter/AgentUnchosen, vm's checkAgentStart and
agent_unchosen_stop.
- vmssh/key.go (EnsureKey, Public, HostKey, ServicesArgs, Capped).
- paths.Smolvm/SmolvmImage and space's smolvm folders; paths.VM's
Record, Key, KnownHosts and ProxyURL; project.Detect, which nothing
called (a test helper now).
- ubuntu.ContainerRepo/ContainerDigest/ContainerRef/ContainerOrigin and
bump.sh's ubuntu_image, with its part of bump.txtar.
- assets/smolvm/ and assets/container/; the no-init-system branches of
layers/docker.sh, layers/nix.sh and guest/sync.sh, and the notes in
features/desktop.sh and guest/ca.sh.
- Messages: smolvm_* (14), vm_no_ssh, vm_no_sshd, ports_no_ssh,
creating_from_image, packing_image, pack_failed, backend_experimental,
agent_unchosen_stop; descriptions naming smolvm reworded.
- Tests: smolvm.txtar, the smolvm stub, registry, decider, netpolicy and
sshagent cases; gc_backend, gc_skipped, gc_orphans and space test a
failing or hanging Lima listing instead (the limactl stub's list-fails
and list-hangs); the --backend smolvm examples; e2e's --backend smolvm
and its section (about 1,130 lines), the smol_* helpers and the
link section's backend switch.
- Coverage: internal/backend/smolvm's lines in both baselines.
- Docs: backends/smolvm.md, internals/smolvm.md, design.md's smolvm
notes (Ports on Lima now holds the forwarder's description), the
backends table's smolvm column, every page naming smolvm, the README,
the home page's backends art, and AGENTS.md's smolvm rows and gotchas
(and the Docker bind-mount gotcha, which nothing refers to).
Kept: the docker layer, on Lima; --from's local Docker; --backend, the
BACKEND column and setup's backend choice, which the next commit removes.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
~/.config/devvm/config.toml is the defaults you write by hand: backend,
network, ports, features, agents, [size] cpus/memory/disk and
[retention]'s six keys. devvm reads it and never writes it, strictly: an
unknown key (toml.MetaData.Undecoded, its line found by key) or a value
its check refuses (ParseCPUs, ParseGiB, ParsePorts, ask/on/off, a
backend's name, image.FeatureName, image.Agents, ParseDuration,
ParseSize, counts) fails naming the file and the line.
~/.local/share/devvm/settings.json holds what devvm setup, size -g,
ports -g, network -g and retention save (unknown fields ignored).
internal/settings owns both: Defaults (Value and List, each with its
Source: flag, config.toml, settings.json or built-in), Read, Save, which
refuses a key config.toml sets (set_in_config, with a doc link), and
the parsers and retention settings that moved from vm and state. A flag
wins over config.toml, config.toml over settings.json, settings.json
over the built-in default. Settings methods lose their files; setup
uses vm.NetworkChoice instead of its own copy; creation.plan reads one
snapshot (firstRun) after the first-run questions; the registry gets
the default backend through DefaultBackend; state's featureName copy
goes with base-features.
devvm size -g, ports -g, network -g and retention show each value's
source after a #, and in --json (source, sources); devvm doctor names
the file that sets its backend (doctor_backend_from) and adds
backend_source. devvm setup skips what config.toml answers
(setup_in_config) and refuses a flag that would change it.
ssh_config (and so the ~/.ssh/config Include line), known_hosts,
agent-keys.json and secrets/ move to the data folder. agent-keys.json is
{"keys": [{file, fingerprint, confirm, lifetime}]}, parsed once
(AddedKey); Keys formats KeyList.
Tests: settings' table tests (every key, unknown keys, bad values, an
empty file, precedence, Save's refusal and merge, settings.json's
fields), agent-keys.json, the registry's default backend, setup with
config.toml, SizeChoice with config.toml; CLI scripts for size -g,
ports -g, network -g, retention, setup and doctor's sources, each
refusal, a hand-edited config.toml with a typo, and ssh -G resolving
devvm-web through the Include line. Docs: settings.md's config.toml
section with a full example, linked from each command's page.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
devvm takes no IMAGE word any more than any other: in a terminal a new VM's
toolchains, coding agents and layers are checked in one picker, under three
headings, before the network-policy question; --tools, --agents and
--layers (each an exact list, or none) skip it, and a part left out takes
its default: the detected toolchains, devvm setup's agents, no layers (a
devcontainer.json's features still count). Without a terminal, or with
--no-input, the VM gets the defaults and new_vm_gets says so in one line.
devvm setup --agents (and its first-run question) chooses new VMs' agents.
devvm tools in a terminal opens the same picker for the VM, its layers
fixed, and turns the changes into tools add and rm.
An image is base and layers only: tools are the VM's tool_names state key.
build, rebuild and images rm refuse a shared tool (tool_not_layer), and
devvm build builds no tool images. devvm ls gains a TOOLS column and
--json tools. gc's --tools is --tool-images, so --tools has one meaning.
Gone: image.Reserved, checkWord's image half (devvm WORD is no_command or
no_command_like, did-you-mean over commands, msg.Closest), the lacks path
in internal/vm/existing.go, and the messages vm_lacks_tools,
vm_lacks_layer, layer_is_command, layer_name_command, no_image_for,
no_command_or_image*, tools_not_images, tools_not_images_rm, detected,
vm_is_now (vm_tools_now), secret_with_image (secret_with_claude).
New: ui.Pick takes headed sections with fixed rows, ui.CanPick,
vm.PickPart/PickRow/AgentsChoice/CheckPart (internal/vm/parts.go),
state.KeyToolNames, state.ReadAgents/WriteAgents, paths.Dirs.Agents,
project.DetectFiles. Image keys are unchanged in form: images never held
tools; docker.sh's and nix.sh's comments changed, so those layers rebuild.
Docs: the home page's quick start steps, diagram (sandbox.svg), cards and
FAQ; README; getting started; using (images' What a new VM gets, coding
agents' Running an agent, settings' agents); internals; contributing;
the cli skill; AGENTS.md.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
DEVVM_HOST_MISE (which replaced the pinned, checksummed mise), DEVVM_KVM
and DEVVM_UBUNTU_URL were read in every build, a release's included. One
ldflag in a leaf package, internal/testbuild (testBuild=yes, set by
tests/e2e.sh and the CLI tests), now marks a test build, and cli's
readOverrides is the one place devvm reads every test override, into
Overrides (registry.Overrides, with platform.Overrides for the host's
size, and HostMise): empty unless testbuild.On(). registry.New takes
them; lima.New takes Ubuntu's URL; ubuntu.New takes a URL, not getenv;
Lima's and smolvm's KVM default to /dev/kvm; tools.Env has Mise in place
of reading DEVVM_HOST_MISE; platform.NewHost takes Overrides. Gone:
registry.unreviewed, registry.Host, newFor, hostFor, ubuntu.URLEnv. The
documented settings (DEVVM_LIMA_HOME, DEVVM_SECRET_SERVICE,
DEVVM_NO_TOOL_CHECK, DEVVM_FROM) stay as they are.
Tests: TestReleaseReadsNoOverrides (cli: a release reads none, its mise,
KVM, unreviewed and host its own), TestOverrides (registry: every override
reaches its backend, none leaves the defaults), TestHostOverrides and
TestListTimeout (platform) and ubuntu's TestNew moved to the new shapes.
Docs: contributing/testing.md's Test builds, contributing's sandbox table.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
devvm --help lists the commands in groups: Your VM, Change your VM,
Images, Disk space and This machine, with help under Cobra's Additional
Commands. A group whose commands don't exist yet, such as Links between
VMs, stays out of the help.
Each command's Long is one to three sentences, and the rules it held are
on the command's docs page. Every visible command has an Example, with
the most common invocations first, each with a comment. Flag
descriptions are shorter. Each help ends with the address of the
command's docs page, and the root's also ends with the issue tracker.
- internal/cli/help.go: commandGroups, addGroups, addDocs (Cobra's usage
template with Docs and Issues sections), examples
- internal/msg/docs.go: commandDocs, CommandDoc, CommandDocURL,
IssuesURL; TestDocLinks checks commandDocs (user pages only)
- docgen: each reference page has a Docs section before See also
- docs: commands.md in the help's groups, with new sections on
restarting and stopping and on deleting a VM; install.md has doctor's
engine, feature values, Docker and CA notes; Contributing describes a
command's help
- tests: TestExamples, TestHelpGroupsAndDocs, TestAddGroups,
TestWithDocs, TestCheckCommandDocs
Co-Authored-By: Claude Opus 5.5 <[email protected]>
devvm [IMAGE]'s flags for a new VM (--backend, --from, --cpus, --memory,
--disk, --ports, --network-policy, --no-network-policy) are the root's
own, so devvm ls --cpus 4 and devvm setup --cpus 2 fail as unknown
flags. build, rebuild and images rm take --backend and --from;
images, gc and space take --backend as a filter of their own (images
and space now filter: only that backend's rows); doctor takes
--backend; restart and tools take none. ports -g is local on ports,
ports add and ports rm. No command has a persistent flag.
One name, one meaning: network log --follow loses -f (-f is --force's,
and gc --force gains it); the hidden secret get's --force becomes
--to-terminal. Flag defaults name the setting command (devvm size -g,
devvm ports -g, devvm setup --backend); descriptions lose then/also
openings.
Special values are words: an empty flag value (flag_blank) or an empty
argument (arg_blank) is refused everywhere, replacing features_empty.
Durations: state.ParseDuration (a whole number and m, h, d or w) for gc
--older-than, retention's ages and ssh-agent add --lifetime (which also
takes forever, via sshagent.CheckLifetime), with one message,
bad_duration, replacing gc_bad_age and agent_lifetime_invalid.
Blanks are checked with the other usage errors (checkCommand, before
checkFlags), and an unknown --backend NAME is a usage error checked
first too (checkFlagValue, against registry.Names, which a test keeps
equal to the registry's own).
Tests: TestPersistentFlags, TestFlagNamesHaveOneMeaning,
TestUpFlagsAreUpsAlone, TestParseDuration, TestCheckLifetime; root,
setup, images, space, gc_history, retention, ssh_agent and network_log
scripts. Docs: commands.md (Flags and values), from.md, install.md,
images.md, space.md, settings.md, ssh.md, network pages; CLI reference.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Every argument and flag error is a devvm message naming what the command
expected, followed by usage_help naming that command's own --help, and
exits with 2. Arguments and flag values are checked in Args, before the
root's PersistentPreRun and any VM lookup.
- internal/cli/args.go: noArgs, exactArgs, maxArgs, minArgs (argsN, with
ValidArgs), argsOf (the arguments in Use), checkCommands (wraps every
command's Args with checkFlags and marks RunE's errors as ranError),
checkFlagValue (--cpus, --memory, --disk, --ports, --lifetime,
--older-than), exclusive (flag groups checked first, then Cobra's own
required flags and groups), flagError (SetFlagErrorFunc: pflag's
NotExist, ValueRequired, InvalidValue, InvalidSyntax errors).
- Execute: 0, 1 for a failure (RunE's error: a message, or
output_failed), 2 for a usage error; usage_error is only the fallback.
- Checked early: ports LIST and add/rm LIST (vm.ParsePortList), network
allow/deny RULEs, network on/off(/ask with -g), layer new NAME
(build.CheckLayerName), retention KEY=VALUE (state.CheckRetention),
setup --features '', secret NAME, completion SHELL, git-protect and
ssh-agent values.
- ui.UI.Error prints an error without ending the run (UI's method limit
44).
- Messages: usage_help, arg_missing, args_too_many, args_none,
arg_not_choice, no_subcommand, flag_unknown, flag_needs_value,
flag_bad_value, flag_bad_switch, flags_exclusive, output_failed;
usage_error reworded; doc links to troubleshooting.
- Tests: TestUsageErrorsEveryCommand, TestRanErrorIsAFailure, TestArgsOf,
TestFlagErrors; txtars check message names; e2e checks a bad port list
exits 2.
- Docs: troubleshooting (a command refused before it runs, exit codes),
contributing (command arguments), AGENTS.md.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
- devvm retention [KEY=VALUE...] shows every retention setting (off when
unset) and changes them; KEY=off turns one off, KEY= is refused and
nothing is written. devvm space only shows.
- devvm secret lists the secrets; devvm secret set claude saves the
Claude Code token. No auth or secret ls commands.
- Bare devvm ssh-agent shows the VM's forwarding, then devvm's own
agent's keys once one is added (it starts no agent without one).
devvm ssh-agent rm KEY_FILE takes a key out of devvm's agent, found by
its recorded fingerprint, and out of ~/.config/devvm/agent-keys; the
key file isn't touched, and a key not added is refused.
- devvm setup's flags are --backend and --features LIST|none ('' is
refused). In a terminal it also asks for new VMs' network policy (ask,
on, off), saved in ~/.config/devvm/network (Dirs.Network), which new
VMs read unless --network-policy or --no-network-policy is given.
Messages: features_empty, network_default, network_default_help,
network_default_ask/on/off, agent_key_not_recorded, agent_unload_failed,
agent_key_removed, retention_settings_failed; retention_unreadable,
agent_devvm_risk, no_claude_token and claude_token_invalid name the new
commands. paths: Dirs.Network (the structure test's Dirs limit is 42).
state: ReadNetwork, WriteNetwork, NetworkChoices, NetworkAsk/On/Off,
RetainOff. sshagent: Agent.Remove. Tests: TestNetwork, TestChooseNetSaved,
TestSetupNetworkStartsFromSaved, TestKeysNone, TestRemove, the real-agent
rm check; retention, setup, secret, ssh_agent and nix_cache scripts; e2e
checks for ssh-agent rm and retention.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The CLI tests read the real host's CPUs, memory and free disk, so they
failed on GitHub's small ubuntu-latest runner (2 vCPUs, 7 GiB, ~10.8 GiB
free) and passed on larger machines.
internal/platform: Host (CPUs, Memory, FreeSpace) is the only way to read
them; the raw reads are unexported (memory, freeSpace). NewHost(test,
getenv) gives a test build's Host, which reads DEVVM_TEST_CPUS,
DEVVM_TEST_MEMORY_GIB and DEVVM_TEST_FREE_GIB (platform.TestCPUs,
TestMemoryGiB, TestFreeGiB) in place of the host's; an unset one leaves
the host's, a bad GiB value is an error. The zero Host reads the host.
The gate is registry.unreviewed, the same -ldflags -X variable as
DEVVM_UNREVIEWED: registry.Host() and newFor pass build == "allowed" into
NewHost, so platform has no package var. backend.Registry gets a Host
field; lima.New, smolvm.New and tools.New take a platform.Host;
vm.ThisHost takes one; vm.NewEnv, doctor, setup, build and
_refresh-tools read the registry's (or registry.Host()). Docker reads
only its engine's NCPU and MemTotal and checks no host free space, so it
has no host reads to route.
forbidigo bans runtime.NumCPU, unix/syscall Statfs, Fstatfs, Sysinfo and
unix.SysctlUint64 outside internal/platform.
script_test.go sets a large host in every script (8 CPUs, 16 GiB, 500
GiB free). small_host.txtar sets 2 CPUs, 7 GiB and 1 GiB free and checks
doctor's disk_low_warning, host_memory_low and host_cpus_few, disk_low on
a build, base_fitted with Lima's --cpus=2 --memory=3.5 and smolvm's --cpus
2 --mem 3584, too_many_cpus have=2 and too_much_memory have=7 max=5. The
host-relative regexes in build, from, setup, size, up_size and smolvm
are now the fake host's exact values.
Docs: contributing/testing.md's "A host of any size" (the overrides, that
only test builds read them, the large host script_test.go sets, how a
script asks for a small one, what stays the Linux CI job's), and the
sandbox table in contributing/_index.md.
Review: GoReleaser's ldflags (both builds) and the Homebrew formula set
only cli.version, linuxURL and linuxSHA256, never registry.unreviewed, so
release binaries ignore the overrides (TestReleaseHostIgnoresOverrides;
a release build checked by hand ignored DEVVM_TEST_CPUS=1,
DEVVM_TEST_MEMORY_GIB=1 and DEVVM_TEST_FREE_GIB=0.5 in doctor and size
while the test build honoured them). No caller outside internal/platform
reads runtime.NumCPU, memory or statfs (grep, and the forbidigo rule
checked against a probe file).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The first run, in a terminal, before base's features are first chosen,
asks for the CPUs and memory new VMs get, when no default size is saved
and neither --cpus nor --memory is given; devvm setup asks after the
backend and features, and --cpus/--memory choose without asking (with
only them, the backend and features stay). Each question starts from the
saved size, else base.yaml's fitted to this machine (FitCPUs/FitMemory);
Enter keeps it, a value Size.Check refuses is warned and asked again.
Only typed values are saved, in the size file devvm size -g writes
(a saved disk kept); keeping both writes nothing. Without a terminal
nothing is asked.
- internal/vm/sizechoice.go: SizeChoice (Ask, Set, Fitted), writeDefaultSize,
creation.firstRunSize; SetSize -g uses SizeChoice.Set
- internal/vm/size.go: baseSetting (BaseDisk on it), readDefaultSize
- internal/vm/env.go: Env.Answer and Env.Interactive (stdin and stdout
terminals); vm.UI gains Answer and StdoutIsTerminal
- internal/vm/up.go: plan asks before reading the default size
- internal/ui: UI.Answer, a line prompt; largeTypes allows UI 41 methods
- internal/cli/setup.go: setupChoice, --cpus/--memory, saveBackend,
saveFeatures; Short/Long updated
- messages: size_question, size_cpus_prompt, size_memory_prompt
(refusals reuse too_many_cpus, too_much_memory, cpus_not_number;
size_defaults after saving)
- tests: TestSizeChoiceAsk, TestSizeChoiceSet, TestFirstRunSize, setup's
size prompts; setup.txtar (--cpus/--memory, refusals, no terminal),
up_size.txtar (first run without a terminal)
- docs: first-vm (paragraph, diagram), ports-size (Choosing new VMs'
size), customizing, backends, settings; CLI reference regenerated
Co-Authored-By: Claude Opus 5.5 <[email protected]>
build.Env holds what images on one backend are built with (folders,
assets, backend, review, shared tools, --from, UI hooks) and what the
groups share: image keys and chains, the user's layers, the features
there are and those chosen, base's C library, deleting an image. Builds,
Images and Choice each embed it:
- Builds: building an image and those under it, rebuilding one, warning
when a VM's image is outdated.
- Images: the backend's images with their records, listing and deleting
them.
- Choice: asking which features base gets, or setting them.
cli and vm hold a *build.Env and name the group they use
(build.Builds{Env: b}.Build, build.Images{Env: b}.Delete,
build.Choice{Env: b}.PickFeatures); images' listing keeps each backend's
Images for gc. internal/build.Builder leaves the structure test's
largeTypes.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
devvm is one file: assets/ (base.yaml, layers/, features/,
shared-tools/, guest/, oci/, smolvm/) is embedded as assets.FS, which
cli passes to every constructor; backends, the builder, the shared
tools, the proxy and Ubuntu's key check read it as an fs.FS. Scripts
reach VMs on stdin (backend.Script carries their contents). What needs
a path (limactl create's base.yaml, oci/ mounted into the conversion
VM, the proxies' policy files) is written out to
~/.local/share/devvm/assets/<hash>, atomically, files 600 and folders
700; devvm gc deletes older copies no VM's proxy was started with
(gc_assets, deleted_assets). Release archives hold the binary with
README.md, CHANGELOG.md and LICENSE, and the formula installs the
binary alone.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
internal/backend/registry builds the registry of every backend devvm
has: registry.New(dirs, u) returns the *backend.Registry, and
registry.Experimental names the experimental ones. Test builds set
registry.unreviewed with -ldflags -X (tests/e2e.sh, the CLI tests,
testing.md). The unexported constructor for a given build and
DEVVM_UNREVIEWED is newFor.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
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]>
Packages other than cli and ui take what they print and ask as fields,
set to ui's by their constructors or by cli:
- vm.Env: Info, Warn, Note, Say, Ask, Confirm, PickFeatures (cli sets
PickFeatures); AgentMounts, UpdateAgentDirs, warnIgnored, applyAgent,
applySize, applyPorts, removeRemote and saveFetched are Env methods
- build.Builder: Info, Warn, Say, Confirm, Pick (build.Feature); cli's
newBuilder sets them, its pickFeatures asks through ui.Pick
- netpolicy.Proxy: Note, Warn, Ask, Confirm; Choose, SelfCheck and
Unproxied are Proxy methods
- sshconfig.Config: Info, Warn, Say, Confirm
- secrets.Store: Warn; LoginKept takes the warn function
Tests set the fields and check messages through them. AGENTS.md: only
cli calls ui's messages and prompts.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
In a terminal, devvm setup with neither --backend nor --features asks
for the default backend, then base's features. --backend chooses it
without asking; --features alone, or no terminal, doesn't ask.
- ui.PickOne: a single-choice picker in Pick's style ("( )"/"(*)",
up/down or k/j move the choice, enter confirms), starting from the
choice that's on; Pick and PickOne share pick/pickLoop.
- backends.Experimental: smolvm is marked experimental in the picker.
- setup: pickBackend starts from the current default (lima unless set,
or set to a backend devvm doesn't have); setupTerminal and pickOne
are test seams.
- Messages: backend_help, backend_experimental.
- Tests: TestPickOneKeys, TestPickOneWithoutTerminal,
TestSetupAsksForTheBackend (terminal, current default, unknown
default, no terminal, --backend, --features); setup.txtar checks no
backend is asked or saved without a terminal or with --features.
- Docs: backends.md (setting the default), customizing.md, the CLI
reference; AGENTS.md's pending line removed.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
devvm setup asks which features base gets, starting from the current
choice (every feature until there's one; kept without a terminal), or
takes them from --features LIST without asking ('' for none), saved in
the features' run order. A name that isn't a feature is no_feature and
saves nothing. --backend NAME saves the default backend new VMs get
(~/.config/devvm/backend, read by the registry), checked against the
backends devvm has; alone, it leaves the features as they are.
A changed choice prints base_will_rebuild, and gc_old_hint once any
image record exists. base_features and base_features_none name devvm
setup. --features completes feature names, setup's --backend backend
names.
- build: PickFeatures, SetFeatures (the first build's choice goes
through PickFeatures)
- state: AnyImage
- messages: no_feature, base_will_rebuild, gc_old_hint,
default_backend, setup_failed
- tests: setup.txtar, completion.txtar; TestPickFeatures,
TestSetFeatures, TestAnyImage
- docs: customizing.md (choosing features), backends.md (choosing a
backend), the CLI reference
Co-Authored-By: Claude Opus 5.5 <[email protected]>