feat(03-01): brownfield integration into GSD workflows

- new-project.md detects existing code, offers /gsd:map-codebase first
- plan-phase loads relevant codebase context based on phase type
- execute-phase updates codebase map incrementally after execution

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Lex Christopherson
2025-12-17 10:37:57 -06:00
parent 8a0dcd668e
commit 8d2f307451
4 changed files with 133 additions and 1 deletions

View File

@@ -1148,6 +1148,52 @@ EOF
For commit message conventions and git workflow patterns, see ~/.claude/get-shit-done/references/git-integration.md
</step>
<step name="update_codebase_map">
**If .planning/codebase/ exists AND files were modified:**
Check if execution modified significant code:
```bash
# Get list of code files modified in this plan
MODIFIED_CODE=$(git diff --name-only HEAD~1 2>/dev/null | grep -E '\.(ts|js|py|go|rs|swift|java)$' | grep -v node_modules)
```
**If significant modifications (>3 code files changed):**
Determine which codebase documents may need update based on what changed:
| Changed Files | Documents to Update |
|--------------|-------------------|
| New directories created | STRUCTURE.md |
| Package dependencies changed | STACK.md, INTEGRATIONS.md |
| New patterns introduced | ARCHITECTURE.md, CONVENTIONS.md |
| Test files added/changed | TESTING.md |
| Config files changed | STACK.md |
| External service integration | INTEGRATIONS.md |
**Update strategy (incremental, not full remap):**
For each document needing update:
1. Read current document
2. Identify what changed (new entries, removed entries, modified sections)
3. Apply minimal edits to reflect new state
4. Keep document under 100 lines (summarize if needed)
**Commit codebase updates:**
```bash
git add .planning/codebase/*.md
git commit --amend --no-edit # Include in plan commit
```
**If no significant changes:**
Skip codebase update - map is still current.
**If .planning/codebase/ doesn't exist:**
Skip this step - no codebase map to update.
**Note:** Full remap via `/gsd:map-codebase` is available if incremental updates become stale.
</step>
<step name="check_phase_issues">
**Check if issues were created during this phase:**
@@ -1330,4 +1376,5 @@ All [Y] plans finished.
- SUMMARY.md created with substantive content
- STATE.md updated (position, decisions, issues, session)
- ROADMAP.md updated
- If codebase map exists: map updated with execution changes (or skipped if no significant changes)
</success_criteria>

View File

@@ -96,6 +96,44 @@ Options:
This ensures planning has full project context.
</step>
<step name="load_codebase_context">
Check if codebase map exists:
```bash
ls .planning/codebase/*.md 2>/dev/null
```
**If .planning/codebase/ exists:**
Determine which codebase documents are relevant based on phase goal:
| Phase Keywords | Load These Documents |
|----------------|---------------------|
| UI, frontend, components, layout | CONVENTIONS.md, STRUCTURE.md |
| API, backend, endpoints, routes | ARCHITECTURE.md, CONVENTIONS.md |
| database, schema, models, migration | ARCHITECTURE.md, STACK.md |
| testing, tests, coverage | TESTING.md, CONVENTIONS.md |
| integration, external, API, service | INTEGRATIONS.md, STACK.md |
| refactor, cleanup, debt | CONCERNS.md, ARCHITECTURE.md |
| setup, config, infrastructure | STACK.md, STRUCTURE.md |
| (default - load minimal set) | STACK.md, ARCHITECTURE.md |
Read the relevant documents and summarize key constraints for this phase:
- From STACK.md: Technologies that must be used
- From ARCHITECTURE.md: Patterns that must be followed
- From CONVENTIONS.md: Code style requirements
- From CONCERNS.md: Issues to avoid or address
**Add to planning context:**
Track codebase constraints for inclusion in PLAN.md context section:
- Which documents loaded
- Key constraints extracted
- Patterns to follow
**If .planning/codebase/ doesn't exist:**
Skip this step - no codebase map available.
</step>
<step name="identify_phase">
Check roadmap for phases:
```bash
@@ -651,6 +689,16 @@ Output: [What artifacts will be created by this plan]
@.planning/ROADMAP.md
@.planning/STATE.md
[If codebase map exists (from /gsd:map-codebase):]
@.planning/codebase/STACK.md
@.planning/codebase/ARCHITECTURE.md
[Add other relevant docs based on phase type - see load_codebase_context step]
**Codebase constraints:**
- [Extracted constraints from codebase documents]
- [Technologies that must be used]
- [Patterns that must be followed]
[If comprehensive ecosystem research exists (from /gsd:research-phase):]
@.planning/phases/XX-name/{phase}-RESEARCH.md