opencodekit 0.6.0 → 0.6.2

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 (79) hide show
  1. package/dist/index.js +1 -1
  2. package/dist/template/.opencode/AGENTS.md +4 -1
  3. package/dist/template/.opencode/command/skill-create.md +3 -3
  4. package/dist/template/.opencode/command/skill-optimize.md +1 -1
  5. package/dist/template/.opencode/dcp.jsonc +63 -41
  6. package/dist/template/.opencode/opencode.json +5 -4
  7. package/dist/template/.opencode/package.json +2 -2
  8. package/dist/template/.opencode/pickle-thinker.jsonc +11 -0
  9. package/dist/template/.opencode/plugin/skill.ts +275 -0
  10. package/dist/template/.opencode/{skills → skill}/accessibility-audit/SKILL.md +5 -0
  11. package/dist/template/.opencode/{skills → skill}/brainstorming/SKILL.md +2 -2
  12. package/dist/template/.opencode/{skills → skill}/design-system-audit/SKILL.md +5 -0
  13. package/dist/template/.opencode/{skills → skill}/executing-plans/SKILL.md +13 -2
  14. package/dist/template/.opencode/{skills → skill}/frontend-aesthetics/SKILL.md +5 -0
  15. package/dist/template/.opencode/{skills → skill}/mockup-to-code/SKILL.md +5 -0
  16. package/dist/template/.opencode/{skills → skill}/requesting-code-review/SKILL.md +16 -6
  17. package/dist/template/.opencode/{skills → skill}/subagent-driven-development/SKILL.md +38 -17
  18. package/dist/template/.opencode/{skills → skill}/systematic-debugging/SKILL.md +28 -18
  19. package/dist/template/.opencode/{skills → skill}/testing-skills-with-subagents/SKILL.md +1 -1
  20. package/dist/template/.opencode/{skills → skill}/ui-ux-research/SKILL.md +5 -0
  21. package/dist/template/.opencode/{skills → skill}/visual-analysis/SKILL.md +5 -0
  22. package/dist/template/.opencode/{skills → skill}/writing-plans/SKILL.md +3 -3
  23. package/dist/template/.opencode/{skills → skill}/writing-skills/SKILL.md +101 -41
  24. package/package.json +1 -1
  25. package/dist/template/.opencode/plugin/superpowers.ts +0 -271
  26. package/dist/template/.opencode/superpowers/.claude/settings.local.json +0 -141
  27. package/dist/template/.opencode/superpowers/.claude-plugin/marketplace.json +0 -20
  28. package/dist/template/.opencode/superpowers/.claude-plugin/plugin.json +0 -13
  29. package/dist/template/.opencode/superpowers/.codex/INSTALL.md +0 -35
  30. package/dist/template/.opencode/superpowers/.codex/superpowers-bootstrap.md +0 -33
  31. package/dist/template/.opencode/superpowers/.codex/superpowers-codex +0 -267
  32. package/dist/template/.opencode/superpowers/.github/FUNDING.yml +0 -3
  33. package/dist/template/.opencode/superpowers/.opencode/INSTALL.md +0 -135
  34. package/dist/template/.opencode/superpowers/.opencode/plugin/superpowers.js +0 -215
  35. package/dist/template/.opencode/superpowers/LICENSE +0 -21
  36. package/dist/template/.opencode/superpowers/README.md +0 -165
  37. package/dist/template/.opencode/superpowers/RELEASE-NOTES.md +0 -493
  38. package/dist/template/.opencode/superpowers/agents/code-reviewer.md +0 -48
  39. package/dist/template/.opencode/superpowers/commands/brainstorm.md +0 -5
  40. package/dist/template/.opencode/superpowers/commands/execute-plan.md +0 -5
  41. package/dist/template/.opencode/superpowers/commands/write-plan.md +0 -5
  42. package/dist/template/.opencode/superpowers/docs/README.codex.md +0 -153
  43. package/dist/template/.opencode/superpowers/docs/README.opencode.md +0 -234
  44. package/dist/template/.opencode/superpowers/docs/plans/2025-11-22-opencode-support-design.md +0 -294
  45. package/dist/template/.opencode/superpowers/docs/plans/2025-11-22-opencode-support-implementation.md +0 -1095
  46. package/dist/template/.opencode/superpowers/hooks/hooks.json +0 -15
  47. package/dist/template/.opencode/superpowers/hooks/session-start.sh +0 -34
  48. package/dist/template/.opencode/superpowers/lib/skills-core.js +0 -208
  49. package/dist/template/.opencode/superpowers/tests/opencode/run-tests.sh +0 -165
  50. package/dist/template/.opencode/superpowers/tests/opencode/setup.sh +0 -73
  51. package/dist/template/.opencode/superpowers/tests/opencode/test-plugin-loading.sh +0 -81
  52. package/dist/template/.opencode/superpowers/tests/opencode/test-priority.sh +0 -198
  53. package/dist/template/.opencode/superpowers/tests/opencode/test-skills-core.sh +0 -440
  54. package/dist/template/.opencode/superpowers/tests/opencode/test-tools.sh +0 -104
  55. /package/dist/template/.opencode/{skills → skill}/condition-based-waiting/SKILL.md +0 -0
  56. /package/dist/template/.opencode/{skills → skill}/condition-based-waiting/example.ts +0 -0
  57. /package/dist/template/.opencode/{skills → skill}/defense-in-depth/SKILL.md +0 -0
  58. /package/dist/template/.opencode/{skills → skill}/dispatching-parallel-agents/SKILL.md +0 -0
  59. /package/dist/template/.opencode/{skills → skill}/finishing-a-development-branch/SKILL.md +0 -0
  60. /package/dist/template/.opencode/{skills → skill}/gemini-large-context/SKILL.md +0 -0
  61. /package/dist/template/.opencode/{skills → skill}/receiving-code-review/SKILL.md +0 -0
  62. /package/dist/template/.opencode/{skills/requesting-code-review/code-reviewer.md → skill/requesting-code-review/review.md} +0 -0
  63. /package/dist/template/.opencode/{skills → skill}/root-cause-tracing/SKILL.md +0 -0
  64. /package/dist/template/.opencode/{skills → skill}/root-cause-tracing/find-polluter.sh +0 -0
  65. /package/dist/template/.opencode/{skills → skill}/sharing-skills/SKILL.md +0 -0
  66. /package/dist/template/.opencode/{skills → skill}/systematic-debugging/CREATION-LOG.md +0 -0
  67. /package/dist/template/.opencode/{skills → skill}/systematic-debugging/test-academic.md +0 -0
  68. /package/dist/template/.opencode/{skills → skill}/systematic-debugging/test-pressure-1.md +0 -0
  69. /package/dist/template/.opencode/{skills → skill}/systematic-debugging/test-pressure-2.md +0 -0
  70. /package/dist/template/.opencode/{skills → skill}/systematic-debugging/test-pressure-3.md +0 -0
  71. /package/dist/template/.opencode/{skills → skill}/test-driven-development/SKILL.md +0 -0
  72. /package/dist/template/.opencode/{skills → skill}/testing-anti-patterns/SKILL.md +0 -0
  73. /package/dist/template/.opencode/{skills → skill}/testing-skills-with-subagents/examples/CLAUDE_MD_TESTING.md +0 -0
  74. /package/dist/template/.opencode/{skills → skill}/using-git-worktrees/SKILL.md +0 -0
  75. /package/dist/template/.opencode/{skills → skill}/using-superpowers/SKILL.md +0 -0
  76. /package/dist/template/.opencode/{skills → skill}/verification-before-completion/SKILL.md +0 -0
  77. /package/dist/template/.opencode/{skills → skill}/writing-skills/anthropic-best-practices.md +0 -0
  78. /package/dist/template/.opencode/{skills → skill}/writing-skills/graphviz-conventions.dot +0 -0
  79. /package/dist/template/.opencode/{skills → skill}/writing-skills/persuasion-principles.md +0 -0
@@ -1,1095 +0,0 @@
1
- # OpenCode Support Implementation Plan
2
-
3
- > **For Claude:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task.
4
-
5
- **Goal:** Add full superpowers support for OpenCode.ai with a native JavaScript plugin that shares core functionality with the existing Codex implementation.
6
-
7
- **Architecture:** Extract common skill discovery/parsing logic into `lib/skills-core.js`, refactor Codex to use it, then build OpenCode plugin using their native plugin API with custom tools and session hooks.
8
-
9
- **Tech Stack:** Node.js, JavaScript, OpenCode Plugin API, Git worktrees
10
-
11
- ---
12
-
13
- ## Phase 1: Create Shared Core Module
14
-
15
- ### Task 1: Extract Frontmatter Parsing
16
-
17
- **Files:**
18
- - Create: `lib/skills-core.js`
19
- - Reference: `.codex/superpowers-codex` (lines 40-74)
20
-
21
- **Step 1: Create lib/skills-core.js with extractFrontmatter function**
22
-
23
- ```javascript
24
- #!/usr/bin/env node
25
-
26
- const fs = require('fs');
27
- const path = require('path');
28
-
29
- /**
30
- * Extract YAML frontmatter from a skill file.
31
- * Current format:
32
- * ---
33
- * name: skill-name
34
- * description: Use when [condition] - [what it does]
35
- * ---
36
- *
37
- * @param {string} filePath - Path to SKILL.md file
38
- * @returns {{name: string, description: string}}
39
- */
40
- function extractFrontmatter(filePath) {
41
- try {
42
- const content = fs.readFileSync(filePath, 'utf8');
43
- const lines = content.split('\n');
44
-
45
- let inFrontmatter = false;
46
- let name = '';
47
- let description = '';
48
-
49
- for (const line of lines) {
50
- if (line.trim() === '---') {
51
- if (inFrontmatter) break;
52
- inFrontmatter = true;
53
- continue;
54
- }
55
-
56
- if (inFrontmatter) {
57
- const match = line.match(/^(\w+):\s*(.*)$/);
58
- if (match) {
59
- const [, key, value] = match;
60
- switch (key) {
61
- case 'name':
62
- name = value.trim();
63
- break;
64
- case 'description':
65
- description = value.trim();
66
- break;
67
- }
68
- }
69
- }
70
- }
71
-
72
- return { name, description };
73
- } catch (error) {
74
- return { name: '', description: '' };
75
- }
76
- }
77
-
78
- module.exports = {
79
- extractFrontmatter
80
- };
81
- ```
82
-
83
- **Step 2: Verify file was created**
84
-
85
- Run: `ls -l lib/skills-core.js`
86
- Expected: File exists
87
-
88
- **Step 3: Commit**
89
-
90
- ```bash
91
- git add lib/skills-core.js
92
- git commit -m "feat: create shared skills core module with frontmatter parser"
93
- ```
94
-
95
- ---
96
-
97
- ### Task 2: Extract Skill Discovery Logic
98
-
99
- **Files:**
100
- - Modify: `lib/skills-core.js`
101
- - Reference: `.codex/superpowers-codex` (lines 97-136)
102
-
103
- **Step 1: Add findSkillsInDir function to skills-core.js**
104
-
105
- Add before `module.exports`:
106
-
107
- ```javascript
108
- /**
109
- * Find all SKILL.md files in a directory recursively.
110
- *
111
- * @param {string} dir - Directory to search
112
- * @param {string} sourceType - 'personal' or 'superpowers' for namespacing
113
- * @param {number} maxDepth - Maximum recursion depth (default: 3)
114
- * @returns {Array<{path: string, name: string, description: string, sourceType: string}>}
115
- */
116
- function findSkillsInDir(dir, sourceType, maxDepth = 3) {
117
- const skills = [];
118
-
119
- if (!fs.existsSync(dir)) return skills;
120
-
121
- function recurse(currentDir, depth) {
122
- if (depth > maxDepth) return;
123
-
124
- const entries = fs.readdirSync(currentDir, { withFileTypes: true });
125
-
126
- for (const entry of entries) {
127
- const fullPath = path.join(currentDir, entry.name);
128
-
129
- if (entry.isDirectory()) {
130
- // Check for SKILL.md in this directory
131
- const skillFile = path.join(fullPath, 'SKILL.md');
132
- if (fs.existsSync(skillFile)) {
133
- const { name, description } = extractFrontmatter(skillFile);
134
- skills.push({
135
- path: fullPath,
136
- skillFile: skillFile,
137
- name: name || entry.name,
138
- description: description || '',
139
- sourceType: sourceType
140
- });
141
- }
142
-
143
- // Recurse into subdirectories
144
- recurse(fullPath, depth + 1);
145
- }
146
- }
147
- }
148
-
149
- recurse(dir, 0);
150
- return skills;
151
- }
152
- ```
153
-
154
- **Step 2: Update module.exports**
155
-
156
- Replace the exports line with:
157
-
158
- ```javascript
159
- module.exports = {
160
- extractFrontmatter,
161
- findSkillsInDir
162
- };
163
- ```
164
-
165
- **Step 3: Verify syntax**
166
-
167
- Run: `node -c lib/skills-core.js`
168
- Expected: No output (success)
169
-
170
- **Step 4: Commit**
171
-
172
- ```bash
173
- git add lib/skills-core.js
174
- git commit -m "feat: add skill discovery function to core module"
175
- ```
176
-
177
- ---
178
-
179
- ### Task 3: Extract Skill Resolution Logic
180
-
181
- **Files:**
182
- - Modify: `lib/skills-core.js`
183
- - Reference: `.codex/superpowers-codex` (lines 212-280)
184
-
185
- **Step 1: Add resolveSkillPath function**
186
-
187
- Add before `module.exports`:
188
-
189
- ```javascript
190
- /**
191
- * Resolve a skill name to its file path, handling shadowing
192
- * (personal skills override superpowers skills).
193
- *
194
- * @param {string} skillName - Name like "superpowers:brainstorming" or "my-skill"
195
- * @param {string} superpowersDir - Path to superpowers skills directory
196
- * @param {string} personalDir - Path to personal skills directory
197
- * @returns {{skillFile: string, sourceType: string, skillPath: string} | null}
198
- */
199
- function resolveSkillPath(skillName, superpowersDir, personalDir) {
200
- // Strip superpowers: prefix if present
201
- const forceSuperpowers = skillName.startsWith('superpowers:');
202
- const actualSkillName = forceSuperpowers ? skillName.replace(/^superpowers:/, '') : skillName;
203
-
204
- // Try personal skills first (unless explicitly superpowers:)
205
- if (!forceSuperpowers && personalDir) {
206
- const personalPath = path.join(personalDir, actualSkillName);
207
- const personalSkillFile = path.join(personalPath, 'SKILL.md');
208
- if (fs.existsSync(personalSkillFile)) {
209
- return {
210
- skillFile: personalSkillFile,
211
- sourceType: 'personal',
212
- skillPath: actualSkillName
213
- };
214
- }
215
- }
216
-
217
- // Try superpowers skills
218
- if (superpowersDir) {
219
- const superpowersPath = path.join(superpowersDir, actualSkillName);
220
- const superpowersSkillFile = path.join(superpowersPath, 'SKILL.md');
221
- if (fs.existsSync(superpowersSkillFile)) {
222
- return {
223
- skillFile: superpowersSkillFile,
224
- sourceType: 'superpowers',
225
- skillPath: actualSkillName
226
- };
227
- }
228
- }
229
-
230
- return null;
231
- }
232
- ```
233
-
234
- **Step 2: Update module.exports**
235
-
236
- ```javascript
237
- module.exports = {
238
- extractFrontmatter,
239
- findSkillsInDir,
240
- resolveSkillPath
241
- };
242
- ```
243
-
244
- **Step 3: Verify syntax**
245
-
246
- Run: `node -c lib/skills-core.js`
247
- Expected: No output
248
-
249
- **Step 4: Commit**
250
-
251
- ```bash
252
- git add lib/skills-core.js
253
- git commit -m "feat: add skill path resolution with shadowing support"
254
- ```
255
-
256
- ---
257
-
258
- ### Task 4: Extract Update Check Logic
259
-
260
- **Files:**
261
- - Modify: `lib/skills-core.js`
262
- - Reference: `.codex/superpowers-codex` (lines 16-38)
263
-
264
- **Step 1: Add checkForUpdates function**
265
-
266
- Add at top after requires:
267
-
268
- ```javascript
269
- const { execSync } = require('child_process');
270
- ```
271
-
272
- Add before `module.exports`:
273
-
274
- ```javascript
275
- /**
276
- * Check if a git repository has updates available.
277
- *
278
- * @param {string} repoDir - Path to git repository
279
- * @returns {boolean} - True if updates are available
280
- */
281
- function checkForUpdates(repoDir) {
282
- try {
283
- // Quick check with 3 second timeout to avoid delays if network is down
284
- const output = execSync('git fetch origin && git status --porcelain=v1 --branch', {
285
- cwd: repoDir,
286
- timeout: 3000,
287
- encoding: 'utf8',
288
- stdio: 'pipe'
289
- });
290
-
291
- // Parse git status output to see if we're behind
292
- const statusLines = output.split('\n');
293
- for (const line of statusLines) {
294
- if (line.startsWith('## ') && line.includes('[behind ')) {
295
- return true; // We're behind remote
296
- }
297
- }
298
- return false; // Up to date
299
- } catch (error) {
300
- // Network down, git error, timeout, etc. - don't block bootstrap
301
- return false;
302
- }
303
- }
304
- ```
305
-
306
- **Step 2: Update module.exports**
307
-
308
- ```javascript
309
- module.exports = {
310
- extractFrontmatter,
311
- findSkillsInDir,
312
- resolveSkillPath,
313
- checkForUpdates
314
- };
315
- ```
316
-
317
- **Step 3: Verify syntax**
318
-
319
- Run: `node -c lib/skills-core.js`
320
- Expected: No output
321
-
322
- **Step 4: Commit**
323
-
324
- ```bash
325
- git add lib/skills-core.js
326
- git commit -m "feat: add git update checking to core module"
327
- ```
328
-
329
- ---
330
-
331
- ## Phase 2: Refactor Codex to Use Shared Core
332
-
333
- ### Task 5: Update Codex to Import Shared Core
334
-
335
- **Files:**
336
- - Modify: `.codex/superpowers-codex` (add import at top)
337
-
338
- **Step 1: Add import statement**
339
-
340
- After the existing requires at top of file (around line 6), add:
341
-
342
- ```javascript
343
- const skillsCore = require('../lib/skills-core');
344
- ```
345
-
346
- **Step 2: Verify syntax**
347
-
348
- Run: `node -c .codex/superpowers-codex`
349
- Expected: No output
350
-
351
- **Step 3: Commit**
352
-
353
- ```bash
354
- git add .codex/superpowers-codex
355
- git commit -m "refactor: import shared skills core in codex"
356
- ```
357
-
358
- ---
359
-
360
- ### Task 6: Replace extractFrontmatter with Core Version
361
-
362
- **Files:**
363
- - Modify: `.codex/superpowers-codex` (lines 40-74)
364
-
365
- **Step 1: Remove local extractFrontmatter function**
366
-
367
- Delete lines 40-74 (the entire extractFrontmatter function definition).
368
-
369
- **Step 2: Update all extractFrontmatter calls**
370
-
371
- Find and replace all calls from `extractFrontmatter(` to `skillsCore.extractFrontmatter(`
372
-
373
- Affected lines approximately: 90, 310
374
-
375
- **Step 3: Verify script still works**
376
-
377
- Run: `.codex/superpowers-codex find-skills | head -20`
378
- Expected: Shows list of skills
379
-
380
- **Step 4: Commit**
381
-
382
- ```bash
383
- git add .codex/superpowers-codex
384
- git commit -m "refactor: use shared extractFrontmatter in codex"
385
- ```
386
-
387
- ---
388
-
389
- ### Task 7: Replace findSkillsInDir with Core Version
390
-
391
- **Files:**
392
- - Modify: `.codex/superpowers-codex` (lines 97-136, approximately)
393
-
394
- **Step 1: Remove local findSkillsInDir function**
395
-
396
- Delete the entire `findSkillsInDir` function definition (approximately lines 97-136).
397
-
398
- **Step 2: Update all findSkillsInDir calls**
399
-
400
- Replace calls from `findSkillsInDir(` to `skillsCore.findSkillsInDir(`
401
-
402
- **Step 3: Verify script still works**
403
-
404
- Run: `.codex/superpowers-codex find-skills | head -20`
405
- Expected: Shows list of skills
406
-
407
- **Step 4: Commit**
408
-
409
- ```bash
410
- git add .codex/superpowers-codex
411
- git commit -m "refactor: use shared findSkillsInDir in codex"
412
- ```
413
-
414
- ---
415
-
416
- ### Task 8: Replace checkForUpdates with Core Version
417
-
418
- **Files:**
419
- - Modify: `.codex/superpowers-codex` (lines 16-38, approximately)
420
-
421
- **Step 1: Remove local checkForUpdates function**
422
-
423
- Delete the entire `checkForUpdates` function definition.
424
-
425
- **Step 2: Update all checkForUpdates calls**
426
-
427
- Replace calls from `checkForUpdates(` to `skillsCore.checkForUpdates(`
428
-
429
- **Step 3: Verify script still works**
430
-
431
- Run: `.codex/superpowers-codex bootstrap | head -50`
432
- Expected: Shows bootstrap content
433
-
434
- **Step 4: Commit**
435
-
436
- ```bash
437
- git add .codex/superpowers-codex
438
- git commit -m "refactor: use shared checkForUpdates in codex"
439
- ```
440
-
441
- ---
442
-
443
- ## Phase 3: Build OpenCode Plugin
444
-
445
- ### Task 9: Create OpenCode Plugin Directory Structure
446
-
447
- **Files:**
448
- - Create: `.opencode/plugin/superpowers.js`
449
-
450
- **Step 1: Create directory**
451
-
452
- Run: `mkdir -p .opencode/plugin`
453
-
454
- **Step 2: Create basic plugin file**
455
-
456
- ```javascript
457
- #!/usr/bin/env node
458
-
459
- /**
460
- * Superpowers plugin for OpenCode.ai
461
- *
462
- * Provides custom tools for loading and discovering skills,
463
- * with automatic bootstrap on session start.
464
- */
465
-
466
- const skillsCore = require('../../lib/skills-core');
467
- const path = require('path');
468
- const fs = require('fs');
469
- const os = require('os');
470
-
471
- const homeDir = os.homedir();
472
- const superpowersSkillsDir = path.join(homeDir, '.config/opencode/superpowers/skills');
473
- const personalSkillsDir = path.join(homeDir, '.config/opencode/skills');
474
-
475
- /**
476
- * OpenCode plugin entry point
477
- */
478
- export const SuperpowersPlugin = async ({ project, client, $, directory, worktree }) => {
479
- return {
480
- // Custom tools and hooks will go here
481
- };
482
- };
483
- ```
484
-
485
- **Step 3: Verify file was created**
486
-
487
- Run: `ls -l .opencode/plugin/superpowers.js`
488
- Expected: File exists
489
-
490
- **Step 4: Commit**
491
-
492
- ```bash
493
- git add .opencode/plugin/superpowers.js
494
- git commit -m "feat: create opencode plugin scaffold"
495
- ```
496
-
497
- ---
498
-
499
- ### Task 10: Implement use_skill Tool
500
-
501
- **Files:**
502
- - Modify: `.opencode/plugin/superpowers.js`
503
-
504
- **Step 1: Add use_skill tool implementation**
505
-
506
- Replace the plugin return statement with:
507
-
508
- ```javascript
509
- export const SuperpowersPlugin = async ({ project, client, $, directory, worktree }) => {
510
- // Import zod for schema validation
511
- const { z } = await import('zod');
512
-
513
- return {
514
- tools: [
515
- {
516
- name: 'use_skill',
517
- description: 'Load and read a specific skill to guide your work. Skills contain proven workflows, mandatory processes, and expert techniques.',
518
- schema: z.object({
519
- skill_name: z.string().describe('Name of the skill to load (e.g., "superpowers:brainstorming" or "my-custom-skill")')
520
- }),
521
- execute: async ({ skill_name }) => {
522
- // Resolve skill path (handles shadowing: personal > superpowers)
523
- const resolved = skillsCore.resolveSkillPath(
524
- skill_name,
525
- superpowersSkillsDir,
526
- personalSkillsDir
527
- );
528
-
529
- if (!resolved) {
530
- return `Error: Skill "${skill_name}" not found.\n\nRun find_skills to see available skills.`;
531
- }
532
-
533
- // Read skill content
534
- const fullContent = fs.readFileSync(resolved.skillFile, 'utf8');
535
- const { name, description } = skillsCore.extractFrontmatter(resolved.skillFile);
536
-
537
- // Extract content after frontmatter
538
- const lines = fullContent.split('\n');
539
- let inFrontmatter = false;
540
- let frontmatterEnded = false;
541
- const contentLines = [];
542
-
543
- for (const line of lines) {
544
- if (line.trim() === '---') {
545
- if (inFrontmatter) {
546
- frontmatterEnded = true;
547
- continue;
548
- }
549
- inFrontmatter = true;
550
- continue;
551
- }
552
-
553
- if (frontmatterEnded || !inFrontmatter) {
554
- contentLines.push(line);
555
- }
556
- }
557
-
558
- const content = contentLines.join('\n').trim();
559
- const skillDirectory = path.dirname(resolved.skillFile);
560
-
561
- // Format output similar to Claude Code's Skill tool
562
- return `# ${name || skill_name}
563
- # ${description || ''}
564
- # Supporting tools and docs are in ${skillDirectory}
565
- # ============================================
566
-
567
- ${content}`;
568
- }
569
- }
570
- ]
571
- };
572
- };
573
- ```
574
-
575
- **Step 2: Verify syntax**
576
-
577
- Run: `node -c .opencode/plugin/superpowers.js`
578
- Expected: No output
579
-
580
- **Step 3: Commit**
581
-
582
- ```bash
583
- git add .opencode/plugin/superpowers.js
584
- git commit -m "feat: implement use_skill tool for opencode"
585
- ```
586
-
587
- ---
588
-
589
- ### Task 11: Implement find_skills Tool
590
-
591
- **Files:**
592
- - Modify: `.opencode/plugin/superpowers.js`
593
-
594
- **Step 1: Add find_skills tool to tools array**
595
-
596
- Add after the use_skill tool definition, before closing the tools array:
597
-
598
- ```javascript
599
- {
600
- name: 'find_skills',
601
- description: 'List all available skills in the superpowers and personal skill libraries.',
602
- schema: z.object({}),
603
- execute: async () => {
604
- // Find skills in both directories
605
- const superpowersSkills = skillsCore.findSkillsInDir(
606
- superpowersSkillsDir,
607
- 'superpowers',
608
- 3
609
- );
610
- const personalSkills = skillsCore.findSkillsInDir(
611
- personalSkillsDir,
612
- 'personal',
613
- 3
614
- );
615
-
616
- // Combine and format skills list
617
- const allSkills = [...personalSkills, ...superpowersSkills];
618
-
619
- if (allSkills.length === 0) {
620
- return 'No skills found. Install superpowers skills to ~/.config/opencode/superpowers/skills/';
621
- }
622
-
623
- let output = 'Available skills:\n\n';
624
-
625
- for (const skill of allSkills) {
626
- const namespace = skill.sourceType === 'personal' ? '' : 'superpowers:';
627
- const skillName = skill.name || path.basename(skill.path);
628
-
629
- output += `${namespace}${skillName}\n`;
630
- if (skill.description) {
631
- output += ` ${skill.description}\n`;
632
- }
633
- output += ` Directory: ${skill.path}\n\n`;
634
- }
635
-
636
- return output;
637
- }
638
- }
639
- ```
640
-
641
- **Step 2: Verify syntax**
642
-
643
- Run: `node -c .opencode/plugin/superpowers.js`
644
- Expected: No output
645
-
646
- **Step 3: Commit**
647
-
648
- ```bash
649
- git add .opencode/plugin/superpowers.js
650
- git commit -m "feat: implement find_skills tool for opencode"
651
- ```
652
-
653
- ---
654
-
655
- ### Task 12: Implement Session Start Hook
656
-
657
- **Files:**
658
- - Modify: `.opencode/plugin/superpowers.js`
659
-
660
- **Step 1: Add session.started hook**
661
-
662
- After the tools array, add:
663
-
664
- ```javascript
665
- 'session.started': async () => {
666
- // Read using-superpowers skill content
667
- const usingSuperpowersPath = skillsCore.resolveSkillPath(
668
- 'using-superpowers',
669
- superpowersSkillsDir,
670
- personalSkillsDir
671
- );
672
-
673
- let usingSuperpowersContent = '';
674
- if (usingSuperpowersPath) {
675
- const fullContent = fs.readFileSync(usingSuperpowersPath.skillFile, 'utf8');
676
- // Strip frontmatter
677
- const lines = fullContent.split('\n');
678
- let inFrontmatter = false;
679
- let frontmatterEnded = false;
680
- const contentLines = [];
681
-
682
- for (const line of lines) {
683
- if (line.trim() === '---') {
684
- if (inFrontmatter) {
685
- frontmatterEnded = true;
686
- continue;
687
- }
688
- inFrontmatter = true;
689
- continue;
690
- }
691
-
692
- if (frontmatterEnded || !inFrontmatter) {
693
- contentLines.push(line);
694
- }
695
- }
696
-
697
- usingSuperpowersContent = contentLines.join('\n').trim();
698
- }
699
-
700
- // Tool mapping instructions
701
- const toolMapping = `
702
- **Tool Mapping for OpenCode:**
703
- When skills reference tools you don't have, substitute OpenCode equivalents:
704
- - \`TodoWrite\` → \`update_plan\` (your planning/task tracking tool)
705
- - \`Task\` tool with subagents → Use OpenCode's subagent system (@mention syntax or automatic dispatch)
706
- - \`Skill\` tool → \`use_skill\` custom tool (already available)
707
- - \`Read\`, \`Write\`, \`Edit\`, \`Bash\` → Use your native tools
708
-
709
- **Skill directories contain supporting files:**
710
- - Scripts you can run with bash tool
711
- - Additional documentation you can read
712
- - Utilities and helpers specific to that skill
713
-
714
- **Skills naming:**
715
- - Superpowers skills: \`superpowers:skill-name\` (from ~/.config/opencode/superpowers/skills/)
716
- - Personal skills: \`skill-name\` (from ~/.config/opencode/skills/)
717
- - Personal skills override superpowers skills when names match
718
- `;
719
-
720
- // Check for updates (non-blocking)
721
- const hasUpdates = skillsCore.checkForUpdates(
722
- path.join(homeDir, '.config/opencode/superpowers')
723
- );
724
-
725
- const updateNotice = hasUpdates ?
726
- '\n\n⚠️ **Updates available!** Run `cd ~/.config/opencode/superpowers && git pull` to update superpowers.' :
727
- '';
728
-
729
- // Return context to inject into session
730
- return {
731
- context: `<EXTREMELY_IMPORTANT>
732
- You have superpowers.
733
-
734
- **Below is the full content of your 'superpowers:using-superpowers' skill - your introduction to using skills. For all other skills, use the 'use_skill' tool:**
735
-
736
- ${usingSuperpowersContent}
737
-
738
- ${toolMapping}${updateNotice}
739
- </EXTREMELY_IMPORTANT>`
740
- };
741
- }
742
- ```
743
-
744
- **Step 2: Verify syntax**
745
-
746
- Run: `node -c .opencode/plugin/superpowers.js`
747
- Expected: No output
748
-
749
- **Step 3: Commit**
750
-
751
- ```bash
752
- git add .opencode/plugin/superpowers.js
753
- git commit -m "feat: implement session.started hook for opencode"
754
- ```
755
-
756
- ---
757
-
758
- ## Phase 4: Documentation
759
-
760
- ### Task 13: Create OpenCode Installation Guide
761
-
762
- **Files:**
763
- - Create: `.opencode/INSTALL.md`
764
-
765
- **Step 1: Create installation guide**
766
-
767
- ```markdown
768
- # Installing Superpowers for OpenCode
769
-
770
- ## Prerequisites
771
-
772
- - [OpenCode.ai](https://opencode.ai) installed
773
- - Node.js installed
774
- - Git installed
775
-
776
- ## Installation Steps
777
-
778
- ### 1. Install Superpowers Skills
779
-
780
- ```bash
781
- # Clone superpowers skills to OpenCode config directory
782
- mkdir -p ~/.config/opencode/superpowers
783
- git clone https://github.com/obra/superpowers.git ~/.config/opencode/superpowers
784
- ```
785
-
786
- ### 2. Install the Plugin
787
-
788
- The plugin is included in the superpowers repository you just cloned.
789
-
790
- OpenCode will automatically discover it from:
791
- - `~/.config/opencode/superpowers/.opencode/plugin/superpowers.js`
792
-
793
- Or you can link it to the project-local plugin directory:
794
-
795
- ```bash
796
- # In your OpenCode project
797
- mkdir -p .opencode/plugin
798
- ln -s ~/.config/opencode/superpowers/.opencode/plugin/superpowers.js .opencode/plugin/superpowers.js
799
- ```
800
-
801
- ### 3. Restart OpenCode
802
-
803
- Restart OpenCode to load the plugin. On the next session, you should see:
804
-
805
- ```
806
- You have superpowers.
807
- ```
808
-
809
- ## Usage
810
-
811
- ### Finding Skills
812
-
813
- Use the `find_skills` tool to list all available skills:
814
-
815
- ```
816
- use find_skills tool
817
- ```
818
-
819
- ### Loading a Skill
820
-
821
- Use the `use_skill` tool to load a specific skill:
822
-
823
- ```
824
- use use_skill tool with skill_name: "superpowers:brainstorming"
825
- ```
826
-
827
- ### Personal Skills
828
-
829
- Create your own skills in `~/.config/opencode/skills/`:
830
-
831
- ```bash
832
- mkdir -p ~/.config/opencode/skills/my-skill
833
- ```
834
-
835
- Create `~/.config/opencode/skills/my-skill/SKILL.md`:
836
-
837
- ```markdown
838
- ---
839
- name: my-skill
840
- description: Use when [condition] - [what it does]
841
- ---
842
-
843
- # My Skill
844
-
845
- [Your skill content here]
846
- ```
847
-
848
- Personal skills override superpowers skills with the same name.
849
-
850
- ## Updating
851
-
852
- ```bash
853
- cd ~/.config/opencode/superpowers
854
- git pull
855
- ```
856
-
857
- ## Troubleshooting
858
-
859
- ### Plugin not loading
860
-
861
- 1. Check plugin file exists: `ls ~/.config/opencode/superpowers/.opencode/plugin/superpowers.js`
862
- 2. Check OpenCode logs for errors
863
- 3. Verify Node.js is installed: `node --version`
864
-
865
- ### Skills not found
866
-
867
- 1. Verify skills directory exists: `ls ~/.config/opencode/superpowers/skills`
868
- 2. Use `find_skills` tool to see what's discovered
869
- 3. Check file structure: each skill should have a `SKILL.md` file
870
-
871
- ### Tool mapping issues
872
-
873
- When a skill references a Claude Code tool you don't have:
874
- - `TodoWrite` → use `update_plan`
875
- - `Task` with subagents → use `@mention` syntax to invoke OpenCode subagents
876
- - `Skill` → use `use_skill` tool
877
- - File operations → use your native tools
878
-
879
- ## Getting Help
880
-
881
- - Report issues: https://github.com/obra/superpowers/issues
882
- - Documentation: https://github.com/obra/superpowers
883
- ```
884
-
885
- **Step 2: Verify file created**
886
-
887
- Run: `ls -l .opencode/INSTALL.md`
888
- Expected: File exists
889
-
890
- **Step 3: Commit**
891
-
892
- ```bash
893
- git add .opencode/INSTALL.md
894
- git commit -m "docs: add opencode installation guide"
895
- ```
896
-
897
- ---
898
-
899
- ### Task 14: Update Main README
900
-
901
- **Files:**
902
- - Modify: `README.md`
903
-
904
- **Step 1: Add OpenCode section**
905
-
906
- Find the section about supported platforms (search for "Codex" in the file), and add after it:
907
-
908
- ```markdown
909
- ### OpenCode
910
-
911
- Superpowers works with [OpenCode.ai](https://opencode.ai) through a native JavaScript plugin.
912
-
913
- **Installation:** See [.opencode/INSTALL.md](.opencode/INSTALL.md)
914
-
915
- **Features:**
916
- - Custom tools: `use_skill` and `find_skills`
917
- - Automatic session bootstrap
918
- - Personal skills with shadowing
919
- - Supporting files and scripts access
920
- ```
921
-
922
- **Step 2: Verify formatting**
923
-
924
- Run: `grep -A 10 "### OpenCode" README.md`
925
- Expected: Shows the section you added
926
-
927
- **Step 3: Commit**
928
-
929
- ```bash
930
- git add README.md
931
- git commit -m "docs: add opencode support to readme"
932
- ```
933
-
934
- ---
935
-
936
- ### Task 15: Update Release Notes
937
-
938
- **Files:**
939
- - Modify: `RELEASE-NOTES.md`
940
-
941
- **Step 1: Add entry for OpenCode support**
942
-
943
- At the top of the file (after the header), add:
944
-
945
- ```markdown
946
- ## [Unreleased]
947
-
948
- ### Added
949
-
950
- - **OpenCode Support**: Native JavaScript plugin for OpenCode.ai
951
- - Custom tools: `use_skill` and `find_skills`
952
- - Automatic session bootstrap with tool mapping instructions
953
- - Shared core module (`lib/skills-core.js`) for code reuse
954
- - Installation guide in `.opencode/INSTALL.md`
955
-
956
- ### Changed
957
-
958
- - **Refactored Codex Implementation**: Now uses shared `lib/skills-core.js` module
959
- - Eliminates code duplication between Codex and OpenCode
960
- - Single source of truth for skill discovery and parsing
961
-
962
- ---
963
-
964
- ```
965
-
966
- **Step 2: Verify formatting**
967
-
968
- Run: `head -30 RELEASE-NOTES.md`
969
- Expected: Shows your new section
970
-
971
- **Step 3: Commit**
972
-
973
- ```bash
974
- git add RELEASE-NOTES.md
975
- git commit -m "docs: add opencode support to release notes"
976
- ```
977
-
978
- ---
979
-
980
- ## Phase 5: Final Verification
981
-
982
- ### Task 16: Test Codex Still Works
983
-
984
- **Files:**
985
- - Test: `.codex/superpowers-codex`
986
-
987
- **Step 1: Test find-skills command**
988
-
989
- Run: `.codex/superpowers-codex find-skills | head -20`
990
- Expected: Shows list of skills with names and descriptions
991
-
992
- **Step 2: Test use-skill command**
993
-
994
- Run: `.codex/superpowers-codex use-skill superpowers:brainstorming | head -20`
995
- Expected: Shows brainstorming skill content
996
-
997
- **Step 3: Test bootstrap command**
998
-
999
- Run: `.codex/superpowers-codex bootstrap | head -30`
1000
- Expected: Shows bootstrap content with instructions
1001
-
1002
- **Step 4: If all tests pass, record success**
1003
-
1004
- No commit needed - this is verification only.
1005
-
1006
- ---
1007
-
1008
- ### Task 17: Verify File Structure
1009
-
1010
- **Files:**
1011
- - Check: All new files exist
1012
-
1013
- **Step 1: Verify all files created**
1014
-
1015
- Run:
1016
- ```bash
1017
- ls -l lib/skills-core.js
1018
- ls -l .opencode/plugin/superpowers.js
1019
- ls -l .opencode/INSTALL.md
1020
- ```
1021
-
1022
- Expected: All files exist
1023
-
1024
- **Step 2: Verify directory structure**
1025
-
1026
- Run: `tree -L 2 .opencode/` (or `find .opencode -type f` if tree not available)
1027
- Expected:
1028
- ```
1029
- .opencode/
1030
- ├── INSTALL.md
1031
- └── plugin/
1032
- └── superpowers.js
1033
- ```
1034
-
1035
- **Step 3: If structure correct, proceed**
1036
-
1037
- No commit needed - this is verification only.
1038
-
1039
- ---
1040
-
1041
- ### Task 18: Final Commit and Summary
1042
-
1043
- **Files:**
1044
- - Check: `git status`
1045
-
1046
- **Step 1: Check git status**
1047
-
1048
- Run: `git status`
1049
- Expected: Working tree clean, all changes committed
1050
-
1051
- **Step 2: Review commit log**
1052
-
1053
- Run: `git log --oneline -20`
1054
- Expected: Shows all commits from this implementation
1055
-
1056
- **Step 3: Create summary document**
1057
-
1058
- Create a completion summary showing:
1059
- - Total commits made
1060
- - Files created: `lib/skills-core.js`, `.opencode/plugin/superpowers.js`, `.opencode/INSTALL.md`
1061
- - Files modified: `.codex/superpowers-codex`, `README.md`, `RELEASE-NOTES.md`
1062
- - Testing performed: Codex commands verified
1063
- - Ready for: Testing with actual OpenCode installation
1064
-
1065
- **Step 4: Report completion**
1066
-
1067
- Present summary to user and offer to:
1068
- 1. Push to remote
1069
- 2. Create pull request
1070
- 3. Test with real OpenCode installation (requires OpenCode installed)
1071
-
1072
- ---
1073
-
1074
- ## Testing Guide (Manual - Requires OpenCode)
1075
-
1076
- These steps require OpenCode to be installed and are not part of the automated implementation:
1077
-
1078
- 1. **Install skills**: Follow `.opencode/INSTALL.md`
1079
- 2. **Start OpenCode session**: Verify bootstrap appears
1080
- 3. **Test find_skills**: Should list all available skills
1081
- 4. **Test use_skill**: Load a skill and verify content appears
1082
- 5. **Test supporting files**: Verify skill directory paths are accessible
1083
- 6. **Test personal skills**: Create a personal skill and verify it shadows core
1084
- 7. **Test tool mapping**: Verify TodoWrite → update_plan mapping works
1085
-
1086
- ## Success Criteria
1087
-
1088
- - [ ] `lib/skills-core.js` created with all core functions
1089
- - [ ] `.codex/superpowers-codex` refactored to use shared core
1090
- - [ ] Codex commands still work (find-skills, use-skill, bootstrap)
1091
- - [ ] `.opencode/plugin/superpowers.js` created with tools and hooks
1092
- - [ ] Installation guide created
1093
- - [ ] README and RELEASE-NOTES updated
1094
- - [ ] All changes committed
1095
- - [ ] Working tree clean