opencode-plugin-docsDocs — 代码逆向文档生成插件,PRD、架构图、UML、流程图、ER图、MermaidJS图表
61
近 30 天 +2
11
近 7 天 5
38.3
生态多维模型
3 个月前
2026-05-04
快速安装与配置
opencode.json写入当前项目的 opencode.json,只对这个仓库生效。
opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-plugin-docs@0.1.1"]
}写入 ~/.config/opencode/opencode.json,对所有项目生效。
~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-plugin-docs@0.1.1"]
}若你要在本地改造这个插件,先装到项目里再从本地路径引用。
shell
pnpm add -D opencode-plugin-docsopencode 启动时会通过内嵌运行时自动加载 npm 依赖并缓存至本地目录,无需手动在全局环境执行安装。
A collection of OpenCode plugins that enable multiple AI agents to collaborate on software development tasks.
Plugins
| Plugin | Agents | Approach | Best For | Docs |
|---|---|---|---|---|
| Commander | 4 | Single orchestrator, fast iteration, Coder↔Tester fix loops | Most development tasks | README |
| Emperor | 11 | Three Departments & Six Ministries (三省六部), governance with checks & balances | Tasks requiring rigorous multi-stage review | README |
| Hive | Dynamic | Domain auto-discovery, EventBus coordination, autonomous execution | Large multi-domain projects | README |
| Superpower | Dynamic | Loads agents, skills, and commands from superpowers repo | Extensible agent capabilities | README |
| Stock | 5 | Multi-dimensional A-share analysis (fundamental, technical, sentiment, flow, sector) | Chinese A-share stock analysis | README |
| Triage | 6 | Jira ticket triage (Bug/Feature), code investigation, solution design | Bug triage and feature specification | - |
Commander — Adaptive 4-Agent Team
User Task → Lead (analyze & plan) → Coder (implement) ↔ Tester (verify) → [Reviewer] → Report
- Lead explores the codebase and creates plans with adaptive complexity classification (trivial / simple / standard / complex)
- Coder↔Tester fix loop: Tester fails → Coder fixes in the same session (context accumulates) → Tester re-verifies → up to N rounds
- Reviewer only engages on complex tasks
- Parallel wave dispatch for independent subtasks
Emperor — 11-Agent Governance System (三省六部)
Edict → Crown Prince → Jinyiwei Recon → Zhongshu (plan) → Menxia (review/veto) → Shangshu → Six Ministries (parallel) → Memorial
- Full governance model: planning, review/veto, parallel execution, post-verification
- Jinyiwei reconnaissance with git-hash caching
- Mandatory department participation (Hubu testing enforced)
- Sensitive operation detection with manual confirmation
Hive — Dynamic Domain-Agent Coordination
Startup → Scan project → Discover domains → Create per-domain Agents + Queen → EventBus coordination → Autonomous execution
- Domain Discovery: Static project scanning + LLM enrichment + user config merge
- EventBus: Pub/sub event system for agent-to-agent communication
- Queen Coordinator: Broadcasts requirements, negotiates interfaces, dispatches parallel tasks
- Autonomous Execution: Domain agents can self-adapt to breaking changes from dependencies
Stock — Multi-Dimensional A-Share Analysis
Query → Fundamentalist (基本面) + Technician (技术面) + Sentiment (情绪) + Flow (资金流) + Industry (行业) → HTML Report
- 5 并发 Agent: 基本面、技术面、情绪面、资金流、行业分析
- 智能评分: 预设权重(保守/平衡/激进),自定义权重
- HTML 报告生成: 可视化分析结果
Triage — Jira Ticket Analysis & Implementation
Jira Ticket → Triage (分类) → Scout (探索) → [Detective (Bug调查) | Architect (Feature方案)] → [Auto-fix | Awaiting Confirm]
- Bug 路径: Scout 探索 → Detective 根因调查 → 自动修复
- Feature 路径: Scout 探索 → Architect 方案设计 → 等待确认后实现
- 6 Agent 协作: triage, scout, detective, architect, coder, tester
Superpower — Extensible Agent Capabilities
Load agents, skills, and commands from external superpowers repository
- Dynamic Agent Loading: Loads agent definitions from
~/.superpowers/agents/ - Skill Registry: Registers skills from
~/.superpowers/skills/ - Command Templates: Registers command templates from
~/.superpowers/commands/ - Extends OpenCode with custom agents and capabilities from the superpowers repo
Quick Start
1. Register plugins
In .opencode/opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"plugin": [
"./plugins/commander/index.ts",
"./plugins/emperor/index.ts",
"./plugins/hive/index.ts",
"./plugins/superpower/index.ts",
"./plugins/stock/index.ts",
"./plugins/triage/index.ts"
]
}
Pick one or more.
2. Use
Commander:
@lead Implement user authentication with JWT and role-based access control
Emperor:
@taizi Implement user authentication with JWT and role-based access control
Hive:
@queen Implement user authentication with JWT and role-based access control
Superpower:
@<agent-name> Your task description here
The Superpower plugin loads agents from the superpowers repository. Use any agent defined there.
3. Configure (optional)
- Commander:
.opencode/commander.json— config docs - Emperor:
.opencode/emperor.json— config docs - Hive:
.opencode/hive.json— design docs - Superpower: No config needed (loads from
~/.superpowers/) - Stock:
.opencode/stock.json— config docs - Triage:
.opencode/triage.json— config docs
Project Structure
.
├── plugins/ # Plugin directory
│ ├── commander/ # Commander plugin
│ │ ├── index.ts # Entry point
│ │ ├── agents/ # 4 agent definitions
│ │ ├── engine/ # Pipeline, classifier, dispatcher
│ │ └── tools/ # cmd_task, cmd_status, cmd_halt
│ ├── emperor/ # Emperor plugin
│ │ ├── index.ts # Entry point
│ │ ├── agents/ # 11 agent definitions
│ │ ├── engine/ # Pipeline, recon, reviewer, dispatcher
│ │ ├── tools/ # edict, memorial, halt
│ │ └── skills/ # Built-in skills
│ ├── hive/ # Hive plugin
│ │ ├── index.ts # Entry point
│ │ ├── discovery/ # Domain auto-discovery
│ │ ├── agents/ # Dynamic agent generator
│ │ ├── eventbus/ # Event pub/sub system
│ │ ├── tools/ # hive_emit, hive_status, hive_broadcast, etc.
│ │ └── hooks/ # config, system-transform, file-watcher, autonomy
│ ├── superpower/ # Superpower plugin
│ │ └── index.ts # Entry point (loads agents/skills/commands from ~/.superpowers/)
│ ├── stock/ # Stock plugin
│ │ ├── index.ts # Entry point
│ │ ├── agents/ # 5 agent definitions
│ │ └── skills/ # Built-in skills
│ └── triage/ # Triage plugin
│ ├── index.ts # Entry point
│ ├── agents/ # 6 agent definitions
│ ├── engine/ # Pipeline, classifier, dispatcher
│ └── tools/ # jira_analyze, jira_implement, jira_status
├── package.json # Build tooling (private)
├── tsconfig.json # TypeScript config
├── .hive/ # Hive runtime data (events.json, domains.json)
└── .github/workflows/
├── ci.yml # Type check + tests
└── npm-publish.yml # Tag-based selective publish
Development
# Install dependencies
bun install
# Type check
bun run build
# Run tests
bun test
Publishing
Each plugin is published automatically to npm when changes are pushed to the main branch. The workflow detects which plugins have changed and publishes them with auto-incremented version numbers.
Configuration
Plugin publishing is configured in publish.config.json:
{
"$schema": "./schemas/publish.config.json",
"plugins": {
"commander": { "name": "opencode-plugin-commander", "path": "plugins/commander" },
"emperor": { "name": "opencode-plugin-emperor", "path": "plugins/emperor" },
...
},
"publish": { "autoBumpVersion": true, "versionBumpType": "patch" }
}
To add a new plugin:
- Add the plugin directory under
plugins/ - Add its config to
publish.config.json - Push to main — it will be auto-published
Manual Trigger
You can also manually trigger a publish via GitHub Actions workflow dispatch.
| Package | npm |
|---|---|
opencode-plugin-commander |
Commander plugin |
opencode-plugin-emperor |
Emperor plugin |
opencode-plugin-hive |
Hive plugin |
opencode-plugin-superpower |
Superpower plugin |
opencode-plugin-stock |
Stock plugin |
opencode-plugin-triage |
Triage plugin |
Tech Stack
- Runtime: Bun
- Language: TypeScript (strict mode)
- Plugin SDK: @opencode-ai/plugin
- Storage: JSON file persistence
License
MIT