fix: Windows shell robustness, project_root detection, and hook stdin safety (#1343)

Address 4 root causes of Windows + Claude Code reliability issues:

1. Workflow shell robustness: add || true guards to informational commands
   (ls, grep, find, cat) that return non-zero on "no results", preventing
   workflow step failures under strict execution models. Guard glob loops
   with [ -e "$var" ] || continue to handle empty glob expansion.

2. Hook stdin handling: replace readFileSync('/dev/stdin') with async
   process.stdin + timeout in agent templates (gsd-verifier.md). Existing
   JS hooks already have timeout guards.

3. project_root detection: fix isInsideGitRepo() to check .git at the
   candidate parent level (not just below it), enabling correct detection
   when .git and .planning/ are siblings at the same directory level —
   the common single-repo case from a subdirectory.

4. @file: handoff: add missing @file: handlers to autonomous.md and
   manager.md workflows that call gsd-tools init but lacked the handler
   for large output payloads.

Fixes #1343

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Tom Boucher
2026-03-23 20:20:15 -04:00
parent ae69e6e9e4
commit 58c2b1f502
25 changed files with 314 additions and 70 deletions

View File

@@ -90,7 +90,7 @@ If user selects "Proceed anyway": note incomplete requirements in MILESTONES.md
<config-check>
```bash
cat .planning/config.json 2>/dev/null
cat .planning/config.json 2>/dev/null || true
```
</config-check>
@@ -129,7 +129,7 @@ Calculate milestone statistics:
```bash
git log --oneline --grep="feat(" | head -20
git diff --stat FIRST_COMMIT..LAST_COMMIT | tail -1
find . -name "*.swift" -o -name "*.ts" -o -name "*.py" | xargs wc -l 2>/dev/null
find . -name "*.swift" -o -name "*.ts" -o -name "*.py" | xargs wc -l 2>/dev/null || true
git log --format="%ai" FIRST_COMMIT | tail -1
git log --format="%ai" LAST_COMMIT | head -1
```
@@ -156,6 +156,7 @@ Extract one-liners from SUMMARY.md files using summary-extract:
```bash
# For each phase in milestone, extract one-liner
for summary in .planning/phases/*-*/*-SUMMARY.md; do
[ -e "$summary" ] || continue
node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" summary-extract "$summary" --fields one_liner --pick one_liner
done
```
@@ -446,7 +447,7 @@ rm .planning/REQUIREMENTS.md
Check for existing retrospective:
```bash
ls .planning/RETROSPECTIVE.md 2>/dev/null
ls .planning/RETROSPECTIVE.md 2>/dev/null || true
```
**If exists:** Read the file, append new milestone section before the "## Cross-Milestone Trends" section.