@mindfoldhq/trellis 0.5.0-beta.8 → 0.5.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 (45) hide show
  1. package/dist/commands/init.d.ts +10 -0
  2. package/dist/commands/init.d.ts.map +1 -1
  3. package/dist/commands/init.js +380 -116
  4. package/dist/commands/init.js.map +1 -1
  5. package/dist/commands/update.d.ts.map +1 -1
  6. package/dist/commands/update.js +6 -21
  7. package/dist/commands/update.js.map +1 -1
  8. package/dist/configurators/index.d.ts.map +1 -1
  9. package/dist/configurators/index.js +8 -7
  10. package/dist/configurators/index.js.map +1 -1
  11. package/dist/configurators/qoder.d.ts +7 -6
  12. package/dist/configurators/qoder.d.ts.map +1 -1
  13. package/dist/configurators/qoder.js +17 -9
  14. package/dist/configurators/qoder.js.map +1 -1
  15. package/dist/configurators/shared.d.ts +2 -0
  16. package/dist/configurators/shared.d.ts.map +1 -1
  17. package/dist/configurators/shared.js +18 -0
  18. package/dist/configurators/shared.js.map +1 -1
  19. package/dist/migrations/manifests/0.5.0-beta.9.json +48 -0
  20. package/dist/templates/common/skills/brainstorm.md +47 -4
  21. package/dist/templates/opencode/plugins/inject-workflow-state.js +21 -7
  22. package/dist/templates/shared-hooks/inject-workflow-state.py +21 -8
  23. package/dist/templates/shared-hooks/session-start.py +14 -4
  24. package/dist/templates/trellis/config.yaml +6 -0
  25. package/dist/templates/trellis/index.d.ts +0 -1
  26. package/dist/templates/trellis/index.d.ts.map +1 -1
  27. package/dist/templates/trellis/index.js +0 -2
  28. package/dist/templates/trellis/index.js.map +1 -1
  29. package/dist/templates/trellis/scripts/common/types.py +0 -2
  30. package/dist/templates/trellis/workflow.md +8 -3
  31. package/dist/utils/project-detector.d.ts +2 -0
  32. package/dist/utils/project-detector.d.ts.map +1 -1
  33. package/dist/utils/project-detector.js +120 -11
  34. package/dist/utils/project-detector.js.map +1 -1
  35. package/dist/utils/task-json.d.ts +46 -0
  36. package/dist/utils/task-json.d.ts.map +1 -0
  37. package/dist/utils/task-json.js +49 -0
  38. package/dist/utils/task-json.js.map +1 -0
  39. package/package.json +1 -1
  40. package/dist/templates/markdown/spec/backend/directory-structure.md +0 -292
  41. package/dist/templates/markdown/spec/backend/index.md +0 -40
  42. package/dist/templates/markdown/spec/backend/script-conventions.md +0 -742
  43. package/dist/templates/markdown/spec/guides/code-reuse-thinking-guide.md +0 -118
  44. package/dist/templates/markdown/spec/guides/cross-platform-thinking-guide.md +0 -394
  45. package/dist/templates/trellis/scripts/create_bootstrap.py +0 -298
@@ -1,298 +0,0 @@
1
- #!/usr/bin/env python3
2
- """
3
- Create Bootstrap Task for First-Time Setup.
4
-
5
- Creates a guided task to help users fill in project guidelines
6
- after initializing Trellis for the first time.
7
-
8
- Usage:
9
- python3 create_bootstrap.py [project-type]
10
-
11
- Arguments:
12
- project-type: frontend | backend | fullstack (default: fullstack)
13
-
14
- Prerequisites:
15
- - .trellis/.developer must exist (run init_developer.py first)
16
-
17
- Creates:
18
- .trellis/tasks/00-bootstrap-guidelines/
19
- - task.json # Task metadata
20
- - prd.md # Task description and guidance
21
- """
22
-
23
- from __future__ import annotations
24
-
25
- import json
26
- import sys
27
- from datetime import datetime
28
- from pathlib import Path
29
-
30
- from common.paths import (
31
- DIR_WORKFLOW,
32
- DIR_SCRIPTS,
33
- DIR_TASKS,
34
- get_repo_root,
35
- get_developer,
36
- get_tasks_dir,
37
- set_current_task,
38
- )
39
- from common.config import get_spec_base, resolve_package
40
-
41
-
42
- # =============================================================================
43
- # Constants
44
- # =============================================================================
45
-
46
- TASK_NAME = "00-bootstrap-guidelines"
47
-
48
-
49
- # =============================================================================
50
- # PRD Content
51
- # =============================================================================
52
-
53
- def write_prd_header() -> str:
54
- """Write PRD header section."""
55
- return """# Bootstrap: Fill Project Development Guidelines
56
-
57
- ## Purpose
58
-
59
- Welcome to Trellis! This is your first task.
60
-
61
- AI agents use `.trellis/spec/` to understand YOUR project's coding conventions.
62
- **Starting from scratch = 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
- """
72
-
73
-
74
- def write_prd_backend_section(spec_base: str) -> str:
75
- """Write PRD backend section."""
76
- return f"""
77
-
78
- ### Backend Guidelines
79
-
80
- | File | What to Document |
81
- |------|------------------|
82
- | `.trellis/{spec_base}/backend/directory-structure.md` | Where different file types go (routes, services, utils) |
83
- | `.trellis/{spec_base}/backend/database-guidelines.md` | ORM, migrations, query patterns, naming conventions |
84
- | `.trellis/{spec_base}/backend/error-handling.md` | How errors are caught, logged, and returned |
85
- | `.trellis/{spec_base}/backend/logging-guidelines.md` | Log levels, format, what to log |
86
- | `.trellis/{spec_base}/backend/quality-guidelines.md` | Code review standards, testing requirements |
87
- """
88
-
89
-
90
- def write_prd_frontend_section(spec_base: str) -> str:
91
- """Write PRD frontend section."""
92
- return f"""
93
-
94
- ### Frontend Guidelines
95
-
96
- | File | What to Document |
97
- |------|------------------|
98
- | `.trellis/{spec_base}/frontend/directory-structure.md` | Component/page/hook organization |
99
- | `.trellis/{spec_base}/frontend/component-guidelines.md` | Component patterns, props conventions |
100
- | `.trellis/{spec_base}/frontend/hook-guidelines.md` | Custom hook naming, patterns |
101
- | `.trellis/{spec_base}/frontend/state-management.md` | State library, patterns, what goes where |
102
- | `.trellis/{spec_base}/frontend/type-safety.md` | TypeScript conventions, type organization |
103
- | `.trellis/{spec_base}/frontend/quality-guidelines.md` | Linting, testing, accessibility |
104
- """
105
-
106
-
107
- def write_prd_footer() -> str:
108
- """Write PRD footer section."""
109
- return """
110
-
111
- ### Thinking Guides (Optional)
112
-
113
- The `.trellis/spec/guides/` directory contains thinking guides that are already
114
- filled with general best practices. You can customize them for your project if needed.
115
-
116
- ---
117
-
118
- ## How to Fill Guidelines
119
-
120
- ### Principle: Document Reality, Not Ideals
121
-
122
- Write what your codebase **actually does**, not what you wish it did.
123
- AI needs to match existing patterns, not introduce new ones.
124
-
125
- ### Steps
126
-
127
- 1. **Look at existing code** - Find 2-3 examples of each pattern
128
- 2. **Document the pattern** - Describe what you see
129
- 3. **Include file paths** - Reference real files as examples
130
- 4. **List anti-patterns** - What does your team avoid?
131
-
132
- ---
133
-
134
- ## Tips for Using AI
135
-
136
- Ask AI to help analyze your codebase:
137
-
138
- - "Look at my codebase and document the patterns you see"
139
- - "Analyze my code structure and summarize the conventions"
140
- - "Find error handling patterns and document them"
141
-
142
- The AI will read your code and help you document it.
143
-
144
- ---
145
-
146
- ## Completion Checklist
147
-
148
- - [ ] Guidelines filled for your project type
149
- - [ ] At least 2-3 real code examples in each guideline
150
- - [ ] Anti-patterns documented
151
-
152
- When done:
153
-
154
- ```bash
155
- python3 ./.trellis/scripts/task.py finish
156
- python3 ./.trellis/scripts/task.py archive 00-bootstrap-guidelines
157
- ```
158
-
159
- ---
160
-
161
- ## Why This Matters
162
-
163
- After completing this task:
164
-
165
- 1. AI will write code that matches your project style
166
- 2. Relevant `/trellis:before-*-dev` commands will inject real context
167
- 3. `/trellis:check-*` commands will validate against your actual standards
168
- 4. Future developers (human or AI) will onboard faster
169
- """
170
-
171
-
172
- def write_prd(task_dir: Path, project_type: str, spec_base: str) -> None:
173
- """Write prd.md file."""
174
- content = write_prd_header()
175
-
176
- if project_type == "frontend":
177
- content += write_prd_frontend_section(spec_base)
178
- elif project_type == "backend":
179
- content += write_prd_backend_section(spec_base)
180
- else: # fullstack
181
- content += write_prd_backend_section(spec_base)
182
- content += write_prd_frontend_section(spec_base)
183
-
184
- content += write_prd_footer()
185
-
186
- prd_file = task_dir / "prd.md"
187
- prd_file.write_text(content, encoding="utf-8")
188
-
189
-
190
- # =============================================================================
191
- # Task JSON
192
- # =============================================================================
193
-
194
- def write_task_json(task_dir: Path, developer: str, project_type: str, spec_base: str) -> None:
195
- """Write task.json file."""
196
- today = datetime.now().strftime("%Y-%m-%d")
197
-
198
- # Generate subtasks and related files based on project type
199
- if project_type == "frontend":
200
- subtasks = [
201
- {"name": "Fill frontend guidelines", "status": "pending"},
202
- {"name": "Add code examples", "status": "pending"},
203
- ]
204
- related_files = [f".trellis/{spec_base}/frontend/"]
205
- elif project_type == "backend":
206
- subtasks = [
207
- {"name": "Fill backend guidelines", "status": "pending"},
208
- {"name": "Add code examples", "status": "pending"},
209
- ]
210
- related_files = [f".trellis/{spec_base}/backend/"]
211
- else: # fullstack
212
- subtasks = [
213
- {"name": "Fill backend guidelines", "status": "pending"},
214
- {"name": "Fill frontend guidelines", "status": "pending"},
215
- {"name": "Add code examples", "status": "pending"},
216
- ]
217
- related_files = [f".trellis/{spec_base}/backend/", f".trellis/{spec_base}/frontend/"]
218
-
219
- task_data = {
220
- "id": TASK_NAME,
221
- "name": "Bootstrap Guidelines",
222
- "description": "Fill in project development guidelines for AI agents",
223
- "status": "in_progress",
224
- "dev_type": "docs",
225
- "priority": "P1",
226
- "creator": developer,
227
- "assignee": developer,
228
- "createdAt": today,
229
- "completedAt": None,
230
- "commit": None,
231
- "subtasks": subtasks,
232
- "children": [],
233
- "parent": None,
234
- "relatedFiles": related_files,
235
- "notes": f"First-time setup task created by trellis init ({project_type} project)",
236
- "meta": {},
237
- }
238
-
239
- task_json = task_dir / "task.json"
240
- task_json.write_text(json.dumps(task_data, indent=2, ensure_ascii=False), encoding="utf-8")
241
-
242
-
243
- # =============================================================================
244
- # Main
245
- # =============================================================================
246
-
247
- def main() -> int:
248
- """Main entry point."""
249
- # Parse project type argument
250
- project_type = "fullstack"
251
- if len(sys.argv) > 1:
252
- project_type = sys.argv[1]
253
-
254
- # Validate project type
255
- if project_type not in ("frontend", "backend", "fullstack"):
256
- print(f"Unknown project type: {project_type}, defaulting to fullstack")
257
- project_type = "fullstack"
258
-
259
- repo_root = get_repo_root()
260
- developer = get_developer(repo_root)
261
-
262
- # Check developer initialized
263
- if not developer:
264
- print("Error: Developer not initialized")
265
- print(f"Run: python3 ./{DIR_WORKFLOW}/{DIR_SCRIPTS}/init_developer.py <your-name>")
266
- return 1
267
-
268
- # Resolve spec base path (monorepo: spec/<package>, single-repo: spec)
269
- package = resolve_package(repo_root=repo_root)
270
- spec_base = get_spec_base(package, repo_root)
271
-
272
- tasks_dir = get_tasks_dir(repo_root)
273
- task_dir = tasks_dir / TASK_NAME
274
- relative_path = f"{DIR_WORKFLOW}/{DIR_TASKS}/{TASK_NAME}"
275
-
276
- # Check if already exists
277
- if task_dir.exists():
278
- print(f"Bootstrap task already exists: {relative_path}")
279
- return 0
280
-
281
- # Create task directory
282
- task_dir.mkdir(parents=True, exist_ok=True)
283
-
284
- # Write files
285
- write_task_json(task_dir, developer, project_type, spec_base)
286
- write_prd(task_dir, project_type, spec_base)
287
-
288
- # Set as current task
289
- set_current_task(relative_path, repo_root)
290
-
291
- # Silent output - init command handles user-facing messages
292
- # Only output the task path for programmatic use
293
- print(relative_path)
294
- return 0
295
-
296
-
297
- if __name__ == "__main__":
298
- sys.exit(main())