add exec, run and scale, and the agent skill

The skill documents how to use myos: what to check before touching a host
stack, how a reference resolves, what the three kinds of stack mean, and where
each failure comes from. Every command it shows was run against the fixtures
before being written down, which is how exec, run and scale turned out to be
missing.

AGENTS.md covers the other side: how to change myos without breaking the
deployments that already run it.
This commit is contained in:
Yann Autissier
2026-09-03 18:46:00 +02:00
parent 653a3c9415
commit 32e2624245
29 changed files with 611 additions and 79 deletions
+28
View File
@@ -0,0 +1,28 @@
#shellcheck shell=sh
# myos exec <stack> [-- command...] run a command in a running service
# myos run <stack> [-- command...] run it in a new container
#
# The service defaults to the stack name, which is what it is called in most
# stacks; SERVICE=<name> picks another one.
myos_cmd_exec() { myos_service_command exec; }
myos_cmd_run() { myos_service_command run; }
myos_service_command() {
_what=$1
_ref=$(printf '%s' "$MYOS_STACKS" | head -1)
[ -n "$_ref" ] || myos_die "$MYOS_E_USAGE" "usage: myos $_what <stack> [SERVICE=name] -- command..."
_service=${SERVICE:-$(myos_stack_name "$_ref")}
_files=$(myos_stack_compose_files "$_ref") || return $?
_fw=$(myos_framework_compose_files)
[ -n "$_fw" ] && _files="$_files
$_fw"
_app=$(myos_stack_name "$_ref")
case $_ref in .|./*|/*|../*) _app=$(basename "$(myos_stack_resolve "$_ref")") ;; esac
_project=$(myos_project_name "$(myos_scope "$_ref")" "$USER" "$ENV" "$_app")
case $_what in
exec) _opts="" ;;
run) _opts=${DOCKER_COMPOSE_RUN_OPTIONS:---rm} ;;
esac
# shellcheck disable=SC2086 # options and arguments are deliberate word lists
myos_compose "$_project" "$_files" -- "$_what" $_opts "$_service" ${MYOS_ARGS:-}
}
+4
View File
@@ -0,0 +1,4 @@
#shellcheck shell=sh
# myos run: see lib/cmd/exec.sh
# shellcheck source=lib/cmd/exec.sh
. "$MYOS_ROOT/lib/cmd/exec.sh"
+13
View File
@@ -0,0 +1,13 @@
#shellcheck shell=sh
# shellcheck source=lib/cmd/_compose.sh
# myos scale <stack> SERVICE=<name> NUM=<n> run n containers of a service
. "$MYOS_ROOT/lib/cmd/_compose.sh"
myos_cmd_scale() {
_ref=$(printf '%s' "$MYOS_STACKS" | head -1)
[ -n "$_ref" ] || myos_die "$MYOS_E_USAGE" "usage: myos scale <stack> SERVICE=name NUM=n"
_service=${SERVICE:-$(myos_stack_name "$_ref")}
[ -n "${NUM:-}" ] || myos_die "$MYOS_E_USAGE" "myos scale needs NUM=<n>"
MYOS_ARGS="--scale $_service=$NUM ${MYOS_ARGS:-}"
myos_cmd_compose up
}