pi-comment-checker

May 16, 2026 · View on GitHub

ci license: MIT

Comment checker hook for the pi coding agent and senpi. It runs @code-yeongyu/comment-checker after mutation tools and appends the checker warning back into the tool result so the agent must react.

This package is the standalone pi extension version of the oh-my-openagent / ../omo comment-checker hook.

Behavior

CaseResult
write succeedschecks the written content
edit succeedschecks old_string / new_string
multiedit succeedschecks the complete edits payload
apply_patch succeeds with OMO metadatachecks each metadata file using before / after, skips deletes
apply_patch succeeds without metadatafalls back to raw Codex patch parsing
checker exits 2appends the warning message to the tool result and leaves the TUI hidden
checker binary missingleaves the TUI hidden and leaves tool output unchanged
checker exits unexpectedlyleaves the TUI hidden and leaves tool output unchanged

apply_patch support

apply_patch is handled in two layers:

  1. OMO-compatible metadata/details:
{
  "files": [
    {
      "filePath": "src/old.ts",
      "movePath": "src/new.ts",
      "before": "const before = 1;\n",
      "after": "// explain next value\nconst after = 2;\n",
      "type": "update"
    }
  ]
}
  1. Raw Codex patch fallback:
*** Begin Patch
*** Update File: src/example.ts
@@
-const before = 1;
+// explain value
+const after = 2;
*** End Patch

Deletes are ignored because they cannot introduce new comments.

TUI

The extension uses an above-editor widget with key pi-comment-checker.

StateWidget
Loadinghidden
Missing binaryhidden
Warninghidden
Cleanwidget hidden

It does not set or modify the footer.

Installation

The package targets the pi / senpi extension package system.

# 1. From npm (once published)
pi install npm:pi-comment-checker

# 2. From git
pi install git:github.com/code-yeongyu/pi-comment-checker

# 3. senpi settings.json
{
  "packages": [
    "git:github.com/code-yeongyu/pi-comment-checker"
  ]
}

# 4. Dev / one-shot test
pi -e /path/to/pi-comment-checker/src/index.ts
senpi -e /path/to/pi-comment-checker/src/index.ts

After installation, restart pi/senpi or run /reload inside an interactive session.

Command

/comment-checker

Shows binary availability and setup guidance.

Development

npm install
npm test
npm run typecheck
npm run check
npm pack --dry-run
pi -e ./src/index.ts

Branch rules and releases

  • main is protected by .github/branch-ruleset.json.
  • CI runs Node 20 and 22 on Ubuntu and macOS.
  • Releases are GitHub Releases tagged as v<semver>.
  • Publishing runs from the publish workflow after a GitHub Release is published.

Origin

Ported from ../omo/src/hooks/comment-checker and adapted to the public pi-coding-agent extension API.

License

MIT.

Acknowledgements

  • Mario Zechner (@badlogic) — author of pi-mono and the pi-coding-agent extension API this package targets.
  • Yeongyu Kim (@code-yeongyu) — maintainer of senpi, oh-my-openagent, and comment-checker.