firebase-tools-with-isolate 15.26.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.
- package/lib/appcheck/api.js +19 -0
- package/lib/appcheck/providers.js +240 -0
- package/lib/commands/appcheck-apps-list.js +78 -0
- package/lib/commands/appcheck-debugtokens-create.js +2 -2
- package/lib/commands/appcheck-debugtokens-delete.js +2 -2
- package/lib/commands/appcheck-debugtokens-list.js +2 -2
- package/lib/commands/appcheck-prompts.js +55 -0
- package/lib/commands/appcheck-providers-get.js +73 -0
- package/lib/commands/appcheck-providers-list.js +67 -0
- package/lib/commands/appcheck-providers-set.js +96 -0
- package/lib/commands/ext-export.js +140 -3
- package/lib/commands/ext-uninstall.js +35 -1
- package/lib/commands/functions-delete.js +19 -5
- package/lib/commands/functions-kits-install.js +417 -0
- package/lib/commands/functions-kits-list.js +27 -0
- package/lib/commands/index.js +11 -0
- package/lib/crashlytics/filters.js +12 -4
- package/lib/crashlytics/reports.js +2 -0
- package/lib/crashlytics/types.js +8 -1
- package/lib/dataconnect/client.js +11 -0
- package/lib/dataconnect/schemaMigration.js +16 -5
- package/lib/deploy/extensions/secrets.js +18 -0
- package/lib/deploy/functions/backend.js +11 -1
- package/lib/deploy/functions/build.js +1 -1
- package/lib/deploy/functions/functionsDeployHelper.js +39 -15
- package/lib/deploy/functions/params.js +5 -1
- package/lib/deploy/functions/prepare.js +69 -22
- package/lib/deploy/functions/prompts.js +1 -1
- package/lib/deploy/functions/release/lifecycle.js +11 -0
- package/lib/deploy/functions/release/planner.js +5 -2
- package/lib/deploy/functions/runtimes/dart/features.js +51 -0
- package/lib/deploy/functions/runtimes/dart/index.js +60 -16
- package/lib/emulator/controller.js +1 -0
- package/lib/emulator/downloadableEmulatorInfo.json +31 -31
- package/lib/emulator/functionsEmulator.js +7 -2
- package/lib/experiments.js +17 -5
- package/lib/extensions/export.js +73 -0
- package/lib/extensions/replacementRegistry.js +30 -0
- package/lib/extensions/replacements.json +464 -0
- package/lib/fetchMOTD.js +3 -0
- package/lib/functions/env.js +31 -7
- package/lib/functions/iac/export.js +16 -1
- package/lib/functions/kits/config.js +8 -0
- package/lib/functions/projectConfig.js +19 -11
- package/lib/functions/python.js +1 -1
- package/lib/gcp/runv2.js +1 -0
- package/lib/gcp/secretManager.js +3 -3
- package/lib/init/features/functions/dart.js +1 -1
- package/lib/mcp/onemcp/index.js +2 -1
- package/lib/mcp/onemcp/onemcp_server.js +38 -11
- package/lib/mcp/prompts/crashlytics/connect.js +1 -1
- package/lib/mcp/resources/guides/crashlytics_issues.js +3 -3
- package/lib/mcp/resources/guides/crashlytics_reports.js +32 -11
- package/lib/mcp/tool.js +5 -0
- package/lib/mcp/tools/core/deploy.js +2 -0
- package/lib/mcp/tools/core/login.js +59 -4
- package/lib/mcp/tools/crashlytics/notes.js +3 -3
- package/lib/mcp/tools/crashlytics/reports.js +2 -0
- package/lib/mcp/tools/dataconnect/compile.js +23 -2
- package/lib/mcp/tools/dataconnect/list_services.js +3 -4
- package/lib/mcp/util/crashlytics/availability.js +54 -1
- package/lib/serve/functions.js +1 -1
- package/lib/tsconfig.publish.tsbuildinfo +1 -1
- package/lib/unzip.js +12 -2
- package/package.json +2 -1
- package/schema/firebase-config.json +3 -3
- package/templates/init/functions/dart/_gitignore +1 -0
- package/templates/init/functions/typescript/index-kit-migration.ts +49 -0
- package/templates/init/functions/typescript/index-kit.ts +35 -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/appcheck/prompts.js +0 -41
|
@@ -6,7 +6,8 @@ exports.validateCodebase = validateCodebase;
|
|
|
6
6
|
exports.validateKit = validateKit;
|
|
7
7
|
exports.validatePrefix = validatePrefix;
|
|
8
8
|
exports.assertUnique = assertUnique;
|
|
9
|
-
exports.
|
|
9
|
+
exports.validateKitInstanceId = validateKitInstanceId;
|
|
10
|
+
exports.validateAndAddKitInstances = validateAndAddKitInstances;
|
|
10
11
|
exports.validate = validate;
|
|
11
12
|
exports.normalizeAndValidate = normalizeAndValidate;
|
|
12
13
|
exports.configForCodebase = configForCodebase;
|
|
@@ -151,17 +152,24 @@ function assertUniqueSourcePrefixPair(config) {
|
|
|
151
152
|
sourcePrefixPairs.add(key);
|
|
152
153
|
}
|
|
153
154
|
}
|
|
154
|
-
function
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
155
|
+
function validateKitInstanceId(instanceId) {
|
|
156
|
+
if (instanceId.length === 0 ||
|
|
157
|
+
instanceId.length > 40 ||
|
|
158
|
+
!/^[a-z0-9_](?:[a-z0-9_-]*[a-z0-9_])?$/.test(instanceId)) {
|
|
159
|
+
throw new error_1.FirebaseError(`Invalid kit instance ID '${instanceId}'. Instance ID must be 40 characters or less, ` +
|
|
160
|
+
"can contain only lowercase letters, numeric characters, underscores, and dashes, and cannot start or end with a dash.");
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
function validateAndAddKitInstances(instanceIds, allProjectInstanceIds) {
|
|
164
|
+
const seenInBatch = new Set();
|
|
165
|
+
for (const instanceId of instanceIds) {
|
|
166
|
+
validateKitInstanceId(instanceId);
|
|
167
|
+
if (seenInBatch.has(instanceId) || allProjectInstanceIds.has(instanceId)) {
|
|
163
168
|
throw new error_1.FirebaseError(`functions kit instance ID must be unique across all kits, but '${instanceId}' was used more than once.`);
|
|
164
169
|
}
|
|
170
|
+
seenInBatch.add(instanceId);
|
|
171
|
+
}
|
|
172
|
+
for (const instanceId of seenInBatch) {
|
|
165
173
|
allProjectInstanceIds.add(instanceId);
|
|
166
174
|
}
|
|
167
175
|
}
|
|
@@ -173,7 +181,7 @@ function assertUniqueKitInstancesAndCodebases(config) {
|
|
|
173
181
|
codebases.add(c.codebase);
|
|
174
182
|
}
|
|
175
183
|
if ("instances" in c && c.instances) {
|
|
176
|
-
|
|
184
|
+
validateAndAddKitInstances(Object.keys(c.instances), instanceIds);
|
|
177
185
|
}
|
|
178
186
|
}
|
|
179
187
|
for (const instanceId of instanceIds) {
|
package/lib/functions/python.js
CHANGED
package/lib/gcp/runv2.js
CHANGED
|
@@ -154,6 +154,7 @@ function endpointFromService(service) {
|
|
|
154
154
|
? proto.secondsFromDuration(service.template.timeout)
|
|
155
155
|
: 60,
|
|
156
156
|
serviceAccount: service.template.serviceAccount || null,
|
|
157
|
+
runServiceId: svcId,
|
|
157
158
|
ingressSettings: (service.annotations?.["run.googleapis.com/ingress"] === "internal"
|
|
158
159
|
? "ALLOW_INTERNAL_ONLY"
|
|
159
160
|
: service.annotations?.["run.googleapis.com/ingress"] === "internal-and-cloud-load-balancing"
|
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,
|
package/lib/mcp/onemcp/index.js
CHANGED
|
@@ -6,9 +6,10 @@ const onemcp_server_1 = require("./onemcp_server");
|
|
|
6
6
|
exports.ONEMCP_SERVERS = {
|
|
7
7
|
developerknowledge: new onemcp_server_1.OneMcpServer("developerknowledge", (0, api_1.developerKnowledgeOrigin)(), {
|
|
8
8
|
requiresAuth: true,
|
|
9
|
+
}, {
|
|
10
|
+
toolsToOptOutProjectRequirement: ["search_documents", "get_documents"],
|
|
9
11
|
}),
|
|
10
12
|
firestore: new onemcp_server_1.OneMcpServer("firestore", (0, api_1.firestoreOrigin)(), {
|
|
11
13
|
requiresAuth: true,
|
|
12
|
-
requiresProject: true,
|
|
13
14
|
}),
|
|
14
15
|
};
|
|
@@ -40,27 +40,53 @@ class OneMcpServer {
|
|
|
40
40
|
return (this.options.allowedTools.includes(mcpTool.name) ||
|
|
41
41
|
this.options.allowedTools.includes(`${this.feature}_${mcpTool.name}`));
|
|
42
42
|
});
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
43
|
+
const optOutSet = new Set(this.options.toolsToOptOutProjectRequirement || []);
|
|
44
|
+
return tools.map((mcpTool) => {
|
|
45
|
+
const isOptedOut = this.meta.requiresProject === false ||
|
|
46
|
+
optOutSet.has(mcpTool.name) ||
|
|
47
|
+
optOutSet.has(`${this.feature}_${mcpTool.name}`);
|
|
48
|
+
const toolRequiresProject = !isOptedOut;
|
|
49
|
+
return {
|
|
50
|
+
mcp: {
|
|
51
|
+
...mcpTool,
|
|
52
|
+
name: `${this.feature}_${mcpTool.name}`,
|
|
53
|
+
_meta: {
|
|
54
|
+
...this.meta,
|
|
55
|
+
requiresProject: toolRequiresProject,
|
|
56
|
+
feature: this.feature,
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
fn: (args, ctx) => this.callTool(mcpTool.name, mcpTool.inputSchema, args, ctx),
|
|
60
|
+
isAvailable: () => Promise.resolve(true),
|
|
61
|
+
};
|
|
62
|
+
});
|
|
52
63
|
}
|
|
53
64
|
catch (error) {
|
|
54
65
|
throw new error_1.FirebaseError("Failed to fetch remote tools for " + this.serverUrl + ": " + JSON.stringify(error));
|
|
55
66
|
}
|
|
56
67
|
}
|
|
57
|
-
async callTool(toolName, args, ctx) {
|
|
68
|
+
async callTool(toolName, inputSchema, args, ctx) {
|
|
58
69
|
if (this.options.allowedTools?.length &&
|
|
59
70
|
!this.options.allowedTools.includes(toolName) &&
|
|
60
71
|
!this.options.allowedTools.includes(`${this.feature}_${toolName}`)) {
|
|
61
72
|
throw new error_1.FirebaseError(`Tool '${toolName}' is not allowed on remote server for feature '${this.feature}'.`);
|
|
62
73
|
}
|
|
63
|
-
|
|
74
|
+
const paramHeaders = {};
|
|
75
|
+
const props = inputSchema?.properties;
|
|
76
|
+
if (props && typeof props === "object" && args) {
|
|
77
|
+
for (const [paramName, propSchema] of Object.entries(props)) {
|
|
78
|
+
if (propSchema && typeof propSchema === "object" && "x-mcp-header" in propSchema) {
|
|
79
|
+
const headerName = propSchema["x-mcp-header"];
|
|
80
|
+
const argValue = args[paramName];
|
|
81
|
+
if (argValue !== undefined && argValue !== null) {
|
|
82
|
+
paramHeaders[`Mcp-Param-${headerName}`] = String(argValue);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
if (ctx.projectId) {
|
|
88
|
+
await (0, ensureApiEnabled_1.ensure)(ctx.projectId, this.serverUrl, this.feature, true);
|
|
89
|
+
}
|
|
64
90
|
try {
|
|
65
91
|
const res = await this.callClient.post("/mcp", {
|
|
66
92
|
method: "tools/call",
|
|
@@ -76,6 +102,7 @@ class OneMcpServer {
|
|
|
76
102
|
"Mcp-Method": "tools/call",
|
|
77
103
|
"Mcp-Name": toolName,
|
|
78
104
|
...(ctx.projectId ? { "x-goog-user-project": ctx.projectId } : {}),
|
|
105
|
+
...paramHeaders,
|
|
79
106
|
},
|
|
80
107
|
});
|
|
81
108
|
return types_js_1.CallToolResultSchema.parse(res.body.result);
|
|
@@ -24,7 +24,7 @@ exports.connect = (0, prompt_1.prompt)("crashlytics", {
|
|
|
24
24
|
content: {
|
|
25
25
|
type: "text",
|
|
26
26
|
text: `
|
|
27
|
-
You will assist developers in investigating and resolving mobile application issues by leveraging Firebase Crashlytics data.
|
|
27
|
+
You will assist developers in investigating and resolving mobile and web application issues by leveraging Firebase Crashlytics data.
|
|
28
28
|
|
|
29
29
|
### Required First Steps
|
|
30
30
|
|
|
@@ -18,14 +18,14 @@ Follow these steps to fetch issues and prioritize them.
|
|
|
18
18
|
|
|
19
19
|
1. Use the 'crashlytics_get_report' tool to fetch the 'topIssues' report.
|
|
20
20
|
1a. Analyze the user's query and apply the appropriate filters. Use the information in the [Firebase Crashlytics Reports Guide](firebase://guides/crashlytics/reports) to further construct appropriate report requests.
|
|
21
|
-
1b. If the user asks for crashes, then set the *issueErrorType* filter to *FATAL*.
|
|
21
|
+
1b. If the user asks for crashes and it is a mobile app, then set the *issueErrorType* filter to *FATAL*.
|
|
22
22
|
1c. If the user asks about a particular time range, then set both the *intervalStartTime* and *intervalEndTime*.
|
|
23
23
|
2. Use the 'crashlytics_get_report' tool to fetch the 'topVersions' for this app.
|
|
24
24
|
3. If the user instructions include statements about prioritization, use those instructions.
|
|
25
25
|
4. If the user instructions do not include statements about prioritization, then prioritize the returned issues using the following criteria:
|
|
26
26
|
4a. The app versions for the issue include the most recent version of the app.
|
|
27
27
|
4b. The number of users experiencing the issue across variants
|
|
28
|
-
4c. The volume of
|
|
28
|
+
4c. The volume of issues
|
|
29
29
|
5. Return the top 5 issues, with a brief description each in a numerical list with the recommended format.
|
|
30
30
|
5a. Describe the rationale for the prioritization order.
|
|
31
31
|
6. Ask the user if they would like to diagnose and fix any of the issues presented before taking any action.
|
|
@@ -34,7 +34,7 @@ exports.crashlytics_issues = (0, resource_1.resource)({
|
|
|
34
34
|
uri: "firebase://guides/crashlytics/issues",
|
|
35
35
|
name: "crashlytics_issues_guide",
|
|
36
36
|
title: "Firebase Crashlytics Issues Guide",
|
|
37
|
-
description: "Guides the coding agent when working with Crashlytics issues, including prioritization rules and procedures for diagnosing and fixing
|
|
37
|
+
description: "Guides the coding agent when working with Crashlytics issues, including prioritization rules and procedures for diagnosing and fixing issues. ",
|
|
38
38
|
}, async (uri) => {
|
|
39
39
|
return {
|
|
40
40
|
contents: [{ uri, type: "text", text: RESOURCE_CONTENT }],
|
|
@@ -14,14 +14,6 @@ The following reports are available for all Crashlytics applications.
|
|
|
14
14
|
Counts events and distinct impacted users, grouped by issue.
|
|
15
15
|
Issue groups are sorted by event count, in descending order.
|
|
16
16
|
|
|
17
|
-
- name: "topVariants"
|
|
18
|
-
display_name: "Top Variants"
|
|
19
|
-
usage: |
|
|
20
|
-
Counts events and distinct impacted users, grouped by issue variant.
|
|
21
|
-
Issue variant groups are sorted by event count, in descending order.
|
|
22
|
-
required: |
|
|
23
|
-
An issue filter including an issue id is required.
|
|
24
|
-
|
|
25
17
|
- name: "topVersions"
|
|
26
18
|
display_name: "Top Versions"
|
|
27
19
|
usage: |
|
|
@@ -34,7 +26,17 @@ The following reports are available for all Crashlytics applications.
|
|
|
34
26
|
Counts events, grouped by device operating systems and their versions.
|
|
35
27
|
Operating systems are sorted by event count, in descending order.
|
|
36
28
|
|
|
37
|
-
Mobile apps have
|
|
29
|
+
Mobile apps have the following report available:
|
|
30
|
+
|
|
31
|
+
- name: "topVariants"
|
|
32
|
+
display_name: "Top Variants"
|
|
33
|
+
usage: |
|
|
34
|
+
Counts events and distinct impacted users, grouped by issue variant.
|
|
35
|
+
Issue variant groups are sorted by event count, in descending order.
|
|
36
|
+
required: |
|
|
37
|
+
An issue filter including an issue id is required.
|
|
38
|
+
|
|
39
|
+
Mobile apps also have one of the following reports available, depending on the platform.
|
|
38
40
|
|
|
39
41
|
- name: "topAndroidDevices"
|
|
40
42
|
display_name: "Top Android Devices"
|
|
@@ -48,10 +50,27 @@ Mobile apps have one of the following reports available, depending on the platfo
|
|
|
48
50
|
Counts events, grouped by operating system and Apple device.
|
|
49
51
|
Devices are sorted by event count, in descending order.
|
|
50
52
|
|
|
53
|
+
Web apps have the following additional reports available.
|
|
54
|
+
|
|
55
|
+
- name: "topBrowsers"
|
|
56
|
+
display_name: "Top Browsers"
|
|
57
|
+
usage: |
|
|
58
|
+
Counts events, grouped by browser.
|
|
59
|
+
Browsers are sorted by event count, in descending order.
|
|
60
|
+
required: |
|
|
61
|
+
An issue filter including an issue id is required.
|
|
62
|
+
|
|
63
|
+
- name: "webMetrics"
|
|
64
|
+
display_name: "Web Metrics"
|
|
65
|
+
usage: |
|
|
66
|
+
Counts events and distinct impacted users, grouped by error type.
|
|
67
|
+
Error types are sorted by event count, in descending order.
|
|
68
|
+
|
|
51
69
|
Report responses contain the following metrics:
|
|
52
70
|
|
|
53
71
|
- eventsCount: the number of events matching
|
|
54
72
|
- impactedUsers: the number of distinct end users in all the matching events
|
|
73
|
+
- sessionsCount: the number of distinct sessions in all the matching events. Only available for web apps.
|
|
55
74
|
|
|
56
75
|
Report responses are always grouped by one of the following dimensions:
|
|
57
76
|
|
|
@@ -59,14 +78,16 @@ Report responses are always grouped by one of the following dimensions:
|
|
|
59
78
|
- issue
|
|
60
79
|
- variant
|
|
61
80
|
- operating system
|
|
62
|
-
- mobile device type
|
|
81
|
+
- mobile device type (mobile only)
|
|
82
|
+
- browser (web only)
|
|
83
|
+
- error type (web only)
|
|
63
84
|
|
|
64
85
|
### Filters
|
|
65
86
|
|
|
66
87
|
When setting report filters adhere to the following instructions.
|
|
67
88
|
|
|
68
89
|
* Issue Filtering:
|
|
69
|
-
*
|
|
90
|
+
* For mobile apps, use the \`issueErrorTypes\` field to focus on events of different fatalities:
|
|
70
91
|
* FATAL: native crashes, which caused the app to exit.
|
|
71
92
|
* NON_FATAL: uncaught or manually reported exceptions, which did not crash the app.
|
|
72
93
|
* ANR: "app not responding" events, only relevant on Android platforms.
|
package/lib/mcp/tool.js
CHANGED
|
@@ -10,6 +10,11 @@ function tool(feature, options, fn) {
|
|
|
10
10
|
mcp: {
|
|
11
11
|
...mcpOptions,
|
|
12
12
|
inputSchema: (0, util_1.cleanSchema)(zod_1.z.toJSONSchema(options.inputSchema, { target: "draft-7", io: "input" })),
|
|
13
|
+
...(options.outputSchema
|
|
14
|
+
? {
|
|
15
|
+
outputSchema: (0, util_1.cleanSchema)(zod_1.z.toJSONSchema(options.outputSchema, { target: "draft-7", io: "output" })),
|
|
16
|
+
}
|
|
17
|
+
: {}),
|
|
13
18
|
},
|
|
14
19
|
fn,
|
|
15
20
|
isAvailable: (ctx) => {
|
|
@@ -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
|
});
|
|
@@ -8,7 +8,7 @@ const filters_1 = require("../../../crashlytics/filters");
|
|
|
8
8
|
const util_1 = require("../../util");
|
|
9
9
|
exports.create_note = (0, tool_1.tool)("crashlytics", {
|
|
10
10
|
name: "create_note",
|
|
11
|
-
description: "Add a note to an issue from crashlytics.",
|
|
11
|
+
description: "Add a note to an issue from crashlytics. Only supported for mobile (Android and iOS) apps.",
|
|
12
12
|
inputSchema: zod_1.z.object({
|
|
13
13
|
appId: filters_1.ApplicationIdSchema,
|
|
14
14
|
issueId: filters_1.IssueIdSchema,
|
|
@@ -32,7 +32,7 @@ exports.create_note = (0, tool_1.tool)("crashlytics", {
|
|
|
32
32
|
});
|
|
33
33
|
exports.list_notes = (0, tool_1.tool)("crashlytics", {
|
|
34
34
|
name: "list_notes",
|
|
35
|
-
description: "Use this to list all notes for an issue in Crashlytics.",
|
|
35
|
+
description: "Use this to list all notes for an issue in Crashlytics. Only supported for mobile (Android and iOS) apps.",
|
|
36
36
|
inputSchema: zod_1.z.object({
|
|
37
37
|
appId: filters_1.ApplicationIdSchema,
|
|
38
38
|
issueId: filters_1.IssueIdSchema,
|
|
@@ -54,7 +54,7 @@ exports.list_notes = (0, tool_1.tool)("crashlytics", {
|
|
|
54
54
|
});
|
|
55
55
|
exports.delete_note = (0, tool_1.tool)("crashlytics", {
|
|
56
56
|
name: "delete_note",
|
|
57
|
-
description: "Delete a note from a Crashlytics issue.",
|
|
57
|
+
description: "Delete a note from a Crashlytics issue. Only supported for mobile (Android and iOS) apps.",
|
|
58
58
|
inputSchema: zod_1.z.object({
|
|
59
59
|
appId: filters_1.ApplicationIdSchema,
|
|
60
60
|
issueId: filters_1.IssueIdSchema,
|
|
@@ -15,6 +15,8 @@ Must specify the desired report:
|
|
|
15
15
|
* TOP_OPERATING_SYSTEMS - metrics grouped by *operating system*
|
|
16
16
|
* TOP_ANDROID_DEVICES - metrics grouped by *device*
|
|
17
17
|
* TOP_APPLE_DEVICES - metrics grouped by *device*
|
|
18
|
+
* TOP_BROWSERS - metrics grouped by *browser*
|
|
19
|
+
* WEB_METRICS - metrics by *error type*
|
|
18
20
|
`.trim();
|
|
19
21
|
function toText(response, filters) {
|
|
20
22
|
const result = {
|
|
@@ -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);
|
|
@@ -4,6 +4,7 @@ exports.isCrashlyticsAvailable = isCrashlyticsAvailable;
|
|
|
4
4
|
const appUtils_1 = require("../../../appUtils");
|
|
5
5
|
const fs = require("fs-extra");
|
|
6
6
|
const path = require("path");
|
|
7
|
+
const apiv2_1 = require("../../../apiv2");
|
|
7
8
|
async function isCrashlyticsAvailable(ctx) {
|
|
8
9
|
ctx.host.logger.debug("Looking for whether crashlytics is installed...");
|
|
9
10
|
return await isCrashlyticsInstalled(ctx);
|
|
@@ -14,7 +15,8 @@ async function isCrashlyticsInstalled(ctx) {
|
|
|
14
15
|
const platforms = await (0, appUtils_1.getPlatformsFromFolder)(projectDir);
|
|
15
16
|
if (!platforms.includes(appUtils_1.Platform.FLUTTER) &&
|
|
16
17
|
!platforms.includes(appUtils_1.Platform.ANDROID) &&
|
|
17
|
-
!platforms.includes(appUtils_1.Platform.IOS)
|
|
18
|
+
!platforms.includes(appUtils_1.Platform.IOS) &&
|
|
19
|
+
!platforms.includes(appUtils_1.Platform.WEB)) {
|
|
18
20
|
host.logger.debug("Found no supported Crashlytics platforms.");
|
|
19
21
|
return false;
|
|
20
22
|
}
|
|
@@ -30,6 +32,11 @@ async function isCrashlyticsInstalled(ctx) {
|
|
|
30
32
|
host.logger.debug("Found iOS app using Crashlytics");
|
|
31
33
|
return true;
|
|
32
34
|
}
|
|
35
|
+
if (platforms.includes(appUtils_1.Platform.WEB) &&
|
|
36
|
+
(await webAppUsesCrashlytics(projectDir, ctx.projectId))) {
|
|
37
|
+
host.logger.debug("Found Web app using Crashlytics");
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
33
40
|
host.logger.debug(`Found supported platforms ${JSON.stringify(platforms)}, but did not find a Crashlytics dependency.`);
|
|
34
41
|
return false;
|
|
35
42
|
}
|
|
@@ -66,3 +73,49 @@ async function flutterAppUsesCrashlytics(appPath) {
|
|
|
66
73
|
}
|
|
67
74
|
return false;
|
|
68
75
|
}
|
|
76
|
+
async function webAppUsesCrashlytics(appPath, projectId) {
|
|
77
|
+
if (!projectId) {
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
const client = new apiv2_1.Client({
|
|
81
|
+
urlPrefix: "https://firebasetelemetryadmin.googleapis.com",
|
|
82
|
+
auth: true,
|
|
83
|
+
apiVersion: "v1alpha",
|
|
84
|
+
});
|
|
85
|
+
try {
|
|
86
|
+
const res = await client.get(`projects/${projectId}/locations/global/configs`);
|
|
87
|
+
const configs = res.body?.configs || [];
|
|
88
|
+
const appIdsInPath = await getAppIdsFromAppPath(appPath);
|
|
89
|
+
for (const config of configs) {
|
|
90
|
+
if (config.appId && appIdsInPath.has(config.appId)) {
|
|
91
|
+
return true;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
catch {
|
|
96
|
+
}
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
async function getAppIdsFromAppPath(appPath) {
|
|
100
|
+
const appIds = new Set();
|
|
101
|
+
try {
|
|
102
|
+
const files = await (0, appUtils_1.detectFiles)(appPath, "*");
|
|
103
|
+
const appIdRegex = /1:\d+:[a-z0-9_-]+:[a-z0-9_-]+/gi;
|
|
104
|
+
for (const file of files) {
|
|
105
|
+
try {
|
|
106
|
+
const content = await fs.readFile(path.join(appPath, file), "utf8");
|
|
107
|
+
const matches = content.match(appIdRegex);
|
|
108
|
+
if (matches) {
|
|
109
|
+
for (const match of matches) {
|
|
110
|
+
appIds.add(match);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
catch {
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
catch {
|
|
119
|
+
}
|
|
120
|
+
return appIds;
|
|
121
|
+
}
|
package/lib/serve/functions.js
CHANGED