mirror of
https://github.com/devvmhq/devvm.git
synced 2026-12-01 06:23:17 -10:00
--network learn runs a VM on the internet tier while it records the hosts it reaches beyond its allowlist, shown as internet (learning). devvm network lock picks which of them go into the VM's own rules, ticking only reviewed registries on 443 and listing risky hosts apart, then gives the VM the allowlist tier at once. learn is per VM only. The lock command names its docs page in its about. Co-Authored-By: Claude Opus 5.5 <[email protected]>
161 lines
5.7 KiB
Plaintext
161 lines
5.7 KiB
Plaintext
# A new VM in a terminal: its summary, then whether to customize it. The
|
||
# question needs the picker, which shows only with a terminal on stdout
|
||
# too: a test build's DEVVM_PICK_ON_PIPE stands in for that, with
|
||
# ttyin's terminal on stdin.
|
||
env DEVVM_PICK_ON_PIPE=1
|
||
|
||
# The first run: a line saying its questions set the defaults for every
|
||
# new VM and base, then its size, agents and base's features asked and
|
||
# saved, then this folder's VM's summary shows what they chose, then the
|
||
# question; Enter makes the VM as shown. Each input file answers every
|
||
# question asked, as a terminal's input never ends: the space toggles
|
||
# claude in the agents picker.
|
||
rm $DATA/settings.json
|
||
project first
|
||
exec sh -c 'echo "{}" > package.json'
|
||
ttyin -stdin $WORK/first.txt
|
||
exec devvm --no-git-protect --network open
|
||
stdout '^==> first_run_defaults$'
|
||
stderr 'size_question have_cpus=8 have_memory=16'
|
||
stdout '(?s)^==> first_run_defaults\n.*==> default_agents agents=claude\n.*features_help\r\n.*==> base_features features=\S.*==> new_vm_summary vm=devvm-first-'
|
||
stdout '^==> new_vm_summary vm=devvm-first-[0-9a-f]{14}\nnew_vm_toolchain_for file=package\.json tool=node\nnew_vm_agent_from agent=claude from=devvm setup\nnew_vm_layers_none\nnew_vm_size cpus=2 disk=100 memory=8\nnew_vm_network tier=open\nnew_vm_ports ports=all\n'
|
||
stderr 'new_vm_customize \[y/N\] '
|
||
! stdout 'new_vm_choose|pick_new_help'
|
||
grep '"cpus": "2"' $DATA/settings.json
|
||
vm_name FIRST first
|
||
vm_state $FIRST_dir/vm.json
|
||
stdout '^tools\.names=node claude$'
|
||
stdout '^net\.tier=open$'
|
||
exec devvm setup --agents none
|
||
|
||
# Enter: made as shown, nothing else asked.
|
||
project enter
|
||
ttyin -stdin $WORK/enter.txt
|
||
exec devvm --no-git-protect
|
||
! stdout 'first_run_defaults|features_help|base_features'
|
||
stdout '^==> new_vm_summary vm=devvm-enter-[0-9a-f]{14}$'
|
||
stdout '^new_vm_network tier=allowlist$'
|
||
stderr 'new_vm_customize \[y/N\]'
|
||
! stdout 'new_vm_choose|pick_new_help'
|
||
! stdout net_tier_help
|
||
! stderr new_vm_cpus_prompt
|
||
vm_name ENTER enter
|
||
vm_state $ENTER_dir/vm.json
|
||
stdout '^net\.tier=allowlist$'
|
||
stdout '^size\.cpus=2$'
|
||
! stdout '^size\.memory'
|
||
|
||
# y: the picker, whose Enter keeps what it shows checked, then the tier's
|
||
# picker, the tiers in order with learn after internet, each with what it
|
||
# reaches, the summary's on (k k moves up past learn to internet), then
|
||
# the ports' picker, every port on (j j moves
|
||
# down to a list), whose list, not a list at first, is asked again, and
|
||
# the CPUs, memory and disk, each starting from the summary's; Enter
|
||
# keeps the memory, a disk below the image's is refused and asked again,
|
||
# and nothing is saved for new VMs.
|
||
project custom
|
||
exec sh -c 'echo "{}" > package.json'
|
||
ttyin -stdin $WORK/custom.txt
|
||
exec devvm --no-git-protect
|
||
stdout '^pick_new_help vm=devvm-custom-[0-9a-f]{14}\r$'
|
||
stdout 'net_tier_help vm=devvm-custom-[0-9a-f]{14}\r$'
|
||
stdout '(?s)open +net_tier_open.*internet +net_tier_internet.*learn +net_choice_learn.*allowlist +net_tier_allowlist.*none +net_tier_none'
|
||
stdout 'new_vm_ports_help vm=devvm-custom-[0-9a-f]{14}\r$'
|
||
stdout '(?s)all +new_vm_ports_all.*none +new_vm_ports_none.*list +new_vm_ports_list'
|
||
stderr 'new_vm_ports_prompt ports=all'
|
||
stderr 'port_invalid value="5173-"'
|
||
stderr 'new_vm_size_question have_cpus=8 have_memory=16'
|
||
stderr 'new_vm_cpus_prompt cpus=2'
|
||
stderr 'new_vm_memory_prompt memory=8'
|
||
stderr 'new_vm_disk_question'
|
||
stderr 'new_vm_disk_prompt disk=100'
|
||
stderr 'disk_shrink have=100 vm=devvm-custom-[0-9a-f]{14} want=50'
|
||
vm_name CUSTOM custom
|
||
vm_state $CUSTOM_dir/vm.json
|
||
stdout '^tools\.names=node$'
|
||
stdout '^net\.tier=internet$'
|
||
stdout '^ports\.forward=5173,8000-8010$'
|
||
stdout '^size\.cpus=3$'
|
||
stdout '^size\.disk=120$'
|
||
! stdout '^size\.memory'
|
||
grep '"cpus": "2"' $DATA/settings.json
|
||
! grep '"disk"' $DATA/settings.json
|
||
|
||
# Flags given are taken as given and shown so, and the question is still
|
||
# asked while something is left: the picker greys the toolchains out,
|
||
# and neither --network's tier, --ports' ports nor --disk's disk is
|
||
# asked.
|
||
project given
|
||
ttyin -stdin $WORK/given.txt
|
||
exec devvm --no-git-protect --tools go --network open --ports 3000 --disk 150
|
||
stdout '^new_vm_toolchain_from from=--tools tool=go$'
|
||
stderr 'new_vm_customize \[y/N\]'
|
||
stdout 'go +pick_from_flag flag=--tools'
|
||
! stdout net_tier_help
|
||
! stdout new_vm_ports_help
|
||
stderr 'new_vm_cpus_prompt cpus=2'
|
||
! stderr new_vm_disk_prompt
|
||
vm_name GIVEN given
|
||
vm_state $GIVEN_dir/vm.json
|
||
stdout '^tools\.names=go$'
|
||
stdout '^net\.tier=open$'
|
||
stdout '^ports\.forward=3000$'
|
||
|
||
# Everything given: nothing left to choose, so nothing is asked.
|
||
project all
|
||
ttyin -stdin $WORK/enter.txt
|
||
exec devvm --no-git-protect --tools none --agents none --layers none --network open --ports none --cpus 2 --memory 4 --disk 100
|
||
stdout '^==> new_vm_summary vm=devvm-all-[0-9a-f]{14}$'
|
||
! stderr new_vm_customize
|
||
! stdout new_vm_choose
|
||
|
||
# --no-input in a terminal: no question, the summary ends with the flags.
|
||
project noinput
|
||
ttyin -stdin $WORK/custom.txt
|
||
exec devvm --no-git-protect --no-input
|
||
! stderr new_vm_customize
|
||
stdout '^new_vm_choose$'
|
||
|
||
# The logo, out of names mode: once, above the first run's line, and
|
||
# above the summary of a later new VM's; not with --no-input.
|
||
env DEVVM_MESSAGES=
|
||
rm $DATA/settings.json
|
||
project logo
|
||
ttyin -stdin $WORK/first.txt
|
||
exec devvm --no-git-protect --network open
|
||
stdout '\A╭──────────╮\n│ ❯ devvm ╭┤\n╰─────────██\n==> These first questions'
|
||
! stdout '(?s)❯ devvm.*❯ devvm'
|
||
project logo2
|
||
ttyin -stdin $WORK/enter.txt
|
||
exec devvm --no-git-protect
|
||
stdout '\A╭──────────╮\n│ ❯ devvm ╭┤\n╰─────────██\n==> This folder''s new VM'
|
||
project logo3
|
||
exec devvm --no-git-protect --no-input
|
||
! stdout '❯ devvm'
|
||
env DEVVM_MESSAGES=names
|
||
|
||
-- first.txt --
|
||
2
|
||
|
||
.
|
||
|
||
|
||
-- enter.txt --
|
||
|
||
-- custom.txt --
|
||
y
|
||
|
||
kk
|
||
jj
|
||
5173-
|
||
5173,8000-8010
|
||
3
|
||
|
||
50
|
||
120
|
||
-- given.txt --
|
||
y
|
||
|
||
|
||
|