Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
8 changes: 5 additions & 3 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
32 changes: 32 additions & 0 deletions test/dist-integrity.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
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");

describe("dist-integrity", () => {
const dist = readFileSync(DIST_PATH, "utf-8");

test("forProject is present at least 1 time (call site)", () => {
const matches = dist.match(/forProject/g) ?? [];
expect(matches.length).toBeGreaterThanOrEqual(1);
});

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);
});
});
Loading