Skip to content

Scripts: every script answers --help, and CLAUDE.md says how to verify and ship - #128

Merged
dinooo13 merged 3 commits into
mainfrom
fan-out/123-safe-scripts
Nov 25, 2026
Merged

dinooo13 merged 3 commits into
mainfrom
fan-out/123-safe-scripts

Conversation

@dinooo13

@dinooo13 dinooo13 commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

Closes #123

Why

Asking a script for help was not safe. overlay-demo.sh, make-screenshots.sh, make-fixtures.sh and make-site-media.sh took --help as an ordinary run and started a build or a recording. bundle.sh, release.sh, appcast.sh, cask.sh and changelog.sh exited non-zero on it, and pladder-cli --help exited 2. CLAUDE.md had no ## Verify or ## Ship section, which the verify and ship-it skills read, so every agent improvised how to prove and ship a change.

Change

  • scripts/*.sh, all eleven: the first statement after set -…o pipefail scans every argument. On -h or --help it prints the header comment and exits 0, before cd, mkdir, a build or a launch. cask.sh, check-doc-pointers.sh and check-site-numbers.sh get the # Usage: line they lacked. bundle.sh gets only that block, away from Keep --overlay-demo and --screenshots out of the release build #124's lines.
  • .github/workflows/scripts.yml: a step in the required scripts job runs every script with --help, -h and x --help under a 5 s timeout. It fails on a non-zero exit, on a missing Usage: scripts/<name>.sh line, on files left in the tree, and on an executable in scripts/ that is not a .sh (the two .swift helpers are not executable and stay out of the rule).
  • scripts/check-doc-commands.sh, new, in docs.yml's doc-pointers job: fails when CLAUDE.md names a scripts/… path or a bare *.sh that does not exist. It also fails on a pladder-cli <command>, in backticks or a fence, that is not a top-level case in main.swift, and when those labels and the usage text disagree.
  • pladder-cli: -h or --help anywhere prints the usage to stdout and exits 0. No arguments or bad ones still go to stderr with exit 2.
  • CLAUDE.md:
    • ## Verify: the command for each kind of change, where its output lands, the screen lock, the hard states, and what only a human can check.
    • ## Ship: the lines Verify, Merge, After merge and Live check.
    • Commands: the stale --speed on the overlay-demo line is gone (the app reads --style and --reduce-motion), and there is a make-screenshots.sh line.
    • The Decisions table is untouched.
  • After merge, the install: bundle.sh --install stops the copy in use, so an agent may run it unasked only after a check from the installed copy's own log prints idle. The check reads the capture category's capture started and capture stop called and fails closed when log show fails. Otherwise the agent asks. Two one-line comments in AVAudioEngineCapture.swift mark the log text as matched there.
  • Keep --overlay-demo and --screenshots out of the release build #124: ## Verify says overlay-demo.sh and make-screenshots.sh build with -DPLADDER_DEV_MODES in .build/dev-modes and a plain build has no developer modes. Keep --overlay-demo and --screenshots out of the release build #124 has merged, and this branch is rebased on it, so that is now true of main.

Verified

  • Every script's --help: 33 runs (--help, -h and x --help on eleven scripts) exit 0 in 0.01–0.4 s and write nothing; a stamp file followed by find -newer shows no new files. bash -x shows only set, the loop, sed and exit 0.
  • The two new CI steps on Ubuntu: run from a clean repo on the Linux box, with gawk and mawk. They fail on each fault seeded into a copy:
    • the block removed from bundle.sh or from make-fixtures.sh
    • a sleep before the block (the timeout)
    • no Usage line
    • a file left behind
    • a script that is not executable
    • an executable x.py
  • check-doc-commands.sh: passes on CLAUDE.md (47 script names, 18 commands). It exits 1 and names the line for bundel.sh, overlay-dmo.sh, bench-coordinater and bench-releese, and when the case labels and usage text disagree. It passes on pladder-cli <audio path>, "$f", … and a \ continuation.
  • Idle check: run read-only against the installed copy, it prints idle; with a broken predicate it prints nothing. Replaying today's log windows gave "recording" inside a real dictation and idle between dictations. Not checked: a recording caught live by the check itself, since no agent posts hotkey events.
  • Lint and docs checks: shellcheck scripts/*.sh, actionlint, check-doc-pointers.sh and check-site-numbers.sh are clean.
  • Build and CLI: swift build has no warnings and swift test passes all 711 tests. pladder-cli --help and -h exit 0; no arguments exits 2.

Benchmark

No code between recordingStopped and inserted changed (two comments in AVAudioEngineCapture.swift), so no benchmark.

Review loop

Reviewer Round 1 Round 2
Claude Opus 5.5 (xhigh) CHANGES APPROVE
Kimi K3.1 Pro (max) CHANGES APPROVE

Round 1 found three real problems, all fixed:

  • the idle check printed idle when log show failed
  • the doc check took audio paths and \ as commands
  • Verify named bench commands without the pladder-cli prefix, so the check never saw them

It also raised nits, fixed. Declined: dropping the executable-but-not-.sh guard and the usage-versus-case-labels self-check. The first keeps a new script from skipping the --help check by its name; the second keeps the doc check from passing on an empty list.

🤖 Generated with Claude Code

dinooo13 and others added 3 commits November 25, 2026 20:26
overlay-demo.sh, make-screenshots.sh, make-fixtures.sh and make-site-media.sh
took --help for a normal run and built, recorded or synthesised, and the
release scripts exited non-zero on it, so an agent could not safely ask a
script what it does. Each one now prints its header comment and exits 0
when any argument is -h or --help, before it changes directory, reads an
argument or builds. cask.sh and the two checks get the Usage line they
lacked.

scripts.yml runs --help, -h and "x --help" for every scripts/*.sh with a
5 s timeout, requires a "Usage: scripts/<name>.sh" line and a clean tree
afterwards, and fails on an executable in scripts/ that is not a .sh, which
the loop would miss. On Linux a script that builds or records before its
check fails for want of swift, say or screencapture.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
It printed the usage to stderr and exited 2, as for a mistake, so a script
or an agent asking for it saw a failure. -h or --help anywhere now prints
it to stdout and exits 0; no arguments and bad arguments still print it to
stderr and exit 2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The verify and ship-it skills read these two sections, and without them
each agent improvised how to prove and land a change. Verify gives the
command per kind of change, where its output lands, the screen lock for
the scripts that record, the hard states and what only a human can check.
Ship gives Verify, Merge, After merge and Live check; an agent installs
without asking only when the installed copy's capture log shows no
recording in progress and nothing in the past 20 s, and asks otherwise.

check-doc-commands.sh, run by docs.yml, fails when CLAUDE.md names a
scripts/ file or a bare .sh that does not exist, or a pladder-cli command
in code that main.swift has no case for, and when those case labels and
the usage text disagree. The Commands list loses the overlay demo's
--speed, which the app no longer reads, and gains make-screenshots.sh.

Closes #123.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dinooo13
dinooo13 force-pushed the fan-out/123-safe-scripts branch from f9d36ca to 8f756a0 Compare November 25, 2026 19:26
@dinooo13
dinooo13 merged commit b5bce27 into main Nov 25, 2026
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Safe scripts and the agents' rules: --help everywhere, ## Verify and ## Ship, checked in CI

1 participant