feat: add firebase ailogic:providers CLI commands#10778
Conversation
Wiz Scan Summary
To detect these findings earlier in the dev lifecycle, try using Wiz Code VS Code Extension. |
There was a problem hiding this comment.
Code Review
This pull request introduces the firebase ailogic:providers:* CLI commands (enable, disable, and list) to manage Gemini API providers, along with updates to the help command to list namespace subcommands. Feedback on these changes suggests removing the ensureAILogicApiEnabled check from the disable and list commands to prevent unnecessary enablement prompts, and removing a redundant billing check in listProviders that could cause permission issues. Additionally, the reviewer recommends simplifying the associated unit tests and replacing an any cast in help.spec.ts with a type-safe alternative to adhere to the repository's style guide.
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.
2efdcd1 to
79fbcdc
Compare
|
Thanks for the review! Addressed all the feedback:
|
abc2d66 to
6621514
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #10778 +/- ##
=======================================
Coverage ? 58.09%
=======================================
Files ? 615
Lines ? 40074
Branches ? 8113
=======================================
Hits ? 23280
Misses ? 14861
Partials ? 1933 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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;agent-platform-gemini-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.firebase help <namespace>now lists the subcommands under a prefix (e.g.firebase help ailogic:providers) for discoverability.ensureApiEnabled.uncacheEnabledAPIto keep the local API-enablement cache consistent after enabling/disabling an API.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 agent-platform-gemini-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.src/gcp/ailogic.spec.ts,src/gcp/serviceusage.spec.ts, andsrc/commands/help.spec.ts.npm test(lint + compile + mocha) passes.Sample Commands