Repository navigation
feat(hooks): ocgs-hooks extension for Pi and oh-my-pi - #113
Merged
Merged
Conversation
Ports the hook logic from .opencode/plugins/ccgs-hooks.ts into a pure Node module with no Pi or omp imports. The wiring is in a separate extension (next commit), so this logic runs under node --test directly. Git calls use argv instead of a shell. Notifications spawn detached, so a missing notifier binary cannot block the agent.
Maps the 12 hooks listed under "Hooks Mapping" in README.md to Pi and omp events. Pi auto-discovers .pi/extensions/ocgs-hooks. omp loads it through .omp/config.yml (next commit). Each harness emits only some of the events. A handler for an event the running harness never emits never fires. The shared session-stop handler skips subagent sessions (ctx.agent.kind === "sub"), so a child session cannot archive the parent's active.md. Pi's ExtensionContext has no agent field, so this guard is inert on Pi. Tests cover the commit and push guards, asset and skill checks, agent audit, compaction context, and the subagent stop regression.
Adds the extension to the project config and to the expected extension list in tests/omp/test-config.test.mjs, which is now seven entries.
Adds the extension to the Pi extension table and reference, the omp wiring table, the root hooks section, and the Pi workflow comparison. The reference lists where Pi and omp differ from the bash originals: no pre-summary compaction hook on Pi, one session-log entry per run, and subagent detection only on omp.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Ports the 12 CCGS hooks listed under "Hooks Mapping" in
README.mdto Pi and oh-my-pi as one extension,.pi/extensions/ocgs-hooks/. The harness-neutral logic lives incore.ts.index.tsmaps it to each harness's events. omp loads the extension through.omp/config.yml.Related Issues
None. No tracking issue exists for this work. Design and mapping are in
docs/pi-extensions.md#ocgs-hooksand the rootREADME.md"Hooks Mapping".Type of Change
Commits (review in order)
3b904cbcore.ts: harness-neutral hook logic, no Pi or omp imports222299findex.tsand tests: event wiring, subagent stop guard, regression test53975d5.omp/config.ymland the omp config test (seven extensions)67ab290docs: Pi extension reference, omp wiring table, root pointer, Pi workflow rowDifferences from the bash originals
session.compacting.ctx.agent.kind === "sub"skips the session-start, session-stop, and compaction handlers. Pi'sExtensionContexthas noagentfield, so on Pi these guards never match.agent_settledfires after every run, sosession-log.mdgets one entry per run.validate-read,validate-write,validate-registry,validate-agent-artifact,update-check,log-instructions).Testing
npm run test:extensions: 61 pass, 36 of them intests/extensions/test-ocgs-hooks.test.mjsnpm run test:omp: 3 passnpm run test:framework: passespi --mode rpc -aandomp --mode rpc, no prompt. Both exit 0 with empty stderr, and thesession_startsummary is emitted. omp's log shows noocgs-hooksload errors.The PR template's test command points at
.opencode/plugins/tests/, which does not cover this change. The suites above are the ones that do.Not verified
ui_prompt_start/tool_approval_requestedfiring in a live session.tscis not installed, so the TypeScript is exercised at runtime only.Checklist