panopticon-cli 0.5.8 → 0.5.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.
- package/README.md +29 -83
- package/dist/{agents-I6RAEGL5.js → agents-MOMDECON.js} +8 -6
- package/dist/{archive-planning-U3AZAKWI.js → archive-planning-54J6EP6A.js} +3 -3
- package/dist/{chunk-UKSGE6RH.js → chunk-3KYTNMSE.js} +1 -2
- package/dist/{chunk-UKSGE6RH.js.map → chunk-3KYTNMSE.js.map} +1 -1
- package/dist/{chunk-M6ZVVKZ3.js → chunk-4OQ4SXQZ.js} +219 -107
- package/dist/chunk-4OQ4SXQZ.js.map +1 -0
- package/dist/{chunk-ZMJFEHGF.js → chunk-7ZB5D46Y.js} +2 -2
- package/dist/{chunk-ZMJFEHGF.js.map → chunk-7ZB5D46Y.js.map} +1 -1
- package/dist/{chunk-BYWVPPAZ.js → chunk-BHRMW7BY.js} +31 -4
- package/dist/chunk-BHRMW7BY.js.map +1 -0
- package/dist/{chunk-WEQW3EAT.js → chunk-F4XS2FQN.js} +3 -2
- package/dist/chunk-F4XS2FQN.js.map +1 -0
- package/dist/{chunk-OJF4QS3S.js → chunk-GIW2TUWI.js} +2 -2
- package/dist/{chunk-SUM2WVPF.js → chunk-H7T35QDO.js} +30 -12
- package/dist/chunk-H7T35QDO.js.map +1 -0
- package/dist/{chunk-MJXYTGK5.js → chunk-JZWCL5S5.js} +2 -2
- package/dist/{chunk-ZN5RHWGR.js → chunk-PFA5XE2V.js} +5 -41
- package/dist/chunk-PFA5XE2V.js.map +1 -0
- package/dist/{chunk-6OYUJ4AJ.js → chunk-R47UJWF6.js} +2 -2
- package/dist/{chunk-NYOGHGIW.js → chunk-RCYJK3ZC.js} +10 -9
- package/dist/chunk-RCYJK3ZC.js.map +1 -0
- package/dist/{chunk-R4KPLLRB.js → chunk-SFX3BG6N.js} +1 -1
- package/dist/chunk-SFX3BG6N.js.map +1 -0
- package/dist/{chunk-IZIXJYXZ.js → chunk-TA5X4QYQ.js} +6 -2
- package/dist/{chunk-IZIXJYXZ.js.map → chunk-TA5X4QYQ.js.map} +1 -1
- package/dist/{chunk-43F4LDZ4.js → chunk-VVTAPQOI.js} +2 -2
- package/dist/{chunk-YAAT66RT.js → chunk-WP6ZLWU3.js} +28 -3
- package/dist/chunk-WP6ZLWU3.js.map +1 -0
- package/dist/clean-planning-V4SSVU26.js +9 -0
- package/dist/cli/index.js +1654 -1056
- package/dist/cli/index.js.map +1 -1
- package/dist/close-issue-5OMOP2FU.js +9 -0
- package/dist/compact-beads-YQDVF6FQ.js +9 -0
- package/dist/dashboard/prompts/inspect-agent.md +157 -0
- package/dist/dashboard/prompts/merge-agent.md +11 -0
- package/dist/dashboard/prompts/review-agent.md +9 -0
- package/dist/dashboard/prompts/test-agent.md +9 -0
- package/dist/dashboard/prompts/uat-agent.md +215 -0
- package/dist/dashboard/prompts/work-agent.md +53 -5
- package/dist/dashboard/public/assets/index-5hYjhhGn.js +826 -0
- package/dist/dashboard/public/assets/index-DIFh3T1V.css +32 -0
- package/dist/dashboard/public/index.html +3 -6
- package/dist/dashboard/server.js +3338 -2033
- package/dist/factory-KKT7324R.js +20 -0
- package/dist/{feedback-writer-T2WCT6EZ.js → feedback-writer-IPPIUPDX.js} +2 -2
- package/dist/feedback-writer-IPPIUPDX.js.map +1 -0
- package/dist/index.d.ts +8 -3
- package/dist/index.js +19 -19
- package/dist/{label-cleanup-4HJVX6NP.js → label-cleanup-4IVZIPGK.js} +2 -2
- package/dist/{merge-agent-ZITLVF2B.js → merge-agent-6YOMGQMX.js} +16 -16
- package/dist/{projects-3CRF57ZU.js → projects-BPGM6IFB.js} +2 -2
- package/dist/{remote-workspace-M4IULGFZ.js → remote-workspace-LKRDGYEB.js} +2 -2
- package/dist/{review-status-J2YJGL3E.js → review-status-E77PZZWG.js} +2 -2
- package/dist/{specialist-context-W25PPWM4.js → specialist-context-GVF4DV3M.js} +5 -5
- package/dist/{specialist-logs-KPC45SZN.js → specialist-logs-W47SAAIU.js} +5 -5
- package/dist/{specialists-H4LGYR7R.js → specialists-SIXRWCZ3.js} +5 -5
- package/dist/{traefik-QXLZ4PO2.js → traefik-X2IWTUHO.js} +3 -3
- package/dist/{workspace-manager-G6TTBPC3.js → workspace-manager-Z57ROWBQ.js} +2 -2
- package/dist/workspace-manager-Z57ROWBQ.js.map +1 -0
- package/package.json +1 -1
- package/scripts/inspect-on-bead-close +73 -0
- package/scripts/stop-hook +17 -0
- package/skills/pan-new-project/SKILL.md +1 -1
- package/skills/pan-oversee/SKILL.md +45 -10
- package/skills/plan/SKILL.md +336 -0
- package/dist/chunk-BYWVPPAZ.js.map +0 -1
- package/dist/chunk-M6ZVVKZ3.js.map +0 -1
- package/dist/chunk-NYOGHGIW.js.map +0 -1
- package/dist/chunk-R4KPLLRB.js.map +0 -1
- package/dist/chunk-SUM2WVPF.js.map +0 -1
- package/dist/chunk-WEQW3EAT.js.map +0 -1
- package/dist/chunk-YAAT66RT.js.map +0 -1
- package/dist/chunk-ZN5RHWGR.js.map +0 -1
- package/dist/clean-planning-7Z5YY64X.js +0 -9
- package/dist/close-issue-CTZK777I.js +0 -9
- package/dist/compact-beads-72SHALOL.js +0 -9
- package/dist/dashboard/public/assets/index-Bx4NCn9A.css +0 -32
- package/dist/dashboard/public/assets/index-C7hJ5-o1.js +0 -756
- package/dist/feedback-writer-T2WCT6EZ.js.map +0 -1
- package/skills/opus-plan/SKILL.md +0 -400
- /package/dist/{agents-I6RAEGL5.js.map → agents-MOMDECON.js.map} +0 -0
- /package/dist/{archive-planning-U3AZAKWI.js.map → archive-planning-54J6EP6A.js.map} +0 -0
- /package/dist/{chunk-OJF4QS3S.js.map → chunk-GIW2TUWI.js.map} +0 -0
- /package/dist/{chunk-MJXYTGK5.js.map → chunk-JZWCL5S5.js.map} +0 -0
- /package/dist/{chunk-6OYUJ4AJ.js.map → chunk-R47UJWF6.js.map} +0 -0
- /package/dist/{chunk-43F4LDZ4.js.map → chunk-VVTAPQOI.js.map} +0 -0
- /package/dist/{clean-planning-7Z5YY64X.js.map → clean-planning-V4SSVU26.js.map} +0 -0
- /package/dist/{close-issue-CTZK777I.js.map → close-issue-5OMOP2FU.js.map} +0 -0
- /package/dist/{compact-beads-72SHALOL.js.map → compact-beads-YQDVF6FQ.js.map} +0 -0
- /package/dist/{projects-3CRF57ZU.js.map → factory-KKT7324R.js.map} +0 -0
- /package/dist/{label-cleanup-4HJVX6NP.js.map → label-cleanup-4IVZIPGK.js.map} +0 -0
- /package/dist/{merge-agent-ZITLVF2B.js.map → merge-agent-6YOMGQMX.js.map} +0 -0
- /package/dist/{review-status-J2YJGL3E.js.map → projects-BPGM6IFB.js.map} +0 -0
- /package/dist/{remote-workspace-M4IULGFZ.js.map → remote-workspace-LKRDGYEB.js.map} +0 -0
- /package/dist/{specialist-logs-KPC45SZN.js.map → review-status-E77PZZWG.js.map} +0 -0
- /package/dist/{specialist-context-W25PPWM4.js.map → specialist-context-GVF4DV3M.js.map} +0 -0
- /package/dist/{specialists-H4LGYR7R.js.map → specialist-logs-W47SAAIU.js.map} +0 -0
- /package/dist/{traefik-QXLZ4PO2.js.map → specialists-SIXRWCZ3.js.map} +0 -0
- /package/dist/{workspace-manager-G6TTBPC3.js.map → traefik-X2IWTUHO.js.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: pan-oversee
|
|
3
|
-
description:
|
|
3
|
+
description: Test the Panopticon framework by supervising an agent through the full lifecycle, identifying and filing every bug encountered
|
|
4
4
|
triggers:
|
|
5
5
|
- oversee issue
|
|
6
6
|
- oversee agent
|
|
@@ -17,15 +17,35 @@ allowed-tools:
|
|
|
17
17
|
- Task
|
|
18
18
|
---
|
|
19
19
|
|
|
20
|
-
# Pan Oversee —
|
|
20
|
+
# Pan Oversee — Panopticon Framework Testing
|
|
21
21
|
|
|
22
22
|
## Purpose
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
**This skill exists to test the Panopticon framework itself.** The issue being overseen is a test payload — the real goal is exercising the full agent lifecycle pipeline and identifying every bug, glitch, and rough edge along the way.
|
|
25
|
+
|
|
26
|
+
Supervise an agent working on an issue through the **entire lifecycle**:
|
|
25
27
|
`spawn/resume → work → completion → review → feedback loop → test → merge-ready`
|
|
26
28
|
|
|
27
|
-
This is NOT passive monitoring
|
|
28
|
-
|
|
29
|
+
This is NOT passive monitoring. You are actively:
|
|
30
|
+
- **Watching for bugs at every stage** — dashboard rendering, agent spawning, workspace creation, beads lifecycle, specialist handoffs, status transitions, terminal output, API responses
|
|
31
|
+
- **Documenting everything** — no bug is too small. If something flickers, logs a warning, shows stale data, or doesn't match expected state, that's a finding
|
|
32
|
+
- **Fixing infrastructure bugs** when they block progress, then continuing the test
|
|
33
|
+
- **Filing or updating GitHub issues** (PAN-XXX) for every bug found
|
|
34
|
+
|
|
35
|
+
## Bug Tracking During Oversight
|
|
36
|
+
|
|
37
|
+
Maintain a running bug log throughout the session. For each finding:
|
|
38
|
+
|
|
39
|
+
1. **Note it immediately** — don't wait until the end. Capture the symptom, what you expected, and what actually happened.
|
|
40
|
+
2. **Check for existing issues** — `gh issue list --search "keyword"` before filing duplicates
|
|
41
|
+
3. **File new issues or update existing ones** — include reproduction context from this oversight run
|
|
42
|
+
4. **Categorize severity:**
|
|
43
|
+
- **Blocker** — stops the pipeline, had to fix inline to continue
|
|
44
|
+
- **Bug** — incorrect behavior but pipeline continued
|
|
45
|
+
- **Cosmetic** — dashboard display issue, misleading status, stale data
|
|
46
|
+
- **Observation** — not clearly a bug but worth investigating
|
|
47
|
+
|
|
48
|
+
At the end of the oversight session, **report a summary** to the user of all findings: what was filed, what was updated, what was fixed inline, and what needs follow-up.
|
|
29
49
|
|
|
30
50
|
## Usage
|
|
31
51
|
|
|
@@ -306,13 +326,28 @@ pan work approve PAN-{ID}
|
|
|
306
326
|
|
|
307
327
|
When you find a bug in the Panopticon infrastructure:
|
|
308
328
|
|
|
309
|
-
1. **
|
|
310
|
-
2. **
|
|
311
|
-
3. **
|
|
312
|
-
4. **
|
|
313
|
-
|
|
329
|
+
1. **Log the finding** — add to your running bug list with symptom, expected behavior, and actual behavior
|
|
330
|
+
2. **Check for existing issues** — `gh issue list --state open --search "keyword"` to avoid duplicates
|
|
331
|
+
3. **File or update a GitHub issue** — include context from this oversight run
|
|
332
|
+
4. **Assess: blocker or not?**
|
|
333
|
+
- **If blocker:** Stop the agent, fix the code, rebuild (`npx tsup` or restart dashboard), resume the agent, continue testing
|
|
334
|
+
- **If not blocker:** Log it, file the issue, keep going — don't derail the test run for non-blocking bugs
|
|
335
|
+
5. **After fixing a blocker**, verify the fix actually works by continuing through the same pipeline stage
|
|
314
336
|
6. **Continue monitoring** from the current phase
|
|
315
337
|
|
|
338
|
+
### What Counts as a Bug
|
|
339
|
+
|
|
340
|
+
Be thorough. All of these are findings worth logging:
|
|
341
|
+
- Dashboard shows wrong status, stale data, or flickers
|
|
342
|
+
- Agent state file says one thing, dashboard shows another
|
|
343
|
+
- Beads not created, duplicated, or disappearing
|
|
344
|
+
- Specialist doesn't wake up or takes too long
|
|
345
|
+
- Terminal output garbled or missing
|
|
346
|
+
- API returns unexpected response
|
|
347
|
+
- Status transition skipped or out of order
|
|
348
|
+
- Workspace in inconsistent state (e.g., directory exists but no git worktree)
|
|
349
|
+
- Any error in server logs, even if the pipeline recovers
|
|
350
|
+
|
|
316
351
|
## Key API Endpoints
|
|
317
352
|
|
|
318
353
|
| Endpoint | Method | Purpose |
|
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: plan
|
|
3
|
+
description: >
|
|
4
|
+
Opus-driven planning for issues before Sonnet implementation. Creates workspace,
|
|
5
|
+
STATE.md, plan.vbrief.json with beads, and updates issue tracker. Ensures
|
|
6
|
+
strategic decisions are made by Opus, not cheaper models.
|
|
7
|
+
triggers:
|
|
8
|
+
- plan
|
|
9
|
+
- /plan
|
|
10
|
+
- create plan
|
|
11
|
+
allowed-tools:
|
|
12
|
+
- Read
|
|
13
|
+
- Write
|
|
14
|
+
- Bash
|
|
15
|
+
- Task
|
|
16
|
+
- Grep
|
|
17
|
+
- Glob
|
|
18
|
+
- ToolSearch
|
|
19
|
+
version: "2.0.0"
|
|
20
|
+
author: "Ed Becker"
|
|
21
|
+
license: "MIT"
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
# Plan Skill
|
|
25
|
+
|
|
26
|
+
**Trigger:** `/plan <issue-id>`
|
|
27
|
+
|
|
28
|
+
**CRITICAL:** This skill MUST be run by Opus. The entire point is that Opus does ALL the thinking so Sonnet just executes. If you are Sonnet or Haiku, STOP and tell the user to switch to Opus.
|
|
29
|
+
|
|
30
|
+
## Core Principle
|
|
31
|
+
|
|
32
|
+
**Opus plans EVERYTHING. Sonnet executes.**
|
|
33
|
+
|
|
34
|
+
Do NOT leave any decisions for the implementation agent. Every architectural choice, every file path, every function name, every edge case - all decided here. The implementation agent should be able to work through beads mechanically without making any design decisions.
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## EXECUTION STEPS
|
|
39
|
+
|
|
40
|
+
### Step 1: Parse Issue ID and Create Workspace
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
# PAN-XXX -> /home/eltmon/projects/panopticon (GitHub)
|
|
44
|
+
# MIN-XXX -> /home/eltmon/projects/myn (Linear)
|
|
45
|
+
# HH-XXX -> /home/eltmon/projects/househunt (Linear)
|
|
46
|
+
# JH-XXX -> /home/eltmon/projects/jobhunt (Linear)
|
|
47
|
+
|
|
48
|
+
# CRITICAL: Create a proper git worktree with feature branch
|
|
49
|
+
# DO NOT use mkdir -p - that creates a directory without git tracking!
|
|
50
|
+
cd <project>
|
|
51
|
+
pan workspace <issue-id> # Creates workspaces/feature-<id>/ with feature branch
|
|
52
|
+
|
|
53
|
+
# Then create planning directory inside the workspace
|
|
54
|
+
mkdir -p workspaces/feature-<issue-id-lowercase>/.planning
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
**IMPORTANT:** The `pan workspace` command creates a git worktree on a feature branch.
|
|
58
|
+
This is REQUIRED so that work agents don't commit directly to main.
|
|
59
|
+
If `pan workspace` fails, fix the issue before continuing.
|
|
60
|
+
|
|
61
|
+
### Step 2: Fetch Issue Details
|
|
62
|
+
|
|
63
|
+
**GitHub (PAN-*):** `gh issue view <number>`
|
|
64
|
+
**Linear:** Use `mcp__linear__get_issue` tool
|
|
65
|
+
|
|
66
|
+
Read the FULL issue. Understand what's being asked.
|
|
67
|
+
|
|
68
|
+
### Step 3: Deep Discovery
|
|
69
|
+
|
|
70
|
+
**YOU MUST** thoroughly explore the codebase. Use `Task` tool with `subagent_type=Explore` or manually:
|
|
71
|
+
|
|
72
|
+
1. Find ALL related files:
|
|
73
|
+
- Where does the feature touch?
|
|
74
|
+
- What patterns exist?
|
|
75
|
+
- What tests exist?
|
|
76
|
+
|
|
77
|
+
2. Read key files completely:
|
|
78
|
+
- Don't skim - read line by line
|
|
79
|
+
- Understand the data flow
|
|
80
|
+
- Note function signatures
|
|
81
|
+
|
|
82
|
+
3. Identify:
|
|
83
|
+
- Files to create (new)
|
|
84
|
+
- Files to modify (existing)
|
|
85
|
+
- Files to delete (cleanup)
|
|
86
|
+
- Tests to write/update
|
|
87
|
+
|
|
88
|
+
### Step 4: Write STATE.md
|
|
89
|
+
|
|
90
|
+
Create `.planning/STATE.md` with COMPLETE planning context:
|
|
91
|
+
|
|
92
|
+
```markdown
|
|
93
|
+
# <issue-id>: <Title>
|
|
94
|
+
|
|
95
|
+
**Status:** Plan Approved
|
|
96
|
+
**Planned by:** Claude Opus 4.6
|
|
97
|
+
**Date:** <date>
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## Discovery Summary
|
|
102
|
+
<What you learned - specific file paths, patterns, gotchas>
|
|
103
|
+
|
|
104
|
+
## Key Architectural Decisions
|
|
105
|
+
|
|
106
|
+
### D1: <Topic>
|
|
107
|
+
**Decision:** <What we're doing>
|
|
108
|
+
**Rationale:** <Why this choice, not alternatives>
|
|
109
|
+
|
|
110
|
+
### D2: ...
|
|
111
|
+
|
|
112
|
+
## Architecture
|
|
113
|
+
|
|
114
|
+
### What's Being Changed
|
|
115
|
+
<Table of components, files, and what changes>
|
|
116
|
+
|
|
117
|
+
### Key Touch Points
|
|
118
|
+
<Specific file:line references for important changes>
|
|
119
|
+
|
|
120
|
+
## Service URLs (if applicable)
|
|
121
|
+
<If this issue involves services with URLs, list them here:>
|
|
122
|
+
Frontend: https://...
|
|
123
|
+
API: https://...
|
|
124
|
+
|
|
125
|
+
## Remaining Work
|
|
126
|
+
See plan.vbrief.json for the complete bead breakdown.
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Step 5: Produce plan.vbrief.json
|
|
130
|
+
|
|
131
|
+
Create `.planning/plan.vbrief.json` following the vBRIEF schema. This replaces the manual `bd create` loop — the Panopticon complete-planning pipeline reads this file and creates beads automatically.
|
|
132
|
+
|
|
133
|
+
```json
|
|
134
|
+
{
|
|
135
|
+
"vBRIEFInfo": {
|
|
136
|
+
"version": "0.5",
|
|
137
|
+
"created": "<ISO timestamp>"
|
|
138
|
+
},
|
|
139
|
+
"plan": {
|
|
140
|
+
"id": "<ISSUE-ID>",
|
|
141
|
+
"title": "<Full issue title>",
|
|
142
|
+
"status": "approved",
|
|
143
|
+
"author": "plan",
|
|
144
|
+
"tags": ["<relevant>", "<tags>"],
|
|
145
|
+
"narratives": {
|
|
146
|
+
"Problem": "<What problem this solves>",
|
|
147
|
+
"Proposal": "<How we solve it>",
|
|
148
|
+
"Constraint": "<Any constraints>",
|
|
149
|
+
"Risk": "<Key risks>",
|
|
150
|
+
"Alternative": "<What alternatives were considered>"
|
|
151
|
+
},
|
|
152
|
+
"items": [
|
|
153
|
+
{
|
|
154
|
+
"id": "<kebab-case-id>",
|
|
155
|
+
"title": "<ISSUE-ID>: <Specific task name>",
|
|
156
|
+
"status": "pending",
|
|
157
|
+
"priority": "high",
|
|
158
|
+
"metadata": {
|
|
159
|
+
"difficulty": "simple|medium|complex",
|
|
160
|
+
"issueLabel": "<issue-id-lowercase>"
|
|
161
|
+
},
|
|
162
|
+
"narrative": {
|
|
163
|
+
"Action": "<Exact what to do: file paths, function names, specific changes>"
|
|
164
|
+
},
|
|
165
|
+
"subItems": [
|
|
166
|
+
{
|
|
167
|
+
"id": "<parent-id>.<ac-name>",
|
|
168
|
+
"title": "<Specific testable acceptance criterion>",
|
|
169
|
+
"status": "pending",
|
|
170
|
+
"metadata": { "kind": "acceptance_criterion" }
|
|
171
|
+
}
|
|
172
|
+
]
|
|
173
|
+
}
|
|
174
|
+
],
|
|
175
|
+
"edges": [
|
|
176
|
+
{
|
|
177
|
+
"from": "<item-id>",
|
|
178
|
+
"to": "<item-id>",
|
|
179
|
+
"type": "blocks"
|
|
180
|
+
}
|
|
181
|
+
]
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
**CRITICAL vBRIEF Structure Rules:**
|
|
187
|
+
|
|
188
|
+
1. **Acceptance criteria MUST be subItems, NEVER top-level items.** Each AC is nested under its parent task/requirement as a `subItems` entry. Top-level items with `kind: "acceptance_criterion"` will fail vBRIEF Studio validation.
|
|
189
|
+
|
|
190
|
+
2. **Hierarchical IDs required.** SubItem IDs must use dot-notation from the parent: `parent-id.ac-name`. Example: `work-prompt-ac.injects-ac-per-bead`. The parent prefix is mandatory.
|
|
191
|
+
|
|
192
|
+
3. **Only actionable tasks are top-level items.** Requirements, tasks, and architectural decisions go in `items[]`. Acceptance criteria go in `subItems[]` under their parent.
|
|
193
|
+
|
|
194
|
+
4. **Every task SHOULD have at least one acceptance criterion** in `subItems` to define "done."
|
|
195
|
+
|
|
196
|
+
**Bead sizing guidance:**
|
|
197
|
+
- Each item should be completable in one focused session
|
|
198
|
+
- Include exact file paths and function names in the Action field
|
|
199
|
+
- Set `edges` to capture blocking relationships between items
|
|
200
|
+
- `difficulty`: trivial (typo/config), simple (1 file), medium (2-3 files), complex (multi-system)
|
|
201
|
+
- 10-40 items for a typical feature; more for large refactors
|
|
202
|
+
- SubItems (acceptance criteria) are NOT converted to beads — they're verification checklists
|
|
203
|
+
|
|
204
|
+
**After writing the JSON file:**
|
|
205
|
+
```bash
|
|
206
|
+
# Mark planning complete so the pipeline picks it up
|
|
207
|
+
touch workspaces/feature-<issue-id-lowercase>/.planning/.planning-complete
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
**Cloister hand-off:** When the `.planning-complete` marker is created, Cloister automatically:
|
|
211
|
+
1. Reads `plan.vbrief.json` from the workspace
|
|
212
|
+
2. Calls `createBeadsFromVBrief()` to convert vBRIEF items into beads tasks
|
|
213
|
+
3. Preserves dependency relationships from `edges` (blocking order)
|
|
214
|
+
4. Includes acceptance criteria in bead descriptions
|
|
215
|
+
5. Starts the work agent with the beads ready for implementation
|
|
216
|
+
|
|
217
|
+
You do NOT need to run `bd create` manually — Cloister handles the full conversion.
|
|
218
|
+
|
|
219
|
+
### Step 6: Stitch Integration (UI Work)
|
|
220
|
+
|
|
221
|
+
If issue involves UI, YOU MUST use Stitch:
|
|
222
|
+
|
|
223
|
+
```bash
|
|
224
|
+
# Load Stitch tools
|
|
225
|
+
ToolSearch query: "+stitch"
|
|
226
|
+
|
|
227
|
+
# Create project
|
|
228
|
+
mcp__stitch__create_project name="<issue-id>-design"
|
|
229
|
+
|
|
230
|
+
# Design each screen
|
|
231
|
+
mcp__stitch__generate_screen_from_text ...
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
Document all designs in `.planning/STITCH_DESIGNS.md`.
|
|
235
|
+
|
|
236
|
+
### Step 7: Update Issue Tracker
|
|
237
|
+
|
|
238
|
+
**GitHub (PAN-*):**
|
|
239
|
+
```bash
|
|
240
|
+
gh label create "planned" --color "0E8A16" 2>/dev/null || true
|
|
241
|
+
gh label create "ready-for-implementation" --color "1D76DB" 2>/dev/null || true
|
|
242
|
+
gh label create "opus-planned" --color "7057FF" 2>/dev/null || true
|
|
243
|
+
|
|
244
|
+
gh issue edit <number> --add-label "planned,ready-for-implementation,opus-planned"
|
|
245
|
+
|
|
246
|
+
gh issue comment <number> --body "## Planning Complete
|
|
247
|
+
**Planned by:** Claude Opus 4.6
|
|
248
|
+
**Workspace:** workspaces/feature-<issue-id>/
|
|
249
|
+
|
|
250
|
+
### Beads: <N> items in plan.vbrief.json
|
|
251
|
+
### Next: /work-issue <ISSUE-ID>"
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
### Step 8: Output Summary
|
|
255
|
+
|
|
256
|
+
```
|
|
257
|
+
## Planning Complete for <ISSUE-ID>
|
|
258
|
+
|
|
259
|
+
**Workspace:** <path>
|
|
260
|
+
**STATE.md:** decisions log, architecture, key touch points
|
|
261
|
+
**plan.vbrief.json:** <N> items, <M> edges
|
|
262
|
+
|
|
263
|
+
**Unblocked Items:**
|
|
264
|
+
1. <item-id>: <title> [P<n>]
|
|
265
|
+
...
|
|
266
|
+
|
|
267
|
+
**Next:** /work-issue <ISSUE-ID>
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
---
|
|
271
|
+
|
|
272
|
+
## Task Breakdown Templates
|
|
273
|
+
|
|
274
|
+
### For Backend API Work:
|
|
275
|
+
|
|
276
|
+
```
|
|
277
|
+
Items:
|
|
278
|
+
- Define types/interfaces in types.ts
|
|
279
|
+
- Create endpoint handler function
|
|
280
|
+
- Add route registration
|
|
281
|
+
- Add request validation
|
|
282
|
+
- Add error handling
|
|
283
|
+
- Write unit tests for handler
|
|
284
|
+
- Write integration tests for endpoint
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
### For React Component Work:
|
|
288
|
+
|
|
289
|
+
```
|
|
290
|
+
Items:
|
|
291
|
+
- Create component file with shell
|
|
292
|
+
- Add props interface
|
|
293
|
+
- Implement render logic
|
|
294
|
+
- Add state management (if needed)
|
|
295
|
+
- Add event handlers
|
|
296
|
+
- Style with Tailwind/CSS
|
|
297
|
+
- Add loading/error states
|
|
298
|
+
- Write unit tests
|
|
299
|
+
- Wire into parent component
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
### For Bug Fixes:
|
|
303
|
+
|
|
304
|
+
```
|
|
305
|
+
Items:
|
|
306
|
+
- Write failing test that reproduces bug
|
|
307
|
+
- Identify root cause (document in Action field)
|
|
308
|
+
- Implement fix
|
|
309
|
+
- Verify test passes
|
|
310
|
+
- Add regression tests
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
### For Refactoring:
|
|
314
|
+
|
|
315
|
+
```
|
|
316
|
+
Items:
|
|
317
|
+
- Write tests for current behavior (if missing)
|
|
318
|
+
- Extract function/module
|
|
319
|
+
- Update all call sites
|
|
320
|
+
- Run tests, fix failures
|
|
321
|
+
- Remove old code
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
---
|
|
325
|
+
|
|
326
|
+
## Quality Checklist
|
|
327
|
+
|
|
328
|
+
Before completing /plan, verify:
|
|
329
|
+
|
|
330
|
+
- [ ] STATE.md has complete discovery, decisions, and architecture
|
|
331
|
+
- [ ] plan.vbrief.json is valid JSON with all required fields
|
|
332
|
+
- [ ] Each item has exact file paths in Action field
|
|
333
|
+
- [ ] Dependencies (edges) are set correctly
|
|
334
|
+
- [ ] .planning-complete marker created
|
|
335
|
+
- [ ] Issue tracker updated
|
|
336
|
+
- [ ] No decisions left for implementation agent
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/lib/skills-merge.ts","../src/lib/workspace-manager.ts"],"sourcesContent":["import {\n existsSync,\n readdirSync,\n mkdirSync,\n readFileSync,\n writeFileSync,\n copyFileSync,\n statSync,\n} from 'fs';\nimport { join, relative, dirname } from 'path';\nimport { SKILLS_DIR, CACHE_AGENTS_DIR, CACHE_RULES_DIR } from './paths.js';\nimport {\n readManifest,\n writeManifest,\n collectSourceFiles,\n hashFile,\n setManifestEntry,\n compareFileToManifest,\n type Manifest,\n} from './manifest.js';\n\nexport interface MergeResult {\n added: string[];\n updated: string[];\n skipped: string[];\n overlayed: string[];\n}\n\n/**\n * Copy all files from a source directory into a target directory,\n * preserving subdirectory structure. Returns the list of relative paths copied.\n */\nfunction copyTree(sourceDir: string, targetDir: string): string[] {\n const copied: string[] = [];\n if (!existsSync(sourceDir)) return copied;\n\n function walk(dir: string): void {\n const entries = readdirSync(dir, { withFileTypes: true });\n for (const entry of entries) {\n const fullPath = join(dir, entry.name);\n if (entry.isDirectory()) {\n walk(fullPath);\n } else if (entry.isFile()) {\n const rel = relative(sourceDir, fullPath);\n const targetPath = join(targetDir, rel);\n mkdirSync(dirname(targetPath), { recursive: true });\n copyFileSync(fullPath, targetPath);\n copied.push(rel);\n }\n }\n }\n\n walk(sourceDir);\n return copied;\n}\n\n/**\n * Merge Panopticon skills, agents, and rules into a workspace using file copies.\n *\n * Flow:\n * 1. Copy from cache (skills, agent-definitions, rules) → workspace/.claude/\n * 2. Write manifest tracking what was placed\n *\n * Project template overlay is handled separately by workspace-manager.ts\n * (processTemplates + createSymlinks → now also copy-based).\n */\nexport function mergeSkillsIntoWorkspace(workspacePath: string): MergeResult {\n const claudeDir = join(workspacePath, '.claude');\n const manifestPath = join(claudeDir, '.panopticon-manifest.json');\n const manifest = readManifest(manifestPath);\n\n const result: MergeResult = {\n added: [],\n updated: [],\n skipped: [],\n overlayed: [],\n };\n\n // Ensure base directories exist\n mkdirSync(join(claudeDir, 'skills'), { recursive: true });\n mkdirSync(join(claudeDir, 'agents'), { recursive: true });\n\n // Sources to copy: category → source cache directory\n const sources: Array<{ category: string; sourceDir: string; targetSubdir: string }> = [\n { category: 'skills', sourceDir: SKILLS_DIR, targetSubdir: 'skills' },\n { category: 'agents', sourceDir: CACHE_AGENTS_DIR, targetSubdir: 'agents' },\n { category: 'rules', sourceDir: CACHE_RULES_DIR, targetSubdir: 'rules' },\n ];\n\n for (const { category, sourceDir, targetSubdir } of sources) {\n if (!existsSync(sourceDir)) continue;\n\n const prefix = targetSubdir ? `${targetSubdir}/` : '';\n const files = collectSourceFiles(sourceDir, '');\n\n for (const file of files) {\n const relativePath = `${prefix}${file.relativePath}`;\n const targetPath = join(claudeDir, relativePath);\n const sourceHash = hashFile(file.absolutePath);\n\n // Check status against manifest\n const status = compareFileToManifest(targetPath, relativePath, manifest);\n\n switch (status.action) {\n case 'new':\n // File doesn't exist at target — copy it\n mkdirSync(dirname(targetPath), { recursive: true });\n copyFileSync(file.absolutePath, targetPath);\n setManifestEntry(manifest, relativePath, sourceHash, 'panopticon');\n result.added.push(relativePath);\n break;\n\n case 'update':\n // File exists and matches manifest — safe to overwrite with latest\n copyFileSync(file.absolutePath, targetPath);\n setManifestEntry(manifest, relativePath, sourceHash, 'panopticon');\n result.updated.push(relativePath);\n break;\n\n case 'modified':\n // User modified the file — skip to preserve their changes\n result.skipped.push(`${relativePath} (modified by user)`);\n break;\n\n case 'user-owned':\n // File exists but wasn't placed by us — never touch\n result.skipped.push(`${relativePath} (user-owned)`);\n break;\n }\n }\n }\n\n // Write updated manifest\n writeManifest(manifestPath, manifest);\n\n return result;\n}\n\n/**\n * Apply project template overlay on top of Panopticon base files in a workspace.\n *\n * This copies files from the project's agent template directory into\n * workspace/.claude/, overwriting Panopticon files where the project\n * provides its own version. Updates the manifest with source=\"project-template\".\n *\n * @param workspacePath - Path to the workspace\n * @param templateDir - Absolute path to the project's agent template directory\n * @param templates - Optional list of specific template files to process (source → target mappings)\n */\nexport function applyProjectTemplateOverlay(\n workspacePath: string,\n templateDir: string,\n templates?: Array<{ source: string; target: string }>,\n): string[] {\n const claudeDir = join(workspacePath, '.claude');\n const manifestPath = join(claudeDir, '.panopticon-manifest.json');\n const manifest = readManifest(manifestPath);\n const overlayed: string[] = [];\n\n if (!existsSync(templateDir)) return overlayed;\n\n if (templates && templates.length > 0) {\n // Process specific template mappings\n for (const { source, target } of templates) {\n const sourcePath = join(templateDir, source);\n if (!existsSync(sourcePath)) continue;\n\n const targetPath = join(workspacePath, target);\n mkdirSync(dirname(targetPath), { recursive: true });\n\n // Read template content and check if it's a template file\n if (source.endsWith('.template')) {\n // Template files are handled by workspace-manager's processTemplates\n // We just track them in the manifest after they're processed\n continue;\n }\n\n copyFileSync(sourcePath, targetPath);\n\n // Track in manifest if it's under .claude/\n if (target.startsWith('.claude/')) {\n const relativePath = target.slice('.claude/'.length);\n const hash = hashFile(targetPath);\n setManifestEntry(manifest, relativePath, hash, 'project-template');\n overlayed.push(relativePath);\n }\n }\n } else {\n // Copy all .claude/ subdirectories from template dir\n const claudeInTemplate = join(templateDir, '.claude');\n if (existsSync(claudeInTemplate)) {\n const copied = copyTree(claudeInTemplate, claudeDir);\n for (const rel of copied) {\n const targetPath = join(claudeDir, rel);\n const hash = hashFile(targetPath);\n setManifestEntry(manifest, rel, hash, 'project-template');\n overlayed.push(rel);\n }\n }\n }\n\n // Write updated manifest\n writeManifest(manifestPath, manifest);\n\n return overlayed;\n}\n\n// ─── Legacy exports (kept for migration, to be removed in future) ───\n\n/**\n * @deprecated No longer needed — skills are copies, not symlinks. Kept for migration.\n */\nexport function cleanupGitignore(gitignorePath: string): {\n cleaned: boolean;\n duplicatesRemoved: number;\n entriesAfter: number;\n} {\n if (!existsSync(gitignorePath)) {\n return { cleaned: false, duplicatesRemoved: 0, entriesAfter: 0 };\n }\n\n const PANOPTICON_HEADER = '# Panopticon-managed symlinks (not committed)';\n let content: string;\n try {\n content = readFileSync(gitignorePath, 'utf-8');\n } catch {\n return { cleaned: false, duplicatesRemoved: 0, entriesAfter: 0 };\n }\n\n // If no Panopticon section, nothing to clean\n if (!content.includes(PANOPTICON_HEADER)) {\n return { cleaned: false, duplicatesRemoved: 0, entriesAfter: 0 };\n }\n\n // Remove the entire Panopticon section (skills are copies now, not symlinks)\n const lines = content.split('\\n');\n const newLines: string[] = [];\n let inPanopticonSection = false;\n\n for (const line of lines) {\n const trimmed = line.trim();\n if (trimmed === PANOPTICON_HEADER) {\n inPanopticonSection = true;\n continue;\n }\n if (inPanopticonSection) {\n if (trimmed.startsWith('#') && trimmed !== '') {\n inPanopticonSection = false;\n newLines.push(line);\n } else if (trimmed === '') {\n // Skip blank lines in Panopticon section\n continue;\n }\n // Skip entries in Panopticon section\n continue;\n }\n newLines.push(line);\n }\n\n // Write cleaned file\n try {\n writeFileSync(gitignorePath, newLines.join('\\n'), 'utf-8');\n return { cleaned: true, duplicatesRemoved: 0, entriesAfter: 0 };\n } catch {\n return { cleaned: false, duplicatesRemoved: 0, entriesAfter: 0 };\n }\n}\n\n/**\n * @deprecated No longer needed — skills are copies, not symlinks. Kept for migration.\n */\nexport function cleanupWorkspaceGitignore(workspacePath: string): {\n cleaned: boolean;\n duplicatesRemoved: number;\n entriesAfter: number;\n} {\n const gitignorePath = join(workspacePath, '.claude', 'skills', '.gitignore');\n return cleanupGitignore(gitignorePath);\n}\n","/**\n * Workspace Manager\n *\n * Handles workspace creation and removal for both monorepo and polyrepo projects.\n */\n\nimport { existsSync, mkdirSync, writeFileSync, readFileSync, readdirSync, copyFileSync, symlinkSync, chmodSync, realpathSync, rmSync } from 'fs';\nimport { join, dirname, basename, extname, resolve } from 'path';\nimport { homedir } from 'os';\nimport { exec } from 'child_process';\nimport { promisify } from 'util';\nimport {\n ProjectConfig,\n WorkspaceConfig,\n TemplatePlaceholders,\n replacePlaceholders,\n getDefaultWorkspaceConfig,\n} from './workspace-config.js';\nimport { addDnsEntry, removeDnsEntry, syncDnsToWindows } from './dns.js';\nimport { addTunnelIngress, removeTunnelIngress } from './tunnel.js';\nimport { createHumeConfig, deleteHumeConfig } from './hume.js';\nimport { mergeSkillsIntoWorkspace } from './skills-merge.js';\n\nconst execAsync = promisify(exec);\n\nexport interface WorkspaceCreateOptions {\n projectConfig: ProjectConfig;\n featureName: string;\n startDocker?: boolean;\n dryRun?: boolean;\n}\n\nexport interface WorkspaceCreateResult {\n success: boolean;\n workspacePath: string;\n errors: string[];\n steps: string[];\n}\n\n/**\n * Create placeholders for template substitution\n */\nfunction createPlaceholders(\n projectConfig: ProjectConfig,\n featureName: string,\n workspacePath: string\n): TemplatePlaceholders {\n const featureFolder = `feature-${featureName}`;\n const domain = projectConfig.workspace?.dns?.domain || 'localhost';\n\n return {\n FEATURE_NAME: featureName,\n FEATURE_FOLDER: featureFolder,\n BRANCH_NAME: `feature/${featureName}`,\n COMPOSE_PROJECT: `${basename(projectConfig.path)}-${featureFolder}`,\n DOMAIN: domain,\n PROJECT_NAME: basename(projectConfig.path),\n PROJECT_PATH: projectConfig.path,\n PROJECTS_DIR: dirname(projectConfig.path),\n WORKSPACE_PATH: workspacePath,\n HOME: homedir(),\n };\n}\n\n/**\n * Sanitize docker-compose files to use platform-agnostic paths\n * Replaces hardcoded /home/username paths with ${HOME}\n */\nfunction sanitizeComposeFile(filePath: string): void {\n if (!existsSync(filePath)) return;\n\n let content = readFileSync(filePath, 'utf-8');\n const originalContent = content;\n\n // Pattern to match hardcoded home paths like /home/username or /Users/username\n // Replace with ${HOME} which docker-compose expands\n const homePatterns = [\n /\\/home\\/[a-zA-Z0-9_-]+\\//g, // Linux: /home/username/\n /\\/Users\\/[a-zA-Z0-9_-]+\\//g, // macOS: /Users/username/\n ];\n\n for (const pattern of homePatterns) {\n content = content.replace(pattern, '${HOME}/');\n }\n\n if (content !== originalContent) {\n writeFileSync(filePath, content, 'utf-8');\n }\n}\n\n/**\n * Validate feature name (alphanumeric and hyphens only)\n */\nfunction validateFeatureName(name: string): boolean {\n return /^[a-zA-Z0-9-]+$/.test(name);\n}\n\n/**\n * Create a git worktree\n * @param repoPath Path to the source git repository\n * @param targetPath Where to create the worktree\n * @param branchName Name of the feature branch to create/checkout\n * @param defaultBranch Base branch to create new branches from (default: 'main')\n */\nasync function createWorktree(\n repoPath: string,\n targetPath: string,\n branchName: string,\n defaultBranch: string = 'main'\n): Promise<{ success: boolean; message: string }> {\n try {\n // Fetch latest from origin\n await execAsync('git fetch origin', { cwd: repoPath });\n\n // Prune stale worktree entries (e.g., from deleted workspaces)\n await execAsync('git worktree prune', { cwd: repoPath });\n\n // Check if branch exists locally or remotely\n const { stdout: localBranches } = await execAsync('git branch --list', { cwd: repoPath });\n const { stdout: remoteBranches } = await execAsync('git branch -r --list', { cwd: repoPath });\n\n const branchExists =\n localBranches.includes(branchName) ||\n remoteBranches.includes(`origin/${branchName}`);\n\n if (branchExists) {\n await execAsync(`git worktree add \"${targetPath}\" \"${branchName}\"`, { cwd: repoPath });\n } else {\n // Create new branch from the configured default branch\n await execAsync(`git worktree add \"${targetPath}\" -b \"${branchName}\" \"${defaultBranch}\"`, { cwd: repoPath });\n }\n\n // Configure beads role so agents don't get \"beads.role not configured\" warnings\n await execAsync('git config beads.role agent', { cwd: targetPath }).catch(() => {});\n\n return { success: true, message: `Created worktree at ${targetPath}` };\n } catch (error) {\n return { success: false, message: `Failed to create worktree: ${error}` };\n }\n}\n\n/**\n * Remove a git worktree\n */\nasync function removeWorktree(\n repoPath: string,\n targetPath: string,\n branchName: string\n): Promise<{ success: boolean; message: string }> {\n try {\n // Remove worktree\n await execAsync(`git worktree remove \"${targetPath}\" --force`, { cwd: repoPath }).catch(() => {});\n\n // Optionally delete the branch\n await execAsync(`git branch -D \"${branchName}\"`, { cwd: repoPath }).catch(() => {});\n\n return { success: true, message: `Removed worktree at ${targetPath}` };\n } catch (error) {\n return { success: false, message: `Failed to remove worktree: ${error}` };\n }\n}\n\n// DNS functions (addWsl2HostEntry, removeWsl2HostEntry, syncDnsToWindows)\n// are now in src/lib/dns.ts and imported above\n\n/**\n * Assign a port from a range\n */\nfunction assignPort(\n portFile: string,\n featureFolder: string,\n range: [number, number]\n): number {\n // Ensure port file exists\n if (!existsSync(portFile)) {\n mkdirSync(dirname(portFile), { recursive: true });\n writeFileSync(portFile, '');\n }\n\n const content = readFileSync(portFile, 'utf-8');\n const lines = content.split('\\n').filter(Boolean);\n\n // Check if already assigned\n for (const line of lines) {\n const [folder, port] = line.split(':');\n if (folder === featureFolder) {\n return parseInt(port, 10);\n }\n }\n\n // Find next available port\n const usedPorts = new Set(lines.map(l => parseInt(l.split(':')[1], 10)));\n for (let port = range[0]; port <= range[1]; port++) {\n if (!usedPorts.has(port)) {\n writeFileSync(portFile, content + (content.endsWith('\\n') ? '' : '\\n') + `${featureFolder}:${port}\\n`);\n return port;\n }\n }\n\n throw new Error(`No available ports in range ${range[0]}-${range[1]}`);\n}\n\n/**\n * Release a port assignment\n */\nfunction releasePort(portFile: string, featureFolder: string): boolean {\n try {\n if (!existsSync(portFile)) return true;\n\n let content = readFileSync(portFile, 'utf-8');\n const lines = content.split('\\n').filter(line => !line.startsWith(`${featureFolder}:`));\n writeFileSync(portFile, lines.join('\\n'));\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Process template files with placeholder replacement\n */\nfunction processTemplates(\n templateDir: string,\n targetDir: string,\n placeholders: TemplatePlaceholders,\n templates?: Array<{ source: string; target: string }>\n): string[] {\n const steps: string[] = [];\n\n if (!existsSync(templateDir)) {\n return steps;\n }\n\n // If specific templates are defined, process those\n if (templates && templates.length > 0) {\n for (const { source, target } of templates) {\n const sourcePath = join(templateDir, source);\n const targetPath = join(targetDir, target);\n\n if (existsSync(sourcePath)) {\n const content = readFileSync(sourcePath, 'utf-8');\n const processed = replacePlaceholders(content, placeholders);\n mkdirSync(dirname(targetPath), { recursive: true });\n writeFileSync(targetPath, processed);\n steps.push(`Processed template: ${source} -> ${target}`);\n }\n }\n } else {\n // Process all .template files\n const files = readdirSync(templateDir);\n for (const file of files) {\n if (file.endsWith('.template')) {\n const sourcePath = join(templateDir, file);\n const targetPath = join(targetDir, file.replace('.template', ''));\n\n const content = readFileSync(sourcePath, 'utf-8');\n const processed = replacePlaceholders(content, placeholders);\n writeFileSync(targetPath, processed);\n steps.push(`Processed template: ${file}`);\n }\n }\n }\n\n return steps;\n}\n\n/**\n * @deprecated Use copyProjectTemplateDirs instead. Kept for non-.claude paths.\n */\nfunction createSymlinks(\n sourceDir: string,\n targetDir: string,\n symlinks: string[]\n): string[] {\n const steps: string[] = [];\n\n for (const symlink of symlinks) {\n const sourcePath = join(sourceDir, symlink);\n const targetPath = join(targetDir, symlink);\n\n if (existsSync(sourcePath)) {\n mkdirSync(dirname(targetPath), { recursive: true });\n try {\n symlinkSync(sourcePath, targetPath);\n steps.push(`Created symlink: ${symlink}`);\n } catch {\n // Symlink might already exist\n }\n }\n }\n\n return steps;\n}\n\n/**\n * Copy project template directories into workspace (replaces symlinks).\n * Recursively copies all files from each source directory.\n */\nconst TEXT_EXTENSIONS = new Set([\n '.md', '.sh', '.yml', '.yaml', '.json', '.ts', '.js', '.env', '.txt', '.toml', '.template',\n]);\n\nfunction copyProjectTemplateDirs(\n sourceDir: string,\n targetDir: string,\n dirs: string[],\n placeholders?: TemplatePlaceholders\n): string[] {\n const steps: string[] = [];\n\n for (const dir of dirs) {\n const sourcePath = join(sourceDir, dir);\n const targetPath = join(targetDir, dir);\n\n if (!existsSync(sourcePath)) continue;\n\n // Recursively copy all files, applying placeholder substitution to text files\n function copyDir(src: string, dest: string): number {\n let count = 0;\n mkdirSync(dest, { recursive: true });\n const entries = readdirSync(src, { withFileTypes: true });\n for (const entry of entries) {\n const srcEntry = join(src, entry.name);\n const destEntry = join(dest, entry.name);\n if (entry.isDirectory()) {\n count += copyDir(srcEntry, destEntry);\n } else if (entry.isFile()) {\n const ext = extname(entry.name).toLowerCase();\n if (placeholders && TEXT_EXTENSIONS.has(ext)) {\n const content = readFileSync(srcEntry, 'utf-8');\n writeFileSync(destEntry, replacePlaceholders(content, placeholders));\n } else {\n copyFileSync(srcEntry, destEntry);\n }\n count++;\n }\n }\n return count;\n }\n\n const count = copyDir(sourcePath, targetPath);\n steps.push(`Copied ${count} files from project template: ${dir}`);\n }\n\n return steps;\n}\n\n/**\n * Create a workspace\n */\nexport async function createWorkspace(options: WorkspaceCreateOptions): Promise<WorkspaceCreateResult> {\n const { projectConfig, featureName, startDocker, dryRun } = options;\n const result: WorkspaceCreateResult = {\n success: true,\n workspacePath: '',\n errors: [],\n steps: [],\n };\n\n // Validate feature name\n if (!validateFeatureName(featureName)) {\n result.success = false;\n result.errors.push('Invalid feature name. Use alphanumeric and hyphens only.');\n return result;\n }\n\n // Reject 'main' as feature name\n if (featureName === 'main') {\n result.success = false;\n result.errors.push('Cannot create workspace for \"main\". Use base repos directly.');\n return result;\n }\n\n const workspaceConfig = projectConfig.workspace || getDefaultWorkspaceConfig();\n const workspacesDir = join(projectConfig.path, workspaceConfig.workspaces_dir || 'workspaces');\n const featureFolder = `feature-${featureName}`;\n const workspacePath = join(workspacesDir, featureFolder);\n result.workspacePath = workspacePath;\n\n // Check if workspace already exists\n if (existsSync(workspacePath)) {\n result.success = false;\n result.errors.push(`Workspace already exists at ${workspacePath}`);\n return result;\n }\n\n if (dryRun) {\n result.steps.push('[DRY RUN] Would create workspace at: ' + workspacePath);\n return result;\n }\n\n // Create placeholders\n const placeholders = createPlaceholders(projectConfig, featureName, workspacePath);\n\n // Create workspace directory\n mkdirSync(workspacePath, { recursive: true });\n result.steps.push('Created workspace directory');\n\n // Handle polyrepo vs monorepo\n if (workspaceConfig.type === 'polyrepo' && workspaceConfig.repos) {\n // Create worktrees for each repo\n for (const repo of workspaceConfig.repos) {\n // Resolve symlinks to get the actual git repository path\n // (e.g., myn/frontend -> ../frontend needs to resolve to actual path)\n const rawRepoPath = join(projectConfig.path, repo.path);\n const repoPath = existsSync(rawRepoPath) ? realpathSync(rawRepoPath) : rawRepoPath;\n const targetPath = join(workspacePath, repo.name);\n const branchPrefix = repo.branch_prefix || 'feature/';\n const branchName = `${branchPrefix}${featureName}`;\n // Per-repo default_branch overrides workspace-level, falls back to 'main'\n const defaultBranch = repo.default_branch || workspaceConfig.default_branch || 'main';\n\n const worktreeResult = await createWorktree(repoPath, targetPath, branchName, defaultBranch);\n if (worktreeResult.success) {\n result.steps.push(`Created worktree for ${repo.name}: ${branchName} (from ${defaultBranch})`);\n } else {\n result.errors.push(`${repo.name}: ${worktreeResult.message}`);\n result.success = false; // Fail the entire workspace creation if any worktree fails\n }\n }\n } else {\n // Monorepo: create single worktree\n const branchName = `feature/${featureName}`;\n const defaultBranch = workspaceConfig.default_branch || 'main';\n const worktreeResult = await createWorktree(projectConfig.path, workspacePath, branchName, defaultBranch);\n if (worktreeResult.success) {\n result.steps.push(`Created worktree: ${branchName} (from ${defaultBranch})`);\n } else {\n result.errors.push(worktreeResult.message);\n result.success = false; // Fail the entire workspace creation if worktree fails\n }\n }\n\n // Remove stale .planning/ directory inherited from main branch.\n // This contains STATE.md and other planning artifacts from a PREVIOUS issue.\n // If left in place, the new agent reads it and works on the wrong issue.\n // SAFETY: resolve() to absolute path and verify it's under a known workspace prefix\n // to prevent path traversal from ever reaching rmSync.\n const resolvedWorkspace = resolve(workspacePath);\n const resolvedPlanning = resolve(resolvedWorkspace, '.planning');\n const isUnderWorkspacesDir = resolvedWorkspace.match(/\\/workspaces\\/feature-[a-z0-9-]+$/);\n if (\n isUnderWorkspacesDir &&\n resolvedPlanning === join(resolvedWorkspace, '.planning') &&\n existsSync(join(resolvedWorkspace, '.git')) &&\n existsSync(resolvedPlanning)\n ) {\n rmSync(resolvedPlanning, { recursive: true, force: true });\n result.steps.push('Removed stale .planning/ directory from previous issue');\n }\n\n // Sanitize any docker-compose files in the workspace to use platform-agnostic paths\n // This handles files inherited from worktrees that may have hardcoded home paths\n const devcontainerDir = join(workspacePath, '.devcontainer');\n if (existsSync(devcontainerDir)) {\n const composeFiles = readdirSync(devcontainerDir)\n .filter(f => f.includes('compose') && (f.endsWith('.yml') || f.endsWith('.yaml')));\n for (const composeFile of composeFiles) {\n sanitizeComposeFile(join(devcontainerDir, composeFile));\n }\n if (composeFiles.length > 0) {\n result.steps.push(`Sanitized ${composeFiles.length} compose file(s) for platform compatibility`);\n }\n }\n\n // Setup TLDR code analysis for workspace (after worktree creation to ensure directory is ready)\n try {\n // Check if python3 is available\n await execAsync('python3 --version');\n const venvPath = join(workspacePath, '.venv');\n const tldrBin = join(venvPath, 'bin', 'tldr');\n\n // Check if main branch already has a working venv with llm-tldr\n const mainVenvTldr = join(projectConfig.path, '.venv', 'bin', 'tldr');\n const mainVenvExists = existsSync(mainVenvTldr);\n\n if (mainVenvExists) {\n // Copy the entire venv from main — faster than pip install (seconds vs 30s+)\n await execAsync(`cp -a \"${join(projectConfig.path, '.venv')}\" \"${venvPath}\"`);\n result.steps.push('Copied Python venv from main branch');\n } else {\n // Create fresh venv and install llm-tldr\n await execAsync(`python3 -m venv \"${venvPath}\"`, { cwd: workspacePath });\n const pipPath = join(venvPath, 'bin', 'pip');\n await execAsync(`\"${pipPath}\" install llm-tldr`, { cwd: workspacePath, timeout: 120000 });\n result.steps.push('Created Python venv and installed llm-tldr');\n\n // Apply .tsx/.jsx support patch (upstream llm-tldr only checks .ts)\n const patchScript = join(projectConfig.path, 'scripts', 'patches', 'llm-tldr-tsx-support.py');\n if (existsSync(patchScript)) {\n await execAsync(`python3 \"${patchScript}\" \"${venvPath}\"`);\n result.steps.push('Applied llm-tldr .tsx/.jsx patch');\n }\n }\n\n // Verify tldr binary exists after setup\n if (!existsSync(tldrBin)) {\n result.steps.push('TLDR setup incomplete: tldr binary not found after venv creation');\n } else {\n // Copy .tldr index from main branch if it exists\n const mainTldrDir = join(projectConfig.path, '.tldr');\n const workspaceTldrDir = join(workspacePath, '.tldr');\n\n if (existsSync(mainTldrDir)) {\n await execAsync(`cp -r \"${mainTldrDir}\" \"${workspaceTldrDir}\"`);\n result.steps.push('Copied TLDR index from main branch');\n }\n\n // Start TLDR daemon for this workspace\n const { getTldrDaemonService } = await import('./tldr-daemon.js');\n const tldrService = getTldrDaemonService(workspacePath, venvPath);\n await tldrService.start(true);\n result.steps.push('Started TLDR daemon');\n\n // Warm the index in the background — ensures workspaces always have a working index\n // even when the main branch cache was empty (nothing to copy)\n try {\n await tldrService.warm(true); // background=true: non-blocking\n result.steps.push('TLDR index warm initiated (background)');\n } catch {\n // Non-fatal — daemon may not support warm yet\n }\n }\n } catch (error: any) {\n // TLDR setup is optional — don't fail workspace creation, but log clearly\n if (error.message?.includes('python3')) {\n result.steps.push('Skipped TLDR setup (python3 not available)');\n } else {\n console.warn(`⚠ TLDR setup failed: ${error.message}`);\n result.steps.push(`TLDR setup failed: ${error.message}`);\n }\n }\n\n // Configure DNS\n if (workspaceConfig.dns) {\n const dnsMethod = workspaceConfig.dns.sync_method || 'wsl2hosts';\n for (const entryPattern of workspaceConfig.dns.entries) {\n const hostname = replacePlaceholders(entryPattern, placeholders);\n\n if (addDnsEntry(dnsMethod, hostname)) {\n result.steps.push(`Added DNS entry: ${hostname} (${dnsMethod})`);\n }\n }\n\n // Sync to Windows if using wsl2hosts method\n if (dnsMethod === 'wsl2hosts') {\n const synced = await syncDnsToWindows();\n if (synced) {\n result.steps.push('Synced DNS to Windows hosts file');\n }\n }\n }\n\n // Assign ports\n if (workspaceConfig.ports) {\n for (const [portName, portConfig] of Object.entries(workspaceConfig.ports)) {\n const portFile = join(projectConfig.path, `.${portName}-ports`);\n try {\n const port = assignPort(portFile, featureFolder, portConfig.range);\n result.steps.push(`Assigned ${portName} port: ${port}`);\n // Add to placeholders for use in templates\n (placeholders as any)[`${portName.toUpperCase()}_PORT`] = String(port);\n } catch (error) {\n result.errors.push(`Failed to assign ${portName} port: ${error}`);\n }\n }\n }\n\n // Install base Panopticon skills/agents/rules from cache\n const mergeResult = mergeSkillsIntoWorkspace(workspacePath);\n const mergeTotal = mergeResult.added.length + mergeResult.updated.length;\n if (mergeTotal > 0) {\n result.steps.push(`Installed ${mergeTotal} Panopticon files (${mergeResult.added.length} new, ${mergeResult.updated.length} updated)`);\n }\n\n // Process agent templates (project template overlay — wins over Panopticon base)\n if (workspaceConfig.agent?.template_dir) {\n const templateDir = join(projectConfig.path, workspaceConfig.agent.template_dir);\n\n // Process template files\n const templateSteps = processTemplates(\n templateDir,\n workspacePath,\n placeholders,\n workspaceConfig.agent.templates\n );\n result.steps.push(...templateSteps);\n\n // Copy .claude/ directories from project template (copy_dirs replaces legacy symlinks)\n const dirsToSync = workspaceConfig.agent.copy_dirs || workspaceConfig.agent.symlinks;\n if (dirsToSync) {\n const copySteps = copyProjectTemplateDirs(templateDir, workspacePath, dirsToSync, placeholders);\n result.steps.push(...copySteps);\n }\n }\n\n // Generate .env file\n if (workspaceConfig.env?.template) {\n const envContent = replacePlaceholders(workspaceConfig.env.template, placeholders);\n writeFileSync(join(workspacePath, '.env'), envContent);\n result.steps.push('Created .env file');\n }\n\n // Process Docker compose templates\n if (workspaceConfig.docker?.compose_template) {\n const templateDir = join(projectConfig.path, workspaceConfig.docker.compose_template);\n const devcontainerDir = join(workspacePath, '.devcontainer');\n mkdirSync(devcontainerDir, { recursive: true });\n\n const templateSteps = processTemplates(templateDir, devcontainerDir, placeholders);\n result.steps.push(...templateSteps);\n\n // Copy non-template files (like Dockerfile)\n if (existsSync(templateDir)) {\n const files = readdirSync(templateDir);\n for (const file of files) {\n if (!file.endsWith('.template')) {\n const sourcePath = join(templateDir, file);\n const targetPath = join(devcontainerDir, file);\n copyFileSync(sourcePath, targetPath);\n }\n }\n }\n\n // Sanitize docker-compose files to use platform-agnostic paths\n // This fixes hardcoded /home/username or /Users/username paths\n const composeFiles = readdirSync(devcontainerDir)\n .filter(f => f.includes('compose') && (f.endsWith('.yml') || f.endsWith('.yaml')));\n for (const composeFile of composeFiles) {\n sanitizeComposeFile(join(devcontainerDir, composeFile));\n }\n if (composeFiles.length > 0) {\n result.steps.push(`Sanitized ${composeFiles.length} compose file(s) for platform compatibility`);\n }\n\n // Create ./dev symlink at workspace root pointing to .devcontainer/dev\n // Symlink keeps changes in sync - editing ./dev updates .devcontainer/dev\n const devScriptInContainer = join(devcontainerDir, 'dev');\n const devScriptAtRoot = join(workspacePath, 'dev');\n if (existsSync(devScriptInContainer) && !existsSync(devScriptAtRoot)) {\n try {\n symlinkSync('.devcontainer/dev', devScriptAtRoot);\n chmodSync(devScriptInContainer, 0o755); // Make executable\n result.steps.push('Created ./dev symlink');\n } catch (error) {\n result.errors.push(`Failed to create ./dev symlink: ${error}`);\n }\n }\n }\n\n // Note: Beads initialization is handled by the calling command (workspace.ts)\n // With beads v0.47.1+, worktrees use shared database with labels for isolation\n // The workspace.ts command creates a bead with workspace:issue-id label\n\n // Set up Cloudflare tunnel for external access (before Docker so containers can use tunnel URLs)\n if (workspaceConfig.tunnel) {\n const tunnelResult = await addTunnelIngress(workspaceConfig.tunnel, placeholders);\n result.steps.push(...tunnelResult.steps);\n if (!tunnelResult.success) {\n result.errors.push('Tunnel setup had failures (see steps for details)');\n }\n }\n\n // Create Hume EVI config and write env file for Docker (before Docker so containers pick up the config ID)\n if (workspaceConfig.hume) {\n const humeResult = await createHumeConfig(workspaceConfig.hume, placeholders);\n result.steps.push(...humeResult.steps);\n if (humeResult.configId) {\n writeFileSync(\n join(workspacePath, '.hume-config'),\n `HUME_CONFIG_ID=${humeResult.configId}\\nVITE_HUME_CONFIG_ID=${humeResult.configId}\\n`,\n );\n result.steps.push('Wrote .hume-config with Hume EVI config ID');\n }\n if (!humeResult.success) {\n result.errors.push('Hume EVI config setup had failures (see steps for details)');\n }\n }\n\n // Start Docker containers if requested\n if (startDocker) {\n // Check for Traefik\n if (workspaceConfig.docker?.traefik) {\n const traefikPath = join(projectConfig.path, workspaceConfig.docker.traefik);\n if (existsSync(traefikPath)) {\n try {\n await execAsync(`docker compose -f \"${traefikPath}\" up -d`, { cwd: projectConfig.path });\n result.steps.push('Started Traefik');\n } catch (error: any) {\n const msg = error?.message || String(error);\n if (msg.includes('port is already allocated') || msg.includes('address already in use')) {\n // Traefik (or another reverse proxy) is already running — not an error\n result.steps.push('Traefik already running (port in use)');\n } else {\n result.errors.push(`Failed to start Traefik: ${error}`);\n }\n }\n }\n }\n\n // Start workspace containers\n const composeLocations = [\n join(workspacePath, 'docker-compose.yml'),\n join(workspacePath, 'docker-compose.yaml'),\n join(workspacePath, '.devcontainer', 'docker-compose.yml'),\n join(workspacePath, '.devcontainer', 'docker-compose.devcontainer.yml'),\n ];\n\n for (const composePath of composeLocations) {\n if (existsSync(composePath)) {\n try {\n // Don't pass -p: the compose file's `name:` field is the authority.\n // Passing -p with a different value creates a second Docker project\n // on container restart, splitting services onto separate networks.\n await execAsync(`docker compose -f \"${composePath}\" up -d --build`, { cwd: dirname(composePath), timeout: 300000 });\n result.steps.push(`Started containers from ${basename(composePath)}`);\n } catch (error) {\n result.errors.push(`Failed to start containers: ${error}`);\n }\n break;\n }\n }\n }\n\n // Pre-trust workspace directory in Claude Code so agents don't get the trust prompt\n try {\n preTrustDirectory(workspacePath);\n result.steps.push('Pre-trusted workspace in Claude Code');\n } catch {\n // Non-fatal — agent can still work, user will just see trust prompt\n }\n\n result.success = result.errors.length === 0;\n return result;\n}\n\n/**\n * Pre-register a directory as trusted in Claude Code's ~/.claude.json.\n * This prevents the \"Quick safety check: Is this a project you created or one you trust?\" prompt\n * when agents are spawned in dynamically-created workspace directories.\n */\nexport function preTrustDirectory(dirPath: string): void {\n const claudeJsonPath = join(homedir(), '.claude.json');\n if (!existsSync(claudeJsonPath)) return;\n\n const data = JSON.parse(readFileSync(claudeJsonPath, 'utf8'));\n if (!data.projects) data.projects = {};\n\n // Only add if not already present\n if (data.projects[dirPath]) {\n if (!data.projects[dirPath].hasTrustDialogAccepted) {\n data.projects[dirPath].hasTrustDialogAccepted = true;\n writeFileSync(claudeJsonPath, JSON.stringify(data, null, 2), 'utf8');\n }\n return;\n }\n\n data.projects[dirPath] = {\n allowedTools: [],\n mcpContextUris: [],\n mcpServers: {},\n enabledMcpjsonServers: [],\n disabledMcpjsonServers: [],\n hasTrustDialogAccepted: true,\n projectOnboardingSeenCount: 0,\n hasClaudeMdExternalIncludesApproved: false,\n hasClaudeMdExternalIncludesWarningShown: false,\n };\n\n writeFileSync(claudeJsonPath, JSON.stringify(data, null, 2), 'utf8');\n}\n\nexport interface WorkspaceRemoveOptions {\n projectConfig: ProjectConfig;\n featureName: string;\n dryRun?: boolean;\n}\n\nexport interface WorkspaceRemoveResult {\n success: boolean;\n errors: string[];\n steps: string[];\n}\n\n/**\n * Result of Docker container cleanup for a workspace.\n */\nexport interface DockerCleanupResult {\n /** Whether compose files were found (containers may or may not have been running) */\n containersFound: boolean;\n /** Human-readable log of cleanup steps taken */\n steps: string[];\n}\n\n/**\n * Stop Docker containers and clean up Docker-created files for a workspace.\n *\n * Extracted as a standalone function so it can be used by:\n * - removeWorkspace() during normal workspace removal\n * - deep-wipe endpoint for complete issue cleanup\n * - workspace-migrate for pre-migration cleanup\n *\n * Failures are logged but never thrown — callers should not fail if Docker is unavailable.\n */\nexport async function stopWorkspaceDocker(\n workspacePath: string,\n projectName: string,\n featureName: string,\n): Promise<DockerCleanupResult> {\n const result: DockerCleanupResult = {\n containersFound: false,\n steps: [],\n };\n\n // Find all compose files in devcontainer directory (some projects use multiple)\n const devcontainerDir = join(workspacePath, '.devcontainer');\n const composeFiles: string[] = [];\n\n if (existsSync(devcontainerDir)) {\n const possibleFiles = [\n 'docker-compose.devcontainer.yml',\n 'docker-compose.yml',\n 'compose.yml',\n 'compose.infra.yml',\n 'compose.override.yml',\n ];\n for (const file of possibleFiles) {\n const fullPath = join(devcontainerDir, file);\n if (existsSync(fullPath)) {\n composeFiles.push(fullPath);\n }\n }\n }\n\n // Fallback: check for compose file in workspace root\n if (composeFiles.length === 0) {\n const rootCompose = join(workspacePath, 'docker-compose.yml');\n if (existsSync(rootCompose)) {\n composeFiles.push(rootCompose);\n }\n }\n\n if (composeFiles.length > 0) {\n result.containersFound = true;\n try {\n const fileFlags = composeFiles.map(f => `-f \"${f}\"`).join(' ');\n const cwd = existsSync(devcontainerDir) ? devcontainerDir : workspacePath;\n\n // Don't pass -p: let the compose file's `name:` field determine the project.\n // This must match what was used at startup to target the correct containers.\n await execAsync(`docker compose ${fileFlags} down -v --remove-orphans`, {\n cwd,\n timeout: 60000,\n });\n result.steps.push(`Stopped Docker containers (${composeFiles.length} compose files)`);\n } catch (error: any) {\n // Log but don't fail — containers might not be running\n result.steps.push(`Docker cleanup attempted (${error.message?.split('\\n')[0] || 'containers may not be running'})`);\n }\n }\n\n // Clean up Docker-created files (root-owned in containers)\n try {\n await execAsync(\n `docker run --rm -v \"${workspacePath}:/workspace\" alpine sh -c \"find /workspace -user root -delete 2>&1 | tail -100 || true\"`,\n { timeout: 30000, maxBuffer: 10 * 1024 * 1024 }\n );\n result.steps.push('Cleaned up Docker-created files');\n } catch {\n // Alpine container might not be available\n }\n\n return result;\n}\n\n/**\n * Remove a workspace\n */\nexport async function removeWorkspace(options: WorkspaceRemoveOptions): Promise<WorkspaceRemoveResult> {\n const { projectConfig, featureName, dryRun } = options;\n const result: WorkspaceRemoveResult = {\n success: true,\n errors: [],\n steps: [],\n };\n\n const workspaceConfig = projectConfig.workspace || getDefaultWorkspaceConfig();\n const workspacesDir = join(projectConfig.path, workspaceConfig.workspaces_dir || 'workspaces');\n const featureFolder = `feature-${featureName}`;\n const workspacePath = join(workspacesDir, featureFolder);\n\n if (!existsSync(workspacePath)) {\n result.success = false;\n result.errors.push(`Workspace not found at ${workspacePath}`);\n return result;\n }\n\n if (dryRun) {\n result.steps.push('[DRY RUN] Would remove workspace at: ' + workspacePath);\n return result;\n }\n\n // Stop TLDR daemon for workspace (if it exists)\n const venvPath = join(workspacePath, '.venv');\n if (existsSync(venvPath)) {\n try {\n const { getTldrDaemonService } = await import('./tldr-daemon.js');\n const tldrService = getTldrDaemonService(workspacePath, venvPath);\n await tldrService.stop();\n result.steps.push('Stopped TLDR daemon');\n } catch (error: any) {\n // Non-fatal - daemon may not be running\n console.warn(`⚠ Failed to stop TLDR daemon: ${error?.message}`);\n }\n }\n\n // Stop Docker containers and clean up Docker-created files\n const dockerResult = await stopWorkspaceDocker(workspacePath, projectConfig.name || 'workspace', featureName);\n result.steps.push(...dockerResult.steps);\n\n // Remove worktrees\n if (workspaceConfig.type === 'polyrepo' && workspaceConfig.repos) {\n for (const repo of workspaceConfig.repos) {\n const repoPath = join(projectConfig.path, repo.path);\n const targetPath = join(workspacePath, repo.name);\n const branchPrefix = repo.branch_prefix || 'feature/';\n const branchName = `${branchPrefix}${featureName}`;\n\n const worktreeResult = await removeWorktree(repoPath, targetPath, branchName);\n if (worktreeResult.success) {\n result.steps.push(`Removed worktree for ${repo.name}`);\n } else {\n result.errors.push(worktreeResult.message);\n }\n }\n } else {\n // Monorepo: remove single worktree\n const branchName = `feature/${featureName}`;\n const worktreeResult = await removeWorktree(projectConfig.path, workspacePath, branchName);\n if (worktreeResult.success) {\n result.steps.push('Removed worktree');\n } else {\n result.errors.push(worktreeResult.message);\n }\n }\n\n // Remove DNS entries\n if (workspaceConfig.dns) {\n const placeholders = createPlaceholders(projectConfig, featureName, workspacePath);\n\n const dnsMethod = workspaceConfig.dns.sync_method || 'wsl2hosts';\n for (const entryPattern of workspaceConfig.dns.entries) {\n const hostname = replacePlaceholders(entryPattern, placeholders);\n if (removeDnsEntry(dnsMethod, hostname)) {\n result.steps.push(`Removed DNS entry: ${hostname}`);\n }\n }\n }\n\n // Remove Cloudflare tunnel entries\n if (workspaceConfig.tunnel) {\n const placeholders = createPlaceholders(projectConfig, featureName, workspacePath);\n const tunnelResult = await removeTunnelIngress(workspaceConfig.tunnel, placeholders);\n result.steps.push(...tunnelResult.steps);\n }\n\n // Remove Hume EVI config\n if (workspaceConfig.hume) {\n const placeholders = createPlaceholders(projectConfig, featureName, workspacePath);\n const humeResult = await deleteHumeConfig(workspaceConfig.hume, placeholders);\n result.steps.push(...humeResult.steps);\n }\n\n // Release ports\n if (workspaceConfig.ports) {\n for (const [portName] of Object.entries(workspaceConfig.ports)) {\n const portFile = join(projectConfig.path, `.${portName}-ports`);\n if (releasePort(portFile, featureFolder)) {\n result.steps.push(`Released ${portName} port`);\n }\n }\n }\n\n // Remove workspace directory\n try {\n await execAsync(`rm -rf \"${workspacePath}\"`, { maxBuffer: 10 * 1024 * 1024 });\n result.steps.push('Removed workspace directory');\n } catch (error) {\n result.errors.push(`Failed to remove workspace directory: ${error}`);\n }\n\n result.success = result.errors.length === 0;\n return result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,EACE;AAAA,EAC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