feat(doc-syncer): PATCHED_FILES newline output for doc-commit handoff

doc-syncer now emits PATCHED_FILES — every public-doc file created/modified this run, ONE PATH PER LINE — in both STEP 9 OUTPUT (full audit) and AUTO MODE STEP A4 (the path orchestrators call). NONE stays silent (no line → doc-commit sees empty → no-ops). Additive: detection/patching logic and the `auto-mode scope:` input contract are unchanged → callers unaffected.

Separator contract, producer↔consumer aligned + proven: newline is doc-syncer's OUTPUT format (paths carry no newlines); the agent splits on newline and passes EACH path as a SEPARATE argv element to lib/doc-commit.sh. The helper takes argv (no in-band separator) → a path with spaces survives as one argument. lib/doc-commit.md spells this out (never flatten to a space-joined string + re-split, which would mis-split a spaced path the helper then silently drops). New test T7 PROVES it on real git: 'docs/My Guide.md' → committed as one file (28/28, shellcheck clean).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ho5EQCFTSvYamuRtVZpp2d
This commit is contained in:
Bastien Chanot
2026-06-27 01:07:03 +02:00
co-authored by Claude Opus 4.8
parent 4a54a65dd4
commit fb1f359da5
3 changed files with 49 additions and 6 deletions
+15
View File
@@ -12,6 +12,7 @@
# T4 stale-staged doc (version A) → commit carries working-tree version B
# T5 idempotent — empty list / clean tree → no-op exit 0
# T6 unsafe git state (detached HEAD) → exit 3, no commit
# T7 path WITH A SPACE passed as one arg → committed (argv is space-safe, no separator)
#
# No -e: run every test and report, even after a failure.
set -uo pipefail
@@ -158,6 +159,20 @@ if [ "$RC" -eq 3 ]; then ok "detached HEAD → exit 3"; else ko "expected 3, got
if [ "$(git -C "$R" rev-parse HEAD)" = "$BEFORE" ]; then ok "no commit created"; else ko "a commit was created"; fi
rm -rf "$R"
echo "T7 — path WITH A SPACE passed as one arg → committed (argv is space-safe)"
R="$(new_repo)"
mkdir -p "$R/docs"
printf 'guide baseline\n' >"$R/docs/My Guide.md"
git -C "$R" add -A; git -C "$R" commit -qm "add spaced doc"
printf 'feature added\n' >>"$R/docs/My Guide.md"
run "$R" commit "docs: T7 spaced" "docs/My Guide.md"
printf ' rc=%s out(hash)=[%s]\n' "$RC" "$OUT"
if [ "$RC" -eq 0 ]; then ok "exit 0"; else ko "expected 0, got $RC"; fi
if [ -n "$OUT" ]; then ok "hash printed (commit made)"; else ko "no hash"; fi
if git -C "$R" cat-file -e "HEAD:docs/My Guide.md" 2>/dev/null; then ok "spaced path present in HEAD"; else ko "spaced path not committed"; fi
if [ -z "$(git -C "$R" status --porcelain -- "docs/My Guide.md")" ]; then ok "spaced doc clean (embarked as ONE file, not split)"; else ko "spaced doc still dirty"; fi
rm -rf "$R"
rm -f "$ERRFILE"
echo ""
printf 'RESULT: %d passed, %d failed\n' "$PASS" "$FAIL"