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

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

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

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

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-16 08:22:47 -07:00
w3cjandClaude Opus 5.5 4d409589bb refactor(redact): every secret's value is a redact.Secret, revealed only where it's used
redact.Secret holds a value that lets whoever has it act as the user or
a VM, behind a pointer, so fmt's raw printing of an unexported field
shows only an address. String, GoString and Format print <redacted> for
every verb; MarshalJSON, UnmarshalJSON and MarshalText return
redact.ErrEncode, so a secret is never silently written as a stand-in
(which would lose a login); there's no LogValue. NewSecret ("" is the
zero Secret), Reveal, Empty and TrimSpace are the rest. internal/redact
joins the proxy's standard-library-only depguard group.

Reveal is refused by forbidigo outside tests; each of the 23 call sites
carries a //nolint:forbidigo saying why, and testdata/lint/forbidigo.go
keeps a call the rule must report. The structure test (checkSecrets)
refuses a struct that embeds redact.Secret outside internal/redact and
an interface that declares Reveal() string.

Typed now: proxy.Config.Password (configFile is the wire type, in
Config's order, held to it by TestConfigFile), the server's password,
proxy.Lookup and the cached values, upstream.auth, upstreamPassword,
Upstream.WithPassword's password; backend.NewProxyPassword, ProxyURL,
Confinement.ProxyPassword, BuildProxy.Password; netpolicy.Key and
NetMade.ProxyKey (netMade wire type); settings.CompanyProxy.Password;
secrets.Store.Value, saved, ProxyPassword, Token, Save, save, Get,
SaveKey, Yours.Save, Claude.Env, saveToken, oauthToken; agentlogin
File.Get, SetKey, ClaudeToken, every format's get, setKey and chatGPT,
refresh's refresh token, capture's access, refresh and id tokens, and
the JWT helpers (a login's map stays the wire, through token and
setToken; piKey is piBound); vm.Net.SecretSave, AgentLoginOptions.Key;
ui.UI.Secret. Strings by design: platform.KeychainGet/Set and the
desktop's VNC password.

Tests: TestSecret (unexported and nested fields too), TestConfigFile,
TestV010ProxyConfigs (0.1.0's proxy.json round-trips byte for byte),
TestFixtureStoreGet saves the Linux secret file back byte for byte,
checkV010Logins (login files read, copied and bound without a change),
secretCases, and e2e netNoLeaks, twice in the network section: every
VM's proxy password and the section's values, also as Basic
credentials, in no run log or proxy log, and the passwords in no
ha.stderr.log or serial log. Docs: Contributing's Secrets in the code,
the owners table, the secrets How it works page, design.md's Where
secret values live.

Fixed, found by netNoLeaks: Lima's boot script 07-etc-environment.sh
runs under set -x, so the console logs (serial*.log) kept the VM's
proxy password; redactLog now stars passwords in them as it does in
ha.stderr.log (CHANGELOG, overview, processes and attack-vectors pages).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-15 19:36:31 -07:00
w3cjandClaude Opus 5.5 02ba74e614 build(lint): stricter linters, and the fixes they need
golangci-lint now also runs govet's nilness, unusedwrite, hostport and
waitgroup analyzers, nilnesserr, durationcheck, canonicalheader,
errchkjson, forcetypeassert, contextcheck and gochecksumtype.

- errchkjson checks each JSON encoding's error where the value could
  fail and drops it where errchkjson proves it can't, and reports
  structs without exported fields; tests may drop theirs.
- forcetypeassert holds the code; tests are exempt.
- gochecksumtype: agentlogin's format is a sum type (//sumtype:decl),
  and a switch on one names every case, default or not.
- canonicalheader: WWW-Authenticate, X-Request-ID, X-Api-Key.
- contextcheck: ctx threaded through carry, peekClientHello and sniOf,
  and through inject and value, whose cached lookup takes
  WithTimeout(WithoutCancel(ctx)), so two forbidigo nolints go;
  openTransparent takes its dialer's ctx. nolints stay where
  contextcheck can't follow: ReverseProxy's Rewrite, WithoutCancel
  alone, cobra's cmd.Context, e2e's runner window.
- No-behaviour fixes: scrubList for redact's list, the loopback
  forward's ports kept with its listeners, upgradetest's Key keeps its
  public key, a CA's leaves read through leafOf.

Contributing's Go lint rules lists each one and the sum-type convention.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-15 00:17:50 -07:00
w3cjandClaude Opus 5.5 90694a414f feat(agent): devvm agent import follows links out of an agent's folder when allowed
A link out of an agent's folder, such as a dotfiles repo's link into
~/.claude, was always left out. Now it's copied when you allow it:
config.toml's follow-links names folders whose links devvm follows
without asking, and otherwise devvm names each link and its target and
asks, a question --follow-links answers. Without a terminal and the
flag, links out are left out with a warning naming --follow-links.

- The store gets copies only: a linked file as a file, a linked folder
  as a folder of files; the next import replaces them, a folder that
  became a file included, and prunes them once the link is gone.
- Each link is resolved one name at a time (linkHops), then read through
  its allowed folder as a safefile.Root opened one folder at a time from
  / (openPhysical); a link inside is read only to a file in that root.
- Always refused: the home folder or a folder holding it, devvm's config,
  data and Lima folders, ~/.ssh, ~/.gnupg, ~/.aws, ~/Library/Keychains,
  ~/.config/devvm, ~/.netrc, ~/.config/gh, ~/.docker, ~/.kube, and every
  agent's logins and history, compared by name and identity (isIn); a
  follow-links folder in or holding one fails the import.
- A target in a VM's project folder warns, naming the VM; a chain through
  a link in a VM's folder to a place outside it is refused.
- Bounds: devvm agent save's, 20,000 entries, 128 MiB and 16 MiB a file,
  across one import.
- A settings file must link to a file and a settings folder to a folder.

Messages: agent_import_link_not_followed, agent_import_link_refused,
agent_import_link_too_big, agent_import_follow, agent_import_link,
agent_import_link_followed, agent_import_link_project,
agent_import_link_via_vm, agent_import_root_refused,
follow_links_invalid.

Tests: TestAgentImportFollowsLinks, TestAgentImportNestedLinks,
TestAgentImportRefusedPlaces, TestAgentImportRefusedRoots,
TestAgentImportProjectFolderLinks, TestAgentImportLinkThroughProject,
TestAgentImportRefusedOtherCase, TestAgentImportLinkBounds,
TestLinkSourceGrown, TestAgentImportLinkKinds, TestAgentImportLinkPrune,
TestAgentImportLinkedAgentFolder, TestLinkHops, TestOpenPhysical,
TestFollowLinks; testscript agent_import_links; e2e project section.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-12 20:47:48 -07:00
2f0cc97392 feat(paste): devvm paste and devvm paste rm (#38)
feat(paste): devvm paste, an image, PDF or copied file from the clipboard into the VM (#38)

devvm paste reads the host's clipboard and streams what's on it into the
running VM's paste folder over the backend's Exec, with no SSH agent and no
new channel, then copies the file's path in the VM to the host clipboard for
the agent's prompt. devvm paste rm empties the folder after a question, and
a launch that starts a stopped VM offers to.

What it reads:
- an image (PNG, JPEG, GIF, WebP; TIFF is converted to PNG), checked by its
  bytes; browsers hand over a PNG, so an animated GIF arrives as one frame
- PDF data, sent as it is, and preferred over a file reference beside it
  (Preview's page copies)
- one copied file, after a question that shows its path on this machine;
  --send-file answers it only for a file inside the project folder reached
  without links, and never for a --clone VM
- never text; several files are refused

Security:
- macOS reads file URLs only through NSPasteboard (FileURLsOnly): AppleScript's
  «class furl» coercion turned any text, such as a path a web page or the
  VM's OSC 52 put there, into a file to send
- copied files are opened with openat and O_NOFOLLOW|O_NOCTTY|O_NONBLOCK,
  following a root-owned link only in a folder only root can change, and read
  through internal/safefile (Checked), capped at 64 MiB
- osascript and pbcopy by absolute path, Linux's tools only from system
  folders, never PATH
- time limits on every clipboard tool and on paste.sh in the VM; bounded
  reads of everything the VM prints
- the path copied back is built on the host, keeping only the file's
  extension: nothing the VM says reaches the clipboard

Also: the paste-dir setting (default /tmp/devvm-paste, made at each
launch), --json with sent, the agents' guide line, messages with doc links,
stubs, CLI tests, an e2e check in the project section, and docs on
coding-agents, settings, design, security and attack-vectors.

Co-authored-by: dustypolk <[email protected]>
Co-authored-by: w3cj <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-11 22:29:46 -07:00
w3cjandClaude Opus 5.5 647ad4bf2a feat(network): transparent mode for tools that ignore the proxy settings
On every confined tier, a tool that ignores the proxy settings (workerd
under wrangler dev, a static Go binary, a container made through Docker's
API) reaches the VM's proxy by the names it looks up. In the VM, dnsmasq
answers every name with the stand-in address 198.18.0.1 and has no
upstream; nftables sends that address's ports 80, 443 and those the allow
rules name to socat listeners on it, which make each an authenticated
CONNECT transparent.devvm.proxy:PORT to the VM's proxy. The proxy reads the
host from the connection's first bytes (TLS SNI, or each HTTP request's
Host) and judges it as CONNECT host:PORT, with the same order of checks,
log, secrets and floor. A blocked HTTPS host gets the 403 over a
certificate from the VM's CA. Nothing new runs on the host, and the
backends don't change.

Proxy (internal/proxy):
- transparent.go: TransparentHost, ProxyDomain, SentinelAddr,
  IsSentinelAddr, ViaDNS, transparent (serve, take, tls, handler,
  refusePage, ports), sniHost, replay, reservedRefusal, withVia, viaOf.
- routeFor and route: the one order of checks for CONNECT and the
  transparent path; carry, the one tunnel with its SNI check; block split
  into the record and blockPage; links.refuse split (isLinkDomain);
  caEndedRefusal's test moved to routeFor; handshake and serveOne shared
  by intercept and the 403 page.
- devvm.proxy reserved whole, CONNECT devvm.proxy:P included; the stand-in
  address refused with its own reason.
- Hosts and SNI in ASCII alone, never folded (the Kelvin sign), in
  splitHostPort, sniMatches and sniHost.
- A ClientHello record past 16 KiB + 256 is never read; once it starts,
  a ClientHello must arrive whole within 10 s, on every tunnel; a stream
  whose first byte is 0x16 is TLS from then on, so a record header that
  doesn't come whole, or isn't TLS's version, is refused, never passed on
  unchecked; and only a ClientHello that parsed (sniOf) counts, so one
  split across records is refused, an address's tunnel's included, which
  may have no name (a gap older than this change).
- routeFor carries the method and path rules: a host they narrow is
  refused where it can't be decrypted and intercepted where it can, on
  the transparent path too.
- On the transparent HTTP path, devvm.proxy answers /blocked alone.
- policy.transparentPorts and /transparent/ports: 80, 443, then the ports
  allow rules name for hosts by name, at most 32, never 22 or 53.
- Event.Via ("dns"), shown in devvm network log, /blocked and the prompt's
  note as "without proxy settings".

Guest (assets/): base.sh installs dnsmasq(-base), socat and nftables;
guest/transparent.sh is devvm-transparent: setup and teardown from
sync.sh (the proxy URL on stdin), the supervisor service (systemd or
OpenRC), the ruleset (render: two filter chains at -150 keep every
interface but lo and Docker's bridges, and every protocol but TCP, UDP
and ICMP, off the stand-in address; both NAT chains at -110 map every port of
the stand-in address, so Docker's published ports never take one; DNS to
public servers and 127.0.0.1:53 go to dnsmasq, which listens on the
stand-in address alone; private, link-local, CGNAT and loopback servers
are left alone, but the VM's own name servers, which Lima's DHCP adds
beside 127.0.0.1 and Docker gives containers, go to dnsmasq too), slots,
the port list's check, and status for devvm-why. Names without a dot and
names under the search domains (this machine's network's, through Lima)
don't resolve.

Setting: config.toml's transparent-proxy, and devvm network transparent
[on|off], the VM's own value in net.transparent (Settings.Transparent,
SetTransparent; netpolicy.TransparentOf, TransparentAddr); the setup gets
DEVVM_TRANSPARENT_ADDR while the VM runs confined and its mode is on.
devvm network --json has transparent; devvm network lock lists apart the
hosts only tools without proxy settings reached (Learned.NoProxy, via in
--json). vmssh.dialAddr refuses the stand-in address.

Tests: the transparent path's unit tests and FuzzTransparent; the
setting, TransparentOf, FormatEvent's via and learned hosts; the ruleset,
slots and port list under bash 3.2; network_transparent.txtar and
sync.txtar; e2e: transparentRuns, the network section's checks, a docker
step, the from section's Debian 12 and Alpine on the allowlist tier, and
the guarantee checks run with transparent mode stopped and running.

Docs: safety/network.md (tools that ignore the proxy, what isn't
covered, the setting, logs, lock), internals/network.md (tools that skip
the proxy), internals/design.md (the design note and threat check),
using/settings.md, using/troubleshooting.md, using/limits.md,
using/images.md, safety/attack-vectors.md, internals/lima.md,
contributing/tests.md and testing.md, the proxy's README, the CLI
reference and the Commands page.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-09 07:18:53 -07:00
w3cjandClaude Opus 5.5 2865158e02 feat(network): learn the hosts a new VM needs, then lock it to them (#22)
--network learn runs a VM on the internet tier while it records the hosts
it reaches beyond its allowlist, shown as internet (learning). devvm
network lock picks which of them go into the VM's own rules, ticking only
reviewed registries on 443 and listing risky hosts apart, then gives the
VM the allowlist tier at once. learn is per VM only. The lock command
names its docs page in its about.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-08 10:05:59 -07:00
w3cjandClaude Opus 5.5 fb19879aaa fix(msg): one rule for which characters reach the terminal
msg.Safe is the one owner: a graphic character in any script is safe;
controls, bidi controls, format characters, variation selectors, private
use and the invisible fillers are not. Printable and OneLine drop what
Safe refuses, agent save's diff escapes it, and forbidigo bans
unicode.IsGraphic, IsPrint, IsControl and Bidi_Control outside
internal/msg.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-08 10:04:59 -07:00
w3cjandClaude Opus 5.5 77d2b202ab fix(agents): opencode's unknown providers' keys withheld by default, as pi's (#30)
opencode gets the rule pi got: an entry of its auth.json that devvm
neither binds nor passes reaches the VM's copy with only the fields
that name its account, with the login_withheld warning, which says to
list the provider under opencode in config.toml's [pass-keys]. A listed
provider's api entry goes whole, metadata included (login_passed), and
opencode 2's import brings every API key the copy holds into its
database. A bound API key's entry is {type, key: placeholder} alone, its
metadata kept on the host. pi's allowlist becomes withheldEntry and
withheldKeep, which both agents share; login_oauth_withheld goes.

A user with a local server's key in opencode sees it withheld after
upgrading, and the launch warning names the provider.

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

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

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

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

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-07 19:16:35 -07:00
w3cjandClaude Opus 5.5 8d44175601 refactor: the Go module is github.com/devvmhq/devvm
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-06 06:16:29 -07:00
w3cjandClaude Opus 5.5 b045eff522 feat(cli): say at a launch in a terminal when a newer devvm release is out
A launch in a terminal checks at most once a day for devvm's newest
release, with upgrade's Source.Check in the background (5 s at most, the
launch waiting at most 1 s more once it's done), and records what it
found in the data folder's cache/release.json (latest, checked, tried;
an offline try keeps what was known, silently). The next launch says
upgrade_available in one line when that release is newer. Nothing
without a terminal, with --no-input, for a source build or for a copy
neither install.sh nor Homebrew installed. Off with config.toml's
release-check = false or DEVVM_NO_RELEASE_CHECK=1. devvm doctor shows
the newest release known (doctor_latest_release, --json's release).

- upgrade: Known, ReadKnown, Due, Newer, Source.Refresh
- settings: ReleaseCheck, KeyReleaseCheck (strict bool)
- paths: Dirs.ReleaseCheck (Dirs' limit 58)
- cli: releaseNotice in up; doctor's Release
- tests: release_notice.txtar, TestKnown, TestRefresh, TestReleaseCheck;
  the CLI tests set DEVVM_NO_RELEASE_CHECK=1 by default
- docs: settings (the release check), install, troubleshooting

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-05 23:22:34 -07:00
w3cjandClaude Opus 5.5 7a26d80a17 feat(settings): the network setting for new VMs is a tier, allowlist by default
The ask setting is gone: a new VM's summary shows its tier (--network,
else the saved tier, else allowlist) and customizing it asks for the
tier, with Enter keeping the one shown, so ask added nothing.

- settings.NetworkChoices is the tiers alone; settings.NetworkDefault
  (allowlist) replaces NetworkAsk, checked against netpolicy.TierDefault.
- chooseNet takes --network, then the saved tier; customize asks for the
  tier whenever --network didn't give it (netpolicy.Proxy.Choose takes
  the tier shown, and net_tier_unknown names it).
- devvm network -g ask and devvm setup's ask choice are gone; ask is a
  usage error (arg_not_choice). net_ask_global and network_default_ask
  removed.
- A saved "ask" in config.toml or settings.json is refused like any
  value that isn't a tier.
- Docs: safety/network, using/settings, using/images, getting-started
  commands and first-vm, the cli skill, devvm network's and up's help.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-05 19:01:03 -07:00
w3cjandClaude Opus 5.5 3a2c290d3d refactor(msg): messages and comments say network tier and the VM's proxy, not network policy
Every VM runs a proxy and is on one of four tiers, so the proxy's messages
name the VM's proxy, the unenforced ones its network tier, and the
redaction ones say devvm keeps secrets on this machine on every tier.
Message IDs are unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-05 17:16:40 -07:00
w3cjandClaude Opus 5.5 fcbab78670 refactor(secrets): one path for secrets, placeholders on every tier
Every VM gets its CA, its proxy setup and placeholders, whatever its
tier, so even an open VM never holds a real secret: a request that goes
around its proxy carries only the placeholder.

- vm/sync.go: the open branches of stage go (the agents' logins copied
  as they are, the ClaudeCopy for unconfined VMs and its MCP warning,
  real values in ~/.config/devvm/env); stageNet is stageSecrets, run
  for every VM, and the salt is every VM's.
- netpolicy: Prepare readies the CAs, salt and secret files on every
  tier, and the proxy config carries the CAs and bindings on every tier;
  dropCA and its caller are gone, so a VM keeps its CAs as its tier
  changes.
- Removed without a caller left: the messages secret_unuse_copied,
  net_on_old_tokens and claude_mcp_secrets_copied;
  secrets.Store.ClaudeCopy and MCPSecrets; agentlogin.MCPSecrets,
  claudeSecrets and argsHoldSecrets; settings.CompanyProxy.ConfigOnly.
- Tests: TestPrepareOpen (open has CAs, salt, secrets; CAs kept across
  tiers), TestInterceptOpen (an open proxy puts secrets in, 421 for
  another host), TestStageSecretsEveryTier (every tier's setup sends
  the VM's CAs, the guard against a tier's own path); sync, ca, network
  and secret scripts for open VMs.
- e2e: network checks that an open VM holds no real secret (its proxy
  puts the token in over TLS the VM verifies, a direct request carries
  only the placeholder and gets a 401); project checks an open VM's
  placeholder, and its company-CA checks allow for the VM's own CAs in
  /etc/ssl/devvm.pem.
- Docs: safety/network (tiers, secrets), internals/network, the design
  note's tiers threat check, attack vectors, coding agents, first VM,
  staying safe, contributing; devvm secret's help.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-05 15:55:21 -07:00
w3cjandClaude Opus 5.5 ceda0bf925 feat(cli): --network TIER, devvm network TIER and the tier question
The command line names the four network tiers. --network TIER (open,
internet, allowlist or none) chooses a new VM's tier, checked before
anything runs (arg_not_choice). devvm network open|internet|allowlist|none
gives the folder's VM a tier through Net.SetTier, and devvm network -g
takes the tiers and ask. config.toml's and settings.json's network is ask
or a tier (settings.NetworkChoices, checked against netpolicy.TierNames
by a test, since settings can't import netpolicy).

The question on creation is Proxy.Choose(vm): net_about says what each
tier reaches, net_ask asks for one (Answer, AnsweredBy("--network")),
Enter or a refusal gives allowlist, and an answer that isn't a tier is
warned of (net_tier_unknown) and asked again. devvm setup's picker
offers ask and the four tiers (network_default_open, _internet,
_allowlist, _none). On an existing VM, --network is ignored with the
devvm network TIER command that changes it.

devvm network --json: policy is the tier or unenforced, and each policy
file whose denies alone apply (internet and none) has denies_only: true,
as the text output's "(denies only)", so a script can tell a file's
denies from all of its rules without knowing the tier rules.

Messages reworded: net_tier_backend (--network open), net_open_policy
(devvm network allowlist), net_about, net_ask, network_default*,
net_default_failed, network_failed, setting_already's and
widen_parent_vm*'s descriptions. safety/network's "Choosing a tier"
replaces its on/off section; docs, the cli skill, testscripts and e2e
use the new forms, and e2e's internet and none checks go through devvm
network.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-05 15:54:43 -07:00
w3cjandClaude Opus 5.5 0941219a76 feat(build): base's packages recorded per key, replayed from a host cache
base's apt packages are no longer pinned by a snapshot. A key's first
build of base records them: assets/layers/apt.sh (a recipe step, as
root, before base.sh and after the last feature) points the image's
sources at an apt mirror+file: list of config.toml's ubuntu-mirror and
then Ubuntu's own archive, so apt checks everything against the archive
key whichever server answers, and keeps what it downloads. At the end it
gives back each package with apt's entry for it. devvm checks what comes
back (regular files only, each named by its own SHA-256, each entry
matching a file's size and SHA-256, nothing left over, at most 20,000
entries and 16 GiB), keeps the files in
~/.local/share/devvm/packages/<sha256>.deb and the key's set in
packages/sets/<key>.json, before the image's record. Every later build of
that key replays the set from the cache, checked on the host first, with
apt given only those files: no network for base's packages, and a key's
packages never change. A --from base keeps its image's own sources,
unpinned. base keeps no package lists, so each layer's recipe starts
with apt.sh lists, which fetches them when there are none.

- backend.ImageSpec.Packages (Send before the steps, Take after) and
  backend.PackagesDir; Lima runs both over limactl shell as root.
- Fail fast: apt.sh turns apt's retries off and exits 75 when no source
  answers, which Lima reports as build_sources_unreachable.
- packages_missing refuses a replay whose cached file is gone or changed;
  packages_refused what a build gives back that isn't packages.
- config.toml's ubuntu-mirror (settings.UbuntuMirror), checked as an
  http(s) address without a user, query or spaces (ubuntu_mirror_invalid).
- devvm gc deletes the sets of keys neither current nor built, then,
  under the cache's lock, the files no set names at that moment, and
  builds' leftover folders over a day old (gc_packages,
  deleted_packages); devvm space lists the cache.
- The snapshot is gone from base.sh, guest/sync.sh and desktop.sh, and
  scripts/bump.sh's apt step with it.
- Tests: recording then replaying, a missing or changed cached file,
  every refusal of what comes back, gc's view of the cache and its race
  with a new set, the set record, the mirror setting, Lima's exchange and
  exit 75, apt.sh's mirrored and record functions, apt.sh in the keys;
  the limactl stub keeps what's sent and gives back
  $STUB_DIR/packages-out.tar.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-04 11:58:23 -07:00
w3cjandClaude Opus 5.5 cde6601655 test(settings): record that host mise takes config.toml's percent-encoded proxy password
CompanyProxy.Env puts config.toml's proxy password into HTTPS_PROXY and
HTTP_PROXY percent-encoded (url.UserPassword). Checked live on Fedora
against squid with basic auth (basic_ncsa_auth), using devvm's actual
Env output from a test binary and the pinned mise 2026.10.7 installing
jq: a password of p@ss:w/rd #1% and a plain one both authenticated
(TCP_TUNNEL/200 under the user's name in squid's access log), and a
wrong one got 407. So mise (reqwest) decodes the password before it
sends Proxy-Authorization, and devvm needs no change.

TestCompanyProxyEnvEncodesPassword pins the encoded URL for such a
password and that it parses back to itself; network.md's company-proxy
section says the characters work.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-04 07:17:04 -07:00
w3cjandClaude Opus 5.5 ed70aeae3b feat(netpolicy): config.toml's company proxy reaches devvm's own downloads and builds' checks, and VMs without policy warn
config.toml's [proxy] covers the places it missed:

- devvm's own requests on this machine (the download of its mise, Ubuntu's
  cloud image listing, --from's registries) go through it when the
  environment sets no proxy. settings.CompanyProxy.Route is their
  transport's proxy: at the first request it looks up the proxy secret,
  puts it in each URL that names a user, and routes each request as a VM's
  proxy does (proxy.Upstream.WithPassword, proxy.Upstream.Route, reusing
  the proxy's NO_PROXY matching). A missing password fails the request
  with fetch.ErrProxy, which isn't retried; HostMise shows its message.
- The mise devvm runs on this machine gets HTTPS_PROXY, HTTP_PROXY and
  NO_PROXY in its environment (settings.CompanyProxy.Env), with the
  password in the URL, as mise takes it nowhere else; never in its
  arguments or a file. With the environment's proxy it adds nothing.
- devvm build, rebuild, the remakes' builds and tool builds check the
  company proxy and its saved password before anything starts
  (build.Builds' checkProxy, tools.Share.Build), through the one check a
  new VM and a VM's proxy use: settings.CompanyProxy.Upstream, which
  netpolicy.Proxy.Upstream now calls. secrets.Store.ProxyPassword owns
  the proxy_password_missing mapping.
- A VM without network policy never gets config.toml's proxy, as the
  guest would need the password, which never leaves this machine; each
  start of one while config.toml is the only proxy warns
  (proxy_needs_policy), naming devvm network on or the shell's
  HTTPS_PROXY, with a doc link.

Wiring: tools.Env.Proxy (its Password set by cli and vm from devvm's
secrets), from.NewLookup/NewRegistry/NewPublicRegistry take the proxy,
lima.New and registry.New take a *settings.CompanyProxy for Ubuntu's
listing. internal/fetch stays standard library only.

- Tests: TestUpstreamWithPassword, TestUpstreamRoute,
  TestUpstreamRouteAuthorizes, TestCompanyProxy,
  TestCompanyProxyPasswordMissing, TestProxyPassword,
  TestHostMiseThroughCompanyProxy, TestMiseCmdCompanyProxy,
  TestBuildChecksCompanyProxy (tools and build), TestRegistryThroughProxy,
  TestUbuntuThroughCompanyProxy, TestTransient's ErrProxy, and
  company_proxy.txtar's build, rebuild and no-policy cases.
- Docs: network policy's Behind a company proxy and Without network
  policy, config.toml's [proxy], How it works' Through a company proxy.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-04 01:42:37 -07:00
w3cjandClaude Opus 5.5 2304f26bf0 feat(netpolicy): config.toml sets the company proxy, and a start warns when its proxy loses one
config.toml's [proxy] table (https, http, no-proxy) is the company proxy that
VMs' proxies and builds go through when devvm's environment sets neither
HTTPS_PROXY nor HTTP_PROXY; the environment's settings win whole, never mixed
with config.toml's. Each value is checked as config.toml is read
(backend.CheckProxyURL, backend.CheckNoProxy), and a URL holding a password is
refused (proxy_password_in_config): config.toml is copied between machines
and kept with dotfiles.

The password is the host-only secret proxy (devvm secret set proxy, in the
Keychain or devvm's secrets folder). A URL that names a user gets
upstream.secret in the proxy's config, and the proxy looks the value up
through IO.Secret as it starts (upstreamPassword), so no file of devvm's holds
it. No VM is ever bound to it: devvm secret use refuses (secret_host_only) and
secrets.Names drops it. A new VM and a VM's proxy refuse to start while it
isn't saved (proxy_password_missing, netpolicy.Proxy.Upstream).

A start whose VM's proxy last ran with an upstream and now has none warns
(upstream_proxy_gone), naming config.toml, with a doc link.

- settings.HostProxy: the environment's, else config.toml's; used by
  netpolicy, Lima's build proxy (buildUpstream) and devvm doctor's CA hint.
- proxy.Upstream.Secret, proxy.UpstreamSecret; secrets.Secret.HostOnly;
  secrets.Token keeps spaces inside the proxy password.
- Messages: proxy_password_in_config, proxy_password_missing,
  upstream_proxy_gone, secret_host_only, proxy_password_howto,
  password_prompt (answered by --stdin).
- Tests: TestHostProxy, TestUpstreamSecret, TestPrepareUpstreamConfig,
  TestBuildUpstreamConfig, config.toml refusals, the warning in
  TestPrepareUpstream, company_proxy.txtar, secret.txtar and ca.txtar cases.
- Docs: troubleshooting's Behind a company proxy, network policy's Behind a
  company proxy and secrets, config.toml's reference, How it works.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-04 01:10:36 -07:00
w3cjandClaude Opus 5.5 ae0fd533fc refactor(msg): names mode is the UI's, read once with each stream's style
A msg.M always renders as its text: String, Error, Parts and Segments no
longer read DEVVM_MESSAGES, and Line is gone. internal/ui reads names mode
in newStyle, with each stream's color, and shows messages as names through
the style (message, segments, line, valueParts). ui.New takes the function
it reads the environment with, so tests make a names-mode UI without
t.Setenv. Messages shown as data go through UI.Text or Table.Text (doctor
--json, ls's image cell, setup's network choices); vm.PickRow.Desc is a
msg.M that cli renders. A config.toml value's refusal keeps its message
(state.CorruptError.Msg, Shown), so fail shows its names in names mode.

Tests: ui TestNamesMode; state TestFiles covers Msg and Shown; Go tests
compare NamesOf or Names, and drop t.Setenv("DEVVM_MESSAGES") outside ui,
msg's TestNames and the testscript runner. The structure test lists
DEVVM_MESSAGES in internal/ui/style.go only; ui.UI's method limit is 47
(Text).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 17:01:47 -07:00
w3cjandClaude Opus 5.5 9f9dfbf89d feat(setup): devvm setup chooses the layers every new VM gets
devvm setup chooses default layers, as it chooses new VMs' coding
agents: settings' layers key (config.toml's layers = [...], or
settings.json's, saved by devvm setup), bottom first, each name checked
as a layer's (not base or a shared tool's).

- devvm setup --layers LIST|none saves them without asking; a name that
  isn't a layer is a usage error with a did-you-mean, and config.toml's
  are refused (set_in_config). In a terminal, setup asks for them last,
  after the agents (layers_help), with each layer's description.
- A new VM's picker checks setup's layers under Layers ("from devvm
  setup"), and they keep their order at the bottom of the image, with
  what's added on top. Without a terminal a new VM gets them; --layers
  replaces them and --layers none gives none. A devcontainer.json's
  layers go on top.
- A default layer whose script is gone is skipped with a warning
  (default_layer_gone); one the backend can't run fails before anything
  is built, naming the layer and both ways out (default_layer_lacks).
- pick_setup_agent becomes pick_from_setup, for agents and layers;
  desktop_no_layer names devvm setup --layers too.

Code: settings.KeyLayers, Defaults.Layers, checkLayers, layerKind;
vm.LayersChoice (Set, Ask), creation.addSetupLayers,
requireSetupLayers, inOrder; cli addLayersFlag, setup's --layers and its
completion.

Tests: TestReadConfig, TestConfigRefused, TestPrecedence,
TestReadSaved; TestLayersChoice, TestUpParts (setup's layers, --layers
replacing them, --layers none, a gone layer), TestUpSetupLayerLacks,
TestUpPicker (setup's layers checked, their order kept); TestSetupLayers,
TestSetupAsks, TestSetupConfigSets; setup.txtar (--layers, none, unknown
names, a new VM getting them, --layers and --layers none replacing them,
a gone layer warned, config.toml's layers refused and given to a new VM).

Docs: settings (config.toml's layers key, devvm setup's fifth question
and flag, Layers for new VMs), images (what a new VM gets), customizing,
desktop, commands, first VM; the CLI reference.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 14:57:53 -07:00
w3cjandClaude Opus 5.5 79b3ef94d4 refactor(cli): one backend: no --backend flag, no BACKEND column
devvm runs every VM on Lima, so the command line has no backend choice:

- --backend is gone from devvm, build, rebuild, images, images rm, gc,
  space, doctor and setup (addBackendFlag, addBackendFilterFlag, setup's
  own, checkFlagValue's case, its completion); a removed flag now fails
  as an unknown flag (exit 2).
- devvm setup no longer asks for or saves a default backend; config.toml
  and settings.json have no backend key (settings.KeyBackend, Values and
  Defaults' Backend, checkBackend, Value.With, Source.File, FromFlag).
- Tables lose BACKEND: ls, images (both tables), space (both tables);
  doctor's FEATURE table is FEATURE and SUPPORT for Lima. space's images
  row is freed by images rm.
- --json keeps every backend field (ls, images, tool records, space,
  doctor's backend, backend_source "built-in" and every backend's
  features).
- The registry keeps Lookup, For and Default: For(d, vm) gives a VM its
  recorded backend and a new VM NewVMs, else Default; tests set NewVMs.
  vm.Env's lookups lose the flag parameter, found.flagIgnored and
  Options.Backend.
- Messages removed: backend_unknown, backend_unknown_default,
  default_backend, backend_help, doctor_backend_from,
  backend_flag_ignored; backend_unknown_vm stays (a VM's recorded
  backend), linked to backends#a-vms-backend.
- Docs: Backends' choosing section becomes "A VM's backend"; settings,
  setup, images, gc, space, doctor, commands and install pages lose
  --backend and BACKEND; Contributing gains "How a backend plugs in".
- Tests: unit tests for For, settings, setup, doctor's table, the
  tables; CLI scripts check --backend as an unknown flag on devvm,
  build, restart, images, gc, space, doctor and setup, and a config.toml
  backend key as unknown; e2e's table checks lose the column.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 12:46:28 -07:00
w3cjandClaude Opus 5.5 f4fd373439 refactor(backend): remove the smolvm backend
Lima is devvm's only backend. The backend architecture stays (Backend,
Caps, Features, Review/Require, the registry, backendtest.Fake), so
another backend is an addition.

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

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

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

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

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

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

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

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

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 10:26:07 -07:00
w3cjandClaude Opus 5.5 dd3f0deb3f feat(state): config.toml and settings.json hold the defaults, and devvm's own files move to the data folder
~/.config/devvm/config.toml is the defaults you write by hand: backend,
network, ports, features, agents, [size] cpus/memory/disk and
[retention]'s six keys. devvm reads it and never writes it, strictly: an
unknown key (toml.MetaData.Undecoded, its line found by key) or a value
its check refuses (ParseCPUs, ParseGiB, ParsePorts, ask/on/off, a
backend's name, image.FeatureName, image.Agents, ParseDuration,
ParseSize, counts) fails naming the file and the line.
~/.local/share/devvm/settings.json holds what devvm setup, size -g,
ports -g, network -g and retention save (unknown fields ignored).

internal/settings owns both: Defaults (Value and List, each with its
Source: flag, config.toml, settings.json or built-in), Read, Save, which
refuses a key config.toml sets (set_in_config, with a doc link), and
the parsers and retention settings that moved from vm and state. A flag
wins over config.toml, config.toml over settings.json, settings.json
over the built-in default. Settings methods lose their files; setup
uses vm.NetworkChoice instead of its own copy; creation.plan reads one
snapshot (firstRun) after the first-run questions; the registry gets
the default backend through DefaultBackend; state's featureName copy
goes with base-features.

devvm size -g, ports -g, network -g and retention show each value's
source after a #, and in --json (source, sources); devvm doctor names
the file that sets its backend (doctor_backend_from) and adds
backend_source. devvm setup skips what config.toml answers
(setup_in_config) and refuses a flag that would change it.

ssh_config (and so the ~/.ssh/config Include line), known_hosts,
agent-keys.json and secrets/ move to the data folder. agent-keys.json is
{"keys": [{file, fingerprint, confirm, lifetime}]}, parsed once
(AddedKey); Keys formats KeyList.

Tests: settings' table tests (every key, unknown keys, bad values, an
empty file, precedence, Save's refusal and merge, settings.json's
fields), agent-keys.json, the registry's default backend, setup with
config.toml, SizeChoice with config.toml; CLI scripts for size -g,
ports -g, network -g, retention, setup and doctor's sources, each
refusal, a hand-edited config.toml with a typo, and ssh -G resolving
devvm-web through the Include line. Docs: settings.md's config.toml
section with a full example, linked from each command's page.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 07:56:29 -07:00