mirror of
https://github.com/devvmhq/devvm.git
synced 2026-12-01 06:23:17 -10:00
main
25
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
c41ca82f6e |
fix(project): devvm's own folders are compared by identity; a launch warns of a project in an agent's folder
project.Unsafe's Holds and Inside compared a project folder with the home folder and devvm's config, data and Lima folders by name alone (paths.Within, paths.Below), so on a volume that ignores case, as a Mac's does by default, a project at ~/.Config/devvm/layers passed both and its VM got devvm's settings and layer scripts read-write. They now compare by identity too: paths.In, the vm package's isIn moved to its owner, finds the path or a folder above it to be the same folder as the other, by device and inode, and paths.Under is In for the path's folder. An empty folder holds nothing, so an unset one can't match the working folder. sshagent's mountedBy, which refuses a key in a folder a VM mounts, compared by name in the same way and uses paths.In now. Each launch (Launch.Up, beside warnMounted) warns once, in one line, when the project folder it mounts is inside an agent's folder in the home folder or holds one (project_agent_folder), naming every such folder from the agents' registry, with agent_import_project_inside's detection (overlapsAgent). A --clone VM mounts nothing and gets no warning. Tests: TestUnsafeIgnoresCase, TestInAndUnder, TestMountedKeyIgnoresCase, TestWarnAgentFolders; the case checks skip on a volume that tells names apart by case. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
ba5613e1ed |
fix(project): a folder name's run of separators becomes one dash in its VM's name
A folder named x--y, "foo (copy)" or "C++ stuff" failed to get a VM (#52): project.Slug turned each character other than a-z and 0-9 into its own dash, and Lima's instance-name grammar refuses separators in a row. Slug now writes one dash per run. - vmname: the project-VM grammar refuses dashes in a row ([a-z0-9]+(-[a-z0-9]+)*); HasRuns recognises the names releases up to 0.1.1-rc.3 made for such folders. - state: a vm.json whose name HasRuns and that has no created time is read as no state. Only a create that Lima refused leaves one (vm.json is written before limactl clone), so the folder's next VM, in the same hash folder, replaces it, rather than every read failing as corrupt. One with created set is still corrupt. - The limactl stub refuses names Lima refuses on create and clone; TestLimactlStubContract gains a refused clone, checked against real Lima. - Tests: TestNamesLimaTakes (Lima's regex as the oracle), TestHasRuns, TestVMWithRuns, TestLimactlRefusesNames, name_runs.txtar (a new VM for x--y, and an older release's leftover state replaced). - Docs: internals/backends.md's VM names; CHANGELOG Unreleased Fixed. 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]> |
||
|
|
fb19879aaa |
fix(msg): one rule for which characters reach the terminal
msg.Safe is the one owner: a graphic character in any script is safe; controls, bidi controls, format characters, variation selectors, private use and the invisible fillers are not. Printable and OneLine drop what Safe refuses, agent save's diff escapes it, and forbidigo bans unicode.IsGraphic, IsPrint, IsControl and Bidi_Control outside internal/msg. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
8d44175601 |
refactor: the Go module is github.com/devvmhq/devvm
Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
e9ca7a4859 |
feat(vm): a moved or renamed project folder keeps its VM
A VM's files and machine are keyed by its name's hash, which stays; what moves is the state's dir. The finder finds a folder's VM by the state that records its path (finder.state: the path's hash first, then every state, recorded), so a VM moved there is found from the new path alone, and links by path (project.ForDir) match the recorded dir. When the folder has no VM, the finder looks through the states for one made for this folder at another path (moveHere, move.go; the match is here.movedFrom): the same folder identity (device, inode, birth time), the folder this user's, its identity unique (platform.UniqueFolderID: an ID with a birth time, and on macOS APFS or HFS+), another recorded path that's gone on the folder's device or only a symlink to here, its creation finished, not a --clone VM. One match is offered: in a terminal move_vm, [y/N]; without one vm_moved_here, naming devvm adopt; devvm adopt --force moves it without asking. Several matches warn (vms_moved_here) and move none. Never automatic. The move (finder.move) refuses a folder no new VM may have (checkUnsafe), holds the creation locks of the VM and of the folder's would-be new VM, checks again that no state records the folder and that the folder is still the one asked about (move_folder_changed), stops a running VM as devvm stop does, then records the path and identity under the VM's lock, refusing a state that changed meanwhile (create_running); vm_adopted says so. .git protection's record is kept: .git, its identity and its uchg locks move with the folder. The project folder's mount is now part of backend.Want (Want.Project, Instance.Project, Apply), so the next start mounts the folder where it is: Lima's wantEdits rebuilds .mounts in its one edit when the project mount or the agent folders differ (mount.project). A VM running with another path asks to restart (Y/n) and otherwise warns (next_start_folder, folder_next_start). A new VM at the old path can't use the moved VM's folder, so newName takes the first of the path's names whose VM folder holds no state (project.Nth: the hash of the path, then of the path and n). devvm adopt [VM]: with VM (by name or alias, as devvm rm VM), moves a VM whose folder is gone or not connected to this folder, for a copy on another disk (a new inode, never matched on its own): adopt_move_vm [y/N], --force, adopt_move_refused without either; refuses a --clone VM (adopt_clone), a lost machine (rm_vm_lost), an unfinished VM, a folder still there (adopt_folder_there) and a folder with a VM of its own (adopt_has_vm). It clears .git protection's record, as the copy's .git is another. rm_vm_state_mismatch is gone, as a dir needn't hash to the name any more: devvm rm VM acts as devvm rm only on the folder's own VM (finder.folderVM), and a VM whose state names a folder with another VM of its own is refused as one whose folder is there. macOS's FolderID has the folder's birth time too, as Linux's has. Security review (security-audit skill, focused, with an independent read): inode reuse needs a unique identity (birth time; APFS/HFS+ on macOS), the same device (in the ID) and the old folder gone; another user's folder never matches (its owner checked); a copy has a new inode and never matches; links and groups go by name and stay, and links by path take the recorded dir, a move refused when another VM records it; a symlinked cwd is resolved first, and a symlink at the old path counts only when it resolves here; .git protection's record stays for a move and is cleared for a copy; agents' mounts are unchanged (only the project mount changes); a VM can rename only folders inside its own mount, which it already writes. Fixed from the review: a folder swapped at the path while devvm asked was moved to (now move_folder_changed); macOS device:inode could collide with a later volume given the same device number (birth time added); a running VM kept the old path's share, which a new folder made there would reach (the move stops it first); a move to the home folder or into devvm's own folders (now checkUnsafe). FolderID's format change makes VMs and .git records made before it look like other folders (adopt them, or make them again). Tests: TestMovedFrom (table: gone/present, same/different device and inode, a non-unique ID, another user's, a clone, unfinished), TestMovedAway (gone, a folder, symlinks here/elsewhere/dangling), TestMoveHere (refused, no, yes, found by its dir, stopped, the new mount at start, a restart for a running old mount, a new VM at the old path by its next name), TestMoveFolderChanged, TestAdoptMoved, TestMoveHereSeveral, TestAdoptVM, TestUniqueFolderID, ForDir and Nth in project, wantEdits' moved project, the conformance start's moved project; move.txtar (refused, no, yes, found, Lima's mounts edit, a new VM at the old path, adopt VM of a copy); rm_vm.txtar's hand-edited dir; e2e project: mv, refused, a yes in a terminal (script), the home file kept, the new path mounted alone, moved back with adopt --force. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
da5bae47f9 |
fix: tighten VM names, validate aliases, make written folders private and choose build VMs' ssh ports under the claims lock
- vmname.IsVM takes a name's folder part only as project.Slug makes it ([a-z0-9-], a letter or digit at each end), so a hand-edited name never carries spaces, slashes, newlines or ssh patterns. TestSlug checks that every name project.New makes is one. - vmname.Short and vmname.IsAlias: a VM's alias is devvm-<folder> of its own name or the name itself. sshconfig.Host, ChooseAlias and project.Named ignore any other alias, so one edited into vm.json never reaches the ssh config's Host line or names a VM. - state's writeFileMode makes a missing folder with PrivateDir (exactly 700, whatever the umask, a link refused); a folder already there keeps its mode. - ports.Allocator.Build chooses a build VM's ssh port on macOS under the claims lock (state.Claims, which VM.Claim now shares), records it in run/build-ports/<name> until limactl start returns, and ports.Used reads those records, so no VM or forwarder takes the port before Lima binds it. Lima's own freePort and platform.PortFree, its only user, go; Lima gets a Ports field (the allocator). paths.Dirs.BuildPorts is new, and Dirs' method limit goes to 54. Tests: TestIsVM, TestIsAlias, TestSlug, TestChooseAlias, TestWrite, TestTargets, TestWriteFileMakesPrivateDir, TestBuild, TestStartBuildSSHPort; layout.txtar lists run/build-ports on macOS. Docs: internals (backends, overview, design), contributing, using/space. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
8670db2df9 |
refactor(project): trim project to the folder, its VM's name and its unsafe folders
What a folder's files call for (detectFiles) moves to internal/vm's detect.go, beside the parts a new VM gets. The set-id check and SSHRemote move to internal/hostsafety, beside gitprotect. The set-id walk skips .git folders and runs only once the VM is stopped (devvm stop, or a launch that finds it stopped) and when a VM is made, never at a launch into a running VM: measured on APFS at about 5 us a file, 1.0-1.3 s for 220,000 files, 65 ms for a 20,000-object .git alone. internal/paths owns resolving and comparing host paths (resolve.go): Physical (every link, as far as the path exists), PhysicalParent (the folder's links, the last element as named) and, for a path that must exist, filepath.EvalSymlinks itself; Within (the folder or inside it) and Below (inside only). project's Unsafe and Parents, sshagent's mountedBy and recordedPath, Lima's Seatbelt paths and QEMU's PATH search, and the home copy's skips use them. Tests: TestPhysical, TestWithinAndBelow, TestSetIDOnStop (named at creation and stop, not at a launch into the running VM; not in .git), SetIDFiles' .git and missing-folder cases; detect's and hostsafety's tests moved with their code. Docs: when set-id files are named, on the user, safety and internals pages; the contributing page on the resolvers; AGENTS.md's layout rows. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
74f41b0efb |
refactor(image): one shared-tool table
image.SharedTools, a table of image.ToolDef (name, kind, members, the files that call for it, its installer), is the one list of shared tools. image.Toolchains, image.Agents, GroupTools, IsTool, IsAgent and SortTools derive from it, and so do project.DetectFiles' toolchain markers (the nix layer's own files stay in project), the lock's rust case (image.NoDownload, for a tool rustup installs) and the devcontainer features devvm maps to a toolchain. Tests: TestSharedTools (the views, NoDownload, each member once), TestSharedToolsPolicies (shared-tools' policies are one per shared tool), and TestConfigTools now checks mise.toml's tools against the table's members. The contributing page names the table and what adding a shared tool takes. 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]> |
||
|
|
f4fd373439 |
refactor(backend): remove the smolvm backend
Lima is devvm's only backend. The backend architecture stays (Backend, Caps, Features, Review/Require, the registry, backendtest.Fake), so another backend is an addition. State from a smolvm VM reads as an unknown backend (backend_unknown_vm, gc_orphans_unknown); nothing migrates it. The image keys of layers/docker.sh, layers/nix.sh and features/desktop.sh change, so images rebuild once. Lima's port forwarder moves off smolvm's files first: newForwarderCmd and forwarderMain from internal/cli/smolvmports.go to limaports.go, and assets/container/ports.sh to assets/guest/ports.sh (sent by the forwarder at run time, so no image key changes). Removed: - internal/backend/smolvm (4,070 lines with tests), _smolvm-ports, its registry entry, registry.Experimental and backend_experimental. - The decider: backend.Decider/UsesDecider, Confinement.Decider and DeciderToken, internal/proxy/decider.go and its test, the proxy's -decider, -decider-to and -decider-token-file, netpolicy's KeyDeciderPort, KeyDeciderToken and deciderToken, the decider port in vm's forwarding and UsedPorts. - backend.AgentStarter/AgentUnchosen, vm's checkAgentStart and agent_unchosen_stop. - vmssh/key.go (EnsureKey, Public, HostKey, ServicesArgs, Capped). - paths.Smolvm/SmolvmImage and space's smolvm folders; paths.VM's Record, Key, KnownHosts and ProxyURL; project.Detect, which nothing called (a test helper now). - ubuntu.ContainerRepo/ContainerDigest/ContainerRef/ContainerOrigin and bump.sh's ubuntu_image, with its part of bump.txtar. - assets/smolvm/ and assets/container/; the no-init-system branches of layers/docker.sh, layers/nix.sh and guest/sync.sh, and the notes in features/desktop.sh and guest/ca.sh. - Messages: smolvm_* (14), vm_no_ssh, vm_no_sshd, ports_no_ssh, creating_from_image, packing_image, pack_failed, backend_experimental, agent_unchosen_stop; descriptions naming smolvm reworded. - Tests: smolvm.txtar, the smolvm stub, registry, decider, netpolicy and sshagent cases; gc_backend, gc_skipped, gc_orphans and space test a failing or hanging Lima listing instead (the limactl stub's list-fails and list-hangs); the --backend smolvm examples; e2e's --backend smolvm and its section (about 1,130 lines), the smol_* helpers and the link section's backend switch. - Coverage: internal/backend/smolvm's lines in both baselines. - Docs: backends/smolvm.md, internals/smolvm.md, design.md's smolvm notes (Ports on Lima now holds the forwarder's description), the backends table's smolvm column, every page naming smolvm, the README, the home page's backends art, and AGENTS.md's smolvm rows and gotchas (and the Docker bind-mount gotcha, which nothing refers to). Kept: the docker layer, on Lima; --from's local Docker; --backend, the BACKEND column and setup's backend choice, which the next commit removes. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
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]> |
||
|
|
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]> |
||
|
|
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]> |
||
|
|
82566e9010 |
refactor: shell quoting, the VM-name grammar and value patterns each in one place
internal/shell, a stdlib leaf: Quote, QuoteJoin and EnvName. They
replace the 4 shell quoters (lima's shq and shqJoin, docker's shq, vm's
and devcontainer's shellQuote) and the 4 variable-name regexes (docker's
envKey, vmssh's envName, vm's envVarName, devcontainer's envName).
lima's quoting tests move there as TestQuote and FuzzQuote.
internal/vmname, a stdlib leaf below project: Prefix, HashLen, IsVM and
SlugOf. project's vmName regex, IsVM and Prefix go (callers use vmname),
lima's projectVM, docker's hostname parsing and cli's export-name regex
use it. TestImageKey (lima) pinned imageKey before the change;
TestParseExportName covers the export names.
Value patterns exported once: from.IsDigest (lima's idPattern),
image.IsKey (build's keyLike and the keyPattern copies in lima, docker
and smolvm), image.ToolVersion (tools' versionLike) and image.ToolName,
with TestIsDigest and TestValuePatterns. state's featureName stays:
internal/state may not import internal/image.
netpolicy.PolicyFiles names a user layer's policy file only for a part
image.LayerName takes, so an image-name part such as ../x never names a
file outside the user's layers; TestPolicyFiles's ../x cases failed
without the check.
The structure test's owners check gets literals: a non-test string
literal holding '\'' outside internal/shell, or [0-9a-f]{14} outside
internal/vmname, fails, naming the owner. TestRulesFail has cases that
break and keep both. shell and vmname join the leaves' layer, and
devcontainer may import shell. Coverage baselines: shell and vmname
added at 100.0.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
||
|
|
9c2511117b |
fix(hostgit): host git runs no program a repo names, nothing of devvm's environment, and ssh only to the VM
devvm ran git on the host bare: --clone's git status could run a repo's core.fsmonitor or filters, its push, fetch, update-ref and remote remove the repo's hooks, and git could ask on devvm's terminal or follow GIT_DIR from devvm's environment. internal/hostgit is now the one runner (Command, Output, Status), with its settings as GIT_CONFIG_COUNT pairs: core.fsmonitor=false, core.hooksPath=/dev/null, core.alternateRefsCommand=true, hook.EVENT.enabled=false for every githooks(5) event, protocol.allow=never with protocol.ssh.allow=always; and, for a command with -C DIR, hook.NAME.enabled=false and filter.NAME's clean/smudge/process emptied with required=false for each hook and filter driver DIR's config names. It drops every GIT_* variable and relative PATH folders, and sets GIT_TERMINAL_PROMPT=0, GIT_NO_LAZY_FETCH=1 (a repo that says it's a partial clone fetches nothing, with its core.sshCommand or ssh), GIT_SSH_COMMAND=false (no ssh but gitSSH's) and GIT_SSH_VARIANT=ssh; maintenance.auto=false and gc.auto=0. Status adds --no-optional-locks and --ignore-submodules=all. Callers: gitprotect (git, ignoreSubmodules), project.SSHRemote, vm/sync's gitConfig, vm/clone (hostGit, gitSSH, saveFetched, the uncommitted-changes status). gitSSH takes the VM: ssh with BatchMode, StrictHostKeyChecking, devvm's known hosts only, HostKeyAlias=VM, ForwardAgent=no and ClearAllForwardings=yes, so a url.*.insteadOf reaches only the VM with its pinned key. The seed push adds --no-verify, --no-recurse-submodules and --no-signed; rm's fetch --no-recurse-submodules. Not neutralized: an include.path can make gitConfig read user.name/email from another git-config file (sent to the VM as its identity), and a FIFO as a config file hangs git until Ctrl+C; neither runs code. A VM swapping the repo's config between repoOff's listing and the command could hide a filter from it, and a --clone VM's root (its host key) working with another VM that writes the repo could send the push to a server of theirs; both documented in internals/git-protection. Tests, each with plain git first running what the hardened one doesn't: hostgit's TestCommandNoFsmonitor, TestCommandNoHooks (reference- transaction, pre-push, from .git/hooks and a core.hooksPath; path, file:// and ext:: pushes refused), TestCommandNoConfigHooks (hook.NAME.*), TestCommandIgnoresGitEnv (GIT_DIR, GIT_WORK_TREE; environ), TestCommandNoLazyFetch (a partial clone's core.sshCommand), TestStatusNoFilters (clean, process, required, names with dots, = and capitals), TestStatusNoSubmodules; vm's TestHostGitNoFsmonitor and TestCloneRunsNoHooks (seed push and rm's fetch, update-ref and remote remove); clone.txtar's push ssh options. Docs: safety/attack-vectors (devvm's own git commands), internals/git-protection. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
4ea141b918 |
feat(link): devvm link, link add, rm, publish and unpublish, with their state and checks
Links between VMs' commands and state, without anything carrying a connection yet. - state: every VM gets a random ID (KeyID, "id") when CreateVM makes it. - vm: Links (links.go) lists, adds and removes the folder's VM's links (KeyLinks, "links": NAME,PORT,TARGET,TARGET_ID,ADDR entries) and publishes and withdraws its ports (KeyPublish, "publish"). Each target gets one address in 127.77.0.0/16 per client, the lowest free. CheckLink says why a link doesn't apply (gone, replaced, unpublished, policy). - project: Matching (which sshconfig.Alias now uses), IsPath, ForDir and Targets resolve a link's TARGET: a path, a VM's name or a folder name. - cli: link.go, in the Links between VMs group; --json on devvm link and devvm link publish; --as checked with the other flag values. - Messages: no_vm_link, link_failed, link_port_invalid, link_ports_invalid, link_unknown_target, link_ambiguous_target, link_self, link_not_published, link_policy_mismatch, link_name_invalid, link_name_host, link_name_taken, link_target_named, link_exists, link_added, link_trust, link_removed, link_not_found, link_port_taken, published, unpublished, port_not_published. - Docs: the Links between VMs table on the Commands page, the CLI reference, AGENTS.md and the cli skill's tree. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
625a5e0431 |
refactor(paths): no folder or comment for a devvm that isn't this one
Dirs.Bin named a folder nothing of this devvm makes or reads, so it goes, with its test row, and the structure test holds Dirs to its 39 methods. The project test's example of a folder inside the data folder is mise/, one devvm uses. The tests of folders made the user's alone (netpolicy's Prepare, an export's folder) and of the proxy's variables leaving a smolvm machine's environment state the rule instead of where a folder or a variable came from. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
91a429108f |
feat(images): a built-in nix layer with Nix, direnv and nix-direnv, pinned
nix is a layer devvm ships, as docker is: devvm nix, devvm node+nix, devvm build nix, or added to an existing VM in place. A folder with flake.nix, shell.nix or devenv.nix at its top level, or a default.nix that makes a shell (mkShell), gets it after its toolchains, so package.json and flake.nix give node+nix. - assets/layers/nix.sh: Nix 2.35.4's release tarball (releases.nixos.org), its version and SHA-256 per arch at the top, checked against the tarball's .sha256 files and nixos.org/nix/install, fetched with devvm-fetch; 2.35.3 fixes GHSA-hf6w-2rg9-v84g (store ownership in the scripted installer) and CVE-2026-110450 (store corruption through the daemon's repair flag). The tarball's own install --daemon --yes --no-channel-add, with experimental-features = nix-command flakes, trusted-users = root, sandbox = true and sandbox-fallback = false. The installer runs without proxy variables (it writes any it finds into a systemd override for nix-daemon, which would put a build's proxy into the image) and with NIX_SSL_CERT_FILE at the system's bundle. The layer checks the store is root's, adds Nix's default profile to the end of sudo's secure_path (/etc/sudoers.d/devvm-nix, checked with visudo), and appends Nix's profiles to BASH_ENV's PATH. direnv 2.38.2 (per arch) and nix-direnv 3.2.0's direnvrc, pinned the same way; direnv's hook in ~/.bashrc.d/direnv.sh, which loads before mise.sh so direnv's prompt hook runs after mise's and a dev shell's PATH comes first; a direnv lib file puts each project's layout under ~/.cache/direnv/layouts, so nix-direnv writes no .direnv into the project folder. Without systemd the script refuses in one line. - assets/layers/nix.policy: cache.nixos.org, channels.nixos.org, releases.nixos.org (GitHub is in base.policy). - assets/guest/sync.sh: nix-daemon gets a systemd drop-in with the VM's proxy (http_proxy, https_proxy, no_proxy) under network policy, removed when it's off, the daemon restarted when it changed. - image.NixLayer in Builtins; project.Detect's nix marker (a default.nix is read only as a regular file, at most 64 KiB); backend.FeatureNixLayer (nix-layer), needed by a VM of an image with the layer and by building one: Lima native, smolvm and Docker none, so both refuse in one line (backend_lacks); dockerLayers.choice returns every layer feature of the image, so docker+nix on Docker needs nix-layer too. - scripts/bump.sh: nix (the version nixos.org's installer names, the sums Nix publishes; it fails when the installer names no tarball, as Nix's Rust installer will), direnv, nix-direnv. - Docs: using/images (built-in layers, detection), using/toolchains (Nix projects), safety/network (the layer's hosts; source builds' hosts blocked), internals/images (the nix layer), internals/network (the daemons' drop-ins), internals/backends (nix-layer), internals/design (the nix layer beside Instead of Nix), backends, customizing, coding-agents, contributing (the e2e section); the CLI reference; AGENTS.md's assets/ and e2e lines. - Tests: Detect (markers, default.nix with and without a shell, a linked one), layer and environment lists, layer new nix reserved, nix-layer in ImageSpec and ImageFeatures, caps tests, up_checks.txtar (node+nix detected under an agent), docker.txtar (nix refused for a VM and a build). e2e nix section: the layer built behind a company proxy leaves no proxy settings and no password on its image's disk; a node+nix flake VM with network policy: pins, a root-owned store, sandbox without fallback, trusted-users root and an untrusted substituter ignored, the daemon's drop-in, nix run nixpkgs#hello, sudo nix and nix over ssh, the flake's node ahead of the shared node prompt after prompt through direnv, no .direnv in the folder, a blocked fixed-output fetch named by devvm-why, and the drop-in gone after network off. Review (security-audit skill, guidance mode, against the review task's list): the tarball and direnv's files are pinned in devvm's source and checked before tar or install runs; nothing from the host goes into the image (no proxy override, e2e greps the disk); the drop-in holds only the VM's own proxy URL, devvm's value, and goes when policy is off; trusted-users stays root and an untrusted user's substituters are ignored (the VM's user has sudo, so that guards an honest VM and the allowlist is what holds); secure_path gains only the root-owned default profile, last; /nix is on the VM's own disk and nothing mounts a host's or another VM's store. Found and fixed in review: Nix's default sandbox-fallback would build unsandboxed without a word where the kernel can't sandbox, so it's off. No confirmed findings. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
23c8dedaba |
feat(vm): devvm in a subfolder uses the parent folder's VM
A folder with no VM and no state of its own uses the VM of the nearest folder it's inside that has one. The lookup stops before the home folder (by its physical path) and the root, and skips a parent whose VM was made for an earlier folder at its path (sameFolder). - devvm (up): in a terminal it asks whether to open the parent's VM in the subfolder ([Y/n]; no makes a new VM). Without a terminal it opens it, with an info line. --here and --clone make the subfolder's own VM without asking. An IMAGE adds to the parent's VM in place after the same question. - stop, restart, update, remove, export, log, network, policy, secret, ssh-agent, git-protect, size, ports, ssh and code use the parent's VM, naming it and its folder first. rm never deletes it unasked: in a terminal it asks ([y/N]) even with -f, which still skips only its checks; without one it refuses, saying to run it in the parent's folder. adopt acts only on this path's VM. - A repo of its own below the parent's folder (a .git folder or file in the subfolder or a folder between): up asks use_parent_vm_repo [y/N], the default a new VM, and makes one without a terminal; the other commands never reach up and say no_vm. - The shell, devvm ssh's folder and devvm code open the subfolder; in a --clone VM, the subfolder when the clone has it, else the clone's top. - project.Parents; Env.lookup and Env.inspect (find split); found.sub, found.shellDir; useParent; Options.Here and the --here flag. - Messages: use_parent_vm (dir, parent, vm), using_parent_vm (dir, vm), delete_parent_vm (dir, vm), rm_parent_vm (dir, vm), use_parent_vm_repo (dir, parent, repo, vm); all but the delete_parent_vm prompt linked to getting-started/commands#a-subfolder. - Tests: TestParents; TestLookupParents, TestUpInSubfolder, TestShellDir, TestCommandsInSubfolder, TestSubfolderRepo; testdata/script/subfolder.txtar; up_checks' "My App" folder is made at $WORK, where the script meant it. e2e: the project section opens the VM from a subfolder (pwd in the VM). - Docs: first-vm (coming back to it), commands (--here, A subfolder), using/clone (Subfolders), internals/overview (A subfolder's VM), internals/security; the CLI reference for devvm and devvm rm. 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]> |
||
|
|
548113d726 |
build(lint): enforce contexts, nolint reasons, reassign and function size
.golangci.yml: - forbidigo bans context.Background and context.TODO outside internal/ui and cmd/devvm. - nolintlint requires each //nolint to name its linters and say why, and reports unused ones. - reassign (patterns .*) forbids setting another package's variables, tests included. - revive keeps its default rules and adds function-length (100 statements, 160 lines) and cognitive-complexity (75). Fixes: - Backend.Lifeline takes a ctx: smolvm's machine data-dir lookup runs with the caller's. - The proxy's TLS handshake with a VM uses the request's context, limited to 30 seconds. - OAuth token refreshes run within refreshTimeout (30 seconds). - Tests use t.Context(). - Launch.create is split into plan, newVM.record and undoCreate. - lima's TestStartConfined is split into helpers. - smolvm's Terminal comes from its UI's StdinIsTerminal. - Unused //nolint directives are removed. - Fresh contexts that remain (an in-memory TLS parse, lookups shared by every request, a test cleanup) each carry a nolint saying why. Docs: contributing.md lists which lint rule enforces which convention; AGENTS.md names the linters behind its Go conventions. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
4bdb3ea843 |
feat(ssh): ssh config and pinned host keys
Each running project VM can be reached as devvm-<folder> (or by its full name when two folders share a name) through ~/.config/devvm/ssh_config, which up rewrites after the VM's setup. Every entry checks the VM's own host keys, kept in ~/.config/devvm/known_hosts and read from the VM through its backend, and sets StrictHostKeyChecking yes, ForwardAgent no (unless the VM forwards), and its own connection. Only Lima's login options are copied. Host keys are dropped before each start, and when an interrupted new VM is deleted, so they're read again. Ported: write_ssh_config (sshconfig.Write), record_host_keys, forget_host_keys (ForgetHostKeys, in vm start and the interrupt cleanup), ensure_ssh_include (EnsureInclude: asks with [Y/n] on a terminal, else says to add the line; no caller yet: --clone and devvm ssh/code), ssh_alias (Alias), is_project_vm (project.IsVM), check_ssh_agent (vm checkAgent, run when a new VM forwards the agent). Backend.SSH's SSHTarget gains Options (Lima: identityfile, identitiesonly, preferredauthentications, batchmode, compression, gssapiauthentication, ciphers). Registry.All, state.WriteFile. Messages: ssh_include_needed, ssh_include_yourself, add_it_now, ssh_include_added, no_ssh_agent, ssh_agent_empty, load_key, key_loaded, key_loaded_keychain, load_key_with. Doc links: ssh_remote_hint, ssh_include_yourself. Converted bats cases: cli.bats "ssh config: only running VMs, each with its own host key checked; Lima's unchecked settings left out" (ssh.txtar, lima TestSSH, sshconfig TestWrite; the rm half waits for rm), delete.bats "ls and the ssh config include a project VM named like an image" (ssh config half: ssh.txtar, TestWrite), project.bats "ssh_alias: short name unless two folders share it" (TestAlias, ssh.txtar). New: TestWriteUnchecked, TestParseHostKeys, TestEnsureInclude, TestCheckAgent, TestIsVM. Stub limactl: Lima-like ssh.config at start, host keys from shell, sshLocalPort/sshConfigFile in list. e2e: project checks the hostname, the entry, pinned host keys, ssh devvm-web through an ~/.ssh/config of the run's own (Include plus Host * ForwardAgent yes), no agent forwarded (a throwaway agent), a changed host key refused; network checks ssh devvm-net. Nothing touches the real ~/.ssh. Docs: ssh.md (from the ssh page), linked from the index, commands, security, images and contributing. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
49d7205360 |
feat(sync): host settings, agent config and mounts for VMs
A new VM's setup now sends the whole of guest/sync.sh and its host side, staged in memory: the hostname, timezone, UTF-8 locale and git identity; the agents' config files (never their history), with their folders mounted read-only at their host paths (one with a comma is left out, with a warning); and the VM's tokens, as they are without network policy (naming MCP servers whose secrets go too) or as its own placeholders with it. With network policy it also sends devvm's CA, the proxy's address (Backend.ProxyURL), the logins' copies with placeholders and the agents' settings files with secret-looking values redacted (one that can't be read that way isn't sent). UpdateAgentDirs keeps an existing VM's agent mounts current through Backend.SetAgentDirs; its caller comes with up for an existing VM. New docs page: coding agents. Ported: sync_vm, agent_dirs, agent_files, agent_mounts, update_agent_mounts, host_tz, claude_mcp_warn, the settings redaction; guest/sync.sh copied whole (one comment edited). Bats cases converted: - project.bats: agent_mounts (one per line, names with spaces); the four update_agent_mounts cases (Go table tests, plus a running VM restarted once the user agrees) - build.bats: sync_vm staging removed on failure, settings redacted with network policy (testscript sync.txtar) - guest.bats: the prompt, blocked since the last prompt, MCP servers' merge (testscript guest.txtar) - network.bats: claude_mcp_warn (sync.txtar, secrets Go test) Deferred: guest.bats VS Code settings (ssh/code). e2e: project gains agent folders and the VM's setup (mount read-only, settings copied, history never, git identity, timezone, hostname, the token without network policy); network becomes claude+codex and checks the CA installed, the VM's own placeholder, the logins' copies and the host's login files unchanged, with curl verifying TLS (no -k). Agent folders on relaunch and restart wait for those commands. Messages: agent_dir_comma, agent_dirs_added, agent_dirs_removed, update_mounts, mounts_next_start, mounts_updated, no_claude_token, claude_token_invalid, no_github_token, login_copy_failed, config_redacted, config_not_copied, claude_mcp_secrets_copied; sync_failed reworded. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
53c37e4dee |
feat(up): create a project VM and open a shell
devvm [IMAGE] in a folder creates its VM: the folder checked (its path, unsafe folders, a folder made again), its size and ports, the image named or detected and built, cloned with only the folder mounted, its state, .git hooks and config locked (macOS), started, then the backend's shell in place of devvm. Network policy isn't there yet, so a VM is created only with --no-network-policy; an existing VM is refused for now. Ctrl+C before the first shell deletes the VM and unlocks .git. Global flags: --backend, --network-policy/--no-network-policy, --cpus, --memory, --disk, --ports; up's own --unsafe-folder, --no-git-protect. tests/e2e.sh gains a project section, with Lima's Exec quoting checked on a real VM. New docs: commands, security model, .git protection. Co-Authored-By: Claude Opus 5.5 <[email protected]> |