43 Commits
Author SHA1 Message Date
w3cjandClaude Opus 5.5 0b85f5f557 fix(size): a size that isn't a number is refused, never read as 0
Size.Backend dropped strconv's errors, so a VM's size in vm.json that
isn't a number, such as "cpus": "four" after an edit by hand, read as
0, the image's, and the VM started with the image's size without a
word. Backend now reads each part with the check that took it
(settings.CPUCount, settings.GiB, which ParseCPUs and ParseGiB now
use), and returns an error naming the key and value. storedSize turns
a stored one into size_stored_invalid, naming the VM. Every start
(bringUp, before anything runs), a restart's stop (stopToStart, so a
running VM keeps running, as a refused proxy start leaves it), devvm
size and a remake's check refuse with it; devvm size --KEY sets it
again. ParseCPUs and ParseGiB also refuse a number too big for an int
or a float64, which for --disk reached Lima as +Inf.

Lima's originOf read base's disk with ParseFloat and dropped its
error: "NaN", "Inf" and "1e400" passed its check of a size above 0.
Only devvm's own Origin writes that step (gibString of BaseDiskGiB), so
no user, VM or limactl output reaches it; it now reads it with
settings.GiB and fails naming the value.

Every other discarded strconv error outside tests goes too:
- hostgit.Bool reads a boolean as git does (yes, on, whole numbers)
  and says when a value isn't one; GIT_CONFIG_NOSYSTEM, which
  strconv.ParseBool read as false for "yes", uses it, as does the clone's
  copy of a repo's config (gitBool, which had its own copy).
- image.GlibcOlder checks both versions itself and reports ok, so one
  that isn't a version is never read as 0.
- leaktest and state's lock order panic on a goroutine number
  runtime.Stack doesn't print today, rather than reading it as 0.
- cli's test-build overrides fail on a number that isn't one (a test
  build's panic), the stub limactl refuses a size it can't read, and
  opencodeMajor's fallback to 0 is explicit.

Tests: TestSizeBackend, TestStoredSizeInvalid (a stopped VM and a
running one's restart), TestSizeNumbers, new TestParseSizes and
TestOriginOfRefuses cases, TestParseUnknownFormat, TestBool,
TestUserFilesOf's git booleans, TestGlibc's invalid versions; each
fails with its fix reverted.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-16 08:22:47 -07:00
w3cjandClaude Opus 5.5 d55476d3e2 feat(images): the prelude is one line, so build scripts keep their line numbers
Every script a build runs with bash, devvm's own and the user's layers,
now gets the prelude as one line, eval $'…', in place of its #! line, so
bash's errors and $LINENO give the script's own line numbers. A script
without a #! line is one line further down.

- shell.QuoteLine: ANSI-C quoting for bash, on one line of printable
  ASCII; every other byte as \xHH, so a multibyte locale's lead byte
  (Shift-JIS, GBK, GB18030, Big5) can't swallow the backslash escaping a
  quote, and a NUL panics as a caller's bug. image's layer rule allows
  internal/shell, a leaf.
- image.WithPrelude, the one place the prelude and a script are joined
  (OwnScript calls it), used by base.sh, apt.sh, the built-in layers and
  features, the user's layers, shared-tools/build.sh and oci/build.sh.
  Every devvm script has a #! line. A leading UTF-8 BOM goes before the
  #! check.
- A build's exports for a company proxy (lima's proxyExports) and the
  user's CAs (trust's exports) end in "; ", not a newline, so they share
  the first line and move no line either; backend.Trust.Env says so.
- The stub logs a bash -s script's second line, which is the script's
  own second line with or without the prelude.
- Keys: every build script's bytes change, so base, every image and
  every shared tool image are built again once; the CHANGELOG's After
  you upgrade says so with git-lfs, and what VMs say until devvm update,
  and Breaking has its own heading.
- Tests: TestQuoteLine (every byte but NUL, a break-out word, in
  /bin/bash 3.2 and PATH's bash, in C and each of ja_JP.SJIS, zh_CN.GBK,
  zh_CN.GB18030 and zh_TW.Big5 that locale -a has), TestQuoteLineNUL,
  TestWithPrelude's shebang and BOM cases, TestWithPreludeRuns (the real
  prelude's line gives the prelude back; a layer under set -euo pipefail
  gets the names, keeps its function and its line numbers, with and
  without exports before it).
- e2e nix: the layer copy no longer adds the prelude itself.
- Docs: images.md's prelude section, Customizing's layer bullet,
  structure.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-12 17:46:30 -07:00
w3cjandClaude Opus 5.5 6ad4f6cb63 feat(images): your own layers get the scripts' prelude
devvm now puts assets/prelude.sh before a user's layer script, as it does
for its own scripts, so a layer gets $devvm_arch, $devvm_libc and
devvm_sha and can pin a download per architecture (and per C library on
Alpine) the way devvm's scripts do.

- image.WithPrelude puts the prelude before any script; OwnScript calls it.
- build.(*Env).LayerData reads the user's layer and puts the prelude
  before it; a deleted layer is still fs.ErrNotExist (Missing).
- The layer's step holds the prelude, so its key changes on its own:
  every image with a user's layer, and every image above one, is built
  again once. base and built-in-only images, and tool images, keep
  their keys; keyFormat is unchanged. The v0.1.0 fixtures have no user
  layers, so their keys don't move.
- The prelude runs first, so a layer that sets its own devvm_ name keeps
  it.
- layer new's starter mentions devvm_sha and $devvm_arch.
- Tests: TestWithPrelude, TestUserLayerGetsThePrelude (LayerData, the key
  differing from a prelude-less build's, a deleted layer still missing);
  prelude.txtar runs a layer as a build does on gnu and musl, and one
  that overrides devvm_arch and devvm_sha.
- e2e (images): the fixture layer prints $devvm_arch, $devvm_libc and
  devvm_sha of two fake pins, which the check compares with the VM's.
- Docs: Customizing's Mailpit example uses $devvm_arch and devvm_sha;
  images.md's key table, recipe and prelude sections; structure.md;
  CHANGELOG (Breaking).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-12 17:46:30 -07:00
w3cjandClaude Opus 5.5 33ec9eb0dc refactor(tools): one definition per toolchain
Each toolchain is one image.ToolDef in image.SharedTools, which also
holds its guest environment, its PATH folders and its version files. They
leave base's devvm-tools.sh for /etc/devvm/toolchains.sh, which every
launch writes, so base.sh changes and every image rebuilds once. The
structure test's names rule fails on a toolchain's name as a literal
outside internal/image, TestToolchainsComplete checks the toolchains
page, and Contributing gains Adding a toolchain.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-08 10:05:29 -07:00
w3cjandClaude Opus 5.5 9f51e79421 refactor(agents): one definition per coding agent (#29)
Each coding agent gets one definition, an agents.Def in a new stdlib-only
leaf package, internal/agents, and everything else iterates over
agents.Defs: agentlogin's format per login kind, secrets' login kinds,
settings' [pass-keys], image.SharedTools, the vm package's store tables
and scripts, and cli's help lists. The VM copies of every login file,
their bindings, the store's layout, the scripts and the CLI reference
stay the same byte for byte, as golden tests made before the refactor
show.

The agents' guest variables leave base.sh for /etc/devvm/agents.sh,
written at every launch, so every image rebuilds once. Messages are
merged per agent (login_kept, login_passed, login_withheld,
login_oauth_withheld, agent_login_key_only). The structure test's new
names rule fails on an agent's name or login kind as a literal outside
internal/agents, and literals on one holding an agent's folder. Docs
link the supported coding agents rather than listing them, and
Contributing gains Adding a coding agent.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-07 19:16:40 -07:00
w3cjandClaude Opus 5.5 84f1190b04 feat(agents): pi, as a fourth coding agent (#23)
Adds pi (earendil-works/pi) as a shared coding agent beside Claude
Code, Codex and opencode: --agents pi, devvm tools add pi, the new-VM
picker and devvm setup offer it. Its network policy allows pi.dev; base
sets PI_SKIP_VERSION_CHECK=1 and PI_TELEMETRY=0 and installs fd-find,
so base and every image on it build again once. The agent store mounts
and copies pi's settings, with keys redacted as JSON.

pi's auth.json is a new login kind: its API keys for Anthropic, OpenAI
and OpenRouter become per-VM placeholders the proxy fills in (devvm
agent login pi --api-key --provider PROVIDER), and everything else is
withheld by default, unless config.toml's [pass-keys] lists the
provider. pi's own account logins aren't supported, and pi has no musl
build, so a musl VM refuses it (image.ToolDef.GlibcOnly). Its sessions
go into devvm history export and import.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-07 19:16:35 -07:00
CJandClaude Opus 5.5 8d8da01037 feat(tools): dotnet, the .NET SDK, as a shared toolchain (#7)
Adds `dotnet`, the .NET SDK, as a fifth shared toolchain next to node,
python, rust and go. `--tools dotnet`, `devvm tools add dotnet` and the
picker offer it, and a folder with `*.sln`, `*.slnx`, `*.csproj`,
`*.fsproj` or `global.json` at its top level suggests it in the new VM's
summary, the way `package.json` suggests node.

Refs #2. Thanks to @jsskeen-utah for the detailed request.

Co-authored-by: Claude Opus 5.5 <[email protected]>
2026-11-07 10:44:25 -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 d9d169e972 fix(tools): a --from base never builds tool images other VMs mount
gnu tool images, which any VM whose tools need their key mounts, always
build in a clone of devvm's own Ubuntu base on the VM's backend, never in
a --from image, whose code runs as root in its build. --from Debian and
Ubuntu VMs mount those images, and tool_needs_glibc still refuses a base
too old for one. When devvm's own base isn't built yet, devvm says so
(tools_need_own_base) and builds it first, pinning the cloud image on
its first build as usual.

musl tool images build in the VM's own --from base, and their keys hash
that base's digest (image.Tool.Base, tools.Target.Base, from the base's
record), so they're only ever another VM's on the same container image.
Their records keep it (base). devvm tools add, tools update and update
build a musl VM's base first, its digest looked up, so the keys they
work out are those of the base the images build in. Every gnu key hashes
devvm's own base, so no image built in a --from base under an earlier
key is mounted again.

Share.Build reads the record of the base it's about to clone and refuses
any but the one the images are for (buildsFor, tools_wrong_base): base
from Ubuntu's cloud image for gnu, a --from base with the target's
digest for musl.

Tests: TestBuildOnlyInItsBase (hostile --from gnu and musl bases, a
layer, no record), TestUpFromTools, TestToolsAddFrom, TestToolFile's musl
digest, TestToolFileRefuses, TestToolTarget's digest; from.txtar: the
clone of devvm's own base, a base record that says it came from a
container image refused (tools_wrong_base), and tools_need_own_base
before devvm's own base is built; e2e from checks where the Debian and
Alpine VMs' tool images built and the musl records' digest.

Docs: internals/images.md (building tools, keys, the share, listing),
using/from.md, using/images.md, using/space.md, internals/design.md,
internals/security.md, contributing's e2e list, AGENTS.md's tool-key
rule.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-04 22:22:16 -07:00
w3cjandClaude Opus 5.5 40d6f45296 fix: the phase review's findings in --clone, --from's output check and tool builds' CAs
- --clone refuses a symlink anywhere in objects or refs (a pack folder, a
  loose object's folder), not only at their top, which could copy another
  repo's objects into the VM.
- A worktree's seed push sends its upstream only when it is one ref: a
  branch.<name>.merge pattern (refs/heads/*) pushed every branch.
- The rm/clone off fetch passes --refmap=, so a remote the repo names after
  the clone's address can't update branches outside saved/devvm/*.
- Undoing devvm clone off checks .git (gitprotect Check) before its locks
  come off, as leftBehind does: a clone VM's .git is never checked again.
- --from's converted disk must have its first 1024 bytes zero before the
  ext4 superblock, so a qcow2 or VMDK header can't sit in front of one; the
  glibc file is checked a plain file before it is read (a link to a FIFO).
- Tool builds get the CAs' variables from the backend (Trust.Env), as image
  builds' steps do; trust.CAs.Script, the caller-side copy, is gone.
- image.isAgent unexported (used only in image).

Tests: TestOwnRepo (pack folder, loose folder), TestSeedRefs (a pattern
upstream), TestCloneRm (a remote named as the clone URL), TestSetCloneUndo
(git_replaced on undo), TestCheckConverted (qcow2 before a superblock, a
short disk, glibc a link to a FIFO), TestBuildToolsTrust. Docs:
internals/git-protection, using/clone, internals/images, internals/design
(the pin's name). Coverage baselines raised (darwin, linux).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-04 18:01:00 -07:00
w3cj cdac5e5012 refactor(image): typed image names, read once at the CLI boundary 2026-11-04 17:03:07 -07:00
w3cjandClaude Opus 5.5 9348a1e518 refactor(assets): one prelude for the build scripts' architecture, libc and pins
assets/prelude.sh gives each of devvm's scripts that a build runs with
bash $devvm_arch (arm64 or amd64), $devvm_libc (musl where apk is, else
gnu) and devvm_sha TOOL (the script's TOOL_sha256_<arch>_musl on musl
where it pins one, else TOOL_sha256_<arch>). It replaces the arch and sha
helpers in layers/base.sh, layers/nix.sh, features/cli-tools.sh,
shared-tools/build.sh and oci/build.sh, and the Alpine checks in
docker.sh, desktop.sh and fzf.sh. Each script that reads it checks it
came first (: "${devvm_arch:?}").

image.OwnScript reads devvm's own scripts with the prelude before them:
base.sh, apt.sh, built-in layers (LayerData) and features (featureStep),
shared-tools/build.sh (the tools build and ToolFile's key) and the
conversion's oci/build.sh (Lima's convertSteps, written into the
conversion's own temp folder). Users' layers and features get none.
keyHash.own goes, its one caller now hashing OwnScript's bytes.

Image keys change: every image and every shared tool image rebuilds.

Tests: testdata/script/prelude.txtar pins which pin devvm_sha picks from
each script on arm64 (aarch64 and arm64) and amd64, gnu and musl, and
refuses another architecture and a missing pin; oci.txtar sources the
prelude first and checks build.sh stops without it; TestOwnScript,
TestPreludeUsers (only scripts that get the prelude use it, each checks
its variables), key rows for the prelude in build and tool keys, and
recipe expectations with the prelude before devvm's scripts only.
e2e's nix copy as a user layer starts with the prelude.

Docs: internals/images.md (the scripts' prelude, keys), contributing
(owner, agreement test), maintaining, assets/oci/README.md, AGENTS.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-04 15:57:21 -07:00
w3cjandClaude Opus 5.5 1f2e4a0edc feat(tools): refuse a shared tool that needs a newer glibc than its --from base
Each shared tool is its project's prebuilt release, built against a
glibc it needs at least, so a --from gnu base older than that ran the
tool into a loader error. Now devvm measures both sides and refuses the
tool clearly.

- A tool image's build measures the newest GLIBC_ version its ELF
  programs and libraries need (shared-tools/build.sh's glibc_needs:
  readelf's version needs, testdata folders left out), writes it to
  FILE.glibc, and devvm keeps it in the image's record (glibc), taken
  only as a plain file holding one version (tool_bad_output).
- A --from conversion records the image's glibc version (getconf
  GNU_LIBC_VERSION in a chroot; oci/build.sh's glibc output, checked by
  checkConverted), in base's record and every image's on it
  (backend.Built.Glibc, state.Image.Glibc). Ubuntu's own base has none
  and isn't checked; musl needs none.
- tools.Target carries the base's glibc (not hashed: a gnu tool image is
  the same on every base); a VM's state records it (tools.made.glibc);
  Launch.buildTools checks every tool with tools.Share.Runs after
  building, for new VMs and devvm tools add/update and devvm update:
  tool_needs_glibc names the tool, its version and both glibc versions.
- image.ValidGlibc and image.GlibcOlder own the version's shape and
  order. build.Env.ToolTarget reads base's record once (BaseLibc gone).
- Measured minimums, current releases (arm64 / amd64): node 2.28/2.28,
  pnpm 2.18/2.18, bun 2.17/2.17, python 2.17/2.17, uv 2.28/2.17, rust
  2.17/2.17, go none (its 2.34 came from Go's own testdata), claude
  2.17/2.17, opencode 2.17/2.17, codex 2.28/2.28 (its voice helper).
- Tests: TestGlibc, TestBuildGlibc, TestBuildGlibcRefused, TestRuns,
  TestGlibcNeeds (build.sh's function against debug/elf, where readelf
  is), TestToolTargetGlibc, checkConverted's glibc cases; from.txtar: an
  old base refuses node at launch and at devvm tools add, keeps go, and
  records 2.24; e2e: the Debian base's record and VM state hold the VM's
  real glibc, no tool image needs a newer one, and Ubuntu's tool images
  record a glibc; the stubs write FILE.glibc and glibc.
- Docs: using/from.md (Shared tools and glibc), using/toolchains.md
  (Which bases they run on), internals/images.md, assets/oci/README.md.

Every tool image's key changes once (build.sh), so each is built again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-04 15:11:16 -07:00
w3cjandClaude Opus 5.5 cacbd90498 test(tools): the pins test, and tool image keys hash base's mise
base.sh's mise installs every shared tool mise installs, in a build VM
made from base, yet a tool image's key didn't hash its version. Now it
does: image.MiseVersion reads layers/base.sh's mise_version, and
image.ToolFile hashes it for each tool mise installs (not rust, which
rustup installs), so a mise bump builds those tool images again.

- TestMisePins: base.sh's mise version and Linux checksums equal
  internal/tools/mise.go's (with the host pins' shape, which it held).
- TestE2ELockPins: tests/e2e-mise.lock's first line is
  shared-tools/mise.toml's SHA-256, and it locks each of its tools
  with a download for every platform but rust's.
- TestE2EUbuntuPins: e2e_ubuntu_release is one release-YYYYMMDD,
  exported as DEVVM_UBUNTU_RELEASE; bump.sh's e2e-ubuntu lists
  ubuntu.DefaultURL and moves it; every Ubuntu release tests/e2e.sh
  and bump.sh name is ubuntu.Series and ubuntu.Version.
- TestToolFile: base.sh's mise pin changes a mise tool's key, not
  rust's, nor the rest of base.sh; TestMiseVersion its refusals.
- Docs: internals/images.md and contributing/maintaining.md; AGENTS.md's
  key line.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-04 14:51:41 -07:00
w3cjandClaude Opus 5.5 ba073c8656 refactor(tools): read mise's lock as TOML, and key tool images on what it says
The tools lock was read line by line, as mise writes it, and a tool
image's key hashed the tool's entries as written: a mise that wrote the
same lock in another order, or with other spacing or quoting, rebuilt
every tool image. Now tools.Lock is the lock parsed with BurntSushi/toml
(ParseLock), and a tool image's key hashes the entry of the version it
installs in a canonical form: its fields as JSON, keys sorted
(Lock.Entry).

- Lock.Has, Version, Backend, HasDownload and the step back's
  versionEntry read the parsed lock; a step back replaces the tool's
  entries and writes the lock again as TOML (withEntry); the lock mise
  wrote is kept byte for byte otherwise (Bytes).
- A cached lock that isn't TOML is resolved again by Versions.Lock;
  ReadLock, which never resolves, names it as a state.CorruptError with
  its line. Lock.None is the zero Lock: no lock file yet.
- Tests: TestEntryCanonical (reordered, respaced, requoted, commented:
  the same key; a changed checksum: another), TestLockNotTOML,
  TestWithEntry; the lock tests read the parsed lock.
- Docs: internals/images.md says the key hashes what the entry says.

Every tool image's key changes once, so each tool image is built again
on its next use.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-04 14:20:12 -07:00
w3cjandClaude Opus 5.5 74f41b0efb refactor(image): one shared-tool table
image.SharedTools, a table of image.ToolDef (name, kind, members, the
files that call for it, its installer), is the one list of shared
tools. image.Toolchains, image.Agents, GroupTools, IsTool, IsAgent and
SortTools derive from it, and so do project.DetectFiles' toolchain
markers (the nix layer's own files stay in project), the lock's rust
case (image.NoDownload, for a tool rustup installs) and the
devcontainer features devvm maps to a toolchain.

Tests: TestSharedTools (the views, NoDownload, each member once),
TestSharedToolsPolicies (shared-tools' policies are one per shared
tool), and TestConfigTools now checks mise.toml's tools against the
table's members. The contributing page names the table and what adding
a shared tool takes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-04 12:53:40 -07:00
w3cjandClaude Opus 5.5 285386693a refactor(lima): base's origin is recipe steps, which Lima is given and runs
backend.Images's KeyFiles becomes Origin(from): the backend's own steps
that base starts with, first in base's recipe (image.Recipe.Origin),
which base's key hashes like any step. On Lima they are the pinned
Ubuntu image for the host, with --from the conversion's oci/build.sh
(as root, its arguments the digest, the reference, the image's user and
the converted disk's size), bootify.sh and kernel.sh, then base.yaml.

BuildImage runs the origin it's given rather than reading devvm's files
again: limactl create gets the recipe's base.yaml, base's size comes
from it, and the conversion writes and runs the recipe's scripts with
build.sh's arguments. originOf refuses an origin Lima wouldn't make
(another Ubuntu pin, no base.yaml, a conversion that isn't --from's or
names other files). image.Input's Own and image.ConversionScripts are
gone; the conformance suite checks Origin, and the fake answers
OriginSteps.

Base's key changes again, as its origin is hashed as steps: every image
is built again on next use.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-04 06:18:31 -07:00
w3cjandClaude Opus 5.5 21db9467f2 refactor(build): one image recipe, which the key hashes and the backend runs
An image's recipe is the ordered list of steps its build runs, each a
script with its name, arguments and whether it runs as root
(image.Recipe, image.Step). internal/build puts it together once
(recipe.go: inputs, plan, basePlan), image.Input.Key hashes it, and
backend.ImageSpec carries the same recipe to the backend, which runs it
as it is. image.Inputs, which read the files a second time for the key,
is gone, with its fixtures; its tests move to internal/build.

The user's CAs' variables are no longer written into the scripts sent:
backend.Trust.Env holds them and Lima puts them before each step, so what
the backend is given is exactly what the key hashed.

Two new tests check that every byte and argument sent into a build
changes the key: TestKeyHashesWhatABuildSends (build, on the fake) and
TestKeyHashesWhatLimaSends (Lima driven by build, its commands, inputs
and the conversion's files). Written first against the code as it was,
the Lima test found two gaps, fixed here:
- a --from conversion's user (name, uid, home folder) and the converted
  disk's size went into the image but not its key: Lima's KeyFiles holds
  them (madeArgs, with a User seam);
- the conversion was given all of oci/, try.sh and README.md included,
  which base's key doesn't hash: it gets image.ConversionScripts only.

Every image's key changes, as keys hash the recipe's fields: images are
built again on next use.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-04 06:02:19 -07:00
w3cjandClaude Opus 5.5 6128f400e4 refactor(backend): Backend is four role interfaces, and Running replaces StartID, Confined and Lifeline
backend.Backend is Name, Caps and four roles, each required:
- Host: Problems, NameMax, Location, DiskDirs, Floors
- Images: BuildImage, Images, ImageSize, DeleteImage, BuildTools,
  ToolFormat, KeyFiles
- Machines: CreateVM, Start, Running, ProxyURL, Stop, Delete, Rename,
  List, Inspect, Exec, Shell, SSH, ForwardTarget
- Housekeeping: Usage, Strays, DevvmCache, DeleteCache

The optional interfaces Lima implemented (KeyFiles, Storage, Locator,
UsageReporter, StrayFinder, CacheCleaner) are gone into the roles, and
their callers call the methods directly; Forgetter stays the one
optional role, found with backend.As. Running(ctx, vm) returns a
backend.Run (ID, Confined, Lifeline) in place of StartID, Confined and
Lifeline. Space.Check, Space.Warning and LocationOf take a Host.

lima.Lima keeps its fields, Name, Caps and its shared helpers (14
methods), and embeds host, images, machines and housekeeping, each over
the Lima it's part of (withRoles); backendtest.Fake is split the same
way. The guard has every role's methods, its own for the ones it guards.

Structure test: max-methods counts an interface's declared methods too;
Lima and the fake leave largeTypes. Tests: TestRunning, TestGuardRoles,
TestAs (Forgetter), TestFakeRunningAndNone, two TestRulesFail cases.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 19:58:19 -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 f4fd373439 refactor(backend): remove the smolvm backend
Lima is devvm's only backend. The backend architecture stays (Backend,
Caps, Features, Review/Require, the registry, backendtest.Fake), so
another backend is an addition.

State from a smolvm VM reads as an unknown backend (backend_unknown_vm,
gc_orphans_unknown); nothing migrates it. The image keys of
layers/docker.sh, layers/nix.sh and features/desktop.sh change, so images
rebuild once.

Lima's port forwarder moves off smolvm's files first: newForwarderCmd and
forwarderMain from internal/cli/smolvmports.go to limaports.go, and
assets/container/ports.sh to assets/guest/ports.sh (sent by the forwarder
at run time, so no image key changes).

Removed:
- internal/backend/smolvm (4,070 lines with tests), _smolvm-ports, its
  registry entry, registry.Experimental and backend_experimental.
- The decider: backend.Decider/UsesDecider, Confinement.Decider and
  DeciderToken, internal/proxy/decider.go and its test, the proxy's
  -decider, -decider-to and -decider-token-file, netpolicy's
  KeyDeciderPort, KeyDeciderToken and deciderToken, the decider port in
  vm's forwarding and UsedPorts.
- backend.AgentStarter/AgentUnchosen, vm's checkAgentStart and
  agent_unchosen_stop.
- vmssh/key.go (EnsureKey, Public, HostKey, ServicesArgs, Capped).
- paths.Smolvm/SmolvmImage and space's smolvm folders; paths.VM's
  Record, Key, KnownHosts and ProxyURL; project.Detect, which nothing
  called (a test helper now).
- ubuntu.ContainerRepo/ContainerDigest/ContainerRef/ContainerOrigin and
  bump.sh's ubuntu_image, with its part of bump.txtar.
- assets/smolvm/ and assets/container/; the no-init-system branches of
  layers/docker.sh, layers/nix.sh and guest/sync.sh, and the notes in
  features/desktop.sh and guest/ca.sh.
- Messages: smolvm_* (14), vm_no_ssh, vm_no_sshd, ports_no_ssh,
  creating_from_image, packing_image, pack_failed, backend_experimental,
  agent_unchosen_stop; descriptions naming smolvm reworded.
- Tests: smolvm.txtar, the smolvm stub, registry, decider, netpolicy and
  sshagent cases; gc_backend, gc_skipped, gc_orphans and space test a
  failing or hanging Lima listing instead (the limactl stub's list-fails
  and list-hangs); the --backend smolvm examples; e2e's --backend smolvm
  and its section (about 1,130 lines), the smol_* helpers and the
  link section's backend switch.
- Coverage: internal/backend/smolvm's lines in both baselines.
- Docs: backends/smolvm.md, internals/smolvm.md, design.md's smolvm
  notes (Ports on Lima now holds the forwarder's description), the
  backends table's smolvm column, every page naming smolvm, the README,
  the home page's backends art, and AGENTS.md's smolvm rows and gotchas
  (and the Docker bind-mount gotcha, which nothing refers to).

Kept: the docker layer, on Lima; --from's local Docker; --backend, the
BACKEND column and setup's backend choice, which the next commit removes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 11:34:05 -07:00
w3cjandClaude Opus 5.5 1917072228 refactor(backend): remove the Docker backend
devvm is about VMs, and Docker's containers aren't VMs: Lima is the
default backend and smolvm stays experimental. The backend architecture
(Backend, Caps, Require, the registry, backendtest.Fake) stays, so
another backend is an addition.

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

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

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

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 10:26:07 -07:00
w3cjandClaude Opus 5.5 299ddb1476 refactor(state): image records in images/<key>/, rebuild counters per backend and --from, tool image records, cache/
- Image records are images/<key>/record.json (JSON, unknown fields
  ignored; name, chain, from, digest, libc, built). state.Images lists
  the folders; AnyImage needs a record.json; RemoveImage deletes the
  folder. Lima's cache cleaner reads records through state.Images.
- Rebuild counters are images/rebuilds.json, keyed by (backend, from as
  given, name), changed under images/locks/rebuilds. image.Inputs takes
  them through an image.Rebuilds interface. A rebuild on one backend no
  longer outdates the others' images, and two --from references that
  wrote the same counter name (node:24, node-24) stay apart.
  paths.RebuildFile, RebuildName and unsafeName are gone.
- Tool images: <file>.sha256, .target and .idle become one <file>.json
  (sha256, libc, format, backend, built, idle_since; state.ToolImage).
  BACKEND and LIBC read the record; the fallbacks (format matching,
  a VM's target, the current target) go, with toolTargets, vmToolTargets,
  formatBackend and gc's backendTools (toolsOn does it).
  Share.IdleFor owns reading idle_since.
- cache/ (Dirs.Cache) holds mise/, nix-cache/ and from-digests.json.
  With the cache gone, from.Recorded takes the newest base record's
  digest for the reference, so no key changes.
- Key check: the rebuild counter is the one input that moved and changes
  keys (deliberately: per backend and exact from). The --from digest
  moved to cache/ and stays an input, kept stable by the records'
  fallback. Records, mise and the Nix cache are outputs.
- Tests: state's image, rebuild, digest and tool record tests; image key
  cases per backend and exact from; build.TestRebuildIsPerBackend;
  from.TestRecordedWithoutTheCache; cli.TestToolsOn; rebuild.txtar
  (Docker's and smolvm's rebuilds keep Lima's and the other --from's
  bases), gc_caches.txtar and from.txtar (a missing cache/); the
  testscript command json_set; e2e reads the JSON records.
- Docs: space, images, settings (retention), internals images,
  overview, network, security, contributing (json_set).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 07:37:36 -07:00
w3cjandClaude Opus 5.5 4d863bb749 fix(cli): another part's name in --tools, --agents or --layers names the flag that takes it
The picker change's review:

- --tools claude, --layers node, --agents node and the like are refused
  with part_other_flag, which names the flag that takes the name, as in
  devvm --agents claude; a name no part has keeps unknown_part or its
  did-you-mean. checkPartFlag checks the three parts' names together.
  TestCheckFlagValue, up.txtar, up_checks.txtar and setup.txtar cover it.
- image.ToolName is back, with its TestValuePatterns row: ToolFile and
  ParseToolFile check a tool's name with it.
- internals/design.md's Docker layer checks name parts_flags_ignored for
  --layers docker on a VM that exists, as e2e checks, in place of a
  message that's gone.
- The home page and the README give the Claude Code token before
  claude's first start, the home page's list says which rows it shows
  checked, and the FAQ says the agents' config comes from your machine.
  The README says the first run asks for new VMs' size and agents before
  the list.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 06:47:59 -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 2b25a0c7dd fix: the shared foundations' review: one Lima host address, a kill only for its own process, and the Linux baselines
The consolidation pass over the shared foundations:

- Lima's host address on its user-mode network, 192.168.5.2, is one
  constant, limaHost, which the VM's proxy URL and the build proxy's
  both use (proxyHostDarwin and buildProxyHost went).
- platform.LockFileShared had no caller: LockFileSharedWaiting with no
  waiting does its job, and its tests use that. image.ToolName had none
  either, and goes until the tools picker needs it. mise run deadcode
  lists only what AGENTS.md names.
- tools' writeNew, a third whole-file writer, goes: the share's .sha256,
  .target and idle files are written through state.WriteFile.

From the security audit of the phase:

- daemon.Proc.Stop sends SIGKILL only to a process whose arguments still
  say it's this one. A process still ending, whose arguments can't be
  read, is waited for; so is another process given the pid since whose
  arguments can't be read either (a setuid one, on macOS), which would
  have been killed. TestProcStopKillsOnlyItsOwn fails without it.
- forbidigo's signalling rule also bans os.Process's Kill and Signal
  outside daemon and platform; tests signal their own children, and
  devvm desktop's ssh child, not yet waited for, says why with a nolint.
  testdata/lint has a line for each. Contributing's checks table says so,
  and internals/network.md says which process SIGKILL goes to.

testdata/coverage/linux.txt is measured again with mise run coverage on
the x86_64 Linux host: it had no lines for fetch, shell and vmname, so
mise run test failed on Linux, and daemon was set by hand. arm64 (the
Linux host VM) agrees within a point. darwin.txt: daemon 97.8, tools
89.2.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-02 23:52:51 -07:00
w3cjandClaude Opus 5.5 82566e9010 refactor: shell quoting, the VM-name grammar and value patterns each in one place
internal/shell, a stdlib leaf: Quote, QuoteJoin and EnvName. They
replace the 4 shell quoters (lima's shq and shqJoin, docker's shq, vm's
and devcontainer's shellQuote) and the 4 variable-name regexes (docker's
envKey, vmssh's envName, vm's envVarName, devcontainer's envName).
lima's quoting tests move there as TestQuote and FuzzQuote.

internal/vmname, a stdlib leaf below project: Prefix, HashLen, IsVM and
SlugOf. project's vmName regex, IsVM and Prefix go (callers use vmname),
lima's projectVM, docker's hostname parsing and cli's export-name regex
use it. TestImageKey (lima) pinned imageKey before the change;
TestParseExportName covers the export names.

Value patterns exported once: from.IsDigest (lima's idPattern),
image.IsKey (build's keyLike and the keyPattern copies in lima, docker
and smolvm), image.ToolVersion (tools' versionLike) and image.ToolName,
with TestIsDigest and TestValuePatterns. state's featureName stays:
internal/state may not import internal/image.

netpolicy.PolicyFiles names a user layer's policy file only for a part
image.LayerName takes, so an image-name part such as ../x never names a
file outside the user's layers; TestPolicyFiles's ../x cases failed
without the check.

The structure test's owners check gets literals: a non-test string
literal holding '\'' outside internal/shell, or [0-9a-f]{14} outside
internal/vmname, fails, naming the owner. TestRulesFail has cases that
break and keep both. shell and vmname join the leaves' layer, and
devcontainer may import shell. Coverage baselines: shell and vmname
added at 100.0.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-02 16:07:18 -07:00
w3cjandClaude Opus 5.5 1cfc8e24f1 test: share the stubs sandbox, message checks and recorders across Go tests
internal/stubtest puts testdata/stubs first on PATH with a folder of its
own (New, New with only some stubs), reads and writes the stubs' files
(Calls, Reset, Touch, Write, Read, Path, Log) and has one ExecRunner. It
replaces the stub setups of the Lima, Docker and smolvm backends' tests,
vm's --clone tests and platform's Keychain tests, and the backends' own
execRunner, reset and touch copies. The structure test holds it to tests
and to importing only internal/msg.

msg.IDOf and msg.NamesOf replace the names(), isMsg, id and shown helpers
and the errors.AsType checks that only read a message's ID or names;
msg.Recorder replaces the inline recorders tests set as Info, Warn or Say.
backendtest.Stored replaces the four stored fakes with disks.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-02 13:24:43 -07:00
w3cjandClaude Opus 5.5 0674a82d45 fix(image): a tool image's key hashes shared-tools/mise.toml's [settings]
mise's settings (python.compile, experimental) change what a tool build
installs, but the key hashed only the lock entry, build.sh, the libc and
the format, so a changed setting kept the old images. The key now hashes
the [settings] table, read as TOML and written as JSON with its keys
sorted, so comments, the [tools] table (whose holds the lock entry
already reflects) and other ways of writing the same settings leave it
as it is. A missing or unreadable mise.toml is an error.

Tests: TestToolFile (a changed setting, an added setting; a tool's hold,
a comment and the settings written another way keep the key),
TestToolFileRefuses (no mise.toml, one that isn't TOML).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-01 20:51:32 -07:00
w3cjandClaude Opus 5.5 665b9f3b22 feat(group): devvm group, group join NAME and group leave: VMs that reach each other's published ports by name, through links
A group's links are links in each member's state, marked as the group's
(a sixth field, ,group), so the link session, the proxy's list and every
connection check treat them as any link. Membership is each member's own
state (group, group_as), so a VM made again is in none.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-24 02:34:56 -06:00