Add remote gc for provider hosts
This commit is contained in:
+6
-1
@@ -3,6 +3,7 @@ import { closeSync, existsSync, ftruncateSync, lstatSync, mkdirSync, openSync, r
|
||||
import { basename, join, resolve } from "node:path";
|
||||
|
||||
import { type UniDeskConfig, repoRoot, rootPath } from "./config";
|
||||
import { runRemoteGcCommand } from "./gc-remote";
|
||||
|
||||
type GcRisk = "low" | "medium" | "high" | "blocked";
|
||||
type GcItemKind =
|
||||
@@ -183,6 +184,10 @@ const TMP_EXACT_PROTECT = new Set([
|
||||
|
||||
export async function runGcCommand(config: UniDeskConfig, args: string[]): Promise<unknown> {
|
||||
const [action = "plan", ...rest] = args;
|
||||
if (action === "remote") {
|
||||
const [providerId, subaction = "plan", ...remoteArgs] = rest;
|
||||
return await runRemoteGcCommand(config, providerId, subaction, remoteArgs);
|
||||
}
|
||||
if (action === "policy") {
|
||||
const [subaction = "plan", ...policyArgs] = rest;
|
||||
const options = parseGcPolicyOptions(policyArgs);
|
||||
@@ -243,7 +248,7 @@ export async function runGcCommand(config: UniDeskConfig, args: string[]): Promi
|
||||
ok: false,
|
||||
error: "unsupported-gc-action",
|
||||
action,
|
||||
supportedActions: ["plan", "run", "db-trace", "policy"],
|
||||
supportedActions: ["plan", "run", "db-trace", "policy", "remote"],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user