mirror of
https://github.com/affaan-m/ECC.git
synced 2026-11-17 21:42:11 +00:00
fix(opencode): address review findings T01-T15 on the V2 plugin surface
P0: spawnCommand() replaces shell:true (cmd-shim routing with /d /s /c, quoted argv, windowsVerbatimArguments); permission.ask no longer auto-approves formatter/test shell prefixes; detached spawns register the error listener before resolving. P1: loadToolModule probes .js then .ts for dist and source layouts; V2 setup() tests via mock ctx; installer recognizes every historical plugin registration (./plugins and plugins/ecc-hooks.*) via shared isOpenCodeHookConfigRegistration(); ecc-universal ./plugins export repointed to the live dist/plugins/ecc-hooks.js; opencode.json drops the file-path plugin entry OpenCode 2.x ignores, docs updated. P2: setup() rolls back registrations and releases the directory guard on mid-setup failure; prettier non-zero exits reported as warn; subscription errors discriminated against abort; disposals awaited without unhandled rejections; windowsHide on all spawns; TROUBLESHOOTING curl passes location[directory]. Tests: opencode-plugin-hooks 22/22 (new T01/T02/T03/T05/T10/T11/T13/T14 coverage), build-opencode 11/11 (new T08 export test), hook-consent 12/12, install-executor 26/26, install-lifecycle 73/73, plugin-manifest 71/71.
This commit is contained in:
1 parent
03cfca273b
commit
6286b7c2f1
13 files changed
+1539
-661
No files matched your search
+10
-7
@@ -224,7 +224,6 @@ Full configuration in `opencode.json`:
|
||||
```json
|
||||
{
|
||||
"$schema": "https://opencode.ai/config.json",
|
||||
"plugin": ["./plugins/ecc-hooks.ts"],
|
||||
"instructions": [
|
||||
"skills/tdd-workflow/SKILL.md",
|
||||
"skills/security-review/SKILL.md"
|
||||
@@ -243,10 +242,14 @@ selection, and its subagents inherit the invoking primary agent's model.
|
||||
MIT
|
||||
|
||||
Home-target installations keep `plugins/index.ts` inert even with hooks enabled.
|
||||
OpenCode 2.x scans every root-level file in a plugins directory **and** loads the
|
||||
directory through `index.ts`, so the config points directly at
|
||||
`plugins/ecc-hooks.ts` and the barrel stays a distinct-id stub
|
||||
(`ecc-hooks-entry`). Re-exporting the real definition from `index.ts` would
|
||||
register the id `ecc-hooks` two-to-three times, and OpenCode marks every entry
|
||||
OpenCode 2.x loads plugins by scanning every root-level file in a plugins
|
||||
directory; it does **not** accept configured file paths — an entry like
|
||||
`"./plugins/ecc-hooks.ts"` in the `plugin` array logs
|
||||
"configured plugin path must be a directory" and is skipped, so the config ships
|
||||
without any `plugin` entry and `plugins/ecc-hooks.ts` is discovered from the
|
||||
directory. The barrel stays a distinct-id stub (`ecc-hooks-entry`) because
|
||||
re-exporting the real definition from `index.ts` would register the id
|
||||
`ecc-hooks` twice — once per discovered entry — and OpenCode marks every entry
|
||||
after the first as failed (`Duplicate plugin ID`). The source and published
|
||||
package barrel remain available for module imports.
|
||||
package barrel remain available for module imports; the package `./plugins`
|
||||
subpath maps to the live `dist/plugins/ecc-hooks.js` entry point.
|
||||
@@ -17,9 +17,6 @@
|
||||
"skills/strategic-compact/SKILL.md",
|
||||
"skills/eval-harness/SKILL.md"
|
||||
],
|
||||
"plugin": [
|
||||
"./plugins/ecc-hooks.ts"
|
||||
],
|
||||
"skills": {
|
||||
"paths": [
|
||||
"../skills"
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
"import": "./dist/index.js"
|
||||
},
|
||||
"./plugins": {
|
||||
"types": "./dist/plugins/index.d.ts",
|
||||
"import": "./dist/plugins/index.js"
|
||||
"types": "./dist/plugins/ecc-hooks.d.ts",
|
||||
"import": "./dist/plugins/ecc-hooks.js"
|
||||
},
|
||||
"./tools": {
|
||||
"types": "./dist/tools/index.d.ts",
|
||||
|
||||
+968
-555
File diff suppressed because it is too large.
Load diff
@@ -2,14 +2,16 @@
|
||||
* ECC plugins directory entry for OpenCode 2.x.
|
||||
*
|
||||
* This file is intentionally inert in normal installs. OpenCode 2.x loads
|
||||
* every root-level `.ts` file in a plugins directory AND the directory
|
||||
* itself through this entry point, so re-exporting the real plugin from
|
||||
* here would register the id `ecc-hooks` twice and OpenCode would mark the
|
||||
* extra entries `failed: Duplicate plugin ID` (shown in red in the TUI
|
||||
* plugins panel).
|
||||
* plugins by scanning every root-level file in a plugins directory, so
|
||||
* re-exporting the real plugin from here would register the id `ecc-hooks`
|
||||
* twice — once per discovered entry — and OpenCode would mark the extra
|
||||
* entries `failed: Duplicate plugin ID` (shown in red in the TUI plugins
|
||||
* panel).
|
||||
*
|
||||
* The configuration in `.opencode/opencode.json` therefore points directly
|
||||
* at `./plugins/ecc-hooks.ts`. This stub keeps:
|
||||
* `.opencode/opencode.json` carries no `plugin` entry at all: OpenCode 2.x
|
||||
* ignores configured file paths ("configured plugin path must be a
|
||||
* directory"), so `./plugins/ecc-hooks.ts` is discovered from the directory.
|
||||
* This stub keeps:
|
||||
* - the file present for the installer/uninstall plan (`ecc repair`), and
|
||||
* - a distinct id so a stray directory load can never collide with or
|
||||
* shadow the real hooks plugin, and never throws the V2 schema error
|
||||
|
||||
Reference in new issue
Block a user