Skip to content

rdcrystallab/cli-creator

v1.0.0MIT

從 API 文件、OpenAPI spec、curl 範例或現有腳本建立可組合的 CLI 工具。支援 Python (uv single-file)、Rust、TypeScript,含 companion skill 自動生成。

cli-creator

從 API 文件、OpenAPI spec、curl 範例、SDK 或現有腳本,建立可組合的 CLI 工具。

改編自:OpenAI Codex Skills

特色

  • Composable commands — discover → resolve → read → write 的漸進式設計
  • Stable JSON — 所有命令支援 --json 機器可讀輸出
  • Doctor commandtool --json doctor 一鍵檢查設定
  • Auth 三層 — 環境變數 → config 檔 → flag
  • Companion skill — 自動產生教 AI agent 使用此 CLI 的 SKILL.md

Runtime 偏好

優先順序Runtime適用場景
1Python (uv single-file)大多數情況。單檔 + inline 依賴,零設定
2Rust效能要求高、需分發 binary
3TypeScript/Node有官方 SDK 或 browser automation 需求

Python uv single-file 範例

#!/usr/bin/env -S uv run --script
# /// script
# requires-python = ">=3.11"
# dependencies = ["httpx"]
# ///

import argparse, json, sys

def main():
    parser = argparse.ArgumentParser(prog="my-cli")
    parser.add_argument("--json", action="store_true")
    # ...

安裝到 PATH:

cp my-cli.py ~/.local/bin/my-cli
chmod +x ~/.local/bin/my-cli

使用

/cli-creator

然後描述你想建的工具和來源即可。