fix(tools): write large JSON payloads to tmpfile to prevent truncation (closes #493)
When init commands include many file contents (state, roadmap, requirements, etc.), the JSON output can exceed Claude Code's Bash tool buffer (~50KB), causing parse errors. The output() function now auto-detects large payloads and writes to a tmpfile, returning @file:/path instead. All workflows that consume init output handle both formats. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -15,7 +15,15 @@ Read config.json for planning behavior settings.
|
||||
Load execution context (uses `init execute-phase` for full context, including file contents):
|
||||
|
||||
```bash
|
||||
INIT=$(node ~/.claude/get-shit-done/bin/gsd-tools.cjs init execute-phase "${PHASE}" --include state,config)
|
||||
INIT_RAW=$(node ~/.claude/get-shit-done/bin/gsd-tools.cjs init execute-phase "${PHASE}" --include state,config)
|
||||
# Large payloads are written to a tmpfile — output starts with @file:/path
|
||||
if [[ "$INIT_RAW" == @file:* ]]; then
|
||||
INIT_FILE="${INIT_RAW#@file:}"
|
||||
INIT=$(cat "$INIT_FILE")
|
||||
rm -f "$INIT_FILE"
|
||||
else
|
||||
INIT="$INIT_RAW"
|
||||
fi
|
||||
```
|
||||
|
||||
Extract from init JSON: `executor_model`, `commit_docs`, `phase_dir`, `phase_number`, `plans`, `summaries`, `incomplete_plans`.
|
||||
|
||||
Reference in New Issue
Block a user