@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,298 @@
1
+ #!/bin/bash
2
+ # Create Bootstrap Feature for First-Time Setup
3
+ #
4
+ # Creates a guided feature to help users fill in project guidelines
5
+ # after initializing Trellis for the first time.
6
+ #
7
+ # Usage:
8
+ # ./.trellis/scripts/create-bootstrap.sh [project-type]
9
+ #
10
+ # Arguments:
11
+ # project-type: frontend | backend | fullstack (default: fullstack)
12
+ #
13
+ # Prerequisites:
14
+ # - .trellis/.developer must exist (run init-developer.sh first)
15
+ #
16
+ # Creates:
17
+ # .trellis/agent-traces/{developer}/features/00-bootstrap-guidelines/
18
+ # ├── feature.json # Feature metadata
19
+ # └── prd.md # Task description and guidance
20
+
21
+ set -e
22
+
23
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
24
+ source "$SCRIPT_DIR/common/paths.sh"
25
+ source "$SCRIPT_DIR/common/developer.sh"
26
+
27
+ # Colors
28
+ RED='\033[0;31m'
29
+ GREEN='\033[0;32m'
30
+ YELLOW='\033[1;33m'
31
+ BLUE='\033[0;34m'
32
+ NC='\033[0m'
33
+
34
+ FEATURE_NAME="00-bootstrap-guidelines"
35
+
36
+ # Project type (default: fullstack)
37
+ PROJECT_TYPE="${1:-fullstack}"
38
+
39
+ # Validate project type
40
+ case "$PROJECT_TYPE" in
41
+ frontend|backend|fullstack)
42
+ ;;
43
+ *)
44
+ echo -e "${YELLOW}Unknown project type: $PROJECT_TYPE, defaulting to fullstack${NC}"
45
+ PROJECT_TYPE="fullstack"
46
+ ;;
47
+ esac
48
+
49
+ # =============================================================================
50
+ # PRD Content
51
+ # =============================================================================
52
+
53
+ write_prd_header() {
54
+ cat << 'EOF'
55
+ # Bootstrap: Fill Project Development Guidelines
56
+
57
+ ## Purpose
58
+
59
+ Welcome to Trellis! This is your first task.
60
+
61
+ AI agents use `.trellis/structure/` to understand YOUR project's coding conventions.
62
+ **Empty templates = AI writes generic code that doesn't match your project style.**
63
+
64
+ Filling these guidelines is a one-time setup that pays off for every future AI session.
65
+
66
+ ---
67
+
68
+ ## Your Task
69
+
70
+ Fill in the guideline files based on your **existing codebase**.
71
+ EOF
72
+ }
73
+
74
+ write_prd_backend_section() {
75
+ cat << 'EOF'
76
+
77
+ ### Backend Guidelines
78
+
79
+ | File | What to Document |
80
+ |------|------------------|
81
+ | `.trellis/structure/backend/directory-structure.md` | Where different file types go (routes, services, utils) |
82
+ | `.trellis/structure/backend/database-guidelines.md` | ORM, migrations, query patterns, naming conventions |
83
+ | `.trellis/structure/backend/error-handling.md` | How errors are caught, logged, and returned |
84
+ | `.trellis/structure/backend/logging-guidelines.md` | Log levels, format, what to log |
85
+ | `.trellis/structure/backend/quality-guidelines.md` | Code review standards, testing requirements |
86
+ EOF
87
+ }
88
+
89
+ write_prd_frontend_section() {
90
+ cat << 'EOF'
91
+
92
+ ### Frontend Guidelines
93
+
94
+ | File | What to Document |
95
+ |------|------------------|
96
+ | `.trellis/structure/frontend/directory-structure.md` | Component/page/hook organization |
97
+ | `.trellis/structure/frontend/component-guidelines.md` | Component patterns, props conventions |
98
+ | `.trellis/structure/frontend/hook-guidelines.md` | Custom hook naming, patterns |
99
+ | `.trellis/structure/frontend/state-management.md` | State library, patterns, what goes where |
100
+ | `.trellis/structure/frontend/type-safety.md` | TypeScript conventions, type organization |
101
+ | `.trellis/structure/frontend/quality-guidelines.md` | Linting, testing, accessibility |
102
+ EOF
103
+ }
104
+
105
+ write_prd_footer() {
106
+ cat << 'EOF'
107
+
108
+ ### Thinking Guides (Optional)
109
+
110
+ The `.trellis/structure/guides/` directory contains thinking guides that are already
111
+ filled with general best practices. You can customize them for your project if needed.
112
+
113
+ ---
114
+
115
+ ## How to Fill Guidelines
116
+
117
+ ### Principle: Document Reality, Not Ideals
118
+
119
+ Write what your codebase **actually does**, not what you wish it did.
120
+ AI needs to match existing patterns, not introduce new ones.
121
+
122
+ ### Steps
123
+
124
+ 1. **Look at existing code** - Find 2-3 examples of each pattern
125
+ 2. **Document the pattern** - Describe what you see
126
+ 3. **Include file paths** - Reference real files as examples
127
+ 4. **List anti-patterns** - What does your team avoid?
128
+
129
+ ---
130
+
131
+ ## Tips for Using AI
132
+
133
+ Ask AI to help analyze your codebase:
134
+
135
+ - "Look at my codebase and document the patterns you see"
136
+ - "Analyze my code structure and summarize the conventions"
137
+ - "Find error handling patterns and document them"
138
+
139
+ The AI will read your code and help you document it.
140
+
141
+ ---
142
+
143
+ ## Completion Checklist
144
+
145
+ - [ ] Guidelines filled for your project type
146
+ - [ ] At least 2-3 real code examples in each guideline
147
+ - [ ] Anti-patterns documented
148
+
149
+ When done:
150
+
151
+ ```bash
152
+ ./.trellis/scripts/feature.sh finish
153
+ ./.trellis/scripts/feature.sh archive 00-bootstrap-guidelines
154
+ ```
155
+
156
+ ---
157
+
158
+ ## Why This Matters
159
+
160
+ After completing this task:
161
+
162
+ 1. AI will write code that matches your project style
163
+ 2. Relevant `/before-*-dev` commands will inject real context
164
+ 3. `/check-*` commands will validate against your actual standards
165
+ 4. Future developers (human or AI) will onboard faster
166
+ EOF
167
+ }
168
+
169
+ write_prd() {
170
+ local dir="$1"
171
+ local project_type="$2"
172
+
173
+ {
174
+ write_prd_header
175
+
176
+ case "$project_type" in
177
+ frontend)
178
+ write_prd_frontend_section
179
+ ;;
180
+ backend)
181
+ write_prd_backend_section
182
+ ;;
183
+ fullstack)
184
+ write_prd_backend_section
185
+ write_prd_frontend_section
186
+ ;;
187
+ esac
188
+
189
+ write_prd_footer
190
+ } > "$dir/prd.md"
191
+ }
192
+
193
+ # =============================================================================
194
+ # Feature JSON
195
+ # =============================================================================
196
+
197
+ write_feature_json() {
198
+ local dir="$1"
199
+ local developer="$2"
200
+ local project_type="$3"
201
+ local today=$(date +%Y-%m-%d)
202
+
203
+ # Generate subtasks based on project type
204
+ local subtasks
205
+ local related_files
206
+
207
+ case "$project_type" in
208
+ frontend)
209
+ subtasks='[
210
+ {"name": "Fill frontend guidelines", "status": "pending"},
211
+ {"name": "Add code examples", "status": "pending"}
212
+ ]'
213
+ related_files='[
214
+ ".trellis/structure/frontend/"
215
+ ]'
216
+ ;;
217
+ backend)
218
+ subtasks='[
219
+ {"name": "Fill backend guidelines", "status": "pending"},
220
+ {"name": "Add code examples", "status": "pending"}
221
+ ]'
222
+ related_files='[
223
+ ".trellis/structure/backend/"
224
+ ]'
225
+ ;;
226
+ fullstack)
227
+ subtasks='[
228
+ {"name": "Fill backend guidelines", "status": "pending"},
229
+ {"name": "Fill frontend guidelines", "status": "pending"},
230
+ {"name": "Add code examples", "status": "pending"}
231
+ ]'
232
+ related_files='[
233
+ ".trellis/structure/backend/",
234
+ ".trellis/structure/frontend/"
235
+ ]'
236
+ ;;
237
+ esac
238
+
239
+ cat > "$dir/feature.json" << EOF
240
+ {
241
+ "id": "$FEATURE_NAME",
242
+ "name": "Bootstrap Guidelines",
243
+ "description": "Fill in project development guidelines for AI agents",
244
+ "status": "in_progress",
245
+ "dev_type": "docs",
246
+ "priority": "high",
247
+ "developer": "$developer",
248
+ "createdAt": "$today",
249
+ "completedAt": null,
250
+ "commit": null,
251
+ "subtasks": $subtasks,
252
+ "relatedFiles": $related_files,
253
+ "notes": "First-time setup task created by trellis init ($project_type project)"
254
+ }
255
+ EOF
256
+ }
257
+
258
+ # =============================================================================
259
+ # Main
260
+ # =============================================================================
261
+
262
+ main() {
263
+ local repo_root=$(get_repo_root)
264
+ local developer=$(get_developer "$repo_root")
265
+
266
+ # Check developer initialized
267
+ if [[ -z "$developer" ]]; then
268
+ echo -e "${RED}Error: Developer not initialized${NC}"
269
+ echo "Run: ./$DIR_WORKFLOW/$DIR_SCRIPTS/init-developer.sh <your-name>"
270
+ exit 1
271
+ fi
272
+
273
+ local features_dir=$(get_features_dir "$repo_root")
274
+ local feature_dir="$features_dir/$FEATURE_NAME"
275
+ local relative_path="$DIR_WORKFLOW/$DIR_PROGRESS/$developer/$DIR_FEATURES/$FEATURE_NAME"
276
+
277
+ # Check if already exists
278
+ if [[ -d "$feature_dir" ]]; then
279
+ echo -e "${YELLOW}Bootstrap feature already exists: $relative_path${NC}"
280
+ exit 0
281
+ fi
282
+
283
+ # Create feature directory
284
+ mkdir -p "$feature_dir"
285
+
286
+ # Write files
287
+ write_feature_json "$feature_dir" "$developer" "$PROJECT_TYPE"
288
+ write_prd "$feature_dir" "$PROJECT_TYPE"
289
+
290
+ # Set as current feature
291
+ set_current_feature "$relative_path" "$repo_root"
292
+
293
+ # Silent output - init command handles user-facing messages
294
+ # Only output the feature path for programmatic use
295
+ echo "$relative_path"
296
+ }
297
+
298
+ main "$@"