MCPcopy
hub / github.com/lobehub/lobehub / resolvePlatform

Function resolvePlatform

apps/cli/src/commands/bot.ts:117–127  ·  view source on GitHub ↗

Validate a platform ID and return its definition.

(client: TrpcClient, platformId: string)

Source from the content-addressed store, hash-verified

115
116/** Validate a platform ID and return its definition. */
117async 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

Callers 1

registerBotCommandFunction · 0.85

Calls 2

findMethod · 0.80
queryMethod · 0.45

Tested by

no test coverage detected