fix: improve incremental codebase map updates

- Remove arbitrary ">3 files" threshold
- Add specific update actions per change type
- Add explicit skip conditions (bug fixes, content changes)
- Clarify update format: single targeted edits, not section rewrites
- Add "file renamed/moved" case to update paths

🤖 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-18 09:18:54 -06:00
parent a990e37c40
commit c11b744f27

View File

@@ -1149,48 +1149,40 @@ For commit message conventions and git workflow patterns, see ~/.claude/get-shit
</step> </step>
<step name="update_codebase_map"> <step name="update_codebase_map">
**If .planning/codebase/ exists AND files were modified:** **If .planning/codebase/ exists:**
Check if execution modified significant code: Check what changed in this plan:
```bash ```bash
# Get list of code files modified in this plan git diff --name-only HEAD~1 2>/dev/null
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):** **Update only if structural changes occurred:**
Determine which codebase documents may need update based on what changed: | Change Detected | Update Action |
|-----------------|---------------|
| New directory in src/ | STRUCTURE.md: Add to directory layout |
| package.json deps changed | STACK.md: Add/remove from dependencies list |
| New file pattern (e.g., first .test.ts) | CONVENTIONS.md: Note new pattern |
| New external API client | INTEGRATIONS.md: Add service entry with file path |
| Config file added/changed | STACK.md: Update configuration section |
| File renamed/moved | Update paths in relevant docs |
| Changed Files | Documents to Update | **Skip update if only:**
|--------------|-------------------| - Code changes within existing files
| New directories created | STRUCTURE.md | - Bug fixes
| Package dependencies changed | STACK.md, INTEGRATIONS.md | - Content changes (no structural impact)
| 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):** **Update format:**
Make single targeted edits - add a bullet point, update a path, or remove a stale entry. Don't rewrite sections.
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
**Commit codebase updates:**
```bash ```bash
git add .planning/codebase/*.md git add .planning/codebase/*.md
git commit --amend --no-edit # Include in plan commit 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:** **If .planning/codebase/ doesn't exist:**
Skip this step - no codebase map to update. Skip this step.
**Note:** Full remap via `/gsd:map-codebase` is available if incremental updates become stale.
</step> </step>
<step name="check_phase_issues"> <step name="check_phase_issues">