firebase-tools-with-isolate 15.27.0 → 15.28.2
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.
- package/lib/apphosting/backend.js +44 -10
- package/lib/apphosting/githubConnections.js +1 -1
- package/lib/apphosting/repo.js +1 -1
- package/lib/apphosting/rollout.js +1 -1
- package/lib/commands/ext-export.js +78 -17
- package/lib/commands/ext-migrate.js +36 -0
- package/lib/commands/ext-uninstall.js +35 -1
- package/lib/commands/functions-delete.js +19 -5
- package/lib/commands/functions-kits-install.js +18 -275
- package/lib/commands/functions-kits-list.js +27 -0
- package/lib/commands/functions-kits-uninstall.js +266 -0
- package/lib/commands/index.js +5 -0
- package/lib/config.js +34 -0
- package/lib/dataconnect/client.js +13 -2
- package/lib/dataconnect/schemaMigration.js +16 -5
- package/lib/deploy/extensions/secrets.js +18 -0
- package/lib/deploy/functions/ensure.js +29 -19
- package/lib/deploy/functions/functionsDeployHelper.js +39 -15
- package/lib/deploy/functions/prepare.js +51 -10
- package/lib/deploy/functions/release/fabricator.js +19 -3
- package/lib/deploy/functions/release/planner.js +8 -0
- package/lib/deploy/functions/runtimes/dart/features.js +51 -0
- package/lib/deploy/functions/runtimes/dart/index.js +60 -16
- package/lib/emulator/downloadableEmulatorInfo.json +31 -31
- package/lib/emulator/functionsEmulator.js +4 -1
- package/lib/experiments.js +6 -0
- package/lib/extensions/export.js +26 -0
- package/lib/extensions/listExtensions.js +27 -3
- package/lib/extensions/migrate.js +171 -0
- package/lib/extensions/replacementRegistry.js +65 -0
- package/lib/extensions/replacements.json +464 -0
- package/lib/fetchMOTD.js +3 -0
- package/lib/functions/env.js +11 -0
- package/lib/functions/iac/export.js +16 -1
- package/lib/functions/kits/config.js +8 -0
- package/lib/functions/kits/env.js +38 -0
- package/lib/functions/kits/index.js +19 -0
- package/lib/functions/kits/install.js +709 -0
- package/lib/gcp/secretManager.js +3 -3
- package/lib/init/features/functions/dart.js +1 -1
- package/lib/mcp/tools/core/deploy.js +2 -0
- package/lib/mcp/tools/core/login.js +59 -4
- package/lib/mcp/tools/dataconnect/compile.js +23 -2
- package/lib/mcp/tools/dataconnect/list_services.js +3 -4
- package/lib/requireTosAcceptance.js +2 -1
- package/lib/tsconfig.publish.tsbuildinfo +1 -1
- package/lib/unzip.js +12 -2
- package/package.json +2 -1
- package/schema/firebase-config.json +1 -1
- package/templates/init/functions/dart/_gitignore +1 -0
- package/templates/init/functions/typescript/index.ts +3 -3
- package/templates/init/functions/typescript/package-ongraphrequest.lint.json +3 -3
- package/templates/init/functions/typescript/package.lint.json +3 -3
- package/templates/init/functions/typescript/tsconfig.dev.json +4 -0
package/lib/gcp/secretManager.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FIREBASE_MANAGED = exports.secretManagerConsoleUri = void 0;
|
|
3
|
+
exports.FIREBASE_MANAGED = exports.secretManagerConsoleUri = exports.SECRET_VERSION_NAME_REGEX = void 0;
|
|
4
4
|
exports.getSecret = getSecret;
|
|
5
5
|
exports.listSecrets = listSecrets;
|
|
6
6
|
exports.getSecretMetadata = getSecretMetadata;
|
|
@@ -34,7 +34,7 @@ const SECRET_NAME_REGEX = new RegExp("projects\\/" +
|
|
|
34
34
|
"(?<project>(?:\\d+)|(?:[A-Za-z]+[A-Za-z\\d-]*[A-Za-z\\d]?))\\/" +
|
|
35
35
|
"secrets\\/" +
|
|
36
36
|
"(?<secret>[A-Za-z\\d\\-_]+)");
|
|
37
|
-
|
|
37
|
+
exports.SECRET_VERSION_NAME_REGEX = new RegExp(SECRET_NAME_REGEX.source + "\\/versions\\/" + "(?<version>latest|[0-9]+)");
|
|
38
38
|
const secretManagerConsoleUri = (projectId) => `https://console.cloud.google.com/security/secret-manager?project=${projectId}`;
|
|
39
39
|
exports.secretManagerConsoleUri = secretManagerConsoleUri;
|
|
40
40
|
const API_VERSION = "v1";
|
|
@@ -151,7 +151,7 @@ function parseSecretResourceName(resourceName) {
|
|
|
151
151
|
};
|
|
152
152
|
}
|
|
153
153
|
function parseSecretVersionResourceName(resourceName) {
|
|
154
|
-
const match = resourceName.match(SECRET_VERSION_NAME_REGEX);
|
|
154
|
+
const match = resourceName.match(exports.SECRET_VERSION_NAME_REGEX);
|
|
155
155
|
if (!match?.groups) {
|
|
156
156
|
throw new error_1.FirebaseError(`Invalid secret version resource name [${resourceName}].`);
|
|
157
157
|
}
|
|
@@ -15,7 +15,7 @@ async function setup(setup, config) {
|
|
|
15
15
|
await config.askWriteProjectFile(`${setup.functions.source}/analysis_options.yaml`, ANALYSIS_OPTIONS_TEMPLATE);
|
|
16
16
|
await config.askWriteProjectFile(`${setup.functions.source}/bin/server.dart`, MAIN_TEMPLATE);
|
|
17
17
|
config.set("functions.runtime", (0, supported_1.latest)("dart"));
|
|
18
|
-
config.set("functions.ignore", [".dart_tool"
|
|
18
|
+
config.set("functions.ignore", [".dart_tool"]);
|
|
19
19
|
const install = await (0, prompt_1.confirm)({
|
|
20
20
|
message: "Do you want to install dependencies now?",
|
|
21
21
|
default: true,
|
|
@@ -45,9 +45,11 @@ exports.deploy = (0, tool_1.tool)("core", {
|
|
|
45
45
|
const parts = only.split(",").map((p) => p.trim());
|
|
46
46
|
targets = parts.filter((p) => validTargets.includes(p));
|
|
47
47
|
}
|
|
48
|
+
const baseOptions = await ctx.host.resolveOptions();
|
|
48
49
|
const jobId = Date.now().toString();
|
|
49
50
|
jobs_1.jobTracker.createJob(jobId);
|
|
50
51
|
const options = {
|
|
52
|
+
...baseOptions,
|
|
51
53
|
only: only || "",
|
|
52
54
|
except: "",
|
|
53
55
|
filteredTargets: targets,
|
|
@@ -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
|
|
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:
|
|
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}
|
|
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:
|
|
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
|
-
}))).
|
|
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
|
-
|
|
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
|
-
|
|
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);
|
|
@@ -5,6 +5,7 @@ const error_1 = require("./error");
|
|
|
5
5
|
const firedata_1 = require("./gcp/firedata");
|
|
6
6
|
const api_1 = require("./api");
|
|
7
7
|
const auth_1 = require("./auth");
|
|
8
|
+
const defaultCredentials_1 = require("./defaultCredentials");
|
|
8
9
|
const consoleLandingPage = new Map([
|
|
9
10
|
[firedata_1.APPHOSTING_TOS_ID, `${(0, api_1.consoleOrigin)()}/project/_/apphosting`],
|
|
10
11
|
[firedata_1.DATA_CONNECT_TOS_ID, `${(0, api_1.consoleOrigin)()}/project/_/dataconnect`],
|
|
@@ -13,7 +14,7 @@ function requireTosAcceptance(tosId) {
|
|
|
13
14
|
return () => requireTos(tosId);
|
|
14
15
|
}
|
|
15
16
|
async function requireTos(tosId) {
|
|
16
|
-
if (!(0, auth_1.loggedIn)()) {
|
|
17
|
+
if (!(0, auth_1.loggedIn)() || (await (0, defaultCredentials_1.hasDefaultCredentials)())) {
|
|
17
18
|
return;
|
|
18
19
|
}
|
|
19
20
|
const res = await (0, firedata_1.getTosStatus)();
|