feat: add required mode flag to cleanup and close

- 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.
This commit is contained in:
2026-03-23 13:59:05 +05:30
parent 415b0624f1
commit 6b07a7ac2a
7 changed files with 13 additions and 4 deletions
+2
View File
@@ -78,6 +78,7 @@ program
cleanupWorktrees: !options.keepWorktrees,
force: options.force,
createArchiveTags: options.tags,
mode: "cli",
});
if (result.success) {
@@ -107,6 +108,7 @@ program
const result = await cleanupMultiModel({
force: options.force,
remote: options.remote === true ? undefined : options.remote,
mode: "cli",
});
if (result.success) {
+2 -2
View File
@@ -73,9 +73,9 @@ async function deleteRemoteTag(
* @returns Result with counts and details of deleted tags.
*/
export async function cleanupMultiModel(
options: CleanupOptions = {},
options: CleanupOptions,
): Promise<CleanupResult> {
const { force = false, remote } = options;
const { force = false, remote, mode } = options;
// Get available remotes and archive tags first
const availableRemotes = await getAvailableRemotes();
+1
View File
@@ -56,6 +56,7 @@ export async function closeMultiModel(
const instructionsArr: string[] = [];
const branchesDeleted: string[] = [];
const tagsCreated: string[] = [];
const mode = options.mode;
const safeSessionName = sanitizeName(options.sessionName);
try {
+1 -1
View File
@@ -41,7 +41,7 @@ export async function openMultiModel(
const safeSessionName = sanitizeName(sessionName);
const models = normalizeModels(options.models);
const binaryName = options.binaryName || "opencode";
const mode = options.mode || "cli";
const mode = options.mode;
if (!sessionName) {
return {
+1
View File
@@ -31,6 +31,7 @@ Arguments:
const result = await cleanupMultiModel({
force: true,
remote: args.noRemote ? false : args.remote,
mode: "tool",
});
if (!result.success) {
+1
View File
@@ -39,6 +39,7 @@ Arguments:
cleanupWorktrees: args.cleanupWorktrees,
createArchiveTags: args.createArchiveTags,
force: true,
mode: "tool",
});
if (!result.success) {
+5 -1
View File
@@ -9,7 +9,7 @@ export interface MultiModelOptions {
/** Binary name to use ('opencode' or 'kilo'). Defaults to 'opencode'. */
binaryName?: string;
/** Caller context: 'cli' shows shell commands, 'tool' shows tool instructions. */
mode?: "cli" | "tool";
mode: "cli" | "tool";
}
/**
@@ -40,6 +40,8 @@ export interface CloseSessionOptions {
cleanupWorktrees?: boolean;
/** Skip confirmation prompts. */
force?: boolean;
/** Caller context: 'cli' shows shell commands, 'tool' shows tool instructions. */
mode: "cli" | "tool";
}
/**
@@ -87,6 +89,8 @@ export interface CleanupOptions {
* - If false: only local cleanup (--no-remote flag)
*/
remote?: string | false;
/** Caller context: 'cli' shows shell commands, 'tool' shows tool instructions. */
mode: "cli" | "tool";
}
/**