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
+13 -4
View File
@@ -18,12 +18,13 @@ and any SIGNIFICANT-gated patch), with the code already committed.
the doc commit strands outside the merge/PR (the exact bug this fixes). See ORDERING.
doc-syncer runs IN-THREAD (the orchestrator loads it), so the list of files it patched is
already in hand — surfaced as `PATCHED_FILES:` in doc-syncer's OUTPUT. Pass that list.
already in hand — surfaced as `PATCHED_FILES:` in doc-syncer's OUTPUT, ONE PATH PER LINE.
Pass each line as a SEPARATE argument (see DO step 3).
## DO
1. Collect `PATCHED_FILES` — the public-doc paths doc-syncer wrote this run (its OUTPUT
block). Empty → nothing to commit; the helper no-ops.
block, ONE PATH PER LINE). Empty → nothing to commit; the helper no-ops.
2. Compose — from the patch context the AGENT holds (doc-syncer ran in-thread, so the
agent knows exactly what changed) — BOTH artifacts:
@@ -34,11 +35,19 @@ already in hand — surfaced as `PATCHED_FILES:` in doc-syncer's OUTPUT. Pass th
Both are the AGENT's to write — the helper produces NEITHER (its only stdout is the
hash). This is the load-bearing point of the visible surface: see the rc 0 row.
3. Commit surgically via the helper, passing EXACTLY the patched files, capturing the hash:
3. Commit surgically via the helper, passing EXACTLY the patched files — each path as a
SEPARATE argument (split `PATCHED_FILES` on NEWLINES only), capturing the hash:
doc_hash=$(bash "$HOME/.claude/lib/doc-commit.sh" commit "<message>" <PATCHED_FILES…>)
doc_hash=$(bash "$HOME/.claude/lib/doc-commit.sh" commit "<message>" "<path-1>" "<path-2>" …)
rc=$?
SEPARATOR — the helper takes argv (no in-band separator), so a path with spaces
(`docs/My Guide.md`) survives as ONE argument and commits correctly (proven, T7). NEVER
flatten the list into a single space-joined string and re-split it: that mis-splits a
spaced path into garbage args, which the helper's `[ -e ]` filter then silently drops —
the spaced doc would strand. Newline is doc-syncer's OUTPUT format (paths carry no
newlines); argv is the handoff to the helper.
4. REPORT BY (rc, doc_hash) — handle EVERY exit, not just success:
| rc | doc_hash | meaning | what to do |