oh-my-claudecode-opencode 0.6.0 → 0.6.1
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/bin/doctor.js +96 -1
- package/bin/doctor.ts +119 -0
- package/package.json +1 -1
package/bin/doctor.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import * as fs from "node:fs";
|
|
5
5
|
import * as path from "node:path";
|
|
6
6
|
import * as os from "node:os";
|
|
7
|
+
import { execSync } from "node:child_process";
|
|
7
8
|
var OPENCODE_CONFIG_DIR = path.join(os.homedir(), ".config", "opencode");
|
|
8
9
|
var PLUGIN_NAME = "oh-my-claudecode-opencode";
|
|
9
10
|
function checkPluginInstalled() {
|
|
@@ -163,13 +164,107 @@ function checkOmcoConfig() {
|
|
|
163
164
|
details: "Optional: create .opencode/omco.json for custom config"
|
|
164
165
|
};
|
|
165
166
|
}
|
|
167
|
+
function checkVersionUpdate() {
|
|
168
|
+
const pluginPkgPath = path.join(OPENCODE_CONFIG_DIR, "node_modules", PLUGIN_NAME, "package.json");
|
|
169
|
+
try {
|
|
170
|
+
if (!fs.existsSync(pluginPkgPath)) {
|
|
171
|
+
return {
|
|
172
|
+
status: "FAIL",
|
|
173
|
+
message: "Plugin not installed"
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
const pkg = JSON.parse(fs.readFileSync(pluginPkgPath, "utf-8"));
|
|
177
|
+
const installedVersion = pkg.version;
|
|
178
|
+
try {
|
|
179
|
+
const npmVersion = execSync(`npm view ${PLUGIN_NAME} version`, {
|
|
180
|
+
encoding: "utf-8",
|
|
181
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
182
|
+
}).trim();
|
|
183
|
+
if (installedVersion === npmVersion) {
|
|
184
|
+
return {
|
|
185
|
+
status: "OK",
|
|
186
|
+
message: `Up to date (v${installedVersion})`
|
|
187
|
+
};
|
|
188
|
+
} else {
|
|
189
|
+
return {
|
|
190
|
+
status: "WARN",
|
|
191
|
+
message: `Update available: v${installedVersion} → v${npmVersion}`,
|
|
192
|
+
fix: `Run: cd ~/.config/opencode && npm install ${PLUGIN_NAME}@latest`
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
} catch (npmError) {
|
|
196
|
+
return {
|
|
197
|
+
status: "OK",
|
|
198
|
+
message: "Could not check npm registry (offline?)",
|
|
199
|
+
details: `Installed: v${installedVersion}`
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
} catch (e) {
|
|
203
|
+
return {
|
|
204
|
+
status: "FAIL",
|
|
205
|
+
message: `Failed to check version: ${e.message}`
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
function checkToolCompatibility() {
|
|
210
|
+
const distPath = path.join(OPENCODE_CONFIG_DIR, "node_modules", PLUGIN_NAME, "dist", "index.js");
|
|
211
|
+
const skillPath = path.join(OPENCODE_CONFIG_DIR, "node_modules", PLUGIN_NAME, "assets", "skills", "orchestrate.md");
|
|
212
|
+
try {
|
|
213
|
+
if (!fs.existsSync(distPath)) {
|
|
214
|
+
return {
|
|
215
|
+
status: "FAIL",
|
|
216
|
+
message: "dist/index.js not found"
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
const distContent = fs.readFileSync(distPath, "utf-8");
|
|
220
|
+
const hasNewTool = distContent.includes("call_omco_agent");
|
|
221
|
+
const hasOldTool = distContent.includes("call_omo_agent");
|
|
222
|
+
let hasDeprecatedSkillAPI = false;
|
|
223
|
+
if (fs.existsSync(skillPath)) {
|
|
224
|
+
const skillContent = fs.readFileSync(skillPath, "utf-8");
|
|
225
|
+
hasDeprecatedSkillAPI = skillContent.includes("Task(subagent_type");
|
|
226
|
+
}
|
|
227
|
+
if (hasOldTool) {
|
|
228
|
+
return {
|
|
229
|
+
status: "WARN",
|
|
230
|
+
message: "Using deprecated tool name (call_omo_agent)",
|
|
231
|
+
fix: `Update to v0.6.0+: cd ~/.config/opencode && npm install ${PLUGIN_NAME}@latest`
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
if (hasDeprecatedSkillAPI) {
|
|
235
|
+
return {
|
|
236
|
+
status: "WARN",
|
|
237
|
+
message: "Skills still reference Claude Code Task() API",
|
|
238
|
+
fix: `Update to v0.6.0+: cd ~/.config/opencode && npm install ${PLUGIN_NAME}@latest`
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
if (hasNewTool) {
|
|
242
|
+
return {
|
|
243
|
+
status: "OK",
|
|
244
|
+
message: "Tool API is up to date (call_omco_agent)"
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
return {
|
|
248
|
+
status: "WARN",
|
|
249
|
+
message: "Tool API compatibility unclear",
|
|
250
|
+
fix: `Reinstall: cd ~/.config/opencode && npm install ${PLUGIN_NAME}@latest`
|
|
251
|
+
};
|
|
252
|
+
} catch (e) {
|
|
253
|
+
return {
|
|
254
|
+
status: "FAIL",
|
|
255
|
+
message: `Failed to check tool compatibility: ${e.message}`
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
}
|
|
166
259
|
function runDiagnostics() {
|
|
167
260
|
const checks = {
|
|
168
261
|
pluginInstalled: checkPluginInstalled(),
|
|
169
262
|
pluginInConfig: checkPluginInConfig(),
|
|
170
263
|
assetsPresent: checkAssetsPresent(),
|
|
171
264
|
packageDependency: checkPackageDependency(),
|
|
172
|
-
omcoConfigValid: checkOmcoConfig()
|
|
265
|
+
omcoConfigValid: checkOmcoConfig(),
|
|
266
|
+
versionUpdate: checkVersionUpdate(),
|
|
267
|
+
toolCompatibility: checkToolCompatibility()
|
|
173
268
|
};
|
|
174
269
|
const values = Object.values(checks);
|
|
175
270
|
const summary = {
|
package/bin/doctor.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import * as fs from 'node:fs';
|
|
5
5
|
import * as path from 'node:path';
|
|
6
6
|
import * as os from 'node:os';
|
|
7
|
+
import { execSync } from 'node:child_process';
|
|
7
8
|
|
|
8
9
|
const OPENCODE_CONFIG_DIR = path.join(os.homedir(), '.config', 'opencode');
|
|
9
10
|
const PLUGIN_NAME = 'oh-my-claudecode-opencode';
|
|
@@ -27,6 +28,8 @@ interface DiagnosticReport {
|
|
|
27
28
|
assetsPresent: CheckResult;
|
|
28
29
|
packageDependency: CheckResult;
|
|
29
30
|
omcoConfigValid: CheckResult;
|
|
31
|
+
versionUpdate: CheckResult;
|
|
32
|
+
toolCompatibility: CheckResult;
|
|
30
33
|
};
|
|
31
34
|
summary: {
|
|
32
35
|
total: number;
|
|
@@ -234,6 +237,120 @@ function checkOmcoConfig(): CheckResult {
|
|
|
234
237
|
};
|
|
235
238
|
}
|
|
236
239
|
|
|
240
|
+
// ============================================================
|
|
241
|
+
// CHECK 6: Version Update Check
|
|
242
|
+
// ============================================================
|
|
243
|
+
function checkVersionUpdate(): CheckResult {
|
|
244
|
+
const pluginPkgPath = path.join(OPENCODE_CONFIG_DIR, 'node_modules', PLUGIN_NAME, 'package.json');
|
|
245
|
+
|
|
246
|
+
try {
|
|
247
|
+
if (!fs.existsSync(pluginPkgPath)) {
|
|
248
|
+
return {
|
|
249
|
+
status: 'FAIL',
|
|
250
|
+
message: 'Plugin not installed'
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
const pkg = JSON.parse(fs.readFileSync(pluginPkgPath, 'utf-8'));
|
|
255
|
+
const installedVersion = pkg.version;
|
|
256
|
+
|
|
257
|
+
// Try to check npm registry for latest version
|
|
258
|
+
try {
|
|
259
|
+
const npmVersion = execSync(`npm view ${PLUGIN_NAME} version`, {
|
|
260
|
+
encoding: 'utf-8',
|
|
261
|
+
stdio: ['pipe', 'pipe', 'pipe']
|
|
262
|
+
}).trim();
|
|
263
|
+
|
|
264
|
+
if (installedVersion === npmVersion) {
|
|
265
|
+
return {
|
|
266
|
+
status: 'OK',
|
|
267
|
+
message: `Up to date (v${installedVersion})`
|
|
268
|
+
};
|
|
269
|
+
} else {
|
|
270
|
+
return {
|
|
271
|
+
status: 'WARN',
|
|
272
|
+
message: `Update available: v${installedVersion} → v${npmVersion}`,
|
|
273
|
+
fix: `Run: cd ~/.config/opencode && npm install ${PLUGIN_NAME}@latest`
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
} catch (npmError) {
|
|
277
|
+
// Network error or npm not available
|
|
278
|
+
return {
|
|
279
|
+
status: 'OK',
|
|
280
|
+
message: 'Could not check npm registry (offline?)',
|
|
281
|
+
details: `Installed: v${installedVersion}`
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
} catch (e) {
|
|
285
|
+
return {
|
|
286
|
+
status: 'FAIL',
|
|
287
|
+
message: `Failed to check version: ${(e as Error).message}`
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
// ============================================================
|
|
293
|
+
// CHECK 7: Tool Compatibility Check
|
|
294
|
+
// ============================================================
|
|
295
|
+
function checkToolCompatibility(): CheckResult {
|
|
296
|
+
const distPath = path.join(OPENCODE_CONFIG_DIR, 'node_modules', PLUGIN_NAME, 'dist', 'index.js');
|
|
297
|
+
const skillPath = path.join(OPENCODE_CONFIG_DIR, 'node_modules', PLUGIN_NAME, 'assets', 'skills', 'orchestrate.md');
|
|
298
|
+
|
|
299
|
+
try {
|
|
300
|
+
if (!fs.existsSync(distPath)) {
|
|
301
|
+
return {
|
|
302
|
+
status: 'FAIL',
|
|
303
|
+
message: 'dist/index.js not found'
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
const distContent = fs.readFileSync(distPath, 'utf-8');
|
|
308
|
+
const hasNewTool = distContent.includes('call_omco_agent');
|
|
309
|
+
const hasOldTool = distContent.includes('call_omo_agent');
|
|
310
|
+
|
|
311
|
+
// Check skill file for deprecated Task() API
|
|
312
|
+
let hasDeprecatedSkillAPI = false;
|
|
313
|
+
if (fs.existsSync(skillPath)) {
|
|
314
|
+
const skillContent = fs.readFileSync(skillPath, 'utf-8');
|
|
315
|
+
hasDeprecatedSkillAPI = skillContent.includes('Task(subagent_type');
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
if (hasOldTool) {
|
|
319
|
+
return {
|
|
320
|
+
status: 'WARN',
|
|
321
|
+
message: 'Using deprecated tool name (call_omo_agent)',
|
|
322
|
+
fix: `Update to v0.6.0+: cd ~/.config/opencode && npm install ${PLUGIN_NAME}@latest`
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
if (hasDeprecatedSkillAPI) {
|
|
327
|
+
return {
|
|
328
|
+
status: 'WARN',
|
|
329
|
+
message: 'Skills still reference Claude Code Task() API',
|
|
330
|
+
fix: `Update to v0.6.0+: cd ~/.config/opencode && npm install ${PLUGIN_NAME}@latest`
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
if (hasNewTool) {
|
|
335
|
+
return {
|
|
336
|
+
status: 'OK',
|
|
337
|
+
message: 'Tool API is up to date (call_omco_agent)'
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
return {
|
|
342
|
+
status: 'WARN',
|
|
343
|
+
message: 'Tool API compatibility unclear',
|
|
344
|
+
fix: `Reinstall: cd ~/.config/opencode && npm install ${PLUGIN_NAME}@latest`
|
|
345
|
+
};
|
|
346
|
+
} catch (e) {
|
|
347
|
+
return {
|
|
348
|
+
status: 'FAIL',
|
|
349
|
+
message: `Failed to check tool compatibility: ${(e as Error).message}`
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
|
|
237
354
|
// ============================================================
|
|
238
355
|
// MAIN
|
|
239
356
|
// ============================================================
|
|
@@ -244,6 +361,8 @@ function runDiagnostics(): DiagnosticReport {
|
|
|
244
361
|
assetsPresent: checkAssetsPresent(),
|
|
245
362
|
packageDependency: checkPackageDependency(),
|
|
246
363
|
omcoConfigValid: checkOmcoConfig(),
|
|
364
|
+
versionUpdate: checkVersionUpdate(),
|
|
365
|
+
toolCompatibility: checkToolCompatibility(),
|
|
247
366
|
};
|
|
248
367
|
|
|
249
368
|
const values = Object.values(checks);
|