feat: add firebase ailogic:providers CLI commands - #10849
Merged
Conversation
Add `firebase ailogic:providers:{enable,disable,list}` to manage the
Gemini API providers (Gemini Developer API and Agent Platform Gemini API)
for Firebase AI Logic from the CLI.
- providers:enable enables the Firebase AI Logic API and the selected
provider's underlying API; agent-platform-gemini-api requires the Blaze
(pay-as-you-go) plan.
- providers:disable prompts for confirmation (--force to skip) and turns
off the proxy when no providers remain enabled.
- providers:list reports which providers are enabled.
- Adds a shared interactive enablement flow (used when the API is not yet
enabled) that checks enable permission up front before prompting.
- Adds `firebase help <namespace>` listing of subcommands under a prefix
so ailogic commands are discoverable.
Requires the firebasevertexai and serviceusage IAM permissions; commands
support --json and --non-interactive.
- Rename provider id agent-platform-gemini-api -> gemini-agent-platform-api for symmetry with gemini-developer-api (paulb777). - Centralize provider-type validation in ailogic.parseProviderType/isProviderType and reuse it in the enable/disable commands instead of copying the union (christhompsongoogle). - Add AILOGIC_LOGGING_PREFIX constant; replace the repeated 'ailogic' literals. - Move enablement-cache invalidation into serviceusage.disableServiceAndPoll and drop the per-callsite uncache calls; rename its 'prefix' param to loggingPrefix. - Drop the redundant non-interactive guard in disable; confirm() already enforces --force in non-interactive mode. - Gate the ailogic commands behind a new 'ailogic' experiment until API-council approval. - Document the help.ts namespace-listing blocks. - Update/extend unit tests accordingly.
# Conflicts: # CHANGELOG.md
- listProviders now reports a provider as enabled only when the Firebase AI Logic API (firebasevertexai.googleapis.com) is also enabled, so providers:list can no longer disagree with other ailogic commands about whether AI Logic is enabled on the project - enableProvider enables the AI Logic API before the provider's service API, so a partial failure cannot land in that inconsistent state
Wiz Scan Summary
To detect these findings earlier in the dev lifecycle, try the Wiz Code extension for VS Code, JetBrains, or Visual Studio. |
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces new CLI commands (firebase ailogic:providers:*) to enable, disable, and list Gemini API providers, gated behind the ailogic experiment. It also updates the help command to support listing subcommands under a namespace. The review feedback highlights a bug in the help command's namespace traversal when encountering intermediate command functions, and suggests optimizing the provider listing logic by checking if the main AI Logic API is enabled before querying provider APIs in parallel.
This was referenced Jul 27, 2026
…ive help The custom namespace walk in the help command predates #10772, which auto-registers a commander command for every namespace. getCommand now always resolves namespaces to those commands, so the walk was unreachable (and mishandled function-valued intermediate nodes like client.ext, as flagged by review). firebase help ailogic:providers and firebase help ext:dev are both served by progressive help. Also remove two empty JSDoc blocks.
joehan
approved these changes
Jul 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
Replaces #10778, moved from my fork to a branch on the main repo as requested by @joehan. The branch is identical to the fork's, including all addressed review feedback from @christhompsongoogle, @paulb777, and @joehan, plus a fix for a provider-state inconsistency bug I found (see #10778 (comment)).
Description
Adds the
firebase ailogic:providers:*command group to manage the Gemini API providers for Firebase AI Logic from the CLI, so developers and CI pipelines can enable, disable, and inspect providers without using the Firebase Console.ailogic:providers:enable <providerType>— enables the Firebase AI Logic API (firebasevertexai.googleapis.com) if needed, then the selected provider's underlying API.gemini-developer-apienablesgenerativelanguage.googleapis.com;gemini-agent-platform-apirequires the Blaze (pay-as-you-go) plan and enablesaiplatform.googleapis.com.ailogic:providers:disable <providerType>— prompts for confirmation (skippable with--force) and turns off the proxy when no providers remain enabled.ailogic:providers:list— reports which providers are enabled.Supporting changes:
ensureAILogicApiEnabled) used when the API isn't yet enabled, which checks theserviceusage.services.enablepermission up front so callers get a clear error before any prompts.ensureApiEnabled.uncacheEnabledAPIto keep the local API-enablement cache consistent after enabling/disabling an API.Note: an earlier version of this branch added namespace subcommand listing to
firebase help; that was superseded by the progressive help from #10772 (which landed after this branch was written) and has been removed.firebase help ailogic:providersis served by progressive help.All commands live under the fixed
globallocation (no--locationflag), support--jsonoutput, and reject client-breaking actions in--non-interactivemode unless--forceis passed. Permissions map to thefirebasevertexaiandserviceusageIAM permissions.This is the first of a series of scoped PRs bringing Firebase AI Logic management (providers, configuration, prompt templates, triggers) to the CLI.
Scenarios Tested
providers:enable gemini-developer-apion a project with the API disabled — enables the AI Logic API andgenerativelanguage.googleapis.com.providers:enable gemini-agent-platform-apion a Blaze project succeeds; on a Spark project it fails with an upgrade link and does not change the plan.providers:disable— confirmation prompt shown;--forceand--non-interactivepaths covered; proxy is disabled only when no providers remain.providers:list— reflects enablement state with and without billing.serviceusage.services.enable.firebase help ailogic:providers— lists the namespace subcommands (via the progressive help from feat: implement progressive CLI help disclosure and dynamic deploy help #10772).src/gcp/ailogic.spec.tsandsrc/gcp/serviceusage.spec.ts.npm test(lint + compile + mocha) passes.Sample Commands