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.8 KiB
TypeScript
62 lines
1.8 KiB
TypeScript
/**
|
|
* `workflow convert` — Convert a .sop.md file to a YAML workflow definition.
|
|
*
|
|
* Reads the SOP markdown file, parses its structure, and outputs
|
|
* a corresponding YAML workflow definition.
|
|
*
|
|
* @example
|
|
* workflow convert deploy.sop.md
|
|
* workflow convert deploy.sop.md --output workflows/deploy.yaml
|
|
*/
|
|
|
|
import type { CliOptions } from '../utils.js';
|
|
import { printJson } from '../utils.js';
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// Stub: engine integration (not implemented yet)
|
|
// ---------------------------------------------------------------------------
|
|
|
|
interface ConvertResult {
|
|
inputFile: string;
|
|
outputFile: string;
|
|
workflowName: string;
|
|
nodeCount: number;
|
|
}
|
|
|
|
async function convertSopToYaml(
|
|
_inputPath: string,
|
|
_outputPath?: string,
|
|
): Promise<ConvertResult> {
|
|
throw new Error('not implemented yet: convertSopToYaml');
|
|
}
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// Command handler
|
|
// ---------------------------------------------------------------------------
|
|
|
|
export async function convertCommand(
|
|
args: string[],
|
|
options: CliOptions,
|
|
): Promise<void> {
|
|
if (args.length === 0) {
|
|
throw new Error('Missing required argument: <file.sop.md>\n\nUsage: workflow convert <file.sop.md> [--output <path>]');
|
|
}
|
|
|
|
const inputPath = args[0]!;
|
|
|
|
if (!inputPath.endsWith('.sop.md')) {
|
|
throw new Error(`Input file must end with .sop.md, got: ${inputPath}`);
|
|
}
|
|
|
|
const result = await convertSopToYaml(inputPath, options.output);
|
|
|
|
if (options.json) {
|
|
printJson(result);
|
|
return;
|
|
}
|
|
|
|
console.log(`Converted: ${result.inputFile}`);
|
|
console.log(` Output: ${result.outputFile}`);
|
|
console.log(` Workflow: ${result.workflowName}`);
|
|
console.log(` Nodes: ${result.nodeCount}`);
|
|
} |