Problem
The brain plugin had a bug where forProject was stripped from the bundled dist because the dependency was pinned to a stale version. This went undetected because there was no post-build verification.
Test File
Create test/dist-integrity.test.ts with the following test cases:
forProject is present in the server dist — read dist/four-opencode-brain.js, verify forProject appears at least 2 times (definition + call site). If only 1 occurrence, method was stripped → FAIL.
forService is present — verify at least 2 occurrences (definition + call site).
forSession is present — verify at least 1 occurrence (definition).
- Brain version matches package.json — read version from
package.json, verify it appears in the dist.
Integration
Add "test": "bun test" to package.json scripts.
Verification
Run bun test after build to confirm all checks pass.
Problem
The brain plugin had a bug where
forProjectwas stripped from the bundled dist because the dependency was pinned to a stale version. This went undetected because there was no post-build verification.Test File
Create
test/dist-integrity.test.tswith the following test cases:forProjectis present in the server dist — readdist/four-opencode-brain.js, verifyforProjectappears at least 2 times (definition + call site). If only 1 occurrence, method was stripped → FAIL.forServiceis present — verify at least 2 occurrences (definition + call site).forSessionis present — verify at least 1 occurrence (definition).package.json, verify it appears in the dist.Integration
Add
"test": "bun test"topackage.jsonscripts.Verification
Run
bun testafter build to confirm all checks pass.