Repository navigation
Share command reading and policy across provider packages - #78
Conversation
erickb336
left a comment
There was a problem hiding this comment.
Codex review at 4d6155be3d3dbbe241688ce43654ffeede83466d: no remaining blocking findings. The owner requested this review because Claude usage is exhausted; the owner will merge.
Independent code/security review confirmed that program resolution, shell parsing, T199 expansion checks, and runnable-text classification preserve the original behavior. Required command-module failures produce a denial before mode and actor gates. QA confirmed both isolated provider bundles and all 64 missing-module combinations. Existing test assertions remain unchanged; the authorized fixture corrections supply the complete plugin.
Review found one nonblocking trailing blank line in the shared source and generated copies. Commit 4d6155b removes it through the source and build; the reviewer confirmed that the correction changes no logic.
Fresh validation of the corrected tree, with fake process tools first on PATH:
npm run build: built 108 files.npm run check: all checks pass.npm test: tests 471; pass 471; fail 0.git diff --check ea9f728: exit 0.
The missing-module regression was rerun on detached main ea9f728: tests 1; pass 0; fail 1, because main returns no denial. The PR body records the separate shared-API red proof.
No live Claude session or native shell execution was tested. Existing parser limitations and queued policy issues remain outside this extraction. This is a Codex review of our work, with separate code/security and QA passes; it is not an external maintainer approval. Local checks are complete; the new CI run must pass before merge.
First focused split from #75, based on main
ea9f728after #72 and #73 merged.Claude keeps the same command rules in a complete plugin. Command parsing, program resolution, executable-text filtering, and T199's expanded-word rule now live in
sage-core. Both provider bundles can use one implementation through the public core entry point. No dependency is added.Merge/push approval, file rules, mode phrases, lead limits, and the Codex runtime remain outside this PR.
Behavior and scope
packages/sage-core/command-reader.mjsandpackages/sage-core/command-policy.mjs. Provider event handling stays in the Claude hook. Claude work on overlapping rules must account for these moved functions.Validation
Fake
ps,pgrep, andkillwere first on PATH for every test run. Test command strings went only to parsers or hook inputs, never to a real shell.npm run buildbuilt 108 filesnpm run checkall checks passnode --test --test-name-pattern='missing command modules|the merge check refuses a merge when it cannot run' scripts/sage-hook.test.mjstests 2; pass 2; fail 0node --test scripts/launcher.test.mjstests 17; pass 17; fail 0npm testtests 471; pass 471; fail 0git diff --checkMain-failure proof used a detached worktree from
origin/main(ea9f728), with only the two test files copied over. With fake process tools first on PATH:node --test --test-name-pattern='missing command modules|shared command extraction' scripts/sage-hook.test.mjs scripts/providers.test.mjsResult:
tests 3; pass 0; fail 3. Main lacks the shared APIs and the new module-load refusal. The missing-module test also failed against the extraction before the fix, with no refusal for the protected API command.The two shared API tests check pipe relationships, program input, parsing failures, T199 refusals, ordinary controls, and the provider's state-tool path in isolated copies of both bundles. Independent review found no remaining issue after the fix.
Seen, not fixed / not verified
The parser's existing limitations remain. This extraction does not implement #69, #70, #58, or automatic Codex command enforcement. Native shell execution and a live Claude session were not tested. The broad lifecycle draft and its dependency advisory remain separate in #75.