@mindfoldhq/trellis 0.1.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 (122) hide show
  1. package/LICENSE +110 -0
  2. package/README.md +149 -0
  3. package/bin/trellis.js +3 -0
  4. package/dist/cli/index.d.ts +2 -0
  5. package/dist/cli/index.d.ts.map +1 -0
  6. package/dist/cli/index.js +42 -0
  7. package/dist/cli/index.js.map +1 -0
  8. package/dist/commands/init.d.ts +11 -0
  9. package/dist/commands/init.d.ts.map +1 -0
  10. package/dist/commands/init.js +236 -0
  11. package/dist/commands/init.js.map +1 -0
  12. package/dist/configurators/claude.d.ts +35 -0
  13. package/dist/configurators/claude.d.ts.map +1 -0
  14. package/dist/configurators/claude.js +83 -0
  15. package/dist/configurators/claude.js.map +1 -0
  16. package/dist/configurators/cursor.d.ts +8 -0
  17. package/dist/configurators/cursor.d.ts.map +1 -0
  18. package/dist/configurators/cursor.js +22 -0
  19. package/dist/configurators/cursor.js.map +1 -0
  20. package/dist/configurators/templates.d.ts +40 -0
  21. package/dist/configurators/templates.d.ts.map +1 -0
  22. package/dist/configurators/templates.js +67 -0
  23. package/dist/configurators/templates.js.map +1 -0
  24. package/dist/configurators/workflow.d.ts +16 -0
  25. package/dist/configurators/workflow.d.ts.map +1 -0
  26. package/dist/configurators/workflow.js +169 -0
  27. package/dist/configurators/workflow.js.map +1 -0
  28. package/dist/constants/paths.d.ts +69 -0
  29. package/dist/constants/paths.d.ts.map +1 -0
  30. package/dist/constants/paths.js +80 -0
  31. package/dist/constants/paths.js.map +1 -0
  32. package/dist/index.d.ts +9 -0
  33. package/dist/index.d.ts.map +1 -0
  34. package/dist/index.js +9 -0
  35. package/dist/index.js.map +1 -0
  36. package/dist/templates/agents/check.txt +120 -0
  37. package/dist/templates/agents/debug.txt +121 -0
  38. package/dist/templates/agents/dispatch.txt +201 -0
  39. package/dist/templates/agents/implement.txt +114 -0
  40. package/dist/templates/agents/index.d.ts +35 -0
  41. package/dist/templates/agents/index.d.ts.map +1 -0
  42. package/dist/templates/agents/index.js +71 -0
  43. package/dist/templates/agents/index.js.map +1 -0
  44. package/dist/templates/agents/research.txt +258 -0
  45. package/dist/templates/commands/claude/start.md.txt +127 -0
  46. package/dist/templates/commands/common/before-backend-dev.txt +13 -0
  47. package/dist/templates/commands/common/before-frontend-dev.txt +13 -0
  48. package/dist/templates/commands/common/break-loop.txt +107 -0
  49. package/dist/templates/commands/common/check-backend.txt +13 -0
  50. package/dist/templates/commands/common/check-cross-layer.txt +153 -0
  51. package/dist/templates/commands/common/check-frontend.txt +13 -0
  52. package/dist/templates/commands/common/create-command.txt +154 -0
  53. package/dist/templates/commands/common/finish-work.txt +129 -0
  54. package/dist/templates/commands/common/integrate-skill.txt +219 -0
  55. package/dist/templates/commands/common/onboard-developer.txt +355 -0
  56. package/dist/templates/commands/common/record-agent-flow.txt +62 -0
  57. package/dist/templates/commands/cursor/start.md.txt +94 -0
  58. package/dist/templates/commands/index.d.ts +46 -0
  59. package/dist/templates/commands/index.d.ts.map +1 -0
  60. package/dist/templates/commands/index.js +151 -0
  61. package/dist/templates/commands/index.js.map +1 -0
  62. package/dist/templates/extract.d.ts +22 -0
  63. package/dist/templates/extract.d.ts.map +1 -0
  64. package/dist/templates/extract.js +34 -0
  65. package/dist/templates/extract.js.map +1 -0
  66. package/dist/templates/hooks/index.d.ts +33 -0
  67. package/dist/templates/hooks/index.d.ts.map +1 -0
  68. package/dist/templates/hooks/index.js +53 -0
  69. package/dist/templates/hooks/index.js.map +1 -0
  70. package/dist/templates/hooks/inject-subagent-context.py +620 -0
  71. package/dist/templates/hooks/settings.json +16 -0
  72. package/dist/templates/markdown/agent-traces-index.md.txt +124 -0
  73. package/dist/templates/markdown/agents.md.txt +18 -0
  74. package/dist/templates/markdown/gitignore.txt +3 -0
  75. package/dist/templates/markdown/index.d.ts +26 -0
  76. package/dist/templates/markdown/index.d.ts.map +1 -0
  77. package/dist/templates/markdown/index.js +33 -0
  78. package/dist/templates/markdown/index.js.map +1 -0
  79. package/dist/templates/markdown/init-agent.md.txt +315 -0
  80. package/dist/templates/markdown/structure/backend/database-guidelines.md.txt +51 -0
  81. package/dist/templates/markdown/structure/backend/directory-structure.md.txt +54 -0
  82. package/dist/templates/markdown/structure/backend/error-handling.md.txt +51 -0
  83. package/dist/templates/markdown/structure/backend/index.md.txt +38 -0
  84. package/dist/templates/markdown/structure/backend/logging-guidelines.md.txt +51 -0
  85. package/dist/templates/markdown/structure/backend/quality-guidelines.md.txt +51 -0
  86. package/dist/templates/markdown/structure/frontend/component-guidelines.md.txt +59 -0
  87. package/dist/templates/markdown/structure/frontend/directory-structure.md.txt +54 -0
  88. package/dist/templates/markdown/structure/frontend/hook-guidelines.md.txt +51 -0
  89. package/dist/templates/markdown/structure/frontend/index.md.txt +39 -0
  90. package/dist/templates/markdown/structure/frontend/quality-guidelines.md.txt +51 -0
  91. package/dist/templates/markdown/structure/frontend/state-management.md.txt +51 -0
  92. package/dist/templates/markdown/structure/frontend/type-safety.md.txt +51 -0
  93. package/dist/templates/markdown/structure/guides/code-reuse-thinking-guide.md.txt +92 -0
  94. package/dist/templates/markdown/structure/guides/cross-layer-thinking-guide.md.txt +94 -0
  95. package/dist/templates/markdown/structure/guides/index.md.txt +79 -0
  96. package/dist/templates/markdown/workflow.md.txt +335 -0
  97. package/dist/templates/scripts/add-session.sh.txt +384 -0
  98. package/dist/templates/scripts/common/developer.sh.txt +130 -0
  99. package/dist/templates/scripts/common/git-context.sh.txt +237 -0
  100. package/dist/templates/scripts/common/paths.sh.txt +201 -0
  101. package/dist/templates/scripts/create-bootstrap.sh.txt +298 -0
  102. package/dist/templates/scripts/feature.sh.txt +700 -0
  103. package/dist/templates/scripts/get-context.sh.txt +7 -0
  104. package/dist/templates/scripts/get-developer.sh.txt +15 -0
  105. package/dist/templates/scripts/index.d.ts +25 -0
  106. package/dist/templates/scripts/index.d.ts.map +1 -0
  107. package/dist/templates/scripts/index.js +28 -0
  108. package/dist/templates/scripts/index.js.map +1 -0
  109. package/dist/templates/scripts/init-developer.sh.txt +34 -0
  110. package/dist/types/ai-tools.d.ts +35 -0
  111. package/dist/types/ai-tools.d.ts.map +1 -0
  112. package/dist/types/ai-tools.js +31 -0
  113. package/dist/types/ai-tools.js.map +1 -0
  114. package/dist/utils/file-writer.d.ts +23 -0
  115. package/dist/utils/file-writer.d.ts.map +1 -0
  116. package/dist/utils/file-writer.js +140 -0
  117. package/dist/utils/file-writer.js.map +1 -0
  118. package/dist/utils/project-detector.d.ts +16 -0
  119. package/dist/utils/project-detector.d.ts.map +1 -0
  120. package/dist/utils/project-detector.js +186 -0
  121. package/dist/utils/project-detector.js.map +1 -0
  122. package/package.json +71 -0
@@ -0,0 +1,79 @@
1
+ # Thinking Guides
2
+
3
+ > **Purpose**: Expand your thinking to catch things you might not have considered.
4
+
5
+ ---
6
+
7
+ ## Why Thinking Guides?
8
+
9
+ **Most bugs and tech debt come from "didn't think of that"**, not from lack of skill:
10
+
11
+ - Didn't think about what happens at layer boundaries → cross-layer bugs
12
+ - Didn't think about code patterns repeating → duplicated code everywhere
13
+ - Didn't think about edge cases → runtime errors
14
+ - Didn't think about future maintainers → unreadable code
15
+
16
+ These guides help you **ask the right questions before coding**.
17
+
18
+ ---
19
+
20
+ ## Available Guides
21
+
22
+ | Guide | Purpose | When to Use |
23
+ |-------|---------|-------------|
24
+ | [Code Reuse Thinking Guide](./code-reuse-thinking-guide.md) | Identify patterns and reduce duplication | When you notice repeated patterns |
25
+ | [Cross-Layer Thinking Guide](./cross-layer-thinking-guide.md) | Think through data flow across layers | Features spanning multiple layers |
26
+
27
+ ---
28
+
29
+ ## Quick Reference: Thinking Triggers
30
+
31
+ ### When to Think About Cross-Layer Issues
32
+
33
+ - [ ] Feature touches 3+ layers (API, Service, Component, Database)
34
+ - [ ] Data format changes between layers
35
+ - [ ] Multiple consumers need the same data
36
+ - [ ] You're not sure where to put some logic
37
+
38
+ → Read [Cross-Layer Thinking Guide](./cross-layer-thinking-guide.md)
39
+
40
+ ### When to Think About Code Reuse
41
+
42
+ - [ ] You're writing similar code to something that exists
43
+ - [ ] You see the same pattern repeated 3+ times
44
+ - [ ] You're adding a new field to multiple places
45
+ - [ ] **You're modifying any constant or config**
46
+ - [ ] **You're creating a new utility/helper function** ← Search first!
47
+
48
+ → Read [Code Reuse Thinking Guide](./code-reuse-thinking-guide.md)
49
+
50
+ ---
51
+
52
+ ## Pre-Modification Rule (CRITICAL)
53
+
54
+ > **Before changing ANY value, ALWAYS search first!**
55
+
56
+ ```bash
57
+ # Search for the value you're about to change
58
+ grep -r "value_to_change" .
59
+ ```
60
+
61
+ This single habit prevents most "forgot to update X" bugs.
62
+
63
+ ---
64
+
65
+ ## How to Use This Directory
66
+
67
+ 1. **Before coding**: Skim the relevant thinking guide
68
+ 2. **During coding**: If something feels repetitive or complex, check the guides
69
+ 3. **After bugs**: Add new insights to the relevant guide (learn from mistakes)
70
+
71
+ ---
72
+
73
+ ## Contributing
74
+
75
+ Found a new "didn't think of that" moment? Add it to the relevant guide.
76
+
77
+ ---
78
+
79
+ **Core Principle**: 30 minutes of thinking saves 3 hours of debugging.
@@ -0,0 +1,335 @@
1
+ # Development Workflow
2
+
3
+ > Based on [Effective Harnesses for Long-Running Agents](https://www.anthropic.com/engineering/effective-harnesses-for-long-running-agents)
4
+
5
+ ---
6
+
7
+ ## Table of Contents
8
+
9
+ 1. [Workflow Overview](#workflow-overview)
10
+ 2. [Session Start Process](#session-start-process)
11
+ 3. [Development Process](#development-process)
12
+ 4. [Session End](#session-end)
13
+ 5. [File Descriptions](#file-descriptions)
14
+ 6. [Best Practices](#best-practices)
15
+
16
+ ---
17
+
18
+ ## Workflow Overview
19
+
20
+ ### Core Principles
21
+
22
+ 1. **Read Before Write** - Understand context before starting
23
+ 2. **Follow Standards** - [!] **MUST read `.trellis/structure/` guidelines before coding**
24
+ 3. **Incremental Development** - Complete one feature at a time
25
+ 4. **Record Promptly** - Update tracking files immediately after completion
26
+ 5. **Document Limits** - [!] **Max 2000 lines per agent-traces document**
27
+
28
+ ### File System
29
+
30
+ ```
31
+ .trellis/
32
+ |-- .developer # Developer identity (gitignored)
33
+ |-- scripts/
34
+ | |-- common/ # Shared utilities
35
+ | | |-- paths.sh # Path utilities
36
+ | | |-- developer.sh # Developer management
37
+ | | \-- git-context.sh # Git context implementation
38
+ | |-- init-developer.sh # Initialize developer identity
39
+ | |-- get-developer.sh # Get current developer name
40
+ | |-- feature.sh # Manage features
41
+ | |-- get-context.sh # Get session context
42
+ | \-- add-session.sh # One-click session recording
43
+ |-- agent-traces/ # AI Agent work progress records
44
+ | |-- index.md # Progress index + Session template
45
+ | \-- {developer}/ # Per-developer directories
46
+ | |-- index.md # Personal index (with @@@auto markers)
47
+ | |-- features/ # Feature directories
48
+ | | \-- {day}-{name}/
49
+ | | \-- feature.json
50
+ | \-- progress-N.md # Progress files (sequential numbering)
51
+ |-- structure/ # [!] MUST READ before coding
52
+ | |-- frontend/ # Frontend guidelines (if applicable)
53
+ | | |-- index.md # Start here - guidelines index
54
+ | | \-- *.md # Topic-specific docs
55
+ | |-- backend/ # Backend guidelines (if applicable)
56
+ | | |-- index.md # Start here - guidelines index
57
+ | | \-- *.md # Topic-specific docs
58
+ | \-- guides/ # Thinking guides
59
+ | |-- index.md # Guides index
60
+ | |-- cross-layer-thinking-guide.md # Pre-implementation checklist
61
+ | \-- *.md # Other guides
62
+ \-- workflow.md # This document
63
+ ```
64
+
65
+ ---
66
+
67
+ ## Session Start Process
68
+
69
+ ### Step 1: Get Session Context
70
+
71
+ Use the unified context script:
72
+
73
+ ```bash
74
+ # Get all context in one command
75
+ ./.trellis/scripts/get-context.sh
76
+
77
+ # Or get JSON format
78
+ ./.trellis/scripts/get-context.sh --json
79
+ ```
80
+
81
+ ### Step 2: Read Development Guidelines [!] REQUIRED
82
+
83
+ **[!] CRITICAL: MUST read guidelines before writing any code**
84
+
85
+ Based on what you'll develop, read the corresponding guidelines:
86
+
87
+ **Frontend Development** (if applicable):
88
+ ```bash
89
+ # Read index first, then specific docs based on task
90
+ cat .trellis/structure/frontend/index.md
91
+ ```
92
+
93
+ **Backend Development** (if applicable):
94
+ ```bash
95
+ # Read index first, then specific docs based on task
96
+ cat .trellis/structure/backend/index.md
97
+ ```
98
+
99
+ **Cross-Layer Features**:
100
+ ```bash
101
+ # For features spanning multiple layers
102
+ cat .trellis/structure/guides/cross-layer-thinking-guide.md
103
+ ```
104
+
105
+ ### Step 3: Select Feature to Develop
106
+
107
+ Use the feature management script:
108
+
109
+ ```bash
110
+ # List active features
111
+ ./.trellis/scripts/feature.sh list
112
+
113
+ # Create new feature (creates directory with feature.json)
114
+ ./.trellis/scripts/feature.sh create <feature-name>
115
+ ```
116
+
117
+ ---
118
+
119
+ ## Development Process
120
+
121
+ ### Feature Development Flow
122
+
123
+ ```
124
+ 1. Create or select feature
125
+ \-> ./.trellis/scripts/feature.sh create <name> or list
126
+
127
+ 2. Write code according to guidelines
128
+ \-> Read .trellis/structure/ docs relevant to your task
129
+ \-> For cross-layer: read .trellis/structure/guides/
130
+
131
+ 3. Self-test
132
+ \-> Run project's lint/test commands (see structure docs)
133
+ \-> Manual feature testing
134
+
135
+ 4. Commit code
136
+ \-> git add <files>
137
+ \-> git commit -m "type(scope): description"
138
+ Format: feat/fix/docs/refactor/test/chore
139
+
140
+ 5. Record session (one command)
141
+ \-> ./.trellis/scripts/add-session.sh --title "Title" --commit "hash"
142
+ ```
143
+
144
+ ### Code Quality Checklist
145
+
146
+ **Must pass before commit**:
147
+ - [OK] Lint checks pass (project-specific command)
148
+ - [OK] Type checks pass (if applicable)
149
+ - [OK] Manual feature testing passes
150
+
151
+ **Project-specific checks**:
152
+ - See `.trellis/structure/frontend/quality-guidelines.md` for frontend
153
+ - See `.trellis/structure/backend/quality-guidelines.md` for backend
154
+
155
+ ---
156
+
157
+ ## Session End
158
+
159
+ ### One-Click Session Recording
160
+
161
+ After code is committed, use:
162
+
163
+ ```bash
164
+ ./.trellis/scripts/add-session.sh \
165
+ --title "Session Title" \
166
+ --commit "abc1234" \
167
+ --summary "Brief summary"
168
+ ```
169
+
170
+ This automatically:
171
+ 1. Detects current progress file
172
+ 2. Creates new file if 2000-line limit exceeded
173
+ 3. Appends session content
174
+ 4. Updates index.md (sessions count, history table)
175
+
176
+ ### Pre-end Checklist
177
+
178
+ Use `/finish-work` command to run through:
179
+ 1. [OK] All code committed, commit message follows convention
180
+ 2. [OK] Session recorded via `add-session.sh`
181
+ 3. [OK] No lint/test errors
182
+ 4. [OK] Working directory clean (or WIP noted)
183
+ 5. [OK] Structure docs updated if needed
184
+
185
+ ---
186
+
187
+ ## File Descriptions
188
+
189
+ ### 1. agent-traces/ - Agent Work Progress
190
+
191
+ **Purpose**: Record each AI Agent session's work content
192
+
193
+ **Structure** (Multi-developer support):
194
+ ```
195
+ agent-traces/
196
+ |-- index.md # Main index (Active Developers table)
197
+ \-- {developer}/ # Per-developer directory
198
+ |-- index.md # Personal index (with @@@auto markers)
199
+ |-- features/ # Feature directories
200
+ | \-- {day}-{name}/ # Each feature is a directory
201
+ | \-- feature.json
202
+ \-- progress-N.md # Progress files (sequential: 1, 2, 3...)
203
+ ```
204
+
205
+ **When to update**:
206
+ - [OK] End of each session
207
+ - [OK] Complete important feature
208
+ - [OK] Fix important bug
209
+
210
+ ### 2. structure/ - Development Guidelines
211
+
212
+ **Purpose**: Documented standards for consistent development
213
+
214
+ **Structure** (Multi-doc format):
215
+ ```
216
+ structure/
217
+ |-- frontend/ # Frontend docs (if applicable)
218
+ | |-- index.md # Start here
219
+ | \-- *.md # Topic-specific docs
220
+ |-- backend/ # Backend docs (if applicable)
221
+ | |-- index.md # Start here
222
+ | \-- *.md # Topic-specific docs
223
+ \-- guides/ # Thinking guides
224
+ |-- index.md # Start here
225
+ \-- *.md # Guide-specific docs
226
+ ```
227
+
228
+ **When to update**:
229
+ - [OK] New pattern discovered
230
+ - [OK] Bug fixed that reveals missing guidance
231
+ - [OK] New convention established
232
+
233
+ ### 3. Features - Feature Tracking
234
+
235
+ Each feature is a directory containing `feature.json`:
236
+
237
+ ```
238
+ features/
239
+ |-- 13-my-feature/
240
+ | \-- feature.json
241
+ \-- archive/
242
+ \-- 2025-01/
243
+ \-- 13-old-feature/
244
+ \-- feature.json
245
+ ```
246
+
247
+ **Commands**:
248
+ ```bash
249
+ ./.trellis/scripts/feature.sh create <name> # Create feature directory
250
+ ./.trellis/scripts/feature.sh archive <name> # Archive to archive/{year-month}/
251
+ ./.trellis/scripts/feature.sh list # List active features
252
+ ./.trellis/scripts/feature.sh list-archive # List archived features
253
+ ```
254
+
255
+ ---
256
+
257
+ ## Best Practices
258
+
259
+ ### [OK] DO - Should Do
260
+
261
+ 1. **Before session start**:
262
+ - Run `./.trellis/scripts/get-context.sh` for full context
263
+ - [!] **MUST read** relevant `.trellis/structure/` docs
264
+
265
+ 2. **During development**:
266
+ - [!] **Follow** `.trellis/structure/` guidelines
267
+ - For cross-layer features, use `/check-cross-layer`
268
+ - Develop only one feature at a time
269
+ - Run lint and tests frequently
270
+
271
+ 3. **After development complete**:
272
+ - Use `/finish-work` for completion checklist
273
+ - After fix bug, use `/break-loop` for deep analysis
274
+ - Human commits after testing passes
275
+ - Use `add-session.sh` to record progress
276
+
277
+ ### [X] DON'T - Should Not Do
278
+
279
+ 1. [!] **Don't** skip reading `.trellis/structure/` guidelines
280
+ 2. [!] **Don't** let agent-traces single file exceed 2000 lines
281
+ 3. **Don't** develop multiple unrelated features simultaneously
282
+ 4. **Don't** commit code with lint/test errors
283
+ 5. **Don't** forget to update structure docs after learning something
284
+ 6. [!] **Don't** execute `git commit` - AI should not commit code
285
+
286
+ ---
287
+
288
+ ## Quick Reference
289
+
290
+ ### Must-read Before Development
291
+
292
+ | Task Type | Must-read Document |
293
+ |-----------|-------------------|
294
+ | Frontend work | `frontend/index.md` → relevant docs |
295
+ | Backend work | `backend/index.md` → relevant docs |
296
+ | Cross-Layer Feature | `guides/cross-layer-thinking-guide.md` |
297
+
298
+ ### Commit Convention
299
+
300
+ ```bash
301
+ git commit -m "type(scope): description"
302
+ ```
303
+
304
+ **Type**: feat, fix, docs, refactor, test, chore
305
+ **Scope**: Module name (e.g., auth, api, ui)
306
+
307
+ ### Common Commands
308
+
309
+ ```bash
310
+ # Session management
311
+ ./.trellis/scripts/get-context.sh # Get full context
312
+ ./.trellis/scripts/add-session.sh # Record session
313
+
314
+ # Feature management
315
+ ./.trellis/scripts/feature.sh list # List features
316
+ ./.trellis/scripts/feature.sh create # Create feature
317
+
318
+ # Slash commands
319
+ /finish-work # Pre-commit checklist
320
+ /break-loop # Post-debug analysis
321
+ /check-cross-layer # Cross-layer verification
322
+ ```
323
+
324
+ ---
325
+
326
+ ## Summary
327
+
328
+ Following this workflow ensures:
329
+ - [OK] Continuity across multiple sessions
330
+ - [OK] Consistent code quality
331
+ - [OK] Trackable progress
332
+ - [OK] Knowledge accumulation in structure docs
333
+ - [OK] Transparent team collaboration
334
+
335
+ **Core Philosophy**: Read before write, follow standards, record promptly, capture learnings