plan: use bun 1

This commit is contained in:
2026-03-19 18:06:25 +05:30
parent 81ba9c7bc9
commit 0f35f0a66d
+17 -6
View File
@@ -479,7 +479,7 @@ export * from "./core/index";
```typescript ```typescript
// src/cli.ts // src/cli.ts
#!/usr/bin/env node #!/usr/bin/env bun
import { Command } from "commander"; import { Command } from "commander";
import { launchMultiModel } from "./core/launch"; import { launchMultiModel } from "./core/launch";
import { closeMultiModel } from "./core/close"; import { closeMultiModel } from "./core/close";
@@ -596,7 +596,7 @@ export { openTool, closeTool };
// package.json scripts // package.json scripts
{ {
"scripts": { "scripts": {
"build": "bun build src/index.ts src/cli.ts --outdir dist --target bun --format esm", "build": "bun build src/index.ts src/cli.ts --outdir dist --target bun --format esm --experimental-dts",
"test": "bun test", "test": "bun test",
"prepublishOnly": "bun run build" "prepublishOnly": "bun run build"
} }
@@ -642,7 +642,9 @@ npm install -g @username/opencode-multi-model
opencode-multi-model open my-session -m openai/gpt-4o opencode-multi-model open my-session -m openai/gpt-4o
``` ```
### As Project Tool (for development) ### As Project Tool
If you installed it via NPM and want to use it as a project tool, import it from the package:
```typescript ```typescript
// .opencode/tools/multi-model.ts // .opencode/tools/multi-model.ts
@@ -650,6 +652,15 @@ import { openTool, closeTool } from "@username/opencode-multi-model"
export { openTool, closeTool } export { openTool, closeTool }
``` ```
If you are developing this package locally and want to test it in a project without publishing, import via relative paths:
```typescript
// .opencode/tools/multi-model.ts
import { openTool } from "../../src/tools/open"
import { closeTool } from "../../src/tools/close"
export { openTool, closeTool }
```
## Usage ## Usage
### Plugin Usage ### Plugin Usage
@@ -773,13 +784,13 @@ This allows testing the tool without publishing to npm.
3. **CLI Test**: 3. **CLI Test**:
```bash ```bash
# Test open # Test open
node dist/cli.js open test-session -m openai/gpt-4o bun dist/cli.js open test-session -m openai/gpt-4o
# Test close # Test close
node dist/cli.js close test-session bun dist/cli.js close test-session
# Test env var # Test env var
OPENCODE_MULTI_MODEL_BINARY=kilo node dist/cli.js open test-session -m openai/gpt-4o OPENCODE_MULTI_MODEL_BINARY=kilo bun dist/cli.js open test-session -m openai/gpt-4o
``` ```
4. **Plugin Test**: 4. **Plugin Test**:
- Link package locally with `bun link` - Link package locally with `bun link`