Files
opencode-multi-model/src/tools/close.ts
T
bendtherules 46d81b4162 feat(tools): enhance CLI tool descriptions and add remote handling option
- 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.
2026-03-23 10:24:49 +05:30

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;
},
});