@mindfoldhq/trellis 0.4.0-beta.8 → 0.4.0-beta.9

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 (92) hide show
  1. package/README.md +10 -5
  2. package/dist/cli/index.js +2 -0
  3. package/dist/cli/index.js.map +1 -1
  4. package/dist/commands/init.d.ts +2 -0
  5. package/dist/commands/init.d.ts.map +1 -1
  6. package/dist/commands/init.js +33 -9
  7. package/dist/commands/init.js.map +1 -1
  8. package/dist/configurators/codex.d.ts.map +1 -1
  9. package/dist/configurators/codex.js +2 -1
  10. package/dist/configurators/codex.js.map +1 -1
  11. package/dist/configurators/copilot.d.ts +9 -0
  12. package/dist/configurators/copilot.d.ts.map +1 -0
  13. package/dist/configurators/copilot.js +34 -0
  14. package/dist/configurators/copilot.js.map +1 -0
  15. package/dist/configurators/index.d.ts.map +1 -1
  16. package/dist/configurators/index.js +32 -1
  17. package/dist/configurators/index.js.map +1 -1
  18. package/dist/configurators/windsurf.d.ts +8 -0
  19. package/dist/configurators/windsurf.d.ts.map +1 -0
  20. package/dist/configurators/windsurf.js +18 -0
  21. package/dist/configurators/windsurf.js.map +1 -0
  22. package/dist/migrations/manifests/0.4.0-beta.9.json +9 -0
  23. package/dist/templates/claude/hooks/inject-subagent-context.py +8 -1
  24. package/dist/templates/claude/hooks/ralph-loop.py +8 -1
  25. package/dist/templates/claude/hooks/session-start.py +31 -7
  26. package/dist/templates/claude/hooks/statusline.py +211 -0
  27. package/dist/templates/claude/settings.json +4 -0
  28. package/dist/templates/codex/hooks/session-start.py +31 -7
  29. package/dist/templates/codex/hooks.json +1 -1
  30. package/dist/templates/copilot/hooks/session-start.py +218 -0
  31. package/dist/templates/copilot/hooks.json +11 -0
  32. package/dist/templates/copilot/index.d.ts +23 -0
  33. package/dist/templates/copilot/index.d.ts.map +1 -0
  34. package/dist/templates/copilot/index.js +54 -0
  35. package/dist/templates/copilot/index.js.map +1 -0
  36. package/dist/templates/copilot/prompts/before-dev.prompt.md +33 -0
  37. package/dist/templates/copilot/prompts/brainstorm.prompt.md +491 -0
  38. package/dist/templates/copilot/prompts/break-loop.prompt.md +129 -0
  39. package/dist/templates/copilot/prompts/check-cross-layer.prompt.md +157 -0
  40. package/dist/templates/copilot/prompts/check.prompt.md +29 -0
  41. package/dist/templates/copilot/prompts/create-command.prompt.md +116 -0
  42. package/dist/templates/copilot/prompts/finish-work.prompt.md +157 -0
  43. package/dist/templates/copilot/prompts/integrate-skill.prompt.md +223 -0
  44. package/dist/templates/copilot/prompts/onboard.prompt.md +362 -0
  45. package/dist/templates/copilot/prompts/parallel.prompt.md +196 -0
  46. package/dist/templates/copilot/prompts/record-session.prompt.md +66 -0
  47. package/dist/templates/copilot/prompts/start.prompt.md +397 -0
  48. package/dist/templates/copilot/prompts/update-spec.prompt.md +358 -0
  49. package/dist/templates/extract.d.ts +18 -0
  50. package/dist/templates/extract.d.ts.map +1 -1
  51. package/dist/templates/extract.js +32 -0
  52. package/dist/templates/extract.js.map +1 -1
  53. package/dist/templates/iflow/hooks/inject-subagent-context.py +8 -1
  54. package/dist/templates/iflow/hooks/ralph-loop.py +8 -1
  55. package/dist/templates/iflow/hooks/session-start.py +31 -7
  56. package/dist/templates/markdown/spec/backend/directory-structure.md +1 -1
  57. package/dist/templates/opencode/agents/dispatch.md +20 -19
  58. package/dist/templates/opencode/lib/trellis-context.js +42 -2
  59. package/dist/templates/opencode/plugins/session-start.js +7 -27
  60. package/dist/templates/trellis/scripts/add_session.py +6 -1
  61. package/dist/templates/trellis/scripts/common/__init__.py +2 -0
  62. package/dist/templates/trellis/scripts/common/cli_adapter.py +87 -9
  63. package/dist/templates/trellis/scripts/common/paths.py +57 -6
  64. package/dist/templates/trellis/scripts/common/task_store.py +6 -4
  65. package/dist/templates/trellis/scripts/common/task_utils.py +14 -8
  66. package/dist/templates/trellis/scripts/multi_agent/start.py +9 -5
  67. package/dist/templates/trellis/scripts/task.py +1 -1
  68. package/dist/templates/windsurf/index.d.ts +21 -0
  69. package/dist/templates/windsurf/index.d.ts.map +1 -0
  70. package/dist/templates/windsurf/index.js +44 -0
  71. package/dist/templates/windsurf/index.js.map +1 -0
  72. package/dist/templates/windsurf/workflows/trellis-before-dev.md +31 -0
  73. package/dist/templates/windsurf/workflows/trellis-brainstorm.md +491 -0
  74. package/dist/templates/windsurf/workflows/trellis-break-loop.md +111 -0
  75. package/dist/templates/windsurf/workflows/trellis-check-cross-layer.md +157 -0
  76. package/dist/templates/windsurf/workflows/trellis-check.md +27 -0
  77. package/dist/templates/windsurf/workflows/trellis-create-command.md +154 -0
  78. package/dist/templates/windsurf/workflows/trellis-finish-work.md +147 -0
  79. package/dist/templates/windsurf/workflows/trellis-integrate-skill.md +220 -0
  80. package/dist/templates/windsurf/workflows/trellis-onboard.md +362 -0
  81. package/dist/templates/windsurf/workflows/trellis-record-session.md +66 -0
  82. package/dist/templates/windsurf/workflows/trellis-start.md +373 -0
  83. package/dist/templates/windsurf/workflows/trellis-update-spec.md +358 -0
  84. package/dist/types/ai-tools.d.ts +5 -3
  85. package/dist/types/ai-tools.d.ts.map +1 -1
  86. package/dist/types/ai-tools.js +21 -1
  87. package/dist/types/ai-tools.js.map +1 -1
  88. package/dist/utils/template-fetcher.d.ts +17 -4
  89. package/dist/utils/template-fetcher.d.ts.map +1 -1
  90. package/dist/utils/template-fetcher.js +94 -12
  91. package/dist/utils/template-fetcher.js.map +1 -1
  92. package/package.json +1 -1
@@ -0,0 +1,397 @@
1
+ ---
2
+ description: "Trellis Copilot prompt: Start Session"
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
+ | Marker | Meaning | Executor |
14
+ |--------|---------|----------|
15
+ | `[AI]` | Bash scripts or Task calls executed by AI | You (AI) |
16
+ | `[USER]` | Slash commands executed by user | User |
17
+
18
+ ---
19
+
20
+ ## Initialization `[AI]`
21
+
22
+ ### Step 1: Understand Development Workflow
23
+
24
+ First, read the workflow guide to understand the development process:
25
+
26
+ ```bash
27
+ cat .trellis/workflow.md
28
+ ```
29
+
30
+ **Follow the instructions in workflow.md** - it contains:
31
+ - Core principles (Read Before Write, Follow Standards, etc.)
32
+ - File system structure
33
+ - Development process
34
+ - Best practices
35
+
36
+ ### Step 2: Get Current Context
37
+
38
+ ```bash
39
+ python3 ./.trellis/scripts/get_context.py
40
+ ```
41
+
42
+ This shows: developer identity, git status, current task (if any), active tasks.
43
+
44
+ ### Step 3: Read Guidelines Index
45
+
46
+ ```bash
47
+ python3 ./.trellis/scripts/get_context.py --mode packages
48
+ ```
49
+
50
+ This shows available packages and their spec layers. Read the relevant spec indexes:
51
+
52
+ ```bash
53
+ cat .trellis/spec/<package>/<layer>/index.md # Package-specific guidelines
54
+ cat .trellis/spec/guides/index.md # Thinking guides (always read)
55
+ ```
56
+
57
+ > **Important**: The index files are navigation �?they list the actual guideline files (e.g., `error-handling.md`, `conventions.md`, `mock-strategies.md`).
58
+ > At this step, just read the indexes to understand what's available.
59
+ > 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.
60
+
61
+ ### Step 4: Report and Ask
62
+
63
+ Report what you learned and ask: "What would you like to work on?"
64
+
65
+ ---
66
+
67
+ ## Task Classification
68
+
69
+ When user describes a task, classify it:
70
+
71
+ | Type | Criteria | Workflow |
72
+ |------|----------|----------|
73
+ | **Question** | User asks about code, architecture, or how something works | Answer directly |
74
+ | **Trivial Fix** | Typo fix, comment update, single-line change | Direct Edit |
75
+ | **Simple Task** | Clear goal, 1-2 files, well-defined scope | Quick confirm �?Implement |
76
+ | **Complex Task** | Vague goal, multiple files, architectural decisions | **Brainstorm �?Task Workflow** |
77
+
78
+ ### Classification Signals
79
+
80
+ **Trivial/Simple indicators:**
81
+ - User specifies exact file and change
82
+ - "Fix the typo in X"
83
+ - "Add field Y to component Z"
84
+ - Clear acceptance criteria already stated
85
+
86
+ **Complex indicators:**
87
+ - "I want to add a feature for..."
88
+ - "Can you help me improve..."
89
+ - Mentions multiple areas or systems
90
+ - No clear implementation path
91
+ - User seems unsure about approach
92
+
93
+ ### Decision Rule
94
+
95
+ > **If in doubt, use Brainstorm + Task Workflow.**
96
+ >
97
+ > Task Workflow ensures code-spec context is injected to agents, resulting in higher quality code.
98
+ > The overhead is minimal, but the benefit is significant.
99
+
100
+ ---
101
+
102
+ ## Question / Trivial Fix
103
+
104
+ For questions or trivial fixes, work directly:
105
+
106
+ 1. Answer question or make the fix
107
+ 2. If code was changed, remind user to run `/`
108
+
109
+ ---
110
+
111
+ ## Simple Task
112
+
113
+ For simple, well-defined tasks:
114
+
115
+ 1. Quick confirm: "I understand you want to [goal]. Shall I proceed?"
116
+ 2. If no, clarify and confirm again
117
+ 3. **If yes: execute ALL steps below without stopping. Do NOT ask for additional confirmation between steps.**
118
+ - Create task directory (Phase 1 Path B, Step 2)
119
+ - Write PRD (Step 3)
120
+ - Research codebase (Phase 2, Step 5)
121
+ - Configure context (Step 6)
122
+ - Activate task (Step 7)
123
+ - Implement (Phase 3, Step 8)
124
+ - Check quality (Step 9)
125
+ - Complete (Step 10)
126
+
127
+ ---
128
+
129
+ ## Complex Task - Brainstorm First
130
+
131
+ For complex or vague tasks, **automatically start the brainstorm process** �?do NOT skip directly to implementation.
132
+
133
+ See `/` for the full process. Summary:
134
+
135
+ 1. **Acknowledge and classify** - State your understanding
136
+ 2. **Create task directory** - Track evolving requirements in `prd.md`
137
+ 3. **Ask questions one at a time** - Update PRD after each answer
138
+ 4. **Propose approaches** - For architectural decisions
139
+ 5. **Confirm final requirements** - Get explicit approval
140
+ 6. **Proceed to Task Workflow** - With clear requirements in PRD
141
+
142
+ > **Subtask Decomposition**: If brainstorm reveals multiple independent work items,
143
+ > consider creating subtasks using `--parent` flag or `add-subtask` command.
144
+ > See `/` Step 8 for details.
145
+
146
+ ### Key Brainstorm Principles
147
+
148
+ | Principle | Description |
149
+ |-----------|-------------|
150
+ | **One question at a time** | Never overwhelm with multiple questions |
151
+ | **Update PRD immediately** | After each answer, update the document |
152
+ | **Prefer multiple choice** | Easier for users to answer |
153
+ | **YAGNI** | Challenge unnecessary complexity |
154
+
155
+ ---
156
+
157
+ ## Task Workflow (Development Tasks)
158
+
159
+ **Why this workflow?**
160
+ - Research Agent analyzes what code-spec files are needed
161
+ - Code-spec files are configured in jsonl files
162
+ - Implement Agent receives code-spec context via Hook injection
163
+ - Check Agent verifies against code-spec requirements
164
+ - Result: Code that follows project conventions automatically
165
+
166
+ ### Overview: Two Entry Points
167
+
168
+ ```
169
+ From Brainstorm (Complex Task):
170
+ PRD confirmed �?Research �?Configure Context �?Activate �?Implement �?Check �?Complete
171
+
172
+ From Simple Task:
173
+ Confirm �?Create Task �?Write PRD �?Research �?Configure Context �?Activate �?Implement �?Check �?Complete
174
+ ```
175
+
176
+ **Key principle: Research happens AFTER requirements are clear (PRD exists).**
177
+
178
+ ---
179
+
180
+ ### Phase 1: Establish Requirements
181
+
182
+ #### Path A: From Brainstorm (skip to Phase 2)
183
+
184
+ PRD and task directory already exist from brainstorm. Skip directly to Phase 2.
185
+
186
+ #### Path B: From Simple Task
187
+
188
+ **Step 1: Confirm Understanding** `[AI]`
189
+
190
+ Quick confirm:
191
+ - What is the goal?
192
+ - What type of development? (frontend / backend / fullstack)
193
+ - Any specific requirements or constraints?
194
+
195
+ **Step 2: Create Task Directory** `[AI]`
196
+
197
+ ```bash
198
+ TASK_DIR=$(python3 ./.trellis/scripts/task.py create "<title>" --slug <name>)
199
+ ```
200
+
201
+ **Step 3: Write PRD** `[AI]`
202
+
203
+ Create `prd.md` in the task directory with:
204
+
205
+ ```markdown
206
+ # <Task Title>
207
+
208
+ ## Goal
209
+ <What we're trying to achieve>
210
+
211
+ ## Requirements
212
+ - <Requirement 1>
213
+ - <Requirement 2>
214
+
215
+ ## Acceptance Criteria
216
+ - [ ] <Criterion 1>
217
+ - [ ] <Criterion 2>
218
+
219
+ ## Technical Notes
220
+ <Any technical decisions or constraints>
221
+ ```
222
+
223
+ ---
224
+
225
+ ### Phase 2: Prepare for Implementation (shared)
226
+
227
+ > Both paths converge here. PRD and task directory must exist before proceeding.
228
+
229
+ **Step 4: Code-Spec Depth Check** `[AI]`
230
+
231
+ If the task touches infra or cross-layer contracts, do not start implementation until code-spec depth is defined.
232
+
233
+ Trigger this requirement when the change includes any of:
234
+ - New or changed command/API signatures
235
+ - Database schema or migration changes
236
+ - Infra integrations (storage, queue, cache, secrets, env contracts)
237
+ - Cross-layer payload transformations
238
+
239
+ Must-have before proceeding:
240
+ - [ ] Target code-spec files to update are identified
241
+ - [ ] Concrete contract is defined (signature, fields, env keys)
242
+ - [ ] Validation and error matrix is defined
243
+ - [ ] At least one Good/Base/Bad case is defined
244
+
245
+ **Step 5: Research the Codebase** `[AI]`
246
+
247
+ Based on the confirmed PRD, call Research Agent to find relevant specs and patterns:
248
+
249
+ ```
250
+ Task(
251
+ subagent_type: "research",
252
+ prompt: "Analyze the codebase for this task:
253
+
254
+ Task: <goal from PRD>
255
+ Type: <frontend/backend/fullstack>
256
+
257
+ Please find:
258
+ 1. Relevant code-spec files in .trellis/spec/
259
+ 2. Existing code patterns to follow (find 2-3 examples)
260
+ 3. Files that will likely need modification
261
+
262
+ Output:
263
+ ## Relevant Code-Specs
264
+ - <path>: <why it's relevant>
265
+
266
+ ## Code Patterns Found
267
+ - <pattern>: <example file path>
268
+
269
+ ## Files to Modify
270
+ - <path>: <what change>",
271
+ model: "opus"
272
+ )
273
+ ```
274
+
275
+ **Step 6: Configure Context** `[AI]`
276
+
277
+ Initialize default context:
278
+
279
+ ```bash
280
+ python3 ./.trellis/scripts/task.py init-context "$TASK_DIR" <type>
281
+ # type: backend | frontend | fullstack
282
+ ```
283
+
284
+ Add code-spec files found by Research Agent:
285
+
286
+ ```bash
287
+ # For each relevant code-spec and code pattern:
288
+ python3 ./.trellis/scripts/task.py add-context "$TASK_DIR" implement "<path>" "<reason>"
289
+ python3 ./.trellis/scripts/task.py add-context "$TASK_DIR" check "<path>" "<reason>"
290
+ ```
291
+
292
+ **Step 7: Activate Task** `[AI]`
293
+
294
+ ```bash
295
+ python3 ./.trellis/scripts/task.py start "$TASK_DIR"
296
+ ```
297
+
298
+ This sets `.current-task` so hooks can inject context.
299
+
300
+ ---
301
+
302
+ ### Phase 3: Execute (shared)
303
+
304
+ **Step 8: Implement** `[AI]`
305
+
306
+ Call Implement Agent (code-spec context is auto-injected by hook):
307
+
308
+ ```
309
+ Task(
310
+ subagent_type: "implement",
311
+ prompt: "Implement the task described in prd.md.
312
+
313
+ Follow all code-spec files that have been injected into your context.
314
+ Run lint and typecheck before finishing.",
315
+ model: "opus"
316
+ )
317
+ ```
318
+
319
+ **Step 9: Check Quality** `[AI]`
320
+
321
+ Call Check Agent (code-spec context is auto-injected by hook):
322
+
323
+ ```
324
+ Task(
325
+ subagent_type: "check",
326
+ prompt: "Review all code changes against the code-spec requirements.
327
+
328
+ Fix any issues you find directly.
329
+ Ensure lint and typecheck pass.",
330
+ model: "opus"
331
+ )
332
+ ```
333
+
334
+ **Step 10: Complete** `[AI]`
335
+
336
+ 1. Verify lint and typecheck pass
337
+ 2. Report what was implemented
338
+ 3. Remind user to:
339
+ - Test the changes
340
+ - Commit when ready
341
+ - Run `/` to record this session
342
+
343
+ ---
344
+
345
+ ## Continuing Existing Task
346
+
347
+ If `get_context.py` shows a current task:
348
+
349
+ 1. Read the task's `prd.md` to understand the goal
350
+ 2. Check `task.json` for current status and phase
351
+ 3. Ask user: "Continue working on <task-name>?"
352
+
353
+ If yes, resume from the appropriate step (usually Step 7 or 8).
354
+
355
+ ---
356
+
357
+ ## Commands Reference
358
+
359
+ ### User Commands `[USER]`
360
+
361
+ | Command | When to Use |
362
+ |---------|-------------|
363
+ | `/` | Begin a session (this command) |
364
+ | `/` | Clarify vague requirements (called from start) |
365
+ | `/` | Complex tasks needing isolated worktree |
366
+ | `/` | Before committing changes |
367
+ | `/` | After completing a task |
368
+
369
+ ### AI Scripts `[AI]`
370
+
371
+ | Script | Purpose |
372
+ |--------|---------|
373
+ | `python3 ./.trellis/scripts/get_context.py` | Get session context |
374
+ | `python3 ./.trellis/scripts/task.py create` | Create task directory |
375
+ | `python3 ./.trellis/scripts/task.py init-context` | Initialize jsonl files |
376
+ | `python3 ./.trellis/scripts/task.py add-context` | Add code-spec/context file to jsonl |
377
+ | `python3 ./.trellis/scripts/task.py start` | Set current task |
378
+ | `python3 ./.trellis/scripts/task.py finish` | Clear current task |
379
+ | `python3 ./.trellis/scripts/task.py archive` | Archive completed task |
380
+
381
+ ### Sub Agents `[AI]`
382
+
383
+ | Agent | Purpose | Hook Injection |
384
+ |-------|---------|----------------|
385
+ | research | Analyze codebase | No (reads directly) |
386
+ | implement | Write code | Yes (implement.jsonl) |
387
+ | check | Review & fix | Yes (check.jsonl) |
388
+ | debug | Fix specific issues | Yes (debug.jsonl) |
389
+
390
+ ---
391
+
392
+ ## Key Principle
393
+
394
+ > **Code-spec context is injected, not remembered.**
395
+ >
396
+ > The Task Workflow ensures agents receive relevant code-spec context automatically.
397
+ > This is more reliable than hoping the AI "remembers" conventions.