Skip to content
This repository was archived by the owner on May 18, 2026. It is now read-only.

refactor: migrate to Bun monorepo built on forked OpenCode source#5

Merged
GusCayresMindsight merged 4 commits into
masterfrom
feat/bun-monorepo
May 15, 2026
Merged

refactor: migrate to Bun monorepo built on forked OpenCode source#5
GusCayresMindsight merged 4 commits into
masterfrom
feat/bun-monorepo

Conversation

@GusCayresMindsight

Copy link
Copy Markdown
Owner

Summary

  • Forks `anomalyco/opencode` into `packages/opencode` and renames the binary `opencode` → `ow`; builds from source via Bun — no external binary dependency
  • Adds `packages/workspace`: TypeScript port of all tool-retrieval logic (corpus indexer, ONNX embedder, MCP client, semantic search, telemetry), registered as an `@ow/workspace` workspace package
  • Integrates five new native CLI commands into the `ow` binary: `ow corpus index`, `ow corpus retrieve`, `ow corpus stats`, `ow corpus mcp-serve`, and `ow ws` (tmux workspace management)
  • Registers `ToolRetrievalPlugin` as a built-in internal plugin in `packages/opencode/src/plugin/index.ts` — fires on the first user message per session to inject relevant MCP tool context, no separate file install required
  • Removes the old Node.js wrapper (`bin/`, `src/`, `lib/`, `unit-tests/`, Cucumber config, `package-lock.json`)
  • Adds Bun workspace root: `package.json` (workspaces + catalog), `bun.lock`, `bunfig.toml`, `turbo.json`, `patches/`
  • Updates `Makefile`: `make install` → `bun install`, `make build` → `bun build --single --skip-embed-web-ui`, `make smoke` → build + corpus retrieval assertion

- Fork anomalyco/opencode into packages/opencode; rename binary opencode → ow
- Add packages/workspace: TypeScript port of all tool-retrieval logic
  (corpus indexer, embedder, MCP client, semantic search, telemetry)
- Add ow corpus index|retrieve|stats|mcp-serve commands natively to the binary
- Add ow ws command for tmux workspace management
- Register ToolRetrievalPlugin as a built-in internal plugin (no separate install)
- Remove Node.js wrapper: bin/, src/, lib/, unit-tests/, package-lock.json
- Add Bun workspace root: package.json, bun.lock, bunfig.toml, turbo.json
- Update Makefile: make install/build/dev/smoke use bun directly
- Binary built from source via: make build (bun run build --single --skip-embed-web-ui)
Comment thread packages/core/src/util/identifier.ts Dismissed
Comment thread packages/opencode/src/acp/agent.ts Dismissed
Comment thread packages/opencode/src/cli/cmd/github.ts Dismissed
Comment thread packages/opencode/src/cli/cmd/run.ts Dismissed
Comment thread packages/opencode/src/id/id.ts Dismissed
Comment thread packages/opencode/test/config/config.test.ts Dismissed
Comment thread packages/ui/src/context/marked.tsx Dismissed
Comment thread packages/opencode/src/util/process.ts Dismissed
Comment thread packages/sdk/js/src/v2/gen/core/params.gen.ts Dismissed
Comment thread packages/sdk/js/src/v2/gen/core/params.gen.ts Dismissed
- Remove obsolete feature files: installation, mcp-servers, permissions
- Rewrite retrieval.feature for search() / ow corpus retrieve
- Update 8 feature files for new ow architecture (paths, command names)
- Add testability hooks: createTestDb, loadConfigFromFile,
  appendSessionToFile, readSessionsFromFile, loadMcpEnvFromFile,
  export bruteForceSearch, extract handleSearchTools
- Write 8 test files (70 tests, 0 failures, ~80 ms):
  config, hash, corpus, search, telemetry, mcp-client, mcp-serve, plugin
- Rewrite AGENTS.md: BDD-first workflow is now the opening rule
- Update CI workflow: bun test runs before make build
When TMUX env var is not set, intercept zero-arg invocation in index.ts
and call runWorkspace() directly. Inside tmux (right pane or any tmux
context), TMUX is set so the check is skipped and the TUI starts normally.
Extract runWorkspace() from effectCmd handler so it can be called without
the Effect runtime.
@GusCayresMindsight GusCayresMindsight merged commit b80765d into master May 15, 2026
4 checks passed
@GusCayresMindsight GusCayresMindsight deleted the feat/bun-monorepo branch May 15, 2026 22:12
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants