mirror of
https://github.com/devvmhq/devvm.git
synced 2026-12-01 16:27:33 -10:00
Adds `dotnet`, the .NET SDK, as a fifth shared toolchain next to node, python, rust and go. `--tools dotnet`, `devvm tools add dotnet` and the picker offer it, and a folder with `*.sln`, `*.slnx`, `*.csproj`, `*.fsproj` or `global.json` at its top level suggests it in the new VM's summary, the way `package.json` suggests node. Refs #2. Thanks to @jsskeen-utah for the detailed request. Co-authored-by: Claude Opus 5.5 <[email protected]>
154 lines
6.2 KiB
Plaintext
154 lines
6.2 KiB
Plaintext
# Existing VMs with network policy, shared tools and agents: a running
|
|
# VM keeps its proxy, the self-check runs on every launch, tools shows
|
|
# its tools and tools add, rm and update change them, and rm exports its
|
|
# agents' history first.
|
|
|
|
# Network policy: a running VM isn't started again, and the self-check
|
|
# runs again. (Its hostagent here: the test's runner, which runs on, in
|
|
# place of the stub's.)
|
|
project net
|
|
exec devvm --network allowlist --no-git-protect
|
|
vm_name NET net
|
|
exec sh -c 'echo $PPID > "$LIMA_HOME/$NET/ha.pid"; echo "$PPID 1" > "$NET_dir/run/started"'
|
|
stub_reset
|
|
exec devvm
|
|
! stdout starting
|
|
stub_calls
|
|
! stdout 'limactl (start|stop|edit)'
|
|
stdout 'exec ''curl'' ''--noproxy'''
|
|
# Started outside devvm: unenforced, so without a terminal to ask in,
|
|
# devvm stops it. devvm starts it again confined. (The exit keeps
|
|
# limactl start sh's child, so its hostagent is sh, soon gone: bash 5.2
|
|
# and newer as sh, Fedora's, runs a last command in sh's place, which would
|
|
# make the runner, which lasts, its hostagent.)
|
|
exec sh -c 'limactl stop "$NET" && limactl start --tty=false "$NET"; exit $?'
|
|
stub_reset
|
|
! exec devvm
|
|
stderr '^devvm: net_unenforced_stop vm=devvm-net-[0-9a-f]{14}$'
|
|
stub_calls
|
|
stdout '^limactl stop devvm-net-[0-9a-f]{14}$'
|
|
! stdout 'tar -xf'
|
|
vm_state $NET_dir/vm.json
|
|
stdout '^net.made.check=unenforced$'
|
|
exec devvm
|
|
stdout '^==> starting vm=devvm-net-[0-9a-f]{14}$'
|
|
vm_state $NET_dir/vm.json
|
|
stdout '^net.made.check=ok$'
|
|
|
|
# tools update: with the lock as it is, the tools are the newest; with a
|
|
# newer go upstream, it's built and the VM moves to it. tools shows the
|
|
# VM's version and the lock's newer one, built or not, without going
|
|
# online.
|
|
project api
|
|
exec devvm --network open --no-git-protect --tools go
|
|
vm_name API api
|
|
! exec devvm tools now
|
|
stderr '^devvm: no_subcommand command=devvm tools commands=add, rm, update given=now$'
|
|
exec devvm tools
|
|
stdout '^TOOL +VERSION +NEWER +BUILT\ngo +\S+ +- +-\n\z'
|
|
exec devvm tools --json
|
|
stdout '\A{\n "version": 1,\n "tools": \[\n {\n "tool": "go",\n "version": "\S+"\n }\n \]\n}\n\z'
|
|
exec devvm tools update
|
|
stdout '^==> checking_tools$'
|
|
stdout '^==> tools_newest vm=devvm-api-[0-9a-f]{14}$'
|
|
exec sh -c 'sed "/^\[\[tools.go\]\]/,/^version/ s/^version = .*/version = \"9.9.9\"/" "$MISE_STUB_LOCK" > "$WORK/newer.lock"'
|
|
exec sh -c 'cp "$WORK/newer.lock" "$DATA/mise.lock"'
|
|
stub_reset
|
|
exec devvm tools
|
|
stdout '^go +\S+ +9\.9\.9 +no$'
|
|
stub_calls
|
|
! stdout mise
|
|
env MISE_STUB_LOCK=$WORK/newer.lock
|
|
exec devvm tools update
|
|
stdout '^==> building_tools tools=go 9\.9\.9$'
|
|
stdout '^==> tools_switch vm=devvm-api-[0-9a-f]{14}$'
|
|
vm_state $API_dir/vm.json
|
|
stdout '^tools.made.files=go-9\.9\.9-[0-9a-f]{12}\.erofs$'
|
|
exec tar -xOf $STUB_DIR/sync.tar tools
|
|
stdout '^go-9\.9\.9-[0-9a-f]{12}\.erofs go 9\.9\.9$'
|
|
# A VM whose tools are older than the lock's is told on launch.
|
|
json_set $API_dir/vm.json tools.made.files:=["go-1.0.0-0123456789ab.erofs"]
|
|
exec devvm
|
|
stderr '^devvm: newer_tools tools=go 9\.9\.9$'
|
|
exec devvm tools
|
|
stdout '^go +1\.0\.0 +9\.9\.9 +yes$'
|
|
exec devvm tools --json
|
|
stdout '\A{\n "version": 1,\n "tools": \[\n {\n "tool": "go",\n "version": "1\.0\.0",\n "newer": "9\.9\.9",\n "newer_built": true\n }\n \]\n}\n\z'
|
|
|
|
# tools rm: the tools leave its list and their files, the rest stays;
|
|
# what it lacks is refused. Names are separate words.
|
|
project web
|
|
cp $WORK/package.json package.json
|
|
exec devvm --network open --no-git-protect --agents claude
|
|
stdout '^new_vm_toolchain_for file=package\.json tool=node\nnew_vm_agent_from agent=claude from=--agents\nnew_vm_layers_none\n'
|
|
vm_name WEB web
|
|
! exec devvm tools rm node,claude
|
|
stderr '^devvm: tools_joined cmd=rm given=node,claude$'
|
|
exec devvm tools rm claude
|
|
stdout '^==> vm_tools_now tools=node vm=devvm-web-[0-9a-f]{14}$'
|
|
vm_state $WEB_dir/vm.json
|
|
stdout '^image=base$'
|
|
stdout '^tools.names=node$'
|
|
stdout '^tools.made.files=node-\S+ pnpm-\S+ bun-\S+$'
|
|
exec tar -xOf $STUB_DIR/sync.tar tools
|
|
! stdout claude
|
|
! exec devvm tools rm python
|
|
stderr '^devvm: vm_lacks has=node tool=python vm=devvm-web-[0-9a-f]{14}$'
|
|
! exec devvm tools rm
|
|
stderr '^devvm: arg_missing args=TOOL\.\.\. command=devvm tools rm$'
|
|
|
|
# The flags add nothing to a VM that exists: it opens with a warning
|
|
# naming devvm tools, and nothing changes.
|
|
exec devvm --tools python --agents claude
|
|
stderr '^devvm: new_vm_flags_ignored_run command=devvm tools flags=--tools, --agents vm=devvm-web-[0-9a-f]{14}$'
|
|
vm_state $WEB_dir/vm.json
|
|
stdout '^tools.names=node$'
|
|
|
|
# tools add: the tools it lacks join its list, those it has are said;
|
|
# only shared tools, each a separate word.
|
|
! exec devvm tools add
|
|
stderr '^devvm: arg_missing args=TOOL\.\.\. command=devvm tools add$'
|
|
! exec devvm tools add python+claude
|
|
stderr '^devvm: tools_joined cmd=add given=python\+claude$'
|
|
! exec devvm tools add docker
|
|
stderr '^devvm: unknown_tool tool=docker tools=node python rust go dotnet claude codex opencode$'
|
|
exec devvm tools add node claude
|
|
stdout '^==> has_tools tools=node vm=devvm-web-[0-9a-f]{14}$'
|
|
stdout '^==> vm_tools_now tools=node claude vm=devvm-web-[0-9a-f]{14}$'
|
|
vm_state $WEB_dir/vm.json
|
|
stdout '^image=base$'
|
|
stdout '^tools.names=node claude$'
|
|
stdout '^tools.made.files=node-\S+ pnpm-\S+ bun-\S+ claude-\S+$'
|
|
exec tar -xOf $STUB_DIR/sync.tar tools
|
|
stdout claude
|
|
|
|
# rm: a VM with an agent has its history exported first, from the VM,
|
|
# started if it's stopped; a failed export keeps the VM, and -f deletes
|
|
# it without one.
|
|
project agent
|
|
exec devvm --network open --no-git-protect --agents claude
|
|
vm_name AGENT agent
|
|
exec limactl stop $AGENT
|
|
exec sh -c ': > "$STUB_DIR/shell-fails"'
|
|
! exec devvm rm --force
|
|
stdout '^==> starting vm=devvm-agent-[0-9a-f]{14}$'
|
|
stderr '^devvm: export_failed_kept command=devvm rm vm=devvm-agent-[0-9a-f]{14}$'
|
|
exists $AGENT_dir/vm.json
|
|
exec sh -c 'ls "$DATA/exports" | wc -l'
|
|
stdout '^ *0$'
|
|
rm $STUB_DIR/shell-fails
|
|
stub_reset
|
|
exec devvm rm --force
|
|
stdout '^==> exported file=\S*/data/devvm/exports/devvm-agent-[0-9a-f]{14}-[0-9]{8}-[0-9]{6}\.tar\.gz vm=devvm-agent-[0-9a-f]{14}$'
|
|
stdout '^==> deleted vm=devvm-agent-[0-9a-f]{14}$'
|
|
stub_calls
|
|
stdout 'exec ''bash'' ''-c'' ''devvm_opencode_clean\(\) \{$'
|
|
stdout '^ *cd ~ && ls -d \.claude \.claude\.json .*--exclude=\.claude/\.credentials\.json.* -T - '
|
|
! exists $AGENT_dir
|
|
cd $WORK/net
|
|
exec devvm rm --force --no-export
|
|
! stdout exported
|
|
|
|
-- package.json --
|
|
{}
|