@mindfoldhq/trellis 0.4.0-rc.0 → 0.4.0

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