npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@crotuyuzhe/opc-cli

v0.4.22

Published

OPC - AI multi-agent team orchestrator CLI

Readme


OPC 是一个运行在终端里的 AI 多智能体协作框架。你只需要一句话描述需求,OPC 会自动拆解任务,分配给 5 个专业角色 Agent,像一支真实团队一样协作完成:需求分析、技术实现、UI 设计、质量测试、项目管理。

"我想做一个网页贪吃蛇小游戏"

PM 追问你 5 轮需求细节 → 产出 PRD → Dev 写出可运行代码 → UI 输出设计规范 → Tester 生成测试用例 → Admin 归档总结 —— 全自动,你只需要做决策。


Why OPC

🏢 一个人就是一家公司 — 不用招人,不用开会。5 个 AI 角色各司其职,你是 Boss,做决策就好。

🧠 Brain 智能协调 — 中枢大脑自动理解意图、拆解任务、编排依赖、串联流水线,复杂项目也能一键启动。

🔁 真实团队协作模式 — 角色之间通过消息总线异步通信,有交接规范、有审批节点、有质量门禁,不是简单的 prompt chain。

🔌 可扩展插件系统 — 从 GitHub 一键安装 Skill 插件,支持 Node.js / Python / Bash,让你的团队能力无限延伸。


架构总览

                            ┌─────────────────────────┐
                            │       👤 You (Boss)      │
                            │   "做一个贪吃蛇小游戏"    │
                            └────────────┬────────────┘
                                         │
                                         ▼
                          ┌──────────────────────────────┐
                          │         🧠 Brain              │
                          │   意图识别 · 任务拆解 · 依赖编排  │
                          │   审批节点 · 知识注入 · Skill 调度 │
                          └──────────────┬───────────────┘
                                         │ dispatch
                                         ▼
               ┌─────────────────────────────────────────────────┐
               │            📬 File-System Message Bus            │
               │                                                  │
               │   inbox/ (待处理) → active/ (执行中) → archive/   │
               └──┬──────────┬──────────┬──────────┬──────────┬──┘
                  │          │          │          │          │
                  ▼          ▼          ▼          ▼          ▼
            ┌─────────┐┌─────────┐┌─────────┐┌─────────┐┌─────────┐
            │ 📋 PM   ││ 💻 Dev  ││ 🎨 UI   ││ 🧪 Test ││ 📊 Admin│
            │         ││         ││         ││         ││         │
            │ 需求分析 ││ 代码实现 ││ 设计规范 ││ 测试验证 ││ 项目管理 │
            │ Deepthink││write_file││write_file││ 报告   ││ 归档   │
            │ ask_user ││         ││         ││         ││         │
            └────┬────┘└────┬────┘└────┬────┘└────┬────┘└────┬────┘
                 │          │          │          │          │
                 ▼          ▼          ▼          ▼          ▼
            ┌─────────────────────────────────────────────────────┐
            │              📁 workspace/artifacts/                 │
            │                                                     │
            │   {id}_pm.md    PRD 需求文档                         │
            │   {id}_dev.md   技术方案 + 代码文件                    │
            │   {id}_ui.md    设计规范                              │
            │   {id}_tester.md 测试报告                             │
            │   {id}_admin.md  项目总结                             │
            └─────────────────────────────────────────────────────┘

核心设计

| 模块 | 说明 | |------|------| | Brain | 中枢协调器。接收用户输入,识别意图(聊天 / 任务),拆解复杂需求为多角色子任务,按依赖顺序串行分发 | | Message Bus | 文件系统消息总线。角色之间不直接对话,所有协作通过 JSON 消息文件异步传递,天然支持断点续跑 | | Identity Engine | 每个角色有独立的身份定义、能力边界、输出规范,确保各司其职不越界 | | Tool Loop | 角色通过 LLM tool-calling 循环执行任务:调用工具 → 获取结果 → 继续推理,直到产出最终交付物 | | Skill System | 插件机制。从 GitHub 安装自定义工具,Brain 自动发现并注入到角色的工具集中 |


Quick Start

安装

npm install -g @crotuyuzhe/opc-cli

需要 Node.js 18+

初始化项目

mkdir my-startup && cd my-startup
opc init

配置 API Key

编辑生成的 opc.json

{
    "provider": "openai",
    "api_key": "sk-your-api-key",
    "base_url": "https://api.openai.com/v1",
    "default_model": "gpt-4o",
    "team_root": ".",
    "max_tokens": 8192,
    "temperature": 0.7
}

兼容所有 OpenAI API 格式的服务(DeepSeek、智谱、Moonshot 等),只需修改 base_urldefault_model

启动

opc
┌──────────────────────────────────────┐
│ OPC Team Agent v0.1                  │
│                                      │
│   Provider   : openai                │
│   Model      : gpt-4o               │
│   Max Tokens : 8192                  │
│   Temperature: 0.7                   │
│   Config     : OK                    │
│                                      │
│   /help for commands, /exit to quit  │
└──────────────────────────────────────┘

opc > 做一个网页贪吃蛇小游戏

交互示例

🧠 Brain: 识别为新功能需求,分发给 PM 进行需求分析...

📋 PM 开始执行任务 [a1b2c3d4]

  ? PM asks: 这个贪吃蛇游戏的目标平台是什么?
  → 移动端H5,手机浏览器直接玩

  ? PM asks: 游戏视觉风格偏好?
    (1) 像素复古风
    (2) 科技霓虹风  ← 你选了这个
    (3) 简约扁平风
    (4) 可爱卡通风

  ? PM asks: 操控方式需要支持哪些?
    (1) 键盘方向键
    (2) 触屏滑动
    (3) 键盘 + 触屏都要  ← 你选了这个

  ✅ PM 产出 PRD → workspace/artifacts/a1b2c3d4_pm.md

💻 Dev 开始执行任务 [b2c3d4e5]
  📝 写入 code/index.html
  📝 写入 code/game.js
  📝 写入 code/style.css
  ✅ Dev 完成 → workspace/artifacts/b2c3d4e5_dev.md

🎨 UI 产出设计规范 → workspace/artifacts/c3d4e5f6_ui.md
🧪 Tester 产出测试报告 → workspace/artifacts/d4e5f6g7_tester.md
📊 Admin 产出项目总结 → workspace/artifacts/e5f6g7h8_admin.md

✅ 所有任务完成,产出物在 workspace/ 目录下

角色分工

| 角色 | 代号 | 职责 | 工具 | 核心产出 | |------|------|------|------|----------| | Boss | boss | 你本人。最终决策者,审批关键节点 | — | 需求指令、审批决策 | | PM | pm | 需求分析。Deepthink 追问直到需求无歧义 | ask_user | PRD、用户故事 | | Dev | dev | 技术实现。写真实可运行的代码 | write_file | 代码文件、技术方案 | | UI | ui | 设计规范。输出完整的 Design System | write_file | 设计规范、组件 spec | | Tester | tester | 质量保障。基于 PRD 编写测试用例 | — | 测试报告、BUG 报告 | | Admin | admin | 项目管理。流程跟踪、归档、总结 | — | 周报、项目总结 |

权限层级

Boss (你)  ← 最高决策权,所有角色听从指令
  │
  ├── PM     ── 平级协作 ── Dev
  ├── UI     ── 平级协作 ── Tester
  └── Admin

角色之间不能互相指挥,只能通过消息总线请求协作,由 Brain 统一调度。


工作流

标准需求流转

你: "做一个用户登录功能"
 │
 ▼
[PM] 追问需求 (Deepthink)
 │  Q: 目标用户? → Q: 登录方式? → Q: 登录态有效期? → ...
 │  全部确认后 → 产出 PRD
 │
 ├──▶ [Dev] 读取 PRD → 技术方案 → 写代码
 │
 ├──▶ [UI] 读取 PRD → 设计规范 → Design System
 │
 ▼
[Tester] 读取 PRD + 技术方案 → 测试计划 + 用例
 │
 ▼
[Admin] 全部完成 → 项目总结归档
 │
 ▼
你审阅所有产出 ✅

Deepthink 追问协议

PM 不会凭空猜测需求。收到任务后进入 Deepthink 模式:

  1. 分析请求,识别所有缺失信息
  2. 通过 ask_user 工具,逐个追问(不会一次性抛出 10 个问题)
  3. 第一个问题必问:交付形态(H5 / App / 小程序 / Web / CLI / API?)
  4. 继续追问:目标用户、核心场景、验收标准、边界条件、技术约束...
  5. 全部确认后才产出 PRD

人工审批节点

Brain 在关键节点会暂停,等你确认:

| 节点 | 触发条件 | |------|----------| | PRD 审批 | PM 产出 PRD 后,必须你确认才能分发给 Dev/UI | | 技术决策 | Dev 提出重大技术选型(框架/架构),需你确认 | | 发布就绪 | 全部角色产出完成,需你确认是否 ready | | 范围变更 | 任何涉及范围扩大或成本增加的决策 |


项目结构

opc init 后生成的目录:

my-startup/
├── opc.json                          ← 配置文件
├── AGENTS.md                         ← 团队协议(所有角色自动加载)
├── boundary.md                       ← 安全红线
│
├── communication/
│   ├── bus/{role}/inbox/             ← 待处理任务
│   ├── bus/{role}/active/            ← 执行中任务
│   └── handoff_protocols.md          ← 角色交接规范
│
├── workspace/
│   ├── artifacts/                    ← 角色产出物(PRD、代码、设计、测试报告)
│   └── code/                         ← Dev/UI 写出的代码文件
│
├── staff/
│   ├── boss_decide/                  ← Boss 身份 + 干预开关
│   ├── pm_office/                    ← PM 身份 + 规则
│   ├── dev_forge/                    ← Dev 身份 + 前后端规范
│   ├── ui_ux_studio/                 ← UI 身份 + 设计模板
│   ├── tester/                       ← Tester 身份 + 测试规范
│   └── admin_bp/                     ← Admin 身份 + 报告模板
│
├── knowledge_base/                   ← 静态知识库(设计规范、技术文档、公司调性)
│
├── memory_center/
│   ├── archive/{date}/               ← 已完成任务归档
│   ├── user.md                       ← Boss 偏好记录
│   └── reflection.log                ← Agent 自省日志
│
└── skills/                           ← 插件目录
    └── hello_world/                  ← 示例插件

配置

opc.json

{
    "provider": "openai",
    "api_key": "sk-your-api-key",
    "base_url": "https://api.openai.com/v1",
    "default_model": "gpt-4o",
    "team_root": ".",
    "max_tokens": 8192,
    "temperature": 0.7
}

| 字段 | 说明 | 默认值 | |------|------|--------| | provider | LLM 提供商 (openai / anthropic) | openai | | api_key | API 密钥 | — | | base_url | API 端点(兼容 OpenAI 格式的服务都能用) | https://api.openai.com/v1 | | default_model | 模型名称 | gpt-4o | | team_root | 团队根目录 | . | | max_tokens | 单次回复最大 token 数 | 8192 | | temperature | 生成温度 (0-2) | 0.7 |

环境变量

export OPC_API_KEY="sk-your-api-key"
export OPC_PROVIDER="openai"
export OPC_MODEL="gpt-4o"
export OPC_BASE_URL="https://api.openai.com/v1"
export OPC_TEAM_ROOT="."
export OPC_MAX_TOKENS="8192"
export OPC_TEMPERATURE="0.7"

优先级:环境变量 > 当前目录 opc.json > ~/.opc/opc.json

使用其他 LLM

{
    "provider": "anthropic",
    "api_key": "sk-ant-your-key",
    "default_model": "claude-sonnet-4-20250514"
}
{
    "provider": "openai",
    "api_key": "your-deepseek-key",
    "base_url": "https://api.deepseek.com/v1",
    "default_model": "deepseek-chat"
}

任何兼容 OpenAI API 格式的服务都可以使用,只需修改 base_urldefault_model

  • 智谱 GLM、Moonshot Kimi、百川、通义千问...
  • 本地部署的 Ollama、vLLM、LocalAI...

命令参考

| 命令 | 说明 | |------|------| | opc init | 初始化团队项目目录 | | opc | 启动交互式终端 | | /help | 显示帮助信息 | | /status | 查看各角色状态(idle / working / queued) | | /tasks | 列出所有任务 | | /inbox <role> | 查看角色收件箱 | | /dispatch <role> <desc> | 手动分发任务到指定角色 | | /skills | 列出已安装的技能插件 | | /skill install <url> | 从 GitHub 安装 Skill 插件 | | /skill remove <name> | 卸载插件 | | /compact | 切换紧凑输出模式 | | /exit | 退出 |


Skill 插件

安装

opc > /skill install https://github.com/user/my-skill

开发自定义 Skill

skills/ 下创建目录:

skills/my_tool/
├── manifest.json      ← 工具描述 + 参数定义
└── run.js             ← 入口脚本(支持 Node.js / Python / Bash)

manifest.json 示例:

{
    "name": "my_tool",
    "description": "A custom tool that does something useful",
    "version": "0.1.0",
    "type": "node",
    "entry": "run.js",
    "parameters": {
        "type": "object",
        "properties": {
            "input": { "type": "string", "description": "Input data" }
        },
        "required": ["input"]
    }
}

Brain 会自动发现已安装的 Skill,并在合适的时机让角色调用。


License

Apache License 2.0