(definition: WorkflowDefinition)
| 45 | } |
| 46 | |
| 47 | function formatWorkflowDetail(definition: WorkflowDefinition): string { |
| 48 | const { command, filePath, baseDir } = definition |
| 49 | if (command.type !== 'prompt') { |
| 50 | return `/${command.name} is not a workflow prompt command.` |
| 51 | } |
| 52 | |
| 53 | const lines = [`/${command.name}`] |
| 54 | const userFacingName = getCommandName(command) |
| 55 | if (userFacingName !== command.name) { |
| 56 | lines.push(`Display name: /${userFacingName}`) |
| 57 | } |
| 58 | |
| 59 | lines.push(`Description: ${command.description}`) |
| 60 | lines.push(`Source: ${getSettingSourceName(command.source)}`) |
| 61 | lines.push(`File: ${filePath}`) |
| 62 | lines.push(`Base directory: ${baseDir}`) |
| 63 | |
| 64 | if (command.argumentHint) { |
| 65 | lines.push(`Arguments: ${command.argumentHint}`) |
| 66 | } |
| 67 | if (command.whenToUse) { |
| 68 | lines.push(`When to use: ${command.whenToUse}`) |
| 69 | } |
| 70 | if (command.version) { |
| 71 | lines.push(`Version: ${command.version}`) |
| 72 | } |
| 73 | if (command.model) { |
| 74 | lines.push(`Model: ${command.model}`) |
| 75 | } |
| 76 | if (command.effort) { |
| 77 | lines.push(`Effort: ${command.effort}`) |
| 78 | } |
| 79 | if (command.context === 'fork') { |
| 80 | lines.push( |
| 81 | command.agent |
| 82 | ? `Context: fork · agent ${command.agent}` |
| 83 | : 'Context: fork', |
| 84 | ) |
| 85 | } |
| 86 | |
| 87 | return lines.join('\n') |
| 88 | } |
| 89 | |
| 90 | function normalizeWorkflowQuery(args: string): string { |
| 91 | return args.trim().replace(/^\/+/, '') |
no test coverage detected