Repository navigation
Conversation
OpenCode 2 does not run V1 plugin implementations. It requires a default export with an id and a setup(ctx) function and registers hooks on the owning domain, and it names the command tool 'shell'. graphify install --platform opencode still wrote the V1 GraphifyPlugin / "tool.execute.before" shape, so the plugin failed to load with: Plugin must export a default definition with an id and an effect or setup function.
The V1 installer also registered the plugin in .opencode/opencode.json under the 'plugin' key as a bare relative path (.opencode/plugins/graphify.js). OpenCode 2 treats a bare specifier as an npm package, tries to install it, and fails (NpmInstallFailedError: ENOTDIR .../graphify.js/package.json). OpenCode 2 already auto-discovers .opencode/plugins/, so no config entry is needed.
- Port _OPENCODE_PLUGIN_JS to the V2 API (default export + setup(ctx), ctx.tool.hook("execute.before", ...), shell tool, ctx.location.directory).
- Stop writing the config entry; remove any legacy plugin/plugins entry on install and uninstall.
- Update tests and the CLI help text.
There was a problem hiding this comment.
Graphify reviewed this change.
Looks safe to merge — no coupling regressions and no blocking issues, checked against the code graph (not a self-assessment).
Graphify review — findings
Migrates the OpenCode plugin from the V1 tool.execute.before map to the V2 API, default-exporting a definition with an id and setup(ctx) that registers the hook via ctx.tool.hook("execute.before") and matches both the V2 shell and legacy bash tool names. Drops config registration entirely since OpenCode 2 auto-discovers .opencode/plugins/, and _install_opencode_plugin now strips any stale V1 plugin/plugins entry (via _drop_opencode_plugin_config_entry) so the bare relative path can't be misread as an npm package spec and fail to load. Updates the CLI help text to say "shell hook plugin" and adjusts tests accordingly.
No blocking issues surfaced. 1 lower-confidence candidate did not survive cross-model review.
Analysis details — impact, health, verification
Impact & health
Graphify review
Impact — 555 functions depend on the 328 functions this change touches.
Health — this change adds coupling hotspots:
- new:
main()— 98 callers, 3 callees - new:
dispatch_command()— 2 callers, 125 callees - new:
install()— 13 callers, 11 callees - new:
codebuddy_install()— 20 callers, 5 callees - new:
gemini_install()— 11 callers, 7 callees - new:
claude_install()— 19 callers, 4 callees - new:
_copy_skill_file()— 12 callers, 6 callees - new:
claude_uninstall()— 17 callers, 4 callees - …and 15 more — each is listed as a finding
Verification — 555 functions in the blast radius were not formally verified this run (proofs are advisory here).
Gate & verification
graphify gate
PASS — objectively clean (no health regressions, tests not run — proofs not run this pass (advisory)). Grounded, not self-assessed.
Advisory (not blocking):
- verification_scope: 555 function(s) in the blast radius were not formally verified this run
Test selection
Test selection
31 of 300 test file(s) selected (10%) via static blast radius.
tests/test_affected_cli.py— impacttests/test_agents_platform.py— impacttests/test_atomic_version_stamp.py— impacttests/test_claude_md.py— impacttests/test_codebuddy.py— impacttests/test_devin.py— impacttests/test_explain_cli.py— impacttests/test_extract_cli.py— impacttests/test_gemini_hook.py— impacttests/test_global_add_tag_inference.py— impacttests/test_god_nodes_cli.py— impacttests/test_hollow_chunks_arm_shrink_guard.py— impacttests/test_home_sandbox.py— impacttests/test_hook_strict.py— impacttests/test_incomplete_build_guard.py— impacttests/test_install.py— impact, changed-testtests/test_install_references.py— impacttests/test_install_strings.py— impacttests/test_install_version_warning.py— impacttests/test_merge_chunks_validation.py— impacttests/test_multigraph_diagnostics.py— impacttests/test_no_dedup_flag.py— impacttests/test_path_cli.py— impacttests/test_query_cli.py— impacttests/test_query_induced_edges.py— impacttests/test_read_hook.py— impacttests/test_replace_or_append_section.py— impacttests/test_search_hook.py— impacttests/test_skill_version_warning.py— impacttests/test_uninstall_scope.py— impacttests/test_unverified_semantic_shrink.py— impact
Selection is safe under the controlled-regression assumption; always-run tests + a periodic full run are the backstops. Advisory — it never changes the check verdict.
· 23 more finding(s) on lines outside this diff (see the check run).
|
Thanks @kianhuat. The OpenCode 2 plugin loading for #3732 already landed via #3554/#4039 (shipped in 0.9.84), and that version keeps a v1 |
What does this PR do?
Fixes #3732.
OpenCode 2 does not run V1 plugin implementations.
graphify install --platform opencodestill wrote the V1 shape:so the installed plugin fails to load with:
OpenCode 2 requires a default export with an
idand asetup(ctx)function, registers hooks on the owning domain (ctx.tool.hook("execute.before", ...)), names the command toolshell(notbash), and exposes the location asctx.location.directory.The V1 installer also registered the plugin in
.opencode/opencode.jsonunder thepluginkey as a bare relative path:{ "plugin": [".opencode/plugins/graphify.js"] }OpenCode 2 treats a bare specifier as an npm package spec, tries to install it, and fails:
OpenCode 2 already auto-discovers direct
.js/.tsfiles under.opencode/plugins/, so no config entry is needed.Changes
_OPENCODE_PLUGIN_JSto the V2 API: default export +setup(ctx),ctx.tool.hook("execute.before", ...),shelltool,ctx.location.directory..opencode/opencode.jsonentry; remove any legacyplugin/pluginsentry on install and uninstall.graphify --helpdescription.Type of change
How was this tested?
Manual, on OpenCode 2.0.15:
The shell reminder still fires: a
shellcommand returned the[graphify]reminder line whengraphify-out/graph.jsonexisted.Graphify-specific checklist