Skip to content

Commit 6e75910

Browse files
authored
Merge pull request #75 from codervisor/copilot/implement-spec-118
docs: parallel spec development workflow with git worktrees
2 parents a9ed14d + 2365390 commit 6e75910

File tree

4 files changed

+145
-4
lines changed

4 files changed

+145
-4
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ tmp/
1414
.playwright-mcp/
1515
*.tsbuildinfo
1616
*.tgz
17-
GEMINI.md
17+
GEMINI.md
18+
.worktrees/

AGENTS.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,38 @@ See [docs/agents/PUBLISHING.md](docs/agents/PUBLISHING.md) for the complete rele
202202

203203
**How to split:** Use `lean-spec analyze <spec>`, `lean-spec split`, and `lean-spec compact` commands. See [docs/agents/WORKFLOWS.md](docs/agents/WORKFLOWS.md) for detailed examples.
204204

205+
## Parallel Development
206+
207+
Need to work on multiple specs at once? Use Git worktrees for complete code isolation:
208+
209+
```bash
210+
# Create worktree for spec 045
211+
lean-spec update 045 --status in-progress
212+
git worktree add .worktrees/spec-045-dashboard -b feature/045-dashboard
213+
cd .worktrees/spec-045-dashboard
214+
# Implement spec 045...
215+
216+
# Meanwhile, start spec 047 in a separate worktree
217+
cd ~/project # Back to main
218+
lean-spec update 047 --status in-progress
219+
git worktree add .worktrees/spec-047-timestamps -b feature/047-timestamps
220+
```
221+
222+
**Best Practices:**
223+
- **Naming**: Use `spec-<number>-<short-name>` for worktrees
224+
- **Branches**: Feature branch per spec (`feature/045-dashboard`)
225+
- **Cleanup**: `git worktree remove <path>` after merge
226+
- **Status**: Update spec status from main worktree
227+
- **Ignore**: Add `.worktrees/` to `.gitignore`
228+
229+
**Full guide:** See [docs/agents/WORKFLOWS.md](docs/agents/WORKFLOWS.md) for complete patterns.
230+
231+
## FAQ
232+
233+
**Q: How do I work on multiple specs at once?**
234+
235+
Use Git worktrees. Each worktree gives you an isolated working directory with its own branch while sharing the same Git history. See [Parallel Development](#parallel-development) above and [docs/agents/WORKFLOWS.md](docs/agents/WORKFLOWS.md) for detailed patterns.
236+
205237
---
206238

207239
**Remember**: LeanSpec is a mindset, not a rulebook. When in doubt, apply the first principles in order: Context Economy → Signal-to-Noise → Intent Over Implementation → Bridge the Gap → Progressive Disclosure. Use `lean-spec --help` to discover features as needed.

docs/agents/WORKFLOWS.md

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,3 +259,104 @@ lean-spec link product-launch --depends-on dark-theme-support
259259
# View full dependency graph
260260
lean-spec deps product-launch --impact
261261
```
262+
263+
## Parallel Development with Git Worktrees
264+
265+
Need to work on multiple specs simultaneously? Use Git worktrees for complete code isolation.
266+
267+
### Why Git Worktrees?
268+
269+
- **Native Git feature** - No additional tools required
270+
- **Complete isolation** - Each worktree has independent working directory
271+
- **Shared history** - Efficient disk usage, all worktrees share `.git`
272+
- **No context switching** - Work on multiple specs without stashing/committing
273+
274+
### Basic Setup
275+
276+
```bash
277+
# Main repo structure after creating worktrees:
278+
~/project/ # Primary worktree (main branch)
279+
~/project/.worktrees/
280+
├── spec-045-dashboard/ # Worktree for spec 045
281+
├── spec-047-timestamps/ # Worktree for spec 047
282+
└── spec-048-analysis/ # Worktree for spec 048
283+
```
284+
285+
### Pattern 1: Solo Developer - Parallel Features
286+
287+
```bash
288+
# Start spec 045
289+
lean-spec update 045 --status in-progress
290+
git worktree add .worktrees/spec-045-dashboard -b feature/045-dashboard
291+
cd .worktrees/spec-045-dashboard
292+
# Implement spec 045...
293+
294+
# While 045 is ongoing, start spec 047 in parallel
295+
cd ~/project # Back to main worktree
296+
lean-spec update 047 --status in-progress
297+
git worktree add .worktrees/spec-047-timestamps -b feature/047-timestamps
298+
cd .worktrees/spec-047-timestamps
299+
# Implement spec 047...
300+
301+
# Work continues independently in each worktree
302+
# Merge and clean up when done:
303+
git worktree remove .worktrees/spec-045-dashboard
304+
```
305+
306+
### Pattern 2: Team - Multiple Developers
307+
308+
```bash
309+
# Developer A works on spec 045
310+
git worktree add .worktrees/spec-045 -b feature/045-dashboard
311+
cd .worktrees/spec-045
312+
lean-spec update 045 --status in-progress --assignee "dev-a"
313+
314+
# Developer B works on spec 047 (from their clone)
315+
git worktree add .worktrees/spec-047 -b feature/047-timestamps
316+
cd .worktrees/spec-047
317+
lean-spec update 047 --status in-progress --assignee "dev-b"
318+
319+
# Each developer has isolated environment
320+
# Merge to main when complete
321+
```
322+
323+
### Pattern 3: Experiment + Stable Work
324+
325+
```bash
326+
# Keep main worktree for stable/production work
327+
cd ~/project # Main worktree on main branch
328+
329+
# Create experimental worktree for risky spec
330+
git worktree add .worktrees/spec-048-experiment -b experiment/048
331+
cd .worktrees/spec-048-experiment
332+
# Try experimental approach...
333+
334+
# If experiment fails, just remove worktree
335+
git worktree remove .worktrees/spec-048-experiment
336+
# Main work remains untouched
337+
```
338+
339+
### Handling Dependencies
340+
341+
When specs have dependencies (`depends_on`):
342+
343+
```bash
344+
# Spec 048 depends on 045
345+
# Option 1: Wait for 045 to merge to main
346+
git worktree add .worktrees/spec-048 -b feature/048
347+
# Work on 048 after 045 is merged
348+
349+
# Option 2: Branch from 045's feature branch (when 045 not yet merged)
350+
cd ~/project # Back to main worktree
351+
git worktree add .worktrees/spec-048-analysis feature/045-dashboard -b feature/048-from-045
352+
# 048 includes all changes from 045's branch
353+
```
354+
355+
### Best Practices
356+
357+
1. **Worktree naming**: Use spec number + short name (e.g., `spec-045-dashboard`)
358+
2. **Branch strategy**: Feature branches per spec (e.g., `feature/045-dashboard`)
359+
3. **Cleanup**: Remove worktrees after merge (`git worktree remove <path>`)
360+
4. **Status updates**: Update spec status from main worktree where `specs/` lives
361+
5. **Dependencies**: Branch from dependent spec's feature branch if needed
362+
6. **Ignore worktrees**: Add `.worktrees/` to `.gitignore`

specs/118-parallel-spec-implementation/README.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,25 @@
11
---
2-
status: planned
2+
status: complete
33
created: '2025-11-25'
44
tags:
55
- workflow
66
- documentation
77
- git
88
priority: high
99
created_at: '2025-11-25T06:46:20.670Z'
10-
updated_at: '2025-11-25T06:47:19.875Z'
10+
updated_at: '2025-11-25T06:59:12.413Z'
11+
transitions:
12+
- status: in-progress
13+
at: '2025-11-25T06:55:08.382Z'
14+
- status: complete
15+
at: '2025-11-25T06:59:12.413Z'
16+
completed_at: '2025-11-25T06:59:12.413Z'
17+
completed: '2025-11-25'
1118
---
1219

1320
# Parallel Spec Implementation Workflow
1421

15-
> **Status**: 🗓️ Planned · **Priority**: High · **Created**: 2025-11-25 · **Tags**: workflow, documentation, git
22+
> **Status**: ✅ Complete · **Priority**: High · **Created**: 2025-11-25 · **Tags**: workflow, documentation, git
1623
1724
**Project**: lean-spec
1825
**Team**: Core Development

0 commit comments

Comments
 (0)