mirror of
https://github.com/devvmhq/devvm.git
synced 2026-12-01 14:33:17 -10:00
devvm node said "Did you mean devvm code?", which misleads anyone who means the tool. When the unknown word, or each name in it joined with + or a comma, is a toolchain, an agent or a layer (devvm's own or the user's), the usage error is no_command_part, with the flags that choose them: devvm node+claude -> devvm --tools node --agents claude. Any other word keeps the did-you-mean over the commands (msg.Closest). The names come from partNames, which checkPartFlag reads too. Co-Authored-By: Claude Opus 5.5 <[email protected]>
77 lines
2.6 KiB
Plaintext
77 lines
2.6 KiB
Plaintext
# devvm layer new NAME: a starter script and allowlist in the layers folder;
|
|
# bad, taken and existing names are refused.
|
|
env LAYERS=$XDG_CONFIG_HOME/devvm/layers
|
|
|
|
exec devvm layer new pg
|
|
stdout '^==> layer_created layer=pg policy=\S*/devvm/layers/pg\.policy script=\S*/devvm/layers/pg\.sh$'
|
|
exec bash -n $LAYERS/pg.sh
|
|
grep '^set -euo pipefail$' $LAYERS/pg.sh
|
|
grep '^# Hosts a VM with the pg layer can reach' $LAYERS/pg.policy
|
|
|
|
# It's a layer at once: images and --layers complete it, and it's among
|
|
# the layers.
|
|
exec devvm __complete build p
|
|
stdout '^pg$'
|
|
exec devvm __complete --layers p
|
|
stdout '^pg$'
|
|
! exec devvm build nope
|
|
stderr '^devvm: unknown_layer layer=nope layers=base docker nix pg$'
|
|
# A shared tool is no layer: an image holds none.
|
|
! exec devvm build node+pg
|
|
stderr '^devvm: tool_not_layer tool=node$'
|
|
|
|
# An existing script is kept; an existing allowlist is kept for a new script.
|
|
! exec devvm layer new pg
|
|
stderr '^devvm: layer_exists file=\S*/devvm/layers/pg\.sh$'
|
|
cp mine.policy $LAYERS/db.policy
|
|
exec devvm layer new db
|
|
cmp $LAYERS/db.policy mine.policy
|
|
|
|
! exec devvm layer new node
|
|
stderr '^devvm: layer_name_reserved layer=node$'
|
|
! exec devvm layer new claude
|
|
stderr '^devvm: layer_name_reserved layer=claude$'
|
|
! exec devvm layer new base
|
|
stderr '^devvm: layer_name_reserved layer=base$'
|
|
! exec devvm layer new docker
|
|
stderr '^devvm: layer_name_reserved layer=docker$'
|
|
! exists $LAYERS/docker.sh
|
|
! exec devvm layer new nix
|
|
stderr '^devvm: layer_name_reserved layer=nix$'
|
|
! exists $LAYERS/nix.sh
|
|
! exec devvm layer new My_DB
|
|
stderr '^devvm: layer_name_invalid layer=My_DB$'
|
|
! exec devvm layer new ../x
|
|
stderr '^devvm: layer_name_invalid layer=\.\./x$'
|
|
! exec devvm layer new -- -x
|
|
stderr '^devvm: layer_name_invalid layer=-x$'
|
|
! exec devvm layer new
|
|
stderr '^devvm: arg_missing args=NAME command=devvm layer new$'
|
|
! exec devvm layer pg
|
|
stderr '^devvm: no_subcommand command=devvm layer commands=new given=pg$'
|
|
! exists $LAYERS/node.sh
|
|
! exists $LAYERS/My_DB.sh
|
|
|
|
# A layer may have a command's name: devvm takes no image as a word, so
|
|
# the layer is named only where a layer goes, and devvm stop stays the
|
|
# command.
|
|
exec devvm layer new log
|
|
exists $LAYERS/log.sh
|
|
exec devvm __complete build l
|
|
stdout '^log$'
|
|
! exec devvm log
|
|
stderr '^devvm: no_command_part flags=--layers log word=log$'
|
|
exec devvm layer new stop
|
|
exec devvm stop --help
|
|
stdout 'devvm stop \[flags\]'
|
|
rm $LAYERS/log.sh $LAYERS/log.policy $LAYERS/stop.sh $LAYERS/stop.policy
|
|
|
|
# A layers folder that can't be written to fails it.
|
|
rm $LAYERS
|
|
exec sh -c 'printf x > "$LAYERS"'
|
|
! exec devvm layer new web
|
|
stderr '^devvm: layer_new_failed reason='
|
|
|
|
-- mine.policy --
|
|
db.example.com
|