( cwd: string = getProjectRoot(), )
| 8 | |
| 9 | /** Scan *.ts|*.js|*.mjs under .claude/workflows/ and generate a /<name> command for each. */ |
| 10 | export async function getWorkflowCommands( |
| 11 | cwd: string = getProjectRoot(), |
| 12 | ): Promise<Command[]> { |
| 13 | const dir = join(cwd, WORKFLOW_DIR_NAME) |
| 14 | const names = await listNamedWorkflows(dir) |
| 15 | return names.map(name => ({ |
| 16 | type: 'prompt', |
| 17 | name, |
| 18 | description: `Run workflow: ${name}`, |
| 19 | kind: 'workflow', |
| 20 | source: 'builtin', |
| 21 | progressMessage: `Running workflow ${name}...`, |
| 22 | contentLength: 0, |
| 23 | async getPromptForCommand(args, _context) { |
| 24 | const argText = |
| 25 | typeof args === 'string' && args ? `\n\nArguments: ${args}` : '' |
| 26 | return [ |
| 27 | { |
| 28 | type: 'text', |
| 29 | text: `Run the "${name}" workflow now by calling the Workflow tool with name="${name}".${argText}`, |
| 30 | }, |
| 31 | ] |
| 32 | }, |
| 33 | })) |
| 34 | } |
no test coverage detected