mirror of
https://github.com/devvmhq/devvm.git
synced 2026-12-01 06:23:17 -10:00
main
11
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
e4b44b5994 |
fix(lima): limactl shell never starts a stopped VM past devvm's checks
In a terminal, limactl shell of a stopped VM asks whether to start it, yes by default (Lima 2.3.0, reproduced under a pty), and that start is Lima's own: no proxy or sandbox-exec profile (no QEMU wrapper on Linux), no pins, and no folderChanged, so the project folder's mount, by path on Linux's 9p, follows a link put at the path or makes a folder that's gone again. devvm opens a shell (Shell) and runs an agent's login (Exec) on the terminal after bringUp, so a guest that powered itself off between the two got that question. This is the start path the self-check's restart was suspected of: that restart goes through startOnce, but limactl shell didn't.
The limactl builder, which every limactl command of devvm's goes through, now gives limactl shell --start=false, which Lima has had since 2.0.0-rc.0 (devvm's oldest is 2.2): a stopped VM's shell or command fails at once ("instance is stopped"), without asking, and devvm's next launch starts it with every check. devvm limactl, which passes its arguments on as given, is unchanged.
TestShellNeverStarts checks Exec's, Shell's and the builder's limactl shell, and fails without the change; the lima package's and the CLI scripts' expected limactl shell calls name the flag, their negative patterns too, so none turns vacuous. Docs: How it works' Lima page's A stopped VM's shell; the changelog's Security hardening gets the line, its summary widened to cover both of its lines, and the release page 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]> |
||
|
|
ceda0bf925 |
feat(cli): --network TIER, devvm network TIER and the tier question
The command line names the four network tiers. --network TIER (open,
internet, allowlist or none) chooses a new VM's tier, checked before
anything runs (arg_not_choice). devvm network open|internet|allowlist|none
gives the folder's VM a tier through Net.SetTier, and devvm network -g
takes the tiers and ask. config.toml's and settings.json's network is ask
or a tier (settings.NetworkChoices, checked against netpolicy.TierNames
by a test, since settings can't import netpolicy).
The question on creation is Proxy.Choose(vm): net_about says what each
tier reaches, net_ask asks for one (Answer, AnsweredBy("--network")),
Enter or a refusal gives allowlist, and an answer that isn't a tier is
warned of (net_tier_unknown) and asked again. devvm setup's picker
offers ask and the four tiers (network_default_open, _internet,
_allowlist, _none). On an existing VM, --network is ignored with the
devvm network TIER command that changes it.
devvm network --json: policy is the tier or unenforced, and each policy
file whose denies alone apply (internet and none) has denies_only: true,
as the text output's "(denies only)", so a script can tell a file's
denies from all of its rules without knowing the tier rules.
Messages reworded: net_tier_backend (--network open), net_open_policy
(devvm network allowlist), net_about, net_ask, network_default*,
net_default_failed, network_failed, setting_already's and
widen_parent_vm*'s descriptions. safety/network's "Choosing a tier"
replaces its on/off section; docs, the cli skill, testscripts and e2e
use the new forms, and e2e's internet and none checks go through devvm
network.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
||
|
|
c0f4b8fb5c |
feat(netpolicy): network tiers in state, confinement and the proxy
A VM's network is one of four tiers, open, internet, allowlist and none, in its state's net section (netpolicy.Tier), in place of on/off. Every VM has its proxy. Confined tiers start on NetProxy; open starts on the backend's own network with its proxy set in the guest (Confinement.GuestProxy): on Lima no Seatbelt profile and no QEMU wrapper, the proxy at 192.168.5.2 on both hosts, propagateProxyEnv off. The proxy: Config.Open (every host and address, no floor, no policies), Config.DenyPolicies (files whose denies alone apply), the rule port :* (any port), and ** matching address literals (the floor still holds). Policies per tier (netpolicy.PolicySet): internet is network/internet.policy (**:*) plus your denies; none is the agents' built-in policies, the secrets' hosts and your denies; open none. Links: a client links only to a target on its tier or a stricter one, and a group's VMs are all on one tier. The self-check per tier: open asks its proxy through the guest's settings and warns (net_proxy_unreachable). devvm ls and devvm network show the tier. A backend without egress-proxy offers open alone (net_tier_backend). devvm network on/off and --network-policy/--no-network-policy map to allowlist/open. Design note, threat check and docs; e2e in the network and link sections. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
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]> |
||
|
|
a134e0d8a6 |
feat(cli): choose a new VM's toolchains, agents and layers in a picker or with --tools, --agents and --layers
devvm takes no IMAGE word any more than any other: in a terminal a new VM's toolchains, coding agents and layers are checked in one picker, under three headings, before the network-policy question; --tools, --agents and --layers (each an exact list, or none) skip it, and a part left out takes its default: the detected toolchains, devvm setup's agents, no layers (a devcontainer.json's features still count). Without a terminal, or with --no-input, the VM gets the defaults and new_vm_gets says so in one line. devvm setup --agents (and its first-run question) chooses new VMs' agents. devvm tools in a terminal opens the same picker for the VM, its layers fixed, and turns the changes into tools add and rm. An image is base and layers only: tools are the VM's tool_names state key. build, rebuild and images rm refuse a shared tool (tool_not_layer), and devvm build builds no tool images. devvm ls gains a TOOLS column and --json tools. gc's --tools is --tool-images, so --tools has one meaning. Gone: image.Reserved, checkWord's image half (devvm WORD is no_command or no_command_like, did-you-mean over commands, msg.Closest), the lacks path in internal/vm/existing.go, and the messages vm_lacks_tools, vm_lacks_layer, layer_is_command, layer_name_command, no_image_for, no_command_or_image*, tools_not_images, tools_not_images_rm, detected, vm_is_now (vm_tools_now), secret_with_image (secret_with_claude). New: ui.Pick takes headed sections with fixed rows, ui.CanPick, vm.PickPart/PickRow/AgentsChoice/CheckPart (internal/vm/parts.go), state.KeyToolNames, state.ReadAgents/WriteAgents, paths.Dirs.Agents, project.DetectFiles. Image keys are unchanged in form: images never held tools; docker.sh's and nix.sh's comments changed, so those layers rebuild. Docs: the home page's quick start steps, diagram (sandbox.svg), cards and FAQ; README; getting started; using (images' What a new VM gets, coding agents' Running an agent, settings' agents); internals; contributing; the cli skill; AGENTS.md. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
ddbc377f8f |
test: testscript commands for the scripts' setup, and a coverage baseline per package
script_test.go's sandbox sets DEVVM_MESSAGES=names and DATA, VMS, RUN and CFG by default, and adds stub_reset, catg (the one file a glob matches), vm_name VAR NAME (the folder's VM) and project NAME [git]; script_cmds.txtar checks each. Every script is rewritten onto them, its assertions kept; TestCommandLines leaves the scripts' own commands out. mise run test runs scripts/test.sh: the tests as before, with the CLI tests' devvm built with -cover for every package (CLI_GOCOVERDIR), merged with the Go tests' counters by go tool covdata, then scripts/coverage.sh holds each package to testdata/coverage/<os>.txt. mise run coverage raises the baselines; coverage.txtar checks the comparison. The macOS baseline is recorded from this tree. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
16b4ad8771 |
feat(cli): --no-input, a flag or command for every question, and --force only skips a confirmation
A global --no-input (persistent on the root, with --help and -v): no question is asked or read. The ui's prompts (Ask, Confirm, Answer, Secret, Pick/PickOne in a terminal) show the question, then fail with no_input naming what answers it (msg.AnswerFor, by the question's ID), or no_input_terminal for a question only a terminal answers. ui.Flags and SetFlags carry -v and --no-input. Answers: --network-policy/--no-network-policy, --here, devvm size -g, devvm setup --features/--backend, devvm network -g, devvm ssh-agent add, devvm restart, --ssh-config (new, on devvm, host and code: the Include line without asking; sshconfig.Config.AddInclude, vm.Env.AddInclude), --stdin, and --force. --force (-f) only skips a confirmation, and destructive commands need it without a terminal (force_needed, a failure, not a usage error): rm (new rm_confirm), gc (it went ahead without a terminal), gc --caches (now allowed without a terminal with --force), images rm (images_rm_confirm), secret rm (secret_rm_confirm), adopt (adopt_vm), rebuild when images are built on the one rebuilt (build.Env.Force). rm --no-export skips the export; rm's parent-folder, earlier-folder and --clone confirmations are terminal-only and --force never answers them (vm.RmOptions). gc --tools --force splits: --recent (only with --tools, gc_recent_needs_tools) drops the hour's hold and keeps the refusal while a VM is being made (gc_recent_making); gc_tools_recent names devvm gc --tools --recent. gc_caches_need_terminal goes. Tests: TestNoInput, TestAnswers, TestConfirmed, TestRmConfirms, TestAdopt (--force), TestRebuild (force_needed, then Force); secret, rebuild, images, gc*, clone, subfolder, existing scripts. e2e: rm/gc/images rm/secret rm/rebuild with --force (and --no-export where rm -f skipped the export), and the clone section's rm with its checks. Docs: commands.md (Questions devvm asks, rm, flags), first-vm, clone, images (cleaning up, --recent), space, coding-agents, internals overview and images; CLI reference. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
3b1959efd2 |
feat(network): network policy rules and log under devvm network, and network -g for new VMs
devvm network allow|deny|rm RULE... [-g] and devvm network log [-f] [-n N] [--blocked] replace devvm policy and devvm log. Bare devvm network shows the VM's network policy, then its allowlist file by file. devvm network -g shows or saves whether new VMs get network policy (ask, on or off), through the network file devvm setup also writes; --network-policy and --no-network-policy beat it and skip reading it, a saved off makes a VM without the docker-layer and backend warnings, and with ask and no terminal a new VM gets it. The proxy's block messages, devvm-why's, network log --blocked's ALLOW WITH and the VM's setup note name devvm network allow. New messages: net_default_failed, net_ask_global; -g reports with network_default. Docs, the CLI reference, txtars (network_rules, network_log, network), e2e (bare devvm network's first line) and AGENTS.md follow. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
1812867162 |
fix(vm): a subfolder's lookup stops at the nearest parent with state; widening a parent's VM asks
The parent-folder lookup passed over a parent whose VM was made for an earlier folder or that its backend had lost, and went on to a VM further out. A VM can rename a nested project folder through its mount (a new device and inode), so devvm skipped the nested folder's VM and acted on the outer one, the VM that replaced it. parentVM now stops at the first parent folder with state of its own: its VM is used only when its backend has it and it was made for that folder, else the folder devvm runs in has no VM (no_vm; devvm makes a new one). Only folders without state are passed over. Commands that give a parent folder's VM more access, run from a subfolder, ask first ([y/N]), naming the VM and its folder, and refuse without a terminal: devvm secret use, ssh-agent on and devvm, network off, policy allow, policy rm of a deny, and git-protect off (found.widen). Messages: widen_parent_vm (the prompt), widen_parent_vm_refused (linked to getting-started/commands#a-subfolder). Tests: TestLookupParents (a parent's lost VM and another folder's VM stop the search: no VM, no_vm), TestWidenParentVM (each command refused without a terminal, a no changing nothing, a yes changing it; taking access away asks nothing), subfolder.txtar (the refusals without a terminal). 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]> |