mirror of
https://github.com/devvmhq/devvm.git
synced 2026-12-01 14:33:17 -10:00
main
23
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
376f1c2ad7 |
fix(agents): opencode's save, plugin approvals and the history scripts' framing
devvm agent save refused a VM whose ~/.config/opencode held a bun.lock (which opencode's plugins' installs write), a package-lock.json, a .gitignore or a .DS_Store: the save's script sent every entry of that folder but node_modules and FolderOwn, while the host's listedPath refuses those files (fileSetting), so it saved nothing. notSettings is now their one list, as patterns path.Match and the shell's case read alike: fileSetting leaves them out and the script sends a file of those names no more, only a folder that isn't a link, which is a setting. TestAgentSaveScriptRuns plants them and a folder named old.lock, and failed with agent_save_unsafe before the fix. opencode's HistoryOwn names its native client's plugin approvals, in its state folder (cli-rs's plugin/src/loader/approval.rs and tui/src/plugins/host.rs, opencode v2.4.1): plugin-approvals.json, its .lock and the .plugin-approvals.json.<pid>.<n>.tmp it's written through, and plugin-staged, the approved trees' copies, which it reuses by their hash's name without hashing them again, so a hostile VM's export could approve a project plugin for the VM that imports it. That client doesn't ship in 2.4.1. TestHistoryExportRuns and TestHistoryImportRuns plant them, with plugin-notes.json as the control, and failed on fedora without the entries. The history scripts' framing (onInputCmd) now says why on its stderr, which goes to the VM's log, when its input was cut short: TestOnInputCutShort checks it for every cut, an empty input included, and none for a whole one, and failed before. TestHistoryScriptsOnInput holds each script under 128 KiB, Linux's limit on one argument, which bash -c "$s" passes it as. The CLI scripts match the framing's new start. Docs: the save's and the store's table say which files stay in the VM; the import's and How it works' lists name the plugin approvals; the release page gets opencode's lock files in a save and the approvals; the changelog's opencode block gets the save's fix, and the hardening line names approved plugins. The review's optional wording: the design note's `*` matches every resource, and the plain-password steps set this machine's password first. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
962c183117 |
fix(agents): imported opencode history brings no automations, approvals or resumed turns
An export of opencode's history held what opencode 2.4 acts on without asking, so a hostile VM's export could run commands in the VM that imports it (opencode v2.4.1's source): its automations (automation), each a trigger and a shell command that it approved once and never asks about again (core/src/automation/shell.ts); the requests you said always to allow (permission, which Permission.evaluate turns into allow rules); each session's own rules (session_v2.permission, a Permission.Ruleset); the subagents' jobs (job), the queued messages (session_inbox) and the suspended sessions (session_v2.time_suspended), which its service starts or resumes when it starts (core/src/session/execution/restart.ts), with the session's agent's own rules, explore's allowing shell; a project's commands (project.commands), whose start command it runs with bash -lc for each worktree (core/src/worktree.ts); and its git repositories in its data folder (snapshot, repos, worktree), whose config can name a clean filter or core.fsmonitor that its own git update-index runs (core/src/snapshot.ts, git.ts). opencodeClean now empties the tables opencodeUnattended picks (automation, permission, job, session_inbox, and any whose name starts so), sets the columns opencodeNulled picks to NULL (time_suspended, commands, in any case), keeps only the deny and ask rules with a text action of every permission column, each written again from what sqlite3 read, so a key written twice can't keep an allow effect for JSON.parse (opencodeAllowRules), drops every view, and fails its check on a generated column (opencodeHidden). Its check counts each and must print 0, so a sqlite3 without JSON leaves the database out. A view, an upper-case column, a generated column and a duplicate key bypassed the first version, as the security review showed. opencode's HistoryOwn now names its background service's registration on every channel and the files written beside it (service-*.json, service.json.*, service-*.json.*) and its git repositories (snapshot, repos, worktree): an export leaves them out and an import never writes them, while a VM made again keeps them. The import's clean-up loop expands each as a pattern; TestHistoryImportScript holds every skip to a path's plain characters. Tests that failed first (fedora's gate): TestOpencodeCleanSchema (automation and permission emptied, a session's allow rule gone), TestHistoryImportRuns and TestHistoryExportRuns (service-local.json, the handoff's and the registration's temporary files); TestOpencodeCleanSessionRules fails closed without the statements. The review's additions: TestOpencodeCleanSchema (job, session_inbox, a suspended session, a project's commands), TestOpencodeCleanSessionRules (a key written twice, a non-text action, an upper-case column), TestOpencodeCleanHidden (a view, a generated column), and the git folders in the export and import tests. The review's docs fixes across the stack land here too: the changelog's What to do steps, the release page, the coding agents page, How it works and the design note. A kept rule whose resource is missing or isn't text gets "*", as opencode's Permission.Rule needs one, and the check also counts a rule that isn't in the rebuilt form, so a copy whose rules weren't rebuilt fails closed. A stack-wide review's last docs fixes land here: devvm rm deletes opencode's worktrees with the VM, so the changelog has a What to do step to commit their work first. The export's and the import's scripts, which the stack doubled, now go on the VM's input (onInput): a line with the script's length, the script, then the import's export. In the command's arguments, quoted for ssh's shared connection, macOS's ssh failed to start the session (mm_send_fd: sendmsg: Message too long), which the mini's e2e hit, the export first and then the import. The VM reads exactly that many bytes (dd bs=1) and runs the script only when it read them all, so an input cut short runs nothing (TestOnInputCutShort), and the script gets the rest as its input. TestHistoryScriptsOnInput holds every argument under 4 KiB; TestHistoryExportRuns and the import's runs use onInput too. The stub guest takes such a script off its input (inputScript), matches its switches and files() against it and keeps an export's and an import's in history-export.sh and history-import.sh, which history, history_import, rm_vm, existing_agents and layer_add read. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
b6954e1e11 |
refactor(vmname): a VM's name is a vmname.VM, parsed where it's read
vmname.VM is the name of every machine devvm runs on a backend: a project VM, an image's machine (devvm-img-<key>), a build VM and a remake's aside. Fields, parameters, results and map keys that held a VM's name as a string now hold a VM, from the backend interface down to the CLI's --json structs, whose output is byte for byte the same. Boundary parsers, the only places a string becomes a VM: - vmname.Parse: a project VM's name (state's vm.json name, export file names, devvm _links's argument, the forwarder's -vm, project.Nth) - vmname.ParseListed: one path element, for what a backend lists - VM.UnmarshalText: JSON (Lima's list, proxy config and events, links' targets in state, link lists); empty stays no VM - vmname.Image(key), VM.Aside(), and typed constants for Lima's build VMs - msg.M.VM: the VM a message's function took, read back vmname's functions on names became methods (Hash, Slug, Short, Aside, AsideHash, ImageKey, IsProject); Lima's image prefix moved to vmname; vmname.Join joins VM lists. Messages' vm and vm_name fields are typed by the generator. Seven messages whose field took something else became what= (backend_lacks, backend_unreviewed, backend_unreviewed_used, starting, deleting, configuring, running_script) and rm_vm_failed's name=: the text is unchanged, the names-mode scripts follow. Review.RequireFor names an image or the tools being built. Typed sites per package (added lines with vmname.VM, non-test): msg 347 (generated), vm 124, lima 48, backendtest 32, vmssh 31, netpolicy 22, backend 16, gitprotect 14, proxy 11, cli 11, project 10, state 8, ports 6, paths 3, sshagent 2, sshconfig 2, tools 2. The structure test's owners rule now fails on a field, parameter or result named for a VM (vm, vms, otherVM, vmName) typed string, []string or map[string]…, and on converting anything but a literal to vmname.VM outside the files it lists; internal/stubtest is free. depguard holds internal/vmname to the standard library, and the proxy may import it. ParseListed and UnmarshalText refuse a name starting with -, which would read as a flag in limactl's argv, and vmname.Image refuses a key that's empty, holds a / or NUL, or makes a project VM's name, so Lima's ImageSize and DeleteImage no longer check it themselves. The check also fails on a *string VM name and an alias of vmname.VM, and says what it doesn't see. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
33ec9eb0dc |
refactor(tools): one definition per toolchain
Each toolchain is one image.ToolDef in image.SharedTools, which also holds its guest environment, its PATH folders and its version files. They leave base's devvm-tools.sh for /etc/devvm/toolchains.sh, which every launch writes, so base.sh changes and every image rebuilds once. The structure test's names rule fails on a toolchain's name as a literal outside internal/image, TestToolchainsComplete checks the toolchains page, and Contributing gains Adding a toolchain. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
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]> |
||
|
|
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]> |
||
|
|
8d8da01037 |
feat(tools): dotnet, the .NET SDK, as a shared toolchain (#7)
Adds `dotnet`, the .NET SDK, as a fifth shared toolchain next to node, python, rust and go. `--tools dotnet`, `devvm tools add dotnet` and the picker offer it, and a folder with `*.sln`, `*.slnx`, `*.csproj`, `*.fsproj` or `global.json` at its top level suggests it in the new VM's summary, the way `package.json` suggests node. Refs #2. Thanks to @jsskeen-utah for the detailed request. Co-authored-by: Claude Opus 5.5 <[email protected]> |
||
|
|
6391a8ba48 |
fix(agents): opencode 2's history exports leave its credentials out
opencode 2 keeps its sessions and its logins in one SQLite database, ~/.local/share/opencode/opencode.db (opencode-<channel>.db for other channels), in WAL mode, so the history export, which tarred ~/.local/share/opencode, carried its credential table (logins, API keys, MCP OAuth tokens), account and control_account (its console's access and refresh tokens) and session_share's secrets to this machine, and an import gave them to another VM. The -wal file carries them too: it holds full page images of what opencode wrote last, a just-saved credential row among them, until a checkpoint, and opencode makes it at once. The export now copies each database in the VM with sqlite3 (base installs it: sqlite3 on Debian and Ubuntu, sqlite on Alpine), keeping the sessions: VACUUM INTO (one snapshot, the WAL's rows included); every trigger dropped; the login tables emptied (credential, account, control_account, account_state, session_share, and any table whose name or a column's says it holds a secret, for tables a later opencode adds); the record of opencode's auth.json import migration taken out, so the next VM's opencode imports the logins devvm's setup wrote there; WAL off and secure_delete with VACUUM, so no free page keeps a deleted row; then the rows counted, and the database left out on any failure or without sqlite3. tar leaves the database and its -wal, -shm and -journal files out and adds the copy at its path (--transform, links' targets kept). The import does the same in the VM to an export it unpacks (one devvm didn't write may hold the logins): it deletes the -wal, -shm and -journal files and any database that isn't a regular file, and puts in the copy, or nothing. Every sqlite3 runs with trusted_schema off. opencode 1's mcp-auth.json joins the logins left out. Rejected: excluding the database (loses opencode's sessions); opencode session export (runs opencode and its server per session, and per project, which rm's export can't count on). Security review (security-audit skill, guidance mode, data isolation and lifecycle): export scope, the WAL, import of an export holding the logins, a trigger restoring rows and a hostile schema each have a holder and a test (design.md's threat check). Not covered, documented: a secret pasted into a session stays in it; a VM without sqlite3 exports no opencode database; a remake's home copy keeps the database's logins, as it's the same VM's data going to the same folder's VM. Tests: TestOpencodeClean (a running opencode's database, its credential only in the WAL of an open connection, an account's tokens, a share's secret, a later table's key and a trigger: none in any byte of the copy, the session kept; a file that isn't a database gives none), TestHistoryExportRuns and TestHistoryImportCleansOpencode (GNU tar, with and without sqlite3); the CLI tests' export calls; e2e's network section plants a key with the VM's sqlite3 and finds neither it nor the login's placeholders in devvm history export's file. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
d94929523d |
feat(vm): a new VM shows a summary, then asks whether to customize it
Before devvm makes a new VM it shows a summary of what the VM gets: each toolchain, coding agent and layer with why (the file that calls for it, devvm setup, config.toml or the flag that gave it), its size, network tier and ports, and the devcontainer.json it's made as. Where the picker shows (CanPick) and something is left to choose, it asks "Customize it? [y/N]": Enter makes the VM as shown; y opens the picker (a part a flag gave greyed out), then the network tier question when no tier is given or saved, then the VM's CPUs and memory (for this VM alone). Without a terminal or with --no-input the summary ends with the flags that choose others. The summary replaces new_vm_gets and devcontainer_using. devvm's first run asks its size and agents first, as before, then shows the summary. A test build's DEVVM_PICK_ON_PIPE shows the picker with a terminal on stdin alone, so testscript's ttyin reaches it (up_customize.txtar). Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
ceda0bf925 |
feat(cli): --network TIER, devvm network TIER and the tier question
The command line names the four network tiers. --network TIER (open,
internet, allowlist or none) chooses a new VM's tier, checked before
anything runs (arg_not_choice). devvm network open|internet|allowlist|none
gives the folder's VM a tier through Net.SetTier, and devvm network -g
takes the tiers and ask. config.toml's and settings.json's network is ask
or a tier (settings.NetworkChoices, checked against netpolicy.TierNames
by a test, since settings can't import netpolicy).
The question on creation is Proxy.Choose(vm): net_about says what each
tier reaches, net_ask asks for one (Answer, AnsweredBy("--network")),
Enter or a refusal gives allowlist, and an answer that isn't a tier is
warned of (net_tier_unknown) and asked again. devvm setup's picker
offers ask and the four tiers (network_default_open, _internet,
_allowlist, _none). On an existing VM, --network is ignored with the
devvm network TIER command that changes it.
devvm network --json: policy is the tier or unenforced, and each policy
file whose denies alone apply (internet and none) has denies_only: true,
as the text output's "(denies only)", so a script can tell a file's
denies from all of its rules without knowing the tier rules.
Messages reworded: net_tier_backend (--network open), net_open_policy
(devvm network allowlist), net_about, net_ask, network_default*,
net_default_failed, network_failed, setting_already's and
widen_parent_vm*'s descriptions. safety/network's "Choosing a tier"
replaces its on/off section; docs, the cli skill, testscripts and e2e
use the new forms, and e2e's internet and none checks go through devvm
network.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
||
|
|
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]> |
||
|
|
d17e62961e |
refactor(msg): one message for each kind of setting, flag and requirement
Messages that said the same thing for different settings are one message each, given what differs: - new_vm_flags_ignored and new_vm_flags_ignored_run (flags, vm, command) replace from_ignored, net_flag_ignored, git_protect_flag_ignored, size_flags_ignored, ports_flag_ignored, parts_flags_ignored, ssh_agent_flag_ignored and no_devcontainer_flag_ignored: one warning for each command that changes the same on the VM, naming only the flags given (ignoredFlags). - setting_already (command, vm) replaces net_already, agent_already, clone_on_already and clone_off_already. - setting_set (vm), for a stopped VM, replaces net_set_stopped, agent_set_stopped and links_next_start. - next_start (count, vm), for a running VM, replaces net_set_running, agent_set_running, size_next_start, agent_next_start, mounts_next_start, folder_next_start and net_off_next_start; a launch warns of each change with its next_start_* line, then next_start once. - program_missing, program_broken and program_old (+ _fix) replace lima_missing, lima_broken, lima_old, qemu_missing, macos_old and their _fix messages; the minimum versions are minLima and minMacOS in the lima backend, passed into program_old. - ports_list_needed replaces link_ports_invalid: devvm link publish and unpublish check their ports with ParsePortList, as devvm ports add does, and ParsePublish is gone. - no_vm replaces no_vm_link. - vm_unfinished says nothing of the user's is in the VM, as remake_unfinished does. Kept apart: git_protect_next_stop (it applies at the next stop, and devvm stop applies it), already_stopped and ports_all_already (not settings), group_already (joining again syncs the group's links), has_tools and has_layers (they name which of those given were there), docker_missing (Docker is optional, so it never says to install it). Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
9f6f62d28a |
refactor(state): vm.json, typed state in package sections, changed under the VM's lock
A VM's state is vms/<hash>/vm.json: core fields (version, id, name, alias, image, chain, from, dir, folder, backend, backend_at, created) and one section per package, each a json.RawMessage its owner decodes into its own type (state.Section, state.SetSection), what was asked for at its top level and what devvm made under "made": net (netpolicy), git (gitprotect), ports (the new internal/ports), agent (sshagent), tools (tools), secrets (secrets), and size, clone, devcontainer, desktop and links (vm, internal/vm/state.go). - state.VM.Update takes vms/<hash>/lock (platform.LockFile), reads the file again, applies a change and writes it once; a failed change, or write, writes nothing. VM.Set and its calls are gone; read-modify-write of lists (links, publish, secrets, tools, size, ports) happens inside Update. VM.Claim also holds run/claims.lock, after the VM's own; VM.Create writes a new VM's whole record once, its alias chosen (sshconfig.ChooseAlias) under the claims lock. Reads take no lock. - created replaces "net unset" as unfinished (VM.Finished). - internal/ports: the ports section (forward, host.ssh/proxy/desktop), ports.Used (was netpolicy.UsedPorts), and one Allocator for ssh, proxy and desktop ports under the claims lock (desktop allocated without one before; run/ports.lock and netpolicy's own ports key are gone). - gitprotect: mode recorded before the backend makes the VM (NewMode; clone for --clone, which ls and git-protect share as gitprotect.Mode); made.git_id (platform.FolderID), one git_dirs list for modules and embedded git dirs, delegations, protected; Unlock takes the union of recorded and current git dirs. - links' entries, git dirs, tools and devcontainer commands are JSON lists, not strings in values; the key=value parser is gone. - vm.checkState reads every section of the folder's VM as it's found. - registry.For drops its unused Dirs. - Tests: TestVMRoundTrip, TestVMOtherName, TestVMID, TestVMUpdate, TestVMUpdateTogether (two writers on one VM and on crossed VMs), TestVMClaim, TestVMFailures, TestVMCorrupt, TestChooseAliasTogether, TestUsed, TestSSH, TestChooseTogether, TestUnlockRecorded, TestCheckState, TestChangesTogether, TestChangesAtOnce; testscript's vm_state, json_set with dotted and := keys; e2e's vm_state/vm_set. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
d8a7d4de7f |
refactor(state): a folder per VM, keyed by its project folder's hash
Every file devvm keeps for a project VM is in one folder, vms/<hash>/, where <hash> is the 14-hex hash of the project folder's path that the VM's name ends with: its state, its own rules (policy), its backend's files (backend/: record.json, key, known_hosts, proxy, ports and the port forwarder's ports.*), what its runs leave (run/: proxy.*, sandbox.sb, started, lifeline.pid, secrets.*, links.*) and its logs (logs/: network.jsonl, proxy.log, links.log). Build VMs keep the same layout in run/builds/<name>/. The top-level run/ holds only what isn't one VM's or must be short: the hashed control sockets, links' link-<hash>.sock/.ctl, the QEMU wrapper and the ports lock. A folder's VM is found by its path's hash (state.ReadHash), with the name and backend its state records, so devvm --backend docker then devvm in the same folder opens the one VM, and a backend's name limit applies to new VMs only. The state records the VM's name and its ssh alias, chosen once at creation (sshconfig.ChooseAlias) and never recomputed. Links' targets match recorded names, aliases and folders (project.Targets). One teardown (vmFolders.teardown) replaces Lifecycle.forget, undoCreate's own list, Leftovers.Forget's, Proxy.Forget and space's leftoverFiles: it stops the proxy and link session, then the pieces outside the folder (clone remote or .git locks, other VMs' links and the group, host keys, the backend's leftovers), removes the folder, and writes the ssh config. Each backend's Delete and Forget remove the VM's backend/ folder (vmssh.Forwards.Forget). A new VM made where an earlier one's folder was left clears it first. devvm space counts an orphan's whole folder as leftover state and the other VMs' logs as network logs. Path builders move into paths: Dirs.VMDir, Dirs.VM and paths.VM's files (secrets' BindingsFile/PolicyFile, netpolicy's run, EventLog, ProxyLog, LinkList, VMPolicyFile, Lima's profileFile, startedFile, forwards.file, vmssh.Forwards.file, links' LinksLog/linksPID, Docker's vmFile and lifeline), ToolLockConfig, ToolLockChecked and ToolsCheckLog; the user's cache folder for Lima's and smolvm's caches is Dirs.UserCache, from HOME, not os.UserCacheDir. Dirs.VMState, LimaVMs, SmolvmVM and DockerVM go. vmname.HashOf and IsHash, project.Hash. The proxy takes the links' sockets' folder (-link-sockets, devvm's run folder) apart from the links' list, which is in the VM's run folder. Tests: a VM made and removed (rm, gc --orphans) leaves nothing under vms/, and with network policy has no file named for it outside its folder (TestTeardownLeavesNothing); a new VM over an old folder starts clean; lookup finds a VM made on another backend with a long folder name and makes no second one (TestLookupOtherBackend, and in docker.txtar); the alias stays put when a second VM shares the folder name (TestChooseAlias, ssh.txtar); every socket fits under a 35-character home with the longest VM name (TestSocketsFit); space counts an orphan's whole folder (TestLeftoverFolders); paths.VM's files; state by hash and name; the proxy refuses a socket in the list's own folder. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
ee8146a5e4 |
fix: scripts and tests work without shasum, and two CLI scripts start Lima outside devvm on bash 5.2's sh
Fedora 43 has sha256sum but no shasum (Perl's Digest::SHA), and its /bin/sh is bash 5.3, which runs the last command of an `a && b` -c string in sh's place. - install.sh's check_host stops with "needs sha256sum or shasum" before downloading; its sha256 already used either. install.txtar covers shasum alone, both, sha256sum alone and neither, with made-up sums. - scripts/release.sh and scripts/bump.sh get a sha256 helper (sha256sum, else shasum -a 256) in place of four shasum calls. - gc_orphans, release, release_head and tools scripts hash with sha256sum, else shasum. tools' old fallback never fell back (the pipeline's status was cut's). - ls and existing_agents restart a VM outside devvm with `sh -c '... && limactl start ...; exit $?'`: without the exit, bash's sh exec'd the stub, whose ha.pid then named the test runner (the pid devvm recorded), so the VM still looked confined. - The install page lists sha256sum or shasum among the script's needs. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
a134e0d8a6 |
feat(cli): choose a new VM's toolchains, agents and layers in a picker or with --tools, --agents and --layers
devvm takes no IMAGE word any more than any other: in a terminal a new VM's toolchains, coding agents and layers are checked in one picker, under three headings, before the network-policy question; --tools, --agents and --layers (each an exact list, or none) skip it, and a part left out takes its default: the detected toolchains, devvm setup's agents, no layers (a devcontainer.json's features still count). Without a terminal, or with --no-input, the VM gets the defaults and new_vm_gets says so in one line. devvm setup --agents (and its first-run question) chooses new VMs' agents. devvm tools in a terminal opens the same picker for the VM, its layers fixed, and turns the changes into tools add and rm. An image is base and layers only: tools are the VM's tool_names state key. build, rebuild and images rm refuse a shared tool (tool_not_layer), and devvm build builds no tool images. devvm ls gains a TOOLS column and --json tools. gc's --tools is --tool-images, so --tools has one meaning. Gone: image.Reserved, checkWord's image half (devvm WORD is no_command or no_command_like, did-you-mean over commands, msg.Closest), the lacks path in internal/vm/existing.go, and the messages vm_lacks_tools, vm_lacks_layer, layer_is_command, layer_name_command, no_image_for, no_command_or_image*, tools_not_images, tools_not_images_rm, detected, vm_is_now (vm_tools_now), secret_with_image (secret_with_claude). New: ui.Pick takes headed sections with fixed rows, ui.CanPick, vm.PickPart/PickRow/AgentsChoice/CheckPart (internal/vm/parts.go), state.KeyToolNames, state.ReadAgents/WriteAgents, paths.Dirs.Agents, project.DetectFiles. Image keys are unchanged in form: images never held tools; docker.sh's and nix.sh's comments changed, so those layers rebuild. Docs: the home page's quick start steps, diagram (sandbox.svg), cards and FAQ; README; getting started; using (images' What a new VM gets, coding agents' Running an agent, settings' agents); internals; contributing; the cli skill; AGENTS.md. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
ddbc377f8f |
test: testscript commands for the scripts' setup, and a coverage baseline per package
script_test.go's sandbox sets DEVVM_MESSAGES=names and DATA, VMS, RUN and CFG by default, and adds stub_reset, catg (the one file a glob matches), vm_name VAR NAME (the folder's VM) and project NAME [git]; script_cmds.txtar checks each. Every script is rewritten onto them, its assertions kept; TestCommandLines leaves the scripts' own commands out. mise run test runs scripts/test.sh: the tests as before, with the CLI tests' devvm built with -cover for every package (CLI_GOCOVERDIR), merged with the Go tests' counters by go tool covdata, then scripts/coverage.sh holds each package to testdata/coverage/<os>.txt. mise run coverage raises the baselines; coverage.txtar checks the comparison. The macOS baseline is recorded from this tree. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
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]> |
||
|
|
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]> |
||
|
|
07ca65c098 |
feat(cli): devvm host, the tools noun and devvm history
devvm ssh is devvm host. devvm tools shows this folder's VM's shared tools (TOOL VERSION NEWER BUILT, from the lock as it is, never online); devvm tools add/rm TOOL... add and take out shared tools, each a word of its own (joined with + refused: tools_joined; add takes only shared tools: unknown_tool), and devvm tools update moves the VM to the newest. devvm IMAGE on a VM that exists adds nothing and asks nothing: it fails with vm_lacks_tools, naming the devvm tools add command, or vm_lacks_layer, as only a new VM gets a layer. devvm export is devvm history export [FILE]; devvm history lists the exports in the exports folder (FILE VM FOLDER DATE SIZE), the folder from a <export>.folder file written beside devvm's own exports and deleted with them. gc --exports is gc --history, retention's exports.age/count are history.age/count, and devvm space's row is history. The in-place layer machinery goes: Launch.addLayers and runLayers, dockerLayers' inPlace/set/unset, backend.DockerLayerVM.SetDockerLayer and the Docker backend's SetDockerLayer, with the add_in_place, restart_for_mounts, no_terminal_confirm, keeping, adding and add_layer_failed messages. vm.Tools (tools.go) holds Add, Remove, Update and List; tools.VMs.Show lists a VM's tools; tools.Remove takes names as a list; VMs.Update compares a VM's files as a set. New messages: vm_lacks_tools, vm_lacks_layer, has_tools, tools_joined, history_failed, tools_failed; renamed: unknown_tool, gc_history, gc_history_export, deleted_history, gc_older_than_needs_history. Command files: host.go, tools.go, history.go, refreshtools.go (_refresh-tools); ssh.go, remove.go, update.go, export.go and gc_exports.go gone. Tests: TestImageLacks, TestToolsAdd, TestShow, TestCompleteToolNames; history.txtar, gc_history.txtar, host_code.txtar and the e2e tools, docker layer and host checks updated. Docs, the CLI reference, AGENTS.md and the e2e header follow. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
5304e9a2b7 |
feat(export): devvm export saves a VM's agent history
devvm export [FILE] saves this folder's VM's agents' history (the same paths and login excludes as rm's export) to FILE, relative to the current folder, or to a new <vm>-<date>-<time>.tar.gz in the exports folder. A stopped VM is started for it. It needs a finished VM made for this folder. The export is now written to a temporary file beside its target (mode 600) and renamed into place once complete, for rm's export too: a failed export leaves no file and an existing FILE as it was. Messages: history_not_exported (logged) and export_failed (reason) for devvm export; rm's is now rm_export_failed. Tests: TestExport (default folder, a new folder for FILE, a failed export keeping FILE); testdata/script/export.txtar (no VM, usage, a stopped VM started, the script, a relative FILE, a failure keeping FILE and the VM); e2e's project section exports a stopped agent VM's history to a file, without its logins. Docs: coding-agents.md#history, commands.md, the CLI reference. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
f2aa210bf7 |
feat(up): existing VMs, restart, remove, update, adopt and rm
devvm opens a VM that exists instead of refusing it: unfinished VMs (no state or no network choice) are refused before anything; --backend, --network-policy, --no-git-protect, --cpus/--memory/--disk and --ports are ignored with a warning each; an IMAGE naming what the VM lacks adds it in place after asking (tools built and listed, a layer's script run in the VM, new agents' folders mounted with a stop first); outdated images and newer tools are warned about, the daily tools check runs, agent folder mounts follow the host's, .git is checked per run, set-id files are named on Linux, a stopped VM gets the size and ports its state asks for (a running one is told they apply at its next start); then it is started if stopped (a running VM with network policy keeps its proxy), the self-check runs (a failure stops the VM), and it is set up and its shell opened. Commands: restart (stop, then open), update (newest shared tools, built from base, then open), remove TOOLS (out of the image and tool list, then open), adopt (a VM made for an earlier folder at this path, after asking; .git protection restarts as appeared), rm [-f] (exports the agents' history first unless -f, a failed export keeps the VM; a VM of an earlier folder only after asking, without export; deletes the VM, state, proxy, rules, run files, logs, .git locks, host keys and ssh config entry, also when the delete failed but left no VM). Inventory: - vm: find/findExisting/existing, sameFolder, open, run, setUp, warnIgnored, checkSetID, applySize, applyPorts, addLayers, wantedImage, runScript, buildTools; Restart, Remove, Update, Adopt, Rm, export, delete; start refuses vm_unfinished and stops a leftover proxy for VMs without network policy - gitprotect: Protector.Check (replaced, appeared, new submodules in the tree and .git/modules, unlocked hooks, commondir, delegations on change; locks only while stopped; unset protection set up as new), Locked field; platform.Immutable - tools.Update takes a build func; build.Builder.LayerScript exported - cli: restart, remove, update, adopt, rm; withEnv; root Long - messages: vm_other_folder (reworded), vm_other_folder_rm/_adopt, delete_other_folder_vm, adopt_vm, vm_adopted, vm_already_here, no_vm, vm_unfinished, backend/net/git_protect/ports_flag_ignored, size_flags_ignored, size_next_start, ports_next_start, add_in_place, restart_for_mounts, no_terminal_confirm, keeping, adding, add_layer_failed, vm_is_now, exported, export_failed, deleted, rm_failed, adopt_failed, git_replaced, git_appeared, git_embedded_new, git_hooks_unlocked; net_unenforced_stop says devvm starts it again confined; vm_exists removed - tests: testscript existing.txtar, existing_agents.txtar; Go tests for Check (five per-run reports, replaced/appeared, off/unset), open with network policy, addLayers, Rm, Adopt, remove/update/restart; limactl stub: delete-fails, Exec-fed scripts - converted bats: delete (vm_unfinished, rm cleans up after a failed delete, rm deletes only this VM), project (folder made again, update twice, remove twice, five .git per-run reports), ports (applied once, restart warning), size (restart warning), cli (rm forgets host keys) - e2e: project (stop and relaunch, running relaunch, restart with host keys, swapped .git, new submodule locked, rm unlocks; agent folder added/removed on restart, rm exports history without logins), tools (update, remove), network (relaunch confined, unenforced relaunch stops it, rm -f) - docs: commands.md (existing VM, adding, deleting, a folder made again), coding-agents.md (mounts on launch, history), git-protection (on each launch), images, network, security; CLI reference Co-Authored-By: Claude Opus 5.5 <[email protected]> |