/** * `workflow list` — List all available workflows. * * Discovers workflows from both bundled and project sources and displays * them in a formatted table (or JSON with --json). * * @example * workflow list * workflow list --json */ import type { CliOptions } from '../utils.js'; import { printTable, printJson } from '../utils.js'; // --------------------------------------------------------------------------- // Stub: engine integration (not implemented yet) // --------------------------------------------------------------------------- interface WorkflowEntry { name: string; description: string; source: 'bundled' | 'project'; } async function discoverWorkflows(_cwd?: string): Promise { throw new Error('not implemented yet: discoverWorkflows'); } // --------------------------------------------------------------------------- // Command handler // --------------------------------------------------------------------------- export async function listCommand( _args: string[], options: CliOptions, ): Promise { const workflows = await discoverWorkflows(options.cwd); if (options.json) { printJson(workflows); return; } console.log('Available workflows:'); console.log(''); printTable( workflows.map((w) => ({ name: w.name, description: w.description, source: w.source, })), [ { header: 'Name', field: 'name', minWidth: 20 }, { header: 'Description', field: 'description', minWidth: 30 }, { header: 'Source', field: 'source', minWidth: 10 }, ], ); }