Skip to content

Commit 1808ab7

Browse files
committed
test: add multi-repo validation test scenarios
Add test scenarios to verify multi-repo support implementation: - init/multi-repo-detection.md: Workspace mode detection - plan/multi-repo-task-format.md: Repo field in task format - execute/multi-repo-execution.md: Per-repo worktrees and setup
1 parent 1b164e4 commit 1808ab7

3 files changed

Lines changed: 343 additions & 0 deletions

File tree

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
# Test Scenario: Multi-Repo Execution
2+
3+
## Context
4+
5+
**Testing:** `/spectacular:execute` handles multi-repo plans with per-repo worktrees and setup commands.
6+
7+
**Setup:**
8+
9+
- Multi-repo workspace with backend, frontend repos
10+
- Plan has tasks tagged with `repo: backend` and `repo: frontend`
11+
- Each repo has CLAUDE.md with different setup commands
12+
13+
**Why this scenario:**
14+
15+
- Worktrees must be created INSIDE each repo (not workspace root)
16+
- Setup commands differ per repo (npm vs pip)
17+
- Constitution paths are per-repo
18+
- Git-spice stacking is per-repo
19+
20+
## Expected Behavior
21+
22+
### Worktree Creation (Multi-Repo)
23+
24+
For task in `repo: backend`:
25+
26+
```bash
27+
cd backend
28+
git worktree add .worktrees/{runId}-task-{N} main
29+
```
30+
31+
NOT:
32+
33+
```bash
34+
# WRONG - creates worktree at workspace root
35+
git worktree add .worktrees/{runId}-task-{N} main
36+
```
37+
38+
### Per-Repo Setup Commands
39+
40+
Setup commands read from each repo's CLAUDE.md:
41+
42+
```bash
43+
# For backend task
44+
INSTALL_CMD=$(grep -A1 "**install**:" backend/CLAUDE.md | tail -1)
45+
46+
# For frontend task
47+
INSTALL_CMD=$(grep -A1 "**install**:" frontend/CLAUDE.md | tail -1)
48+
```
49+
50+
### Per-Repo Stacking
51+
52+
Each repo maintains its own git-spice stack:
53+
54+
```
55+
backend repo stack:
56+
{runId}-task-1-1-schema
57+
└─□ {runId}-task-2-1-api
58+
59+
frontend repo stack:
60+
{runId}-task-2-2-component
61+
└─□ {runId}-task-3-1-integration
62+
```
63+
64+
## Verification Commands
65+
66+
```bash
67+
# Verify multi-repo context passing in executing-plan
68+
grep -n "WORKSPACE_MODE" skills/executing-plan/SKILL.md
69+
70+
# Verify per-repo worktree creation in parallel phase
71+
grep -n "worktree.*repo\|TASK_REPO" skills/executing-parallel-phase/SKILL.md
72+
73+
# Verify per-repo setup command lookup
74+
grep -n "CLAUDE.md.*repo\|repo.*CLAUDE.md" skills/executing-parallel-phase/SKILL.md
75+
76+
# Verify sequential phase handles repo switching
77+
grep -n "WORKSPACE_MODE" skills/executing-sequential-phase/SKILL.md
78+
```
79+
80+
## Evidence of PASS
81+
82+
- [ ] `executing-plan` passes WORKSPACE_MODE to phase skills
83+
- [ ] `executing-parallel-phase` creates worktrees inside task's repo
84+
- [ ] Setup commands read from per-repo CLAUDE.md
85+
- [ ] `executing-sequential-phase` handles cross-repo sequential tasks
86+
- [ ] Subagent prompts include repo-specific context (constitution path, CLAUDE.md path)
87+
88+
## Evidence of FAIL
89+
90+
- [ ] WORKSPACE_MODE not passed to phase skills
91+
- [ ] Worktrees created at workspace root instead of repo root
92+
- [ ] Setup commands always read from same CLAUDE.md
93+
- [ ] No repo context in subagent prompts
94+
95+
## Test Execution
96+
97+
**Manual setup:**
98+
99+
```bash
100+
# Create multi-repo workspace
101+
mkdir -p /tmp/workspace/{backend,frontend}
102+
cd /tmp/workspace/backend && git init && echo "## Development Commands\n\n**install**: pip install -r requirements.txt" > CLAUDE.md
103+
cd /tmp/workspace/frontend && git init && echo "## Development Commands\n\n**install**: npm install" > CLAUDE.md
104+
105+
# Create spec and plan with multi-repo tasks
106+
# Run execute
107+
cd /tmp/workspace
108+
/spectacular:execute @specs/{runId}-feature/plan.md
109+
```
110+
111+
**Expected behavior:**
112+
113+
1. Detects WORKSPACE_MODE="multi-repo"
114+
2. Creates worktrees in each repo's .worktrees/
115+
3. Runs `pip install` for backend tasks
116+
4. Runs `npm install` for frontend tasks
117+
5. Stacks branches per-repo
118+
119+
## Related Scenarios
120+
121+
- **parallel-stacking-4-tasks.md** - Single-repo parallel execution
122+
- **sequential-stacking.md** - Single-repo sequential execution
123+
- **multi-repo-detection.md** - Multi-repo workspace detection
124+
- **multi-repo-task-format.md** - Multi-repo plan format
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
# Test Scenario: Multi-Repo Workspace Detection
2+
3+
## Context
4+
5+
**Testing:** `/spectacular:init` detection of multi-repo vs single-repo workspace.
6+
7+
**Setup:**
8+
9+
- User runs Claude from a workspace directory containing multiple git repos as subdirectories
10+
- Each repo should have CLAUDE.md with setup commands
11+
- Optional: docs/constitutions/current/ in each repo
12+
13+
**Why this scenario:**
14+
15+
- Multi-repo detection is foundational to all multi-repo spectacular workflows
16+
- Detection must be reliable and consistent across all skills
17+
- Incorrect detection causes downstream failures in spec, plan, and execute
18+
19+
## Expected Behavior
20+
21+
### Step 1: Workspace Mode Detection
22+
23+
The validating-environment skill runs this check:
24+
25+
```bash
26+
REPO_COUNT=$(find . -maxdepth 2 -name ".git" -type d 2>/dev/null | wc -l | tr -d ' ')
27+
if [ "$REPO_COUNT" -gt 1 ]; then
28+
WORKSPACE_MODE="multi-repo"
29+
else
30+
WORKSPACE_MODE="single-repo"
31+
fi
32+
```
33+
34+
### Step 2: Multi-Repo Summary Output
35+
36+
When WORKSPACE_MODE="multi-repo", the summary should include:
37+
38+
- Total number of repos detected
39+
- List of repo names
40+
- Per-repo validation status (CLAUDE.md present, constitutions present)
41+
- Warning if any repo missing required setup
42+
43+
### Step 3: Specs Directory Creation
44+
45+
In multi-repo mode, creates `specs/` at workspace root (not inside any repo).
46+
47+
## Verification Commands
48+
49+
```bash
50+
# Verify WORKSPACE_MODE detection in validating-environment skill
51+
grep -n "WORKSPACE_MODE" skills/validating-environment/SKILL.md
52+
53+
# Verify detection logic uses find with maxdepth 2
54+
grep -n "find.*-maxdepth 2.*\.git" skills/validating-environment/SKILL.md
55+
56+
# Verify multi-repo summary section exists
57+
grep -n "Multi-Repo Workspace Summary\|multi-repo" skills/validating-environment/SKILL.md
58+
59+
# Verify specs directory creation at workspace root
60+
grep -n "specs/" skills/validating-environment/SKILL.md
61+
```
62+
63+
## Evidence of PASS
64+
65+
- [ ] `skills/validating-environment/SKILL.md` contains WORKSPACE_MODE variable
66+
- [ ] Detection uses `find . -maxdepth 2 -name ".git"` pattern
67+
- [ ] Multi-repo summary section outputs detected repos
68+
- [ ] Specs directory created at workspace root (not repo root)
69+
- [ ] Per-repo validation checks CLAUDE.md presence
70+
71+
## Evidence of FAIL
72+
73+
- [ ] WORKSPACE_MODE variable missing or incorrectly named
74+
- [ ] Detection pattern doesn't use maxdepth 2 (would miss repos)
75+
- [ ] No multi-repo summary output
76+
- [ ] Specs directory created inside a repo (wrong location)
77+
78+
## Test Execution
79+
80+
**Manual test setup:**
81+
82+
```bash
83+
# Create test workspace
84+
mkdir -p /tmp/test-workspace/{backend,frontend}
85+
cd /tmp/test-workspace/backend && git init
86+
cd /tmp/test-workspace/frontend && git init
87+
cd /tmp/test-workspace
88+
89+
# Run init
90+
/spectacular:init
91+
```
92+
93+
**Expected output:**
94+
95+
```
96+
Multi-repo workspace detected (2 repos)
97+
Available repos: backend frontend
98+
...
99+
Workspace Mode: multi-repo
100+
```
101+
102+
## Related Scenarios
103+
104+
- **validate-superpowers.md** - Validates superpowers plugin presence
105+
- **validate-git-spice.md** - Validates git-spice installation
106+
- **error-handling.md** - Handles missing dependencies gracefully
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
# Test Scenario: Multi-Repo Task Format
2+
3+
## Context
4+
5+
**Testing:** `/spectacular:plan` generates tasks with `**Repo**:` field in multi-repo mode.
6+
7+
**Setup:**
8+
9+
- Multi-repo workspace detected
10+
- Spec references multiple repos (backend, frontend, etc.)
11+
- Plan decomposition should generate per-repo tasks
12+
13+
**Why this scenario:**
14+
15+
- Execution depends on knowing which repo each task belongs to
16+
- Worktrees must be created in the correct repo
17+
- Setup commands differ per repo (npm vs pip, etc.)
18+
19+
## Expected Behavior
20+
21+
### Task Format in Multi-Repo Mode
22+
23+
Each task MUST include the `**Repo**:` field:
24+
25+
```markdown
26+
### Task 1.1: Add user_preferences table
27+
28+
**Repo**: backend
29+
**Files**:
30+
- prisma/schema.prisma
31+
- prisma/migrations/*
32+
33+
**Constitution**: @backend/docs/constitutions/current/
34+
```
35+
36+
### Cross-Repo Dependency Analysis
37+
38+
Tasks in DIFFERENT repos are automatically parallelizable:
39+
40+
```markdown
41+
## Phase 2: Implementation (parallel)
42+
43+
- [ ] **Task 2.1**: Add API endpoint | repo: backend | files: src/api.ts
44+
- [ ] **Task 2.2**: Add UI component | repo: frontend | files: src/App.tsx
45+
```
46+
47+
Tasks in SAME repo touching same files must be sequential.
48+
49+
## Verification Commands
50+
51+
```bash
52+
# Verify multi-repo task format exists in decomposing-tasks skill
53+
grep -n "**Repo**:" skills/decomposing-tasks/SKILL.md
54+
55+
# Verify multi-repo detection in plan skill
56+
grep -n "WORKSPACE_MODE" skills/decomposing-tasks/SKILL.md
57+
58+
# Verify cross-repo parallelization documented
59+
grep -n "different repos" skills/decomposing-tasks/SKILL.md
60+
61+
# Verify constitution reference includes repo prefix
62+
grep -n "Constitution.*repo" skills/decomposing-tasks/SKILL.md
63+
```
64+
65+
## Evidence of PASS
66+
67+
- [ ] `skills/decomposing-tasks/SKILL.md` shows `**Repo**:` field in task template
68+
- [ ] Multi-repo detection (WORKSPACE_MODE) is performed
69+
- [ ] Cross-repo tasks can be parallelized (different repos = independent)
70+
- [ ] Constitution paths include repo prefix in multi-repo mode
71+
72+
## Evidence of FAIL
73+
74+
- [ ] No `**Repo**:` field in task template for multi-repo
75+
- [ ] WORKSPACE_MODE not checked in decomposing-tasks skill
76+
- [ ] Cross-repo dependency analysis missing
77+
- [ ] Constitution paths don't reference repo prefix
78+
79+
## Test Execution
80+
81+
**Example spec for multi-repo:**
82+
83+
```markdown
84+
# User Preferences Feature
85+
86+
## Overview
87+
Add user preferences with shared types, backend API, and frontend UI.
88+
89+
## Repos Involved
90+
- shared-lib: Type definitions
91+
- backend: API and database
92+
- frontend: UI components
93+
94+
## Constitutions
95+
- @backend/docs/constitutions/current/
96+
- @frontend/docs/constitutions/current/
97+
```
98+
99+
**Expected plan output:**
100+
101+
```markdown
102+
## Phase 1: Foundation (sequential)
103+
- [ ] **Task 1.1**: Add preference types | repo: shared-lib | files: src/types.ts
104+
105+
## Phase 2: Implementation (parallel)
106+
- [ ] **Task 2.1**: Add API endpoint | repo: backend | files: src/api.ts
107+
- [ ] **Task 2.2**: Add UI component | repo: frontend | files: src/App.tsx
108+
```
109+
110+
## Related Scenarios
111+
112+
- **multi-repo-detection.md** - Detects multi-repo workspace
113+
- **task-decomposition.md** - General task decomposition validation

0 commit comments

Comments
 (0)