opencodekit 0.9.2 → 0.11.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.
Files changed (62) hide show
  1. package/dist/index.js +1 -1
  2. package/dist/template/.opencode/AGENTS.md +116 -47
  3. package/dist/template/.opencode/agent/build.md +16 -48
  4. package/dist/template/.opencode/agent/explore.md +13 -34
  5. package/dist/template/.opencode/agent/planner.md +41 -11
  6. package/dist/template/.opencode/agent/review.md +2 -23
  7. package/dist/template/.opencode/agent/rush.md +24 -65
  8. package/dist/template/.opencode/agent/scout.md +5 -21
  9. package/dist/template/.opencode/agent/vision.md +0 -14
  10. package/dist/template/.opencode/command/accessibility-check.md +293 -30
  11. package/dist/template/.opencode/command/analyze-mockup.md +406 -20
  12. package/dist/template/.opencode/command/analyze-project.md +439 -30
  13. package/dist/template/.opencode/command/brainstorm.md +288 -5
  14. package/dist/template/.opencode/command/commit.md +226 -17
  15. package/dist/template/.opencode/command/create.md +138 -35
  16. package/dist/template/.opencode/command/design-audit.md +477 -29
  17. package/dist/template/.opencode/command/design.md +609 -6
  18. package/dist/template/.opencode/command/edit-image.md +223 -20
  19. package/dist/template/.opencode/command/finish.md +162 -71
  20. package/dist/template/.opencode/command/fix-ci.md +296 -24
  21. package/dist/template/.opencode/command/fix-types.md +345 -13
  22. package/dist/template/.opencode/command/fix-ui.md +293 -13
  23. package/dist/template/.opencode/command/fix.md +256 -9
  24. package/dist/template/.opencode/command/generate-diagram.md +327 -26
  25. package/dist/template/.opencode/command/generate-icon.md +266 -22
  26. package/dist/template/.opencode/command/generate-image.md +232 -12
  27. package/dist/template/.opencode/command/generate-pattern.md +234 -20
  28. package/dist/template/.opencode/command/generate-storyboard.md +231 -21
  29. package/dist/template/.opencode/command/handoff.md +202 -30
  30. package/dist/template/.opencode/command/implement.md +162 -50
  31. package/dist/template/.opencode/command/import-plan.md +247 -51
  32. package/dist/template/.opencode/command/init.md +154 -35
  33. package/dist/template/.opencode/command/integration-test.md +405 -24
  34. package/dist/template/.opencode/command/issue.md +171 -21
  35. package/dist/template/.opencode/command/new-feature.md +382 -54
  36. package/dist/template/.opencode/command/plan.md +144 -118
  37. package/dist/template/.opencode/command/pr.md +229 -28
  38. package/dist/template/.opencode/command/quick-build.md +234 -5
  39. package/dist/template/.opencode/command/research-and-implement.md +436 -12
  40. package/dist/template/.opencode/command/research-ui.md +444 -34
  41. package/dist/template/.opencode/command/research.md +173 -45
  42. package/dist/template/.opencode/command/restore-image.md +416 -22
  43. package/dist/template/.opencode/command/resume.md +439 -63
  44. package/dist/template/.opencode/command/revert-feature.md +341 -64
  45. package/dist/template/.opencode/command/review-codebase.md +193 -4
  46. package/dist/template/.opencode/command/skill-create.md +506 -14
  47. package/dist/template/.opencode/command/skill-optimize.md +487 -16
  48. package/dist/template/.opencode/command/status.md +320 -60
  49. package/dist/template/.opencode/command/summarize.md +374 -33
  50. package/dist/template/.opencode/command/triage.md +355 -0
  51. package/dist/template/.opencode/command/ui-review.md +292 -25
  52. package/dist/template/.opencode/plugin/README.md +110 -98
  53. package/dist/template/.opencode/plugin/compactor.ts +95 -171
  54. package/dist/template/.opencode/plugin/enforcer.ts +177 -127
  55. package/dist/template/.opencode/plugin/injector.ts +150 -0
  56. package/dist/template/.opencode/plugin/lib/notify.ts +86 -0
  57. package/dist/template/.opencode/plugin/notification.ts +57 -123
  58. package/dist/template/.opencode/plugin/truncator.ts +60 -166
  59. package/dist/template/.opencode/skill/mqdh/SKILL.md +161 -0
  60. package/dist/template/.opencode/skill/playwriter/SKILL.md +148 -0
  61. package/dist/template/.opencode/skill/v0/SKILL.md +154 -0
  62. package/package.json +1 -1
@@ -1,20 +1,275 @@
1
1
  ---
2
- description: Analyze project structure, status, and ready work
2
+ description: Analyze project health, status, and ready work with metrics
3
+ argument-hint: "[--quick|--deep|--health|--security]"
3
4
  agent: planner
4
5
  ---
5
6
 
6
7
  # Analyze Project
7
8
 
8
- **For large codebases:** `skill({ name: "gemini-large-context" })`
9
+ ## Phase 1: Quick Status Dashboard
9
10
 
10
- ## Quick Status
11
+ Run these checks in parallel for speed:
11
12
 
12
- 1. **Git:** `git status` - current branch, changes
13
- 2. **Tasks:** `bd_ls({ status: "open" })` - active beads
14
- 3. **CI:** Check build status
15
- 4. **Dependencies:** Check for outdated packages
13
+ ```bash
14
+ # Git status
15
+ git status --short
16
+ git branch --show-current
17
+ git log --oneline -3
16
18
 
17
- ## Ready Work
19
+ # Beads status
20
+ bd_status({ include_agents: false })
21
+ bd_ls({ status: "open", limit: 5, offset: 0 })
22
+ bd_ls({ status: "ready", limit: 5, offset: 0 })
23
+
24
+ # CI/CD status (GitHub Actions)
25
+ gh run list --limit 5
26
+
27
+ # Last commit info
28
+ git log -1 --format="%h %s (%cr by %an)"
29
+ ```
30
+
31
+ ### Status Dashboard Output
32
+
33
+ ```markdown
34
+ ## Project Status Dashboard
35
+
36
+ | Category | Status | Details |
37
+ | ---------------- | --------------------- | ------------------------------ |
38
+ | **Branch** | `main` | 3 commits ahead of origin |
39
+ | **Working Tree** | Clean / Dirty | X files modified |
40
+ | **Last Commit** | `abc123` | "feat: add auth" (2 hours ago) |
41
+ | **CI Status** | Pass / Fail / Running | Last run: 2h ago |
42
+ | **Open Tasks** | X beads | Y ready, Z blocked |
43
+ | **Dependencies** | X outdated | Y security issues |
44
+ ```
45
+
46
+ ---
47
+
48
+ ## Phase 2: Tech Stack Detection
49
+
50
+ Detect project technology:
51
+
52
+ ```bash
53
+ # Package manager & framework
54
+ ls package.json pyproject.toml Cargo.toml go.mod pom.xml build.gradle
55
+
56
+ # Read main config
57
+ read package.json # or equivalent
58
+ ```
59
+
60
+ ### Tech Stack Analysis
61
+
62
+ | Aspect | Detection Method | Example Output |
63
+ | --------------------- | ------------------------- | -------------------------------- |
64
+ | **Language** | File extensions, config | TypeScript, Python, Rust |
65
+ | **Framework** | package.json dependencies | Next.js 14, FastAPI, Axum |
66
+ | **Package Manager** | Lock file presence | npm, pnpm, yarn, bun |
67
+ | **Testing** | Test framework in deps | Jest, Vitest, pytest, cargo test |
68
+ | **Linting** | Config files | ESLint, Biome, Ruff |
69
+ | **Formatting** | Config files | Prettier, Biome, Black |
70
+ | **CI/CD** | Workflow files | GitHub Actions, GitLab CI |
71
+ | **Database** | Dependencies, .env | PostgreSQL, SQLite, MongoDB |
72
+ | **UI Framework** | Dependencies | React, Vue, Svelte |
73
+ | **Component Library** | components.json, deps | shadcn/ui, MUI, Chakra |
74
+
75
+ ```markdown
76
+ ## Tech Stack
77
+
78
+ | Category | Technology | Version |
79
+ | --------------- | ---------- | ------- |
80
+ | Language | TypeScript | 5.3.x |
81
+ | Runtime | Node.js | 20.x |
82
+ | Framework | Next.js | 14.2 |
83
+ | Package Manager | pnpm | 8.x |
84
+ | Testing | Vitest | 1.x |
85
+ | Linting | Biome | 1.x |
86
+ | UI | shadcn/ui | latest |
87
+ | Database | PostgreSQL | 16 |
88
+ ```
89
+
90
+ ---
91
+
92
+ ## Phase 3: Health Metrics
93
+
94
+ ### 3.1 Dependency Health
95
+
96
+ ```bash
97
+ # Node.js
98
+ npm outdated --json || pnpm outdated --json
99
+ npm audit --json
100
+
101
+ # Python
102
+ pip list --outdated
103
+ pip-audit
104
+
105
+ # Rust
106
+ cargo outdated
107
+ cargo audit
108
+ ```
109
+
110
+ **Dependency Dashboard:**
111
+
112
+ | Metric | Value | Status | Threshold |
113
+ | ------------------------ | ----- | ------- | --------- |
114
+ | Total dependencies | 45 | - | - |
115
+ | Outdated (major) | 3 | Warning | < 5 |
116
+ | Outdated (minor) | 8 | OK | < 20 |
117
+ | Security vulnerabilities | 0 | OK | 0 |
118
+ | High/Critical vulns | 0 | OK | 0 |
119
+
120
+ ### 3.2 Test Coverage
121
+
122
+ ```bash
123
+ # Node.js
124
+ npm test -- --coverage --json
125
+
126
+ # Python
127
+ pytest --cov --cov-report=json
128
+
129
+ # Check for coverage config
130
+ glob pattern="**/jest.config.*"
131
+ glob pattern="**/vitest.config.*"
132
+ glob pattern="**/pytest.ini"
133
+ glob pattern="**/pyproject.toml"
134
+ ```
135
+
136
+ **Coverage Dashboard:**
137
+
138
+ | Metric | Value | Status | Threshold |
139
+ | --------------- | ----- | ------- | --------- |
140
+ | Line coverage | 78% | Warning | > 80% |
141
+ | Branch coverage | 65% | Warning | > 70% |
142
+ | Uncovered files | 12 | - | - |
143
+ | Test count | 156 | - | - |
144
+ | Test pass rate | 100% | OK | 100% |
145
+
146
+ ### 3.3 Code Quality
147
+
148
+ ```bash
149
+ # TypeScript type errors
150
+ npx tsc --noEmit 2>&1 | wc -l
151
+
152
+ # Linting issues
153
+ npm run lint -- --format json 2>/dev/null || npx biome check --reporter=json
154
+
155
+ # TODO/FIXME count
156
+ grep -r "TODO\|FIXME\|HACK\|XXX" src/ --include="*.ts" --include="*.tsx" | wc -l
157
+ ```
158
+
159
+ **Quality Dashboard:**
160
+
161
+ | Metric | Value | Status | Threshold |
162
+ | ---------------------- | ----- | ------- | --------- |
163
+ | Type errors | 0 | OK | 0 |
164
+ | Lint errors | 5 | Warning | 0 |
165
+ | Lint warnings | 23 | OK | < 50 |
166
+ | TODO/FIXME | 15 | Info | < 30 |
167
+ | Console.log statements | 3 | Warning | 0 |
168
+
169
+ ### 3.4 Documentation Status
170
+
171
+ ```bash
172
+ # Check for docs
173
+ ls README.md CHANGELOG.md CONTRIBUTING.md docs/ 2>/dev/null
174
+
175
+ # README freshness
176
+ git log -1 --format="%cr" -- README.md
177
+
178
+ # API docs
179
+ ls docs/api/ openapi.yaml swagger.json 2>/dev/null
180
+ ```
181
+
182
+ **Documentation Dashboard:**
183
+
184
+ | Document | Status | Last Updated |
185
+ | --------------- | ------- | ------------ |
186
+ | README.md | Present | 5 days ago |
187
+ | CHANGELOG.md | Present | 2 days ago |
188
+ | CONTRIBUTING.md | Missing | - |
189
+ | API docs | Present | 1 week ago |
190
+ | AGENTS.md | Present | 3 days ago |
191
+
192
+ ---
193
+
194
+ ## Phase 4: Detailed Analysis (--deep)
195
+
196
+ **For large codebases (>100KB of source):**
197
+
198
+ skill({ name: "gemini-large-context" })
199
+
200
+ ### 4.1 Architecture Analysis
201
+
202
+ ```bash
203
+ gemini -p "@src/
204
+ Describe:
205
+ 1. Overall architecture pattern (MVC, Clean, Hexagonal, etc.)
206
+ 2. Key modules and their responsibilities
207
+ 3. Data flow between components
208
+ 4. External dependencies and integrations
209
+ 5. Areas of high complexity"
210
+ ```
211
+
212
+ ### 4.2 Test Gap Analysis
213
+
214
+ ```bash
215
+ gemini -p "@src/ @tests/
216
+ Assess test coverage:
217
+ - Which modules have tests?
218
+ - Which are missing tests?
219
+ - Test quality (unit vs integration)
220
+ - Edge cases covered
221
+ - Critical paths without tests"
222
+ ```
223
+
224
+ ### 4.3 Code Smell Detection
225
+
226
+ ```bash
227
+ gemini -p "@src/
228
+ Identify code smells:
229
+ - Duplicated code
230
+ - Long functions (>50 lines)
231
+ - Deep nesting (>4 levels)
232
+ - God objects/files
233
+ - Dead code
234
+ - Inconsistent patterns"
235
+ ```
236
+
237
+ ### 4.4 Security Analysis (--security)
238
+
239
+ ```bash
240
+ # Automated scans
241
+ npm audit
242
+ npx snyk test 2>/dev/null || true
243
+
244
+ # Pattern-based detection
245
+ grep -r "password\s*=" src/ --include="*.ts" || true
246
+ grep -r "api_key\s*=" src/ --include="*.ts" || true
247
+ grep -r "secret" src/ --include="*.ts" || true
248
+
249
+ # Deep analysis with Gemini
250
+ gemini -p "@src/ @api/
251
+ Security review:
252
+ - Input validation practices
253
+ - Authentication/authorization patterns
254
+ - SQL injection protections
255
+ - XSS prevention measures
256
+ - Secrets in code
257
+ - CORS configuration"
258
+ ```
259
+
260
+ **Security Dashboard:**
261
+
262
+ | Check | Status | Issues |
263
+ | ----------------- | ------- | ------------------------- |
264
+ | npm audit | Pass | 0 vulnerabilities |
265
+ | Hardcoded secrets | Warning | 2 potential matches |
266
+ | Auth patterns | OK | Using established library |
267
+ | Input validation | Warning | 5 unvalidated endpoints |
268
+ | CORS | OK | Properly configured |
269
+
270
+ ---
271
+
272
+ ## Phase 5: Ready Work
18
273
 
19
274
  Find actionable tasks with no blockers:
20
275
 
@@ -22,41 +277,195 @@ Find actionable tasks with no blockers:
22
277
  bd_ls({ status: "ready", limit: 10, offset: 0 });
23
278
  ```
24
279
 
25
- This shows beads that are unblocked and ready to start. Use `/implement <bead-id>` to begin work on any of these.
280
+ ### Ready Work Table
26
281
 
27
- ## Detailed Analysis (On Request)
282
+ | ID | Title | Type | Priority | Tags |
283
+ | ------ | ------------- | ------- | -------- | ----------- |
284
+ | bd-123 | Add user auth | feature | P1 | backend |
285
+ | bd-124 | Fix login bug | bug | P0 | urgent |
286
+ | bd-125 | Update deps | task | P2 | maintenance |
28
287
 
29
- ### Task Overview
288
+ **Blocked Work:**
30
289
 
31
290
  ```typescript
32
- bd_ls({ status: "open", limit: 10, offset: 0 });
33
- bd_ls({ status: "ready", limit: 10, offset: 0 });
291
+ bd_ls({ status: "blocked", limit: 5, offset: 0 });
292
+ ```
293
+
294
+ | ID | Title | Blocked By | Action Needed |
295
+ | ------ | -------------- | ---------- | ------------------- |
296
+ | bd-130 | Deploy to prod | bd-124 | Fix login bug first |
297
+
298
+ ---
299
+
300
+ ## Phase 6: Health Score
301
+
302
+ Calculate overall project health:
303
+
304
+ ```
305
+ Health Score = 100 - (penalties)
306
+
307
+ Penalties:
308
+ - Each high/critical vulnerability: -10 (max -30)
309
+ - Each major outdated dependency: -2 (max -10)
310
+ - Type errors present: -15
311
+ - Test coverage < 80%: -10
312
+ - Test coverage < 60%: -20
313
+ - CI failing: -20
314
+ - No README: -5
315
+ - No CHANGELOG: -3
316
+ - Lint errors > 0: -5
317
+ - TODO count > 50: -5
318
+
319
+ Score interpretation:
320
+ 90-100: Excellent - Ship with confidence
321
+ 75-89: Good - Minor issues to address
322
+ 60-74: Fair - Technical debt accumulating
323
+ < 60: Poor - Significant attention needed
324
+ ```
325
+
326
+ ### Health Score Output
327
+
328
+ ```markdown
329
+ ## Project Health Score: 82/100 (Good)
330
+
331
+ ### Score Breakdown
332
+
333
+ | Category | Score | Notes |
334
+ | ------------- | ----- | ------------------------ |
335
+ | Security | 20/20 | No vulnerabilities |
336
+ | Dependencies | 18/20 | 2 major outdated |
337
+ | Tests | 15/20 | 78% coverage (below 80%) |
338
+ | Code Quality | 15/20 | 5 lint errors |
339
+ | CI/CD | 10/10 | Passing |
340
+ | Documentation | 4/10 | Missing CONTRIBUTING.md |
341
+
342
+ ### Priority Actions
343
+
344
+ 1. **Fix 5 lint errors** → `npm run lint -- --fix`
345
+ 2. **Increase test coverage** → Focus on uncovered files
346
+ 3. **Update 2 major deps** → `npm update`
347
+ 4. **Add CONTRIBUTING.md** → Document contribution process
34
348
  ```
35
349
 
36
- For active beads, read spec from `.beads/artifacts/<bead-id>/spec.md`
350
+ ---
351
+
352
+ ## Phase 7: Recommendations & Actions
353
+
354
+ Based on analysis, generate actionable recommendations:
37
355
 
38
- ### Blocked Work
356
+ ### Immediate Actions
39
357
 
40
- Check what's blocking progress:
358
+ | Priority | Issue | Command | Bead Created |
359
+ | -------- | ---------------- | ----------------------- | ------------ |
360
+ | P0 | CI failing | Check `gh run view` | - |
361
+ | P1 | 2 security vulns | `npm audit fix` | bd-xxx |
362
+ | P2 | 5 lint errors | `npm run lint -- --fix` | - |
363
+
364
+ ### Create Beads for Issues
365
+
366
+ For significant findings, create tracking issues:
41
367
 
42
368
  ```typescript
43
- bd_ls({ status: "blocked", limit: 10, offset: 0 });
369
+ // For security vulnerabilities
370
+ bd_add({
371
+ title: "[Security] Fix npm audit vulnerabilities",
372
+ desc: "npm audit found 2 high severity vulnerabilities:\n- lodash: prototype pollution\n- axios: SSRF\n\nRun: npm audit fix --force",
373
+ type: "bug",
374
+ pri: 1,
375
+ tags: ["security", "dependencies"],
376
+ });
377
+
378
+ // For test coverage
379
+ bd_add({
380
+ title: "[Quality] Increase test coverage to 80%",
381
+ desc: "Current coverage: 78%\nTarget: 80%\n\nUncovered files:\n- src/auth/login.ts\n- src/api/users.ts",
382
+ type: "task",
383
+ pri: 2,
384
+ tags: ["testing", "quality"],
385
+ });
44
386
  ```
45
387
 
46
- For each blocked bead, identify the blocker and either resolve it or escalate.
388
+ ### Suggested Follow-up Commands
389
+
390
+ Based on findings:
391
+
392
+ | Finding | Suggested Command |
393
+ | --------------------- | ------------------------------------- |
394
+ | Ready tasks available | `/implement <bead-id>` |
395
+ | Test coverage low | `/research test coverage strategies` |
396
+ | Security issues | `/fix security` |
397
+ | Outdated deps | `npm update` or `/research migration` |
398
+ | Architecture unclear | `/research architecture` |
399
+ | Design system issues | `/design-audit codebase` |
400
+
401
+ ---
402
+
403
+ ## Output Modes
47
404
 
48
- ### Project Structure
405
+ ### --quick (Default)
49
406
 
50
- - Key directories
51
- - Recent modifications
52
- - Architecture patterns
53
- - Build configuration
54
- - Testing setup
407
+ - Status dashboard only
408
+ - Ready work list
409
+ - ~30 seconds
410
+
411
+ ### --health
412
+
413
+ - Quick status + health metrics
414
+ - Dependency/security scan
415
+ - Health score
416
+ - ~2-3 minutes
417
+
418
+ ### --deep
419
+
420
+ - Full analysis including Gemini-powered insights
421
+ - Architecture, test gaps, code smells
422
+ - ~10-15 minutes
423
+
424
+ ### --security
425
+
426
+ - Security-focused analysis
427
+ - npm audit, secret detection, pattern analysis
428
+ - Gemini security review
429
+ - ~5-10 minutes
430
+
431
+ ---
432
+
433
+ ## Examples
434
+
435
+ ```bash
436
+ # Quick status check
437
+ /analyze-project
438
+
439
+ # Full health assessment
440
+ /analyze-project --health
441
+
442
+ # Deep analysis for large codebase
443
+ /analyze-project --deep
444
+
445
+ # Security audit
446
+ /analyze-project --security
447
+ ```
448
+
449
+ ---
450
+
451
+ ## Storage
452
+
453
+ Save analysis to `.opencode/memory/project/analysis-[YYYY-MM-DD].md` for trend tracking.
454
+
455
+ Compare with previous analysis:
456
+
457
+ ```bash
458
+ read .opencode/memory/project/analysis-*.md
459
+ ```
460
+
461
+ ---
55
462
 
56
- ### Recommendations
463
+ ## Related Commands
57
464
 
58
- - **Immediate:** Tasks from `bd_ls({ status: "ready" })` to start now
59
- - **Blocked:** Dependencies preventing progress
60
- - **Attention:** Areas needing cleanup or refactoring
61
- - **Updates:** Dependency updates needed
62
- - **Patterns:** Code patterns to follow
465
+ | Need | Command |
466
+ | ------------------- | ------------------------------------- |
467
+ | Start ready work | `/implement <bead-id>` |
468
+ | Review codebase | `/review-codebase` |
469
+ | Check design system | `/design-audit` |
470
+ | Security deep dive | `/research security best practices` |
471
+ | Dependency update | `/research migration to [package] vX` |