mirror of
https://github.com/bendtherules/opencode-multi-model.git
synced 2026-08-18 13:42:21 +00:00
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:
@@ -78,6 +78,7 @@ program
|
|||||||
cleanupWorktrees: !options.keepWorktrees,
|
cleanupWorktrees: !options.keepWorktrees,
|
||||||
force: options.force,
|
force: options.force,
|
||||||
createArchiveTags: options.tags,
|
createArchiveTags: options.tags,
|
||||||
|
mode: "cli",
|
||||||
});
|
});
|
||||||
|
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
@@ -107,6 +108,7 @@ program
|
|||||||
const result = await cleanupMultiModel({
|
const result = await cleanupMultiModel({
|
||||||
force: options.force,
|
force: options.force,
|
||||||
remote: options.remote === true ? undefined : options.remote,
|
remote: options.remote === true ? undefined : options.remote,
|
||||||
|
mode: "cli",
|
||||||
});
|
});
|
||||||
|
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
|
|||||||
+2
-2
@@ -73,9 +73,9 @@ async function deleteRemoteTag(
|
|||||||
* @returns Result with counts and details of deleted tags.
|
* @returns Result with counts and details of deleted tags.
|
||||||
*/
|
*/
|
||||||
export async function cleanupMultiModel(
|
export async function cleanupMultiModel(
|
||||||
options: CleanupOptions = {},
|
options: CleanupOptions,
|
||||||
): Promise<CleanupResult> {
|
): Promise<CleanupResult> {
|
||||||
const { force = false, remote } = options;
|
const { force = false, remote, mode } = options;
|
||||||
|
|
||||||
// Get available remotes and archive tags first
|
// Get available remotes and archive tags first
|
||||||
const availableRemotes = await getAvailableRemotes();
|
const availableRemotes = await getAvailableRemotes();
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ export async function closeMultiModel(
|
|||||||
const instructionsArr: string[] = [];
|
const instructionsArr: string[] = [];
|
||||||
const branchesDeleted: string[] = [];
|
const branchesDeleted: string[] = [];
|
||||||
const tagsCreated: string[] = [];
|
const tagsCreated: string[] = [];
|
||||||
|
const mode = options.mode;
|
||||||
|
|
||||||
const safeSessionName = sanitizeName(options.sessionName);
|
const safeSessionName = sanitizeName(options.sessionName);
|
||||||
try {
|
try {
|
||||||
|
|||||||
+1
-1
@@ -41,7 +41,7 @@ export async function openMultiModel(
|
|||||||
const safeSessionName = sanitizeName(sessionName);
|
const safeSessionName = sanitizeName(sessionName);
|
||||||
const models = normalizeModels(options.models);
|
const models = normalizeModels(options.models);
|
||||||
const binaryName = options.binaryName || "opencode";
|
const binaryName = options.binaryName || "opencode";
|
||||||
const mode = options.mode || "cli";
|
const mode = options.mode;
|
||||||
|
|
||||||
if (!sessionName) {
|
if (!sessionName) {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ Arguments:
|
|||||||
const result = await cleanupMultiModel({
|
const result = await cleanupMultiModel({
|
||||||
force: true,
|
force: true,
|
||||||
remote: args.noRemote ? false : args.remote,
|
remote: args.noRemote ? false : args.remote,
|
||||||
|
mode: "tool",
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ Arguments:
|
|||||||
cleanupWorktrees: args.cleanupWorktrees,
|
cleanupWorktrees: args.cleanupWorktrees,
|
||||||
createArchiveTags: args.createArchiveTags,
|
createArchiveTags: args.createArchiveTags,
|
||||||
force: true,
|
force: true,
|
||||||
|
mode: "tool",
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
|
|||||||
+5
-1
@@ -9,7 +9,7 @@ export interface MultiModelOptions {
|
|||||||
/** Binary name to use ('opencode' or 'kilo'). Defaults to 'opencode'. */
|
/** Binary name to use ('opencode' or 'kilo'). Defaults to 'opencode'. */
|
||||||
binaryName?: string;
|
binaryName?: string;
|
||||||
/** Caller context: 'cli' shows shell commands, 'tool' shows tool instructions. */
|
/** 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;
|
cleanupWorktrees?: boolean;
|
||||||
/** Skip confirmation prompts. */
|
/** Skip confirmation prompts. */
|
||||||
force?: boolean;
|
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)
|
* - If false: only local cleanup (--no-remote flag)
|
||||||
*/
|
*/
|
||||||
remote?: string | false;
|
remote?: string | false;
|
||||||
|
/** Caller context: 'cli' shows shell commands, 'tool' shows tool instructions. */
|
||||||
|
mode: "cli" | "tool";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user