opencodekit 0.23.3 → 0.23.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/README.md +7 -14
  2. package/dist/index.js +1 -1
  3. package/dist/template/.opencode/AGENTS.md +89 -17
  4. package/dist/template/.opencode/README.md +43 -6
  5. package/dist/template/.opencode/artifacts/harness-workflows/plan.md +317 -0
  6. package/dist/template/.opencode/command/audit.md +65 -0
  7. package/dist/template/.opencode/command/init.md +19 -2
  8. package/dist/template/.opencode/command/research.md +67 -16
  9. package/dist/template/.opencode/command/ship.md +55 -5
  10. package/dist/template/.opencode/command/verify.md +5 -5
  11. package/dist/template/.opencode/opencode.json +12 -0
  12. package/dist/template/.opencode/plugin/README.md +0 -6
  13. package/dist/template/.opencode/skill/defense-in-depth/SKILL.md +0 -2
  14. package/dist/template/.opencode/skill/development-lifecycle/SKILL.md +11 -9
  15. package/dist/template/.opencode/skill/manifest.json +77 -0
  16. package/dist/template/.opencode/workflows/audit-pattern.md +51 -0
  17. package/dist/template/.opencode/workflows/batch-implement.md +82 -0
  18. package/dist/template/.opencode/workflows/deep-research.md +58 -0
  19. package/dist/template/.opencode/workflows/development-lifecycle-workflow.md +129 -0
  20. package/package.json +1 -1
  21. package/dist/template/.opencode/command/clarify.md +0 -46
  22. package/dist/template/.opencode/command/commit.md +0 -53
  23. package/dist/template/.opencode/command/design.md +0 -129
  24. package/dist/template/.opencode/command/explore.md +0 -169
  25. package/dist/template/.opencode/command/improve-architecture.md +0 -55
  26. package/dist/template/.opencode/command/pr.md +0 -148
  27. package/dist/template/.opencode/command/refactor.md +0 -65
  28. package/dist/template/.opencode/command/review-codebase.md +0 -128
  29. package/dist/template/.opencode/command/test.md +0 -66
  30. package/dist/template/.opencode/command/ui-review.md +0 -109
  31. package/dist/template/.opencode/opencodex-fast.jsonc +0 -3
  32. package/dist/template/.opencode/plugin/rtk.ts +0 -43
  33. package/dist/template/.opencode/skill/agent-teams/SKILL.md +0 -268
  34. package/dist/template/.opencode/skill/code-navigation/SKILL.md +0 -142
  35. package/dist/template/.opencode/skill/condition-based-waiting/SKILL.md +0 -135
  36. package/dist/template/.opencode/skill/condition-based-waiting/example.ts +0 -171
  37. package/dist/template/.opencode/skill/context-engineering/SKILL.md +0 -176
  38. package/dist/template/.opencode/skill/memory-system/SKILL.md +0 -147
  39. package/dist/template/.opencode/skill/structured-edit/SKILL.md +0 -191
  40. package/dist/template/.opencode/skill/ubiquitous-language/SKILL.md +0 -184
  41. package/dist/template/.opencode/skill/v0/SKILL.md +0 -158
@@ -1,148 +0,0 @@
1
- ---
2
- description: Create and submit a pull request
3
- argument-hint: "[--draft]"
4
- agent: build
5
- ---
6
-
7
- # Pull Request
8
-
9
- ## Load Skills
10
-
11
- ```typescript
12
- skill({ name: "verification-before-completion" });
13
- ```
14
-
15
- ## Parse Arguments
16
-
17
- | Argument | Default | Description |
18
- | --------- | ------- | ------------------ |
19
- | `--draft` | false | Create as draft PR |
20
-
21
- ## Phase 1: Pre-PR Verification
22
-
23
- ```bash
24
- git status --porcelain
25
- ```
26
-
27
- If uncommitted changes exist, ask whether to commit first.
28
-
29
- All gates must pass before creating the PR.
30
-
31
- Check `package.json` scripts, `Makefile`, or `justfile` for project-specific commands first — prefer those over generic defaults.
32
-
33
- If any gate fails, stop. Fix errors first, then run `/pr` again.
34
-
35
- ## Phase 2: Gather Context
36
-
37
- ### Memory Grounding
38
-
39
- Search memory for relevant findings to include in the PR description.
40
-
41
- ### Git Context
42
-
43
- ```bash
44
- git branch --show-current
45
- git log main...HEAD --oneline
46
- git diff main...HEAD --stat
47
- ```
48
-
49
- Read `.opencode/artifacts/$(cat .opencode/artifacts/.active)/spec.md` to extract goal and success criteria for the PR description.
50
-
51
- ## Phase 2B: Pre-PR Review
52
-
53
- This is the last gate before code hits GitHub. Run it every time.
54
-
55
- Run **5 parallel agents** for review: security/correctness, performance/architecture, type-safety/tests, conventions/patterns, simplicity/completeness.
56
-
57
- ```bash
58
- BASE_SHA=$(git rev-parse origin/main 2>/dev/null || git merge-base HEAD origin/main)
59
- HEAD_SHA=$(git rev-parse HEAD)
60
- ```
61
-
62
- Fill placeholders:
63
-
64
- - `{WHAT_WAS_IMPLEMENTED}`: what this PR delivers (from git log summary)
65
- - `{PLAN_OR_REQUIREMENTS}`: PRD path or brief requirements
66
- - `{BASE_SHA}` / `{HEAD_SHA}`: from above
67
-
68
- **Gate rule:** All Critical issues must be resolved before pushing. No exceptions.
69
- Important issues: fix or document as known limitation in PR body.
70
-
71
- After fixing issues, re-run verification gates from Phase 1 if code was changed.
72
-
73
- ## Phase 3: Push and Confirm
74
-
75
- Show what will be pushed and ask the user:
76
-
77
- ```typescript
78
- question({
79
- questions: [
80
- {
81
- header: "Push",
82
- question: "Ready to push and create PR. Proceed?",
83
- options: [
84
- { label: "Push & create PR (Recommended)", description: "Push branch and create PR" },
85
- { label: "Push & draft PR", description: "Create as draft for review" },
86
- { label: "Show diff first", description: "Review changes before pushing" },
87
- ],
88
- },
89
- ],
90
- });
91
- ```
92
-
93
- If confirmed:
94
-
95
- ```bash
96
- git push -u origin $(git branch --show-current)
97
- ```
98
-
99
- ## Phase 4: Create PR
100
-
101
- ```bash
102
- # Verify gh CLI is installed
103
- command -v gh >/dev/null 2>&1 || { echo "Error: gh CLI not found. Install: https://cli.github.com"; exit 1; }
104
-
105
- gh pr create --title "<title>" --body "$(cat <<'EOF'
106
- ## Summary
107
-
108
- [1-2 sentences: what this PR does and why]
109
-
110
- ## Changes
111
-
112
- - `file.ts`: [what changed]
113
- - `other.ts`: [what changed]
114
-
115
- ## Testing
116
-
117
- - All tests pass
118
- - Lint and typecheck pass
119
- - Manual verification: [how to test]
120
-
121
- ## Checklist
122
-
123
- - [x] Tests added/updated
124
- - [x] All gates pass
125
- - [ ] Docs updated (if applicable)
126
- EOF
127
- )"
128
- ```
129
-
130
- If `--draft`, add `--draft` flag.
131
-
132
- Add a link to `.opencode/artifacts/$(cat .opencode/artifacts/.active)/spec.md` for requirements context.
133
-
134
- ## Output
135
-
136
- Report:
137
-
138
- 1. PR URL
139
- 2. Status (Ready for Review / Draft)
140
- 3. Branch → main
141
- 4. Gate results
142
-
143
- ## Related Commands
144
-
145
- | Need | Command |
146
- | ------------ | -------------- |
147
- | Ship first | `/ship <id>` |
148
- | Verify first | `/verify <id>` |
@@ -1,65 +0,0 @@
1
- ---
2
- description: Refactor code for clarity, performance, or maintainability
3
- argument-hint: "<file or path> [--scope minimal|moderate|aggressive]"
4
- agent: build
5
- ---
6
-
7
- # Refactor: $ARGUMENTS
8
-
9
- Improve code quality without changing external behavior.
10
-
11
- ## Load Skills
12
-
13
- ```typescript
14
- skill({ name: "verification-before-completion" });
15
- ```
16
-
17
- ## Parse Arguments
18
-
19
- | Argument | Default | Description |
20
- |---|---|---|
21
- | `<file or path>` | required | File or directory to refactor |
22
- | `--scope` | minimal | `minimal` (rename/restructure), `moderate` (extract modules), `aggressive` (redesign) |
23
-
24
- ## When to Refactor
25
-
26
- - Module has grown beyond its original purpose
27
- - Tests are hard to write because of tight coupling
28
- - Similar logic appears in multiple places
29
- - Files have crossed 300+ lines with unclear boundaries
30
-
31
- ## Process
32
-
33
- ### Phase 1: Assess
34
-
35
- 1. Read all files in scope
36
- 2. Identify: duplication, shallow interfaces, unclear naming, mixed concerns
37
- 3. Plan the refactor — show plan if >3 files would change
38
-
39
- ### Phase 2: Lock Behavior
40
-
41
- - If the module has tests, they must still pass after refactor
42
- - If no tests exist, run existing verification (typecheck, lint)
43
- - No behavior changes in a refactor — external API must be preserved
44
-
45
- ### Phase 3: Execute
46
-
47
- - One change at a time, verify after each
48
- - Prefer small commits with clear messages
49
- - `refactor(scope): what changed`
50
-
51
- ### Phase 4: Verify
52
-
53
- ```bash
54
- npm run typecheck
55
- npm run lint
56
- npm test
57
- ```
58
-
59
- ## Output
60
-
61
- Report:
62
- 1. What changed and why
63
- 2. Files modified
64
- 3. Verification results
65
- 4. What was left for future refactors
@@ -1,128 +0,0 @@
1
- ---
2
- description: Review code for quality, security, and compliance
3
- argument-hint: "[path|pr-number|'all'] [--quick|--thorough]"
4
- agent: review
5
- ---
6
-
7
- # Review: $ARGUMENTS
8
-
9
- ## Determine Input Type
10
-
11
- | Input Type | Detection | Action |
12
- | --------------------- | ---------------------------- | -------------------------- |
13
- | No arguments | Default | Review uncommitted changes |
14
- | Commit hash (40-char) | SHA pattern | `git show <hash>` |
15
- | Branch name | String, not matching above | `git diff main...HEAD` |
16
- | PR URL/number | Contains "github.com" or "#" | `gh pr diff` |
17
- | Current plan | `.opencode/artifacts/$(cat .opencode/artifacts/.active)/spec.md` | Review against spec |
18
-
19
- ## Before You Review
20
-
21
- - **Be certain**: Only flag issues you can verify with tools
22
- - **Don't invent problems**: If an edge case isn't specified, don't flag it
23
- - **Don't be a zealot about style**: Unless it violates project conventions, don't flag
24
- - **Review the changes**: Don't review pre-existing code that wasn't modified
25
- - **Investigate first**: If unsure, use explore/scout agents before flagging
26
-
27
- ## Available Tools
28
-
29
- | Tool | Use When |
30
- | -------------------- | --------------------------------------- |
31
- | `explore` | Finding patterns in codebase, prior art |
32
- | `scout` | External research, best practices |
33
- | `lsp` | Finding symbol definitions, references |
34
- | `srcwalk find` | Finding code patterns |
35
- | `codesearch` | Real-world usage examples |
36
-
37
- ## Phase 1: Gather Context
38
-
39
- ```bash
40
- git status --short
41
- git diff --cached # staged
42
- git diff # unstaged
43
- ```
44
-
45
- For each changed file:
46
-
47
- - Read the full file to understand context
48
- - Don't rely on diff alone — code that looks wrong in isolation may be correct
49
-
50
- If plan exists, read `.opencode/artifacts/$(cat .opencode/artifacts/.active)/spec.md` to review against spec.
51
-
52
- ## Phase 2: Determine Scope
53
-
54
- | Input | Scope | How to Get Code |
55
- | ------------------------ | --------------------- | ------------------------- |
56
- | File/directory path | That path only | `read` or `glob` + `read` |
57
- | Current plan | Implementation vs spec | Read `.opencode/artifacts/$(cat .opencode/artifacts/.active)/spec.md` then `git diff` |
58
- | PR number (e.g., `#45`) | PR changes | `gh pr diff 45` |
59
- | `all` or empty | Recent changes | `git diff main...HEAD` |
60
-
61
- If plan exists, read `.opencode/artifacts/$(cat .opencode/artifacts/.active)/spec.md` to review against spec.
62
-
63
- ## Phase 3: Automated Checks
64
-
65
- Use the `verification-before-completion` skill to run gates.
66
-
67
- Check `package.json` scripts, `Makefile`, or `justfile` for project-specific commands first — prefer those over generic defaults.
68
-
69
- Also scan for common issues appropriate to the detected language:
70
-
71
- - Debug statements (`console.log`, `print()`, `println!`, `fmt.Println`)
72
- - Loose typing (`any` in TypeScript, `type: ignore` in Python)
73
- - `TODO|FIXME|HACK` markers
74
- - Hardcoded secrets patterns
75
-
76
- ## Phase 4: Manual Review
77
-
78
- Review each category:
79
-
80
- | Category | Focus |
81
- | ------------------- | ----------------------------------------------------------------------- |
82
- | **Security** | Auth checks, input validation, no secrets in code, injection prevention |
83
- | **Performance** | N+1 queries, unbounded loops, missing pagination, hot path ops |
84
- | **Maintainability** | Complexity, DRY violations, dead code, naming clarity |
85
- | **Error Handling** | Async error handling, error context, sanitized user errors |
86
- | **Testing** | Coverage on changed code, behavior tests, edge cases |
87
- | **Type Safety** | No unjustified `any`, null handling, explicit return types |
88
-
89
- **Depth levels:**
90
-
91
- - `--quick`: Automated checks + skim, critical issues only
92
- - Default: Full automated + manual review
93
- - `--thorough`: Deep analysis of all categories
94
-
95
- ## Phase 5: Report
96
-
97
- Group findings by severity:
98
-
99
- - **Critical** (must fix before merge): with file:line, issue, fix
100
- - **Important** (should fix): with file:line, issue, fix
101
- - **Minor** (nice to have): with file:line, suggestion
102
-
103
- Include:
104
-
105
- 1. Summary metrics (files reviewed, issues by severity)
106
- 2. Strengths (what's done well, with file:line)
107
- 3. Verdict: Ready to merge / With fixes / No
108
- 4. Reasoning (1-2 sentences)
109
-
110
- Record significant findings with `observation()`:
111
-
112
- ```typescript
113
- observation({
114
- type: "discovery", // or "warning", "pattern", "bugfix"
115
- title: "Review: [scope] [key finding]",
116
- narrative: "[What was found, severity, file:line, recommended fix]",
117
- concepts: "code-review, [category]",
118
- confidence: "high",
119
- });
120
- ```
121
-
122
- ## Related Commands
123
-
124
- | Need | Command |
125
- | ------------------- | -------------- |
126
- | Ship after review | `/ship <id>` |
127
- | Verify completeness | `/verify <id>` |
128
- | Check status | `/status` |
@@ -1,66 +0,0 @@
1
- ---
2
- description: Write or generate tests for code
3
- argument-hint: "<file or function> [--unit|--integration|--e2e]"
4
- agent: build
5
- ---
6
-
7
- # Test: $ARGUMENTS
8
-
9
- Write or generate tests for the specified code.
10
-
11
- ## Load Skills
12
-
13
- ```typescript
14
- skill({ name: "test-driven-development" });
15
- skill({ name: "testing-anti-patterns" });
16
- skill({ name: "verification-before-completion" });
17
- ```
18
-
19
- ## Parse Arguments
20
-
21
- | Argument | Default | Description |
22
- |---|---|---|
23
- | `<file or function>` | required | File path or function name to test |
24
- | `--unit` | auto | Unit test (default for utils, helpers) |
25
- | `--integration` | false | Integration test (default for API, DB) |
26
- | `--e2e` | false | End-to-end test (requires full setup) |
27
-
28
- ## Process
29
-
30
- ### Phase 1: Understand
31
-
32
- 1. Read the file and understand the function/module contract
33
- 2. Identify: inputs, outputs, side effects, error states, edge cases
34
- 3. Check existing tests for patterns and structure
35
-
36
- ### Phase 2: Write Tests
37
-
38
- Cover:
39
- - Happy path (expected input → expected output)
40
- - Edge cases (empty, null, boundary values)
41
- - Error states (invalid input, missing dependencies)
42
- - Contract invariants (what must always be true)
43
-
44
- Follow the existing test patterns in the project. If none exist, check `vitest.config.ts`.
45
-
46
- ### Phase 3: Run and Verify
47
-
48
- ```bash
49
- vitest <path> # or npm test
50
- ```
51
-
52
- TDD if writing implementation simultaneously: RED → GREEN → REFACTOR.
53
-
54
- ## Anti-Patterns
55
-
56
- - Testing implementation details instead of behavior
57
- - Mocking without understanding the real dependency
58
- - Test-only code in production files (exporting internals just for tests)
59
- - Brittle assertions (matching full objects when partial match suffices)
60
-
61
- ## Output
62
-
63
- Report:
64
- 1. Tests written
65
- 2. Coverage summary
66
- 3. Verification results
@@ -1,109 +0,0 @@
1
- ---
2
- description: Review UI/UX design for quality, aesthetics, and best practices
3
- argument-hint: "<image-or-component-path> [--responsive] [--dark-mode]"
4
- agent: vision
5
- model: proxypal/gemini-3-pro-preview
6
- ---
7
-
8
- # UI Review: $ARGUMENTS
9
-
10
- ## Load Skills
11
-
12
- ```typescript
13
- skill({ name: "accessibility-audit" }); // WCAG checklists
14
- skill({ name: "frontend-design" }); // Anti-patterns, design quality
15
- ```
16
-
17
- ## Input
18
-
19
- Parse `$ARGUMENTS`:
20
-
21
- - **Path** (required): Image, screenshot, or component file
22
- - **`--responsive`**: Include responsive breakpoint review
23
- - **`--dark-mode`**: Include dark mode review
24
-
25
- ## Review Workflow
26
-
27
- ### 1. Analyze the Input
28
-
29
- Analyze the input:
30
-
31
- - Content inventory (elements, text, icons)
32
- - Visual properties (colors, typography, spacing, layout)
33
- - Design patterns and potential issues
34
-
35
- ### 2. Usability Heuristic Pass
36
-
37
- Before visual scoring, check:
38
-
39
- - System status is visible for async or multi-step work
40
- - Labels and navigation use user vocabulary, not implementation terms
41
- - Users can cancel, undo, go back, retry, or recover from failure
42
- - Controls, names, and layouts are consistent across the surface
43
- - Dangerous or invalid actions are prevented before they happen
44
- - Options and relationships are visible without relying on memory
45
- - High-volume workflows expose efficient paths where appropriate
46
- - Empty/loading/error/success states are present and useful
47
-
48
- Any failure that blocks task completion or recovery is **Critical**, even if the screen looks polished.
49
-
50
- ### 3. Score Categories
51
-
52
- Rate each 1-10 with brief justification:
53
-
54
- | Category | What to Evaluate |
55
- | --------------------------------- | -------------------------------------------------------------- |
56
- | **Information Architecture** | User vocabulary, scope clarity, relationships, navigation |
57
- | **Task Flow & Recovery** | Primary action, cancellation, undo/retry, error recovery |
58
- | **Forms & Data Interaction** | Labels, helper text, validation, selection, bulk actions |
59
- | **Typography** | Hierarchy, readability, weight contrast, intentional choices |
60
- | **Color** | Palette cohesion, contrast, semantic usage, no AI slop |
61
- | **Layout & Spacing** | Visual hierarchy, consistency, alignment, white space |
62
- | **Interactive States** | Hover, focus, active, disabled, loading/error/success coverage |
63
- | **Accessibility & Semantic HTML** | WCAG AA compliance, native semantics, keyboard/focus behavior |
64
- | **Component Consistency** | Shared token DNA: radius, height, border, shadow, states |
65
- | **Visual Polish** | Consistency, attention to detail, motion, shadows, icons |
66
-
67
- ### 4. Conditional Reviews
68
-
69
- **If `--responsive`**: Check at 375px, 768px, 1280px, 1536px+. Flag touch targets, horizontal scroll, text sizing.
70
-
71
- **If `--dark-mode`**: Check contrast on dark backgrounds, adapted colors (not just inverted), shadow adjustments, focus visibility.
72
-
73
- ### 5. Report Findings
74
-
75
- Group by severity:
76
-
77
- - **Critical (Must Fix)**: Accessibility failures, broken interactions, dead-end errors, unsafe destructive actions
78
- - **Warning (Should Fix)**: AI slop patterns, inconsistent spacing, missing states, confusing IA/naming
79
- - **Info (Nice to Have)**: Polish opportunities
80
-
81
- For each finding: location, impact, and recommended fix.
82
-
83
- ## Output
84
-
85
- Deliver:
86
-
87
- 1. Category scores (1-10 each) with justification
88
- 2. Overall assessment (1-2 sentences)
89
- 3. Findings grouped by severity with actionable fixes
90
- 4. Code fixes for critical issues (if reviewing component code)
91
-
92
- ## Record Findings
93
-
94
- ```typescript
95
- observation({
96
- type: "warning",
97
- title: "UI: [Component] [issue type]",
98
- narrative: "Found [issue] in [location]. Impact: [description]...",
99
- concepts: "ui, accessibility, [category]",
100
- confidence: "high",
101
- });
102
- ```
103
-
104
- ## Related Commands
105
-
106
- | Need | Command |
107
- | ------------------- | --------- |
108
- | Design from scratch | `/design` |
109
- | Ship implementation | `/ship` |
@@ -1,3 +0,0 @@
1
- {
2
- "enabled": false
3
- }
@@ -1,43 +0,0 @@
1
- import type { Plugin } from "@opencode-ai/plugin";
2
-
3
- // RTK OpenCode plugin — rewrites commands to use rtk for token savings.
4
- // Requires: rtk >= 0.23.0 in PATH.
5
- //
6
- // This is a thin delegating plugin: all rewrite logic lives in `rtk rewrite`,
7
- // which is the single source of truth (src/discover/registry.rs).
8
- // To add or change rewrite rules, edit the Rust registry — not this file.
9
-
10
- export const RtkOpenCodePlugin: Plugin = async ({ $ }) => {
11
- try {
12
- await $`which rtk`.quiet();
13
- } catch {
14
- console.warn("[rtk] rtk binary not found in PATH — plugin disabled");
15
- return {};
16
- }
17
-
18
- return {
19
- "tool.execute.before": async (input, output) => {
20
- const tool = String(input?.tool ?? "").toLowerCase();
21
- if (tool !== "bash" && tool !== "shell") return;
22
- const args = output?.args;
23
- if (!args || typeof args !== "object") return;
24
-
25
- const command = (args as Record<string, unknown>).command;
26
- if (typeof command !== "string" || !command) return;
27
- // This config is symlinked as both global and project OpenCode config.
28
- // OpenCode may load this plugin twice in that layout, so avoid rewriting
29
- // commands that have already been routed through rtk.
30
- if (/^\s*(?:RTK_[A-Z_]+=\S+\s+)*rtk\b/.test(command)) return;
31
-
32
- try {
33
- const result = await $`rtk rewrite ${command}`.quiet().nothrow();
34
- const rewritten = String(result.stdout).trim();
35
- if (rewritten && rewritten !== command) {
36
- (args as Record<string, unknown>).command = rewritten;
37
- }
38
- } catch {
39
- // rtk rewrite failed — pass through unchanged
40
- }
41
- },
42
- };
43
- };