New @boocode/ion package (v0.0.1) for inference optimization network. .codesight/ wiki artifacts for codebase documentation. .omo/ work plans for openspec cleanup and enhanced file panel.
62 lines
1.6 KiB
TypeScript
62 lines
1.6 KiB
TypeScript
/**
|
|
* `workflow reject` — Reject a paused workflow run.
|
|
*
|
|
* Sets $REJECTION_REASON with the provided reason string.
|
|
*
|
|
* @example
|
|
* workflow reject abc123
|
|
* workflow reject abc123 "Not compliant" --json
|
|
*/
|
|
|
|
import type { CliOptions } from '../utils.js';
|
|
import { printJson } from '../utils.js';
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// Stub: engine integration (not implemented yet)
|
|
// ---------------------------------------------------------------------------
|
|
|
|
interface RejectResult {
|
|
runId: string;
|
|
rejected: boolean;
|
|
reason?: string;
|
|
message: string;
|
|
}
|
|
|
|
async function rejectWorkflowRun(
|
|
_runId: string,
|
|
_reason?: string,
|
|
): Promise<RejectResult> {
|
|
throw new Error('not implemented yet: rejectWorkflowRun');
|
|
}
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// Command handler
|
|
// ---------------------------------------------------------------------------
|
|
|
|
export async function rejectCommand(
|
|
args: string[],
|
|
options: CliOptions,
|
|
): Promise<void> {
|
|
if (args.length === 0) {
|
|
throw new Error('Missing required argument: <run-id>\n\nUsage: workflow reject <run-id> [reason] [--json]');
|
|
}
|
|
|
|
const runId = args[0]!;
|
|
const reason = args.length > 1 ? args.slice(1).join(' ') : undefined;
|
|
|
|
const result = await rejectWorkflowRun(runId, reason);
|
|
|
|
if (options.json) {
|
|
printJson(result);
|
|
return;
|
|
}
|
|
|
|
if (result.rejected) {
|
|
console.log(`✗ Run ${result.runId} rejected.`);
|
|
if (result.reason) {
|
|
console.log(` Reason: ${result.reason}`);
|
|
}
|
|
} else {
|
|
console.log(`Failed to reject run ${result.runId}: ${result.message}`);
|
|
}
|
|
} |