84 Commits
Author SHA1 Message Date
w3cjandClaude Opus 5.5 dd46dd7a0f feat(tools): tool images build side by side
A first run built its tool images one after another, each paying a
build VM's boot (5.7 s on vz, 9.3 s on QEMU) before a download of a few
seconds to a minute. Share.Build now hands the images out to up to four
slots (buildAll), each slot's builds one after another in a build VM of
its own:

- slots: as many as the host's memory, less what the backend's running
  VMs have, and its CPUs give a build VM of 2 GiB and 2 CPUs each after
  keeping 6 GiB and 2 CPUs, at most backend.MaxToolSlots (4) and the
  number of images; one alone keeps base's size. A backend that can't
  list its VMs builds one at a time. A running VM's memory counts whole
  (7.5 GiB, not 7): TestBuildSlotsFit's running VMs fail when it isn't
  counted or is truncated.
- plan lowers the slots until the backend's disks have room:
  Floors.ForTools counts Tools once for each build VM at once, as on a
  disk without copy on write each is a whole copy of base.
- backend.ToolsSpec gets Slot, Slots, Size and Hold; Lima's slot VMs are
  the constants ToolsVM to ToolsVM4, sized with --cpus/--memory, and the
  first slot's build deletes what a killed run left in the slots this
  run doesn't use. Builds hold the share's lock, so one devvm uses the
  slots.
- A failed build's VM goes in the run's cleanup, which runs after the
  build let go of the share's lock: it deletes the VM only once it has
  the lock again (ToolsSpec.Hold, Env.holdShare's TryLockFile), and
  leaves it while another devvm holds it (a build, gc or the daily
  refresh) (TestBuildToolsCleanupHolds, TestBuildHoldsShareForCleanup).
  The next tools build deletes what it finds in the slots, and so does
  devvm gc, which holds the share's lock: backend.Images'
  DeleteToolsLeft, Lima's deleting the slots' build VMs that are there
  and no other VM, which gc asks of every backend first, without
  asking, a backend that can't being a run log line. It returns what
  it deleted, which gc names in one line (tools_build_vms_deleted), and
  gc then never says nothing_to_clean or nothing_deleted
  (gc_tools_build.txtar, TestDeleteToolsLeft in lima and vm, the fake's
  ToolsLeft). The cli skill's judgment.md names this exception to "gc
  --force deletes exactly what gc lists". The conformance suite's
  delete-tools-left checks that it deletes no other VM, not even the
  project VM of a folder named tools (devvm-tools-<hash>), and no image
  (TestConformanceFinds: deletesAllVMs, deletesImage, deletesByPrefix).
  The share's lock
  is the data folder's, so devvms with their own data folders and one
  Lima home don't exclude each other's builds: the docs say not to build
  tools or run gc in two at once (a lock per build VM in the Lima home
  would close it, but it would replace Hold and needs e2e).
- Side by side, one status line covers the builds
  (building_tools_together), and their commands' lines in the run log
  are tagged with their tool (msg.WithLogTag): the UI's LoggedCmd
  prefixes them and shows no status line of its own. Every write starts
  with the tag, as does every line in it, one ended by "\r" included,
  so no build can pass a line off as another's (TestTaggedWrites), and
  a tool's lines are found after another's "\r" (taggedLines splits
  there, a progress bar's updates staying one line: TestTaggedLines). The
  first failure cancels the others and is what Build returns, tagged
  (backend.LoggedIn), so ErrorLogged shows that tool's lines' end.
- A test build's DEVVM_TOOL_SLOTS caps the slots; the CLI tests set 1,
  so the stub's calls keep their order, and tools_side_by_side.txtar
  sets 3, with an interrupt that leaves no build VM. The stub keeps each
  build VM's folder by its name, and the fake backend's BuildTools runs
  its builds outside its lock, as a real backend's would, passing
  ToolsBuild its context.

Docs: images.md's Building tools and Free space, ports-size.md,
space.md, images.md (using) and gc's help (the build VMs gc deletes),
settings.md (one Lima home for two data folders), extending.md,
testing.md and tests.md; the cli skill's judgment.md; the CHANGELOG's
first highlight and the release page's A faster first run.

New messages: building_tools_together, tools_build_vms_deleted.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-29 22:57:15 -07:00
w3cjandClaude Opus 5.5 2de3e31a6c fix(vm): devvm ports shows a status line as it restarts a running VM's forwarder, and every lock's wait is tested for its label
Lock waits:
- Tests record the label of each lock's wait that had none, the lock held
  as by another devvm and the wait ended by a cancel, a deadline failing
  one that shows nothing rather than hanging: git_lock_waiting
  (TestGitLockWaits; .git protection's Serial is gitSerial, so a test can
  reach it), packages_waiting and rebuilds_waiting (TestImageLocksWait),
  ubuntu_pin_waiting (TestPinOriginWaits), custom_secrets_waiting
  (TestYoursLockWaits) and forwarder_waiting (TestForwardsLockWaits).
- A test build's locks panic on a nil platform.Waiting
  (platform.CheckWaiting, which the root's run calls in every test build
  beside state.CheckLockOrder), so the CLI tests and e2e catch a nil wait
  the structure test can't see, such as a zero agentlogin.File's; a
  msg.Waiting given a nil status shows nothing and stays review only.
  msg.Waiting with no status gives a wait that shows nothing, never nil;
  platform.NoWait is the Waiting of a lock that never waits (the build
  port's record, which passed nil), and the status-lines rule holds it to
  statusSites as it does nil (TestCheckWaiting, TestWaiting, the rule's
  NoWait case).
- forbidigo refuses syscall.Flock and unix.Flock outside internal/platform,
  internal/proxy/rotate.go, the stubs and tests (testdata/lint, both).
- TestLockFileWaiting runs in a synctest bubble and checks the wait shows
  while held, not before (its counters under a mutex, which the race
  detector needs, as only the file's lock orders them).

Status lines:
- TestCommandStatusLines runs the setters too: devvm ports LIST and ports
  add, size --cpus, network open, allowlist, transparent off and on, learn
  and allow, git-protect off and on, ssh-agent off. It found devvm ports on
  a running VM starting its forwarder again (ssh and a command in the VM)
  with no status line; that step now shows ports_restarting.

The folder named twice:
- vm_folder_unreadable's why was the open's error, the folder's path in
  it; folderUnreadable gives the system's reason alone when the error is
  about the folder itself (TestUnreadableFolder checks the whole message).
- platform.OpenNoLinks and StatFolder return a link on the path as an
  fs.PathError about the folder too (ErrLinkOnPath still matches), so that
  case names it once as well (TestStatFolderUnique).

Docs: Contributing's CLI page (status lines) and structure page, the
codebase-standards guards; CHANGELOG (devvm ports' status line).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-19 17:04:29 -07:00
w3cjandClaude Opus 5.5 cb7177b32c feat(ui): waits for another devvm's lock show a status line; a project folder devvm can't read says so
Lock waits:
- platform.LockFile and LockFileShared take a platform.Waiting, called
  once they find the lock held, never when it's free, whose end they call
  once the wait ends; LockFileWaiting, LockFileSharedWaiting and their
  delays (ShareNote, OCINote, WaitNote, groupsNote, makingNote) go.
- msg.Waiting makes one from a Reporter's Status and a label;
  msg.WithStatus and msg.StatusOf carry the run's Status in its context
  for the two packages that take no Reporter, internal/state and
  internal/trust, which cli's execute sets; forbidigo keeps StatusOf to
  them, and AGENTS.md says so.
- Every lock that waits shows its own label: vm_state_waiting (a VM's
  state, its deletion), claims_waiting, layout_waiting, git_lock_waiting,
  ca_waiting, packages_waiting, rebuilds_waiting, ubuntu_pin_waiting,
  custom_secrets_waiting, forwarder_waiting, agent_store_waiting, and the
  waits that printed a line after a delay, which now show theirs as a
  status line: share_waiting, oci_waiting, image_build_waiting,
  group_waiting, making_waiting.
- An agent's login file's lock (agentlogin's lockLogin, a folder's flock
  that a VM's proxy holds while it refreshes the login) tries first
  without waiting and shows agentlogin.File's Waiting
  (agent_login_waiting) while it waits; secrets fills it from its
  Reporter, for SaveLogins, Claude Code's logins folder and every File.
- The structure test's status-lines rule counts a LockFile or
  LockFileShared whose waiting is nil as slow work; the build port's
  record, a file just made that never waits, is listed in statusSites.
- Without a terminal, or with -v, a status line draws nothing, so the
  waits that printed an info line after a delay no longer print it there;
  the CHANGELOG and the troubleshooting page say so. from.txtar's check
  that a free conversion lock printed no wait goes, as TestLockOCI checks
  it.

The layout's migration runs under a status line (layout_migrating),
only when there are migrations to run.

Backend calls outside a launch: TestCommandStatusLines runs devvm ls,
ports, size, network, tools, git-protect, history export, stop and rm on
a running and a stopped VM and fails on a backend call with no status
line showing, with a control that each makes one.

A project folder devvm can't open and read (vm_folder_unreadable) was
taken for another folder's VM (vm_other_folder, which offers rm and
adopt, and adopt went on); the finder now keeps why (target.unread), and
every command on the folder's VM, from the folder or a subfolder of it,
names the folder and why; devvm rm VM run elsewhere goes by the VM's
name as before.

platform.UniqueFolderID had no caller but its test: FolderStat.Unique,
from the open folder, replaced it; it goes, and its test checks
StatFolder's Unique instead.

Tests: TestLockFileWaiting (rewritten: called only when held, its end
once got or given up, shared too), TestVMLockWaits, TestCheckLayoutWaits,
TestCheckLayout (migrations under layout_migrating, nothing shown
otherwise), TestLockGroups, TestLockShare, TestMaking, TestLockOCI and
the build lock's test (status lines, not info lines), TestLockLogin,
TestInitCACancelled (ca_waiting), the status-lines rule's lock cases,
TestCommandStatusLines, TestUnreadableFolder (a subfolder of it too),
TestStatFolderUnique.

Docs: Contributing's CLI page (Status lines) and structure page, the cli
and codebase-standards skills (the guards), AGENTS.md's Go conventions,
internals/images.md and design.md (the waits), using/troubleshooting.md,
using/vms.md (a folder devvm can't read); CHANGELOG.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-19 15:10:22 -07:00
w3cjandClaude Opus 5.5 aeea3135b2 feat(proxy): the proxy's broker and its child
A VM's proxy runs as two processes, as design.md's "The proxy's broker"
says: devvm _proxy, the broker, which keeps what only the host should
do, and devvm _proxy-child, which reads the VM's network and can be
confined by the follow-ups.

- wire.go: the protocol over one socketpair (close-on-exec from the
  start: SOCK_CLOEXEC on Linux, ForkLock elsewhere), length-prefixed JSON
  frames of at most 2 MiB, unknown fields refused, bytes as base64, one
  descriptor on a frame's first bytes (SCM_RIGHTS, MSG_CTRUNC breaks the
  rules), wire types for every secret (redact.Secret at once).
- broker.go: newBroker, the start (handshake: version 1 and each side's
  executable's SHA-256, within 4 s), the answers (value through lookups,
  kept 30 s or 5 min, a failure 5 s, dropped when the bindings change;
  file by number; link connected by the broker and passed as a
  descriptor; token exchanged by the broker), each by something in its
  own config, with caps 1/8/4/256; live: the lifeline closes the socket
  and kills the child 6 s later, SIGTERM stops it within a second, a
  child that ends ends the broker, a rule broken stops the child.
- child.go: the start (startOf), the child's server (newChildServer),
  the broker as hostSide over the socket (brokerClient), runChildOn;
  ready only after it reads the host's addresses (kept: the last good
  read), roots and time zone loaded first.
- process.go: Main(ctx, ...) and ChildMain; the child spawned with
  /proc/self/exe on Linux, PR_SET_PDEATHSIG from a locked thread
  (daemon.Cmd.DieWithThread), descriptors 3 and 4, and TZ, SSL_CERT_*
  and GODEBUG with updatemaxprocs=0 alone; run/proxy-child.pid and
  run/proxy.confined ("none" until the follow-ups); KeepLogs in the
  broker. ChildMain refuses to start unless descriptors 3 and 4 are a
  unix socket and an IP one (checkInherited): run by hand, without
  them, those numbers can be the Go runtime's own, which closing
  crashed it (signal_recv: inconsistent state).
- capture.go: a captured token request goes to the broker
  (captureToken, exchanger), so a login's real tokens never enter the
  child; an error reply passes up to 1 MiB, longer gets 502.
- watched.go: the child stats each changing file and asks the broker
  for it once it changed, keeping the stamp of what the broker read.
- rotate.go: proxy.log rotated by both through its descriptor, under a
  lock of a description of its own; OpenLog opens a log never through a
  link, one link, yours, replacing what a child left in its place.
- nixcache.go: the trim and its count through a safefile.Root, nar/
  only as a folder, links deleted as themselves; reads never through a
  link; the lock tried for 5 s (ErrNixLocked, nix_cache_locked).
- daemon: Cmd.Err, Files, Env, DieWithThread; Handle.Kill, Exit;
  WritePID.
- netpolicy: Proxy.Stop also stops a child that outlived its broker
  (run/proxy-child.pid, _proxy-child -for); proxy.log opened with
  OpenLog; a refused launch keeps a running VM only while both run.
  devvm network log and lock read the event log through safefile.
- vm, vmssh, vmlog: links.log and ports.log opened with OpenLog, read
  through safefile, trimmed only as a regular file with one link.
- backend: the build proxy's logs in a logs/ folder of their own.
- cli: _proxy-child; _proxy waits for its child on a signal
  (StopsItsOwn); the child reads none of devvm's folders (no
  makePrivate); ui.Files.
- Tests: FuzzBrokerFrames, the frames' rules, the handshake and the
  pair's end in synctest bubbles, the caps, the broker naming its own
  alone, the client over a real socketpair with a passed descriptor,
  ChildMain, TestInheritedSocket and proxy.txtar's child run by hand,
  the frozen 0.1.0 configs starting a broker and child,
  two writers rotating once, planted links, FIFOs and hard links; the
  testscript runner stops _proxy-child too; e2e: broker and child, their
  arguments, descriptors and environment, stop, SIGKILL either, planted
  files in the logs folder and the Nix cache, build proxies gone.
- Review fixes: the lifeline closes the socket and starts the kill's
  timer before logging; every log lock (proxy.log's, the event log's
  rotation) is tried without blocking for 200 ms (flockWithin, which the
  Nix lock shares), then written without or the rotation skipped; a
  copied log's rotation streams at most twice its limit from a line's
  start (copyFrom, copyAtomic); a reply too long to send goes as
  too_long; kept token headers capped at 1 KiB; the child gives up on a
  request whose context ended, dropping its late reply and holding its
  slot until then; a write deadline on the start frame; errors reach the
  child as codes (not_found, refused, busy, too_long, failed), their
  text in the broker's log; FuzzFrameStreams, and FuzzBrokerFrames
  writes from a goroutine; nix_cache_locked links to How it works.
- Docs: processes, network, overview, design (with threat rows for the
  logs' locks and a log made huge), troubleshooting, the proxy's
  README, structure, testing; CHANGELOG.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-15 22:04:32 -07:00
w3cjandClaude Opus 5.5 90a64a44d1 fix(races): lock order checked, sandboxes' own ports, pins that meet a rename, daemons' groups stopped
- state: test builds and tests check the state locks' order (state.held, CheckLockOrder): a second VM's lock, a VM's lock under the claims lock, or a lock taken again panics before waiting.
- platform: PinBeneath opens the path again when a rename takes the file away before move_mount (ENOENT), so the keeper no longer reports a false lost pin (TestPinsInNamespace's 'f lost / f pinned-again'); TestPinWhileRenamed.
- daemon: Proc.Stop signals the process group (SignalGroup), so forwarders' and link sessions' ssh masters and relays end with them; ui.UI.StopsItsOwn makes _ports and _links wait for their ssh on an outside SIGTERM.
- vm: gc --orphans and devvm space count forwarders' leftover control sockets (vmssh.ControlGlob).
- CLI tests: each sandbox claims a block of ports below devvm's range and the ephemeral range (claimPortBlock, /tmp/devvm-test-ports); free_port, the fixtures' ports and DEVVM_SSH_PORTS come from it, and the sandbox's devvm chooses from its own range (DEVVM_PORT_RANGE override). Fixtures' forwarded ports and settings ports are rewritten too (FIXTURE_PORT_<port>).
- netpolicy and vm tests: the fake proxy's stop waits for its reap, and fake daemons run until the test ends, not 30 s.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-15 22:04:31 -07:00
w3cjandClaude Opus 5.5 02ba74e614 build(lint): stricter linters, and the fixes they need
golangci-lint now also runs govet's nilness, unusedwrite, hostport and
waitgroup analyzers, nilnesserr, durationcheck, canonicalheader,
errchkjson, forcetypeassert, contextcheck and gochecksumtype.

- errchkjson checks each JSON encoding's error where the value could
  fail and drops it where errchkjson proves it can't, and reports
  structs without exported fields; tests may drop theirs.
- forcetypeassert holds the code; tests are exempt.
- gochecksumtype: agentlogin's format is a sum type (//sumtype:decl),
  and a switch on one names every case, default or not.
- canonicalheader: WWW-Authenticate, X-Request-ID, X-Api-Key.
- contextcheck: ctx threaded through carry, peekClientHello and sniOf,
  and through inject and value, whose cached lookup takes
  WithTimeout(WithoutCancel(ctx)), so two forbidigo nolints go;
  openTransparent takes its dialer's ctx. nolints stay where
  contextcheck can't follow: ReverseProxy's Rewrite, WithoutCancel
  alone, cobra's cmd.Context, e2e's runner window.
- No-behaviour fixes: scrubList for redact's list, the loopback
  forward's ports kept with its listeners, upgradetest's Key keeps its
  public key, a CA's leaves read through leafOf.

Contributing's Go lint rules lists each one and the sum-type convention.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-15 00:17:50 -07:00
6c36850251 feat(cursor): devvm cursor opens this folder's VM in the Cursor editor
devvm cursor is devvm code's twin for Cursor, the editor. It gets the
folder's VM ready as devvm host does, then runs
`cursor --remote ssh-remote+HOST DIR` in devvm's place, with the SSH
agent devvm started with. Without `cursor` on PATH it fails with
no_cursor_command, naming the host to connect to.

Cursor's Agent and your sign-in (from CJ's manual check with a real
login): recent Cursor runs Agent in the editor's server in the VM, which
holds your Cursor sign-in in memory only (no token on disk, in any
environment or command line) and calls Cursor from the VM. Cursor's
`cursorAgentHost.remoteInferenceRoute` is application-scoped, so it's
read only from the user settings on this machine; with it set to
"always", Agent's own requests go through the Cursor app here, while
the VM's server still talks to Cursor.

- vm: Code and Cursor share openRemote; vm.CursorCommand names the
  editor's command, apart from the CLI agent's agents.Cursor. After
  LookPath finds `cursor`, devvm reads Cursor's user settings on this
  machine (platform.AppSettingsDir: Application Support on macOS,
  $XDG_CONFIG_HOME or ~/.config on Linux) through safefile.Read, 1 MiB
  at most, read-only, as JSON with comments, and warns with
  cursor_agent_in_vm unless the route is "always". It never fails on
  the file.
- sync.sh: Cursor's ~/.cursor-server/data/Machine/settings.json gets VS
  Code's remote.autoForwardPorts, git.terminalAuthentication and
  github.gitAuthentication off, in one loop over both editors' files.
  devvm doesn't write the route there, since Cursor ignores it.
- structure: nameFree lets a literal that is an agent's name stand in
  one file, with its reason, and fails when it frees nothing.
- cli: cursor.go (--ssh-config, --here, --parent), registered beside
  code; cursor_failed, no_cursor_command, cursor_agent_in_vm and their
  doc links; ssh_host_info names Cursor too; the cli skill's judgment
  note: an editor's command is a bare verb named after the editor's.
- Tests: host_code.txtar (cursor, its full-name host, the missing
  command, the warning and no warning once the route is set),
  guest.txtar, TestCursorAgentWarning (always, absent, other values, no
  file, broken JSON, too long, a FIFO, the XDG path; never written),
  e2e network: devvm cursor passes the editor only the host and folder,
  a fake editor sign-in on this machine reaches neither the VM's home,
  its processes' environments nor the proxy's logs, and a Cursor login
  in the store reaches the CLI's methods while the agent store's are
  refused.
- Docs: SSH and editors (commands first; "Cursor's Agent": it runs in
  the VM with your sign-in, the user-settings line, what it doesn't
  cover, open only VMs you trust; if Tab doesn't work on the allowlist
  tier, devvm network allow api3.cursor.sh), the agents page's Cursor
  notes, Commands, attack vectors, design, the home page, CHANGELOG,
  generated CLI pages.

Reviewed adversarially before the push: the settings read (size, FIFOs,
links), the warning's wording and when it fires. Researched with PR
#44's design as reference only.

Co-authored-by: JB <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-13 00:05:36 -07:00
2f0cc97392 feat(paste): devvm paste and devvm paste rm (#38)
feat(paste): devvm paste, an image, PDF or copied file from the clipboard into the VM (#38)

devvm paste reads the host's clipboard and streams what's on it into the
running VM's paste folder over the backend's Exec, with no SSH agent and no
new channel, then copies the file's path in the VM to the host clipboard for
the agent's prompt. devvm paste rm empties the folder after a question, and
a launch that starts a stopped VM offers to.

What it reads:
- an image (PNG, JPEG, GIF, WebP; TIFF is converted to PNG), checked by its
  bytes; browsers hand over a PNG, so an animated GIF arrives as one frame
- PDF data, sent as it is, and preferred over a file reference beside it
  (Preview's page copies)
- one copied file, after a question that shows its path on this machine;
  --send-file answers it only for a file inside the project folder reached
  without links, and never for a --clone VM
- never text; several files are refused

Security:
- macOS reads file URLs only through NSPasteboard (FileURLsOnly): AppleScript's
  «class furl» coercion turned any text, such as a path a web page or the
  VM's OSC 52 put there, into a file to send
- copied files are opened with openat and O_NOFOLLOW|O_NOCTTY|O_NONBLOCK,
  following a root-owned link only in a folder only root can change, and read
  through internal/safefile (Checked), capped at 64 MiB
- osascript and pbcopy by absolute path, Linux's tools only from system
  folders, never PATH
- time limits on every clipboard tool and on paste.sh in the VM; bounded
  reads of everything the VM prints
- the path copied back is built on the host, keeping only the file's
  extension: nothing the VM says reaches the clipboard

Also: the paste-dir setting (default /tmp/devvm-paste, made at each
launch), --json with sent, the agents' guide line, messages with doc links,
stubs, CLI tests, an e2e check in the project section, and docs on
coding-agents, settings, design, security and attack-vectors.

Co-authored-by: dustypolk <[email protected]>
Co-authored-by: w3cj <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-11 22:29:46 -07:00
w3cjandClaude Opus 5.5 6fd1d846d6 fix(lima): cache a Linux VM's project folder with 9p's none
Linux's 9p client loses data with Lima's default cache=mmap for a
writable share: a stat() during an extending write() takes the host's
stale size and writeback drops the data, so files reach the host empty
or cut to 4096 bytes even after fsync (Claude Code's Edit sets it off);
and on devvm's Ubuntu 26.04 guest kernel, a lock after a write makes the
next read return zeros, which breaks SQLite in any journal mode and
Gradle's daemon. macOS's vz VMs use virtiofs and aren't affected.

- New VMs on a Linux host record cache mode none in a new mount section
  of vm.json, and their project folder is made and started with it, as
  is the folder devvm clone off mounts. VMs whose state has no mode
  (0.1.0's, and every VM made before this) keep Lima's mmap untouched,
  with no limactl edit, and each launch warns (mount_cache_unchosen)
  until devvm mount-cache none.
- devvm mount-cache [none], with --json: none is the only mode devvm
  sets, so any other value is a usage error (mount_cache_invalid); a
  stopped VM gets it in its next start's one edit, a running one after
  the restart devvm offers. macOS refuses (backend_lacks), and so does a
  Linux VM whose folder isn't a 9p mount (mount_cache_no_choice). No -g
  or config.toml key: every new VM gets none.
- The start that changes the mode mounts the folder again in the guest,
  as cloud-init rewrites fstab only after systemd has mounted it, through
  the logged runner with a minute's limit (output pipes closed a second
  after), then checks it with mountpoint and findmnt, reading 4 KiB at
  most and only the last line: a folder left unmounted stops the VM and
  fails the start before its shell (mount_cache_unmounted), and so does a
  check that gets no answer (mount_cache_unchecked); one still mounted
  with the old mode is warned of (mount_cache_remount_failed), any mode
  but none or mmap named unknown. An interrupt meanwhile, on any tier,
  leaves a cleanup that stops the VM, the one stop then. A launch into a
  running VM asks the guest, in words, whether its folder is a mount
  point, and refuses one that isn't (project_unmounted) or whose check
  fails or gives no answer (project_unchecked). A stored mmap, from a
  build before none alone, reads as none chosen, and devvm clone off
  records none for its new mount; any other mode is refused naming
  vm.json.
- backend: FeatureMountCache (native on Linux, none on macOS, built on
  project-mount), Want.ProjectCache, Instance.ProjectCache, CacheModes.
- lima: mount rewrites keep only the sshfs and 9p settings devvm knows
  where they differ from Lima's defaults, and drop the rest for Lima to
  fill in, so lima.yaml never freezes a default; same() compares the
  cache where devvm sets one. Build VMs' writable output folders (tools,
  --from) get none.
- tools: an EROFS tool image that ends before its superblock does, or is
  shorter than its superblock says, as a build under mmap could leave
  one, counts as not built, so the next build makes it again; a build's
  short output is refused. The fakes' tool images are a page
  (backendtest.ToolImage).
- The limactl stub lists QEMU's vmType, fills in 9p cache defaults on
  Linux, and answers the remount's check.
- Docs: backends/lima (the project folder's cache, when it changes,
  programs that map files for writing, SQLite), using/limits,
  using/clone, commands, internals/lima, internals/backends, the design
  note (both mmap bugs, why none alone, the remount, tool images, the
  e2e findings), the CLI reference and the cli skill.
- Tests: TestProjectCache, TestMountRoundTrip,
  TestStartSetsProjectCacheOnce (the remount's outcomes), TestCutShort,
  TestBuiltCutShort, TestGuestMountOptions, TestFilledMounts,
  TestUpCacheMode, TestWarnMountCache, TestCacheAtNextStart,
  TestSwitchCache, TestSetMountCache, TestCheckStateCache, the
  mount_cache CLI test, clone_switch and the 0.1.0 fixture on Linux, and
  e2e's projectMountCache (findmnt, a stat-while-write loop, SQLite's
  journals, a shared writable mmap refused, the opt-in switch of an
  unchosen VM, what mmap does reported, macOS unchanged).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-09 07:17:12 -07:00
w3cjandClaude Opus 5.5 3e81767482 refactor(cli): each command carries its own docs link, group and samples
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]>
2026-11-08 10:05:13 -07:00
w3cjandClaude Opus 5.5 8d44175601 refactor: the Go module is github.com/devvmhq/devvm
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-06 06:16:29 -07:00
w3cjandClaude Opus 5.5 b80550bc5a feat(vm): customizing a new VM asks which ports it forwards
After the network tier, a picker (PickOne) offers every port, none, or
a list typed at new_vm_ports_prompt and checked by settings.ParsePorts,
asked again on port_invalid. The summary's ports are preselected and
Enter at the list keeps them; the choice is this VM's alone. --ports
skips it and counts in leftToChoose; where devvm can't ask, the
summary's ports stand. Ports are now read for the requirements after
the choice. new_vm_choose, the customize question and devvm's help name
--ports. Tests: TestPortsRows, TestChoosePorts, TestUpCustomize,
TestLeftToChoose, up_customize.txtar, network.txtar. Docs: commands.md,
first-vm.md, images.md, ports-size.md, devvm.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-06 02:15:28 -07:00
w3cjandClaude Opus 5.5 086ee543c3 feat(vm): customizing a new VM asks its disk after its memory
The disk's question (new_vm_disk_prompt) starts from the summary's disk,
after one line saying it grows with devvm size --disk but never shrinks
and takes only what the VM writes (new_vm_disk_question). It's this VM's
alone, skipped with --disk, and a disk below the image's or not a size is
refused with Size.Check's and ParseGiB's messages, then asked again.
leftToChoose counts the disk; new_vm_choose and the customize question
name --disk. Tests: TestSizeChoiceAskVM, TestUpCustomize, TestLeftToChoose,
up_customize.txtar. Docs: commands.md, first-vm.md, images.md, devvm.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-06 00:52:27 -07:00
w3cjandClaude Opus 5.5 8e851cddf4 feat(ui): devvm's logo atop the root help, the first run and each new VM's summary
The logo prints from the UI alone (ui.UI.Logo, msg.Reporter's Logo), once
a run, only with stdout a terminal (or a test build's PickOnPipe), not with
--no-input, --json or names mode; its mark green, plain under NO_COLOR. The
CLI reference's pages don't get it: only the root's help func prints it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-06 00:35:59 -07:00
w3cjandClaude Opus 5.5 5f7289e6f7 feat(cli): devvm upgrade, the newest release the way devvm was installed
devvm upgrade [--check] [--to VERSION] [-f/--force] [--json] installs
devvm's newest release the way this devvm was installed, asking first
(upgrade_confirm, answered by --force). upgrade is a top-level exception
in the cli skill: it acts on devvm itself, not this folder's VM, and it's
the name other tools give the verb. It skips the layout check, as a
layout a newer devvm wrote is a reason to run it.

- install.sh's (<prefix>/lib/devvm/<version>/devvm, which
  <prefix>/bin/devvm links to): SHA256SUMS and its .minisig over HTTPS,
  the signature checked against the key built in from
  packaging/minisign.pub (packaging/key.go embeds the folder; no file,
  no key, and upgrade_no_key), the archive's SHA-256, unpacked into
  lib/.<v>.new.<pid>, run (--version), renamed to lib/<v>, the link
  switched atomically (symlink beside, rename over), run again through
  the link, rolled back on any failure; then older versions pruned as
  install.sh does (kept: the one that ran, any a running process names,
  another upgrade's staging folder).
- Homebrew's (a Cellar/devvm/ keg): brew upgrade devvm, asked first,
  through the run log; --to refused.
- Anything else: says how it was installed (a checkout build, go
  install, a copy elsewhere) and fails.
- Already latest says so; a newest release older than this devvm is
  refused even with --force (rollback); --to installs a named one, older
  asked about (upgrade_confirm_older). --check and --json install
  nothing.

minisign verification is Go's: ed25519 over blake2b.Sum512 for the
default prehashed ED signature (legacy Ed refused), the key ID, the
global signature over signature||trusted comment, and the trusted
comment "devvm <version>" as scripts/release.sh writes it. Verified
against a signature minisign 0.12 made. golang.org/x/crypto v0.58.0
added for blake2b only (approved; depguard allows only
golang.org/x/crypto/blake2b); MVS raised x/text to v0.43.0 and x/tools
to v0.51.0. mise run vuln: no vulnerability reached; the module-level
GO-2026-5932 is x/crypto/openpgp, which devvm doesn't import.

New: internal/upgrade (Detect, Source: Latest, Check for the release
notice to call, Fetch; ParsePublicKey/Verify; Valid/Compare; Upgrader),
internal/upgrade/upgradetest (TLS release server, minisign signer;
tests only, a structure layer), fetch.Resolve (where a HEAD's redirects
end), fetch.Download's size cap (mise's 256 MiB too). Test-build
overrides: DEVVM_REPO_URL, DEVVM_RELEASE_KEY, DEVVM_RELEASE_CA,
DEVVM_TEST_VERSION; script command release_server [-badsig].

Security review (security-audit skill, guidance mode, a fresh reviewer):
- Prerelease order compared suffixes as text (rc.10 < rc.9), which let
  an older signed prerelease past the rollback refusal: fixed, semver
  precedence, with table cases.
- No cap on the archive download (a host could fill TMPDIR before the
  checksum failed): fixed, fetch.Download takes a limit.
- Two upgrades at once: prune removed another's staging folder: fixed,
  .<v>.new/old.<pid> folders are kept while that pid runs.
- A failed rollback of the link was silent: fixed,
  upgrade_rollback_failed names the link and the old devvm, and the new
  folder stays so the link isn't left dangling.
- QEMU's guestfwd names devvm with commas doubled, which the in-use check
  missed: fixed.
- Freeze (a host serving the current version as newest forever): no
  boundary crossed, inherent without signed expiring metadata;
  documented in internals/install.md.
Checked sound: nothing untrusted runs or unpacks before the signature
and SHA-256; versions from the redirect and --to pass Valid before any
URL or path; tar takes only regular files in its one folder (no links,
subfolders, ..), 512 MiB cap, fixed modes; test overrides are read only
by test builds.

Tests: minisign (real minisign fixture, tampering, legacy, other key),
each install kind against the fake TLS server, bad signature, wrong
trusted comment, replaced archive (wrong SHA), bad archives, a new
devvm that fails before and after the switch, a failed switch (old
kept), a failed rollback, downgrade refused and --to, pruning, Homebrew
via a brew script, Check, Latest's failures, Compare; CLI test
upgrade.txtar.

Docs: getting-started/install.md (Upgrading: how, what it checks, an
older release, --json), getting-started/commands.md (This machine row,
Upgrading devvm, questions, output for scripts), internals/install.md
(devvm upgrade), contributing (release_server), the CLI reference.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-05 22:47:23 -07:00
w3cjandClaude Opus 5.5 d94929523d feat(vm): a new VM shows a summary, then asks whether to customize it
Before devvm makes a new VM it shows a summary of what the VM gets:
each toolchain, coding agent and layer with why (the file that calls for
it, devvm setup, config.toml or the flag that gave it), its size, network
tier and ports, and the devcontainer.json it's made as. Where the picker
shows (CanPick) and something is left to choose, it asks
"Customize it? [y/N]": Enter makes the VM as shown; y opens the picker
(a part a flag gave greyed out), then the network tier question when no
tier is given or saved, then the VM's CPUs and memory (for this VM
alone). Without a terminal or with --no-input the summary ends with the
flags that choose others. The summary replaces new_vm_gets and
devcontainer_using. devvm's first run asks its size and agents first,
as before, then shows the summary.

A test build's DEVVM_PICK_ON_PIPE shows the picker with a terminal on
stdin alone, so testscript's ttyin reaches it (up_customize.txtar).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-05 16:48:53 -07:00
w3cjandClaude Opus 5.5 317bd8f978 feat(agents): devvm's agent store, filled by devvm agent import
Every VM gets its agents' settings and logins from devvm's own store,
never from the agents' files in the home folder: settings in
~/.config/devvm/agents/<agent>/, logins in
~/.local/share/devvm/logins/<agent>/ (folders 700, files 600, each
agent's logins folder kept out of Time Machine), each laid out as in a
home folder. The store's settings folders are mounted read-only and
linked into the VM's home; its files and logins are copied in, with
network policy as placeholders the proxy fills from the store.

devvm agent import [AGENT...] [--force] copies the home folder's agent
settings and logins into the store once: only agentDirs, agentFiles and
secrets.LoginRel's paths, never history; .claude.json reduced to its
settings, account state and MCP servers; read through each agent's
folder as an os.Root, so no link out of it is followed (a link to a file
inside becomes a copy, any other is left out with a warning, and so is
a login file that's a link); Claude Code's plugin records renamed to the
store's folders. It asks before replacing what the store has (refused
without a terminal, naming --force), replaces in place, keeping the
mounted folders, and prunes what the home folder no longer has.

- paths: Dirs.AgentSettings, Dirs.AgentLogins
- secrets: LoginRel, LoginFile(Dirs, kind), SaveLogin, HasLogin,
  Store.ExcludeFromBackup; Logins, VMLogin, ClaudeCopy, MCPSecrets and
  the proxy's Get read the store
- vm: agentStore, agentMounts/homeSkips/Inventory.Mounts take Dirs,
  syncer.stageAgents, AgentImport; the guest's links file holds each
  folder's home path and its mount's (host_home is gone)
- structure: callers takes methods (pkg.Type.Name);
  Dirs.AgentSettings only in vm/agents.go, Dirs.AgentLogins only in
  secrets/secrets.go
- messages: agent_import_none, agent_import_nothing,
  agent_import_replace, nothing_imported, agent_settings_imported,
  agent_login_imported, agent_import_link_left_out,
  agent_login_read_failed, agent_import_failed; the login refresh
  messages point at devvm agent import
- tests: agentimport_test.go, testdata/script/agent.txtar, sync and
  network scripts through the store, e2e project and network sections
- docs: coding agents (devvm's agent store, importing from this
  machine), README, getting started, safety, internals, contributing

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-05 14:08:41 -07:00
w3cjandClaude Opus 5.5 d58b24affe refactor(ui): prompts in one place: each question declares its answer
Every question is a msg.Question that declares what answers it where
devvm can't ask: AnsweredBy("--force") names a flag or command, which the
refusal names (no_input), and RefusedWith(msg.X(...)) gives a question no
flag answers its own refusal. msg.AnswerFor and its table go.

The Reporter's Ask, Confirm and Answer, and the UI's Secret, take a
Question and return a *msg.Refusal where they can't ask: with --no-input,
without a terminal, or at the end of the input, one refusal for all three
causes. Commands return it through the failure path (showFailure ->
UI.Refused: the question, then the refusal); nothing dies on an unanswered
question any more. Questions with a usual answer fall back on it instead:
network policy on, restart no, history import later, the Include line
warned, an unenforced VM stopped, the first run's size kept.

Gone: confirmed() in cli (4 callers), force_needed and no_input_terminal,
vm.Env.CanAsk and ui.CanAsk, vm's interactive, setup's terminal, the
Reporter's StdinIsTerminal/StdoutIsTerminal and the Fake's StdoutTerminal,
and every caller's terminal check (18 in vm, netpolicy, build and
sshconfig; 3 CanAsk; 1 interactive; 2 in cli). The picker's check
(CanPick) stays in the picker, which keeps its choices with --no-input
too; setup and the first run's agents and the new-VM summary still read
CanPick, because what they save or say depends on whether the picker
showed.

A Question's About context (the network policy's, a secret's howto, the
restart's changes, the size's host) is said only when it's asked.
devvm update asks before its tools change, so a refusal leaves the VM as
it is.

The CLI tests answer through a terminal (ttyin) or, explicitly, with a
test build's DEVVM_PIPED_ANSWERS=1, a line of input each.

Tests: ui's TestConfirm, TestAsk, TestAnswer, TestPromptsOnlyAtATerminal,
TestSecret, TestNoInput, TestNoTerminal, TestNoAnswer, TestPipedAnswers,
TestRefusedInterrupted, TestPickNoInput; msg's TestQuestionRefused,
TestQuestionAbout; cli's agreement test TestQuestionsDeclareAnswers (every
AnsweredBy names devvm's flags and commands, every RefusedWith a message,
no Question made otherwise) and TestCheckAnswer; vm's
TestSizeChoiceRefused; testscript prompts.txtar (each cause, a refusal of
its own, piped answers).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-05 11:49:57 -07:00
w3cjandClaude Opus 5.5 ca8a91305b fix(ui): one failure path, and an interrupt's cleanups wait for the command
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]>
2026-11-05 10:42:20 -07:00
w3cjandClaude Opus 5.5 e13839aa41 feat(cli): every command on the folder's VM takes --here and --parent, resolved in one place
The VM a folder uses is decided once, by vm's resolveFolder, from the
folder's own VM, the nearest parent folder's (with any repo of its own
in between) and the command's rule (vm.Env.Folder): by default the
folder's own, else the parent's unless a nested repo is in between,
else none (devvm makes the folder's own, other commands say no_vm).
--here takes only the folder's own; --parent takes the parent's across
a nested repo and past the folder's own, and refuses a folder inside
none with a VM (no_parent_vm). devvm asks nothing now, in a terminal
or not: use_parent_vm and use_parent_vm_repo are gone. The questions
before deleting, remaking or widening a parent's VM stay.

find resolves through it; own is the folder's own VM (adopt, --clone);
lookup and useParent are gone; Options.Here is the rule's.

cli: addFolderFlags (flags.go) adds --here and --parent into the run's
app, which vmEnv sets as the rule; the two are exclusive, and with -g
where a command has it; --clone and --parent are exclusive; devvm rm VM
takes neither (rm_vm_folder_flag). Commands: devvm, restart, stop,
update, rm, code, desktop, host, history export, tools (add, rm,
update), size, ports (add, rm), network (allow, deny, rm, log),
ssh-agent, git-protect, clone, secret use, secret unuse, layer add,
layer rm, group (join, leave), link (add, rm, publish, unpublish).

Tests: TestResolveFolder (own, parent, none, nested repo, --here,
--parent), TestFolderFlags (every folder command takes both, and no
other; refusals before anything runs; the rule each sets), the parent
tests and subfolder.txtar's cases updated for no questions and --parent.
Docs: the Commands page's subfolder section, first VM, --clone's
subfolders, the overview's subfolder VM; the CLI reference regenerated.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-05 01:21:41 -07:00
w3cjandClaude Opus 5.5 e132a29b5a refactor(cli): one per-run app holds the run's services
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]>
2026-11-05 00:53:51 -07:00
w3cjandClaude Opus 5.5 2933b535a9 feat(clone): devvm clone on|off switches a VM to or from its own clone
devvm clone [on|off] is a setting: bare (and --json) it shows whether the
folder's VM has its own clone of the repo. on and off make the VM again
through the shared remake, keeping its home folder and settings, after
asking (--force, --no-export, --clean-home as devvm layer add).

- on: a mounted VM is made again with nothing of the folder mounted; its
  branches are seeded as a new --clone VM's, and once the old machine is
  deleted, .git is checked as a launch does and unlocked.
- off: the clone is checked as devvm rm does (unfetched branches offered
  for fetching into saved/<remote>/*, uncommitted changes asked about,
  terminal only; --no-clone-check skips it after a warning); the remote
  goes before the new machine's .git is locked, and is added back if the
  switch is undone.
- The remake records its clone mode (remake.clone), so a remake that
  didn't finish finishes in it, and undo restores the old mode.
- devvm --clone on a mounted VM and layer add/rm/update on a clone VM
  now name devvm clone on/off. rm's clone check messages name the
  command; --no-clone-check has one help text (addNoCloneCheckFlag).
- teardown removes a clone's remote and .git's locks independently.

Tests: TestSetCloneOn, TestSetCloneOff, TestSetCloneUndo,
TestSetCloneRefuses, clone_switch.txtar, e2e clone section checks.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-04 15:21:09 -07:00
w3cjandClaude Opus 5.5 f4ad9c2c3d feat(vm): devvm update makes an outdated VM again from its image's new build, keeping its home and settings
devvm update [--force|--no-export|--clean-home] (internal/cli/update.go)
is the shared remake with the VM's own image name: Lifecycle.Update calls
toRemake, decides with build.Builds.Outdated (WarnIfOutdated's check, now
its owner) whether the chain's keys changed, says vm_current and does
nothing when they didn't, else names what changed (vm_changed) and calls
remakeTo. --from VMs are judged on the recorded digest and built with
build's lookup. The remake's flags are one adder (addRemakeFlags) for
devvm layer add and devvm update. vm_outdated names devvm update.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 19:47:49 -07:00
w3cjandClaude Opus 5.5 bdc95ef6ee refactor(ports): port forwarding out of the backends, one owner in vmssh
The port forwarder is devvm's on every backend. vmssh (moved out of
internal/backend) holds it, the link sessions, and its one owner,
vmssh.Forwards: the lock, stop and start of a VM's forwarder, which
ports it forwards read from vm.json (ports.Forwarding) each time, the
listed ports a host program has left out (ports_taken), the host key
devvm pins, and the backend's new ForwardTarget (user, key, host
loopback port) and Lifeline. One hidden command, devvm _ports
(cli/forwarder.go, vmssh.Main), replaces _lima-ports.

The backend no longer forwards: SetPorts, Want.Ports, Confinement.Free,
Confinement.HostKey and Confinement.Forwarded go; Lima keeps its own
forwards off and gives ForwardTarget (Lima's ssh port on 127.0.0.1,
Lima's user, _config/user). Lima's Stop and Delete no longer touch the
forwarder, and Lima's Forget goes with the backend/ folder: the
forwarder's files are in the VM's run/ (ports.pid, .status, .lock,
.known_hosts) and logs/ (ports.log), its control socket run/port-<hash>.ctl.
vm starts the forwarder after each start and on devvm ports of a running
VM; devvm stop, rm, gc --orphans and an interrupted start stop it.
vm/ports.go's hand rollback goes: the state changes first, and a
forwarder that can't start only warns. A structure-test layer keeps
backends from importing vmssh.

Tests: TestForwardsStart, TestForwardsRun, TestForwarderMain,
TestSplitPorts (vmssh); TestForwardTarget (lima); TestForwarding
(ports); TestStartPorts, TestSetPortsRunning (vm); testscripts up,
ports, layout, gc_orphans updated. Docs: internals/ports.md,
backends.md, lima.md, design.md (Ports on Lima), overview.md,
using/space.md, contributing.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 18:19:39 -07:00
w3cjandClaude Opus 5.5 628dc11c94 feat(state): a layout version for devvm's folders, made_by in its records, the golden listing and doctor's leftovers in vms/
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]>
2026-11-03 15:50:49 -07:00
w3cjandClaude Opus 5.5 79b3ef94d4 refactor(cli): one backend: no --backend flag, no BACKEND column
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]>
2026-11-03 12:46:28 -07:00
w3cjandClaude Opus 5.5 f4fd373439 refactor(backend): remove the smolvm backend
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]>
2026-11-03 11:34:05 -07:00
w3cjandClaude Opus 5.5 1917072228 refactor(backend): remove the Docker backend
devvm is about VMs, and Docker's containers aren't VMs: Lima is the
default backend and smolvm stays experimental. The backend architecture
(Backend, Caps, Require, the registry, backendtest.Fake) stays, so
another backend is an addition.

Removed:
- internal/backend/docker, its registry entry and Names/Experimental's
  docker half; devvm _docker-connect and _docker-ports
  (internal/cli/dockerssh.go); assets/docker/unpack.sh.
- Test-build overrides DEVVM_DOCKER_KIND, DEVVM_DOCKER_PROC_SYS,
  DEVVM_LINUX_BUILD_URL/_SHA256, the registry.linuxURL/linuxSHA256
  ldflags vars and the CLI tests' Linux-build archive (linux_release).
- Interfaces only Docker implemented, with their callers:
  backend.ProxySocket/ProxySocketOf (the proxy's -listen-unix),
  DiskUser (ls's and size's disk-over warning, size's disk_used and
  --json disk_used_gib), Reporter (doctor), LeftoverLister and Leftover
  (gc --orphans' volumes, networks, containers and images),
  DockerLayerVM and VMSpec.DockerLayer, SSHTarget.ProxyCommand and
  vmssh.SSH.Proxy, vmssh.SSH.SessionArgs, CacheEntry.Name.
- The docker layer's runtime on a backend that makes VMs for it:
  vm/dockerlayer.go, KeyDockerLayer, chooseNet's refusal (chooseNet
  returns a bool now), the refusals at start and devvm network on, ls's
  "(sysbox)" and --json docker_layer, size_disk_default_unused.
- The proxy's relay mode (relay.go, -relay, -relay-to, -listen-unix).
- paths.Dirs.Docker and paths.VM.Lifeline.
- assets/guest/tools.sh's linked-folder branch; services.sh's
  DEVVM_LOOP, DEVVM_DOCKERD and DEVVM_SSHD=inetd.
- Messages: every docker_* the backend used, docker_layer_runtime,
  net_docker_layer, net_off_docker_layer, committing_image,
  pulling_image, unpacking_tools, disk_over, size_disk_default_unused,
  gc_orphan_volume/_network/_container/_image, docker_connect_failed;
  gc_orphan_elsewhere reworded.
- Tests: docker.txtar, the docker stub's engine (its --from half
  stays), the ssh stub's login-shell branch; e2e's --backend docker,
  --engine, the docker host VM and Docker Desktop runs.
- Release: one GoReleaser pass, no Linux-build pin in the macOS builds,
  no Linux devvm in the Homebrew formula's libexec. Linux builds stay.
- Docs: backends/docker.md and internals/docker.md, design.md's Docker
  notes, the Docker column of the feature table, and every page's
  mentions of the Docker backend, Docker Desktop as one, and Sysbox.

Kept: the docker layer in Lima VMs, devcontainer docker-in-docker,
--from with images only a local Docker has, Docker Hub references.

State written by a Docker VM before this reads as an unknown backend
(backend_unknown_vm).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 10:26:07 -07:00
w3cjandClaude Opus 5.5 a134e0d8a6 feat(cli): choose a new VM's toolchains, agents and layers in a picker or with --tools, --agents and --layers
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]>
2026-11-03 00:45:09 -07:00
w3cjandClaude Opus 5.5 665b9f3b22 feat(group): devvm group, group join NAME and group leave: VMs that reach each other's published ports by name, through links
A group's links are links in each member's state, marked as the group's
(a sixth field, ,group), so the link session, the proxy's list and every
connection check treat them as any link. Membership is each member's own
state (group, group_as), so a VM made again is in none.

- internal/vm/groups.go: Groups (Show, Join, Leave), groupLinks (pure:
  the user's links kept and taking precedence, a link per published port
  of each other member, one address per member kept across changes),
  sync/syncVM/change (records, names what each member gains and loses,
  applies to running members), clashes warned.
- All or none: join refused by network policy (group_policy_on/off);
  devvm network on/off refused for a member (group_policy_mixed).
- One group at a time (group_other); names unique in a group
  (group_name_taken, group_name_host); a member whose hostname is
  another's name gets no links to it (group_link_name_host).
- CheckLink refuses a group's link once the two aren't in one group
  (ungrouped); leave removes the leaver's own group links first; join
  again works every member's links out again; link rm refuses a group's
  link that still applies (link_from_group).
- Publish/unpublish, link add/rm and devvm rm reach the group's links.
- Docs: using/links.md Groups, the Commands page, safety/network.md,
  internals/ports.md, the design note's Groups section and threat check;
  the CLI reference.
- Tests: groups_test.go, testdata/script/group.txtar, JSON shape; e2e:
  three VMs in a group and the all-or-none refusals in the link section
  on every backend.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-01 16:01:54 -08:00
w3cjandClaude Opus 5.5 6805d194bd feat(link): devvm _links, the host side that carries a client's links, and the forwarder skipping links' addresses
vmssh.Links runs a running client VM's link session: one ssh master of
its own to the client (never the forwarder's), started with
ClearAllForwardings=yes and -N, to which each link is added with
-O forward -R 127.77.x.y:PORT:<socket> and from which it's removed with
-O cancel, read again every second (Want). Each forward is its own, so
one the client refuses fails that link alone (Failed, which warns with
link_port_taken through Link.PortTaken). Each link's end on the host is
a unix socket, mode 600, in the run folder (made 700), named
link-<hash of client, address, port>.sock; masters' control sockets are
link-<hash>.ctl (the session's; a target's by target and start). A
stale socket is replaced, anything else refused, and sockets go with
their link or the session.

Each connection is checked again (Check), then carried by
ssh -S <target master> -o ProxyCommand=/usr/bin/false -W 127.0.0.1:PORT
through a master kept per target and start: a channel goes through the
master or nowhere. At most 256 at once, then refused (link_limit).
Events (link, link_refused, link_target_stopped, link_limit) go to the
client's event log. The session ends once the client no longer runs its
start, or has no links.

vm.Links.Session builds it from the state and the backends: the
client's and targets' ssh from Backend.SSH, the key its first
IdentityFile, host keys devvm's pinned known_hosts (HostKeyAlias), only
on a host loopback port or through the backend's ProxyCommand, FeatureSSH
allowed. linkConn re-reads the states per connection: the link still in
the client's state (removed), CheckLink (gone, replaced, unpublished,
policy), the link features on the target's backend, the target running
(Inspect, StartID: link_target_stopped otherwise; it never starts one),
its ssh (ssh). devvm _links VM (hidden, one argument) runs it, failing
with link_session_failed or vm_not_running.

The port forwarder never forwards a listener in 127.77.0.0/16 (dialAddr,
vmssh.IsLinkAddr), on any VM; a test keeps vmssh.IsLinkAddr equal to
vm.IsLinkAddr on every link address and around them.

netpolicy.AppendEvent writes devvm _links's events beside the proxy's,
mode 600, rotating past 10 MiB; events carry target, which FormatEvent
and devvm network log --json show.

Tests: TestLinkArgs, TestLinkFiles, TestListenSocket, TestLinks,
TestLinksSessionLost, TestLinksCap, TestIsLinkAddr, TestListeners
(range exclusion) in vmssh; TestLinkAddrsAgree, TestLinkConn,
TestSessionLinks, TestLinkEvents in vm; TestAppendEvent and link cases
in TestFormatEvent; link_session.txtar for _links's argument and
refusals; e2e's project section checks a server on 127.77.0.1 isn't
forwarded while the VM's own on 127.0.0.1 with its port is.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-01 06:48:11 -08:00
w3cjandClaude Opus 5.5 4ea141b918 feat(link): devvm link, link add, rm, publish and unpublish, with their state and checks
Links between VMs' commands and state, without anything carrying a
connection yet.

- state: every VM gets a random ID (KeyID, "id") when CreateVM makes it.
- vm: Links (links.go) lists, adds and removes the folder's VM's links
  (KeyLinks, "links": NAME,PORT,TARGET,TARGET_ID,ADDR entries) and
  publishes and withdraws its ports (KeyPublish, "publish"). Each target
  gets one address in 127.77.0.0/16 per client, the lowest free. CheckLink
  says why a link doesn't apply (gone, replaced, unpublished, policy).
- project: Matching (which sshconfig.Alias now uses), IsPath, ForDir and
  Targets resolve a link's TARGET: a path, a VM's name or a folder name.
- cli: link.go, in the Links between VMs group; --json on devvm link and
  devvm link publish; --as checked with the other flag values.
- Messages: no_vm_link, link_failed, link_port_invalid, link_ports_invalid,
  link_unknown_target, link_ambiguous_target, link_self,
  link_not_published, link_policy_mismatch, link_name_invalid,
  link_name_host, link_name_taken, link_target_named, link_exists,
  link_added, link_trust, link_removed, link_not_found, link_port_taken,
  published, unpublished, port_not_published.
- Docs: the Links between VMs table on the Commands page, the CLI
  reference, AGENTS.md and the cli skill's tree.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-01 06:13:15 -08:00
w3cjandClaude Opus 5.5 0b03f334fb feat(cli): help in groups, with short texts, examples and each command's docs page
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]>
2026-11-01 04:39:39 -08:00
w3cjandClaude Opus 5.5 16b4ad8771 feat(cli): --no-input, a flag or command for every question, and --force only skips a confirmation
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]>
2026-11-01 03:51:27 -08:00
w3cjandClaude Opus 5.5 a7b605f0c0 feat(cli): -v/--verbose streams the run log
A global -v/--verbose (persistent on the root, the only one with
--help): each line the run log gets, numbered steps, the redacted
command lines and the commands' output, also goes to stderr as it's
written, without control characters (a C1 control split across writes
too) and dim where stderr is colored, with no status line. The run log
is still written. A logged failure while verbose names the log
(log_details) instead of printing its end again. DEVVM_VERBOSE is gone.

ui: SetVerbose; stream (printable, dim) and logTo tee LoggedCmd's and
LogWriter's output; a streamed command's pipe gets WaitDelay
(streamWait, 2s) so a process it leaves running can't hold devvm, and
ErrWaitDelay alone isn't a failure. --version stays root-only, and
version.txtar checks -v isn't it.

Tests: TestStreamIsPrintable, TestDieLoggedVerbose, the logged-command
and status tests; build.txtar streams a build with -v. Docs:
troubleshooting (A command fails), settings (colors, environment),
commands (Flags and values), contributing (styles); CLI reference.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-01 02:55:59 -08:00
w3cjandClaude Opus 5.5 e782de9ae8 feat(cli): flags local to their commands, one meaning per name, and one duration grammar
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]>
2026-11-01 03:14:23 -08:00
w3cjandClaude Opus 5.5 cd6fc60576 feat(cli): --json on every command that shows or lists
ls, images, tools, size, ports, network (and -g), network log (and
--blocked), ssh-agent, git-protect, secret, history, space, retention and
doctor take --json: one JSON object on stdout with "version": 1 first,
messages on stderr (ui.DataOnly), lists [] when empty. Settings commands
only show with --json and refuse a value (json_shows_only). doctor --json
replaces --fixes: problems with key, fix (null without one) and message,
warnings, docker and every backend's features; it prints nothing else and
succeeds whatever is missing, and install.sh reads its problems with awk.
TestJSONShapes holds each command's field names and types. Each shape is
documented on its command's page, with the contract under Everyday
commands' Output for scripts.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-01 03:06:56 -08:00
w3cjandClaude Opus 5.5 fe32d2a01c feat(cli): reserved command names, and did-you-mean for devvm WORD
A word after devvm that's neither a command nor an image (no +, and not
base, a shared tool or a layer) is a usage error, exit 2, suggesting the
closest command (Cobra's SuggestionsFor, distance 2) and the closest image
name. devvm help WORD and devvm WORD --help fail the same way instead of
printing the root's help. Layers can't take a word devvm keeps for its
commands.

- internal/image/reserved.go: Reserved (every command and subcommand
  name, hidden ones and help, and link, group, join, leave, publish,
  unpublish kept for later), IsReserved; LayerName refuses them, so
  Layers() and completion leave such files out.
- build.CheckLayerName refuses one (layer_name_command); CheckLayers
  refuses a layer file named with one wherever an image names it
  (layer_is_command, naming the file).
- internal/cli/word.go: checkWord (the root's Args), closest and
  levenshtein, addHelp (devvm's own help command, and a help func that
  panics with wordPanic for execute to recover), helpTarget, printUsage.
- Messages: layer_name_command, layer_is_command, no_command_or_image,
  no_command_or_image_command, no_command_or_image_image,
  no_command_or_image_both, with doc links.
- Tests: TestEveryCommandReserved, TestImagesNotReserved,
  TestLevenshtein, TestUnknownWord; layer.txtar and up_checks.txtar; e2e
  checks a mistyped command exits 2 with its suggestion.
- Docs: customizing (layer names), commands (devvm WORD), contributing,
  AGENTS.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-01 02:54:41 -08:00
w3cjandClaude Opus 5.5 f9e14e9b37 feat(cli): usage errors as devvm messages, checked before anything runs, exit code 2
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]>
2026-11-01 02:27:57 -08:00
w3cjandClaude Opus 5.5 3b1959efd2 feat(network): network policy rules and log under devvm network, and network -g for new VMs
devvm network allow|deny|rm RULE... [-g] and devvm network log [-f] [-n N]
[--blocked] replace devvm policy and devvm log. Bare devvm network shows the
VM's network policy, then its allowlist file by file. devvm network -g shows
or saves whether new VMs get network policy (ask, on or off), through the
network file devvm setup also writes; --network-policy and
--no-network-policy beat it and skip reading it, a saved off makes a VM
without the docker-layer and backend warnings, and with ask and no terminal
a new VM gets it.

The proxy's block messages, devvm-why's, network log --blocked's ALLOW WITH
and the VM's setup note name devvm network allow. New messages:
net_default_failed, net_ask_global; -g reports with network_default. Docs,
the CLI reference, txtars (network_rules, network_log, network), e2e
(bare devvm network's first line) and AGENTS.md follow.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-01 01:40:20 -07:00
w3cjandClaude Opus 5.5 07ca65c098 feat(cli): devvm host, the tools noun and devvm history
devvm ssh is devvm host. devvm tools shows this folder's VM's shared
tools (TOOL VERSION NEWER BUILT, from the lock as it is, never online);
devvm tools add/rm TOOL... add and take out shared tools, each a word of
its own (joined with + refused: tools_joined; add takes only shared
tools: unknown_tool), and devvm tools update moves the VM to the newest.
devvm IMAGE on a VM that exists adds nothing and asks nothing: it fails
with vm_lacks_tools, naming the devvm tools add command, or
vm_lacks_layer, as only a new VM gets a layer. devvm export is devvm
history export [FILE]; devvm history lists the exports in the exports
folder (FILE VM FOLDER DATE SIZE), the folder from a <export>.folder
file written beside devvm's own exports and deleted with them. gc
--exports is gc --history, retention's exports.age/count are
history.age/count, and devvm space's row is history.

The in-place layer machinery goes: Launch.addLayers and runLayers,
dockerLayers' inPlace/set/unset, backend.DockerLayerVM.SetDockerLayer
and the Docker backend's SetDockerLayer, with the add_in_place,
restart_for_mounts, no_terminal_confirm, keeping, adding and
add_layer_failed messages. vm.Tools (tools.go) holds Add, Remove,
Update and List; tools.VMs.Show lists a VM's tools; tools.Remove takes
names as a list; VMs.Update compares a VM's files as a set.

New messages: vm_lacks_tools, vm_lacks_layer, has_tools, tools_joined,
history_failed, tools_failed; renamed: unknown_tool, gc_history,
gc_history_export, deleted_history, gc_older_than_needs_history.
Command files: host.go, tools.go, history.go, refreshtools.go
(_refresh-tools); ssh.go, remove.go, update.go, export.go and
gc_exports.go gone. Tests: TestImageLacks, TestToolsAdd, TestShow,
TestCompleteToolNames; history.txtar, gc_history.txtar, host_code.txtar
and the e2e tools, docker layer and host checks updated. Docs, the CLI
reference, AGENTS.md and the e2e header follow.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-01 01:27:24 -08:00
w3cjandClaude Opus 5.5 18eefddc16 feat(cli): devvm retention, bare secret and ssh-agent, ssh-agent rm, and setup's network question
- devvm retention [KEY=VALUE...] shows every retention setting (off when
  unset) and changes them; KEY=off turns one off, KEY= is refused and
  nothing is written. devvm space only shows.
- devvm secret lists the secrets; devvm secret set claude saves the
  Claude Code token. No auth or secret ls commands.
- Bare devvm ssh-agent shows the VM's forwarding, then devvm's own
  agent's keys once one is added (it starts no agent without one).
  devvm ssh-agent rm KEY_FILE takes a key out of devvm's agent, found by
  its recorded fingerprint, and out of ~/.config/devvm/agent-keys; the
  key file isn't touched, and a key not added is refused.
- devvm setup's flags are --backend and --features LIST|none ('' is
  refused). In a terminal it also asks for new VMs' network policy (ask,
  on, off), saved in ~/.config/devvm/network (Dirs.Network), which new
  VMs read unless --network-policy or --no-network-policy is given.

Messages: features_empty, network_default, network_default_help,
network_default_ask/on/off, agent_key_not_recorded, agent_unload_failed,
agent_key_removed, retention_settings_failed; retention_unreadable,
agent_devvm_risk, no_claude_token and claude_token_invalid name the new
commands. paths: Dirs.Network (the structure test's Dirs limit is 42).
state: ReadNetwork, WriteNetwork, NetworkChoices, NetworkAsk/On/Off,
RetainOff. sshagent: Agent.Remove. Tests: TestNetwork, TestChooseNetSaved,
TestSetupNetworkStartsFromSaved, TestKeysNone, TestRemove, the real-agent
rm check; retention, setup, secret, ssh_agent and nix_cache scripts; e2e
checks for ssh-agent rm and retention.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-01 01:38:54 -07:00
w3cjandClaude Opus 5.5 452e7bf80a fix(state): devvm's data and settings folders are the user's alone on every run
Before every command, the root command's PersistentPreRun runs
state.MakePrivate: it makes the data folder ($XDG_DATA_HOME/devvm) and
the settings folder ($XDG_CONFIG_HOME/devvm) when they're missing and
sets both to mode 700, whatever mode they had, so a wider mode on
anything beneath them opens nothing to others. When it can't, devvm
warns (folders_not_private, linked to what devvm keeps) and goes on;
without an absolute HOME there are no folders, and the command says so
itself. The per-folder 700s (exports, logs, run logs, run, CA, secrets)
stay as they are.

Tests: state's TestMakePrivate (made, made private from 777, a folder
inside keeps its mode, one that can't be made fails) and
folders_private.txtar (modes after a run, the warning's fields).
Docs: using/space.md's data folder, using/settings.md's state and
internals/overview.md's state section.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 16:26:58 -07:00
w3cjandClaude Opus 5.5 7cd15a0862 feat(retention): retention settings for what devvm keeps, all off by default
~/.config/devvm/retention holds key=value lines, written by devvm space
set KEY=VALUE... (KEY= turns one off; a bad key or value is refused
before the file is written; all off removes the file). Every setting
is off unless set:

- logs.runs: run logs kept (20 when off; ui.KeepRunLogs).
- exports.age, exports.count: exports that old deleted, then all but
  the newest count.
- tools.unused-age: current shared tool images no VM's state lists,
  counted from when retention first found them so (an <image>.idle
  record in the share, dropped when a VM lists it again).
- orphans.age: what devvm keeps for VMs their backend no longer has
  (vm.Leftovers, as gc --orphans), once their state hasn't changed for
  that long.

Ages as state.ParseAge (30d, 2w, 12h). Not the backends' caches (gc
--caches only), and never a VM, an image, or a tool any VM's state
lists. devvm's commands apply the settings at their start at most once
a day (data/retention.run; again at once after a clock that went
back), under a lock so two devvms never apply them at once (a dead
one's lock is taken over after 10 minutes), skipping the tools while a
build holds the share's lock; it says what it deleted in one line on
stderr (retention_deleted). orphans.age needs the backends asked, so
only devvm gc --retention applies it; gc --retention applies all of
them at once. space, gc, completion and devvm's internal commands
don't apply them on their own. A bad line names the file and the line,
and then none applies (retention_unreadable). devvm space shows each
setting beside its row (RETAIN), with what it would free now.

Not done here: logs.network.size and logs.network.files, which
override the proxy's log rotation defaults: rotation is another task's
(the proxy rotates its logs), not on this branch; space set refuses
them until it is.

Messages: retention_deleted, retention_off, retention_busy,
retention_unreadable, retention_failed, retention_bad,
retention_saved. Docs: using/settings.md (the file, each setting, all
off), the What devvm keeps page (what each setting does, RETAIN),
using/images.md's Cleaning up, the CLI reference.

Review (deletes only what it's told to): no file or an empty one
deletes nothing (txtar, unit); a VM, an image and a tool any VM's state
lists are never retention's (Idle builds on NoVM: a stopped VM's and a
leftover state's tools stay until orphans.age deletes that state); two
runs at once (lockRetention); a clock that jumps (retainDue, Idle and
the age checks skip a negative age); the one-line report on every
deletion. Tests: TestRetention (parser, set, off, bad lines),
TestIdle, TestExportsToRetire, TestRetainDueAndLock; retention.txtar
(refusals, space set and RETAIN, the automatic run once a day and
again after a day, gc --retention with tools, a VM's tool kept).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 13:29:49 -07:00
w3cjandClaude Opus 5.5 bfc925e043 feat(space): devvm space shows what devvm keeps and the space it takes
devvm space [--json] lists each kind of thing devvm keeps, on every
backend, with its count, size (allocated blocks, as du), whether devvm
makes it again (remade, only copy, log, state, leftover), what devvm gc
frees of it now and what frees the rest, then a total: VMs and images
per backend, shared tool builds per backend and C library, exports,
network and run logs, devvm's own mise, the copies of devvm's files,
the leftover state of VMs their backend no longer has, and the rest of
devvm's state. The backends' own caches come apart and outside the
total: Lima's download cache, smolvm's caches on macOS (pack disks,
image disks, archives, registry; never its machines' folders) and
Docker's labelled volumes that aren't one VM's own.

backend.UsageReporter (optional): Lima, smolvm and Docker say what their
VMs and caches take. Each backend gets 30 s; one that doesn't answer is
named when a VM's state uses it (space_backend_unknown), and its VMs are
never counted as leftovers.

Each tool build now leaves <image>.target beside it (libc, format), so
listings tell a Lima, smolvm and Docker build of a version apart;
tools.Listed has Target, from the record or the target it's current for;
Share.Delete deletes the record too.

Messages: reading_space, space_failed, space_backend_unknown,
space_caches_note. Stubs: docker volume ls; smolvm machine ls fails with
smolvm-ls-fails. Docs: the What devvm keeps page leads with devvm
space; commands table; images' Cleaning up; CLI reference.

Review: space runs only listings (limactl list, smolvm machine ls and
data-dir, docker info, container ls/inspect --size, system df, volume
ls), each bounded by ctx with a timeout; the txtar checks no call
creates, deletes, starts, stops or edits. Backend caches aren't in the
total. Sizes checked against du on the e2e sandbox data and the user's
caches (Lima 9.1G, smolvm pack disks 20G, both match du -sh). APFS
clones count for both, as the page says.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 12:15:18 -07:00
w3cjandClaude Opus 5.5 91a429108f feat(images): a built-in nix layer with Nix, direnv and nix-direnv, pinned
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]>
2026-10-31 12:22:02 -07:00
w3cjandClaude Opus 5.5 e2e3c70d81 feat(desktop): a desktop feature and devvm desktop, over VNC, on every backend
The desktop feature (assets/features/desktop.sh, not chosen until you
choose it, about 370 MB) installs Xfce and TigerVNC's Xvnc from base's
package snapshot, and devvm-desktop, which starts Xvnc on display :1 on a
socket of the VM user's own (/run/devvm-desktop/vnc.sock, 0600 in a 0700
folder), with no TCP port (-rfbport -1, -nolisten tcp) and no password of
its own, the clipboard on or off as asked (vncconfig on a running one),
then an Xfce session in a D-Bus session of its own. Nothing starts it at
boot: devvm desktop does, on every backend.

devvm desktop gets the VM ready as devvm ssh does, refuses a VM without
the feature (desktop_no_feature), starts its desktop (desktop_start_failed),
and serves it on 127.0.0.1 alone until Ctrl+C or the VM stops
(desktop_vm_stopped), on the VM's own port (desktop_port, among
netpolicy.UsedPorts, so no forwarder or new VM takes it), showing the
address and password (desktop_ready) and opening vnc://127.0.0.1:PORT in
Screen Sharing on macOS (--no-open; desktop_open_failed). --clipboard
shares the clipboard both ways for that run.

internal/desktop's Relay is the guarantee, not the VM's server: it speaks
RFB 3.3/3.7/3.8 as a server, offers VNC authentication alone, checks the
answer against the VM's password (8 characters of 31, about 40 bits,
crypto/rand, kept in the VM's state as desktop_password, never sent to the
VM) one check at a time with a second's wait after a wrong one, and only
then opens an ssh -W channel to the VM's socket through devvm's ssh config
(pinned host key, no session, agent or forwarding), closed by its input
first so the VM's sshd ends its side. Without --clipboard it drops every
ClientCutText (extended ones too) and ends a connection on a message type
it can't size. At most 8 connections.

Also: vm.Desktop (Open, serve, listener, dial), vm.ready (devvm ssh's
launch without the Include prompt), Env.OpenURL; build's chosen features
leave desktop out until it's chosen; messages desktop_failed,
desktop_no_feature, desktop_start_failed, desktop_ready,
desktop_open_failed, desktop_vm_stopped, with doc links.

Tests: internal/desktop (passwords, Response, wrong passwords refused with
no dial, 3.3/3.7/3.8, not a viewer, the clipboard dropped or carried, an
unknown message ending the connection, a VM server asking for a password),
internal/vm (the password kept and remade, the listener's port kept and
replaced, ssh's arguments), internal/build (desktop off until chosen),
testdata/script/desktop.txtar (no VM, no feature, a stopped VM started,
the forward asked for with the clipboard off and on, the same port and
password, Screen Sharing opened or failing, the VM stopping, the start
failing), setup.txtar, docgen; tests/e2e.sh's desktop section (Lima, with
network policy) and checks in the smolvm and Docker sections;
TestE2EDesktop.

Docs: using/desktop.md (new), customizing.md's features, commands.md,
internals/desktop.md (new), design.md's note on the desktop,
contributing/testing.md's manual Screen Sharing check, the CLI reference.

Review (security-audit skill, guidance mode, local IPC and loopback
listener classes), against the review's list:
- another local user or process reaching the port: 127.0.0.1 alone,
  without address reuse; VNC authentication checked on the host before any
  ssh, constant-time, about 1 guess a second globally (thousands of
  years); the password in the VM's state (0600 file, 0700 folder), shown
  only on stdout with the address, never in open's arguments or the run
  log (e2e: no run log, no host process's arguments);
- never in an image or the VM: the VM's server has no password; e2e greps
  the VM's files for it (found the first time only in the VM's journal,
  from the check's own sudo command line, now fed on its input);
- the server on no address but loopback on each backend, even if root
  changes it: Xvnc has no TCP listener (e2e on each backend), the relay
  is the only way in and lives on the host; root's own server without a
  password (e2e, Lima) still gets no viewer without devvm's password;
- clipboard off really off: the relay drops the viewer's clipboard
  whatever the server accepts (e2e: root's server records a key event but
  never the clipboard); the VM's clipboard to the viewer can't be filtered
  without decoding screen updates, documented, Screen Sharing's setting;
- nothing from the VM toward the host: a local ssh -W channel, which ssh's
  client asks for; the VM reaches neither the relay's port nor anything
  new (e2e: with network policy, no direct connection out, nor to the
  port); a VM that reaches host loopback (no policy, Docker Desktop) meets
  the password like anyone;
- network policy unchanged: no policy file or allowlist changes; the
  self-check passes with the desktop running (e2e).
Left as documented residuals: the VM's clipboard sent by a changed
server; a local process or VM keeping the relay's 8 slots busy or failing
checks (availability only).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 12:49:23 -07:00
w3cjandClaude Opus 5.5 23c8dedaba feat(vm): devvm in a subfolder uses the parent folder's VM
A folder with no VM and no state of its own uses the VM of the nearest
folder it's inside that has one. The lookup stops before the home folder
(by its physical path) and the root, and skips a parent whose VM was made
for an earlier folder at its path (sameFolder).

- devvm (up): in a terminal it asks whether to open the parent's VM in
  the subfolder ([Y/n]; no makes a new VM). Without a terminal it opens it,
  with an info line. --here and --clone make the subfolder's own VM
  without asking. An IMAGE adds to the parent's VM in place after the
  same question.
- stop, restart, update, remove, export, log, network, policy, secret,
  ssh-agent, git-protect, size, ports, ssh and code use the parent's VM,
  naming it and its folder first. rm never deletes it unasked: in a
  terminal it asks ([y/N]) even with -f, which still skips only its
  checks; without one it refuses, saying to run it in the parent's
  folder. adopt acts only on this path's VM.
- A repo of its own below the parent's folder (a .git folder or file in
  the subfolder or a folder between): up asks use_parent_vm_repo [y/N],
  the default a new VM, and makes one without a terminal; the other
  commands never reach up and say no_vm.
- The shell, devvm ssh's folder and devvm code open the subfolder; in a
  --clone VM, the subfolder when the clone has it, else the clone's top.
- project.Parents; Env.lookup and Env.inspect (find split); found.sub,
  found.shellDir; useParent; Options.Here and the --here flag.
- Messages: use_parent_vm (dir, parent, vm), using_parent_vm (dir, vm),
  delete_parent_vm (dir, vm), rm_parent_vm (dir, vm), use_parent_vm_repo
  (dir, parent, repo, vm); all but the delete_parent_vm prompt linked to getting-started/commands#a-subfolder.
- Tests: TestParents; TestLookupParents, TestUpInSubfolder, TestShellDir,
  TestCommandsInSubfolder, TestSubfolderRepo; testdata/script/subfolder.txtar; up_checks'
  "My App" folder is made at $WORK, where the script meant it. e2e: the
  project section opens the VM from a subfolder (pwd in the VM).
- Docs: first-vm (coming back to it), commands (--here, A subfolder),
  using/clone (Subfolders), internals/overview (A subfolder's VM),
  internals/security; the CLI reference for devvm and devvm rm.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 17:57:42 -07:00
w3cjandClaude Opus 5.5 b27cd9b9b3 feat(lima): forward ports through devvm's own forwarder
Lima VMs forward their ports, every port and listed ones, through
devvm's forwarder (devvm _lima-ports), as Docker's do: loopback only,
exclusive binds, every port from 1024 up, never a port a host program
or another VM's record holds. Lima's own portForwards are ignore rules
for TCP and UDP on every address. The port choice is a record
(lima-vms/<vm>.ports), so changing it edits no Lima config and keeps
the VM's host keys. The forwarder pins the host key devvm pins
(Confinement.HostKey, sshconfig.HostKey) and ends with the hostagent
(the shared lifeline in vmssh). Lima's ports and ports-all are
emulated, reviewed: design note, threat check, e2e.

Docs: the forwarding rules for every backend, UDP not forwarded and
the socat alternative, in the docs voice.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 21:43:10 -07:00
w3cjandClaude Opus 5.5 3da0d6b0a6 feat(devcontainer): a project's devcontainer.json as input for new VMs
A new VM gets what the folder's .devcontainer/devcontainer.json (or .devcontainer.json) says, on every backend: image as --from (only an image its registry gives anyone, asked anonymously, pinned to that digest, never a registry on this machine or its network), features devvm has layers for (docker-in-docker as the docker layer, node, python, rust, go), forwardPorts as far as the user's ports allow, containerEnv and remoteEnv in the VM's environment, onCreate/updateContent/postCreate commands once and postStartCommand at each start, in the VM as its user. --no-devcontainer skips it; the command line wins. Later launches only warn when the file changed.

Nothing from it runs on or reaches the host: initializeCommand never runs, ${localEnv} and the host-folder variables are refused, builds, Compose and docker-outside-of-docker are refused, mounts, runArgs and privileged ignored. The file is read through os.Root, without blocking, at most 1 MiB. A docker layer only the file asks for still asks about network policy on Docker.

Reviewed with the security-audit skill (FuzzParse, design note); e2e: project 69/0, docker linux 135/0, smolvm 131/0.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 04:33:54 -07:00