mirror of
https://github.com/devvmhq/devvm.git
synced 2026-12-01 06:23:17 -10:00
main
18
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]> |
||
|
|
20d2fe1db7 |
feat(clone): workspace clones of a folder of repos
devvm --clone in a folder of git repos gives one VM a clone of each repo the user chooses, each at the same path as on the host, so paths between them (file:../pkg, ../Lib/Lib.csproj) work in the VM, and a copy of the folder's own files outside the repos, made once. - Discovery by .git protection's walk (4 folders down, the same skipped folders, 100 repos); each repo checked as --clone checks one; a linked worktree of a repo in the folder isn't a repo of its own; a repo whose folder, or common dir, another VM mounts is refused, naming it, as is one whose name a terminal can't show. A picker in a terminal (every copyable repo ticked, the others shown with why); --repos all|none|LIST answers without one, and the question is refused naming it. A folder that's a repo keeps today's single clone unless --repos is given; one inside another repo's working tree is refused (workspace_inside_repo). The choice is recorded in the VM's state. - A single --clone, or devvm clone on, in a folder another VM mounts is refused too (clone_folder_mounted), at plan time and before the seed's push. - Each repo seeded with its current and default branch (origin/HEAD, else main, else master); a detached HEAD checks out the default. One VM command makes every repo, leaving one an earlier push reached as it is; each repo is checked again just before its push, and its remote chosen once the one before is added. The folder's own repo's clone excludes the other clones (escaped, anchored lines) and the host's info/exclude, at the seed and at devvm clone add. - The folder's own files: walked folder by folder beneath the folder (safefile.Root.OpenDir), no links followed, no hard-linked files, no bare repos, no set-id bits, bounded; refused folders (checkUnsafe) apply. - devvm clone fetch [--json]: every repo's branches into its remote's remote-tracking branches (--refmap=, one refspec), listed by branch name with their repos; nothing new is said only when a repo was fetched from. devvm clone add PATH: one more repo; one whose copy didn't finish is copied again. - rm, devvm clone off and the switch loop over the repos; rm's check reads every repo in one VM command (cloneState), parsed strictly and capped (8 MiB, 10,000 branches in all), counting only worktrees inside the folder, a VM-side folder never made read as every repo gone; a clone missing in the VM is asked about, an unfinished repo checked when it's there; a host repo that changed refuses the check, and one another VM mounts, a single clone's too, gets no host git and is asked about; each repo is checked again before rm's fetch. - The finder opens a workspace clone VM inside one of its repos; --here still makes the repo's own. --repos's dependencies go through needs(), which now takes a first argument too (devvm clone on). - State is additive: clone.workspace, clone.repos, clone.made.files; a 0.1.0 clone reads as one repo at ".". CHANGELOG: an Unreleased section. Messages: flag_needs_flag, repos_value, repos_not_workspace, workspace_repo_unknown, workspace_pick_help, workspace_pick_cannot, workspace_reason_*, workspace_inside_repo, workspace_repos_past, workspace_skipped, workspace_repo_dropped, workspace_detached, copying_repo, uncommitted_not_copied_repos, workspace_ready, workspace_files_failed, workspace_files_skipped, unfetched_commits_in, clone_repo_dirty, clone_repo_gone, clone_repo_changed, clone_repo_mounted, clone_repo_unchecked, clone_folder_mounted, clone_check_repo_changed, fetch_before_delete_repos, no_terminal_fetch_repos, clone_fetch_*, fetching_repo, clone_fetched_*, clone_add_*, clone_added. Tests: TestDefaultBranch, TestBranchPlan, TestIsWorkspace, TestChooseRepos, TestPickRepos, TestFindRepos, TestRepoExcludes, TestWorkspaceFiles, TestCloneChangesAcrossRepos, TestFetchedByBranch, TestCloneRepos, TestV010CloneReadsAsOneRepo, TestCoversRepo, TestParseCloneState, TestCloneStateScript, TestWorktreePathPins, TestOpenDir; the clone_workspace, clone_workspace_repo, subfolder and nested_replaced scripts; fixture_v010_clone (0.1.0's web clone fetched, checked by rm, made a workspace clone by devvm clone add, switched off; its scratch switched on); the e2e clone section's cloneWorkspace. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
8f6b30a887 |
feat(secret): your own secrets, bound to the hosts you choose
devvm secret set NAME --host HOST[,HOST…] --env VARIABLE [--header H] [--prefix P] [--stdin] saves a secret of your own: the value from a hidden prompt or stdin (never argv) into the Keychain or devvm's secrets folder, and its definition into custom-secrets.json. A VM that uses it (devvm secret use NAME) gets only a per-VM placeholder in VARIABLE, and its proxy puts the real value in that header only for those exact hosts, over TLS on 443; the hosts join that VM's allowlist. Names, hosts, headers, variables and prefixes are checked; wildcards, addresses, internal names and other ports are refused. One placeholder builder serves every secret and login, and the proxy caches values by kind, agent and name. After an independent review, a secret goes in only in four exact shapes (alone; Bearer, Token or a saved --scheme in Authorization; the Basic password; the Basic username only with --basic-user), values are printable ASCII under 3,800 bytes, the proxy checks each binding against its definition, definitions carry IDs and VMs record their hosts, and custom values are stored apart from the known secrets. 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]> |
||
|
|
14c4fe935a |
fix(ui): an answer after Ctrl+C is refused, and an interrupt doesn't wait at a question
A question's answer read once the run is interrupted is its refusal, so an answer typed in the moment after Ctrl+C never lets a deleting command go ahead. An interrupt no longer waits returnGrace for a command that waits at a question: its read doesn't end at Ctrl+C (the UI counts the questions waiting, asking). One message for a failed export that keeps the VM: export_failed_kept (command, vm) replaces remake_export_failed, rm_export_failed and rm_vm_export_failed; devvm rm VM's case gets a CLI test. no_terminal_delete and no_terminal_fetch no longer say there's no terminal, as --no-input and the end of the input refuse them too; no_input says to use its answer; --force's help names --no-input. Tests: TestAnswerAfterInterrupt, TestSignalsDontWaitForAQuestion, rm_vm.txtar's failed export. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
d58b24affe |
refactor(ui): prompts in one place: each question declares its answer
Every question is a msg.Question that declares what answers it where
devvm can't ask: AnsweredBy("--force") names a flag or command, which the
refusal names (no_input), and RefusedWith(msg.X(...)) gives a question no
flag answers its own refusal. msg.AnswerFor and its table go.
The Reporter's Ask, Confirm and Answer, and the UI's Secret, take a
Question and return a *msg.Refusal where they can't ask: with --no-input,
without a terminal, or at the end of the input, one refusal for all three
causes. Commands return it through the failure path (showFailure ->
UI.Refused: the question, then the refusal); nothing dies on an unanswered
question any more. Questions with a usual answer fall back on it instead:
network policy on, restart no, history import later, the Include line
warned, an unenforced VM stopped, the first run's size kept.
Gone: confirmed() in cli (4 callers), force_needed and no_input_terminal,
vm.Env.CanAsk and ui.CanAsk, vm's interactive, setup's terminal, the
Reporter's StdinIsTerminal/StdoutIsTerminal and the Fake's StdoutTerminal,
and every caller's terminal check (18 in vm, netpolicy, build and
sshconfig; 3 CanAsk; 1 interactive; 2 in cli). The picker's check
(CanPick) stays in the picker, which keeps its choices with --no-input
too; setup and the first run's agents and the new-VM summary still read
CanPick, because what they save or say depends on whether the picker
showed.
A Question's About context (the network policy's, a secret's howto, the
restart's changes, the size's host) is said only when it's asked.
devvm update asks before its tools change, so a refusal leaves the VM as
it is.
The CLI tests answer through a terminal (ttyin) or, explicitly, with a
test build's DEVVM_PIPED_ANSWERS=1, a line of input each.
Tests: ui's TestConfirm, TestAsk, TestAnswer, TestPromptsOnlyAtATerminal,
TestSecret, TestNoInput, TestNoTerminal, TestNoAnswer, TestPipedAnswers,
TestRefusedInterrupted, TestPickNoInput; msg's TestQuestionRefused,
TestQuestionAbout; cli's agreement test TestQuestionsDeclareAnswers (every
AnsweredBy names devvm's flags and commands, every RefusedWith a message,
no Question made otherwise) and TestCheckAnswer; vm's
TestSizeChoiceRefused; testscript prompts.txtar (each cause, a refusal of
its own, piped answers).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
||
|
|
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]> |
||
|
|
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]> |
||
|
|
314852a8a4 |
fix(layer): a remake holds its VM's lock, records when its new machine is done, and keeps the saved home while it's recorded
The group's review found three ways the remake's resume and undo could delete the only copy of a VM's home folder: - A second devvm in the folder took a remake that was still running for one that stopped, and finished it: the remake now holds the VM's remake lock (paths.VM.RemakeLock, run/remake.lock) from finding the VM until it ends, reading the state again under it, and a second devvm refuses (remake_running). - The undo put the old machine back but could fail to end the remake, leaving Made set and the saved home deleted: putBack now records that the machine by the VM's name is the old one, and clear deletes home.tar.gz only after the section is gone. - An interrupt while the old machine was deleted ran the undo, which deleted the new machine with the home folder: once the home is in, the remake is committed and recorded as done (remake.done) with its new image, and only then is the old machine deleted (dropOld), which the next devvm finishes when it can't. A resumed remake whose old machine is gone is checked again first (makeNew), as the others are. Docs: images.md (another devvm refuses, close other shells first, rebuild then update for a current VM), overview's remake steps, locks and files, design's threat rows. Comments name devvm layer rm beside layer add. Tests: TestRemakeHeld, TestRemakeDone, TestRemakePendingChecked. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
4b9086e0cc |
feat(layer): devvm layer rm makes the folder's VM again without some of its layers, keeping its home and settings
devvm layer rm LAYER... [--force|--no-export|--clean-home] is the shared remake with layers taken out: Lifecycle.RemoveLayers works out the image (removedImage: the VM's other layers in their order, base when none is left), says the layers the VM lacks (lacks_layers) and refuses a name that isn't a layer, then remakeTo. AddLayers and RemoveLayers share remakeLayers, so neither copies the remake. Its Args refuse base, a shared tool's name and a name no layer can have (vm.CheckLayerNames), so one of the user's layers whose script is gone can still be taken out. devvm tools rm of a layer (custom_layer_remove) names devvm layer rm, and parts_flags_ignored and pick_vm_help name it beside devvm layer add. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
f4ad9c2c3d |
feat(vm): devvm update makes an outdated VM again from its image's new build, keeping its home and settings
devvm update [--force|--no-export|--clean-home] (internal/cli/update.go) is the shared remake with the VM's own image name: Lifecycle.Update calls toRemake, decides with build.Builds.Outdated (WarnIfOutdated's check, now its owner) whether the chain's keys changed, says vm_current and does nothing when they didn't, else names what changed (vm_changed) and calls remakeTo. --from VMs are judged on the recorded digest and built with build's lookup. The remake's flags are one adder (addRemakeFlags) for devvm layer add and devvm update. vm_outdated names devvm update. 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]> |
||
|
|
9f9dfbf89d |
feat(setup): devvm setup chooses the layers every new VM gets
devvm setup chooses default layers, as it chooses new VMs' coding
agents: settings' layers key (config.toml's layers = [...], or
settings.json's, saved by devvm setup), bottom first, each name checked
as a layer's (not base or a shared tool's).
- devvm setup --layers LIST|none saves them without asking; a name that
isn't a layer is a usage error with a did-you-mean, and config.toml's
are refused (set_in_config). In a terminal, setup asks for them last,
after the agents (layers_help), with each layer's description.
- A new VM's picker checks setup's layers under Layers ("from devvm
setup"), and they keep their order at the bottom of the image, with
what's added on top. Without a terminal a new VM gets them; --layers
replaces them and --layers none gives none. A devcontainer.json's
layers go on top.
- A default layer whose script is gone is skipped with a warning
(default_layer_gone); one the backend can't run fails before anything
is built, naming the layer and both ways out (default_layer_lacks).
- pick_setup_agent becomes pick_from_setup, for agents and layers;
desktop_no_layer names devvm setup --layers too.
Code: settings.KeyLayers, Defaults.Layers, checkLayers, layerKind;
vm.LayersChoice (Set, Ask), creation.addSetupLayers,
requireSetupLayers, inOrder; cli addLayersFlag, setup's --layers and its
completion.
Tests: TestReadConfig, TestConfigRefused, TestPrecedence,
TestReadSaved; TestLayersChoice, TestUpParts (setup's layers, --layers
replacing them, --layers none, a gone layer), TestUpSetupLayerLacks,
TestUpPicker (setup's layers checked, their order kept); TestSetupLayers,
TestSetupAsks, TestSetupConfigSets; setup.txtar (--layers, none, unknown
names, a new VM getting them, --layers and --layers none replacing them,
a gone layer warned, config.toml's layers refused and given to a new VM).
Docs: settings (config.toml's layers key, devvm setup's fifth question
and flag, Layers for new VMs), images (what a new VM gets), customizing,
desktop, commands, first VM; the CLI reference.
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]> |
||
|
|
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]> |
||
|
|
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]> |
||
|
|
e782de9ae8 |
feat(cli): flags local to their commands, one meaning per name, and one duration grammar
devvm [IMAGE]'s flags for a new VM (--backend, --from, --cpus, --memory, --disk, --ports, --network-policy, --no-network-policy) are the root's own, so devvm ls --cpus 4 and devvm setup --cpus 2 fail as unknown flags. build, rebuild and images rm take --backend and --from; images, gc and space take --backend as a filter of their own (images and space now filter: only that backend's rows); doctor takes --backend; restart and tools take none. ports -g is local on ports, ports add and ports rm. No command has a persistent flag. One name, one meaning: network log --follow loses -f (-f is --force's, and gc --force gains it); the hidden secret get's --force becomes --to-terminal. Flag defaults name the setting command (devvm size -g, devvm ports -g, devvm setup --backend); descriptions lose then/also openings. Special values are words: an empty flag value (flag_blank) or an empty argument (arg_blank) is refused everywhere, replacing features_empty. Durations: state.ParseDuration (a whole number and m, h, d or w) for gc --older-than, retention's ages and ssh-agent add --lifetime (which also takes forever, via sshagent.CheckLifetime), with one message, bad_duration, replacing gc_bad_age and agent_lifetime_invalid. Blanks are checked with the other usage errors (checkCommand, before checkFlags), and an unknown --backend NAME is a usage error checked first too (checkFlagValue, against registry.Names, which a test keeps equal to the registry's own). Tests: TestPersistentFlags, TestFlagNamesHaveOneMeaning, TestUpFlagsAreUpsAlone, TestParseDuration, TestCheckLifetime; root, setup, images, space, gc_history, retention, ssh_agent and network_log scripts. Docs: commands.md (Flags and values), from.md, install.md, images.md, space.md, settings.md, ssh.md, network pages; CLI reference. Co-Authored-By: Claude Opus 5.5 <[email protected]> |