mirror of
https://github.com/devvmhq/devvm.git
synced 2026-12-01 14:33:17 -10:00
main
20
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
b625469ac6 |
fix(vm): devvm rm asks before opencode's worktrees' uncommitted changes go
An export leaves out opencode's worktree folder, as a git repository's config can name a command that git runs, so the uncommitted changes in the worktrees opencode makes there (~/.local/share/opencode/worktree/<project>/<name>, opencode v2.4.1's worktree/strategies.ts) went with the VM's disk on devvm rm, and on a remake with --clean-home, with nothing to say so. The registry gets Worktrees (opencode's worktree/*/*, below its HistoryOwn, TestDefsComplete holding each to a plain pattern there). rm's unsaved-work check, cloneCheck, becomes workCheck: the clone (cloneLost, as before) and the agents' worktrees (agentTrees), one question for both. agentTreesState reads them in the running VM in one command, in its home folder, each * of a pattern sent as *, .[!.]* and ..?* (treeGlobs), so a name that starts with a dot is found: each folder with a .git, its git status and a detached HEAD's commit nothing else has; past 100 it says more. devvm reads at most 8 MiB of the answer, cancelling the command past it, and waits at most treesWait (2 minutes). parseAgentTrees takes the answer as untrusted: whole records of a glob asked for, each path clean, matched by its pattern and once, at most 100, each with one status. Dirty, detached, unreadable (wfail) and more are shown and asked about (delete_anyway or remake_anyway), which --force never answers; refused without a terminal (no_terminal_delete_trees, naming --no-worktree-check, or the clone's no_terminal_delete when it has work too). --no-worktree-check skips the check and warns (trees_check_skipped). A failed, late or hostile answer keeps the VM (trees_check_failed), and so does a VM that doesn't start for it (trees_check_not_started). Rm and rmGone run it, and rmGone refuses a stopped VM with opencode, which starting would make its folder again (rm_gone_stopped_trees, naming --no-export --no-worktree-check); stillGone takes the refusal to give. remaking.checkWork runs it before a remake with --clean-home (remakeTo, Update, SetClone, whose clone check it joins), its messages naming the command as typed (remakeInVM.typed), with --clean-home, which --no-worktree-check needs (needs), so devvm clone off --clean-home's clone check messages name it too. A remake's flag has its own help. The stub guest runs the read in vmhome-<vm>. Tests that fail without the check: TestRmAgentTrees, TestRmVMAgentTrees, TestRemakeAgentTrees, TestUpdateAgentTrees, TestSetCloneAgentTrees and the rm_agent_trees script; TestAgentTreesBounded (an endless answer cancelled, a silent VM given up on, in a synctest bubble); TestAgentTreesState runs the script under sh on real worktrees, a dot-named one included; TestParseAgentTrees holds the answer's checks, TestCloneGit the stub's. TestSetCloneOff names the command with --clean-home. e2e's network section makes a worktree in opencode's folder in the real VM, and devvm rm refuses, then --no-worktree-check deletes it. Docs: coding agents' opencode's worktrees, How it works' opencode's worktrees, deleting a VM, a VM whose folder is gone, images, clone, the overview's remake, Commands, extending and rm's help; the changelog's What to do step 4 names --no-worktree-check for scripts and devvm rm VM of a stopped VM, and opencode's block gets the check; the release page has its section. 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]> |
||
|
|
2414d64bcc |
refactor(msg): one wording for questions only a terminal can answer
Refusals and help that need a person now say 'in a terminal without --no-input', as no_terminal_fetch and no_terminal_delete did: each message names the command to run, so the condition sits in it rather than being added by UI.Refused. size_pending is for a stopped VM; size_pending_running keeps the restart hint for a running one. setup's size question goes through a Reporter the tests make (msg.Fake). 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]> |
||
|
|
e13839aa41 |
feat(cli): every command on the folder's VM takes --here and --parent, resolved in one place
The VM a folder uses is decided once, by vm's resolveFolder, from the folder's own VM, the nearest parent folder's (with any repo of its own in between) and the command's rule (vm.Env.Folder): by default the folder's own, else the parent's unless a nested repo is in between, else none (devvm makes the folder's own, other commands say no_vm). --here takes only the folder's own; --parent takes the parent's across a nested repo and past the folder's own, and refuses a folder inside none with a VM (no_parent_vm). devvm asks nothing now, in a terminal or not: use_parent_vm and use_parent_vm_repo are gone. The questions before deleting, remaking or widening a parent's VM stay. find resolves through it; own is the folder's own VM (adopt, --clone); lookup and useParent are gone; Options.Here is the rule's. cli: addFolderFlags (flags.go) adds --here and --parent into the run's app, which vmEnv sets as the rule; the two are exclusive, and with -g where a command has it; --clone and --parent are exclusive; devvm rm VM takes neither (rm_vm_folder_flag). Commands: devvm, restart, stop, update, rm, code, desktop, host, history export, tools (add, rm, update), size, ports (add, rm), network (allow, deny, rm, log), ssh-agent, git-protect, clone, secret use, secret unuse, layer add, layer rm, group (join, leave), link (add, rm, publish, unpublish). Tests: TestResolveFolder (own, parent, none, nested repo, --here, --parent), TestFolderFlags (every folder command takes both, and no other; refusals before anything runs; the rule each sets), the parent tests and subfolder.txtar's cases updated for no questions and --parent. Docs: the Commands page's subfolder section, first VM, --clone's subfolders, the overview's subfolder VM; the CLI reference regenerated. 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]> |
||
|
|
2933b535a9 |
feat(clone): devvm clone on|off switches a VM to or from its own clone
devvm clone [on|off] is a setting: bare (and --json) it shows whether the folder's VM has its own clone of the repo. on and off make the VM again through the shared remake, keeping its home folder and settings, after asking (--force, --no-export, --clean-home as devvm layer add). - on: a mounted VM is made again with nothing of the folder mounted; its branches are seeded as a new --clone VM's, and once the old machine is deleted, .git is checked as a launch does and unlocked. - off: the clone is checked as devvm rm does (unfetched branches offered for fetching into saved/<remote>/*, uncommitted changes asked about, terminal only; --no-clone-check skips it after a warning); the remote goes before the new machine's .git is locked, and is added back if the switch is undone. - The remake records its clone mode (remake.clone), so a remake that didn't finish finishes in it, and undo restores the old mode. - devvm --clone on a mounted VM and layer add/rm/update on a clone VM now name devvm clone on/off. rm's clone check messages name the command; --no-clone-check has one help text (addNoCloneCheckFlag). - teardown removes a clone's remote and .git's locks independently. Tests: TestSetCloneOn, TestSetCloneOff, TestSetCloneUndo, TestSetCloneRefuses, clone_switch.txtar, e2e clone section checks. 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]> |
||
|
|
cab497bc8f |
feat(layer): devvm layer add makes the folder's VM again with more layers, keeping its home and settings
The one remake in vm's Lifecycle (remake.go): the image built first, the agents' history exported and the home folder saved (home.go: the VM's tar stream filtered on the host), the VM stopped and its machine renamed aside (backend.Backend's Rename, limactl rename, vmname.Aside), the new machine made from vm.json, started, its home put back, then the old one deleted. A failure or interrupt before that puts the old VM back; a killed devvm leaves the remake section, which the next devvm or devvm layer add finishes. The VM keeps its ID (design.md). 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]> |
||
|
|
5f9e2e2408 |
fix(rm, git-protect): messages whose advice looped now name what works
- rm_export_failed names devvm rm --no-export, the flag that skips the export, in place of devvm rm -f. - devvm rm --no-clone-check deletes a --clone VM without checking its clone, after warning that its unfetched commits and uncommitted changes go with it (clone_check_skipped). clone_check_failed names it. - devvm git-protect on, strict or off on a running VM (macOS) is saved in the VM's state (git_protect_next) and applied the next time devvm finds the VM stopped: devvm stop, devvm restart, or the next launch of a VM stopped some other way, before it starts (git_protect_next_stop). So git_protect_flag_ignored's advice, devvm git-protect off, works on a running VM, and git_protect_running is gone. gitprotect owns the key (Next, SetNext; Set drops it); vm's checkGit applies it, then the .git check and set-id files, for devvm stop and every launch. Tests: TestSetNext (internal/gitprotect); git_protect.txtar (a running VM's choice saved, replaced, applied by devvm stop and by the next launch); clone.txtar (clone_check_failed, then --no-clone-check); e2e project's git-protect check and clone's rm check. 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]> |
||
|
|
16b4ad8771 |
feat(cli): --no-input, a flag or command for every question, and --force only skips a confirmation
A global --no-input (persistent on the root, with --help and -v): no question is asked or read. The ui's prompts (Ask, Confirm, Answer, Secret, Pick/PickOne in a terminal) show the question, then fail with no_input naming what answers it (msg.AnswerFor, by the question's ID), or no_input_terminal for a question only a terminal answers. ui.Flags and SetFlags carry -v and --no-input. Answers: --network-policy/--no-network-policy, --here, devvm size -g, devvm setup --features/--backend, devvm network -g, devvm ssh-agent add, devvm restart, --ssh-config (new, on devvm, host and code: the Include line without asking; sshconfig.Config.AddInclude, vm.Env.AddInclude), --stdin, and --force. --force (-f) only skips a confirmation, and destructive commands need it without a terminal (force_needed, a failure, not a usage error): rm (new rm_confirm), gc (it went ahead without a terminal), gc --caches (now allowed without a terminal with --force), images rm (images_rm_confirm), secret rm (secret_rm_confirm), adopt (adopt_vm), rebuild when images are built on the one rebuilt (build.Env.Force). rm --no-export skips the export; rm's parent-folder, earlier-folder and --clone confirmations are terminal-only and --force never answers them (vm.RmOptions). gc --tools --force splits: --recent (only with --tools, gc_recent_needs_tools) drops the hour's hold and keeps the refusal while a VM is being made (gc_recent_making); gc_tools_recent names devvm gc --tools --recent. gc_caches_need_terminal goes. Tests: TestNoInput, TestAnswers, TestConfirmed, TestRmConfirms, TestAdopt (--force), TestRebuild (force_needed, then Force); secret, rebuild, images, gc*, clone, subfolder, existing scripts. e2e: rm/gc/images rm/secret rm/rebuild with --force (and --no-export where rm -f skipped the export), and the clone section's rm with its checks. Docs: commands.md (Questions devvm asks, rm, flags), first-vm, clone, images (cleaning up, --recent), space, coding-agents, internals overview and images; CLI reference. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
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]> |
||
|
|
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]> |
||
|
|
1e4c772cc5 |
refactor(vm): split Env's commands into types by group
Env holds the shared dependencies NewEnv sets and the helpers every
group uses: finding the folder's VM, starting it, applying its size and
ports, the image builder and the ssh config. The commands are on types
that embed *Env:
- Launch: up, restart, remove, update, ssh and code; a new VM
(up.go), an existing one (existing.go), ssh.go, agents' mounts
- Lifecycle: stop, adopt, rm and export (lifecycle.go)
- Settings: .git protection (settings.go), size (size.go), ports
(ports.go), SSH agent forwarding (sshagent.go)
- Net: network policy, its log and allowlist (network.go), secrets
(secret.go)
- clones (clone.go) and syncer (sync.go), used by the others
env.go holds Env, UI, NewEnv and the shared helpers. cli's commands
call the group they need, e.g. vm.Launch{Env: env}.Up. Tests follow
their code: env_test.go holds the shared helpers, with up_test.go,
lifecycle_test.go, network_test.go and ports_test.go beside them.
The most methods on one type is 24 (Launch).
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]> |
||
|
|
bdd781c037 |
feat(clone): --clone gives the VM its own clone
devvm --clone makes a VM that mounts nothing of the folder's: only the shared tools and its agents' config folders. Once it runs, devvm makes a repo at the folder's path in the VM (receive.denyCurrentBranch updateInstead, HEAD on the host's branch), pushes every local branch into it with host git over devvm's own ssh config (pinned host keys), and adds a remote to the host repo (devvm, else devvm-<folder>, else the VM's name), URL <vm>:<dir>. It offers the ~/.ssh/config Include line (EnsureInclude's first caller), else says how to fetch until then, warns about uncommitted changes, which aren't copied, and opens the shell in the clone. No .git protection, set-id check or ssh remote hint for clone VMs. A copy that fails is retried on the next launch. --clone on a VM that mounts its folder is refused. rm on a clone VM (not -f) starts it if stopped, lists branches whose commits the host repo lacks (VM answers looked up only when they're object names) and offers to fetch them into <remote>/*, then shows the clone's uncommitted changes and asks before deleting; without a terminal either refuses and keeps the VM. Deleting removes the remote's config if it still points at the VM, keeping fetched branches. Inventory: - vm: clone.go (isClone, checkCloneRepo, seedClone, freeRemote, remoteURL, cloneRmCheck, cloneGit, unfetchedRefs, removeRemote, gitSSH, hostGit, capped); state keys mode, clone_remote, seeded; Options.Clone; create skips the unsafe-folder check, the mount, .git protection; setUp seeds unseeded clone VMs; open refuses clone_needs_new_vm and skips Check/setid for clones; ensureRunning (from export); Rm runs the clone check; delete removes the remote; the interrupt cleanup removes it too - cli: --clone on up; rm and root Long, rm -f's help - messages: clone_needs_git, clone_not_top, clone_no_commits, clone_detached, clone_needs_new_vm, copying_branches, clone_seed_failed, remotes_taken, remote_add_failed, fetch_until, uncommitted_not_copied, clone_ready, unfetched_commits, no_terminal_fetch, fetch_before_delete, fetching, fetch_failed, clone_check_failed, clone_dirty, no_terminal_delete, delete_anyway, kept, removed_remote; unsafe_folder and git_protect_needs_macos_new name --clone. Doc links: clone_not_top, clone_no_commits, clone_detached, clone_needs_new_vm, remotes_taken, fetch_until, no_terminal_fetch, no_terminal_delete - tests: testscript clone.txtar (refusals, the new VM's mounts, state, push, remote and clone; no reseed; rm clean, unfetched, dirty, -f, a remote pointed elsewhere; a failed copy retried; clone_needs_new_vm); Go TestUpClone, TestCloneRm (fetch yes/no, delete anyway, a stopped VM started, VM answers that aren't object names), TestCheckCloneRepo, TestFreeRemote, TestRemoveRemote. Stubs: limactl runs a clone's git on $STUB_DIR/vmfs; new ssh stub pushes and fetches there - converted: the bats suite has no clone cases besides cli.bats parse_args, which waits for --from - e2e: clone section (own HOME and git config, throwaway repo): clone with every branch and only the tools mounted, shell in it, remote, nothing locked, rm refusing unfetched commits and uncommitted changes, fetch over devvm's ssh config, rm -f removing the remote and keeping fetched branches - docs: clone.md; commands, security, git-protection, ssh, contributing, index; CLI reference Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
f2aa210bf7 |
feat(up): existing VMs, restart, remove, update, adopt and rm
devvm opens a VM that exists instead of refusing it: unfinished VMs (no state or no network choice) are refused before anything; --backend, --network-policy, --no-git-protect, --cpus/--memory/--disk and --ports are ignored with a warning each; an IMAGE naming what the VM lacks adds it in place after asking (tools built and listed, a layer's script run in the VM, new agents' folders mounted with a stop first); outdated images and newer tools are warned about, the daily tools check runs, agent folder mounts follow the host's, .git is checked per run, set-id files are named on Linux, a stopped VM gets the size and ports its state asks for (a running one is told they apply at its next start); then it is started if stopped (a running VM with network policy keeps its proxy), the self-check runs (a failure stops the VM), and it is set up and its shell opened. Commands: restart (stop, then open), update (newest shared tools, built from base, then open), remove TOOLS (out of the image and tool list, then open), adopt (a VM made for an earlier folder at this path, after asking; .git protection restarts as appeared), rm [-f] (exports the agents' history first unless -f, a failed export keeps the VM; a VM of an earlier folder only after asking, without export; deletes the VM, state, proxy, rules, run files, logs, .git locks, host keys and ssh config entry, also when the delete failed but left no VM). Inventory: - vm: find/findExisting/existing, sameFolder, open, run, setUp, warnIgnored, checkSetID, applySize, applyPorts, addLayers, wantedImage, runScript, buildTools; Restart, Remove, Update, Adopt, Rm, export, delete; start refuses vm_unfinished and stops a leftover proxy for VMs without network policy - gitprotect: Protector.Check (replaced, appeared, new submodules in the tree and .git/modules, unlocked hooks, commondir, delegations on change; locks only while stopped; unset protection set up as new), Locked field; platform.Immutable - tools.Update takes a build func; build.Builder.LayerScript exported - cli: restart, remove, update, adopt, rm; withEnv; root Long - messages: vm_other_folder (reworded), vm_other_folder_rm/_adopt, delete_other_folder_vm, adopt_vm, vm_adopted, vm_already_here, no_vm, vm_unfinished, backend/net/git_protect/ports_flag_ignored, size_flags_ignored, size_next_start, ports_next_start, add_in_place, restart_for_mounts, no_terminal_confirm, keeping, adding, add_layer_failed, vm_is_now, exported, export_failed, deleted, rm_failed, adopt_failed, git_replaced, git_appeared, git_embedded_new, git_hooks_unlocked; net_unenforced_stop says devvm starts it again confined; vm_exists removed - tests: testscript existing.txtar, existing_agents.txtar; Go tests for Check (five per-run reports, replaced/appeared, off/unset), open with network policy, addLayers, Rm, Adopt, remove/update/restart; limactl stub: delete-fails, Exec-fed scripts - converted bats: delete (vm_unfinished, rm cleans up after a failed delete, rm deletes only this VM), project (folder made again, update twice, remove twice, five .git per-run reports), ports (applied once, restart warning), size (restart warning), cli (rm forgets host keys) - e2e: project (stop and relaunch, running relaunch, restart with host keys, swapped .git, new submodule locked, rm unlocks; agent folder added/removed on restart, rm exports history without logins), tools (update, remove), network (relaunch confined, unenforced relaunch stops it, rm -f) - docs: commands.md (existing VM, adding, deleting, a folder made again), coding-agents.md (mounts on launch, history), git-protection (on each launch), images, network, security; CLI reference Co-Authored-By: Claude Opus 5.5 <[email protected]> |