@mindfoldhq/trellis 0.4.0-beta.5 → 0.4.0-beta.7

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 (83) hide show
  1. package/README.md +6 -2
  2. package/dist/cli/index.js +1 -0
  3. package/dist/cli/index.js.map +1 -1
  4. package/dist/commands/init.d.ts +1 -0
  5. package/dist/commands/init.d.ts.map +1 -1
  6. package/dist/commands/init.js.map +1 -1
  7. package/dist/configurators/codebuddy.d.ts +11 -0
  8. package/dist/configurators/codebuddy.d.ts.map +1 -0
  9. package/dist/configurators/codebuddy.js +58 -0
  10. package/dist/configurators/codebuddy.js.map +1 -0
  11. package/dist/configurators/index.d.ts.map +1 -1
  12. package/dist/configurators/index.js +13 -0
  13. package/dist/configurators/index.js.map +1 -1
  14. package/dist/configurators/opencode.d.ts +1 -1
  15. package/dist/configurators/opencode.js +1 -1
  16. package/dist/migrations/manifests/0.4.0-beta.6.json +9 -0
  17. package/dist/migrations/manifests/0.4.0-beta.7.json +9 -0
  18. package/dist/templates/claude/hooks/session-start.py +2 -2
  19. package/dist/templates/codebuddy/commands/trellis/before-dev.md +29 -0
  20. package/dist/templates/codebuddy/commands/trellis/brainstorm.md +487 -0
  21. package/dist/templates/codebuddy/commands/trellis/break-loop.md +107 -0
  22. package/dist/templates/codebuddy/commands/trellis/check-cross-layer.md +153 -0
  23. package/dist/templates/codebuddy/commands/trellis/check.md +25 -0
  24. package/dist/templates/codebuddy/commands/trellis/create-command.md +154 -0
  25. package/dist/templates/codebuddy/commands/trellis/finish-work.md +143 -0
  26. package/dist/templates/codebuddy/commands/trellis/integrate-skill.md +219 -0
  27. package/dist/templates/codebuddy/commands/trellis/onboard.md +358 -0
  28. package/dist/templates/codebuddy/commands/trellis/record-session.md +61 -0
  29. package/dist/templates/codebuddy/commands/trellis/start.md +373 -0
  30. package/dist/templates/codebuddy/commands/trellis/update-spec.md +354 -0
  31. package/dist/templates/codebuddy/index.d.ts +25 -0
  32. package/dist/templates/codebuddy/index.d.ts.map +1 -0
  33. package/dist/templates/codebuddy/index.js +45 -0
  34. package/dist/templates/codebuddy/index.js.map +1 -0
  35. package/dist/templates/codex/skills/before-dev/SKILL.md +1 -1
  36. package/dist/templates/codex/skills/brainstorm/SKILL.md +1 -1
  37. package/dist/templates/codex/skills/break-loop/SKILL.md +1 -1
  38. package/dist/templates/codex/skills/check/SKILL.md +1 -1
  39. package/dist/templates/codex/skills/check-cross-layer/SKILL.md +1 -1
  40. package/dist/templates/codex/skills/create-command/SKILL.md +1 -1
  41. package/dist/templates/codex/skills/finish-work/SKILL.md +1 -1
  42. package/dist/templates/codex/skills/integrate-skill/SKILL.md +1 -1
  43. package/dist/templates/codex/skills/onboard/SKILL.md +1 -1
  44. package/dist/templates/codex/skills/record-session/SKILL.md +1 -1
  45. package/dist/templates/codex/skills/start/SKILL.md +1 -1
  46. package/dist/templates/codex/skills/update-spec/SKILL.md +1 -1
  47. package/dist/templates/extract.d.ts +7 -0
  48. package/dist/templates/extract.d.ts.map +1 -1
  49. package/dist/templates/extract.js +13 -0
  50. package/dist/templates/extract.js.map +1 -1
  51. package/dist/templates/iflow/hooks/session-start.py +2 -2
  52. package/dist/templates/kiro/skills/before-dev/SKILL.md +1 -1
  53. package/dist/templates/kiro/skills/brainstorm/SKILL.md +1 -1
  54. package/dist/templates/kiro/skills/break-loop/SKILL.md +1 -1
  55. package/dist/templates/kiro/skills/check/SKILL.md +1 -1
  56. package/dist/templates/kiro/skills/check-cross-layer/SKILL.md +1 -1
  57. package/dist/templates/kiro/skills/create-command/SKILL.md +1 -1
  58. package/dist/templates/kiro/skills/finish-work/SKILL.md +1 -1
  59. package/dist/templates/kiro/skills/integrate-skill/SKILL.md +1 -1
  60. package/dist/templates/kiro/skills/onboard/SKILL.md +1 -1
  61. package/dist/templates/kiro/skills/record-session/SKILL.md +1 -1
  62. package/dist/templates/kiro/skills/start/SKILL.md +1 -1
  63. package/dist/templates/kiro/skills/update-spec/SKILL.md +1 -1
  64. package/dist/templates/qoder/skills/before-dev/SKILL.md +1 -1
  65. package/dist/templates/qoder/skills/brainstorm/SKILL.md +1 -1
  66. package/dist/templates/qoder/skills/break-loop/SKILL.md +1 -1
  67. package/dist/templates/qoder/skills/check/SKILL.md +1 -1
  68. package/dist/templates/qoder/skills/check-cross-layer/SKILL.md +1 -1
  69. package/dist/templates/qoder/skills/create-command/SKILL.md +1 -1
  70. package/dist/templates/qoder/skills/finish-work/SKILL.md +1 -1
  71. package/dist/templates/qoder/skills/integrate-skill/SKILL.md +1 -1
  72. package/dist/templates/qoder/skills/onboard/SKILL.md +1 -1
  73. package/dist/templates/qoder/skills/record-session/SKILL.md +1 -1
  74. package/dist/templates/qoder/skills/start/SKILL.md +1 -1
  75. package/dist/templates/qoder/skills/update-spec/SKILL.md +1 -1
  76. package/dist/templates/trellis/scripts/common/cli_adapter.py +32 -8
  77. package/dist/types/ai-tools.d.ts +3 -3
  78. package/dist/types/ai-tools.d.ts.map +1 -1
  79. package/dist/types/ai-tools.js +8 -0
  80. package/dist/types/ai-tools.js.map +1 -1
  81. package/package.json +1 -1
  82. /package/dist/templates/opencode/{plugin → plugins}/inject-subagent-context.js +0 -0
  83. /package/dist/templates/opencode/{plugin → plugins}/session-start.js +0 -0
@@ -0,0 +1,373 @@
1
+ # Start Session
2
+
3
+ Initialize your AI development session and begin working on tasks.
4
+
5
+ ---
6
+
7
+ ## Operation Types
8
+
9
+ Operations in this document are categorized as:
10
+
11
+ | Marker | Meaning | Executor |
12
+ |--------|---------|----------|
13
+ | `[AI]` | Bash scripts or file reads executed by AI | You (AI) |
14
+ | `[USER]` | Slash commands executed by user | User |
15
+
16
+ ---
17
+
18
+ ## Initialization
19
+
20
+ ### Step 1: Understand Trellis Workflow `[AI]`
21
+
22
+ First, read the workflow guide to understand the development process:
23
+
24
+ ```bash
25
+ cat .trellis/workflow.md # Development process, conventions, and quick start guide
26
+ ```
27
+
28
+ ### Step 2: Get Current Status `[AI]`
29
+
30
+ ```bash
31
+ python3 ./.trellis/scripts/get_context.py
32
+ ```
33
+
34
+ This returns:
35
+ - Developer identity
36
+ - Git status (branch, uncommitted changes)
37
+ - Recent commits
38
+ - Active tasks
39
+ - Journal file status
40
+
41
+ ### Step 3: Read Guidelines Index `[AI]`
42
+
43
+ ```bash
44
+ python3 ./.trellis/scripts/get_context.py --mode packages
45
+ ```
46
+
47
+ This shows available packages and their spec layers. Read the relevant spec indexes:
48
+
49
+ ```bash
50
+ cat .trellis/spec/<package>/<layer>/index.md # Package-specific guidelines
51
+ cat .trellis/spec/guides/index.md # Thinking guides (always read)
52
+ ```
53
+
54
+ > **Important**: The index files are navigation — they list the actual guideline files (e.g., `error-handling.md`, `conventions.md`, `mock-strategies.md`).
55
+ > At this step, just read the indexes to understand what's available.
56
+ > When you start actual development, you MUST go back and read the specific guideline files relevant to your task, as listed in the index's Pre-Development Checklist.
57
+
58
+ ### Step 4: Check Active Tasks `[AI]`
59
+
60
+ ```bash
61
+ python3 ./.trellis/scripts/task.py list
62
+ ```
63
+
64
+ If continuing previous work, review the task file.
65
+
66
+ ### Step 5: Report Ready Status and Ask for Tasks
67
+
68
+ Output a summary:
69
+
70
+ ```markdown
71
+ ## Session Initialized
72
+
73
+ | Item | Status |
74
+ |------|--------|
75
+ | Developer | {name} |
76
+ | Branch | {branch} |
77
+ | Uncommitted | {count} file(s) |
78
+ | Journal | {file} ({lines}/2000 lines) |
79
+ | Active Tasks | {count} |
80
+
81
+ Ready for your task. What would you like to work on?
82
+ ```
83
+
84
+ ---
85
+
86
+ ## Task Classification
87
+
88
+ When user describes a task, classify it:
89
+
90
+ | Type | Criteria | Workflow |
91
+ |------|----------|----------|
92
+ | **Question** | User asks about code, architecture, or how something works | Answer directly |
93
+ | **Trivial Fix** | Typo fix, comment update, single-line change, < 5 minutes | Direct Edit |
94
+ | **Simple Task** | Clear goal, 1-2 files, well-defined scope | Quick confirm → Task Workflow |
95
+ | **Complex Task** | Vague goal, multiple files, architectural decisions | **Brainstorm → Task Workflow** |
96
+
97
+ ### Decision Rule
98
+
99
+ > **If in doubt, use Brainstorm + Task Workflow.**
100
+ >
101
+ > Task Workflow ensures code-specs are injected to the right context, resulting in higher quality code.
102
+ > The overhead is minimal, but the benefit is significant.
103
+
104
+ > **Subtask Decomposition**: If brainstorm reveals multiple independent work items,
105
+ > consider creating subtasks using `--parent` flag or `add-subtask` command.
106
+ > See `/trellis:brainstorm` Step 8 for details.
107
+
108
+ ---
109
+
110
+ ## Question / Trivial Fix
111
+
112
+ For questions or trivial fixes, work directly:
113
+
114
+ 1. Answer question or make the fix
115
+ 2. If code was changed, remind user to run `/trellis:finish-work`
116
+
117
+ ---
118
+
119
+ ## Simple Task
120
+
121
+ For simple, well-defined tasks:
122
+
123
+ 1. Quick confirm: "I understand you want to [goal]. Shall I proceed?"
124
+ 2. If no, clarify and confirm again
125
+ 3. **If yes: execute ALL steps below without stopping. Do NOT ask for additional confirmation between steps.**
126
+ - Create task directory (Phase 1 Path B, Step 2)
127
+ - Write PRD (Step 3)
128
+ - Research codebase (Phase 2, Step 5)
129
+ - Configure context (Step 6)
130
+ - Activate task (Step 7)
131
+ - Implement (Phase 3, Step 8)
132
+ - Check quality (Step 9)
133
+ - Complete (Step 10)
134
+
135
+ ---
136
+
137
+ ## Complex Task - Brainstorm First
138
+
139
+ For complex or vague tasks, **automatically start the brainstorm process** — do NOT skip directly to implementation. Use `/trellis:brainstorm`.
140
+
141
+ Summary:
142
+
143
+ 1. **Acknowledge and classify** - State your understanding
144
+ 2. **Create task directory** - Track evolving requirements in `prd.md`
145
+ 3. **Ask questions one at a time** - Update PRD after each answer
146
+ 4. **Propose approaches** - For architectural decisions
147
+ 5. **Confirm final requirements** - Get explicit approval
148
+ 6. **Proceed to Task Workflow** - With clear requirements in PRD
149
+
150
+ ---
151
+
152
+ ## Task Workflow (Development Tasks)
153
+
154
+ **Why this workflow?**
155
+ - Run a dedicated research pass before coding
156
+ - Configure specs in jsonl context files
157
+ - Implement using injected context
158
+ - Verify with a separate check pass
159
+ - Result: Code that follows project conventions automatically
160
+
161
+ ### Overview: Two Entry Points
162
+
163
+ ```
164
+ From Brainstorm (Complex Task):
165
+ PRD confirmed → Research → Configure Context → Activate → Implement → Check → Complete
166
+
167
+ From Simple Task:
168
+ Confirm → Create Task → Write PRD → Research → Configure Context → Activate → Implement → Check → Complete
169
+ ```
170
+
171
+ **Key principle: Research happens AFTER requirements are clear (PRD exists).**
172
+
173
+ ---
174
+
175
+ ### Phase 1: Establish Requirements
176
+
177
+ #### Path A: From Brainstorm (skip to Phase 2)
178
+
179
+ PRD and task directory already exist from brainstorm. Skip directly to Phase 2.
180
+
181
+ #### Path B: From Simple Task
182
+
183
+ **Step 1: Confirm Understanding** `[AI]`
184
+
185
+ Quick confirm:
186
+ - What is the goal?
187
+ - What type of development? (frontend / backend / fullstack)
188
+ - Any specific requirements or constraints?
189
+
190
+ If unclear, ask clarifying questions.
191
+
192
+ **Step 2: Create Task Directory** `[AI]`
193
+
194
+ ```bash
195
+ TASK_DIR=$(python3 ./.trellis/scripts/task.py create "<title>" --slug <name>)
196
+ ```
197
+
198
+ **Step 3: Write PRD** `[AI]`
199
+
200
+ Create `prd.md` in the task directory with:
201
+
202
+ ```markdown
203
+ # <Task Title>
204
+
205
+ ## Goal
206
+ <What we're trying to achieve>
207
+
208
+ ## Requirements
209
+ - <Requirement 1>
210
+ - <Requirement 2>
211
+
212
+ ## Acceptance Criteria
213
+ - [ ] <Criterion 1>
214
+ - [ ] <Criterion 2>
215
+
216
+ ## Technical Notes
217
+ <Any technical decisions or constraints>
218
+ ```
219
+
220
+ ---
221
+
222
+ ### Phase 2: Prepare for Implementation (shared)
223
+
224
+ > Both paths converge here. PRD and task directory must exist before proceeding.
225
+
226
+ **Step 4: Code-Spec Depth Check** `[AI]`
227
+
228
+ If the task touches infra or cross-layer contracts, do not start implementation until code-spec depth is defined.
229
+
230
+ Trigger this requirement when the change includes any of:
231
+ - New or changed command/API signatures
232
+ - Database schema or migration changes
233
+ - Infra integrations (storage, queue, cache, secrets, env contracts)
234
+ - Cross-layer payload transformations
235
+
236
+ Must-have before proceeding:
237
+ - [ ] Target code-spec files to update are identified
238
+ - [ ] Concrete contract is defined (signature, fields, env keys)
239
+ - [ ] Validation and error matrix is defined
240
+ - [ ] At least one Good/Base/Bad case is defined
241
+
242
+ **Step 5: Research the Codebase** `[AI]`
243
+
244
+ Based on the confirmed PRD, run a focused research pass and produce:
245
+
246
+ 1. Relevant spec files in `.trellis/spec/`
247
+ 2. Existing code patterns to follow (2-3 examples)
248
+ 3. Files that will likely need modification
249
+
250
+ Use this output format:
251
+
252
+ ```markdown
253
+ ## Relevant Specs
254
+ - <path>: <why it's relevant>
255
+
256
+ ## Code Patterns Found
257
+ - <pattern>: <example file path>
258
+
259
+ ## Files to Modify
260
+ - <path>: <what change>
261
+ ```
262
+
263
+ **Step 6: Configure Context** `[AI]`
264
+
265
+ Initialize default context:
266
+
267
+ ```bash
268
+ python3 ./.trellis/scripts/task.py init-context "$TASK_DIR" <type>
269
+ # type: backend | frontend | fullstack
270
+ ```
271
+
272
+ Add specs found in your research pass:
273
+
274
+ ```bash
275
+ # For each relevant spec and code pattern:
276
+ python3 ./.trellis/scripts/task.py add-context "$TASK_DIR" implement "<path>" "<reason>"
277
+ python3 ./.trellis/scripts/task.py add-context "$TASK_DIR" check "<path>" "<reason>"
278
+ ```
279
+
280
+ **Step 7: Activate Task** `[AI]`
281
+
282
+ ```bash
283
+ python3 ./.trellis/scripts/task.py start "$TASK_DIR"
284
+ ```
285
+
286
+ This sets `.current-task` so hooks can inject context.
287
+
288
+ ---
289
+
290
+ ### Phase 3: Execute (shared)
291
+
292
+ **Step 8: Implement** `[AI]`
293
+
294
+ Implement the task described in `prd.md`.
295
+
296
+ - Follow all specs injected into implement context
297
+ - Keep changes scoped to requirements
298
+ - Run lint and typecheck before finishing
299
+
300
+ **Step 9: Check Quality** `[AI]`
301
+
302
+ Run a quality pass against check context:
303
+
304
+ - Review all code changes against the specs
305
+ - Fix issues directly
306
+ - Ensure lint and typecheck pass
307
+
308
+ **Step 10: Complete** `[AI]`
309
+
310
+ 1. Verify lint and typecheck pass
311
+ 2. Report what was implemented
312
+ 3. Remind user to:
313
+ - Test the changes
314
+ - Commit when ready
315
+ - Run `/trellis:record-session` to record this session
316
+
317
+ ---
318
+
319
+ ## User Available Commands `[USER]`
320
+
321
+ The following slash commands are for users (not AI):
322
+
323
+ | Command | Description |
324
+ |---------|-------------|
325
+ | `/trellis:start` | Start development session (this command) |
326
+ | `/trellis:brainstorm` | Clarify vague requirements before implementation |
327
+ | `/trellis:before-dev` | Read development guidelines |
328
+ | `/trellis:check` | Check code quality |
329
+ | `/trellis:check-cross-layer` | Cross-layer verification |
330
+ | `/trellis:finish-work` | Pre-commit checklist |
331
+ | `/trellis:record-session` | Record session progress |
332
+
333
+ ---
334
+
335
+ ## AI Executed Scripts `[AI]`
336
+
337
+ | Script | Purpose |
338
+ |--------|---------|
339
+ | `python3 ./.trellis/scripts/task.py create "<title>" [--slug <name>]` | Create task directory |
340
+ | `python3 ./.trellis/scripts/task.py list` | List active tasks |
341
+ | `python3 ./.trellis/scripts/task.py archive <name>` | Archive task |
342
+ | `python3 ./.trellis/scripts/get_context.py` | Get session context |
343
+
344
+ ---
345
+
346
+ ## Platform Detection
347
+
348
+ Trellis auto-detects your platform based on config directories. For CodeBuddy users, ensure detection works correctly:
349
+
350
+ | Condition | Detected Platform |
351
+ |-----------|-------------------|
352
+ | Only `.codebuddy/` exists | `codebuddy` ✅ |
353
+ | Both `.codebuddy/` and `.claude/` exist | `claude` (default) |
354
+
355
+ If auto-detection fails, set manually:
356
+
357
+ ```bash
358
+ export TRELLIS_PLATFORM=codebuddy
359
+ ```
360
+
361
+ Or prefix commands:
362
+
363
+ ```bash
364
+ TRELLIS_PLATFORM=codebuddy python3 ./.trellis/scripts/task.py list
365
+ ```
366
+
367
+ ---
368
+
369
+ ## Session End Reminder
370
+
371
+ **IMPORTANT**: When a task or session is completed, remind the user:
372
+
373
+ > Before ending this session, please run `/trellis:record-session` to record what we accomplished.