(ctor: CommandConstructor, path: string)
| 75 | } |
| 76 | |
| 77 | export function describeCommand(ctor: CommandConstructor, path: string): CommandDescriptor { |
| 78 | const guide = agentGuideOf(ctor) |
| 79 | |
| 80 | return { |
| 81 | command: path, |
| 82 | description: ctor.description ?? null, |
| 83 | effect: ctor.effect ?? 'read', |
| 84 | args: Object.entries(ctor.args ?? {}).map(([name, def]) => ({ |
| 85 | name, |
| 86 | required: def.required ?? false, |
| 87 | description: def.description, |
| 88 | })), |
| 89 | flags: Object.entries(ctor.flags ?? {}).map(([name, def]) => ({ |
| 90 | name, |
| 91 | char: def.char ?? null, |
| 92 | type: def.type, |
| 93 | default: def.default ?? null, |
| 94 | multiple: def.multiple ?? false, |
| 95 | options: def.options ?? null, |
| 96 | description: def.description, |
| 97 | })), |
| 98 | examples: renderExamples(ctor), |
| 99 | agentGuide: guide.length > 0 ? guide : null, |
| 100 | } |
| 101 | } |
| 102 | |
| 103 | function formatHelpText(ctor: CommandConstructor, path: string): string { |
| 104 | const lines: string[] = [] |
no test coverage detected