@mindfoldhq/trellis 0.4.0-beta.7 → 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.
- package/README.md +10 -5
- package/dist/cli/index.js +2 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/commands/init.d.ts +2 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +34 -10
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +33 -2
- package/dist/commands/update.js.map +1 -1
- package/dist/configurators/codex.d.ts +7 -4
- package/dist/configurators/codex.d.ts.map +1 -1
- package/dist/configurators/codex.js +40 -10
- package/dist/configurators/codex.js.map +1 -1
- package/dist/configurators/copilot.d.ts +9 -0
- package/dist/configurators/copilot.d.ts.map +1 -0
- package/dist/configurators/copilot.js +34 -0
- package/dist/configurators/copilot.js.map +1 -0
- package/dist/configurators/index.d.ts +11 -1
- package/dist/configurators/index.d.ts.map +1 -1
- package/dist/configurators/index.js +59 -4
- package/dist/configurators/index.js.map +1 -1
- package/dist/configurators/windsurf.d.ts +8 -0
- package/dist/configurators/windsurf.d.ts.map +1 -0
- package/dist/configurators/windsurf.js +18 -0
- package/dist/configurators/windsurf.js.map +1 -0
- package/dist/migrations/manifests/0.4.0-beta.8.json +34 -0
- package/dist/migrations/manifests/0.4.0-beta.9.json +9 -0
- package/dist/templates/claude/commands/trellis/record-session.md +2 -1
- package/dist/templates/claude/hooks/inject-subagent-context.py +8 -1
- package/dist/templates/claude/hooks/ralph-loop.py +8 -1
- package/dist/templates/claude/hooks/session-start.py +31 -7
- package/dist/templates/claude/hooks/statusline.py +211 -0
- package/dist/templates/claude/settings.json +4 -0
- package/dist/templates/codex/agents/check.toml +23 -0
- package/dist/templates/codex/agents/implement.toml +19 -0
- package/dist/templates/codex/agents/research.toml +26 -0
- package/dist/templates/codex/codex-skills/parallel/SKILL.md +194 -0
- package/dist/templates/codex/config.toml +5 -0
- package/dist/templates/codex/hooks/session-start.py +228 -0
- package/dist/templates/codex/hooks.json +16 -0
- package/dist/templates/codex/index.d.ts +27 -5
- package/dist/templates/codex/index.d.ts.map +1 -1
- package/dist/templates/codex/index.js +60 -8
- package/dist/templates/codex/index.js.map +1 -1
- package/dist/templates/codex/skills/improve-ut/SKILL.md +69 -0
- package/dist/templates/codex/skills/record-session/SKILL.md +2 -1
- package/dist/templates/copilot/hooks/session-start.py +218 -0
- package/dist/templates/copilot/hooks.json +11 -0
- package/dist/templates/copilot/index.d.ts +23 -0
- package/dist/templates/copilot/index.d.ts.map +1 -0
- package/dist/templates/copilot/index.js +54 -0
- package/dist/templates/copilot/index.js.map +1 -0
- package/dist/templates/copilot/prompts/before-dev.prompt.md +33 -0
- package/dist/templates/copilot/prompts/brainstorm.prompt.md +491 -0
- package/dist/templates/copilot/prompts/break-loop.prompt.md +129 -0
- package/dist/templates/copilot/prompts/check-cross-layer.prompt.md +157 -0
- package/dist/templates/copilot/prompts/check.prompt.md +29 -0
- package/dist/templates/copilot/prompts/create-command.prompt.md +116 -0
- package/dist/templates/copilot/prompts/finish-work.prompt.md +157 -0
- package/dist/templates/copilot/prompts/integrate-skill.prompt.md +223 -0
- package/dist/templates/copilot/prompts/onboard.prompt.md +362 -0
- package/dist/templates/copilot/prompts/parallel.prompt.md +196 -0
- package/dist/templates/copilot/prompts/record-session.prompt.md +66 -0
- package/dist/templates/copilot/prompts/start.prompt.md +397 -0
- package/dist/templates/copilot/prompts/update-spec.prompt.md +358 -0
- package/dist/templates/cursor/commands/trellis-record-session.md +2 -1
- package/dist/templates/extract.d.ts +29 -0
- package/dist/templates/extract.d.ts.map +1 -1
- package/dist/templates/extract.js +51 -0
- package/dist/templates/extract.js.map +1 -1
- package/dist/templates/gemini/commands/trellis/record-session.toml +2 -1
- package/dist/templates/iflow/commands/trellis/record-session.md +2 -1
- package/dist/templates/iflow/hooks/inject-subagent-context.py +8 -1
- package/dist/templates/iflow/hooks/ralph-loop.py +8 -1
- package/dist/templates/iflow/hooks/session-start.py +31 -7
- package/dist/templates/kilo/workflows/record-session.md +2 -1
- package/dist/templates/kiro/skills/record-session/SKILL.md +2 -1
- package/dist/templates/markdown/agents.md +4 -0
- package/dist/templates/markdown/spec/backend/directory-structure.md +1 -1
- package/dist/templates/markdown/workspace-index.md +2 -0
- package/dist/templates/opencode/agents/dispatch.md +20 -19
- package/dist/templates/opencode/commands/trellis/record-session.md +2 -1
- package/dist/templates/opencode/lib/trellis-context.js +42 -2
- package/dist/templates/opencode/plugins/session-start.js +7 -27
- package/dist/templates/qoder/skills/record-session/SKILL.md +2 -1
- package/dist/templates/trellis/scripts/add_session.py +69 -16
- package/dist/templates/trellis/scripts/common/__init__.py +2 -0
- package/dist/templates/trellis/scripts/common/cli_adapter.py +108 -16
- package/dist/templates/trellis/scripts/common/developer.py +2 -2
- package/dist/templates/trellis/scripts/common/paths.py +57 -6
- package/dist/templates/trellis/scripts/common/task_store.py +6 -4
- package/dist/templates/trellis/scripts/common/task_utils.py +14 -8
- package/dist/templates/trellis/scripts/multi_agent/plan.py +7 -6
- package/dist/templates/trellis/scripts/multi_agent/start.py +16 -11
- package/dist/templates/trellis/scripts/task.py +1 -1
- package/dist/templates/windsurf/index.d.ts +21 -0
- package/dist/templates/windsurf/index.d.ts.map +1 -0
- package/dist/templates/windsurf/index.js +44 -0
- package/dist/templates/windsurf/index.js.map +1 -0
- package/dist/templates/windsurf/workflows/trellis-before-dev.md +31 -0
- package/dist/templates/windsurf/workflows/trellis-brainstorm.md +491 -0
- package/dist/templates/windsurf/workflows/trellis-break-loop.md +111 -0
- package/dist/templates/windsurf/workflows/trellis-check-cross-layer.md +157 -0
- package/dist/templates/windsurf/workflows/trellis-check.md +27 -0
- package/dist/templates/windsurf/workflows/trellis-create-command.md +154 -0
- package/dist/templates/windsurf/workflows/trellis-finish-work.md +147 -0
- package/dist/templates/windsurf/workflows/trellis-integrate-skill.md +220 -0
- package/dist/templates/windsurf/workflows/trellis-onboard.md +362 -0
- package/dist/templates/windsurf/workflows/trellis-record-session.md +66 -0
- package/dist/templates/windsurf/workflows/trellis-start.md +373 -0
- package/dist/templates/windsurf/workflows/trellis-update-spec.md +358 -0
- package/dist/types/ai-tools.d.ts +15 -3
- package/dist/types/ai-tools.d.ts.map +1 -1
- package/dist/types/ai-tools.js +34 -2
- package/dist/types/ai-tools.js.map +1 -1
- package/dist/utils/template-fetcher.d.ts +17 -4
- package/dist/utils/template-fetcher.d.ts.map +1 -1
- package/dist/utils/template-fetcher.js +94 -12
- package/dist/utils/template-fetcher.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
"""
|
|
4
|
+
Trellis StatusLine — project-level status display for Claude Code.
|
|
5
|
+
|
|
6
|
+
Reads Claude Code session JSON from stdin + Trellis task data from filesystem.
|
|
7
|
+
Outputs 1-2 lines:
|
|
8
|
+
With active task: [P1] Task title (status) + info line
|
|
9
|
+
Without task: info line only
|
|
10
|
+
Info line: model · ctx% · branch · duration · developer · tasks · rate limits
|
|
11
|
+
"""
|
|
12
|
+
from __future__ import annotations
|
|
13
|
+
|
|
14
|
+
import json
|
|
15
|
+
import re
|
|
16
|
+
import subprocess
|
|
17
|
+
import sys
|
|
18
|
+
from pathlib import Path
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def _read_text(path: Path) -> str:
|
|
22
|
+
try:
|
|
23
|
+
return path.read_text(encoding="utf-8").strip()
|
|
24
|
+
except (FileNotFoundError, PermissionError, OSError):
|
|
25
|
+
return ""
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def _read_json(path: Path) -> dict:
|
|
29
|
+
text = _read_text(path)
|
|
30
|
+
if not text:
|
|
31
|
+
return {}
|
|
32
|
+
try:
|
|
33
|
+
return json.loads(text)
|
|
34
|
+
except (json.JSONDecodeError, ValueError):
|
|
35
|
+
return {}
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def _normalize_task_ref(task_ref: str) -> str:
|
|
39
|
+
normalized = task_ref.strip()
|
|
40
|
+
if not normalized:
|
|
41
|
+
return ""
|
|
42
|
+
|
|
43
|
+
path_obj = Path(normalized)
|
|
44
|
+
if path_obj.is_absolute():
|
|
45
|
+
return str(path_obj)
|
|
46
|
+
|
|
47
|
+
normalized = normalized.replace("\\", "/")
|
|
48
|
+
while normalized.startswith("./"):
|
|
49
|
+
normalized = normalized[2:]
|
|
50
|
+
|
|
51
|
+
if normalized.startswith("tasks/"):
|
|
52
|
+
return f".trellis/{normalized}"
|
|
53
|
+
|
|
54
|
+
return normalized
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def _resolve_task_dir(trellis_dir: Path, task_ref: str) -> Path:
|
|
58
|
+
normalized = _normalize_task_ref(task_ref)
|
|
59
|
+
path_obj = Path(normalized)
|
|
60
|
+
if path_obj.is_absolute():
|
|
61
|
+
return path_obj
|
|
62
|
+
if normalized.startswith(".trellis/"):
|
|
63
|
+
return trellis_dir.parent / path_obj
|
|
64
|
+
return trellis_dir / "tasks" / path_obj
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def _find_trellis_dir() -> Path | None:
|
|
68
|
+
"""Walk up from cwd to find .trellis/ directory."""
|
|
69
|
+
current = Path.cwd()
|
|
70
|
+
for parent in [current, *current.parents]:
|
|
71
|
+
candidate = parent / ".trellis"
|
|
72
|
+
if candidate.is_dir():
|
|
73
|
+
return candidate
|
|
74
|
+
return None
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def _get_current_task(trellis_dir: Path) -> dict | None:
|
|
78
|
+
"""Load current task info. Returns dict with title/status/priority or None."""
|
|
79
|
+
task_ref = _normalize_task_ref(_read_text(trellis_dir / ".current-task"))
|
|
80
|
+
if not task_ref:
|
|
81
|
+
return None
|
|
82
|
+
|
|
83
|
+
# Resolve task directory
|
|
84
|
+
task_path = _resolve_task_dir(trellis_dir, task_ref)
|
|
85
|
+
task_data = _read_json(task_path / "task.json")
|
|
86
|
+
if not task_data:
|
|
87
|
+
return None
|
|
88
|
+
|
|
89
|
+
return {
|
|
90
|
+
"title": task_data.get("title") or task_data.get("name") or "unknown",
|
|
91
|
+
"status": task_data.get("status", "unknown"),
|
|
92
|
+
"priority": task_data.get("priority", "P2"),
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def _count_active_tasks(trellis_dir: Path) -> int:
|
|
97
|
+
"""Count non-archived task directories with valid task.json."""
|
|
98
|
+
tasks_dir = trellis_dir / "tasks"
|
|
99
|
+
if not tasks_dir.is_dir():
|
|
100
|
+
return 0
|
|
101
|
+
count = 0
|
|
102
|
+
for d in tasks_dir.iterdir():
|
|
103
|
+
if d.is_dir() and d.name != "archive" and (d / "task.json").is_file():
|
|
104
|
+
count += 1
|
|
105
|
+
return count
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def _get_developer(trellis_dir: Path) -> str:
|
|
109
|
+
content = _read_text(trellis_dir / ".developer")
|
|
110
|
+
if not content:
|
|
111
|
+
return "unknown"
|
|
112
|
+
for line in content.splitlines():
|
|
113
|
+
if line.startswith("name="):
|
|
114
|
+
return line[5:].strip()
|
|
115
|
+
return content.splitlines()[0].strip() or "unknown"
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
def _get_git_branch() -> str:
|
|
119
|
+
try:
|
|
120
|
+
result = subprocess.run(
|
|
121
|
+
["git", "branch", "--show-current"],
|
|
122
|
+
capture_output=True, text=True, timeout=3,
|
|
123
|
+
)
|
|
124
|
+
return result.stdout.strip() if result.returncode == 0 else ""
|
|
125
|
+
except (FileNotFoundError, subprocess.TimeoutExpired):
|
|
126
|
+
return ""
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
def _format_ctx_size(size: int) -> str:
|
|
130
|
+
if size >= 1_000_000:
|
|
131
|
+
return f"{size // 1_000_000}M"
|
|
132
|
+
if size >= 1_000:
|
|
133
|
+
return f"{size // 1_000}K"
|
|
134
|
+
return str(size)
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
def _format_duration(ms: int) -> str:
|
|
138
|
+
secs = ms // 1000
|
|
139
|
+
hours, remainder = divmod(secs, 3600)
|
|
140
|
+
mins = remainder // 60
|
|
141
|
+
if hours > 0:
|
|
142
|
+
return f"{hours}h{mins}m"
|
|
143
|
+
return f"{mins}m"
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
def main() -> None:
|
|
147
|
+
# Read Claude Code session JSON from stdin
|
|
148
|
+
try:
|
|
149
|
+
cc_data = json.loads(sys.stdin.read())
|
|
150
|
+
except (json.JSONDecodeError, ValueError):
|
|
151
|
+
cc_data = {}
|
|
152
|
+
|
|
153
|
+
trellis_dir = _find_trellis_dir()
|
|
154
|
+
SEP = " \033[90m·\033[0m "
|
|
155
|
+
|
|
156
|
+
# --- Trellis data ---
|
|
157
|
+
task = _get_current_task(trellis_dir) if trellis_dir else None
|
|
158
|
+
dev = _get_developer(trellis_dir) if trellis_dir else ""
|
|
159
|
+
task_count = _count_active_tasks(trellis_dir) if trellis_dir else 0
|
|
160
|
+
|
|
161
|
+
# --- CC session data ---
|
|
162
|
+
model = cc_data.get("model", {}).get("display_name", "?")
|
|
163
|
+
ctx_pct = int(cc_data.get("context_window", {}).get("used_percentage") or 0)
|
|
164
|
+
ctx_size = _format_ctx_size(cc_data.get("context_window", {}).get("context_window_size") or 0)
|
|
165
|
+
duration = _format_duration(cc_data.get("cost", {}).get("total_duration_ms") or 0)
|
|
166
|
+
branch = _get_git_branch()
|
|
167
|
+
|
|
168
|
+
# Avoid "Opus 4.6 (1M context) (1M)"
|
|
169
|
+
if re.search(r"\d+[KMG]\b", model, re.IGNORECASE):
|
|
170
|
+
model_label = model
|
|
171
|
+
else:
|
|
172
|
+
model_label = f"{model} ({ctx_size})"
|
|
173
|
+
|
|
174
|
+
# Context % with color
|
|
175
|
+
if ctx_pct >= 90:
|
|
176
|
+
ctx_color = "\033[31m"
|
|
177
|
+
elif ctx_pct >= 70:
|
|
178
|
+
ctx_color = "\033[33m"
|
|
179
|
+
else:
|
|
180
|
+
ctx_color = "\033[32m"
|
|
181
|
+
|
|
182
|
+
# Build info line: model · ctx · branch · duration · dev · tasks [· rate limits]
|
|
183
|
+
parts = [
|
|
184
|
+
model_label,
|
|
185
|
+
f"ctx {ctx_color}{ctx_pct}%\033[0m",
|
|
186
|
+
]
|
|
187
|
+
if branch:
|
|
188
|
+
parts.append(f"\033[35m{branch}\033[0m")
|
|
189
|
+
parts.append(duration)
|
|
190
|
+
if dev:
|
|
191
|
+
parts.append(f"\033[32m{dev}\033[0m")
|
|
192
|
+
if task_count:
|
|
193
|
+
parts.append(f"{task_count} task(s)")
|
|
194
|
+
|
|
195
|
+
five_hr = cc_data.get("rate_limits", {}).get("five_hour", {}).get("used_percentage")
|
|
196
|
+
if five_hr is not None:
|
|
197
|
+
parts.append(f"5h {int(five_hr)}%")
|
|
198
|
+
seven_day = cc_data.get("rate_limits", {}).get("seven_day", {}).get("used_percentage")
|
|
199
|
+
if seven_day is not None:
|
|
200
|
+
parts.append(f"7d {int(seven_day)}%")
|
|
201
|
+
|
|
202
|
+
info_line = SEP.join(parts)
|
|
203
|
+
|
|
204
|
+
# Output: task line (only if active) + info line
|
|
205
|
+
if task:
|
|
206
|
+
print(f"\033[36m[{task['priority']}]\033[0m {task['title']} \033[33m({task['status']})\033[0m")
|
|
207
|
+
print(info_line)
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
if __name__ == "__main__":
|
|
211
|
+
main()
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
name = "check"
|
|
2
|
+
description = "Read-only Trellis reviewer focused on correctness, missing tests, and spec drift."
|
|
3
|
+
sandbox_mode = "read-only"
|
|
4
|
+
|
|
5
|
+
developer_instructions = """
|
|
6
|
+
You are the Trellis reviewer agent.
|
|
7
|
+
|
|
8
|
+
Review checklist:
|
|
9
|
+
- Verify behavior against the actual code paths, not assumptions.
|
|
10
|
+
- Look for missing template/update/detection touch points when platform config changes.
|
|
11
|
+
- Check whether tests should be added or updated.
|
|
12
|
+
- Check whether `.trellis/spec/` docs need sync after implementation.
|
|
13
|
+
- Prefer concrete findings over speculative warnings.
|
|
14
|
+
|
|
15
|
+
Output format:
|
|
16
|
+
## Findings
|
|
17
|
+
- Severity: <high|medium|low>
|
|
18
|
+
- File: <path>
|
|
19
|
+
- Issue: <what is wrong>
|
|
20
|
+
- Recommendation: <specific fix>
|
|
21
|
+
|
|
22
|
+
If no issues are found, say so explicitly.
|
|
23
|
+
"""
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
name = "implement"
|
|
2
|
+
description = "Workspace-write Trellis implementer that follows specs and keeps generated templates in sync."
|
|
3
|
+
sandbox_mode = "workspace-write"
|
|
4
|
+
|
|
5
|
+
developer_instructions = """
|
|
6
|
+
You are the Trellis implementer agent.
|
|
7
|
+
|
|
8
|
+
Rules:
|
|
9
|
+
- Read before write. Follow `.trellis/spec/` guidance relevant to the task.
|
|
10
|
+
- Keep changes focused on the requested scope.
|
|
11
|
+
- When touching platform registries or template lists, search first so you do not miss mirrored update paths.
|
|
12
|
+
- If you modify `.trellis/scripts/`, keep `packages/cli/src/templates/trellis/scripts/` in sync.
|
|
13
|
+
- Do not make destructive git changes unless explicitly asked.
|
|
14
|
+
|
|
15
|
+
Before finishing, summarize:
|
|
16
|
+
- Files changed
|
|
17
|
+
- Tests/checks run
|
|
18
|
+
- Remaining risks or follow-ups
|
|
19
|
+
"""
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
name = "research"
|
|
2
|
+
description = "Read-only Trellis researcher for specs, code patterns, and affected files."
|
|
3
|
+
sandbox_mode = "read-only"
|
|
4
|
+
|
|
5
|
+
developer_instructions = """
|
|
6
|
+
You are the Trellis researcher agent.
|
|
7
|
+
|
|
8
|
+
Responsibilities:
|
|
9
|
+
- Read `.trellis/workflow.md`, relevant `.trellis/spec/` files, and target code before proposing changes.
|
|
10
|
+
- Identify the smallest set of relevant specs, code patterns, and files to modify.
|
|
11
|
+
- Call out cross-layer or cross-platform risks when they are real.
|
|
12
|
+
- Do not edit files.
|
|
13
|
+
|
|
14
|
+
Output format:
|
|
15
|
+
## Relevant Specs
|
|
16
|
+
- <path>: <why>
|
|
17
|
+
|
|
18
|
+
## Code Patterns Found
|
|
19
|
+
- <pattern>: <file>
|
|
20
|
+
|
|
21
|
+
## Files to Modify
|
|
22
|
+
- <path>: <change>
|
|
23
|
+
|
|
24
|
+
## Risks / Follow-ups
|
|
25
|
+
- <none or concrete note>
|
|
26
|
+
"""
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: parallel
|
|
3
|
+
description: "Multi-agent pipeline orchestrator that plans and dispatches parallel development tasks to worktree agents. Reads project context, configures task directories with PRDs and jsonl context files, and launches isolated coding agents. Use when multiple independent features need parallel development, orchestrating worktree agents, or managing multi-agent coding pipelines."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Multi-Agent Pipeline Orchestrator
|
|
7
|
+
|
|
8
|
+
You are the Multi-Agent Pipeline Orchestrator Agent, running in the main repository, responsible for collaborating with users to manage parallel development tasks.
|
|
9
|
+
|
|
10
|
+
## Role Definition
|
|
11
|
+
|
|
12
|
+
- **You are in the main repository**, not in a worktree
|
|
13
|
+
- **You don't write code directly** - code work is done by agents in worktrees
|
|
14
|
+
- **You are responsible for planning and dispatching**: discuss requirements, create plans, configure context, start worktree agents
|
|
15
|
+
- **Delegate complex analysis to research**: find specs, inspect code structure, and reduce ambiguity before dispatch
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Operation Types
|
|
20
|
+
|
|
21
|
+
Operations in this document are categorized as:
|
|
22
|
+
|
|
23
|
+
| Marker | Meaning | Executor |
|
|
24
|
+
|--------|---------|----------|
|
|
25
|
+
| `[AI]` | Bash scripts or tool calls executed by AI | You (AI) |
|
|
26
|
+
| `[USER]` | Skills executed by user | User |
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Startup Flow
|
|
31
|
+
|
|
32
|
+
### Step 1: Understand Trellis Workflow `[AI]`
|
|
33
|
+
|
|
34
|
+
First, read the workflow guide to understand the development process:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
cat .trellis/workflow.md # Development process, conventions, and quick start guide
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Step 2: Get Current Status `[AI]`
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
python3 ./.trellis/scripts/get_context.py
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Step 3: Read Project Guidelines `[AI]`
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
python3 ./.trellis/scripts/get_context.py --mode packages # Discover available spec layers
|
|
50
|
+
cat .trellis/spec/guides/index.md # Thinking guides
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Step 4: Ask User for Requirements
|
|
54
|
+
|
|
55
|
+
Ask the user:
|
|
56
|
+
|
|
57
|
+
1. What feature to develop?
|
|
58
|
+
2. Which modules are involved?
|
|
59
|
+
3. Development type? (backend / frontend / fullstack)
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Planning: Choose Your Approach
|
|
64
|
+
|
|
65
|
+
Based on requirement complexity, choose one of these approaches:
|
|
66
|
+
|
|
67
|
+
### Option A: Plan Agent (Recommended for complex features) `[AI]`
|
|
68
|
+
|
|
69
|
+
Use when:
|
|
70
|
+
- Requirements need analysis and validation
|
|
71
|
+
- Multiple modules or cross-layer changes
|
|
72
|
+
- Unclear scope that needs research
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
python3 ./.trellis/scripts/multi_agent/plan.py \
|
|
76
|
+
--name "<feature-name>" \
|
|
77
|
+
--type "<backend|frontend|fullstack>" \
|
|
78
|
+
--requirement "<user requirement description>" \
|
|
79
|
+
--platform codex
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Plan Agent will:
|
|
83
|
+
1. Evaluate requirement validity (may reject if unclear/too large)
|
|
84
|
+
2. Analyze the codebase and specs
|
|
85
|
+
3. Create and configure task directory
|
|
86
|
+
4. Write `prd.md` with acceptance criteria
|
|
87
|
+
5. Output a ready-to-use task directory
|
|
88
|
+
|
|
89
|
+
After `plan.py` completes, start the worktree agent:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
python3 ./.trellis/scripts/multi_agent/start.py "$TASK_DIR" --platform codex
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Option B: Manual Configuration (For simple or already-clear features) `[AI]`
|
|
96
|
+
|
|
97
|
+
Use when:
|
|
98
|
+
- Requirements are already clear and specific
|
|
99
|
+
- You know exactly which files are involved
|
|
100
|
+
- Simple, well-scoped changes
|
|
101
|
+
|
|
102
|
+
#### Step 1: Create Task Directory
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
TASK_DIR=$(python3 ./.trellis/scripts/task.py create "<title>" --slug <task-name>)
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
#### Step 2: Configure Task
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
python3 ./.trellis/scripts/task.py init-context "$TASK_DIR" <dev_type>
|
|
112
|
+
python3 ./.trellis/scripts/task.py set-branch "$TASK_DIR" feature/<name>
|
|
113
|
+
python3 ./.trellis/scripts/task.py set-scope "$TASK_DIR" <scope>
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
#### Step 3: Add Context
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
python3 ./.trellis/scripts/task.py add-context "$TASK_DIR" implement "<path>" "<reason>"
|
|
120
|
+
python3 ./.trellis/scripts/task.py add-context "$TASK_DIR" check "<path>" "<reason>"
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
#### Step 4: Create `prd.md`
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
cat > "$TASK_DIR/prd.md" << 'END_PRD'
|
|
127
|
+
# Feature: <name>
|
|
128
|
+
|
|
129
|
+
## Requirements
|
|
130
|
+
- ...
|
|
131
|
+
|
|
132
|
+
## Acceptance Criteria
|
|
133
|
+
- ...
|
|
134
|
+
END_PRD
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
#### Step 5: Validate and Start
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
python3 ./.trellis/scripts/task.py validate "$TASK_DIR"
|
|
141
|
+
python3 ./.trellis/scripts/multi_agent/start.py "$TASK_DIR" --platform codex
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## After Starting: Report Status
|
|
147
|
+
|
|
148
|
+
Tell the user the agent has started and provide monitoring commands.
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## User Available Skills `[USER]`
|
|
153
|
+
|
|
154
|
+
The following skills are for users (not AI):
|
|
155
|
+
|
|
156
|
+
| Skill | Description |
|
|
157
|
+
|-------|-------------|
|
|
158
|
+
| `$parallel` | Start Multi-Agent Pipeline (this skill) |
|
|
159
|
+
| `$start` | Start normal development mode (single process) |
|
|
160
|
+
| `$record-session` | Record session progress |
|
|
161
|
+
| `$finish-work` | Pre-completion checklist |
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## Monitoring Commands (for user reference)
|
|
166
|
+
|
|
167
|
+
Tell the user they can use these commands to monitor:
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
python3 ./.trellis/scripts/multi_agent/status.py # Overview
|
|
171
|
+
python3 ./.trellis/scripts/multi_agent/status.py --log <name> # View log
|
|
172
|
+
python3 ./.trellis/scripts/multi_agent/status.py --watch <name> # Real-time monitoring
|
|
173
|
+
python3 ./.trellis/scripts/multi_agent/cleanup.py <branch> # Cleanup worktree
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## Pipeline Phases
|
|
179
|
+
|
|
180
|
+
The dispatch agent in the worktree will automatically execute:
|
|
181
|
+
|
|
182
|
+
1. implement → Implement feature
|
|
183
|
+
2. check → Check code quality
|
|
184
|
+
3. finish → Final verification
|
|
185
|
+
4. create-pr → Create PR
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
## Core Rules
|
|
190
|
+
|
|
191
|
+
- **Don't write code directly** - delegate to agents in worktrees
|
|
192
|
+
- **Don't execute git commit** - the flow handles it in the worktree pipeline
|
|
193
|
+
- **Delegate complex analysis before dispatch** - find specs, inspect code structure, and reduce ambiguity
|
|
194
|
+
- **Prefer focused tasks** - parallelism works best when each worktree has a narrow scope
|