.golangci.yml: - forbidigo bans context.Background and context.TODO outside internal/ui and cmd/devvm. - nolintlint requires each //nolint to name its linters and say why, and reports unused ones. - reassign (patterns .*) forbids setting another package's variables, tests included. - revive keeps its default rules and adds function-length (100 statements, 160 lines) and cognitive-complexity (75). Fixes: - Backend.Lifeline takes a ctx: smolvm's machine data-dir lookup runs with the caller's. - The proxy's TLS handshake with a VM uses the request's context, limited to 30 seconds. - OAuth token refreshes run within refreshTimeout (30 seconds). - Tests use t.Context(). - Launch.create is split into plan, newVM.record and undoCreate. - lima's TestStartConfined is split into helpers. - smolvm's Terminal comes from its UI's StdinIsTerminal. - Unused //nolint directives are removed. - Fresh contexts that remain (an in-memory TLS parse, lookups shared by every request, a test cleanup) each carry a nolint saying why. Docs: contributing.md lists which lint rule enforces which convention; AGENTS.md names the linters behind its Go conventions. Co-Authored-By: Claude Opus 5.5 <[email protected]>
34 KiB
AGENTS.md
devvm: one isolated VM per project folder, cloned from a base image, with toolchains and agents shared read-only between VMs. It's a Go CLI with swappable VM backends (Lima first). Read README.md for what it is, and the docs site for how each part works; Contributing covers building, the tools, testscript and writing docs.
Layout
| Path | What |
|---|---|
cmd/devvm/ |
the entry point: ui.Main makes the run's UI and runs the root command with it; the only os.Exit |
internal/cli/ |
Cobra commands, one file each (root = up, build/rebuild, images, gc, layer, setup, restart, update, remove, adopt, rm, ls, log, doctor, secret, auth, ssh-agent, ssh, code, limactl, ports, size, git-protect, completion, hidden version, _msg, _qemu, _proxy, _refresh-tools); script_test.go runs testscript; docgen/ writes the CLI reference |
internal/vm/ |
Env (env.go: shared dependencies, finding and starting the folder's VM); Launch: a new VM (up.go), an existing one (existing.go), ssh.go, agents' mounts; Lifecycle (lifecycle.go); Settings (settings.go, size.go, ports.go, sshagent.go); Net (network.go, secret.go); --clone (clone.go); the setup it sends (sync.go) |
internal/project/, internal/gitprotect/ |
a project folder (VM name, unsafe folders, detection, set-id files); .git protection |
internal/sshconfig/, internal/sshagent/ |
the ssh config for running VMs by name, their pinned host keys, the ~/.ssh/config Include line; each VM's SSH agent choice, devvm's own agent and its keys |
internal/build/, internal/image/ |
building and rebuilding images, their records; image keys and names (pure) |
internal/from/ |
--from: references, registry digests (anonymous token), Docker's IDs, the recorded digests |
internal/tools/ |
the shared tools: the lock, host mise, the daily check, tool image builds, the share |
internal/netpolicy/, internal/secrets/ |
network policy (the choice, the VM's proxy, the self-check); tokens on the host and the VM's bindings |
internal/proxy/ |
the proxy, run as devvm _proxy; see its README.md |
internal/backend/ |
Backend, Caps, Require, the registry; backendtest/ (fake), registry/ (every backend's), lima/, smolvm/ (experimental) |
internal/ui/ |
the only package that prints: ui.UI (messages, prompts, status line, run log, cleanups), ui.Main (signals); no package state |
internal/msg/, locales/ |
messages: en.toml, the generated functions, doc links (docs.go), the generator (gen/) |
internal/paths/, internal/state/ |
every folder and file devvm uses; atomic state files, assets.FS written out where a path is needed (errors aren't messages yet) |
internal/platform/, internal/ubuntu/ |
build-tagged OS code; finding and verifying Ubuntu's cloud image (never downloads) |
assets/ |
the files devvm ships, embedded (assets.FS, passed to constructors by cli): base.yaml, layers/ (base's Lima template and scripts), features/ (base's optional ones), shared-tools/ (mise.toml, build.sh, *.policy), guest/ (in-VM scripts sent on every launch), oci/ (--from's conversion; see its README.md), smolvm/ (smolvm's in-VM scripts) |
testdata/ |
script/*.txtar (CLI tests), stubs/ (host commands; see each header), mise.lock (fixture) |
tests/e2e.sh |
end-to-end tests on real VMs (bash 3.2) |
scripts/, packaging/, .goreleaser.yaml, VERSION, CHANGELOG.md |
bump.sh (pins), release.sh (signed-tag checks around GoReleaser, then minisign); the Homebrew formula; VERSION is read by the scripts only |
install.sh |
curl | bash: the host's archive (the binary, README, changelog, license), checked, into ~/.local/lib/devvm/<version>, then doctor's fixes, asking first; tests source it (DEVVM_INSTALL_TEST) |
docs/ |
the docs site (Hugo + Hextra); content/docs/cli/ is generated, never edit it |
mise.toml, .golangci.yml, .vale*, .markdownlint-cli2.yaml, .github/ |
tools, tasks, linters, CI and Pages |
.agents/skills/security-audit/ |
the security-audit skill, for backend reviews |
Still to come: smolvm's emulations, the docker backend; the release keys (packaging/minisign.pub, packaging/release-signer).
Tasks
mise run <task>: fmt; lint (Go, shellcheck, docs, TestDocLinks); test (-race, in a throwaway HOME; needs a C compiler); vuln; deadcode (what it lists waits for a caller in Pending, or goes); cli-docs (after changing any command's Use, Short, Long or flags; commit the pages); docs (serves http://localhost:1313/devvm/); e2e.
Rules
- The gate:
mise run fmt && mise run lint && mise run test, all passing, before starting a task and before marking it done; a gate failing at the start gets fixed first. Anything touching VMs also passestests/e2e.shin the background:--quickonce it exists, until then the sections for what changed. - Nothing in project folders: state goes in
~/.local/share/devvmand~/.config/devvm. - Credentials never go into images. Host agent history never goes into VMs.
- Never auto-delete project VMs: they may hold unsaved work. Warn instead.
- The startup check only reports. Never install host software without asking.
- Image keys hash everything that goes into an image, the backend included. A tool image's key is its lock entry,
assets/shared-tools/build.shand the libc. - Pin every download in
assets/'slayers/,features/,shared-tools/build.sh,oci/build.sh:<tool>_versionand<tool>_sha256_arm64/_amd64at the top, fetched withdevvm-fetch(oci/build.sh:sha256sum). Nocurl | sh, no "latest". Upstream-checked exceptions: shared tools (MISE_LOCKED=1), Ubuntu's signedSHA256SUMS, Lima ininstall.sh. Go checks a download's SHA-256 before use. - Shared tools are read-only in VMs: whatever writes into a tool's folder (global installs, self-updates,
corepack enable,rustup component add) is redirected (~/.npm-global,go_set_gobin = false), done inassets/shared-tools/build.sh, or off. - In-VM scripts are bash 3.2-safe and shellcheck-clean (
assets/,install.sh,tests/e2e.sh): guard empty arrays (${a[@]+"${a[@]}"}), no associative arrays. Everything else is Go. - Docs: succinct and explicit. Every behavior change updates its page in
docs/content/docs/in the same task; a page's parts not ported yet come with their tasks. The README stays high level. - Edit files with the editor tools, not
sed,awk,python, heredocs orcat >. - Ask first before anything outward-facing (publishing, releases, repos, pushing) and before deleting anything you didn't create.
- A task that turns out wrong or incomplete gets a proposed change (
dex edit), not quietly something else.
Go conventions
- Only
internal/uiprints. forbidigo bansfmt.Print*,os.Stdout/os.Stderrelsewhere andos.Exitoutsidecmd/devvm. Data goes to the UI'sStdout(), non-message log lines to itsStderr(). - Functions take their caller's
ctx: forbidigo banscontext.Background/TODOoutsideinternal/uiandcmd/devvm; one that must outlive its caller's gets//nolint:forbidigo // why. - Every
//nolintnames its linters and says why (nolintlint). Functions stay within revive'sfunction-lengthandcognitive-complexitylimits: split one that grows past them. - Only
cmd/devvmandinternal/cliimportinternal/ui(depguard): cli passes the run's*ui.UIto each command; other packages take what they need as fields (Info/Warn func(msg.M),LoggedCmd,AddCleanup,Interrupted…), set from a smallUIinterface of their own that their constructors take, or cli asks first and passes the answer in. - Fail with
u.Die(msg.X(...)): it prints and panics;ui.Mainrecovers, runs the cleanups, returns 1. Commands end withfail(DieLoggedfor aLoggedError). INT/TERM/HUP cancel the root context, wait for the logged command, run the cleanups and return 130; a second signal is ignored; after one,Dieprints nothing. A logged command a signal ended (or 128+) waits up to 1 s for devvm's own interrupt, as Ctrl+C can end it first. - Cleanups: whatever a failure would leave (a build VM, a temp file) registers with the UI's
AddCleanupand is removed once done; one only for interrupts checksInterrupted(). Cleanups get a fresh context. - External commands run with the UI's
LoggedCmd(ctx, step, cmd)(a backend'sRunner): output to the run log, failure viaDieLogged.WithSteps(ctx, n)numbers steps. - OS-specific code goes behind build tags in
internal/platform(*_darwin.go,*_linux.go,*_other.go). - Dependencies: the depguard allowlist (cobra, pflag, cobra/doc, go-i18n, BurntSushi/toml, x/text, x/term, x/sys; go-internal in tests; cobra/doc's own deps never imported directly).
internal/proxyis stdlib only. Adding one: ask. - External tools are commands, never linked (
limactl,docker,security,git,chflags…); prefer the standard library to shelling out. Strings into a backend's shell are quoted withshq(). - Test seams are fields tests set (
Host,Exec,Runner,OS,Warn…), never package vars (reassign: no package sets another's); the one exception isinternal/proxy's globals (set byMain). - A command exists only once it's ported;
TestReferenceIsCurrentfails on a stale CLI reference. CGO_ENABLED=0.internal/proxyis unix-only for now (syscall.Kill,Flock).
Backends
- Every backend implements
backend.Backendand declaresCapsper feature: native, emulated (reviewed) or none. A newFeaturegoes inbackend.Featuresand the table indocs/content/docs/backends.md. - A missing feature fails in one line naming the VM and what to do; never fall back silently. Callers check the registry's
Review.Require(b, vm, spec.Features()...)first; backends don't decide what a VM needs. - Every emulation is refused until reviewed: a design note in
docs/content/docs/design.md, a threat check with the security-audit skill, and e2e checks proving the guarantee; then it's marked reviewed inCaps. - Backend-specific code stays in its package; what isn't (
.gitprotection, the proxy) stays out. - Backends return errors, they don't die: a
msg.M, orbackend.Logged(m)after a logged command failed. Set calls on a running VM getvm_not_stopped; restart warnings are the callers'. - Lima edits only what differs: any
limactl editgives the VM new ssh host keys at its next boot, soStartcompares first.Startownsenv:,propagateProxyEnv,dnsandhostResolver.
Messages
- Succinct and direct. Say what is being done, or what failed and what to do. No explanations; link a docs page when more is needed.
- Every message lives in
locales/en.toml, called through its generated function (msg.NoVM(dir));go generate ./internal/msgafter editing. Only go-i18n's fields (other,one,description); snake_case plain template fields ({{.vm_name}});onemakes it plural (count int). Doc links go ininternal/msg/docs.go. A message without a caller fails the tests.msg.Mis anerror. Never build prose withfmt. VM-made values go throughmsg.Shown. A message made from an error carries it (.Because(err)), not onlyerr.Error(). - An error is one line. Explain why only when the user must decide; a prompt gets at most two lines of context. Status steps are a few words, lowercase. Commands are written as devvm x, not quoted. No "please", "note that" or "simply".
[y/N]/[Y/n]stay literal. - Not messages: data output and text in scripts that run elsewhere.
- Tests check which message and with what, never its wording:
DEVVM_MESSAGES=namesprintsno_vm dir=/x;devvm _msg NAME k=v…gives e2e the text.
Testing
- Unit tests are Go table tests next to the code; CLI tests are testscript against the built binary in a
/tmpsandbox, stubs first onPATH(stub_calls); the binary hasassets/embedded (no override: scripts read$DEVVM_REPO/assets/; rebuild before a manual run after editing them). New logic needs a test. Neither touches the Keychain, real VMs or the user's folders; state-writing tests point the XDG folders att.TempDir(). Go tests never run up: scripts do. - Don't touch the user's own VMs or images. Manual runs:
DEVVM_LIMA_HOME=~/.lt LIMA_HOME=~/.lt XDG_DATA_HOME=/tmp/x/data XDG_CONFIG_HOME=/tmp/x/config DEVVM_SECRET_SERVICE=devvm-sandbox-test(devvm's Lima home is$XDG_DATA_HOME/devvm/limaunlessDEVVM_LIMA_HOME;LIMA_HOMEis for yourlimactl). Add abase-featuresfile and pass--network-policy/--no-network-policyso nothing prompts. Delete test Keychain items. Never use the user's tokens or logins: a network-policy VM reads its agent's login file fromHOME, so give it its own (the Keychain needs the realHOME: test it apart). - End-to-end:
tests/e2e.shbuilds devvm from the checkout and drives real VMs in its sandbox (~/.lt-e2e-go,/tmp/devvm-go-e2e, servicedevvm-go-e2e), deleting only what it made; images stay cached (--clean).toolsfirst resolves the newest tool versions. Run it in the background. Sections:images,project,clone(a throwaway repo, its ownHOME),gc(animg-*folder's VM, a stale fixture),tools(a node VM),network(a claude VM),from(Debian 12, Alpine and Ubuntu bases, a docker that isn't running). Tiers: none (all butfrom, no features);--from(everything, every feature; before mergingassets/or--fromchanges);--only a,b(withfrom: every feature); to come:--quick(project,--clone, size, gc, network; after most changes). Hosted CI can't run it on macOS. - Linux hosts:
LIMA_HOME=~/.lt-linux-go, VMlinuxhost(nested virtualization, the repo read-only, copied to~/devvm), set up as testing.md says; never~/.lt-linux, which is the user's. tests/e2e.sh --backend smolvmruns only thesmolvmsection (after touchinginternal/backend/smolvmor shared code); it acts only on machines with its sandbox's label. Unreviewed emulations are checked throughDEVVM_UNREVIEWED=backend:feature, which only test builds (e2e's, the CLI tests', by ldflags) read.- e2e to come: network: git over SSH, opencode's login; tools: python, uv, claude, codex, rust, go, adding in place, gc.
- Delete test VMs and temp files afterwards. Long builds run in the background. Tests that
chflagsreal files unlock them (chflags -R nouchg), only in their own temp folders. - The testscript runner stops the sandbox's proxies (
pkill -fon-lifeline): the stub hostagent is gone before they look, so they'd wait 15 minutes. limactl shellreads stdin: give it none unless the input is meant for it.- Boot problems: read
<devvm's Lima home>/<vm>/serialv.logbefore restarting; every start overwrites it.
Gotchas learned
- Lima
vz: raw disks only; clones are APFS copy-on-write (duovercounts). Direct kernel boot needs an uncompressed arm64Image. Stopping sends a GPIO power key, so guests needgpio_keys, or Lima hard-kills them after 30 s. Lima can't shrink disks. virtiofs tags arelima-<hash>. After root touches a directory on a virtiofs mount, the guest sees it as root's for a few seconds (git: "dubious ownership").mounts: []doesn't remove the home mount frombase: template:…: pass--mount-none(or--mount-only) tolimactl create/clone. - Lima can report a failed start for a VM that is running but degraded. Starting tolerates it.
limactl list --jsonfills in the config: mounts getmountPoint, port forwards aguestIP(127.0.0.1) and host side; compare only what devvm set.--setapplies after--mount-none.limactl createdownloads the image at once (no dry run).limactl shellquotes each argument for the guest's shell, soExecpassessh -cand oneshqstring. QEMU's guestfwd command goes through/bin/sh -ctoo, commas doubled.- The ssh socket path limit (104 characters) bounds VM names (
NameMax). - Linux hosts (QEMU): mounts are 9p, and a 9p share mounts once per guest. Docker writes bind-mounted files as root, so containers that write host files
chownthem back. Ubuntu'sdocker.iohas no BuildKit (RUN --mountneedsdocker-buildx). Debian's tmpfs/tmphides anything mounted below it during boot. Project VMs' qcow2 disks are overlays of their image's, so never start an image VM or write its disk after it's built. - Shared tools: mise rewrites
latest/24/ltslinks in a tool's folder after any install, so those folders are local in the VM; only version folders are mounted. - Linux's
pgrep -fmatches the shell running it (procps), so e2e's patterns are written[_]proxy. mise skips minisign on linux/arm64 (no build). - smolvm runs an image as a container in an Alpine microVM: no init system,
execenters the container as root with onlyHOMEset (noUSER, no/etc/environment),/devhas no loop nodes (mknod), its EROFS mounts only uncompressed images, Docker needs-v /var/lib/dockerand installssystemctl(tell systemd by/run/systemd/system). virtiofs shows host files as the host's uid, so the VM's user has it. - smolvm packs carry their build VM's network, CPUs and memory;
--block-privatecan't be removed.update --storagebreaks a registry-image machine, and a pack machine whose pack (stub and.smolmachine) is gone.--state-diris Linux only: run it withSMOLVM_USAGE=0. On macOS it shares the user's machines (kept underHOME: a devvm run with anotherHOMEsees others): touch only those with devvm's label. - smolvm's network: allow lists are per address (the gateway
100.96.0.1is every host loopback port), DNS answers any name under them, forwarded ports reach only servers on0.0.0.0, at most 64 per machine (one is devvm's sshd's). - smolvm base's packages before
assets/layers/base.shcome from Ubuntu's live archive, then base.sh pins a snapshot: anything pulling systemd libraries (openssh-server) goes after base's scripts (sshd.sh), or Docker's packages can't be installed. Under mediated egress a refused connection still opens in the guest, then resets (test with data, not a connect); TCP and UDP to any port 53 go to its resolver;--dnsis create-only; a machine once started mediated won't start without a decider until--no-egress-interceptor. - Lima writes
lima.REJECTED.yamlinto the current folder on an invalid config: runlimactloutside the repo (devvm runs it from its data folder).
Commits and tasks
- Tasks are in dex (
.dex/, git-ignored). - One commit when each task is complete, its Docs and Review subtasks included. Conventional Commits:
type(scope): summary, typesfeat,fix,docs,test,refactor,build,ci,chore. Thendex complete <id> --commit <sha>. - Don't commit or
dex completeuntil the gate passes, with whatevermise run fmtchanged in the commit. - Dex task IDs never go in commit messages, code comments or docs.
- AGENTS.md stays short: one line per path, rule or porting entry. Inventories (functions, messages, test names, converted cases) go in the commit message and the
dex completeresult, not here.
Porting
The only place in the repo that mentions the bash devvm. It lives at /Users/me/dev/devvm; commit 5efc65f is the spec (its bats tests and tests/e2e.sh define the behavior). Never change it.
- Copy only what a task needs (
git -C /Users/me/dev/devvm show 5efc65f:<path>) and list it below. Rewritten code isn't listed: each task's commit and dex result say what it ported. - Bats cases become testscript or Go table tests in the task that ports them; update the table. e2e sections come with the task that needs them.
- Bash fixes copied later are listed with their bash commit. Nothing else in the repo mentions the bash devvm or the port. This section goes when the port is done.
- No migrations from the bash's files or older state.
Copied (here ← there):
LICENSE,.shellcheckrc← same paths;assets/layers/*,assets/shared-tools/*.policy,assets/guest/tools.sh←layers/*,tools/*.policy,guest/tools.sh;assets/layers/base.shedited: sshd's forwarding, commentassets/base.yaml,assets/shared-tools/mise.toml,assets/shared-tools/build.sh,assets/guest/sync.sh←base.yaml,tools/mise.toml,tools/build.sh,guest/sync.sh; edited: comment.agents/skills/security-audit/,skills-lock.json← the bash repo's untracked filestestdata/mise.lock,testdata/stubs/tmutil←tests/fixtures/,tests/stubs/testdata/stubs/{gpgv,mise}←tests/stubs/; edited: commenttestdata/stubs/{limactl,qemu-img,security}←tests/stubs/, adaptedtestdata/stubs/docker←tests/stubs/assets/oci/{bootify,kernel,try}.sh←oci/;assets/oci/build.sh,assets/oci/README.md←oci/, edited: comment, docs linkinternal/proxy/←devvm-proxy/(main.go→proxy.go), adapted:Main(args, IO), no-connecttests/e2e.sh← same, adapted: framework,images,project(relaunch, restart, rm,.gitreports, agent folders),clone,tools(node half,update,remove),network(self-check on relaunch),from(no image only Docker has: it would build one in the user's Docker)assets/features/*←features/*VERSION,scripts/release.sh← same, adapted: GoReleaser in a clone of the commit;scripts/bump.sh← same, adapted: the host mise ininternal/tools/mise.go;packaging/homebrew/devvm.rb← same, adapted: builds with Goinstall.sh← same, adapted: the host's archive, older versions in use keptSECURITY.md← same, adapted: docs site links,--ignore-missing
Docs (page ← bash page, all rewritten, partly):
images.md,commands.md,security.md,git-protection.md,coding-agents.md,ssh.md,clone.md,from.md← same nameslima.md←network.md,security.md,design.md,limits.mdnetwork.md←network.md,devvm-proxy/README.mdcustomizing.md←customizing.mdtesting.md← same name (with the platform table, the Linux host as verified, manual checks)- README "Quickstart" ← README usage
install.md← same name (with requirements and checking them)maintaining.md← same namedesign.md← same name (with emulation design notes; dropped: the per-tool layers it replaced, fixes along the way, platform test history, the Go-only build)limits.md← same name (a summary linking each page; dropped: mise's shared installs as experimental, no longer)_index.md←docs/README.md
Bats files (pending cases, by task):
| File | Pending |
|---|---|
build, bump, cli, delete, from, guest, images, install, layers, lint, messages, network, oci, ports, project, release, size, tools |
none |
Dropped: build_proxy (two), json_str (encoding/json), the claude-token, features-file, pre-folder-check and pre-git-protection migrations.
Deliberate changes from the bash:
- A failed network self-check stops the VM, existing VMs included; a failed start stops the proxy it started.
- A running network-policy VM whose proxy can't start again (port taken, start failed) is stopped (
net_proxy_down_stopped);proxy_port_takenno longer asks to stop it. - A failed build keeps its stopped VM for inspection; a failed create or clone deletes the partial instance.
script_failedsuggestsdevvm limactl shell --start(nolima_home=). - Rebuild warns about and keeps an image in use (
image_in_use). Build VMs are always confined (no.confined,build_vm_unconfined,unconfine). - The proxy is in the binary (no
build_proxy,tool_intact);devvm _qemu connectreplaces-connect; log prefixdevvm proxy:;dialrefuses ports outside 1–65535; placeholders keepdevvm-proxy-managed; its password and the login salt are in no process's arguments. - New image keys, no parity: length-prefixed fields, the backend in base's key, a missing script hashed as missing.
- VM state is written before the clone, so a failed clone leaves nothing that starts. Slugs are cut per character; a too-long Lima home is
vm_name_no_room, before anything. - New VMs on Linux are checked for set-id files. Unsafe-folder paths resolve as far as they exist. VM-made values are Go-quoted, not stripped.
- The QEMU wrapper also refuses
-nic,-netother than none,-readconfig, and an option as-netdev's value. - Sync stages in memory (no temp folder). Agent folder changes are
agent_dirs_added/_removed;mounts_next_startreplacesmounts_on_restart. Placeholders, tokens and host settings go in single-quoted, not%q. - Host keys are kept only as a key type and base64; a linked
~/.ssh/configis written through its link. A VM whose host keys are read is shown at most 64 KiB, for 30 s. - An existing VM without state or
net=isvm_unfinishedbefore anything; rm deletes it without an export.--backendon one warns.size_next_start/ports_next_startreplace*_on_restart. A VM whose.gitprotection was never set up gets it as new.adoptclearsgit_inode, so the next launch locks.gitas appeared. --clone: host git pushes and fetches through devvm's ssh config (pinned host keys), not Lima's; rm fetches unfetched branches into new localsaved/<remote>[-N]/*branches, keeps the remote's fetched-only work there too, thengit remote removes it; a failed copy is retried on the next launch (clone_seed_failed);fetch_failed,clone_check_failed,remote_add_failedkeep the VM.--from:from_lookup_failed/from_cachedarefrom_unreachable,from_not_foundandfrom_cached_*(no nested message); a registry still failing (5xx, 429) after retries is unreachable;building_image_fromreplacesbuilding_image'sfrom=; Lima sets the converted disk with--set .imagesonbase.yaml(nolima.yaml) and the build VM's mounts with--set .mounts;from_ignoredon restart, update and remove too; a missing--fromvalue is cobra'susage_error.ls: a BACKEND column, VMs from every backend sorted by name,-for what a VM's state lacks (an unset GIT isn'ton), a tab-aligned table; a backend that can't list fails it (ls_failed, or its check's message) only when a VM's state names it.log:--follow/--lineslong names;--blockedrefuses-f/-n(not ignored);net_off_logon stderr; an empty log islog_emptytoo (-fwaits on it); lines that aren't events are skipped;--blockedis a tab-aligned table,-for refused requests, IPv6 hosts bracketed.policy:allow/deny/rmsubcommands with-g/--global; rules are the proxy's own syntax (proxy.ValidRule), all checked before any is added,allow !RULErefused; duplicates andrmmatch in any case, comments aside; files rewritten whole, through a link;rule_added*/rule_removed*/rule_presentreplacepolicy_changed/removed;rmon a missing file warns per rule (nono_rules);net_off_policyon edits too;state.VMNamesskips<vm>.policy.net_direct_routedoesn't name the Lima config.DEVVM_SECRET_SERVICEis checked for reads too. A failed tools resolve istools_need_resolvewith the log's end. e2e's sandbox and service differ from the bash's: its rebuilds and gc delete every stale image in its Lima home, and gc every unused tool image.- Features: each runs as a
running_scriptstep (noadding_feature); none chosen isbase_features_none; feature names that aren't layer-like are skipped in the listing and makebase-featuresunreadable. helpis Cobra's (devvm help COMMAND, per-command help);devvm completion bash|zsh|fishis new;--versionhas no-v; the version is set at build time, else Go's build info (noVERSIONfile read).- Host checks are each backend's
Problems: a command stops at the first (none listed under it);doctorchecks the new VMs' backend (--backend), adds a features table, Lima's global configs (lima-config) andqemu-img,*_fixmessages carry the fix,doctor_oknames the backend. network: no argument printsls's value (unenforcedtoo); an unchanged one isnet_already;onneeds the backend's egress proxy first; a running VM turned off stays on its proxy until it next starts (net_off_next_start);Confinedmeans started with the proxy, andnet_unenforced*say "wasn't started confined"; a bad argument is cobra'susage_error.secret:ls(anddevvm secret) is a table of every secret, SAVED and USED BY; set, rm, use and unuse rewrite running proxies' bindings (no touch);secret_saved/_keychain,secret_removed,secret_used/_unusedreplacesecret_saved keychain=,removed,secret_bound;unuse claudeon an image with claude issecret_with_image; control characters are refused too;usewarns when no token is saved; bad names are cobra'susage_error.ssh-agent: an unchanged mode isagent_already; a stopped VM's forwarding changes at its next launch (agent_set_*, noagent_off), a running one's warnsagent_next_start(wasagent_on_restart); a new VM without forwarding carries no agent from the start;agent_key_unpinnednames no older devvm; a missing key isagent_key_not_found, a bad lifetimeagent_lifetime_invalid(no usage);keysshows the default lifetime beside other options.layer:devvm layeralone is its help, a missing or extra NAME cobra'susage_error(nousage_layer);layer_createdis one line; the script is linked into place whole, never over one that appeared.ports:add/rmsubcommands with-g/--globalanywhere; a running VM's pending ports areports_pendingon stderr (nonext_starton stdout);add/rmof all or none isports_list_needed, other bad usage cobra'susage_error(nousage_ports);-grefuses a hand-edited ports file too; a change checks the backend's port forwarding first.size: its own--cpus/--memory/--diskand-g/--global; a running VM's pending size issize_pendingon stderr (nonext_starton stdout); a running VM's unchanged size isvm_sizetoo;size_defaultsshows sizes asvm_sizedoes;-grefuses a hand-edited size file too; a change checks the backend's features first;no_vm_size/size_failed(nousage_size,usage_size_flag,size_change_failed: cobra'susage_error,lima_edit_failed).git-protect: a--cloneVM showscloneand refuses changes (git_protect_clone); a never-set-up VM shows what its next launch sets; strict counts as on for launches and rm; strict that can't setdiff.ignoreSubmodulesfails (git_config_failed);git_locked*/git_unlocked/git_lock_latername the VM; a bad mode is cobra'susage_error(nousage_git_protect).images: two tab-aligned tables,-for what's missing: images on every backend (a BACKEND column; FROM a column, notimage_from; STATEunfinishedfor(unfinished)/(unknown)), then tool images (NAME, TOOL, VERSION, SIZE, VMS counted per image from VMs'tools=, STATE; the lock's unbuilt version anot builtrow, notnewer:); never resolves the lock; no custom layer rows, share total or section messages;images rmresolves every name before deleting, an unfinished one isdeleted_unfinished_build,deleted_imagenames the key,no_image_named/_frompoint to devvm images; bad usage is cobra'susage_error.gc: deletes whatimageslists as stale or unfinished (every backend) and asunused: tool images any VM's state lists stay (a VM deleted outside devvm's too), none without a lock (never resolves); a stale image an overlay uses is listed, then kept withimage_in_use(nokeeping_stale); no.tmpfiles (tool builds write outside the share);gc_images/gc_image/gc_unfinished/gc_toolsreplacestale_images/unused_tools;imagesaddsimages_stale_note/images_unusedon stderr.setup:--features LISTchooses without asking (in the features' run order; an unknown name isno_feature, nothing saved) and--backend NAMEsaves the default backend (default_backend; alone, features untouched); in a terminal with neither, it asks for the backend (backend_help, experimental ones marked), then the features; the pickers start from the current choice, an unreadablebase-featuresissetup_failed;base_will_rebuildcompares the chosen lists, only in setup (not a first build's choice);gc_old_hintwhen any image record exists.export: needs a finished VM made for this folder (vm_unfinished,vm_other_folder); the tarball is written beside its file (mode 600) and renamed in once complete, so a failure leaves none and replaces nothing;history_not_exported/export_failedfor export,rm_export_failedfor rm's.stop: needs a finished VM made for this folder (no_vm,vm_other_folder,vm_unfinished); stops its proxy at once;stopped, oralready_stopped(checked all the same, not an error); a--cloneVM's folder isn't checked;git_protect_runningnames it.ssh/code: a launch without its shell (launch, then setup: a stopped VM's pending size and ports applied, the user's agent checked,syncrun so VS Code's Machine settings are set again, a--cloneVM's clone made); they need a finished VM made for this folder and the backend'sssh;codegets the environment devvm started with (itsSSH_AUTH_SOCK);ssh_host_infois two lines naming the host and folder;ssh_failed/code_failed.limactl: runs in devvm's place (exec), every argument passed on (devvm help limactlis devvm's); nolimactlislima_missing, a failed execlimactl_failed.- Releases: per-platform archives (the binary, its files embedded, with README, CHANGELOG, LICENSE) and a source tarball from GoReleaser; the formula builds from source and installs the binary alone; release.sh checks the host's binary prints the version;
--headtakesDEVVM_MINISIGN_PUB; the scripts' text isn't messages, nor isinstall.sh's (it runs before devvm is there);release.sh --headneedsinstall.shtoo. install.sh: the host's archive (devvm-<v>-<os>-<arch>, Apple silicon's under Rosetta), the binary with README, CHANGELOG, LICENSE; an older version a running process names (a VM's proxy, QEMU) is kept for a later install; commands in its text aren't quoted.
Pending in code:
- deadcode's list:
backendtest(tests'). log_ref,see_log/see_outputcome with their callers.
Bash fixes copied: none yet.