$npx -y skills add mvanhorn/cli-printing-press --skill printing-press-oauth2-device-codePrinting Press CLI for Printing Press Oauth2. Purpose-built fixture for the OAuth2 device-code auth shape.
| 1 | # Printing Press Oauth2 — Printing Press CLI |
| 2 | |
| 3 | ## Prerequisites: Install the CLI |
| 4 | |
| 5 | This skill drives the `printing-press-oauth2-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 printing-press-oauth2 --cli-only |
| 10 | ``` |
| 11 | 2. Verify: `printing-press-oauth2-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 | Purpose-built fixture for the OAuth2 device-code auth shape. |
| 19 | |
| 20 | ## When Not to Use This CLI |
| 21 | |
| 22 | 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. |
| 23 | |
| 24 | ## Command Reference |
| 25 | |
| 26 | **items** — Manage items |
| 27 | |
| 28 | - `printing-press-oauth2-pp-cli items` — List items |
| 29 | |
| 30 | |
| 31 | ### Finding the right command |
| 32 | |
| 33 | When you know what you want to do but not which command does it, ask the CLI directly: |
| 34 | |
| 35 | ```bash |
| 36 | printing-press-oauth2-pp-cli which "<capability in your own words>" |
| 37 | ``` |
| 38 | |
| 39 | `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. |
| 40 | |
| 41 | ## Auth Setup |
| 42 | |
| 43 | Run `printing-press-oauth2-pp-cli auth setup` for setup details if needed. Then authenticate: |
| 44 | |
| 45 | ```bash |
| 46 | export DEVICE_CODE_CLIENT_ID=<client-id> |
| 47 | printing-press-oauth2-pp-cli auth login --device-code |
| 48 | ``` |
| 49 | |
| 50 | Open the verification URL, enter the printed user code, and return to the CLI. Tokens are stored locally and refreshed automatically. |
| 51 | |
| 52 | Run `printing-press-oauth2-pp-cli doctor` to verify setup. |
| 53 | |
| 54 | ## Agent Mode |
| 55 | |
| 56 | Add `--agent` to any command. Expands to: `--json --compact --no-input --no-color --yes`. |
| 57 | |
| 58 | - **Pipeable** — JSON on stdout, errors on stderr |
| 59 | - **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: |
| 60 | |
| 61 | ```bash |
| 62 | printing-press-oauth2-pp-cli items --agent --select id,name,status |
| 63 | ``` |
| 64 | - **Previewable** — `--dry-run` shows the request without sending |
| 65 | - **Offline-friendly** — sync/search commands can use the local SQLite store when available |
| 66 | - **Non-interactive** — never prompts, every input is a flag |
| 67 | - **Read-only** — do not use this CLI for create, update, delete, publish, comment, upvote, invite, order, send, or other mutating requests |
| 68 | |
| 69 | ### Response envelope |
| 70 | |
| 71 | Commands that read from the local store or the API wrap output in a provenance envelope: |
| 72 | |
| 73 | ```json |
| 74 | { |
| 75 | "meta": {"source": "live" | "local", "synced_at": "...", "reason": "..."}, |
| 76 | "results": <data> |
| 77 | } |
| 78 | ``` |
| 79 | |
| 80 | 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. |
| 81 | |
| 82 | ## Paths and state |
| 83 | |
| 84 | Agents should treat the CLI's path resolver as part of the runtime contract: |
| 85 | |
| 86 | - Use `--home <dir>` for one invocation, or set `PRINTING_PRESS_OAUTH2_HOME=<dir>` to relocate all four path kinds under one root. |
| 87 | - Use per-kind env vars only when a specific kind must diverge: `PRINTING_PRESS_OAUTH2_CONFIG_DIR`, `PRINTING_PRESS_OAUTH2_DATA_DIR`, `PRINTING_PRESS_OAUTH2_STATE_DIR`, `PRINTING_PRESS_OAUTH2_CACHE_DIR`. |
| 88 | - Resolution order is per-kind env var, `--home`, `PRINTING_PRESS_OAUTH2_HOME`, XDG (`XDG_CONFIG_HOME`, `XDG_DATA_HOME`, `XDG_STATE_HOME`, `XDG_CACHE_HOME`), then platform defaults. |
| 89 | - `config` contains settings like `config.toml` and profiles. `data` contains `credentials.toml`, `data.db`, cookies, and auth sidecars. `state` contains persisted queries, jobs, and `teach.log`. `cache` contains regenerable HTTP/cache files. |
| 90 | - Stored secrets live in `credentials. |