mirror of
https://github.com/bendtherules/opencode-multi-model.git
synced 2026-08-18 21:52:11 +00:00
build: add biome formatter and linter
This commit is contained in:
+60
-37
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bun
|
||||
import { Command } from "commander";
|
||||
import { openMultiModel } from "./core/open";
|
||||
import { closeMultiModel } from "./core/close";
|
||||
import { openMultiModel } from "./core/open";
|
||||
import { getBinaryName } from "./core/utils";
|
||||
|
||||
const program = new Command();
|
||||
@@ -15,57 +15,80 @@ program
|
||||
.command("open")
|
||||
.description("Create a new multi-model tmux session")
|
||||
.argument("<session-name>", "Name for the tmux session")
|
||||
.option("-m, --models <models...>", "Model IDs to launch (space-separated)", [])
|
||||
.option("-b, --binary <binary>", "Binary to use (opencode or kilo). Defaults to env var OPENCODE_MULTI_MODEL_BINARY or 'opencode'")
|
||||
.action(async (sessionName: string, options: { models: string[]; binary?: string }) => {
|
||||
try {
|
||||
const binaryName = options.binary || getBinaryName();
|
||||
.option(
|
||||
"-m, --models <models...>",
|
||||
"Model IDs to launch (space-separated)",
|
||||
[],
|
||||
)
|
||||
.option(
|
||||
"-b, --binary <binary>",
|
||||
"Binary to use (opencode or kilo). Defaults to env var OPENCODE_MULTI_MODEL_BINARY or 'opencode'",
|
||||
)
|
||||
.action(
|
||||
async (
|
||||
sessionName: string,
|
||||
options: { models: string[]; binary?: string },
|
||||
) => {
|
||||
try {
|
||||
const binaryName = options.binary || getBinaryName();
|
||||
|
||||
const result = await openMultiModel({
|
||||
sessionName,
|
||||
models: options.models,
|
||||
binaryName,
|
||||
mode: "cli",
|
||||
});
|
||||
const result = await openMultiModel({
|
||||
sessionName,
|
||||
models: options.models,
|
||||
binaryName,
|
||||
mode: "cli",
|
||||
});
|
||||
|
||||
if (result.success) {
|
||||
console.log(result.instructions || `Created session: ${result.sessionName}`);
|
||||
} else {
|
||||
console.error(`Failed: ${result.error}`);
|
||||
if (result.success) {
|
||||
console.log(
|
||||
result.instructions || `Created session: ${result.sessionName}`,
|
||||
);
|
||||
} else {
|
||||
console.error(`Failed: ${result.error}`);
|
||||
process.exit(1);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(`Error: ${error}`);
|
||||
process.exit(1);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(`Error: ${error}`);
|
||||
process.exit(1);
|
||||
}
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
program
|
||||
.command("close")
|
||||
.description("Close a multi-model tmux session")
|
||||
.argument("<session-name>", "Name of the tmux session to close")
|
||||
.option("--keep-worktrees", "Do not remove worktrees and delete branches", false)
|
||||
.option(
|
||||
"--keep-worktrees",
|
||||
"Do not remove worktrees and delete branches",
|
||||
false,
|
||||
)
|
||||
.option("--no-tags", "Create archive tags before deleting branches")
|
||||
.option("-f, --force", "Skip confirmation prompts", false)
|
||||
.action(async (sessionName: string, options: { keepWorktrees: boolean; force: boolean; tags: boolean }) => {
|
||||
try {
|
||||
const result = await closeMultiModel({
|
||||
sessionName,
|
||||
cleanupWorktrees: !options.keepWorktrees,
|
||||
force: options.force,
|
||||
createArchiveTags: options.tags,
|
||||
});
|
||||
.action(
|
||||
async (
|
||||
sessionName: string,
|
||||
options: { keepWorktrees: boolean; force: boolean; tags: boolean },
|
||||
) => {
|
||||
try {
|
||||
const result = await closeMultiModel({
|
||||
sessionName,
|
||||
cleanupWorktrees: !options.keepWorktrees,
|
||||
force: options.force,
|
||||
createArchiveTags: options.tags,
|
||||
});
|
||||
|
||||
if (result.success) {
|
||||
if (result.success) {
|
||||
console.log(result.instructions);
|
||||
} else {
|
||||
console.error(`Failed: ${result.error}`);
|
||||
console.error(`Failed: ${result.error}`);
|
||||
process.exit(1);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(`Error: ${error}`);
|
||||
process.exit(1);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(`Error: ${error}`);
|
||||
process.exit(1);
|
||||
}
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
program.parse();
|
||||
|
||||
Reference in New Issue
Block a user