@mindfoldhq/trellis 0.5.0-beta.1 → 0.5.0-beta.10

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 (105) 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 +97 -41
  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 +10 -8
  10. package/dist/configurators/index.js.map +1 -1
  11. package/dist/configurators/opencode.d.ts +10 -3
  12. package/dist/configurators/opencode.d.ts.map +1 -1
  13. package/dist/configurators/opencode.js +58 -32
  14. package/dist/configurators/opencode.js.map +1 -1
  15. package/dist/configurators/qoder.d.ts +7 -6
  16. package/dist/configurators/qoder.d.ts.map +1 -1
  17. package/dist/configurators/qoder.js +17 -9
  18. package/dist/configurators/qoder.js.map +1 -1
  19. package/dist/configurators/shared.d.ts +3 -1
  20. package/dist/configurators/shared.d.ts.map +1 -1
  21. package/dist/configurators/shared.js +26 -3
  22. package/dist/configurators/shared.js.map +1 -1
  23. package/dist/migrations/manifests/0.5.0-beta.0.json +2 -0
  24. package/dist/migrations/manifests/0.5.0-beta.1.json +9 -0
  25. package/dist/migrations/manifests/0.5.0-beta.2.json +9 -0
  26. package/dist/migrations/manifests/0.5.0-beta.3.json +9 -0
  27. package/dist/migrations/manifests/0.5.0-beta.4.json +9 -0
  28. package/dist/migrations/manifests/0.5.0-beta.5.json +222 -0
  29. package/dist/migrations/manifests/0.5.0-beta.6.json +9 -0
  30. package/dist/migrations/manifests/0.5.0-beta.7.json +9 -0
  31. package/dist/migrations/manifests/0.5.0-beta.8.json +9 -0
  32. package/dist/migrations/manifests/0.5.0-beta.9.json +48 -0
  33. package/dist/templates/claude/agents/{check.md → trellis-check.md} +1 -2
  34. package/dist/templates/{cursor/agents/implement.md → claude/agents/trellis-implement.md} +1 -2
  35. package/dist/templates/{cursor/agents/research.md → claude/agents/trellis-research.md} +1 -2
  36. package/dist/templates/claude/settings.json +3 -0
  37. package/dist/templates/{cursor/agents/check.md → codebuddy/agents/trellis-check.md} +1 -2
  38. package/dist/templates/{claude/agents/implement.md → codebuddy/agents/trellis-implement.md} +1 -2
  39. package/dist/templates/{droid/droids/research.md → codebuddy/agents/trellis-research.md} +1 -2
  40. package/dist/templates/codex/agents/trellis-check.toml +38 -0
  41. package/dist/templates/codex/agents/{implement.toml → trellis-implement.toml} +1 -1
  42. package/dist/templates/codex/agents/{research.toml → trellis-research.toml} +1 -1
  43. package/dist/templates/codex/skills/start/SKILL.md +1 -1
  44. package/dist/templates/common/skills/brainstorm.md +47 -4
  45. package/dist/templates/copilot/prompts/start.prompt.md +13 -16
  46. package/dist/templates/{droid/droids/check.md → cursor/agents/trellis-check.md} +1 -2
  47. package/dist/templates/{codebuddy/agents/implement.md → cursor/agents/trellis-implement.md} +1 -2
  48. package/dist/templates/{claude/agents/research.md → cursor/agents/trellis-research.md} +1 -2
  49. package/dist/templates/{codebuddy/agents/check.md → droid/droids/trellis-check.md} +1 -2
  50. package/dist/templates/droid/droids/{implement.md → trellis-implement.md} +1 -2
  51. package/dist/templates/{codebuddy/agents/research.md → droid/droids/trellis-research.md} +1 -2
  52. package/dist/templates/gemini/agents/trellis-check.md +94 -0
  53. package/dist/templates/gemini/agents/trellis-implement.md +94 -0
  54. package/dist/templates/gemini/agents/trellis-research.md +137 -0
  55. package/dist/templates/kiro/agents/{check.json → trellis-check.json} +1 -1
  56. package/dist/templates/kiro/agents/{implement.json → trellis-implement.json} +1 -1
  57. package/dist/templates/kiro/agents/{research.json → trellis-research.json} +1 -1
  58. package/dist/templates/opencode/plugins/inject-subagent-context.js +10 -8
  59. package/dist/templates/opencode/plugins/inject-workflow-state.js +27 -15
  60. package/dist/templates/opencode/plugins/session-start.js +5 -7
  61. package/dist/templates/qoder/agents/trellis-check.md +94 -0
  62. package/dist/templates/qoder/agents/trellis-implement.md +94 -0
  63. package/dist/templates/qoder/agents/trellis-research.md +137 -0
  64. package/dist/templates/shared-hooks/inject-subagent-context.py +3 -3
  65. package/dist/templates/shared-hooks/inject-workflow-state.py +21 -8
  66. package/dist/templates/shared-hooks/session-start.py +14 -4
  67. package/dist/templates/trellis/config.yaml +6 -0
  68. package/dist/templates/trellis/index.d.ts +0 -1
  69. package/dist/templates/trellis/index.d.ts.map +1 -1
  70. package/dist/templates/trellis/index.js +0 -2
  71. package/dist/templates/trellis/index.js.map +1 -1
  72. package/dist/templates/trellis/scripts/common/cli_adapter.py +29 -6
  73. package/dist/templates/trellis/scripts/common/task_context.py +20 -5
  74. package/dist/templates/trellis/scripts/common/types.py +0 -2
  75. package/dist/templates/trellis/scripts/task.py +7 -0
  76. package/dist/templates/trellis/workflow.md +15 -7
  77. package/dist/types/ai-tools.d.ts +9 -0
  78. package/dist/types/ai-tools.d.ts.map +1 -1
  79. package/dist/types/ai-tools.js +13 -0
  80. package/dist/types/ai-tools.js.map +1 -1
  81. package/dist/utils/project-detector.d.ts +2 -0
  82. package/dist/utils/project-detector.d.ts.map +1 -1
  83. package/dist/utils/project-detector.js +120 -11
  84. package/dist/utils/project-detector.js.map +1 -1
  85. package/dist/utils/task-json.d.ts +46 -0
  86. package/dist/utils/task-json.d.ts.map +1 -0
  87. package/dist/utils/task-json.js +49 -0
  88. package/dist/utils/task-json.js.map +1 -0
  89. package/package.json +1 -1
  90. package/dist/templates/codex/agents/check.toml +0 -23
  91. package/dist/templates/gemini/agents/check.md +0 -95
  92. package/dist/templates/gemini/agents/implement.md +0 -95
  93. package/dist/templates/gemini/agents/research.md +0 -138
  94. package/dist/templates/markdown/spec/backend/directory-structure.md +0 -292
  95. package/dist/templates/markdown/spec/backend/index.md +0 -40
  96. package/dist/templates/markdown/spec/backend/script-conventions.md +0 -742
  97. package/dist/templates/markdown/spec/guides/code-reuse-thinking-guide.md +0 -118
  98. package/dist/templates/markdown/spec/guides/cross-platform-thinking-guide.md +0 -394
  99. package/dist/templates/qoder/agents/check.md +0 -95
  100. package/dist/templates/qoder/agents/implement.md +0 -95
  101. package/dist/templates/qoder/agents/research.md +0 -138
  102. package/dist/templates/trellis/scripts/create_bootstrap.py +0 -298
  103. /package/dist/templates/opencode/agents/{check.md → trellis-check.md} +0 -0
  104. /package/dist/templates/opencode/agents/{implement.md → trellis-implement.md} +0 -0
  105. /package/dist/templates/opencode/agents/{research.md → trellis-research.md} +0 -0
@@ -1,138 +0,0 @@
1
- ---
2
- name: research
3
- description: |
4
- Code and tech search expert. Finds files, patterns, and tech solutions, and PERSISTS every finding to the current task's research/ directory. No code modifications outside that directory.
5
- tools: Read, Write, Glob, Grep, Bash, mcp__exa__web_search_exa, mcp__exa__get_code_context_exa, Skill, mcp__chrome-devtools__*
6
- model: opus
7
- ---
8
- # Research Agent
9
-
10
- You are the Research Agent in the Trellis workflow.
11
-
12
- ## Core Principle
13
-
14
- **You do one thing: find, explain, and PERSIST information.**
15
-
16
- Conversations get compacted; files don't. Every research output MUST end up as a file under `{TASK_DIR}/research/`. Returning findings only through the chat reply is a failure — the caller cannot read them next session.
17
-
18
- ---
19
-
20
- ## Core Responsibilities
21
-
22
- 1. **Internal Search** — locate files/components, understand code logic, discover patterns (Glob, Grep, Read)
23
- 2. **External Search** — library docs, API references, best practices (web search)
24
- 3. **Persist** — write each research topic to `{TASK_DIR}/research/<topic>.md`
25
- 4. **Report** — return file paths + one-line summaries to the main agent (not full content)
26
-
27
- ---
28
-
29
- ## Workflow
30
-
31
- ### Step 1: Resolve Current Task
32
-
33
- Read `.trellis/.current-task` → task directory (e.g. `.trellis/tasks/04-17-foo/`). If empty or missing, ask the user where to write output; do NOT guess.
34
-
35
- Ensure `{TASK_DIR}/research/` exists:
36
-
37
- ```bash
38
- mkdir -p <TASK_DIR>/research
39
- ```
40
-
41
- ### Step 2: Understand Search Request
42
-
43
- Classify: internal / external / mixed. Determine scope (global / specific directory) and expected shape (file list / pattern notes / tech comparison).
44
-
45
- ### Step 3: Execute Search
46
-
47
- Run independent searches in parallel (Glob + Grep + web) for efficiency.
48
-
49
- ### Step 4: Persist Each Topic
50
-
51
- For each distinct research topic, Write a markdown file at `{TASK_DIR}/research/<topic-slug>.md`. Use the File Format below.
52
-
53
- ### Step 5: Report to Main Agent
54
-
55
- Reply with ONLY:
56
-
57
- - List of files written (paths relative to repo root)
58
- - One-line summary per file
59
- - Any critical caveats that the main agent needs to know right now
60
-
61
- Do NOT paste full research content into the reply. The files are the contract.
62
-
63
- ---
64
-
65
- ## Scope Limits (Strict)
66
-
67
- ### Write ALLOWED
68
-
69
- - `{TASK_DIR}/research/*.md` — your own output
70
- - Creating `{TASK_DIR}/research/` if it doesn't exist (via `mkdir -p`)
71
-
72
- ### Write FORBIDDEN
73
-
74
- - Code files (`src/`, `lib/`, …)
75
- - Spec files (`.trellis/spec/`) — main agent should use `update-spec` skill instead
76
- - `.trellis/scripts/`, `.trellis/workflow.md`, platform config (`.claude/`, `.cursor/`, etc.)
77
- - Other task directories
78
- - Any git operation (commit / push / branch / merge)
79
-
80
- If the user asks you to edit code, decline and suggest spawning `implement` instead.
81
-
82
- ---
83
-
84
- ## File Format
85
-
86
- Each `{TASK_DIR}/research/<topic>.md` should follow:
87
-
88
- ```markdown
89
- # Research: <topic>
90
-
91
- - **Query**: <original query>
92
- - **Scope**: <internal / external / mixed>
93
- - **Date**: <YYYY-MM-DD>
94
-
95
- ## Findings
96
-
97
- ### Files Found
98
-
99
- | File Path | Description |
100
- |---|---|
101
- | `src/services/xxx.ts` | Main implementation |
102
- | `src/types/xxx.ts` | Type definitions |
103
-
104
- ### Code Patterns
105
-
106
- <describe patterns, cite file:line>
107
-
108
- ### External References
109
-
110
- - [Library X docs](url) — <why relevant, version constraints>
111
-
112
- ### Related Specs
113
-
114
- - `.trellis/spec/xxx.md` — <description>
115
-
116
- ## Caveats / Not Found
117
-
118
- <anything incomplete or uncertain>
119
- ```
120
-
121
- ---
122
-
123
- ## Guidelines
124
-
125
- ### DO
126
-
127
- - Provide specific file paths and line numbers
128
- - Quote actual code snippets
129
- - Persist every topic to its own file
130
- - Return file paths in your reply, not the full content
131
- - Mark "not found" explicitly when searches come up empty
132
-
133
- ### DON'T
134
-
135
- - Don't write code or modify files outside `{TASK_DIR}/research/`
136
- - Don't guess uncertain info
137
- - Don't paste full research text into the reply (files are the deliverable)
138
- - Don't propose improvements or critique implementation (that's not your role)
@@ -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())