firebase-tools-with-isolate 15.27.0 → 15.28.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/lib/commands/ext-export.js +85 -20
  2. package/lib/commands/ext-uninstall.js +35 -1
  3. package/lib/commands/functions-delete.js +19 -5
  4. package/lib/commands/functions-kits-install.js +228 -105
  5. package/lib/commands/functions-kits-list.js +27 -0
  6. package/lib/commands/index.js +1 -0
  7. package/lib/dataconnect/client.js +11 -0
  8. package/lib/dataconnect/schemaMigration.js +16 -5
  9. package/lib/deploy/extensions/secrets.js +18 -0
  10. package/lib/deploy/functions/functionsDeployHelper.js +39 -15
  11. package/lib/deploy/functions/prepare.js +43 -9
  12. package/lib/deploy/functions/runtimes/dart/features.js +51 -0
  13. package/lib/deploy/functions/runtimes/dart/index.js +60 -16
  14. package/lib/emulator/downloadableEmulatorInfo.json +31 -31
  15. package/lib/emulator/functionsEmulator.js +4 -1
  16. package/lib/experiments.js +6 -0
  17. package/lib/extensions/export.js +26 -0
  18. package/lib/extensions/replacementRegistry.js +30 -0
  19. package/lib/extensions/replacements.json +464 -0
  20. package/lib/fetchMOTD.js +3 -0
  21. package/lib/functions/env.js +11 -0
  22. package/lib/functions/iac/export.js +16 -1
  23. package/lib/functions/kits/config.js +8 -0
  24. package/lib/gcp/secretManager.js +3 -3
  25. package/lib/init/features/functions/dart.js +1 -1
  26. package/lib/mcp/tools/core/deploy.js +2 -0
  27. package/lib/mcp/tools/core/login.js +59 -4
  28. package/lib/mcp/tools/dataconnect/compile.js +23 -2
  29. package/lib/mcp/tools/dataconnect/list_services.js +3 -4
  30. package/lib/tsconfig.publish.tsbuildinfo +1 -1
  31. package/lib/unzip.js +12 -2
  32. package/package.json +2 -1
  33. package/templates/init/functions/dart/_gitignore +1 -0
  34. package/templates/init/functions/typescript/index.ts +3 -3
  35. package/templates/init/functions/typescript/package-ongraphrequest.lint.json +3 -3
  36. package/templates/init/functions/typescript/package.lint.json +3 -3
  37. package/templates/init/functions/typescript/tsconfig.dev.json +4 -0
@@ -6,17 +6,60 @@ const tool_1 = require("../../tool");
6
6
  const auth_1 = require("../../../auth");
7
7
  const util_1 = require("../../util");
8
8
  const LoginInputSchema = zod_1.z.object({
9
- authCode: zod_1.z.string().optional().describe("The authorization code from the login flow"),
9
+ authCode: zod_1.z
10
+ .string()
11
+ .optional()
12
+ .describe("The authorization code generated after the user signs in via the login URL. Leave this field empty on the first call to initiate the login flow."),
13
+ reauth: zod_1.z.boolean().optional().describe("Force reauthentication even if already logged in."),
10
14
  });
11
15
  exports.login = (0, tool_1.tool)("core", {
12
16
  name: "login",
13
- description: "Use this to sign the user into the Firebase CLI and Firebase MCP server. This requires a Google Account, and sign in is required to create and work with Firebase Projects.",
17
+ description: `Signs the user into the Firebase CLI and Firebase MCP server.
18
+
19
+ **Prerequisites:**
20
+ * A Google Account is required.
21
+ * Sign in is required to work with Firebase Projects and call most other Firebase tools.
22
+
23
+ **When to use it:**
24
+ * Use this tool when you need to authenticate the Firebase CLI/MCP server.
25
+ * Use this tool to check the current login status (which account is currently authenticated).
26
+ * Use this tool to switch accounts or force reauthentication when credentials expire or change.
27
+
28
+ **How to use it:**
29
+ * To check current login status, call the tool without any parameters. If a user is already logged in, it will return the logged-in email.
30
+ * To log in (initial or after logging out), call the tool without any parameters:
31
+ 1. The tool will return a login URL (\`uri\`) and a \`sessionId\`.
32
+ 2. **CRITICAL SECURITY REQUIREMENT**: The agent MUST display BOTH the login URL and the Session ID to the user. Explicitly instruct the user to verify that the Session ID shown on the browser matches the Session ID provided by the agent. This prevents phishing attacks.
33
+ 3. Once the user signs in on the browser and copies the authorization code, call this tool again with that code passed to the \`authCode\` parameter.
34
+ * To force reauthentication or log in as a different account, call the tool with \`reauth: true\`.
35
+
36
+ **JSON Examples:**
37
+
38
+ *Scenario 1: Check login status (or initiate login flow if not authenticated)*
39
+ \`\`\`json
40
+ {}
41
+ \`\`\`
42
+
43
+ *Scenario 2: Complete the login flow with the retrieved authorization code*
44
+ \`\`\`json
45
+ {
46
+ "authCode": "4/0ATsMZqD..."
47
+ }
48
+ \`\`\`
49
+
50
+ *Scenario 3: Force reauthentication*
51
+ \`\`\`json
52
+ {
53
+ "reauth": true
54
+ }
55
+ \`\`\`
56
+ `,
14
57
  inputSchema: LoginInputSchema,
15
58
  _meta: {
16
59
  requiresAuth: false,
17
60
  },
18
61
  }, async (input, ctx) => {
19
- const { authCode } = input;
62
+ const { authCode, reauth } = input;
20
63
  const serverWithState = ctx.host;
21
64
  if (authCode) {
22
65
  if (!serverWithState.authorize) {
@@ -34,13 +77,25 @@ exports.login = (0, tool_1.tool)("core", {
34
77
  }
35
78
  }
36
79
  else {
80
+ const account = (0, auth_1.getProjectDefaultAccount)(ctx.host.cachedProjectDir || ctx.host.startupRoot);
81
+ if (account && !reauth) {
82
+ return (0, util_1.toContent)(`Already logged in as ${account.user.email}`);
83
+ }
37
84
  const prototyper = await (0, auth_1.loginPrototyper)();
38
85
  serverWithState.authorize = prototyper.authorize;
39
86
  const result = {
40
87
  uri: prototyper.uri,
41
88
  sessionId: prototyper.sessionId,
42
89
  };
43
- const humanReadable = `Please visit this URL to login: ${result.uri}\nYour session ID is: ${result.sessionId}\nInstruct the use to copy the authorization code from that link, and paste it into chat.\nThen, run this tool again with that as the authCode argument to complete the login.`;
90
+ const humanReadable = `Please visit this URL to login: ${result.uri}
91
+ Your session ID is: ${result.sessionId}
92
+
93
+ CRITICAL SECURITY REQUIREMENT:
94
+ As the agent, you MUST explicitly display BOTH the login URL and the Session ID to the user in your response.
95
+ Instruct the user to verify that the Session ID displayed on the browser matches the Session ID above to prevent phishing attacks before they grant access.
96
+
97
+ Once the user has completed the login, instruct them to copy the authorization code and paste it back into the chat.
98
+ Then, call this tool again with the authorization code passed as the 'authCode' parameter to complete the login.`;
44
99
  return (0, util_1.toContent)(humanReadable);
45
100
  }
46
101
  });
@@ -7,7 +7,28 @@ const compile_1 = require("../../util/dataconnect/compile");
7
7
  const load_1 = require("../../../dataconnect/load");
8
8
  exports.compile = (0, tool_1.tool)("dataconnect", {
9
9
  name: "build",
10
- description: "Use this to compile Firebase SQL Connect schema, operations, and/or connectors and check for build errors.",
10
+ description: `Use this to compile Firebase SQL Connect schema, operations, and/or connectors and check for build errors.
11
+
12
+ Resolves service directories defined in the project's \`firebase.json\` under \`dataconnect\`, reads \`dataconnect.yaml\` to locate schema and connector directories, and validates all \`*.gql\` and \`*.graphql\` files within them.
13
+
14
+ **Prerequisites:**
15
+ * A \`firebase.json\` file at the root of the project with a configured \`dataconnect\` section.
16
+ * A local SQL Connect service directory containing a \`dataconnect.yaml\` file and GraphQL source files.
17
+ * Note: These files are ideally generated using the \`firebase_init\` MCP tool, or must follow the standard structure described in the \`firebase-data-connect-basics\` skill.
18
+
19
+ **When to use it:**
20
+ * Use this tool to compile schemas and operations, and check for syntax or type errors in your SQL Connect files.
21
+
22
+ **How to use it:**
23
+ * Call the tool to compile all services, or filter results by \`service_id\`, \`location_id\`, or \`error_filter\`.
24
+
25
+ **JSON Example:**
26
+ \`\`\`json
27
+ {
28
+ "service_id": "my-service",
29
+ "error_filter": "schema"
30
+ }
31
+ \`\`\``,
11
32
  inputSchema: zod_1.z.object({
12
33
  error_filter: zod_1.z
13
34
  .enum(["all", "schema", "operations"])
@@ -34,7 +55,7 @@ exports.compile = (0, tool_1.tool)("dataconnect", {
34
55
  const serviceInfos = await (0, load_1.pickServices)(projectId, config, service_id || undefined, location_id || undefined);
35
56
  const errors = (await Promise.all(serviceInfos.map(async (serviceInfo) => {
36
57
  return await (0, compile_1.compileErrors)(serviceInfo.sourceDirectory, error_filter);
37
- }))).flat();
58
+ }))).filter(Boolean);
38
59
  if (errors.length > 0)
39
60
  return {
40
61
  content: [
@@ -9,7 +9,6 @@ const client = require("../../../dataconnect/client");
9
9
  const load_1 = require("../../../dataconnect/load");
10
10
  const types_1 = require("../../../dataconnect/types");
11
11
  const js_yaml_1 = require("js-yaml");
12
- const logger_1 = require("../../../logger");
13
12
  exports.list_services = (0, tool_1.tool)("dataconnect", {
14
13
  name: "list_services",
15
14
  description: "Use this to list existing local and backend Firebase SQL Connect services",
@@ -22,7 +21,7 @@ exports.list_services = (0, tool_1.tool)("dataconnect", {
22
21
  requiresProject: false,
23
22
  requiresAuth: false,
24
23
  },
25
- }, async (_, { projectId, config }) => {
24
+ }, async (_, { projectId, config, host }) => {
26
25
  const localServiceInfos = await (0, load_1.loadAll)(projectId, config);
27
26
  const serviceInfos = new Map();
28
27
  for (const l of localServiceInfos) {
@@ -35,7 +34,7 @@ exports.list_services = (0, tool_1.tool)("dataconnect", {
35
34
  client.listSchemas(`projects/${projectId}/locations/-/services/-`),
36
35
  client.listConnectors(`projects/${projectId}/locations/-/services/-`),
37
36
  ]);
38
- console.log(services, schemas, connectors);
37
+ host.logger.debug(JSON.stringify({ services, schemas, connectors }));
39
38
  for (const s of services) {
40
39
  const k = s.name.split("/").slice(2, 6).join("/");
41
40
  const st = serviceInfos.get(k) || {};
@@ -61,7 +60,7 @@ exports.list_services = (0, tool_1.tool)("dataconnect", {
61
60
  }
62
61
  }
63
62
  catch (e) {
64
- logger_1.logger.debug("cannot fetch dataconnect resources in the backend", e);
63
+ host.logger.debug(`cannot fetch dataconnect resources in the backend.\n${e}`);
65
64
  }
66
65
  }
67
66
  const localServices = Array.from(serviceInfos.values()).filter((s) => s.local);