--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]>
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]>
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]>
A recording keeps a packages/<sha>.deb already in the cache only when
its SHA-256 and size still match; a changed one is replaced with the
build's copy, and the run log notes it (build.Env's LogWriter, set from
the UI's).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
backend.Check(ctx, b) returns the first of a backend's Problems, in place
of Check in the Backend interface (Lima's and the fake's go).
ImageSpec.Validate and ToolsSpec.Validate hold the build specs' checks
Lima made itself: a layer from a container image, a network that isn't a
build's, a key that isn't one, a tools format other than the backend's,
folders that aren't absolute. ToolsSpec gets Name, what it builds, for
the refusal's vm.
The registry hands out each backend behind a guard: CreateVM, Start,
BuildImage and BuildTools run the spec's Validate and the review's
refusal for spec.Features() (VMSpec's, Want's and Confinement's,
ImageSpec's, ToolsSpec's) before the backend sees them, without a second
warning for an unreviewed emulation let through. Callers' own Require
calls stay as the clear error path; the guard is the backstop.
Want.Features is new; VMSpec.Features uses it and adds agent-toggle when
the VM is made ready for it. backend.As finds a backend's other
interfaces behind the guard (KeyFiles, Storage, Locator, Forgetter,
UsageReporter, StrayFinder, CacheCleaner).
Structure test: execSites lists the 17 files whose 24 exec.Command*
calls stay, each with why (they make a command a runner runs, or one
that streams, asks on the terminal, outlives the run or carries a
secret); a host command made anywhere else fails, as does a listed file
making none. guardOwner: a type assertion or type switch to a backend
package's type outside guard.go fails (use backend.As). TestRulesFail
cases for both.
Tests: TestCheck, TestImageSpecValidate, TestToolsSpecValidate,
TestGuardRefuses, TestGuardLetsThrough, TestAs; TestFeaturesNeeded
gains Want's and agent-toggle; Lima's refuse cases for what Validate
owns move to the backend package.
Docs: internals/backends.md (the guard behind the first check);
contributing's How a backend plugs in (Check, the guard, Validate, As),
the structure test's execSites and guardOwner, and the owners table.
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]>
The data and config folders each hold a version file (state.Layout, 1).
state.CheckLayout runs before every command but help, completion,
version and devvm's hidden commands, under version.lock: the same
version goes on, a missing file gets this devvm's, an older one runs
the migrations in order (migrations(), empty now), and a newer one in
either folder refuses with layout_newer; a file that isn't a version
fails with layout_unchecked.
made_by, devvm's version, is in vm.json's core fields (set when the VM
is made, kept by later changes), image records and tool image records.
It's passed from cli's devvmVersion through vm.NewEnv, tools.New and
build.Env.Version.
testdata/script/layout.txtar makes two network-policy VMs with a
forwarded port, a link and a secret, and compares every path under the
data and config folders with checked-in listings (macOS and Linux).
devvm doctor warns about entries in vms/ that aren't VM folders
(vms_stray) and VM folders without vm.json (vm_folder_stateless),
changing nothing.
Tests: TestMigrations, TestCheckLayout, TestCheckLayoutMigrationFails,
TestVMFolderProblems, TestSkipsLayout; made_by checks in TestVMRoundTrip,
TestImage, TestToolImage, TestUp, the build and tools tests and scripts;
doctor's unit test and script. Docs: internals/overview (the layout
version, made_by), using/space, using/settings, using/troubleshooting,
internals/images, Contributing (changing the state layout).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A VM's state is vms/<hash>/vm.json: core fields (version, id, name,
alias, image, chain, from, dir, folder, backend, backend_at, created)
and one section per package, each a json.RawMessage its owner decodes
into its own type (state.Section, state.SetSection), what was asked for
at its top level and what devvm made under "made":
net (netpolicy), git (gitprotect), ports (the new internal/ports),
agent (sshagent), tools (tools), secrets (secrets), and size, clone,
devcontainer, desktop and links (vm, internal/vm/state.go).
- state.VM.Update takes vms/<hash>/lock (platform.LockFile), reads the
file again, applies a change and writes it once; a failed change, or
write, writes nothing. VM.Set and its calls are gone; read-modify-write
of lists (links, publish, secrets, tools, size, ports) happens inside
Update. VM.Claim also holds run/claims.lock, after the VM's own;
VM.Create writes a new VM's whole record once, its alias chosen
(sshconfig.ChooseAlias) under the claims lock. Reads take no lock.
- created replaces "net unset" as unfinished (VM.Finished).
- internal/ports: the ports section (forward, host.ssh/proxy/desktop),
ports.Used (was netpolicy.UsedPorts), and one Allocator for ssh, proxy
and desktop ports under the claims lock (desktop allocated without
one before; run/ports.lock and netpolicy's own ports key are gone).
- gitprotect: mode recorded before the backend makes the VM (NewMode;
clone for --clone, which ls and git-protect share as gitprotect.Mode);
made.git_id (platform.FolderID), one git_dirs list for modules and
embedded git dirs, delegations, protected; Unlock takes the union of
recorded and current git dirs.
- links' entries, git dirs, tools and devcontainer commands are JSON
lists, not strings in values; the key=value parser is gone.
- vm.checkState reads every section of the folder's VM as it's found.
- registry.For drops its unused Dirs.
- Tests: TestVMRoundTrip, TestVMOtherName, TestVMID, TestVMUpdate,
TestVMUpdateTogether (two writers on one VM and on crossed VMs),
TestVMClaim, TestVMFailures, TestVMCorrupt, TestChooseAliasTogether,
TestUsed, TestSSH, TestChooseTogether, TestUnlockRecorded,
TestCheckState, TestChangesTogether, TestChangesAtOnce; testscript's
vm_state, json_set with dotted and := keys; e2e's vm_state/vm_set.
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]>
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]>
A global --no-input (persistent on the root, with --help and -v): no
question is asked or read. The ui's prompts (Ask, Confirm, Answer,
Secret, Pick/PickOne in a terminal) show the question, then fail with
no_input naming what answers it (msg.AnswerFor, by the question's ID),
or no_input_terminal for a question only a terminal answers. ui.Flags
and SetFlags carry -v and --no-input.
Answers: --network-policy/--no-network-policy, --here, devvm size -g,
devvm setup --features/--backend, devvm network -g, devvm ssh-agent add,
devvm restart, --ssh-config (new, on devvm, host and code: the Include
line without asking; sshconfig.Config.AddInclude, vm.Env.AddInclude),
--stdin, and --force.
--force (-f) only skips a confirmation, and destructive commands need it
without a terminal (force_needed, a failure, not a usage error): rm (new
rm_confirm), gc (it went ahead without a terminal), gc --caches (now
allowed without a terminal with --force), images rm (images_rm_confirm),
secret rm (secret_rm_confirm), adopt (adopt_vm), rebuild when images
are built on the one rebuilt (build.Env.Force). rm --no-export skips the
export; rm's parent-folder, earlier-folder and --clone confirmations are
terminal-only and --force never answers them (vm.RmOptions). gc --tools
--force splits: --recent (only with --tools, gc_recent_needs_tools)
drops the hour's hold and keeps the refusal while a VM is being made
(gc_recent_making); gc_tools_recent names devvm gc --tools --recent.
gc_caches_need_terminal goes.
Tests: TestNoInput, TestAnswers, TestConfirmed, TestRmConfirms, TestAdopt
(--force), TestRebuild (force_needed, then Force); secret, rebuild,
images, gc*, clone, subfolder, existing scripts. e2e: rm/gc/images
rm/secret rm/rebuild with --force (and --no-export where rm -f skipped
the export), and the clone section's rm with its checks. Docs:
commands.md (Questions devvm asks, rm, flags), first-vm, clone, images
(cleaning up, --recent), space, coding-agents, internals overview and
images; CLI reference.
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]>
nix is a layer devvm ships, as docker is: devvm nix, devvm node+nix, devvm
build nix, or added to an existing VM in place. A folder with flake.nix,
shell.nix or devenv.nix at its top level, or a default.nix that makes a
shell (mkShell), gets it after its toolchains, so package.json and flake.nix
give node+nix.
- assets/layers/nix.sh: Nix 2.35.4's release tarball (releases.nixos.org),
its version and SHA-256 per arch at the top, checked against the
tarball's .sha256 files and nixos.org/nix/install, fetched with
devvm-fetch; 2.35.3 fixes GHSA-hf6w-2rg9-v84g (store ownership in the
scripted installer) and CVE-2026-110450 (store corruption through the
daemon's repair flag). The tarball's own install --daemon --yes
--no-channel-add, with experimental-features = nix-command flakes,
trusted-users = root, sandbox = true and sandbox-fallback = false. The
installer runs without proxy variables (it writes any it finds into a
systemd override for nix-daemon, which would put a build's proxy into
the image) and with NIX_SSL_CERT_FILE at the system's bundle. The layer
checks the store is root's, adds Nix's default profile to the end of
sudo's secure_path (/etc/sudoers.d/devvm-nix, checked with visudo), and
appends Nix's profiles to BASH_ENV's PATH. direnv 2.38.2 (per arch) and
nix-direnv 3.2.0's direnvrc, pinned the same way; direnv's hook in
~/.bashrc.d/direnv.sh, which loads before mise.sh so direnv's prompt hook
runs after mise's and a dev shell's PATH comes first; a direnv lib file
puts each project's layout under ~/.cache/direnv/layouts, so nix-direnv
writes no .direnv into the project folder. Without systemd the script
refuses in one line.
- assets/layers/nix.policy: cache.nixos.org, channels.nixos.org,
releases.nixos.org (GitHub is in base.policy).
- assets/guest/sync.sh: nix-daemon gets a systemd drop-in with the VM's
proxy (http_proxy, https_proxy, no_proxy) under network policy, removed
when it's off, the daemon restarted when it changed.
- image.NixLayer in Builtins; project.Detect's nix marker (a default.nix is
read only as a regular file, at most 64 KiB); backend.FeatureNixLayer
(nix-layer), needed by a VM of an image with the layer and by building
one: Lima native, smolvm and Docker none, so both refuse in one line
(backend_lacks); dockerLayers.choice returns every layer feature of the
image, so docker+nix on Docker needs nix-layer too.
- scripts/bump.sh: nix (the version nixos.org's installer names, the
sums Nix publishes; it fails when the installer names no tarball, as
Nix's Rust installer will), direnv, nix-direnv.
- Docs: using/images (built-in layers, detection), using/toolchains (Nix
projects), safety/network (the layer's hosts; source builds' hosts
blocked), internals/images (the nix layer), internals/network (the
daemons' drop-ins), internals/backends (nix-layer), internals/design
(the nix layer beside Instead of Nix), backends, customizing,
coding-agents, contributing (the e2e section); the CLI reference;
AGENTS.md's assets/ and e2e lines.
- Tests: Detect (markers, default.nix with and without a shell, a linked
one), layer and environment lists, layer new nix reserved, nix-layer in
ImageSpec and ImageFeatures, caps tests, up_checks.txtar (node+nix
detected under an agent), docker.txtar (nix refused for a VM and a
build). e2e nix section: the layer built behind a company proxy leaves
no proxy settings and no password on its image's disk; a node+nix flake
VM with network policy: pins, a root-owned store, sandbox without
fallback, trusted-users root and an untrusted substituter ignored, the
daemon's drop-in, nix run nixpkgs#hello, sudo nix and nix over ssh, the
flake's node ahead of the shared node prompt after prompt through
direnv, no .direnv in the folder, a blocked fixed-output fetch named by
devvm-why, and the drop-in gone after network off.
Review (security-audit skill, guidance mode, against the review task's
list): the tarball and direnv's files are pinned in devvm's source and
checked before tar or install runs; nothing from the host goes into the
image (no proxy override, e2e greps the disk); the drop-in holds only the
VM's own proxy URL, devvm's value, and goes when policy is off;
trusted-users stays root and an untrusted user's substituters are
ignored (the VM's user has sudo, so that guards an honest VM and the
allowlist is what holds); secure_path gains only the root-owned default
profile, last; /nix is on the VM's own disk and nothing mounts a host's
or another VM's store. Found and fixed in review: Nix's default
sandbox-fallback would build unsandboxed without a word where the kernel
can't sandbox, so it's off. No confirmed findings.
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]>
- platform.FreeSpace: statfs (Bavail * Bsize) on darwin and linux, the
nearest existing folder for one not made yet; ErrUnsupported elsewhere
- backend.Storage (DiskDirs: Lima's home; smolvm's folder, and HOME on
macOS; Docker none), backend.Space Check and Warning, floors FreeBase
12 GiB, FreeImage 8, FreeTools 8, FreeVM 4, each commented with its
measurement
- builds (base, other images), shared tool builds (also the data folder)
and new VMs refuse below their floor before anything is made
(disk_low); statfs errors carry their cause (disk_free_unknown); doctor
warns below base's floor without failing (disk_low_warning)
- FreeSpace fields on build.Env, tools.Env and vm.Env; structure limits
Lima 67, smolvm 72 for DiskDirs
- docs: ports-size Free space, troubleshooting Not enough free space,
install requirements, docker, smolvm, design's open work; doctor's help
- tests: backend Space, build, tools, up, smolvm DiskDirs, platform
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Docker is a layer devvm ships, docker, chosen per VM like any layer
(devvm node+docker, devvm build docker) and added to an existing VM in
place. base installs no Docker.
- Built-in layers: image.Builtins (docker) and IsBuiltin; a name is
looked up in devvm's assets/layers first, so a user's docker.sh is never
read; devvm layer new docker is refused (layer_name_reserved); an
image's key hashes the shipped script (own file, must exist); Layers,
Environments, completion and unknown_layer/no_image_for list it;
Env.LayerData reads either kind's script.
- assets/layers/docker.sh: Docker's apt repository (pinned key, pinned
package versions; Alpine's own packages, rc-update, the docker group),
the daemon started now too (OpenRC, or with no init system as
services.sh does) for a VM it's added to in place. scripts/bump.sh's
docker pins read it.
- assets/layers/docker.policy: Docker's packages and the registries,
applied to VMs with the layer (netpolicy.PolicyFiles); base.policy
keeps OS packages (Alpine's too), mise and GitHub.
- Adding layers in place sets the new image in the VM's state before
their scripts run, so a network-policy VM's proxy allows their hosts;
a failing script sets it back.
- smolvm's sshd.sh keeps the snapshot's package lists, for layers'
apt-get install.
- Docs: images (base, built-in layers, keys), customizing, commands,
network, smolvm, from, install, maintaining, design, coding-agents,
contributing; the CLI reference; AGENTS.md's assets/ line.
- Tests: key, layers, build, policy files, in-place add (devvm's script,
image during the run, set back on failure), layer new docker; e2e:
a base VM has no Docker (Lima, smolvm), the docker layer on Debian 12
and Alpine (from), and smolvm's network-policy VM is a docker VM whose
Docker pulls through the proxy.
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]>
tools.Env holds what the shared tools run with (folders, assets, host,
HTTP client, UI hooks) and what the groups share: the platforms, devvm's
mise.toml, a tool's image file and the share's lock. Versions, Share and
VMs each embed it:
- Versions: the tools lock, resolving it with the host's mise, the daily
check and refresh, the image files of an image name's tools.
- Share: building, listing and deleting the share's tool images.
- VMs: newer tools than a VM's, and moving a VM to them.
vm.Env and build.Builder hold a *tools.Env; callers name the group they
use (tools.Versions{Env: e.Tools}.Files, tools.Share{Env: b.Tools}.List).
internal/tools.Tools 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]>
msg.M.Because(err) returns the message carrying err, and Unwrap returns
it, so errors.Is and errors.As see through a message to its cause. The
text stays the message's own.
Messages made from an error carry it: proxy_failed (secrets and the
proxy command), login_copy_failed, run_log_failed and fail's fallback
message. TestBecause covers errors.Is and errors.As through a message,
through %w wrapping, and through a message in a message.
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]>
--from IMAGE (default $DEVVM_FROM) starts base from a Debian-, Ubuntu-
or Alpine-based container image instead of Ubuntu's cloud image, for new
VMs, build and rebuild. base is keyed by the image's digest, looked up
once per build and recorded per reference; existing VMs keep their own
(from_ignored).
- internal/from: ParseRef (registry_ref, with a fuzz target), Valid/
Check (bad_from), Pinned, Name, Recorded (from_digest), Registry.Digest
(manifest HEAD, anonymous Bearer token from an https realm only,
timeouts, size caps, retries; ErrUnreachable/ErrNotFound), Lookup.Refresh
(refresh_from_digest: registry, else Docker's ID, else the recorded
digest with a warning), DockerID, DockerRunning.
- build.Builder: From and Lookup; Inputs/Key/Chain with the recorded
digest; spec.From for base; records keep from and digest on every image
above a --from base; rebuild counters per from; building_image_from.
- lima: convert (oci_base): devvm-oci-build from Ubuntu's image with only
<tmp>/vm (rw) and oci/ (ro) mounted, confined to the internet, runs
oci/build.sh; docker save plus exportIs for images only Docker has;
checkConverted (regular files, gnu/musl, cmdline charset, raw ext4);
base created with --set .images (disk, kernel, cmdline, initrd); the
temp folder, build VM and the OCI build lock (lockOCI, pid, stale
takeover, oci_waiting) go however the run ends.
- cli/vm: global --from flag, state from=, builders with the VM's from in
open, update, remove.
- Messages: building_image_from, bad_from, from_ignored, from_unreachable,
from_not_found, from_cached_unreachable, from_cached_not_found,
no_digest, docker_only, exporting_docker, docker_export_failed,
docker_image_changed, oci_waiting, converting_in_vm, converting,
convert_failed, convert_bad_output; doc links to from.md.
- Copied: oci/ (build.sh and README edited: comment, docs link),
testdata/stubs/docker; limactl stub gains oci/build.sh outputs and
interrupt-on.
- Converted: from.bats (registry_ref, registry_digest token, 1/2,
https realm, refresh per tag, Docker-only, offline, no Docker, pinned,
moved tag, cached keys, build flow, docker save, Ctrl+C, steps, failures,
bad outputs, record, export check, lock) as Go tests and from.txtar;
oci.bats (libc_for, missing architecture, crane pins) as oci.txtar;
cli.bats --from parse_args and project.bats --from input checks.
- e2e: from section (--from tier, or --only from): node:24 Debian 12
node+python+claude, alpine:3 musl tools and Docker on OpenRC, base from
ubuntu:26.04, no Docker needed. Left out: features, an image only Docker
has.
- Docs: from.md; images, commands, lima, contributing, index; CLI
reference.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The toolchains and agents an image name holds (node, python, rust, go,
claude, codex, opencode) are shared tools: resolved per user into the
tools lock by devvm's pinned, checksummed mise, built once into
read-only EROFS images in a throwaway VM from base, and mounted into
every VM that names them. The lock is checked again daily, in the
background through devvm _refresh-tools, and before a new VM when due.
Copies tools/ and guest/tools.sh, and the shared tools part of
guest/sync.sh, which a new VM runs once it starts. e2e gains a tools
section.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
devvm [IMAGE] in a folder creates its VM: the folder checked (its path,
unsafe folders, a folder made again), its size and ports, the image
named or detected and built, cloned with only the folder mounted, its
state, .git hooks and config locked (macOS), started, then the backend's
shell in place of devvm. Network policy isn't there yet, so a VM is
created only with --no-network-policy; an existing VM is refused for
now. Ctrl+C before the first shell deletes the VM and unlocks .git.
Global flags: --backend, --network-policy/--no-network-policy, --cpus,
--memory, --disk, --ports; up's own --unsafe-folder, --no-git-protect.
tests/e2e.sh gains a project section, with Lima's Exec quoting checked
on a real VM. New docs: commands, security model, .git protection.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
devvm build and devvm rebuild build base and the user's layers through
Backend.BuildImage. On Lima an image is a stopped instance: base from
Ubuntu's cloud image with base.yaml, a layer a clone of its parent, each
started confined with no host mounts, its script run, then stopped. Records
are written last; an interrupted or failed build deletes its instance
through the cleanup stack. Rebuild bumps the rebuild counter and deletes
stale images no VM uses.
tests/e2e.sh starts here, with its framework and an images section.
Co-Authored-By: Claude Opus 5.5 <[email protected]>