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.
- package/LICENSE +21 -21
- package/README.md +299 -270
- package/agents/architect.md +30 -30
- package/agents/backend-dev.md +29 -0
- package/agents/business-analyst.md +30 -0
- package/agents/code-reviewer.md +29 -29
- package/agents/design-evidence.md +29 -0
- package/agents/frontend-dev.md +29 -0
- package/agents/system-designer.md +30 -0
- package/agents/team-lead.md +65 -60
- package/agents/tech-writer.md +30 -30
- package/agents/test-engineer.md +30 -30
- package/agents/verifier.md +38 -33
- package/bin/cli.js +366 -364
- package/bin/moc +198 -198
- package/opencode.json +218 -170
- package/package.json +53 -51
- package/plugins/README.md +67 -67
- package/plugins/provider-profile.mjs +203 -194
- package/scripts/postinstall.js +202 -202
- package/scripts/validate-role-flow.mjs +90 -0
- package/skills/adr/SKILL.md +91 -91
- package/skills/adr/references/templates.md +100 -100
- package/skills/adr/scripts/README.md +5 -5
- package/skills/design-evidence/SKILL.md +56 -0
- package/skills/dev-flow/SKILL.md +126 -188
- package/skills/dev-flow/references/code-phase.md +35 -72
- package/skills/dev-flow/references/contract-phase.md +66 -81
- package/skills/dev-flow/references/verify-phase.md +70 -129
- package/skills/dev-flow/scripts/README.md +3 -3
- package/skills/docs-gen/SKILL.md +162 -162
- package/skills/docs-gen/references/doc-styles.md +216 -216
- package/skills/docs-gen/scripts/README.md +5 -5
- package/skills/orchestrate/SKILL.md +63 -112
- package/skills/orchestrate/references/orchestration-patterns.md +49 -56
- package/skills/pr-review/SKILL.md +110 -110
- package/skills/pr-review/references/review-dimensions.md +117 -117
- package/skills/pr-review/references/security-checklist.md +122 -122
- package/skills/pr-review/scripts/README.md +5 -5
- package/skills/test-gen/SKILL.md +143 -143
- package/skills/test-gen/references/framework-detection.md +105 -105
- package/skills/test-gen/references/test-patterns.md +260 -260
- package/skills/test-gen/scripts/README.md +5 -5
- package/agents/executor.md +0 -30
- package/agents/fullstack-dev.md +0 -57
- package/agents/spec-writer.md +0 -37
|
@@ -1,194 +1,203 @@
|
|
|
1
|
-
import fs from "node:fs";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import { fileURLToPath } from "node:url";
|
|
4
|
-
|
|
5
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
6
|
-
const __dirname = path.dirname(__filename);
|
|
7
|
-
const CONFIG_PATH = path.resolve(__dirname, "..", "opencode.json");
|
|
8
|
-
|
|
9
|
-
const PROFILE_MAP = Object.freeze({
|
|
10
|
-
opencode: Object.freeze({
|
|
11
|
-
model: "opencode-go/deepseek-v4-pro",
|
|
12
|
-
small_model: "opencode-go/deepseek-v4-flash",
|
|
13
|
-
heavy_model: "opencode-go/deepseek-v4-pro",
|
|
14
|
-
}),
|
|
15
|
-
openai: Object.freeze({
|
|
16
|
-
model: "openai/gpt-5.6",
|
|
17
|
-
small_model: "openai/gpt-5.6-luna",
|
|
18
|
-
heavy_model: "openai/gpt-5.6",
|
|
19
|
-
reasoning: Object.freeze({
|
|
20
|
-
"openai/gpt-5.6-luna": Object.freeze({
|
|
21
|
-
default_effort: "low",
|
|
22
|
-
efforts: ["high", "medium", "low"],
|
|
23
|
-
}),
|
|
24
|
-
}),
|
|
25
|
-
}),
|
|
26
|
-
google: Object.freeze({
|
|
27
|
-
model: "google/gemini-3.1-pro-preview-customtools",
|
|
28
|
-
small_model: "google/gemini-3.5-flash",
|
|
29
|
-
heavy_model: "google/gemini-3.1-pro-preview-customtools",
|
|
30
|
-
}),
|
|
31
|
-
copilot: Object.freeze({
|
|
32
|
-
model: "github-copilot/gpt-5.6-sol",
|
|
33
|
-
small_model: "github-copilot/gpt-5.6-luna",
|
|
34
|
-
heavy_model: "github-copilot/gpt-5.6-sol",
|
|
35
|
-
reasoning: Object.freeze({
|
|
36
|
-
"github-copilot/gpt-5.6-luna": Object.freeze({
|
|
37
|
-
default_effort: "low",
|
|
38
|
-
efforts: ["high", "medium", "low"],
|
|
39
|
-
}),
|
|
40
|
-
}),
|
|
41
|
-
}),
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
const SUPPORTED_PROFILES = Object.keys(PROFILE_MAP);
|
|
45
|
-
const HEAVY_AGENTS = [
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
return
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
const
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
*
|
|
176
|
-
*
|
|
177
|
-
*
|
|
178
|
-
*
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
|
|
5
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = path.dirname(__filename);
|
|
7
|
+
const CONFIG_PATH = path.resolve(__dirname, "..", "opencode.json");
|
|
8
|
+
|
|
9
|
+
const PROFILE_MAP = Object.freeze({
|
|
10
|
+
opencode: Object.freeze({
|
|
11
|
+
model: "opencode-go/deepseek-v4-pro",
|
|
12
|
+
small_model: "opencode-go/deepseek-v4-flash",
|
|
13
|
+
heavy_model: "opencode-go/deepseek-v4-pro",
|
|
14
|
+
}),
|
|
15
|
+
openai: Object.freeze({
|
|
16
|
+
model: "openai/gpt-5.6",
|
|
17
|
+
small_model: "openai/gpt-5.6-luna",
|
|
18
|
+
heavy_model: "openai/gpt-5.6",
|
|
19
|
+
reasoning: Object.freeze({
|
|
20
|
+
"openai/gpt-5.6-luna": Object.freeze({
|
|
21
|
+
default_effort: "low",
|
|
22
|
+
efforts: ["high", "medium", "low"],
|
|
23
|
+
}),
|
|
24
|
+
}),
|
|
25
|
+
}),
|
|
26
|
+
google: Object.freeze({
|
|
27
|
+
model: "google/gemini-3.1-pro-preview-customtools",
|
|
28
|
+
small_model: "google/gemini-3.5-flash",
|
|
29
|
+
heavy_model: "google/gemini-3.1-pro-preview-customtools",
|
|
30
|
+
}),
|
|
31
|
+
copilot: Object.freeze({
|
|
32
|
+
model: "github-copilot/gpt-5.6-sol",
|
|
33
|
+
small_model: "github-copilot/gpt-5.6-luna",
|
|
34
|
+
heavy_model: "github-copilot/gpt-5.6-sol",
|
|
35
|
+
reasoning: Object.freeze({
|
|
36
|
+
"github-copilot/gpt-5.6-luna": Object.freeze({
|
|
37
|
+
default_effort: "low",
|
|
38
|
+
efforts: ["high", "medium", "low"],
|
|
39
|
+
}),
|
|
40
|
+
}),
|
|
41
|
+
}),
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
const SUPPORTED_PROFILES = Object.keys(PROFILE_MAP);
|
|
45
|
+
const HEAVY_AGENTS = [
|
|
46
|
+
"design-evidence",
|
|
47
|
+
"business-analyst",
|
|
48
|
+
"system-designer",
|
|
49
|
+
"code-reviewer",
|
|
50
|
+
"team-lead",
|
|
51
|
+
"architect",
|
|
52
|
+
];
|
|
53
|
+
const ALL_OVERRIDDEN_AGENTS = [...HEAVY_AGENTS, "verifier"];
|
|
54
|
+
|
|
55
|
+
function normalizeProfileValue(value) {
|
|
56
|
+
return typeof value === "string" ? value.trim() : "";
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function assertKnownProfile(value) {
|
|
60
|
+
if (!SUPPORTED_PROFILES.includes(value)) {
|
|
61
|
+
throw new Error(
|
|
62
|
+
`Unknown provider profile "${value}". Must be one of: ${SUPPORTED_PROFILES.join(", ")}`,
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function pickProfile(options = {}) {
|
|
68
|
+
const optionProfile = normalizeProfileValue(options.profile);
|
|
69
|
+
const envProfile = normalizeProfileValue(process.env.OPENCODE_PROVIDER_PROFILE);
|
|
70
|
+
const activeProfile = optionProfile || envProfile || "opencode";
|
|
71
|
+
|
|
72
|
+
assertKnownProfile(activeProfile);
|
|
73
|
+
|
|
74
|
+
return activeProfile;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export default function resolveProfile(options = {}) {
|
|
78
|
+
const activeProfile = pickProfile(options);
|
|
79
|
+
const profile = PROFILE_MAP[activeProfile];
|
|
80
|
+
|
|
81
|
+
return {
|
|
82
|
+
model: profile.model,
|
|
83
|
+
small_model: profile.small_model,
|
|
84
|
+
agent_overrides: {
|
|
85
|
+
"design-evidence": profile.heavy_model,
|
|
86
|
+
"business-analyst": profile.heavy_model,
|
|
87
|
+
"system-designer": profile.heavy_model,
|
|
88
|
+
verifier: profile.small_model,
|
|
89
|
+
"code-reviewer": profile.heavy_model,
|
|
90
|
+
"team-lead": profile.heavy_model,
|
|
91
|
+
architect: profile.heavy_model,
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export function buildProfileConfig(options = {}) {
|
|
97
|
+
const activeProfile = pickProfile(options);
|
|
98
|
+
const profile = PROFILE_MAP[activeProfile];
|
|
99
|
+
const resolved = resolveProfile(options);
|
|
100
|
+
const provider = buildProviderOverrides(profile);
|
|
101
|
+
|
|
102
|
+
return {
|
|
103
|
+
model: resolved.model,
|
|
104
|
+
small_model: resolved.small_model,
|
|
105
|
+
...(Object.keys(provider).length > 0 ? { provider } : {}),
|
|
106
|
+
agent: Object.fromEntries(
|
|
107
|
+
ALL_OVERRIDDEN_AGENTS.map((name) => [name, { model: resolved.agent_overrides[name] }]),
|
|
108
|
+
),
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Build the `provider` config fragment for models that need reasoning-effort
|
|
114
|
+
* variants (e.g. gpt-5.6-luna with high/medium/low effort switching).
|
|
115
|
+
*
|
|
116
|
+
* Output shape (merged into opencode config via OPENCODE_CONFIG_CONTENT):
|
|
117
|
+
* provider.openai.models["gpt-5.6-luna"] = {
|
|
118
|
+
* options: { reasoningEffort: <default_effort> },
|
|
119
|
+
* variants: { high: { reasoningEffort: "high" }, ... },
|
|
120
|
+
* }
|
|
121
|
+
*/
|
|
122
|
+
function buildProviderOverrides(profile) {
|
|
123
|
+
if (!profile.reasoning) return {};
|
|
124
|
+
|
|
125
|
+
const provider = {};
|
|
126
|
+
for (const [modelRef, cfg] of Object.entries(profile.reasoning)) {
|
|
127
|
+
const [providerId, ...rest] = modelRef.split("/");
|
|
128
|
+
const modelId = rest.join("/");
|
|
129
|
+
if (!providerId || !modelId) continue;
|
|
130
|
+
|
|
131
|
+
const variants = {};
|
|
132
|
+
for (const effort of cfg.efforts) {
|
|
133
|
+
variants[effort] = { reasoningEffort: effort };
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const modelConfig = { variants };
|
|
137
|
+
if (cfg.default_effort) {
|
|
138
|
+
modelConfig.options = { reasoningEffort: cfg.default_effort };
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
provider[providerId] = {
|
|
142
|
+
models: {
|
|
143
|
+
[modelId]: modelConfig,
|
|
144
|
+
},
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
return provider;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function isProviderProfilePlugin(entry) {
|
|
152
|
+
return typeof entry === "string" && entry.replaceAll("\\", "/").endsWith("provider-profile.mjs");
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export function readPluginOptions(configPath = CONFIG_PATH) {
|
|
156
|
+
try {
|
|
157
|
+
const config = JSON.parse(fs.readFileSync(configPath, "utf8"));
|
|
158
|
+
const plugins = Array.isArray(config.plugin) ? config.plugin : [];
|
|
159
|
+
|
|
160
|
+
for (const plugin of plugins) {
|
|
161
|
+
if (Array.isArray(plugin) && plugin.length === 2 && isProviderProfilePlugin(plugin[0])) {
|
|
162
|
+
return plugin[1] && typeof plugin[1] === "object" ? plugin[1] : {};
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
} catch {
|
|
166
|
+
return {};
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
return {};
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* ProviderProfilePlugin — runtime hook placeholder (no-op).
|
|
174
|
+
*
|
|
175
|
+
* This is a no-op runtime hook for opencode's plugin system.
|
|
176
|
+
* The actual model-profile switching happens outside the runtime hook:
|
|
177
|
+
*
|
|
178
|
+
* 1) `bin/moc` (the shell launcher) or direct invocation sets
|
|
179
|
+
* `OPENCODE_CONFIG_CONTENT` by running this module directly:
|
|
180
|
+
* `node plugins/provider-profile.mjs`
|
|
181
|
+
*
|
|
182
|
+
* 2) The direct-execution path at the bottom of this file generates
|
|
183
|
+
* the JSON config override fragment that opencode merges at startup.
|
|
184
|
+
*
|
|
185
|
+
* This function exists so the module is loadable as an opencode plugin,
|
|
186
|
+
* but no runtime transformation is needed because the config override is
|
|
187
|
+
* already applied via `OPENCODE_CONFIG_CONTENT` at process launch.
|
|
188
|
+
*
|
|
189
|
+
* @returns {object} Empty object — no runtime hook behavior.
|
|
190
|
+
*/
|
|
191
|
+
export function ProviderProfilePlugin() {
|
|
192
|
+
return {};
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
function isDirectExecution() {
|
|
196
|
+
const scriptPath = process.argv[1];
|
|
197
|
+
return scriptPath ? path.resolve(scriptPath) === __filename : false;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
if (isDirectExecution()) {
|
|
201
|
+
const options = readPluginOptions();
|
|
202
|
+
process.stdout.write(`${JSON.stringify(buildProfileConfig(options))}\n`);
|
|
203
|
+
}
|