MCPcopy Create free account
hub / github.com/firebase/firebase-tools / askQuestions

Function askQuestions

src/init/features/dataconnect/index.ts:123–169  ·  view source on GitHub ↗
(setup: Setup, config: Config, options: Options)

Source from the content-addressed store, hash-verified

121// askQuestions prompts the user about the SQL Connect service they want to init. Any prompting
122// logic should live here, and _no_ actuation logic should live here.
123export async function askQuestions(setup: Setup, config: Config, options: Options): Promise<void> {
124 const info: RequiredInfo = {
125 flow: "",
126 appDescription: "",
127 serviceId: "",
128 locationId: "",
129 cloudSqlInstanceId: "",
130 cloudSqlDatabase: "",
131 shouldProvisionCSQL: false,
132 };
133 if (setup.projectId) {
134 await ensureApis(setup.projectId);
135 await promptForExistingServices(setup, info, options);
136 // In an empty project, firebase init dataconnect in non-interactive mode always setup the static movie app template.
137 if (!info.serviceGql && !options.nonInteractive) {
138 // TODO: Consider use Gemini to generate schema for Spark project as well.
139 if (!configstore.get("gemini")) {
140 logBullet(
141 "Learn more about Gemini in Firebase and how it uses your data: https://firebase.google.com/docs/gemini-in-firebase#how-gemini-in-firebase-uses-your-data",
142 );
143 }
144 const wantToGenerate = await confirm({
145 message: "Do you want to generate schema and queries with Gemini?",
146 default: false,
147 nonInteractive: options.nonInteractive,
148 });
149 if (wantToGenerate) {
150 configstore.set("gemini", true);
151 info.appDescription = await input({
152 message: `Describe your app idea:`,
153 validate: async (s: string) => {
154 if (s.length > 0) {
155 return true;
156 }
157 return "Please enter a description for your app idea.";
158 },
159 nonInteractive: options.nonInteractive,
160 });
161 }
162 }
163 await promptForCloudSQL(setup, info, options);
164 }
165 setup.featureInfo = setup.featureInfo || {};
166 setup.featureInfo.dataconnect = info;
167
168 await sdk.askQuestions(setup, config, options);
169}
170
171// actuate writes product specific files and makes product specifc API calls.
172// It does not handle writing firebase.json and .firebaserc

Callers

nothing calls this directly

Calls 8

ensureApisFunction · 0.90
logBulletFunction · 0.90
confirmFunction · 0.90
inputFunction · 0.90
promptForCloudSQLFunction · 0.85
getMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…