19 Commits
Author SHA1 Message Date
w3cjandClaude Opus 5.5 b625469ac6 fix(vm): devvm rm asks before opencode's worktrees' uncommitted changes go
An export leaves out opencode's worktree folder, as a git repository's config can name a command that git runs, so the uncommitted changes in the worktrees opencode makes there (~/.local/share/opencode/worktree/<project>/<name>, opencode v2.4.1's worktree/strategies.ts) went with the VM's disk on devvm rm, and on a remake with --clean-home, with nothing to say so.

The registry gets Worktrees (opencode's worktree/*/*, below its HistoryOwn, TestDefsComplete holding each to a plain pattern there). rm's unsaved-work check, cloneCheck, becomes workCheck: the clone (cloneLost, as before) and the agents' worktrees (agentTrees), one question for both. agentTreesState reads them in the running VM in one command, in its home folder, each * of a pattern sent as *, .[!.]* and ..?* (treeGlobs), so a name that starts with a dot is found: each folder with a .git, its git status and a detached HEAD's commit nothing else has; past 100 it says more. devvm reads at most 8 MiB of the answer, cancelling the command past it, and waits at most treesWait (2 minutes). parseAgentTrees takes the answer as untrusted: whole records of a glob asked for, each path clean, matched by its pattern and once, at most 100, each with one status. Dirty, detached, unreadable (wfail) and more are shown and asked about (delete_anyway or remake_anyway), which --force never answers; refused without a terminal (no_terminal_delete_trees, naming --no-worktree-check, or the clone's no_terminal_delete when it has work too). --no-worktree-check skips the check and warns (trees_check_skipped). A failed, late or hostile answer keeps the VM (trees_check_failed), and so does a VM that doesn't start for it (trees_check_not_started).

Rm and rmGone run it, and rmGone refuses a stopped VM with opencode, which starting would make its folder again (rm_gone_stopped_trees, naming --no-export --no-worktree-check); stillGone takes the refusal to give. remaking.checkWork runs it before a remake with --clean-home (remakeTo, Update, SetClone, whose clone check it joins), its messages naming the command as typed (remakeInVM.typed), with --clean-home, which --no-worktree-check needs (needs), so devvm clone off --clean-home's clone check messages name it too. A remake's flag has its own help. The stub guest runs the read in vmhome-<vm>.

Tests that fail without the check: TestRmAgentTrees, TestRmVMAgentTrees, TestRemakeAgentTrees, TestUpdateAgentTrees, TestSetCloneAgentTrees and the rm_agent_trees script; TestAgentTreesBounded (an endless answer cancelled, a silent VM given up on, in a synctest bubble); TestAgentTreesState runs the script under sh on real worktrees, a dot-named one included; TestParseAgentTrees holds the answer's checks, TestCloneGit the stub's. TestSetCloneOff names the command with --clean-home. e2e's network section makes a worktree in opencode's folder in the real VM, and devvm rm refuses, then --no-worktree-check deletes it.

Docs: coding agents' opencode's worktrees, How it works' opencode's worktrees, deleting a VM, a VM whose folder is gone, images, clone, the overview's remake, Commands, extending and rm's help; the changelog's What to do step 4 names --no-worktree-check for scripts and devvm rm VM of a stopped VM, and opencode's block gets the check; the release page has its section.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-25 00:03:05 -07:00
w3cjandClaude Opus 5.5 3e81767482 refactor(cli): each command carries its own docs link, group and samples
A command's metadata moves from hand-kept tables into the command itself:
an about (docs page, help group, why no --json) set as its Cobra
Annotations. msg.commandDocs, commandGroups and withoutJSON are gone;
TestDocLinks reads the links from the generated CLI reference, and help
output and the reference are byte-identical. AGENTS.md's cli and vm rows
point at new doc.go package comments.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-08 10:05:13 -07:00
w3cjandClaude Opus 5.5 b44cbb9b9d fix(cli): a space between the sentences of four commands' help
devvm images rm, layer add, layer rm and secret rm joined two strings of
their Long without a space (--no-input.devvm). TestEveryCommandsHelp
now fails on a sentence's end joined to the next one's start.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-06 06:46:15 -07:00
w3cjandClaude Opus 5.5 8d44175601 refactor: the Go module is github.com/devvmhq/devvm
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-06 06:16:29 -07:00
w3cjandClaude Opus 5.5 2414d64bcc refactor(msg): one wording for questions only a terminal can answer
Refusals and help that need a person now say 'in a terminal without
--no-input', as no_terminal_fetch and no_terminal_delete did: each
message names the command to run, so the condition sits in it rather
than being added by UI.Refused. size_pending is for a stopped VM;
size_pending_running keeps the restart hint for a running one. setup's
size question goes through a Reporter the tests make (msg.Fake).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-05 20:13:35 -07:00
w3cjandClaude Opus 5.5 76f2021b65 docs: network tiers throughout, and the tools that ignore the proxy
Every page that spoke of network policy as on or off now speaks of the
four tiers: confined (internet, allowlist, none) or open. safety/network.md
is titled Network tiers, its company-proxy subsection is "Open VMs and
builds", and a new section lists tools that ignore HTTP(S)_PROXY on the
open tier (Node's fetch without NODE_USE_ENV_PROXY, aiohttp without
trust_env, Go programs with their own transport, Java, the Docker daemon).
internals/lima.md says how each tier reaches its proxy; design.md names
link_tier_mismatch and group_tier_mismatch; the help texts of stop,
network log, layer new, limactl and _proxy drop "network policy".

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-05 17:06:49 -07:00
w3cjandClaude Opus 5.5 ca8a91305b fix(ui): one failure path, and an interrupt's cleanups wait for the command
Commands fail by returning: RunE returns the error, as failed(err, what)
when it may not be a message (replacing fail and the direct Die calls in
cli), and a.env returns its failure. checkLayout returns its error from the
root's PersistentPreRunE. execute alone prints a failure (showFailure): a
backend.LoggedError with the run log's end (ui.ErrorLogged, which replaces
DieLogged), a message as it is, else what failed or output_failed, with a
corrupt file's message as names mode shows it. Exit codes stay 0, 1, 2, 130.

Die is now the UI's own die, for where no command can return: a question
without an answer, a run log that can't be opened. Error prints nothing once
the run is interrupted.

After INT, TERM or HUP, Main waited only for the logged command and then ran
the cleanups while the command's own code still ran. It now also waits for
the command to return, up to returnGrace (2 s), when there are cleanups to
run; a run without cleanups ends at once, so the proxy and the other
background processes still stop as soon as they are told to. A start's
undoStart stays registered once interrupted (interruptCleanup), as the
cleanups now run after the start returned.

Tests: TestSignalsWaitForTheCommandBeforeTheCleanups (failed on the old
ordering), TestSignalsWaitForAStuckCommandAWhile,
TestSignalsWithoutCleanupsEndAtOnce, TestExecuteShowsEachFailure;
DieLogged's tests are ErrorLogged's.

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

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

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

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

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-05 01:21:41 -07:00
w3cjandClaude Opus 5.5 e132a29b5a refactor(cli): one per-run app holds the run's services
NewRoot makes one app for the run's UI and hands it to every command.
The app makes each service the first time a command asks for it and
keeps it, or its error, for the rest of the run: devvm's folders
(dirs), a test build's overrides, the secrets store, the backends'
registry, the shared tools, the VM environment (vmEnv) and the image
builder of the backend new VMs get (builder). The retention that runs
before a command and the command itself share them.

- paths.FromEnv: 23 of 24 calls go through a.dirs; partNames, which the
  parser's flag and word checks call before any command, keeps its own.
- The registry is made once (8 newRegistry calls and newEnv's).
- builder(u) (6 calls) and cli's newBuilder are gone: a.builder and the
  per-backend builders in images, space and gc are vm.Env.Builder,
  exported, the only builder. setup's feature choice takes a build.Env
  of its folders and prompts alone.
- The shared tools are made once (newTools and vm.NewEnv's), and the
  secrets store once (companyProxy's, newTools', vm.NewEnv's and
  _proxy's): vm.NewEnv takes the run's tools and store.
- withEnv (46 calls) is a.env; autoRetain, retainOrphans and gc
  --orphans use the run's VM environment.
- thisHost and readOverrides' other callers read the overrides once
  (a.host); space and gc --caches time out on the registry's host.

TestAppMakesEachServiceOnce checks that one run makes each service once
and that the VM environment and builder share the run's registry and
tools; TestAppKeepsAFailure that a failure is kept.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-05 00:53:51 -07:00
w3cjandClaude Opus 5.5 4b9086e0cc feat(layer): devvm layer rm makes the folder's VM again without some of its layers, keeping its home and settings
devvm layer rm LAYER... [--force|--no-export|--clean-home] is the shared
remake with layers taken out: Lifecycle.RemoveLayers works out the image
(removedImage: the VM's other layers in their order, base when none is
left), says the layers the VM lacks (lacks_layers) and refuses a name
that isn't a layer, then remakeTo. AddLayers and RemoveLayers share
remakeLayers, so neither copies the remake. Its Args refuse base, a
shared tool's name and a name no layer can have (vm.CheckLayerNames), so
one of the user's layers whose script is gone can still be taken out.

devvm tools rm of a layer (custom_layer_remove) names devvm layer rm,
and parts_flags_ignored and pick_vm_help name it beside devvm layer add.

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

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 19:47:49 -07:00
w3cjandClaude Opus 5.5 cab497bc8f feat(layer): devvm layer add makes the folder's VM again with more layers, keeping its home and settings
The one remake in vm's Lifecycle (remake.go): the image built first, the
agents' history exported and the home folder saved (home.go: the VM's tar
stream filtered on the host), the VM stopped and its machine renamed
aside (backend.Backend's Rename, limactl rename, vmname.Aside), the new
machine made from vm.json, started, its home put back, then the old one
deleted. A failure or interrupt before that puts the old VM back; a
killed devvm leaves the remake section, which the next devvm or devvm
layer add finishes. The VM keeps its ID (design.md).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 17:58:21 -07:00
w3cjandClaude Opus 5.5 a134e0d8a6 feat(cli): choose a new VM's toolchains, agents and layers in a picker or with --tools, --agents and --layers
devvm takes no IMAGE word any more than any other: in a terminal a new VM's
toolchains, coding agents and layers are checked in one picker, under three
headings, before the network-policy question; --tools, --agents and
--layers (each an exact list, or none) skip it, and a part left out takes
its default: the detected toolchains, devvm setup's agents, no layers (a
devcontainer.json's features still count). Without a terminal, or with
--no-input, the VM gets the defaults and new_vm_gets says so in one line.
devvm setup --agents (and its first-run question) chooses new VMs' agents.
devvm tools in a terminal opens the same picker for the VM, its layers
fixed, and turns the changes into tools add and rm.

An image is base and layers only: tools are the VM's tool_names state key.
build, rebuild and images rm refuse a shared tool (tool_not_layer), and
devvm build builds no tool images. devvm ls gains a TOOLS column and
--json tools. gc's --tools is --tool-images, so --tools has one meaning.

Gone: image.Reserved, checkWord's image half (devvm WORD is no_command or
no_command_like, did-you-mean over commands, msg.Closest), the lacks path
in internal/vm/existing.go, and the messages vm_lacks_tools,
vm_lacks_layer, layer_is_command, layer_name_command, no_image_for,
no_command_or_image*, tools_not_images, tools_not_images_rm, detected,
vm_is_now (vm_tools_now), secret_with_image (secret_with_claude).
New: ui.Pick takes headed sections with fixed rows, ui.CanPick,
vm.PickPart/PickRow/AgentsChoice/CheckPart (internal/vm/parts.go),
state.KeyToolNames, state.ReadAgents/WriteAgents, paths.Dirs.Agents,
project.DetectFiles. Image keys are unchanged in form: images never held
tools; docker.sh's and nix.sh's comments changed, so those layers rebuild.

Docs: the home page's quick start steps, diagram (sandbox.svg), cards and
FAQ; README; getting started; using (images' What a new VM gets, coding
agents' Running an agent, settings' agents); internals; contributing;
the cli skill; AGENTS.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 00:45:09 -07:00
w3cjandClaude Opus 5.5 0b03f334fb feat(cli): help in groups, with short texts, examples and each command's docs page
devvm --help lists the commands in groups: Your VM, Change your VM,
Images, Disk space and This machine, with help under Cobra's Additional
Commands. A group whose commands don't exist yet, such as Links between
VMs, stays out of the help.

Each command's Long is one to three sentences, and the rules it held are
on the command's docs page. Every visible command has an Example, with
the most common invocations first, each with a comment. Flag
descriptions are shorter. Each help ends with the address of the
command's docs page, and the root's also ends with the issue tracker.

- internal/cli/help.go: commandGroups, addGroups, addDocs (Cobra's usage
  template with Docs and Issues sections), examples
- internal/msg/docs.go: commandDocs, CommandDoc, CommandDocURL,
  IssuesURL; TestDocLinks checks commandDocs (user pages only)
- docgen: each reference page has a Docs section before See also
- docs: commands.md in the help's groups, with new sections on
  restarting and stopping and on deleting a VM; install.md has doctor's
  engine, feature values, Docker and CA notes; Contributing describes a
  command's help
- tests: TestExamples, TestHelpGroupsAndDocs, TestAddGroups,
  TestWithDocs, TestCheckCommandDocs

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-01 04:39:39 -08:00
w3cjandClaude Opus 5.5 f9e14e9b37 feat(cli): usage errors as devvm messages, checked before anything runs, exit code 2
Every argument and flag error is a devvm message naming what the command
expected, followed by usage_help naming that command's own --help, and
exits with 2. Arguments and flag values are checked in Args, before the
root's PersistentPreRun and any VM lookup.

- internal/cli/args.go: noArgs, exactArgs, maxArgs, minArgs (argsN, with
  ValidArgs), argsOf (the arguments in Use), checkCommands (wraps every
  command's Args with checkFlags and marks RunE's errors as ranError),
  checkFlagValue (--cpus, --memory, --disk, --ports, --lifetime,
  --older-than), exclusive (flag groups checked first, then Cobra's own
  required flags and groups), flagError (SetFlagErrorFunc: pflag's
  NotExist, ValueRequired, InvalidValue, InvalidSyntax errors).
- Execute: 0, 1 for a failure (RunE's error: a message, or
  output_failed), 2 for a usage error; usage_error is only the fallback.
- Checked early: ports LIST and add/rm LIST (vm.ParsePortList), network
  allow/deny RULEs, network on/off(/ask with -g), layer new NAME
  (build.CheckLayerName), retention KEY=VALUE (state.CheckRetention),
  setup --features '', secret NAME, completion SHELL, git-protect and
  ssh-agent values.
- ui.UI.Error prints an error without ending the run (UI's method limit
  44).
- Messages: usage_help, arg_missing, args_too_many, args_none,
  arg_not_choice, no_subcommand, flag_unknown, flag_needs_value,
  flag_bad_value, flag_bad_switch, flags_exclusive, output_failed;
  usage_error reworded; doc links to troubleshooting.
- Tests: TestUsageErrorsEveryCommand, TestRanErrorIsAFailure, TestArgsOf,
  TestFlagErrors; txtars check message names; e2e checks a bad port list
  exits 2.
- Docs: troubleshooting (a command refused before it runs, exit codes),
  contributing (command arguments), AGENTS.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-01 02:27:57 -08:00
w3cjandClaude Opus 5.5 91a429108f feat(images): a built-in nix layer with Nix, direnv and nix-direnv, pinned
nix is a layer devvm ships, as docker is: devvm nix, devvm node+nix, devvm
build nix, or added to an existing VM in place. A folder with flake.nix,
shell.nix or devenv.nix at its top level, or a default.nix that makes a
shell (mkShell), gets it after its toolchains, so package.json and flake.nix
give node+nix.

- assets/layers/nix.sh: Nix 2.35.4's release tarball (releases.nixos.org),
  its version and SHA-256 per arch at the top, checked against the
  tarball's .sha256 files and nixos.org/nix/install, fetched with
  devvm-fetch; 2.35.3 fixes GHSA-hf6w-2rg9-v84g (store ownership in the
  scripted installer) and CVE-2026-110450 (store corruption through the
  daemon's repair flag). The tarball's own install --daemon --yes
  --no-channel-add, with experimental-features = nix-command flakes,
  trusted-users = root, sandbox = true and sandbox-fallback = false. The
  installer runs without proxy variables (it writes any it finds into a
  systemd override for nix-daemon, which would put a build's proxy into
  the image) and with NIX_SSL_CERT_FILE at the system's bundle. The layer
  checks the store is root's, adds Nix's default profile to the end of
  sudo's secure_path (/etc/sudoers.d/devvm-nix, checked with visudo), and
  appends Nix's profiles to BASH_ENV's PATH. direnv 2.38.2 (per arch) and
  nix-direnv 3.2.0's direnvrc, pinned the same way; direnv's hook in
  ~/.bashrc.d/direnv.sh, which loads before mise.sh so direnv's prompt hook
  runs after mise's and a dev shell's PATH comes first; a direnv lib file
  puts each project's layout under ~/.cache/direnv/layouts, so nix-direnv
  writes no .direnv into the project folder. Without systemd the script
  refuses in one line.
- assets/layers/nix.policy: cache.nixos.org, channels.nixos.org,
  releases.nixos.org (GitHub is in base.policy).
- assets/guest/sync.sh: nix-daemon gets a systemd drop-in with the VM's
  proxy (http_proxy, https_proxy, no_proxy) under network policy, removed
  when it's off, the daemon restarted when it changed.
- image.NixLayer in Builtins; project.Detect's nix marker (a default.nix is
  read only as a regular file, at most 64 KiB); backend.FeatureNixLayer
  (nix-layer), needed by a VM of an image with the layer and by building
  one: Lima native, smolvm and Docker none, so both refuse in one line
  (backend_lacks); dockerLayers.choice returns every layer feature of the
  image, so docker+nix on Docker needs nix-layer too.
- scripts/bump.sh: nix (the version nixos.org's installer names, the
  sums Nix publishes; it fails when the installer names no tarball, as
  Nix's Rust installer will), direnv, nix-direnv.
- Docs: using/images (built-in layers, detection), using/toolchains (Nix
  projects), safety/network (the layer's hosts; source builds' hosts
  blocked), internals/images (the nix layer), internals/network (the
  daemons' drop-ins), internals/backends (nix-layer), internals/design
  (the nix layer beside Instead of Nix), backends, customizing,
  coding-agents, contributing (the e2e section); the CLI reference;
  AGENTS.md's assets/ and e2e lines.
- Tests: Detect (markers, default.nix with and without a shell, a linked
  one), layer and environment lists, layer new nix reserved, nix-layer in
  ImageSpec and ImageFeatures, caps tests, up_checks.txtar (node+nix
  detected under an agent), docker.txtar (nix refused for a VM and a
  build). e2e nix section: the layer built behind a company proxy leaves
  no proxy settings and no password on its image's disk; a node+nix flake
  VM with network policy: pins, a root-owned store, sandbox without
  fallback, trusted-users root and an untrusted substituter ignored, the
  daemon's drop-in, nix run nixpkgs#hello, sudo nix and nix over ssh, the
  flake's node ahead of the shared node prompt after prompt through
  direnv, no .direnv in the folder, a blocked fixed-output fetch named by
  devvm-why, and the drop-in gone after network off.

Review (security-audit skill, guidance mode, against the review task's
list): the tarball and direnv's files are pinned in devvm's source and
checked before tar or install runs; nothing from the host goes into the
image (no proxy override, e2e greps the disk); the drop-in holds only the
VM's own proxy URL, devvm's value, and goes when policy is off;
trusted-users stays root and an untrusted user's substituters are
ignored (the VM's user has sudo, so that guards an honest VM and the
allowlist is what holds); secure_path gains only the root-owned default
profile, last; /nix is on the VM's own disk and nothing mounts a host's
or another VM's store. Found and fixed in review: Nix's default
sandbox-fallback would build unsandboxed without a word where the kernel
can't sandbox, so it's off. No confirmed findings.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 12:22:02 -07:00
w3cjandClaude Opus 5.5 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 4bbd35a24b refactor(ui): make the UI an instance only cli holds
internal/ui has no package state: ui.UI holds the streams, terminal
flags, run log, status line, cleanup stack and interrupt flag, and its
functions are methods. ui.Main makes the run's UI on devvm's own
streams, owns signals, recovers Die and runs the cleanups; ui.New makes
one on other streams. cmd/devvm passes it to cli.Execute, and every cli
command gets it through its constructor.

Only cmd/devvm and internal/cli import internal/ui (a depguard rule).
Each other package defines the small UI interface it needs, which its
constructor takes, filling fields tests set:
- gitprotect.New, secrets.NewStore, from.NewLookup: a warn func
- ubuntu.New: LoggedCmd, Note
- netpolicy.NewProxy: Note, Warn, Ask, Confirm, StdinIsTerminal; its
  log lines drop control characters themselves (oneLine)
- sshagent.New: Info, Note, Warn, LogWriter
- tools.New: Info, Warn, LogNote, Status, LoggedCmd, AddCleanup
- lima.New, smolvm.New: Info, Warn, LoggedCmd (their Runner's Run),
  WithSteps, AddCleanup, Interrupted; lima LogNote and ubuntu's too
- backends.Registry: lima's and smolvm's
- vm.NewEnv: all of the above, Say, Stdout, Stderr; Env has Stdout,
  LogNote, LogWriter, LoggedCmd, AddCleanup, Interrupted fields
- build.Builder: Terminal and LogNote fields
- sshconfig.New: its caller sets what it prints and asks

ui's tests build their own UI over buffers and run in parallel; other
packages' tests use small fakes; cli's unit tests a UI over buffers.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-25 16:23:51 -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