Commit Graph
70 Commits
Author SHA1 Message Date
w3cjandClaude Opus 5.5 bd124472e9 refactor(msg): warnings and errors don't repeat devvm after its prefix
Warn, Die and DieLogged print "devvm: " before a message, so the 73
warnings and errors whose text started with devvm read "devvm: devvm
couldn't ...". They now lead with what failed or what they're about,
with the same fields. The 20 that only Info, Note or a prompt print keep
their text. The docs-voice skill gets the rule and a tropes example, and
qemu.txtar matches qemu_refused's new wording.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 11:04:31 -07:00
w3cjandClaude Opus 5.5 d3948f0933 test: CLI scripts expect the docs-voice wording of usage errors and qemu_refused
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 10:33:53 -07:00
w3cjandClaude Opus 5.5 ee06f051ff refactor(msg): remaining messages in the docs voice
Rewrites the messages outside the prompt, network policy, secrets, project folder, .git, --clone, backend, host, image, build and shared tool groups (agent_, ssh_, ports_, size_, disk_, vm_, no_, devcontainer_ and the rest) as full sentences: what happened first, then one action as a command, without chained colons and semicolons. Status steps and short ==> result lines stay as they are, and every template keeps its fields.

Adds doc links for the actionable warnings and errors that had none: no_devcontainer_flag_ignored, no_ssh_agent, ssh_agent_empty, load_key_with, no_vm_ssh_agent, agent_key_not_found, agent_load_failed, agent_start_failed, mounts_next_start, no_feature, no_image_named, no_image_named_from, not_an_image, no_vm, no_vm_size, no_vm_ports, no_vm_git_protect, no_vm_policy, no_token, bad_secret_service, start_failed, stop_failed, delete_failed, vm_create_failed, sync_failed and pack_failed.

msg_unknown's wording is checked by TestValuesAsGiven and msg.txtar, which follow it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 10:26:23 -07:00
w3cjandClaude Opus 5.5 9cf45cc5e0 feat(net): network policy on by default; a warning where a VM can't have it
A new VM gets network policy unless it's turned off. In a terminal devvm
shows the tradeoff and asks yes by default ([Y/n]); without a terminal
it's on. A VM that can't have network policy gets no question, only a
warning, and is made without it: on a backend without egress-proxy (or
with it unreviewed), and a Docker VM made for the docker layer, whether
named or from a devcontainer.json's docker-in-docker. An explicit
--network-policy on such a VM is still refused (net_docker_layer, or
backend_lacks from Require). Existing VMs keep their state's choice.

- netpolicy.Proxy.Choose: no terminal gives on; in a terminal net_about,
  then Confirm (yes by default). Proxy's Ask field and netpolicy.UI's Ask
  removed (unused); vm.UI asks Ask itself.
- vm.creation.chooseNet: --no-network-policy first; the docker layer
  warns (net_off_docker_layer) or refuses --network-policy; a backend
  Registry.Allowed doesn't let egress-proxy through warns
  (net_off_backend); otherwise Choose.
- Messages: new net_off_docker_layer, net_off_backend (with doc links);
  net_about rewritten as the two-line tradeoff with a doc link
  (safety/network#turning-it-on-or-off); net_ask is "Turn it on?" (no
  fields); devcontainer_docker_net removed (no caller).
- --network-policy's help: secrets, default on, asked in a terminal; CLI
  reference regenerated.
- Tests: TestChoose (flags, terminal yes/no, no terminal on, what's said);
  TestChooseNet replaces TestChooseNetDockerLayer (docker layer named and
  from the file, no egress-proxy, unreviewed egress-proxy, flags, with and
  without a terminal); TestUpWithoutEgressProxy (backend_lacks for
  --network-policy, the warning and net=off by default).
  network.txtar: --no-network-policy for the off VM, and a VM made without
  a flag or terminal gets net=on. docker.txtar: another machine's engine
  (backend_lacks, then the warning and net=off), and the sysbox VM's
  warning. e2e's docker sysbox check expects the warning.
- Docs: first-vm, commands, safety/network (the prompt, the VMs that
  can't have it), security, attack-vectors, devcontainer, backends index
  and docker, design notes, README.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 08:45:55 -07:00
w3cjandClaude Opus 5.5 8439cbdb8c ci: the tests pass on Linux runners; workflows linted with actionlint and zizmor
The tests assumed a macOS host with 4 or more CPUs:
- size: the stub VM has 2 CPUs, which any host running the tests has
- ls, images: smolvm's --state-dir on Linux
- docker: .git protection is off on Linux
- the limactl stub's delete forgets the VM's port forwards and ssh port,
  as Lima does, so from's second conversion VM is configured again
- TestStartForwarder confines Lima's start as the host does (no
  sandbox-exec on Linux)
- TestProcessArgs runs sh, which ignores the extra arguments GNU sleep
  exits on

lint:code runs actionlint and zizmor (offline) on the workflows; ci.yml's
paths are written out, without a YAML anchor, and the deploy job's
permissions say why.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 08:01:37 -07:00
w3cjandClaude Opus 5.5 fd6170c7f7 fix(lima): the sandbox refuses the hostagent's port binds; ssh ports recorded
On macOS, a network-policy VM's hostagent Seatbelt profile denies every
network bind but TCP on its ssh port and unix sockets in its Lima
folder, so Lima forwards none of the guest's ports even if its ignore
rules were bypassed. Lima's host resolver is off for these VMs, as on
Linux: it binds a random port the profile can't allow.

Every VM's ssh port is chosen and recorded before create (VMSpec.SSHPort,
Lima's .ssh.localPort), under a lock so two VMs can't choose the same
one, and checked free by a bind as well as a connect. Other VMs'
forwarders reserve it, so none can take it while Lima boots, when
Lima's unpinned ssh would reach whatever has it.

Design note: the sandbox's binds, how they were found, the threat check.
e2e: the profile's rules, binds refused around Lima's rules, a taken
ssh port, a direct VM's recorded port.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 01:14:22 -07:00
w3cjandClaude Opus 5.5 70f472eacd feat(ports): port changes apply to running VMs
devvm ports on a running VM records the ports and starts only its
forwarder again, on every backend: the VM runs on, and connections
open through the old forwarder close (ports_forwarding). SetPorts
takes the VM's Confinement (host key, proxy and decider ports, Free,
which leaves out and warns ports a host program has); Env.forwarding
builds it for starts and changes alike. State is written first, so
other VMs' forwarders reserve the new ports, and put back if the
backend fails. A per-VM lock (platform.LockFile, Forwards.Lock) keeps
two runs from leaving a forwarder nothing stops; Stop kills a
forwarder that outlives SIGTERM by 2 s. A smolvm or Docker VM started
outside devvm gets ports_no_ssh.

Removed: ports_set, applyPorts, startPorts, ports_pending,
ports_next_start. ports.txtar takes free ports (free_port) instead of
fixed ones a host program can hold.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 00:04:38 -07:00
w3cjandClaude Opus 5.5 5fe850e1b2 feat(smolvm): forward listed ports through devvm's forwarder
smolvm's listed ports go through devvm's forwarder (Spec.Only), as
Lima's and Docker's do: smolvm itself forwards only the VM's ssh. The
record keeps the list (listed_ports); create and SetPorts pass no -p.
That lifts smolvm's 64-forward limit and its reach of servers on all
addresses only, and allows listing 22. smolvm's ports are emulated,
reviewed: design note with a threat check for listed ports, e2e (a
listed port on the VM's loopback reaches the host, an unlisted one
doesn't, the machine publishes only its ssh, a network-policy VM's
listed ports).

Removed: smolvm_too_many_ports, smolvm_port_ssh.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 22:47:03 -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 cf5a7db974 fix(images): pin Lima's Ubuntu cloud image with base's snapshot
Lima's base starts from a pinned dated Ubuntu cloud release (release-20261016) with each architecture's SHA-256, checked against Ubuntu's signed SHA256SUMS; another checksum is refused (ubuntu_checksum_unpinned). The pin is in base's image key (Lima's KeyFiles). scripts/bump.sh apt moves it with the snapshot and container digest: the newest release dated before the snapshot, its SHA256SUMS checked with gpgv against Ubuntu's cloud key.

e2e: default tier 146/0, --only from 13/0.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 05:13:12 -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
w3cjandClaude Opus 5.5 7259ad13a1 feat(docker): the docker layer on Docker VMs with Sysbox
Docker's engine runs inside a Docker VM only under Sysbox, on a Linux engine of this machine's: its own user namespace, its own network with nothing else on it, volumes of its own for Docker's and containerd's files, dockerd started after each start. Made with the layer or given it in place (its container made again from a commit); a failed add in place makes the VM as it was. Elsewhere refused in one line (docker_layer_no_sysbox, docker_layer_needs_vm); devvm never runs a container --privileged.

No network policy for it at any step (net_docker_layer): root in it controls its own network. A bridge routing to this machine's loopback (Docker's userland proxy off), or one whose setting can't be read, is refused at creation and each start (docker_route_localnet, docker_bridge_unreadable).

Set-id files of root's, or root's group's, in the project folder are named apart as running as root (setid_root_files); setid_files says the rest run as their owner. Root in any Docker VM writes the folder as the host's root.

Reviewed with the security-audit skill; e2e on the Linux engine with Sysbox 0.7.1 (135/0) and Docker Desktop (115/0, the refusal).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 03:17:36 -07:00
w3cjandClaude Opus 5.5 fcbea2c744 feat(docker): network policy, and build confinement on Docker Desktop
A Docker VM with network policy sits alone with a relay container on an
internal network of its own (inhibit_ipv4). The relay, devvm's own Linux
build in an empty imported image (read-only, every capability dropped),
copies the VM's connections to a unix socket of devvm's proxy on the
host, so tokens, the Keychain, the CA key and agents' logins never enter
Docker. On and off is docker network connect/disconnect at the next
start. Desktop builds run on a network and relay of their own, through a
host proxy allowing any host on ports 80 and 443.

- every Docker VM drops NET_RAW; it's in the config hash, so containers
  are made again from their commit
- confined: the start's ID, the VM alone on its network with the relay
  by its recorded container ID, the network still internal; a foreign
  member is docker_network_shared, at start and on removal
- proxy: -listen-unix, -relay/-relay-to; a lifeline pid file written
  after the proxy started whose process has gone ends it
- macOS fetches the release's Linux build on first use, checked against
  a SHA-256 the two-pass release.sh bakes in; builds without the pin use
  devvm-linux-<arch> beside devvm or refuse
- the build proxy is stopped through the process devvm started
- reviewed: design notes and threat check in design.md; e2e on the
  Linux engine and Desktop: dropped capabilities, network members and
  options, no IPv6 beyond the bridge's link-local, no DNS query leaving
  (captured, with an unconfined control), direct connections refused

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-28 05:08:03 -07:00
w3cjandClaude Opus 5.5 edc0c865ed fix(vm): launches ask only the backends a VM's state names
A launch lists VMs (the ssh config, the SSH agent's folder checks) only
on backends some VM's state names, so a Lima user's launch never runs
docker or smolvm, and a wedged or missing engine never slows one down.

- state.Backends: the backends the VMs' states name; Registry.Used: the
  registered ones among them, sorted. ls and images use state.Backends
  to fail only on a backend a VM's state names (vm.BackendUsed goes).
- Env.mounts and sshconfig ask Registry.Used; sshconfig.Config.Backends
  is a function read at each write, and Write fails on unreadable state.
- up.txtar: a new and an existing Lima VM's launches run neither docker
  nor smolvm; registry_test covers Used.
- tests/e2e.sh: the from section's launches make no docker call but
  image inspect.
- docs: backends.md says which backends a launch asks.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-27 01:49:13 -06:00
w3cjandClaude Opus 5.5 2b413028e6 fix(images): pin Ubuntu's container image with base's package snapshot
smolvm's and Docker's base start from Ubuntu's container image by a
digest pinned in internal/ubuntu (ContainerDigest), not the tag's digest
looked up at build time. base's key hashes it (each backend's KeyFiles),
and base's record names it. The image is never newer than
assets/layers/base.sh's snapshot: an image with newer packages leaves apt
unable to install what depends on their exact versions (the docker
layer's docker-ce, through systemd's libsystemd0).

- internal/ubuntu: ContainerRepo, ContainerDigest, ContainerRef,
  ContainerOrigin; the backends' Digest fields and UbuntuImage go.
- base.sh: apt_snapshot 20261026T000000Z, with the image's digest
  sha256:19fcd1bf268f (built 2026-10-25).
- scripts/bump.sh: apt moves the snapshot and the image's digest
  together (the index's digest hashed from what the registry sent), and
  refuses an image built after the snapshot; bump.txtar covers both.
- tests/e2e.sh: timings per selection and Docker engines, so an
  --engine linux run isn't compared with one that included Desktop; the
  Linux engine's run pulls the pinned Ubuntu image before recording what
  Docker has without the sandbox's label; base's records are checked
  against the pin; smolvm's TSI check takes any of this machine's
  resolvers; the from section allows devvm's labelled VM listing.
- docs: smolvm, Docker, images, maintaining, contributing; design.md's
  smolvm notes describe the reviewed emulations as they are.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-27 01:16:57 -06:00
w3cjandClaude Opus 5.5 db07c9a43d fix(ssh-agent): the ssh config's agent follows the VM's running start
A VM's ssh config entry, devvm's own SSH_AUTH_SOCK and its key reloads
use the agent choice the VM's current start was made with; a stopped
VM, or one started outside devvm, follows the stored choice. Turning
forwarding on or off for a running VM reaches ssh by name, editors and
devvm's shell at its next start, as agent_next_start says.

- Backend.StartID: Lima's hostagent pid file, smolvm's lifeline, the
  container ID and StartedAt on Docker; the fake counts starts
- state: ssh_agent_started=<mode>_<hash of the start>, written after
  each start; sshagent.Running reads it
- tests: TestRunningAgent, TestWriteAgentStarted, ssh_agent.txtar,
  docker.txtar, smolvm.txtar; e2e on Lima, smolvm and Docker

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-26 23:11:51 -06:00
w3cjandClaude Opus 5.5 6f597d7e1f feat(docker): ssh, ports and agent forwarding over docker exec
Docker VMs get ssh for editors, listed ports, every port, agent
forwarding and agent toggling, all over one transport: devvm's ssh
config reaches a VM through `devvm _docker-connect`, which runs
`sshd -i` in the labelled container by ID with docker exec. The
container publishes nothing and runs no listening sshd.

- internal/backend/vmssh: VM keys, host-key parsing, the port
  forwarder and its processes, shared by smolvm and docker
- `devvm _docker-ports`: every port, or the listed ones; ports a host
  program has are skipped (ports_taken)
- the agent goes only to ssh sessions (ForwardAgent, IdentityAgent);
  no socket is mounted
- --clone on Docker, its clone in a per-VM volume
- platform.ListenExclusive keeps SO_REUSEADDR on Linux; UsedPorts
  leaves out the VM's own listed ports
- messages: vm_no_ssh, vm_no_sshd, ports_no_ssh, ports_forward_failed,
  forwarder_failed, docker_ssh_path, docker_connect_failed
- reviewed: design notes and threat check in design.md; e2e checks for
  a hostile sshd config, host ports kept on every address family, and
  ports not forwarded off loopback or listed by another VM

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-26 10:33:41 -06:00
w3cjandClaude Opus 5.5 9ec1601801 feat(docker): an experimental Docker backend, its containers and native features
Each VM is a container from an image devvm builds by running its scripts
in a container and committing it. A container is not a VM: on Linux it
shares the host's kernel, on macOS Docker Desktop's one VM; docker.md says
so first.

- internal/backend/docker: build-image (docker commit; base from Ubuntu's
  image by digest, prepared by the container scripts smolvm shares, now in
  assets/container), from (any image Docker has or pulls), clone,
  project-mount and agent-folders (bind mounts), tools-share (tool images
  unpacked into a volume by a network-less container, linked by
  guest/tools.sh; ToolFormat dir-<unpack.sh>), cpus and memory (docker
  update). Build confinement native only on a rootful engine of this
  Linux machine; Docker Desktop and other engines build nothing yet.
- Containers run --init and a sleep; services.sh after each start, without
  Docker's daemon. Mounts and network are hashed into a label; a start that
  finds them changed commits the container and makes it again under the
  same name (flattened past 100 layers), its home a per-VM volume.
- The VM's user has the host's uid, and on Linux its gid. A --clone VM's
  clone gets a volume (VMSpec.CloneAt).
- Disk none: DiskUser reports what a VM holds (devvm size's disk_used),
  warned past base's disk by launches and ls; a default disk size is left
  out of a new VM on such a backend, said.
- Everything labelled devvm.data=<data folder>; only labelled resources
  are touched; names Docker shares between users carry its hash.
- Problems: docker on PATH, a reachable engine (or the docker group fix),
  29.1+, Linux containers, this machine's arch; Report names the engine and
  Docker Desktop's file sharing, which CreateVM checks.
- ssh, ports, ports-all, agent forwarding and toggling, egress-proxy, disk
  and the new docker-layer feature are none: refused in one line. Builds
  ask for build features only when they build, so a built image works
  where it couldn't be built.
- testdata/stubs/docker: a stateful engine; docker.txtar; unit tests;
  tests/e2e.sh --backend docker on a Linux engine in a Lima VM e2e keeps
  (~/.lt-e2e-go-docker) and on Docker Desktop, with images copied from the
  Linux run.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-26 08:54:04 -06:00
w3cjandClaude Opus 5.5 e6681035b2 feat(images): a built-in docker layer
Docker is a layer devvm ships, docker, chosen per VM like any layer
(devvm node+docker, devvm build docker) and added to an existing VM in
place. base installs no Docker.

- Built-in layers: image.Builtins (docker) and IsBuiltin; a name is
  looked up in devvm's assets/layers first, so a user's docker.sh is never
  read; devvm layer new docker is refused (layer_name_reserved); an
  image's key hashes the shipped script (own file, must exist); Layers,
  Environments, completion and unknown_layer/no_image_for list it;
  Env.LayerData reads either kind's script.
- assets/layers/docker.sh: Docker's apt repository (pinned key, pinned
  package versions; Alpine's own packages, rc-update, the docker group),
  the daemon started now too (OpenRC, or with no init system as
  services.sh does) for a VM it's added to in place. scripts/bump.sh's
  docker pins read it.
- assets/layers/docker.policy: Docker's packages and the registries,
  applied to VMs with the layer (netpolicy.PolicyFiles); base.policy
  keeps OS packages (Alpine's too), mise and GitHub.
- Adding layers in place sets the new image in the VM's state before
  their scripts run, so a network-policy VM's proxy allows their hosts;
  a failing script sets it back.
- smolvm's sshd.sh keeps the snapshot's package lists, for layers'
  apt-get install.
- Docs: images (base, built-in layers, keys), customizing, commands,
  network, smolvm, from, install, maintaining, design, coding-agents,
  contributing; the CLI reference; AGENTS.md's assets/ line.
- Tests: key, layers, build, policy files, in-place add (devvm's script,
  image during the run, set back on failure), layer new docker; e2e:
  a base VM has no Docker (Lima, smolvm), the docker layer on Debian 12
  and Alpine (from), and smolvm's network-policy VM is a docker VM whose
  Docker pulls through the proxy.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-26 07:18:30 -06:00
w3cjandClaude Opus 5.5 a9459a8c9c fix(ports): never forward a listed port a host program has
A listed port's forward (Lima's hostagent, smolvm's -p) listens on
127.0.0.1/::1 with SO_REUSEADDR, so on macOS it took a port a host
program held on *:PORT, and that program's localhost connections with it
(checked on both backends). Now each start checks the VM's listed ports
first and leaves out those in use, warned; the VM starts all the same,
and the next start that finds a port free forwards it again.

- platform: ListenLoopback (moved from smolvm's forwarder), PortFree and
  PortInUse, which listen on 127.0.0.1 and ::1 without SO_REUSEADDR (a
  port held only by ended connections counts as free; one that can't be
  bound for another reason, such as below 1024 on Linux, isn't in use).
- vm: start checks the backend's listed ports (ports_set) with
  Env.PortInUse, warns ports_taken, and passes the rest in the new
  Confinement.Ports; every port and none pass nil.
- Lima: Start parses portForwards from limactl list and sets them only
  where devvm's rules differ (guestIP compared for ignore rules alone),
  so a start edits, and the VM gets new host keys, only when a port is
  left out or comes back.
- smolvm: Start updates -p where the machine's ports differ
  (listedPorts); the ssh port choice (freePort, PortFree) and Lima's
  confined ssh port use platform.PortFree.
- Lima's forwards of every port aren't checked (Lima makes them as guest
  servers start): documented as a limit.

Message: ports_taken. Docs: images.md (ports), lima.md, smolvm.md,
security.md, design.md, limits.md, contributing.md. Tests: platform
TestListenLoopback, vm TestSplitPorts and TestStartPorts, lima
TestStartSetsPorts, smolvm TestStartListedPorts; ports.txtar and
smolvm.txtar with a host listener (listen_any); the limactl stub keeps
the portForwards clone and edit set. e2e: a host program on *:PORT
keeps its port while the VM lists it, and the port is forwarded again
once freed (project and smolvm sections).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-26 01:12:58 -06:00
w3cjandClaude Opus 5.5 75652b3097 feat(smolvm): turn ssh-agent forwarding on or off for an existing VM
smolvm forwards an agent only if the machine was made with --ssh-agent,
and reads SSH_AUTH_SOCK at each start. agent-toggle is now an emulation,
reviewed:

- Every new smolvm VM is made with --ssh-agent. Each start points
  SSH_AUTH_SOCK at the user's agent (on), devvm's agent (devvm), or a
  path no socket can exist at, /dev/null/devvm-no-agent (off): nothing
  listens, so off VMs share no agent to add keys to or sign with.
  Every other smolvm command runs without SSH_AUTH_SOCK.
- Off wins whenever the record or Confinement.NoAgent says so, so starts
  for exports and clone checks give no agent either.
- A VM made without forwarding can't be turned on (agent_fixed).
- Each start records the machine's lifeline; a running VM whose lifeline
  differs and whose mode isn't on (started outside devvm, with whatever
  agent that shell had) is stopped at launch, ssh, code, restart and
  export (agent_unchosen_stop), through backend.AgentStarter.

Docs: smolvm.md (SSH agent forwarding), backends.md, ssh.md,
security.md, limits.md, testing.md, design.md (the design note and
threat check). e2e: each mode, toggling on an existing VM, devvm's agent
ending, a start outside devvm stopped; direct starts in the network
checks pass an agent path.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-26 00:39:10 -06:00
w3cjandClaude Opus 5.5 293c3a82ca feat(smolvm): forward every port, loopback-only servers included
smolvm forwards only listed ports, and only to servers on the guest's
0.0.0.0. ports-all is now an emulation, reviewed:

- devvm _smolvm-ports, started with the VM and ended with its lifeline,
  holds one ssh master connection to the VM's sshd (its key alone, the
  host key pinned, no agent, no forwarding asked) and relays each host
  connection as an ssh -W channel, so every connection starts on the host.
- assets/smolvm/ports.sh reports the guest's TCP listeners; the host
  parses the report as untrusted (sizes capped, loopback addresses only,
  applied at most every 500 ms).
- Ports from 1024 up, at most 256, bound on 127.0.0.1 and ::1 with
  platform.ListenExclusive: never a port another host program holds, nor
  any VM's ssh, proxy, decider or listed ports (netpolicy.UsedPorts).
- Its log is rate- and size-limited; reads through smolvm exec (host
  key, the sshd probe) are capped at 64 KiB and 30 s.
- sshd's AddressFamily is any, for channels to the guest's ::1.
- vm checks the VM's port features at every start.

Messages: smolvm_ports_no_ssh, smolvm_ports_failed,
smolvm_forwarder_failed. Docs: smolvm.md (every port), backends.md,
security.md, design.md (the design note and threat check), limits.md,
testing.md. e2e: the smolvm section's every-port checks, and its fake
decider reads smolvm's request before closing.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-25 23:32:00 -06:00
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 9f24d2639e refactor: group devvm's files under assets/
assets/ holds the files devvm ships: base.yaml, layers/, features/,
shared-tools/ (mise.toml, build.sh, the tools' policies), guest/ and
oci/. devvm reads them from assets/ beside its binary (paths.Root,
paths.RootOf); releases, the Homebrew formula, the CLI tests and e2e
put them there. Image keys hash them by their names in assets/.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-25 17:08:33 -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 782f67e4ad fix(netpolicy): keep the proxy's password out of every process's arguments
The VM's proxy URL, password included, reached the guest through
limactl edit --set .env and smolvm machine update -e, both visible to
other local users with ps.

- lima: startSets puts a stand-in (devvm-proxy-password) in the .env
  edit; fillPassword then replaces the stand-in URL with the real one in
  the VM's lima.yaml, rewritten atomically mode 600, refusing a URL with
  characters YAML treats specially or a lima.yaml without the stand-in.
- smolvm: the proxy variables are no longer machine env. Start writes
  smolvm/vms/<vm>.proxy (mode 600) with the URL under network policy and
  removes it without; every devvm exec (userArgs, asRoot) names it with
  machine exec --secret-file, so smolvm reads it. create's --secret-file
  is ignored by smolvm for machines made from a pack. Proxy variables
  left in an older machine's env are removed; rm deletes the file;
  updateQuiet is gone (update prints no secrets now).
- stubs: limactl's edit writes --set .env into lima.yaml; smolvm's exec
  fails on an unreadable --secret-file.
- tests: TestStartConfined (both backends), TestFillPassword, network
  and smolvm testscripts check the password is in no stub call and is in
  the file, mode 600.
- e2e: network and smolvm sample ps every 0.1 s during the launch
  (ps_watch) and check the password is in none, nor after, with the
  guest's environment (and on smolvm Docker's daemon) as the control.
- docs: lima.md, smolvm.md, network.md, design.md, contributing.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-25 11:31:40 -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 ad99868604 test(stop): keep the proxy's hostagent alive until devvm stop
The limactl stub's start wrote devvm's own pid as the VM's hostagent, so
a proxy that saw it before devvm returned (devvm still running at the
proxy's first 3 s lifeline check, under load) exited at its next check,
and stop.txtar's kill -0 found it gone. The stub now takes a lasting pid
from $STUB_DIR/hostagent; stop.txtar gives it the test's runner.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-24 23:44:45 -06:00
w3cjandClaude Opus 5.5 37d2fa57e4 feat(install): install.sh for the per-platform release archives
install.sh picks this host's archive (devvm-<version>-<os>-<arch>.tar.gz:
darwin or linux, arm64 or amd64; Apple silicon's under Rosetta, from
sysctl hw.optional.arm64), checks SHA256SUMS's minisign signature (an
empty key still skips it, with a warning; no minisign prints the command
to check by hand), then the archive's checksum, and installs the binary
with its data files in <prefix>/lib/devvm/<version>, linked from
<prefix>/bin/devvm. Older versions go, except one a running process
names in its arguments (a VM's proxy, QEMU's guestfwd on Linux): it's
kept until a later install. Then it offers devvm doctor --fixes' fixes,
asking first (Homebrew's Lima or Lima's checked release tarball, QEMU,
the kvm group), and runs devvm doctor. Downloads are HTTPS only. Its text
isn't messages: it runs before devvm is there.

release.sh --head now needs install.sh too.

Tests: testdata/script/install.txtar sources install.sh (host and archive
names, Rosetta, version choice and validation, HTTPS-only fetch, run_fix
as words, install and links, reinstall, an older version in use kept
(and the real ps), signature good, bad, missing, no minisign, a bad
checksum, no archive for this host, Lima's tarball for the host and
arch and a bad checksum, the PATH hint, the fixes with --yes, the kvm
re-login, no yes, Lima's release once allowed, nothing missing, main's
options, and the tests' devvm binary installed and finding its files);
release_head.txtar: a HEAD without install.sh is refused.

docs: install.md (Homebrew and the install script, upgrading,
uninstalling), maintaining.md (trying install.sh on a --head build),
README.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-24 23:24:22 -06:00
w3cjandClaude Opus 5.5 f42d436350 build(release): release.sh around GoReleaser, bump.sh
scripts/release.sh checks the signed tag (git tag -v) and its signer
against this checkout's packaging/release-signer, then runs goreleaser
release --skip=publish (--snapshot with --head) in a clone of the commit,
so only what's committed goes in. .goreleaser.yaml builds darwin/linux x
arm64/amd64 archives with the binary and its data files, a source
tarball and SHA256SUMS, with -X github.com/w3cj/devvm/internal/cli.version
(VERSION's version, for HEAD too). release.sh checks the host's binary
prints the version, signs SHA256SUMS with minisign and verifies it, fills
in install.sh (release_version, minisign_key) and the Homebrew formula,
which builds from the source tarball with Go (brew audit --strict clean).
--head takes DEVVM_MINISIGN_PUB for a test key, and skips a missing
install.sh; a tag without one is refused.

scripts/bump.sh writes the host mise's pins in internal/tools/mise.go.
VERSION and a fresh CHANGELOG.md. docs: maintaining.md (pins, releasing).
Tests: testdata/script/release.txtar (unsigned tag, no pin, another
signer, the checkout's pin, no install.sh), release_head.txtar (unsigned,
signed and verified, install.sh and formula filled in, only committed
files, wrong key, wrong version, bad install.sh, bad VERSION), bump.txtar
(crane, mise in base.sh and mise.go, hostile and missing values, --check
control characters, unknown tool). The sandbox sets DEVVM_REPO.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-24 23:04:37 -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 22ca41735d test(doctor): QEMU stubs on the PATHs that leave out the stubs folder
On Linux the Lima backend also checks for QEMU's emulator and qemu-img,
so the cases with a reduced PATH got an extra qemu_missing and the exact
stderr after the global-config case didn't match. They now have stub
QEMU programs, so they test only what they name on both hosts.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-24 17:58:33 -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