code-review-graph version
2.3.8
Operating system
macOS
Python version
3.12.4
AI platform
opencode
Output of code-review-graph status
`code-review-graph install --platform opencode` writes
`~/.config/opencode/plugins/crg-plugin.ts` whose factory registers hooks via
`app.on(...)` (EventEmitter style). opencode's current plugin API calls the
factory with `{ project, client, $, directory, worktree }` and expects a hooks
object back — there is no `app`, so the loader fails on every startup and the
plugin never runs:
level=ERROR message="failed to load plugin" path=.../crg-plugin.ts
error="app.on is not a function"
Affected template: `_opencode_plugin_content()` in `code_review_graph/skills.py`
(all three hooks: `file.edited`, `session.created`, `tool.execute.before`).
Steps to reproduce
the run($, cmd) helper uses
$+""+${cmd}+""+`` — in Bun shell, interpolating a full command string as
the whole template escapes it into ONE executable name and throws (verified).
Even if app.on worked, every `run()` call would silently no-op through the
swallowed catch. Commands must be literal tagged templates.
Expected vs actual behavior
(verified with routing tests):
import type { Plugin } from "@opencode-ai/plugin"
export default (async ({ $ }: { $: any }) => {
return {
event: async ({ event }: { event: { type: string } }) => {
if (event.type === "file.edited") {
try { await $`code-review-graph update --skip-flows`.quiet() } catch {}
}
if (event.type === "session.created") {
try {
const result = await $`code-review-graph status`.quiet()
const output = result.stdout?.toString().trim()
if (output) console.log("[code-review-graph]", output)
} catch {}
}
},
"tool.execute.before": async (input: { tool: string; args?: { command?: string } }) => {
try {
if (/^git\s+commit/i.test(input?.args?.command ?? "")) {
const result = await $`code-review-graph detect-changes --brief`.quiet()
const output = result.stdout?.toString().trim()
if (output) console.log("[code-review-graph] Pre-commit analysis:\n" + output)
}
} catch {}
},
}
}) satisfies Plugin
Note: install_opencode_plugin() unconditionally overwrites the file
("If the file already exists it is overwritten"), so hand-fixes get
clobbered by any re-run of install.
Additional context
No response
code-review-graph version
2.3.8
Operating system
macOS
Python version
3.12.4
AI platform
opencode
Output of
code-review-graph statusSteps to reproduce
the
run($, cmd)helper uses$+""+${cmd}+""+`` — in Bun shell, interpolating a full command string asthe whole template escapes it into ONE executable name and throws (verified).
Even if
app.onworked, every `run()` call would silently no-op through theswallowed catch. Commands must be literal tagged templates.
Expected vs actual behavior
(verified with routing tests):
Note:
install_opencode_plugin()unconditionally overwrites the file("If the file already exists it is overwritten"), so hand-fixes get
clobbered by any re-run of
install.Additional context
No response