opencode-cc10x 6.0.21

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 (45) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +283 -0
  3. package/bun.lock +20 -0
  4. package/dist/agents.d.ts +3 -0
  5. package/dist/agents.d.ts.map +1 -0
  6. package/dist/agents.js +483 -0
  7. package/dist/agents.js.map +1 -0
  8. package/dist/compatibility-layer.d.ts +18 -0
  9. package/dist/compatibility-layer.d.ts.map +1 -0
  10. package/dist/compatibility-layer.js +150 -0
  11. package/dist/compatibility-layer.js.map +1 -0
  12. package/dist/index.d.ts +4 -0
  13. package/dist/index.d.ts.map +1 -0
  14. package/dist/index.js +1459 -0
  15. package/dist/index.js.map +1 -0
  16. package/dist/intent-detection.d.ts +14 -0
  17. package/dist/intent-detection.d.ts.map +1 -0
  18. package/dist/intent-detection.js +121 -0
  19. package/dist/intent-detection.js.map +1 -0
  20. package/dist/memory.d.ts +41 -0
  21. package/dist/memory.d.ts.map +1 -0
  22. package/dist/memory.js +330 -0
  23. package/dist/memory.js.map +1 -0
  24. package/dist/router.d.ts +15 -0
  25. package/dist/router.d.ts.map +1 -0
  26. package/dist/router.js +208 -0
  27. package/dist/router.js.map +1 -0
  28. package/dist/skills.d.ts +3 -0
  29. package/dist/skills.d.ts.map +1 -0
  30. package/dist/skills.js +2790 -0
  31. package/dist/skills.js.map +1 -0
  32. package/dist/task-orchestrator.d.ts +46 -0
  33. package/dist/task-orchestrator.d.ts.map +1 -0
  34. package/dist/task-orchestrator.js +262 -0
  35. package/dist/task-orchestrator.js.map +1 -0
  36. package/dist/workflow-executor.d.ts +29 -0
  37. package/dist/workflow-executor.d.ts.map +1 -0
  38. package/dist/workflow-executor.js +414 -0
  39. package/dist/workflow-executor.js.map +1 -0
  40. package/install-from-github.mjs +152 -0
  41. package/install-from-github.sh +106 -0
  42. package/install.sh +295 -0
  43. package/opencode.json +118 -0
  44. package/package.json +41 -0
  45. package/tsconfig.json +23 -0
package/dist/agents.js ADDED
@@ -0,0 +1,483 @@
1
+ export const agentDefinitions = [
2
+ {
3
+ name: 'component-builder',
4
+ description: 'Builds features using TDD cycle (RED → GREEN → REFACTOR). Used by cc10x router for BUILD workflows.',
5
+ mode: 'subagent',
6
+ model: 'inherit', // Use primary agent's model
7
+ temperature: 0.3,
8
+ color: 'green',
9
+ tools: {
10
+ write: true,
11
+ edit: true,
12
+ bash: true,
13
+ grep: true,
14
+ glob: true,
15
+ skill: true,
16
+ lsp: true,
17
+ askUserQuestion: true,
18
+ webfetch: false
19
+ },
20
+ prompt: `# Component Builder (TDD)
21
+
22
+ **Core:** Build features using TDD cycle (RED → GREEN → REFACTOR). No code without failing test first.
23
+
24
+ ## Memory First
25
+ Always load memory at start:
26
+ 1. Create directory: Bash(command="mkdir -p .claude/cc10x")
27
+ 2. Read memory files: activeContext.md, patterns.md, progress.md
28
+
29
+ ## SKILL_HINTS
30
+ If your prompt includes SKILL_HINTS, invoke each skill via Skill(skill="{name}") after memory load.
31
+
32
+ ## GATE: Plan File Check
33
+ Look for "Plan File:" in your prompt's Task Context section:
34
+ - If Plan File exists: Read it and follow specific instructions
35
+ - If Plan File is "None": Proceed with requirements from prompt
36
+
37
+ ## Process
38
+ 1. **Understand** - Read relevant files, clarify requirements, define acceptance criteria
39
+ 2. **RED** - Write failing test (must exit 1)
40
+ 3. **GREEN** - Minimal code to pass (must exit 0)
41
+ 4. **REFACTOR** - Clean up, keep tests green
42
+ 5. **Verify** - All tests pass, functionality works
43
+ 6. **Update memory** - Use Edit tool (permission-free) to update .claude/cc10x/*.md
44
+
45
+ ## Pre-Implementation Checklist
46
+ - API: CORS? Auth middleware? Input validation? Rate limiting?
47
+ - UI: Loading states? Error boundaries? Accessibility?
48
+ - DB: Migrations? N+1 queries? Transactions?
49
+ - All: Edge cases listed? Error handling planned?
50
+
51
+ ## Output Requirements
52
+ - TDD Evidence: RED phase (exit 1) and GREEN phase (exit 0) with exact commands
53
+ - Dev Journal: What was built, key decisions, assumptions
54
+ - Changes Made: Files modified, tests added
55
+ - Confidence level based on assumption certainty
56
+ - ### Memory Notes section for workflow persistence
57
+
58
+ ## Router Contract
59
+ Follow the exact YAML contract format with STATUS, CONFIDENCE, TDD_RED_EXIT, TDD_GREEN_EXIT, CRITICAL_ISSUES, BLOCKING, REQUIRES_REMEDIATION, MEMORY_NOTES.
60
+ `,
61
+ permission: {
62
+ edit: 'allow',
63
+ write: 'allow',
64
+ bash: {
65
+ '*': 'ask',
66
+ 'git status': 'allow',
67
+ 'git diff': 'allow',
68
+ 'git log': 'allow',
69
+ 'npm test': 'allow',
70
+ 'yarn test': 'allow',
71
+ 'bun test': 'allow',
72
+ 'mkdir -p .claude/cc10x': 'allow'
73
+ }
74
+ }
75
+ },
76
+ {
77
+ name: 'bug-investigator',
78
+ description: 'Investigates bugs with log-first approach. Used by cc10x router for DEBUG workflows.',
79
+ mode: 'subagent',
80
+ model: 'inherit',
81
+ temperature: 0.2,
82
+ color: 'orange',
83
+ tools: {
84
+ write: false,
85
+ edit: false,
86
+ bash: true,
87
+ grep: true,
88
+ glob: true,
89
+ skill: true,
90
+ lsp: true,
91
+ askUserQuestion: true,
92
+ webfetch: true
93
+ },
94
+ prompt: `# Bug Investigator (LOG FIRST)
95
+
96
+ **Iron Law:** Never fix without evidence. LOG FIRST approach.
97
+
98
+ ## Process
99
+ 1. **Reproduce** - Get exact error conditions
100
+ 2. **Log** - Gather all relevant logs, stack traces, system state
101
+ 3. **Analyze** - Root cause analysis using debugging patterns
102
+ 4. **Fix** - Minimal change to resolve
103
+ 5. **Verify** - Confirm fix works and doesn't break other things
104
+
105
+ ## Debugging Patterns
106
+ - Check recent changes (git diff)
107
+ - Examine error logs and stack traces
108
+ - Validate assumptions with print statements
109
+ - Isolate the failing component
110
+ - Check for null/undefined values
111
+ - Verify data types and formats
112
+ - Use binary search approach to narrow down
113
+
114
+ ## Memory Usage
115
+ - Load patterns.md for common gotchas
116
+ - Check activeContext.md for similar previous issues
117
+ - Update patterns.md if new debugging pattern discovered
118
+
119
+ ## Output Requirements
120
+ - Evidence before any fix proposal (logs, stack traces, reproduction steps)
121
+ - Root cause analysis with confidence level
122
+ - Minimal fix with verification steps
123
+ - Include "### Memory Notes" section for workflow persistence
124
+ - If research needed, request github-research skill
125
+
126
+ ## Confidence Scoring
127
+ Only report findings with ≥80% confidence.`,
128
+ permission: {
129
+ bash: {
130
+ '*': 'ask',
131
+ 'git status': 'allow',
132
+ 'git diff': 'allow',
133
+ 'git log': 'allow',
134
+ 'cat': 'allow',
135
+ 'grep': 'allow',
136
+ 'find': 'allow'
137
+ },
138
+ webfetch: 'ask'
139
+ }
140
+ },
141
+ {
142
+ name: 'code-reviewer',
143
+ description: 'Reviews code with 80%+ confidence threshold. Used by cc10x router for REVIEW, BUILD, and DEBUG workflows.',
144
+ mode: 'subagent',
145
+ model: 'inherit',
146
+ temperature: 0.1,
147
+ color: 'yellow',
148
+ tools: {
149
+ write: false,
150
+ edit: false,
151
+ bash: true,
152
+ grep: true,
153
+ glob: true,
154
+ skill: true,
155
+ lsp: true,
156
+ askUserQuestion: false,
157
+ webfetch: false
158
+ },
159
+ prompt: `# Code Reviewer (80%+ Confidence)
160
+
161
+ **Rule:** Only report issues with ≥80% confidence. No vague feedback.
162
+
163
+ ## Review Dimensions
164
+ - **Security**: OWASP top 10, input validation, authentication/authorization, SQL injection, XSS
165
+ - **Performance**: Algorithm efficiency, database queries (N+1), memory usage, caching
166
+ - **Maintainability**: Code structure, naming conventions, documentation, complexity
167
+ - **Reliability**: Error handling, edge cases, resource management, race conditions
168
+ - **Testing**: Test coverage, test quality, edge case coverage, mocking
169
+
170
+ ## Confidence Scoring
171
+ For each issue:
172
+ 1. Assess certainty (0-100%)
173
+ 2. Only report if ≥80%
174
+ 3. Provide file:line citations for every finding
175
+ 4. Include reasoning for confidence level
176
+
177
+ ## Output Format
178
+ ### Critical Issues
179
+ - [File:line] Issue description (Confidence: XX%)
180
+ - Evidence: [specific code pattern]
181
+ - Impact: [what could go wrong]
182
+ - Fix: [specific recommendation]
183
+
184
+ ### Verdict
185
+ - **APPROVED** - No critical issues found
186
+ - **CHANGES REQUESTED** - Critical issues must be addressed
187
+
188
+ ### Memory Notes
189
+ Include learnings, patterns discovered, or common gotchas to persist.
190
+
191
+ ## For BUILD workflows
192
+ Review the implementation from component-builder.
193
+ Focus on TDD quality, test coverage, and implementation correctness.
194
+
195
+ ## For DEBUG workflows
196
+ Validate the fix from bug-investigator.
197
+ Ensure fix solves problem without introducing new issues.
198
+
199
+ ## For REVIEW workflows
200
+ Comprehensive review of user-specified code with full analysis.`,
201
+ permission: {
202
+ bash: {
203
+ '*': 'allow', // Read-only operations
204
+ 'git diff': 'allow',
205
+ 'git log': 'allow',
206
+ 'grep': 'allow'
207
+ }
208
+ }
209
+ },
210
+ {
211
+ name: 'silent-failure-hunter',
212
+ description: 'Finds silent failures and error handling gaps. Used by cc10x router for BUILD workflows (parallel with code-reviewer).',
213
+ mode: 'subagent',
214
+ model: 'inherit',
215
+ temperature: 0.2,
216
+ color: 'red',
217
+ tools: {
218
+ write: false,
219
+ edit: false,
220
+ bash: true,
221
+ grep: true,
222
+ glob: true,
223
+ skill: true,
224
+ lsp: true,
225
+ askUserQuestion: false,
226
+ webfetch: false
227
+ },
228
+ prompt: `# Silent Failure Hunter
229
+
230
+ **Mission:** Zero tolerance for empty catch blocks and unhandled errors.
231
+
232
+ ## Hunting Patterns
233
+
234
+ ### Empty Catch Blocks
235
+ - \`catch (error) {}\`
236
+ - \`catch (e) {}\`
237
+ - \`except: pass\`
238
+ - \`catch {}\`
239
+
240
+ ### Missing Error Handling
241
+ - No try-catch around async operations
242
+ - Unvalidated API responses
243
+ - Unhandled promise rejections
244
+ - Missing null/undefined checks
245
+
246
+ ### Resource Leaks
247
+ - Open connections without cleanup
248
+ - File handles not closed
249
+ - Memory leaks in event listeners
250
+ - Unreleased database connections
251
+
252
+ ### Race Conditions
253
+ - Unsynchronized access to shared state
254
+ - Missing locks on critical sections
255
+ - Async operations without proper sequencing
256
+
257
+ ### Edge Cases
258
+ - No input validation
259
+ - Boundary conditions not tested
260
+ - Error paths not exercised
261
+ - Timeout handling missing
262
+
263
+ ## Hunting Process
264
+ 1. **Static Analysis** - grep for anti-patterns
265
+ 2. **Code Review** - examine error handling patterns
266
+ 3. **Test Analysis** - check if edge cases covered
267
+ 4. **Runtime Analysis** - consider execution paths
268
+
269
+ ## Output Requirements
270
+ ### Critical Issues
271
+ - [File:line] Silent failure pattern found
272
+ - Pattern: [empty catch, missing validation, etc.]
273
+ - Risk: [what could happen]
274
+ - Fix: [specific recommendation]
275
+
276
+ ### Verdict
277
+ - **SAFE** - No silent failures detected
278
+ - **UNSAFE** - Silent failures must be fixed
279
+
280
+ ### Memory Notes
281
+ Include patterns discovered for future prevention.
282
+
283
+ ## Zero Tolerance Policy
284
+ Any empty catch block = CRITICAL issue. No exceptions.`,
285
+ permission: {
286
+ bash: {
287
+ '*': 'allow',
288
+ 'grep': 'allow',
289
+ 'find': 'allow'
290
+ }
291
+ }
292
+ },
293
+ {
294
+ name: 'integration-verifier',
295
+ description: 'Performs end-to-end validation. Used by cc10x router as final step in BUILD and DEBUG workflows.',
296
+ mode: 'subagent',
297
+ model: 'inherit',
298
+ temperature: 0.1,
299
+ color: 'blue',
300
+ tools: {
301
+ write: false,
302
+ edit: false,
303
+ bash: true,
304
+ grep: true,
305
+ glob: true,
306
+ skill: true,
307
+ lsp: true,
308
+ askUserQuestion: true,
309
+ webfetch: false
310
+ },
311
+ prompt: `# Integration Verifier
312
+
313
+ **Goal:** Exit code 0 or it didn't happen. Comprehensive validation.
314
+
315
+ ## Verification Checklist
316
+
317
+ ### Functional Verification
318
+ - [ ] All tests pass (run full test suite)
319
+ - [ ] Application starts without errors
320
+ - [ ] Core functionality works end-to-end
321
+ - [ ] API endpoints respond correctly
322
+ - [ ] Database operations succeed
323
+
324
+ ### Quality Gates
325
+ - [ ] No critical issues from code-reviewer
326
+ - [ ] No silent failures from hunter
327
+ - [ ] All security concerns addressed
328
+ - [ ] Performance acceptable (no obvious bottlenecks)
329
+
330
+ ### Integration Points
331
+ - [ ] External services configured correctly
332
+ - [ ] Environment variables present
333
+ - [ ] Database migrations applied
334
+ - [ ] CORS configured properly
335
+ - [ ] Authentication/authorization working
336
+
337
+ ## Process
338
+ 1. **Review Previous Findings** - Consider ALL issues from code-reviewer and hunter
339
+ 2. **Run Tests** - Execute full test suite, capture exit codes
340
+ 3. **Manual Verification** - Test key user journeys
341
+ 4. **Integration Check** - Verify all components work together
342
+ 5. **Evidence Collection** - Commands, outputs, screenshots if needed
343
+
344
+ ## Critical Issues Blocking PASS
345
+ - Any unaddressed critical issue from reviewers
346
+ - Test failures (exit code != 0)
347
+ - Application crashes on startup
348
+ - Database connection failures
349
+ - Missing required environment variables
350
+
351
+ ## Output Requirements
352
+ ### Verdict
353
+ - **PASS** - All verification criteria met
354
+ - **FAIL** - Critical blocking issues remain
355
+
356
+ ### Verification Evidence
357
+ - \`npm test\` → exit 0 (X/X tests passed)
358
+ - \`npm start\` → exit 0 (server started)
359
+ - [Additional verification commands with exit codes]
360
+
361
+ ### Issues Found
362
+ List any non-critical issues that should be addressed later.
363
+
364
+ ### Memory Notes
365
+ Include verification results and any deployment considerations.
366
+
367
+ ## Exit Code Rule
368
+ If you cannot verify with exit code 0, the verdict is FAIL.`,
369
+ permission: {
370
+ bash: {
371
+ '*': 'ask',
372
+ 'npm test': 'allow',
373
+ 'yarn test': 'allow',
374
+ 'bun test': 'allow',
375
+ 'npm start': 'allow',
376
+ 'npm run build': 'allow',
377
+ 'git status': 'allow'
378
+ }
379
+ }
380
+ },
381
+ {
382
+ name: 'planner',
383
+ description: 'Creates comprehensive plans with research. Used by cc10x router for PLAN workflows.',
384
+ mode: 'subagent',
385
+ model: 'inherit',
386
+ temperature: 0.4,
387
+ color: 'purple',
388
+ tools: {
389
+ write: true,
390
+ edit: true,
391
+ bash: true,
392
+ grep: true,
393
+ glob: true,
394
+ skill: true,
395
+ lsp: true,
396
+ askUserQuestion: true,
397
+ webfetch: true
398
+ },
399
+ prompt: `# Planner (Comprehensive Planning)
400
+
401
+ **Goal:** Create detailed, actionable plans with clear next steps.
402
+
403
+ ## Planning Phases
404
+
405
+ ### 1. Analysis & Requirements
406
+ - Clarify requirements with user questions
407
+ - Identify constraints and dependencies
408
+ - Assess current state and gaps
409
+ - Define success criteria
410
+
411
+ ### 2. Architecture & Design
412
+ - System design decisions with rationale
413
+ - Technology choices and trade-offs
414
+ - API design (if applicable)
415
+ - Data model and database schema
416
+ - Security considerations
417
+
418
+ ### 3. Implementation Plan
419
+ - Phased approach with milestones
420
+ - Specific files to create/modify
421
+ - Testing strategy (TDD recommended)
422
+ - Rollback plan
423
+ - Timeline estimates
424
+
425
+ ### 4. Research Needs
426
+ - External packages to investigate
427
+ - Best practices to research
428
+ - Alternatives to evaluate
429
+ - Performance considerations
430
+
431
+ ## Research Pattern (if needed)
432
+ If unfamiliar technology or complex integration:
433
+ 1. Use github-research skill to find examples
434
+ 2. Research best practices and patterns
435
+ 3. Document findings in docs/research/
436
+ 4. Reference research in plan
437
+
438
+ ## Output Requirements
439
+
440
+ ### Plan Document
441
+ Save to: \`docs/plans/YYYY-MM-DD-<topic>-plan.md\`
442
+
443
+ Include:
444
+ - Executive summary
445
+ - Requirements analysis
446
+ - Architecture decisions
447
+ - Implementation phases
448
+ - Risk assessment
449
+ - Success criteria
450
+
451
+ ### Memory Updates
452
+ - Update activeContext.md with plan reference
453
+ - Record key decisions in patterns.md
454
+ - Set next steps in activeContext.md
455
+
456
+ ### User Interaction
457
+ Ask clarifying questions before finalizing plan.
458
+ Present options with pros/cons when multiple approaches exist.
459
+
460
+ ## Plan Quality Checklist
461
+ - [ ] Requirements clearly understood
462
+ - [ ] Architecture decisions documented with rationale
463
+ - [ ] Implementation steps are specific and actionable
464
+ - [ ] Risks identified with mitigation strategies
465
+ - [ ] Success criteria defined
466
+ - [ ] Research completed if needed
467
+ - [ ] User questions answered
468
+
469
+ ## For cc10x Integration
470
+ Create plan that can be followed by component-builder in subsequent BUILD workflow.
471
+ Include specific file paths, test commands, and code structure expectations.`,
472
+ permission: {
473
+ write: 'ask',
474
+ edit: 'ask',
475
+ bash: {
476
+ '*': 'ask',
477
+ 'mkdir -p docs/plans': 'allow'
478
+ },
479
+ webfetch: 'ask'
480
+ }
481
+ }
482
+ ];
483
+ //# sourceMappingURL=agents.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agents.js","sourceRoot":"","sources":["../src/agents.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,gBAAgB,GAAsB;IACjD;QACE,IAAI,EAAE,mBAAmB;QACzB,WAAW,EAAE,qGAAqG;QAClH,IAAI,EAAE,UAAU;QAChB,KAAK,EAAE,SAAS,EAAE,4BAA4B;QAC9C,WAAW,EAAE,GAAG;QAChB,KAAK,EAAE,OAAO;QACd,KAAK,EAAE;YACL,KAAK,EAAE,IAAI;YACX,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,IAAI;YACV,KAAK,EAAE,IAAI;YACX,GAAG,EAAE,IAAI;YACT,eAAe,EAAE,IAAI;YACrB,QAAQ,EAAE,KAAK;SAChB;QACD,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwCX;QACG,UAAU,EAAE;YACV,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,OAAO;YACd,IAAI,EAAE;gBACJ,GAAG,EAAE,KAAK;gBACV,YAAY,EAAE,OAAO;gBACrB,UAAU,EAAE,OAAO;gBACnB,SAAS,EAAE,OAAO;gBAClB,UAAU,EAAE,OAAO;gBACnB,WAAW,EAAE,OAAO;gBACpB,UAAU,EAAE,OAAO;gBACnB,wBAAwB,EAAE,OAAO;aAClC;SACF;KACF;IACD;QACE,IAAI,EAAE,kBAAkB;QACxB,WAAW,EAAE,sFAAsF;QACnG,IAAI,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,EAAE,OAAO;gBACnB,WAAW,EAAE,OAAO;gBACpB,eAAe,EAAE,OAAO;gBACxB,YAAY,EAAE,OAAO;aACtB;SACF;KACF;IACD;QACE,IAAI,EAAE,SAAS;QACf,WAAW,EAAE,qFAAqF;QAClG,IAAI,EAAE,UAAU;QAChB,KAAK,EAAE,SAAS;QAChB,WAAW,EAAE,GAAG;QAChB,KAAK,EAAE,QAAQ;QACf,KAAK,EAAE;YACL,KAAK,EAAE,IAAI;YACX,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,IAAI;YACV,KAAK,EAAE,IAAI;YACX,GAAG,EAAE,IAAI;YACT,eAAe,EAAE,IAAI;YACrB,QAAQ,EAAE,IAAI;SACf;QACD,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6EAwEiE;QACzE,UAAU,EAAE;YACV,KAAK,EAAE,KAAK;YACZ,IAAI,EAAE,KAAK;YACX,IAAI,EAAE;gBACJ,GAAG,EAAE,KAAK;gBACV,qBAAqB,EAAE,OAAO;aAC/B;YACD,QAAQ,EAAE,KAAK;SAChB;KACF;CACF,CAAC"}
@@ -0,0 +1,18 @@
1
+ export declare function readFile(input: any, path: string): Promise<string>;
2
+ export declare function writeFile(input: any, path: string, content: string): Promise<void>;
3
+ export declare function editFile(input: any, path: string, options: {
4
+ oldString: string;
5
+ newString: string;
6
+ }): Promise<void>;
7
+ export declare function mkdir(input: any, ...args: string[]): Promise<void>;
8
+ export declare function bash(input: any, command: string, args?: string[]): Promise<{
9
+ exitCode: number;
10
+ stdout: string;
11
+ stderr: string;
12
+ }>;
13
+ export declare function isPermissionFreeOperation(tool: string, args: any): boolean;
14
+ export declare function validateTDDPhase(phase: 'RED' | 'GREEN' | 'REFACTOR', context: any): boolean;
15
+ export declare function extractExitCode(result: any): number;
16
+ export declare function isTestFile(filePath: string): boolean;
17
+ export declare function isTestCommand(command?: string): boolean;
18
+ //# sourceMappingURL=compatibility-layer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compatibility-layer.d.ts","sourceRoot":"","sources":["../src/compatibility-layer.ts"],"names":[],"mappings":"AAGA,wBAAsB,QAAQ,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAWxE;AAED,wBAAsB,SAAS,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAQxF;AAED,wBAAsB,QAAQ,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE;IAChE,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB,GAAG,OAAO,CAAC,IAAI,CAAC,CAQhB;AAED,wBAAsB,KAAK,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAmBxE;AAGD,wBAAsB,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,MAAM,EAAO,GAAG,OAAO,CAAC;IACpF,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC,CAsBD;AAGD,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,OAAO,CAgC1E;AAGD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,GAAG,UAAU,EAAE,OAAO,EAAE,GAAG,GAAG,OAAO,CAI3F;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,GAAG,GAAG,MAAM,CAEnD;AAED,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAkBpD;AAED,wBAAgB,aAAa,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAQvD"}
@@ -0,0 +1,150 @@
1
+ // Compatibility layer to provide file operation methods similar to Claude Code
2
+ // These wrap OpenCode's native tools with cc10x-expected interfaces
3
+ export async function readFile(input, path) {
4
+ try {
5
+ // Use OpenCode's read tool via client
6
+ const result = await input.client.app.fs.read(path);
7
+ return result;
8
+ }
9
+ catch (error) {
10
+ if (error.code === 'ENOENT' || error.message?.includes('not found')) {
11
+ throw new Error(`File not found: ${path}`);
12
+ }
13
+ throw error;
14
+ }
15
+ }
16
+ export async function writeFile(input, path, content) {
17
+ try {
18
+ // Use OpenCode's write tool via client
19
+ await input.client.app.fs.write(path, content);
20
+ }
21
+ catch (error) {
22
+ console.error(`Failed to write file ${path}:`, error);
23
+ throw error;
24
+ }
25
+ }
26
+ export async function editFile(input, path, options) {
27
+ try {
28
+ // Use OpenCode's edit tool via client
29
+ await input.client.app.fs.edit(path, options);
30
+ }
31
+ catch (error) {
32
+ console.error(`Failed to edit file ${path}:`, error);
33
+ throw error;
34
+ }
35
+ }
36
+ export async function mkdir(input, ...args) {
37
+ try {
38
+ // Use OpenCode's shell ($) for mkdir - execute as tagged template
39
+ const $ = input.$;
40
+ if (typeof $ === 'function') {
41
+ const dir = args[0] || args.join(' ');
42
+ // Bun shell expects tagged template syntax: $`mkdir -p dir`
43
+ const result = await $ `mkdir -p ${dir}`;
44
+ // result is BunShellPromise with exitCode, stdout, stderr
45
+ if (result.exitCode !== 0) {
46
+ throw new Error(`mkdir failed: ${result.stderr.toString()}`);
47
+ }
48
+ }
49
+ else {
50
+ throw new Error('Shell not available');
51
+ }
52
+ }
53
+ catch (error) {
54
+ console.error(`Failed to create directory:`, error);
55
+ throw error;
56
+ }
57
+ }
58
+ // Wrapper for bash commands with proper permission handling
59
+ export async function bash(input, command, args = []) {
60
+ try {
61
+ const $ = input.$;
62
+ if (typeof $ !== 'function') {
63
+ throw new Error('Shell not available');
64
+ }
65
+ // Build command string for tagged template
66
+ const fullCommand = [command, ...args].join(' ');
67
+ const result = await $ `${fullCommand}`;
68
+ // BunShellPromise has exitCode, stdout, stderr as Buffer
69
+ return {
70
+ exitCode: result.exitCode,
71
+ stdout: result.stdout.toString(),
72
+ stderr: result.stderr.toString()
73
+ };
74
+ }
75
+ catch (error) {
76
+ return {
77
+ exitCode: error.exitCode || 1,
78
+ stdout: '',
79
+ stderr: error.message || String(error)
80
+ };
81
+ }
82
+ }
83
+ // Permission checking utilities
84
+ export function isPermissionFreeOperation(tool, args) {
85
+ // Memory operations are permission-free in cc10x
86
+ const memoryPaths = [
87
+ '.claude/cc10x/activeContext.md',
88
+ '.claude/cc10x/patterns.md',
89
+ '.claude/cc10x/progress.md'
90
+ ];
91
+ if (tool === 'read' && args?.filePath) {
92
+ return memoryPaths.some(path => args.filePath.includes(path));
93
+ }
94
+ if (tool === 'edit' && args?.filePath) {
95
+ return memoryPaths.some(path => args.filePath.includes(path));
96
+ }
97
+ if (tool === 'write' && args?.filePath) {
98
+ // Write is permission-free for any file in memory directory (for new files)
99
+ // Since we can't check existence, we'll allow writes to any .claude/cc10x/ path
100
+ return args.filePath.includes('.claude/cc10x/');
101
+ }
102
+ if (tool === 'bash' && args?.command) {
103
+ const command = args.command;
104
+ // mkdir for memory directory is permission-free
105
+ if (command === 'mkdir' && args.args?.includes('-p') &&
106
+ args.args?.some((arg) => arg.includes('.claude/cc10x'))) {
107
+ return true;
108
+ }
109
+ }
110
+ return false;
111
+ }
112
+ // TDD enforcement utilities
113
+ export function validateTDDPhase(phase, context) {
114
+ // This would validate TDD cycle compliance
115
+ // For now, return true - full implementation would track state
116
+ return true;
117
+ }
118
+ export function extractExitCode(result) {
119
+ return result?.exitCode ?? result?.code ?? 0;
120
+ }
121
+ export function isTestFile(filePath) {
122
+ const testPatterns = [
123
+ /\.test\./i,
124
+ /\.spec\./i,
125
+ /__tests__\//,
126
+ /__mocks__\//,
127
+ /(^|\/|[-_])test($|[\W_])/i, // test at start, after dash/underscore, or as directory
128
+ /(^|\/|[-_])spec($|[\W_])/i, // spec at start, after dash/underscore, or as directory
129
+ /\.test\.js$/i,
130
+ /\.spec\.js$/i,
131
+ /test\.py$/i,
132
+ /test\.go$/i,
133
+ /test\.rs$/i,
134
+ /test\.java$/i,
135
+ /test\.ts$/i,
136
+ /test\.tsx$/i
137
+ ];
138
+ return testPatterns.some(pattern => pattern.test(filePath));
139
+ }
140
+ export function isTestCommand(command) {
141
+ if (!command)
142
+ return false;
143
+ const testPatterns = [
144
+ /test/i, /spec/i, /\.test\./, /\.spec\./,
145
+ /jest/i, /mocha/i, /pytest/i, /tox/i,
146
+ /npm test/i, /yarn test/i, /bun test/i
147
+ ];
148
+ return testPatterns.some(pattern => pattern.test(command));
149
+ }
150
+ //# sourceMappingURL=compatibility-layer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compatibility-layer.js","sourceRoot":"","sources":["../src/compatibility-layer.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,oEAAoE;AAEpE,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,KAAU,EAAE,IAAY;IACrD,IAAI,CAAC;QACH,sCAAsC;QACtC,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACpD,OAAO,MAAgB,CAAC;IAC1B,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,EAAE,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC;YACpE,MAAM,IAAI,KAAK,CAAC,mBAAmB,IAAI,EAAE,CAAC,CAAC;QAC7C,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,KAAU,EAAE,I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MAAM,EAAE,IAAI,IAAI,CAAC,CAAC;AAC/C,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,QAAgB;IACzC,MAAM,YAAY,GAAG;QACnB,WAAW;QACX,WAAW;QACX,aAAa;QACb,aAAa;QACb,2BAA2B,EAAG,wDAAwD;QACtF,2BAA2B,EAAG,wDAAwD;QACtF,cAAc;QACd,cAAc;QACd,YAAY;QACZ,YAAY;QACZ,YAAY;QACZ,cAAc;QACd,YAAY;QACZ,aAAa;KACd,CAAC;IACF,OAAO,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;AAC9D,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,OAAgB;IAC5C,IAAI,CAAC,OAAO;QAAE,OAAO,KAAK,CAAC;IAC3B,MAAM,YAAY,GAAG;QACnB,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU;QACxC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM;QACpC,WAAW,EAAE,YAAY,EAAE,WAAW;KACvC,CAAC;IACF,OAAO,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;AAC7D,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { Plugin } from '@opencode-ai/plugin';
2
+ export declare const OpenCodeCC10xPlugin: Plugin;
3
+ export default OpenCodeCC10xPlugin;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAGlD,eAAO,MAAM,mBAAmB,EAAE,MAiEjC,CAAC;AAEF,eAAe,mBAAmB,CAAC"}