chore: add ion package, codesight wiki, work plans, ascli config
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.
This commit is contained in:
66
packages/ion/src/cli/commands/validate.ts
Normal file
66
packages/ion/src/cli/commands/validate.ts
Normal file
@@ -0,0 +1,66 @@
|
||||
/**
|
||||
* `workflow validate` — Validate a workflow definition without executing.
|
||||
*
|
||||
* Loads the workflow, runs schema validation, and reports any errors.
|
||||
*
|
||||
* @example
|
||||
* workflow validate deploy
|
||||
* workflow validate deploy --json
|
||||
*/
|
||||
|
||||
import type { CliOptions } from '../utils.js';
|
||||
import { printJson } from '../utils.js';
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Stub: engine integration (not implemented yet)
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
interface ValidationError {
|
||||
path: string;
|
||||
message: string;
|
||||
}
|
||||
|
||||
interface ValidateResult {
|
||||
valid: boolean;
|
||||
errors: ValidationError[];
|
||||
workflowName: string;
|
||||
}
|
||||
|
||||
async function validateWorkflow(
|
||||
_name: string,
|
||||
_cwd?: string,
|
||||
): Promise<ValidateResult> {
|
||||
throw new Error('not implemented yet: validateWorkflow');
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Command handler
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export async function validateCommand(
|
||||
args: string[],
|
||||
options: CliOptions,
|
||||
): Promise<void> {
|
||||
if (args.length === 0) {
|
||||
throw new Error('Missing required argument: <name>\n\nUsage: workflow validate <name> [--json]');
|
||||
}
|
||||
|
||||
const workflowName = args[0]!;
|
||||
|
||||
const result = await validateWorkflow(workflowName, options.cwd);
|
||||
|
||||
if (options.json) {
|
||||
printJson(result);
|
||||
return;
|
||||
}
|
||||
|
||||
if (result.valid) {
|
||||
console.log(`✓ Workflow "${result.workflowName}" is valid.`);
|
||||
} else {
|
||||
console.log(`✗ Workflow "${result.workflowName}" has ${result.errors.length} error(s):`);
|
||||
console.log('');
|
||||
for (const err of result.errors) {
|
||||
console.log(` ${err.path}: ${err.message}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user