diff --git a/packages/omo-codex/plugin/components/comment-checker/LICENSE b/packages/omo-codex/plugin/components/comment-checker/LICENSE new file mode 100644 index 000000000..09aac3c3b --- /dev/null +++ b/packages/omo-codex/plugin/components/comment-checker/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 Yeongyu Kim + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/omo-codex/plugin/components/comment-checker/NOTICE b/packages/omo-codex/plugin/components/comment-checker/NOTICE new file mode 100644 index 000000000..5b363ec20 --- /dev/null +++ b/packages/omo-codex/plugin/components/comment-checker/NOTICE @@ -0,0 +1,6 @@ +codex-comment-checker + +This package ports the pi-comment-checker hook into a Codex plugin repository. + +The plugin targets Codex plugin manifests and plugin-bundled lifecycle hooks. +The checker engine is provided by @code-yeongyu/comment-checker. diff --git a/packages/omo-codex/plugin/components/comment-checker/README.md b/packages/omo-codex/plugin/components/comment-checker/README.md new file mode 100644 index 000000000..d48d38f80 --- /dev/null +++ b/packages/omo-codex/plugin/components/comment-checker/README.md @@ -0,0 +1,87 @@ +# codex-comment-checker + +[![ci](https://github.com/code-yeongyu/codex-comment-checker/actions/workflows/ci.yml/badge.svg)](https://github.com/code-yeongyu/codex-comment-checker/actions/workflows/ci.yml) [![license: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE) + +Codex plugin that runs [`@code-yeongyu/comment-checker`](https://github.com/code-yeongyu/go-claude-code-comment-checker) after successful edit-like `PostToolUse` hook calls. + +## Behavior + +| Case | Result | +|------|--------| +| `apply_patch` succeeds | parses `tool_input.command` and checks added/updated files | +| `write`, `edit`, `multi_edit`, or `multiedit` succeeds | maps the Codex payload to the native checker hook input | +| non-edit tool succeeds | ignored | +| checker exits `2` | returns Codex `PostToolUse` blocking feedback so the model fixes or explains the warning | +| checker binary missing or unavailable on the current platform | emits no hook output | +| checker exits unexpectedly | leaves hook output unchanged | + +Deletes are ignored because they cannot introduce new comments. + +## Codex Plugin + +The plugin ships: + +- `.codex-plugin/plugin.json` for Codex plugin discovery. +- `hooks/hooks.json` for the `PostToolUse` hook. +- `skills/comment-checker/SKILL.md` with usage guidance. + +The hook command is: + +```bash +node "${PLUGIN_ROOT}/dist/cli.js" hook post-tool-use +``` + +No MCP server or `comment_check` tool is exposed. + +## Local Development + +```bash +npm install +npm test +npm run typecheck +npm run check +npm pack --dry-run +``` + +Smoke-test the hook: + +```bash +node dist/cli.js hook post-tool-use < test/fixtures/post-tool-use.json +``` + +## Local Codex Installation + +```bash +bunx lazycodex install +``` + +The installer builds and copies the plugin into `~/.codex/plugins/cache/sisyphuslabs/omo/0.1.0`, registers the `sisyphuslabs` marketplace from the `lazycodex` Git repository, installs runtime dependencies there, and enables: + +```toml +[features] +plugins = true +plugin_hooks = true + +[plugins."omo@sisyphuslabs"] +enabled = true +``` + +## Branch Rules and Releases + +- `main` is protected by `.github/branch-ruleset.json`. +- CI runs Node 20 and 22 on Ubuntu, macOS, and Windows. +- Releases are GitHub Releases tagged as `v`. +- Publishing runs from the `publish` workflow after a GitHub Release is published. + +## Privacy + +This plugin runs locally. It sends hook input to the optional local `comment-checker` binary when available and does not call a network service by itself. + +## License + +[MIT](LICENSE). + +## Related + +- [pi-comment-checker](https://github.com/code-yeongyu/pi-comment-checker) - source extension this Codex plugin ports. +- [comment-checker](https://github.com/code-yeongyu/go-claude-code-comment-checker) - native checker binary. diff --git a/packages/omo-codex/plugin/components/comment-checker/package.json b/packages/omo-codex/plugin/components/comment-checker/package.json new file mode 100644 index 000000000..6fa96b416 --- /dev/null +++ b/packages/omo-codex/plugin/components/comment-checker/package.json @@ -0,0 +1,57 @@ +{ + "name": "@code-yeongyu/codex-comment-checker", + "version": "0.1.1", + "description": "Codex plugin that runs comment-checker after edit-like PostToolUse hooks.", + "type": "module", + "packageManager": "npm@11.12.1", + "license": "MIT", + "homepage": "https://github.com/code-yeongyu/codex-comment-checker", + "repository": { + "type": "git", + "url": "git+https://github.com/code-yeongyu/codex-comment-checker.git" + }, + "bugs": { + "url": "https://github.com/code-yeongyu/codex-comment-checker/issues" + }, + "keywords": [ + "codex", + "codex-plugin", + "comment-checker", + "hooks", + "typescript" + ], + "bin": { + "omo-comment-checker": "./dist/cli.js" + }, + "files": [ + "dist", + "hooks", + "skills", + ".codex-plugin", + "LICENSE", + "NOTICE", + "README.md", + "CHANGELOG.md" + ], + "scripts": { + "build": "tsc -p tsconfig.build.json", + "test": "vitest --run", + "test:watch": "vitest", + "typecheck": "tsc --noEmit", + "lint": "biome check .", + "lint:fix": "biome check --write .", + "check": "tsc --noEmit && biome check . && npm run build" + }, + "optionalDependencies": { + "@code-yeongyu/comment-checker": "^0.8.0" + }, + "devDependencies": { + "@biomejs/biome": "2.4.15", + "@types/node": "^25.7.0", + "typescript": "^6.0.3", + "vitest": "^4.1.5" + }, + "engines": { + "node": ">=20.0.0" + } +} diff --git a/packages/omo-codex/plugin/components/comment-checker/tsconfig.build.json b/packages/omo-codex/plugin/components/comment-checker/tsconfig.build.json new file mode 100644 index 000000000..5b5bbcafd --- /dev/null +++ b/packages/omo-codex/plugin/components/comment-checker/tsconfig.build.json @@ -0,0 +1,12 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "allowImportingTsExtensions": false, + "declaration": true, + "outDir": "dist", + "rootDir": "src", + "noEmit": false + }, + "include": ["src/**/*"], + "exclude": ["test/**/*"] +} diff --git a/packages/omo-codex/plugin/components/comment-checker/tsconfig.json b/packages/omo-codex/plugin/components/comment-checker/tsconfig.json new file mode 100644 index 000000000..342229c02 --- /dev/null +++ b/packages/omo-codex/plugin/components/comment-checker/tsconfig.json @@ -0,0 +1,27 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "Node16", + "moduleResolution": "Node16", + "lib": ["ES2022"], + "strict": true, + "exactOptionalPropertyTypes": true, + "noUncheckedIndexedAccess": true, + "noPropertyAccessFromIndexSignature": true, + "verbatimModuleSyntax": true, + "noImplicitOverride": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "esModuleInterop": true, + "allowImportingTsExtensions": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "resolveJsonModule": true, + "useDefineForClassFields": false, + "types": ["node"], + "noEmit": true + }, + "include": ["src/**/*", "test/**/*"] +} diff --git a/packages/omo-codex/plugin/components/comment-checker/vitest.config.ts b/packages/omo-codex/plugin/components/comment-checker/vitest.config.ts new file mode 100644 index 000000000..57bd8f12b --- /dev/null +++ b/packages/omo-codex/plugin/components/comment-checker/vitest.config.ts @@ -0,0 +1,9 @@ +import { defineConfig } from "vitest/config"; + +export default defineConfig({ + test: { + include: ["test/**/*.test.ts"], + environment: "node", + pool: "threads", + }, +});