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.
55 lines
1.5 KiB
TypeScript
55 lines
1.5 KiB
TypeScript
/**
|
|
* `workflow abandon` — Cancel a non-terminal workflow run.
|
|
*
|
|
* Marks the run as cancelled. Only works on runs that are not
|
|
* already in a terminal state (completed, failed, cancelled).
|
|
*
|
|
* @example
|
|
* workflow abandon abc123
|
|
* workflow abandon abc123 --json
|
|
*/
|
|
|
|
import type { CliOptions } from '../utils.js';
|
|
import { printJson } from '../utils.js';
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// Stub: engine integration (not implemented yet)
|
|
// ---------------------------------------------------------------------------
|
|
|
|
interface AbandonResult {
|
|
runId: string;
|
|
abandoned: boolean;
|
|
message: string;
|
|
}
|
|
|
|
async function abandonWorkflowRun(_runId: string): Promise<AbandonResult> {
|
|
throw new Error('not implemented yet: abandonWorkflowRun');
|
|
}
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// Command handler
|
|
// ---------------------------------------------------------------------------
|
|
|
|
export async function abandonCommand(
|
|
args: string[],
|
|
options: CliOptions,
|
|
): Promise<void> {
|
|
if (args.length === 0) {
|
|
throw new Error('Missing required argument: <run-id>\n\nUsage: workflow abandon <run-id> [--json]');
|
|
}
|
|
|
|
const runId = args[0]!;
|
|
|
|
const result = await abandonWorkflowRun(runId);
|
|
|
|
if (options.json) {
|
|
printJson(result);
|
|
return;
|
|
}
|
|
|
|
if (result.abandoned) {
|
|
console.log(`⊘ Run ${result.runId} abandoned (cancelled).`);
|
|
} else {
|
|
console.log(`Failed to abandon run ${result.runId}: ${result.message}`);
|
|
}
|
|
} |