Files
devvm/testdata/script/host_code.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

97 lines
3.4 KiB
Plaintext

# devvm host and devvm code: the folder's VM launched as devvm does without
# its shell (checked, started, self-checked, set up, in devvm's ssh
# config), then its host name shown, or its folder opened in VS Code (a
# stub code) with the SSH agent devvm started with. The Include line is
# offered for the sandbox's own ~/.ssh/config only.
# No VM.
project web
! exec devvm host
stderr '^devvm: no_vm dir=\S*/web$'
! exec devvm code
stderr '^devvm: no_vm dir=\S*/web$'
! exec devvm host now
stderr '^devvm: args_none command=devvm host given=now$'
! exec devvm code .
stderr '^devvm: args_none command=devvm code given=\.$'
# A stopped VM: started and set up, no shell. Without a terminal, the
# Include line is shown, not added.
exec devvm --no-network-policy --no-git-protect
vm_name WEB web
exec limactl stop $WEB
stub_reset
exec devvm host
stdout '^==> starting vm=devvm-web-[0-9a-f]{14}$'
stdout '^ssh_include_needed line=Include /\S*/config/devvm/ssh_config$'
stderr '^devvm: ssh_include_yourself$'
stdout '^ssh_host_info dir=/\S*/web host=devvm-web$'
stub_calls
stdout '^limactl start --tty=false devvm-web-[0-9a-f]{14}$'
stdout 'tar -xf'
! stdout 'limactl shell --workdir /\S*/web devvm-web'
catg $CFG/ssh_config
stdout '^Host devvm-web devvm-web-[0-9a-f]{14}$'
! exists $HOME/.ssh
# With the line there: nothing asked. A size its state asks for waits for
# the running VM's next start, as on a launch.
exec sh -c 'mkdir -p "$HOME/.ssh" && echo "Include $CFG/ssh_config" > "$HOME/.ssh/config"'
exec sh -c 'echo cpus=6 >> "$VMS/$WEB"'
stub_reset
exec devvm host
! stdout 'starting|ssh_include'
stderr '^devvm: size_next_start vm=devvm-web-[0-9a-f]{14}$'
stdout '^ssh_host_info dir=/\S*/web host=devvm-web$'
stub_calls
! stdout 'limactl (start|edit)'
# devvm code: the folder in VS Code over Remote-SSH, with the SSH agent
# devvm started with, though this VM's own connections carry none.
env SSH_AUTH_SOCK=$WORK/user-agent.sock
stub_reset
exec devvm code
stub_calls
stdout '^code --remote ssh-remote\+devvm-web /\S*/web$'
exec sh -c 'cat "$STUB_DIR/code-agent"'
stdout '^\S*/user-agent\.sock$'
env SSH_AUTH_SOCK=
# Two folders named web: the VM by its full name.
mkdir $WORK/other/web
cd $WORK/other/web
exec devvm --no-network-policy --no-git-protect
stub_reset
exec devvm code
stub_calls
stdout '^code --remote ssh-remote\+devvm-web-[0-9a-f]{14} /\S*/other/web$'
# No code command on PATH: said, with the host to connect to.
exec sh -c 'mkdir "$WORK/nocode" && for f in "$(dirname "$DEVVM_HOST_MISE")"/*; do [ "${f##*/}" = code ] || ln -s "$f" "$WORK/nocode/"; done'
env SAVED_PATH=$PATH
env PATH=$DEVVM_BIN:$WORK/nocode:/usr/bin:/bin:/usr/sbin:/sbin
stub_reset
! exec devvm code
stderr '^devvm: no_code_command host=devvm-web-[0-9a-f]{14}$'
stub_calls
! stdout '^code '
env PATH=$SAVED_PATH
# Network policy: a VM devvm started confined that still reaches the
# internet directly is stopped, as on a launch; no host name. (Its
# hostagent here: the test's runner, which runs on, in place of the
# stub's.)
project leak
exec devvm --network-policy --no-git-protect
vm_name LEAK leak
exec sh -c 'echo $PPID > "$LIMA_HOME/$LEAK/ha.pid"; echo "$PPID 1" > "$RUN/$LEAK.started"'
stub_reset
exec sh -c ': > "$STUB_DIR/net-direct"'
! exec devvm host
stderr '^devvm: net_direct_route vm=devvm-leak-[0-9a-f]{14}$'
! stdout ssh_host_info
stub_calls
stdout '^limactl stop devvm-leak-[0-9a-f]{14}$'
! stdout 'tar -xf'
rm $STUB_DIR/net-direct