opencode-team-mode 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,282 @@
1
+ # OpenCode TeamMode
2
+
3
+ # OpenCode TeamMode
4
+
5
+ **[English](./README.md)** | **[中文](./README.zh-CN.md)**
6
+
7
+ > 🤝 **Multi-agent team collaboration plugin for [OpenCode Desktop](https://opencode.ai)**
8
+ >
9
+ > Adds a complete team of specialized AI agents — Architect, Implementer, Reviewer, Tester, Researcher — orchestrated by a Team Lead, all accessible via simple slash commands.
10
+
11
+ ---
12
+
13
+ ## ✨ What is TeamMode?
14
+
15
+ TeamMode transforms OpenCode Desktop from a single-agent coding assistant into a **full development team**. Each agent has a distinct role, expertise, and personality — just like a real engineering team.
16
+
17
+ Instead of one agent trying to do everything, you get:
18
+
19
+ | Agent | Role | When to use |
20
+ |---|---|---|
21
+ | 🎯 **Team Lead** | Orchestrator | Complex tasks that need planning + multi-step execution |
22
+ | 🏗️ **Architect** | System designer | Design docs, module structure, API contracts |
23
+ | 💻 **Implementer** | Code writer | Building features, writing production code |
24
+ | 🔍 **Reviewer** | Code auditor | Bug hunting, security review, quality checks |
25
+ | 🧪 **Tester** | Test engineer | Unit tests, integration tests, edge-case coverage |
26
+ | 🔎 **Researcher** | Knowledge finder | Library evaluation, API docs, best practices |
27
+
28
+ ---
29
+
30
+ ## 🚀 Quick Start
31
+
32
+ ### Prerequisites
33
+
34
+ 1. **Install OpenCode Desktop** (if you haven't already):
35
+
36
+ | Platform | Install command |
37
+ |---|---|
38
+ | macOS (Apple Silicon) | `brew install --cask opencode-desktop` |
39
+ | macOS (Intel) | `brew install --cask opencode-desktop` |
40
+ | Windows | `scoop bucket add extras && scoop install extras/opencode-desktop` |
41
+ | Linux | Download from [opencode.ai/download](https://opencode.ai/download) |
42
+
43
+ Or install the **CLI/TUI** version:
44
+ ```bash
45
+ # one-line script (all platforms)
46
+ curl -fsSL https://opencode.ai/install | bash
47
+
48
+ # or via npm
49
+ npm install -g opencode-ai
50
+ ```
51
+
52
+ 2. **Node.js ≥ 18** (for npm)
53
+
54
+ ### Install TeamMode
55
+
56
+ **Option A — One-line installer (recommended):**
57
+
58
+ ```bash
59
+ curl -fsSL https://raw.githubusercontent.com/user/Opencode-TeamMode/main/scripts/install.sh | bash
60
+ ```
61
+
62
+ This script installs the npm package and automatically registers the plugin in your project's `opencode.json`.
63
+
64
+ **Option B — Manual npm install:**
65
+
66
+ ```bash
67
+ # 1. Install the plugin package
68
+ npm install -g opencode-team-mode
69
+
70
+ # 2. Add the plugin to your project's opencode.json
71
+ # (see "Configuration" below)
72
+ ```
73
+
74
+ **Option C — Local dev install (from this repo):**
75
+
76
+ ```bash
77
+ git clone https://github.com/Te-River/Opencode-TeamMode.git
78
+ cd Opencode-TeamMode
79
+ npm install
80
+ npm run build
81
+ npm link
82
+ ```
83
+
84
+ ---
85
+
86
+ ## ⚙️ Configuration
87
+
88
+ After installing, add the plugin to your project's `opencode.json`:
89
+
90
+ ```jsonc
91
+ {
92
+ "$schema": "https://opencode.ai/config.json",
93
+ "plugin": [
94
+ "opencode-team-mode"
95
+ ]
96
+ }
97
+ ```
98
+
99
+ That's it. The plugin automatically injects all team agents and commands when OpenCode starts. **No need to manually copy agent files or command definitions.**
100
+
101
+ > 💡 **Tip:** After modifying `opencode.json`, **restart OpenCode Desktop** for changes to take effect.
102
+
103
+ ### Global install (all projects)
104
+
105
+ To enable TeamMode in every project, add the plugin to your global config:
106
+
107
+ ```jsonc
108
+ // ~/.config/opencode/opencode.json
109
+ {
110
+ "$schema": "https://opencode.ai/config.json",
111
+ "plugin": [
112
+ "opencode-team-mode"
113
+ ]
114
+ }
115
+ ```
116
+
117
+ ---
118
+
119
+ ## 📖 Usage
120
+
121
+ ### Slash Commands
122
+
123
+ TeamMode adds six slash commands to OpenCode. Type them in the chat input:
124
+
125
+ | Command | Agent | Description |
126
+ |---|---|---|
127
+ | `/team-plan <task>` | Architect | Create a detailed implementation plan with architecture, file manifest, and task breakdown |
128
+ | `/team-implement <task>` | Implementer | Write production code for a feature or task |
129
+ | `/team-review [scope]` | Reviewer | Audit code for bugs, security issues, and quality problems |
130
+ | `/team-test [scope]` | Tester | Generate comprehensive tests with edge-case coverage |
131
+ | `/team-research <topic>` | Researcher | Investigate libraries, APIs, or best practices |
132
+ | `/team-run <task>` | Team Lead | **Full workflow** — orchestrates all agents end-to-end |
133
+
134
+ #### Example workflow
135
+
136
+ ```
137
+ # 1. Plan the feature
138
+ /team-plan Add user authentication with OAuth2 and JWT tokens
139
+
140
+ # 2. Review the plan, then implement
141
+ /team-implement Implement the auth module as planned
142
+
143
+ # 3. Review the code
144
+ /team-review src/auth/
145
+
146
+ # 4. Write tests
147
+ /team-test src/auth/
148
+
149
+ # Or let the team lead handle everything:
150
+ /team-run Add user authentication with OAuth2 and JWT tokens
151
+ ```
152
+
153
+ ### Agent Picker
154
+
155
+ You can also invoke agents directly using the `@` mention in OpenCode Desktop:
156
+
157
+ - `@team-lead` — Orchestrate a complex task
158
+ - `@architect` — Design a system or module
159
+ - `@implementer` — Write code
160
+ - `@reviewer` — Review code quality
161
+ - `@tester` — Write tests
162
+ - `@researcher` — Research a topic
163
+
164
+ ### Desktop-specific features
165
+
166
+ In **OpenCode Desktop**, you get additional UX benefits:
167
+
168
+ - 🎨 **Color-coded agents** — Each agent has a distinct color in the chat UI for easy identification.
169
+ - 📋 **Agent picker** — Click the agent dropdown to switch between team agents visually.
170
+ - 🔀 **Parallel sub-tasks** — The Team Lead can dispatch multiple sub-agents simultaneously, with results shown in parallel panels.
171
+ - 📊 **Session history** — All team interactions are saved and searchable in the Desktop session sidebar.
172
+
173
+ ---
174
+
175
+ ## 🏗️ Architecture
176
+
177
+ ```
178
+ opencode-team-mode/
179
+ ├── package.json ← npm package definition
180
+ ├── tsconfig.json ← TypeScript config
181
+ ├── src/
182
+ │ ├── index.ts ← Plugin entry (v2 format, id: "team-mode")
183
+ │ ├── agents.ts ← Agent definitions (prompts, modes, colors)
184
+ │ ├── commands.ts ← Command definitions (templates, agent bindings)
185
+ │ └── types.ts ← v2 Plugin API type definitions
186
+ ├── scripts/
187
+ │ └── install.sh ← One-click installer
188
+ ├── LICENSE ← Apache 2.0
189
+ ├── README.md ← English documentation
190
+ └── README.zh-CN.md ← Chinese documentation
191
+ ```
192
+
193
+ ### How it works
194
+
195
+ 1. OpenCode Desktop starts and loads `opencode.json`.
196
+ 2. It sees `"opencode-team-mode"` in the `plugin` array and loads the npm package.
197
+ 3. The plugin's v2 `setup` function runs, using `ctx.agent.transform()` and `ctx.command.transform()` to inject 6 agents and 6 commands.
198
+ 4. The plugin's `id: "team-mode"` is displayed as the plugin name in the Desktop UI.
199
+ 5. Agents and commands are immediately available in the Desktop UI — no file copying needed.
200
+
201
+ ---
202
+
203
+ ## 🔧 Customization
204
+
205
+ ### Override an agent
206
+
207
+ Add an agent with the same name in your `opencode.json` — your definition takes precedence:
208
+
209
+ ```jsonc
210
+ {
211
+ "agent": {
212
+ "reviewer": {
213
+ "model": "anthropic/claude-sonnet-4-6",
214
+ "prompt": "You are an extremely strict reviewer. Reject anything with a lint warning."
215
+ }
216
+ }
217
+ }
218
+ ```
219
+
220
+ ### Add your own agents
221
+
222
+ TeamMode does not prevent you from adding more agents. Define them alongside the team:
223
+
224
+ ```jsonc
225
+ {
226
+ "agent": {
227
+ "devops": {
228
+ "mode": "subagent",
229
+ "description": "Handles CI/CD, Docker, and deployment tasks.",
230
+ "prompt": "You are the DevOps engineer..."
231
+ }
232
+ }
233
+ }
234
+ ```
235
+
236
+ ### Disable an agent
237
+
238
+ ```jsonc
239
+ {
240
+ "agent": {
241
+ "researcher": { "disable": true }
242
+ }
243
+ }
244
+ ```
245
+
246
+ ---
247
+
248
+ ## 📦 Publishing to npm
249
+
250
+ If you want to publish your own fork:
251
+
252
+ ```bash
253
+ npm run build # compile TypeScript → dist/
254
+ npm version patch # bump version
255
+ npm publish # publish to npm registry
256
+ ```
257
+
258
+ ---
259
+
260
+ ## 🤝 Contributing
261
+
262
+ Contributions are welcome! Areas where we need help:
263
+
264
+ - 🌐 **Localization** — Translate agent prompts to other languages
265
+ - 🎨 **More agent roles** — DevOps, DBA, Security Specialist, UX Designer
266
+ - 🔧 **Additional commands** — `/team-deploy`, `/team-docs`, `/team-refactor`
267
+ - 📝 **Better prompts** — Improve agent behavior through prompt engineering
268
+
269
+ ---
270
+
271
+ ## 📄 License
272
+
273
+ [Apache License 2.0](./LICENSE)
274
+
275
+ ---
276
+
277
+ ## 🔗 Links
278
+
279
+ - [OpenCode Desktop](https://opencode.ai) — Official website & download
280
+ - [OpenCode Docs](https://opencode.ai/docs) — Configuration & plugin documentation
281
+ - [OpenCode Plugin API](https://opencode.ai/docs/plugins) — Build your own plugins
282
+ - [OpenCode GitHub](https://github.com/anomalyco/opencode) — Source code for OpenCode itself
@@ -0,0 +1,279 @@
1
+ # OpenCode TeamMode
2
+
3
+ **[English](./README.md)** | **[中文](./README.zh-CN.md)**
4
+
5
+ > 🤝 **[OpenCode 桌面版](https://opencode.ai) 多 Agent 团队协作插件**
6
+ >
7
+ > 为你的 OpenCode 桌面版添加一整支 AI 专家团队 —— 架构师、实现者、审查员、测试员、调研员,由 Team Lead 统一调度,通过简单的斜杠命令即可调用。
8
+
9
+ ---
10
+
11
+ ## ✨ TeamMode 是什么?
12
+
13
+ TeamMode 将 OpenCode 桌面版从一个单 Agent 编码助手,升级为**一整个开发团队**。每个 Agent 拥有独立的角色定位、专业领域和行为风格 —— 就像真实的工程团队。
14
+
15
+ 不再是一个 Agent 包揽所有事,你将获得:
16
+
17
+ | Agent | 角色 | 使用场景 |
18
+ |---|---|---|
19
+ | 🎯 **Team Lead** | 调度者 | 需要规划 + 多步执行的复杂任务 |
20
+ | 🏗️ **Architect** | 系统设计师 | 设计文档、模块结构、API 契约 |
21
+ | 💻 **Implementer** | 代码实现者 | 编写生产代码、实现功能 |
22
+ | 🔍 **Reviewer** | 代码审查员 | Bug 猎手、安全审查、质量检查 |
23
+ | 🧪 **Tester** | 测试工程师 | 单元测试、集成测试、边界覆盖 |
24
+ | 🔎 **Researcher** | 知识调研员 | 库评估、API 文档、最佳实践调研 |
25
+
26
+ ---
27
+
28
+ ## 🚀 快速开始
29
+
30
+ ### 前置条件
31
+
32
+ 1. **安装 OpenCode 桌面版**(如果还没有):
33
+
34
+ | 平台 | 安装命令 |
35
+ |---|---|
36
+ | macOS (Apple Silicon) | `brew install --cask opencode-desktop` |
37
+ | macOS (Intel) | `brew install --cask opencode-desktop` |
38
+ | Windows | `scoop bucket add extras && scoop install extras/opencode-desktop` |
39
+ | Linux | 从 [opencode.ai/download](https://opencode.ai/download) 下载 |
40
+
41
+ 或安装 **CLI/TUI** 版本:
42
+ ```bash
43
+ # 一键脚本(全平台)
44
+ curl -fsSL https://opencode.ai/install | bash
45
+
46
+ # 或通过 npm
47
+ npm install -g opencode-ai
48
+ ```
49
+
50
+ 2. **Node.js ≥ 18**(用于 npm)
51
+
52
+ ### 安装 TeamMode
53
+
54
+ **方式 A — 一键安装脚本(推荐):**
55
+
56
+ ```bash
57
+ curl -fsSL https://raw.githubusercontent.com/user/Opencode-TeamMode/main/scripts/install.sh | bash
58
+ ```
59
+
60
+ 此脚本会自动安装 npm 包,并将插件注册到你的项目 `opencode.json` 中。
61
+
62
+ **方式 B — 手动 npm 安装:**
63
+
64
+ ```bash
65
+ # 1. 安装插件包
66
+ npm install -g opencode-team-mode
67
+
68
+ # 2. 将插件添加到项目的 opencode.json
69
+ # (见下方"配置"章节)
70
+ ```
71
+
72
+ **方式 C — 本地开发安装(从本仓库):**
73
+
74
+ ```bash
75
+ git clone https://github.com/Te-River/Opencode-TeamMode.git
76
+ cd Opencode-TeamMode
77
+ npm install
78
+ npm run build
79
+ npm link
80
+ ```
81
+
82
+ ---
83
+
84
+ ## ⚙️ 配置
85
+
86
+ 安装后,将插件添加到项目的 `opencode.json`:
87
+
88
+ ```jsonc
89
+ {
90
+ "$schema": "https://opencode.ai/config.json",
91
+ "plugin": [
92
+ "opencode-team-mode"
93
+ ]
94
+ }
95
+ ```
96
+
97
+ 就这么简单。插件会在 OpenCode 启动时自动注入所有团队 Agent 和命令,**无需手动复制任何 Agent 文件或命令定义**。
98
+
99
+ > 💡 **提示:** 修改 `opencode.json` 后,请**重启 OpenCode 桌面版**使更改生效。
100
+
101
+ ### 全局安装(所有项目生效)
102
+
103
+ 要在所有项目中启用 TeamMode,将插件添加到全局配置:
104
+
105
+ ```jsonc
106
+ // ~/.config/opencode/opencode.json
107
+ {
108
+ "$schema": "https://opencode.ai/config.json",
109
+ "plugin": [
110
+ "opencode-team-mode"
111
+ ]
112
+ }
113
+ ```
114
+
115
+ ---
116
+
117
+ ## 📖 使用方法
118
+
119
+ ### 斜杠命令
120
+
121
+ TeamMode 为 OpenCode 添加了六个斜杠命令,在聊天输入框中输入:
122
+
123
+ | 命令 | Agent | 说明 |
124
+ |---|---|---|
125
+ | `/team-plan <任务>` | Architect | 创建详细的实现计划:架构、文件清单、任务拆解 |
126
+ | `/team-implement <任务>` | Implementer | 为功能或任务编写生产代码 |
127
+ | `/team-review [范围]` | Reviewer | 审查代码的 Bug、安全问题和质量问题 |
128
+ | `/team-test [范围]` | Tester | 生成全面的测试,覆盖边界场景 |
129
+ | `/team-research <主题>` | Researcher | 调研库、API 或最佳实践 |
130
+ | `/team-run <任务>` | Team Lead | **完整工作流** — 端到端调度所有 Agent |
131
+
132
+ #### 示例工作流
133
+
134
+ ```bash
135
+ # 1. 规划功能
136
+ /team-plan 添加基于 OAuth2 和 JWT 的用户认证
137
+
138
+ # 2. 审查计划后,开始实现
139
+ /team-implement 按计划实现认证模块
140
+
141
+ # 3. 审查代码
142
+ /team-review src/auth/
143
+
144
+ # 4. 编写测试
145
+ /team-test src/auth/
146
+
147
+ # 或者让 Team Lead 全程调度:
148
+ /team-run 添加基于 OAuth2 和 JWT 的用户认证
149
+ ```
150
+
151
+ ### Agent 选择器
152
+
153
+ 你也可以在 OpenCode 桌面版中使用 `@` 直接调用 Agent:
154
+
155
+ - `@team-lead` — 调度复杂任务
156
+ - `@architect` — 设计系统或模块
157
+ - `@implementer` — 编写代码
158
+ - `@reviewer` — 审查代码质量
159
+ - `@tester` — 编写测试
160
+ - `@researcher` — 调研主题
161
+
162
+ ### 桌面版专属特性
163
+
164
+ 在 **OpenCode 桌面版** 中,你还能获得额外的 UX 体验:
165
+
166
+ - 🎨 **Agent 颜色标识** — 每个 Agent 在聊天 UI 中有独立颜色,便于识别
167
+ - 📋 **Agent 选择器** — 点击 Agent 下拉菜单,可视化切换团队 Agent
168
+ - 🔀 **并行子任务** — Team Lead 可同时调度多个子 Agent,结果在并行面板中展示
169
+ - 📊 **会话历史** — 所有团队交互都保存在桌面版侧边栏,可搜索回溯
170
+
171
+ ---
172
+
173
+ ## 🏗️ 架构
174
+
175
+ ```
176
+ opencode-team-mode/
177
+ ├── package.json ← npm 包定义
178
+ ├── tsconfig.json ← TypeScript 配置
179
+ ├── src/
180
+ │ ├── index.ts ← 插件入口(v2 格式,id: "team-mode")
181
+ │ ├── agents.ts ← Agent 定义(prompts、模式、颜色)
182
+ │ ├── commands.ts ← 命令定义(模板、Agent 绑定)
183
+ │ └── types.ts ← v2 Plugin API 类型定义
184
+ ├── scripts/
185
+ │ └── install.sh ← 一键安装脚本
186
+ ├── LICENSE ← Apache 2.0
187
+ └── README.md ← 英文文档
188
+ README.zh-CN.md ← 中文文档
189
+ ```
190
+
191
+ ### 工作原理
192
+
193
+ 1. OpenCode 桌面版启动,加载 `opencode.json`
194
+ 2. 检测到 `plugin` 数组中的 `"opencode-team-mode"`,加载 npm 包
195
+ 3. 插件的 `setup` 函数执行,通过 `ctx.agent.transform()` 和 `ctx.command.transform()` 注入 6 个 Agent 和 6 个命令
196
+ 4. Agent 和命令立即在桌面版 UI 中可用 —— 无需复制任何文件
197
+
198
+ ---
199
+
200
+ ## 🔧 自定义
201
+
202
+ ### 覆盖某个 Agent
203
+
204
+ 在 `opencode.json` 中添加同名 Agent —— 你的定义会优先生效:
205
+
206
+ ```jsonc
207
+ {
208
+ "agent": {
209
+ "reviewer": {
210
+ "model": "anthropic/claude-sonnet-4-6",
211
+ "prompt": "你是一个极其严格的审查员。任何 lint 警告都必须打回。"
212
+ }
213
+ }
214
+ }
215
+ ```
216
+
217
+ ### 添加自己的 Agent
218
+
219
+ TeamMode 不阻止你添加更多 Agent,与团队 Agent 并存:
220
+
221
+ ```jsonc
222
+ {
223
+ "agent": {
224
+ "devops": {
225
+ "mode": "subagent",
226
+ "description": "处理 CI/CD、Docker 和部署任务",
227
+ "prompt": "你是 DevOps 工程师..."
228
+ }
229
+ }
230
+ }
231
+ ```
232
+
233
+ ### 禁用某个 Agent
234
+
235
+ ```jsonc
236
+ {
237
+ "agent": {
238
+ "researcher": { "disable": true }
239
+ }
240
+ }
241
+ ```
242
+
243
+ ---
244
+
245
+ ## 📦 发布到 npm
246
+
247
+ 如果你想发布自己的 fork:
248
+
249
+ ```bash
250
+ npm run build # 编译 TypeScript → dist/
251
+ npm version patch # 更新版本号
252
+ npm publish # 发布到 npm 仓库
253
+ ```
254
+
255
+ ---
256
+
257
+ ## 🤝 贡献
258
+
259
+ 欢迎贡献!以下方向特别需要帮助:
260
+
261
+ - 🌐 **本地化** — 将 Agent prompt 翻译为其他语言
262
+ - 🎨 **更多 Agent 角色** — DevOps、DBA、安全专家、UX 设计师
263
+ - 🔧 **更多命令** — `/team-deploy`、`/team-docs`、`/team-refactor`
264
+ - 📝 **更好的 Prompt** — 通过 Prompt 工程优化 Agent 行为
265
+
266
+ ---
267
+
268
+ ## 📄 许可证
269
+
270
+ [Apache License 2.0](./LICENSE)
271
+
272
+ ---
273
+
274
+ ## 🔗 链接
275
+
276
+ - [OpenCode 桌面版](https://opencode.ai) — 官网 & 下载
277
+ - [OpenCode 文档](https://opencode.ai/docs) — 配置 & 插件文档
278
+ - [OpenCode 插件 API](https://opencode.ai/docs/plugins) — 构建你自己的插件
279
+ - [OpenCode GitHub](https://github.com/anomalyco/opencode) — OpenCode 源码
@@ -0,0 +1,10 @@
1
+ /**
2
+ * TeamMode agent definitions.
3
+ *
4
+ * Each agent is injected into the OpenCode config via the plugin's `config`
5
+ * hook. Users see them in the agent picker of OpenCode Desktop and can
6
+ * invoke them with `@agent-name` or via the `/team-*` commands.
7
+ */
8
+ import type { AgentItem } from "./types.js";
9
+ export declare const agents: Record<string, AgentItem>;
10
+ //# sourceMappingURL=agents.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../src/agents.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAwN3C,eAAO,MAAM,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAO5C,CAAA"}
package/dist/agents.js ADDED
@@ -0,0 +1,217 @@
1
+ /**
2
+ * TeamMode agent definitions.
3
+ *
4
+ * Each agent is injected into the OpenCode config via the plugin's `config`
5
+ * hook. Users see them in the agent picker of OpenCode Desktop and can
6
+ * invoke them with `@agent-name` or via the `/team-*` commands.
7
+ */
8
+ /* ------------------------------------------------------------------ */
9
+ /* Team Lead — orchestrator */
10
+ /* ------------------------------------------------------------------ */
11
+ const teamLead = {
12
+ mode: "all",
13
+ description: "Team lead orchestrator — decomposes complex tasks, dispatches sub-agents " +
14
+ "(architect, implementer, reviewer, tester, researcher), and synthesises " +
15
+ "their outputs into a coherent deliverable. Use when the task requires " +
16
+ "multi-step collaboration across different expertise areas.",
17
+ prompt: `You are the **Team Lead** in a multi-agent coding team.
18
+
19
+ ## Role
20
+ You orchestrate the team. You never write production code yourself — instead
21
+ you decompose the user's request into clear sub-tasks and dispatch them to the
22
+ specialist agents via the Task tool.
23
+
24
+ ## Workflow
25
+ 1. **Understand** — Clarify the goal, constraints, and acceptance criteria.
26
+ 2. **Plan** — Break the work into ordered sub-tasks. Identify dependencies.
27
+ 3. **Dispatch** — Assign each sub-task to the best-fit agent:
28
+ - Architecture / system design → \`architect\`
29
+ - Feature implementation → \`implementer\`
30
+ - Code review / quality audit → \`reviewer\`
31
+ - Test writing / validation → \`tester\`
32
+ - Research / documentation → \`researcher\`
33
+ 4. **Synthesize** — Collect outputs, resolve conflicts, merge results.
34
+ 5. **Report** — Present a concise summary to the user with next steps.
35
+
36
+ ## Rules
37
+ - Always create a todo list before dispatching work.
38
+ - Run independent sub-tasks in parallel when possible.
39
+ - If a sub-agent returns poor results, refine the prompt and retry once.
40
+ - Keep the user informed with brief progress updates.
41
+ - Your final output must be a structured summary, not raw agent output.
42
+ `,
43
+ color: "#E879F9", // purple
44
+ };
45
+ /* ------------------------------------------------------------------ */
46
+ /* Architect */
47
+ /* ------------------------------------------------------------------ */
48
+ const architect = {
49
+ mode: "subagent",
50
+ description: "System architect — designs module structure, API contracts, data models, " +
51
+ "and technical strategy. Use when you need a design doc, architecture " +
52
+ "decision record, or module breakdown before implementation.",
53
+ prompt: `You are the **Architect** on a multi-agent coding team.
54
+
55
+ ## Role
56
+ You produce clear, implementable technical designs. You think in systems:
57
+ interfaces, data flow, module boundaries, trade-offs.
58
+
59
+ ## Output format
60
+ For every design task, produce:
61
+ 1. **Overview** — One-paragraph summary of the design.
62
+ 2. **Components** — List each module/file with its responsibility.
63
+ 3. **Interfaces** — Key type definitions, function signatures, or API contracts.
64
+ 4. **Data flow** — How data moves through the system (use text diagrams if helpful).
65
+ 5. **Task breakdown** — Ordered implementation steps the implementer can follow.
66
+ 6. **Risks & open questions** — Anything uncertain or worth a second look.
67
+
68
+ ## Rules
69
+ - Prefer simplicity. Do not over-engineer.
70
+ - Use existing patterns and libraries in the project when possible.
71
+ - Be explicit about file paths and naming conventions.
72
+ - If you need information about the codebase, read files yourself — do not guess.
73
+ `,
74
+ color: "#38BDF8", // sky blue
75
+ };
76
+ /* ------------------------------------------------------------------ */
77
+ /* Implementer */
78
+ /* ------------------------------------------------------------------ */
79
+ const implementer = {
80
+ mode: "subagent",
81
+ description: "Core implementer — writes production code, creates files, and builds " +
82
+ "features according to the architect's design. Use when you need clean, " +
83
+ "working code written quickly.",
84
+ prompt: `You are the **Implementer** on a multi-agent coding team.
85
+
86
+ ## Role
87
+ You write clean, production-quality code. You follow the architect's design
88
+ closely and produce working, well-structured implementations.
89
+
90
+ ## Rules
91
+ - Follow the design spec. If the spec is ambiguous, pick the simpler
92
+ interpretation and note your assumption.
93
+ - Write idiomatic code matching the project's existing style.
94
+ - Include inline comments only where the *why* is non-obvious.
95
+ - Handle errors properly — no silent failures.
96
+ - If a task is large, break it into small commits mentally and describe each.
97
+ - Do not write tests (that is the tester's job) unless explicitly asked.
98
+ - After implementation, list the files you created or modified.
99
+ `,
100
+ color: "#4ADE80", // green
101
+ };
102
+ /* ------------------------------------------------------------------ */
103
+ /* Reviewer */
104
+ /* ------------------------------------------------------------------ */
105
+ const reviewer = {
106
+ mode: "subagent",
107
+ description: "Code reviewer — audits code for correctness, performance, security, " +
108
+ "maintainability, and best practices. Use when you want a thorough " +
109
+ "review before merging or deploying.",
110
+ prompt: `You are the **Reviewer** on a multi-agent coding team.
111
+
112
+ ## Role
113
+ You perform thorough, constructive code reviews. You catch bugs, security
114
+ issues, performance problems, and maintainability concerns before they ship.
115
+
116
+ ## Review checklist
117
+ For every review, cover:
118
+ 1. **Correctness** — Logic errors, edge cases, off-by-one, null safety.
119
+ 2. **Security** — Injection, auth bypass, secrets exposure, input validation.
120
+ 3. **Performance** — Unnecessary allocations, N+1 queries, blocking calls.
121
+ 4. **Maintainability** — Naming, complexity, duplication, test coverage.
122
+ 5. **Best practices** — Framework idioms, error handling, logging.
123
+
124
+ ## Output format
125
+ - 🔴 **Critical** — Must fix before merge.
126
+ - 🟡 **Warning** — Should fix, but not blocking.
127
+ - 🔵 **Suggestion** — Nice to have.
128
+ - ✅ **Praise** — Good patterns worth calling out.
129
+
130
+ For each finding, include:
131
+ - File path and line number
132
+ - Description of the issue
133
+ - Concrete fix suggestion (code snippet if helpful)
134
+
135
+ ## Rules
136
+ - Be specific. "This could be better" is not a review.
137
+ - Prioritize findings — do not bury critical issues in a long list.
138
+ - If the code is good, say so. Positive feedback matters.
139
+ `,
140
+ color: "#FB923C", // orange
141
+ };
142
+ /* ------------------------------------------------------------------ */
143
+ /* Tester */
144
+ /* ------------------------------------------------------------------ */
145
+ const tester = {
146
+ mode: "subagent",
147
+ description: "Test engineer — writes unit tests, integration tests, and edge-case " +
148
+ "coverage. Use when you need to validate correctness or increase test " +
149
+ "coverage for existing or new code.",
150
+ prompt: `You are the **Tester** on a multi-agent coding team.
151
+
152
+ ## Role
153
+ You write comprehensive, maintainable tests that give the team confidence
154
+ to ship.
155
+
156
+ ## Strategy
157
+ 1. **Read the implementation** thoroughly before writing any test.
158
+ 2. Identify the **happy path**, **edge cases**, and **error paths**.
159
+ 3. Use the project's existing test framework and patterns.
160
+ 4. Write **table-driven tests** (or equivalent) for parameterized cases.
161
+ 5. Mock external dependencies; test units in isolation.
162
+
163
+ ## Output format
164
+ - Test file path(s)
165
+ - List of test cases with descriptions
166
+ - Any assumptions about behavior that should be verified with the team
167
+
168
+ ## Rules
169
+ - Tests must be deterministic — no flaky tests.
170
+ - Each test should test exactly one behavior.
171
+ - Use descriptive test names: \`should return 404 when user does not exist\`.
172
+ - Include boundary conditions: empty input, max values, null/undefined.
173
+ - If the code is untestable as-is, flag it and suggest refactoring.
174
+ `,
175
+ color: "#F472B6", // pink
176
+ };
177
+ /* ------------------------------------------------------------------ */
178
+ /* Researcher */
179
+ /* ------------------------------------------------------------------ */
180
+ const researcher = {
181
+ mode: "subagent",
182
+ description: "Researcher — investigates libraries, APIs, best practices, and " +
183
+ "documentation. Use when you need accurate, up-to-date information " +
184
+ "to inform a technical decision.",
185
+ prompt: `You are the **Researcher** on a multi-agent coding team.
186
+
187
+ ## Role
188
+ You find accurate, actionable information so the team can make informed
189
+ decisions. You consult documentation, source code, and reliable references.
190
+
191
+ ## Output format
192
+ 1. **Summary** — Key findings in 2-3 sentences.
193
+ 2. **Details** — Structured findings with sources.
194
+ 3. **Recommendation** — What the team should do, with trade-offs.
195
+ 4. **Sources** — Links or file paths consulted.
196
+
197
+ ## Rules
198
+ - Cite your sources. Do not fabricate URLs or API details.
199
+ - Distinguish between facts and your own interpretation.
200
+ - If information is uncertain, say so explicitly.
201
+ - Prefer official documentation over blog posts.
202
+ - When reading source code, quote the relevant lines.
203
+ `,
204
+ color: "#A78BFA", // violet
205
+ };
206
+ /* ------------------------------------------------------------------ */
207
+ /* Export all agents keyed by name */
208
+ /* ------------------------------------------------------------------ */
209
+ export const agents = {
210
+ "team-lead": teamLead,
211
+ architect,
212
+ implementer,
213
+ reviewer,
214
+ tester,
215
+ researcher,
216
+ };
217
+ //# sourceMappingURL=agents.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agents.js","sourceRoot":"","sources":["../src/agents.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,wEAAwE;AACxE,wEAAwE;AACxE,wEAAwE;AACxE,MAAM,QAAQ,GAAc;IAC1B,IAAI,EAAE,KAAK;IACX,WAAW,EACT,2EAA2E;QAC3E,0EAA0E;QAC1E,yEAAyE;QACzE,4DAA4D;IAC9D,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;CAyBT;IACC,KAAK,EAAE,SAAS,EAAE,SAAS;CAC5B,CAAA;AAED,wEAAwE;AACxE,wEAAwE;AACxE,wEAAwE;AACxE,MAAM,SAAS,GAAc;IAC3B,IAAI,EAAE,UAAU;IAChB,WAAW,EACT,2EAA2E;QAC3E,wEAAwE;QACxE,6DAA6D;IAC/D,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;CAoBT;IACC,KAAK,EAAE,SAAS,EAAE,WAAW;CAC9B,CAAA;AAED,wEAAwE;AACxE,wEAAwE;AACxE,wEAAwE;AACxE,MAAM,WAAW,GAAc;IAC7B,IAAI,EAAE,UAAU;IAChB,WAAW,EACT,uEAAuE;QACvE,0EAA0E;QAC1E,+BAA+B;IACjC,MAAM,EAAE;;;;;;;;;;;;;;;CAeT;IACC,KAAK,EAAE,SAAS,EAAE,QAAQ;CAC3B,CAAA;AAED,wEAAwE;AACxE,wEAAwE;AACxE,wEAAwE;AACxE,MAAM,QAAQ,GAAc;IAC1B,IAAI,EAAE,UAAU;IAChB,WAAW,EACT,sEAAsE;QACtE,qEAAqE;QACrE,qCAAqC;IACvC,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6BT;IACC,KAAK,EAAE,SAAS,EAAE,SAAS;CAC5B,CAAA;AAED,wEAAwE;AACxE,wEAAwE;AACxE,wEAAwE;AACxE,MAAM,MAAM,GAAc;IACxB,IAAI,EAAE,UAAU;IAChB,WAAW,EACT,sEAAsE;QACtE,wEAAwE;QACxE,oCAAoC;IACtC,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;CAwBT;IACC,KAAK,EAAE,SAAS,EAAE,OAAO;CAC1B,CAAA;AAED,wEAAwE;AACxE,wEAAwE;AACxE,wEAAwE;AACxE,MAAM,UAAU,GAAc;IAC5B,IAAI,EAAE,UAAU;IAChB,WAAW,EACT,iEAAiE;QACjE,qEAAqE;QACrE,iCAAiC;IACnC,MAAM,EAAE;;;;;;;;;;;;;;;;;;CAkBT;IACC,KAAK,EAAE,SAAS,EAAE,SAAS;CAC5B,CAAA;AAED,wEAAwE;AACxE,wEAAwE;AACxE,wEAAwE;AAExE,MAAM,CAAC,MAAM,MAAM,GAA8B;IAC/C,WAAW,EAAE,QAAQ;IACrB,SAAS;IACT,WAAW;IACX,QAAQ;IACR,MAAM;IACN,UAAU;CACX,CAAA"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * TeamMode command definitions.
3
+ *
4
+ * Each command is injected into the OpenCode config via the plugin's
5
+ * `config` hook. Users invoke them with `/team-plan`, `/team-review`, etc.
6
+ * in both OpenCode Desktop and the TUI.
7
+ */
8
+ import type { CommandItem } from "./types.js";
9
+ export declare const commands: Record<string, CommandItem>;
10
+ //# sourceMappingURL=commands.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AA8H7C,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAOhD,CAAA"}
@@ -0,0 +1,127 @@
1
+ /**
2
+ * TeamMode command definitions.
3
+ *
4
+ * Each command is injected into the OpenCode config via the plugin's
5
+ * `config` hook. Users invoke them with `/team-plan`, `/team-review`, etc.
6
+ * in both OpenCode Desktop and the TUI.
7
+ */
8
+ /* ------------------------------------------------------------------ */
9
+ const teamPlan = {
10
+ description: "Create a comprehensive implementation plan — architecture, task breakdown, and risk analysis.",
11
+ agent: "architect",
12
+ template: `Analyze the following task and produce a detailed implementation plan.
13
+
14
+ ## Task
15
+ $ARGUMENTS
16
+
17
+ ## Required output
18
+ 1. **Overview** — What we are building and why.
19
+ 2. **Architecture** — Module structure, key interfaces, data flow.
20
+ 3. **File manifest** — Every file to create or modify, with a one-line summary.
21
+ 4. **Task breakdown** — Ordered steps the implementer can execute, noting dependencies.
22
+ 5. **Risks & open questions** — Anything uncertain.
23
+
24
+ Read existing project files as needed to ground your plan in reality.
25
+ Do not write implementation code — only the plan.`,
26
+ };
27
+ /* ------------------------------------------------------------------ */
28
+ const teamImplement = {
29
+ description: "Implement a feature or task — write production code following the project's conventions.",
30
+ agent: "implementer",
31
+ template: `Implement the following task. Follow the project's existing code style and conventions.
32
+
33
+ ## Task
34
+ $ARGUMENTS
35
+
36
+ ## Rules
37
+ - Read relevant existing files before writing code.
38
+ - Handle errors properly.
39
+ - After finishing, list every file you created or modified.`,
40
+ };
41
+ /* ------------------------------------------------------------------ */
42
+ const teamReview = {
43
+ description: "Review code for correctness, security, performance, and maintainability.",
44
+ agent: "reviewer",
45
+ template: `Perform a thorough code review on the following scope.
46
+
47
+ ## Scope
48
+ $ARGUMENTS
49
+
50
+ If no specific scope is given, review all recently modified files in the project.
51
+
52
+ Use the standard review checklist:
53
+ - 🔴 Critical (must fix)
54
+ - 🟡 Warning (should fix)
55
+ - 🔵 Suggestion (nice to have)
56
+ - ✅ Praise (good patterns)
57
+
58
+ Include file paths, line numbers, and concrete fix suggestions.`,
59
+ };
60
+ /* ------------------------------------------------------------------ */
61
+ const teamTest = {
62
+ description: "Generate comprehensive tests — unit, integration, and edge-case coverage.",
63
+ agent: "tester",
64
+ template: `Write comprehensive tests for the following scope.
65
+
66
+ ## Scope
67
+ $ARGUMENTS
68
+
69
+ If no specific scope is given, identify the most recently modified source files and write tests for them.
70
+
71
+ ## Requirements
72
+ - Use the project's existing test framework and conventions.
73
+ - Cover happy path, edge cases, and error paths.
74
+ - Each test must be deterministic and test exactly one behavior.
75
+ - Use descriptive test names.`,
76
+ };
77
+ /* ------------------------------------------------------------------ */
78
+ const teamResearch = {
79
+ description: "Research a topic — libraries, APIs, best practices, or documentation.",
80
+ agent: "researcher",
81
+ template: `Research the following topic and provide actionable findings.
82
+
83
+ ## Topic
84
+ $ARGUMENTS
85
+
86
+ ## Required output
87
+ 1. **Summary** — Key findings in 2-3 sentences.
88
+ 2. **Details** — Structured findings with sources.
89
+ 3. **Recommendation** — What the team should do, with trade-offs.
90
+ 4. **Sources** — Links or file paths consulted.
91
+
92
+ Cite your sources. Do not fabricate URLs or API details.`,
93
+ };
94
+ /* ------------------------------------------------------------------ */
95
+ const teamRun = {
96
+ description: "Full team workflow — the team lead orchestrates all agents to complete a complex task end-to-end.",
97
+ agent: "team-lead",
98
+ template: `Execute the full team workflow for the following task.
99
+
100
+ ## Task
101
+ $ARGUMENTS
102
+
103
+ ## Workflow
104
+ 1. Understand the goal and acceptance criteria.
105
+ 2. Create a todo list of all sub-tasks.
106
+ 3. Dispatch sub-tasks to the appropriate agents:
107
+ - Design / architecture → architect
108
+ - Implementation → implementer
109
+ - Code review → reviewer
110
+ - Testing → tester
111
+ - Research → researcher
112
+ 4. Run independent sub-tasks in parallel.
113
+ 5. Collect all outputs, resolve conflicts, and synthesize a final result.
114
+ 6. Present a structured summary to the user.`,
115
+ };
116
+ /* ------------------------------------------------------------------ */
117
+ /* Export all commands keyed by name */
118
+ /* ------------------------------------------------------------------ */
119
+ export const commands = {
120
+ "team-plan": teamPlan,
121
+ "team-implement": teamImplement,
122
+ "team-review": teamReview,
123
+ "team-test": teamTest,
124
+ "team-research": teamResearch,
125
+ "team-run": teamRun,
126
+ };
127
+ //# sourceMappingURL=commands.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commands.js","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,wEAAwE;AACxE,MAAM,QAAQ,GAAgB;IAC5B,WAAW,EACT,+FAA+F;IACjG,KAAK,EAAE,WAAW;IAClB,QAAQ,EAAE;;;;;;;;;;;;;kDAasC;CACjD,CAAA;AAED,wEAAwE;AACxE,MAAM,aAAa,GAAgB;IACjC,WAAW,EACT,0FAA0F;IAC5F,KAAK,EAAE,aAAa;IACpB,QAAQ,EAAE;;;;;;;;4DAQgD;CAC3D,CAAA;AAED,wEAAwE;AACxE,MAAM,UAAU,GAAgB;IAC9B,WAAW,EACT,0EAA0E;IAC5E,KAAK,EAAE,UAAU;IACjB,QAAQ,EAAE;;;;;;;;;;;;;gEAaoD;CAC/D,CAAA;AAED,wEAAwE;AACxE,MAAM,QAAQ,GAAgB;IAC5B,WAAW,EACT,2EAA2E;IAC7E,KAAK,EAAE,QAAQ;IACf,QAAQ,EAAE;;;;;;;;;;;8BAWkB;CAC7B,CAAA;AAED,wEAAwE;AACxE,MAAM,YAAY,GAAgB;IAChC,WAAW,EACT,uEAAuE;IACzE,KAAK,EAAE,YAAY;IACnB,QAAQ,EAAE;;;;;;;;;;;0DAW8C;CACzD,CAAA;AAED,wEAAwE;AACxE,MAAM,OAAO,GAAgB;IAC3B,WAAW,EACT,mGAAmG;IACrG,KAAK,EAAE,WAAW;IAClB,QAAQ,EAAE;;;;;;;;;;;;;;;;6CAgBiC;CAC5C,CAAA;AAED,wEAAwE;AACxE,wEAAwE;AACxE,wEAAwE;AAExE,MAAM,CAAC,MAAM,QAAQ,GAAgC;IACnD,WAAW,EAAE,QAAQ;IACrB,gBAAgB,EAAE,aAAa;IAC/B,aAAa,EAAE,UAAU;IACzB,WAAW,EAAE,QAAQ;IACrB,eAAe,EAAE,YAAY;IAC7B,UAAU,EAAE,OAAO;CACpB,CAAA"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * opencode-team-mode — OpenCode v2 plugin entry point.
3
+ *
4
+ * Uses the v2 Promise API with an explicit `id` field. The `id` is the
5
+ * display name shown in OpenCode Desktop's plugin list (instead of the
6
+ * raw file path).
7
+ */
8
+ export declare const Plugin: import("./types.js").PluginDefinition;
9
+ export default Plugin;
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,eAAO,MAAM,MAAM,uCA2BjB,CAAA;AAEF,eAAe,MAAM,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,38 @@
1
+ /**
2
+ * opencode-team-mode — OpenCode v2 plugin entry point.
3
+ *
4
+ * Uses the v2 Promise API with an explicit `id` field. The `id` is the
5
+ * display name shown in OpenCode Desktop's plugin list (instead of the
6
+ * raw file path).
7
+ */
8
+ import { define } from "./types.js";
9
+ import { agents } from "./agents.js";
10
+ import { commands } from "./commands.js";
11
+ export const Plugin = define({
12
+ id: "team-mode",
13
+ setup: async (ctx) => {
14
+ // ---------- inject team agents ----------
15
+ await ctx.agent.transform((agent) => {
16
+ for (const [name, def] of Object.entries(agents)) {
17
+ agent.update(name, (item) => {
18
+ item.description = def.description;
19
+ item.mode = def.mode;
20
+ item.prompt = def.prompt;
21
+ item.color = def.color;
22
+ });
23
+ }
24
+ });
25
+ // ---------- inject team commands ----------
26
+ await ctx.command.transform((command) => {
27
+ for (const [name, def] of Object.entries(commands)) {
28
+ command.update(name, (item) => {
29
+ item.description = def.description;
30
+ item.template = def.template;
31
+ item.agent = def.agent;
32
+ });
33
+ }
34
+ });
35
+ },
36
+ });
37
+ export default Plugin;
38
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,MAAM,CAAC,MAAM,MAAM,GAAG,MAAM,CAAC;IAC3B,EAAE,EAAE,WAAW;IAEf,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE;QACnB,2CAA2C;QAC3C,MAAM,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE;YAClC,KAAK,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;gBACjD,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE;oBAC1B,IAAI,CAAC,WAAW,GAAG,GAAG,CAAC,WAAW,CAAA;oBAClC,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,CAAA;oBACpB,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM,CAAA;oBACxB,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,KAAK,CAAA;gBACxB,CAAC,CAAC,CAAA;YACJ,CAAC;QACH,CAAC,CAAC,CAAA;QAEF,6CAA6C;QAC7C,MAAM,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,EAAE;YACtC,KAAK,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;gBACnD,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE;oBAC5B,IAAI,CAAC,WAAW,GAAG,GAAG,CAAC,WAAW,CAAA;oBAClC,IAAI,CAAC,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAA;oBAC5B,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,KAAK,CAAA;gBACxB,CAAC,CAAC,CAAA;YACJ,CAAC;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;CACF,CAAC,CAAA;AAEF,eAAe,MAAM,CAAA"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * OpenCode v2 Plugin type definitions.
3
+ *
4
+ * These types match the v2 Promise plugin API used by OpenCode Desktop.
5
+ * The v2 format requires an `id` field which controls the display name
6
+ * shown in the Desktop UI.
7
+ */
8
+ export interface AgentItem {
9
+ description?: string;
10
+ mode?: "primary" | "subagent" | "all";
11
+ prompt?: string;
12
+ model?: string;
13
+ color?: string;
14
+ hidden?: boolean;
15
+ permission?: Record<string, unknown>;
16
+ [key: string]: unknown;
17
+ }
18
+ export interface CommandItem {
19
+ description?: string;
20
+ template?: string;
21
+ agent?: string;
22
+ model?: string;
23
+ [key: string]: unknown;
24
+ }
25
+ export interface TransformEditor<T> {
26
+ update(name: string, updater: (item: T) => void): void;
27
+ }
28
+ export interface PluginContext {
29
+ agent: {
30
+ transform<T = void>(callback: (editor: TransformEditor<AgentItem>) => T | Promise<T>): Promise<T>;
31
+ reload(): Promise<void>;
32
+ };
33
+ command: {
34
+ transform<T = void>(callback: (editor: TransformEditor<CommandItem>) => T | Promise<T>): Promise<T>;
35
+ reload(): Promise<void>;
36
+ };
37
+ options?: Record<string, unknown>;
38
+ [key: string]: unknown;
39
+ }
40
+ export interface PluginDefinition {
41
+ readonly id: string;
42
+ readonly setup: (ctx: PluginContext) => Promise<void>;
43
+ }
44
+ export declare function define(plugin: PluginDefinition): PluginDefinition;
45
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,MAAM,WAAW,SAAS;IACxB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,IAAI,CAAC,EAAE,SAAS,GAAG,UAAU,GAAG,KAAK,CAAA;IACrC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACpC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB;AAED,MAAM,WAAW,WAAW;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB;AAED,MAAM,WAAW,eAAe,CAAC,CAAC;IAChC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,GAAG,IAAI,CAAA;CACvD;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE;QACL,SAAS,CAAC,CAAC,GAAG,IAAI,EAChB,QAAQ,EAAE,CAAC,MAAM,EAAE,eAAe,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GAC/D,OAAO,CAAC,CAAC,CAAC,CAAA;QACb,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;KACxB,CAAA;IACD,OAAO,EAAE;QACP,SAAS,CAAC,CAAC,GAAG,IAAI,EAChB,QAAQ,EAAE,CAAC,MAAM,EAAE,eAAe,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GACjE,OAAO,CAAC,CAAC,CAAC,CAAA;QACb,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;KACxB,CAAA;IACD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACjC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB;AAID,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,KAAK,EAAE,CAAC,GAAG,EAAE,aAAa,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CACtD;AAED,wBAAgB,MAAM,CAAC,MAAM,EAAE,gBAAgB,GAAG,gBAAgB,CAEjE"}
package/dist/types.js ADDED
@@ -0,0 +1,11 @@
1
+ /**
2
+ * OpenCode v2 Plugin type definitions.
3
+ *
4
+ * These types match the v2 Promise plugin API used by OpenCode Desktop.
5
+ * The v2 format requires an `id` field which controls the display name
6
+ * shown in the Desktop UI.
7
+ */
8
+ export function define(plugin) {
9
+ return plugin;
10
+ }
11
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAmDH,MAAM,UAAU,MAAM,CAAC,MAAwB;IAC7C,OAAO,MAAM,CAAA;AACf,CAAC"}
package/package.json ADDED
@@ -0,0 +1,49 @@
1
+ {
2
+ "name": "opencode-team-mode",
3
+ "version": "1.0.0",
4
+ "description": "Team collaboration mode plugin for OpenCode Desktop — injects specialized agents (architect, reviewer, implementer, tester, researcher) and team workflow commands into your OpenCode workspace.",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/index.js",
11
+ "types": "./dist/index.d.ts"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist",
16
+ "README.md",
17
+ "LICENSE"
18
+ ],
19
+ "scripts": {
20
+ "build": "tsc",
21
+ "prepublishOnly": "tsc",
22
+ "dev": "tsc --watch"
23
+ },
24
+ "keywords": [
25
+ "opencode",
26
+ "opencode-plugin",
27
+ "plugin",
28
+ "team-mode",
29
+ "collaboration",
30
+ "multi-agent",
31
+ "desktop",
32
+ "ai-coding"
33
+ ],
34
+ "author": "",
35
+ "license": "Apache-2.0",
36
+ "peerDependencies": {
37
+ "@opencode-ai/plugin": ">=0.1.0"
38
+ },
39
+ "devDependencies": {
40
+ "typescript": "^5.5.0"
41
+ },
42
+ "repository": {
43
+ "type": "git",
44
+ "url": "https://github.com/Te-River/Opencode-TeamMode.git"
45
+ },
46
+ "engines": {
47
+ "node": ">=18.0.0"
48
+ }
49
+ }