$npx -y skills add mvanhorn/cli-printing-press --skill printing-press-amendAmend a published CLI from one of two input sources: (1) dogfood mode mines the active Claude Code session transcript for friction (missing flags, hand- rolled API payloads, silent-null returns); (2) direct-input mode accepts user-supplied asks (rename a command, add commands or
| 1 | # /printing-press-amend |
| 2 | |
| 3 | Turn a dogfood session into a PR for a printed CLI in the public library. |
| 4 | |
| 5 | ```bash |
| 6 | /printing-press-amend # auto-detect target CLI from session |
| 7 | /printing-press-amend superhuman # explicit short name |
| 8 | /printing-press-amend superhuman-pp-cli |
| 9 | /printing-press-amend "$PRESS_LIBRARY/superhuman" |
| 10 | ``` |
| 11 | |
| 12 | This skill lives in this repo (the machine) and acts on a printed CLI in the public library. It is sibling to `/printing-press-publish` (adds a new CLI), `/printing-press-polish` (improves a CLI pre-publish), and `/printing-press-retro` (reflects on the machine itself). None of those cover post-publish CLI amendments driven by real-session friction. |
| 13 | |
| 14 | The artifact this skill produces is semantically a "patch" (in the git/PR sense), tracked by the public library's `.printing-press-patches/` directory (one file per patch). Inline `// PATCH(...)` source comments are optional navigation aids when they make a customized site easier to grep. The slash-skill name is `amend` to disambiguate from the existing `cli-printing-press patch` binary subcommand (which AST-injects pre-defined features — different mechanism, different intent). |
| 15 | |
| 16 | ## Setup |
| 17 | |
| 18 | Before doing anything else: |
| 19 | |
| 20 | <!-- PRESS_SETUP_CONTRACT_START --> |
| 21 | ```bash |
| 22 | # min-binary-version: 4.0.0 |
| 23 | |
| 24 | # Derive scope first — needed for local build detection |
| 25 | _scope_dir="$(git rev-parse --show-toplevel 2>/dev/null || echo "$PWD")" |
| 26 | _scope_dir="$(cd "$_scope_dir" && pwd -P)" |
| 27 | |
| 28 | # Prefer local build when running from inside the printing-press repo. |
| 29 | _press_repo=false |
| 30 | if [ -x "$_scope_dir/cli-printing-press" ] && [ -d "$_scope_dir/cmd/cli-printing-press" ]; then |
| 31 | _press_repo=true |
| 32 | export PATH="$_scope_dir:$PATH" |
| 33 | echo "Using local build: $_scope_dir/cli-printing-press" |
| 34 | elif ! command -v cli-printing-press >/dev/null 2>&1; then |
| 35 | if [ -x "$HOME/go/bin/cli-printing-press" ]; then |
| 36 | echo "cli-printing-press found at ~/go/bin/cli-printing-press but not on PATH." |
| 37 | echo "Add GOPATH/bin to your PATH: export PATH=\"\$HOME/go/bin:\$PATH\"" |
| 38 | else |
| 39 | echo "cli-printing-press binary not found." |
| 40 | echo "Install with: go install github.com/mvanhorn/cli-printing-press/v4/cmd/cli-printing-press@latest" |
| 41 | fi |
| 42 | return 1 2>/dev/null || exit 1 |
| 43 | fi |
| 44 | |
| 45 | # Resolve and emit the absolute path the agent must use for every later |
| 46 | # `cli-printing-press` invocation. `export PATH` above only affects this one |
| 47 | # Bash tool call; subsequent calls open a fresh shell and resolve bare |
| 48 | # `cli-printing-press` against the user's default PATH, where a stale global |
| 49 | # can silently shadow the local build. The agent captures this marker and |
| 50 | # substitutes the absolute path into every later invocation. |
| 51 | if [ "$_press_repo" = "true" ]; then |
| 52 | PRINTING_PRESS_BIN="$_scope_dir/cli-printing-press" |
| 53 | else |
| 54 | PRINTING_PRESS_BIN="$(command -v cli-printing-press 2>/dev/null || true)" |
| 55 | fi |
| 56 | if ! command -v go >/dev/null 2>&1; then |
| 57 | echo "" |
| 58 | echo "[setup-error] Go toolchain not found." |
| 59 | echo "" |
| 60 | echo "This Printing Press flow runs Go-based build or validation commands." |
| 61 | echo "Install Go 1.26.5 or newer from https://go.dev/dl/, then verify with:" |
| 62 | echo " go version" |
| 63 | echo "Then re-run this skill." |
| 64 | echo "" |
| 65 | return 1 2>/dev/null || exit 1 |
| 66 | fi |
| 67 | echo "PRINTING_PRESS_BIN=$PRINTING_PRESS_BIN" |
| 68 | |
| 69 | _pp_semver_lt() { |
| 70 | awk -v a="$1" -v b="$2" 'BEGIN { |
| 71 | split(a, x, "."); split(b, y, ".") |
| 72 | for (i = 1; i <= 3; i++) { |
| 73 | if ((x[i] + 0) < (y[i] + 0)) exit 0 |
| 74 | if ((x[i] + 0) > (y[i] + 0)) exit 1 |
| 75 | } |
| 76 | exit 1 |
| 77 | }' |
| 78 | } |
| 79 | |
| 80 | _pp_go_version_norm() { |
| 81 | printf '%s\n' "$1" | sed -nE 's/.*go([0-9]+)\.([0-9]+)(\.([0-9]+))?.*/\1.\2.\4/p' | awk -F. 'NF >= 2 { printf "%d.%d.%d\n", $1, $2, ($3 == "" ? 0 : $3) }' |
| 82 | } |
| 83 | |
| 84 | _pp_check_go_currency() { |
| 85 | _pp_go_installed="$(_pp_go_version_norm "$(go env GOVERSION 2>/dev/null)")" |
| 86 | _pp_go_required="$(_pp_go_version_norm "$(go version "$PRINTING_PRESS_BIN" 2>/dev/null)")" |
| 87 | i |