$npx -y skills add mvanhorn/cli-printing-press --skill printing-press-polishPolish a generated CLI to pass verification and become publish-ready. Runs diagnostics (dogfood, verify, scorecard, go vet, gosec), automatically fixes all issues (verify failures, static-analysis findings, dead code, descriptions, README, MCP tool quality), reports the before/af
| 1 | # /printing-press-polish |
| 2 | |
| 3 | Polish a generated CLI so it passes verification and is ready to publish. |
| 4 | |
| 5 | The retro improves the Printing Press. Polish improves the generated CLI. This skill runs in a forked context (`context: fork`) so its diagnostic and fix loop doesn't pollute the caller — the diagnostic spam, fix iterations, and re-diagnose noise stay scoped to the polish session, and the caller receives a clean summary. |
| 6 | |
| 7 | ```bash |
| 8 | /printing-press-polish redfin |
| 9 | /printing-press-polish redfin-pp-cli |
| 10 | /printing-press-polish "$PRESS_LIBRARY/redfin" |
| 11 | ``` |
| 12 | |
| 13 | ## When to run |
| 14 | |
| 15 | After any `/printing-press` generation, especially when: |
| 16 | - The shipcheck verdict is `ship-with-gaps` |
| 17 | - The verify pass rate is below 80% |
| 18 | - The scorecard is below 85 |
| 19 | - You want the CLI publish-ready in one pass |
| 20 | |
| 21 | Can also be run standalone on any CLI in `$PRESS_LIBRARY/`. |
| 22 | |
| 23 | ## Setup |
| 24 | |
| 25 | ```bash |
| 26 | # min-binary-version: 4.0.0 |
| 27 | |
| 28 | PRESS_HOME="${PRINTING_PRESS_HOME:-$HOME/printing-press}" |
| 29 | PRESS_LIBRARY="$PRESS_HOME/library" |
| 30 | |
| 31 | _pp_check_disk_space() { |
| 32 | _pp_disk_warn_kb="${PRINTING_PRESS_DISK_WARN_KB:-3145728}" |
| 33 | _pp_disk_fail_kb="${PRINTING_PRESS_DISK_FAIL_KB:-524288}" |
| 34 | case "$_pp_disk_warn_kb$_pp_disk_fail_kb" in |
| 35 | ""|*[!0-9]*) return 0 ;; |
| 36 | esac |
| 37 | |
| 38 | _pp_disk_path="$PRESS_HOME" |
| 39 | while [ ! -e "$_pp_disk_path" ] && [ "$_pp_disk_path" != "/" ]; do |
| 40 | _pp_disk_path="$(dirname "$_pp_disk_path")" |
| 41 | done |
| 42 | |
| 43 | _pp_disk_avail_kb="$(df -Pk "$_pp_disk_path" 2>/dev/null | awk 'NR == 2 { print $4; exit }')" |
| 44 | case "$_pp_disk_avail_kb" in |
| 45 | ""|*[!0-9]*) return 0 ;; |
| 46 | esac |
| 47 | |
| 48 | if [ "$_pp_disk_avail_kb" -lt "$_pp_disk_fail_kb" ]; then |
| 49 | echo "" |
| 50 | echo "[setup-error] Critically low disk space on the Printing Press workspace volume." |
| 51 | echo "PRESS_DISK_PATH=$_pp_disk_path" |
| 52 | echo "PRESS_DISK_AVAIL_KB=$_pp_disk_avail_kb" |
| 53 | echo "PRESS_DISK_FAIL_KB=$_pp_disk_fail_kb" |
| 54 | echo "Free disk space or set PRINTING_PRESS_HOME to a volume with more room, then re-run this skill." |
| 55 | echo "" |
| 56 | return 1 |
| 57 | fi |
| 58 | |
| 59 | if [ "$_pp_disk_avail_kb" -lt "$_pp_disk_warn_kb" ]; then |
| 60 | echo "" |
| 61 | echo "[low-disk] Printing Press workspace volume is low on free space." |
| 62 | echo "PRESS_DISK_PATH=$_pp_disk_path" |
| 63 | echo "PRESS_DISK_AVAIL_KB=$_pp_disk_avail_kb" |
| 64 | echo "PRESS_DISK_WARN_KB=$_pp_disk_warn_kb" |
| 65 | echo "This flow may need several GiB for generated files, Go build cache, module downloads, or repository clones." |
| 66 | echo "" |
| 67 | fi |
| 68 | } |
| 69 | _pp_check_disk_space || { return 1 2>/dev/null || exit 1; } |
| 70 | |
| 71 | # Mid-pipeline callers may pass printing_press_bin: <abs-path> in the args |
| 72 | # bundle. Prefer it so forked polish runs keep using the parent skill's |
| 73 | # preflight-selected binary instead of re-resolving through PATH. |
| 74 | PRINTING_PRESS_BIN="${PRINTING_PRESS_BIN:-}" |
| 75 | if [ -z "$PRINTING_PRESS_BIN" ] && [ -n "${ARGUMENTS:-}" ]; then |
| 76 | PRINTING_PRESS_BIN="$(printf '%s\n' "$ARGUMENTS" | sed -nE 's/^[[:space:]]*printing_press_bin:[[:space:]]*(.+)$/\1/p' | head -1)" |
| 77 | fi |
| 78 | if [ -z "$PRINTING_PRESS_BIN" ]; then |
| 79 | PRINTING_PRESS_BIN="$(command -v cli-printing-press 2>/dev/null || true)" |
| 80 | fi |
| 81 | |
| 82 | if [ -z "$PRINTING_PRESS_BIN" ]; then |
| 83 | echo "cli-printing-press binary not found." |
| 84 | echo "Install with: go install github.com/mvanhorn/cli-printing-press/v4/cmd/cli-printing-press@latest" |
| 85 | return 1 2>/dev/null || exit 1 |
| 86 | fi |
| 87 | if ! command -v go >/dev/null 2>&1; then |
| 88 | echo "" |
| 89 | echo "[setup-error] Go toolchain not found." |
| 90 | echo "" |
| 91 | echo "This Printing Press flow runs Go-based build or validation commands." |
| 92 | echo "Install Go 1.26.5 or newer from https://go.dev/dl/, then verify with:" |
| 93 | echo " go version" |
| 94 | echo "Then re-run this skill." |
| 95 | echo "" |
| 96 | return 1 2>/dev/null || exit 1 |
| 97 | fi |
| 98 | echo "PRINTING_PRESS_BIN=$PRINTING_PRESS_BIN" |
| 99 | |
| 100 | _pp_semver_lt() { |
| 101 | awk -v a="$1" -v b="$2" 'BEGIN { |
| 102 | split(a, x, "."); split(b, y, ".") |
| 103 | for (i = 1; i <= 3; i++) { |
| 104 | if ((x[i] + 0) < (y[i] + 0)) exit 0 |
| 105 | if ((x[i] + 0) > (y[i] + 0)) exit 1 |
| 106 | } |
| 107 | exit 1 |
| 108 | }' |
| 109 | } |
| 110 | |
| 111 | _pp_go_version_norm() { |
| 112 | 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) }' |
| 113 | } |
| 114 | |
| 115 | _pp_check_go_currency() { |
| 116 | _pp_go_installed="$(_pp_go_version_norm "$(go env GOVERSION 2>/dev/null)")" |
| 117 | _pp_go_required="$(_pp_go_version_norm "$(go version "$PRINTING_PRESS_BIN" |