mirror of
https://github.com/devvmhq/devvm.git
synced 2026-12-01 16:27:33 -10:00
fe32d2a01ce93d11cb3f994d83cdec8df4c01493
109
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
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]> |
||
|
|
f9e14e9b37 |
feat(cli): usage errors as devvm messages, checked before anything runs, exit code 2
Every argument and flag error is a devvm message naming what the command expected, followed by usage_help naming that command's own --help, and exits with 2. Arguments and flag values are checked in Args, before the root's PersistentPreRun and any VM lookup. - internal/cli/args.go: noArgs, exactArgs, maxArgs, minArgs (argsN, with ValidArgs), argsOf (the arguments in Use), checkCommands (wraps every command's Args with checkFlags and marks RunE's errors as ranError), checkFlagValue (--cpus, --memory, --disk, --ports, --lifetime, --older-than), exclusive (flag groups checked first, then Cobra's own required flags and groups), flagError (SetFlagErrorFunc: pflag's NotExist, ValueRequired, InvalidValue, InvalidSyntax errors). - Execute: 0, 1 for a failure (RunE's error: a message, or output_failed), 2 for a usage error; usage_error is only the fallback. - Checked early: ports LIST and add/rm LIST (vm.ParsePortList), network allow/deny RULEs, network on/off(/ask with -g), layer new NAME (build.CheckLayerName), retention KEY=VALUE (state.CheckRetention), setup --features '', secret NAME, completion SHELL, git-protect and ssh-agent values. - ui.UI.Error prints an error without ending the run (UI's method limit 44). - Messages: usage_help, arg_missing, args_too_many, args_none, arg_not_choice, no_subcommand, flag_unknown, flag_needs_value, flag_bad_value, flag_bad_switch, flags_exclusive, output_failed; usage_error reworded; doc links to troubleshooting. - Tests: TestUsageErrorsEveryCommand, TestRanErrorIsAFailure, TestArgsOf, TestFlagErrors; txtars check message names; e2e checks a bad port list exits 2. - Docs: troubleshooting (a command refused before it runs, exit codes), contributing (command arguments), AGENTS.md. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
3b1959efd2 |
feat(network): network policy rules and log under devvm network, and network -g for new VMs
devvm network allow|deny|rm RULE... [-g] and devvm network log [-f] [-n N] [--blocked] replace devvm policy and devvm log. Bare devvm network shows the VM's network policy, then its allowlist file by file. devvm network -g shows or saves whether new VMs get network policy (ask, on or off), through the network file devvm setup also writes; --network-policy and --no-network-policy beat it and skip reading it, a saved off makes a VM without the docker-layer and backend warnings, and with ask and no terminal a new VM gets it. The proxy's block messages, devvm-why's, network log --blocked's ALLOW WITH and the VM's setup note name devvm network allow. New messages: net_default_failed, net_ask_global; -g reports with network_default. Docs, the CLI reference, txtars (network_rules, network_log, network), e2e (bare devvm network's first line) and AGENTS.md follow. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
07ca65c098 |
feat(cli): devvm host, the tools noun and devvm history
devvm ssh is devvm host. devvm tools shows this folder's VM's shared tools (TOOL VERSION NEWER BUILT, from the lock as it is, never online); devvm tools add/rm TOOL... add and take out shared tools, each a word of its own (joined with + refused: tools_joined; add takes only shared tools: unknown_tool), and devvm tools update moves the VM to the newest. devvm IMAGE on a VM that exists adds nothing and asks nothing: it fails with vm_lacks_tools, naming the devvm tools add command, or vm_lacks_layer, as only a new VM gets a layer. devvm export is devvm history export [FILE]; devvm history lists the exports in the exports folder (FILE VM FOLDER DATE SIZE), the folder from a <export>.folder file written beside devvm's own exports and deleted with them. gc --exports is gc --history, retention's exports.age/count are history.age/count, and devvm space's row is history. The in-place layer machinery goes: Launch.addLayers and runLayers, dockerLayers' inPlace/set/unset, backend.DockerLayerVM.SetDockerLayer and the Docker backend's SetDockerLayer, with the add_in_place, restart_for_mounts, no_terminal_confirm, keeping, adding and add_layer_failed messages. vm.Tools (tools.go) holds Add, Remove, Update and List; tools.VMs.Show lists a VM's tools; tools.Remove takes names as a list; VMs.Update compares a VM's files as a set. New messages: vm_lacks_tools, vm_lacks_layer, has_tools, tools_joined, history_failed, tools_failed; renamed: unknown_tool, gc_history, gc_history_export, deleted_history, gc_older_than_needs_history. Command files: host.go, tools.go, history.go, refreshtools.go (_refresh-tools); ssh.go, remove.go, update.go, export.go and gc_exports.go gone. Tests: TestImageLacks, TestToolsAdd, TestShow, TestCompleteToolNames; history.txtar, gc_history.txtar, host_code.txtar and the e2e tools, docker layer and host checks updated. Docs, the CLI reference, AGENTS.md and the e2e header follow. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
18eefddc16 |
feat(cli): devvm retention, bare secret and ssh-agent, ssh-agent rm, and setup's network question
- devvm retention [KEY=VALUE...] shows every retention setting (off when
unset) and changes them; KEY=off turns one off, KEY= is refused and
nothing is written. devvm space only shows.
- devvm secret lists the secrets; devvm secret set claude saves the
Claude Code token. No auth or secret ls commands.
- Bare devvm ssh-agent shows the VM's forwarding, then devvm's own
agent's keys once one is added (it starts no agent without one).
devvm ssh-agent rm KEY_FILE takes a key out of devvm's agent, found by
its recorded fingerprint, and out of ~/.config/devvm/agent-keys; the
key file isn't touched, and a key not added is refused.
- devvm setup's flags are --backend and --features LIST|none ('' is
refused). In a terminal it also asks for new VMs' network policy (ask,
on, off), saved in ~/.config/devvm/network (Dirs.Network), which new
VMs read unless --network-policy or --no-network-policy is given.
Messages: features_empty, network_default, network_default_help,
network_default_ask/on/off, agent_key_not_recorded, agent_unload_failed,
agent_key_removed, retention_settings_failed; retention_unreadable,
agent_devvm_risk, no_claude_token and claude_token_invalid name the new
commands. paths: Dirs.Network (the structure test's Dirs limit is 42).
state: ReadNetwork, WriteNetwork, NetworkChoices, NetworkAsk/On/Off,
RetainOff. sshagent: Agent.Remove. Tests: TestNetwork, TestChooseNetSaved,
TestSetupNetworkStartsFromSaved, TestKeysNone, TestRemove, the real-agent
rm check; retention, setup, secret, ssh_agent and nix_cache scripts; e2e
checks for ssh-agent rm and retention.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
||
|
|
9b2650e089 |
fix(gc): gc --tools and retention keep current tools while a VM is being made
A new VM can pick a tool built long before that no VM has, so the hour alone didn't keep it from plain gc --tools or retention's tools.unused-age between picking it and its state listing it. Both now try the making lock without waiting, after the share's lock, and hold it until they're done. While any VM holds it, plain gc --tools keeps every current tool no VM has, after the same filters, and names them (gc_tools_making), deleting the rest of its list; retention deletes no tool images that run and leaves their idle records, then applies its other settings. A devvm that starts to make a VM while either holds the lock waits, saying so after 200 ms (making_waiting). gc_force_making gives one action. Tests: TestMaking (the wait message), gc_tools.txtar (a hanging up keeps an old tool through plain gc --tools, the kill releases it), retention.txtar (a hanging up keeps the tools, the rest runs). Docs: using/images.md, using/settings.md, internals/images.md, the CLI reference. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
c0b9916ff2 |
feat(gc): gc --tools names the tools it keeps for the hour, and --force deletes them
gc --tools prints gc_tools_recent (count, tools) for the current shared tool images no VM has that it keeps because they were built in the last hour, after the same filters as the ones it deletes (TOOL names, --backend, skipped backends): with gc's list, or in place of nothing_to_clean. Plain gc never prints it. --force, only with --tools (gc_force_needs_tools otherwise), also deletes those and skips gc's prompt; gc still lists what it deletes. Tools a VM's state lists stay, the share's lock is held from before the List, and no other category widens. Retention's Idle keeps the hour. The being-made signal: tools.Making, an flock on making.lock in devvm's data folder (platform.LockFileShared, platform.TryLockFile). up's create (every backend, --clone, devcontainers), devvm update and adding a layer in place hold it shared from before they pick tools until the VM's state lists them; gc --tools --force takes it exclusively without waiting, after the share's lock, and holds it through its deletions, else fails with gc_force_making and deletes nothing. The OS releases it when the process ends, and its descriptor is close-on-exec. Tests: TestLockFileShared, TestLockFileKilled (a killed child releases it), TestMaking, TestNoVM's recent ones, TestGCAsks, gc_tools.txtar. Docs: using/images.md, using/space.md, internals/images.md, the CLI reference. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
6f680a6f8b |
feat(proxy): a shared, read-only Nix cache that only the host fills
VMs with network policy and the nix layer share their downloads from cache.nixos.org: the proxy answers http://devvm.proxy/nix/ itself (a reserved endpoint, never forwarded), and the guest setup puts it before https://cache.nixos.org in Nix's substituters, trusted-public-keys left as Nix's own (cache.nixos.org-1). Each VM keeps its own store and daemon; only downloads are shared, and no VM can change what another gets. The proxy (internal/proxy/nixcache.go, -nix-cache DIR and -nix-cache-max BYTES): - takes only GET and HEAD, no query, nothing escaped, of nix-cache-info, <32 nix32>.narinfo and nar/<52 nix32>.nar with no suffix or .xz, .zst or .bz2 (nixPath, FuzzNixPath); 400 otherwise; - makes up nix-cache-info (priority 30, before cache.nixos.org's 40); - fetches from https://cache.nixos.org alone, when the VM's policy allows cache.nixos.org:443, through the floor or the company proxy, with the system's roots and the user's CAs, following no redirect, sending nothing of the VM's request; - keeps a narinfo when its StorePath is the path asked for, its URL is of the pattern and named by its own NarHash or FileHash, and a Sig by the pinned cache.nixos.org-1 Ed25519 key verifies over 1;StorePath;NarHash;NarSize;References (parseNarinfo, against a real narinfo and NAR of cache.nixos.org's in testdata/nix/); - fetches a NAR only after a narinfo it checked names it, never for a HEAD, once however many ask and at most four at once (fetchOnce), and keeps it when its SHA-256 and size are the narinfo's FileHash and FileSize; a cached copy of another size is dropped; - answers 404 to anything that fails, keeping nothing, so Nix goes to cache.nixos.org itself; logs each request as a nix-cache event (hit, fetched, or why not), which devvm log shows as cache; - writes files whole and renames them in, 600 in folders of 700. The cap: the nix-cache.size retention setting, 10 GiB when off (state.NixCacheDefault, proxy.NixCacheDefault), with state.ParseSize (500M, 20G, 1T). Under a flock on .lock every proxy takes a file's room before writing it (reserve, in whole blocks), deleting the least recently used files (by mtime, which a hit sets) down to nine tenths of the cap; a NAR being fetched is made its full size at once and counts, so a fetch the in-flight files leave no room for is refused. devvm gc trims to the cap, devvm gc --nix-cache empties it, and the daily retention run trims it (proxy.TrimNixCache, NixCacheUsage). devvm space has a Nix cache row (GC: what's over the cap, FREED BY gc --nix-cache, RETAIN nix-cache.size), devvm images says what it takes of its cap. netpolicy passes -nix-cache and -nix-cache-max only for images with the nix layer (nixCacheArgs; a retention file it can't read warns and uses the default). The guest setup writes /etc/nix/devvm-cache.conf through !include in nix.conf only with the nix layer and policy on, removes it otherwise, and restarts nix-daemon when it changes. VMs without network policy get no shared cache: they fetch from cache.nixos.org directly, and nothing new runs or listens on the host for them. Review (security-audit skill, on nixcache.go, its callers and the setup): a NAR could be kept under another NAR's name, as the URL isn't signed (fixed: the URL must be named by the narinfo's own hashes, and a hit of another size is dropped); files being fetched didn't count against the cap and blocks weren't counted, so one VM's parallel requests could pass it (fixed: reserve, full-size temp files, block counts, fetchOnce); a HEAD downloaded a NAR (fixed). Ruled out: stored VM input, paths out of the folder, another upstream, parser differences, cross-VM visibility beyond timing, a VM's own nix.conf. Open, documented: timing tells a VM whether some VM fetched a public path, and a VM can fill the cache to its cap. Messages: gc_nix_cache_over, gc_nix_cache, deleted_nix_cache, images_nix_cache; retention_deleted gains nix_files. Paths: Dirs.NixCache (structure limit for Dirs to 40). Flags: devvm gc --nix-cache; the CLI reference regenerated. Tests: TestNixPath, TestNix32, TestParseNarinfo, TestNixCacheServes, TestNixCacheRefuses, TestNixCachePolicy, TestNixCacheFetches, TestTrimNixCache, TestNixCacheCap, FuzzNixPath, TestParseSize, TestRetention, TestNixCacheArgs, TestFormatEvent; nix_cache.txtar (the proxy's endpoint and refusals, space, images, gc, gc --nix-cache, retention); e2e nix: the VM's substituters and keys, hello through the cache, fetched by the host (600/700), a VM's writes and other requests refused and nothing kept, a second VM's hits fetching nothing, no cache after devvm network off. Docs: the design note (internals/design.md), internals/network.md's The shared Nix cache, the VM's setup, logs and flags, internals/security.md, internals/images.md, safety/network.md's Nix and Logs, using/toolchains.md's Nix projects, using/images.md, using/space.md, using/settings.md's Retention, internal/proxy/README.md. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
415e77c773 |
test: docker's and smolvm's forwarding scripts use free ports and look for their own forwarders
docker.txtar and smolvm.txtar gave the VM's servers fixed host ports (47327-47329), so another run of the same script on this machine (a gate in another worktree) could hold them, and the forwarder refused them as taken. Each script now takes its ports from free_port, writes them into the stub's guest-ports in hex, and expects them throughout. The ps checks of a running forwarder match only this run's, by its key in the run's data folder. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
3c4a77349c |
fix(clone): rm checks every worktree inside a --clone VM's clone
devvm rm on a --clone VM ran git status only in the clone's main checkout, so uncommitted changes in other worktrees in the VM went with it unasked. It lists the clone's worktrees (git worktree list --porcelain -z, at most 1 MiB read) and checks each one's status, showing the changes under each worktree's path, 20 in all. The list comes from the VM, so only clean absolute paths inside the clone are used, each once, and bare or prunable ones are skipped; a worktree whose folder is gone has nothing to lose. Paths go to the VM only as an argument and are shown through msg.Shown. At most 100 worktrees are checked; past that devvm says so and asks anyway. - internal/vm/clone.go: cloneChanges, cloneWorktrees, insideClone, showChanges, cloneExec, worktreeStatus, cloneWorktreesMax - messages: clone_worktree_dirty, clone_worktrees_unchecked (linked to using/clone#deleting-the-vm) - tests: TestCloneWorktrees, TestCloneRmWorktrees, TestCloneRmTooManyWorktrees; clone.txtar's dirty worktree; the limactl stub's git worktree list and worktree status; e2e clone's dirty-worktree check - docs: using/clone.md's Deleting the VM and a new section, Several agents in one VM; internals/overview.md Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
36f4d0ab21 |
feat(gc): a backend that can't list its images is skipped with a warning
When a backend that a VM's state names can't list its images, gc warns (gc_backend_skipped, linked to Cleaning up) with its Check's error, else its listing's, and leaves everything of that backend's alone: its images (not listed), its unused and current shared tool images and those whose backend devvm can't tell, its orphans (moved to the backends that couldn't be asked, so gc_orphans_unknown names it) and, with --caches, its cache. gc goes on with the other backends and succeeds. devvm images still fails, as it lists every backend's or none. listImages returns an imageListing (images, tools, unlisted backends); images uses its failUnlisted, gc's planGC its skip, withoutSkipped and the skipped set gcRun hands to gcCaches. Tests: TestWithoutSkipped; gc_skipped.txtar (Lima's stale image and tool deleted, smolvm's and an unknown backend's tool kept, the smolvm VM's state kept, gc succeeds, devvm images fails); gc_orphans.txtar's end. Docs: using/images.md's Cleaning up, using/space.md's leftovers, gc's help and the CLI reference. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
c3173b1544 |
feat(gc): gc --orphans names each Docker volume, network and image it deletes
A gone Docker VM's home volume holds its home folder, and gc --orphans deletes it without an export, so the listing before gc asks names it. backend.LeftoverLister is a Forgetter that names the resources of its own Forget deletes (backend.Leftover, by LeftoverKind); Docker's Leftovers lists the VM's relay container, its networks (<vm>-net, <vm>-docker-net), its volumes (home, clone, docker, containerd), each only if the engine has it as devvm's, and the image its record says its last change was committed to. Someone else's by one of those names fails it, as it does Forget, so gc stops before it deletes anything. vm.Leftovers.Find fills each Orphan's Leaves, and gc prints one line per resource under its VM: gc_orphan_container, gc_orphan_network, gc_orphan_volume and gc_orphan_image. Docker's largeTypes maximum is 87 for the new method. Tests: docker's TestLeftovers; gc_orphans.txtar's Docker orphan has a network and a commit too, listed by name and deleted. Docs: using/space.md's leftovers. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
452e7bf80a |
fix(state): devvm's data and settings folders are the user's alone on every run
Before every command, the root command's PersistentPreRun runs state.MakePrivate: it makes the data folder ($XDG_DATA_HOME/devvm) and the settings folder ($XDG_CONFIG_HOME/devvm) when they're missing and sets both to mode 700, whatever mode they had, so a wider mode on anything beneath them opens nothing to others. When it can't, devvm warns (folders_not_private, linked to what devvm keeps) and goes on; without an absolute HOME there are no folders, and the command says so itself. The per-folder 700s (exports, logs, run logs, run, CA, secrets) stay as they are. Tests: state's TestMakePrivate (made, made private from 777, a folder inside keeps its mode, one that can't be made fails) and folders_private.txtar (modes after a run, the warning's fields). Docs: using/space.md's data folder, using/settings.md's state and internals/overview.md's state section. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
7cd15a0862 |
feat(retention): retention settings for what devvm keeps, all off by default
~/.config/devvm/retention holds key=value lines, written by devvm space set KEY=VALUE... (KEY= turns one off; a bad key or value is refused before the file is written; all off removes the file). Every setting is off unless set: - logs.runs: run logs kept (20 when off; ui.KeepRunLogs). - exports.age, exports.count: exports that old deleted, then all but the newest count. - tools.unused-age: current shared tool images no VM's state lists, counted from when retention first found them so (an <image>.idle record in the share, dropped when a VM lists it again). - orphans.age: what devvm keeps for VMs their backend no longer has (vm.Leftovers, as gc --orphans), once their state hasn't changed for that long. Ages as state.ParseAge (30d, 2w, 12h). Not the backends' caches (gc --caches only), and never a VM, an image, or a tool any VM's state lists. devvm's commands apply the settings at their start at most once a day (data/retention.run; again at once after a clock that went back), under a lock so two devvms never apply them at once (a dead one's lock is taken over after 10 minutes), skipping the tools while a build holds the share's lock; it says what it deleted in one line on stderr (retention_deleted). orphans.age needs the backends asked, so only devvm gc --retention applies it; gc --retention applies all of them at once. space, gc, completion and devvm's internal commands don't apply them on their own. A bad line names the file and the line, and then none applies (retention_unreadable). devvm space shows each setting beside its row (RETAIN), with what it would free now. Not done here: logs.network.size and logs.network.files, which override the proxy's log rotation defaults: rotation is another task's (the proxy rotates its logs), not on this branch; space set refuses them until it is. Messages: retention_deleted, retention_off, retention_busy, retention_unreadable, retention_failed, retention_bad, retention_saved. Docs: using/settings.md (the file, each setting, all off), the What devvm keeps page (what each setting does, RETAIN), using/images.md's Cleaning up, the CLI reference. Review (deletes only what it's told to): no file or an empty one deletes nothing (txtar, unit); a VM, an image and a tool any VM's state lists are never retention's (Idle builds on NoVM: a stopped VM's and a leftover state's tools stay until orphans.age deletes that state); two runs at once (lockRetention); a clock that jumps (retainDue, Idle and the age checks skip a negative age); the one-line report on every deletion. Tests: TestRetention (parser, set, off, bad lines), TestIdle, TestExportsToRetire, TestRetainDueAndLock; retention.txtar (refusals, space set and RETAIN, the automatic run once a day and again after a day, gc --retention with tools, a VM's tool kept). Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
5bfb89c371 |
feat(gc): gc --caches frees devvm's share of the backends' own caches
Lima's download cache (9.1G on the user's machine) and smolvm's caches (22G) are filled by devvm's builds but are the backends' own and hold the user's own downloads too. devvm never prunes them on its own and never runs limactl prune, smolvm pack prune or smolvm machine prune (each reaches the user's own entries). gc --caches, only in a terminal (gc_caches_need_terminal otherwise, before anything is deleted), then lists devvm's share of each backend's cache with sizes and asks for each backend apart (backend.CacheCleaner): - Lima: entries of download/by-url-sha256 whose url hashes to the folder's name and is Ubuntu's cloud image at the address devvm downloads base from, for its release, a dated release, that no image record names, unchanged for an hour (a build may be downloading). Lima copies a VM's disk out of the cache, so no VM needs an entry. - smolvm (macOS): the disks smolvm unpacks of each pack (vms/_pack-storage-seeds/v2-<sha256 of the .smolmachine>-auto, found on the user's machine: 20G of the 22G), tied to devvm's packs by their SHA-256 - packs devvm has, and every pack it makes from now on, which smolvm/packs records - that no machine of devvm's was made from, unchanged for an hour, with their lock files. Disks of packs that are gone and unrecorded can't be tied to devvm and stay; so do the machines' folders and smolvm's other caches. On Linux smolvm's state is devvm's own folder: nothing listed. - Docker: volumes with devvm's label that no VM has, not the tools' volume, not one of a VM devvm has state for (a VM being made makes its volumes before its container). Never an unlabelled one, never a prune. Each delete checks the entry again first. With --backend, only that backend's cache. Messages: gc_caches_need_terminal, gc_cache, gc_cache_entry, gc_cache_confirm, deleted_cache. Docs: the What devvm keeps page (the backends' caches, Lima, smolvm, Docker), backends/smolvm.md's Cleaning smolvm's caches, backends/lima.md, the uninstall steps, using/images.md's Cleaning up, the CLI reference. Review (touches nothing of the user's): limactl prune empties the whole cache and isn't used; --keep-referred would see only devvm's Lima home. smolvm pack prune removes any unused cached extraction, the user's own packs' included, and machine prune works on a named machine's images; neither is used. Lima entries are tied by address and hash, smolvm disks by the SHA-256 of devvm's own packs, Docker volumes by devvm's label. Tests: lima TestDevvmCache (your download, a recorded release, one being written, a wrong layout, another file kept); smolvm TestDevvmCache (a VM's pack, someone else's, a recent disk, a machine's folder kept; a recorded deleted pack's disk freed; Linux lists none), TestPackRecorded; docker TestDevvmCacheVolumes (a VM's, the tools', one being made, someone else's kept); gc_caches.txtar (refused without a terminal before anything is deleted; the default run leaves the caches). 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]> |
||
|
|
bf03f26221 |
feat(gc): gc --exports [--older-than AGE] deletes saved exports
Exports (exports/<vm>-<date>-<time>.tar.gz, from devvm export and devvm rm) were never deleted, and each can be the only copy of a deleted VM's agent history. --exports deletes them, never as part of gc's default run; --older-than AGE (state.ParseAge: a whole number of days, weeks or hours, 30d, 2w, 12h, which retention will read too) keeps those newer, by the date in their name. Only plain files named as devvm names them: an export being written (.devvm-export-…), a folder or a file of the user's in the folder stays. The list names each export's VM and date (gc_exports, gc_export); it asks in a terminal, goes ahead without one, never deletes a VM. --older-than without --exports, or an age devvm doesn't take, is refused. devvm space's exports row says gc --exports frees them, and counts the exports as gc does. Messages: gc_exports, gc_export, deleted_exports, gc_older_than_needs_exports, gc_bad_age. Docs: coding-agents' History, using/images.md's Cleaning up, the What devvm keeps page, the CLI reference. Tests: TestParseAge; TestExports (names, order, the age boundary); gc_exports.txtar (the default run keeps them, the flags refused, 30d deletes the old one only, then every one, nothing else in the folder). Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
e9aba7360d |
feat(gc): gc --tools [TOOL...] deletes current tool builds no VM has
gc keeps every current tool build, so a toolchain tried once stayed until a newer version came out. --tools also deletes the current builds that no VM's state lists (Share.NoVM), on every backend format and C library; with tool names (the names images use, so node takes pnpm and bun too) only those. A build whose hash was written in the last hour stays: a launch builds its tools before it records them in the VM's state. A tool any state lists stays, a stopped VM's and a leftover state's included. With --backend, only that backend's builds. Names without --tools, or a name that isn't a shared tool's, are refused. Like gc: it lists them first (gc_tools_no_vm, naming each), asks in a terminal, goes ahead without one, never deletes a VM. A VM that names a deleted tool builds it again. devvm space's tool rows say gc --tools frees the rest. Messages: gc_tools_no_vm, deleted_tools_no_vm, gc_names_need_tools, gc_unknown_tool. Docs: using/images.md's Cleaning up, internals/images.md's listing and cleaning up, the What devvm keeps page, the CLI reference. Tests: TestNoVM (a VM's, not current, missing hash, built just now, names); gc_tools.txtar (a leftover state's claude kept, a just-built codex kept, node's three deleted, names refused without --tools, an unknown name refused, node built again after). Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
0900ba5372 |
feat(gc): gc --backend NAME acts on one backend alone
gc reuses the root --backend flag: with it, gc deletes that backend's images, the current ones too, and its unused tool images (the backend from the build's .target record; one devvm can't tell is never one), and leaves every other backend and devvm's own files (old copies of its files, old mise) alone. Without it gc acts on every backend as before: g.backend stays empty unless passed, so the default backend file never narrows a plain gc. An image a smolvm or Docker VM was made from, or on Linux hosts a Lima image whose disk VMs use, is refused by its backend and stays (image_in_use, a warning). An unknown name is refused. devvm space's images rows say gc --backend NAME frees the rest. Docs: using/images.md's Cleaning up; Cleaning up sections on the Lima and Docker pages, and smolvm's Cleaning smolvm's caches; the What devvm keeps page; gc's help and CLI reference. Tests: gc_backend.txtar: images on Lima, smolvm and Docker; a plain gc with the default backend file set to smolvm still deletes Lima's stale image and every unused tool; --backend smolvm deletes only its base and its plain- tool image; --backend docker only Docker's base; Lima's base stays; an unknown backend is refused. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
25930d2252 |
feat(gc): gc deletes older versions of devvm's own mise
devvm's mise (mise/<version>) is pinned per devvm release, and an upgrade left the older folder (121M on the user's machine). gc's default run deletes every folder but this devvm's version (Versions.StaleMise), except one that changed in the last hour, which another devvm may be downloading into. mise's data, cache, state and config are temporary folders per run (miseCmd), so there's no cache to keep or free. devvm space's mise row shows what gc frees. Checked first what's kept: mise/<version> holds only the binary; bin/ (devvm-proxy, its key and hash) is written by nothing in this devvm (the proxy is devvm _proxy, devvm's own binary, which install.sh prunes in ~/.local/lib/devvm), so gc leaves bin/ alone; Docker's Linux build is one file, replaced in place. gc is now a plan (gather, show, ask, run) that the gc options extend. Messages: gc_mise, deleted_mise. Docs: using/images.md's Cleaning up (four things), the What devvm keeps page, internals/images.md, the CLI reference. Tests: TestStaleMise (this version, a recent folder and a file kept); gc.txtar (an old and a recent mise folder). Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
60d59c46f3 |
feat(images): the tool table shows each build's backend and C library
devvm images's tool table has BACKEND and LIBC columns, so a Lima and a smolvm build of one version no longer look alike: from the target record each build leaves beside it (its format matched to the backend that has it, or one of the same kind), else the target it's current for, else a VM's state that lists it, else -. The output ends with the disk the images and tools take in all, pointing at devvm space (images_total). Docs: using/images.md's tool table and the line after the tables; internals/images.md's listing section (the .target record and how BACKEND is found); the CLI reference. Tests: TestWriteImagesTools (rows, - for what a row lacks); images.txtar (the columns from a record and from a VM's state, the total); gc.txtar. 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]> |
||
|
|
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]> |
||
|
|
e2e3c70d81 |
feat(desktop): a desktop feature and devvm desktop, over VNC, on every backend
The desktop feature (assets/features/desktop.sh, not chosen until you choose it, about 370 MB) installs Xfce and TigerVNC's Xvnc from base's package snapshot, and devvm-desktop, which starts Xvnc on display :1 on a socket of the VM user's own (/run/devvm-desktop/vnc.sock, 0600 in a 0700 folder), with no TCP port (-rfbport -1, -nolisten tcp) and no password of its own, the clipboard on or off as asked (vncconfig on a running one), then an Xfce session in a D-Bus session of its own. Nothing starts it at boot: devvm desktop does, on every backend. devvm desktop gets the VM ready as devvm ssh does, refuses a VM without the feature (desktop_no_feature), starts its desktop (desktop_start_failed), and serves it on 127.0.0.1 alone until Ctrl+C or the VM stops (desktop_vm_stopped), on the VM's own port (desktop_port, among netpolicy.UsedPorts, so no forwarder or new VM takes it), showing the address and password (desktop_ready) and opening vnc://127.0.0.1:PORT in Screen Sharing on macOS (--no-open; desktop_open_failed). --clipboard shares the clipboard both ways for that run. internal/desktop's Relay is the guarantee, not the VM's server: it speaks RFB 3.3/3.7/3.8 as a server, offers VNC authentication alone, checks the answer against the VM's password (8 characters of 31, about 40 bits, crypto/rand, kept in the VM's state as desktop_password, never sent to the VM) one check at a time with a second's wait after a wrong one, and only then opens an ssh -W channel to the VM's socket through devvm's ssh config (pinned host key, no session, agent or forwarding), closed by its input first so the VM's sshd ends its side. Without --clipboard it drops every ClientCutText (extended ones too) and ends a connection on a message type it can't size. At most 8 connections. Also: vm.Desktop (Open, serve, listener, dial), vm.ready (devvm ssh's launch without the Include prompt), Env.OpenURL; build's chosen features leave desktop out until it's chosen; messages desktop_failed, desktop_no_feature, desktop_start_failed, desktop_ready, desktop_open_failed, desktop_vm_stopped, with doc links. Tests: internal/desktop (passwords, Response, wrong passwords refused with no dial, 3.3/3.7/3.8, not a viewer, the clipboard dropped or carried, an unknown message ending the connection, a VM server asking for a password), internal/vm (the password kept and remade, the listener's port kept and replaced, ssh's arguments), internal/build (desktop off until chosen), testdata/script/desktop.txtar (no VM, no feature, a stopped VM started, the forward asked for with the clipboard off and on, the same port and password, Screen Sharing opened or failing, the VM stopping, the start failing), setup.txtar, docgen; tests/e2e.sh's desktop section (Lima, with network policy) and checks in the smolvm and Docker sections; TestE2EDesktop. Docs: using/desktop.md (new), customizing.md's features, commands.md, internals/desktop.md (new), design.md's note on the desktop, contributing/testing.md's manual Screen Sharing check, the CLI reference. Review (security-audit skill, guidance mode, local IPC and loopback listener classes), against the review's list: - another local user or process reaching the port: 127.0.0.1 alone, without address reuse; VNC authentication checked on the host before any ssh, constant-time, about 1 guess a second globally (thousands of years); the password in the VM's state (0600 file, 0700 folder), shown only on stdout with the address, never in open's arguments or the run log (e2e: no run log, no host process's arguments); - never in an image or the VM: the VM's server has no password; e2e greps the VM's files for it (found the first time only in the VM's journal, from the check's own sudo command line, now fed on its input); - the server on no address but loopback on each backend, even if root changes it: Xvnc has no TCP listener (e2e on each backend), the relay is the only way in and lives on the host; root's own server without a password (e2e, Lima) still gets no viewer without devvm's password; - clipboard off really off: the relay drops the viewer's clipboard whatever the server accepts (e2e: root's server records a key event but never the clipboard); the VM's clipboard to the viewer can't be filtered without decoding screen updates, documented, Screen Sharing's setting; - nothing from the VM toward the host: a local ssh -W channel, which ssh's client asks for; the VM reaches neither the relay's port nor anything new (e2e: with network policy, no direct connection out, nor to the port); a VM that reaches host loopback (no policy, Docker Desktop) meets the password like anyone; - network policy unchanged: no policy file or allowlist changes; the self-check passes with the desktop running (e2e). Left as documented residuals: the VM's clipboard sent by a changed server; a local process or VM keeping the relay's 8 slots busy or failing checks (availability only). Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
37d843c285 |
fix(test): the CLI tests fake the host's CPUs, memory and free space
The CLI tests read the real host's CPUs, memory and free disk, so they failed on GitHub's small ubuntu-latest runner (2 vCPUs, 7 GiB, ~10.8 GiB free) and passed on larger machines. internal/platform: Host (CPUs, Memory, FreeSpace) is the only way to read them; the raw reads are unexported (memory, freeSpace). NewHost(test, getenv) gives a test build's Host, which reads DEVVM_TEST_CPUS, DEVVM_TEST_MEMORY_GIB and DEVVM_TEST_FREE_GIB (platform.TestCPUs, TestMemoryGiB, TestFreeGiB) in place of the host's; an unset one leaves the host's, a bad GiB value is an error. The zero Host reads the host. The gate is registry.unreviewed, the same -ldflags -X variable as DEVVM_UNREVIEWED: registry.Host() and newFor pass build == "allowed" into NewHost, so platform has no package var. backend.Registry gets a Host field; lima.New, smolvm.New and tools.New take a platform.Host; vm.ThisHost takes one; vm.NewEnv, doctor, setup, build and _refresh-tools read the registry's (or registry.Host()). Docker reads only its engine's NCPU and MemTotal and checks no host free space, so it has no host reads to route. forbidigo bans runtime.NumCPU, unix/syscall Statfs, Fstatfs, Sysinfo and unix.SysctlUint64 outside internal/platform. script_test.go sets a large host in every script (8 CPUs, 16 GiB, 500 GiB free). small_host.txtar sets 2 CPUs, 7 GiB and 1 GiB free and checks doctor's disk_low_warning, host_memory_low and host_cpus_few, disk_low on a build, base_fitted with Lima's --cpus=2 --memory=3.5 and smolvm's --cpus 2 --mem 3584, too_many_cpus have=2 and too_much_memory have=7 max=5. The host-relative regexes in build, from, setup, size, up_size and smolvm are now the fake host's exact values. Docs: contributing/testing.md's "A host of any size" (the overrides, that only test builds read them, the large host script_test.go sets, how a script asks for a small one, what stays the Linux CI job's), and the sandbox table in contributing/_index.md. Review: GoReleaser's ldflags (both builds) and the Homebrew formula set only cli.version, linuxURL and linuxSHA256, never registry.unreviewed, so release binaries ignore the overrides (TestReleaseHostIgnoresOverrides; a release build checked by hand ignored DEVVM_TEST_CPUS=1, DEVVM_TEST_MEMORY_GIB=1 and DEVVM_TEST_FREE_GIB=0.5 in doctor and size while the test build honoured them). No caller outside internal/platform reads runtime.NumCPU, memory or statfs (grep, and the forbidigo rule checked against a probe file). Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
f196357f43 |
feat(netpolicy): the proxy rotates a VM's network logs past 10 MiB, one old file each
A VM's <vm>.jsonl and <vm>.proxy.log grew without limit. The proxy, their only writer, now rotates each before a line would take it past 10 MiB (logLimit), keeping one old file: - the event log (-log) is the proxy's alone: renamed to <log>.1 (the previous .1 dropped) and a new one opened, 600; - the proxy's own log is also the process's stdout/stderr, which netpolicy opens, where Main's last error and a crash go. A new -proxy-log flag names that file: the proxy's logger writes through a rotating writer that copies it to <log>.1 (written whole, 600) and truncates it, so the O_APPEND writes that bypass the rotation still reach the current file. The HTTP servers' and the reverse proxy's ErrorLog is the proxy's logger, so their lines go through the rotation instead of straight to stderr. Stdlib only. Writes are serialized and each is a whole line, rotated before the write, so no line is lost, split or duplicated. A log deleted while the proxy runs starts again at the limit. The start check (logged) finds the listening line across a rotation (the rest of <log>.1 and the new log). devvm log reads <vm>.jsonl.1 before <vm>.jsonl (opened after the log, and skipped when it's the same file, so a rotation while opening reads nothing twice); --blocked counts both; -f reads a renamed log to its end, checked before the drain so no late line is missed, then follows the new one from its start; a just-rotated empty log with a .1 isn't log_empty. Review (log rotation): lost or duplicated lines across a rotation (none: mutex, rotation before the whole-line write; TestRotateConcurrent: 16 writers, every line once across both files); a VM writing faster than rotation (rotation is inline in Write, so it can't fall behind; a follower misses a file only if two rotations, 20 MiB, happen within one 250 ms tick); devvm log -f across a rotation (TestWriteLogFollowRotated); modes 600 after a rotation, a log left 644 tightened at open (TestRotateRenames, TestRotateCopies); rm deleting every rotated file (existing.txtar: .jsonl.1 and .proxy.log.1 gone). Copy rotation can lose only a write that bypasses the logger between the copy and the truncate: a runtime crash's output. Tests: proxy unit tests (rotation at the limit, one old file, a long line, a deleted log, concurrent writes, the copying rotation), netpolicy reader across a rotation and following one, logged across a rotation, log.txtar (rotated history and blocks, a just-rotated log), existing.txtar (rm). Docs: internals/network.md's Log files and -log/-proxy-log flags, safety/network.md's Logs, internal/proxy/README.md. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
080d57dd28 |
fix(netpolicy): builds reach a company proxy through a proxy of their own; ** refuses names the host can't resolve
From an independent review of the company-proxy change. 1. Builds never get the company proxy's credentials. Each build behind a company proxy goes through a devvm _proxy of its own on the host (backend.ProxyStarter / BuildProxy, shared by Lima and Docker; Docker Desktop's build proxy moved into it): policy **, a new random password, the company proxy in its -upstream file, -lifeline on the build VM's hostagent or the container's docker container wait. Builds get only http://devvm:<one-time>@<host>:<port> (each variable the host sets) and the host's NO_PROXY. - Lima: image builds, the tools build and --from's conversion VM reach it at 192.168.5.2; on macOS the build's Seatbelt profile allows that one loopback port (NetInternet + ProxyPort), so a loopback company proxy works for macOS builds too. guestProxyURL is gone. limactl runs without the host's proxy variables (Lima logged them, password and all, into devvm's run log; found by the new e2e check); only a NetDirect start gets them back for propagateProxyEnv. - assets/oci/build.sh: the /etc/os-release probe runs under env -i; chroot_run passes only the build proxy's variables (bootify.sh's downloads behind a company proxy). - Docker: buildNet takes Desktop's path (own network, relay, build proxy) on any engine behind a company proxy; hostProxyEnv is gone. A Linux engine's build behind one needs devvm's Linux build. - Settings the proxy can't go through are refused before anything is made (upstream_proxy_scheme, reworded for builds too). 2. noClientProxy on the tools' unpack container and the relay. 3. floorUpstream: a name the host can't resolve goes upstream only when an allow rule names it (itself or *.domain: policy.byName); with only ** it's refused (errUnresolved, logged as the reason). 4. CONNECT replies are read through a 64 KiB io.LimitReader (maxConnectReply); bytes after the answer stay the tunnel's. Tests: backend (TestProxyStarter, TestProxyStarterFails, TestListeningPort, TestBuildProxyStop), lima (TestBuildImageHostProxy on linux and darwin with the Seatbelt port, TestBuildImageHostProxyRefused, TestConfineProxyEnv), docker (TestBuildHostProxy for a Linux engine with and without a company proxy, unpack's empty proxy pairs), proxy (TestUpstreamUnresolved, TestUpstreamConnectReplyLimit). CLI: docker.txtar (a Linux engine's build behind a company proxy; every container create and run, kept by the stub in containers-made, sets the empty -e pairs), from.txtar (builds' proxy folders gone). e2e: images (a build sees only its own proxy), from (a --from alpine:3.21 base with every feature and a layer behind a company proxy with a password: the registry, Alpine's mirror and the layer reach it through the builds' proxies; the password is in no converted disk, image, log, build file or process's arguments); corp_start/corp_stop shared with network. Docs: internals/design (A company proxy: the ** case, builds, checks; build confinement), safety/network, internals/network, images, lima, docker, using/troubleshooting, internal/proxy/README.md. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
2f559eaaa5 |
feat(netpolicy): network policy behind a company proxy; host proxy credentials kept out of images
Behind a company proxy, network policy's proxy connected to servers itself and reached nothing. It now reaches allowed hosts through the host's HTTPS_PROXY / HTTP_PROXY, still deciding each request by the name the VM asked for. Step 1, credentials (traced in the code and the backends' published docs; not yet proven on a real build, which the new e2e checks do): - Lima: build VMs (images, the tools build, --from's conversion VM) started with propagateProxyEnv on, its default. Lima's 07-etc-environment.sh writes the propagated settings into the guest's /etc/environment between #LIMA-START/#LIMA-END on each boot, and a stopped build VM's disk keeps it, so an image built with HTTPS_PROXY=http://user:pass@... kept the password. Fixed: propagateProxyEnv is on only for NetDirect; build scripts get the variables exported on their input (a loopback proxy as host.lima.internal), and /etc/sudoers.d/devvm-build-proxy keeps them for sudo until the scripts end. - Docker: the CLI puts ~/.docker/config.json's proxies into every container it creates, and a commit keeps them (Docker's docs). Fixed: every container devvm makes sets each proxy variable empty (noClientProxy); a Linux engine's build gets the host's settings from an env file (hostProxyEnv); Desktop's build proxy goes through the company proxy. - smolvm: passes the host's proxy only with --use-host-proxy, which devvm doesn't use: nothing to fix. The upstream: - backend.HostProxy (new): ReadHostProxy (capitals, then lowercase), None, Upstream (the proxy's -upstream file; only http:// proxies: upstream_proxy_scheme, upstream_proxy_invalid), Env. - internal/proxy/upstream.go (new): -upstream FILE; ParseUpstream, ErrUpstreamScheme; NO_PROXY as Go reads it; localhost, *.localhost and loopback/unspecified addresses always direct; CONNECT by name with Proxy-Authorization: Basic for tunnels and for the TLS connections that put secrets in (checked against the system roots and -upstream-cas); plain HTTP in absolute form, canonical host, credentials only in the header to the upstream; floorUpstream: addresses judged as before, a name refused when the host's resolver answers with any internal or denied address, unjudged when it can't resolve; Event.Upstream (host:port), and devvm log's "through host:port". - hostOK refuses shorthand addresses (127.1, 2130706433, 0x7f000001), which a company proxy may read as inet_aton does (found in review). - netpolicy: Proxy.Getenv, run/<vm>.proxy.upstream (mode 600), stale() (a changed upstream starts the proxy again), writeUpstream for both files. Also, from a review of the company-CA change: a proxy that needed starting again and didn't end within 2 s of SIGTERM was kept, with its old roots, silently. Stop now sends SIGKILL after 2 s and reports whether it ended; Prepare fails with proxy_stop_failed instead of keeping it (Proxy.Signal seam). Messages: proxy_stop_failed, upstream_proxy_scheme, upstream_proxy_invalid, with doc links. Tests: proxy (TestParseUpstream, TestNoProxy, TestUpstreamTunnel, TestUpstreamNoProxyDirect, TestUpstreamPlainHTTP, TestUpstreamIntercept, shorthand hosts in TestOddHostsRefused), backend (TestHostProxy), lima (TestBuildImageHostProxy, TestGuestProxyURL, propagateProxyEnv expectations), docker (TestBuildHostProxy, create's empty proxy variables), netpolicy (TestPrepareUpstream, TestPrepareStopsTheOldProxy, FormatEvent's upstream). e2e: images (a layer built with a fake proxy password: its script and sudo see it; the image's disk, Lima's files and devvm's logs don't), network (a devvm _proxy as the company proxy: allowed hosts through it by name, blocked ones never reach it, its password nowhere, and back to direct). Docs: safety/network (Behind a company proxy, Without network policy), using/troubleshooting (Behind a company proxy), internals/network (Through a company proxy, restarts, -upstream), internals/design (A company proxy: what an upstream changes, credentials, builds, checks), internals/images, internal/proxy/README.md. Review (security-audit skill, independent pass over the proxy change): the shorthand-address bypass, fixed; a VM-controlled name can force the unjudged branch, documented; refusals name the company proxy's address (no credentials), accepted as on the direct path; a loopback company proxy isn't reachable from macOS builds, documented. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
1812867162 |
fix(vm): a subfolder's lookup stops at the nearest parent with state; widening a parent's VM asks
The parent-folder lookup passed over a parent whose VM was made for an earlier folder or that its backend had lost, and went on to a VM further out. A VM can rename a nested project folder through its mount (a new device and inode), so devvm skipped the nested folder's VM and acted on the outer one, the VM that replaced it. parentVM now stops at the first parent folder with state of its own: its VM is used only when its backend has it and it was made for that folder, else the folder devvm runs in has no VM (no_vm; devvm makes a new one). Only folders without state are passed over. Commands that give a parent folder's VM more access, run from a subfolder, ask first ([y/N]), naming the VM and its folder, and refuse without a terminal: devvm secret use, ssh-agent on and devvm, network off, policy allow, policy rm of a deny, and git-protect off (found.widen). Messages: widen_parent_vm (the prompt), widen_parent_vm_refused (linked to getting-started/commands#a-subfolder). Tests: TestLookupParents (a parent's lost VM and another folder's VM stop the search: no VM, no_vm), TestWidenParentVM (each command refused without a terminal, a no changing nothing, a yes changing it; taking access away asks nothing), subfolder.txtar (the refusals without a terminal). Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
c9436eca97 |
fix(tools): bound the unmounted-tools read, drop a stale report first
After a failed setup, devvm reads /run/devvm/tools-unmounted from the VM with a command of its own. Root in the VM could make that read hang, so it now has its own 10 s timeout (unmountedWait, readUnmounted), after which no tool counts and the error is sync_failed. guest/sync.sh removes that report as its first command, so a report left from the VM's boot isn't read after a failure that comes before devvm-tools runs. Tests: TestReadUnmountedWait (a read in time counts; a hung one gives up after its wait); guest.txtar checks sync.sh's first command. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
c65ab1f507 |
fix(install): find Homebrew's devvm without running brew
check_brew ran brew list --formula devvm on every install, and Homebrew's wrapper can download its own Ruby when it runs. The script now looks for a devvm keg (Cellar/devvm/<version>) in the Cellar next to the brew on PATH, in HOMEBREW_CELLAR and HOMEBREW_PREFIX/Cellar, and in /opt/homebrew, /usr/local and /home/linuxbrew/.linuxbrew (brew_prefixes, which the tests set). --force and the refusal stay as they were. path_hint resolves paths with readlink -f --, so a PATH entry starting with a dash isn't read as an option. Tests: install.txtar's brew stub only logs; a Cellar folder fixture stands for the keg (next to brew, HOMEBREW_CELLAR, HOMEBREW_PREFIX, a usual prefix, an empty rack, no brew on PATH), and brew is never run. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
7f9f1316ec |
feat(doctor): warn on small hosts; builds say when base's size was fitted
devvm doctor warns when this machine has less than 8 GiB of memory or fewer than 4 CPUs, the host devvm recommends. The warnings go to stderr in doctor's normal output only: doctor's exit status and --fixes are unchanged. Its checks move into a doctor type with field seams (Path, Free, Host) and a run method returning the last problem, which the command dies with as before. Long also names the warning about another devvm first on PATH. When fitting base to the host gives it fewer CPUs or less memory than base.yaml's, the backend returns that size in backend.Built's Fitted (backend.Fitted), and the build says so once (base_fitted) before image ready. Lima's buildSize returns base.yaml's size and the fitted one; smolvm's and Docker's base.yaml reading becomes baseYAML(fs.FS), with fitted(fs.FS, cpus, mem), as functions to keep their types' method counts. install.sh runs devvm doctor when nothing is missing too, so a new user sees its warnings. - messages: host_memory_low, host_cpus_few (doc link getting-started/install#requirements), base_fitted (using/ports-size#size-and-ports) - docs: install's Requirements (a recommended-host row in both tables, what devvm does on less) and Checking what devvm needs; internals' install (doctor after the fixes, warnings have no --fixes keys); ports-size's size paragraph; the doctor CLI page - tests: TestSmallHost, TestDoctorSmallHostWarnsOnly, TestFitted, TestBuildSaysFitted; Lima's TestBuildImageSmallHost, smolvm's TestSmallHost and Docker's TestBaseSize check Fitted; install.txtar checks doctor runs when nothing is missing - smolvm.txtar: the ports check matches only forwards of 22 and 3000, not a random ssh port starting with 22 Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
28e289c190 |
feat(setup): ask for new VMs' CPUs and memory at first run and in devvm setup
The first run, in a terminal, before base's features are first chosen, asks for the CPUs and memory new VMs get, when no default size is saved and neither --cpus nor --memory is given; devvm setup asks after the backend and features, and --cpus/--memory choose without asking (with only them, the backend and features stay). Each question starts from the saved size, else base.yaml's fitted to this machine (FitCPUs/FitMemory); Enter keeps it, a value Size.Check refuses is warned and asked again. Only typed values are saved, in the size file devvm size -g writes (a saved disk kept); keeping both writes nothing. Without a terminal nothing is asked. - internal/vm/sizechoice.go: SizeChoice (Ask, Set, Fitted), writeDefaultSize, creation.firstRunSize; SetSize -g uses SizeChoice.Set - internal/vm/size.go: baseSetting (BaseDisk on it), readDefaultSize - internal/vm/env.go: Env.Answer and Env.Interactive (stdin and stdout terminals); vm.UI gains Answer and StdoutIsTerminal - internal/vm/up.go: plan asks before reading the default size - internal/ui: UI.Answer, a line prompt; largeTypes allows UI 41 methods - internal/cli/setup.go: setupChoice, --cpus/--memory, saveBackend, saveFeatures; Short/Long updated - messages: size_question, size_cpus_prompt, size_memory_prompt (refusals reuse too_many_cpus, too_much_memory, cpus_not_number; size_defaults after saving) - tests: TestSizeChoiceAsk, TestSizeChoiceSet, TestFirstRunSize, setup's size prompts; setup.txtar (--cpus/--memory, refusals, no terminal), up_size.txtar (first run without a terminal) - docs: first-vm (paragraph, diagram), ports-size (Choosing new VMs' size), customizing, backends, settings; CLI reference regenerated Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
23c8dedaba |
feat(vm): devvm in a subfolder uses the parent folder's VM
A folder with no VM and no state of its own uses the VM of the nearest folder it's inside that has one. The lookup stops before the home folder (by its physical path) and the root, and skips a parent whose VM was made for an earlier folder at its path (sameFolder). - devvm (up): in a terminal it asks whether to open the parent's VM in the subfolder ([Y/n]; no makes a new VM). Without a terminal it opens it, with an info line. --here and --clone make the subfolder's own VM without asking. An IMAGE adds to the parent's VM in place after the same question. - stop, restart, update, remove, export, log, network, policy, secret, ssh-agent, git-protect, size, ports, ssh and code use the parent's VM, naming it and its folder first. rm never deletes it unasked: in a terminal it asks ([y/N]) even with -f, which still skips only its checks; without one it refuses, saying to run it in the parent's folder. adopt acts only on this path's VM. - A repo of its own below the parent's folder (a .git folder or file in the subfolder or a folder between): up asks use_parent_vm_repo [y/N], the default a new VM, and makes one without a terminal; the other commands never reach up and say no_vm. - The shell, devvm ssh's folder and devvm code open the subfolder; in a --clone VM, the subfolder when the clone has it, else the clone's top. - project.Parents; Env.lookup and Env.inspect (find split); found.sub, found.shellDir; useParent; Options.Here and the --here flag. - Messages: use_parent_vm (dir, parent, vm), using_parent_vm (dir, vm), delete_parent_vm (dir, vm), rm_parent_vm (dir, vm), use_parent_vm_repo (dir, parent, repo, vm); all but the delete_parent_vm prompt linked to getting-started/commands#a-subfolder. - Tests: TestParents; TestLookupParents, TestUpInSubfolder, TestShellDir, TestCommandsInSubfolder, TestSubfolderRepo; testdata/script/subfolder.txtar; up_checks' "My App" folder is made at $WORK, where the script meant it. e2e: the project section opens the VM from a subfolder (pwd in the VM). - Docs: first-vm (coming back to it), commands (--here, A subfolder), using/clone (Subfolders), internals/overview (A subfolder's VM), internals/security; the CLI reference for devvm and devvm rm. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
906d598954 |
feat(trust): VMs, builds and the proxy trust a company's CAs from ~/.config/devvm/ca
Behind a proxy that inspects TLS, VMs and build VMs couldn't make TLS
connections. The CA certificates in ~/.config/devvm/ca (*.pem, *.crt) are
now read at each launch, build and proxy start, checked, and trusted;
images never keep them.
- internal/trust (new): Read parses every PEM block with crypto/x509 and
refuses anything but CA certificates (ca_not_certificate, ca_not_ca,
ca_invalid, naming the file); only the re-encoded certificates leave the
host. Env/GuestEnv (NODE_EXTRA_CA_CERTS=/etc/ssl/devvm.pem,
SSL_CERT_FILE, REQUESTS_CA_BUNDLE, PIP_CERT, UV_SYSTEM_CERTS), Build
(a build's Add/Remove root scripts from guest/ca.sh), Script (Env
exported at a build script's start), Name, Bundle.
- assets/guest/ca.sh (new): installs exactly DIR's devvm-*.crt into
/usr/local/share/ca-certificates (update-ca-certificates --fresh), or
into the bundle file itself when there's no update-ca-certificates (the
old bundle kept and put back), writes /etc/ssl/devvm.pem; without DIR,
removes all of devvm's. sync.sh runs it with the proxy's CA
(ca/devvm-proxy.crt) and the user's (ca/devvm-extra-N.crt).
- backend: ImageSpec.Trust and ToolsSpec.Trust (backend.Trust{Add,
Remove}); VMSpec.Env. Lima runs Add after the start and Remove after the
scripts (runScript's root mode, sudo sh), the --from conversion VM runs
Add and oci/build.sh runs ca.sh in the image's chroot around bootify.sh
(guest/ mounted read-only, CA_SH argument); smolvm and Docker run Add
before prepare.sh and Remove after sshd.sh; tools builds run Add only.
Lima's clone sets the guest environment, so starts edit nothing.
- vm: every project VM starts with trust.Env (netpolicy.Env keeps only the
proxy's variables); the setup sends ca.sh and ca/; Dirs.TrustedCAs.
- proxy: -upstream-cas FILE adds CAs to the system roots for its own TLS
connections; netpolicy writes run/<vm>.proxy.cas and restarts a proxy
whose bundle changed.
- doctor: doctor_proxy_ca when HTTPS_PROXY is set and the folder has no
CAs (Say), a refused folder warned about.
- Tests: internal/trust unit tests (folder reading, scripts, ca.sh run in a
stand-in root with and without update-ca-certificates); ca.txtar; sync,
up, network, smolvm txtars and the limactl stub (clone's .env, list
shows lima.yaml's env); e2e: images (a layer built with a test CA, its
key unchanged, its image's copy without CA files), project ("a company's
CA" section), tools (node fetch), smolvm and docker build checks.
- Docs: using/settings (a company's CA), using/troubleshooting (TLS errors
behind a company proxy), internals/network and internals/images,
safety/network, design (assets written out), oci README, doctor's help.
- Structure: Dirs at 38 methods, trust.Env a table, trust above backends.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
||
|
|
b33b0a9b4c |
fix(tools): a shared tool that doesn't mount fails the launch
A tool image missing from the share, or one the VM couldn't mount or link, used to be skipped with a line on stderr, and mise's auto_install then downloaded the same version into the VM on first use. Now the launch stops with a message naming the VM and the tools. - assets/guest/tools.sh: tries every listed image, removes a failed one's empty mount point, says why on stderr, lists the failed files in /run/devvm/tools-unmounted (removed at the start of each run) and exits 1. Link failures (Docker's unpacked folders) count too. - assets/guest/sync.sh: its devvm-tools call failing fails the setup. - assets/container/services.sh: a devvm-tools failure doesn't stop a smolvm or Docker start; the launch's setup reports it. - internal/vm/sync.go: after a failed setup, syncer.unmounted reads the VM's report with its own Exec (capped at 16 KiB, unmountedMax), and reported keeps only whole lines that are one of the VM's own tool files from its state, so the message carries devvm's values, never the VM's text. The setup's output still goes straight to the run log (a pipe would wait on processes the setup leaves running). - internal/tools: label is exported as Label; VMs.Update builds the VM's tool images that the share lacks even when they're the newest, so devvm update repairs a missing image. - Message tools_unmounted (tools, vm), linked to using/troubleshooting#a-shared-tool-doesnt-mount. - Docs: troubleshooting "A shared tool doesn't mount"; images.md's shared tools and devvm update; internals/images.md "The share" has the mechanism; design.md says why. - Tests: TestReported (internal/vm), TestUpdate rebuilds a missing newest image, guest.txtar runs tools.sh with stubbed mount commands, sync.txtar checks tools_unmounted and that other report lines don't count (limactl stub: $STUB_DIR/sync-fails-with), e2e's tools section moves node's image out of the share and back. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
6a168ed23a |
fix(size): the size check keeps memory for the host, as base's fitting does
Size.Check refused only memory above the host's total, so --memory 8 on an 8 GiB host passed, though a VM asking for all of the host's memory doesn't start. It now refuses more than backend.MaxMemory allows, the limit of the rule base's memory is fitted by: the host's whole GiB less 2, or half of them on a host of 4 GiB or less. Whatever FitMemory gives always passes. CPUs stay limited to the host's count. Check runs for a new VM, devvm size and devvm size -g only: a VM whose recorded size is over the limit still starts. Changes: - internal/backend/fit.go: MaxMemory(hostBytes uint64) float64 beside FitMemory, with TestMaxMemory (which also checks FitMemory never exceeds it). - internal/vm/size.go: Check uses MaxMemory (Host.memoryBytes converts the whole GiB); too_much_memory gets max, the largest --memory that works (fields have, max, want). - locales/en.toml, messages_gen.go: too_much_memory's text and description. - Tests: TestSizeCheck's cases updated (32 GiB host: max 30), and new ones: 8 GiB refuses 8 and 7, allows 6; 4 GiB allows 2, refuses 3; 3 GiB allows 1.5. up_size.txtar expects max. - Docs: using/ports-size.md says the most memory a VM can have, for new VMs, devvm size and devvm size -g, what devvm says when it's too much, and that VMs already over it still start; internals/images.md's Base's size section says the check shares the rule. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
d55dae5386 |
fix(build): fit base's CPUs to the host, as its memory is
Base asked for base.yaml's 4 CPUs whatever the host had. It now gets base.yaml's CPUs, or the host's count when the host has fewer, by the same shared rule as its memory. What happens above the host's count (from published docs, not checked on a VM): - Lima accepts cpus above the host's count: its template's default is min(4, host CPU cores), and its proposed check that refused more than runtime.NumCPU() (lima-vm/lima#2309) was closed unmerged. On vz, a VM given more CPUs than the Mac has can start so slowly that ssh never comes up (lima-vm/lima#1621, open). - Apple's Virtualization framework only requires cpuCount <= VZVirtualMachineConfiguration.maximumAllowedCPUCount, whose docs don't tie it to the host's count. - smolvm and libkrun document no limit for --cpus. - Docker refuses --cpus above its engine's machine's count ("Range of CPUs is from 0.01 to N.00, as there are only N CPUs available"). Changes: - internal/backend/fit.go: FitCPUs(want, hostCPUs int) int and FitMemory(wantGiB float64, hostBytes uint64) float64, pure and exported; fitMemory's rule moved there from Lima, with table tests. - Lima: buildSize replaces buildMemory and reads base.yaml's cpus and memory; limactl create gets --cpus and --memory for base and the --from conversion VM (createArgs). A CPUs field (runtime.NumCPU) is the host-CPU seam beside Memory. - smolvm: baseSize fits CPUs and memory with the shared rules, for base's build, tool builds and VMs given no size; a CPUs field is the seam. spec.Size.CPUs still wins. - Docker: the engine's NCPU is read from docker info beside MemTotal (engineSize replaces engineMemory), and baseSize fits both. - Image keys are unchanged: neither the fitted memory nor CPUs are in them. - Tests: TestFitCPUs, TestFitMemory, Lima's TestBuildImageSmallHost and "no CPUs" case, smolvm's TestSmallHost, Docker's TestBaseSize; the build and from testscripts expect --cpus. - Docs: using/ports-size.md and using/images.md say what a small machine gets; internals/images.md has a Base's size section on the mechanism; internals/smolvm.md and internals/docker.md match it. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
effcdfece0 |
feat(install): install.sh and doctor catch a second devvm
Installing with both Homebrew and the install script left two devvms, and the one first on PATH ran without a word while brew upgrade might update the other. - install.sh: before downloading, check_brew stops (exit 1, in a terminal or not) when brew is on PATH and brew list --formula devvm succeeds; brew runs with stdin from /dev/null and its output discarded, only its exit status read. --force (in the usage, the header and the parser) installs anyway. - install.sh: path_hint, after installing, warns when ~/.local/bin is on PATH but command -v devvm resolves (readlink -f) to another copy, naming it and what to do; it only looks the path up, never runs it. When ~/.local/bin isn't on PATH it prints only the existing hint. - devvm doctor: warns (u.Warn, not a backend.Problem) when the devvm first on PATH isn't this binary, both resolved with filepath.EvalSymlinks; skipped when devvm isn't on PATH, and never with --fixes; exit status unchanged. Seams: onPath's LookPath and Executable fields. - Message devvm_other_first (first, self), linked to getting-started/install#one-devvm. - Tests: TestOnPathOther (this copy by either link, another copy, none on PATH, a broken link); install.txtar: a stub brew reporting devvm makes the script refuse before downloading, --force goes on, another devvm earlier on PATH gets the warning and isn't run, a link to the installed copy gets none; the stub brew answers list from $BREW_DEVVM. - Docs: Installing's One devvm section (one way, the refusal, --force, switching through Uninstalling's step 4, the PATH warnings), --force in the options, doctor's warning; Installing and updating: the Homebrew check, the PATH check and doctor's check. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
bd124472e9 |
refactor(msg): warnings and errors don't repeat devvm after its prefix
Warn, Die and DieLogged print "devvm: " before a message, so the 73 warnings and errors whose text started with devvm read "devvm: devvm couldn't ...". They now lead with what failed or what they're about, with the same fields. The 20 that only Info, Note or a prompt print keep their text. The docs-voice skill gets the rule and a tropes example, and qemu.txtar matches qemu_refused's new wording. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
d3948f0933 |
test: CLI scripts expect the docs-voice wording of usage errors and qemu_refused
Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
ee06f051ff |
refactor(msg): remaining messages in the docs voice
Rewrites the messages outside the prompt, network policy, secrets, project folder, .git, --clone, backend, host, image, build and shared tool groups (agent_, ssh_, ports_, size_, disk_, vm_, no_, devcontainer_ and the rest) as full sentences: what happened first, then one action as a command, without chained colons and semicolons. Status steps and short ==> result lines stay as they are, and every template keeps its fields. Adds doc links for the actionable warnings and errors that had none: no_devcontainer_flag_ignored, no_ssh_agent, ssh_agent_empty, load_key_with, no_vm_ssh_agent, agent_key_not_found, agent_load_failed, agent_start_failed, mounts_next_start, no_feature, no_image_named, no_image_named_from, not_an_image, no_vm, no_vm_size, no_vm_ports, no_vm_git_protect, no_vm_policy, no_token, bad_secret_service, start_failed, stop_failed, delete_failed, vm_create_failed, sync_failed and pack_failed. msg_unknown's wording is checked by TestValuesAsGiven and msg.txtar, which follow it. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
9cf45cc5e0 |
feat(net): network policy on by default; a warning where a VM can't have it
A new VM gets network policy unless it's turned off. In a terminal devvm shows the tradeoff and asks yes by default ([Y/n]); without a terminal it's on. A VM that can't have network policy gets no question, only a warning, and is made without it: on a backend without egress-proxy (or with it unreviewed), and a Docker VM made for the docker layer, whether named or from a devcontainer.json's docker-in-docker. An explicit --network-policy on such a VM is still refused (net_docker_layer, or backend_lacks from Require). Existing VMs keep their state's choice. - netpolicy.Proxy.Choose: no terminal gives on; in a terminal net_about, then Confirm (yes by default). Proxy's Ask field and netpolicy.UI's Ask removed (unused); vm.UI asks Ask itself. - vm.creation.chooseNet: --no-network-policy first; the docker layer warns (net_off_docker_layer) or refuses --network-policy; a backend Registry.Allowed doesn't let egress-proxy through warns (net_off_backend); otherwise Choose. - Messages: new net_off_docker_layer, net_off_backend (with doc links); net_about rewritten as the two-line tradeoff with a doc link (safety/network#turning-it-on-or-off); net_ask is "Turn it on?" (no fields); devcontainer_docker_net removed (no caller). - --network-policy's help: secrets, default on, asked in a terminal; CLI reference regenerated. - Tests: TestChoose (flags, terminal yes/no, no terminal on, what's said); TestChooseNet replaces TestChooseNetDockerLayer (docker layer named and from the file, no egress-proxy, unreviewed egress-proxy, flags, with and without a terminal); TestUpWithoutEgressProxy (backend_lacks for --network-policy, the warning and net=off by default). network.txtar: --no-network-policy for the off VM, and a VM made without a flag or terminal gets net=on. docker.txtar: another machine's engine (backend_lacks, then the warning and net=off), and the sysbox VM's warning. e2e's docker sysbox check expects the warning. - Docs: first-vm, commands, safety/network (the prompt, the VMs that can't have it), security, attack-vectors, devcontainer, backends index and docker, design notes, README. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
8439cbdb8c |
ci: the tests pass on Linux runners; workflows linted with actionlint and zizmor
The tests assumed a macOS host with 4 or more CPUs: - size: the stub VM has 2 CPUs, which any host running the tests has - ls, images: smolvm's --state-dir on Linux - docker: .git protection is off on Linux - the limactl stub's delete forgets the VM's port forwards and ssh port, as Lima does, so from's second conversion VM is configured again - TestStartForwarder confines Lima's start as the host does (no sandbox-exec on Linux) - TestProcessArgs runs sh, which ignores the extra arguments GNU sleep exits on lint:code runs actionlint and zizmor (offline) on the workflows; ci.yml's paths are written out, without a YAML anchor, and the deploy job's permissions say why. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
fd6170c7f7 |
fix(lima): the sandbox refuses the hostagent's port binds; ssh ports recorded
On macOS, a network-policy VM's hostagent Seatbelt profile denies every network bind but TCP on its ssh port and unix sockets in its Lima folder, so Lima forwards none of the guest's ports even if its ignore rules were bypassed. Lima's host resolver is off for these VMs, as on Linux: it binds a random port the profile can't allow. Every VM's ssh port is chosen and recorded before create (VMSpec.SSHPort, Lima's .ssh.localPort), under a lock so two VMs can't choose the same one, and checked free by a bind as well as a connect. Other VMs' forwarders reserve it, so none can take it while Lima boots, when Lima's unpinned ssh would reach whatever has it. Design note: the sandbox's binds, how they were found, the threat check. e2e: the profile's rules, binds refused around Lima's rules, a taken ssh port, a direct VM's recorded port. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
70f472eacd |
feat(ports): port changes apply to running VMs
devvm ports on a running VM records the ports and starts only its forwarder again, on every backend: the VM runs on, and connections open through the old forwarder close (ports_forwarding). SetPorts takes the VM's Confinement (host key, proxy and decider ports, Free, which leaves out and warns ports a host program has); Env.forwarding builds it for starts and changes alike. State is written first, so other VMs' forwarders reserve the new ports, and put back if the backend fails. A per-VM lock (platform.LockFile, Forwards.Lock) keeps two runs from leaving a forwarder nothing stops; Stop kills a forwarder that outlives SIGTERM by 2 s. A smolvm or Docker VM started outside devvm gets ports_no_ssh. Removed: ports_set, applyPorts, startPorts, ports_pending, ports_next_start. ports.txtar takes free ports (free_port) instead of fixed ones a host program can hold. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
5fe850e1b2 |
feat(smolvm): forward listed ports through devvm's forwarder
smolvm's listed ports go through devvm's forwarder (Spec.Only), as Lima's and Docker's do: smolvm itself forwards only the VM's ssh. The record keeps the list (listed_ports); create and SetPorts pass no -p. That lifts smolvm's 64-forward limit and its reach of servers on all addresses only, and allows listing 22. smolvm's ports are emulated, reviewed: design note with a threat check for listed ports, e2e (a listed port on the VM's loopback reaches the host, an unlisted one doesn't, the machine publishes only its ssh, a network-policy VM's listed ports). Removed: smolvm_too_many_ports, smolvm_port_ssh. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
b27cd9b9b3 |
feat(lima): forward ports through devvm's own forwarder
Lima VMs forward their ports, every port and listed ones, through devvm's forwarder (devvm _lima-ports), as Docker's do: loopback only, exclusive binds, every port from 1024 up, never a port a host program or another VM's record holds. Lima's own portForwards are ignore rules for TCP and UDP on every address. The port choice is a record (lima-vms/<vm>.ports), so changing it edits no Lima config and keeps the VM's host keys. The forwarder pins the host key devvm pins (Confinement.HostKey, sshconfig.HostKey) and ends with the hostagent (the shared lifeline in vmssh). Lima's ports and ports-all are emulated, reviewed: design note, threat check, e2e. Docs: the forwarding rules for every backend, UDP not forwarded and the socat alternative, in the docs voice. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
cf5a7db974 |
fix(images): pin Lima's Ubuntu cloud image with base's snapshot
Lima's base starts from a pinned dated Ubuntu cloud release (release-20261016) with each architecture's SHA-256, checked against Ubuntu's signed SHA256SUMS; another checksum is refused (ubuntu_checksum_unpinned). The pin is in base's image key (Lima's KeyFiles). scripts/bump.sh apt moves it with the snapshot and container digest: the newest release dated before the snapshot, its SHA256SUMS checked with gpgv against Ubuntu's cloud key. e2e: default tier 146/0, --only from 13/0. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
3da0d6b0a6 |
feat(devcontainer): a project's devcontainer.json as input for new VMs
A new VM gets what the folder's .devcontainer/devcontainer.json (or .devcontainer.json) says, on every backend: image as --from (only an image its registry gives anyone, asked anonymously, pinned to that digest, never a registry on this machine or its network), features devvm has layers for (docker-in-docker as the docker layer, node, python, rust, go), forwardPorts as far as the user's ports allow, containerEnv and remoteEnv in the VM's environment, onCreate/updateContent/postCreate commands once and postStartCommand at each start, in the VM as its user. --no-devcontainer skips it; the command line wins. Later launches only warn when the file changed.
Nothing from it runs on or reaches the host: initializeCommand never runs, ${localEnv} and the host-folder variables are refused, builds, Compose and docker-outside-of-docker are refused, mounts, runArgs and privileged ignored. The file is read through os.Root, without blocking, at most 1 MiB. A docker layer only the file asks for still asks about network policy on Docker.
Reviewed with the security-audit skill (FuzzParse, design note); e2e: project 69/0, docker linux 135/0, smolvm 131/0.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|