Skip to content

feat: add Oh My Pi (omp) support#53

Merged
mylee04 merged 2 commits into
mylee04:mainfrom
obviousbread:feat/omp-support
Jun 12, 2026
Merged

feat: add Oh My Pi (omp) support#53
mylee04 merged 2 commits into
mylee04:mainfrom
obviousbread:feat/omp-support

Conversation

@obviousbread

Copy link
Copy Markdown
Contributor

Closes #52.

What this does

Adds Oh My Pi (omp) — the @oh-my-pi/pi-coding-agent CLI — as
a fourth supported tool alongside Claude Code, Codex, and Gemini CLI. cn on omp,
cn off omp, and cn status now 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 commands
from a config file — it loads JS/TS extension modules from
~/.omp/agent/extensions/. So enabling = writing a small managed extension
module, disabling = removing it.

cn on omp writes ~/.omp/agent/extensions/code-notify.js, which subscribes to
omp's agent_end event and forwards it to the existing notifier.sh
(stop omp <project>). Because the contract into notifier.sh is unchanged, all
existing delivery — sound, voice, Slack/Discord, click-through, the global mute
kill switch, and rate limiting — is reused as-is.

Notable design decisions

  • Outcome-aware: the extension maps the final assistant stopReason so
    errored/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.
  • Global mute keeps working: the project name is passed via cwd (not as the
    notifier's positional project arg), so basename($PWD) still scopes the text
    while cn off / the kill switch still suppress the notification.
  • Binary-only detection (command -v omp), matching detect_codex /
    detect_gemini_cli. A directory probe on ~/.omp/agent false-positives:
    code-notify creates the extensions/ subdir on enable, and it survives an omp
    uninstall.
  • Safe enable/disable: enable refuses to overwrite a non-managed file at that
    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.shdetect_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_enabled
  • lib/code-notify/core/notifier.sh — omp display name
  • lib/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 Windows
  • README.md — Features, usage table, How It Works
  • tests/test-omp-extension.sh (+ scripts/run_tests.sh wiring) — functional JS
    harness for the extension's runtime contract, plus mute / refuse-overwrite /
    binary-only detection coverage

Testing

make test: the new omp extension support test passes, along with 25 of the
other 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 a
separate issue for it.

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.
@mylee04 mylee04 merged commit 48a5d34 into mylee04:main Jun 12, 2026
4 checks passed
@mylee04

mylee04 commented Jun 12, 2026

Copy link
Copy Markdown
Owner

@obviousbread thanks for your effort. I like your suggestion and just merged it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: Add Oh My Pi (omp) as a fourth supported tool

2 participants