my-opencode 1.3.2 → 1.3.4

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/README.md CHANGED
@@ -17,12 +17,29 @@ npx my-opencode init
17
17
 
18
18
  # 安裝到指定專案
19
19
  npx my-opencode init ./my-project
20
+
21
+ # 覆寫既有檔案(升級用)
22
+ npx my-opencode init --force
20
23
  ```
21
24
 
22
25
  這會在你的專案下建立 `.opencode/`,包含 `skills/`、`agents/`、`plugins/`、`opencode.json`。
23
26
 
24
27
  opencode 會自動發現 `.opencode/opencode.json`,無需額外設定。
25
28
 
29
+ ### 升級到最新版
30
+
31
+ ```bash
32
+ # 1. 更新 npm 套件
33
+ npm install my-opencode@latest
34
+
35
+ # 2. 覆寫既有 .opencode/ 檔案(預設會跳過已存在檔案)
36
+ npx my-opencode init --force
37
+ ```
38
+
39
+ > ⚠️ `init` 預設「已存在就跳過」以保護你客製化的檔案。
40
+ > `--force`(alias `-f` / `--overwrite`)才會覆寫 skills/agents/plugins/opencode.json。
41
+ > 若只想保留自己改過的 `opencode.json`,可先備份再執行 `--force`。
42
+
26
43
  ---
27
44
 
28
45
  ### 本地開發(git clone)
@@ -68,9 +85,12 @@ npx my-opencode help # 顯示說明
68
85
  | Profile | Primary / heavy | Small / verifier |
69
86
  |---------|------------------|------------------|
70
87
  | `opencode` | `opencode-go/deepseek-v4-pro` | `opencode-go/deepseek-v4-flash` |
71
- | `openai` | `openai/gpt-5.4` | `openai/gpt-5.4-mini` |
88
+ | `openai` | `openai/gpt-5.6` | `openai/gpt-5.6-luna` |
72
89
  | `google` | `google/gemini-3.1-pro-preview-customtools` | `google/gemini-3.5-flash` |
73
- | `copilot` | `copilot/gpt-5.4` | `copilot/gpt-5.4-mini` |
90
+ | `copilot` | `github-copilot/gpt-5.6-sol` | `github-copilot/gpt-5.6-luna` |
91
+
92
+ > 💡 `openai` 與 `copilot` profile 的 `gpt-5.6-luna`(verifier / 小型任務)支援 reasoning effort 切換:
93
+ > **high / medium / low** 三檔(預設 `low`)。在 opencode 內用 `variant_cycle` 快捷鍵循環切換。
74
94
 
75
95
  ```bash
76
96
  # 預設 profile(opencode)
package/bin/cli.js CHANGED
@@ -118,8 +118,9 @@ function cmdHelp() {
118
118
  ✓ 不寫入 package.json
119
119
 
120
120
  \x1b[1mCOMMANDS\x1b[0m
121
- init [target-dir] 安裝 skills/agents/plugins 到 .opencode/ 下
121
+ init [target-dir] [--force] 安裝 skills/agents/plugins 到 .opencode/ 下
122
122
  (預設: 當前目錄的 .opencode/)
123
+ --force/-f/--overwrite 覆寫既有檔案 (升級用)
123
124
  list 列出可用的 skills 與 agents
124
125
  help 顯示此說明
125
126
 
@@ -133,6 +134,7 @@ function cmdHelp() {
133
134
  npm install my-opencode # 方法 A (自動)
134
135
  npx my-opencode init # 方法 B (手動)
135
136
  npx my-opencode init ./my-project # 指定專案目錄
137
+ npx my-opencode init --force # 覆寫既有檔案 (升級)
136
138
  npx my-opencode list # 列出內容
137
139
  moc openai # 用 openai profile 啟動
138
140
  `);
@@ -169,7 +171,7 @@ function cmdList() {
169
171
  }
170
172
  }
171
173
 
172
- function cmdInit(targetDir) {
174
+ function cmdInit(targetDir, force) {
173
175
  // If no target specified, default to .opencode/ in CWD
174
176
  const target = targetDir
175
177
  ? path.resolve(targetDir, ".opencode")
@@ -177,6 +179,10 @@ function cmdInit(targetDir) {
177
179
 
178
180
  header(`Installing my-opencode → ${target}`);
179
181
 
182
+ if (force) {
183
+ info("--force: overwriting existing files");
184
+ }
185
+
180
186
  if (!fs.existsSync(target)) {
181
187
  fs.mkdirSync(target, { recursive: true });
182
188
  success(`Created .opencode/`);
@@ -192,7 +198,7 @@ function cmdInit(targetDir) {
192
198
  for (const s of skills) {
193
199
  const src = path.join(SKILLS_DIR, s);
194
200
  const dst = path.join(targetSkills, s);
195
- copyDirSync(src, dst);
201
+ copyDirSync(src, dst, force);
196
202
  skillCount++;
197
203
  }
198
204
  success(`Skills: ${skillCount} installed → .opencode/skills/`);
@@ -207,7 +213,7 @@ function cmdInit(targetDir) {
207
213
  for (const a of agents) {
208
214
  const src = path.join(AGENTS_DIR, a);
209
215
  const dst = path.join(targetAgents, a);
210
- if (!fs.existsSync(dst)) {
216
+ if (force || !fs.existsSync(dst)) {
211
217
  fs.copyFileSync(src, dst);
212
218
  agentCount++;
213
219
  } else {
@@ -226,7 +232,7 @@ function cmdInit(targetDir) {
226
232
  for (const plugin of plugins) {
227
233
  const src = path.join(PLUGINS_DIR, plugin);
228
234
  const dst = path.join(targetPlugins, plugin);
229
- if (!fs.existsSync(dst)) {
235
+ if (force || !fs.existsSync(dst)) {
230
236
  fs.copyFileSync(src, dst);
231
237
  pluginCount++;
232
238
  } else {
@@ -237,7 +243,7 @@ function cmdInit(targetDir) {
237
243
 
238
244
  // ── Generate opencode.json ──────────────────────────────────────────────
239
245
  const targetConfig = path.join(target, "opencode.json");
240
- if (!fs.existsSync(targetConfig)) {
246
+ if (force || !fs.existsSync(targetConfig)) {
241
247
  try {
242
248
  const config = JSON.parse(fs.readFileSync(OPENCODE_CONFIG, "utf-8"));
243
249
  fs.writeFileSync(targetConfig, JSON.stringify(config, null, 2) + "\n");
@@ -274,22 +280,37 @@ function cmdInit(targetDir) {
274
280
 
275
281
  // ─── File Utilities ─────────────────────────────────────────────────────────
276
282
 
277
- function copyDirSync(src, dst) {
283
+ function copyDirSync(src, dst, force) {
278
284
  fs.mkdirSync(dst, { recursive: true });
279
285
  const entries = fs.readdirSync(src, { withFileTypes: true });
280
286
  for (const entry of entries) {
281
287
  const srcPath = path.join(src, entry.name);
282
288
  const dstPath = path.join(dst, entry.name);
283
289
  if (entry.isDirectory()) {
284
- copyDirSync(srcPath, dstPath);
290
+ copyDirSync(srcPath, dstPath, force);
285
291
  } else if (entry.isFile()) {
286
- if (!fs.existsSync(dstPath)) {
292
+ if (force || !fs.existsSync(dstPath)) {
287
293
  fs.copyFileSync(srcPath, dstPath);
288
294
  }
289
295
  }
290
296
  }
291
297
  }
292
298
 
299
+ // ─── Argument parsing ─────────────────────────────────────────────────────────
300
+
301
+ function parseInitArgs(args) {
302
+ let targetDir = null;
303
+ let force = false;
304
+ for (const arg of args) {
305
+ if (arg === "--force" || arg === "-f" || arg === "--overwrite") {
306
+ force = true;
307
+ } else if (!targetDir && !arg.startsWith("-")) {
308
+ targetDir = arg;
309
+ }
310
+ }
311
+ return { targetDir, force };
312
+ }
313
+
293
314
  // ─── Main ───────────────────────────────────────────────────────────────────
294
315
 
295
316
  function main() {
@@ -298,9 +319,11 @@ function main() {
298
319
 
299
320
  switch (cmd) {
300
321
  case "init":
301
- case "install":
302
- cmdInit(args[1]);
322
+ case "install": {
323
+ const { targetDir, force } = parseInitArgs(args.slice(1));
324
+ cmdInit(targetDir, force);
303
325
  break;
326
+ }
304
327
  case "list":
305
328
  case "ls":
306
329
  cmdList();
@@ -318,6 +341,7 @@ function main() {
318
341
  在專案中執行以下指令來安裝到 \x1b[33m.opencode/\x1b[0m:
319
342
 
320
343
  \x1b[36mnpx my-opencode init\x1b[0m
344
+ \x1b[36mnpx my-opencode init --force\x1b[0m (升級時覆寫既有檔案)
321
345
 
322
346
  安裝後,將以下內容加入你的 \x1b[33mopencode.json\x1b[0m:
323
347
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "my-opencode",
3
- "version": "1.3.2",
3
+ "version": "1.3.4",
4
4
  "description": "高品質 opencode 開發流程 skill 與 agents 集合 — Contract-First 開發流程、ADR、PR Review、測試生成、文件生成",
5
5
  "keywords": [
6
6
  "opencode",
@@ -26,7 +26,8 @@
26
26
  "url": "git+https://github.com/jjyung/my-opencode.git"
27
27
  },
28
28
  "scripts": {
29
- "postinstall": "node scripts/postinstall.js"
29
+ "postinstall": "node scripts/postinstall.js",
30
+ "test": "node --test"
30
31
  },
31
32
  "bin": {
32
33
  "my-opencode": "bin/cli.js",
package/plugins/README.md CHANGED
@@ -16,9 +16,12 @@ opencode plugin 是透過 `opencode.json` 的 `plugin` 區塊註冊的 npm 或
16
16
  | Profile | Primary / heavy | Small / verifier |
17
17
  |---------|------------------|------------------|
18
18
  | `opencode` | `opencode-go/deepseek-v4-pro` | `opencode-go/deepseek-v4-flash` |
19
- | `openai` | `openai/gpt-5.4` | `openai/gpt-5.4-mini` |
19
+ | `openai` | `openai/gpt-5.6` | `openai/gpt-5.6-luna` |
20
20
  | `google` | `google/gemini-3.1-pro-preview-customtools` | `google/gemini-3.5-flash` |
21
- | `copilot` | `copilot/gpt-5.4` | `copilot/gpt-5.4-mini` |
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` 快捷鍵循環切換。
22
25
 
23
26
  ### 用法
24
27
 
@@ -13,9 +13,15 @@ const PROFILE_MAP = Object.freeze({
13
13
  heavy_model: "opencode-go/deepseek-v4-pro",
14
14
  }),
15
15
  openai: Object.freeze({
16
- model: "openai/gpt-5.4",
17
- small_model: "openai/gpt-5.4-mini",
18
- heavy_model: "openai/gpt-5.4",
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
+ }),
19
25
  }),
20
26
  google: Object.freeze({
21
27
  model: "google/gemini-3.1-pro-preview-customtools",
@@ -23,9 +29,15 @@ const PROFILE_MAP = Object.freeze({
23
29
  heavy_model: "google/gemini-3.1-pro-preview-customtools",
24
30
  }),
25
31
  copilot: Object.freeze({
26
- model: "copilot/gpt-5.4",
27
- small_model: "copilot/gpt-5.4-mini",
28
- heavy_model: "copilot/gpt-5.4",
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
+ }),
29
41
  }),
30
42
  });
31
43
 
@@ -73,17 +85,60 @@ export default function resolveProfile(options = {}) {
73
85
  }
74
86
 
75
87
  export function buildProfileConfig(options = {}) {
88
+ const activeProfile = pickProfile(options);
89
+ const profile = PROFILE_MAP[activeProfile];
76
90
  const resolved = resolveProfile(options);
91
+ const provider = buildProviderOverrides(profile);
77
92
 
78
93
  return {
79
94
  model: resolved.model,
80
95
  small_model: resolved.small_model,
96
+ ...(Object.keys(provider).length > 0 ? { provider } : {}),
81
97
  agent: Object.fromEntries(
82
98
  ALL_OVERRIDDEN_AGENTS.map((name) => [name, { model: resolved.agent_overrides[name] }]),
83
99
  ),
84
100
  };
85
101
  }
86
102
 
103
+ /**
104
+ * Build the `provider` config fragment for models that need reasoning-effort
105
+ * variants (e.g. gpt-5.6-luna with high/medium/low effort switching).
106
+ *
107
+ * Output shape (merged into opencode config via OPENCODE_CONFIG_CONTENT):
108
+ * provider.openai.models["gpt-5.6-luna"] = {
109
+ * options: { reasoningEffort: <default_effort> },
110
+ * variants: { high: { reasoningEffort: "high" }, ... },
111
+ * }
112
+ */
113
+ function buildProviderOverrides(profile) {
114
+ if (!profile.reasoning) return {};
115
+
116
+ const provider = {};
117
+ for (const [modelRef, cfg] of Object.entries(profile.reasoning)) {
118
+ const [providerId, ...rest] = modelRef.split("/");
119
+ const modelId = rest.join("/");
120
+ if (!providerId || !modelId) continue;
121
+
122
+ const variants = {};
123
+ for (const effort of cfg.efforts) {
124
+ variants[effort] = { reasoningEffort: effort };
125
+ }
126
+
127
+ const modelConfig = { variants };
128
+ if (cfg.default_effort) {
129
+ modelConfig.options = { reasoningEffort: cfg.default_effort };
130
+ }
131
+
132
+ provider[providerId] = {
133
+ models: {
134
+ [modelId]: modelConfig,
135
+ },
136
+ };
137
+ }
138
+
139
+ return provider;
140
+ }
141
+
87
142
  function isProviderProfilePlugin(entry) {
88
143
  return typeof entry === "string" && entry.replaceAll("\\", "/").endsWith("provider-profile.mjs");
89
144
  }