opencodekit 0.23.2 → 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.
- package/README.md +7 -14
- package/dist/index.js +1 -1
- package/dist/template/.opencode/AGENTS.md +92 -19
- package/dist/template/.opencode/README.md +43 -6
- package/dist/template/.opencode/artifacts/harness-workflows/plan.md +317 -0
- package/dist/template/.opencode/command/audit.md +65 -0
- package/dist/template/.opencode/command/init.md +19 -2
- package/dist/template/.opencode/command/research.md +67 -16
- package/dist/template/.opencode/command/ship.md +55 -5
- package/dist/template/.opencode/command/verify.md +5 -5
- package/dist/template/.opencode/opencode.json +12 -0
- package/dist/template/.opencode/plugin/README.md +0 -6
- package/dist/template/.opencode/plugin/codesearch.ts +730 -0
- package/dist/template/.opencode/plugin/memory/tools.ts +6 -6
- package/dist/template/.opencode/plugin/session-summary.ts +0 -2
- package/dist/template/.opencode/plugin/srcwalk.ts +22 -157
- package/dist/template/.opencode/skill/code-review-and-quality/SKILL.md +1 -1
- package/dist/template/.opencode/skill/debugging-and-error-recovery/SKILL.md +1 -1
- package/dist/template/.opencode/skill/deep-module-design/SKILL.md +1 -1
- package/dist/template/.opencode/skill/defense-in-depth/SKILL.md +0 -2
- package/dist/template/.opencode/skill/development-lifecycle/SKILL.md +11 -9
- package/dist/template/.opencode/skill/manifest.json +77 -0
- package/dist/template/.opencode/skill/planning-and-task-breakdown/SKILL.md +1 -1
- package/dist/template/.opencode/skill/srcwalk/SKILL.md +10 -13
- package/dist/template/.opencode/tool/grepsearch.ts +92 -103
- package/dist/template/.opencode/workflows/audit-pattern.md +51 -0
- package/dist/template/.opencode/workflows/batch-implement.md +82 -0
- package/dist/template/.opencode/workflows/deep-research.md +58 -0
- package/dist/template/.opencode/workflows/development-lifecycle-workflow.md +129 -0
- package/package.json +1 -1
- package/dist/template/.opencode/command/clarify.md +0 -46
- package/dist/template/.opencode/command/commit.md +0 -53
- package/dist/template/.opencode/command/design.md +0 -129
- package/dist/template/.opencode/command/explore.md +0 -169
- package/dist/template/.opencode/command/improve-architecture.md +0 -55
- package/dist/template/.opencode/command/pr.md +0 -148
- package/dist/template/.opencode/command/refactor.md +0 -65
- package/dist/template/.opencode/command/review-codebase.md +0 -128
- package/dist/template/.opencode/command/test.md +0 -66
- package/dist/template/.opencode/command/ui-review.md +0 -109
- package/dist/template/.opencode/opencodex-fast.jsonc +0 -3
- package/dist/template/.opencode/plugin/rtk.ts +0 -43
- package/dist/template/.opencode/skill/agent-teams/SKILL.md +0 -268
- package/dist/template/.opencode/skill/code-navigation/SKILL.md +0 -142
- package/dist/template/.opencode/skill/condition-based-waiting/SKILL.md +0 -135
- package/dist/template/.opencode/skill/condition-based-waiting/example.ts +0 -171
- package/dist/template/.opencode/skill/context-engineering/SKILL.md +0 -176
- package/dist/template/.opencode/skill/memory-system/SKILL.md +0 -147
- package/dist/template/.opencode/skill/structured-edit/SKILL.md +0 -191
- package/dist/template/.opencode/skill/ubiquitous-language/SKILL.md +0 -184
- package/dist/template/.opencode/skill/v0/SKILL.md +0 -158
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: UI/UX visual design with aesthetic direction and code output
|
|
3
|
-
argument-hint: "<component|page|system> [topic] [--quick]"
|
|
4
|
-
agent: vision
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# Design: $ARGUMENTS
|
|
8
|
-
|
|
9
|
-
Design a component, page, or design system with a clear aesthetic point of view.
|
|
10
|
-
|
|
11
|
-
> **Design track (optional):** Not part of the core `/create → /ship` workflow.
|
|
12
|
-
> Use when you need visual design guidance before or during implementation.
|
|
13
|
-
|
|
14
|
-
## Parse Arguments
|
|
15
|
-
|
|
16
|
-
| Argument | Default | Description |
|
|
17
|
-
| ----------- | -------- | ------------------------------------------- |
|
|
18
|
-
| `component` | — | Design a specific component |
|
|
19
|
-
| `page` | — | Design a page layout |
|
|
20
|
-
| `system` | — | Create or extend a design system |
|
|
21
|
-
| `[topic]` | required | What to design (e.g. "button", "dashboard") |
|
|
22
|
-
| `--quick` | false | High-level direction only, skip code |
|
|
23
|
-
|
|
24
|
-
## Load Skills
|
|
25
|
-
|
|
26
|
-
```typescript
|
|
27
|
-
skill({ name: "frontend-design" }); // Design system guidance, anti-patterns, references
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
---
|
|
31
|
-
|
|
32
|
-
## Phase 1: Detect Existing Design System
|
|
33
|
-
|
|
34
|
-
```bash
|
|
35
|
-
srcwalk files "**/tailwind.config.{js,ts,mjs}"
|
|
36
|
-
srcwalk files "**/globals.css"
|
|
37
|
-
srcwalk files "**/components.json" # shadcn
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
Read what exists. Don't design in a vacuum — build on the project's current system.
|
|
41
|
-
|
|
42
|
-
---
|
|
43
|
-
|
|
44
|
-
## Phase 2: Check Memory
|
|
45
|
-
|
|
46
|
-
```typescript
|
|
47
|
-
memory - search({ query: "[topic] design UI", limit: 3 });
|
|
48
|
-
memory - search({ query: "design system colors typography", limit: 3 });
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
Reuse existing aesthetic decisions. Don't contradict previous design choices unless the user asks.
|
|
52
|
-
|
|
53
|
-
---
|
|
54
|
-
|
|
55
|
-
## Phase 3: UX Structure Decisions
|
|
56
|
-
|
|
57
|
-
Before visual design, define the interaction structure. A beautiful screen with unclear scope, weak recovery, or missing states is still failed design.
|
|
58
|
-
|
|
59
|
-
State these decisions explicitly:
|
|
60
|
-
|
|
61
|
-
1. **Primary action** — the one dominant action for the component/page/flow
|
|
62
|
-
2. **User-facing vocabulary** — entity/action names the UI will use consistently
|
|
63
|
-
3. **Scope and relationships** — what this UI affects, where the user is, and what related objects matter
|
|
64
|
-
4. **Dangerous actions** — destructive/bulk/account/security actions and their confirm/undo/recovery pattern
|
|
65
|
-
5. **State model** — empty, loading, error, success, disabled, and optimistic states required
|
|
66
|
-
6. **Pattern selection** — form, table/list/grid, notification, modal, or navigation pattern if applicable
|
|
67
|
-
|
|
68
|
-
Keep these decisions concrete and explicit.
|
|
69
|
-
|
|
70
|
-
---
|
|
71
|
-
|
|
72
|
-
## Phase 4: Design
|
|
73
|
-
|
|
74
|
-
The `frontend-design` skill provides all reference material:
|
|
75
|
-
|
|
76
|
-
- Aesthetic directions and design philosophy
|
|
77
|
-
- Typography and font pairing guidance
|
|
78
|
-
- Color systems (OKLCH)
|
|
79
|
-
- Animation patterns (Motion + Tailwind)
|
|
80
|
-
- Anti-patterns and AI slop avoidance
|
|
81
|
-
- shadcn/ui component patterns
|
|
82
|
-
- Tailwind v4 configuration
|
|
83
|
-
|
|
84
|
-
**Before designing, state:**
|
|
85
|
-
|
|
86
|
-
1. **Aesthetic direction** — which style and why
|
|
87
|
-
2. **Key characteristics** — 3 specific elements you'll apply
|
|
88
|
-
3. **UX gates satisfied** — primary action, states, recovery, and accessibility baseline
|
|
89
|
-
|
|
90
|
-
Then produce the design:
|
|
91
|
-
|
|
92
|
-
| Task Type | Output |
|
|
93
|
-
| ----------- | ------------------------------------- |
|
|
94
|
-
| `component` | Spec (variants, sizes, states) + code |
|
|
95
|
-
| `page` | Layout structure + section breakdown |
|
|
96
|
-
| `system` | Tokens (CSS variables) + guidelines |
|
|
97
|
-
|
|
98
|
-
For `--quick`: Skip code output. Provide direction + key decisions only.
|
|
99
|
-
|
|
100
|
-
---
|
|
101
|
-
|
|
102
|
-
## Phase 5: Record Decision
|
|
103
|
-
|
|
104
|
-
```typescript
|
|
105
|
-
observation({
|
|
106
|
-
type: "decision",
|
|
107
|
-
title: "Design: [topic]",
|
|
108
|
-
narrative: "Chose [direction] because [rationale]. Key tokens: [colors, fonts].",
|
|
109
|
-
concepts: "design, ui, [topic]",
|
|
110
|
-
confidence: "high",
|
|
111
|
-
});
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
---
|
|
115
|
-
|
|
116
|
-
## Examples
|
|
117
|
-
|
|
118
|
-
```bash
|
|
119
|
-
/design component button # Full component design with code
|
|
120
|
-
/design page landing --quick # High-level page direction only
|
|
121
|
-
/design system # Create/extend design system tokens
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
## Related Commands
|
|
125
|
-
|
|
126
|
-
| Need | Command |
|
|
127
|
-
| ------------------ | -------------- |
|
|
128
|
-
| Review existing UI | `/ui-review` |
|
|
129
|
-
| Ship it | `/ship <bead>` |
|
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Think through an idea with structured alternatives before committing to a change
|
|
3
|
-
argument-hint: "<idea or question>"
|
|
4
|
-
agent: plan
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# Explore: $ARGUMENTS
|
|
8
|
-
|
|
9
|
-
Think through an idea, problem, or approach with structured alternatives and tradeoffs — before committing to a plan.
|
|
10
|
-
|
|
11
|
-
> **Workflow:** **`/explore`** → `/create` (if worth pursuing) or discard
|
|
12
|
-
>
|
|
13
|
-
> Use when you're not sure WHAT to build or HOW to approach it. This is ideation with rigor, not open-ended brainstorming.
|
|
14
|
-
>
|
|
15
|
-
> **When to use:** Before `/create`, when the approach isn't obvious. Skip for clear, well-scoped work.
|
|
16
|
-
|
|
17
|
-
## Load Skills
|
|
18
|
-
|
|
19
|
-
```typescript
|
|
20
|
-
skill({ name: "brainstorming" }); // Collaborative refinement
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
## Phase 1: Ground
|
|
24
|
-
|
|
25
|
-
Search for prior art and past decisions:
|
|
26
|
-
|
|
27
|
-
```typescript
|
|
28
|
-
memory_search({ query: "<topic keywords>", limit: 5 });
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
```bash
|
|
32
|
-
# What exists in the codebase already?
|
|
33
|
-
git log --oneline -20 | grep -i "<keyword>"
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
Spawn an explore agent to understand the current state:
|
|
37
|
-
|
|
38
|
-
```typescript
|
|
39
|
-
task({
|
|
40
|
-
subagent_type: "explore",
|
|
41
|
-
description: "Map existing patterns for this area",
|
|
42
|
-
prompt: `Search the codebase for existing implementations, patterns, and conventions related to: $ARGUMENTS
|
|
43
|
-
|
|
44
|
-
Return: what exists today, what patterns are used, what files are involved.`,
|
|
45
|
-
});
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
## Phase 2: Frame the Problem
|
|
49
|
-
|
|
50
|
-
Before proposing solutions, state the problem clearly:
|
|
51
|
-
|
|
52
|
-
1. **What's the goal?** (outcome, not task)
|
|
53
|
-
2. **What constraints exist?** (tech stack, time, compatibility, user preferences)
|
|
54
|
-
3. **What's the risk of doing nothing?** (is this urgent or nice-to-have?)
|
|
55
|
-
|
|
56
|
-
If the problem isn't clear after reading context, ask the user to clarify — but max 2 questions.
|
|
57
|
-
|
|
58
|
-
## Phase 3: Generate Alternatives
|
|
59
|
-
|
|
60
|
-
Produce 2-3 approaches. For each:
|
|
61
|
-
|
|
62
|
-
| Aspect | What to Cover |
|
|
63
|
-
| ------------ | -------------------------------------- |
|
|
64
|
-
| **Approach** | 1-2 sentence summary |
|
|
65
|
-
| **How** | Key implementation steps (3-5 bullets) |
|
|
66
|
-
| **Pros** | What this gets right |
|
|
67
|
-
| **Cons** | What this gets wrong or makes harder |
|
|
68
|
-
| **Effort** | S (<1h), M (1-3h), L (1-2d), XL (>2d) |
|
|
69
|
-
| **Risk** | What could go wrong |
|
|
70
|
-
|
|
71
|
-
**Rules for alternatives:**
|
|
72
|
-
|
|
73
|
-
- At least one must be the simplest viable option
|
|
74
|
-
- At least one must be different in kind, not just degree (different architecture, not just different library)
|
|
75
|
-
- Don't pad with bad options to make the recommended one look good
|
|
76
|
-
|
|
77
|
-
## Phase 4: Recommend
|
|
78
|
-
|
|
79
|
-
Pick one approach and explain why:
|
|
80
|
-
|
|
81
|
-
```markdown
|
|
82
|
-
## Recommendation
|
|
83
|
-
|
|
84
|
-
**Approach:** [Name]
|
|
85
|
-
**Effort:** [S/M/L/XL]
|
|
86
|
-
**Why:** [2-3 sentences — why this over the others]
|
|
87
|
-
**When to reconsider:** [What signals would make you switch to an alternative]
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
## Phase 5: Output Proposal
|
|
91
|
-
|
|
92
|
-
Write the proposal as a structured document:
|
|
93
|
-
|
|
94
|
-
```markdown
|
|
95
|
-
# Exploration: [Topic]
|
|
96
|
-
|
|
97
|
-
## Problem
|
|
98
|
-
|
|
99
|
-
[What we're trying to solve]
|
|
100
|
-
|
|
101
|
-
## Constraints
|
|
102
|
-
|
|
103
|
-
- [Constraint 1]
|
|
104
|
-
- [Constraint 2]
|
|
105
|
-
|
|
106
|
-
## Alternatives
|
|
107
|
-
|
|
108
|
-
### Option A: [Name]
|
|
109
|
-
|
|
110
|
-
- **How:** ...
|
|
111
|
-
- **Pros:** ...
|
|
112
|
-
- **Cons:** ...
|
|
113
|
-
- **Effort:** S/M/L/XL
|
|
114
|
-
|
|
115
|
-
### Option B: [Name]
|
|
116
|
-
|
|
117
|
-
- **How:** ...
|
|
118
|
-
- **Pros:** ...
|
|
119
|
-
- **Cons:** ...
|
|
120
|
-
- **Effort:** S/M/L/XL
|
|
121
|
-
|
|
122
|
-
### Option C: [Name] (if applicable)
|
|
123
|
-
|
|
124
|
-
...
|
|
125
|
-
|
|
126
|
-
## Recommendation
|
|
127
|
-
|
|
128
|
-
**Option [X]** because [reasoning].
|
|
129
|
-
**Reconsider if:** [triggers for switching]
|
|
130
|
-
|
|
131
|
-
## Next Step
|
|
132
|
-
|
|
133
|
-
`/create "[description based on chosen approach]"`
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
**If a plan exists:** Save to `.opencode/artifacts/$(cat .opencode/artifacts/.active)/research.md`
|
|
137
|
-
**If no plan:** Display inline, don't create files.
|
|
138
|
-
|
|
139
|
-
## Phase 6: Ask User
|
|
140
|
-
|
|
141
|
-
Present the proposal and ask:
|
|
142
|
-
|
|
143
|
-
```typescript
|
|
144
|
-
question({
|
|
145
|
-
questions: [
|
|
146
|
-
{
|
|
147
|
-
header: "Approach",
|
|
148
|
-
question: "Which approach do you want to pursue?",
|
|
149
|
-
options: [
|
|
150
|
-
{ label: "Option A (Recommended)", description: "[brief]" },
|
|
151
|
-
{ label: "Option B", description: "[brief]" },
|
|
152
|
-
{ label: "Option C", description: "[brief]" },
|
|
153
|
-
{ label: "None — need more research", description: "Spawn scout agents" },
|
|
154
|
-
],
|
|
155
|
-
},
|
|
156
|
-
],
|
|
157
|
-
});
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
If user picks an approach → suggest `/create "[description]"` with the chosen approach baked in.
|
|
161
|
-
If user wants more research → spawn `@scout` for the specific unknowns.
|
|
162
|
-
|
|
163
|
-
## Related Commands
|
|
164
|
-
|
|
165
|
-
| Need | Command |
|
|
166
|
-
| ------------------------- | ----------------------------------- |
|
|
167
|
-
| Commit to an approach | `/create` |
|
|
168
|
-
| Research external options | `/research` |
|
|
169
|
-
| Open-ended ideation | Load `brainstorming` skill directly |
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Proactive architecture health check — find shallow modules, propose deep-module redesigns
|
|
3
|
-
argument-hint: "[path|module|'all'] [--scope surface|deep]"
|
|
4
|
-
agent: review
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# Improve Architecture: $ARGUMENTS
|
|
8
|
-
|
|
9
|
-
Proactive architecture health check. Find shallow modules and propose deep-module redesigns.
|
|
10
|
-
|
|
11
|
-
## Load Skills
|
|
12
|
-
|
|
13
|
-
```typescript
|
|
14
|
-
skill({ name: "deep-module-design" });
|
|
15
|
-
skill({ name: "verification-before-completion" });
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
## Architecture Check
|
|
19
|
-
|
|
20
|
-
Apply Ousterhout's deep module principles:
|
|
21
|
-
- **Small interface** — does this module expose more than it should?
|
|
22
|
-
- **Information hiding** — are implementation details leaking?
|
|
23
|
-
- **Pull complexity downward** — are callers doing work the module should own?
|
|
24
|
-
|
|
25
|
-
## Process
|
|
26
|
-
|
|
27
|
-
### Phase 1: Scan
|
|
28
|
-
|
|
29
|
-
If path given, focus on that directory. If `all`, scan the full project.
|
|
30
|
-
|
|
31
|
-
For each module, assess:
|
|
32
|
-
- Lines of interface vs lines of implementation
|
|
33
|
-
- Number of callers and how they use it
|
|
34
|
-
- What knowledge is embedded but not encapsulated
|
|
35
|
-
- What would break if the module were redesigned
|
|
36
|
-
|
|
37
|
-
### Phase 2: Propose
|
|
38
|
-
|
|
39
|
-
For each finding:
|
|
40
|
-
|
|
41
|
-
| Module | Issue | Proposed Redesign | Effort | Risk |
|
|
42
|
-
|---|---|---|---|---|
|
|
43
|
-
| path/to/module | Shallow interface exposing internals | Encapsulate behind 3 functions | M | Low |
|
|
44
|
-
|
|
45
|
-
### Phase 3: Prioritize
|
|
46
|
-
|
|
47
|
-
Rank proposals by impact/effort ratio. Recommend top 1-3 changes worth making.
|
|
48
|
-
|
|
49
|
-
## Output
|
|
50
|
-
|
|
51
|
-
Report:
|
|
52
|
-
1. Modules reviewed
|
|
53
|
-
2. Findings (current issue, proposed redesign, effort, risk)
|
|
54
|
-
3. Top recommendations
|
|
55
|
-
4. Quick wins (S-effort changes)
|
|
@@ -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` |
|