fix: replace echo with printf in shell snippets to prevent jq parse errors
zsh's built-in echo interprets \n escape sequences in JSON strings, converting properly-escaped \\n back into literal newlines. This breaks jq parsing with "control characters U+0000 through U+001F must be escaped". printf '%s\n' preserves the JSON verbatim. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -33,8 +33,8 @@ With existing decimals:
|
||||
|
||||
```bash
|
||||
DECIMAL_INFO=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" phase next-decimal "${AFTER_PHASE}")
|
||||
DECIMAL_PHASE=$(echo "$DECIMAL_INFO" | jq -r '.next')
|
||||
BASE_PHASE=$(echo "$DECIMAL_INFO" | jq -r '.base_phase')
|
||||
DECIMAL_PHASE=$(printf '%s\n' "$DECIMAL_INFO" | jq -r '.next')
|
||||
BASE_PHASE=$(printf '%s\n' "$DECIMAL_INFO" | jq -r '.base_phase')
|
||||
```
|
||||
|
||||
Or with --raw flag:
|
||||
|
||||
@@ -46,7 +46,7 @@ Use `roadmap get-phase` to validate phase exists:
|
||||
|
||||
```bash
|
||||
PHASE_CHECK=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" roadmap get-phase "${PHASE}")
|
||||
if [ "$(echo "$PHASE_CHECK" | jq -r '.found')" = "false" ]; then
|
||||
if [ "$(printf '%s\n' "$PHASE_CHECK" | jq -r '.found')" = "false" ]; then
|
||||
echo "ERROR: Phase ${PHASE} not found in roadmap"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -66,7 +66,7 @@ Find highest existing phase:
|
||||
```bash
|
||||
# Get sorted phase list, extract last one
|
||||
PHASES=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" phases list)
|
||||
HIGHEST=$(echo "$PHASES" | jq -r '.directories[-1]')
|
||||
HIGHEST=$(printf '%s\n' "$PHASES" | jq -r '.directories[-1]')
|
||||
```
|
||||
|
||||
New phases continue from there:
|
||||
|
||||
@@ -257,13 +257,13 @@ ls "${PHASE_DIR}"/*-PLAN.md 2>/dev/null
|
||||
Extract from INIT JSON:
|
||||
|
||||
```bash
|
||||
STATE_PATH=$(echo "$INIT" | jq -r '.state_path // empty')
|
||||
ROADMAP_PATH=$(echo "$INIT" | jq -r '.roadmap_path // empty')
|
||||
REQUIREMENTS_PATH=$(echo "$INIT" | jq -r '.requirements_path // empty')
|
||||
RESEARCH_PATH=$(echo "$INIT" | jq -r '.research_path // empty')
|
||||
VERIFICATION_PATH=$(echo "$INIT" | jq -r '.verification_path // empty')
|
||||
UAT_PATH=$(echo "$INIT" | jq -r '.uat_path // empty')
|
||||
CONTEXT_PATH=$(echo "$INIT" | jq -r '.context_path // empty')
|
||||
STATE_PATH=$(printf '%s\n' "$INIT" | jq -r '.state_path // empty')
|
||||
ROADMAP_PATH=$(printf '%s\n' "$INIT" | jq -r '.roadmap_path // empty')
|
||||
REQUIREMENTS_PATH=$(printf '%s\n' "$INIT" | jq -r '.requirements_path // empty')
|
||||
RESEARCH_PATH=$(printf '%s\n' "$INIT" | jq -r '.research_path // empty')
|
||||
VERIFICATION_PATH=$(printf '%s\n' "$INIT" | jq -r '.verification_path // empty')
|
||||
UAT_PATH=$(printf '%s\n' "$INIT" | jq -r '.uat_path // empty')
|
||||
CONTEXT_PATH=$(printf '%s\n' "$INIT" | jq -r '.context_path // empty')
|
||||
```
|
||||
|
||||
## 8. Spawn gsd-planner Agent
|
||||
|
||||
Reference in New Issue
Block a user