opencodekit 0.17.1 → 0.17.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. package/dist/index.js +1 -1
  2. package/dist/template/.opencode/AGENT_ALIGNMENT.md +564 -0
  3. package/dist/template/.opencode/agent/build.md +140 -0
  4. package/dist/template/.opencode/agent/general.md +89 -0
  5. package/dist/template/.opencode/agent/plan.md +175 -0
  6. package/dist/template/.opencode/agent/review.md +96 -0
  7. package/dist/template/.opencode/command/create.md +57 -15
  8. package/dist/template/.opencode/command/init-context.md +259 -0
  9. package/dist/template/.opencode/command/init-user.md +103 -0
  10. package/dist/template/.opencode/command/init.md +53 -39
  11. package/dist/template/.opencode/command/plan.md +200 -16
  12. package/dist/template/.opencode/command/ship.md +251 -17
  13. package/dist/template/.opencode/command/start.md +35 -4
  14. package/dist/template/.opencode/memory/_templates/PROJECT.md +58 -0
  15. package/dist/template/.opencode/memory/_templates/ROADMAP.md +93 -0
  16. package/dist/template/.opencode/memory/_templates/STATE.md +89 -0
  17. package/dist/template/.opencode/memory/_templates/tech-stack.md +35 -0
  18. package/dist/template/.opencode/memory/project/project.md +92 -0
  19. package/dist/template/.opencode/memory/project/roadmap.md +142 -0
  20. package/dist/template/.opencode/memory/project/state.md +84 -0
  21. package/dist/template/.opencode/opencode.json +1030 -1027
  22. package/dist/template/.opencode/package.json +1 -1
  23. package/dist/template/.opencode/skill/context-initialization/SKILL.md +60 -0
  24. package/dist/template/.opencode/skill/systematic-debugging/SKILL.md +76 -0
  25. package/dist/template/.opencode/skill/writing-plans/SKILL.md +68 -0
  26. package/package.json +1 -1
@@ -0,0 +1,259 @@
1
+ ---
2
+ description: Initialize GSD-style project planning context with integrated skill usage
3
+ argument-hint: "[--skip-questions] [--brownfield]"
4
+ agent: build
5
+ ---
6
+
7
+ # Init-Context: $ARGUMENTS
8
+
9
+ Initialize GSD-style project planning with integrated skill usage.
10
+
11
+ ## Load Skills
12
+
13
+ ```typescript
14
+ skill({ name: "context-initialization" });
15
+ skill({ name: "brainstorming" });
16
+ skill({ name: "verification-before-completion" });
17
+ ```
18
+
19
+ ## Parse Arguments
20
+
21
+ ```typescript
22
+ const args = {
23
+ skipQuestions: $ARGUMENTS.includes("--skip-questions"),
24
+ brownfield: $ARGUMENTS.includes("--brownfield"),
25
+ focus: $ARGUMENTS.match(/--focus=(\w+)/)?.[1], // Optional: api, ui, db, etc.
26
+ };
27
+ ```
28
+
29
+ ## Phase 1: Discovery
30
+
31
+ ### 1.1 Check Existing Context
32
+
33
+ ```bash
34
+ ls .opencode/memory/project/ 2>/dev/null && HAS_CONTEXT=true || HAS_CONTEXT=false
35
+ cat .opencode/memory/project/project.md 2>/dev/null | head -20
36
+ ```
37
+
38
+ **If context exists:**
39
+
40
+ ```
41
+ Existing planning context found:
42
+ - project.md: [exists/size]
43
+ - roadmap.md: [exists/size]
44
+ - state.md: [exists/size]
45
+
46
+ Options:
47
+ 1. Refresh - Delete and recreate from templates
48
+ 2. Update - Keep existing, only update state.md
49
+ 3. Skip - Use existing context as-is
50
+ ```
51
+
52
+ Wait for user selection.
53
+
54
+ ### 1.2 Brownfield Codebase Analysis (if --brownfield)
55
+
56
+ If `--brownfield` flag is set:
57
+
58
+ ```typescript
59
+ // Spawn parallel analysis agents (like GSD map-codebase)
60
+ skill({ name: "swarm-coordination" });
61
+
62
+ // Agent 1: Map tech stack
63
+ Task({
64
+ subagent_type: "explore",
65
+ description: "Analyze tech stack",
66
+ prompt:
67
+ "Analyze the codebase technology stack. Write findings to .opencode/memory/project/tech-analysis.md covering: languages, frameworks, dependencies, build tools. Return file path and line count only.",
68
+ });
69
+
70
+ // Agent 2: Map architecture
71
+ Task({
72
+ subagent_type: "explore",
73
+ description: "Analyze architecture",
74
+ prompt:
75
+ "Analyze the codebase architecture. Write findings to .opencode/memory/project/arch-analysis.md covering: patterns, directory structure, entry points. Return file path and line count only.",
76
+ });
77
+
78
+ // Wait for agents and collect confirmations
79
+ ```
80
+
81
+ ## Phase 2: Requirements Gathering
82
+
83
+ ### 2.1 Load Brainstorming Skill (if not --skip-questions)
84
+
85
+ ```typescript
86
+ if (!args.skipQuestions) {
87
+ skill({ name: "brainstorming" });
88
+
89
+ // Follow brainstorming process for project vision
90
+ // Ask questions one at a time (as per brainstorming skill)
91
+ // Output: Refined vision, success criteria, target users
92
+ }
93
+ ```
94
+
95
+ ### 2.2 Quick Mode (if --skip-questions)
96
+
97
+ Use template defaults with placeholders for:
98
+
99
+ - Project vision
100
+ - Success criteria
101
+ - Target users
102
+ - Phases
103
+ - Current phase
104
+
105
+ ## Phase 3: Document Creation
106
+
107
+ ### 3.1 Create project.md
108
+
109
+ **Load template:**
110
+
111
+ ```bash
112
+ cat .opencode/memory/_templates/project.md
113
+ ```
114
+
115
+ **Fill with gathered data:**
116
+
117
+ - Vision from brainstorming OR template placeholder
118
+ - Success criteria (3-7 measurable outcomes)
119
+ - Target users (primary/secondary)
120
+ - Core principles (convention over config, minimal, extensible)
121
+ - Current phase (from user input or template default)
122
+
123
+ **Write to:** `.opencode/memory/project/project.md`
124
+
125
+ ### 3.2 Create roadmap.md
126
+
127
+ **Parse phases from input:**
128
+
129
+ ```typescript
130
+ // Convert user-provided phases into structured roadmap
131
+ // Example: "Discovery, MVP, Launch, Scale" → table rows
132
+ ```
133
+
134
+ **Structure:**
135
+
136
+ ```markdown
137
+ | Phase | Goal | Status | Beads |
138
+ | --------- | ------ | -------- | ----- |
139
+ | [Phase 1] | [Goal] | [Status] | [#] |
140
+ ```
141
+
142
+ **Write to:** `.opencode/memory/project/roadmap.md`
143
+
144
+ ### 3.3 Create state.md
145
+
146
+ **Initialize with:**
147
+
148
+ - Active Bead: (blank or from bead context)
149
+ - Status: In Progress
150
+ - Started: [current date]
151
+ - Phase: [from roadmap]
152
+ - Recent Completed Work: (empty table)
153
+ - Active Decisions: (empty table)
154
+ - Blockers: (empty table)
155
+ - Open Questions: (empty table)
156
+ - Next Actions: (empty list)
157
+
158
+ **Write to:** `.opencode/memory/project/state.md`
159
+
160
+ ### 3.4 Brownfield Analysis Integration (if applicable)
161
+
162
+ If `--brownfield` analysis was run:
163
+
164
+ ```typescript
165
+ // Append tech/arch findings to project.md Context Notes section
166
+ // Or create separate .opencode/memory/project/codebase/ documents
167
+ // (similar to GSD's .planning/codebase/ approach)
168
+ ```
169
+
170
+ ## Phase 4: Verification & Security
171
+
172
+ ### 4.1 Verify Documents Created
173
+
174
+ ```bash
175
+ ls -la .opencode/memory/project/
176
+ wc -l .opencode/memory/project/*.md
177
+ ```
178
+
179
+ **Check:**
180
+
181
+ - [ ] project.md exists and >20 lines
182
+ - [ ] roadmap.md exists and >20 lines
183
+ - [ ] state.md exists and >20 lines
184
+ - [ ] All files are readable
185
+
186
+ ### 4.2 Secret Scan (Critical - from GSD pattern)
187
+
188
+ ```bash
189
+ # Scan for accidentally leaked secrets in generated docs
190
+ grep -E '(sk-[a-zA-Z0-9]{20,}|sk_live_[a-zA-Z0-9]+|AKIA[A-Z0-9]{16}|ghp_[a-zA-Z0-9]{36}|-----BEGIN.*PRIVATE KEY)' .opencode/memory/project/*.md 2>/dev/null && SECRETS_FOUND=true || SECRETS_FOUND=false
191
+ ```
192
+
193
+ **If secrets found:** Alert user and pause before proceeding.
194
+
195
+ ### 4.3 Load Verification Skill
196
+
197
+ ```typescript
198
+ skill({ name: "verification-before-completion" });
199
+
200
+ // Run verification checklist:
201
+ // 1. IDENTIFY: Files created, structure valid
202
+ // 2. RUN: Validation commands
203
+ // 3. READ: Check file contents
204
+ // 4. VERIFY: All success criteria met
205
+ // 5. CLAIM: Context initialization complete
206
+ ```
207
+
208
+ ## Phase 5: Beads Integration
209
+
210
+ ### 5.1 Create Initialization Bead (optional)
211
+
212
+ ```bash
213
+ # If user wants to track context setup as a bead
214
+ br create "Initialize project context" --type=task
215
+ br update <bead-id> --status closed --reason="Context files created"
216
+ ```
217
+
218
+ ## Output
219
+
220
+ Creates in `.opencode/memory/project/`:
221
+
222
+ | File | Purpose | Lines (typical) |
223
+ | ------------ | ---------------------------------------- | --------------- |
224
+ | `project.md` | Vision, success criteria, principles | 50-100 |
225
+ | `roadmap.md` | Phases, milestones, bead planning | 80-150 |
226
+ | `state.md` | Current position, blockers, next actions | 60-100 |
227
+
228
+ **If `--brownfield`:**
229
+ Additional files in `.opencode/memory/project/codebase/`:
230
+
231
+ - `tech-analysis.md` - Stack and dependencies
232
+ - `arch-analysis.md` - Architecture patterns
233
+
234
+ ## Success Criteria
235
+
236
+ - [ ] All required documents created from templates
237
+ - [ ] Documents follow template structure
238
+ - [ ] No secrets leaked in generated files
239
+ - [ ] Files pass basic validation (readable, non-empty)
240
+ - [ ] User informed of next steps
241
+
242
+ ## Next Steps
243
+
244
+ After init-context completes:
245
+
246
+ 1. **For new projects:** Use `/plan` to create first implementation plan
247
+ 2. **For brownfield:** Review codebase analysis, then `/plan`
248
+ 3. **For existing beads:** Use `/resume` to continue tracked work
249
+
250
+ ---
251
+
252
+ ## Skill Integration Summary
253
+
254
+ | Skill | When Used | Purpose |
255
+ | -------------------------------- | --------------------------------- | ------------------------------ |
256
+ | `brainstorming` | Phase 2 (if not --skip-questions) | Refine vision and requirements |
257
+ | `swarm-coordination` | Phase 1.2 (if --brownfield) | Parallel codebase analysis |
258
+ | `verification-before-completion` | Phase 4 | Validate created files |
259
+ | `beads` | Phase 5 | Track as bead if desired |
@@ -0,0 +1,103 @@
1
+ ---
2
+ description: Create user profile for personalized AI interactions
3
+ argument-hint: "[--skip-questions]"
4
+ agent: build
5
+ ---
6
+
7
+ # Init-User: $ARGUMENTS
8
+
9
+ Create personalized user profile. Optional but recommended for better AI responses.
10
+
11
+ > **Prerequisite:** Run `/init` first for core setup
12
+ > **Related:** `/init-context` for project planning setup
13
+
14
+ ## Load Skills
15
+
16
+ ```typescript
17
+ skill({ name: "memory-system" });
18
+ ```
19
+
20
+ ## Options
21
+
22
+ | Argument | Default | Description |
23
+ | ------------------ | ------- | ----------------------------------- |
24
+ | `--skip-questions` | false | Infer from git config, skip prompts |
25
+
26
+ ## Phase 1: Gather Preferences
27
+
28
+ Unless `--skip-questions`, ask in one message:
29
+
30
+ 1. **Identity**: "Which git contributor are you?" (show top 5 from `git shortlog -sn --all`)
31
+ 2. **Communication**: "Terse or detailed responses?"
32
+ 3. **Workflow**: "Auto-commit or ask-first?"
33
+ 4. **Rules**: "Any rules I should always follow?"
34
+ 5. **Technical**: "Preferred languages/frameworks?"
35
+
36
+ If skipped, infer from `git config user.name` and `git config user.email`.
37
+
38
+ ## Phase 2: Create user.md
39
+
40
+ From template `.opencode/memory/_templates/user.md`:
41
+
42
+ ```bash
43
+ cp .opencode/memory/_templates/user.md .opencode/memory/project/user.md
44
+ ```
45
+
46
+ Fill in gathered answers:
47
+
48
+ ```markdown
49
+ ---
50
+ purpose: User identity, preferences, communication style
51
+ updated: [today]
52
+ ---
53
+
54
+ # User Profile
55
+
56
+ ## Identity
57
+
58
+ - **Name:** [from answers]
59
+ - **Git:** [user.name] <[user.email]>
60
+
61
+ ## Communication Preferences
62
+
63
+ - **Style:** [Terse/Detailed]
64
+ - **Tone:** [Professional/Casual]
65
+
66
+ ## Workflow Preferences
67
+
68
+ - **Commits:** [Auto/Ask-first]
69
+ - **Beads updates:** [Auto/Ask-first]
70
+
71
+ ## Technical Preferences
72
+
73
+ - **Languages:** [Preferred languages]
74
+ - **Frameworks:** [Preferred frameworks]
75
+
76
+ ## Rules to Always Follow
77
+
78
+ - [Rule 1]
79
+ - [Rule 2]
80
+ - [Rule 3]
81
+ ```
82
+
83
+ ## Phase 3: Update opencode.json
84
+
85
+ Ensure user.md is loaded in instructions:
86
+
87
+ ```json
88
+ {
89
+ "instructions": [
90
+ "file://.opencode/AGENTS.md",
91
+ "file://.opencode/memory/project/tech-stack.md",
92
+ "file://.opencode/memory/project/user.md"
93
+ ]
94
+ }
95
+ ```
96
+
97
+ ## Phase 4: Report
98
+
99
+ Output:
100
+
101
+ 1. user.md created at `.opencode/memory/project/user.md`
102
+ 2. Preferences captured
103
+ 3. Next step: `/init-context` for GSD planning workflow
@@ -1,40 +1,28 @@
1
1
  ---
2
- description: Initialize project for AI-assisted development (creates AGENTS.md + memory files)
3
- argument-hint: "[--deep] [--skip-questions]"
2
+ description: Initialize core project setup (AGENTS.md + tech-stack detection only)
3
+ argument-hint: "[--deep]"
4
4
  agent: build
5
5
  ---
6
6
 
7
7
  # Init: $ARGUMENTS
8
8
 
9
- One command to onboard a project. Creates project-root AGENTS.md and populates memory files.
9
+ Core project setup. Creates AGENTS.md and detects tech stack. Run once per project.
10
+
11
+ > **Next steps:** `/init-user` for personalization, `/init-context` for GSD planning workflow
10
12
 
11
13
  ## Load Skills
12
14
 
13
15
  ```typescript
14
- skill({ name: "memory-system" });
15
16
  skill({ name: "index-knowledge" });
16
17
  ```
17
18
 
18
19
  ## Options
19
20
 
20
- | Argument | Default | Description |
21
- | ------------------ | ------- | ----------------------------------------- |
22
- | `--deep` | false | Comprehensive research (~100+ tool calls) |
23
- | `--skip-questions` | false | Infer from git config, skip prompts |
24
-
25
- ## Phase 1: Upfront Questions
26
-
27
- Unless `--skip-questions`, ask in one message:
28
-
29
- 1. **Identity**: "Which git contributor are you?" (show top 5 from `git shortlog -sn --all`)
30
- 2. **Communication**: "Terse or detailed responses?"
31
- 3. **Workflow**: "Auto-commit or ask-first?"
32
- 4. **Rules**: "Any rules I should always follow?"
33
- 5. **Beads**: "Use beads for task tracking?"
34
-
35
- If skipped, infer identity from `git config user.name` and `git config user.email`.
21
+ | Argument | Default | Description |
22
+ | -------- | ------- | ----------------------------------------- |
23
+ | `--deep` | false | Comprehensive research (~100+ tool calls) |
36
24
 
37
- ## Phase 2: Detect Project
25
+ ## Phase 1: Detect Project
38
26
 
39
27
  Detect and validate:
40
28
 
@@ -44,7 +32,29 @@ Detect and validate:
44
32
  - Existing AI rules (`.cursor/rules/`, `.cursorrules`, `.github/copilot-instructions.md`)
45
33
  - Top-level directory structure
46
34
 
47
- With `--deep`: Also analyze git history (contributors, commit conventions, branching strategy), source patterns, and subsystem candidates.
35
+ With `--deep`: Also analyze git history, source patterns, subsystem candidates.
36
+
37
+ ## Phase 2: Preview Detection
38
+
39
+ After detecting project, show summary and ask for confirmation:
40
+
41
+ ```typescript
42
+ question({
43
+ questions: [
44
+ {
45
+ header: "Preview",
46
+ question: `Detected: ${detectedTechStack}. Create AGENTS.md?`,
47
+ options: [
48
+ { label: "Yes, create it (Recommended)" },
49
+ { label: "Show me what you'll write first" },
50
+ { label: "Cancel" },
51
+ ],
52
+ },
53
+ ],
54
+ });
55
+ ```
56
+
57
+ **If "Show me":** Display detected values without writing files, then ask again.
48
58
 
49
59
  ## Phase 3: Create AGENTS.md
50
60
 
@@ -58,16 +68,23 @@ Create `./AGENTS.md` — **target <60 lines** (max 150). Follow the `index-knowl
58
68
  - Boundaries (always/ask-first/never)
59
69
  - Gotchas
60
70
 
61
- **Principles**: Examples > explanations. Pointers > copies. If AGENTS.md already exists, improve it — don't overwrite blindly.
71
+ **Principles**: Examples > explanations. Pointers > copies. If AGENTS.md exists, improve it — don't overwrite blindly.
72
+
73
+ ## Phase 4: Create tech-stack.md
62
74
 
63
- ## Phase 4: Populate Memory Files
75
+ From template `.opencode/memory/_templates/tech-stack.md`:
64
76
 
65
- Read templates from `.opencode/memory/_templates/`, then create:
77
+ ```bash
78
+ cp .opencode/memory/_templates/tech-stack.md .opencode/memory/project/tech-stack.md
79
+ ```
66
80
 
67
- - `.opencode/memory/project/user.md` — from Phase 1 answers
68
- - `.opencode/memory/project/tech-stack.md` — from Phase 2 detection
81
+ Fill detected values:
69
82
 
70
- Use `write()` for markdown files on disk (not `memory-update()` which writes to SQLite).
83
+ - Framework, language, runtime
84
+ - Styling, components, design system
85
+ - Database, ORM, state management
86
+ - Testing tools
87
+ - Verification commands
71
88
 
72
89
  ## Phase 5: Subsystems (--deep only)
73
90
 
@@ -79,25 +96,22 @@ Identify candidates for nested AGENTS.md:
79
96
 
80
97
  Ask user before creating nested files.
81
98
 
82
- ## Phase 6: Initialize Beads (if requested)
83
-
84
- ```bash
85
- br init
86
- ```
87
-
88
- ## Phase 7: Verify and Report
99
+ ## Phase 6: Verify and Report
89
100
 
90
101
  Verify:
91
102
 
92
- - [ ] AGENTS.md is <60 lines (or justified if longer)
103
+ - [ ] AGENTS.md is <60 lines (or justified)
93
104
  - [ ] Commands validated and work
94
105
  - [ ] Boundaries include Never rules
95
- - [ ] At least one code example from actual codebase
96
- - [ ] Memory files created with accurate info
106
+ - [ ] Code example from actual codebase
107
+ - [ ] tech-stack.md created
97
108
 
98
109
  Output:
99
110
 
100
111
  1. Files created (with line counts)
101
112
  2. Tech stack detected
102
113
  3. Commands validated (yes/no)
103
- 4. Suggested next steps: review AGENTS.md, run `/review-codebase`
114
+ 4. Suggested next steps:
115
+ - `/init-user` — Create user profile
116
+ - `/init-context` — Set up GSD planning workflow
117
+ - `/review-codebase` — Deep codebase analysis