Merge pull request #868 from pikasTech/fix/862-trigger-current-summary
补齐 AgentRun trigger-current 默认输出摘要
This commit is contained in:
+18
-3
@@ -111,7 +111,11 @@ export async function runAgentRunCommand(config: UniDeskConfig | null, args: str
|
||||
if (action === "secret-sync") return await secretSync(config, parseSecretSyncOptions(actionArgs));
|
||||
if (action === "restart") return await restartYamlLane(config, parseLaneConfirmOptions(actionArgs));
|
||||
if (action === "expose") return await exposeAgentRun(config, parseConfirmOptions(actionArgs));
|
||||
if (action === "trigger-current") return await triggerCurrent(config, parseTriggerOptions(actionArgs));
|
||||
if (action === "trigger-current") {
|
||||
const options = parseTriggerOptions(actionArgs);
|
||||
const result = await triggerCurrent(config, options);
|
||||
return options.full || options.raw || !isRecord(result.target) ? result : renderAgentRunControlPlaneActionSummary(result, "AGENTRUN TRIGGER CURRENT");
|
||||
}
|
||||
if (action === "refresh") {
|
||||
const options = parseRefreshOptions(actionArgs);
|
||||
const result = await refresh(config, options);
|
||||
@@ -1830,7 +1834,7 @@ function isRecord(value: unknown): value is Record<string, unknown> {
|
||||
return typeof value === "object" && value !== null && !Array.isArray(value);
|
||||
}
|
||||
|
||||
interface TriggerOptions {
|
||||
interface TriggerOptions extends DisclosureOptions {
|
||||
confirm: boolean;
|
||||
dryRun: boolean;
|
||||
node: string | null;
|
||||
@@ -2004,9 +2008,20 @@ function parseTriggerOptions(args: string[]): TriggerOptions {
|
||||
let node: string | null = null;
|
||||
let lane: string | null = null;
|
||||
let wait = false;
|
||||
let full = false;
|
||||
let raw = false;
|
||||
for (let index = 0; index < args.length; index += 1) {
|
||||
const arg = args[index];
|
||||
if (arg === "--confirm" || arg === "--dry-run") continue;
|
||||
if (arg === "--full") {
|
||||
full = true;
|
||||
continue;
|
||||
}
|
||||
if (arg === "--raw") {
|
||||
raw = true;
|
||||
full = true;
|
||||
continue;
|
||||
}
|
||||
if (arg === "--wait") {
|
||||
wait = true;
|
||||
continue;
|
||||
@@ -2027,7 +2042,7 @@ function parseTriggerOptions(args: string[]): TriggerOptions {
|
||||
}
|
||||
throw new Error(`unsupported trigger-current option: ${arg}`);
|
||||
}
|
||||
return { ...base, node, lane, wait };
|
||||
return { ...base, node, lane, wait, full, raw };
|
||||
}
|
||||
|
||||
function parseSecretSyncOptions(args: string[]): SecretSyncOptions {
|
||||
|
||||
Reference in New Issue
Block a user