vmname.VM is the name of every machine devvm runs on a backend: a
project VM, an image's machine (devvm-img-<key>), a build VM and a
remake's aside. Fields, parameters, results and map keys that held a VM's
name as a string now hold a VM, from the backend interface down to the
CLI's --json structs, whose output is byte for byte the same.
Boundary parsers, the only places a string becomes a VM:
- vmname.Parse: a project VM's name (state's vm.json name, export file
names, devvm _links's argument, the forwarder's -vm, project.Nth)
- vmname.ParseListed: one path element, for what a backend lists
- VM.UnmarshalText: JSON (Lima's list, proxy config and events, links'
targets in state, link lists); empty stays no VM
- vmname.Image(key), VM.Aside(), and typed constants for Lima's build VMs
- msg.M.VM: the VM a message's function took, read back
vmname's functions on names became methods (Hash, Slug, Short, Aside,
AsideHash, ImageKey, IsProject); Lima's image prefix moved to vmname;
vmname.Join joins VM lists. Messages' vm and vm_name fields are typed
by the generator. Seven messages whose field took something else became
what= (backend_lacks, backend_unreviewed, backend_unreviewed_used,
starting, deleting, configuring, running_script) and rm_vm_failed's
name=: the text is unchanged, the names-mode scripts follow.
Review.RequireFor names an image or the tools being built.
Typed sites per package (added lines with vmname.VM, non-test): msg 347
(generated), vm 124, lima 48, backendtest 32, vmssh 31, netpolicy 22,
backend 16, gitprotect 14, proxy 11, cli 11, project 10, state 8,
ports 6, paths 3, sshagent 2, sshconfig 2, tools 2.
The structure test's owners rule now fails on a field, parameter or
result named for a VM (vm, vms, otherVM, vmName) typed string, []string
or map[string]…, and on converting anything but a literal to vmname.VM
outside the files it lists; internal/stubtest is free. depguard holds
internal/vmname to the standard library, and the proxy may import it.
ParseListed and UnmarshalText refuse a name starting with -, which would read as a flag in limactl's argv, and vmname.Image refuses a key that's empty, holds a / or NUL, or makes a project VM's name, so Lima's ImageSize and DeleteImage no longer check it themselves. The check also fails on a *string VM name and an alias of vmname.VM, and says what it doesn't see.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Linux build VMs' ssh ports were Lima's own pick, outside the claims
lock, so another VM's forwarder could take one before Lima bound it.
Lima's start now gets every build VM's port from ports.Allocator.Build
on macOS and Linux alike, and sets it with its one edit.
- start.go: the l.OS == "darwin" condition goes.
- build.go, tools.go: cloneEdits goes; a build VM's start always edits
its new ssh port, so the configure step is always counted.
- ports.Allocator.Build holds a file lock on run/build-ports/<name>
(platform.LockFile) until release, so the kernel lets go of it when
devvm ends, killed or not. free, under the claims lock, first deletes
(clearStale) the records no process holds that are over 15 minutes
old (staleAfter: longer than Lima's 10 minutes of waiting for ssh,
which a killed devvm's limactl start may still spend binding it).
Tests: TestBuild (a stale record kept while young, then cleared; a held
one kept however old), TestStartBuildSSHPort on darwin and linux,
TestStartConfined's Linux builds, TestBuildImageLayer, TestBuildTools;
TestCloneEdits goes. build.txtar checks the build's port edit and that
its record is gone; tools.txtar's steps are one count on both systems;
layout.txtar lists run/build-ports on Linux. The limactl stub needed no
change: it applies .ssh.localPort on every host, and the contract's
scenario already starts builds with a port.
Docs: internals/design (reserved ports; the build VM's ssh port lead is
now confirmed, fixed), internals/overview, using/space.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
devvm reads base's features only from its own files (assets/features):
~/.config/devvm/features is no longer a folder devvm knows. An extra of
your own for every new VM is a layer of yours (devvm layer new), chosen
with devvm setup --layers, which each VM's list can uncheck.
- build: Features returns devvm's features alone; featureStep gives each
its prelude; FeatureScript, the shadowing check and its
feature_shadowed warning are gone. A chosen name devvm has no script
for is skipped with unknown_feature, as before.
- paths: Dirs.Features is gone.
- Tests: TestFeatures, TestOwnFeatures, TestPickFeatures,
TestSetFeatures, TestBuildRunsFeatures and the key tests use devvm's
features only and check that a script in ~/.config/devvm/features is
neither a feature nor in any key; features.txtar likewise.
- Docs: customizing's Extras of your own (a layer chosen in devvm
setup), settings, install, space, overview, internals/images and the
landing page drop the user features folder.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
base's apt packages are no longer pinned by a snapshot. A key's first
build of base records them: assets/layers/apt.sh (a recipe step, as
root, before base.sh and after the last feature) points the image's
sources at an apt mirror+file: list of config.toml's ubuntu-mirror and
then Ubuntu's own archive, so apt checks everything against the archive
key whichever server answers, and keeps what it downloads. At the end it
gives back each package with apt's entry for it. devvm checks what comes
back (regular files only, each named by its own SHA-256, each entry
matching a file's size and SHA-256, nothing left over, at most 20,000
entries and 16 GiB), keeps the files in
~/.local/share/devvm/packages/<sha256>.deb and the key's set in
packages/sets/<key>.json, before the image's record. Every later build of
that key replays the set from the cache, checked on the host first, with
apt given only those files: no network for base's packages, and a key's
packages never change. A --from base keeps its image's own sources,
unpinned. base keeps no package lists, so each layer's recipe starts
with apt.sh lists, which fetches them when there are none.
- backend.ImageSpec.Packages (Send before the steps, Take after) and
backend.PackagesDir; Lima runs both over limactl shell as root.
- Fail fast: apt.sh turns apt's retries off and exits 75 when no source
answers, which Lima reports as build_sources_unreachable.
- packages_missing refuses a replay whose cached file is gone or changed;
packages_refused what a build gives back that isn't packages.
- config.toml's ubuntu-mirror (settings.UbuntuMirror), checked as an
http(s) address without a user, query or spaces (ubuntu_mirror_invalid).
- devvm gc deletes the sets of keys neither current nor built, then,
under the cache's lock, the files no set names at that moment, and
builds' leftover folders over a day old (gc_packages,
deleted_packages); devvm space lists the cache.
- The snapshot is gone from base.sh, guest/sync.sh and desktop.sh, and
scripts/bump.sh's apt step with it.
- Tests: recording then replaying, a missing or changed cached file,
every refusal of what comes back, gc's view of the cache and its race
with a new set, the set record, the mirror setting, Lima's exchange and
exit 75, apt.sh's mirrored and record functions, apt.sh in the keys;
the limactl stub keeps what's sent and gives back
$STUB_DIR/packages-out.tar.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
TestLimactlStubContract runs scenario on dummy instances twice, through
the real limactl and through testdata/stubs/limactl, and after each step
compares every instance as devvm reads it from limactl list --json: their
order, status, size, mounts, agent forwarding, ssh port and networks, and
the edits each kind of start would make (startSets).
The stub had drifted from Lima, and now matches it:
- create ignored --cpus= and --memory=: every image was 4 CPUs and 8 GiB.
- clone started from an empty config: Lima's keeps its source's config,
size and lima.yaml (env), then --mount-none, then each --set.
- Only --set .portForwards, .ssh.localPort and .env were kept: the
mounts, .ssh.forwardAgent, .propagateProxyEnv, .hostResolver and .dns
were dropped, so each start edited them again. The stub keeps any
--set (and del()) in $STUB_DIR/config-<name>/, on create too.
- delete left the VM's size and $LIMA_HOME/<name> (its lima.yaml).
- list gave instances in the order they were made: Lima sorts them.
devvm relied on the clone drift: a project VM keeps its image's
propagateProxyEnv: false (from the build's start), so its first start
without network policy edited it, where the CLI tests said it edits
nothing. CreateVM now sets .propagateProxyEnv=true at the clone. And
rebuild.txtar relied on the list order: it compares the deletes sorted,
as Lima lists images by name. On Linux a layer's or the tools build's
VM, cloned from a built image, keeps the config its image's build made,
so Start edits nothing (no ssh port there) and the build's step count
was one too many: cloneEdits counts the configure step only when Start
edits (TestCloneEdits).
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]>
script_test.go's sandbox sets DEVVM_MESSAGES=names and DATA, VMS, RUN
and CFG by default, and adds stub_reset, catg (the one file a glob
matches), vm_name VAR NAME (the folder's VM) and project NAME [git];
script_cmds.txtar checks each. Every script is rewritten onto them, its
assertions kept; TestCommandLines leaves the scripts' own commands out.
mise run test runs scripts/test.sh: the tests as before, with the CLI
tests' devvm built with -cover for every package (CLI_GOCOVERDIR),
merged with the Go tests' counters by go tool covdata, then
scripts/coverage.sh holds each package to testdata/coverage/<os>.txt.
mise run coverage raises the baselines; coverage.txtar checks the
comparison. The macOS baseline is recorded from this tree.
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]>
assets/ holds the files devvm ships: base.yaml, layers/, features/,
shared-tools/ (mise.toml, build.sh, the tools' policies), guest/ and
oci/. devvm reads them from assets/ beside its binary (paths.Root,
paths.RootOf); releases, the Homebrew formula, the CLI tests and e2e
put them there. Image keys hash them by their names in assets/.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
base runs its chosen features after layers/base.sh, in the order chosen:
devvm's own (features/<name>.sh next to the binary) and the user's
(~/.config/devvm/features/<name>.sh). The choice is in base-features and
in base's key; until there's a file, every feature counts.
The first build of anything asks which features base gets, every one
chosen to start with: an arrow-key (or j/k) picker in a terminal, showing
each script's second line; without a terminal, every feature. The choice
is saved and printed.
- build: Features (devvm's, sorted, then the user's; a user feature named
like a built-in one is ignored), FeatureScript, chosenFeatures
(selected_features), chooseFeatures (pick_features) run by Build and
Rebuild before any key; Inputs hashes the chosen features and the
user's folder; base's spec gets each feature's script, one without a
script skipped with a warning.
- image: FeatureName. ui: Pick and Choice (raw mode, hidden cursor,
control characters dropped from descriptions, Ctrl+C ends the run with
130).
- Messages: features_help, base_features, base_features_none,
feature_shadowed, unknown_feature; doc links to customizing.md.
- Copied: features/ (cli-tools.sh, fzf.sh, omb.sh), unchanged.
- Converted: images.bats user features (listing, shadowed, in base's key)
and build.bats step counts (two features and one skipped) as
features.txtar and Go tests (TestFeatures, TestDescription,
TestChooseFeatures, TestBuildRunsFeatures, TestPickKeys,
TestPickWithoutTerminal, TestPickCtrlC). Script tests start with an
empty base-features file.
- e2e: with from selected, base-features holds every feature; images
checks base ran base.sh and every feature, and takes base's key from
its build or the newest Ubuntu base (no longer a cached --from base);
from checks every feature in the node:24 and alpine:3 VMs.
- Docs: customizing.md (base image features); images.md, index.
Co-Authored-By: Claude Opus 5.5 <[email protected]>