mirror of
https://github.com/bendtherules/opencode-multi-model.git
synced 2026-08-18 13:42:21 +00:00
- Updated `cleanupTool` description to include detailed usage and arguments. - Added optional `noRemote` flag to `cleanupTool` for local‑only tag deletion. - Adjusted remote handling logic to respect the new `noRemote` flag. - Expanded `closeTool` description with clear argument documentation. - Expanded `openTool` description with detailed argument documentation.
51 lines
1.6 KiB
TypeScript
51 lines
1.6 KiB
TypeScript
import { tool } from "@opencode-ai/plugin";
|
|
import { closeMultiModel } from "../core/close";
|
|
|
|
/**
|
|
* OpenCode tool definition for closing multi-model tmux sessions.
|
|
*
|
|
* Kills the tmux session and optionally removes git worktrees,
|
|
* creates archive tags, and deletes associated branches.
|
|
*/
|
|
export const closeTool = tool({
|
|
description: `Close a multi-model tmux session and optionally clean up worktrees and branches.
|
|
|
|
Arguments:
|
|
- \`sessionName\` (string, required): tmux session name to close.
|
|
- \`cleanupWorktrees\` (boolean, optional, default: true): Whether to remove worktrees and delete branches.
|
|
- \`createArchiveTags\` (boolean, optional, default: true): Whether to create archive tags before deleting branches.`,
|
|
args: {
|
|
sessionName: tool.schema
|
|
.string()
|
|
.min(1)
|
|
.describe("tmux session name to close"),
|
|
cleanupWorktrees: tool.schema
|
|
.boolean()
|
|
.default(true)
|
|
.describe(
|
|
"whether to remove worktrees and delete branches (default: true)",
|
|
),
|
|
createArchiveTags: tool.schema
|
|
.boolean()
|
|
.default(true)
|
|
.describe(
|
|
"whether to create archive tags before deleting branches (default: true)",
|
|
),
|
|
},
|
|
async execute(args, _context) {
|
|
// In plugin mode, we skip confirmation (force=true) since there's no interactive terminal
|
|
const result = await closeMultiModel({
|
|
sessionName: args.sessionName,
|
|
cleanupWorktrees: args.cleanupWorktrees,
|
|
createArchiveTags: args.createArchiveTags,
|
|
force: true,
|
|
});
|
|
|
|
if (!result.success) {
|
|
return result.error!;
|
|
}
|
|
|
|
return result.instructions;
|
|
},
|
|
});
|