mirror of
https://github.com/devvmhq/devvm.git
synced 2026-12-01 14:33:17 -10:00
main
31
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
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]> |
||
|
|
4ccdbf8125 |
fix(vm): folder identity's last checks: a renumbered folder keeps its volume
From the volume UUID commit's security review. A folder at its own recorded path on a disk numbered anew (platform.SameFolder's renumbered case) must now also be on the volume its state records, when both are known (platform.KeepsVolume): the finder checks it (finder.sameFolder, Env.keepsVolume, so a launch refuses with vm_other_folder) and so does recordFolder under the state's lock, so a copy of the disk with a volume ID of its own mounted at the folder's path is another folder. A volume that can't be told leaves the device's rule, as for a state that records none. mountedBy and mountsRepo keep the check without volumes (madeFor), which errs towards warning. hereOf reads the folder's identity, uniqueness, owner and volume from one open folder (platform.StatFolder, now with Owner), so the folder checked as the user's is the one matched and recorded. StatFolder is one function for macOS and Linux (folderstat_unix.go) over each system's openFolder, which SameFolder's renumbered case uses too, in place of openFolderID and darwin's copy. devvm ls and devvm space look volumes up through the run's Env (Env.FolderOf, Inventory.List(ctx, e)), each mount once a run, in place of diskutil for each VM; FolderOf, parentVolume and movedAway go. FolderDevice is unexported (folderDevice), so only platform reads a device; OnRecordedDisk takes a record without a device as on any disk. The folder-ids rule tracks names assigned from such names, however many steps on, and maps keyed by an identity, indexed or in a map's literal, without counting a struct literal's field; its loop is sitesWhereIn, shared with sitesWhere. The hdiutil e2e check makes sure macOS gave the disk a new number, attaching up to three images first, and is skipped when it never does. The design notes say who can forge a volume ID and what it gets them. Tests: TestKeepsVolume, OnRecordedDisk without a device, TestRenumberedOnAnotherVolume (a launch and recordFolder), TestListLooksUpVolumesOnce, StatFolder's Owner on both systems, the folder-ids rule's new cases, and fixture_v010_renumbered.txtar (another volume at its own path refused with nothing recorded; ls calls the moved folder gone by its recorded volume, where it said not_connected). 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]> |
||
|
|
cb36951de2 |
refactor(git-protect): drop strict, convert strict VMs to on
devvm git-protect strict (0.1.0, 0.1.1-rc.1) set diff.ignoreSubmodules = all in the locked .git/config, which can't keep git on this machine out of a submodule the VM adds: a .gitmodules ignore line the VM writes overrides it, and git add -A/-u, describe --dirty, diff-index, diff-files, fetch and pull recursion and --ignore-submodules on the command line enter submodules anyway (#37). --clone is the only way to keep VM code away from host git. - devvm git-protect takes on|off; strict is a usage error (git_protect_strict_refused) naming devvm clone on. Use, help, completion (Modes) and --json reflect it. - A VM left strict reads as on (Mode, Next) and is pinned and kept as on. The first check that finds it stopped (Check, then converter.unstrict: launches, devvm stop, devvm clone on and its undo) removes the value all from the .git/config of each repo its state recorded before that check, under the host's git lock, and only where .git's identity is the recorded git_id (a replaced .git, or a VM with no record after devvm adopt, is left alone, its all named with the manual remedy: git_strict_unknown). Each config is read through safefile first, unlocked for the edit and locked again even after an interrupt (context.WithoutCancel), and checked to still be a regular file in that .git afterwards (git_lock_raced). On a watching host, a config whose sum isn't the check's is left, and the new sums go into the watch's. An interrupt records nothing. Then on is recorded (mode and next) with one warning (git_strict_converted), none when next is off. Set on/off and Unlock (devvm rm) remove it the same way, silently (strictLeft). - strict recorded nothing about a value it overwrote, so nothing can be restored: only all is removed (--unset-all '^all$'); any other value is the user's and stays. This fixes off, which unset any local value. - A config another VM keeps locked keeps it, named with the manual remedy (git_strict_kept, via msg.M.Value), and its repo goes in the state's strict_left, retried at each later stopped check until empty. A config git can't change is named (git_strict_left). - Messages: git_locked and git_embedded_new say what on can't stop; git_locked_strict and git_config_failed go. - Docs: .git protection's Strict section becomes VMs that were strict, with the remedies; on and Not covered say a submodule or repo the VM adds runs through host git until the next check names it, and only --clone keeps VM code away; attack vectors, How it works, the design notes, the commands table, ls, the cli skill and the CLI reference follow. - Tests: strict_test.go (conversion, values kept, off/on/unlock, nested, kept and retried, replaced and unrecorded .git, interrupted, next off, changed since the check, Linux pins and sums, Watch, next, a failed edit), TestUnstrictFIFO, msg TestValue, git_protect.txtar, git_pins.txtar, fixture_v010_strict.txtar (0.1.0's app VM made strict on macOS), e2e project checks on macOS and Linux. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
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]> |
||
|
|
3e81767482 |
refactor(cli): each command carries its own docs link, group and samples
A command's metadata moves from hand-kept tables into the command itself: an about (docs page, help group, why no --json) set as its Cobra Annotations. msg.commandDocs, commandGroups and withoutJSON are gone; TestDocLinks reads the links from the generated CLI reference, and help output and the reference are byte-identical. AGENTS.md's cli and vm rows point at new doc.go package comments. 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]> |
||
|
|
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]>
|
||
|
|
c0f4b8fb5c |
feat(netpolicy): network tiers in state, confinement and the proxy
A VM's network is one of four tiers, open, internet, allowlist and none, in its state's net section (netpolicy.Tier), in place of on/off. Every VM has its proxy. Confined tiers start on NetProxy; open starts on the backend's own network with its proxy set in the guest (Confinement.GuestProxy): on Lima no Seatbelt profile and no QEMU wrapper, the proxy at 192.168.5.2 on both hosts, propagateProxyEnv off. The proxy: Config.Open (every host and address, no floor, no policies), Config.DenyPolicies (files whose denies alone apply), the rule port :* (any port), and ** matching address literals (the floor still holds). Policies per tier (netpolicy.PolicySet): internet is network/internet.policy (**:*) plus your denies; none is the agents' built-in policies, the secrets' hosts and your denies; open none. Links: a client links only to a target on its tier or a stricter one, and a group's VMs are all on one tier. The self-check per tier: open asks its proxy through the guest's settings and warns (net_proxy_unreachable). devvm ls and devvm network show the tier. A backend without egress-proxy offers open alone (net_tier_backend). devvm network on/off and --network-policy/--no-network-policy map to allowlist/open. Design note, threat check and docs; e2e in the network and link sections. 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]> |
||
|
|
e132a29b5a |
refactor(cli): one per-run app holds the run's services
NewRoot makes one app for the run's UI and hands it to every command. The app makes each service the first time a command asks for it and keeps it, or its error, for the rest of the run: devvm's folders (dirs), a test build's overrides, the secrets store, the backends' registry, the shared tools, the VM environment (vmEnv) and the image builder of the backend new VMs get (builder). The retention that runs before a command and the command itself share them. - paths.FromEnv: 23 of 24 calls go through a.dirs; partNames, which the parser's flag and word checks call before any command, keeps its own. - The registry is made once (8 newRegistry calls and newEnv's). - builder(u) (6 calls) and cli's newBuilder are gone: a.builder and the per-backend builders in images, space and gc are vm.Env.Builder, exported, the only builder. setup's feature choice takes a build.Env of its folders and prompts alone. - The shared tools are made once (newTools and vm.NewEnv's), and the secrets store once (companyProxy's, newTools', vm.NewEnv's and _proxy's): vm.NewEnv takes the run's tools and store. - withEnv (46 calls) is a.env; autoRetain, retainOrphans and gc --orphans use the run's VM environment. - thisHost and readOverrides' other callers read the overrides once (a.host); space and gc --caches time out on the registry's host. TestAppMakesEachServiceOnce checks that one run makes each service once and that the VM environment and builder share the run's registry and tools; TestAppKeepsAFailure that a failure is kept. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
120ca70279 |
fix(vm): a VM whose folder is on a disk that isn't connected isn't gone
A folder with nothing at its path is now one of three folder states (vm.FolderOf): there, gone, or not connected. With nothing at the path, devvm compares the device of the nearest folder above it that exists (platform.DeviceOf) with the device in the recorded folder identity (platform.FolderDevice): the same device is gone, another is not connected (a folder moved to another disk and then deleted counts too), and no recorded identity or an unreadable device is gone. devvm ls writes (not connected) and --json gives folder_state (there, gone, not_connected) in place of folder_gone; devvm space names such VMs (space_folder_not_connected) and lists them as folder_not_connected. devvm rm VM refuses one without a terminal, even with --force (rm_vm_not_connected), and in one asks (delete_not_connected_folder_vm), which --force never answers. Tests: TestFolderOf (a fake device: same, other, none, unreadable, and a real deleted folder), TestDeviceOf, the JSON shapes, rm_vm.txtar's not-connected case, ls.txtar. Docs: commands (rm, ls, a folder on a disk that isn't connected), space, troubleshooting, overview. 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]>
|
||
|
|
8ec7547ebd |
feat(cli): devvm rm VM deletes a VM whose folder is gone, and ls and space mark it
A VM whose recorded project folder is gone (nothing at its path) is marked: devvm ls writes "(gone)" after its folder and gives "folder_gone" in --json; devvm space names it in a note and in --json's "folder_gone". devvm rm takes an optional VM, by name or ssh alias, from any folder: this folder's own VM goes through rm; a VM whose folder is there, a name that isn't a VM's, and a VM its backend lost are refused. It asks in a terminal, --force answers, and without either it refuses. Agents' history is exported first unless --no-export; a stopped VM that mounts its folder is refused, as starting it would make the folder again (Lima makes a missing mount's folder); a --clone VM needs --no-clone-check. Never deleted by gc or retention. vm: FolderGone, Lifecycle.RmVM/rmGone, recordedVMs (moved from Links.projectVMs); project: Named (Targets uses it). Messages: rm_unknown_vm, rm_vm_folder_there, rm_vm_lost, rm_gone_stopped, rm_gone_clone, rm_vm_export_failed, rm_vm_failed, delete_gone_folder_vm (answered by --force), space_folder_gone. Tests: testscript rm_vm, ls; TestFolderGone, TestList, TestTargets, TestJSONShapes. Docs: commands (rm, ls, a VM whose folder is gone), space, troubleshooting, coding-agents, overview; CLI reference. 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]> |
||
|
|
79b3ef94d4 |
refactor(cli): one backend: no --backend flag, no BACKEND column
devvm runs every VM on Lima, so the command line has no backend choice: - --backend is gone from devvm, build, rebuild, images, images rm, gc, space, doctor and setup (addBackendFlag, addBackendFilterFlag, setup's own, checkFlagValue's case, its completion); a removed flag now fails as an unknown flag (exit 2). - devvm setup no longer asks for or saves a default backend; config.toml and settings.json have no backend key (settings.KeyBackend, Values and Defaults' Backend, checkBackend, Value.With, Source.File, FromFlag). - Tables lose BACKEND: ls, images (both tables), space (both tables); doctor's FEATURE table is FEATURE and SUPPORT for Lima. space's images row is freed by images rm. - --json keeps every backend field (ls, images, tool records, space, doctor's backend, backend_source "built-in" and every backend's features). - The registry keeps Lookup, For and Default: For(d, vm) gives a VM its recorded backend and a new VM NewVMs, else Default; tests set NewVMs. vm.Env's lookups lose the flag parameter, found.flagIgnored and Options.Backend. - Messages removed: backend_unknown, backend_unknown_default, default_backend, backend_help, doctor_backend_from, backend_flag_ignored; backend_unknown_vm stays (a VM's recorded backend), linked to backends#a-vms-backend. - Docs: Backends' choosing section becomes "A VM's backend"; settings, setup, images, gc, space, doctor, commands and install pages lose --backend and BACKEND; Contributing gains "How a backend plugs in". - Tests: unit tests for For, settings, setup, doctor's table, the tables; CLI scripts check --backend as an unknown flag on devvm, build, restart, images, gc, space, doctor and setup, and a config.toml backend key as unknown; e2e's table checks lose the column. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
1917072228 |
refactor(backend): remove the Docker backend
devvm is about VMs, and Docker's containers aren't VMs: Lima is the default backend and smolvm stays experimental. The backend architecture (Backend, Caps, Require, the registry, backendtest.Fake) stays, so another backend is an addition. Removed: - internal/backend/docker, its registry entry and Names/Experimental's docker half; devvm _docker-connect and _docker-ports (internal/cli/dockerssh.go); assets/docker/unpack.sh. - Test-build overrides DEVVM_DOCKER_KIND, DEVVM_DOCKER_PROC_SYS, DEVVM_LINUX_BUILD_URL/_SHA256, the registry.linuxURL/linuxSHA256 ldflags vars and the CLI tests' Linux-build archive (linux_release). - Interfaces only Docker implemented, with their callers: backend.ProxySocket/ProxySocketOf (the proxy's -listen-unix), DiskUser (ls's and size's disk-over warning, size's disk_used and --json disk_used_gib), Reporter (doctor), LeftoverLister and Leftover (gc --orphans' volumes, networks, containers and images), DockerLayerVM and VMSpec.DockerLayer, SSHTarget.ProxyCommand and vmssh.SSH.Proxy, vmssh.SSH.SessionArgs, CacheEntry.Name. - The docker layer's runtime on a backend that makes VMs for it: vm/dockerlayer.go, KeyDockerLayer, chooseNet's refusal (chooseNet returns a bool now), the refusals at start and devvm network on, ls's "(sysbox)" and --json docker_layer, size_disk_default_unused. - The proxy's relay mode (relay.go, -relay, -relay-to, -listen-unix). - paths.Dirs.Docker and paths.VM.Lifeline. - assets/guest/tools.sh's linked-folder branch; services.sh's DEVVM_LOOP, DEVVM_DOCKERD and DEVVM_SSHD=inetd. - Messages: every docker_* the backend used, docker_layer_runtime, net_docker_layer, net_off_docker_layer, committing_image, pulling_image, unpacking_tools, disk_over, size_disk_default_unused, gc_orphan_volume/_network/_container/_image, docker_connect_failed; gc_orphan_elsewhere reworded. - Tests: docker.txtar, the docker stub's engine (its --from half stays), the ssh stub's login-shell branch; e2e's --backend docker, --engine, the docker host VM and Docker Desktop runs. - Release: one GoReleaser pass, no Linux-build pin in the macOS builds, no Linux devvm in the Homebrew formula's libexec. Linux builds stay. - Docs: backends/docker.md and internals/docker.md, design.md's Docker notes, the Docker column of the feature table, and every page's mentions of the Docker backend, Docker Desktop as one, and Sysbox. Kept: the docker layer in Lima VMs, devcontainer docker-in-docker, --from with images only a local Docker has, Docker Hub references. State written by a Docker VM before this reads as an unknown backend (backend_unknown_vm). Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
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]> |
||
|
|
bdd26779b4 |
fix(cli): only a test build reads the test overrides
DEVVM_HOST_MISE (which replaced the pinned, checksummed mise), DEVVM_KVM and DEVVM_UBUNTU_URL were read in every build, a release's included. One ldflag in a leaf package, internal/testbuild (testBuild=yes, set by tests/e2e.sh and the CLI tests), now marks a test build, and cli's readOverrides is the one place devvm reads every test override, into Overrides (registry.Overrides, with platform.Overrides for the host's size, and HostMise): empty unless testbuild.On(). registry.New takes them; lima.New takes Ubuntu's URL; ubuntu.New takes a URL, not getenv; Lima's and smolvm's KVM default to /dev/kvm; tools.Env has Mise in place of reading DEVVM_HOST_MISE; platform.NewHost takes Overrides. Gone: registry.unreviewed, registry.Host, newFor, hostFor, ubuntu.URLEnv. The documented settings (DEVVM_LIMA_HOME, DEVVM_SECRET_SERVICE, DEVVM_NO_TOOL_CHECK, DEVVM_FROM) stay as they are. Tests: TestReleaseReadsNoOverrides (cli: a release reads none, its mise, KVM, unreviewed and host its own), TestOverrides (registry: every override reaches its backend, none leaves the defaults), TestHostOverrides and TestListTimeout (platform) and ubuntu's TestNew moved to the new shapes. Docs: contributing/testing.md's Test builds, contributing's sandbox table. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
9b7652d347 |
feat(link): links in VMs' lifecycle, and the link backend feature
backend.FeatureLink ("link"), native on Lima, smolvm and Docker, with its
row on internals/backends.md; linkFeatures() returns it, so link add, each
launch, the session and each connection check it with Require.
- Env.Links is guestLinks: an address and a name per target, by address,
none for a target whose policy rule no longer holds.
- Launch (setUpVM, after the ssh config pins host keys): linkRuns.atLaunch
starts devvm _links detached (pid in run/<vm>.links.pid, its log in
logs/<vm>.links.log), warns once per stopped target (link_target_stopped)
and per target whose policy rule broke (link_policy_mismatch) or whose
backend lacks links (link_target_unusable), never starting one, and
reads the new session's log for refused forwards (link_port_taken).
- link add and link rm on a running client send the setup again and make
sure _links runs (linkRuns.apply), reporting a new link the VM refused;
on a stopped one, links_next_start.
- Stopping: Lifecycle.Stop and every Env.start stop the session; a session
killed has its sockets removed; its masters' control sockets go with
their ssh.
- devvm rm (Lifecycle.forget, so gc --orphans and retention too) stops the
session and removes every link to the VM from other clients
(links_target_gone), giving running clients their links at once.
- devvm network off on a target linked by clients with policy
(network_off_linked) and on for a client linked to a target without
(network_on_linked) are refused.
- link unpublish names the clients that link to the withdrawn ports
(unpublished_linked).
- devvm ls has a LINKS column and "links" in --json; devvm doctor lists
link; gc --orphans removes links to VMs without state and link sockets
nothing listens on, which devvm space counts as leftover state.
- net_off_log says devvm logs only a VM's links' connections without
network policy.
- Lima: Start already compares the guest environment, so it edits only
when the links' names change (TestStartSetsLinkNames); lima.md and the
design note say the edit's new host keys are pinned again at the start.
Fixes to the earlier link code: vmssh's masters left their control
sockets when killed; the session's log names a forward the VM refused on
a line of its own (ReadLinksLog).
Tests: vm TestGuestLinks, TestPolicyLinked, TestUnlinkTarget,
TestLinkLeftovers, TestLinkRuns, TestLinksAtLaunch; vmssh TestReadLinksLog;
lima TestStartSetsLinkNames; link.txtar updated, link_life.txtar new, the
stub ssh carries link masters; e2e's project section has a link smoke check
on Lima.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
||
|
|
0b03f334fb |
feat(cli): help in groups, with short texts, examples and each command's docs page
devvm --help lists the commands in groups: Your VM, Change your VM, Images, Disk space and This machine, with help under Cobra's Additional Commands. A group whose commands don't exist yet, such as Links between VMs, stays out of the help. Each command's Long is one to three sentences, and the rules it held are on the command's docs page. Every visible command has an Example, with the most common invocations first, each with a comment. Flag descriptions are shorter. Each help ends with the address of the command's docs page, and the root's also ends with the issue tracker. - internal/cli/help.go: commandGroups, addGroups, addDocs (Cobra's usage template with Docs and Issues sections), examples - internal/msg/docs.go: commandDocs, CommandDoc, CommandDocURL, IssuesURL; TestDocLinks checks commandDocs (user pages only) - docgen: each reference page has a Docs section before See also - docs: commands.md in the help's groups, with new sections on restarting and stopping and on deleting a VM; install.md has doctor's engine, feature values, Docker and CA notes; Contributing describes a command's help - tests: TestExamples, TestHelpGroupsAndDocs, TestAddGroups, TestWithDocs, TestCheckCommandDocs Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
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]> |
||
|
|
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]> |
||
|
|
7259ad13a1 |
feat(docker): the docker layer on Docker VMs with Sysbox
Docker's engine runs inside a Docker VM only under Sysbox, on a Linux engine of this machine's: its own user namespace, its own network with nothing else on it, volumes of its own for Docker's and containerd's files, dockerd started after each start. Made with the layer or given it in place (its container made again from a commit); a failed add in place makes the VM as it was. Elsewhere refused in one line (docker_layer_no_sysbox, docker_layer_needs_vm); devvm never runs a container --privileged. No network policy for it at any step (net_docker_layer): root in it controls its own network. A bridge routing to this machine's loopback (Docker's userland proxy off), or one whose setting can't be read, is refused at creation and each start (docker_route_localnet, docker_bridge_unreadable). Set-id files of root's, or root's group's, in the project folder are named apart as running as root (setid_root_files); setid_files says the rest run as their owner. Root in any Docker VM writes the folder as the host's root. Reviewed with the security-audit skill; e2e on the Linux engine with Sysbox 0.7.1 (135/0) and Docker Desktop (115/0, the refusal). Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
9ec1601801 |
feat(docker): an experimental Docker backend, its containers and native features
Each VM is a container from an image devvm builds by running its scripts in a container and committing it. A container is not a VM: on Linux it shares the host's kernel, on macOS Docker Desktop's one VM; docker.md says so first. - internal/backend/docker: build-image (docker commit; base from Ubuntu's image by digest, prepared by the container scripts smolvm shares, now in assets/container), from (any image Docker has or pulls), clone, project-mount and agent-folders (bind mounts), tools-share (tool images unpacked into a volume by a network-less container, linked by guest/tools.sh; ToolFormat dir-<unpack.sh>), cpus and memory (docker update). Build confinement native only on a rootful engine of this Linux machine; Docker Desktop and other engines build nothing yet. - Containers run --init and a sleep; services.sh after each start, without Docker's daemon. Mounts and network are hashed into a label; a start that finds them changed commits the container and makes it again under the same name (flattened past 100 layers), its home a per-VM volume. - The VM's user has the host's uid, and on Linux its gid. A --clone VM's clone gets a volume (VMSpec.CloneAt). - Disk none: DiskUser reports what a VM holds (devvm size's disk_used), warned past base's disk by launches and ls; a default disk size is left out of a new VM on such a backend, said. - Everything labelled devvm.data=<data folder>; only labelled resources are touched; names Docker shares between users carry its hash. - Problems: docker on PATH, a reachable engine (or the docker group fix), 29.1+, Linux containers, this machine's arch; Report names the engine and Docker Desktop's file sharing, which CreateVM checks. - ssh, ports, ports-all, agent forwarding and toggling, egress-proxy, disk and the new docker-layer feature are none: refused in one line. Builds ask for build features only when they build, so a built image works where it couldn't be built. - testdata/stubs/docker: a stateful engine; docker.txtar; unit tests; tests/e2e.sh --backend docker on a Linux engine in a Lima VM e2e keeps (~/.lt-e2e-go-docker) and on Docker Desktop, with images copied from the Linux run. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
851e39ef86 |
build: embed devvm's files in its binary
devvm is one file: assets/ (base.yaml, layers/, features/, shared-tools/, guest/, oci/, smolvm/) is embedded as assets.FS, which cli passes to every constructor; backends, the builder, the shared tools, the proxy and Ubuntu's key check read it as an fs.FS. Scripts reach VMs on stdin (backend.Script carries their contents). What needs a path (limactl create's base.yaml, oci/ mounted into the conversion VM, the proxies' policy files) is written out to ~/.local/share/devvm/assets/<hash>, atomically, files 600 and folders 700; devvm gc deletes older copies no VM's proxy was started with (gc_assets, deleted_assets). Release archives hold the binary with README.md, CHANGELOG.md and LICENSE, and the formula installs the binary alone. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
a76ceb6e48 |
refactor(backend): name the package that builds every backend registry
internal/backend/registry builds the registry of every backend devvm has: registry.New(dirs, u) returns the *backend.Registry, and registry.Experimental names the experimental ones. Test builds set registry.unreviewed with -ldflags -X (tests/e2e.sh, the CLI tests, testing.md). The unexported constructor for a given build and DEVVM_UNREVIEWED is newFor. 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]> |
||
|
|
e5df9e22df |
feat(ls): list project VMs with a BACKEND column
devvm ls lists the project VMs on every backend, sorted by name: NAME, STATUS, IMAGE (base (from node:24) for a --from base), GIT (on, off, or clone for a --clone VM), NET (on, off, or unenforced: a failed self-check, or running but not confined by devvm), BACKEND and FOLDER. Images and build VMs aren't listed; a project VM named like an image is. What a VM's state lacks is -. A backend that can't list fails ls only when a VM's state names it. - vm.List, netpolicy.Listed, state.VMNames - messages: image_from, ls_failed - bats cases converted: delete.bats "ls and the ssh config include a project VM named like an image" (ls half), network.bats "ls shows network policy: off, on, unenforced" and the ls check of the direct route case (testdata/script/ls.txtar, Go table tests) - e2e: ls checks in project and network - docs: commands.md (Listing VMs), network.md, lima.md, CLI reference Co-Authored-By: Claude Opus 5.5 <[email protected]> |