(cmd: Command)
| 417 | * so this must be re-evaluated on every getCommands() call. |
| 418 | */ |
| 419 | export function meetsAvailabilityRequirement(cmd: Command): boolean { |
| 420 | if (!cmd.availability) return true |
| 421 | for (const a of cmd.availability) { |
| 422 | switch (a) { |
| 423 | case 'claude-ai': |
| 424 | if (isClaudeAISubscriber()) return true |
| 425 | break |
| 426 | case 'console': |
| 427 | // Console API key user = direct 1P API customer (not 3P, not claude.ai). |
| 428 | // Excludes 3P (Bedrock/Vertex/Foundry) who don't set ANTHROPIC_BASE_URL |
| 429 | // and gateway users who proxy through a custom base URL. |
| 430 | if ( |
| 431 | !isClaudeAISubscriber() && |
| 432 | !isUsing3PServices() && |
| 433 | isFirstPartyAnthropicBaseUrl() |
| 434 | ) |
| 435 | return true |
| 436 | break |
| 437 | default: { |
| 438 | const _exhaustive: never = a |
| 439 | void _exhaustive |
| 440 | break |
| 441 | } |
| 442 | } |
| 443 | } |
| 444 | return false |
| 445 | } |
| 446 | |
| 447 | /** |
| 448 | * Loads all command sources (skills, plugins, workflows). Memoized by cwd |
no test coverage detected