mirror of
https://github.com/devvmhq/devvm.git
synced 2026-12-01 06:23:17 -10:00
main
22
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
e4b44b5994 |
fix(lima): limactl shell never starts a stopped VM past devvm's checks
In a terminal, limactl shell of a stopped VM asks whether to start it, yes by default (Lima 2.3.0, reproduced under a pty), and that start is Lima's own: no proxy or sandbox-exec profile (no QEMU wrapper on Linux), no pins, and no folderChanged, so the project folder's mount, by path on Linux's 9p, follows a link put at the path or makes a folder that's gone again. devvm opens a shell (Shell) and runs an agent's login (Exec) on the terminal after bringUp, so a guest that powered itself off between the two got that question. This is the start path the self-check's restart was suspected of: that restart goes through startOnce, but limactl shell didn't.
The limactl builder, which every limactl command of devvm's goes through, now gives limactl shell --start=false, which Lima has had since 2.0.0-rc.0 (devvm's oldest is 2.2): a stopped VM's shell or command fails at once ("instance is stopped"), without asking, and devvm's next launch starts it with every check. devvm limactl, which passes its arguments on as given, is unchanged.
TestShellNeverStarts checks Exec's, Shell's and the builder's limactl shell, and fails without the change; the lima package's and the CLI scripts' expected limactl shell calls name the flag, their negative patterns too, so none turns vacuous. Docs: How it works' Lima page's A stopped VM's shell; the changelog's Security hardening gets the line, its summary widened to cover both of its lines, and the release page its section.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
||
|
|
b6954e1e11 |
refactor(vmname): a VM's name is a vmname.VM, parsed where it's read
vmname.VM is the name of every machine devvm runs on a backend: a project VM, an image's machine (devvm-img-<key>), a build VM and a remake's aside. Fields, parameters, results and map keys that held a VM's name as a string now hold a VM, from the backend interface down to the CLI's --json structs, whose output is byte for byte the same. Boundary parsers, the only places a string becomes a VM: - vmname.Parse: a project VM's name (state's vm.json name, export file names, devvm _links's argument, the forwarder's -vm, project.Nth) - vmname.ParseListed: one path element, for what a backend lists - VM.UnmarshalText: JSON (Lima's list, proxy config and events, links' targets in state, link lists); empty stays no VM - vmname.Image(key), VM.Aside(), and typed constants for Lima's build VMs - msg.M.VM: the VM a message's function took, read back vmname's functions on names became methods (Hash, Slug, Short, Aside, AsideHash, ImageKey, IsProject); Lima's image prefix moved to vmname; vmname.Join joins VM lists. Messages' vm and vm_name fields are typed by the generator. Seven messages whose field took something else became what= (backend_lacks, backend_unreviewed, backend_unreviewed_used, starting, deleting, configuring, running_script) and rm_vm_failed's name=: the text is unchanged, the names-mode scripts follow. Review.RequireFor names an image or the tools being built. Typed sites per package (added lines with vmname.VM, non-test): msg 347 (generated), vm 124, lima 48, backendtest 32, vmssh 31, netpolicy 22, backend 16, gitprotect 14, proxy 11, cli 11, project 10, state 8, ports 6, paths 3, sshagent 2, sshconfig 2, tools 2. The structure test's owners rule now fails on a field, parameter or result named for a VM (vm, vms, otherVM, vmName) typed string, []string or map[string]…, and on converting anything but a literal to vmname.VM outside the files it lists; internal/stubtest is free. depguard holds internal/vmname to the standard library, and the proxy may import it. ParseListed and UnmarshalText refuse a name starting with -, which would read as a flag in limactl's argv, and vmname.Image refuses a key that's empty, holds a / or NUL, or makes a project VM's name, so Lima's ImageSize and DeleteImage no longer check it themselves. The check also fails on a *string VM name and an alias of vmname.VM, and says what it doesn't see. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
6fd1d846d6 |
fix(lima): cache a Linux VM's project folder with 9p's none
Linux's 9p client loses data with Lima's default cache=mmap for a writable share: a stat() during an extending write() takes the host's stale size and writeback drops the data, so files reach the host empty or cut to 4096 bytes even after fsync (Claude Code's Edit sets it off); and on devvm's Ubuntu 26.04 guest kernel, a lock after a write makes the next read return zeros, which breaks SQLite in any journal mode and Gradle's daemon. macOS's vz VMs use virtiofs and aren't affected. - New VMs on a Linux host record cache mode none in a new mount section of vm.json, and their project folder is made and started with it, as is the folder devvm clone off mounts. VMs whose state has no mode (0.1.0's, and every VM made before this) keep Lima's mmap untouched, with no limactl edit, and each launch warns (mount_cache_unchosen) until devvm mount-cache none. - devvm mount-cache [none], with --json: none is the only mode devvm sets, so any other value is a usage error (mount_cache_invalid); a stopped VM gets it in its next start's one edit, a running one after the restart devvm offers. macOS refuses (backend_lacks), and so does a Linux VM whose folder isn't a 9p mount (mount_cache_no_choice). No -g or config.toml key: every new VM gets none. - The start that changes the mode mounts the folder again in the guest, as cloud-init rewrites fstab only after systemd has mounted it, through the logged runner with a minute's limit (output pipes closed a second after), then checks it with mountpoint and findmnt, reading 4 KiB at most and only the last line: a folder left unmounted stops the VM and fails the start before its shell (mount_cache_unmounted), and so does a check that gets no answer (mount_cache_unchecked); one still mounted with the old mode is warned of (mount_cache_remount_failed), any mode but none or mmap named unknown. An interrupt meanwhile, on any tier, leaves a cleanup that stops the VM, the one stop then. A launch into a running VM asks the guest, in words, whether its folder is a mount point, and refuses one that isn't (project_unmounted) or whose check fails or gives no answer (project_unchecked). A stored mmap, from a build before none alone, reads as none chosen, and devvm clone off records none for its new mount; any other mode is refused naming vm.json. - backend: FeatureMountCache (native on Linux, none on macOS, built on project-mount), Want.ProjectCache, Instance.ProjectCache, CacheModes. - lima: mount rewrites keep only the sshfs and 9p settings devvm knows where they differ from Lima's defaults, and drop the rest for Lima to fill in, so lima.yaml never freezes a default; same() compares the cache where devvm sets one. Build VMs' writable output folders (tools, --from) get none. - tools: an EROFS tool image that ends before its superblock does, or is shorter than its superblock says, as a build under mmap could leave one, counts as not built, so the next build makes it again; a build's short output is refused. The fakes' tool images are a page (backendtest.ToolImage). - The limactl stub lists QEMU's vmType, fills in 9p cache defaults on Linux, and answers the remount's check. - Docs: backends/lima (the project folder's cache, when it changes, programs that map files for writing, SQLite), using/limits, using/clone, commands, internals/lima, internals/backends, the design note (both mmap bugs, why none alone, the remount, tool images, the e2e findings), the CLI reference and the cli skill. - Tests: TestProjectCache, TestMountRoundTrip, TestStartSetsProjectCacheOnce (the remount's outcomes), TestCutShort, TestBuiltCutShort, TestGuestMountOptions, TestFilledMounts, TestUpCacheMode, TestWarnMountCache, TestCacheAtNextStart, TestSwitchCache, TestSetMountCache, TestCheckStateCache, the mount_cache CLI test, clone_switch and the 0.1.0 fixture on Linux, and e2e's projectMountCache (findmnt, a stat-while-write loop, SQLite's journals, a shared writable mmap refused, the opt-in switch of an unchosen VM, what mmap does reported, macOS unchanged). Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
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]> |
||
|
|
adbaf2612a |
fix(tools): each tool build's steps name the tool and its version
The steps of each shared tool's build named the build VM every tool shares (devvm-tools-build), so a build of several tools printed the same lines over and over. Each step now names its tool: cloning base for node 24.22.2, starting the build VM for node 24.22.2, building node 24.22.2, deleting the build VM for node 24.22.2. Lima's start, configure, script and delete steps take the name from the context (withShown). Messages: building_tool, cloning_for_tools, tools_build_vm; building_tools_in goes. tools.txtar checks all five steps for each tool, in order. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
d94929523d |
feat(vm): a new VM shows a summary, then asks whether to customize it
Before devvm makes a new VM it shows a summary of what the VM gets: each toolchain, coding agent and layer with why (the file that calls for it, devvm setup, config.toml or the flag that gave it), its size, network tier and ports, and the devcontainer.json it's made as. Where the picker shows (CanPick) and something is left to choose, it asks "Customize it? [y/N]": Enter makes the VM as shown; y opens the picker (a part a flag gave greyed out), then the network tier question when no tier is given or saved, then the VM's CPUs and memory (for this VM alone). Without a terminal or with --no-input the summary ends with the flags that choose others. The summary replaces new_vm_gets and devcontainer_using. devvm's first run asks its size and agents first, as before, then shows the summary. A test build's DEVVM_PICK_ON_PIPE shows the picker with a terminal on stdin alone, so testscript's ttyin reaches it (up_customize.txtar). Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
ceda0bf925 |
feat(cli): --network TIER, devvm network TIER and the tier question
The command line names the four network tiers. --network TIER (open,
internet, allowlist or none) chooses a new VM's tier, checked before
anything runs (arg_not_choice). devvm network open|internet|allowlist|none
gives the folder's VM a tier through Net.SetTier, and devvm network -g
takes the tiers and ask. config.toml's and settings.json's network is ask
or a tier (settings.NetworkChoices, checked against netpolicy.TierNames
by a test, since settings can't import netpolicy).
The question on creation is Proxy.Choose(vm): net_about says what each
tier reaches, net_ask asks for one (Answer, AnsweredBy("--network")),
Enter or a refusal gives allowlist, and an answer that isn't a tier is
warned of (net_tier_unknown) and asked again. devvm setup's picker
offers ask and the four tiers (network_default_open, _internet,
_allowlist, _none). On an existing VM, --network is ignored with the
devvm network TIER command that changes it.
devvm network --json: policy is the tier or unenforced, and each policy
file whose denies alone apply (internet and none) has denies_only: true,
as the text output's "(denies only)", so a script can tell a file's
denies from all of its rules without knowing the tier rules.
Messages reworded: net_tier_backend (--network open), net_open_policy
(devvm network allowlist), net_about, net_ask, network_default*,
net_default_failed, network_failed, setting_already's and
widen_parent_vm*'s descriptions. safety/network's "Choosing a tier"
replaces its on/off section; docs, the cli skill, testscripts and e2e
use the new forms, and e2e's internet and none checks go through devvm
network.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
||
|
|
9f619bd2ca |
fix(lima): choose every build VM's ssh port under the claims lock, and clear stale build-port records
Linux build VMs' ssh ports were Lima's own pick, outside the claims lock, so another VM's forwarder could take one before Lima bound it. Lima's start now gets every build VM's port from ports.Allocator.Build on macOS and Linux alike, and sets it with its one edit. - start.go: the l.OS == "darwin" condition goes. - build.go, tools.go: cloneEdits goes; a build VM's start always edits its new ssh port, so the configure step is always counted. - ports.Allocator.Build holds a file lock on run/build-ports/<name> (platform.LockFile) until release, so the kernel lets go of it when devvm ends, killed or not. free, under the claims lock, first deletes (clearStale) the records no process holds that are over 15 minutes old (staleAfter: longer than Lima's 10 minutes of waiting for ssh, which a killed devvm's limactl start may still spend binding it). Tests: TestBuild (a stale record kept while young, then cleared; a held one kept however old), TestStartBuildSSHPort on darwin and linux, TestStartConfined's Linux builds, TestBuildImageLayer, TestBuildTools; TestCloneEdits goes. build.txtar checks the build's port edit and that its record is gone; tools.txtar's steps are one count on both systems; layout.txtar lists run/build-ports on Linux. The limactl stub needed no change: it applies .ssh.localPort on every host, and the contract's scenario already starts builds with a port. Docs: internals/design (reserved ports; the build VM's ssh port lead is now confirmed, fixed), internals/overview, using/space. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
f4388d79ae |
fix(tools): each shared tool image builds in a VM of its own
A tools build ran every tool of a batch in one VM with a shared work folder and output folder, and a tool image's key hashes only its own tool's inputs, so one tool's installer (as root, through sudo) could write into another tool's image: through the work folder, a process left running until the next tool's mkfs.erofs, or by replacing mise or mkfs.erofs. A fresh folder per tool and killing its processes wouldn't stop root, so Share.Build now builds each tool in a throwaway VM and an output folder of its own (buildOne, moveIn), one after another, and only that tool's image and its .glibc are read from that folder. shared-tools/build.sh takes exactly one TOOL VERSION FILE. Measured on Fedora 43 (bare-metal x86_64, Lima with QEMU and KVM), node, pnpm and bun: about 16 s in one VM, about 34 s in three (two runs each, the same), so about 9 s for each extra tool, once per tool version. Tests: TestBuildOneVMEach (node's build writes every tool's file in its folder; each image holds its own tool's), TestBuild's one call per tool, TestUpTools' calls, tools.txtar's VM per tool. Docs: internals/images.md (building tools), internals/design.md's shared tools (a VM for each tool, the cost). Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
628dc11c94 |
feat(state): a layout version for devvm's folders, made_by in its records, the golden listing and doctor's leftovers in vms/
The data and config folders each hold a version file (state.Layout, 1). state.CheckLayout runs before every command but help, completion, version and devvm's hidden commands, under version.lock: the same version goes on, a missing file gets this devvm's, an older one runs the migrations in order (migrations(), empty now), and a newer one in either folder refuses with layout_newer; a file that isn't a version fails with layout_unchecked. made_by, devvm's version, is in vm.json's core fields (set when the VM is made, kept by later changes), image records and tool image records. It's passed from cli's devvmVersion through vm.NewEnv, tools.New and build.Env.Version. testdata/script/layout.txtar makes two network-policy VMs with a forwarded port, a link and a secret, and compares every path under the data and config folders with checked-in listings (macOS and Linux). devvm doctor warns about entries in vms/ that aren't VM folders (vms_stray) and VM folders without vm.json (vm_folder_stateless), changing nothing. Tests: TestMigrations, TestCheckLayout, TestCheckLayoutMigrationFails, TestVMFolderProblems, TestSkipsLayout; made_by checks in TestVMRoundTrip, TestImage, TestToolImage, TestUp, the build and tools tests and scripts; doctor's unit test and script. Docs: internals/overview (the layout version, made_by), using/space, using/settings, using/troubleshooting, internals/images, Contributing (changing the state layout). Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
9f6f62d28a |
refactor(state): vm.json, typed state in package sections, changed under the VM's lock
A VM's state is vms/<hash>/vm.json: core fields (version, id, name, alias, image, chain, from, dir, folder, backend, backend_at, created) and one section per package, each a json.RawMessage its owner decodes into its own type (state.Section, state.SetSection), what was asked for at its top level and what devvm made under "made": net (netpolicy), git (gitprotect), ports (the new internal/ports), agent (sshagent), tools (tools), secrets (secrets), and size, clone, devcontainer, desktop and links (vm, internal/vm/state.go). - state.VM.Update takes vms/<hash>/lock (platform.LockFile), reads the file again, applies a change and writes it once; a failed change, or write, writes nothing. VM.Set and its calls are gone; read-modify-write of lists (links, publish, secrets, tools, size, ports) happens inside Update. VM.Claim also holds run/claims.lock, after the VM's own; VM.Create writes a new VM's whole record once, its alias chosen (sshconfig.ChooseAlias) under the claims lock. Reads take no lock. - created replaces "net unset" as unfinished (VM.Finished). - internal/ports: the ports section (forward, host.ssh/proxy/desktop), ports.Used (was netpolicy.UsedPorts), and one Allocator for ssh, proxy and desktop ports under the claims lock (desktop allocated without one before; run/ports.lock and netpolicy's own ports key are gone). - gitprotect: mode recorded before the backend makes the VM (NewMode; clone for --clone, which ls and git-protect share as gitprotect.Mode); made.git_id (platform.FolderID), one git_dirs list for modules and embedded git dirs, delegations, protected; Unlock takes the union of recorded and current git dirs. - links' entries, git dirs, tools and devcontainer commands are JSON lists, not strings in values; the key=value parser is gone. - vm.checkState reads every section of the folder's VM as it's found. - registry.For drops its unused Dirs. - Tests: TestVMRoundTrip, TestVMOtherName, TestVMID, TestVMUpdate, TestVMUpdateTogether (two writers on one VM and on crossed VMs), TestVMClaim, TestVMFailures, TestVMCorrupt, TestChooseAliasTogether, TestUsed, TestSSH, TestChooseTogether, TestUnlockRecorded, TestCheckState, TestChangesTogether, TestChangesAtOnce; testscript's vm_state, json_set with dotted and := keys; e2e's vm_state/vm_set. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
ffbc139969 |
test(lima): a contract test of the limactl stub against real Lima
TestLimactlStubContract runs scenario on dummy instances twice, through the real limactl and through testdata/stubs/limactl, and after each step compares every instance as devvm reads it from limactl list --json: their order, status, size, mounts, agent forwarding, ssh port and networks, and the edits each kind of start would make (startSets). The stub had drifted from Lima, and now matches it: - create ignored --cpus= and --memory=: every image was 4 CPUs and 8 GiB. - clone started from an empty config: Lima's keeps its source's config, size and lima.yaml (env), then --mount-none, then each --set. - Only --set .portForwards, .ssh.localPort and .env were kept: the mounts, .ssh.forwardAgent, .propagateProxyEnv, .hostResolver and .dns were dropped, so each start edited them again. The stub keeps any --set (and del()) in $STUB_DIR/config-<name>/, on create too. - delete left the VM's size and $LIMA_HOME/<name> (its lima.yaml). - list gave instances in the order they were made: Lima sorts them. devvm relied on the clone drift: a project VM keeps its image's propagateProxyEnv: false (from the build's start), so its first start without network policy edited it, where the CLI tests said it edits nothing. CreateVM now sets .propagateProxyEnv=true at the clone. And rebuild.txtar relied on the list order: it compares the deletes sorted, as Lima lists images by name. On Linux a layer's or the tools build's VM, cloned from a built image, keeps the config its image's build made, so Start edits nothing (no ssh port there) and the build's step count was one too many: cloneEdits counts the configure step only when Start edits (TestCloneEdits). Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
e720d2def5 |
fix(tools): Debian --from bases boot the generic kernel, which has 9p, and the tools build waits for its folder
On an x86_64 Linux host, a --from base made from a Debian image (node:24) booted Debian's cloud kernel, which has no 9p (CONFIG_NET_9P is not set). Lima mounts with nofail, so every mount was an empty folder, and the shared tools' build VM failed at `cd /mnt/devvm-tools/.build`. Not a race and not nesting: it fails every time on that image, on the Debian 13 KVM guest and on bare-metal Fedora alike. - assets/oci/bootify.sh: Debian gets linux-image-$arch on every architecture (the generic kernel, already used on arm64 for gpio_keys), and net.ifnames=0 on its kernel command line: with the generic kernel udev's enp0s4 came up from Lima's MAC match before cloud-init's rename to eth0, which failed as busy and stopped its init stage, leaving no ssh host keys. - assets/shared-tools/build.sh: wait_share waits up to 60 s for .build/mise.lock, mounting the folder again from fstab while it isn't mounted, then fails naming the folder and mount's last error. - tools.txtar: wait_share there at once, mounted late, never mounted. - docs: internals/images.md (the wait), internals/design.md (the cloud kernel's missing 9p, the rename). Both scripts are in image keys: --from bases and every tool image rebuild. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
d8a7d4de7f |
refactor(state): a folder per VM, keyed by its project folder's hash
Every file devvm keeps for a project VM is in one folder, vms/<hash>/, where <hash> is the 14-hex hash of the project folder's path that the VM's name ends with: its state, its own rules (policy), its backend's files (backend/: record.json, key, known_hosts, proxy, ports and the port forwarder's ports.*), what its runs leave (run/: proxy.*, sandbox.sb, started, lifeline.pid, secrets.*, links.*) and its logs (logs/: network.jsonl, proxy.log, links.log). Build VMs keep the same layout in run/builds/<name>/. The top-level run/ holds only what isn't one VM's or must be short: the hashed control sockets, links' link-<hash>.sock/.ctl, the QEMU wrapper and the ports lock. A folder's VM is found by its path's hash (state.ReadHash), with the name and backend its state records, so devvm --backend docker then devvm in the same folder opens the one VM, and a backend's name limit applies to new VMs only. The state records the VM's name and its ssh alias, chosen once at creation (sshconfig.ChooseAlias) and never recomputed. Links' targets match recorded names, aliases and folders (project.Targets). One teardown (vmFolders.teardown) replaces Lifecycle.forget, undoCreate's own list, Leftovers.Forget's, Proxy.Forget and space's leftoverFiles: it stops the proxy and link session, then the pieces outside the folder (clone remote or .git locks, other VMs' links and the group, host keys, the backend's leftovers), removes the folder, and writes the ssh config. Each backend's Delete and Forget remove the VM's backend/ folder (vmssh.Forwards.Forget). A new VM made where an earlier one's folder was left clears it first. devvm space counts an orphan's whole folder as leftover state and the other VMs' logs as network logs. Path builders move into paths: Dirs.VMDir, Dirs.VM and paths.VM's files (secrets' BindingsFile/PolicyFile, netpolicy's run, EventLog, ProxyLog, LinkList, VMPolicyFile, Lima's profileFile, startedFile, forwards.file, vmssh.Forwards.file, links' LinksLog/linksPID, Docker's vmFile and lifeline), ToolLockConfig, ToolLockChecked and ToolsCheckLog; the user's cache folder for Lima's and smolvm's caches is Dirs.UserCache, from HOME, not os.UserCacheDir. Dirs.VMState, LimaVMs, SmolvmVM and DockerVM go. vmname.HashOf and IsHash, project.Hash. The proxy takes the links' sockets' folder (-link-sockets, devvm's run folder) apart from the links' list, which is in the VM's run folder. Tests: a VM made and removed (rm, gc --orphans) leaves nothing under vms/, and with network policy has no file named for it outside its folder (TestTeardownLeavesNothing); a new VM over an old folder starts clean; lookup finds a VM made on another backend with a long folder name and makes no second one (TestLookupOtherBackend, and in docker.txtar); the alias stays put when a second VM shares the folder name (TestChooseAlias, ssh.txtar); every socket fits under a 35-character home with the longest VM name (TestSocketsFit); space counts an orphan's whole folder (TestLeftoverFolders); paths.VM's files; state by hash and name; the proxy refuses a socket in the list's own folder. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
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]> |
||
|
|
ee8146a5e4 |
fix: scripts and tests work without shasum, and two CLI scripts start Lima outside devvm on bash 5.2's sh
Fedora 43 has sha256sum but no shasum (Perl's Digest::SHA), and its /bin/sh is bash 5.3, which runs the last command of an `a && b` -c string in sh's place. - install.sh's check_host stops with "needs sha256sum or shasum" before downloading; its sha256 already used either. install.txtar covers shasum alone, both, sha256sum alone and neither, with made-up sums. - scripts/release.sh and scripts/bump.sh get a sha256 helper (sha256sum, else shasum -a 256) in place of four shasum calls. - gc_orphans, release, release_head and tools scripts hash with sha256sum, else shasum. tools' old fallback never fell back (the pipeline's status was cut's). - ls and existing_agents restart a VM outside devvm with `sh -c '... && limactl start ...; exit $?'`: without the exit, bash's sh exec'd the stub, whose ha.pid then named the test runner (the pid devvm recorded), so the VM still looked confined. - The install page lists sha256sum or shasum among the script's needs. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
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]> |
||
|
|
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]> |
||
|
|
e433e61719 |
feat(gc): gc --orphans forgets VMs their backend no longer has
A VM deleted outside devvm (limactl delete, smolvm machine delete, docker rm) left its state, logs, run files, backend files, ssh config entry and host keys, and gc kept its tools. --orphans finds each VM whose state names a backend that answers (Check and List, 30 s each) and that, asked by Inspect, doesn't have it (vm.Leftovers.Find), lists them with their project folders, asks in a terminal, and deletes what devvm keeps for each as devvm rm does after its delete (Lifecycle's tail, now forget), after asking the backend once more. Backends delete their own leftovers through backend.Forgetter: Lima its port records, sandbox profile and start record; smolvm its record, proxy file, ssh key and forwarder files; Docker its relay, networks, ssh keys, labelled volumes and commit image. Each refuses a VM it has. Never an orphan, each said with a note: a VM whose backend can't be asked or isn't this devvm's (gc_orphans_unknown); one made where this run's backend doesn't look (gc_orphan_elsewhere) - new VMs record backend_at, a hash of backend.LocationOf: Lima's home (DEVVM_LIMA_HOME), smolvm's HOME on macOS, Docker's engine ID and name - and a VM without the record counts only when its backend looks in its default place; one whose state changed in the last hour, as a VM being made has its state before its backend has it (gc_orphan_recent). When a backend a VM uses can't list its images, gc stops before deleting anything, as before. devvm space: the leftover row says gc --orphans; VMs with devvm's label that this devvm has no state for (another devvm's, a sandbox's) are named with their label's data folder (space_stray, backend.StrayFinder), and never deleted. Messages: gc_orphans, gc_orphan, forgot_orphan, gc_orphans_unknown, gc_orphan_elsewhere, gc_orphan_recent, space_stray. Docs: the What devvm keeps page (leftovers, VMs devvm has no state for, how to delete one), using/images.md's Cleaning up, the CLI reference. Review (a backend down, slow or answering garbage; a VM moved between Lima homes; smolvm under another HOME; Docker Desktop vs a Linux engine; a VM being made): down, slow (timeout) or unreadable answers make a backend unknown, never its VMs orphans; moved homes and engines are caught by backend_at; a VM being made is recent; Forget re-asks the backend and each Forgetter refuses a VM it has. Tests: gc_orphans.txtar (a live Lima VM and its files kept, a deleted one forgotten with its logs, run and port files, a Docker one's volume deleted, a smolvm one, another Lima home, no record under a non-default home, a recent state, an unknown backend; no backend delete runs; gc stops when smolvm can't list); tools.txtar (backend_at recorded). Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
bfc925e043 |
feat(space): devvm space shows what devvm keeps and the space it takes
devvm space [--json] lists each kind of thing devvm keeps, on every backend, with its count, size (allocated blocks, as du), whether devvm makes it again (remade, only copy, log, state, leftover), what devvm gc frees of it now and what frees the rest, then a total: VMs and images per backend, shared tool builds per backend and C library, exports, network and run logs, devvm's own mise, the copies of devvm's files, the leftover state of VMs their backend no longer has, and the rest of devvm's state. The backends' own caches come apart and outside the total: Lima's download cache, smolvm's caches on macOS (pack disks, image disks, archives, registry; never its machines' folders) and Docker's labelled volumes that aren't one VM's own. backend.UsageReporter (optional): Lima, smolvm and Docker say what their VMs and caches take. Each backend gets 30 s; one that doesn't answer is named when a VM's state uses it (space_backend_unknown), and its VMs are never counted as leftovers. Each tool build now leaves <image>.target beside it (libc, format), so listings tell a Lima, smolvm and Docker build of a version apart; tools.Listed has Target, from the record or the target it's current for; Share.Delete deletes the record too. Messages: reading_space, space_failed, space_backend_unknown, space_caches_note. Stubs: docker volume ls; smolvm machine ls fails with smolvm-ls-fails. Docs: the What devvm keeps page leads with devvm space; commands table; images' Cleaning up; CLI reference. Review: space runs only listings (limactl list, smolvm machine ls and data-dir, docker info, container ls/inspect --size, system df, volume ls), each bounded by ctx with a timeout; the txtar checks no call creates, deletes, starts, stops or edits. Backend caches aren't in the total. Sizes checked against du on the e2e sandbox data and the user's caches (Lima 9.1G, smolvm pack disks 20G, both match du -sh). APFS clones count for both, as the page says. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
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]> |
||
|
|
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]> |