mirror of
https://github.com/devvmhq/devvm.git
synced 2026-12-01 06:23:17 -10:00
main
53
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
dd46dd7a0f |
feat(tools): tool images build side by side
A first run built its tool images one after another, each paying a build VM's boot (5.7 s on vz, 9.3 s on QEMU) before a download of a few seconds to a minute. Share.Build now hands the images out to up to four slots (buildAll), each slot's builds one after another in a build VM of its own: - slots: as many as the host's memory, less what the backend's running VMs have, and its CPUs give a build VM of 2 GiB and 2 CPUs each after keeping 6 GiB and 2 CPUs, at most backend.MaxToolSlots (4) and the number of images; one alone keeps base's size. A backend that can't list its VMs builds one at a time. A running VM's memory counts whole (7.5 GiB, not 7): TestBuildSlotsFit's running VMs fail when it isn't counted or is truncated. - plan lowers the slots until the backend's disks have room: Floors.ForTools counts Tools once for each build VM at once, as on a disk without copy on write each is a whole copy of base. - backend.ToolsSpec gets Slot, Slots, Size and Hold; Lima's slot VMs are the constants ToolsVM to ToolsVM4, sized with --cpus/--memory, and the first slot's build deletes what a killed run left in the slots this run doesn't use. Builds hold the share's lock, so one devvm uses the slots. - A failed build's VM goes in the run's cleanup, which runs after the build let go of the share's lock: it deletes the VM only once it has the lock again (ToolsSpec.Hold, Env.holdShare's TryLockFile), and leaves it while another devvm holds it (a build, gc or the daily refresh) (TestBuildToolsCleanupHolds, TestBuildHoldsShareForCleanup). The next tools build deletes what it finds in the slots, and so does devvm gc, which holds the share's lock: backend.Images' DeleteToolsLeft, Lima's deleting the slots' build VMs that are there and no other VM, which gc asks of every backend first, without asking, a backend that can't being a run log line. It returns what it deleted, which gc names in one line (tools_build_vms_deleted), and gc then never says nothing_to_clean or nothing_deleted (gc_tools_build.txtar, TestDeleteToolsLeft in lima and vm, the fake's ToolsLeft). The cli skill's judgment.md names this exception to "gc --force deletes exactly what gc lists". The conformance suite's delete-tools-left checks that it deletes no other VM, not even the project VM of a folder named tools (devvm-tools-<hash>), and no image (TestConformanceFinds: deletesAllVMs, deletesImage, deletesByPrefix). The share's lock is the data folder's, so devvms with their own data folders and one Lima home don't exclude each other's builds: the docs say not to build tools or run gc in two at once (a lock per build VM in the Lima home would close it, but it would replace Hold and needs e2e). - Side by side, one status line covers the builds (building_tools_together), and their commands' lines in the run log are tagged with their tool (msg.WithLogTag): the UI's LoggedCmd prefixes them and shows no status line of its own. Every write starts with the tag, as does every line in it, one ended by "\r" included, so no build can pass a line off as another's (TestTaggedWrites), and a tool's lines are found after another's "\r" (taggedLines splits there, a progress bar's updates staying one line: TestTaggedLines). The first failure cancels the others and is what Build returns, tagged (backend.LoggedIn), so ErrorLogged shows that tool's lines' end. - A test build's DEVVM_TOOL_SLOTS caps the slots; the CLI tests set 1, so the stub's calls keep their order, and tools_side_by_side.txtar sets 3, with an interrupt that leaves no build VM. The stub keeps each build VM's folder by its name, and the fake backend's BuildTools runs its builds outside its lock, as a real backend's would, passing ToolsBuild its context. Docs: images.md's Building tools and Free space, ports-size.md, space.md, images.md (using) and gc's help (the build VMs gc deletes), settings.md (one Lima home for two data folders), extending.md, testing.md and tests.md; the cli skill's judgment.md; the CHANGELOG's first highlight and the release page's A faster first run. New messages: building_tools_together, tools_build_vms_deleted. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
2b176c92b3 |
feat(ui): every slow step shows a status line, and messages and questions never land on it
Any work that can take noticeable time now runs under the UI's status line: a Reporter's Status with a label message, or a LoggedCmd step. The UI: - status lines are a stack: a Status or LoggedCmd inside another shows its own line, then the outer one is drawn again, where before it ended the outer one for good - a message (Info, Warn, Note, Say, data on Stdout/Stderr) clears the line, prints and draws it again below; an unended line holds it - a question (Ask, Confirm, Answer, Secret), the picker and ui.Terminal hold it until they're done - no status line starts once the run is interrupted, as nothing would clear it - the run log's path is read without the log's lock, as the status line reads it under outMu Covered, by site and label: - finder.target: finding_vm; Lima's limactl --version: checking_backend - bringUp's checks (seeds, instance, recordFolder, hostChecks, ssh, requirements) and a running VM's go-on (proxy, pins, mount check): checking_vm; startOnce after the agent: starting; the self-check's probes: checking_network; pinHostKeys: reading_host_keys - setUpVM (sync, ssh config, links, clone seed): setting_up_vm; each devcontainer command: running_script; makeMachine: creating; buildOnce: checking_image; paste's count and rm: reading_pasted - volumeOf's lookup (diskutil), for launch, adopt, move, ls and rm: looking_up_volume - vm.ListAll (devvm ls): reading_vms; devvm doctor's checks: doctor_checking - devvm agent import: agent_import_reading (walk, links, opencode), agent_store_saving (copy, marketplace git checks, tmutil); devvm agent save: agent_save_reading, agent_save_comparing, agent_store_saving - devvm stop (from its pins check on): checking_vm; a delete, an orphan's teardown and Lima's DeleteImage: deleting; devvm git-protect and clone on/off's .git work (leftBehind, mountFolder, unmountFolder): git_protecting; git-protect's re-read: finding_vm - devvm clone add: clone_reading, clone_adding; clone fetch: clone_fetching; planClone: clone_planning; the clone check before rm or a remake: clone_checking; history export and import: history_exporting, history_importing; a remake's home: saving_home, restoring_home - devvm upgrade's install: upgrade_installing; the shared tools' step back and .NET's downloads: resolving_tools; gc's caches: reading_space; the retention settings (daily and in gc): retaining Work that takes the terminal stays off: the shell, ssh-add's passphrase (checkAgent, Agent.Ensure, reloadAgent) and an agent's login. Tests and guard: - msg.Fake: OnStatus and Showing; its LoggedCmd shows its step - backendtest.Fake: OnCall - TestLaunchStatusLines: every backend call of a new, running and stopped VM's launch runs under a status line but the shell's and Running's (pid files) - TestSSHAddOffStatusLine: ssh-add, on the user's agent or devvm's, never runs under one; chflagsCalls fails a .git lock or unlock with none - the structure test's status-lines rule (statusSites, statusFree) - TestStatusLinesNest, TestMessagesClearTheStatusLine, TestQuestionsHoldTheStatusLine, TestSecretAndPickerHoldTheStatusLine, TestTerminalHoldsTheStatusLine, TestNoStatusLineOnceInterrupted, TestFakeStatus, TestAgentImportStatus, TestAgentSaveStatus, TestDoctorReport, TestProblems, TestList, TestListLooksUpVolumesOnce, TestVolumeOfCache, TestWithSDKDownloads, TestRetainStatus, TestSetCloneOn, TestTeardownLeavesNothing The rule is written in the cli skill (rule 14, checklist, review), the codebase-standards skill (Show what devvm waits for, its checklist line and rules.md's row), Contributing's CLI page (Status lines), its tests and structure pages, and the troubleshooting page. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
3101c85260 |
fix(vm): a failed agent import leaves the store as it was; the import's bounds count every entry and cap a file; a login's terminal is put back
devvm agent import wrote each settings file into the store as it read it, so a file that failed to read partway (changed since it was listed, or past the bounds) left the store half replaced. The import now reads and writes every agent's settings into a staging folder of the agent's store first (.devvm-import-<random>, beside the agent's folder, so no VM mounts it), and only once all of them are staged, and the run isn't interrupted, moves each file into place, prunes what the home folder no longer has and then saves the logins. A failure or an interrupt while staging leaves the store as it was: the staging folder goes, through discard, or through a cleanup for an interrupted run, which reaches it by a root of its own. A failure after that (a rename, a login) can still leave the store partly replaced, which internals/agents.md says. A killed import's leftover staging folder counts as nothing of the agent's (inStore), so it never makes the import ask, and the next import of that agent takes it out first (sweepStages). The import's bounds on an agent's own folder now match devvm agent save's: the walk counts every entry it meets, links, sockets and FIFOs included, not only the folders and files it keeps, and a file of more than 16 MiB, as listed or as read, fails the import as the 128 MiB does. Claude Code's plugin records are copied with the store's longer paths, and what the copy grows counts against the same bounds (hostAgent.grew), naming the folder, or the link a file came through, so the store never gets more than the import checked. The two handles on an agent's folder, the os.Root it lists through and the folder opened one folder at a time that it reads through, are checked to be one folder (sameFolder), failing the import otherwise. A VM state the import can't read is a warning (agent_import_states_unread), naming the file, rather than silently dropping that VM from the project-inside warnings and the link checks; the follower takes the VMs the import read at its start instead of reading them again. state.WriteFileIn and writeFileMode share one tail (finishTemp). clearKind takes the root the import opened once, rather than opening the store for every path, and pruneStore's walk is pruneIn, which the import calls on the same root. Cursor's changing verbs (proxy's cursorChanges), checked again against the 1,463 methods of DashboardService, AutomationsService and BackgroundComposerService in 2026.11.17-f532c45, read and not run. generate goes: it matched only GenerateGrokCollectionDescription, which only returns a draft, and GenerateTeamGrokBotScimIdpSigningKey, which cursorCredential refuses anyway; no other method changes between refused and passed. test stays, justified in its comment: it matches TestAutomationFilter, a dry run that only reads, but also TestTeamCustomerTelemetryDestinationConnection, which has Cursor's servers send a request with any headers to any address. park, hand, decline, replace and resend match only methods that cursorCredential refuses too (as rotate, link and invite do), and stay, justified in the comment, for the methods Cursor adds. Every cursorRoutes path the CLI's login goes to is checked against the proxy by agentlogin's TestCursorCapture (proxy can't import agentlogin, which imports it); TestCursorChangingVerbs now says so. devvm agent login on a terminal saves the terminal's state before the login (ui.Terminal, through vm.Env.Terminal, which now returns a restore) and puts it back once the login and endLogin are done, or in a UI cleanup if the run ends first, so an ssh that a signal killed in raw mode doesn't leave the host terminal raw. Tests that fail without their fix: TestAgentImportFailsWhole (a failed import leaves the store's own files and no staging folder), TestAgentImportTooMuch (rewritten: its dead want field gone; exactly 20,000 entries and 128 MiB list whole, one more entry or byte fails, a link and a FIFO count, a file of 16 MiB and a byte fails), TestAgentImportPluginsGrow, TestSameFolder (the helper, and the import with its folder swapped between the two opens), TestAgentImportStageLeftover, TestAgentImportInterrupted (the ctx check before apply, and the interrupt cleanup on its own), TestAgentImportProjectInside (beside a broken state), TestCursorChangingVerbs (GenerateGrokCollectionDescription passes), TestAgentLoginTerminal (put back once, after the login ended, interrupted included), TestTerminalRestores. Tests that pin what already held: TestNarrowNotesBesideBroken (devvm network's -g allowlists beside a VM state that can't be read), TestWriteFileIn (a failed rename leaves no temporary file), and TestCursorChangingVerbs' TestTeamCustomerTelemetryDestinationConnection. The finder now checks fst with found, so nilaway no longer reports fst's flow, and all of fst's lines in its baseline go. Docs: using/coding-agents.md, internals/agents.md, internals/network.md; CHANGELOG. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
6965efcc0a |
fix(vm): devvm agent login claude --setup-token shows Claude Code's address (#57)
An agent's login in the VM ran with devvm's own writers as its output, so os/exec gave limactl shell pipes, Lima added no ssh -t, and claude setup-token, which draws full-screen, showed nothing and waited. When devvm's stdin and stdout are terminals and both output streams are files, the login now gets stdout and stderr as the files they are (ui.Terminal, set by cli as vm.Env.Terminal), so Lima gives it a terminal in the VM, as devvm's shell has. Without a terminal it keeps pipes, and --setup-token warns first (setup_token_no_terminal). Its output reaches devvm's output alone, never the run log, as before. On a terminal, Ctrl-C goes to the login in the VM, which ends, and devvm says the login ended or saved nothing. - internal/ui: Terminal, over Files, never a half pair; TestTerminal. - internal/vm: Env.Terminal; AgentLogin.loginOpts; the warning; why an interrupted login's cleanup stays as endLogin's backstop; endLogin's comment for a login on a terminal; TestAgentLoginTerminal (fails without the fix). - internal/backend: ExecOpts says a terminal's files pass on as they are; Lima's TestExecStreamsAsGiven. - internal/cli: vmEnv sets Terminal; agent_login.txtar checks the warning. - locales/en.toml, internal/msg: setup_token_no_terminal. - tests/e2e: OnTTY, out of TTYRun; network's check that devvm agent login claude --setup-token on a terminal shows the address, waiting for its devvm to end before the next login. - Docs: internals/network.md, using/coding-agents.md, contributing/extending.md and tests.md; CHANGELOG Fixed. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
aeea3135b2 |
feat(proxy): the proxy's broker and its child
A VM's proxy runs as two processes, as design.md's "The proxy's broker"
says: devvm _proxy, the broker, which keeps what only the host should
do, and devvm _proxy-child, which reads the VM's network and can be
confined by the follow-ups.
- wire.go: the protocol over one socketpair (close-on-exec from the
start: SOCK_CLOEXEC on Linux, ForkLock elsewhere), length-prefixed JSON
frames of at most 2 MiB, unknown fields refused, bytes as base64, one
descriptor on a frame's first bytes (SCM_RIGHTS, MSG_CTRUNC breaks the
rules), wire types for every secret (redact.Secret at once).
- broker.go: newBroker, the start (handshake: version 1 and each side's
executable's SHA-256, within 4 s), the answers (value through lookups,
kept 30 s or 5 min, a failure 5 s, dropped when the bindings change;
file by number; link connected by the broker and passed as a
descriptor; token exchanged by the broker), each by something in its
own config, with caps 1/8/4/256; live: the lifeline closes the socket
and kills the child 6 s later, SIGTERM stops it within a second, a
child that ends ends the broker, a rule broken stops the child.
- child.go: the start (startOf), the child's server (newChildServer),
the broker as hostSide over the socket (brokerClient), runChildOn;
ready only after it reads the host's addresses (kept: the last good
read), roots and time zone loaded first.
- process.go: Main(ctx, ...) and ChildMain; the child spawned with
/proc/self/exe on Linux, PR_SET_PDEATHSIG from a locked thread
(daemon.Cmd.DieWithThread), descriptors 3 and 4, and TZ, SSL_CERT_*
and GODEBUG with updatemaxprocs=0 alone; run/proxy-child.pid and
run/proxy.confined ("none" until the follow-ups); KeepLogs in the
broker. ChildMain refuses to start unless descriptors 3 and 4 are a
unix socket and an IP one (checkInherited): run by hand, without
them, those numbers can be the Go runtime's own, which closing
crashed it (signal_recv: inconsistent state).
- capture.go: a captured token request goes to the broker
(captureToken, exchanger), so a login's real tokens never enter the
child; an error reply passes up to 1 MiB, longer gets 502.
- watched.go: the child stats each changing file and asks the broker
for it once it changed, keeping the stamp of what the broker read.
- rotate.go: proxy.log rotated by both through its descriptor, under a
lock of a description of its own; OpenLog opens a log never through a
link, one link, yours, replacing what a child left in its place.
- nixcache.go: the trim and its count through a safefile.Root, nar/
only as a folder, links deleted as themselves; reads never through a
link; the lock tried for 5 s (ErrNixLocked, nix_cache_locked).
- daemon: Cmd.Err, Files, Env, DieWithThread; Handle.Kill, Exit;
WritePID.
- netpolicy: Proxy.Stop also stops a child that outlived its broker
(run/proxy-child.pid, _proxy-child -for); proxy.log opened with
OpenLog; a refused launch keeps a running VM only while both run.
devvm network log and lock read the event log through safefile.
- vm, vmssh, vmlog: links.log and ports.log opened with OpenLog, read
through safefile, trimmed only as a regular file with one link.
- backend: the build proxy's logs in a logs/ folder of their own.
- cli: _proxy-child; _proxy waits for its child on a signal
(StopsItsOwn); the child reads none of devvm's folders (no
makePrivate); ui.Files.
- Tests: FuzzBrokerFrames, the frames' rules, the handshake and the
pair's end in synctest bubbles, the caps, the broker naming its own
alone, the client over a real socketpair with a passed descriptor,
ChildMain, TestInheritedSocket and proxy.txtar's child run by hand,
the frozen 0.1.0 configs starting a broker and child,
two writers rotating once, planted links, FIFOs and hard links; the
testscript runner stops _proxy-child too; e2e: broker and child, their
arguments, descriptors and environment, stop, SIGKILL either, planted
files in the logs folder and the Nix cache, build proxies gone.
- Review fixes: the lifeline closes the socket and starts the kill's
timer before logging; every log lock (proxy.log's, the event log's
rotation) is tried without blocking for 200 ms (flockWithin, which the
Nix lock shares), then written without or the rotation skipped; a
copied log's rotation streams at most twice its limit from a line's
start (copyFrom, copyAtomic); a reply too long to send goes as
too_long; kept token headers capped at 1 KiB; the child gives up on a
request whose context ended, dropping its late reply and holding its
slot until then; a write deadline on the start frame; errors reach the
child as codes (not_found, refused, busy, too_long, failed), their
text in the broker's log; FuzzFrameStreams, and FuzzBrokerFrames
writes from a goroutine; nix_cache_locked links to How it works.
- Docs: processes, network, overview, design (with threat rows for the
logs' locks and a log made huge), troubleshooting, the proxy's
README, structure, testing; CHANGELOG.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
||
|
|
9c74dac11e |
fix(logs): a VM's logs are held to their caps while it runs
internal/vmlog owns every log a VM can drive but the proxy's own: Limit (moved from vmssh's logLimit, with Allow for the link session's warnings), Capped and Trim for ports.log and links.log while they run, and KeepVM, which the VM's proxy (proxy.IO.KeepLogs, Config.VMLogs from backend.Run.Logs) and a Lima build run on the serial consoles' and the hostagent's logs: redacted as they grow (redact.FileFrom), so a reboot in place can't leave the proxy password there, and rotated past 10 MiB, counting what a log holds past the hole its writer left (platform.DataStart). The proxy's http.Server logs through its own limited log, and its copied log counts what reached it as stderr; the build proxy's log is held as a VM's proxy's is. git-pins.jsonl has a cap. Run logs take at most 256 MiB together, never the newest or a live run's. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
90a64a44d1 |
fix(races): lock order checked, sandboxes' own ports, pins that meet a rename, daemons' groups stopped
- state: test builds and tests check the state locks' order (state.held, CheckLockOrder): a second VM's lock, a VM's lock under the claims lock, or a lock taken again panics before waiting. - platform: PinBeneath opens the path again when a rename takes the file away before move_mount (ENOENT), so the keeper no longer reports a false lost pin (TestPinsInNamespace's 'f lost / f pinned-again'); TestPinWhileRenamed. - daemon: Proc.Stop signals the process group (SignalGroup), so forwarders' and link sessions' ssh masters and relays end with them; ui.UI.StopsItsOwn makes _ports and _links wait for their ssh on an outside SIGTERM. - vm: gc --orphans and devvm space count forwarders' leftover control sockets (vmssh.ControlGlob). - CLI tests: each sandbox claims a block of ports below devvm's range and the ephemeral range (claimPortBlock, /tmp/devvm-test-ports); free_port, the fixtures' ports and DEVVM_SSH_PORTS come from it, and the sandbox's devvm chooses from its own range (DEVVM_PORT_RANGE override). Fixtures' forwarded ports and settings ports are rewritten too (FIXTURE_PORT_<port>). - netpolicy and vm tests: the fake proxy's stop waits for its reap, and fake daemons run until the test ends, not 30 s. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
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]>
|
||
|
|
cc94465400 |
test(leaktest): goroutine leak checks, and the leaks they found
A new internal/leaktest, standard library only, so the proxy's and the daemon's tests use it too (depguard's proxy rule allows it, and the structure test holds it to tests and to importing nothing of devvm's): - leaktest.Main(m), in TestMain: once the tests pass, every goroutine's stack (runtime.Stack), a settle of 5 s, then a failure naming those still running, but the standard library's own that outlive every test (allowed: signal.Notify's loop, an HTTP client's idle connections); then Go 1.27's goroutineleak profile, which fails on any goroutine blocked for good. - leaktest.Check(t), first in a test: its own goroutines, followed by parent through those still running, and by which ran before it, never by ID (each thread takes a batch of IDs). Main runs in proxy, vmssh, daemon, desktop, ui, vm, backend/lima, platform, cli and gitprotect (main_test.go, or the TestMain they had). Check runs in TestLinksEndStuckRelays (replacing its NumGoroutine count), TestForwarder, the desktop relay's serve helper, TestRunChild, TestPinWaits, and the proxy's new close tests. The structure test's goroutines rule (internal/structure/goroutines_test.go): goroutineSites lists every function outside tests that starts a goroutine, with a go statement, a wait group's Go, or time's or context's AfterFunc, function literals in package-level vars included, as "file: Func", with its waiter, or "detached: " and why nothing waits. A new one fails until listed, a listed one that starts none fails, and a package that starts one fails until its tests call leaktest.Main. Leaks it found, each fixed with a test: - The proxy's close left its connections running: http.Server's Close neither closes a connection a handler took (a CONNECT's tunnel, a WebSocket upgrade ReverseProxy takes) nor waits for a handler. conns (conns.go) holds every connection the listener accepted (track) and counts every handler (handle); serve calls closeConns once Serve returns, which closes them, closes any accepted after, and waits up to 5 s for the handlers. splice also ends when its client's connection can't be read (closed, reset), rather than half-closing the far end and waiting on it; a failed write to the server (one that answered early and closed) still lets its answer through. Tests: TestCloseConns (a tunnel and an upgrade), TestConnectAfterClose, TestSpliceEndsWhenItsClientCloses, TestSpliceKeepsAnEarlyAnswer; the tests' listen closes as the proxy does, and the fake upstream closes its target once its client's end comes. - platform's runChild left its signal-passing goroutine blocked on a channel signal.Stop never closes; it now closes it and waits (TestRunChild). - platform's WaitExit and WatchFolders blocked in poll(2) and read(2), which closing their fd from the stop doesn't wake on every kernel (Debian's didn't), and a retried call could land on a reused fd. They now wait in Go's poller (pollable), which the stop wakes (TestPinWaits, with a wait stopped before its process ends). Docs: Contributing's tests page (Goroutine leaks), the structure page (the goroutines rule, goroutineSites, the layers, the packages), the Go lint rules' depguard line, the proxy's shutdown in How it works' processes page and the proxy's README, and AGENTS.md. Coverage baselines: internal/leaktest's line on both systems, netpolicy's raise on macOS. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
5c8aeafcbc |
test: gosec's G703 off in test files, where it reports a helper's write on some runs only
gosec's taint analysis reported internal/gitprotect's test helper write
(G703) on some runs and not others, which failed macOS CI's lint at
|
||
|
|
ab125b1af6 |
fix(lima): tidy the remount restart's failure paths
A review of the remount restart found its failure paths loose: - A restart whose limactl stop failed returned the plain message, and the caller then stopped the VM's proxy with the VM still running. Now a folder still mounted with the old mode is warned of and the VM goes on with its proxy, and anything else fails as a logged stop_failed, saying the VM didn't stop. - The interrupt's cleanup was dropped before the restart's stop, so a Ctrl+C during that stop could leave an open-tier VM running. It now stays until any stop in remountProject returns. - The start again repeated the first start's warnings (policy lines, pins, a degraded start). The UI now says each warning once a run, by its name and values, which covers every package's warnings without a flag through each of them. - mount_cache_unmounted and mount_cache_unchecked come only after the restart failed, so they no longer say to run devvm restart: they say the VM is stopped and its console log may say why. mount_cache_remount_failed says the old mode can lose writes and what may hold the folder. Their doc links stay on "When the cache mode changes", which now points to the console log. - The mountinfo check's comments and docs say why it's used (portable: any awk, no util-linux tool but mountpoint), not that Alpine lacks findmnt, which devvm's base layer installs there. - design.md: the stop that fails, the warnings said once, the cleanup through the stop, and the older race of another devvm starting the VM in the gap, which fails closed. Tests: TestRemountRestartStop (the cleanup held through the stop; a stop that fails, mounted or not), TestRemountRestartConfined (each start's undoStart, an interrupt between the starts: one start, the proxy stopped, the one undo kept; a start again whose proxy fails), TestWarnOnce, and mount_cache.txtar's allowlist restart warning of a bad policy line once. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HTFcPrY8FzzQMopN5wgpLQ |
||
|
|
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]> |
||
|
|
8d44175601 |
refactor: the Go module is github.com/devvmhq/devvm
Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
8e851cddf4 |
feat(ui): devvm's logo atop the root help, the first run and each new VM's summary
The logo prints from the UI alone (ui.UI.Logo, msg.Reporter's Logo), once a run, only with stdout a terminal (or a test build's PickOnPipe), not with --no-input, --json or names mode; its mark green, plain under NO_COLOR. The CLI reference's pages don't get it: only the root's help func prints it. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
d94929523d |
feat(vm): a new VM shows a summary, then asks whether to customize it
Before devvm makes a new VM it shows a summary of what the VM gets: each toolchain, coding agent and layer with why (the file that calls for it, devvm setup, config.toml or the flag that gave it), its size, network tier and ports, and the devcontainer.json it's made as. Where the picker shows (CanPick) and something is left to choose, it asks "Customize it? [y/N]": Enter makes the VM as shown; y opens the picker (a part a flag gave greyed out), then the network tier question when no tier is given or saved, then the VM's CPUs and memory (for this VM alone). Without a terminal or with --no-input the summary ends with the flags that choose others. The summary replaces new_vm_gets and devcontainer_using. devvm's first run asks its size and agents first, as before, then shows the summary. A test build's DEVVM_PICK_ON_PIPE shows the picker with a terminal on stdin alone, so testscript's ttyin reaches it (up_customize.txtar). Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
14c4fe935a |
fix(ui): an answer after Ctrl+C is refused, and an interrupt doesn't wait at a question
A question's answer read once the run is interrupted is its refusal, so an answer typed in the moment after Ctrl+C never lets a deleting command go ahead. An interrupt no longer waits returnGrace for a command that waits at a question: its read doesn't end at Ctrl+C (the UI counts the questions waiting, asking). One message for a failed export that keeps the VM: export_failed_kept (command, vm) replaces remake_export_failed, rm_export_failed and rm_vm_export_failed; devvm rm VM's case gets a CLI test. no_terminal_delete and no_terminal_fetch no longer say there's no terminal, as --no-input and the end of the input refuse them too; no_input says to use its answer; --force's help names --no-input. Tests: TestAnswerAfterInterrupt, TestSignalsDontWaitForAQuestion, rm_vm.txtar's failed export. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
d58b24affe |
refactor(ui): prompts in one place: each question declares its answer
Every question is a msg.Question that declares what answers it where
devvm can't ask: AnsweredBy("--force") names a flag or command, which the
refusal names (no_input), and RefusedWith(msg.X(...)) gives a question no
flag answers its own refusal. msg.AnswerFor and its table go.
The Reporter's Ask, Confirm and Answer, and the UI's Secret, take a
Question and return a *msg.Refusal where they can't ask: with --no-input,
without a terminal, or at the end of the input, one refusal for all three
causes. Commands return it through the failure path (showFailure ->
UI.Refused: the question, then the refusal); nothing dies on an unanswered
question any more. Questions with a usual answer fall back on it instead:
network policy on, restart no, history import later, the Include line
warned, an unenforced VM stopped, the first run's size kept.
Gone: confirmed() in cli (4 callers), force_needed and no_input_terminal,
vm.Env.CanAsk and ui.CanAsk, vm's interactive, setup's terminal, the
Reporter's StdinIsTerminal/StdoutIsTerminal and the Fake's StdoutTerminal,
and every caller's terminal check (18 in vm, netpolicy, build and
sshconfig; 3 CanAsk; 1 interactive; 2 in cli). The picker's check
(CanPick) stays in the picker, which keeps its choices with --no-input
too; setup and the first run's agents and the new-VM summary still read
CanPick, because what they save or say depends on whether the picker
showed.
A Question's About context (the network policy's, a secret's howto, the
restart's changes, the size's host) is said only when it's asked.
devvm update asks before its tools change, so a refusal leaves the VM as
it is.
The CLI tests answer through a terminal (ttyin) or, explicitly, with a
test build's DEVVM_PIPED_ANSWERS=1, a line of input each.
Tests: ui's TestConfirm, TestAsk, TestAnswer, TestPromptsOnlyAtATerminal,
TestSecret, TestNoInput, TestNoTerminal, TestNoAnswer, TestPipedAnswers,
TestRefusedInterrupted, TestPickNoInput; msg's TestQuestionRefused,
TestQuestionAbout; cli's agreement test TestQuestionsDeclareAnswers (every
AnsweredBy names devvm's flags and commands, every RefusedWith a message,
no Question made otherwise) and TestCheckAnswer; vm's
TestSizeChoiceRefused; testscript prompts.txtar (each cause, a refusal of
its own, piped answers).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
||
|
|
7bdaf8e99e |
refactor: one Reporter for every package's messages and prompts
msg.Reporter is what every package below cli prints and asks through: Info, Say, Note, Warn, Status, Ask, Confirm, Answer, the terminal checks and CanPick, the run log (LogNote, LogWriter, LoggedCmd, WithSteps), Stdout, Stderr, AddCleanup and Interrupted, under the UI's signatures. *ui.UI implements it (a compile-time check in ui), and msg.Fake is the tests': quiet as its zero value, its On funcs and fields record and answer. The six UI interfaces (tools, netpolicy, lima, registry, sshagent, vm) are gone, and the copied output and prompt func fields of tools.Env, tools.Making, gitprotect.Protector, secrets.Store, netpolicy.Proxy, from.Lookup, backend.Review, lima.Lima, sshagent.Agent, vm.Env, vm.SizeChoice, vm.AgentsChoice, vm.LayersChoice, vm.NetworkChoice, vmssh.Forwards, build.Env and sshconfig.Config: each embeds the Reporter. Lima's and the shared tools' Warn, which says where the run log is too, is a method of their own over it; vm's interactive check is a function over it. The pickers (build.Env.Pick, vm.Env's PickFeatures and PickParts, the choices' Pick) and vm.Env.CanAsk stay fields: they carry types of their own or cli's answer. The test UIs of tools, netpolicy, lima, registry, build and vm become msg.Fake. Coverage baselines raised: internal/backend/lima, internal/msg, internal/tools. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
ca8a91305b |
fix(ui): one failure path, and an interrupt's cleanups wait for the command
Commands fail by returning: RunE returns the error, as failed(err, what) when it may not be a message (replacing fail and the direct Die calls in cli), and a.env returns its failure. checkLayout returns its error from the root's PersistentPreRunE. execute alone prints a failure (showFailure): a backend.LoggedError with the run log's end (ui.ErrorLogged, which replaces DieLogged), a message as it is, else what failed or output_failed, with a corrupt file's message as names mode shows it. Exit codes stay 0, 1, 2, 130. Die is now the UI's own die, for where no command can return: a question without an answer, a run log that can't be opened. Error prints nothing once the run is interrupted. After INT, TERM or HUP, Main waited only for the logged command and then ran the cleanups while the command's own code still ran. It now also waits for the command to return, up to returnGrace (2 s), when there are cleanups to run; a run without cleanups ends at once, so the proxy and the other background processes still stop as soon as they are told to. A start's undoStart stays registered once interrupted (interruptCleanup), as the cleanups now run after the start returned. Tests: TestSignalsWaitForTheCommandBeforeTheCleanups (failed on the old ordering), TestSignalsWaitForAStuckCommandAWhile, TestSignalsWithoutCleanupsEndAtOnce, TestExecuteShowsEachFailure; DieLogged's tests are ErrorLogged's. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
e6f64dae31 |
refactor(vm): one VM inventory per run
vm.Inventory (internal/vm/inventory.go) holds each project VM's state, backend and Instance, read in one place: ReadStates for the states alone, ReadInventory (UsedBackends or AllBackends) for the backends' lists too, each within the host's list wait (30 s), with the backend's Check saying why a list failed. It replaces Env.mounts, recordedVMs, vm.List and vm.ToolsInUse, linkstate's clientStates listing, the secret list's, Leftovers.Find's (and backendVMs), cli/space.go's two (backendRows' list, vmFolders), images' state.Backends and sshconfig's running list: sshconfig.Write takes the inventory's Running VMs. state.ReadAll reads each VM folder on its own (only the inventory calls it, a structure-test callers rule); state.Backends and Registry.Used go. One failure policy: - a backend that can't list fails a listing (Inventory.Err) only when some VM's state names it: devvm ls and the ssh config fail, and the ssh config stays as it was rather than lose that backend's entries; space and gc --orphans name it and leave its VMs alone; - an unreadable vm.json is its own row: ls lists the VM with its name and status alone and warns (vm_state_unreadable); links, the secret list, rm VM and link targets leave it out; gc --orphans never takes it for an orphan; ToolsInUse and Mounts (images, gc, space, the SSH agent's mounted-key check) fail on it, naming the file; - FolderOf is bounded (5 s): a folder on a hung share is there. Mounts come from the states alone, stopped VMs and agents' folders included, so the mounted-key check asks no backend. ui.Table shows every cell through msg.OneLine, so ls's cells can't move the cursor or break a row. Docs: internals/overview's listing, troubleshooting's file devvm can't read, ssh's mounted keys, contributing's owners table. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
9c1af22910 |
fix(redact): find proxy passwords without a scheme and passwords split mid-line
redact.String takes the password out of a proxy URL without a scheme (user:password@host:port), which needs the port and a user that starts a word, so emails, mailto: links and ssh targets stay as they are. redact.Split says where a writer may end part of a line: after its last space or tab, at most 4 KiB before its end, never inside a secret. The run log's redacting writer uses it when a line passes 64 KiB and at a logged command's start (flushPart), and holds the rest for the next write, so a password split there is still found; DieLogged and the run's end write it all. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
12d1a84149 |
fix(redact): proxy passwords stay out of Lima's hostagent log and guest commands' output
Lima's hostagent logs a proxy variable's value, password and all, as it starts a VM (Lima's cidata setupEnv: a loopback proxy pointed at the guest's gateway, an override of the system's value, or a value it can't parse), into <lima home>/<vm>/ha.stderr.log. For a VM without network policy that's the shell's HTTPS_PROXY. devvm's run log already redacted the copy limactl start prints; Lima's own file kept it. Start now redacts that file once limactl start ends, started or failed: each password becomes as many "*", in place. Lima creates the file with os.Create (no O_APPEND) and the hostagent keeps writing at its own offset, so the file keeps its length and every other byte, and Lima goes on where it was. Keeping the password out of the hostagent's environment would keep it out of the guest too (Lima writes the guest's /etc/environment from it), so apt and curl there couldn't use the company proxy. A file devvm can't change warns (lima_log_unredacted). Output written through UI.LogWriter() (guest commands: a VM's setup, the home folder's copy, devcontainer.json's commands) now goes through the run's one redacting writer, flushed at a logged command's start, at DieLogged and at the run's end. The patterns and both redactions have one owner, internal/redact (stdlib leaf): String, the run log's (moved from ui's redact), and File. - redact.String, redact.File; ui: LogWriter's redacting, flushLog; lima: redactLog; message lima_log_unredacted. - Tests: TestLogWriterRedacts (fails without the fix), TestStartRedactsTheHostagentLog, TestString, TestFile; e2e's network section restarts its VM without network policy behind the run's loopback company proxy, its fake password read from a file: the guest has and uses the proxy, the run logs hold <password> only and ha.stderr.log stars only. - Docs: troubleshooting's run log, network policy's Without network policy, Contributing's layers and e2e network section. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
c12fadd036 |
fix(ui): the run log keeps URL passwords out of commands' output
Lima's hostagent logs a proxy variable's value, password and all, when it replaces a loopback proxy's address with the guest's gateway, overrides the system's or lima.yaml's value, or can't parse it (Lima's pkg/cidata setupEnv), and limactl start passes those lines on to its stderr. For a VM without network policy, Start gives limactl the shell's proxy variables, so a password in the shell's HTTPS_PROXY could land in devvm's run log. LoggedCmd's output now goes to the run log through a redacting writer: whole lines (ended by \n or \r, or 64 KiB), each redacted, so a password split across writes is still found, the rest written once the command ends. redact, which the command's + line already took, also replaces the password of any URL's user info with <password>, besides the proxy keys' <key>. limactl.go's comment says when Lima logs the values. - ui: urlPassword, redacting, redactLineMax. - Tests: TestURLPasswordsStayOutOfTheLog (a Lima-like line, the URL in the command's environment, never its arguments), TestRedactingWriter; network.txtar and e2e's network check expect Lima's password stand-in as devvm:<password>@ in the run log. - Docs: troubleshooting's run log, network policy's Without network policy. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
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]>
|
||
|
|
aab5272a4b |
feat(vm): offer to delete and make again a VM whose creation didn't finish
In a terminal without --no-input, devvm asks remake_unfinished ([y/N]); yes deletes the VM as devvm rm does (Lifecycle.delete, teardown) and makes it as for a folder without one. Without a terminal, with --no-input, on no or for a parent folder's VM, vm_unfinished stays. Adds ui.CanAsk (a function, keeping UI within its methods) and Env.CanAsk, set by cli; AnswerFor names devvm rm, then devvm. vm_unfinished's doc link points at troubleshooting's new entry. Tests: TestRemakeUnfinished, TestCanAsk; existing.txtar covers --no-input, no and yes (delete, clone, start in order). Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
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]> |
||
|
|
a134e0d8a6 |
feat(cli): choose a new VM's toolchains, agents and layers in a picker or with --tools, --agents and --layers
devvm takes no IMAGE word any more than any other: in a terminal a new VM's toolchains, coding agents and layers are checked in one picker, under three headings, before the network-policy question; --tools, --agents and --layers (each an exact list, or none) skip it, and a part left out takes its default: the detected toolchains, devvm setup's agents, no layers (a devcontainer.json's features still count). Without a terminal, or with --no-input, the VM gets the defaults and new_vm_gets says so in one line. devvm setup --agents (and its first-run question) chooses new VMs' agents. devvm tools in a terminal opens the same picker for the VM, its layers fixed, and turns the changes into tools add and rm. An image is base and layers only: tools are the VM's tool_names state key. build, rebuild and images rm refuse a shared tool (tool_not_layer), and devvm build builds no tool images. devvm ls gains a TOOLS column and --json tools. gc's --tools is --tool-images, so --tools has one meaning. Gone: image.Reserved, checkWord's image half (devvm WORD is no_command or no_command_like, did-you-mean over commands, msg.Closest), the lacks path in internal/vm/existing.go, and the messages vm_lacks_tools, vm_lacks_layer, layer_is_command, layer_name_command, no_image_for, no_command_or_image*, tools_not_images, tools_not_images_rm, detected, vm_is_now (vm_tools_now), secret_with_image (secret_with_claude). New: ui.Pick takes headed sections with fixed rows, ui.CanPick, vm.PickPart/PickRow/AgentsChoice/CheckPart (internal/vm/parts.go), state.KeyToolNames, state.ReadAgents/WriteAgents, paths.Dirs.Agents, project.DetectFiles. Image keys are unchanged in form: images never held tools; docker.sh's and nix.sh's comments changed, so those layers rebuild. Docs: the home page's quick start steps, diagram (sandbox.svg), cards and FAQ; README; getting started; using (images' What a new VM gets, coding agents' Running an agent, settings' agents); internals; contributing; the cli skill; AGENTS.md. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
f2a8ddd404 |
refactor: write every file whole through state, and make private folders with state.PrivateDir
internal/state is the one writer of whole files outside the proxy: state.WriteFileMode joins state.WriteFile for another mode (0700 for the QEMU wrapper and Docker's copies of devvm's Linux build), and state.PrivateDir makes a folder the user's alone (700), refusing a file or a symbolic link there, as vmssh's runDir did. - Deleted: both writeOwn (backend's build proxy, Docker's egress), lima's writeFile (the Seatbelt profile, the QEMU wrapper, the start record), vmssh's writeWhole and runDir, Docker's copyFile, the Linux build fetch's temporary file (fetch.Open's body is read whole, its SHA-256 checked, then written with state.WriteFileMode), and Resolve's .tmp-and-rename loop. The host's mise stays fetch.Download's. - os.WriteFile to state.WriteFile: tools (Resolve's and lockVersions' mise.toml, the checked file, the tools build's files), sshagent (two), ubuntu's checksum files, docgen's pages and backendtest's fake tool images. - state.PrivateDir for nine MkdirAll and Chmod pairs (eleven folders): the run log's two, tools' logs, secrets, netpolicy's CA, run, logs and socket folder, lima's run folder and the exports folder. MakePrivate and ~/.ssh keep following a link: where they live is the user's choice. - The proxy's writers are one, writeAtomic: the login files' writeJSON and the Nix cache's size file use it, its temporary files named .<name>.tmp-* as state's are. - forbidigo bans os.WriteFile outside internal/state, internal/proxy, internal/msg/gen, internal/stubtest and tests, with its line in testdata/lint/forbidigo.go. Tests: TestWriteFileMode, TestPrivateDir (a symbolic link to a folder refused, its folder's mode unchanged), TestWriteAtomic; mode checks on the Seatbelt profile and Docker's Linux build copy. Coverage baselines raised: lima, netpolicy, proxy, secrets, ui. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
7929eafaf5 |
fix(msg): every message value renders without control characters
A value a VM made reached the terminal unfiltered wherever a caller forgot msg.Shown, such as the errors passed as err.Error() and a link's name. Four cleaners did the job in different ways: msg.Shown (quoting), ui's printable and oneLine, netpolicy's oneLine and the port forwarder's log (which let C1 through, in UTF-8). msg.Printable and msg.OneLine are now the one cleaner: they drop C0 but newline and tab (OneLine drops those too), DEL and C1, in UTF-8 or as a lone byte. Every message value goes through OneLine as the message renders, in Text, Segments and names mode, so no caller can forget it, and msg.Shown is gone with its 68 calls. The status line, the run log's end and verbose output, Pick, devvm network log, the forwarder's log and a clone's status lines use them too. Tests: TestPrintable and TestValuesArePrintable (internal/msg), the hostile-value segments test, TestLogLimit (internal/backend/vmssh) with C1 in UTF-8 and as a lone byte; TestCheckLinks and TestNewVMOtherRepoAndCommondir expect the cleaned values. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
02b45681d7 |
fix(ui): the run log hides the build proxy's password too
The run log's redaction matched only a VM's proxy key, 32 hex digits, so the build proxy's 64-digit password would have been written as it is had it reached a logged command line. It now matches both lengths. Nothing passes the build proxy's password on a command line today. Tests: TestProxyKeysStayOutOfTheLog (internal/ui) checks a 64-digit password too. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
9559267ae7 |
fix(ui): a question at the end of the input names what answers it
Ask, Confirm and Answer exited 1 without a word when the input ended before an answer, such as an empty pipe or Ctrl+D at the prompt. They now fail as --no-input does: the question shown unless its prompt was, then no_input naming the flag or command that answers it, or no_input_terminal for a question only a terminal answers. no_input's and no_input_terminal's wording covers both causes. Tests: TestNoAnswer (internal/ui). Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
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]> |
||
|
|
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]> |
||
|
|
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]> |
||
|
|
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]> |
||
|
|
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]> |
||
|
|
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]> |
||
|
|
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]> |
||
|
|
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]> |
||
|
|
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]> |
||
|
|
28e289c190 |
feat(setup): ask for new VMs' CPUs and memory at first run and in devvm setup
The first run, in a terminal, before base's features are first chosen, asks for the CPUs and memory new VMs get, when no default size is saved and neither --cpus nor --memory is given; devvm setup asks after the backend and features, and --cpus/--memory choose without asking (with only them, the backend and features stay). Each question starts from the saved size, else base.yaml's fitted to this machine (FitCPUs/FitMemory); Enter keeps it, a value Size.Check refuses is warned and asked again. Only typed values are saved, in the size file devvm size -g writes (a saved disk kept); keeping both writes nothing. Without a terminal nothing is asked. - internal/vm/sizechoice.go: SizeChoice (Ask, Set, Fitted), writeDefaultSize, creation.firstRunSize; SetSize -g uses SizeChoice.Set - internal/vm/size.go: baseSetting (BaseDisk on it), readDefaultSize - internal/vm/env.go: Env.Answer and Env.Interactive (stdin and stdout terminals); vm.UI gains Answer and StdoutIsTerminal - internal/vm/up.go: plan asks before reading the default size - internal/ui: UI.Answer, a line prompt; largeTypes allows UI 41 methods - internal/cli/setup.go: setupChoice, --cpus/--memory, saveBackend, saveFeatures; Short/Long updated - messages: size_question, size_cpus_prompt, size_memory_prompt (refusals reuse too_many_cpus, too_much_memory, cpus_not_number; size_defaults after saving) - tests: TestSizeChoiceAsk, TestSizeChoiceSet, TestFirstRunSize, setup's size prompts; setup.txtar (--cpus/--memory, refusals, no terminal), up_size.txtar (first run without a terminal) - docs: first-vm (paragraph, diagram), ports-size (Choosing new VMs' size), customizing, backends, settings; CLI reference regenerated Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
548113d726 |
build(lint): enforce contexts, nolint reasons, reassign and function size
.golangci.yml: - forbidigo bans context.Background and context.TODO outside internal/ui and cmd/devvm. - nolintlint requires each //nolint to name its linters and say why, and reports unused ones. - reassign (patterns .*) forbids setting another package's variables, tests included. - revive keeps its default rules and adds function-length (100 statements, 160 lines) and cognitive-complexity (75). Fixes: - Backend.Lifeline takes a ctx: smolvm's machine data-dir lookup runs with the caller's. - The proxy's TLS handshake with a VM uses the request's context, limited to 30 seconds. - OAuth token refreshes run within refreshTimeout (30 seconds). - Tests use t.Context(). - Launch.create is split into plan, newVM.record and undoCreate. - lima's TestStartConfined is split into helpers. - smolvm's Terminal comes from its UI's StdinIsTerminal. - Unused //nolint directives are removed. - Fresh contexts that remain (an in-memory TLS parse, lookups shared by every request, a test cleanup) each carry a nolint saying why. Docs: contributing.md lists which lint rule enforces which convention; AGENTS.md names the linters behind its Go conventions. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
4bbd35a24b |
refactor(ui): make the UI an instance only cli holds
internal/ui has no package state: ui.UI holds the streams, terminal flags, run log, status line, cleanup stack and interrupt flag, and its functions are methods. ui.Main makes the run's UI on devvm's own streams, owns signals, recovers Die and runs the cleanups; ui.New makes one on other streams. cmd/devvm passes it to cli.Execute, and every cli command gets it through its constructor. Only cmd/devvm and internal/cli import internal/ui (a depguard rule). Each other package defines the small UI interface it needs, which its constructor takes, filling fields tests set: - gitprotect.New, secrets.NewStore, from.NewLookup: a warn func - ubuntu.New: LoggedCmd, Note - netpolicy.NewProxy: Note, Warn, Ask, Confirm, StdinIsTerminal; its log lines drop control characters themselves (oneLine) - sshagent.New: Info, Note, Warn, LogWriter - tools.New: Info, Warn, LogNote, Status, LoggedCmd, AddCleanup - lima.New, smolvm.New: Info, Warn, LoggedCmd (their Runner's Run), WithSteps, AddCleanup, Interrupted; lima LogNote and ubuntu's too - backends.Registry: lima's and smolvm's - vm.NewEnv: all of the above, Say, Stdout, Stderr; Env has Stdout, LogNote, LogWriter, LoggedCmd, AddCleanup, Interrupted fields - build.Builder: Terminal and LogNote fields - sshconfig.New: its caller sets what it prints and asks ui's tests build their own UI over buffers and run in parallel; other packages' tests use small fakes; cli's unit tests a UI over buffers. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
d73c010ec4 |
feat(msg): messages carry the error they report
msg.M.Because(err) returns the message carrying err, and Unwrap returns it, so errors.Is and errors.As see through a message to its cause. The text stays the message's own. Messages made from an error carry it: proxy_failed (secrets and the proxy command), login_copy_failed, run_log_failed and fail's fallback message. TestBecause covers errors.Is and errors.As through a message, through %w wrapping, and through a message in a message. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
78e660d93d |
feat(setup): ask for the default backend
In a terminal, devvm setup with neither --backend nor --features asks
for the default backend, then base's features. --backend chooses it
without asking; --features alone, or no terminal, doesn't ask.
- ui.PickOne: a single-choice picker in Pick's style ("( )"/"(*)",
up/down or k/j move the choice, enter confirms), starting from the
choice that's on; Pick and PickOne share pick/pickLoop.
- backends.Experimental: smolvm is marked experimental in the picker.
- setup: pickBackend starts from the current default (lima unless set,
or set to a backend devvm doesn't have); setupTerminal and pickOne
are test seams.
- Messages: backend_help, backend_experimental.
- Tests: TestPickOneKeys, TestPickOneWithoutTerminal,
TestSetupAsksForTheBackend (terminal, current default, unknown
default, no terminal, --backend, --features); setup.txtar checks no
backend is asked or saved without a terminal or with --features.
- Docs: backends.md (setting the default), customizing.md, the CLI
reference; AGENTS.md's pending line removed.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
||
|
|
ab20aab59d |
feat(secret): devvm secret and devvm auth, tokens kept on this machine
devvm secret set claude|github [--stdin] saves a token in the macOS Keychain (through security -i on stdin, never in arguments) or in an owner-only file elsewhere; devvm auth claude does the same for claude. secret rm deletes one, secret ls (and devvm secret) lists every secret, whether it's saved and the VMs using it, and secret use|unuse binds one to the folder's VM. Saving, deleting, binding and unbinding rewrite the running proxies' bindings at once, keeping their logins' bindings as the VM's start wrote them. get stays hidden, for the proxies. - secrets: Token (whitespace dropped; empty, quotes, backslashes, control characters and non-setup claude tokens refused), Save, Delete, Bind, FromImage, RefreshFiles; platform: KeychainSet, KeychainDelete. - netpolicy: Proxy.RefreshSecrets. vm: SecretSave, SecretRm, Secrets, SecretUse. ui: Secret (no echo at a terminal, the terminal restored on interrupt) and Line. - Messages: claude_token_howto, github_token_howto, token_prompt, no_token, token_quotes, not_setup_token, keychain_save_failed, secret_saved, secret_saved_keychain, secret_removed, secret_used, secret_unused, secret_with_image, secret_unuse_copied, secret_failed; no_claude_token, claude_token_invalid and no_github_token name devvm auth claude and devvm secret set github. - Tests: secret.txtar (set/rm/ls, use/unuse, auth, refused tokens, the value never in argv), Go tests for Token, Save/Delete, Bind, RefreshFiles, RefreshSecrets, the Keychain calls through the security stub (now with -i and delete-generic-password), ui.Secret, vm secrets. - e2e network: secret set/get/use/ls/unuse/rm with a fake GitHub token; the VM gets its own GH_TOKEN placeholder, the proxy puts the token in for api.github.com. - Docs: network.md (saving and binding tokens), coding-agents.md (Claude Code login), security.md, commands.md, contributing.md; CLI reference. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
60f23a6f4e |
feat(log): devvm log, the network log of a folder's VM
devvm log [-f] [-n N] [--blocked] shows what this folder's VM's proxy allowed and blocked, the last 50 events unless -n, following new ones with -f, or the blocks grouped by host and port with the devvm policy allow command that allows each (--blocked). Control characters from the VM are dropped. - internal/netpolicy/log.go: WriteLog (tail and follow, a partial last line and an emptied log handled), FormatEvent, WriteBlocked. - internal/proxy: event is exported as Event; AllowRule. - internal/ui: OneLine, for VM-made values on one line of data. - internal/vm: Env.Log; internal/cli/log.go. - Messages: net_off_log, log_empty, log_failed. - Tests: testdata/script/log.txtar (the three network.bats log cases), netpolicy and proxy table tests; e2e network checks devvm log and --blocked. - Docs: network.md (Logs), commands.md (Network policy), CLI reference. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
e76cb894b5 |
fix: verify the core on macOS and Linux
Full e2e (default and --from) on macOS and --from on a nested Linux host, plus deadcode. Fixes: - ui: a logged command a signal ended (or exited 128+) waits up to 1 s for devvm's own interrupt, so Ctrl+C that ends the command first no longer prints its failure (seen on Linux in from.txtar's Ctrl+C case; TestACommandEndedByTheSameSignalPrintsNothing, TestKilled). - mise.toml: minisign only where it has builds (no linux/arm64), so mise run works on arm64 Linux. - up.txtar: the .git protection warning is checked in devvm's stderr, not after stub_calls (it never matched on Linux, and macOS's negative check was vacuous). - up_size.txtar: a default memory of 5 GiB, not 16, which a 16 GiB host reports as 15. - qemu.txtar: "no real QEMU" no longer has /usr/bin on PATH, where Linux hosts have QEMU. - TestUp: its protector is macOS's, as its Env. - e2e: pgrep patterns are [_]proxy (Linux's pgrep -f matched the check's own shell: the proxy-gone check failed, the proxy-runs check passed vacuously); a cached base's key comes from the fixture's chain, not the newest record (another selection's base); base's features check is counted as SKIP when base is cached, so runs compare their counts. Deadcode removed: ui.Logged (callers use LoggedCmd; tests get a helper), paths.rootOf (its tests now test resolve), tools.Lock.Tools (moved into the tests). Kept for their commands: backend.Emulated, state.WriteSize/WritePorts/WriteBackend/writeValue/ReadAgentKeys/ WriteAgentKeys, tools.Lock.Version, Tools.All, Tools.Garbage, backendtest. New mise task: deadcode (x/tools v0.52.0). Docs: testing.md (platform table, Linux host setup as verified, x86_64, the manual check for an image only Docker has); contributing links it and lists deadcode and SKIP. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
6a2b2dcf5a |
feat(features): optional base image features
base runs its chosen features after layers/base.sh, in the order chosen: devvm's own (features/<name>.sh next to the binary) and the user's (~/.config/devvm/features/<name>.sh). The choice is in base-features and in base's key; until there's a file, every feature counts. The first build of anything asks which features base gets, every one chosen to start with: an arrow-key (or j/k) picker in a terminal, showing each script's second line; without a terminal, every feature. The choice is saved and printed. - build: Features (devvm's, sorted, then the user's; a user feature named like a built-in one is ignored), FeatureScript, chosenFeatures (selected_features), chooseFeatures (pick_features) run by Build and Rebuild before any key; Inputs hashes the chosen features and the user's folder; base's spec gets each feature's script, one without a script skipped with a warning. - image: FeatureName. ui: Pick and Choice (raw mode, hidden cursor, control characters dropped from descriptions, Ctrl+C ends the run with 130). - Messages: features_help, base_features, base_features_none, feature_shadowed, unknown_feature; doc links to customizing.md. - Copied: features/ (cli-tools.sh, fzf.sh, omb.sh), unchanged. - Converted: images.bats user features (listing, shadowed, in base's key) and build.bats step counts (two features and one skipped) as features.txtar and Go tests (TestFeatures, TestDescription, TestChooseFeatures, TestBuildRunsFeatures, TestPickKeys, TestPickWithoutTerminal, TestPickCtrlC). Script tests start with an empty base-features file. - e2e: with from selected, base-features holds every feature; images checks base ran base.sh and every feature, and takes base's key from its build or the newest Ubuntu base (no longer a cached --from base); from checks every feature in the node:24 and alpine:3 VMs. - Docs: customizing.md (base image features); images.md, index. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
ff57370ffb |
feat(network): network policy for VMs
A new VM can get network policy: --network-policy, else a question in a terminal (no by default), else off. devvm makes its CA, writes the VM's secret bindings, starts the VM's proxy (devvm _proxy, its password in a file) and starts the VM confined to it, then runs the self-check before the setup and the shell: a VM that isn't held to its proxy is stopped. Tokens stay on the host; the hidden devvm secret get reads them for the proxy, from the Keychain or a file. e2e gets a network section. Co-Authored-By: Claude Opus 5.5 <[email protected]> |