printing-press-catalog

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

/printing-press-catalog

/printing-press-catalog

Deprecated: This skill is superseded by the main
/printing-press
skill, which now checks the built-in catalog automatically. Use
/printing-press <API>
instead. For browsing the catalog, use
printing-press catalog list
in your terminal.
Browse and install pre-built Go CLIs for popular APIs.
已废弃: 这个技能已被主技能
/printing-press
取代,该主技能现在会自动检查内置目录。请改用
/printing-press <API>
。如需浏览目录,请在终端中运行
printing-press catalog list
浏览并安装为热门API预构建的Go CLI。

Quick Start

快速开始

/printing-press-catalog
/printing-press-catalog install stripe
/printing-press-catalog search auth
/printing-press-catalog
/printing-press-catalog install stripe
/printing-press-catalog search auth

Prerequisites

前提条件

  • Go 1.21+ installed
  • printing-press
    binary on PATH (install with
    go install github.com/mvanhorn/cli-printing-press/v4/cmd/printing-press@latest
    )
  • Go 1.21+ 已安装
  • printing-press
    二进制文件已在PATH中(使用
    go install github.com/mvanhorn/cli-printing-press/v4/cmd/printing-press@latest
    安装)

Setup

设置

Before any other commands, run the setup contract to verify the printing-press binary is on PATH and initialize scope variables:
<!-- PRESS_SETUP_CONTRACT_START -->
bash
undefined
在执行任何其他命令之前,运行设置脚本以验证printing-press二进制文件是否在PATH中并初始化作用域变量:
<!-- PRESS_SETUP_CONTRACT_START -->
bash
undefined

min-binary-version: 0.2.0

min-binary-version: 0.2.0

Derive scope first — needed for local build detection

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)"
_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.

Prefer local build when running from inside the printing-press repo.

if [ -x "$_scope_dir/printing-press" ] && [ -d "$_scope_dir/cmd/printing-press" ]; then export PATH="$_scope_dir:$PATH" echo "Using local build: $_scope_dir/printing-press" elif ! command -v printing-press >/dev/null 2>&1; then if [ -x "$HOME/go/bin/printing-press" ]; then echo "printing-press found at ~/go/bin/printing-press but not on PATH." echo "Add GOPATH/bin to your PATH: export PATH="$HOME/go/bin:$PATH"" else echo "printing-press binary not found." echo "Install with: go install github.com/mvanhorn/cli-printing-press/v4/cmd/printing-press@latest" fi return 1 2>/dev/null || exit 1 fi
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="$HOME/printing-press" PRESS_RUNSTATE="$PRESS_HOME/.runstate/$PRESS_SCOPE" PRESS_LIBRARY="$PRESS_HOME/library"
mkdir -p "$PRESS_RUNSTATE" "$PRESS_LIBRARY"
<!-- PRESS_SETUP_CONTRACT_END -->

After running the setup contract, check binary version compatibility. Read the `min-binary-version` field from this skill's YAML frontmatter. Run `printing-press version --json` and parse the version from the output. Compare it to `min-binary-version` using semver rules. If the installed binary is older than the minimum, warn the user: "printing-press binary vX.Y.Z is older than the minimum required vA.B.C. Run `go install github.com/mvanhorn/cli-printing-press/v4/cmd/printing-press@latest` to update." Continue anyway but surface the warning prominently.

Generated CLIs are published to `$PRESS_LIBRARY/`, not to the repo.
if [ -x "$_scope_dir/printing-press" ] && [ -d "$_scope_dir/cmd/printing-press" ]; then export PATH="$_scope_dir:$PATH" echo "Using local build: $_scope_dir/printing-press" elif ! command -v printing-press >/dev/null 2>&1; then if [ -x "$HOME/go/bin/printing-press" ]; then echo "printing-press found at ~/go/bin/printing-press but not on PATH." echo "Add GOPATH/bin to your PATH: export PATH="$HOME/go/bin:$PATH"" else echo "printing-press binary not found." echo "Install with: go install github.com/mvanhorn/cli-printing-press/v4/cmd/printing-press@latest" fi return 1 2>/dev/null || exit 1 fi
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="$HOME/printing-press" PRESS_RUNSTATE="$PRESS_HOME/.runstate/$PRESS_SCOPE" PRESS_LIBRARY="$PRESS_HOME/library"
mkdir -p "$PRESS_RUNSTATE" "$PRESS_LIBRARY"
<!-- PRESS_SETUP_CONTRACT_END -->

运行设置脚本后,检查二进制版本兼容性。从该技能的YAML前置元数据中读取`min-binary-version`字段。运行`printing-press version --json`并从输出中解析版本号。使用语义化版本规则将其与`min-binary-version`进行比较。如果已安装的二进制版本低于最低要求版本,向用户发出警告:"printing-press二进制文件vX.Y.Z低于最低要求版本vA.B.C。请运行`go install github.com/mvanhorn/cli-printing-press/v4/cmd/printing-press@latest`进行更新。" 仍继续执行操作,但要显著显示该警告。

生成的CLI会发布到`$PRESS_LIBRARY/`,而非仓库中。

Workflows

工作流程

List Catalog (no arguments)

列出目录(无参数)

When invoked with no arguments, list all available CLIs grouped by category.
  1. Read all YAML files in catalog/ using Glob + Read
  2. Parse each file's name, display_name, description, category fields
  3. Group by category and display:
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>
当不带参数调用时,按类别列出所有可用的CLI。
  1. 使用Glob + Read读取catalog/目录下的所有YAML文件
  2. 解析每个文件的name、display_name、description、category字段
  3. 按类别分组并显示:
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>)

安装(install <name>

When invoked with
install <name>
:
  1. Read catalog/<name>.yaml
  2. If file doesn't exist, show error: "No catalog entry for '<name>'. Run /printing-press-catalog to see available CLIs."
  3. Extract spec_url from the catalog entry
  4. Show preview: "Installing <display_name> CLI from <spec_url>"
  5. Download the spec and generate:
    bash
    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
    printing-press generate \
      --spec "$SPEC_TMP" \
      --output "$OUTPUT_DIR" \
      --validate
  6. If all quality gates pass, present the result:
    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
  7. If gates fail, show the error and suggest: "Try /printing-press <display_name> API for a custom generation with retry support."
当使用
install <name>
调用时:
  1. 读取catalog/<name>.yaml文件
  2. 如果文件不存在,显示错误:"没有'<name>'的目录条目。运行/printing-press-catalog查看可用CLI。"
  3. 从目录条目中提取spec_url
  4. 显示预览:"正在从<spec_url>安装<display_name> CLI"
  5. 下载规范并生成:
    bash
    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
    printing-press generate \
      --spec "$SPEC_TMP" \
      --output "$OUTPUT_DIR" \
      --validate
  6. 如果所有质量检查通过,展示结果:
    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
  7. 如果检查失败,显示错误并建议:"尝试使用/printing-press <display_name> API进行自定义生成,该方式支持重试。"

Search (search <query>)

搜索(search <query>

When invoked with
search <query>
:
  1. Read all YAML files in catalog/
  2. Search name, display_name, description, and category for the query (case-insensitive)
  3. Display matching entries
当使用
search <query>
调用时:
  1. 读取catalog/目录下的所有YAML文件
  2. 在name、display_name、description和category中搜索查询内容(不区分大小写)
  3. 显示匹配的条目

Limitations

局限性

  • Large API specs (Stripe, Discord, GitHub) take 30-60 seconds to generate and compile
  • Generated CLIs are truncated to 50 resources / 20 endpoints per resource
  • Catalog entries point to external URLs that may change
  • 大型API规范(Stripe、Discord、GitHub)的生成和编译需要30-60秒
  • 生成的CLI会被截断为每个资源最多50个资源/20个端点
  • 目录条目指向的外部URL可能会发生变化