Validate a platform ID and return its definition.
(client: TrpcClient, platformId: string)
| 115 | |
| 116 | /** Validate a platform ID and return its definition. */ |
| 117 | async function resolvePlatform(client: TrpcClient, platformId: string) { |
| 118 | const platforms = await client.agentBotProvider.listPlatforms.query(); |
| 119 | const def = (platforms as any[]).find((p: any) => p.id === platformId); |
| 120 | if (!def) { |
| 121 | const ids = (platforms as any[]).map((p: any) => p.id).join(', '); |
| 122 | log.error(`Invalid platform "${platformId}". Must be one of: ${ids}`); |
| 123 | log.info('Run `lh bot platforms` to see required credentials for each platform.'); |
| 124 | process.exit(1); |
| 125 | } |
| 126 | return def; |
| 127 | } |
| 128 | |
| 129 | // ── Allowlist subcommand factory ──────────────────────── |
| 130 |
no test coverage detected