关于 printing-press-catalog
用于浏览和安装常见 API 的预构建 Go CLI 的技能,支持目录列表、搜索和生成。该技能已弃用,README 建议改用 `/printing-press`。
主要功能
- 01按类别浏览 CLI
- 02搜索目录条目
- 03安装目录中的 CLI
- 04生成 Go CLI 项目
适用场景
- 01查找 API 的预构建 CLI
- 02根据目录规范生成 CLI
安装
复制下面的命令,在终端中运行。
npx skills add https:/ / github.com/ mvanhorn/ cli-printing-press --skill printing-press-catalog安装后在 Claude Code 中输入/printing-press-catalog确认已加载。
详细介绍
/printing-press-catalog
已弃用: 此技能已由主
/printing-press技能取代,该技能现在会自动检查内置目录。请改用/printing-press <API>。如需浏览目录,请在终端中使用cli-printing-press catalog list。
浏览并安装适用于热门 API 的预构建 Go CLI。
快速开始
/printing-press-catalog
/printing-press-catalog install stripe
/printing-press-catalog search auth
前置条件
- 已安装 Go 1.26.4 或更高版本
cli-printing-press二进制文件位于 PATH 中(使用go install github.com/mvanhorn/cli-printing-press/v4/cmd/cli-printing-press@latest安装)
设置
在运行任何其他命令之前,运行设置约定,以验证 cli-printing-press 二进制文件位于 PATH 中并初始化作用域变量:
# min-binary-version: 4.0.0
# Derive scope first — needed for local build detection
_scope_dir="$(git rev-parse --show-toplevel 2>/dev/null || echo "$PWD")"
_scope_dir="$(cd "$_scope_dir" && pwd -P)"
# Prefer local build when running from inside the printing-press repo.
_press_repo=false
if [ -x "$_scope_dir/cli-printing-press" ] && [ -d "$_scope_dir/cmd/cli-printing-press" ]; then
_press_repo=true
export PATH="$_scope_dir:$PATH"
echo "Using local build: $_scope_dir/cli-printing-press"
elif ! command -v cli-printing-press >/dev/null 2>&1; then
if [ -x "$HOME/go/bin/cli-printing-press" ]; then
echo "cli-printing-press found at ~/go/bin/cli-printing-press but not on PATH."
echo "Add GOPATH/bin to your PATH: export PATH=\"\$HOME/go/bin:\$PATH\""
else
echo "cli-printing-press binary not found."
echo "Install with: go install github.com/mvanhorn/cli-printing-press/v4/cmd/cli-printing-press@latest"
fi
return 1 2>/dev/null || exit 1
fi
# Resolve and emit the absolute path the agent must use for every later
# `cli-printing-press` invocation. `export PATH` above only affects this one
# Bash tool call; subsequent calls open a fresh shell and resolve bare
# `cli-printing-press` against the user's default PATH, where a stale global
# can silently shadow the local build. The agent captures this marker and
# substitutes the absolute path into every later invocation.
if [ "$_press_repo" = "true" ]; then
PRINTING_PRESS_BIN="$_scope_dir/cli-printing-press"
else
PRINTING_PRESS_BIN="$(command -v cli-printing-press 2>/dev/null || true)"
fi
echo "PRINTING_PRESS_BIN=$PRINTING_PRESS_BIN"
PRESS_BASE="$(basename "$_scope_dir" | tr '[:upper:]' '[:lower:]' | sed -E 's/[^a-z0-9_-]/-/g; s/^-+//; s/-+$//')"
if [ -z "$PRESS_BASE" ]; then
PRESS_BASE="workspace"
fi
PRESS_SCOPE="$PRESS_BASE-$(printf '%s' "$_scope_dir" | shasum -a 256 | cut -c1-8)"
PRESS_HOME="${PRINTING_PRESS_HOME:-$HOME/printing-press}"
PRESS_RUNSTATE="$PRESS_HOME/.runstate/$PRESS_SCOPE"
PRESS_LIBRARY="$PRESS_HOME/library"
mkdir -p "$PRESS_RUNSTATE" "$PRESS_LIBRARY"
运行设置约定后,从 stdout 中获取 PRINTING_PRESS_BIN=<abs-path> 这一行。此技能中后续每次调用 cli-printing-press ... 都必须使用该绝对路径(替换为对应的值,而不是字面量 $PRINTING_PRESS_BIN);上面的 export PATH 只会影响其运行所在的单次 Bash 工具调用,因此后续调用会启动新的 shell,在其中,裸写的 cli-printing-press 会根据用户的默认 PATH 进行解析,而过时的全局版本可能会覆盖本地构建版本。
获取二进制文件路径后,检查二进制文件的版本兼容性。读取此技能 YAML frontmatter 中的 min-binary-version 字段。运行 <PRINTING_PRESS_BIN> version --json 并从输出中解析版本。使用 semver 规则将其与 min-binary-version 进行比较。如果已安装的二进制文件版本低于最低要求,请立即停止并告知用户:“cli-printing-press 二进制文件版本 vX.Y.Z 低于最低要求 vA.B.C。运行 go install github.com/mvanhorn/cli-printing-press/v4/cmd/cli-printing-press@latest 进行更新。”
生成的 CLI 会发布到 $PRESS_LIBRARY/,而不是仓库中。
工作流
列出目录(不带参数)
不带参数调用时,按类别列出所有可用的 CLI。
- 使用 Glob + Read 读取 catalog/ 中的所有 YAML 文件
- 解析每个文件的 name、display_name、description、category 字段
- 按类别分组并显示:
Available CLIs (12 entries):
Payments:
stripe - Payment processing and financial infrastructure API
square - Payment processing and commerce API
Auth:
stytch - Authentication and user management API
Email:
sendgrid - Email delivery and marketing API
Communication:
discord - Chat and community platform API
twilio - Communication APIs for SMS, voice, and messaging
front - Customer communication platform API
Developer Tools:
github - Software development platform API
digitalocean - Cloud infrastructure and developer platform API
Project Management:
asana - Work management and project tracking API
CRM:
hubspot - CRM contacts API
Example:
petstore - Canonical OpenAPI example
Install any CLI: /printing-press-catalog install <name>
安装(install )
使用 install <name> 调用时:
- 读取 catalog/.yaml
- 如果文件不存在,则显示错误:“没有名为 '' 的目录条目。运行 /printing-press-catalog 查看可用的 CLI。”
- 从目录条目中提取 spec_url
- 显示预览:“正在从 <spec_url> 安装 <display_name> CLI”
- 下载规范并生成:
CATALOG_TMP_DIR="/tmp/printing-press/catalog" mkdir -p "$CATALOG_TMP_DIR" SPEC_TMP="$(mktemp "$CATALOG_TMP_DIR/<name>-spec-XXXXXX.yaml")" curl -sL -o "$SPEC_TMP" "<spec_url>" OUTPUT_BASE="$PRESS_LIBRARY/<name>-pp-cli" OUTPUT_DIR="$OUTPUT_BASE" i=2 while [ -e "$OUTPUT_DIR" ]; do OUTPUT_DIR="${OUTPUT_BASE}-$i" i=$((i + 1)) done cli-printing-press generate \ --spec "$SPEC_TMP" \ --output "$OUTPUT_DIR" \ --validate - 如果所有质量门禁都通过,则显示结果:
Generated <name>-pp-cli with X resources. Try it: cd "$OUTPUT_DIR" go install ./cmd/<name>-pp-cli <name>-pp-cli --help <name>-pp-cli doctor - 如果门禁未通过,则显示错误并建议:“尝试使用 /printing-press <display_name> API 进行自定义生成,并启用重试支持。”
搜索(search )
使用 search <query> 调用时:
- 读取 catalog/ 中的所有 YAML 文件
- 搜索 name、display_name、description 和 category 中与查询匹配的内容(不区分大小写)
- 显示匹配的条目
限制
- 大型 API 规范(Stripe、Discord、GitHub)生成和编译需要 30–60 秒
- 生成的 CLI 最多包含 50 个资源,每个资源最多包含 20 个端点
- 目录条目指向可能发生变化的外部 URL