Files
devvm/testdata/script/subfolder.txtar
T
w3cjandClaude Opus 5.5 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]>
2026-11-03 00:45:09 -07:00

118 lines
4.0 KiB
Plaintext

# devvm in a subfolder of a folder with a VM: without a terminal it opens
# that VM in the subfolder, saying so; --here and --clone make the
# subfolder its own; stop acts on the parent's VM, naming it first; rm
# refuses it without a terminal. adopt doesn't look upward, and nothing
# does from a repo of its own below the parent's folder. Commands that
# give the parent's VM more access are refused without a terminal.
mkdir $WORK/app/src/lib
cd $WORK/app
exec git init -q
exec devvm --no-network-policy
# The parent's VM, its shell in the subfolder.
cd $WORK/app/src/lib
stub_reset
exec devvm
stdout '^==> using_parent_vm dir=/\S*/app vm=devvm-app-[0-9a-f]{14}$'
! stdout creating
stub_calls
! stdout 'limactl (clone|create)'
stdout '^limactl shell --workdir /\S*/app/src/lib devvm-app-[0-9a-f]{14}\n\z'
exec sh -c 'ls "$VMS" | wc -l'
stdout '^ *1$'
# adopt is for this path's VM only.
! exec devvm adopt
stderr '^devvm: no_vm dir=/\S*/app/src/lib$'
# stop: the parent's, named first.
stub_reset
exec devvm stop
stdout '^==> using_parent_vm dir=/\S*/app vm=devvm-app-[0-9a-f]{14}\n==> stopped vm=devvm-app-[0-9a-f]{14}$'
stub_calls
stdout '^limactl stop devvm-app-[0-9a-f]{14}$'
# --here: a new VM for the subfolder, nothing asked; then it's the
# subfolder's own.
cd $WORK/app/src
exec devvm --here --no-network-policy
stdout '^==> creating_from image=base vm=devvm-src-[0-9a-f]{14}$'
! stdout using_parent_vm
stub_reset
exec devvm
! stdout using_parent_vm
stub_calls
stdout '^limactl shell --workdir /\S*/app/src devvm-src-[0-9a-f]{14}\n\z'
# The nearest folder with a VM wins.
cd $WORK/app/src/lib
exec devvm stop
stdout '^==> using_parent_vm dir=/\S*/app/src vm=devvm-src-[0-9a-f]{14}$'
# A repo of its own below the parent's folder: other commands find no VM,
# and without a terminal devvm makes the subfolder's own.
mkdir $WORK/app/tool/bin
cd $WORK/app/tool
exec git init -q
cd $WORK/app/tool/bin
! exec devvm stop
stderr '^devvm: no_vm dir=/\S*/app/tool/bin$'
! stdout using_parent_vm
exec devvm --no-network-policy
stdout '^==> creating_from image=base vm=devvm-bin-[0-9a-f]{14}$'
! stdout using_parent_vm
exec devvm rm --force --no-export
# --clone: a new VM for the subfolder's own repo, as --here, nothing
# asked.
mkdir $WORK/app/repo
cd $WORK/app/repo
env GIT_AUTHOR_NAME=t GIT_AUTHOR_EMAIL=t@t GIT_COMMITTER_NAME=t GIT_COMMITTER_EMAIL=t@t
exec git init -q -b main
exec git commit -q --allow-empty -m one
exec devvm --clone --no-network-policy
stdout '^==> creating_from image=base vm=devvm-repo-[0-9a-f]{14}$'
! stdout using_parent_vm
exec devvm rm --force --no-export
# rm: never a parent's without asking. Without a terminal it's refused,
# --force or not, and nothing is deleted; in the parent's folder it goes.
cd $WORK/app/src
exec devvm rm --force
cd $WORK/app/src/lib
# Commands that give a parent's VM more access are refused without a
# terminal, naming the VM and its folder, and change nothing.
! exec devvm secret use github
stderr '^devvm: widen_parent_vm_refused cmd=devvm secret use dir=/\S*/app vm=devvm-app-[0-9a-f]{14}$'
! exec devvm ssh-agent on
stderr '^devvm: widen_parent_vm_refused cmd=devvm ssh-agent on dir=/\S*/app vm=devvm-app-[0-9a-f]{14}$'
exec devvm ssh-agent
stdout '^off$'
! exec devvm network allow example.com
stderr '^devvm: widen_parent_vm_refused cmd=devvm network allow dir=/\S*/app vm=devvm-app-[0-9a-f]{14}$'
exec devvm network deny bad.example.com
stdout 'rule_added'
! exec devvm network rm '!bad.example.com'
stderr '^devvm: widen_parent_vm_refused cmd=devvm network rm dir=/\S*/app vm=devvm-app-[0-9a-f]{14}$'
exec devvm network
stdout '!bad.example.com'
! stdout '^example.com'
stub_reset
! exec devvm rm --force --no-export
stdout '^==> using_parent_vm dir=/\S*/app vm=devvm-app-[0-9a-f]{14}$'
stderr '^devvm: rm_parent_vm dir=/\S*/app vm=devvm-app-[0-9a-f]{14}$'
stub_calls
! stdout 'limactl delete'
exec sh -c 'ls "$VMS" | grep -v "\.policy$" | wc -l'
stdout '^ *1$'
cd $WORK/app
exec devvm rm --force
stdout '^==> deleted vm=devvm-app-[0-9a-f]{14}$'
exec ls $VMS
! stdout .
cd $WORK/app/src/lib
! exec devvm rm --force
stderr '^devvm: no_vm dir=/\S*/app/src/lib$'