fix: add .gitkeep to phase directories for git tracking

Phase directories created by /gsd:add-phase and /gsd:insert-phase were
empty until planning, causing git to ignore them. This prevented syncing
across machines.

Fixes #427

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Lex Christopherson
2026-02-15 15:03:06 -06:00
parent 1e3194a233
commit 0f2a3fafff

View File

@@ -2653,8 +2653,9 @@ function cmdPhaseAdd(cwd, description, raw) {
const dirName = `${paddedNum}-${slug}`;
const dirPath = path.join(cwd, '.planning', 'phases', dirName);
// Create directory
// Create directory with .gitkeep so git tracks empty folders
fs.mkdirSync(dirPath, { recursive: true });
fs.writeFileSync(path.join(dirPath, '.gitkeep'), '');
// Build phase entry
const phaseEntry = `\n### Phase ${newPhaseNum}: ${description}\n\n**Goal:** [To be planned]\n**Depends on:** Phase ${maxPhase}\n**Plans:** 0 plans\n\nPlans:\n- [ ] TBD (run /gsd:plan-phase ${newPhaseNum} to break down)\n`;
@@ -2725,8 +2726,9 @@ function cmdPhaseInsert(cwd, afterPhase, description, raw) {
const dirName = `${decimalPhase}-${slug}`;
const dirPath = path.join(cwd, '.planning', 'phases', dirName);
// Create directory
// Create directory with .gitkeep so git tracks empty folders
fs.mkdirSync(dirPath, { recursive: true });
fs.writeFileSync(path.join(dirPath, '.gitkeep'), '');
// Build phase entry
const phaseEntry = `\n### Phase ${decimalPhase}: ${description} (INSERTED)\n\n**Goal:** [Urgent work - to be planned]\n**Depends on:** Phase ${afterPhase}\n**Plans:** 0 plans\n\nPlans:\n- [ ] TBD (run /gsd:plan-phase ${decimalPhase} to break down)\n`;