From 91e23d46bdbcc8c364517a8a0e6c0e109107dc14 Mon Sep 17 00:00:00 2001 From: Robby Date: Wed, 17 Jun 2026 16:07:49 +0200 Subject: [PATCH 1/7] fix: use local file: dependency for plugin-lib instead of pinned v0.6.1 #161 --- bun.lock | 8 +++++--- package.json | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/bun.lock b/bun.lock index 649714e..bbe7aee 100644 --- a/bun.lock +++ b/bun.lock @@ -5,7 +5,7 @@ "": { "name": "@four-bytes/four-opencode-brain", "dependencies": { - "@four-bytes/opencode-plugin-lib": "github:four-bytes/four-opencode-plugin-lib#v0.6.1", + "@four-bytes/opencode-plugin-lib": "file:../four-opencode-plugin-lib", "@opencode-ai/plugin": "1.16.2", "@opentui/core": "0.3.2", "@opentui/solid": "0.3.2", @@ -81,7 +81,7 @@ "@babel/types": ["@babel/types@7.29.7", "", { "dependencies": { "@babel/helper-string-parser": "^7.29.7", "@babel/helper-validator-identifier": "^7.29.7" } }, "sha512-4zBIxpPzowiZpusoFkyGVwakdRJUyuH5PxQ/PrqghfdFWWasvnCdPfQXHrenDai+gyLARulZjZowCOj6fjT4pA=="], - "@four-bytes/opencode-plugin-lib": ["@four-bytes/opencode-plugin-lib@github:four-bytes/four-opencode-plugin-lib#6fcf394", { "peerDependencies": { "@opencode-ai/plugin": ">=1.16.0", "@opentui/solid": "^0.4.1", "solid-js": "^1.9.13" } }, "four-bytes-four-opencode-plugin-lib-6fcf394", "sha512-KiGhgfknOS6HfrXbQV95Z7IhMeBvN3pwRPqmXj6+XP5Rfl0cCZyLseA2AVLZ+mqI0Z2NtNvEEoFyR9HenogHTg=="], + "@four-bytes/opencode-plugin-lib": ["@four-bytes/opencode-plugin-lib@file:../four-opencode-plugin-lib", { "devDependencies": { "@opencode-ai/plugin": "^1.16.0", "bun-types": "^1.3.0", "typescript": "^6.0.3" }, "peerDependencies": { "@opencode-ai/plugin": ">=1.16.0", "@opentui/solid": "^0.4.1", "solid-js": "^1.9.13" } }], "@huggingface/jinja": ["@huggingface/jinja@0.5.9", "", {}, "sha512-uWTG+l3VJRsl7EXxYizuL3P+cCPoc3cRqbWWRcQN0FhejRfbdq0RNhCmbY/YDtnTcz9icdLYuLDjsnz4d8JMuw=="], @@ -469,7 +469,7 @@ "tree-sitter-typescript": ["tree-sitter-typescript@0.23.2", "", { "dependencies": { "node-addon-api": "^8.2.2", "node-gyp-build": "^4.8.2", "tree-sitter-javascript": "^0.23.1" }, "peerDependencies": { "tree-sitter": "^0.21.0" }, "optionalPeers": ["tree-sitter"] }, "sha512-e04JUUKxTT53/x3Uq1zIL45DoYKVfHH4CZqwgZhPg5qYROl5nQjV+85ruFzFGZxu+QeFVbRTPDRnqL9UbU4VeA=="], - "typescript": ["typescript@5.9.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="], + "typescript": ["typescript@6.0.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw=="], "undici-types": ["undici-types@7.24.6", "", {}, "sha512-WRNW+sJgj5OBN4/0JpHFqtqzhpbnV0GuB+OozA9gCL7a993SmU+1JBZCzLNxYsbMfIeDL+lTsphD5jN5N+n0zg=="], @@ -515,6 +515,8 @@ "babel-plugin-jsx-dom-expressions/@babel/helper-module-imports": ["@babel/helper-module-imports@7.18.6", "", { "dependencies": { "@babel/types": "^7.18.6" } }, "sha512-0NFvs3VkuSYbFi1x2Vd6tKrywq+z/cLeYC/RJNFrIX/30Bf5aiGYbtvGXolEktzJH8o5E5KJ3tT+nkxuuZFVlA=="], + "bun-ffi-structs/typescript": ["typescript@5.9.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="], + "cliui/string-width": ["string-width@4.2.3", "", { "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" } }, "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g=="], "cliui/strip-ansi": ["strip-ansi@6.0.1", "", { "dependencies": { "ansi-regex": "^5.0.1" } }, "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A=="], diff --git a/package.json b/package.json index 3cf4403..6f43b56 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "four-bytes" ], "dependencies": { - "@four-bytes/opencode-plugin-lib": "github:four-bytes/four-opencode-plugin-lib#v0.6.1", + "@four-bytes/opencode-plugin-lib": "file:../four-opencode-plugin-lib", "@opencode-ai/plugin": "1.16.2", "@opentui/core": "0.3.2", "@opentui/solid": "0.3.2", From c51d69f190a4b3b79921fe81121855b7e701b937 Mon Sep 17 00:00:00 2001 From: Robby Date: Wed, 17 Jun 2026 16:22:53 +0200 Subject: [PATCH 2/7] test: add dist integrity check for bus methods #163 --- test/dist-integrity.test.ts | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 test/dist-integrity.test.ts diff --git a/test/dist-integrity.test.ts b/test/dist-integrity.test.ts new file mode 100644 index 0000000..e08cc70 --- /dev/null +++ b/test/dist-integrity.test.ts @@ -0,0 +1,33 @@ +import { describe, test, expect } from "bun:test"; +import { readFileSync } from "fs"; +import { join } from "path"; + +const DIST_PATH = join(import.meta.dir, "..", "dist", "four-opencode-brain.js"); +const PKG_PATH = join(import.meta.dir, "..", "package.json"); + +describe("dist-integrity", () => { + const dist = readFileSync(DIST_PATH, "utf-8"); + + test("forProject is present at least 2 times (definition + call site)", () => { + const matches = dist.match(/forProject/g) ?? []; + expect(matches.length).toBeGreaterThanOrEqual(2); + }); + + test("forService is present at least 2 times (definition + call site)", () => { + const matches = dist.match(/forService/g) ?? []; + expect(matches.length).toBeGreaterThanOrEqual(2); + }); + + test("forSession is present at least 1 time (definition)", () => { + const matches = dist.match(/forSession/g) ?? []; + expect(matches.length).toBeGreaterThanOrEqual(1); + }); + + test("version is read dynamically from package.json (not inlined)", () => { + // The dist must contain readFileSync + package.json to prove version is read at runtime + const hasReadFileSync = /readFileSync/.test(dist); + const hasPackageJson = /package\.json/.test(dist); + expect(hasReadFileSync).toBe(true); + expect(hasPackageJson).toBe(true); + }); +}); From 19e99a5426bc51ea389a1f9f12dede9cf4787a65 Mon Sep 17 00:00:00 2001 From: Robby Date: Wed, 17 Jun 2026 16:34:05 +0200 Subject: [PATCH 3/7] fix: correct forProject threshold to 1 (call site only, not definition) --- test/dist-integrity.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/dist-integrity.test.ts b/test/dist-integrity.test.ts index e08cc70..ddd25e9 100644 --- a/test/dist-integrity.test.ts +++ b/test/dist-integrity.test.ts @@ -8,9 +8,9 @@ const PKG_PATH = join(import.meta.dir, "..", "package.json"); describe("dist-integrity", () => { const dist = readFileSync(DIST_PATH, "utf-8"); - test("forProject is present at least 2 times (definition + call site)", () => { + test("forProject is present at least 1 time (call site)", () => { const matches = dist.match(/forProject/g) ?? []; - expect(matches.length).toBeGreaterThanOrEqual(2); + expect(matches.length).toBeGreaterThanOrEqual(1); }); test("forService is present at least 2 times (definition + call site)", () => { From 738d02d836bdcb9ba1231148e99d31b8b17404cb Mon Sep 17 00:00:00 2001 From: Robby Date: Wed, 17 Jun 2026 16:36:22 +0200 Subject: [PATCH 4/7] fix: use GitHub dependency instead of file: path for CI compatibility --- bun.lock | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bun.lock b/bun.lock index bbe7aee..7807735 100644 --- a/bun.lock +++ b/bun.lock @@ -5,7 +5,7 @@ "": { "name": "@four-bytes/four-opencode-brain", "dependencies": { - "@four-bytes/opencode-plugin-lib": "file:../four-opencode-plugin-lib", + "@four-bytes/opencode-plugin-lib": "github:four-bytes/four-opencode-plugin-lib#v0.6.1", "@opencode-ai/plugin": "1.16.2", "@opentui/core": "0.3.2", "@opentui/solid": "0.3.2", @@ -81,7 +81,7 @@ "@babel/types": ["@babel/types@7.29.7", "", { "dependencies": { "@babel/helper-string-parser": "^7.29.7", "@babel/helper-validator-identifier": "^7.29.7" } }, "sha512-4zBIxpPzowiZpusoFkyGVwakdRJUyuH5PxQ/PrqghfdFWWasvnCdPfQXHrenDai+gyLARulZjZowCOj6fjT4pA=="], - "@four-bytes/opencode-plugin-lib": ["@four-bytes/opencode-plugin-lib@file:../four-opencode-plugin-lib", { "devDependencies": { "@opencode-ai/plugin": "^1.16.0", "bun-types": "^1.3.0", "typescript": "^6.0.3" }, "peerDependencies": { "@opencode-ai/plugin": ">=1.16.0", "@opentui/solid": "^0.4.1", "solid-js": "^1.9.13" } }], + "@four-bytes/opencode-plugin-lib": ["@four-bytes/opencode-plugin-lib@github:four-bytes/four-opencode-plugin-lib#6fcf394", { "peerDependencies": { "@opencode-ai/plugin": ">=1.16.0", "@opentui/solid": "^0.4.1", "solid-js": "^1.9.13" } }, "four-bytes-four-opencode-plugin-lib-6fcf394", "sha512-KiGhgfknOS6HfrXbQV95Z7IhMeBvN3pwRPqmXj6+XP5Rfl0cCZyLseA2AVLZ+mqI0Z2NtNvEEoFyR9HenogHTg=="], "@huggingface/jinja": ["@huggingface/jinja@0.5.9", "", {}, "sha512-uWTG+l3VJRsl7EXxYizuL3P+cCPoc3cRqbWWRcQN0FhejRfbdq0RNhCmbY/YDtnTcz9icdLYuLDjsnz4d8JMuw=="], diff --git a/package.json b/package.json index 6f43b56..3cf4403 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "four-bytes" ], "dependencies": { - "@four-bytes/opencode-plugin-lib": "file:../four-opencode-plugin-lib", + "@four-bytes/opencode-plugin-lib": "github:four-bytes/four-opencode-plugin-lib#v0.6.1", "@opencode-ai/plugin": "1.16.2", "@opentui/core": "0.3.2", "@opentui/solid": "0.3.2", From 1f910c18068f4f770588a861ff548a61ff7c0a05 Mon Sep 17 00:00:00 2001 From: Robby Date: Wed, 17 Jun 2026 16:38:21 +0200 Subject: [PATCH 5/7] fix: update plugin-lib to v0.6.6 for forProject support #163 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3cf4403..1a4f155 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "four-bytes" ], "dependencies": { - "@four-bytes/opencode-plugin-lib": "github:four-bytes/four-opencode-plugin-lib#v0.6.1", + "@four-bytes/opencode-plugin-lib": "github:four-bytes/four-opencode-plugin-lib#v0.6.6", "@opencode-ai/plugin": "1.16.2", "@opentui/core": "0.3.2", "@opentui/solid": "0.3.2", From a01849250351753c4c10ae1c94013d12a4c2a4e1 Mon Sep 17 00:00:00 2001 From: Robby Date: Wed, 17 Jun 2026 16:40:01 +0200 Subject: [PATCH 6/7] fix: regenerate lockfile for CI compatibility --- bun.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bun.lock b/bun.lock index 7807735..e67dc47 100644 --- a/bun.lock +++ b/bun.lock @@ -5,7 +5,7 @@ "": { "name": "@four-bytes/four-opencode-brain", "dependencies": { - "@four-bytes/opencode-plugin-lib": "github:four-bytes/four-opencode-plugin-lib#v0.6.1", + "@four-bytes/opencode-plugin-lib": "github:four-bytes/four-opencode-plugin-lib#v0.6.6", "@opencode-ai/plugin": "1.16.2", "@opentui/core": "0.3.2", "@opentui/solid": "0.3.2", @@ -81,7 +81,7 @@ "@babel/types": ["@babel/types@7.29.7", "", { "dependencies": { "@babel/helper-string-parser": "^7.29.7", "@babel/helper-validator-identifier": "^7.29.7" } }, "sha512-4zBIxpPzowiZpusoFkyGVwakdRJUyuH5PxQ/PrqghfdFWWasvnCdPfQXHrenDai+gyLARulZjZowCOj6fjT4pA=="], - "@four-bytes/opencode-plugin-lib": ["@four-bytes/opencode-plugin-lib@github:four-bytes/four-opencode-plugin-lib#6fcf394", { "peerDependencies": { "@opencode-ai/plugin": ">=1.16.0", "@opentui/solid": "^0.4.1", "solid-js": "^1.9.13" } }, "four-bytes-four-opencode-plugin-lib-6fcf394", "sha512-KiGhgfknOS6HfrXbQV95Z7IhMeBvN3pwRPqmXj6+XP5Rfl0cCZyLseA2AVLZ+mqI0Z2NtNvEEoFyR9HenogHTg=="], + "@four-bytes/opencode-plugin-lib": ["@four-bytes/opencode-plugin-lib@github:four-bytes/four-opencode-plugin-lib#335bf0e", { "peerDependencies": { "@opencode-ai/plugin": ">=1.16.0", "@opentui/solid": "^0.4.1", "solid-js": "^1.9.13" } }, "four-bytes-four-opencode-plugin-lib-335bf0e", "sha512-I5oCnqL4D14TC2wSSeiGkAz6hHzeTUe6+jeBXeqPx+qv/3VaRiMGjFTFxweF0tl2vCVT3TbJWnr0ZKdIEmy6Pw=="], "@huggingface/jinja": ["@huggingface/jinja@0.5.9", "", {}, "sha512-uWTG+l3VJRsl7EXxYizuL3P+cCPoc3cRqbWWRcQN0FhejRfbdq0RNhCmbY/YDtnTcz9icdLYuLDjsnz4d8JMuw=="], From 653d0f08f2cacea5eef66dc0657f0ca45914eba9 Mon Sep 17 00:00:00 2001 From: Robby Date: Wed, 17 Jun 2026 18:23:59 +0200 Subject: [PATCH 7/7] fix: remove unused PKG_PATH variable from dist-integrity test --- AGENTS.md | 21 +++++++++++++++++++++ test/dist-integrity.test.ts | 1 - 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/AGENTS.md b/AGENTS.md index 2c8e131..d375456 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -44,3 +44,24 @@ For local dev guidance, see `AGENTS.local.md` (gitignored, machine-specific). ## Workflow Issues → Branch → PR → Merge (feature workflow) + + +## Plugin-Lib Dependency Strategy + +`@four-bytes/opencode-plugin-lib` is a shared library used by multiple plugins (brain, tbg, etc.). + +**CI:** `package.json` pins to a GitHub tag: +```json +"@four-bytes/opencode-plugin-lib": "github:four-bytes/four-opencode-plugin-lib#v0.6.6" +``` +When plugin-lib changes are merged: +1. Bump version in plugin-lib's `package.json` +2. Tag: `git tag v0.6.7 && git push --tags` +3. Update all dependent plugins' `package.json` + `bun.lock` to new tag + +**Local dev:** Uses `bun link` to point `node_modules/@four-bytes/opencode-plugin-lib` at the local source `~/four-opencode-plugin-lib`: +```bash +cd ~/four-opencode-plugin-lib && bun link +cd ~/four-opencode-brain && bun link @four-bytes/opencode-plugin-lib +``` +This makes local changes immediately available without re-tagging. NEVER commit a lockfile with symlink paths — always regenerate with `bun install` before pushing. diff --git a/test/dist-integrity.test.ts b/test/dist-integrity.test.ts index ddd25e9..3a8f47c 100644 --- a/test/dist-integrity.test.ts +++ b/test/dist-integrity.test.ts @@ -3,7 +3,6 @@ import { readFileSync } from "fs"; import { join } from "path"; const DIST_PATH = join(import.meta.dir, "..", "dist", "four-opencode-brain.js"); -const PKG_PATH = join(import.meta.dir, "..", "package.json"); describe("dist-integrity", () => { const dist = readFileSync(DIST_PATH, "utf-8");