Commit Graph
45 Commits
Author SHA1 Message Date
w3cjandClaude Opus 5.5 851e39ef86 build: embed devvm's files in its binary
devvm is one file: assets/ (base.yaml, layers/, features/,
shared-tools/, guest/, oci/, smolvm/) is embedded as assets.FS, which
cli passes to every constructor; backends, the builder, the shared
tools, the proxy and Ubuntu's key check read it as an fs.FS. Scripts
reach VMs on stdin (backend.Script carries their contents). What needs
a path (limactl create's base.yaml, oci/ mounted into the conversion
VM, the proxies' policy files) is written out to
~/.local/share/devvm/assets/<hash>, atomically, files 600 and folders
700; devvm gc deletes older copies no VM's proxy was started with
(gc_assets, deleted_assets). Release archives hold the binary with
README.md, CHANGELOG.md and LICENSE, and the formula installs the
binary alone.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-25 18:12:37 -06:00
w3cjandClaude Opus 5.5 d73c010ec4 feat(msg): messages carry the error they report
msg.M.Because(err) returns the message carrying err, and Unwrap returns
it, so errors.Is and errors.As see through a message to its cause. The
text stays the message's own.

Messages made from an error carry it: proxy_failed (secrets and the
proxy command), login_copy_failed, run_log_failed and fail's fallback
message. TestBecause covers errors.Is and errors.As through a message,
through %w wrapping, and through a message in a message.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-25 15:37:32 -06:00
w3cjandClaude Opus 5.5 7fcac40758 refactor: test seams on structs, not package vars
Tests set fields; no test outside internal/proxy and internal/ui assigns
a package var.

- backend.Review: Unreviewed and Warn, with Require and Allowed as its
  methods; Registry embeds it, set by backends.Registry (a test build
  reads DEVVM_UNREVIEWED); build.Builder.Review, sshconfig.Config.Review,
  and Tools.Build takes the review with the backend
- netpolicy.Log: Path and Tick (NewLog), with Write and WriteBlocked;
  Proxy.Terminal for Choose and SelfCheck
- vm.Env.Terminal, sshconfig.Config.Terminal
- cli: setup's terminal check and backend picker are fields of setup;
  versionOf takes the release's version
- from.Registry.RetryDelay, ubuntu.Finder.RetryDelay, lima.Lima.OCIWait
- msg's tests use real messages, not entries added to docs and specs

The tests these free run in parallel. AGENTS.md: test seams are fields;
internal/proxy's globals and internal/ui's process-wide state are the
exceptions.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-25 15:28:37 -06:00
w3cjandClaude Opus 5.5 78e660d93d feat(setup): ask for the default backend
In a terminal, devvm setup with neither --backend nor --features asks
for the default backend, then base's features. --backend chooses it
without asking; --features alone, or no terminal, doesn't ask.

- ui.PickOne: a single-choice picker in Pick's style ("( )"/"(*)",
  up/down or k/j move the choice, enter confirms), starting from the
  choice that's on; Pick and PickOne share pick/pickLoop.
- backends.Experimental: smolvm is marked experimental in the picker.
- setup: pickBackend starts from the current default (lima unless set,
  or set to a backend devvm doesn't have); setupTerminal and pickOne
  are test seams.
- Messages: backend_help, backend_experimental.
- Tests: TestPickOneKeys, TestPickOneWithoutTerminal,
  TestSetupAsksForTheBackend (terminal, current default, unknown
  default, no terminal, --backend, --features); setup.txtar checks no
  backend is asked or saved without a terminal or with --features.
- Docs: backends.md (setting the default), customizing.md, the CLI
  reference; AGENTS.md's pending line removed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-25 14:19:56 -06:00
w3cjandClaude Opus 5.5 83726f6a56 feat(smolvm): ssh for editors
ssh for editors is emulated on smolvm, and reviewed: devvm ssh, devvm code,
--clone and the ssh config's entries work as on Lima.

- sshd: sshd.sh installs openssh-server in base after its scripts (from the
  snapshot they pin; before them, the live archive's systemd libraries broke
  Docker's install) and deletes its host keys; prepare.sh sets the user's
  password to * (sshd without PAM refuses a locked account's keys). Both are in
  base's key.
- Start: Confinement.SSH (set by vm.start when Require lets ssh through)
  forwards guest port 22 from a host loopback port (Confinement.SSHPort, else
  the recorded one while free, else a new one; never one of the VM's own
  forwards: smolvm_ssh_port_forwarded), then services.sh makes new ed25519
  host keys at every start, writes the VM's only authorized key and devvm's
  own sshd config (VM's user only, publickey only, local forwarding only, no
  remote forwarding, tunnels or X11; SetEnv of /etc/environment and the
  proxy's variables, by name), and starts sshd. The record's ssh_up is cleared
  before each start and set once sshd runs; SSH answers only then.
- An image without sshd (probed before services.sh) starts without ssh,
  warned (smolvm_no_sshd).
- Keys: one per VM, smolvm/vms/<vm>.key (mode 600, OpenSSH format made in Go,
  its public half read back from it), deleted with the VM. SSH returns
  127.0.0.1, the port, the user, IdentityFile, IdentitiesOnly yes,
  PreferredAuthentications publickey.
- Ports: smolvm forwards at most 64 per machine, so a VM's own are at most
  63; port 22 in --ports is refused (smolvm_port_ssh).
- Shared ssh entries (Lima too): ForwardX11 no, ForwardX11Trusted no, Tunnel
  no, PermitRemoteOpen none, AddKeysToAgent no, ProxyJump none, ProxyCommand
  none, UpdateHostKeys no, HashKnownHosts no; no IgnoreUnknown (its first
  value would replace a user's Host * one), so devvm needs OpenSSH 8.7 or
  newer. sshconfig.Write skips a backend whose ssh isn't usable
  (backend.Allowed); vm.reach checks the backend's SSH.
- netpolicy: freePort avoids every VM's forwarded ports, and a stopped VM's
  ssh_port is picked again when it's one of its own.
- Lima: layers/base.sh writes /etc/ssh/sshd_config.d/00-devvm.conf (local
  forwarding only, no remote forwarding, tunnels or X11), which changes base's
  image key on Lima and smolvm.
- Messages: smolvm_port_ssh, smolvm_no_ssh, smolvm_no_sshd,
  smolvm_ssh_port_forwarded.
- Tests: unit (keys and their parsing, Start with and without ssh, port reuse
  and collisions, ssh_up, no sshd, Allowed, entries under a user's Host * with
  an IgnoreUnknown through the real ssh -G, netpolicy forwards); testscript
  smolvm.txtar (forward, services args, entry, pinned keys, devvm ssh, no
  sshd, port 22) and ssh.txtar (entry options); e2e smolvm: entry and
  loopback-only forward, listening ports, net backend pinned (virtio-net with
  a forward, TSI without), pinned host keys of each VM's own and new ones per
  start, a changed key refused, environment, agent off with ssh -A as the
  control, password/keyboard-interactive/other key/root/other user refused,
  remote forwarding refused, sshd -T, a hostile sshd that gets no display and
  no key through a Host * asking (command-line controls, and ssh -R shown not
  covered), devvm ssh and code, another VM's key refused, a squatted port, no
  sshd, stop and rm, --clone seed/fetch/push/rm, and under network policy ssh
  on ssh_port with the proxy's variables, no way out through local or remote
  forwards (with controls), DNS no-leak with the forward and the nettop DNS
  control on a machine without one; e2e Lima: its sshd's forwarding refused,
  the entry's options under a hostile Host *.
- Docs: smolvm.md (ssh for editors), backends.md, security.md (ssh into VMs,
  remote forwards you ask for), ssh.md, install.md (OpenSSH 8.7), design.md
  (the design note: the guarantee, what keeps a session from carrying the VM
  out, DNS detection by net backend, not covered: remote forwards you ask
  for), limits.md, testing.md, contributing.md; AGENTS.md gotchas.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-25 13:43:00 -06:00
w3cjandClaude Opus 5.5 d53bfdb5d1 feat(smolvm): network policy through devvm's proxy
egress-proxy is emulated on smolvm, and reviewed: a VM with network policy reaches nothing but its proxy.

- smolvm Start (NetProxy): allow list of the gateway alone (--reset-allow-list --allow-cidr 100.96.0.1/32), DNS closed (--allow-host-pattern devvm.invalid), and the start through devvm's decider (--mediated-egress --egress-interceptor, token in SMOLVM_INTERCEPTOR_TOKEN, never in arguments); a start without policy removes them (--net --reset-allow-list --no-egress-interceptor). The proxy's environment goes in by a quiet update, as smolvm prints the values it sets. Confined compares agent.pid with the confined start's and re-checks the allow lists on every call.
- The proxy is smolvm's mediated-egress decider (protocol v2, internal/proxy/decider.go, stdlib only): -decider, -decider-to, -decider-token-file; it takes over only connections to its own address in the VM, served with password and policy, and refuses and logs the rest; the token is checked before anything past it is read, first bytes capped at 8 KiB; FuzzPrelude.
- Interface: Confinement.Decider/DeciderToken, backend.Decider (UsesDecider); netpolicy.Proxy.Prepare takes the backend, allocates decider_port and a decider_token new at each start.
- A running network-policy VM whose proxy can't start again (port taken, start failed) is stopped, on Lima and smolvm (net_proxy_down_stopped; proxy_port_taken reworded); the stop isn't cancelled by an interrupt.
- DEVVM_UNREVIEWED=backend:feature lets unreviewed emulations through, warned (backend_unreviewed_used), only in test builds (-X internal/backend/backends.unreviewed=allowed: tests/e2e.sh and the CLI tests).
- Tests: decider, prelude and token unit tests; Prepare with a decider; Unproxied; smolvm Start/Confined on the stub (allow lists, decider requirement, env echo); testscript smolvm.txtar (policy VM, no password in run logs, proxy down stops it), network.txtar (Lima: proxy down stops it), doctor.txtar; e2e smolvm network section: proxy and decider, allow list, allowed/blocked hosts, direct connections as root (controls off policy), DNS refused per smolvm's decision log with devvm.invalid as control, UDP and ICMP (UDP allow control), token nowhere, log, policy, a widened allow list unenforced, fail closed with the proxy gone or a fake decider (garbage, silent, allow-direct; take-over as control), no start without a decider, someone else's decider stopped, network off/on.
- Docs: design note (how it works, what it relies on, what could break it, not covered: UDP allows the host's user adds, the devvm.invalid DNS channel), smolvm.md, backends.md, security.md, network.md, testing.md (DEVVM_UNREVIEWED, a canary DNS zone check), contributing, limits; AGENTS.md gotchas and a deliberate change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-25 10:47:43 -06:00
w3cjandClaude Opus 5.5 31d1f3c78e feat(smolvm): an experimental smolvm backend, its native features
A second backend, registered beside Lima: each VM is a smolvm machine
(a microVM running its image as a container, no init system), each
image a pack in devvm's data folder.

- internal/backend/smolvm: images built as packs (pack create --from-vm)
  from Ubuntu's container image by its registry digest (or --from's,
  registry images only), base prepared first (prepare.sh: sudo, CA
  certificates, bash, the host's user and uid); systemctl/rc-update
  stand-ins while a build's scripts run (shims.sh); project VMs made
  from a pack with network, CPUs, memory and disk set; after each start
  the loop devices, the tools' mounts and dockerd (services.sh); Exec as
  the VM's user with a login's environment; ports, agent folders, size;
  a record per VM of what smolvm doesn't show. On macOS every machine
  carries the label devvm.data=<data folder> and nothing without it is
  touched (smolvm_machine_foreign); on Linux --state-dir too.
  SMOLVM_USAGE=0, SMOLVM_MACHINE_NAME never passed on. Images used by a
  VM aren't deleted (their pack is read when a disk grows).
- Caps: native for everything but egress-proxy, ssh, ports-all and
  agent-toggle (none until their emulations are reviewed), refused in
  one line naming the VM.
- Interface: two features, ports-all (every port; new VMs' default) and
  agent-toggle (forwarding changed after create), each Lima-native;
  Backend.ToolFormat and ToolsSpec.Format; backend.KeyFiles, the
  backend's own scripts in base's key; --clone requires ssh. Lima's
  image and tool keys are unchanged: the format is hashed only when it
  isn't build.sh's own, and backend files only when there are any.
- Tool images: smolvm's tools build runs tools/build.sh unchanged, then
  remakes each image uncompressed (plain.sh); its format is named by
  plain.sh's hash. tools.Target (libc and format) replaces the libc
  argument; devvm images counts an image current for any backend.
- The proxy reads only the lifeline's first line (smolvm's has the start
  time on a second). guest/sync.sh tells a running systemd by
  /run/systemd/system (Docker's packages install systemctl).
- Messages: smolvm_missing(_fix), smolvm_broken(_fix), smolvm_old(_fix),
  smolvm_host_unsupported, smolvm_machine_foreign, smolvm_update_failed,
  smolvm_script_failed, smolvm_from_registry_only, smolvm_mount_colon,
  smolvm_too_many_ports, smolvm_no_agent, creating_from_image,
  packing_image, pack_failed; doc links to the smolvm page.
- Tests: internal/backend/smolvm (caps, ports, create, only ours, start,
  base build, failed build, set calls, Linux state dir, problems) on
  testdata/stubs/smolvm; testscript smolvm.txtar; TestE2EExecQuoting for
  smolvm; tests/e2e.sh --backend smolvm (the smolvm section: 34 checks);
  existing scripts expect the second backend.
- Docs: new smolvm.md; backends.md's column and the two new rows;
  design.md's smolvm section as built; limits, contributing; AGENTS.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-25 01:31:24 -06:00
w3cjandClaude Opus 5.5 fb2d591b09 feat(limactl): devvm limactl runs Lima on devvm's own Lima home
devvm limactl ARGS... runs limactl in devvm's place (exec), with
LIMA_HOME set to devvm's Lima home whatever the environment says, from
devvm's data folder (as devvm's own limactl commands run, away from
lima.REJECTED.yaml in a project folder). Every argument passes through,
flags and --help included; input, terminal and exit code are limactl's.
The code lives in the lima package (lima.Limactl); the cli command is a
thin wrapper, like _qemu.

- Messages: limactl_failed (new); lima_missing when limactl isn't on
  PATH; script_failed now suggests devvm limactl shell --start and drops
  its lima_home field.
- Tests: testdata/script/limactl.txtar (Lima home, LIMA_HOME ignored,
  data folder as cwd, arguments and --help passed, stdin, exit code,
  default home, no Lima); build.txtar, build tests and e2e updated for
  script_failed; e2e images checks devvm limactl list and its exit code.
- Docs: lima.md "Running limactl", commands.md row, images.md's failed
  build hint; CLI reference regenerated.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-24 22:48:52 -06:00
w3cjandClaude Opus 5.5 06780fee5d feat(ssh): devvm ssh and devvm code, VS Code's Machine settings kept
devvm ssh gets this folder's VM ready for ssh and editors, as a launch
does without its shell, then names the host they reach it by; devvm code
does the same, then opens the folder in VS Code over Remote-SSH.

- vm: launch (from open: .git and set-id checks, a stopped VM's size,
  ports and agent forwarding, the user's agent checked, run with its
  self-check) and setUpVM (from setUp: sync, ssh config, a --clone VM's
  clone) shared by launches, SSH and Code; reach requires the backend's
  ssh, then offers the Include line (EnsureInclude). Code runs code
  --remote ssh-remote+HOST DIR in devvm's place with the environment
  devvm started with (Env.Environ), so the editor keeps the user's
  SSH_AUTH_SOCK.
- sshconfig: Host (the alias among every backend's project VMs), with
  the listing shared with Write.
- cli: ssh and code commands; CLI reference regenerated.
- Messages: ssh_host_info, no_code_command (linked to ssh.md),
  ssh_failed, code_failed.
- Tests: ssh_code.txtar (no VM, usage, a stopped VM started and set up
  without a shell, the Include line shown not added, a pending size
  waiting, code's arguments and agent, two folders named alike, no code
  on PATH, a direct route stopping the VM); guest.txtar's VS Code
  Machine settings case; a stub code. e2e: devvm ssh on a stopped VM and
  ssh reaching it, the Machine settings set and set again, devvm code
  with a stub code; network: devvm ssh's self-check, passing and
  stopping a VM started outside devvm.
- Docs: ssh.md (devvm ssh and devvm code, VS Code), commands.md,
  security.md, clone.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-24 22:33:29 -06:00
w3cjandClaude Opus 5.5 44e256d51a feat(stop): devvm stop stops this folder's VM and its proxy
devvm stop needs a finished VM made for this folder (no_vm,
vm_other_folder, vm_unfinished). It stops the VM (Backend.Stop, the
"stopping" step), says stopped, or already_stopped for a VM that was,
then stops its network policy proxy at once instead of waiting for it
to notice the hostagent is gone. With the VM stopped, .git is checked
and locked as on a launch that finds it stopped, and on Linux set-id
files are named (not for a --clone VM); the ssh config is rewritten, so
the VM's entry goes.

Messages: stopped, already_stopped, stop_vm_failed; git_protect_running
now says to run devvm stop first.

Tests: testdata/script/stop.txtar (no VM, usage, a running network
policy VM and its proxy, locks after stop on macOS, the ssh config
entry, already stopped, a folder made again). e2e: project's stop
(status, ssh entry; on macOS a submodule git folder reported and locked
by devvm stop), network's stop (the proxy gone at once, both back on
the next launch).

Docs: commands.md (Stopping a VM), git-protection.md, network.md,
ssh.md, contributing.md; the CLI reference.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-24 21:43:45 -06:00
w3cjandClaude Opus 5.5 5304e9a2b7 feat(export): devvm export saves a VM's agent history
devvm export [FILE] saves this folder's VM's agents' history (the same
paths and login excludes as rm's export) to FILE, relative to the
current folder, or to a new <vm>-<date>-<time>.tar.gz in the exports
folder. A stopped VM is started for it. It needs a finished VM made for
this folder.

The export is now written to a temporary file beside its target (mode
600) and renamed into place once complete, for rm's export too: a failed
export leaves no file and an existing FILE as it was.

Messages: history_not_exported (logged) and export_failed (reason) for
devvm export; rm's is now rm_export_failed.

Tests: TestExport (default folder, a new folder for FILE, a failed
export keeping FILE); testdata/script/export.txtar (no VM, usage, a
stopped VM started, the script, a relative FILE, a failure keeping FILE
and the VM); e2e's project section exports a stopped agent VM's history
to a file, without its logins.

Docs: coding-agents.md#history, commands.md, the CLI reference.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-24 21:30:52 -06:00
w3cjandClaude Opus 5.5 b03293b7d7 feat(setup): devvm setup chooses base's features and the default backend
devvm setup asks which features base gets, starting from the current
choice (every feature until there's one; kept without a terminal), or
takes them from --features LIST without asking ('' for none), saved in
the features' run order. A name that isn't a feature is no_feature and
saves nothing. --backend NAME saves the default backend new VMs get
(~/.config/devvm/backend, read by the registry), checked against the
backends devvm has; alone, it leaves the features as they are.

A changed choice prints base_will_rebuild, and gc_old_hint once any
image record exists. base_features and base_features_none name devvm
setup. --features completes feature names, setup's --backend backend
names.

- build: PickFeatures, SetFeatures (the first build's choice goes
  through PickFeatures)
- state: AnyImage
- messages: no_feature, base_will_rebuild, gc_old_hint,
  default_backend, setup_failed
- tests: setup.txtar, completion.txtar; TestPickFeatures,
  TestSetFeatures, TestAnyImage
- docs: customizing.md (choosing features), backends.md (choosing a
  backend), the CLI reference

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-24 21:21:07 -06:00
w3cjandClaude Opus 5.5 77aa2d6dc0 feat(layer): devvm layer new starts a layer of your own
devvm layer new NAME writes ~/.config/devvm/layers/NAME.sh, a starter
script, and NAME.policy next to it unless that exists. Names that aren't
layer-like are layer_name_invalid; base and the shared tools'
layer_name_reserved; an existing script layer_exists. The script is
linked into place whole, never over one that appeared.

- internal/build/layer.go: NewLayer, its templates, createNew
- internal/cli/layer.go: devvm layer (help alone), devvm layer new NAME
- messages: layer_name_invalid, layer_name_reserved, layer_exists,
  layer_created, layer_new_failed; doc links to customizing
- testdata/script/layer.txtar: from images.bats' layer new case
- e2e images: the fixture layer starts from devvm layer new
- docs: customizing.md gets your own layers (with the postgres
  example); commands.md, images.md, the index; CLI reference

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-24 21:09:22 -06:00
w3cjandClaude Opus 5.5 c9998037a0 feat(gc): devvm gc deletes stale images and unused tool images
devvm gc deletes the images that devvm images lists as stale or
unfinished, on every backend, together with their records. It also deletes
the tool images it lists as unused, with their hashes. It lists everything
first and asks when run in a terminal. It holds the share's lock for the
whole run. VMs are never deleted. On Linux hosts, a stale image that
overlays use stays, with image_in_use.

- tools: Listed.File, Unused (List's unused rows) and Delete (tool
  image names only); Garbage and Tools.All go.
- build: DeleteKey. cli: listImages takes a builder and keeps each
  backend's.
- devvm images: images_stale_note and images_unused on stderr.
- Messages: gc_failed, nothing_to_clean, gc_images, gc_image,
  gc_unfinished, gc_tools, gc_confirm, nothing_deleted, deleted_tools;
  script_failed and tools_not_images_rm name devvm gc.
- Tests: gc.txtar (stale, unfinished, corrupt and key-less images, a
  project VM named like an image, tools in use, current and unused),
  TestDeleteStaleKeepsImagesInUse, TestUnusedAndDelete, TestConfigTools.
- e2e: a gc section. Docs: images.md (cleaning up), commands.md,
  contributing.md, the CLI reference.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-24 20:59:03 -06:00
w3cjandClaude Opus 5.5 f5cca0ff02 feat(images): devvm images and images rm
devvm images lists the images on every backend (IMAGE, FROM, DIGEST,
KEY, STATE current/stale/unfinished, SIZE, BACKEND), then the shared tool
images by the name images have them by (NAME, TOOL, VERSION, SIZE, VMS,
STATE current/in use/unused/not built/not installed). Listing never
resolves the tools lock. devvm images rm IMAGE|KEY... deletes images by
name (with --from, on that base) or by key, resolving every one first;
shared tools are refused.

- backend.Backend gets ImageSize (Lima: du of the instance folder);
  platform.DiskUsage counts blocks, hard links once.
- build: Listing, Delete, Image.Digest; ubuntu.ReleaseDate.
- tools: List, ReadLock (uses Lock.Version); vm: ToolsInUse,
  BackendUsed exported.
- Messages: reading_images, images_failed, images_rm_failed,
  deleted_image, no_image_named, no_image_named_from,
  tools_not_images_rm.
- Tests: testdata/script/images.txtar (images.bats' three images cases
  and images rm), Go tests for Listing, Delete, List, compareVersions,
  DiskUsage, ImageSize, ReleaseDate, humanSize; e2e images section lists
  base and a layer, deletes by name and an unfinished build by key.
- Docs: images.md (Listing images, Deleting images), commands.md, the
  CLI reference.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-24 20:42:39 -06:00
w3cjandClaude Opus 5.5 bc164bcbe3 feat(git-protect): devvm git-protect on, strict and off
devvm git-protect shows a folder's VM's .git protection (on, strict, off,
or clone for a --clone VM) and changes it while the VM is stopped. On and
strict lock .git as it is now, reporting what a lock can't cover as a new
VM does; strict also sets diff.ignoreSubmodules=all in the locked
.git/config, which on and off take out; off unlocks. Locks need macOS.

- gitprotect: Mode, Set, ignoreSubmodules; NewVM and Check share
  protect (new, on, check); strict counts as on for launches and rm.
- Messages: no_vm_git_protect, git_protect_failed, git_protect_running,
  git_protect_on_needs_macos, git_protect_clone, git_config_failed,
  git_locked, git_locked_strict, git_lock_later, git_unlocked;
  git_protect_flag_ignored names devvm git-protect off.
- Tests: TestSet, TestSetStrictFails, TestSetLinuxAndNoGit;
  testdata/script/git_protect.txtar (project.bats strict and
  git-protect-waits cases). e2e project: waits for stop, strict, off/on,
  refused off macOS.
- Docs: git-protection.md (turning it on or off, strict), commands.md,
  CLI reference.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-24 20:25:56 -06:00
w3cjandClaude Opus 5.5 cfae579fec feat(size): devvm size, --cpus/--memory/--disk, and -g for new VMs
devvm size shows this folder's VM's CPUs, memory and disk
(cpus=4 memory=8GiB disk=100GiB), with a note when a change waits for
its next start; --cpus, --memory and --disk change them, at once for a
stopped VM, from its next start for a running one. Disks only grow; more
than this machine has is refused. -g/--global shows (cpus=, memory=,
disk= lines) or changes the size new VMs get (~/.config/devvm/size),
keeping what it leaves unset. A change checks the backend's features
first.

- vm: Env.ShowSize, Env.SetSize, SizeText, pendingSize (also used by
  applySize), defaultSize (also used by up), folderVM (shared by
  ports, ssh-agent and size)
- messages: vm_size, size_pending, size_defaults, no_vm_size,
  size_failed; size_flags_ignored names devvm size
- tests: size.txtar (show, set, running vs stopped, -g, a hand-edited
  size file, refusals), TestSetSize, TestSizeText; the limactl stub's
  edit applies --cpus/--memory/--disk; e2e project: a new VM gets its
  size, devvm size shows it, a running VM's new size waits for restart
  then applies, a smaller disk is refused
- docs: images.md Size and Disk use, commands.md rows, CLI reference

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-24 20:09:02 -06:00
w3cjandClaude Opus 5.5 8312d764ad feat(ports): devvm ports, add and rm, and -g for new VMs
devvm ports shows which ports this folder's VM forwards (all, none or a
list), with a note when a change waits for its next start; devvm ports
all|none|LIST, add LIST and rm LIST change it, at once for a stopped VM,
from its next start for a running one. -g/--global shows or changes what
new VMs forward (~/.config/devvm/ports). A change checks the backend's
port forwarding first.

- vm: AddPorts, RemovePorts, PortsChange, Env.Ports, Env.SetPorts,
  defaultPorts (also used by up), portsVM
- messages: ports_list_needed, ports_rm_all, port_not_listed,
  ports_all_already, ports_now, ports_pending, ports_default, no_vm_ports,
  ports_failed; ports_flag_ignored names devvm ports
- tests: ports.txtar (show, set, add, rm, -g, running vs stopped, usage,
  completion), TestAddRemovePorts; e2e project: a running VM's new ports
  wait for restart, then only the listed ports reach the host
- docs: images.md Ports, commands.md rows, CLI reference

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-24 19:55:40 -06:00
w3cjandClaude Opus 5.5 fd479df9d8 feat(ssh-agent): devvm ssh-agent and --ssh-agent, with devvm's own agent
SSH agent forwarding per VM: off by default, on (your agent, --ssh-agent
for a new VM) or devvm (devvm's own agent, holding only keys added to it).
devvm ssh-agent [on|devvm|off] shows or changes it from the VM's next
start; devvm ssh-agent add KEY_FILE [--confirm] [--lifetime D] loads a key
into devvm's agent and records it with its pinned fingerprint
(agent-keys); devvm ssh-agent keys lists them. Keys are loaded again on
launch (after a reboot or their lifetime), only while the file holds the
pinned key and isn't in a folder a VM mounts.

- internal/sshagent: Mode/Key, Agent (Ensure, Add, Keys), its messages.
- vm: --ssh-agent on create, applyAgent and checkAgent on relaunch,
  ssh_agent_flag_ignored, devvm's agent socket at start, SSH_AUTH_SOCK
  per mode for devvm's own connections, SetSSHAgent/SSHAgent.
- sshconfig: ForwardAgent from the VM's state; devvm mode forwards and
  names devvm's socket (IdentityAgent).
- ssh_remote_hint names devvm ssh-agent on; skipped with --ssh-agent.
- Tests: sshagent table tests (the five bats cases) plus one with real
  OpenSSH tools and a throwaway agent; vm tests; ssh_agent.txtar with
  ssh-agent/ssh-add/ssh-keygen stubs; e2e project section "SSH agents".
  The test task and e2e unset SSH_AUTH_SOCK.
- Docs: ssh.md agent forwarding and devvm's own agent, commands,
  security, contributing; CLI reference.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-24 19:41:09 -06:00
w3cjandClaude Opus 5.5 ab20aab59d feat(secret): devvm secret and devvm auth, tokens kept on this machine
devvm secret set claude|github [--stdin] saves a token in the macOS
Keychain (through security -i on stdin, never in arguments) or in an
owner-only file elsewhere; devvm auth claude does the same for claude.
secret rm deletes one, secret ls (and devvm secret) lists every secret,
whether it's saved and the VMs using it, and secret use|unuse binds one
to the folder's VM. Saving, deleting, binding and unbinding rewrite the
running proxies' bindings at once, keeping their logins' bindings as the
VM's start wrote them. get stays hidden, for the proxies.

- secrets: Token (whitespace dropped; empty, quotes, backslashes,
  control characters and non-setup claude tokens refused), Save, Delete,
  Bind, FromImage, RefreshFiles; platform: KeychainSet, KeychainDelete.
- netpolicy: Proxy.RefreshSecrets. vm: SecretSave, SecretRm, Secrets,
  SecretUse. ui: Secret (no echo at a terminal, the terminal restored on
  interrupt) and Line.
- Messages: claude_token_howto, github_token_howto, token_prompt,
  no_token, token_quotes, not_setup_token, keychain_save_failed,
  secret_saved, secret_saved_keychain, secret_removed, secret_used,
  secret_unused, secret_with_image, secret_unuse_copied, secret_failed;
  no_claude_token, claude_token_invalid and no_github_token name
  devvm auth claude and devvm secret set github.
- Tests: secret.txtar (set/rm/ls, use/unuse, auth, refused tokens, the
  value never in argv), Go tests for Token, Save/Delete, Bind,
  RefreshFiles, RefreshSecrets, the Keychain calls through the security
  stub (now with -i and delete-generic-password), ui.Secret, vm secrets.
- e2e network: secret set/get/use/ls/unuse/rm with a fake GitHub token;
  the VM gets its own GH_TOKEN placeholder, the proxy puts the token in
  for api.github.com.
- Docs: network.md (saving and binding tokens), coding-agents.md (Claude
  Code login), security.md, commands.md, contributing.md; CLI reference.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-24 17:43:18 -06:00
w3cjandClaude Opus 5.5 eae6614cab feat(network): devvm network, a folder's VM's network policy on or off
devvm network prints the VM's network policy as ls shows it (on, off,
unenforced); devvm network on|off changes its state, applied when it next
starts (net_set_running/net_set_stopped, net_already when unchanged,
net_on_old_tokens on turning on). on needs the backend's egress proxy.

A running VM turned off stays on its proxy until it next starts
(net_off_next_start). Confined now means started with the proxy (Lima
reads the recorded network; the fake tracks Start's), so a VM turned on
while it ran direct is unenforced and its launch offers the confined
restart; net_unenforced* say it wasn't started confined.

net_flag_ignored, net_off_log and net_off_policy name devvm network.
Docs: network.md "Turning it on or off", commands.md, security.md,
contributing.md, CLI reference. Tests: TestNetwork,
TestNetworkRequiresEgressProxy, Lima's Confined after a direct start,
network.txtar (what it prints), e2e network (off, on while running,
off while confined).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-24 17:09:40 -06:00
w3cjandClaude Opus 5.5 a8a20a085e feat(policy): devvm policy, the allowlist of a folder's VM
devvm policy shows the policy files of this folder's VM that have rules,
in order, comments left out. devvm policy allow|deny|rm RULE... edit the
VM's own file, or with -g/--global the user's file for every VM; the
VM's proxy re-reads a changed file, so changes apply at once.

- proxy.ValidRule: the rules devvm policy takes (host, *.host, **, an
  address or CIDR, optional port and !); AllowRule's suggestions are
  valid (FuzzRequest checks it), and FuzzParseRule checks valid rules
  parse.
- netpolicy: Rule, AddRule, RemoveRule, WriteRules; files rewritten
  whole through a link; duplicates and rm match in any case, comments
  aside.
- vm: Env.Policy and Env.PolicyChange; net_off_policy for a VM without
  network policy.
- state.VMNames skips <vm>.policy files.
- Messages: net_off_policy, no_vm_policy, not_a_rule, rule_added,
  rule_added_global, rule_present, rule_removed, rule_removed_global,
  rule_missing, policy_failed.
- testdata/script/policy.txtar: allow/deny/rm, -g, IPv6 rules, refused
  rules, the rules shown per file, a VM without network policy, and a
  new VM not inheriting rules of one deleted outside devvm.
- e2e network: the allow command devvm log --blocked suggests applies
  at once on the running proxy; rm blocks again.
- Docs: network.md (Changing rules), commands.md, CLI reference.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-24 16:52:37 -06:00
w3cjandClaude Opus 5.5 60f23a6f4e feat(log): devvm log, the network log of a folder's VM
devvm log [-f] [-n N] [--blocked] shows what this folder's VM's proxy
allowed and blocked, the last 50 events unless -n, following new ones
with -f, or the blocks grouped by host and port with the devvm policy
allow command that allows each (--blocked). Control characters from the
VM are dropped.

- internal/netpolicy/log.go: WriteLog (tail and follow, a partial last
  line and an emptied log handled), FormatEvent, WriteBlocked.
- internal/proxy: event is exported as Event; AllowRule.
- internal/ui: OneLine, for VM-made values on one line of data.
- internal/vm: Env.Log; internal/cli/log.go.
- Messages: net_off_log, log_empty, log_failed.
- Tests: testdata/script/log.txtar (the three network.bats log cases),
  netpolicy and proxy table tests; e2e network checks devvm log and
  --blocked.
- Docs: network.md (Logs), commands.md (Network policy), CLI reference.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-24 16:37:46 -06:00
w3cjandClaude Opus 5.5 7d49772eb4 feat(doctor): devvm doctor and the backends' host checks
- backend.Backend gains Problems(ctx) []Problem (Key, Fix, Msg): all
  that a backend needs and the host lacks. Check is the first of them,
  so every command that needs the backend stops at the first one.
- Lima's Problems (check.go): host OS, arm64/amd64 (arch), macOS 13+
  (macos, via sysctl kern.osproductversion: platform.MacOSVersion),
  Lima missing/broken/older than 2.0 (lima; brew install/reinstall/
  upgrade lima when Homebrew is there), on Linux qemu-system-<arch> and
  qemu-img (qemu; apt-get, dnf, pacman or zypper's command), /dev/kvm
  missing (kvm) or not openable (kvm-access; sudo usermod -aG kvm
  USER), Lima's global configs (lima-config). DEVVM_KVM swaps /dev/kvm
  for tests.
- devvm doctor [--backend NAME] [--fixes]: a features table (FEATURE,
  one column per backend: native, emulated, unreviewed, none; Support
  gains String), Docker found or not, then doctor_ok or each problem
  (the last one fails). --fixes prints KEY<tab>FIX<tab>MESSAGE lines
  and succeeds either way.
- Messages: lima_missing_fix, lima_broken_fix, lima_old_fix,
  qemu_missing_fix, lima_arch_unsupported, macos_old, no_kvm,
  kvm_access, docker_found, docker_missing, doctor_ok, doctor_failed;
  kvm and ok are initialisms in the generator.
- Tests: TestProblems (23 cases), TestWriteFeatures, TestWriteFixes,
  TestMacOSVersion, Support's String in TestSupport; doctor.txtar;
  the script sandbox sets DEVVM_KVM; e2e images checks doctor.
- Converted: cli.bats preflight (arm64 and x86_64), doctor (macOS
  without Lima, Linux without QEMU, x86_64 Linux, limactl that doesn't
  run), the doctor half of "all there", doctor's half of the Lima
  global configs case.
- Docs: new install.md (requirements, checking them, --fixes keys),
  lima.md requirements, backends.md, commands.md, contributing.md,
  README; CLI reference regenerated.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-24 16:25:17 -06:00
w3cjandClaude Opus 5.5 e5df9e22df feat(ls): list project VMs with a BACKEND column
devvm ls lists the project VMs on every backend, sorted by name: NAME,
STATUS, IMAGE (base (from node:24) for a --from base), GIT (on, off, or
clone for a --clone VM), NET (on, off, or unenforced: a failed
self-check, or running but not confined by devvm), BACKEND and FOLDER.
Images and build VMs aren't listed; a project VM named like an image is.
What a VM's state lacks is -. A backend that can't list fails ls only
when a VM's state names it.

- vm.List, netpolicy.Listed, state.VMNames
- messages: image_from, ls_failed
- bats cases converted: delete.bats "ls and the ssh config include a
  project VM named like an image" (ls half), network.bats "ls shows
  network policy: off, on, unenforced" and the ls check of the direct
  route case (testdata/script/ls.txtar, Go table tests)
- e2e: ls checks in project and network
- docs: commands.md (Listing VMs), network.md, lima.md, CLI reference

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-24 16:08:10 -06:00
w3cjandClaude Opus 5.5 6a2b2dcf5a feat(features): optional base image features
base runs its chosen features after layers/base.sh, in the order chosen:
devvm's own (features/<name>.sh next to the binary) and the user's
(~/.config/devvm/features/<name>.sh). The choice is in base-features and
in base's key; until there's a file, every feature counts.

The first build of anything asks which features base gets, every one
chosen to start with: an arrow-key (or j/k) picker in a terminal, showing
each script's second line; without a terminal, every feature. The choice
is saved and printed.

- build: Features (devvm's, sorted, then the user's; a user feature named
  like a built-in one is ignored), FeatureScript, chosenFeatures
  (selected_features), chooseFeatures (pick_features) run by Build and
  Rebuild before any key; Inputs hashes the chosen features and the
  user's folder; base's spec gets each feature's script, one without a
  script skipped with a warning.
- image: FeatureName. ui: Pick and Choice (raw mode, hidden cursor,
  control characters dropped from descriptions, Ctrl+C ends the run with
  130).
- Messages: features_help, base_features, base_features_none,
  feature_shadowed, unknown_feature; doc links to customizing.md.
- Copied: features/ (cli-tools.sh, fzf.sh, omb.sh), unchanged.
- Converted: images.bats user features (listing, shadowed, in base's key)
  and build.bats step counts (two features and one skipped) as
  features.txtar and Go tests (TestFeatures, TestDescription,
  TestChooseFeatures, TestBuildRunsFeatures, TestPickKeys,
  TestPickWithoutTerminal, TestPickCtrlC). Script tests start with an
  empty base-features file.
- e2e: with from selected, base-features holds every feature; images
  checks base ran base.sh and every feature, and takes base's key from
  its build or the newest Ubuntu base (no longer a cached --from base);
  from checks every feature in the node:24 and alpine:3 VMs.
- Docs: customizing.md (base image features); images.md, index.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-24 13:50:39 -06:00
w3cjandClaude Opus 5.5 0aec2ece89 feat(from): base images from Docker and OCI images
--from IMAGE (default $DEVVM_FROM) starts base from a Debian-, Ubuntu-
or Alpine-based container image instead of Ubuntu's cloud image, for new
VMs, build and rebuild. base is keyed by the image's digest, looked up
once per build and recorded per reference; existing VMs keep their own
(from_ignored).

- internal/from: ParseRef (registry_ref, with a fuzz target), Valid/
  Check (bad_from), Pinned, Name, Recorded (from_digest), Registry.Digest
  (manifest HEAD, anonymous Bearer token from an https realm only,
  timeouts, size caps, retries; ErrUnreachable/ErrNotFound), Lookup.Refresh
  (refresh_from_digest: registry, else Docker's ID, else the recorded
  digest with a warning), DockerID, DockerRunning.
- build.Builder: From and Lookup; Inputs/Key/Chain with the recorded
  digest; spec.From for base; records keep from and digest on every image
  above a --from base; rebuild counters per from; building_image_from.
- lima: convert (oci_base): devvm-oci-build from Ubuntu's image with only
  <tmp>/vm (rw) and oci/ (ro) mounted, confined to the internet, runs
  oci/build.sh; docker save plus exportIs for images only Docker has;
  checkConverted (regular files, gnu/musl, cmdline charset, raw ext4);
  base created with --set .images (disk, kernel, cmdline, initrd); the
  temp folder, build VM and the OCI build lock (lockOCI, pid, stale
  takeover, oci_waiting) go however the run ends.
- cli/vm: global --from flag, state from=, builders with the VM's from in
  open, update, remove.
- Messages: building_image_from, bad_from, from_ignored, from_unreachable,
  from_not_found, from_cached_unreachable, from_cached_not_found,
  no_digest, docker_only, exporting_docker, docker_export_failed,
  docker_image_changed, oci_waiting, converting_in_vm, converting,
  convert_failed, convert_bad_output; doc links to from.md.
- Copied: oci/ (build.sh and README edited: comment, docs link),
  testdata/stubs/docker; limactl stub gains oci/build.sh outputs and
  interrupt-on.
- Converted: from.bats (registry_ref, registry_digest token, 1/2,
  https realm, refresh per tag, Docker-only, offline, no Docker, pinned,
  moved tag, cached keys, build flow, docker save, Ctrl+C, steps, failures,
  bad outputs, record, export check, lock) as Go tests and from.txtar;
  oci.bats (libc_for, missing architecture, crane pins) as oci.txtar;
  cli.bats --from parse_args and project.bats --from input checks.
- e2e: from section (--from tier, or --only from): node:24 Debian 12
  node+python+claude, alpine:3 musl tools and Docker on OpenRC, base from
  ubuntu:26.04, no Docker needed. Left out: features, an image only Docker
  has.
- Docs: from.md; images, commands, lima, contributing, index; CLI
  reference.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-24 13:23:29 -06:00
w3cjandClaude Opus 5.5 5c345b43b3 fix(clone): rm keeps fetched branches as local branches
rm on a clone VM now fetches the VM's unfetched branches into new local
branches, saved/<remote>/<branch>, and removes the remote fully with git
remote remove (its remote-tracking branches and upstream settings too).
Before removing it, any of the remote's remote-tracking branches with
commits no other ref has (fetched by hand, or with rm -f) are kept the
same way, in one update-ref transaction that never overwrites.

The prefix is saved/<remote>, else saved/<remote>-2 up to -99: the first
that no local branch is, is in or holds. Remote names devvm picks start
with devvm, so these never shadow a later VM's remote-tracking branches.
No free prefix: rm refuses before fetching (saved_names_taken), and at
deletion the remote stays (remote_kept). Branch names from the VM are
checked with git check-ref-format, passed only as argv, and shown
quoted; invalid ones are skipped (branch_names_invalid). The fetch uses
--no-tags. A branch counts as fetched only when a ref reaches its
commit, not merely when the object exists.

Inventory:
- vm: fetchUnfetched, validBranch, savedPrefix, quoted, saveFetched;
  unfetchedRefs reads full refnames and checks reachability; removeRemote
  saves, then git remote remove
- messages: branch_names_invalid, saved_names_taken, saved_branches,
  remote_kept; fetch_before_delete and fetching take prefix;
  removed_remote and unfetched_commits reworded. Doc links:
  saved_names_taken, remote_kept
- tests: TestCloneRm (saved/devvm/main, no remote-tracking refs left,
  a dangling commit unfetched), TestFetchUnfetchedInvalid,
  TestSavedPrefix, TestRemoveRemote (unique branches saved under
  saved/devvm-2, upstream gone, no free names keeps the remote);
  clone.txtar: rm -f keeps fetched-only work as saved/devvm/main
- e2e: clone's rm -f check wants saved/devvm/main and no remote-tracking
  branches
- docs: clone.md, commands.md

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-24 12:52:22 -06:00
w3cjandClaude Opus 5.5 bdd781c037 feat(clone): --clone gives the VM its own clone
devvm --clone makes a VM that mounts nothing of the folder's: only the
shared tools and its agents' config folders. Once it runs, devvm makes a
repo at the folder's path in the VM (receive.denyCurrentBranch
updateInstead, HEAD on the host's branch), pushes every local branch
into it with host git over devvm's own ssh config (pinned host keys),
and adds a remote to the host repo (devvm, else devvm-<folder>, else the
VM's name), URL <vm>:<dir>. It offers the ~/.ssh/config Include line
(EnsureInclude's first caller), else says how to fetch until then, warns
about uncommitted changes, which aren't copied, and opens the shell in
the clone. No .git protection, set-id check or ssh remote hint for clone
VMs. A copy that fails is retried on the next launch. --clone on a VM
that mounts its folder is refused.

rm on a clone VM (not -f) starts it if stopped, lists branches whose
commits the host repo lacks (VM answers looked up only when they're
object names) and offers to fetch them into <remote>/*, then shows the
clone's uncommitted changes and asks before deleting; without a
terminal either refuses and keeps the VM. Deleting removes the remote's
config if it still points at the VM, keeping fetched branches.

Inventory:
- vm: clone.go (isClone, checkCloneRepo, seedClone, freeRemote,
  remoteURL, cloneRmCheck, cloneGit, unfetchedRefs, removeRemote,
  gitSSH, hostGit, capped); state keys mode, clone_remote, seeded;
  Options.Clone; create skips the unsafe-folder check, the mount, .git
  protection; setUp seeds unseeded clone VMs; open refuses
  clone_needs_new_vm and skips Check/setid for clones; ensureRunning
  (from export); Rm runs the clone check; delete removes the remote; the
  interrupt cleanup removes it too
- cli: --clone on up; rm and root Long, rm -f's help
- messages: clone_needs_git, clone_not_top, clone_no_commits,
  clone_detached, clone_needs_new_vm, copying_branches,
  clone_seed_failed, remotes_taken, remote_add_failed, fetch_until,
  uncommitted_not_copied, clone_ready, unfetched_commits,
  no_terminal_fetch, fetch_before_delete, fetching, fetch_failed,
  clone_check_failed, clone_dirty, no_terminal_delete, delete_anyway,
  kept, removed_remote; unsafe_folder and git_protect_needs_macos_new
  name --clone. Doc links: clone_not_top, clone_no_commits,
  clone_detached, clone_needs_new_vm, remotes_taken, fetch_until,
  no_terminal_fetch, no_terminal_delete
- tests: testscript clone.txtar (refusals, the new VM's mounts, state,
  push, remote and clone; no reseed; rm clean, unfetched, dirty, -f, a
  remote pointed elsewhere; a failed copy retried; clone_needs_new_vm);
  Go TestUpClone, TestCloneRm (fetch yes/no, delete anyway, a stopped VM
  started, VM answers that aren't object names), TestCheckCloneRepo,
  TestFreeRemote, TestRemoveRemote. Stubs: limactl runs a clone's git
  on $STUB_DIR/vmfs; new ssh stub pushes and fetches there
- converted: the bats suite has no clone cases besides cli.bats
  parse_args, which waits for --from
- e2e: clone section (own HOME and git config, throwaway repo): clone
  with every branch and only the tools mounted, shell in it, remote,
  nothing locked, rm refusing unfetched commits and uncommitted
  changes, fetch over devvm's ssh config, rm -f removing the remote and
  keeping fetched branches
- docs: clone.md; commands, security, git-protection, ssh,
  contributing, index; CLI reference

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-24 12:26:40 -06:00
w3cjandClaude Opus 5.5 f2aa210bf7 feat(up): existing VMs, restart, remove, update, adopt and rm
devvm opens a VM that exists instead of refusing it: unfinished VMs
(no state or no network choice) are refused before anything; --backend,
--network-policy, --no-git-protect, --cpus/--memory/--disk and --ports
are ignored with a warning each; an IMAGE naming what the VM lacks adds
it in place after asking (tools built and listed, a layer's script run
in the VM, new agents' folders mounted with a stop first); outdated
images and newer tools are warned about, the daily tools check runs,
agent folder mounts follow the host's, .git is checked per run, set-id
files are named on Linux, a stopped VM gets the size and ports its state
asks for (a running one is told they apply at its next start); then it
is started if stopped (a running VM with network policy keeps its
proxy), the self-check runs (a failure stops the VM), and it is set up
and its shell opened.

Commands: restart (stop, then open), update (newest shared tools, built
from base, then open), remove TOOLS (out of the image and tool list,
then open), adopt (a VM made for an earlier folder at this path, after
asking; .git protection restarts as appeared), rm [-f] (exports the
agents' history first unless -f, a failed export keeps the VM; a VM of
an earlier folder only after asking, without export; deletes the VM,
state, proxy, rules, run files, logs, .git locks, host keys and ssh
config entry, also when the delete failed but left no VM).

Inventory:
- vm: find/findExisting/existing, sameFolder, open, run, setUp,
  warnIgnored, checkSetID, applySize, applyPorts, addLayers,
  wantedImage, runScript, buildTools; Restart, Remove, Update, Adopt,
  Rm, export, delete; start refuses vm_unfinished and stops a leftover
  proxy for VMs without network policy
- gitprotect: Protector.Check (replaced, appeared, new submodules in
  the tree and .git/modules, unlocked hooks, commondir, delegations on
  change; locks only while stopped; unset protection set up as new),
  Locked field; platform.Immutable
- tools.Update takes a build func; build.Builder.LayerScript exported
- cli: restart, remove, update, adopt, rm; withEnv; root Long
- messages: vm_other_folder (reworded), vm_other_folder_rm/_adopt,
  delete_other_folder_vm, adopt_vm, vm_adopted, vm_already_here, no_vm,
  vm_unfinished, backend/net/git_protect/ports_flag_ignored,
  size_flags_ignored, size_next_start, ports_next_start, add_in_place,
  restart_for_mounts, no_terminal_confirm, keeping, adding,
  add_layer_failed, vm_is_now, exported, export_failed, deleted,
  rm_failed, adopt_failed, git_replaced, git_appeared,
  git_embedded_new, git_hooks_unlocked; net_unenforced_stop says devvm
  starts it again confined; vm_exists removed
- tests: testscript existing.txtar, existing_agents.txtar; Go tests for
  Check (five per-run reports, replaced/appeared, off/unset), open with
  network policy, addLayers, Rm, Adopt, remove/update/restart; limactl
  stub: delete-fails, Exec-fed scripts
- converted bats: delete (vm_unfinished, rm cleans up after a failed
  delete, rm deletes only this VM), project (folder made again, update
  twice, remove twice, five .git per-run reports), ports (applied once,
  restart warning), size (restart warning), cli (rm forgets host keys)
- e2e: project (stop and relaunch, running relaunch, restart with host
  keys, swapped .git, new submodule locked, rm unlocks; agent folder
  added/removed on restart, rm exports history without logins), tools
  (update, remove), network (relaunch confined, unenforced relaunch
  stops it, rm -f)
- docs: commands.md (existing VM, adding, deleting, a folder made
  again), coding-agents.md (mounts on launch, history), git-protection
  (on each launch), images, network, security; CLI reference

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-24 12:07:16 -06:00
w3cjandClaude Opus 5.5 4bdb3ea843 feat(ssh): ssh config and pinned host keys
Each running project VM can be reached as devvm-<folder> (or by its full
name when two folders share a name) through ~/.config/devvm/ssh_config,
which up rewrites after the VM's setup. Every entry checks the VM's own
host keys, kept in ~/.config/devvm/known_hosts and read from the VM
through its backend, and sets StrictHostKeyChecking yes, ForwardAgent no
(unless the VM forwards), and its own connection. Only Lima's login
options are copied. Host keys are dropped before each start, and when an
interrupted new VM is deleted, so they're read again.

Ported: write_ssh_config (sshconfig.Write), record_host_keys,
forget_host_keys (ForgetHostKeys, in vm start and the interrupt cleanup),
ensure_ssh_include (EnsureInclude: asks with [Y/n] on a terminal, else
says to add the line; no caller yet: --clone and devvm ssh/code),
ssh_alias (Alias), is_project_vm (project.IsVM), check_ssh_agent (vm
checkAgent, run when a new VM forwards the agent). Backend.SSH's
SSHTarget gains Options (Lima: identityfile, identitiesonly,
preferredauthentications, batchmode, compression, gssapiauthentication,
ciphers). Registry.All, state.WriteFile.

Messages: ssh_include_needed, ssh_include_yourself, add_it_now,
ssh_include_added, no_ssh_agent, ssh_agent_empty, load_key, key_loaded,
key_loaded_keychain, load_key_with. Doc links: ssh_remote_hint,
ssh_include_yourself.

Converted bats cases: cli.bats "ssh config: only running VMs, each with
its own host key checked; Lima's unchecked settings left out" (ssh.txtar,
lima TestSSH, sshconfig TestWrite; the rm half waits for rm),
delete.bats "ls and the ssh config include a project VM named like an
image" (ssh config half: ssh.txtar, TestWrite), project.bats "ssh_alias:
short name unless two folders share it" (TestAlias, ssh.txtar). New:
TestWriteUnchecked, TestParseHostKeys, TestEnsureInclude, TestCheckAgent,
TestIsVM. Stub limactl: Lima-like ssh.config at start, host keys from
shell, sshLocalPort/sshConfigFile in list.

e2e: project checks the hostname, the entry, pinned host keys, ssh
devvm-web through an ~/.ssh/config of the run's own (Include plus Host *
ForwardAgent yes), no agent forwarded (a throwaway agent), a changed host
key refused; network checks ssh devvm-net. Nothing touches the real
~/.ssh.

Docs: ssh.md (from the ssh page), linked from the index, commands,
security, images and contributing.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-24 11:39:20 -06:00
w3cjandClaude Opus 5.5 49d7205360 feat(sync): host settings, agent config and mounts for VMs
A new VM's setup now sends the whole of guest/sync.sh and its host
side, staged in memory: the hostname, timezone, UTF-8 locale and git
identity; the agents' config files (never their history), with their
folders mounted read-only at their host paths (one with a comma is left
out, with a warning); and the VM's tokens, as they are without network
policy (naming MCP servers whose secrets go too) or as its own
placeholders with it. With network policy it also sends devvm's CA, the
proxy's address (Backend.ProxyURL), the logins' copies with placeholders
and the agents' settings files with secret-looking values redacted (one
that can't be read that way isn't sent). UpdateAgentDirs keeps an
existing VM's agent mounts current through Backend.SetAgentDirs; its
caller comes with up for an existing VM. New docs page: coding agents.

Ported: sync_vm, agent_dirs, agent_files, agent_mounts,
update_agent_mounts, host_tz, claude_mcp_warn, the settings redaction;
guest/sync.sh copied whole (one comment edited).

Bats cases converted:
- project.bats: agent_mounts (one per line, names with spaces); the
  four update_agent_mounts cases (Go table tests, plus a running VM
  restarted once the user agrees)
- build.bats: sync_vm staging removed on failure, settings redacted
  with network policy (testscript sync.txtar)
- guest.bats: the prompt, blocked since the last prompt, MCP servers'
  merge (testscript guest.txtar)
- network.bats: claude_mcp_warn (sync.txtar, secrets Go test)
Deferred: guest.bats VS Code settings (ssh/code).

e2e: project gains agent folders and the VM's setup (mount read-only,
settings copied, history never, git identity, timezone, hostname, the
token without network policy); network becomes claude+codex and checks
the CA installed, the VM's own placeholder, the logins' copies and the
host's login files unchanged, with curl verifying TLS (no -k). Agent
folders on relaunch and restart wait for those commands.

Messages: agent_dir_comma, agent_dirs_added, agent_dirs_removed,
update_mounts, mounts_next_start, mounts_updated, no_claude_token,
claude_token_invalid, no_github_token, login_copy_failed,
config_redacted, config_not_copied, claude_mcp_secrets_copied;
sync_failed reworded.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-24 11:20:03 -06:00
w3cjandClaude Opus 5.5 ff57370ffb feat(network): network policy for VMs
A new VM can get network policy: --network-policy, else a question in a
terminal (no by default), else off. devvm makes its CA, writes the VM's
secret bindings, starts the VM's proxy (devvm _proxy, its password in a
file) and starts the VM confined to it, then runs the self-check before
the setup and the shell: a VM that isn't held to its proxy is stopped.
Tokens stay on the host; the hidden devvm secret get reads them for the
proxy, from the Keychain or a file. e2e gets a network section.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-24 10:46:24 -06:00
w3cjandClaude Opus 5.5 f4508dfb61 feat(proxy): the network policy proxy as devvm _proxy
The network policy proxy moves into the binary as internal/proxy
(standard library only), run by the hidden devvm _proxy with its own
flags. Main returns errors instead of exiting, writes only to the
streams devvm hands it (the event log and data on stdout, its log
lines on stderr), and returns when the VM's hostagent is gone. The
connect mode is gone: devvm _qemu connect does that. Logins copied
as they are are warned about through ui.

Its tests come along, with a short run, fuzz targets for policy rules,
request targets and ClientHellos, a testscript, and the network page
of the docs for the proxy.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-24 10:12:26 -06:00
w3cjandClaude Opus 5.5 42d3fd4356 feat(tools): shared tools
The toolchains and agents an image name holds (node, python, rust, go,
claude, codex, opencode) are shared tools: resolved per user into the
tools lock by devvm's pinned, checksummed mise, built once into
read-only EROFS images in a throwaway VM from base, and mounted into
every VM that names them. The lock is checked again daily, in the
background through devvm _refresh-tools, and before a new VM when due.
Copies tools/ and guest/tools.sh, and the shared tools part of
guest/sync.sh, which a new VM runs once it starts. e2e gains a tools
section.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-24 09:50:15 -06:00
w3cjandClaude Opus 5.5 53c37e4dee feat(up): create a project VM and open a shell
devvm [IMAGE] in a folder creates its VM: the folder checked (its path,
unsafe folders, a folder made again), its size and ports, the image
named or detected and built, cloned with only the folder mounted, its
state, .git hooks and config locked (macOS), started, then the backend's
shell in place of devvm. Network policy isn't there yet, so a VM is
created only with --no-network-policy; an existing VM is refused for
now. Ctrl+C before the first shell deletes the VM and unlocks .git.

Global flags: --backend, --network-policy/--no-network-policy, --cpus,
--memory, --disk, --ports; up's own --unsafe-folder, --no-git-protect.
tests/e2e.sh gains a project section, with Lima's Exec quoting checked
on a real VM. New docs: commands, security model, .git protection.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-24 09:14:27 -06:00
w3cjandClaude Opus 5.5 c632b96142 fix(build): a failed build keeps its VM for inspection
Once the image's VM exists, a failed start, script, sync or stop leaves
it stopped and without a record; the error says how to open a shell in
it with devvm's Lima home, and the next build deletes it. Ctrl+C, and a
failed create or clone, still delete it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-24 08:36:56 -06:00
w3cjandClaude Opus 5.5 27905c2413 feat(build): build and rebuild images through the backend
devvm build and devvm rebuild build base and the user's layers through
Backend.BuildImage. On Lima an image is a stopped instance: base from
Ubuntu's cloud image with base.yaml, a layer a clone of its parent, each
started confined with no host mounts, its script run, then stopped. Records
are written last; an interrupted or failed build deletes its instance
through the cleanup stack. Rebuild bumps the rebuild counter and deletes
stale images no VM uses.

tests/e2e.sh starts here, with its framework and an images section.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-24 03:47:25 -06:00
w3cjandClaude Opus 5.5 09786d1951 feat(image): Ubuntu cloud image and the base image files
Add base.yaml and layers/ (base.sh, base.policy, Ubuntu's cloud image
key) and internal/ubuntu, which finds the newest dated Ubuntu 26.04
release with an image for the host, takes its digest from SHA256SUMS
and checks the signature with gpgv when it's installed. Fetches use
net/http with a timeout, retries and no redirects to another scheme;
DEVVM_UBUNTU_URL moves the listing (file:// folders in tests).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-24 03:21:27 -06:00
w3cjandClaude Opus 5.5 218d8d9569 feat(lima): Lima backend
The Lima backend behind backend.Backend: limactl on devvm's own Lima
home, run from devvm's data folder, refusing Lima's global configs and
networks devvm didn't set. Start confines VMs with a Seatbelt profile
(macOS) or the QEMU wrapper, devvm _qemu, with restrict=on and a
guestfwd to the proxy (Linux), tolerates degraded starts, and records
the hostagent for Confined. Clones with qcow2 overlays on Linux, size,
ports, mounts, agent forwarding and the ssh target. BuildImage comes
with the image build.

Adds NameMax and LoggedError to the backend package, a limactl stub,
the registry with lima as the default, and the Lima docs page.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-24 03:11:14 -06:00
w3cjandClaude Opus 5.5 21d21ea007 feat(backend): backend interface, capabilities and registry
The Backend interface every VM backend implements, Caps per feature
(native, emulated and reviewed or not, none), Require with one-line
refusals for missing and unreviewed features, the registry and the
choice of backend for a VM. A fake backend for tests, the default
backend file in state, and the backends docs page.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-24 02:44:05 -06:00
w3cjandClaude Opus 5.5 9c11d42379 feat(image): image keys, chains and tool image names
internal/image hashes everything that goes into an image, the backend
included, as length-prefixed fields: base's files, features, --from and
its digest, each layer's script and rebuild counter, and each parent's
key. Tool image names hash the lock entry, tools/build.sh and the libc.
The images page gains its caching section.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-24 02:34:56 -06:00
w3cjandClaude Opus 5.5 e182e3787a feat(ui): output helpers, spinner, run logs and cleanups
internal/ui is now the only package that prints: the message helpers,
prompts, tty detection, the status line, the run log (Logged, step
counts, proxy keys redacted) and ui.Main, which recovers Die, runs the
cleanup stack and handles INT/TERM/HUP (exit 130). main runs devvm
through it, and Cobra's errors print as one-line devvm errors.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-24 02:27:59 -06:00
w3cjandClaude Opus 5.5 09581cb9b6 refactor(msg): standard go-i18n TOML, doc links in Go
locales/*.toml now hold only go-i18n's message fields and load with
go-i18n's own loader (RegisterUnmarshalFunc with BurntSushi/toml, then
LoadMessageFileFS), so go-i18n's tools work on them. Doc links move to
the docs map in internal/msg/docs.go; TestDocLinks checks every key is a
message and every page and heading exists. The generator decodes en.toml
into go-i18n's message fields and refuses anything else.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-24 02:16:08 -06:00
w3cjandClaude Opus 5.5 13b9afa59e feat(msg): generated typed messages with go-i18n
locales/en.toml holds every message; go generate ./internal/msg writes
one typed function per message. internal/msg renders them through a
go-i18n bundle in the user's language (LC_ALL, LC_MESSAGES, LANG), with
names mode (DEVVM_MESSAGES=names) and doc links. devvm _msg prints a
message's text. Tests check the generated file is current, every
message renders and is called, and every doc link exists; lint runs
the doc link check.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-24 01:42:46 -06:00