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:
2026-03-23 09:43:43 +05:30
parent 42f153a28f
commit 6e2521b70d
9 changed files with 747 additions and 4 deletions
+45
View File
@@ -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.`
);
},
});