fix(sandbox): compare list to config images (#563) - thanks @pasogott

This commit is contained in:
Peter Steinberger
2026-01-09 13:29:47 +01:00
parent 7883491ce2
commit 201c879772
3 changed files with 38 additions and 6 deletions

View File

@@ -72,7 +72,9 @@ export async function sandboxRecreateCommand(
opts: SandboxRecreateOptions,
runtime: RuntimeEnv,
): Promise<void> {
validateRecreateOptions(opts, runtime);
if (!validateRecreateOptions(opts, runtime)) {
return;
}
const filtered = await fetchAndFilterContainers(opts);
@@ -101,10 +103,11 @@ export async function sandboxRecreateCommand(
function validateRecreateOptions(
opts: SandboxRecreateOptions,
runtime: RuntimeEnv,
): void {
): boolean {
if (!opts.all && !opts.session && !opts.agent) {
runtime.error("Please specify --all, --session <key>, or --agent <id>");
runtime.exit(1);
return false;
}
const exclusiveCount = [opts.all, opts.session, opts.agent].filter(
@@ -113,7 +116,10 @@ function validateRecreateOptions(
if (exclusiveCount > 1) {
runtime.error("Please specify only one of: --all, --session, --agent");
runtime.exit(1);
return false;
}
return true;
}
// --- Filtering ---