Files
w3cjandClaude Opus 5.5 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]>
2026-11-05 15:54:43 -07:00

53 lines
1.5 KiB
Plaintext

# Where devvm can't ask, a question is refused in one way: the question
# shown, then what answers it, named. It can't ask without a terminal,
# with --no-input in one, or once its input ends. Piped answers
# (DEVVM_PIPED_ANSWERS=1, which only a test build reads) answer from
# input that isn't a terminal, a line each.
project web
exec devvm --network open --no-git-protect
vm_name WEB web
# Without a terminal: refused, and nothing is read.
stdin $WORK/yes.txt
! exec devvm rm
stderr '^rm_confirm vm=devvm-web-[0-9a-f]{14}\ndevvm: no_input answer=--force$'
exists $WEB_dir/vm.json
# With --no-input in a terminal: refused before it's asked.
ttyin -stdin $WORK/yes.txt
! exec devvm --no-input rm
stderr '^rm_confirm vm=devvm-web-[0-9a-f]{14}\ndevvm: no_input answer=--force$'
! stderr '\[y/N\]'
exists $WEB_dir/vm.json
# A question only the user answers is refused with what to do instead,
# alone: devvm rm of the folder's VM from a subfolder.
mkdir sub
cd sub
! exec devvm rm
stderr '^devvm: rm_parent_vm dir=\S*/web vm=devvm-web-[0-9a-f]{14}$'
! stderr delete_parent_vm
cd ..
# Piped answers: a no keeps the VM, the end of the input is refused, and
# a yes deletes it.
env DEVVM_PIPED_ANSWERS=1
stdin $WORK/no.txt
exec devvm rm
stdout '^==> kept vm=devvm-web-[0-9a-f]{14}$'
! stderr .
stdin $WORK/empty.txt
! exec devvm rm
stderr '^rm_confirm vm=devvm-web-[0-9a-f]{14}\ndevvm: no_input answer=--force$'
exists $WEB_dir/vm.json
stdin $WORK/yes.txt
exec devvm rm
! exists $WEB_dir/vm.json
env DEVVM_PIPED_ANSWERS=
-- yes.txt --
y
-- no.txt --
n
-- empty.txt --