$npx -y skills add mvanhorn/cli-printing-press --skill learn-loop-examplePrinting Press CLI for Learn Loop Example. Golden fixture exercising the spec-declared self-learning loop.
| 1 | # Learn Loop Example — Printing Press CLI |
| 2 | |
| 3 | ## Prerequisites: Install the CLI |
| 4 | |
| 5 | This skill drives the `learn-loop-example-pp-cli` binary. **You must verify the CLI is installed before invoking any command from this skill.** If it is missing, install it first: |
| 6 | |
| 7 | 1. Install via the Printing Press installer. It defaults binaries to `$HOME/.local/bin` on macOS/Linux and `%LOCALAPPDATA%\Programs\PrintingPress\bin` on Windows: |
| 8 | ```bash |
| 9 | npx -y @mvanhorn/printing-press-library install learn-loop-example --cli-only |
| 10 | ``` |
| 11 | 2. Verify: `learn-loop-example-pp-cli --version` |
| 12 | 3. Ensure the reported install directory is on `$PATH` for the agent/runtime that will invoke this skill. |
| 13 | |
| 14 | If the `npx` install fails before this CLI has a public-library category, install Node or use the category-specific Go fallback after publish. |
| 15 | |
| 16 | If `--version` reports "command not found" after install, the runtime cannot see the binary directory on `$PATH`. Do not proceed with skill commands until verification succeeds. |
| 17 | |
| 18 | Golden fixture exercising the spec-declared self-learning loop. Demonstrates |
| 19 | the shape every printed CLI gets when its spec declares a `learn:` block: |
| 20 | the generator emits internal/learn/* subpackages, the teach/recall/learnings |
| 21 | commands, the v3 store schema additions, and the self-learning sections in |
| 22 | README.md / SKILL.md / AGENTS.md. |
| 23 | |
| 24 | The underlying resource surface mirrors the sync-walker fixture (top-level |
| 25 | games + walker-fanned-out leagues) so the emitted shape covers the typical |
| 26 | multi-file CLI alongside the learn package. Identifiers in the learn block |
| 27 | are intentionally neutral (EXAMPLE-* ticker, ALPHA/BRAVO entities) so the |
| 28 | scripts/verify-learn-purity.sh gate cannot trip on this fixture. |
| 29 | |
| 30 | |
| 31 | ## When Not to Use This CLI |
| 32 | |
| 33 | Do not activate this CLI for requests that require creating, updating, deleting, publishing, commenting, upvoting, inviting, ordering, sending messages, booking, purchasing, or changing remote state. This printed CLI exposes read-only commands for inspection, export, sync, and analysis. |
| 34 | |
| 35 | ## Command Reference |
| 36 | |
| 37 | **games** — Top-level games resource. The list endpoint populates the generic resources table; rows carry a `game_key` field that the walker's leagues endpoint extracts for child fan-out. |
| 38 | |
| 39 | - `learn-loop-example-pp-cli games` — List games |
| 40 | |
| 41 | **leagues** — Leagues, fetched per-game by walking games and extracting each game's game_key into the child path. |
| 42 | |
| 43 | - `learn-loop-example-pp-cli leagues <game_key>` — List leagues for a game |
| 44 | |
| 45 | |
| 46 | ### Finding the right command |
| 47 | |
| 48 | When you know what you want to do but not which command does it, ask the CLI directly: |
| 49 | |
| 50 | ```bash |
| 51 | learn-loop-example-pp-cli which "<capability in your own words>" |
| 52 | ``` |
| 53 | |
| 54 | `which` resolves a natural-language capability query to the best matching command from this CLI's curated feature index. Exit code `0` means at least one match; exit code `2` means no confident match — fall back to `--help` or use a narrower query. |
| 55 | |
| 56 | ## Auth Setup |
| 57 | |
| 58 | Run `learn-loop-example-pp-cli auth setup` for the URL and steps to obtain a token (add `--launch` to open the URL). Then store it: |
| 59 | |
| 60 | ```bash |
| 61 | learn-loop-example-pp-cli auth set-token YOUR_TOKEN_HERE |
| 62 | ``` |
| 63 | |
| 64 | Or set `LEARN_LOOP_TOKEN` as an environment variable. |
| 65 | |
| 66 | Run `learn-loop-example-pp-cli doctor` to verify setup. |
| 67 | |
| 68 | ## Agent Mode |
| 69 | |
| 70 | Add `--agent` to any command. Expands to: `--json --compact --no-input --no-color --yes`. |
| 71 | |
| 72 | - **Pipeable** — JSON on stdout, errors on stderr |
| 73 | - **Filterable** — `--select` keeps a subset of fields. Dotted paths descend into nested structures; arrays traverse element-wise. Critical for keeping context small on verbose APIs: |
| 74 | |
| 75 | ```bash |
| 76 | learn-loop-example-pp-cli games --agent --select id,name,status |
| 77 | ``` |
| 78 | - **Previewable** — `--dry-run` shows the request without sending |
| 79 | - **Offline-friendly** — sync/search commands can use the local SQLite store when available |
| 80 | - **Non-interactive** — never prompts, every input is a flag |
| 81 | - **Read-only** — do not use this CLI for create, update, delete, publish, comment, upvote, invite, order, send, or other mutating requests |
| 82 | |
| 83 | ### Response envelope |
| 84 | |
| 85 | Commands that read from the local store or the API wrap output in a provenance envelope: |
| 86 | |
| 87 | ```json |
| 88 | { |
| 89 | "meta": {"source": "live" | "local", "synced_at": "...", "reason": "..."}, |
| 90 | "results": <data> |
| 91 | } |
| 92 | ``` |
| 93 | |
| 94 | Parse `.results` for data and `.meta.source` to know whether it's live or local. A human-readable `N results (live)` summary is printed to stderr only when stdout is a terminal AND no machine-format flag (`--json`, `--csv`, `--compact`, `--quiet`, `--plain`, `--select`) is set — piped/agent consumers and explicit-format runs get pure JSON on stdout. |
| 95 | |
| 96 | ## Paths a |