anomalyco / anomalyco/opencode
[BUG]: core migration generator (script/migration.ts) fails on Windows with ENOENT
@Hona is already working on this.
Since Aug 23, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Description
Running bun script/migration.ts --name <anything> from packages/core on Windows fails after drizzle-kit generates the migration:
[✓] Your SQL migration ➜ E:\Temp\opencode-core-migration-XXXX\incremental\<name>\migration.sql 🚀
ENOENT: no such file or directory, open 'E:\Temp\...\incremental\<name>\migration.sql\migration.sql'
Note the doubled migration.sql\migration.sql — the script's generatedMigrations() helper finds files via new Bun.Glob("*/migration.sql").scan(), which yields backslash-separated paths on Windows. file.split("/")[0] then fails to isolate the directory name, so <dir>\migration.sql is used as the migration name and every subsequent path join is wrong. The same broken split also affects --check, so the schema-consistency gate can't pass on Windows either.
Fix is to split on both separators: file.split(/[\\/]/)[0].
Plugins
None.
OpenCode version
v1.18.18 (dev checkout, packages/core script).
Steps to reproduce
- On Windows, in a dev checkout of the repo, edit
packages/core/src/session/sql.ts(any schema change). cd packages/core && bun script/migration.ts --name test_idx.- drizzle-kit succeeds, then the script dies with ENOENT before writing any files.
Screenshot and/or share link
N/A (CLI output above).
Operating System
Windows 11 (Bun 1.3.9). Works fine on Linux/macOS where glob paths use /.
Terminal
Windows Terminal.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.