mirror of
https://github.com/bendtherules/opencode-multi-model.git
synced 2026-08-18 13:42:21 +00:00
- Made `mode` a mandatory property in `MultiModelOptions`, `CloseSessionOptions`, and `CleanupOptions`. - Updated function signatures to accept `mode` and removed default empty option objects where appropriate. - Passed `mode: "cli"` from CLI commands and `mode: "tool"` from tool commands to cleanup, close, and open operations. - Adjusted internal handling to use the provided `mode` (removed fallback defaults). - Updated type definitions and added documentation for the new `mode` field.
46 lines
1.4 KiB
TypeScript
46 lines
1.4 KiB
TypeScript
import { tool } from "@opencode-ai/plugin";
|
|
import { cleanupMultiModel } from "../core/cleanup";
|
|
|
|
/**
|
|
* OpenCode tool definition for cleaning up archive tags.
|
|
*
|
|
* Deletes archive tags (format: archive/*) from local and remote repositories.
|
|
* Used to clean up recovery tags created by the close command.
|
|
*/
|
|
export const cleanupTool = tool({
|
|
description: `Delete all archive tags from the local repository and, optionally, from a remote.
|
|
|
|
Arguments:
|
|
-\`remote\` (string, optional): Specify a remote name to which deletions should be pushed. If omitted, the first available remote is used.
|
|
- \`noRemote\` (boolean, optional): When true, only delete local tags and do not push deletions to any remote.`,
|
|
args: {
|
|
remote: tool.schema
|
|
.string()
|
|
.optional()
|
|
.describe(
|
|
"Remote handling: string=specific remote, undefined=first available remote",
|
|
),
|
|
noRemote: tool.schema
|
|
.boolean()
|
|
.default(false)
|
|
.describe("Only delete local tags, don't push to remote.")
|
|
.optional(),
|
|
},
|
|
async execute(args, _context) {
|
|
// In plugin mode, we skip confirmation (force=true)
|
|
const result = await cleanupMultiModel({
|
|
force: true,
|
|
remote: args.noRemote ? false : args.remote,
|
|
mode: "tool",
|
|
});
|
|
|
|
if (!result.success) {
|
|
return result.error!;
|
|
}
|
|
|
|
return (
|
|
result.instructions ?? `Deleted ${result.localTagsDeleted} local tags.`
|
|
);
|
|
},
|
|
});
|