A parent folder's VM can move a nested project folder aside and put a link in its place. The checks around a start refuse what they see, but a swap timed for the moment Virtualization.framework opens the share, and put back before devvm's last check, made the nested VM mount the link's target. On vz, the Lima backend now mounts the project folder as location /.vol/<dev>/<ino>, from the folder devvm recorded (the state's folder, passed as the new Want.ProjectID), with mountPoint set to its path. macOS's volfs opens the folder by its inode wherever it is, so the share is the recorded folder, never what's at the path. Checked first on a real vz VM (Lima 2.2.1, macOS 26): vz and Lima accept the /.vol location; with the folder swapped for a link before limactl start the VM read the real folder's files at the project path, and wrote there; limactl list --json keeps the location and mountPoint as set. vz serves the share by the path the folder had at the start, so once the folder is put back the VM gets Operation not permitted (as for any rename while it runs) until its next start, and replacing that path with a link while it runs gives the same: never the decoy. The Lima backend alone decides it: projectMount (vz with a recorded folder: by inode; otherwise, and on QEMU/9p, by path), used by CreateVM (the image's vmType, which its clone has) and Start's wantEdits, which now compares the project mount whole (location, path in the VM, writable) through keptMounts, so a start edits nothing when they match and limactl list's filled-in fields never cause an edit. Instance.Project is the mount's path in the VM, so devvm's comparisons, devvm ls, devvm ports and .git protection keep using the host path. mount_comma checks the path in the VM too. platform.VolPath parses a FolderID. The checks from the nested-replaced fix stay, as defence in depth and for Linux, where 9p has no equivalent. Docs: internals/lima.md (the mount, the compare), internals/overview.md (what's checked and what stays open per OS), safety/attack-vectors.md (the residual gap is Linux's only), using/vms.md. Tests: TestVolPath (parsing; on macOS the path opens a moved folder), TestProjectMountByInode (wantEdits on vz: as it is, another inode, moved, a comma, a path mount before, no folder recorded, --clone; QEMU by path; Instance.Project), TestCreateVMByInode (the clone's mount, no mount edit), TestUp (spec and start carry the state's folder), TestUpClone (none); e2e's project section: the folder swapped as limactl start runs and put back when it returns, through the parent's VM (macOS: the VM never sees the decoy, its mount is /.vol/<dev>/<ino> at the path; Linux: noted), and the next start runs no limactl edit. Co-Authored-By: Claude Opus 5.5 <[email protected]>
31 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 that runs its VMs on Lima, behind a backend interface another backend could implement. 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, space, retention, layer (its new, add and rm), setup, agent (its import and save; login in agentlogin.go), restart, tools, adopt, rm, stop, update, history, ls, network (its rules and log too), doctor, secret, link (its add, rm, publish and unpublish too), group (join, leave), ssh-agent, host, code, desktop, limactl, ports, size, git-protect, clone, completion, upgrade, hidden version, _msg, _qemu, _proxy, _ports (forwarder.go), _links, _refresh-tools); app.go: the run's services, each made once (folders, overrides, secrets, registry, tools, vmEnv, builder; a.env runs a command on the folder's VM); args.go checks arguments and flags (usage errors), flags.go the flags several commands share, word.go refuses devvm WORD and help's unknown words (a part's name points to its flag; did-you-mean over commands, msg.Closest); help.go the help's groups, Examples and docs links (msg.CommandDocURL); json.go: --json (printJSON, "version": 1), its shapes in json_test.go; script_test.go runs testscript; docgen/ writes the CLI reference |
internal/vm/ |
Env (env.go: shared dependencies, and its parts, each made once by wire, which the commands reach, never converting one type to another); the start (start.go: starter.bringUp, every path's one start, requirements, confinementFor, hostChecks); the finder (finder.go: target finds the VM a command acts on, as its need says; target.go: that VM, read once, and what a command does with it; move.go: a VM whose folder moved, devvm adopt VM); the inventory (inventory.go: every VM's state, backend and list, read in one place, one failure policy); Launch: a new VM (up.go; parts.go: its toolchains, agents and layers, the picker, setup's agents and layers; detect.go: what the folder's files call for), an existing one (existing.go), ssh.go, agents' mounts from devvm's agent store (agents.go: agentStore, the one reader of Dirs.AgentSettings; secrets.LoginFile the logins'), AgentImport (agentimport.go: devvm agent import, the one reader of the home's agent files), AgentLogin (agentlogin.go: devvm agent login, the agent's login in the VM, its forward, API keys), AgentSave (agentsave.go: devvm agent save, a VM's settings into the store, after a diff (linediff.go) and a yes; agentsave_read.go: its fixed list and the checks on the VM's stream); Lifecycle (lifecycle.go; remake.go: the one remake, a VM made again from another image, devvm layer add, devvm layer rm, devvm update and devvm clone; home.go: its home folder's copy); Housekeeping (housekeep.go: images, shared tools, exports and leftovers for devvm images, gc, space and retention); Exports (exports.go: the exports of agents' history, their .folder files, Newest); Tools (tools.go: a VM's shared tools); Settings (settings.go, size.go, ports.go, sshagent.go); Net (network.go, secret.go); Links (links.go: links between VMs, published ports), Groups (groups.go: the links a group makes); --clone (clone.go: the clone, rm's check, devvm clone's switch); a devcontainer.json's mapping and commands (devcontainer.go); the setup it sends (sync.go) |
internal/shell/, internal/vmname/ |
stdlib leaves: quoting for a POSIX shell (Quote, QuoteJoin) and its variables' names (EnvName); a project VM's name grammar (Prefix, HashLen, IsVM, HashOf, SlugOf, a remake's Aside) |
internal/project/, internal/gitprotect/, internal/hostsafety/, internal/hostgit/ |
a project folder (VM name, link targets, unsafe folders, parents); .git protection; the folder's other host checks (set-id files, skipping .git, once stopped; an SSH origin); every host git command devvm runs (no fsmonitor, hooks or filters, ssh only, no GIT_* of the environment, no prompts) |
internal/sshconfig/, internal/sshagent/ |
the ssh config for running VMs by name, 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/fetch/ |
every HTTP client (stdlib): NewClient (timeout, HTTPSOnly/SameScheme), Retry/Transient, ReadCapped, Get, Resolve (where a HEAD's redirects end), Download (checks the SHA-256, capped) |
internal/upgrade/ |
devvm upgrade: how this devvm was installed (Detect), the releases (Source: the newest, Check for a notice, Fetch: minisign's ED signature by the built-in key, then the SHA-256), the unpack, the link's switch and rollback, brew; upgradetest/ (tests only: a TLS release server, a minisign signer) |
internal/from/ |
--from: references, registry digests (anonymous token), Docker's IDs, the recorded digests |
internal/redact/ |
passwords out of logs (stdlib): String (the run log's lines: proxy keys, URL passwords), File (another program's log, in place, its length kept) |
internal/devcontainer/, internal/jsonc/ |
a project's devcontainer.json (pure): finding it, mapping it to a new VM's plan, refusals, what devvm update's reading again replaces (Reread); JSON with comments (jsonc.Strip, stdlib) |
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/trust/ |
the user's CAs (~/.config/devvm/ca): read and checked, sent to VMs, build VMs' Trust scripts, the guest environment; each VM's own CA and its next (InitCA, in vms/<hash>/run/ca/) |
internal/agentlogin/ |
agents' login and settings files on the host: the VM's copies with placeholders, bindings, values and OAuth refresh (File), Redact, and Restore, which puts the store's values back for a VM's placeholders |
internal/proxy/ |
the proxy, run as devvm _proxy; see its README.md |
internal/daemon/ |
devvm's background processes (stdlib only): detached starts, pid files checked against the process's arguments, stopping (TERM, then KILL), readiness by status file, the lifeline; the only place a process is signalled by pid (forbidigo) |
internal/desktop/ |
devvm desktop's relay on the host: VNC's password checked here, then an ssh channel to the VM's socket, the viewer's clipboard dropped; passwords |
internal/backend/ |
Backend and its roles, Caps, Require, Check, the registry and its guard (As); backendtest/ (fake), registry/ (every backend's), lima/ |
internal/vmssh/ |
devvm's own over a VM's ssh, on every backend: Checked, the one way to a VM's ssh (the review, the backend's SSH checked by FromTarget, its host keys read or pinned; UnusableError, ErrNoHostKeys), the port forwarder and its one owner (Forwards: lock, stop, start, its ports from vm.json), a login's forward of this machine's loopback ports in devvm's own process (ForwardLoopback), links' sessions, each VM's one host-key record per start (PinHostKeys, vms/<hash>/run/known_hosts) that every ssh of devvm's checks |
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/); Reporter (reporter.go: what every package prints and asks through, *ui.UI its one implementation, Fake the tests'); Question (question.go: a question and what answers it, AnsweredBy/RefusedWith; where devvm can't ask, its Refusal is the prompt's error) |
internal/ports/ |
a VM's ports section (forwards asked for, host ports chosen) and the one allocator of host ports, under the claims lock |
internal/paths/, internal/state/ |
every folder and file devvm uses, a VM's in its folder (Dirs.VM: vms/<hash>/), host paths resolved and compared (Physical, PhysicalParent, Within, Below: resolve.go says which for what); a VM's state, vm.json (core fields, one section per package, changed only in VM.Update under the VM's lock); the layout version (CheckLayout, migrations; testdata/script/layout.txtar lists every file); every file written whole (WriteFile, WriteFileMode: forbidigo bans os.WriteFile, os.Create and O_TRUNC elsewhere but the proxy), private folders (PrivateDir) |
internal/settings/ |
the defaults (Defaults, Read, Save): config.toml (yours, strict) over settings.json (devvm's), each value's check (ParsePorts, ParseCPUs, ParseGiB, the retention settings) |
internal/platform/, internal/ubuntu/, internal/testbuild/ |
build-tagged OS code; finding and verifying Ubuntu's cloud image (never downloads); whether this is a test build (ldflags: only it reads the test overrides, cli's readOverrides) |
assets/ |
the files devvm ships, embedded (assets.FS, passed to constructors by cli): base.yaml, prelude.sh ($devvm_arch, $devvm_libc, devvm_sha: first in each build script run with bash, read through image.OwnScript), layers/ (base's Lima template and scripts; the built-in layers, desktop, docker and nix, each with its policy), features/ (base's optional ones), shared-tools/ (mise.toml, build.sh, *.policy), guest/ (in-VM scripts sent on every launch, and the port forwarder's ports.sh), oci/ (--from's conversion; see its README.md) |
internal/structure/ |
the structure test (tests only) |
internal/stubtest/ |
the test stubs (tests only): stub/, one Go binary for every host command, dispatched on argv[0] (each stub's comment lists its switches; guest.go, the VM behind limactl shell and ssh; stub, scripts' commands on its state), built once into $TMPDIR/devvm-stubs-<hash>; stubstate/, their typed JSON state under a lock; stubtest puts them on PATH: their folder, calls, files and state, ExecRunner; msg.Fake, msg.Recorder, msg.IDOf and msg.NamesOf are tests' too, backendtest.Stored a fake with disks |
testdata/ |
script/*.txtar (CLI tests), golden/<os>/ (what the real tools printed, mise run e2e -- --golden; the stubs and devvm's parsers are checked against it), mise.lock (fixture), coverage/<os>.txt (each package's coverage baseline, per system), lint/ (a line breaking each forbidigo rule, which lint:code checks) |
tests/e2e/, tests/e2e-mise.lock |
end-to-end tests on real VMs (Go, tag e2e, a file per section; TestE2E is the run, mise run e2e -- FLAGS; the sandbox, slots, locks and e2eUbuntuRelease in sandbox_test.go); the shared tools' versions every section but tools uses (scripts/bump.sh e2e-tools) |
scripts/, packaging/, .goreleaser.yaml, VERSION, CHANGELOG.md |
bump.sh (pins), release.sh (signed-tag checks around GoReleaser, then minisign), publish.sh (the release: checks, release.sh, one yes, then pushes, gh release and the tap), test.sh and coverage.sh (mise's test tasks); the Homebrew formula; packaging/key.go embeds the folder, so devvm upgrade's key is minisign.pub's (none without it); 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 |
.agents/skills/cli/ |
the cli skill: devvm's command line rules, the checklist for adding a command, the tests behind each rule, judgment.md for the rest |
.agents/skills/docs-voice/ |
the docs-voice skill: the voice of the prose and messages, terms, tropes, scan.sh and facts.sh |
Tasks
mise run <task>: fmt; lint (lint:code: Go, shellcheck, workflows with actionlint and zizmor; lint:docs: docs, TestDocLinks, TestCommandLines); test (scripts/test.sh: -race, in a throwaway HOME; needs a C compiler; then each package's coverage, unit and CLI tests merged, against testdata/coverage/<os>.txt); coverage (the same, then raises the baselines it beat: commit them with the change); vuln; deadcode (lists only backendtest, stubtest, upgradetest, msg.IDOf, msg.NamesOf, msg.Recorder and msg.Fake, which tests use; anything else gets a caller or goes); cli-docs (after changing any command's Use, Short, Long or flags; commit the pages); docs (serves http://localhost:1313/); 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 passesmise run e2ein the background: the sections for what changed (--only). - Nothing in project folders: state goes in
~/.local/share/devvmand~/.config/devvm. - devvm's own files never get a shared copy on disk: the proxy reads them from the binary, base.yaml and scripts go on stdin,
--from's build writes its scripts into its own temp folder. - 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.shafter the prelude,shared-tools/mise.toml's[settings], the miselayers/base.shpins (not rust's), the libc and the base it builds in: devvm's own Ubuntu base for gnu, the only one gnu ones build in, and for musl its--frombase's digest (Share.Buildchecks the base's record). - Pin every download in
assets/'slayers/,features/,shared-tools/build.sh,oci/build.sh:<tool>_versionand<tool>_sha256_arm64/_amd64at the top, picked with the prelude'sdevvm_sha, 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): guard empty arrays (${a[@]+"${a[@]}"}), no associative arrays. Everything else is Go. - Docs: an easy-to-follow guide in full, joined sentences, every fact kept; write and edit prose with the docs-voice skill (Vale's
devvm.AIWordsfails on chatbot vocabulary). Every behavior change updates its page indocs/content/docs/in the same task. The README stays high level. - Adding or changing a command follows the cli skill (
.agents/skills/cli/): its checklist, then its review. - Adding or changing a shared tool updates its page:
using/toolchains.mdfor a toolchain,using/coding-agents.md's Supported agents for an agent. - Docs by reader: user pages (
getting-started/,using/,safety/,backends/) say what devvm does and what you type, without repo paths, Go identifiers or message names; How it works (internals/) explains mechanisms; Contributing (contributing/) has repo paths and Go identifiers. - Extend the owner, don't copy it: before adding a helper, parser, path, file reader, message or table, find its owner and extend it; a new owner gets a forbidigo rule or a structure-test check only when a second copy would be a bug (Contributing).
- 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. - Fail by returning:
RunEreturns the error, asfailed(err, msg.XFailed)when it may not be a message;executealone prints it (showFailure: aLoggedErrorwith the log's end viaErrorLogged, a message as it is, elsewhat) and returns 1, thenui.Mainruns the cleanups. Only the UI ends a run itself (die: no run log). INT/TERM/HUP cancel the root context, wait for the logged command, then, with cleanups to run, up to 2 s for the command to return (returnGrace; not while it waits at a question, whose answer after a signal is refused), run the cleanups and return 130; a second signal is ignored; after one, failures print 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. - Only
cmd/devvmandinternal/cliimportinternal/ui(the structure test's layers): cli passes the run'sapp(its*ui.UIand services) to each command; other packages embed the onemsg.Reporter(messages, prompts, status line, run log, cleanups), which their constructors take and cli gives them, or cli asks first and passes the answer in; a package's ownWarnthat says where the run log is too (Lima's, the shared tools') is a method over it. - Arguments and flag values are checked before anything runs, in
Args(noArgs,exactArgs… fromargs.go, never Cobra's; values withcobra.MatchAll),checkFlagValueandexclusive: a usage error exits 2 and names the command's --help. Exit codes: 0, 1, 2, 130. - 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()and stays once interrupted, as the cleanups run after the command returns. Cleanups get a fresh context. - External commands run with the UI's
LoggedCmd(ctx, step, cmd)(a backend'sRunner): output to the run log, a failure after one returned asbackend.Logged(m).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, x/crypto's
blake2bonly (minisign's prehash); go-internal in tests; cobra/doc's own deps never imported directly).internal/proxyandinternal/daemonare 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 shell are quoted withshell.Quote. - Test seams are fields tests set (
Host,Exec,Runner,OS,Reporter…), never package vars (reassign: no package sets another's);internal/proxy's are itsserver's, which each test makes. - The structure test (
internal/structure, inmise run test) holds types to 24 methods, bansfunc init, allows only constants' kin as package vars, checks the package layers and the owners (host git only ininternal/hostgit;DEVVM_variables only inreadOverridesand the listed settings;HOMEonly ininternal/paths, asDirs.Home; shell quoting only ininternal/shell, the VM-name grammar only ininternal/vmname,state.ReadHashandproject.Parentsonly in the finder,state.ReadAllonly in the inventory,Dirs.AgentSettingsonly invm/agents.goandDirs.AgentLoginsonly insecrets/secrets.go): see Contributing before raising a limit or listing an exception. - The CLI reference is generated:
TestReferenceIsCurrentfails on a stale one (mise run cli-docs). CGO_ENABLED=0.internal/proxyandinternal/daemonare unix-only for now (syscall.Kill,Setsid,Flock).
Backends
- Every backend implements
backend.Backendand declaresCapsper feature: native, emulated (reviewed) or none. A newFeaturegoes inbackend.Featuresand the table indocs/content/docs/internals/backends.md. backend.BackendisName,Capsand four roles,Host,Images,Machines,Housekeeping, all required; a backend's type splits the same way (Lima'shost,images,machines,housekeeping). The one optional role,Forgetter, is found withbackend.As.- 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, and its guard refuses the rest (it has every role's methods); backends don't decide what a VM needs. - Every emulation is refused until reviewed: a design note in
docs/content/docs/internals/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. A stopped VM changes only atStart, which applies what itsWantasks where it differs (backend.Validatefirst); a running one is left as it is; restart warnings are the callers'. Ports are never the backend's:vmssh.Forwardsforwards over itsSSH, whichvmssh.FromTargetchecks. - Lima edits only what differs: any
limactl editgives the VM new ssh host keys at its next boot, soStartcompares first and makes one edit.Startownsenv:,propagateProxyEnv,dnsandhostResolver, and a project VM's size, agent mounts andforwardAgent.
Messages
- Messages use the docs voice, only shorter: the docs-voice skill's Messages and Terms rules.
- 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. Message values render on one line without control or bidi characters (msg.OneLine, at render); a VM's text shown as data goes throughmsg.Printable. A message made from an error carries it (.Because(err)), not onlyerr.Error(). - Every question declares what answers it (
msg.X().AnsweredBy("--force")or.RefusedWith(msg.Y()));Ask/Confirm/Answer/Secretreturn its refusal where devvm can't ask (no terminal,--no-input, end of input), which callers return or fall back on, never checking for a terminal. The CLI tests answer withttyinorDEVVM_PIPED_ANSWERS=1. - An error or warning is at most two sentences; a prompt gets at most two lines of context.
- The mechanism goes in the doc link, not the message: every warning or error the user can act on has one.
- Status steps stay 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 in names mode, stubs first onPATH(stub_calls,stub_reset), withproject,vm_name,catg,vm_state,json_setand$DATA/$VMS/$RUN/$CFG; 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. - Never touch VMs, images or containers devvm's tests didn't make: your own stay as they are. 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 aconfig.tomlwithfeatures = []and pass--network TIERso nothing prompts. Delete test Keychain items. Never use your own 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:
mise run e2e -- FLAGS(--only,--from,--clean,--slots,--golden…) builds 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).--slots Nspreads the sections over N sandboxes at once (slot K's paths end-K, its ports +100·K, its images cloned from slot 0's). Onlytoolsresolves the newest tool versions; the rest use the pinned lock, and--fromimages go by pinned digest but one tag (scripts/bump.sh e2e-tools e2e-from). 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 VM with Claude Code, Codex and opencode),desktop(a base VM refused, then the desktop layer, devvm desktop),nix(a node VM with the nix layer and a flake),from(Debian 12, Alpine and Ubuntu bases, a docker that isn't running),link(two targets and a client, then the three in a group, the design note's threat check). Tiers: none (all butdesktopandfrom, no features);--from(everything, every feature; before mergingassets/or--fromchanges);--only a,b(withfrom: every feature). 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, apart from any Lima home of your own. - Unreviewed emulations are checked through
DEVVM_UNREVIEWED=backend:feature, which only test builds (e2e's, the CLI tests', by ldflags) read. - 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_proxy -configin the sandbox): 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>. The project mount is/.vol/<dev>/<ino>at its path; vz serves a share by the path it had at the start, so a rename while it runs gives "Operation not permitted". 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 oneshell.QuoteJoinstring. 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. 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). - 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 or rule. Inventories (functions, messages, test names) go in the commit message and the
dex completeresult, not here.