11 Commits
Author SHA1 Message Date
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 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 d2dc8c74b6 feat(layers): desktop is a built-in layer, not one of base's features
devvm --layers desktop (or desktop under the picker's Layers heading)
gives a VM the Xfce desktop devvm desktop opens; base no longer has it.

- assets/features/desktop.sh moves to assets/layers/desktop.sh, with a
  built-in layer's header, and assets/layers/desktop.policy (no rules: its
  packages come from the distribution's archive, which base's policy has).
- image.DesktopLayer joins image.Builtins (desktop, docker, nix, sorted):
  reserved, listed under Layers, taken by --layers and completion, its
  policy read by netpolicy.Policies.
- build: desktopFeature and chosenFeatures' special case are gone; until
  a choice is made, base gets every feature. devvm setup --features
  desktop is no_feature.
- devvm desktop: desktop_no_feature becomes desktop_no_layer (devvm rm,
  then devvm --layers desktop), linked to the desktop page. The picker's
  row: pick_layer_desktop.
- apt snapshot: base.sh's /etc/apt/apt.conf.d/50devvm-snapshot stays in
  base's image, and only guest/sync.sh (project VMs) removes it, so a
  layer built on base installs from the same snapshot and package lists;
  said in base.sh, desktop.sh and internals/images.md.
- No backend feature: desktop builds and runs like any layer on Lima.

base's image key changes (desktop leaves the features, base.sh's comment
changes), so base rebuilds, now about 400 MB smaller without the desktop
on the --from tier's every-feature base, and for anyone who chose it.

Tests: TestBuiltins; TestOwnFeatures (devvm's features without desktop,
every one until chosen, desktop refused); TestLayersAndCheckLayers,
TestCompleteParts, TestPartFlags and TestUpPicker list desktop under
Layers; TestBuiltinPolicies allows desktop.policy alone without rules;
testscript: desktop.txtar (a base VM refused with desktop_no_layer, its
build without the layer's script; --layers desktop builds the desktop
image), setup.txtar (--features desktop is no_feature), the layer lists
in build, layer, up and up_checks. e2e: the desktop section checks a base
VM has none of the desktop's programs and is refused, then makes its VM
with --layers desktop; from's Alpine VM gets the desktop layer too.

Docs: using/desktop.md, using/images.md (built-in layers, desktop),
using/customizing.md, using/from.md, using/_index.md,
getting-started/commands.md, internals/desktop.md, internals/images.md
(the desktop layer, the snapshot in layers), internals/design.md,
contributing; the CLI reference for devvm desktop.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 14:10:52 -07:00
w3cjandClaude Opus 5.5 34e2e5ef5a feat(cli): devvm WORD naming a toolchain, agent or layer points to its flag
devvm node said "Did you mean devvm code?", which misleads anyone who
means the tool. When the unknown word, or each name in it joined with +
or a comma, is a toolchain, an agent or a layer (devvm's own or the
user's), the usage error is no_command_part, with the flags that choose
them: devvm node+claude -> devvm --tools node --agents claude. Any other
word keeps the did-you-mean over the commands (msg.Closest). The names
come from partNames, which checkPartFlag reads too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 07:06:06 -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 ddbc377f8f test: testscript commands for the scripts' setup, and a coverage baseline per package
script_test.go's sandbox sets DEVVM_MESSAGES=names and DATA, VMS, RUN
and CFG by default, and adds stub_reset, catg (the one file a glob
matches), vm_name VAR NAME (the folder's VM) and project NAME [git];
script_cmds.txtar checks each. Every script is rewritten onto them, its
assertions kept; TestCommandLines leaves the scripts' own commands out.

mise run test runs scripts/test.sh: the tests as before, with the CLI
tests' devvm built with -cover for every package (CLI_GOCOVERDIR),
merged with the Go tests' counters by go tool covdata, then
scripts/coverage.sh holds each package to testdata/coverage/<os>.txt.
mise run coverage raises the baselines; coverage.txtar checks the
comparison. The macOS baseline is recorded from this tree.

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

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

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

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

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-01 02:27:57 -08:00
w3cjandClaude Opus 5.5 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 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