Skip to content

feat: add firebase ailogic:providers CLI commands - #10849

Merged
marb2000 merged 11 commits into
mainfrom
feat/ailogic-providers
Jul 28, 2026
Merged

feat: add firebase ailogic:providers CLI commands#10849
marb2000 merged 11 commits into
mainfrom
feat/ailogic-providers

Conversation

@marb2000

@marb2000 marb2000 commented Jul 27, 2026

Copy link
Copy Markdown
Member

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-api enables generativelanguage.googleapis.com; gemini-agent-platform-api requires the Blaze (pay-as-you-go) plan and enables aiplatform.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:

  • A shared interactive enablement flow (ensureAILogicApiEnabled) used when the API isn't yet enabled, which checks the serviceusage.services.enable permission up front so callers get a clear error before any prompts.
  • ensureApiEnabled.uncacheEnabledAPI to 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:providers is served by progressive help.

All commands live under the fixed global location (no --location flag), support --json output, and reject client-breaking actions in --non-interactive mode unless --force is passed. Permissions map to the firebasevertexai and serviceusage IAM 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-api on a project with the API disabled — enables the AI Logic API and generativelanguage.googleapis.com.
  • providers:enable gemini-agent-platform-api on 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; --force and --non-interactive paths covered; proxy is disabled only when no providers remain.
  • providers:list — reflects enablement state with and without billing.
  • Interactive enablement flow — re-prompts on a Spark billing failure; fails up front when the caller lacks 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).
  • Unit tests added in src/gcp/ailogic.spec.ts and src/gcp/serviceusage.spec.ts. npm test (lint + compile + mocha) passes.

Sample Commands

firebase ailogic:providers:enable gemini-developer-api
firebase ailogic:providers:list
firebase ailogic:providers:list --json
firebase ailogic:providers:disable gemini-developer-api --force
firebase help ailogic:providers

marb2000 and others added 8 commits July 8, 2026 09:42
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.
- 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-9635d3485b

wiz-9635d3485b Bot commented Jul 27, 2026

Copy link
Copy Markdown

Wiz Scan Summary

Scanner Findings
Vulnerability Finding Vulnerabilities -
Data Finding Sensitive Data -
Secret Finding Secrets -
IaC Misconfiguration IaC Misconfigurations -
SAST Finding SAST Findings -
Software Management Finding Software Management Findings -
Total -

View scan details in Wiz

To detect these findings earlier in the dev lifecycle, try the Wiz Code extension for VS Code, JetBrains, or Visual Studio.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/commands/help.ts Outdated
Comment thread src/gcp/ailogic.ts
…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.
@marb2000
marb2000 merged commit 36d8cae into main Jul 28, 2026
52 of 53 checks passed
@marb2000
marb2000 deleted the feat/ailogic-providers branch July 28, 2026 06:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants