opencode-bonfire 0.9.6
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 +73 -0
- package/dist/cli.js +156 -0
- package/files/agent/codebase-explorer.md +115 -0
- package/files/agent/doc-writer.md +120 -0
- package/files/agent/spec-writer.md +142 -0
- package/files/agent/work-reviewer.md +130 -0
- package/files/command/bonfire-archive.md +128 -0
- package/files/command/bonfire-configure.md +96 -0
- package/files/command/bonfire-document.md +178 -0
- package/files/command/bonfire-end.md +62 -0
- package/files/command/bonfire-git-strategy.md +91 -0
- package/files/command/bonfire-review.md +158 -0
- package/files/command/bonfire-spec.md +272 -0
- package/files/command/bonfire-start.md +245 -0
- package/files/opencode.json +4 -0
- package/files/package.json +7 -0
- package/files/plugin/bonfire-hooks.ts +51 -0
- package/files/skill/bonfire-context/SKILL.md +56 -0
- package/files/tool/bonfire.ts +103 -0
- package/package.json +37 -0
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Review work for blindspots, gaps, and improvements
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Review Work
|
|
6
|
+
|
|
7
|
+
Strategic review using subagent for analysis, preserving main context for action decisions.
|
|
8
|
+
|
|
9
|
+
## Step 1: Determine Scope
|
|
10
|
+
|
|
11
|
+
Based on $ARGUMENTS:
|
|
12
|
+
- No args: Review current branch vs base
|
|
13
|
+
- `--session`: Review work captured in current session context
|
|
14
|
+
- Topic/area: Focus review on specific aspect
|
|
15
|
+
|
|
16
|
+
## Step 2: Gather Context
|
|
17
|
+
|
|
18
|
+
- Read session context from `<git-root>/.bonfire/index.md`
|
|
19
|
+
- Get branch diff: `git diff main...HEAD` (or appropriate base)
|
|
20
|
+
- Read relevant specs/docs from `.bonfire/`
|
|
21
|
+
- Understand intent: what were we trying to accomplish?
|
|
22
|
+
|
|
23
|
+
## Step 3: Run Review (Subagent)
|
|
24
|
+
|
|
25
|
+
**Progress**: Tell the user "Reviewing work for blindspots and gaps..."
|
|
26
|
+
|
|
27
|
+
Use the task tool to invoke the **work-reviewer** subagent.
|
|
28
|
+
|
|
29
|
+
Provide the review context:
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
Review this work for blindspots, gaps, and improvements.
|
|
33
|
+
|
|
34
|
+
**Scope**: [Branch diff / session work / specific area]
|
|
35
|
+
|
|
36
|
+
**Intent**: [What we were trying to accomplish - from session context]
|
|
37
|
+
|
|
38
|
+
**Files changed**:
|
|
39
|
+
[List of modified files from git diff]
|
|
40
|
+
|
|
41
|
+
**Session context**:
|
|
42
|
+
[Relevant notes from index.md]
|
|
43
|
+
|
|
44
|
+
Return categorized findings with severity and effort estimates.
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
**Wait for the subagent to return findings** before proceeding.
|
|
48
|
+
|
|
49
|
+
The subagent runs in isolated context (sonnet model), preserving main context for action decisions.
|
|
50
|
+
|
|
51
|
+
### Review Validation
|
|
52
|
+
|
|
53
|
+
After the subagent returns, validate the response:
|
|
54
|
+
|
|
55
|
+
**Valid response contains:**
|
|
56
|
+
- `## Summary` with finding counts
|
|
57
|
+
- At least one of: `## Fix Now`, `## Needs Spec`, or `## Create Issues`
|
|
58
|
+
|
|
59
|
+
**On valid response**: Proceed to Step 4.
|
|
60
|
+
|
|
61
|
+
**On partial response** (missing categories but has findings):
|
|
62
|
+
1. Warn user: "Review returned partial results. Some categories may be missing."
|
|
63
|
+
2. Present available findings.
|
|
64
|
+
3. Continue to Step 4.
|
|
65
|
+
|
|
66
|
+
**On invalid/empty response**:
|
|
67
|
+
1. Warn user: "Review subagent returned no findings. I'll review directly."
|
|
68
|
+
2. Fall back to in-context review:
|
|
69
|
+
- Read changed files from git diff
|
|
70
|
+
- Analyze for common issues (missing tests, error handling, etc.)
|
|
71
|
+
- Check for TODOs and incomplete implementations
|
|
72
|
+
3. Present in-context findings using the same format.
|
|
73
|
+
|
|
74
|
+
**On subagent failure** (timeout, error):
|
|
75
|
+
1. Warn user: "Review subagent failed. Continuing with direct review."
|
|
76
|
+
2. Perform in-context review as above.
|
|
77
|
+
|
|
78
|
+
### Resumable Review (Large Changes)
|
|
79
|
+
|
|
80
|
+
For large changesets, review may need multiple passes. The task tool returns a `session_id` you can use to resume.
|
|
81
|
+
|
|
82
|
+
**When to offer resume:**
|
|
83
|
+
- Review covers many files and user wants deeper analysis of specific area
|
|
84
|
+
- Findings mention "additional items omitted" or suggest areas need more attention
|
|
85
|
+
- User wants to focus review on specific aspect (e.g., "look more at tests")
|
|
86
|
+
|
|
87
|
+
**To resume review:**
|
|
88
|
+
1. Tell user: "Review covered [X]. Want deeper analysis of [specific area]?"
|
|
89
|
+
2. If yes, re-invoke work-reviewer with the `session_id` parameter:
|
|
90
|
+
- Pass the session_id from the previous invocation
|
|
91
|
+
- Provide a focused directive: "Continue review focusing on: [specific area]."
|
|
92
|
+
3. Merge findings from resumed review with previous findings.
|
|
93
|
+
4. Repeat if needed, up to 3 passes maximum.
|
|
94
|
+
|
|
95
|
+
**Example multi-pass scenario:**
|
|
96
|
+
- Pass 1: General review → finds 5 issues, notes "test coverage not analyzed"
|
|
97
|
+
- Pass 2 (resume): "Continue review focusing on: test coverage" → finds 3 more test gaps
|
|
98
|
+
- Merge: Combined findings give complete picture
|
|
99
|
+
|
|
100
|
+
## Step 4: Present Findings
|
|
101
|
+
|
|
102
|
+
Present the subagent's findings grouped by recommended action:
|
|
103
|
+
|
|
104
|
+
### Fix Now (trivial effort)
|
|
105
|
+
[List items from subagent that can be fixed immediately]
|
|
106
|
+
|
|
107
|
+
> Ask: "Want me to fix these now?"
|
|
108
|
+
|
|
109
|
+
### Needs Spec (important, needs planning)
|
|
110
|
+
[List items that need implementation planning]
|
|
111
|
+
|
|
112
|
+
> Ask: "Want me to create an implementation spec?"
|
|
113
|
+
|
|
114
|
+
### Create Issues (large effort or nice-to-have)
|
|
115
|
+
[List items for future sessions]
|
|
116
|
+
|
|
117
|
+
> Ask: "Want me to create GitHub/Linear issues?"
|
|
118
|
+
|
|
119
|
+
## Step 5: Execute Chosen Action
|
|
120
|
+
|
|
121
|
+
Based on user choice:
|
|
122
|
+
- **Fix now**: Make the changes directly
|
|
123
|
+
- **Spec**: Run `/bonfire-spec` with findings
|
|
124
|
+
- **Create issues**: See below
|
|
125
|
+
|
|
126
|
+
### Creating Issues
|
|
127
|
+
|
|
128
|
+
First, read `<git-root>/.bonfire/config.json` and check `linearEnabled`.
|
|
129
|
+
|
|
130
|
+
**Offer choices based on config:**
|
|
131
|
+
- Always offer: "Create GitHub issue"
|
|
132
|
+
- If `linearEnabled` is true: Also offer "Create Linear issue"
|
|
133
|
+
|
|
134
|
+
**GitHub Issue Creation:**
|
|
135
|
+
```bash
|
|
136
|
+
gh issue create --title "Finding title" --body "Finding details"
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
**Linear Issue Creation (if enabled):**
|
|
140
|
+
1. Use linear-cli to create the issue:
|
|
141
|
+
```bash
|
|
142
|
+
linear issue create --title "Finding title" --description "Finding details"
|
|
143
|
+
```
|
|
144
|
+
2. On success: Return issue URL/ID
|
|
145
|
+
3. On failure: Warn user, offer to create GitHub issue instead
|
|
146
|
+
|
|
147
|
+
Note: Run `linear issue create --help` to see available options (team, priority, labels, etc.).
|
|
148
|
+
|
|
149
|
+
**For each created issue:**
|
|
150
|
+
- Record the issue ID and URL
|
|
151
|
+
- Note which tracker (GitHub/Linear) was used
|
|
152
|
+
|
|
153
|
+
## Step 6: Update Session Context
|
|
154
|
+
|
|
155
|
+
Add review outcomes to `<git-root>/.bonfire/index.md`:
|
|
156
|
+
- Key findings noted
|
|
157
|
+
- Issues created (with links)
|
|
158
|
+
- Work deferred to future sessions
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Create an implementation spec for a feature or task
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Create Implementation Spec
|
|
6
|
+
|
|
7
|
+
A hybrid approach using subagents: research in isolated context, interview in main context, write in isolated context.
|
|
8
|
+
|
|
9
|
+
## Step 1: Find Git Root
|
|
10
|
+
|
|
11
|
+
Run `git rev-parse --show-toplevel` to locate the repository root.
|
|
12
|
+
|
|
13
|
+
## Step 2: Check Config
|
|
14
|
+
|
|
15
|
+
Read `<git-root>/.bonfire/config.json` if it exists.
|
|
16
|
+
|
|
17
|
+
**Specs location**: Read `specsLocation` from config. Default to `.bonfire/specs/` if not set.
|
|
18
|
+
|
|
19
|
+
## Step 3: Gather Initial Context
|
|
20
|
+
|
|
21
|
+
Get the topic from $ARGUMENTS or ask if unclear.
|
|
22
|
+
|
|
23
|
+
Check for existing context:
|
|
24
|
+
- Read `<git-root>/.bonfire/index.md` for project state
|
|
25
|
+
- Check for `SPEC.md` or `spec.md` in git root (user's spec template)
|
|
26
|
+
- If issue ID provided, note for filename
|
|
27
|
+
|
|
28
|
+
## Step 4: Research Phase (Subagent)
|
|
29
|
+
|
|
30
|
+
**Progress**: Tell the user "Researching codebase for patterns and constraints..."
|
|
31
|
+
|
|
32
|
+
Use the task tool to invoke the **codebase-explorer** subagent for research.
|
|
33
|
+
|
|
34
|
+
Provide a research directive with these questions:
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
Research the codebase for implementing: [TOPIC]
|
|
38
|
+
|
|
39
|
+
Find:
|
|
40
|
+
1. **Patterns**: How similar features are implemented, existing abstractions to reuse, naming conventions
|
|
41
|
+
2. **Constraints**: Dependencies, API boundaries, performance considerations
|
|
42
|
+
3. **Potential Conflicts**: Files that need changes, intersections with existing code, migration concerns
|
|
43
|
+
|
|
44
|
+
Return structured findings only - no raw file contents.
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
**Wait for the subagent to return findings** before proceeding.
|
|
48
|
+
|
|
49
|
+
The subagent runs in isolated context (haiku model, fast), preserving main context for interview.
|
|
50
|
+
|
|
51
|
+
### Research Validation
|
|
52
|
+
|
|
53
|
+
After the subagent returns, validate the response:
|
|
54
|
+
|
|
55
|
+
**Valid response contains at least one of:**
|
|
56
|
+
- `## Patterns Found` with content
|
|
57
|
+
- `## Key Files` with entries
|
|
58
|
+
- `## Constraints Discovered` with items
|
|
59
|
+
|
|
60
|
+
**On valid response**: Proceed to Step 5.
|
|
61
|
+
|
|
62
|
+
**On invalid/empty response**:
|
|
63
|
+
1. Warn user: "Codebase exploration returned limited results. I'll research directly."
|
|
64
|
+
2. Fall back to in-context research using glob, grep, and read:
|
|
65
|
+
- Search for patterns: `glob("**/*.{ts,js,py,go}")` to find code files
|
|
66
|
+
- Look for similar implementations: `grep("pattern-keyword")`
|
|
67
|
+
- Read key files identified
|
|
68
|
+
3. Continue to Step 5 with in-context findings.
|
|
69
|
+
|
|
70
|
+
**On subagent failure** (timeout, error):
|
|
71
|
+
1. Warn user: "Subagent research failed. Continuing with direct exploration."
|
|
72
|
+
2. Perform in-context research as above.
|
|
73
|
+
3. Continue to Step 5.
|
|
74
|
+
|
|
75
|
+
### Resumable Exploration (Large Codebases)
|
|
76
|
+
|
|
77
|
+
For very large codebases, exploration may need multiple passes. The task tool returns a `session_id` you can use to resume.
|
|
78
|
+
|
|
79
|
+
**When to offer resume:**
|
|
80
|
+
- Subagent returns with "X additional items omitted" notes
|
|
81
|
+
- Findings cover only part of the codebase (e.g., backend but not frontend)
|
|
82
|
+
- User asks for deeper exploration of a specific area
|
|
83
|
+
|
|
84
|
+
**To resume exploration:**
|
|
85
|
+
1. Tell user: "Exploration found [X] but there's more to explore. Continue exploring [specific area]?"
|
|
86
|
+
2. If yes, re-invoke codebase-explorer with the `session_id` parameter:
|
|
87
|
+
- Pass the session_id from the previous invocation
|
|
88
|
+
- Provide a refined directive: "Continue exploring: [specific area]. Focus on [what to find]."
|
|
89
|
+
3. Merge findings from resumed exploration with previous findings.
|
|
90
|
+
4. Repeat if needed, up to 3 passes maximum.
|
|
91
|
+
|
|
92
|
+
**Example multi-pass scenario:**
|
|
93
|
+
- Pass 1: "Research authentication" → finds auth middleware, auth service
|
|
94
|
+
- Pass 2 (resume): "Continue exploring: authorization rules" → finds permissions, role checks
|
|
95
|
+
- Merge: Combined findings inform better interview questions
|
|
96
|
+
|
|
97
|
+
## Step 5: Interview Phase (Main Context)
|
|
98
|
+
|
|
99
|
+
**Progress**: Tell the user "Starting interview (3 rounds: core decisions, edge cases, testing & scope)..."
|
|
100
|
+
|
|
101
|
+
Using the research findings, interview the user with **informed questions** via the question tool.
|
|
102
|
+
|
|
103
|
+
### Round 1: Core Decisions
|
|
104
|
+
|
|
105
|
+
**Progress**: "Round 1/3: Core decisions..."
|
|
106
|
+
|
|
107
|
+
Ask about fundamental approach based on patterns found:
|
|
108
|
+
|
|
109
|
+
Example questions (adapt based on actual findings):
|
|
110
|
+
- "I found [Pattern A] in `services/` and [Pattern B] in `handlers/`. Which pattern should this feature follow?"
|
|
111
|
+
- "The existing [Component] handles [X]. Should we extend it or create a new [Y]?"
|
|
112
|
+
- "I see [Library] is used for [purpose]. Should we use it here or try [Alternative]?"
|
|
113
|
+
|
|
114
|
+
### Round 2: Edge Cases & Tradeoffs
|
|
115
|
+
|
|
116
|
+
**Progress**: "Round 2/3: Edge cases and tradeoffs..."
|
|
117
|
+
|
|
118
|
+
Based on Round 1 answers and research, ask about:
|
|
119
|
+
- Error handling approach
|
|
120
|
+
- Edge cases identified in research
|
|
121
|
+
- Performance vs simplicity tradeoffs
|
|
122
|
+
- User experience considerations
|
|
123
|
+
|
|
124
|
+
Example questions:
|
|
125
|
+
- "What should happen when [edge case from research]?"
|
|
126
|
+
- "I found [potential conflict]. How should we handle it?"
|
|
127
|
+
- "[Approach A] is simpler but [tradeoff]. [Approach B] is more complex but [benefit]. Preference?"
|
|
128
|
+
|
|
129
|
+
### Round 3: Testing & Scope (Required)
|
|
130
|
+
|
|
131
|
+
**Progress**: "Round 3/3: Testing and scope (final round)..."
|
|
132
|
+
|
|
133
|
+
Always ask about testing and scope, even if user seems ready to proceed:
|
|
134
|
+
|
|
135
|
+
**Testing** (must ask one):
|
|
136
|
+
- "What's the testing approach? Unit tests, integration tests, manual testing, or skip tests for MVP?"
|
|
137
|
+
- "Should this include tests? If so, what should be covered?"
|
|
138
|
+
|
|
139
|
+
**Scope** (must ask one):
|
|
140
|
+
- "What's explicitly out of scope for this implementation?"
|
|
141
|
+
- "MVP vs full implementation - any features to defer?"
|
|
142
|
+
|
|
143
|
+
Example combined question:
|
|
144
|
+
- "Two quick questions: (1) Testing approach for this feature? (2) Anything explicitly out of scope?"
|
|
145
|
+
|
|
146
|
+
**Do not skip Round 3.** These questions take 30 seconds and prevent spec gaps.
|
|
147
|
+
|
|
148
|
+
## Step 6: Write the Spec (Subagent)
|
|
149
|
+
|
|
150
|
+
**Progress**: Tell the user "Writing implementation spec..."
|
|
151
|
+
|
|
152
|
+
Use the task tool to invoke the **spec-writer** subagent.
|
|
153
|
+
|
|
154
|
+
Provide the prompt in this exact format:
|
|
155
|
+
|
|
156
|
+
```
|
|
157
|
+
## Research Findings
|
|
158
|
+
|
|
159
|
+
<paste structured findings from Step 4>
|
|
160
|
+
|
|
161
|
+
## Interview Q&A
|
|
162
|
+
|
|
163
|
+
### Core Decisions
|
|
164
|
+
**Q**: <question from Round 1>
|
|
165
|
+
**A**: <user's answer>
|
|
166
|
+
|
|
167
|
+
### Edge Cases & Tradeoffs
|
|
168
|
+
**Q**: <question from Round 2>
|
|
169
|
+
**A**: <user's answer>
|
|
170
|
+
|
|
171
|
+
### Scope & Boundaries
|
|
172
|
+
**Q**: <question from Round 3>
|
|
173
|
+
**A**: <user's answer>
|
|
174
|
+
|
|
175
|
+
## Spec Metadata
|
|
176
|
+
|
|
177
|
+
- **Topic**: <topic name>
|
|
178
|
+
- **Issue**: <issue ID or N/A>
|
|
179
|
+
- **Output Path**: <git-root>/<specsLocation>/<filename>.md
|
|
180
|
+
- **Date**: <YYYY-MM-DD>
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
The subagent will write the spec file directly to the Output Path.
|
|
184
|
+
|
|
185
|
+
**Naming convention**: `<issue-id>-<topic>.md` or `<topic>.md`
|
|
186
|
+
|
|
187
|
+
### Spec Verification
|
|
188
|
+
|
|
189
|
+
After the spec-writer subagent returns, verify the spec is complete.
|
|
190
|
+
|
|
191
|
+
**Key sections to check** (lenient - only these 4):
|
|
192
|
+
- `## Overview`
|
|
193
|
+
- `## Decisions`
|
|
194
|
+
- `## Implementation Steps`
|
|
195
|
+
- `## Edge Cases`
|
|
196
|
+
|
|
197
|
+
**Verification steps:**
|
|
198
|
+
|
|
199
|
+
1. **Read the spec file** at `<git-root>/<specsLocation>/<filename>.md`
|
|
200
|
+
|
|
201
|
+
2. **If file missing or empty**:
|
|
202
|
+
- Warn user: "Spec file wasn't written. Writing directly..."
|
|
203
|
+
- Write the spec yourself using the write tool
|
|
204
|
+
- Run verification again on the written file
|
|
205
|
+
|
|
206
|
+
3. **If file exists, check for key sections**:
|
|
207
|
+
- Scan content for the 4 section headers above
|
|
208
|
+
- Track which sections are present/missing
|
|
209
|
+
|
|
210
|
+
4. **If all 4 sections present**:
|
|
211
|
+
- Tell user: "Spec written and verified (4/4 key sections present)."
|
|
212
|
+
- Proceed to Step 7.
|
|
213
|
+
|
|
214
|
+
5. **If 1-3 sections missing** (partial write):
|
|
215
|
+
- Warn user: "Spec appears incomplete. Missing sections: [list missing]"
|
|
216
|
+
- Show which sections ARE present
|
|
217
|
+
- Ask: "Proceed with partial spec, retry write, or abort?"
|
|
218
|
+
- **Proceed**: Continue to Step 7
|
|
219
|
+
- **Retry**: Re-invoke spec-writer subagent with same input, then verify again
|
|
220
|
+
- **Abort**: Stop and inform user the incomplete spec file remains at path
|
|
221
|
+
|
|
222
|
+
6. **If all sections missing but has content**:
|
|
223
|
+
- Treat as invalid format, trigger fallback write
|
|
224
|
+
- Write the spec yourself, then verify the written file
|
|
225
|
+
|
|
226
|
+
**On subagent failure** (timeout, error):
|
|
227
|
+
- Warn user: "Spec writer failed. Writing spec directly..."
|
|
228
|
+
- Write the spec yourself using the write tool
|
|
229
|
+
- Run verification on the written file
|
|
230
|
+
|
|
231
|
+
## Step 7: Link to Session Context
|
|
232
|
+
|
|
233
|
+
Add a reference to the spec in `<git-root>/.bonfire/index.md` under Current State.
|
|
234
|
+
|
|
235
|
+
## Step 8: Confirm
|
|
236
|
+
|
|
237
|
+
Read the generated spec and present a summary. Ask if user wants to:
|
|
238
|
+
- Proceed with implementation
|
|
239
|
+
- Refine specific sections
|
|
240
|
+
- Add more detail to any area
|
|
241
|
+
- Save for later
|
|
242
|
+
|
|
243
|
+
## Interview Tips
|
|
244
|
+
|
|
245
|
+
**Good questions are:**
|
|
246
|
+
- Informed by research (not generic)
|
|
247
|
+
- About tradeoffs (not yes/no)
|
|
248
|
+
- Specific to the codebase
|
|
249
|
+
- Non-obvious (user wouldn't think to mention)
|
|
250
|
+
|
|
251
|
+
**Bad questions:**
|
|
252
|
+
- "What features do you want?" (too broad)
|
|
253
|
+
- "Should we add error handling?" (obvious)
|
|
254
|
+
- Generic without codebase context
|
|
255
|
+
|
|
256
|
+
**Examples of good informed questions:**
|
|
257
|
+
- "I found `UserService` uses repository pattern but `OrderService` uses direct DB access. Which approach?"
|
|
258
|
+
- "The `auth` middleware validates JWT but doesn't check permissions. Should this feature add permission checks or assume auth is enough?"
|
|
259
|
+
- "There's a `BaseController` with shared logic. Extend it or keep this feature standalone?"
|
|
260
|
+
|
|
261
|
+
## Spec Lifecycle
|
|
262
|
+
|
|
263
|
+
Specs are **temporary artifacts** - they exist to guide implementation:
|
|
264
|
+
|
|
265
|
+
1. **Draft** → Created, ready for review
|
|
266
|
+
2. **In Progress** → Being implemented
|
|
267
|
+
3. **Completed** → Implementation done
|
|
268
|
+
|
|
269
|
+
**When a spec is fully implemented**:
|
|
270
|
+
- If it contains reusable reference material, move to `docs/`
|
|
271
|
+
- Delete the spec file - archive has the record
|
|
272
|
+
- Don't let specs accumulate
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Start a new session - reads context and scaffolds .bonfire/ if needed
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Start Session
|
|
6
|
+
|
|
7
|
+
## Step 1: Find Git Root
|
|
8
|
+
|
|
9
|
+
Run `git rev-parse --show-toplevel` to locate the repository root. All session files live at `<git-root>/.bonfire/`.
|
|
10
|
+
|
|
11
|
+
## Step 2: Check for Bonfire Directory
|
|
12
|
+
|
|
13
|
+
Check if `<git-root>/.bonfire/index.md` exists.
|
|
14
|
+
|
|
15
|
+
**If .bonfire/ does NOT exist**, scaffold it:
|
|
16
|
+
|
|
17
|
+
1. Tell the user: "No bonfire directory found. Let me set that up for you."
|
|
18
|
+
|
|
19
|
+
2. Use the question tool to ask setup questions (4 questions, one round):
|
|
20
|
+
|
|
21
|
+
1. "Where should specs be saved?" (Header: "Specs")
|
|
22
|
+
- .bonfire/specs/ (Default) - Keep with session context
|
|
23
|
+
- specs/ - Project root level
|
|
24
|
+
|
|
25
|
+
2. "Where should docs be saved?" (Header: "Docs")
|
|
26
|
+
- .bonfire/docs/ (Default) - Keep with session context
|
|
27
|
+
- docs/ - Project root level
|
|
28
|
+
|
|
29
|
+
3. "How should `.bonfire/` be handled in git?" (Header: "Git")
|
|
30
|
+
- ignore-all (Default) - Keep sessions private/local
|
|
31
|
+
- hybrid - Commit docs/specs, keep notes private
|
|
32
|
+
- commit-all - Share everything with team
|
|
33
|
+
|
|
34
|
+
4. "Enable Linear integration?" (Header: "Linear")
|
|
35
|
+
- No (Default) - Skip Linear integration
|
|
36
|
+
- Yes - Fetch/create Linear issues (requires linear-cli)
|
|
37
|
+
|
|
38
|
+
3. Create the directory structure based on user choices:
|
|
39
|
+
|
|
40
|
+
**Always create in .bonfire/**:
|
|
41
|
+
```
|
|
42
|
+
.bonfire/
|
|
43
|
+
├── index.md
|
|
44
|
+
├── config.json
|
|
45
|
+
├── archive/
|
|
46
|
+
└── .gitignore
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
**If specsLocation is `.bonfire/specs/`**: create `.bonfire/specs/`
|
|
50
|
+
**If specsLocation is `specs/`**: create `<git-root>/specs/`
|
|
51
|
+
|
|
52
|
+
**If docsLocation is `.bonfire/docs/`**: create `.bonfire/docs/`
|
|
53
|
+
**If docsLocation is `docs/`**: create `<git-root>/docs/`
|
|
54
|
+
|
|
55
|
+
4. Detect project name from: package.json name → git remote → directory name
|
|
56
|
+
|
|
57
|
+
5. Create `config.json` with user's answers:
|
|
58
|
+
```json
|
|
59
|
+
{
|
|
60
|
+
"specsLocation": "<user-answer>",
|
|
61
|
+
"docsLocation": "<user-answer>",
|
|
62
|
+
"gitStrategy": "<user-answer>",
|
|
63
|
+
"linearEnabled": <true-or-false>
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
6. Create `index.md` with template:
|
|
68
|
+
```markdown
|
|
69
|
+
# Session Context: [PROJECT_NAME]
|
|
70
|
+
|
|
71
|
+
**Date**: [CURRENT_DATE]
|
|
72
|
+
**Status**: Active
|
|
73
|
+
**Branch**: main
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## Current State
|
|
78
|
+
|
|
79
|
+
[Describe what you're working on]
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## Recent Sessions
|
|
84
|
+
|
|
85
|
+
### Session 1 - [CURRENT_DATE]
|
|
86
|
+
|
|
87
|
+
**Goal**: [What you want to accomplish]
|
|
88
|
+
|
|
89
|
+
**Accomplished**:
|
|
90
|
+
- [List completed items]
|
|
91
|
+
|
|
92
|
+
**Decisions**:
|
|
93
|
+
- [Key decisions made]
|
|
94
|
+
|
|
95
|
+
**Blockers**: None
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## Next Session Priorities
|
|
100
|
+
|
|
101
|
+
1. [Priority items]
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## Key Resources
|
|
106
|
+
|
|
107
|
+
**Code References**:
|
|
108
|
+
- [Component/feature]: `path/to/file.ts`
|
|
109
|
+
|
|
110
|
+
**External Links**:
|
|
111
|
+
- [Issue Tracker](url)
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## Archived Sessions
|
|
116
|
+
|
|
117
|
+
[Links to archived sessions will appear here]
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## Notes
|
|
122
|
+
|
|
123
|
+
[Any additional context]
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
7. Create `.gitignore` based on chosen strategy and locations:
|
|
127
|
+
|
|
128
|
+
**Ignore all**:
|
|
129
|
+
```
|
|
130
|
+
*
|
|
131
|
+
!.gitignore
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
**Hybrid** (only include dirs that are inside .bonfire/):
|
|
135
|
+
```
|
|
136
|
+
*
|
|
137
|
+
!.gitignore
|
|
138
|
+
```
|
|
139
|
+
If docsLocation is `.bonfire/docs/`, add:
|
|
140
|
+
```
|
|
141
|
+
!docs/
|
|
142
|
+
!docs/**
|
|
143
|
+
```
|
|
144
|
+
If specsLocation is `.bonfire/specs/`, add:
|
|
145
|
+
```
|
|
146
|
+
!specs/
|
|
147
|
+
!specs/**
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
**Commit all**:
|
|
151
|
+
```
|
|
152
|
+
data/
|
|
153
|
+
scratch/
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
**If .bonfire/ EXISTS**, proceed to Step 3.
|
|
157
|
+
|
|
158
|
+
## Step 3: Check/Update CLAUDE.md
|
|
159
|
+
|
|
160
|
+
Check if `<git-root>/CLAUDE.md` exists.
|
|
161
|
+
|
|
162
|
+
**If CLAUDE.md does NOT exist**, create it:
|
|
163
|
+
```markdown
|
|
164
|
+
# [PROJECT_NAME]
|
|
165
|
+
|
|
166
|
+
## Quick Context
|
|
167
|
+
|
|
168
|
+
Read `.bonfire/index.md` for current project state, recent work, and priorities.
|
|
169
|
+
|
|
170
|
+
## Bonfire Commands
|
|
171
|
+
|
|
172
|
+
- `/bonfire-start` - Start a session (reads context)
|
|
173
|
+
- `/bonfire-end` - End session (updates context)
|
|
174
|
+
- `/bonfire-spec` - Create implementation spec
|
|
175
|
+
- `/bonfire-document <topic>` - Document a topic
|
|
176
|
+
- `/bonfire-review` - Review work for blindspots and improvements
|
|
177
|
+
- `/bonfire-archive` - Archive completed work
|
|
178
|
+
- `/bonfire-configure` - Change project settings
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
**If CLAUDE.md EXISTS**, check if it references `.bonfire/index.md`. If not, append:
|
|
182
|
+
```markdown
|
|
183
|
+
|
|
184
|
+
## Session Context
|
|
185
|
+
|
|
186
|
+
Read `.bonfire/index.md` for current project state, recent work, and priorities.
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
## Step 4: Read Session Context
|
|
190
|
+
|
|
191
|
+
Read `<git-root>/.bonfire/index.md` and report when ready.
|
|
192
|
+
|
|
193
|
+
Summarize:
|
|
194
|
+
- Current state
|
|
195
|
+
- Recent work
|
|
196
|
+
- Next priorities
|
|
197
|
+
|
|
198
|
+
Then ask: "What do you want to work on this session?"
|
|
199
|
+
|
|
200
|
+
## Step 5: Fetch External Context (Optional)
|
|
201
|
+
|
|
202
|
+
**Only fetch if user provides a new URL or issue ID:**
|
|
203
|
+
|
|
204
|
+
### Detecting Issue Type
|
|
205
|
+
|
|
206
|
+
- **GitHub**: Starts with `#`, contains `github.com`, or doesn't match Linear pattern
|
|
207
|
+
- **Linear**: Matches `[A-Z]+-[0-9]+` pattern (e.g., `ENG-123`, `ABC-456`) or contains `linear.app`
|
|
208
|
+
|
|
209
|
+
### GitHub Issues/PRs
|
|
210
|
+
|
|
211
|
+
Use `gh` CLI:
|
|
212
|
+
- `gh pr view [URL] --json title,body,state,labels`
|
|
213
|
+
- `gh issue view [URL] --json title,body,state,labels`
|
|
214
|
+
|
|
215
|
+
### Linear Issues
|
|
216
|
+
|
|
217
|
+
First, read `<git-root>/.bonfire/config.json` and check `linearEnabled`.
|
|
218
|
+
|
|
219
|
+
**If `linearEnabled` is false or not set**: Skip Linear, treat as ad-hoc task.
|
|
220
|
+
|
|
221
|
+
**If `linearEnabled` is true**:
|
|
222
|
+
1. Use linear-cli to fetch the issue:
|
|
223
|
+
```bash
|
|
224
|
+
linear issue view ENG-123
|
|
225
|
+
```
|
|
226
|
+
2. Extract: title, description, state, priority, labels, assignee
|
|
227
|
+
3. On success: Summarize the issue context
|
|
228
|
+
4. On failure: Warn user - "Couldn't fetch Linear issue. Is linear-cli installed and authenticated? Continue without issue context?"
|
|
229
|
+
|
|
230
|
+
Note: Run `linear issue view --help` to see available options.
|
|
231
|
+
|
|
232
|
+
### Update Session Context
|
|
233
|
+
|
|
234
|
+
If issue was fetched successfully:
|
|
235
|
+
- Add reference to `index.md` under Current State
|
|
236
|
+
- Include issue ID, title, and link
|
|
237
|
+
- Note the issue tracker type (GitHub/Linear)
|
|
238
|
+
|
|
239
|
+
### Fallback
|
|
240
|
+
|
|
241
|
+
If no URL/issue ID provided (continuing work, ad-hoc task):
|
|
242
|
+
- Proceed with existing session context
|
|
243
|
+
- Session notes are the source of truth for ongoing work
|
|
244
|
+
|
|
245
|
+
Confirm understanding and ask how to proceed.
|