cc-workspace 4.4.0 → 4.5.1
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 +59 -8
- package/bin/cli.js +9 -3
- package/global-skills/agents/e2e-validator.md +58 -296
- package/global-skills/agents/implementer.md +51 -64
- package/global-skills/agents/team-lead.md +103 -186
- package/global-skills/cleanup/SKILL.md +94 -0
- package/global-skills/dispatch-feature/SKILL.md +20 -22
- package/global-skills/dispatch-feature/references/spawn-templates.md +49 -89
- package/global-skills/doctor/SKILL.md +90 -0
- package/global-skills/hooks/session-start-context.sh +38 -7
- package/global-skills/session/SKILL.md +79 -0
- package/package.json +1 -1
|
@@ -167,34 +167,32 @@ For each service in the current wave:
|
|
|
167
167
|
**Cross-service parallelism**: Different services within the same wave can
|
|
168
168
|
progress in parallel. Use parallel Task calls when possible.
|
|
169
169
|
|
|
170
|
-
### Implementer spawn prompt —
|
|
170
|
+
### Implementer spawn prompt — context tiering
|
|
171
171
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
3. **Constitution rules** from constitution.md (translated to English)
|
|
175
|
-
4. **API contract** (if this commit involves API endpoints)
|
|
176
|
-
5. **Repo path** and **session branch**: `session/{name}`
|
|
177
|
-
6. **Previous context**: "Commits 1-2 are already on the branch (data layer + business logic).
|
|
178
|
-
You handle Commit 3: API layer. Do NOT redo earlier work."
|
|
179
|
-
7. Instruction to read repo CLAUDE.md first
|
|
180
|
-
8. Instruction to escalate if hitting an architectural decision not in the plan
|
|
172
|
+
The implementer agent already knows its git workflow, commit protocol, and cleanup
|
|
173
|
+
procedure. Do NOT repeat these in spawn prompts. Only provide specific values and context.
|
|
181
174
|
|
|
182
|
-
|
|
175
|
+
**Always include (Tier 1):**
|
|
176
|
+
1. Which commit unit: "Commit N of M for service X"
|
|
177
|
+
2. Tasks for this commit only (NOT the whole plan)
|
|
178
|
+
3. Constitution rules from constitution.md (translated to English)
|
|
179
|
+
4. Repo path + session branch: `session/{name}`
|
|
180
|
+
5. Previous context: "Commits 1..N-1 are on the branch. Do NOT redo."
|
|
183
181
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
182
|
+
**Conditional (Tier 2):**
|
|
183
|
+
- **Frontend commits with UI**: UX standards (from `references/frontend-ux-standards.md`)
|
|
184
|
+
- **API commits**: API contract shapes (exact request/response)
|
|
185
|
+
- **Frontend commits**: API contract as TypeScript interfaces
|
|
188
186
|
|
|
189
|
-
|
|
190
|
-
-
|
|
191
|
-
-
|
|
187
|
+
**Never inject (Tier 3 — already in repo CLAUDE.md or agent instructions):**
|
|
188
|
+
- Anti-patterns list (implementer reads CLAUDE.md)
|
|
189
|
+
- Git workflow procedure (implementer agent already knows)
|
|
190
|
+
- Full workspace context (implementer doesn't need it)
|
|
192
191
|
|
|
193
|
-
|
|
192
|
+
See @references/spawn-templates.md for templates per service type.
|
|
194
193
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
- Note that frontend will build types from these shapes
|
|
194
|
+
> **Constitution in spawn prompts**: Implementers do NOT receive the constitution
|
|
195
|
+
> automatically. You MUST include ALL rules from constitution.md in every spawn prompt.
|
|
198
196
|
|
|
199
197
|
### Isolation
|
|
200
198
|
|
|
@@ -8,35 +8,36 @@ Reference file for dispatch-feature. Loaded on-demand, not at skill activation.
|
|
|
8
8
|
> template below includes a "Constitution" section that you MUST fill with
|
|
9
9
|
> all rules from your workspace's `constitution.md`.
|
|
10
10
|
|
|
11
|
+
## Context tiering — what to inject per commit type
|
|
12
|
+
|
|
13
|
+
| Context | Backend commits | Frontend commits | Infra commits |
|
|
14
|
+
|---------|:-:|:-:|:-:|
|
|
15
|
+
| Constitution rules | ALWAYS | ALWAYS | ALWAYS |
|
|
16
|
+
| Commit unit tasks | ALWAYS | ALWAYS | ALWAYS |
|
|
17
|
+
| Repo path + session branch | ALWAYS | ALWAYS | ALWAYS |
|
|
18
|
+
| Previous commits summary | ALWAYS | ALWAYS | ALWAYS |
|
|
19
|
+
| API contract shapes | If API commit | ALWAYS (TypeScript) | Never |
|
|
20
|
+
| UX standards | Never | If UI commit | Never |
|
|
21
|
+
| Anti-patterns | Never (read CLAUDE.md) | Never (read CLAUDE.md) | Never |
|
|
22
|
+
|
|
23
|
+
> **Deduplication note**: The implementer agent already knows its git workflow
|
|
24
|
+
> (worktree creation, commit protocol, cleanup). Do NOT repeat the full git
|
|
25
|
+
> procedure in spawn prompts. Only provide the SPECIFIC values: repo path,
|
|
26
|
+
> session branch name, and source branch (if branch may not exist yet).
|
|
27
|
+
|
|
11
28
|
## Backend/API implementer spawn template
|
|
12
29
|
|
|
13
30
|
```
|
|
14
31
|
You are implementer for [service], handling Commit [N] of [total]: [commit title].
|
|
15
32
|
Commits 1 to [N-1] are already on the session branch. Do NOT redo earlier work.
|
|
16
33
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
when the worktree is cleaned up.
|
|
22
|
-
|
|
23
|
-
CRITICAL: Do NOT run `git checkout` in the main repo. Do NOT use `git -C ../repo checkout`.
|
|
24
|
-
You are already in an isolated worktree — all git commands run HERE, not in the main repo.
|
|
25
|
-
|
|
26
|
-
1. FIRST THING: Switch to the session branch inside your worktree:
|
|
27
|
-
git checkout session/{session-name}
|
|
28
|
-
(This is safe — you are in a worktree, not the main repo)
|
|
29
|
-
2. Verify you are on the right branch:
|
|
30
|
-
git branch --show-current (must show: session/{session-name})
|
|
31
|
-
3. If checkout fails with "did not match any file(s)":
|
|
32
|
-
git fetch origin session/{session-name}
|
|
33
|
-
git checkout session/{session-name}
|
|
34
|
-
4. Check existing commits: git log --oneline -5
|
|
35
|
-
|
|
36
|
-
Branch `session/{session-name}` ALREADY EXISTS. Do NOT create other branches.
|
|
34
|
+
## Repo & branch
|
|
35
|
+
- Repo: ../[service]
|
|
36
|
+
- Session branch: session/[session-name]
|
|
37
|
+
- Source branch: [source-branch] (only if branch may need creation)
|
|
37
38
|
|
|
38
39
|
## Constitution (non-negotiable)
|
|
39
|
-
[paste all rules from your workspace's constitution.md]
|
|
40
|
+
[paste all rules from your workspace's constitution.md, translated to English]
|
|
40
41
|
|
|
41
42
|
## API contract
|
|
42
43
|
[paste the exact request/response shapes relevant to THIS commit]
|
|
@@ -51,16 +52,13 @@ Branch `session/{session-name}` ALREADY EXISTS. Do NOT create other branches.
|
|
|
51
52
|
## Instructions
|
|
52
53
|
1. Read the repo CLAUDE.md first — follow its conventions
|
|
53
54
|
2. Implement ONLY the tasks above — do not touch code from earlier commits
|
|
54
|
-
3.
|
|
55
|
-
4.
|
|
56
|
-
5.
|
|
57
|
-
6. If your changes exceed ~300 lines, split into multiple commits
|
|
55
|
+
3. Run the existing test suite — report pass/fail
|
|
56
|
+
4. List any dead code created or exposed by your changes
|
|
57
|
+
5. If your changes exceed ~300 lines, split into multiple commits
|
|
58
58
|
(data → logic → API layer), each compilable
|
|
59
|
-
|
|
59
|
+
6. If you hit an architectural decision NOT covered by the plan: STOP and
|
|
60
60
|
report the dilemma instead of guessing
|
|
61
|
-
|
|
62
|
-
(your commit must appear)
|
|
63
|
-
9. Report back: commit hash + message, files created/modified, tests pass/fail,
|
|
61
|
+
7. Report back: commit hash + message, files created/modified, tests pass/fail,
|
|
64
62
|
dead code found, blockers
|
|
65
63
|
```
|
|
66
64
|
|
|
@@ -70,32 +68,15 @@ Branch `session/{session-name}` ALREADY EXISTS. Do NOT create other branches.
|
|
|
70
68
|
You are implementer for [service], handling Commit [N] of [total]: [commit title].
|
|
71
69
|
Commits 1 to [N-1] are already on the session branch. Do NOT redo earlier work.
|
|
72
70
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
You are working in a temporary worktree. If you don't commit, YOUR WORK WILL BE LOST
|
|
77
|
-
when the worktree is cleaned up.
|
|
78
|
-
|
|
79
|
-
CRITICAL: Do NOT run `git checkout` in the main repo. Do NOT use `git -C ../repo checkout`.
|
|
80
|
-
You are already in an isolated worktree — all git commands run HERE, not in the main repo.
|
|
81
|
-
|
|
82
|
-
1. FIRST THING: Switch to the session branch inside your worktree:
|
|
83
|
-
git checkout session/{session-name}
|
|
84
|
-
(This is safe — you are in a worktree, not the main repo)
|
|
85
|
-
2. Verify you are on the right branch:
|
|
86
|
-
git branch --show-current (must show: session/{session-name})
|
|
87
|
-
3. If checkout fails with "did not match any file(s)":
|
|
88
|
-
git fetch origin session/{session-name}
|
|
89
|
-
git checkout session/{session-name}
|
|
90
|
-
4. Check existing commits: git log --oneline -5
|
|
91
|
-
|
|
92
|
-
Branch `session/{session-name}` ALREADY EXISTS. Do NOT create other branches.
|
|
71
|
+
## Repo & branch
|
|
72
|
+
- Repo: ../[service]
|
|
73
|
+
- Session branch: session/[session-name]
|
|
93
74
|
|
|
94
75
|
## Constitution (non-negotiable)
|
|
95
|
-
[paste all rules from your workspace's constitution.md]
|
|
76
|
+
[paste all rules from your workspace's constitution.md, translated to English]
|
|
96
77
|
|
|
97
|
-
## UX Standards (non-negotiable)
|
|
98
|
-
[paste full content of frontend-ux-standards.md
|
|
78
|
+
## UX Standards (non-negotiable — only if this commit involves UI components)
|
|
79
|
+
[paste full content of frontend-ux-standards.md]
|
|
99
80
|
|
|
100
81
|
## API contract (TypeScript interfaces)
|
|
101
82
|
[paste exact response shapes relevant to THIS commit]
|
|
@@ -109,17 +90,14 @@ Branch `session/{session-name}` ALREADY EXISTS. Do NOT create other branches.
|
|
|
109
90
|
## Instructions
|
|
110
91
|
1. Read the repo CLAUDE.md first — follow its conventions
|
|
111
92
|
2. Implement ONLY the tasks above — do not touch code from earlier commits
|
|
112
|
-
3.
|
|
113
|
-
4.
|
|
114
|
-
5.
|
|
115
|
-
6.
|
|
116
|
-
7. If your changes exceed ~300 lines, split into multiple commits
|
|
93
|
+
3. If this commit adds components: MUST handle 4 states (skeleton, empty+CTA, error+retry, success)
|
|
94
|
+
4. Run the existing test suite — report pass/fail
|
|
95
|
+
5. List any dead code (unused components, composables, store actions, CSS)
|
|
96
|
+
6. If your changes exceed ~300 lines, split into multiple commits
|
|
117
97
|
(types → store → components → pages), each compilable
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
10. Report back: commit hash + message, files created/modified, tests pass/fail,
|
|
122
|
-
dead code found, UX compliance, blockers
|
|
98
|
+
7. If you hit an architectural decision NOT covered by the plan: STOP and escalate
|
|
99
|
+
8. Report back: commit hash + message, files created/modified, tests pass/fail,
|
|
100
|
+
dead code found, UX compliance, blockers
|
|
123
101
|
```
|
|
124
102
|
|
|
125
103
|
## Infra/Config implementer spawn template
|
|
@@ -128,29 +106,12 @@ Branch `session/{session-name}` ALREADY EXISTS. Do NOT create other branches.
|
|
|
128
106
|
You are implementer for [service], handling Commit [N] of [total]: [commit title].
|
|
129
107
|
Commits 1 to [N-1] are already on the session branch. Do NOT redo earlier work.
|
|
130
108
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
You are working in a temporary worktree. If you don't commit, YOUR WORK WILL BE LOST
|
|
135
|
-
when the worktree is cleaned up.
|
|
136
|
-
|
|
137
|
-
CRITICAL: Do NOT run `git checkout` in the main repo. Do NOT use `git -C ../repo checkout`.
|
|
138
|
-
You are already in an isolated worktree — all git commands run HERE, not in the main repo.
|
|
139
|
-
|
|
140
|
-
1. FIRST THING: Switch to the session branch inside your worktree:
|
|
141
|
-
git checkout session/{session-name}
|
|
142
|
-
(This is safe — you are in a worktree, not the main repo)
|
|
143
|
-
2. Verify you are on the right branch:
|
|
144
|
-
git branch --show-current (must show: session/{session-name})
|
|
145
|
-
3. If checkout fails with "did not match any file(s)":
|
|
146
|
-
git fetch origin session/{session-name}
|
|
147
|
-
git checkout session/{session-name}
|
|
148
|
-
4. Check existing commits: git log --oneline -5
|
|
149
|
-
|
|
150
|
-
Branch `session/{session-name}` ALREADY EXISTS. Do NOT create other branches.
|
|
109
|
+
## Repo & branch
|
|
110
|
+
- Repo: ../[service]
|
|
111
|
+
- Session branch: session/[session-name]
|
|
151
112
|
|
|
152
113
|
## Constitution (non-negotiable)
|
|
153
|
-
[paste all rules from your workspace's constitution.md]
|
|
114
|
+
[paste all rules from your workspace's constitution.md, translated to English]
|
|
154
115
|
|
|
155
116
|
## Your single commit unit
|
|
156
117
|
[paste ONLY the tasks for this commit — typically gateway routes, configs, env vars]
|
|
@@ -165,9 +126,7 @@ Branch `session/{session-name}` ALREADY EXISTS. Do NOT create other branches.
|
|
|
165
126
|
4. No application code changes — only configuration
|
|
166
127
|
5. Commit message format: `chore(service): description`
|
|
167
128
|
6. If you hit an architectural decision NOT covered by the plan: STOP and escalate
|
|
168
|
-
7.
|
|
169
|
-
(your commit must appear)
|
|
170
|
-
8. Report back: commit hash + message, files modified, consistency check results, blockers
|
|
129
|
+
7. Report back: commit hash + message, files modified, consistency check results, blockers
|
|
171
130
|
```
|
|
172
131
|
|
|
173
132
|
## Explore/Haiku subagent template (read-only)
|
|
@@ -189,7 +148,8 @@ You are an explorer scanning [target]. Read-only — do NOT modify any files.
|
|
|
189
148
|
When an implementer reports back:
|
|
190
149
|
- **Test regression or missing file** (recoverable): fix commit unit description, re-dispatch ONCE
|
|
191
150
|
- **Architectural decision not in plan** (blocking): STOP the wave, escalate to user
|
|
192
|
-
- **No commit in report**:
|
|
193
|
-
|
|
194
|
-
- **Max re-dispatches per commit unit**: 2. After that,
|
|
151
|
+
- **No commit in report**: verify on session branch with a Task subagent.
|
|
152
|
+
If no commit exists, re-dispatch with emphasis on committing.
|
|
153
|
+
- **Max re-dispatches per commit unit**: 2. After that → mark ❌ ESCALATED, stop the wave.
|
|
195
154
|
- **Giant commit (>400 lines)**: note in session log, consider splitting in future plans
|
|
155
|
+
- **Corrupted branch**: use rollback protocol (see team-lead agent instructions)
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: doctor
|
|
3
|
+
description: >
|
|
4
|
+
Full diagnostic of the orchestrator workspace installation. Checks global
|
|
5
|
+
components (skills, rules, agents), local structure (hooks, settings,
|
|
6
|
+
workspace.md), and repo health (CLAUDE.md, test frameworks).
|
|
7
|
+
Use: /doctor
|
|
8
|
+
argument-hint: ""
|
|
9
|
+
context: fork
|
|
10
|
+
model: haiku
|
|
11
|
+
allowed-tools: Bash, Read, Glob, Grep
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# Doctor — Workspace Diagnostic
|
|
15
|
+
|
|
16
|
+
Run a comprehensive health check of the orchestrator installation.
|
|
17
|
+
|
|
18
|
+
## Checks to perform
|
|
19
|
+
|
|
20
|
+
### 1. Global components (~/.claude/)
|
|
21
|
+
```bash
|
|
22
|
+
# Version
|
|
23
|
+
cat ~/.claude/.orchestrator-version 2>/dev/null || echo "NOT INSTALLED"
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Check existence of:
|
|
27
|
+
- `~/.claude/skills/` — count skill directories (expect 10+)
|
|
28
|
+
- `~/.claude/rules/context-hygiene.md`
|
|
29
|
+
- `~/.claude/rules/model-routing.md`
|
|
30
|
+
- `~/.claude/agents/team-lead.md`
|
|
31
|
+
- `~/.claude/agents/implementer.md`
|
|
32
|
+
- `~/.claude/agents/workspace-init.md`
|
|
33
|
+
- `~/.claude/agents/e2e-validator.md`
|
|
34
|
+
|
|
35
|
+
### 2. Local orchestrator structure
|
|
36
|
+
Find orchestrator dir (./workspace.md or ./orchestrator/workspace.md).
|
|
37
|
+
|
|
38
|
+
Check:
|
|
39
|
+
- `workspace.md` exists and is configured (no `[UNCONFIGURED]`)
|
|
40
|
+
- `constitution.md` exists and has rules
|
|
41
|
+
- `plans/` directory exists
|
|
42
|
+
- `plans/_TEMPLATE.md` exists
|
|
43
|
+
- `templates/` directory exists
|
|
44
|
+
- `.claude/settings.json` exists and has hooks config
|
|
45
|
+
- `.claude/hooks/` — count .sh files, verify executable permissions
|
|
46
|
+
- `.sessions/` directory exists
|
|
47
|
+
- `e2e/` directory exists
|
|
48
|
+
|
|
49
|
+
### 3. Dependencies
|
|
50
|
+
```bash
|
|
51
|
+
jq --version 2>/dev/null || echo "MISSING"
|
|
52
|
+
git --version 2>/dev/null || echo "MISSING"
|
|
53
|
+
docker compose version 2>/dev/null || echo "MISSING (optional, for E2E)"
|
|
54
|
+
gh --version 2>/dev/null || echo "MISSING (optional, for PRs)"
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### 4. Sibling repos health
|
|
58
|
+
For each directory in `../` with `.git/`:
|
|
59
|
+
- Has CLAUDE.md? (yes/no)
|
|
60
|
+
- Has `.claude/settings.json`? (yes/no)
|
|
61
|
+
- Detected type (package.json → Vue/React/Node, composer.json → PHP, etc.)
|
|
62
|
+
- Has test config? (vitest.config.*, phpunit.xml, pytest.ini, etc.)
|
|
63
|
+
- Stale worktrees? `git worktree list` — flag any in /tmp/
|
|
64
|
+
|
|
65
|
+
### 5. Orphan worktrees
|
|
66
|
+
```bash
|
|
67
|
+
# Check for stale /tmp/ worktrees
|
|
68
|
+
ls -d /tmp/*-session-* /tmp/e2e-* 2>/dev/null
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Output format
|
|
72
|
+
|
|
73
|
+
Present results as a markdown table:
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
| Check | Status | Detail |
|
|
77
|
+
|-------|--------|--------|
|
|
78
|
+
| Installed version | ✅ | v4.5.0 |
|
|
79
|
+
| Skills (12/10) | ✅ | |
|
|
80
|
+
| workspace.md | ✅ | Configured |
|
|
81
|
+
| jq | ✅ | jq-1.7 |
|
|
82
|
+
| docker | ⚠️ | Not installed (optional) |
|
|
83
|
+
| repo: api | ✅ | PHP/Laravel, CLAUDE.md ✓ |
|
|
84
|
+
| repo: front | ⚠️ | Vue/Quasar, CLAUDE.md ✗ |
|
|
85
|
+
| Orphan worktrees | ✅ | None |
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
End with:
|
|
89
|
+
- If all OK: "All checks passed."
|
|
90
|
+
- If issues: list recommended fixes.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
# session-start-context.sh
|
|
3
|
-
# SessionStart hook: injects active plan context and
|
|
3
|
+
# SessionStart hook: injects active plan context, repo status, and cleans orphan worktrees.
|
|
4
4
|
# Stdout on exit 0 is added as context visible to Claude.
|
|
5
5
|
set -euo pipefail
|
|
6
6
|
|
|
@@ -8,7 +8,39 @@ cat > /dev/null
|
|
|
8
8
|
PROJECT_DIR="${CLAUDE_PROJECT_DIR:-.}"
|
|
9
9
|
OUTPUT=""
|
|
10
10
|
|
|
11
|
-
#
|
|
11
|
+
# ── Orphan worktree cleanup ──────────────────────────────────
|
|
12
|
+
# Clean /tmp/ worktrees that were left behind by crashed implementers.
|
|
13
|
+
# These are safe to remove: they're temporary by design.
|
|
14
|
+
ORPHAN_COUNT=0
|
|
15
|
+
for wt in /tmp/*-session-* /tmp/e2e-* 2>/dev/null; do
|
|
16
|
+
[ -d "$wt" ] || continue
|
|
17
|
+
# Check if the worktree is registered with any repo
|
|
18
|
+
REPO_FOUND=0
|
|
19
|
+
PARENT_DIR="$(cd "$PROJECT_DIR/.." 2>/dev/null && pwd)" || continue
|
|
20
|
+
for repo_dir in "$PARENT_DIR"/*/; do
|
|
21
|
+
[ -d "$repo_dir/.git" ] || continue
|
|
22
|
+
if git -C "$repo_dir" worktree list 2>/dev/null | grep -q "$wt"; then
|
|
23
|
+
# Worktree is registered — check if it's stale (no git lock, no recent activity)
|
|
24
|
+
if [ ! -f "$wt/.git" ]; then
|
|
25
|
+
# Not a valid worktree anymore — remove registration
|
|
26
|
+
git -C "$repo_dir" worktree remove "$wt" --force 2>/dev/null && ORPHAN_COUNT=$((ORPHAN_COUNT + 1))
|
|
27
|
+
REPO_FOUND=1
|
|
28
|
+
break
|
|
29
|
+
fi
|
|
30
|
+
REPO_FOUND=1
|
|
31
|
+
break
|
|
32
|
+
fi
|
|
33
|
+
done
|
|
34
|
+
if [ "$REPO_FOUND" -eq 0 ] && [ -d "$wt/.git" ] || [ -f "$wt/.git" ]; then
|
|
35
|
+
# Unregistered worktree directory — likely a crash remnant. Remove it.
|
|
36
|
+
rm -rf "$wt" 2>/dev/null && ORPHAN_COUNT=$((ORPHAN_COUNT + 1))
|
|
37
|
+
fi
|
|
38
|
+
done
|
|
39
|
+
if [ "$ORPHAN_COUNT" -gt 0 ]; then
|
|
40
|
+
OUTPUT+="[Cleanup] Removed $ORPHAN_COUNT orphan worktree(s) from /tmp/.\n"
|
|
41
|
+
fi
|
|
42
|
+
|
|
43
|
+
# ── Active plans ─────────────────────────────────────────────
|
|
12
44
|
if [ -d "$PROJECT_DIR/plans" ]; then
|
|
13
45
|
ACTIVE_PLANS=$(find "$PROJECT_DIR/plans" -name '*.md' \
|
|
14
46
|
! -name '_TEMPLATE.md' \
|
|
@@ -29,14 +61,13 @@ if [ -d "$PROJECT_DIR/plans" ]; then
|
|
|
29
61
|
done <<< "$ACTIVE_PLANS"
|
|
30
62
|
OUTPUT+="\nRead these plans to resume where you left off.\n"
|
|
31
63
|
|
|
32
|
-
# Export active plan name to Claude's environment if supported
|
|
33
64
|
if [ -n "${CLAUDE_ENV_FILE:-}" ] && [ -n "$FIRST_PLAN" ]; then
|
|
34
65
|
echo "ACTIVE_PLAN=$FIRST_PLAN" >> "$CLAUDE_ENV_FILE"
|
|
35
66
|
fi
|
|
36
67
|
fi
|
|
37
68
|
fi
|
|
38
69
|
|
|
39
|
-
#
|
|
70
|
+
# ── Active sessions ──────────────────────────────────────────
|
|
40
71
|
SESSIONS_DIR="$PROJECT_DIR/.sessions"
|
|
41
72
|
if [ -d "$SESSIONS_DIR" ]; then
|
|
42
73
|
ACTIVE_SESSIONS=""
|
|
@@ -54,12 +85,12 @@ if [ -d "$SESSIONS_DIR" ]; then
|
|
|
54
85
|
fi
|
|
55
86
|
fi
|
|
56
87
|
|
|
57
|
-
#
|
|
88
|
+
# ── Workspace check ──────────────────────────────────────────
|
|
58
89
|
if [ ! -f "$PROJECT_DIR/workspace.md" ]; then
|
|
59
90
|
OUTPUT+="[WARNING] No workspace.md found. Run setup-workspace.sh first.\n"
|
|
60
91
|
fi
|
|
61
92
|
|
|
62
|
-
# First-session detection
|
|
93
|
+
# ── First-session detection ──────────────────────────────────
|
|
63
94
|
if [ -f "$PROJECT_DIR/workspace.md" ]; then
|
|
64
95
|
if grep -q '\[UNCONFIGURED\]' "$PROJECT_DIR/workspace.md" 2>/dev/null; then
|
|
65
96
|
OUTPUT+="[FIRST SESSION] workspace.md is not yet configured. Run: claude --agent workspace-init\n"
|
|
@@ -77,7 +108,7 @@ if [ -f "$PROJECT_DIR/workspace.md" ]; then
|
|
|
77
108
|
fi
|
|
78
109
|
fi
|
|
79
110
|
|
|
80
|
-
# Auto-discovery:
|
|
111
|
+
# ── Auto-discovery: new repos ────────────────────────────────
|
|
81
112
|
if [ -f "$PROJECT_DIR/workspace.md" ] && ! grep -q '\[UNCONFIGURED\]' "$PROJECT_DIR/workspace.md" 2>/dev/null; then
|
|
82
113
|
PARENT_DIR="$(cd "$PROJECT_DIR/.." 2>/dev/null && pwd)"
|
|
83
114
|
NEW_REPOS=""
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: session
|
|
3
|
+
description: >
|
|
4
|
+
Manage parallel feature sessions. List active sessions, show detailed status
|
|
5
|
+
with commits per repo, or close a session (PRs + branch cleanup).
|
|
6
|
+
Use: /session, /session status <name>, /session close <name>.
|
|
7
|
+
argument-hint: "[list | status <name> | close <name>]"
|
|
8
|
+
context: fork
|
|
9
|
+
allowed-tools: Bash, Read, Glob, Grep
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# Session Manager
|
|
13
|
+
|
|
14
|
+
You manage parallel feature sessions from the orchestrator.
|
|
15
|
+
|
|
16
|
+
## Detect context
|
|
17
|
+
|
|
18
|
+
1. Find the orchestrator directory:
|
|
19
|
+
- If `./workspace.md` exists → you're in orchestrator/
|
|
20
|
+
- If `../orchestrator/workspace.md` exists → orchestrator is at `../orchestrator/`
|
|
21
|
+
- Otherwise → error: "No orchestrator found. Run from orchestrator/ or its parent."
|
|
22
|
+
|
|
23
|
+
2. Read `.sessions/*.json` files to list sessions.
|
|
24
|
+
|
|
25
|
+
## Commands
|
|
26
|
+
|
|
27
|
+
### /session (no args) or /session list
|
|
28
|
+
List all sessions with their status:
|
|
29
|
+
```
|
|
30
|
+
For each .sessions/*.json:
|
|
31
|
+
- Name, status (active/closed), created date
|
|
32
|
+
- For each repo: session branch, branch_created status
|
|
33
|
+
- Commit count on session branch vs source branch
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Run for each active session repo:
|
|
37
|
+
```bash
|
|
38
|
+
git -C ../[repo] log session/[name] --oneline --not [source_branch] 2>/dev/null | wc -l
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Present as a clean table.
|
|
42
|
+
|
|
43
|
+
### /session status <name>
|
|
44
|
+
Detailed view of one session:
|
|
45
|
+
```bash
|
|
46
|
+
# For each repo in the session JSON:
|
|
47
|
+
git -C ../[repo] log session/[name] --oneline --not [source_branch] 2>/dev/null
|
|
48
|
+
git -C ../[repo] diff --stat [source_branch]..session/[name] 2>/dev/null
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Show: commits list, files changed, lines added/removed.
|
|
52
|
+
|
|
53
|
+
### /session close <name>
|
|
54
|
+
Interactive close — ask before EACH action:
|
|
55
|
+
|
|
56
|
+
1. **For each repo**: offer to create PR
|
|
57
|
+
```bash
|
|
58
|
+
gh pr create --repo [remote] --base [source_branch] --head session/[name] \
|
|
59
|
+
--title "[session-name]: [repo]" --body "Session: [session-name]"
|
|
60
|
+
```
|
|
61
|
+
Ask: "Create PR session/X → source in [repo]? [y/N]"
|
|
62
|
+
|
|
63
|
+
2. **For each repo**: offer to delete session branch
|
|
64
|
+
First check for unpushed commits:
|
|
65
|
+
```bash
|
|
66
|
+
git -C ../[repo] log session/[name] --oneline --not --remotes 2>/dev/null
|
|
67
|
+
```
|
|
68
|
+
If unpushed: warn before deletion.
|
|
69
|
+
Ask: "Delete branch session/X in [repo]? [y/N]"
|
|
70
|
+
```bash
|
|
71
|
+
git -C ../[repo] branch -D session/[name]
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
3. **Session file**: offer to delete or mark closed
|
|
75
|
+
Ask: "Delete .sessions/[name].json? [y/N]"
|
|
76
|
+
If no → mark status as "closed" in the JSON.
|
|
77
|
+
|
|
78
|
+
## Output format
|
|
79
|
+
Use clean markdown tables. Keep it concise.
|
package/package.json
CHANGED