Commit Graph
222 Commits
Author SHA1 Message Date
w3cjandClaude Opus 5.5 35bc2c3cdd docs: hugo.Data in place of the deprecated site.Data, and lint:docs fails on any Hugo warning
The two templates that read the sections' icons used site.Data, which
Hugo 0.156 deprecated; the built site is the same with hugo.Data.
lint:docs builds the site with --panicOnWarning into a temporary
folder, so the next deprecation fails there. The site's description
says one VM for every project.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-01 08:12:33 -08:00
w3cjandClaude Opus 5.5 4a81a4246e fix(cli): the last stale command lines, and a test that checks every one
TestCommandLines (internal/cli/commandlines_test.go) reads every devvm
command line in the repo: docs (the CLI reference too), README, AGENTS.md,
locales/en.toml, Go comments and strings, assets/, install.sh,
tests/e2e.sh, testdata scripts and stubs, scripts, packaging, workflows
and the skills (5722 lines in 606 files). Each command must exist, each
flag must be one that command takes, a placeholder must be one its Use
shows and a flag's value the form its help shows, and a reserved word
after a command with commands of its own must be one of them. Lines
written to be typed (code blocks, code spans, testscript exec) get their
values checked with checkFlagValue and, with nothing to fill in, run in
the stubbed tree, where they mustn't be a usage error. Lines written to
show a refusal are in refused, each with why. TestCheckCommandLine checks
it finds each kind of stale line. mise run test and lint:docs run it;
Contributing's The CLI rule tests says what it checks.

Fixed: gc_older_than_needs_history said --older-than AGE (DURATION);
no_vm_ports said devvm --ports LIST (the flag's form is PORTS); the guest
agents' note read "(devvm network policy)" as a command (devvm's).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-01 05:33:47 -08:00
w3cjandClaude Opus 5.5 f734beec66 docs(cli): the cli skill and Contributing's CLI conventions
The cli skill (.agents/skills/cli/) holds devvm's command line rules:
SKILL.md has the tree, the thirteen rules each with the test that checks
it or "by hand", a checklist for adding a command, the steps for changing
one, and a review. judgment.md explains, with examples from devvm's own
commands, the rules no test checks: where a command goes, rm or unX,
which commands are settings, arguments, destructive commands (confirmed,
--force, widening flags) and the wording of help and usage errors. It
links clig.dev and cobra.dev for the reasoning instead of restating them.

Contributing gets a CLI conventions section linking the skill and the
sources, naming what the tests check and what a reviewer checks, and
mise run cli-docs. AGENTS.md gets a Layout line and a Rules line;
lint:docs and .vale.ini lint the skill; docs-voice's scope names it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-01 05:19:55 -08:00
w3cjandClaude Opus 5.5 368991cf9f test(cli): rule tests walk the command tree for help, flags, --json, names, arguments and prompts
New tests:
- TestEveryCommandsHelp: Short in sentence case without a full stop, Long
  of one to three sentences, Example, docs page; root's commands in a group
  (devvm help excepted).
- TestFlagNames: shorthands only -h -v -f -g -n, each for one flag; no
  --yes; one help text per flag name but manyUses (backend, cpus, memory,
  disk, global, json).
- TestDurationFlags: DURATION flags go through state.ParseDuration; no
  time.Duration flags.
- TestShowCommandsTakeJSON: every visible command takes --json or is in
  withoutJSON with why.
- TestCommandNames: lower-case names, no aliases, no list/show/get/delete/
  remove/ls but devvm ls, unX has a sibling X, Use arguments are
  placeholders or words.
- TestUseMatchesArgs: every command runs with the arguments its Use shows.
- TestPromptsAnswered (internal/msg): every message given to Ask, Confirm,
  Answer, Secret, Pick or PickOne has an AnswerFor answer or is in
  terminalOnly with why.

Extended:
- TestPersistentFlags: every command takes -h/--help, --no-input,
  -v/--verbose.
- TestUsageErrorsEveryCommand: a blank value for every string flag is a
  usage error.
- TestJSONShapes: every command with --json has a shape.

Contributing: The CLI rule tests section.

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

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

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

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-01 04:39:39 -08:00
w3cjandClaude Opus 5.5 16b4ad8771 feat(cli): --no-input, a flag or command for every question, and --force only skips a confirmation
A global --no-input (persistent on the root, with --help and -v): no
question is asked or read. The ui's prompts (Ask, Confirm, Answer,
Secret, Pick/PickOne in a terminal) show the question, then fail with
no_input naming what answers it (msg.AnswerFor, by the question's ID),
or no_input_terminal for a question only a terminal answers. ui.Flags
and SetFlags carry -v and --no-input.

Answers: --network-policy/--no-network-policy, --here, devvm size -g,
devvm setup --features/--backend, devvm network -g, devvm ssh-agent add,
devvm restart, --ssh-config (new, on devvm, host and code: the Include
line without asking; sshconfig.Config.AddInclude, vm.Env.AddInclude),
--stdin, and --force.

--force (-f) only skips a confirmation, and destructive commands need it
without a terminal (force_needed, a failure, not a usage error): rm (new
rm_confirm), gc (it went ahead without a terminal), gc --caches (now
allowed without a terminal with --force), images rm (images_rm_confirm),
secret rm (secret_rm_confirm), adopt (adopt_vm), rebuild when images
are built on the one rebuilt (build.Env.Force). rm --no-export skips the
export; rm's parent-folder, earlier-folder and --clone confirmations are
terminal-only and --force never answers them (vm.RmOptions). gc --tools
--force splits: --recent (only with --tools, gc_recent_needs_tools)
drops the hour's hold and keeps the refusal while a VM is being made
(gc_recent_making); gc_tools_recent names devvm gc --tools --recent.
gc_caches_need_terminal goes.

Tests: TestNoInput, TestAnswers, TestConfirmed, TestRmConfirms, TestAdopt
(--force), TestRebuild (force_needed, then Force); secret, rebuild,
images, gc*, clone, subfolder, existing scripts. e2e: rm/gc/images
rm/secret rm/rebuild with --force (and --no-export where rm -f skipped
the export), and the clone section's rm with its checks. Docs:
commands.md (Questions devvm asks, rm, flags), first-vm, clone, images
(cleaning up, --recent), space, coding-agents, internals overview and
images; CLI reference.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-01 03:51:27 -08:00
w3cjandClaude Opus 5.5 a7b605f0c0 feat(cli): -v/--verbose streams the run log
A global -v/--verbose (persistent on the root, the only one with
--help): each line the run log gets, numbered steps, the redacted
command lines and the commands' output, also goes to stderr as it's
written, without control characters (a C1 control split across writes
too) and dim where stderr is colored, with no status line. The run log
is still written. A logged failure while verbose names the log
(log_details) instead of printing its end again. DEVVM_VERBOSE is gone.

ui: SetVerbose; stream (printable, dim) and logTo tee LoggedCmd's and
LogWriter's output; a streamed command's pipe gets WaitDelay
(streamWait, 2s) so a process it leaves running can't hold devvm, and
ErrWaitDelay alone isn't a failure. --version stays root-only, and
version.txtar checks -v isn't it.

Tests: TestStreamIsPrintable, TestDieLoggedVerbose, the logged-command
and status tests; build.txtar streams a build with -v. Docs:
troubleshooting (A command fails), settings (colors, environment),
commands (Flags and values), contributing (styles); CLI reference.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-01 02:55:59 -08:00
w3cjandClaude Opus 5.5 e782de9ae8 feat(cli): flags local to their commands, one meaning per name, and one duration grammar
devvm [IMAGE]'s flags for a new VM (--backend, --from, --cpus, --memory,
--disk, --ports, --network-policy, --no-network-policy) are the root's
own, so devvm ls --cpus 4 and devvm setup --cpus 2 fail as unknown
flags. build, rebuild and images rm take --backend and --from;
images, gc and space take --backend as a filter of their own (images
and space now filter: only that backend's rows); doctor takes
--backend; restart and tools take none. ports -g is local on ports,
ports add and ports rm. No command has a persistent flag.

One name, one meaning: network log --follow loses -f (-f is --force's,
and gc --force gains it); the hidden secret get's --force becomes
--to-terminal. Flag defaults name the setting command (devvm size -g,
devvm ports -g, devvm setup --backend); descriptions lose then/also
openings.

Special values are words: an empty flag value (flag_blank) or an empty
argument (arg_blank) is refused everywhere, replacing features_empty.
Durations: state.ParseDuration (a whole number and m, h, d or w) for gc
--older-than, retention's ages and ssh-agent add --lifetime (which also
takes forever, via sshagent.CheckLifetime), with one message,
bad_duration, replacing gc_bad_age and agent_lifetime_invalid.
Blanks are checked with the other usage errors (checkCommand, before
checkFlags), and an unknown --backend NAME is a usage error checked
first too (checkFlagValue, against registry.Names, which a test keeps
equal to the registry's own).

Tests: TestPersistentFlags, TestFlagNamesHaveOneMeaning,
TestUpFlagsAreUpsAlone, TestParseDuration, TestCheckLifetime; root,
setup, images, space, gc_history, retention, ssh_agent and network_log
scripts. Docs: commands.md (Flags and values), from.md, install.md,
images.md, space.md, settings.md, ssh.md, network pages; CLI reference.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-01 03:14:23 -08:00
w3cjandClaude Opus 5.5 cd6fc60576 feat(cli): --json on every command that shows or lists
ls, images, tools, size, ports, network (and -g), network log (and
--blocked), ssh-agent, git-protect, secret, history, space, retention and
doctor take --json: one JSON object on stdout with "version": 1 first,
messages on stderr (ui.DataOnly), lists [] when empty. Settings commands
only show with --json and refuse a value (json_shows_only). doctor --json
replaces --fixes: problems with key, fix (null without one) and message,
warnings, docker and every backend's features; it prints nothing else and
succeeds whatever is missing, and install.sh reads its problems with awk.
TestJSONShapes holds each command's field names and types. Each shape is
documented on its command's page, with the contract under Everyday
commands' Output for scripts.

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

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

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

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

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-01 02:27:57 -08:00
w3cjandClaude Opus 5.5 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]>
2026-11-01 01:40:20 -07:00
w3cjandClaude Opus 5.5 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]>
2026-11-01 01:27:24 -08:00
w3cjandClaude Opus 5.5 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]>
2026-11-01 01:38:54 -07:00
w3cjandClaude Opus 5.5 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]>
2026-11-01 00:39:23 -07:00
w3cjandClaude Opus 5.5 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]>
2026-11-01 00:19:42 -07:00
w3cjandClaude Opus 5.5 76a91ed698 feat(docs): llms.txt links to each page's Markdown copy
As the llms.txt convention prefers: agents get the clean Markdown,
install commands and tables included, without the site's chrome.
_partials/llms-link.txt gives a page's Markdown copy's URL, or its
HTML page's for one without a copy.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-01 00:40:24 -07:00
w3cjandClaude Opus 5.5 b5be557ab6 feat(docs): llms.txt, a Markdown copy of each page and the Copy page menu
hugo.yaml turns on Hextra's llms output at the site root, a markdown
output beside each page and section, and params.page.contextMenu. The
home page keeps html and rss, and sections keep rss. The search index
comes out byte-identical.

- layouts/llms.txt replaces Hextra's. Each section's own page is listed
  first, followed by its pages. Each line is the page's description, or
  else its first paragraph as plain text on one line, cut at 200
  characters (_partials/llms-summary.txt). Hextra's version left out the
  section pages, printed HTML entities and newlines, and let the
  experimental badge and the CLI "Synopsis" heading into the summaries.
- page/section.markdown.md and _partials/markdown-copy.md render the
  shortcodes through .markdown.md versions (install, os-tabs, yes, no,
  experimental, section-card, Hextra's cards). They also point links to
  a section's _index.md at index.md, so all 867 relative links between
  the copies resolve. The install commands live in
  _partials/install-tabs.html, which the HTML tabs use too.
- The branding page sets outputs: [html], contextMenu: false and
  llms: false. The home page sets contextMenu: false.
- Coding agents gets a description, because its first paragraph is a
  heading and a code block.
- custom.css styles the menu in the site's border, surface and lime.
- Contributing's Writing docs describes all of this, including what to
  check after adding a page or a shortcode.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-01 00:28:13 -07:00
w3cjandClaude Opus 5.5 0483337999 docs: a recipe for sharing a team's Nix packages through a layer of your own
using/toolchains.md's Sharing a team's packages: a layer of your own,
named after nix in the image (devvm nix+myteam), runs nix develop on
the team's flake at a commit while the image builds, records the dev
shell in a profile and keeps it with nix-store --add-root, so VMs made
from the image share its packages on disk (APFS clones on macOS, qcow2
overlays on Linux hosts), with stable Nix, on Lima and smolvm, with
network policy or without. The flake must be one anyone can fetch, as
credentials never go into images. Not covered: packages a VM gets after
it's made, a new flake version (the script edited, or devvm rebuild
myteam when it names a branch), a flake pinning another nixpkgs
revision, and Nix's local overlay store until it's stable. The design
note links to it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 23:37:33 -07:00
w3cjandClaude Opus 5.5 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]>
2026-10-31 22:56:53 -07:00
w3cjandClaude Opus 5.5 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]>
2026-10-31 22:28:06 -07:00
w3cjandClaude Opus 5.5 66ae237292 docs(testing): a manual check of VM clocks after the Mac sleeps
Lima vz without and with network policy, and smolvm, stay within about
0.1 s of the host after a real 2.5-hour sleep, with no NTP correction:
the guest's clock catches up through the hypervisor. The check notes
that caffeinate -s on AC power turns a sleep into a dark wake.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 21:59:07 -07:00
w3cjandClaude Opus 5.5 a169ebb1cf feat(ui): a feature a backend lacks is dim in devvm doctor's table, not red
none isn't a fault, and Docker's column, with many features it lacks,
read as mostly red. Red is left for unreviewed emulations and
unenforced network policy.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 17:26:35 -07:00
w3cjandClaude Opus 5.5 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]>
2026-10-31 16:50:19 -07:00
w3cjandClaude Opus 5.5 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]>
2026-10-31 16:38:38 -07:00
w3cjandClaude Opus 5.5 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]>
2026-10-31 16:26:58 -07:00
w3cjandClaude Opus 5.5 92ce736574 fix(test): tests pass in any time zone, and CI runs them in one with DST
TestExports counted 30 days from a fixed local date, so it failed in UTC
(CI) and passed in Pacific time, where the range crosses a DST change and
is an hour short. It now counts from export b's parsed date: at exactly
30d both exports are that old, a second short only a, and olderThan 0
returns both.

The audit of internal/ and cmd/ found nothing else that depends on the
zone or today's date: export names are written and parsed in local time
(now documented at the parse and on the coding agents page: an age is
elapsed time, so across DST it's an hour off wall-clock days); run-log
names are local but pruning goes by mtime; the network log, image
versions, logins and Lima's start marker are UTC; retention, tools'
daily check and the caches tests count from instants; testscript
fixtures are dated far in the past or the future.

CI runs mise run test a third time on Linux with TZ=America/Los_Angeles,
and contributing/testing.md says how to check other zones.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 16:50:38 -07:00
w3cjandClaude Opus 5.5 bb564f4966 feat(ui): bold a message's values in a terminal
The values a message's template fills in (a VM's name, a path, a port,
a count, a value inside a command) are bold (SGR 1) in a terminal; the
template's own words stay in the default foreground. Bold, not italic,
which some terminals don't draw or draw as reverse video. Same enable
rule and streams as the other colors; the run log, DEVVM_MESSAGES=names,
M.String/Line and anything not a terminal are byte-identical.

internal/msg: M.Segments returns the text as segments (the template's
words, or a value) and the doc link apart; names mode gives the names as
one segment and no link. It renders the template with each value between
U+E000 and U+E001, after dropping those runes from the values, so a
value can't start or end a marking; VM-made values still go through
msg.Shown, so their control characters are quoted. Joined, the segments
are Text.

internal/ui: style.message bolds value segments (per line) and paints
the link; the status line's label and the done line are parts, values
bold, cut and counted on their plain text (style.fit), so truncation
inside a value closes its code. DieLogged's log end stays Line inside
dim.

Tests: TestSegments (a VM name, a path, a log path, both plural forms,
two values, an empty value), TestSegmentsOfHostileValues (marker runes,
escape codes through Shown), TestSegmentsInNamesMode; TestEveryMessageRenders
checks every message's segments join to its text with each field a
value, in every language; ui's TestMessagesColored with the value bold,
TestStatusLineValuesBold (bold, cut at 12 columns, plain unchanged),
TestDoneMarkGreen with a bold value.

Docs: using/settings (Colors); contributing (Messages: Colors).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 16:25:01 -07:00
w3cjandClaude Opus 5.5 bb48f435cc feat(ui): color devvm's tables when stdout is a terminal
devvm ls, devvm images, devvm space and devvm doctor's feature table
are colored with the messages' rule for stdout (NO_COLOR or names mode
off, FORCE_COLOR or CLICOLOR_FORCE on, TERM=dumb off, else only when
stdout is a terminal). Pipes, scripts, --json, doctor --fixes, the run
log, DEVVM_MESSAGES=names and tests stay byte-identical.

Header rows and totals bold; names, paths, sizes and counts in the
default color; base 16 colors only. The roles, by table:

- images: current green (32); stale, unfinished, unused, not built
  yellow (33); DIGEST and KEY dim (2)
- ls: Running green, Stopped yellow, any other status (Broken) red
  (31); GIT on, strict and clone green; NET on green, unenforced red
- space: KEPT only copy and leftover yellow; the total row bold
- doctor: native green, emulated yellow, unreviewed and none red

internal/ui: Table (Header, Row, Total, Break, Flush), Cell and Role
(Plain, Good, Attention, Bad, Secondary), from u.Table(), on stdout and
colored as it is; cli never reads the environment. Table pads each
cell on its plain text before painting it, as text/tabwriter counts
the codes' bytes; a plain table is byte for byte tabwriter's with
padding 2. New's UIs color only when FORCE_COLOR or CLICOLOR_FORCE says
so, which is how cli's tests get a colored one. ui.UI's method max
goes to 43 for Table.

internal/cli: writeImages, writeList, writeSpace and writeFeatures
take a *ui.Table; cell, dim, cellAs and the role functions imageStates,
toolStates, vmStatuses, gitModes, netModes, keptRoles, supportCell.

Tests: TestTableLikeTabwriter (plain and colored, against tabwriter),
TestTableBreak, TestUITable; cli's tables helper renders each table
plain and colored and checks they match without the codes, in
TestWriteListColored, TestWriteImagesColored, TestWriteImagesTools,
TestWriteSpace and TestWriteFeatures, with the expected codes.

Docs: using/settings (Colors: tables); contributing (Messages: Colors:
tables and roles).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 15:57:03 -07:00
w3cjandClaude Opus 5.5 b94c99e226 feat(ui): color errors, warnings, doc links and log text in a terminal
devvm colors the labels and links around its messages with the
terminal's 16 base colors, so the theme picks shades that read on its
background; a message's own text stays in the default foreground.

- Die's devvm: label bold red (1;31), Warn's bold yellow (1;33)
- doc links underlined blue (4;34)
- Info's ==> bold (1)
- DieLogged's log end and its --- lines, and the status line's log
  text, dim (2), each line painted apart
- the done mark green (32)

No bright colors, backgrounds, 256 colors or truecolor, and no
background detection.

Each stream decides apart (colorOn): NO_COLOR or DEVVM_MESSAGES=names
off, then FORCE_COLOR or CLICOLOR_FORCE (but 0) on, then TERM=dumb off,
else only when that stream is a terminal. Names mode stays plain in a
terminal too, so e2e's checks under script read the names unchanged.
The run log and Stdout() data are never colored; no --color flag and no
message text changes.

internal/ui: a style per stream (style.go: paint, paintLines, message,
labelled, fit), made in onTerminal; Die and Warn share labelled. The
status line cuts and counts its plain text (style.fit) before painting,
so it fits and clears at the right width; statusText returns the log
part apart. Codes are added after printable() and msg.Shown.
internal/msg: M.Parts returns the text and the doc link apart, names and
no link in names mode; String joins them as before.

mise run test unsets NO_COLOR, FORCE_COLOR and CLICOLOR_FORCE, and
tests/e2e.sh unsets FORCE_COLOR and CLICOLOR_FORCE, so a user's own
settings don't change what they check.

Tests: TestColorOn (env x terminal), TestMessagesColored (Say, Info,
Note, Warn, Die colored and plain, the link apart), TestNamesModeStaysPlain,
TestDieLoggedColored, TestColoredStatusLineFits, TestDoneMarkGreen;
msg's TestStringAddsDocLink checks Parts.

Docs: using/settings (Colors, the environment table); contributing
(Messages: Colors).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 15:36:13 -07:00
w3cjandClaude Opus 5.5 c3e125814e docs: what devvm keeps names network logs' rotation and the folders made only yours; the CLI reference after the merge
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 13:37:29 -07:00
w3cjandClaude Opus 5.5 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]>
2026-10-31 13:29:49 -07:00
w3cjandClaude Opus 5.5 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]>
2026-10-31 13:08:52 -07:00
w3cjandClaude Opus 5.5 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]>
2026-10-31 12:57:47 -07:00
w3cjandClaude Opus 5.5 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]>
2026-10-31 12:41:57 -07:00
w3cjandClaude Opus 5.5 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]>
2026-10-31 12:36:50 -07:00
w3cjandClaude Opus 5.5 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]>
2026-10-31 12:30:17 -07:00
w3cjandClaude Opus 5.5 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]>
2026-10-31 12:23:35 -07:00
w3cjandClaude Opus 5.5 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]>
2026-10-31 12:21:17 -07:00
w3cjandClaude Opus 5.5 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]>
2026-10-31 12:15:18 -07:00
w3cjandClaude Opus 5.5 fddf1fde36 docs: what devvm keeps on this machine
A new user page, using/space.md, lists everything devvm, its tools and
its backends keep on the host as devvm is today: devvm's data folder
item by item (what it is, whether devvm can make it again, how it's
cleaned up), the shared tools' builds per backend and C library,
exports as the only copy of a deleted VM's history, what a VM deleted
outside devvm leaves, the settings folder, Lima's home and download
cache, smolvm's packs, machines and caches, Docker's labelled
resources, the Keychain, the ssh Include line, the Time Machine
exclusion and the install.

Also fixed: overview's State files table (mise.lock.toml,
mise.lock.checked, oci-build.lock added; bin/ dropped, as nothing in
this devvm writes it; links the new page); images.md's tool image key
(the backend's format) and the share (compressed on Lima and Docker,
uncompressed on smolvm); using/images.md's Shared tools (where the
builds are, one per backend and C library); coding-agents' History
(exports stay until deleted); settings' devvm's state links the page;
the uninstall steps (Docker's labelled volumes and networks, Lima's and
smolvm's caches, exports, the Time Machine exclusion).

Review: each path and claim checked against internal/paths, the
backends (lima delete, smolvm remove, docker Delete, egress buildNet),
internal/tools (mise runs with temp data and cache folders, so mise/
holds only the binary), internal/proxy (CA life 30 days, renewed with
under 7 left), internal/platform (tmutil on ca/ only), and against the
e2e sandboxes' data folders (Lima, smolvm, Docker) and the shapes of
~/.local/share/devvm, ~/Library/Caches/lima and smolvm's caches (list
and du only). smolvm's _pack-storage-seeds are named by the SHA-256 of
a pack's .smolmachine. scan.sh's remaining hits are guarantees, lists
and labels; lint:docs passes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 11:31:22 -07:00
w3cjandClaude Opus 5.5 e77efecb2f docs(internals): the nix-layer row links to the Docker backend page's limits
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 13:29:39 -07:00
w3cjandClaude Opus 5.5 b70742eaf9 feat(images): the nix layer on --from Debian and Alpine
Debian (systemd) needed nothing new: the node:24 (Debian 12) VM's nix layer
installs, runs nix run nixpkgs#hello and builds in Nix's sandbox. Alpine
(OpenRC, musl) is supported: Nix's tarball binaries are static or linked
against its store's glibc, so they run on musl, and its daemon becomes an
OpenRC service of devvm's.

- nix.sh: on Alpine, apk add xz (GNU tar needs it for the tarball; shadow's
  groupadd and useradd are base's), unpinned and said so, as the docker
  layer's Alpine packages are; on OpenRC, /etc/init.d/nix-daemon
  (openrc-run, command_background, its pid in /run/nix-daemon.pid, its log
  in /var/log/nix-daemon.log), added to the default runlevel and started.
  OpenRC reads /etc/conf.d/nix-daemon for it, the file guest/sync.sh writes
  with the VM's proxy under network policy.
- sync.sh: on OpenRC, a changed /etc/conf.d/nix-daemon restarts the service
  with rc-service.
- e2e from: the node:24 VM is node+python+docker+nix+claude (nix-daemon's
  socket active, hello, a sandboxed build); the alpine:3 VM is
  node+docker+nix (the service running, hello, a sandboxed build, no crashed
  services, then devvm network on and restart: /etc/conf.d/nix-daemon has
  the proxy and a fixed-output fetch from a host that isn't allowed gets the
  proxy's 403).
- Docs: using/images (the bases the layer works on), using/from (Alpine's
  unpinned packages, what's tested), internals/images (OpenRC's service,
  xz, musl), contributing.

Review (security-audit skill, guidance mode): the OpenRC service runs the
root-owned default profile's nix-daemon and reads only the root-written
/etc/conf.d/nix-daemon; xz is Alpine's own package from its signed
repositories, unpinned as every Alpine package devvm installs is, and says
so; nothing else changed in what the image or the daemon gets.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 13:20:54 -07:00
w3cjandClaude Opus 5.5 f0d8aea497 feat(smolvm): the nix layer on smolvm; refused on Docker, whose containers can't sandbox Nix's builds
smolvm runs no init system, so the nix layer's daemon starts the way the
docker layer's does: nix.sh starts it when there's no systemd (for a VM it's
added to in place), and assets/container/services.sh starts it after each
start (its pid in /run/nix-daemon.pid, counted only when that process is
nix-daemon). Its settings are /etc/conf.d/nix-daemon, devvm's alone, which
guest/sync.sh writes with the VM's proxy under network policy and removes
when it's off, restarting the daemon when the file changed. nix-layer is
native on smolvm.

Docker stays none, so devvm refuses the layer in one line (backend_lacks)
for a VM or a build. Tested on Docker Desktop with nix-layer let through:
the layer builds and substitutes (nix run nixpkgs#hello works), but every
build fails with "this system does not support the kernel namespaces that
are required for sandboxing", as its containers lack CAP_SYS_ADMIN, and the
layer's sandbox-fallback = false keeps Nix from building unsandboxed
without a word. Supporting it there needs sandbox = false or Sysbox, a
choice left open.

- nix.sh: OpenRC refused in one line for now; with no init system, the
  daemon started with /etc/conf.d/nix-daemon read.
- sync.sh: one block for nix-daemon's proxy, a systemd drop-in or
  /etc/conf.d/nix-daemon.
- Caps: smolvm's nix-layer native; Docker's comment says why it's none.
- e2e: smolvm's nix section (a nix VM with network policy: nix-daemon
  running with the VM's proxy, nix run nixpkgs#hello through it, a build in
  Nix's sandbox, network off and restart giving a daemon without it);
  Docker's base project refuses the nix layer in one line (both engines);
  Lima's nix section gains the sandboxed build. smol_others is exported for
  the last smolvm check, whose bash -c couldn't find it.
- Docs: internals/backends (nix-layer's row), backends (the table, smolvm's
  Nix works, Docker's can't-do list), using/images, internals/images,
  internals/smolvm (no init system), internals/network, contributing.

Review (security-audit skill, guidance mode): /etc/conf.d/nix-daemon is
written by root through sudo in a root-owned folder and holds only the
VM's own proxy URL, so services.sh, running as root, sources only what root
wrote; the pid file is root's and a stale one never makes devvm kill
another process (its comm is checked); the daemon gets no host value. The
Docker refusal keeps every Nix build sandboxed.

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

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

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

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 12:22:02 -07:00
w3cjandClaude Opus 5.5 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]>
2026-10-31 12:49:23 -07:00
w3cjandClaude Opus 5.5 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]>
2026-10-31 12:22:01 -07:00
w3cjandClaude Opus 5.5 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]>
2026-10-31 12:16:48 -07:00
w3cjandClaude Opus 5.5 725a98ed41 fix(export): the exports folder and devvm's CA folder are only the user's, whatever mode they had
The 644 export in a 755 exports folder on the user's machine was made by
the bash devvm (mkdir -p and a redirect under umask 022, files without
macOS's provenance attribute, like bin/, mise/, tools/ and images/ from
the same time). The Go export makes its file with os.CreateTemp (600) but
made the folder with MkdirAll(0o700), which leaves an existing folder's
mode alone. An export into the exports folder now sets it to 700 each
time; a folder of the user's own (devvm export FILE) keeps its mode.
Prepare does the same for the data CA folder, which holds ca.key; logs/,
logs/runs/, run/, the secrets folder and Docker's socket folders already
did.

Review (modes of devvm's data folders): every folder under
~/.local/share/devvm and ~/.config/devvm that holds history, logs, keys
or secrets is 700 after the run that writes into it (exports/, logs/,
logs/runs/, run/, ca/, config secrets/), and their files 600 (exports via
CreateTemp, logs opened 0600 and, with the proxy's rotation, chmodded;
ca.key written 600; state files 600). Left as they are: bin/, mise/,
tools/, images/ and assets/ (binaries, tools mounted read-only into VMs,
image records: no history, logs, keys or secrets) and the data and config
roots themselves.

Tests: TestExport exports into an existing 755 exports folder (700, file
600) and into a 755 folder of the user's (kept); TestPrepare starts with
755 run/, logs/ and ca/ (all 700 after). e2e: rm's export check makes the
exports folder 755 first and checks 700/600 after.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 12:16:31 -07:00
w3cjandClaude Opus 5.5 529e8132c3 fix(netpolicy): Lima's and a Linux engine's build proxies pass names the host can't resolve on to the company proxy
A build's proxy has policy ** alone, so it refused every name this machine
can't resolve, and where only the company proxy resolves outside names,
builds behind it reached nothing by name. devvm _proxy gets
-upstream-unresolved, which sends such names upstream unjudged even when
only ** allows them; a denied name stays refused. Lima's build proxies and
a Linux Docker engine's start with it: without a company proxy those
builds reach internal addresses directly anyway. Docker Desktop's build
proxy starts without it, as its builds are kept off this machine's own
services, which a company proxy on its loopback could reach.

Tests: TestUpstreamUnresolved covers the flag; Lima's build test checks
the build proxy gets it; TestBuildOnDesktop's exact arguments keep it off.
Docs: safety/network.md, using/troubleshooting.md, internals/design.md,
internal/proxy/README.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 10:50:45 -07:00