@mindfoldhq/trellis 0.1.7 → 0.1.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/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +34 -4
- package/dist/cli/index.js.map +1 -1
- package/dist/commands/update.d.ts +1 -0
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +90 -7
- package/dist/commands/update.js.map +1 -1
- package/dist/templates/claude/commands/start.md +182 -94
- package/dist/templates/claude/hooks/session-start.py +124 -0
- package/dist/templates/claude/settings.json +14 -1
- package/dist/templates/trellis/scripts/feature.sh +1 -1
- package/dist/templates/trellis/scripts/multi-agent/create-pr.sh +1 -1
- package/dist/templates/trellis/scripts/multi-agent/plan.sh +3 -29
- package/dist/templates/trellis/scripts/multi-agent/start.sh +3 -14
- package/package.json +1 -1
- package/README.md +0 -818
|
@@ -6,8 +6,6 @@ Initialize your AI development session and begin working on tasks.
|
|
|
6
6
|
|
|
7
7
|
## Operation Types
|
|
8
8
|
|
|
9
|
-
Operations in this document are categorized as:
|
|
10
|
-
|
|
11
9
|
| Marker | Meaning | Executor |
|
|
12
10
|
|--------|---------|----------|
|
|
13
11
|
| `[AI]` | Bash scripts or Task calls executed by AI | You (AI) |
|
|
@@ -15,178 +13,268 @@ Operations in this document are categorized as:
|
|
|
15
13
|
|
|
16
14
|
---
|
|
17
15
|
|
|
18
|
-
## Initialization
|
|
16
|
+
## Initialization `[AI]`
|
|
19
17
|
|
|
20
|
-
### Step 1: Understand
|
|
18
|
+
### Step 1: Understand Development Workflow
|
|
21
19
|
|
|
22
20
|
First, read the workflow guide to understand the development process:
|
|
23
21
|
|
|
24
22
|
```bash
|
|
25
|
-
cat .trellis/workflow.md
|
|
23
|
+
cat .trellis/workflow.md
|
|
26
24
|
```
|
|
27
25
|
|
|
28
|
-
|
|
26
|
+
**Follow the instructions in workflow.md** - it contains:
|
|
27
|
+
- Core principles (Read Before Write, Follow Standards, etc.)
|
|
28
|
+
- File system structure
|
|
29
|
+
- Development process
|
|
30
|
+
- Best practices
|
|
31
|
+
|
|
32
|
+
### Step 2: Get Current Context
|
|
29
33
|
|
|
30
34
|
```bash
|
|
31
35
|
./.trellis/scripts/get-context.sh
|
|
32
36
|
```
|
|
33
37
|
|
|
34
|
-
|
|
38
|
+
This shows: developer identity, git status, current feature (if any), backlog items.
|
|
39
|
+
|
|
40
|
+
### Step 3: Read Guidelines Index
|
|
35
41
|
|
|
36
42
|
```bash
|
|
37
|
-
cat .trellis/structure/frontend/index.md # Frontend guidelines
|
|
38
|
-
cat .trellis/structure/backend/index.md # Backend guidelines
|
|
43
|
+
cat .trellis/structure/frontend/index.md # Frontend guidelines
|
|
44
|
+
cat .trellis/structure/backend/index.md # Backend guidelines
|
|
39
45
|
cat .trellis/structure/guides/index.md # Thinking guides
|
|
40
46
|
```
|
|
41
47
|
|
|
42
|
-
### Step 4: Report
|
|
48
|
+
### Step 4: Report and Ask
|
|
49
|
+
|
|
50
|
+
Report what you learned and ask: "What would you like to work on?"
|
|
43
51
|
|
|
44
52
|
---
|
|
45
53
|
|
|
46
|
-
##
|
|
54
|
+
## Task Classification
|
|
47
55
|
|
|
48
|
-
|
|
56
|
+
When user describes a task, classify it:
|
|
49
57
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
58
|
+
| Type | Criteria | Workflow |
|
|
59
|
+
|------|----------|----------|
|
|
60
|
+
| **Question** | User asks about code, architecture, or how something works | Answer directly |
|
|
61
|
+
| **Trivial Fix** | Typo fix, comment update, single-line change, < 5 minutes | Direct Edit |
|
|
62
|
+
| **Development Task** | Any code change that: modifies logic, adds features, fixes bugs, touches multiple files | **Feature Workflow** |
|
|
53
63
|
|
|
54
|
-
###
|
|
64
|
+
### Decision Rule
|
|
55
65
|
|
|
56
|
-
|
|
66
|
+
> **If in doubt, use Feature Workflow.**
|
|
67
|
+
>
|
|
68
|
+
> Feature Workflow ensures specs are injected to agents, resulting in higher quality code.
|
|
69
|
+
> The overhead is minimal, but the benefit is significant.
|
|
57
70
|
|
|
58
|
-
|
|
71
|
+
---
|
|
59
72
|
|
|
60
|
-
|
|
61
|
-
FEATURE_DIR=$(./.trellis/scripts/feature.sh create "<title>" --slug <name>)
|
|
62
|
-
```
|
|
73
|
+
## Question / Trivial Fix
|
|
63
74
|
|
|
64
|
-
|
|
75
|
+
For questions or trivial fixes, work directly:
|
|
65
76
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
77
|
+
1. Answer question or make the fix
|
|
78
|
+
2. If code was changed, remind user to run `/finish-work`
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## Feature Workflow (Development Tasks)
|
|
83
|
+
|
|
84
|
+
**Why this workflow?**
|
|
85
|
+
- Research Agent analyzes what specs are needed
|
|
86
|
+
- Specs are configured in jsonl files
|
|
87
|
+
- Implement Agent receives specs via Hook injection
|
|
88
|
+
- Check Agent verifies against specs
|
|
89
|
+
- Result: Code that follows project conventions automatically
|
|
70
90
|
|
|
71
|
-
|
|
91
|
+
### Step 1: Understand the Task `[AI]`
|
|
92
|
+
|
|
93
|
+
Before creating anything, understand what user wants:
|
|
94
|
+
- What is the goal?
|
|
95
|
+
- What type of development? (frontend / backend / fullstack)
|
|
96
|
+
- Any specific requirements or constraints?
|
|
97
|
+
|
|
98
|
+
If unclear, ask clarifying questions.
|
|
99
|
+
|
|
100
|
+
### Step 2: Research the Codebase `[AI]`
|
|
101
|
+
|
|
102
|
+
Call Research Agent to analyze:
|
|
72
103
|
|
|
73
104
|
```
|
|
74
105
|
Task(
|
|
75
106
|
subagent_type: "research",
|
|
76
|
-
prompt: "Analyze
|
|
107
|
+
prompt: "Analyze the codebase for this task:
|
|
77
108
|
|
|
78
|
-
Task
|
|
79
|
-
|
|
109
|
+
Task: <user's task description>
|
|
110
|
+
Type: <frontend/backend/fullstack>
|
|
80
111
|
|
|
81
|
-
Please:
|
|
82
|
-
1.
|
|
83
|
-
2.
|
|
84
|
-
3.
|
|
112
|
+
Please find:
|
|
113
|
+
1. Relevant spec files in .trellis/structure/
|
|
114
|
+
2. Existing code patterns to follow (find 2-3 examples)
|
|
115
|
+
3. Files that will likely need modification
|
|
85
116
|
|
|
86
|
-
Output
|
|
87
|
-
##
|
|
88
|
-
- path
|
|
117
|
+
Output:
|
|
118
|
+
## Relevant Specs
|
|
119
|
+
- <path>: <why it's relevant>
|
|
89
120
|
|
|
90
|
-
##
|
|
91
|
-
-
|
|
121
|
+
## Code Patterns Found
|
|
122
|
+
- <pattern>: <example file path>
|
|
92
123
|
|
|
93
|
-
##
|
|
94
|
-
- path
|
|
124
|
+
## Files to Modify
|
|
125
|
+
- <path>: <what change>
|
|
126
|
+
|
|
127
|
+
## Suggested Feature Name
|
|
128
|
+
- <short-slug-name>",
|
|
95
129
|
model: "opus"
|
|
96
130
|
)
|
|
97
131
|
```
|
|
98
132
|
|
|
99
|
-
|
|
133
|
+
### Step 3: Create Feature Directory `[AI]`
|
|
134
|
+
|
|
135
|
+
Based on research results:
|
|
100
136
|
|
|
101
137
|
```bash
|
|
102
|
-
./.trellis/scripts/feature.sh
|
|
103
|
-
|
|
104
|
-
|
|
138
|
+
FEATURE_DIR=$(./.trellis/scripts/feature.sh create "<title from research>" --slug <suggested-slug>)
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Step 4: Configure Context `[AI]`
|
|
142
|
+
|
|
143
|
+
Initialize default context:
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
./.trellis/scripts/feature.sh init-context "$FEATURE_DIR" <type>
|
|
147
|
+
# type: backend | frontend | fullstack
|
|
105
148
|
```
|
|
106
149
|
|
|
107
|
-
|
|
150
|
+
Add specs found by Research Agent:
|
|
151
|
+
|
|
108
152
|
```bash
|
|
109
|
-
|
|
153
|
+
# For each relevant spec and code pattern:
|
|
154
|
+
./.trellis/scripts/feature.sh add-context "$FEATURE_DIR" implement "<path>" "<reason>"
|
|
155
|
+
./.trellis/scripts/feature.sh add-context "$FEATURE_DIR" check "<path>" "<reason>"
|
|
110
156
|
```
|
|
111
157
|
|
|
112
|
-
|
|
158
|
+
### Step 5: Write Requirements `[AI]`
|
|
159
|
+
|
|
160
|
+
Create `prd.md` in the feature directory with:
|
|
113
161
|
|
|
114
|
-
|
|
162
|
+
```markdown
|
|
163
|
+
# <Feature Title>
|
|
115
164
|
|
|
116
|
-
|
|
165
|
+
## Goal
|
|
166
|
+
<What we're trying to achieve>
|
|
167
|
+
|
|
168
|
+
## Requirements
|
|
169
|
+
- <Requirement 1>
|
|
170
|
+
- <Requirement 2>
|
|
171
|
+
|
|
172
|
+
## Acceptance Criteria
|
|
173
|
+
- [ ] <Criterion 1>
|
|
174
|
+
- [ ] <Criterion 2>
|
|
175
|
+
|
|
176
|
+
## Technical Notes
|
|
177
|
+
<Any technical decisions or constraints>
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### Step 6: Activate Feature `[AI]`
|
|
117
181
|
|
|
118
182
|
```bash
|
|
119
183
|
./.trellis/scripts/feature.sh start "$FEATURE_DIR"
|
|
120
184
|
```
|
|
121
185
|
|
|
122
|
-
|
|
186
|
+
This sets `.current-feature` so hooks can inject context.
|
|
187
|
+
|
|
188
|
+
### Step 7: Implement `[AI]`
|
|
189
|
+
|
|
190
|
+
Call Implement Agent (specs are auto-injected by hook):
|
|
123
191
|
|
|
124
192
|
```
|
|
125
|
-
Task(
|
|
193
|
+
Task(
|
|
194
|
+
subagent_type: "implement",
|
|
195
|
+
prompt: "Implement the feature described in prd.md.
|
|
196
|
+
|
|
197
|
+
Follow all specs that have been injected into your context.
|
|
198
|
+
Run lint and typecheck before finishing.",
|
|
199
|
+
model: "opus"
|
|
200
|
+
)
|
|
126
201
|
```
|
|
127
202
|
|
|
128
|
-
Check
|
|
203
|
+
### Step 8: Check Quality `[AI]`
|
|
204
|
+
|
|
205
|
+
Call Check Agent (specs are auto-injected by hook):
|
|
129
206
|
|
|
130
207
|
```
|
|
131
|
-
Task(
|
|
208
|
+
Task(
|
|
209
|
+
subagent_type: "check",
|
|
210
|
+
prompt: "Review all code changes against the specs.
|
|
211
|
+
|
|
212
|
+
Fix any issues you find directly.
|
|
213
|
+
Ensure lint and typecheck pass.",
|
|
214
|
+
model: "opus"
|
|
215
|
+
)
|
|
132
216
|
```
|
|
133
217
|
|
|
134
|
-
|
|
218
|
+
### Step 9: Complete `[AI]`
|
|
135
219
|
|
|
136
|
-
1. Verify
|
|
137
|
-
2.
|
|
138
|
-
3. Remind user to
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
./.trellis/scripts/feature.sh archive <feature-name>
|
|
143
|
-
```
|
|
220
|
+
1. Verify lint and typecheck pass
|
|
221
|
+
2. Report what was implemented
|
|
222
|
+
3. Remind user to:
|
|
223
|
+
- Test the changes
|
|
224
|
+
- Commit when ready
|
|
225
|
+
- Run `/record-agent-flow` to record this session
|
|
144
226
|
|
|
145
227
|
---
|
|
146
228
|
|
|
147
|
-
##
|
|
229
|
+
## Continuing Existing Feature
|
|
148
230
|
|
|
149
|
-
|
|
231
|
+
If `get-context.sh` shows a current feature:
|
|
150
232
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
| `/parallel` | Start Multi-Agent Pipeline (worktree mode) |
|
|
155
|
-
| `/finish-work` | Pre-completion checklist |
|
|
156
|
-
| `/record-agent-flow` | Record session progress |
|
|
157
|
-
| `/check-frontend` | Check frontend code |
|
|
158
|
-
| `/check-backend` | Check backend code |
|
|
233
|
+
1. Read the feature's `prd.md` to understand the goal
|
|
234
|
+
2. Check `feature.json` for current status and phase
|
|
235
|
+
3. Ask user: "Continue working on <feature-name>?"
|
|
159
236
|
|
|
160
|
-
|
|
237
|
+
If yes, resume from the appropriate step (usually Step 7 or 8).
|
|
161
238
|
|
|
162
|
-
|
|
239
|
+
---
|
|
163
240
|
|
|
164
|
-
|
|
241
|
+
## Commands Reference
|
|
165
242
|
|
|
166
|
-
|
|
243
|
+
### User Commands `[USER]`
|
|
167
244
|
|
|
168
|
-
|
|
245
|
+
| Command | When to Use |
|
|
246
|
+
|---------|-------------|
|
|
247
|
+
| `/start` | Begin a session (this command) |
|
|
248
|
+
| `/parallel` | Complex features needing isolated worktree |
|
|
249
|
+
| `/finish-work` | Before committing changes |
|
|
250
|
+
| `/record-agent-flow` | After completing a task |
|
|
169
251
|
|
|
170
|
-
|
|
252
|
+
### AI Scripts `[AI]`
|
|
171
253
|
|
|
172
254
|
| Script | Purpose |
|
|
173
255
|
|--------|---------|
|
|
174
|
-
| `feature.sh create <title> --assignee <dev> [--priority P0\|P1\|P2\|P3] [--slug <slug>]` | Create backlog + feature |
|
|
175
|
-
| `feature.sh init-context <dir> <type>` | Initialize jsonl files |
|
|
176
|
-
| `feature.sh add-context <dir> <jsonl> <path>` | Add specs |
|
|
177
|
-
| `feature.sh start <dir>` | Set current feature |
|
|
178
|
-
| `feature.sh finish` | Clear current feature |
|
|
179
|
-
| `feature.sh archive <name>` | Archive feature (also deletes linked backlog) |
|
|
180
|
-
| `feature.sh list` | List active features |
|
|
181
256
|
| `get-context.sh` | Get session context |
|
|
257
|
+
| `feature.sh create` | Create feature directory |
|
|
258
|
+
| `feature.sh init-context` | Initialize jsonl files |
|
|
259
|
+
| `feature.sh add-context` | Add spec to jsonl |
|
|
260
|
+
| `feature.sh start` | Set current feature |
|
|
261
|
+
| `feature.sh finish` | Clear current feature |
|
|
262
|
+
| `feature.sh archive` | Archive completed feature |
|
|
182
263
|
|
|
183
|
-
|
|
264
|
+
### Sub Agents `[AI]`
|
|
265
|
+
|
|
266
|
+
| Agent | Purpose | Hook Injection |
|
|
267
|
+
|-------|---------|----------------|
|
|
268
|
+
| research | Analyze codebase | No (reads directly) |
|
|
269
|
+
| implement | Write code | Yes (implement.jsonl) |
|
|
270
|
+
| check | Review & fix | Yes (check.jsonl) |
|
|
271
|
+
| debug | Fix specific issues | Yes (debug.jsonl) |
|
|
272
|
+
|
|
273
|
+
---
|
|
184
274
|
|
|
185
|
-
|
|
275
|
+
## Key Principle
|
|
186
276
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
| check | Check code |
|
|
192
|
-
| debug | Fix issues |
|
|
277
|
+
> **Specs are injected, not remembered.**
|
|
278
|
+
>
|
|
279
|
+
> The Feature Workflow ensures agents receive relevant specs automatically.
|
|
280
|
+
> This is more reliable than hoping the AI "remembers" conventions.
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Session Start Hook - Inject structured context
|
|
4
|
+
|
|
5
|
+
Matcher: "startup" - only runs on normal startup (not resume/clear/compact)
|
|
6
|
+
|
|
7
|
+
This hook injects:
|
|
8
|
+
1. Current state (git status, current feature, backlog)
|
|
9
|
+
2. Workflow guide
|
|
10
|
+
3. Guidelines index (frontend/backend/guides)
|
|
11
|
+
4. Session instructions (start.md)
|
|
12
|
+
5. Action directive
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
import os
|
|
16
|
+
import subprocess
|
|
17
|
+
import sys
|
|
18
|
+
from pathlib import Path
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def should_skip_injection() -> bool:
|
|
22
|
+
"""
|
|
23
|
+
Determine if context injection should be skipped.
|
|
24
|
+
|
|
25
|
+
Multi-agent scripts (start.sh, plan.sh) set CLAUDE_NON_INTERACTIVE=1
|
|
26
|
+
to prevent duplicate context injection.
|
|
27
|
+
"""
|
|
28
|
+
return os.environ.get("CLAUDE_NON_INTERACTIVE") == "1"
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def read_file(path: Path, fallback: str = "") -> str:
|
|
32
|
+
"""Read file content, return fallback if not found."""
|
|
33
|
+
try:
|
|
34
|
+
return path.read_text(encoding="utf-8")
|
|
35
|
+
except (FileNotFoundError, PermissionError):
|
|
36
|
+
return fallback
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def run_script(script_path: Path) -> str:
|
|
40
|
+
"""Run a script and return its output."""
|
|
41
|
+
try:
|
|
42
|
+
result = subprocess.run(
|
|
43
|
+
[str(script_path)],
|
|
44
|
+
capture_output=True,
|
|
45
|
+
text=True,
|
|
46
|
+
timeout=5,
|
|
47
|
+
cwd=script_path.parent.parent.parent, # repo root
|
|
48
|
+
)
|
|
49
|
+
return result.stdout if result.returncode == 0 else "No context available"
|
|
50
|
+
except (subprocess.TimeoutExpired, FileNotFoundError, PermissionError):
|
|
51
|
+
return "No context available"
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def main():
|
|
55
|
+
# Skip injection in non-interactive mode (multi-agent scripts set CLAUDE_NON_INTERACTIVE=1)
|
|
56
|
+
if should_skip_injection():
|
|
57
|
+
sys.exit(0)
|
|
58
|
+
|
|
59
|
+
project_dir = Path(os.environ.get("CLAUDE_PROJECT_DIR", ".")).resolve()
|
|
60
|
+
trellis_dir = project_dir / ".trellis"
|
|
61
|
+
claude_dir = project_dir / ".claude"
|
|
62
|
+
|
|
63
|
+
# 1. Header
|
|
64
|
+
print("""<session-context>
|
|
65
|
+
You are starting a new session in a Trellis-managed project.
|
|
66
|
+
Read and follow all instructions below carefully.
|
|
67
|
+
</session-context>
|
|
68
|
+
""")
|
|
69
|
+
|
|
70
|
+
# 2. Current Context (dynamic)
|
|
71
|
+
print("<current-state>")
|
|
72
|
+
context_script = trellis_dir / "scripts" / "get-context.sh"
|
|
73
|
+
print(run_script(context_script))
|
|
74
|
+
print("</current-state>")
|
|
75
|
+
print()
|
|
76
|
+
|
|
77
|
+
# 3. Workflow Guide
|
|
78
|
+
print("<workflow>")
|
|
79
|
+
workflow_content = read_file(trellis_dir / "workflow.md", "No workflow.md found")
|
|
80
|
+
print(workflow_content)
|
|
81
|
+
print("</workflow>")
|
|
82
|
+
print()
|
|
83
|
+
|
|
84
|
+
# 4. Guidelines Index
|
|
85
|
+
print("<guidelines>")
|
|
86
|
+
|
|
87
|
+
print("## Frontend")
|
|
88
|
+
frontend_index = read_file(
|
|
89
|
+
trellis_dir / "structure" / "frontend" / "index.md", "Not configured"
|
|
90
|
+
)
|
|
91
|
+
print(frontend_index)
|
|
92
|
+
print()
|
|
93
|
+
|
|
94
|
+
print("## Backend")
|
|
95
|
+
backend_index = read_file(
|
|
96
|
+
trellis_dir / "structure" / "backend" / "index.md", "Not configured"
|
|
97
|
+
)
|
|
98
|
+
print(backend_index)
|
|
99
|
+
print()
|
|
100
|
+
|
|
101
|
+
print("## Guides")
|
|
102
|
+
guides_index = read_file(
|
|
103
|
+
trellis_dir / "structure" / "guides" / "index.md", "Not configured"
|
|
104
|
+
)
|
|
105
|
+
print(guides_index)
|
|
106
|
+
|
|
107
|
+
print("</guidelines>")
|
|
108
|
+
print()
|
|
109
|
+
|
|
110
|
+
# 5. Session Instructions
|
|
111
|
+
print("<instructions>")
|
|
112
|
+
start_md = read_file(claude_dir / "commands" / "start.md", "No start.md found")
|
|
113
|
+
print(start_md)
|
|
114
|
+
print("</instructions>")
|
|
115
|
+
print()
|
|
116
|
+
|
|
117
|
+
# 6. Final directive
|
|
118
|
+
print("""<ready>
|
|
119
|
+
Context loaded. Wait for user's first message, then follow <instructions> to handle their request.
|
|
120
|
+
</ready>""")
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
if __name__ == "__main__":
|
|
124
|
+
main()
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"hooks": {
|
|
3
|
+
"SessionStart": [
|
|
4
|
+
{
|
|
5
|
+
"matcher": "startup",
|
|
6
|
+
"hooks": [
|
|
7
|
+
{
|
|
8
|
+
"type": "command",
|
|
9
|
+
"command": "python3 \"$CLAUDE_PROJECT_DIR/.claude/hooks/session-start.py\"",
|
|
10
|
+
"timeout": 10
|
|
11
|
+
}
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
],
|
|
3
15
|
"PreToolUse": [
|
|
4
16
|
{
|
|
5
17
|
"matcher": "Task",
|
|
@@ -24,5 +36,6 @@
|
|
|
24
36
|
]
|
|
25
37
|
}
|
|
26
38
|
]
|
|
27
|
-
}
|
|
39
|
+
},
|
|
40
|
+
"enabledPlugins": {}
|
|
28
41
|
}
|
|
@@ -863,7 +863,7 @@ cmd_create_pr() {
|
|
|
863
863
|
git add -A
|
|
864
864
|
# Exclude agent traces and temp files
|
|
865
865
|
git reset "$DIR_WORKFLOW/$DIR_PROGRESS/" 2>/dev/null || true
|
|
866
|
-
git reset .agent-log .agent-
|
|
866
|
+
git reset .agent-log .agent-runner.sh 2>/dev/null || true
|
|
867
867
|
|
|
868
868
|
# Check if there are staged changes
|
|
869
869
|
if git diff --cached --quiet 2>/dev/null; then
|
|
@@ -130,7 +130,7 @@ git add -A
|
|
|
130
130
|
|
|
131
131
|
# Exclude agent traces and temp files
|
|
132
132
|
git reset ".trellis/agent-traces/" 2>/dev/null || true
|
|
133
|
-
git reset .agent-log .agent-
|
|
133
|
+
git reset .agent-log .agent-runner.sh 2>/dev/null || true
|
|
134
134
|
|
|
135
135
|
# Check if there are staged changes
|
|
136
136
|
if git diff --cached --quiet 2>/dev/null; then
|
|
@@ -148,16 +148,6 @@ log_success "Feature directory: ${FEATURE_DIR}"
|
|
|
148
148
|
# =============================================================================
|
|
149
149
|
log_info "Step 2: Starting Plan Agent in background..."
|
|
150
150
|
|
|
151
|
-
# Extract plan.md content (skip frontmatter)
|
|
152
|
-
PLAN_PROMPT=$(awk '
|
|
153
|
-
BEGIN { in_frontmatter = 0; started = 0 }
|
|
154
|
-
/^---$/ {
|
|
155
|
-
if (!started) { in_frontmatter = 1; started = 1; next }
|
|
156
|
-
else if (in_frontmatter) { in_frontmatter = 0; next }
|
|
157
|
-
}
|
|
158
|
-
!in_frontmatter { print }
|
|
159
|
-
' "$PLAN_MD")
|
|
160
|
-
|
|
161
151
|
LOG_FILE="${FEATURE_DIR_ABS}/.plan-log"
|
|
162
152
|
touch "$LOG_FILE"
|
|
163
153
|
|
|
@@ -175,26 +165,10 @@ export PLAN_REQUIREMENT="${REQUIREMENT}"
|
|
|
175
165
|
export https_proxy="\${AGENT_HTTPS_PROXY:-}"
|
|
176
166
|
export http_proxy="\${AGENT_HTTP_PROXY:-}"
|
|
177
167
|
export all_proxy="\${AGENT_ALL_PROXY:-}"
|
|
168
|
+
export CLAUDE_NON_INTERACTIVE=1
|
|
178
169
|
|
|
179
|
-
#
|
|
180
|
-
claude -p --dangerously-skip-permissions --output-format stream-json --verbose
|
|
181
|
-
# Environment Variables
|
|
182
|
-
|
|
183
|
-
The following environment variables are set for this planning session:
|
|
184
|
-
|
|
185
|
-
\`\`\`
|
|
186
|
-
PLAN_FEATURE_NAME=${FEATURE_NAME}
|
|
187
|
-
PLAN_DEV_TYPE=${DEV_TYPE}
|
|
188
|
-
PLAN_FEATURE_DIR=${FEATURE_DIR}
|
|
189
|
-
PLAN_REQUIREMENT=${REQUIREMENT}
|
|
190
|
-
\`\`\`
|
|
191
|
-
|
|
192
|
-
You can read these directly from the environment or use the values above.
|
|
193
|
-
|
|
194
|
-
---
|
|
195
|
-
|
|
196
|
-
${PLAN_PROMPT}
|
|
197
|
-
PROMPT_EOF
|
|
170
|
+
# Use --agent flag to load plan agent directly
|
|
171
|
+
claude -p --agent plan --dangerously-skip-permissions --output-format stream-json --verbose "Start planning for feature: ${FEATURE_NAME}"
|
|
198
172
|
|
|
199
173
|
# Self-delete the runner script
|
|
200
174
|
rm -f "\$0"
|
|
@@ -236,16 +236,6 @@ log_success "Current feature set: ${FEATURE_DIR_RELATIVE}"
|
|
|
236
236
|
# =============================================================================
|
|
237
237
|
log_info "Step 3: Starting Claude agent..."
|
|
238
238
|
|
|
239
|
-
# Extract dispatch.md content (skip frontmatter)
|
|
240
|
-
DISPATCH_PROMPT=$(awk '
|
|
241
|
-
BEGIN { in_frontmatter = 0; started = 0 }
|
|
242
|
-
/^---$/ {
|
|
243
|
-
if (!started) { in_frontmatter = 1; started = 1; next }
|
|
244
|
-
else if (in_frontmatter) { in_frontmatter = 0; next }
|
|
245
|
-
}
|
|
246
|
-
!in_frontmatter { print }
|
|
247
|
-
' "$DISPATCH_MD")
|
|
248
|
-
|
|
249
239
|
# Update feature status
|
|
250
240
|
jq '.status = "in_progress"' "$FEATURE_JSON" > "${FEATURE_JSON}.tmp"
|
|
251
241
|
mv "${FEATURE_JSON}.tmp" "$FEATURE_JSON"
|
|
@@ -253,21 +243,20 @@ mv "${FEATURE_JSON}.tmp" "$FEATURE_JSON"
|
|
|
253
243
|
cd "$WORKTREE_PATH"
|
|
254
244
|
|
|
255
245
|
LOG_FILE="${WORKTREE_PATH}/.agent-log"
|
|
256
|
-
PROMPT_FILE="${WORKTREE_PATH}/.agent-prompt"
|
|
257
246
|
RUNNER_SCRIPT="${WORKTREE_PATH}/.agent-runner.sh"
|
|
258
247
|
|
|
259
248
|
touch "$LOG_FILE"
|
|
260
|
-
echo "$DISPATCH_PROMPT" > "$PROMPT_FILE"
|
|
261
249
|
|
|
262
|
-
# Create runner script
|
|
250
|
+
# Create runner script (uses --agent flag to load dispatch agent directly)
|
|
263
251
|
cat > "$RUNNER_SCRIPT" << 'RUNNER_EOF'
|
|
264
252
|
#!/bin/bash
|
|
265
253
|
cd "$(dirname "$0")"
|
|
266
254
|
export https_proxy="${AGENT_HTTPS_PROXY:-}"
|
|
267
255
|
export http_proxy="${AGENT_HTTP_PROXY:-}"
|
|
268
256
|
export all_proxy="${AGENT_ALL_PROXY:-}"
|
|
257
|
+
export CLAUDE_NON_INTERACTIVE=1
|
|
269
258
|
|
|
270
|
-
claude -p --dangerously-skip-permissions --output-format stream-json --verbose
|
|
259
|
+
claude -p --agent dispatch --dangerously-skip-permissions --output-format stream-json --verbose "Start the pipeline"
|
|
271
260
|
RUNNER_EOF
|
|
272
261
|
chmod +x "$RUNNER_SCRIPT"
|
|
273
262
|
|
package/package.json
CHANGED