my-opencode 1.3.4 → 2.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.
Files changed (46) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +299 -270
  3. package/agents/architect.md +30 -30
  4. package/agents/backend-dev.md +29 -0
  5. package/agents/business-analyst.md +30 -0
  6. package/agents/code-reviewer.md +29 -29
  7. package/agents/design-evidence.md +29 -0
  8. package/agents/frontend-dev.md +29 -0
  9. package/agents/system-designer.md +30 -0
  10. package/agents/team-lead.md +65 -60
  11. package/agents/tech-writer.md +30 -30
  12. package/agents/test-engineer.md +30 -30
  13. package/agents/verifier.md +38 -33
  14. package/bin/cli.js +366 -364
  15. package/bin/moc +198 -198
  16. package/opencode.json +218 -170
  17. package/package.json +53 -51
  18. package/plugins/README.md +67 -67
  19. package/plugins/provider-profile.mjs +203 -194
  20. package/scripts/postinstall.js +202 -202
  21. package/scripts/validate-role-flow.mjs +90 -0
  22. package/skills/adr/SKILL.md +91 -91
  23. package/skills/adr/references/templates.md +100 -100
  24. package/skills/adr/scripts/README.md +5 -5
  25. package/skills/design-evidence/SKILL.md +56 -0
  26. package/skills/dev-flow/SKILL.md +126 -188
  27. package/skills/dev-flow/references/code-phase.md +35 -72
  28. package/skills/dev-flow/references/contract-phase.md +66 -81
  29. package/skills/dev-flow/references/verify-phase.md +70 -129
  30. package/skills/dev-flow/scripts/README.md +3 -3
  31. package/skills/docs-gen/SKILL.md +162 -162
  32. package/skills/docs-gen/references/doc-styles.md +216 -216
  33. package/skills/docs-gen/scripts/README.md +5 -5
  34. package/skills/orchestrate/SKILL.md +63 -112
  35. package/skills/orchestrate/references/orchestration-patterns.md +49 -56
  36. package/skills/pr-review/SKILL.md +110 -110
  37. package/skills/pr-review/references/review-dimensions.md +117 -117
  38. package/skills/pr-review/references/security-checklist.md +122 -122
  39. package/skills/pr-review/scripts/README.md +5 -5
  40. package/skills/test-gen/SKILL.md +143 -143
  41. package/skills/test-gen/references/framework-detection.md +105 -105
  42. package/skills/test-gen/references/test-patterns.md +260 -260
  43. package/skills/test-gen/scripts/README.md +5 -5
  44. package/agents/executor.md +0 -30
  45. package/agents/fullstack-dev.md +0 -57
  46. package/agents/spec-writer.md +0 -37
package/opencode.json CHANGED
@@ -1,170 +1,218 @@
1
- {
2
- "$schema": "https://opencode.ai/config.json",
3
- "model": "opencode-go/deepseek-v4-pro",
4
- "small_model": "opencode-go/deepseek-v4-flash",
5
- "default_agent": "fullstack-dev",
6
- "instructions": [
7
- "skills/adr/SKILL.md",
8
- "skills/dev-flow/SKILL.md",
9
- "skills/pr-review/SKILL.md",
10
- "skills/test-gen/SKILL.md",
11
- "skills/docs-gen/SKILL.md",
12
- "skills/orchestrate/SKILL.md"
13
- ],
14
- "plugin": [
15
- "plugins/provider-profile.mjs"
16
- ],
17
- "agent": {
18
- "fullstack-dev": {
19
- "description": "Primary development agent. Orchestrates contract-first ADR → contract → code → verify flow.",
20
- "mode": "primary",
21
- "prompt": "{file:agents/fullstack-dev.md}",
22
- "permission": {
23
- "task": "ask"
24
- },
25
- "tools": {
26
- "read": true,
27
- "write": true,
28
- "edit": true,
29
- "bash": true
30
- }
31
- },
32
- "spec-writer": {
33
- "description": "Analyze requirements and produce contract specifications in docs/specs/. Writes persistent contracts for parallel development.",
34
- "mode": "subagent",
35
- "model": "opencode-go/deepseek-v4-pro",
36
- "prompt": "{file:agents/spec-writer.md}",
37
- "tools": {
38
- "read": true,
39
- "bash": true,
40
- "write": true,
41
- "edit": true
42
- }
43
- },
44
- "executor": {
45
- "description": "Implement code changes following an approved contract. Full read/write access for coding.",
46
- "mode": "subagent",
47
- "prompt": "{file:agents/executor.md}",
48
- "tools": {
49
- "read": true,
50
- "write": true,
51
- "edit": true,
52
- "bash": true
53
- }
54
- },
55
- "verifier": {
56
- "description": "Run lint, typecheck, tests, and build to verify code changes. Read-only + bash.",
57
- "mode": "subagent",
58
- "model": "opencode-go/deepseek-v4-flash",
59
- "prompt": "{file:agents/verifier.md}",
60
- "tools": {
61
- "read": true,
62
- "bash": true,
63
- "write": false,
64
- "edit": false
65
- }
66
- },
67
- "code-reviewer": {
68
- "description": "Systematic code review across correctness, security, quality, testing, and style dimensions.",
69
- "mode": "subagent",
70
- "model": "opencode-go/deepseek-v4-pro",
71
- "prompt": "{file:agents/code-reviewer.md}",
72
- "tools": {
73
- "read": true,
74
- "bash": true,
75
- "write": false,
76
- "edit": false
77
- }
78
- },
79
- "test-engineer": {
80
- "description": "Generate meaningful tests for source code — unit, integration, and E2E. Framework-aware.",
81
- "mode": "subagent",
82
- "prompt": "{file:agents/test-engineer.md}",
83
- "tools": {
84
- "read": true,
85
- "write": true,
86
- "edit": true,
87
- "bash": true
88
- }
89
- },
90
- "tech-writer": {
91
- "description": "Generate and update project documentation — code comments, API docs, README, and CHANGELOG.",
92
- "mode": "subagent",
93
- "prompt": "{file:agents/tech-writer.md}",
94
- "tools": {
95
- "read": true,
96
- "write": true,
97
- "edit": true,
98
- "bash": true
99
- }
100
- },
101
- "team-lead": {
102
- "description": "Multi-agent orchestrator for complex tasks. Delegates to architect, spec-writer, executor, code-reviewer, test-engineer, verifier.",
103
- "mode": "subagent",
104
- "model": "opencode-go/deepseek-v4-pro",
105
- "prompt": "{file:agents/team-lead.md}",
106
- "tools": {
107
- "read": true,
108
- "write": true,
109
- "edit": true,
110
- "bash": true
111
- }
112
- },
113
- "architect": {
114
- "description": "Capture architecture decisions as ADR documents. Analyzes tradeoffs and records context.",
115
- "mode": "subagent",
116
- "model": "opencode-go/deepseek-v4-pro",
117
- "prompt": "{file:agents/architect.md}",
118
- "tools": {
119
- "read": true,
120
- "write": true,
121
- "edit": true,
122
- "bash": true
123
- }
124
- }
125
- },
126
- "command": {
127
- "spec": {
128
- "description": "Create a contract specification in docs/specs/ — source of truth for implementation",
129
- "agent": "spec-writer",
130
- "subtask": true,
131
- "template": "Analyze the request and produce a contract specification document.\n\n$ARGUMENTS"
132
- },
133
- "review": {
134
- "description": "Review code changes across 5 dimensions (correctness, security, quality, testing, style)",
135
- "agent": "code-reviewer",
136
- "subtask": true,
137
- "template": "Review the current changes.\n\n$ARGUMENTS"
138
- },
139
- "test": {
140
- "description": "Generate tests for source code — auto-detects framework and conventions",
141
- "agent": "test-engineer",
142
- "subtask": true,
143
- "template": "Generate tests for the current code.\n\n$ARGUMENTS"
144
- },
145
- "docs": {
146
- "description": "Generate or update documentation — code comments, README, API docs, ADRs",
147
- "agent": "tech-writer",
148
- "subtask": true,
149
- "template": "Generate or update documentation.\n\n$ARGUMENTS"
150
- },
151
- "orchestrate": {
152
- "description": "Coordinate multiple agents for complex, multi-domain tasks",
153
- "agent": "team-lead",
154
- "subtask": true,
155
- "template": "Orchestrate the following complex task.\n\n$ARGUMENTS"
156
- },
157
- "adr": {
158
- "description": "Create or update an Architecture Decision Record",
159
- "agent": "architect",
160
- "subtask": true,
161
- "template": "Create an Architecture Decision Record.\n\n$ARGUMENTS"
162
- },
163
- "verify": {
164
- "description": "Run lint, typecheck, tests, and build to verify changes",
165
- "template": "Use the verifier agent to run the full verification suite on the current changes.\n\n$ARGUMENTS",
166
- "agent": "verifier",
167
- "subtask": true
168
- }
169
- }
170
- }
1
+ {
2
+ "$schema": "https://opencode.ai/config.json",
3
+ "model": "opencode-go/deepseek-v4-pro",
4
+ "small_model": "opencode-go/deepseek-v4-flash",
5
+ "default_agent": "team-lead",
6
+ "instructions": [
7
+ "skills/adr/SKILL.md",
8
+ "skills/dev-flow/SKILL.md",
9
+ "skills/pr-review/SKILL.md",
10
+ "skills/test-gen/SKILL.md",
11
+ "skills/docs-gen/SKILL.md",
12
+ "skills/orchestrate/SKILL.md",
13
+ "skills/design-evidence/SKILL.md"
14
+ ],
15
+ "plugin": [
16
+ "plugins/provider-profile.mjs"
17
+ ],
18
+ "agent": {
19
+ "team-lead": {
20
+ "description": "Primary delivery orchestrator. Coordinates Design Evidence → SA → SD → Frontend/Backend → Review → Verify.",
21
+ "mode": "primary",
22
+ "prompt": "{file:agents/team-lead.md}",
23
+ "permission": {
24
+ "task": "ask"
25
+ },
26
+ "tools": {
27
+ "read": true,
28
+ "write": true,
29
+ "edit": true,
30
+ "bash": true
31
+ }
32
+ },
33
+ "design-evidence": {
34
+ "description": "Extract source-backed Design Evidence Packs from Figma, screenshots, wireframes, and prototypes.",
35
+ "mode": "subagent",
36
+ "model": "opencode-go/deepseek-v4-pro",
37
+ "prompt": "{file:agents/design-evidence.md}",
38
+ "tools": {
39
+ "read": true,
40
+ "bash": true,
41
+ "write": true,
42
+ "edit": true
43
+ }
44
+ },
45
+ "business-analyst": {
46
+ "description": "SA role: translate evidence into business requirements, rules, states, data meaning, and acceptance intent.",
47
+ "mode": "subagent",
48
+ "model": "opencode-go/deepseek-v4-pro",
49
+ "prompt": "{file:agents/business-analyst.md}",
50
+ "tools": {
51
+ "read": true,
52
+ "write": true,
53
+ "edit": true,
54
+ "bash": true
55
+ }
56
+ },
57
+ "system-designer": {
58
+ "description": "SD role: translate business requirements into technical, API, data, security, and operational contracts.",
59
+ "mode": "subagent",
60
+ "model": "opencode-go/deepseek-v4-pro",
61
+ "prompt": "{file:agents/system-designer.md}",
62
+ "tools": {
63
+ "read": true,
64
+ "bash": true,
65
+ "write": true,
66
+ "edit": true
67
+ }
68
+ },
69
+ "frontend-dev": {
70
+ "description": "Implement frontend routes, interactions, state, accessibility, and visual acceptance from approved contracts.",
71
+ "mode": "subagent",
72
+ "prompt": "{file:agents/frontend-dev.md}",
73
+ "tools": {
74
+ "read": true,
75
+ "write": true,
76
+ "edit": true,
77
+ "bash": true
78
+ }
79
+ },
80
+ "backend-dev": {
81
+ "description": "Implement backend APIs, domain logic, persistence, authorization, integrations, and observability from approved contracts.",
82
+ "mode": "subagent",
83
+ "prompt": "{file:agents/backend-dev.md}",
84
+ "tools": {
85
+ "read": true,
86
+ "write": true,
87
+ "edit": true,
88
+ "bash": true
89
+ }
90
+ },
91
+ "verifier": {
92
+ "description": "Run lint, typecheck, tests, and build to verify code changes. Read-only + bash.",
93
+ "mode": "subagent",
94
+ "model": "opencode-go/deepseek-v4-flash",
95
+ "prompt": "{file:agents/verifier.md}",
96
+ "tools": {
97
+ "read": true,
98
+ "bash": true,
99
+ "write": false,
100
+ "edit": false
101
+ }
102
+ },
103
+ "code-reviewer": {
104
+ "description": "Systematic code review across correctness, security, quality, testing, and style dimensions.",
105
+ "mode": "subagent",
106
+ "model": "opencode-go/deepseek-v4-pro",
107
+ "prompt": "{file:agents/code-reviewer.md}",
108
+ "tools": {
109
+ "read": true,
110
+ "bash": true,
111
+ "write": false,
112
+ "edit": false
113
+ }
114
+ },
115
+ "test-engineer": {
116
+ "description": "Generate meaningful tests for source code — unit, integration, and E2E. Framework-aware.",
117
+ "mode": "subagent",
118
+ "prompt": "{file:agents/test-engineer.md}",
119
+ "tools": {
120
+ "read": true,
121
+ "write": true,
122
+ "edit": true,
123
+ "bash": true
124
+ }
125
+ },
126
+ "tech-writer": {
127
+ "description": "Generate and update project documentation — code comments, API docs, README, and CHANGELOG.",
128
+ "mode": "subagent",
129
+ "prompt": "{file:agents/tech-writer.md}",
130
+ "tools": {
131
+ "read": true,
132
+ "write": true,
133
+ "edit": true,
134
+ "bash": true
135
+ }
136
+ },
137
+ "architect": {
138
+ "description": "Capture architecture decisions as ADR documents. Analyzes tradeoffs and records context.",
139
+ "mode": "subagent",
140
+ "model": "opencode-go/deepseek-v4-pro",
141
+ "prompt": "{file:agents/architect.md}",
142
+ "tools": {
143
+ "read": true,
144
+ "write": true,
145
+ "edit": true,
146
+ "bash": true
147
+ }
148
+ }
149
+ },
150
+ "command": {
151
+ "evidence": {
152
+ "description": "Create a source-backed Design Evidence Pack in docs/specs/<feature>/",
153
+ "agent": "design-evidence",
154
+ "subtask": true,
155
+ "template": "Extract the Design Evidence Pack for this feature. Record sources, observed/inferred/unknown evidence, confidence, and intake metadata.\n\n$ARGUMENTS"
156
+ },
157
+ "business-spec": {
158
+ "description": "Create business requirements from an approved Design Evidence Pack",
159
+ "agent": "business-analyst",
160
+ "subtask": true,
161
+ "template": "Read the feature intake and evidence pack, then produce business requirements, rules, states, business data definitions, acceptance intent, and traceability IDs.\n\n$ARGUMENTS"
162
+ },
163
+ "technical-design": {
164
+ "description": "Create technical, frontend, and backend contracts from approved business requirements",
165
+ "agent": "system-designer",
166
+ "subtask": true,
167
+ "template": "Read the evidence pack and business requirements, then produce technical design, frontend contract, backend contract, and traceability mappings.\n\n$ARGUMENTS"
168
+ },
169
+ "frontend": {
170
+ "description": "Implement a frontend slice from its approved contract",
171
+ "agent": "frontend-dev",
172
+ "subtask": true,
173
+ "template": "Implement the approved frontend slice and report its requirement, API, and verification IDs.\n\n$ARGUMENTS"
174
+ },
175
+ "backend": {
176
+ "description": "Implement a backend slice from its approved contract",
177
+ "agent": "backend-dev",
178
+ "subtask": true,
179
+ "template": "Implement the approved backend slice and report its requirement, API, data, and verification IDs.\n\n$ARGUMENTS"
180
+ },
181
+ "review": {
182
+ "description": "Review code changes across 5 dimensions (correctness, security, quality, testing, style)",
183
+ "agent": "code-reviewer",
184
+ "subtask": true,
185
+ "template": "Review the current changes.\n\n$ARGUMENTS"
186
+ },
187
+ "test": {
188
+ "description": "Generate tests for source code — auto-detects framework and conventions",
189
+ "agent": "test-engineer",
190
+ "subtask": true,
191
+ "template": "Generate tests for the current code.\n\n$ARGUMENTS"
192
+ },
193
+ "docs": {
194
+ "description": "Generate or update documentation — code comments, README, API docs, ADRs",
195
+ "agent": "tech-writer",
196
+ "subtask": true,
197
+ "template": "Generate or update documentation.\n\n$ARGUMENTS"
198
+ },
199
+ "orchestrate": {
200
+ "description": "Coordinate multiple agents for complex, multi-domain tasks",
201
+ "agent": "team-lead",
202
+ "subtask": true,
203
+ "template": "Orchestrate the following complex task.\n\n$ARGUMENTS"
204
+ },
205
+ "adr": {
206
+ "description": "Create or update an Architecture Decision Record",
207
+ "agent": "architect",
208
+ "subtask": true,
209
+ "template": "Create an Architecture Decision Record.\n\n$ARGUMENTS"
210
+ },
211
+ "verify": {
212
+ "description": "Run lint, typecheck, tests, and build to verify changes",
213
+ "template": "Use the verifier agent to run the full verification suite on the current changes.\n\n$ARGUMENTS",
214
+ "agent": "verifier",
215
+ "subtask": true
216
+ }
217
+ }
218
+ }
package/package.json CHANGED
@@ -1,51 +1,53 @@
1
- {
2
- "name": "my-opencode",
3
- "version": "1.3.4",
4
- "description": "高品質 opencode 開發流程 skill 與 agents 集合 — Contract-First 開發流程、ADR、PR Review、測試生成、文件生成",
5
- "keywords": [
6
- "opencode",
7
- "claude-code",
8
- "ai-coding",
9
- "development-workflow",
10
- "contract-first",
11
- "adr",
12
- "code-review",
13
- "test-generation",
14
- "documentation",
15
- "agents",
16
- "skills"
17
- ],
18
- "homepage": "https://github.com/jjyung/my-opencode#readme",
19
- "bugs": {
20
- "url": "https://github.com/jjyung/my-opencode/issues"
21
- },
22
- "license": "MIT",
23
- "author": "cfh00902455",
24
- "repository": {
25
- "type": "git",
26
- "url": "git+https://github.com/jjyung/my-opencode.git"
27
- },
28
- "scripts": {
29
- "postinstall": "node scripts/postinstall.js",
30
- "test": "node --test"
31
- },
32
- "bin": {
33
- "my-opencode": "bin/cli.js",
34
- "moc": "bin/moc.js"
35
- },
36
- "files": [
37
- "bin/",
38
- "scripts/",
39
- "skills/",
40
- "agents/",
41
- "plugins/",
42
- "opencode.json"
43
- ],
44
- "engines": {
45
- "node": ">=18.0.0"
46
- },
47
- "type": "module",
48
- "publishConfig": {
49
- "access": "public"
50
- }
51
- }
1
+ {
2
+ "name": "my-opencode",
3
+ "version": "2.0.0",
4
+ "description": "高品質 opencode 開發流程 skill 與 agents 集合 — Evidence-First 開發流程、ADR、PR Review、測試生成、文件生成",
5
+ "keywords": [
6
+ "opencode",
7
+ "claude-code",
8
+ "ai-coding",
9
+ "development-workflow",
10
+ "contract-first",
11
+ "evidence-first",
12
+ "adr",
13
+ "code-review",
14
+ "test-generation",
15
+ "documentation",
16
+ "agents",
17
+ "skills"
18
+ ],
19
+ "homepage": "https://github.com/jjyung/my-opencode#readme",
20
+ "bugs": {
21
+ "url": "https://github.com/jjyung/my-opencode/issues"
22
+ },
23
+ "license": "MIT",
24
+ "author": "cfh00902455",
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "git+https://github.com/jjyung/my-opencode.git"
28
+ },
29
+ "scripts": {
30
+ "postinstall": "node scripts/postinstall.js",
31
+ "test": "node --test test/*.test.mjs",
32
+ "test:structure": "node scripts/validate-role-flow.mjs"
33
+ },
34
+ "bin": {
35
+ "my-opencode": "bin/cli.js",
36
+ "moc": "bin/moc.js"
37
+ },
38
+ "files": [
39
+ "bin/",
40
+ "scripts/",
41
+ "skills/",
42
+ "agents/",
43
+ "plugins/",
44
+ "opencode.json"
45
+ ],
46
+ "engines": {
47
+ "node": ">=18.0.0"
48
+ },
49
+ "type": "module",
50
+ "publishConfig": {
51
+ "access": "public"
52
+ }
53
+ }
package/plugins/README.md CHANGED
@@ -1,67 +1,67 @@
1
- # Plugins
2
-
3
- opencode plugin 是透過 `opencode.json` 的 `plugin` 區塊註冊的 npm 或本地封裝,可包含自訂 tool、MCP 整合、或額外的 subagent 類型。
4
-
5
- ## 目前包含
6
-
7
- ### `provider-profile.mjs`
8
-
9
- 零依賴 ESM plugin / resolver,用來切換本 repo 的模型 profile。
10
-
11
- - 預設 profile:`opencode`
12
- - 支援:`opencode`、`openai`、`google`、`copilot`
13
- - 讀取:`OPENCODE_PROVIDER_PROFILE`
14
- - 可透過 plugin tuple options 覆寫:`["plugins/provider-profile.mjs", { "profile": "google" }]`
15
-
16
- | Profile | Primary / heavy | Small / verifier |
17
- |---------|------------------|------------------|
18
- | `opencode` | `opencode-go/deepseek-v4-pro` | `opencode-go/deepseek-v4-flash` |
19
- | `openai` | `openai/gpt-5.6` | `openai/gpt-5.6-luna` |
20
- | `google` | `google/gemini-3.1-pro-preview-customtools` | `google/gemini-3.5-flash` |
21
- | `copilot` | `github-copilot/gpt-5.6-sol` | `github-copilot/gpt-5.6-luna` |
22
-
23
- > 💡 `openai` 與 `copilot` profile 的 `gpt-5.6-luna` 支援 reasoning effort 切換(high / medium / low,預設 `low`),
24
- > 在 opencode 內用 `variant_cycle` 快捷鍵循環切換。
25
-
26
- ### 用法
27
-
28
- 建議優先使用 `moc`:
29
-
30
- ```bash
31
- moc
32
- moc openai
33
- moc google --list-agents
34
- ```
35
-
36
- `moc` 會對四個已知 profile 快取 provider-profile 產生出的 JSON override,位置在 `.opencode/cache/provider-profile/`。快取是否有效由以下條件決定:
37
-
38
- - profile 名稱
39
- - `.opencode/plugins/provider-profile.mjs` 的 mtime
40
- - `.opencode/opencode.json` 的 mtime
41
-
42
- 若三者都沒變,`moc` 會直接重用快取,不再重新執行 `node .opencode/plugins/provider-profile.mjs`。
43
-
44
- 進階情境可直接設定環境變數:
45
-
46
- ```bash
47
- OPENCODE_CONFIG_CONTENT="$(node .opencode/plugins/provider-profile.mjs)" opencode
48
-
49
- OPENCODE_PROVIDER_PROFILE=openai \
50
- OPENCODE_CONFIG_CONTENT="$(node .opencode/plugins/provider-profile.mjs)" \
51
- opencode
52
- ```
53
-
54
- 直接執行模組時,會輸出可供 `OPENCODE_CONFIG_CONTENT` 使用的 JSON override。
55
-
56
- > 備註:目前 OpenCode plugin API 可註冊 runtime hooks / tools,但不會在載入時直接改寫 `opencode.json`;因此這個模組同時扮演 plugin 與 config override generator。
57
-
58
- ## 何時需要 Plugin
59
-
60
- - 需要封裝自訂 tool 給多個專案共用
61
- - 需要透過 MCP 串接外部 API
62
- - 需要 hook opencode 的生命週期事件
63
-
64
- ## 開發參考
65
-
66
- - [opencode 官方文件 — Plugins](https://opencode.ai/plugins)
67
- - 範本可參考 `templates/plugin-template/`
1
+ # Plugins
2
+
3
+ opencode plugin 是透過 `opencode.json` 的 `plugin` 區塊註冊的 npm 或本地封裝,可包含自訂 tool、MCP 整合、或額外的 subagent 類型。
4
+
5
+ ## 目前包含
6
+
7
+ ### `provider-profile.mjs`
8
+
9
+ 零依賴 ESM plugin / resolver,用來切換本 repo 的模型 profile。
10
+
11
+ - 預設 profile:`opencode`
12
+ - 支援:`opencode`、`openai`、`google`、`copilot`
13
+ - 讀取:`OPENCODE_PROVIDER_PROFILE`
14
+ - 可透過 plugin tuple options 覆寫:`["plugins/provider-profile.mjs", { "profile": "google" }]`
15
+
16
+ | Profile | Primary / heavy | Small / verifier |
17
+ |---------|------------------|------------------|
18
+ | `opencode` | `opencode-go/deepseek-v4-pro` | `opencode-go/deepseek-v4-flash` |
19
+ | `openai` | `openai/gpt-5.6` | `openai/gpt-5.6-luna` |
20
+ | `google` | `google/gemini-3.1-pro-preview-customtools` | `google/gemini-3.5-flash` |
21
+ | `copilot` | `github-copilot/gpt-5.6-sol` | `github-copilot/gpt-5.6-luna` |
22
+
23
+ > 💡 `openai` 與 `copilot` profile 的 `gpt-5.6-luna` 支援 reasoning effort 切換(high / medium / low,預設 `low`),
24
+ > 在 opencode 內用 `variant_cycle` 快捷鍵循環切換。
25
+
26
+ ### 用法
27
+
28
+ 建議優先使用 `moc`:
29
+
30
+ ```bash
31
+ moc
32
+ moc openai
33
+ moc google --list-agents
34
+ ```
35
+
36
+ `moc` 會對四個已知 profile 快取 provider-profile 產生出的 JSON override,位置在 `.opencode/cache/provider-profile/`。快取是否有效由以下條件決定:
37
+
38
+ - profile 名稱
39
+ - `.opencode/plugins/provider-profile.mjs` 的 mtime
40
+ - `.opencode/opencode.json` 的 mtime
41
+
42
+ 若三者都沒變,`moc` 會直接重用快取,不再重新執行 `node .opencode/plugins/provider-profile.mjs`。
43
+
44
+ 進階情境可直接設定環境變數:
45
+
46
+ ```bash
47
+ OPENCODE_CONFIG_CONTENT="$(node .opencode/plugins/provider-profile.mjs)" opencode
48
+
49
+ OPENCODE_PROVIDER_PROFILE=openai \
50
+ OPENCODE_CONFIG_CONTENT="$(node .opencode/plugins/provider-profile.mjs)" \
51
+ opencode
52
+ ```
53
+
54
+ 直接執行模組時,會輸出可供 `OPENCODE_CONFIG_CONTENT` 使用的 JSON override。
55
+
56
+ > 備註:目前 OpenCode plugin API 可註冊 runtime hooks / tools,但不會在載入時直接改寫 `opencode.json`;因此這個模組同時扮演 plugin 與 config override generator。
57
+
58
+ ## 何時需要 Plugin
59
+
60
+ - 需要封裝自訂 tool 給多個專案共用
61
+ - 需要透過 MCP 串接外部 API
62
+ - 需要 hook opencode 的生命週期事件
63
+
64
+ ## 開發參考
65
+
66
+ - [opencode 官方文件 — Plugins](https://opencode.ai/plugins)
67
+ - 範本可參考 `templates/plugin-template/`