feat: add Oh My Pi (omp) support#53
Merged
Merged
Conversation
omp (the @oh-my-pi/pi-coding-agent harness) loads extension modules from ~/.omp/agent/extensions instead of reading hook commands from a config file, so the existing config-edit approach used for Claude/Codex/Gemini does not apply. `cn on omp` now writes a small managed extension (~/.omp/agent/extensions/code-notify.js) that forwards omp's agent_end event to notifier.sh via `stop omp <project>`; `cn off omp` removes it. Because the contract back into notifier.sh is identical, all existing delivery machinery (sound, voice, Slack/Discord channels, click-through, the global mute kill switch, and rate limiting) works unchanged. - detect.sh: detect_omp + registry (get_installed_tools, is_tool_installed) - config.sh: omp paths, generate_omp_extension, is/enable/disable_omp_hooks, enable_tool/disable_tool/is_tool_enabled dispatch - notifier.sh: omp display name - global.sh: enable/disable/status wiring + supported-tools text - help.sh: omp listed in tool names and command help - tests/test-omp-extension.sh wired into run_tests.sh - README: Features, usage table, How It Works Scope: macOS/Linux, completion event (like Codex). Windows omp and a needs-input event are left as follow-ups.
Review fixes on top of af5ee32 (initial omp support): - Global mute / `cn off` now suppress omp notifications. The extension passed the project name as the notifier's 3rd arg, which marks a notification "project-scoped" and bypasses the kill switch. It now passes the project via opts.cwd, so basename($PWD) still scopes the text while the notification stays globally mutable. - detect_omp is binary-only (command -v omp), matching detect_codex / detect_gemini_cli. The old directory probe keyed on ~/.omp/agent, which code-notify itself partially creates on enable and which survives an omp uninstall, so it falsely reported omp as installed. disable_omp_hooks now removes only its own managed file and never touches ~/.omp/agent (omp's data dir). - agent_end maps the final assistant stopReason to the notifier hook type, so errored/aborted runs notify as errors instead of a false "Task Complete". Scans back to the last assistant message instead of assuming the array's last element. - enable refuses to overwrite a non-managed extension at the same path. - omp wired into per-tool voice status/teardown; Windows warns that omp is not yet supported. - tests: functional JS harness for the extension's runtime contract, plus mute, refuse-overwrite, and binary-only detection coverage.
Owner
|
@obviousbread thanks for your effort. I like your suggestion and just merged it. |
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.
Closes #52.
What this does
Adds Oh My Pi (omp) — the
@oh-my-pi/pi-coding-agentCLI — asa fourth supported tool alongside Claude Code, Codex, and Gemini CLI.
cn on omp,cn off omp, andcn statusnow behave like the existing tools.Why omp needs a different mechanism
The Claude/Codex/Gemini integrations register a hook command by editing a
config file (
settings.json/config.toml). omp doesn't read hook commandsfrom a config file — it loads JS/TS extension modules from
~/.omp/agent/extensions/. So enabling = writing a small managed extensionmodule, disabling = removing it.
cn on ompwrites~/.omp/agent/extensions/code-notify.js, which subscribes toomp's
agent_endevent and forwards it to the existingnotifier.sh(
stop omp <project>). Because the contract intonotifier.shis unchanged, allexisting delivery — sound, voice, Slack/Discord, click-through, the global mute
kill switch, and rate limiting — is reused as-is.
Notable design decisions
stopReasonsoerrored/aborted runs notify as errors instead of a false "Task Complete". It
scans back to the last assistant message, since the array can end on a
tool-result/bash/compaction message that would mask the outcome.
cwd(not as thenotifier's positional project arg), so
basename($PWD)still scopes the textwhile
cn off/ the kill switch still suppress the notification.command -v omp), matchingdetect_codex/detect_gemini_cli. A directory probe on~/.omp/agentfalse-positives:code-notify creates the
extensions/subdir on enable, and it survives an ompuninstall.
path; disable removes only the managed file and never touches
~/.omp/agent(omp's data dir).
Scope
macOS / Linux, completion event only (mirrors the Codex scope). Windows omp and a
needs-input/idle event are left as follow-ups — status/voice wiring already warns
that omp is unsupported on Windows.
Files
lib/code-notify/utils/detect.sh—detect_omp+ registry(
get_installed_tools,is_tool_installed)lib/code-notify/core/config.sh— omp paths,generate_omp_extension,is/enable/disable_omp_hooks, dispatch in
enable_tool/disable_tool/is_tool_enabledlib/code-notify/core/notifier.sh— omp display namelib/code-notify/commands/global.sh— enable/disable/status wiring +supported-tools text
lib/code-notify/utils/help.sh,lib/code-notify/utils/voice.sh— omp listed;per-tool voice status/teardown
scripts/install-windows.ps1— warns omp unsupported on WindowsREADME.md— Features, usage table, How It Workstests/test-omp-extension.sh(+scripts/run_tests.shwiring) — functional JSharness for the extension's runtime contract, plus mute / refuse-overwrite /
binary-only detection coverage
Testing
make test: the newomp extension supporttest passes, along with 25 of theother 26 tests. The single failure —
click-through resolver(
click_through_resolve_default_term_program's builtin reverse-lookup fallback)— is pre-existing and unrelated to this change: it fails identically on
main(2b854f6), and this branch touches no click-through code. Happy to open aseparate issue for it.