mirror of
https://github.com/affaan-m/ECC.git
synced 2026-11-17 05:22:17 +00:00
fix(opencode): migrate hooks plugin to V2 API and stop duplicate registrations
OpenCode 2.x only runs V2 plugin definitions ({ id, setup(ctx) }); the V1
function-export form failed schema validation at load with
"PluginModule.LoadError: Plugin must export a default definition with an id
and an effect or setup function".
- Rewrite .opencode/plugins/ecc-hooks.ts as a native V2 plugin: V1 hook keys
now register on their V2 domains (ctx.tool.hook execute.before/after,
ctx.shell.hook create.before, ctx.permission.hook evaluate,
ctx.session.hook compaction, ctx.event.subscribe for file/session/todo
events, ctx.tool.transform for custom tools). Windows-safe: replaces Bun
dollar-shell and grep with child_process.spawn + fs; every callback is
try/catch wrapped and every domain registration is guarded so a missing
capability degrades instead of crashing setup.
- Stop registering the same plugin id three times: OpenCode scans root-level
plugin files AND loads the directory through index.ts, so the directory
form of the plugin config produced two red "Duplicate plugin ID:
ecc-hooks" entries in the TUI panel. Config now points directly at
./plugins/ecc-hooks.ts and plugins/index.ts becomes an inert distinct-id
stub (kept on disk because install/uninstall plans and consent safety
tests reference it).
- Document the failure modes and the /api/plugin plus "opencode plugin list"
diagnostic playbook in TROUBLESHOOTING.md; align .opencode/README.md.
Verified: hook-consent, opencode-hook-consent-safety, install-lifecycle,
install-executor, harness-adapter-compliance tests pass (197 assertions);
check-hooks-schema-keys, validate-install-manifests, validate-hooks and
unicode-safety CI validators pass.
This commit is contained in:
1 parent
b38be6a7f6
commit
03cfca273b
6 files changed
+717
-628
No files matched your search
@@ -18,7 +18,7 @@
|
||||
"skills/eval-harness/SKILL.md"
|
||||
],
|
||||
"plugin": [
|
||||
"./plugins"
|
||||
"./plugins/ecc-hooks.ts"
|
||||
],
|
||||
"skills": {
|
||||
"paths": [
|
||||
|
||||
Reference in new issue
Block a user