mirror of
https://github.com/bendtherules/opencode-multi-model.git
synced 2026-08-18 13:42:21 +00:00
feat: add multi-model cleanup tool and CLI command
- Bump `@opencode-ai/plugin` dependency from 1.2.27 to 1.3.0. - Introduce `cleanup` command in CLI with force and remote options. - Export `cleanupMultiModel` from core index. - Register `multi-model-cleanup` tool in plugin and update exports. - Add `CleanupOptions` and `CleanupResult` types to define cleanup behavior and results.
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
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 local and optionally remote repository",
|
||||
args: {
|
||||
remote: tool.schema
|
||||
.union([
|
||||
tool.schema
|
||||
.string()
|
||||
.describe(
|
||||
"Remote name to push deletions to. Error if doesn't exist.",
|
||||
),
|
||||
tool.schema
|
||||
.literal(false)
|
||||
.describe("Only delete local tags, don't push to remote."),
|
||||
])
|
||||
.optional()
|
||||
.describe(
|
||||
"Remote handling: string=specific remote, false=local-only, undefined=first available remote",
|
||||
),
|
||||
},
|
||||
async execute(args, _context) {
|
||||
// In plugin mode, we skip confirmation (force=true)
|
||||
const result = await cleanupMultiModel({
|
||||
force: true,
|
||||
remote: args.remote,
|
||||
});
|
||||
|
||||
if (!result.success) {
|
||||
return result.error!;
|
||||
}
|
||||
|
||||
return (
|
||||
result.instructions ?? `Deleted ${result.localTagsDeleted} local tags.`
|
||||
);
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user