Skip to content

feat(dataconnect): dataconnect:sdk:generate automatically run firebase init dataconnect if no gen SDK is setup#9325

Merged
fredzqm merged 13 commits intomasterfrom
dataconnect-sdk-generate-init-flow
Oct 16, 2025
Merged

feat(dataconnect): dataconnect:sdk:generate automatically run firebase init dataconnect if no gen SDK is setup#9325
fredzqm merged 13 commits intomasterfrom
dataconnect-sdk-generate-init-flow

Conversation

@fredzqm
Copy link
Copy Markdown
Contributor

@fredzqm fredzqm commented Oct 15, 2025

Improve dataconnect:sdk:generate's behavior when the project folder hasn't been setup

  • If the Firebase project hasn't been setup or dataconnect feature hasn't been setup, run the same flow as firebase init dataconnect (in src/init/features/dataconnect/index.ts)
  • If the dataconnect feature is setup, but generated SDK hasn't been setup, run the same flow as firebase init dataconnect:sdk (in src/init/features/dataconnect/sdk.ts)

Then continue with the remaining steps~

We can position firebase dataconnect:sdk:generate --watch as that single command to setup up everything you need to use data connect in an app.

In an empty folder

Screenshot 2025-10-15 at 3 11 07 PM Screenshot 2025-10-15 at 3 09 59 PM

In a folder with firebase.json, but not dataconnect

Screenshot 2025-10-15 at 3 13 16 PM

In a folder with firebase.json & dataconnect, but no gen SDK setup

Screenshot 2025-10-15 at 3 14 21 PM Screenshot 2025-10-15 at 3 15 03 PM

In a folder with gen SDK setup

Screenshot 2025-10-15 at 3 11 56 PM
… the project folder hasn't been setup

- If the Firebase project hasn't been setup or dataconnect feature hasn't been setup, run the same flow as `firebase init dataconnect` (in src/init/features/dataconnect/index.ts)
- If the dataconnect feature is setup, but generated SDK hasn't been setup, run the same flow as `firebase init dataconnect:sdk` (in src/init/features/dataconnect/sdk.ts)

Then continue with the remaining steps~
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @fredzqm, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly improves the developer experience for Firebase Data Connect users by making the dataconnect:sdk:generate command more intelligent. It now proactively checks for and automatically initiates the necessary firebase init flows for Data Connect and its SDK generation if they haven't been set up, ensuring a smoother and more guided configuration process.

Highlights

  • Automated Data Connect Initialization: The dataconnect:sdk:generate command now automatically triggers the firebase init dataconnect flow if the Data Connect feature is not already configured in the project.
  • Automated SDK Configuration: If no generated SDKs are declared in connector.yaml files, the command will now automatically run the firebase init dataconnect:sdk flow to guide the user through configuring one.
  • Improved User Experience: This change streamlines the setup process for Data Connect SDK generation, reducing manual steps and making the command more robust.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

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

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 improves the dataconnect:sdk:generate command by automatically running the necessary initialization steps if the project isn't set up for Data Connect or for SDK generation. The changes are logical and enhance the user experience.

I've identified a couple of areas for improvement:

  • There's a high-severity bug where the command can hang if SDK setup is aborted by the user.
  • There is some duplicated code that could be refactored to improve maintainability.

Details are in the specific comments.

@fredzqm fredzqm requested a review from yuchenshi October 15, 2025 22:19
Copy link
Copy Markdown
Member

@yuchenshi yuchenshi left a comment

Choose a reason for hiding this comment

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

LGTM except one thing


let serviceInfosWithSDKs = await loadAllWithSDKs(projectId, config);
if (!serviceInfosWithSDKs.length) {
if (justRanInit || options.nonInteractive) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we should continue to ask SDK questions even if justRanInit. The command being run is firebase dataconnect:sdk:generate -- which means the user is clearly interested in SDKs. Let's give them SDKs.

Copy link
Copy Markdown
Contributor Author

@fredzqm fredzqm Oct 16, 2025

Choose a reason for hiding this comment

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

The only way they can get here is:

firebase init dataconnect already asked whether they want to an app template, and they said no. Maybe they want to create their own app, but right now we don't support generating SDKs without a linked app.

This is the second screenshot above. If we run init sdk again, it would just fails with a different error.

Here is a behavior w/o this check:
Screenshot 2025-10-16 at 2 56 32 PM

@fredzqm
Copy link
Copy Markdown
Contributor Author

fredzqm commented Oct 16, 2025

Improved the app detection logging message based on feedback

@fredzqm fredzqm merged commit b119293 into master Oct 16, 2025
48 checks passed
@fredzqm fredzqm deleted the dataconnect-sdk-generate-init-flow branch October 16, 2025 23:01
@github-project-automation github-project-automation bot moved this from Approved [PR] to Done in [Cloud] Extensions + Functions Oct 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants