feat: add controlled AgentRun CI cleanup
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
import { agentRunHelp } from "./src/agentrun";
|
||||
import { rootHelp } from "./src/help";
|
||||
|
||||
function assertCondition(condition: unknown, message: string, detail: unknown = {}): void {
|
||||
if (!condition) throw new Error(`${message}: ${JSON.stringify(detail)}`);
|
||||
}
|
||||
|
||||
const agentRunUsage = Array.isArray((agentRunHelp() as { usage?: unknown }).usage)
|
||||
? ((agentRunHelp() as { usage: unknown[] }).usage).map(String)
|
||||
: [];
|
||||
|
||||
assertCondition(
|
||||
agentRunUsage.some((line) => line.includes("control-plane cleanup-runs --min-age-minutes 30 --limit 200 --dry-run"))
|
||||
&& agentRunUsage.some((line) => line.includes("control-plane cleanup-runs --min-age-minutes 30 --limit 200 --confirm"))
|
||||
&& agentRunUsage.some((line) => line.includes("control-plane cleanup-released-pvs --limit 200 --dry-run"))
|
||||
&& agentRunUsage.some((line) => line.includes("control-plane cleanup-released-pvs --limit 200 --confirm")),
|
||||
"AgentRun help must expose controlled CI workspace retention commands",
|
||||
agentRunUsage,
|
||||
);
|
||||
|
||||
const globalHelp = JSON.stringify(rootHelp());
|
||||
|
||||
assertCondition(
|
||||
globalHelp.includes("agentrun v01 control-plane status|trigger-current|refresh|cleanup-runs|cleanup-released-pvs"),
|
||||
"global help must index AgentRun cleanup entrypoints",
|
||||
rootHelp(),
|
||||
);
|
||||
|
||||
console.log(JSON.stringify({
|
||||
ok: true,
|
||||
checks: [
|
||||
"AgentRun command help exposes cleanup-runs and cleanup-released-pvs",
|
||||
"global help indexes AgentRun cleanup entrypoints",
|
||||
],
|
||||
}));
|
||||
Reference in New Issue
Block a user