Commit Graph

1 Commits

Author SHA1 Message Date
Дмитрий c14fb72e84 feat(router-gate-v4): Stream H Task 6 — askuser-answer-parser wrapper + toApprovalRecord schema sync
Closes Stream H Task 6 (H4). Retires the manual approval-write workaround
the controller used throughout Stream H Tasks 1-5.

Two changes:

1. Pure module tools/askuser-answer-parser.mjs gains toApprovalRecord(answer, opts)
   exporter that detects a git verb in the user's free-form answer and returns
   a Stream B-compatible {type:'approve_git_operation', command, ts} record
   (matches loadApprovedGitOps reader format in shell-content-rules.mjs:125).
   Returns null for non-git answers and for stop/abort/cancel keywords.

2. New PostToolUse(AskUserQuestion) wrapper tools/enforce-askuser-answer-parser.mjs
   reads each question/answer pair, calls toApprovalRecord, appends matching
   records to ~/.claude/runtime/askuser-decisions-<sess>.jsonl. Fail-open
   observability — never blocks AskUserQuestion.

Regression: vitest tools 1742/1742 GREEN (was 1731; +5 toApprovalRecord tests
under "toApprovalRecord (Stream H Task 6 — schema sync)" including non-string
guard, +6 wrapper-hook tests under "enforce-askuser-answer-parser wrapper
(Stream H Task 6)" including missing session_id fail-open guard).

DEFERRED: settings.json registration (matcher "AskUserQuestion", PostToolUse,
fail-open, timeout 2000ms) — batched with H5/H6/H7/H8 hook activations at end
of Phase H-α/H-β. Hook code is fully implemented and unit-tested; activation
pending settings.json update.

Stream H Task 6 of 11. Plan: docs/superpowers/plans/2026-05-30-router-gate-v4-stream-H.md
2026-05-30 11:28:13 +03:00