firebase-tools-with-isolate 14.10.1 → 14.16.0
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/api.js +5 -1
- package/lib/apphosting/backend.js +40 -15
- package/lib/apptesting/ensureProjectConfigured.js +56 -0
- package/lib/apptesting/invokeTests.js +40 -0
- package/lib/apptesting/parseTestFiles.js +75 -0
- package/lib/apptesting/types.js +18 -0
- package/lib/auth.js +37 -2
- package/lib/command.js +24 -5
- package/lib/commands/apphosting-backends-create.js +8 -5
- package/lib/commands/apptesting-execute.js +101 -0
- package/lib/commands/dataconnect-sdk-generate.js +28 -26
- package/lib/commands/dataconnect-services-list.js +1 -1
- package/lib/commands/dataconnect-sql-diff.js +2 -2
- package/lib/commands/dataconnect-sql-grant.js +7 -2
- package/lib/commands/dataconnect-sql-migrate.js +2 -2
- package/lib/commands/dataconnect-sql-setup.js +3 -5
- package/lib/commands/dataconnect-sql-shell.js +2 -2
- package/lib/commands/ext-export.js +1 -1
- package/lib/commands/firestore-bulkdelete.js +73 -0
- package/lib/commands/firestore-databases-create.js +11 -0
- package/lib/commands/firestore-operations-cancel.js +44 -0
- package/lib/commands/firestore-operations-describe.js +29 -0
- package/lib/commands/firestore-operations-list.js +29 -0
- package/lib/commands/firestore-utils.js +15 -0
- package/lib/commands/functions-config-clone.js +2 -0
- package/lib/commands/functions-config-export.js +5 -2
- package/lib/commands/functions-config-get.js +2 -0
- package/lib/commands/functions-config-set.js +2 -0
- package/lib/commands/functions-config-unset.js +2 -0
- package/lib/commands/index.js +9 -0
- package/lib/commands/init.js +24 -4
- package/lib/commands/internaltesting-functions-discover.js +20 -5
- package/lib/commands/login.js +13 -9
- package/lib/commands/use.js +5 -0
- package/lib/config.js +16 -4
- package/lib/crashlytics/addNote.js +27 -0
- package/lib/crashlytics/buildToolsJarHelper.js +1 -2
- package/lib/crashlytics/deleteNote.js +23 -0
- package/lib/crashlytics/getIssueDetails.js +26 -0
- package/lib/crashlytics/getSampleCrash.js +34 -0
- package/lib/crashlytics/listNotes.js +29 -0
- package/lib/crashlytics/listTopDevices.js +33 -0
- package/lib/crashlytics/listTopIssues.js +8 -23
- package/lib/crashlytics/listTopOperatingSystems.js +32 -0
- package/lib/crashlytics/listTopVersions.js +32 -0
- package/lib/crashlytics/updateIssue.js +35 -0
- package/lib/crashlytics/utils.js +38 -0
- package/lib/dataconnect/appFinder.js +102 -0
- package/lib/dataconnect/client.js +23 -15
- package/lib/dataconnect/ensureApis.js +6 -9
- package/lib/dataconnect/errors.js +7 -1
- package/lib/dataconnect/freeTrial.js +16 -38
- package/lib/dataconnect/load.js +105 -6
- package/lib/dataconnect/provisionCloudSql.js +67 -70
- package/lib/dataconnect/schemaMigration.js +219 -169
- package/lib/deploy/dataconnect/deploy.js +7 -9
- package/lib/deploy/dataconnect/prepare.js +7 -12
- package/lib/deploy/dataconnect/release.js +43 -31
- package/lib/deploy/firestore/deploy.js +10 -0
- package/lib/deploy/functions/backend.js +7 -1
- package/lib/deploy/functions/build.js +28 -14
- package/lib/deploy/functions/deploy.js +3 -2
- package/lib/deploy/functions/ensure.js +1 -1
- package/lib/deploy/functions/functionsDeployHelper.js +8 -1
- package/lib/deploy/functions/params.js +4 -0
- package/lib/deploy/functions/prepare.js +25 -13
- package/lib/deploy/functions/pricing.js +12 -5
- package/lib/deploy/functions/release/fabricator.js +25 -3
- package/lib/deploy/functions/release/reporter.js +1 -0
- package/lib/deploy/functions/runtimes/discovery/index.js +52 -5
- package/lib/deploy/functions/runtimes/node/index.js +83 -51
- package/lib/emulator/auth/operations.js +10 -1
- package/lib/emulator/commandUtils.js +7 -1
- package/lib/emulator/controller.js +22 -34
- package/lib/emulator/dataconnectEmulator.js +27 -24
- package/lib/emulator/downloadableEmulatorInfo.json +18 -18
- package/lib/emulator/env.js +2 -1
- package/lib/emulator/functionsEmulator.js +12 -2
- package/lib/emulator/hub.js +11 -8
- package/lib/emulator/tasksEmulator.js +1 -1
- package/lib/emulator/ui.js +3 -1
- package/lib/env.js +18 -0
- package/lib/experiments.js +20 -0
- package/lib/extensions/extensionsHelper.js +4 -15
- package/lib/extensions/runtimes/common.js +3 -2
- package/lib/extensions/utils.js +1 -12
- package/lib/firestore/api-sort.js +96 -3
- package/lib/firestore/api-types.js +20 -1
- package/lib/firestore/api.js +144 -15
- package/lib/firestore/pretty-print.js +35 -1
- package/lib/firestore/validator.js +1 -1
- package/lib/functional.js +7 -1
- package/lib/functions/deprecationWarnings.js +21 -0
- package/lib/functions/env.js +31 -16
- package/lib/functions/projectConfig.js +87 -8
- package/lib/functions/secrets.js +3 -0
- package/lib/gcp/cloudfunctions.js +1 -6
- package/lib/gcp/cloudfunctionsv2.js +3 -39
- package/lib/gcp/cloudscheduler.js +1 -1
- package/lib/gcp/cloudsql/cloudsqladmin.js +4 -16
- package/lib/gcp/cloudsql/connect.js +4 -3
- package/lib/gcp/cloudsql/permissionsSetup.js +23 -16
- package/lib/gcp/k8s.js +32 -0
- package/lib/gcp/runv2.js +181 -0
- package/lib/gemini/fdcExperience.js +5 -3
- package/lib/init/features/aitools/claude.js +43 -0
- package/lib/init/features/aitools/cursor.js +61 -0
- package/lib/init/features/aitools/gemini.js +58 -0
- package/lib/init/features/aitools/index.js +28 -0
- package/lib/init/features/aitools/promptUpdater.js +111 -0
- package/lib/init/features/aitools/studio.js +17 -0
- package/lib/init/features/aitools/types.js +2 -0
- package/lib/init/features/aitools.js +83 -0
- package/lib/init/features/apptesting/index.js +34 -0
- package/lib/init/features/dataconnect/create_app.js +53 -0
- package/lib/init/features/dataconnect/index.js +280 -186
- package/lib/init/features/dataconnect/sdk.js +232 -144
- package/lib/init/features/index.js +8 -3
- package/lib/init/features/project.js +4 -0
- package/lib/init/index.js +18 -2
- package/lib/management/apps.js +3 -3
- package/lib/management/studio.js +120 -0
- package/lib/mcp/errors.js +5 -7
- package/lib/mcp/index.js +179 -61
- package/lib/mcp/logging-transport.js +23 -0
- package/lib/mcp/prompt.js +10 -0
- package/lib/mcp/prompts/core/deploy.js +101 -0
- package/lib/mcp/prompts/core/index.js +5 -0
- package/lib/mcp/prompts/crashlytics/connect.js +114 -0
- package/lib/mcp/prompts/crashlytics/index.js +5 -0
- package/lib/mcp/prompts/dataconnect/index.js +9 -0
- package/lib/mcp/prompts/dataconnect/schema.js +67 -0
- package/lib/mcp/prompts/index.js +47 -0
- package/lib/mcp/tools/apphosting/fetch_logs.js +22 -22
- package/lib/mcp/tools/apphosting/list_backends.js +10 -10
- package/lib/mcp/tools/auth/disable_user.js +7 -7
- package/lib/mcp/tools/auth/get_user.js +13 -6
- package/lib/mcp/tools/auth/index.js +10 -10
- package/lib/mcp/tools/auth/list_users.js +6 -6
- package/lib/mcp/tools/auth/set_claims.js +7 -7
- package/lib/mcp/tools/auth/set_sms_region_policy.js +6 -6
- package/lib/mcp/tools/core/consult_assistant.js +13 -8
- package/lib/mcp/tools/core/create_android_sha.js +9 -9
- package/lib/mcp/tools/core/create_app.js +7 -7
- package/lib/mcp/tools/core/create_project.js +13 -13
- package/lib/mcp/tools/core/get_admin_sdk_config.js +7 -7
- package/lib/mcp/tools/core/get_environment.js +8 -8
- package/lib/mcp/tools/core/get_project.js +5 -5
- package/lib/mcp/tools/core/get_sdk_config.js +19 -9
- package/lib/mcp/tools/core/index.js +28 -24
- package/lib/mcp/tools/core/init.js +39 -16
- package/lib/mcp/tools/core/list_apps.js +6 -6
- package/lib/mcp/tools/core/list_projects.js +6 -6
- package/lib/mcp/tools/core/login.js +46 -0
- package/lib/mcp/tools/core/logout.js +62 -0
- package/lib/mcp/tools/core/update_environment.js +10 -10
- package/lib/mcp/tools/crashlytics/add_note.js +32 -0
- package/lib/mcp/tools/crashlytics/constants.js +11 -0
- package/lib/mcp/tools/crashlytics/delete_note.js +35 -0
- package/lib/mcp/tools/crashlytics/get_issue_details.js +31 -0
- package/lib/mcp/tools/crashlytics/get_sample_crash.js +43 -0
- package/lib/mcp/tools/crashlytics/index.js +22 -2
- package/lib/mcp/tools/crashlytics/list_notes.js +37 -0
- package/lib/mcp/tools/crashlytics/list_top_devices.js +33 -0
- package/lib/mcp/tools/crashlytics/list_top_issues.js +12 -13
- package/lib/mcp/tools/crashlytics/list_top_operating_systems.js +33 -0
- package/lib/mcp/tools/crashlytics/list_top_versions.js +33 -0
- package/lib/mcp/tools/crashlytics/update_issue.js +37 -0
- package/lib/mcp/tools/database/get_data.js +49 -0
- package/lib/mcp/tools/database/get_rules.js +39 -0
- package/lib/mcp/tools/database/index.js +8 -0
- package/lib/mcp/tools/database/set_data.js +57 -0
- package/lib/mcp/tools/database/validate_rules.js +41 -0
- package/lib/mcp/tools/dataconnect/compile.js +43 -0
- package/lib/mcp/tools/dataconnect/execute.js +71 -0
- package/lib/mcp/tools/dataconnect/generate_operation.js +8 -8
- package/lib/mcp/tools/dataconnect/generate_schema.js +6 -6
- package/lib/mcp/tools/dataconnect/index.js +10 -18
- package/lib/mcp/tools/dataconnect/list_services.js +107 -11
- package/lib/mcp/tools/firestore/delete_document.js +13 -13
- package/lib/mcp/tools/firestore/get_documents.js +13 -13
- package/lib/mcp/tools/firestore/list_collections.js +7 -10
- package/lib/mcp/tools/firestore/query_collection.js +13 -13
- package/lib/mcp/tools/index.js +24 -18
- package/lib/mcp/tools/messaging/index.js +2 -2
- package/lib/mcp/tools/messaging/send_message.js +7 -7
- package/lib/mcp/tools/remoteconfig/get_template.js +5 -5
- package/lib/mcp/tools/remoteconfig/index.js +4 -4
- package/lib/mcp/tools/remoteconfig/publish_template.js +7 -7
- package/lib/mcp/tools/remoteconfig/rollback_template.js +6 -6
- package/lib/mcp/tools/rules/get_rules.js +8 -8
- package/lib/mcp/tools/rules/validate_rules.js +10 -10
- package/lib/mcp/tools/storage/get_download_url.js +8 -8
- package/lib/mcp/tools/storage/get_rules.js +8 -8
- package/lib/mcp/types.js +2 -0
- package/lib/mcp/util/dataconnect/compile.js +20 -0
- package/lib/mcp/util/dataconnect/content.js +655 -0
- package/lib/mcp/util/dataconnect/emulator.js +16 -0
- package/lib/mcp/util.js +5 -18
- package/lib/requireAuth.js +14 -4
- package/lib/rtdb.js +10 -6
- package/lib/scopes.js +2 -1
- package/lib/serve/functions.js +4 -3
- package/lib/timeout.js +21 -0
- package/lib/track.js +18 -1
- package/lib/unzip.js +13 -0
- package/lib/utils.js +76 -2
- package/package.json +5 -3
- package/prompts/FIREBASE.md +121 -0
- package/prompts/FIREBASE_FUNCTIONS.md +221 -0
- package/schema/apptesting-yaml.json +64 -0
- package/schema/firebase-config.json +163 -53
- package/templates/init/aitools/cursor-rules-header.txt +8 -0
- package/templates/init/aitools/gemini-extension.json +11 -0
- package/templates/init/apptesting/smoke_test.yaml +6 -0
- package/templates/init/dataconnect/connector.yaml +0 -16
- package/templates/init/dataconnect/dataconnect.yaml +2 -1
- package/templates/init/dataconnect/mutations.gql +29 -29
- package/templates/init/dataconnect/queries.gql +73 -73
- package/templates/init/dataconnect/schema.gql +48 -48
- package/templates/init/firestore/firestore.indexes.json +26 -1
- package/lib/dataconnect/fileUtils.js +0 -168
- package/lib/emulator/adminSdkConfig.test.js +0 -16
- package/lib/extensions/resolveSource.js +0 -23
- package/lib/firestore/api-sort.test.js +0 -74
- package/lib/firestore/backupUtils.test.js +0 -18
- package/lib/firestore/pretty-print.test.js +0 -61
- package/lib/firestore/util.test.js +0 -42
- package/lib/mcp/tools/dataconnect/emulator.js +0 -16
- package/lib/mcp/tools/dataconnect/execute_graphql.js +0 -48
- package/lib/mcp/tools/dataconnect/execute_graphql_read.js +0 -48
- package/lib/mcp/tools/dataconnect/execute_mutation.js +0 -62
- package/lib/mcp/tools/dataconnect/execute_query.js +0 -62
- package/lib/mcp/tools/dataconnect/get_connector.js +0 -31
- package/lib/mcp/tools/dataconnect/get_schema.js +0 -31
- /package/lib/mcp/{tools → util}/dataconnect/converter.js +0 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateFeaturePromptSection = exports.getFeatureContent = exports.replaceFirebaseFile = exports.updateFirebaseSection = exports.generatePromptSection = void 0;
|
|
4
|
+
const crypto = require("crypto");
|
|
5
|
+
const fs = require("fs");
|
|
6
|
+
const path = require("path");
|
|
7
|
+
const prompt_1 = require("../../../prompt");
|
|
8
|
+
const utils = require("../../../utils");
|
|
9
|
+
const logger_1 = require("../../../logger");
|
|
10
|
+
const vsCodeUtils_1 = require("../../../vsCodeUtils");
|
|
11
|
+
const CLI_PROMPTS_DIR = path.join(__dirname, "../../../../prompts");
|
|
12
|
+
const VSCODE_PROMPTS_DIR = path.join(__dirname, "./prompts");
|
|
13
|
+
const FIREBASE_TAG_REGEX = /<firebase_prompts(?:\s+hash="([^"]+)")?>([\s\S]*?)<\/firebase_prompts>/;
|
|
14
|
+
const PROMPT_FILES = {
|
|
15
|
+
base: "FIREBASE.md",
|
|
16
|
+
functions: "FIREBASE_FUNCTIONS.md",
|
|
17
|
+
};
|
|
18
|
+
function calculateHash(content) {
|
|
19
|
+
return crypto.createHash("sha256").update(content.trim()).digest("hex").substring(0, 8);
|
|
20
|
+
}
|
|
21
|
+
function generatePromptSection(enabledFeatures, options) {
|
|
22
|
+
let fullContent = getFeatureContent("base");
|
|
23
|
+
for (const feature of enabledFeatures) {
|
|
24
|
+
if (feature !== "base" && PROMPT_FILES[feature]) {
|
|
25
|
+
fullContent += "\n\n" + getFeatureContent(feature);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
const hash = calculateHash(fullContent);
|
|
29
|
+
const innerContent = options?.customContent ?? fullContent;
|
|
30
|
+
const wrapped = `<firebase_prompts hash="${hash}">
|
|
31
|
+
<!-- Firebase Tools Context - Auto-generated, do not edit -->
|
|
32
|
+
${innerContent}
|
|
33
|
+
</firebase_prompts>`;
|
|
34
|
+
return { content: wrapped, hash };
|
|
35
|
+
}
|
|
36
|
+
exports.generatePromptSection = generatePromptSection;
|
|
37
|
+
async function updateFirebaseSection(config, filePath, enabledFeatures, options) {
|
|
38
|
+
const { content: newSection, hash: newHash } = generatePromptSection(enabledFeatures);
|
|
39
|
+
let currentContent = "";
|
|
40
|
+
try {
|
|
41
|
+
currentContent = config.readProjectFile(filePath) || "";
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
}
|
|
45
|
+
const match = currentContent.match(FIREBASE_TAG_REGEX);
|
|
46
|
+
if (match && match[1] === newHash) {
|
|
47
|
+
return { updated: false };
|
|
48
|
+
}
|
|
49
|
+
if (options?.interactive && currentContent) {
|
|
50
|
+
const fileName = filePath.split("/").pop();
|
|
51
|
+
logger_1.logger.info();
|
|
52
|
+
utils.logBullet(`Update available for ${fileName}`);
|
|
53
|
+
const shouldUpdate = await (0, prompt_1.confirm)({
|
|
54
|
+
message: `Update Firebase section in ${fileName}?`,
|
|
55
|
+
default: true,
|
|
56
|
+
});
|
|
57
|
+
if (!shouldUpdate) {
|
|
58
|
+
return { updated: false };
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
let finalContent;
|
|
62
|
+
if (!currentContent) {
|
|
63
|
+
finalContent = options?.header ? `${options.header}\n\n${newSection}` : newSection;
|
|
64
|
+
}
|
|
65
|
+
else if (match) {
|
|
66
|
+
finalContent =
|
|
67
|
+
currentContent.substring(0, match.index) +
|
|
68
|
+
newSection +
|
|
69
|
+
currentContent.substring(match.index + match[0].length);
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
const separator = currentContent.endsWith("\n") ? "\n" : "\n\n";
|
|
73
|
+
finalContent = currentContent + separator + newSection;
|
|
74
|
+
}
|
|
75
|
+
config.writeProjectFile(filePath, finalContent);
|
|
76
|
+
return { updated: true };
|
|
77
|
+
}
|
|
78
|
+
exports.updateFirebaseSection = updateFirebaseSection;
|
|
79
|
+
async function replaceFirebaseFile(config, filePath, content) {
|
|
80
|
+
try {
|
|
81
|
+
const existing = config.readProjectFile(filePath);
|
|
82
|
+
if (existing === content) {
|
|
83
|
+
return { updated: false };
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
catch {
|
|
87
|
+
}
|
|
88
|
+
config.writeProjectFile(filePath, content);
|
|
89
|
+
return { updated: true };
|
|
90
|
+
}
|
|
91
|
+
exports.replaceFirebaseFile = replaceFirebaseFile;
|
|
92
|
+
function getFeatureContent(feature) {
|
|
93
|
+
const filename = PROMPT_FILES[feature];
|
|
94
|
+
if (!filename)
|
|
95
|
+
return "";
|
|
96
|
+
const PROMPTS_DIR = (0, vsCodeUtils_1.isVSCodeExtension)() ? VSCODE_PROMPTS_DIR : CLI_PROMPTS_DIR;
|
|
97
|
+
const content = fs.readFileSync(path.join(PROMPTS_DIR, filename), "utf8");
|
|
98
|
+
return content;
|
|
99
|
+
}
|
|
100
|
+
exports.getFeatureContent = getFeatureContent;
|
|
101
|
+
function generateFeaturePromptSection(feature) {
|
|
102
|
+
const content = getFeatureContent(feature);
|
|
103
|
+
if (!content)
|
|
104
|
+
return "";
|
|
105
|
+
const hash = calculateHash(content);
|
|
106
|
+
return `<firebase_${feature}_prompts hash="${hash}">
|
|
107
|
+
<!-- Firebase ${feature.charAt(0).toUpperCase() + feature.slice(1)} Context - Auto-generated, do not edit -->
|
|
108
|
+
${content}
|
|
109
|
+
</firebase_${feature}_prompts>`;
|
|
110
|
+
}
|
|
111
|
+
exports.generateFeaturePromptSection = generateFeaturePromptSection;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.studio = void 0;
|
|
4
|
+
const promptUpdater_1 = require("./promptUpdater");
|
|
5
|
+
const RULES_PATH = ".idx/airules.md";
|
|
6
|
+
exports.studio = {
|
|
7
|
+
name: "studio",
|
|
8
|
+
displayName: "Firebase Studio",
|
|
9
|
+
async configure(config, projectPath, enabledFeatures) {
|
|
10
|
+
const files = [];
|
|
11
|
+
const { updated } = await (0, promptUpdater_1.updateFirebaseSection)(config, RULES_PATH, enabledFeatures, {
|
|
12
|
+
interactive: true,
|
|
13
|
+
});
|
|
14
|
+
files.push({ path: RULES_PATH, updated });
|
|
15
|
+
return { files };
|
|
16
|
+
},
|
|
17
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.doSetup = void 0;
|
|
4
|
+
const utils = require("../../utils");
|
|
5
|
+
const prompt_1 = require("../../prompt");
|
|
6
|
+
const index_1 = require("./aitools/index");
|
|
7
|
+
const logger_1 = require("../../logger");
|
|
8
|
+
const AGENT_CHOICES = Object.values(index_1.AI_TOOLS).map((tool) => ({
|
|
9
|
+
value: tool.name,
|
|
10
|
+
name: tool.displayName,
|
|
11
|
+
checked: false,
|
|
12
|
+
}));
|
|
13
|
+
async function doSetup(setup, config) {
|
|
14
|
+
logger_1.logger.info();
|
|
15
|
+
logger_1.logger.info("This command will configure AI coding assistants to work with your Firebase project by:");
|
|
16
|
+
utils.logBullet("• Setting up the Firebase MCP server for direct Firebase operations");
|
|
17
|
+
utils.logBullet("• Installing context files that help AI understand:");
|
|
18
|
+
utils.logBullet(" - Firebase project structure and firebase.json configuration");
|
|
19
|
+
utils.logBullet(" - Common Firebase CLI commands and debugging practices");
|
|
20
|
+
utils.logBullet(" - Product-specific guidance (Functions, Firestore, Hosting, etc.)");
|
|
21
|
+
logger_1.logger.info();
|
|
22
|
+
const selections = {};
|
|
23
|
+
selections.tools = await (0, prompt_1.checkbox)({
|
|
24
|
+
message: "Which tools would you like to configure?",
|
|
25
|
+
choices: AGENT_CHOICES,
|
|
26
|
+
validate: (choices) => {
|
|
27
|
+
if (choices.length === 0) {
|
|
28
|
+
return "Must select at least one tool.";
|
|
29
|
+
}
|
|
30
|
+
return true;
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
if (!selections.tools || selections.tools.length === 0) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
logger_1.logger.info();
|
|
37
|
+
logger_1.logger.info("Configuring selected tools...");
|
|
38
|
+
const projectPath = config.projectDir;
|
|
39
|
+
const enabledFeatures = getEnabledFeatures(setup.config);
|
|
40
|
+
let anyUpdates = false;
|
|
41
|
+
for (const toolName of selections.tools) {
|
|
42
|
+
const tool = index_1.AI_TOOLS[toolName];
|
|
43
|
+
if (!tool) {
|
|
44
|
+
utils.logWarning(`Unknown tool: ${toolName}`);
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
const result = await tool.configure(config, projectPath, enabledFeatures);
|
|
48
|
+
const updatedCount = result.files.filter((f) => f.updated).length;
|
|
49
|
+
const hasChanges = updatedCount > 0;
|
|
50
|
+
if (hasChanges) {
|
|
51
|
+
anyUpdates = true;
|
|
52
|
+
logger_1.logger.info();
|
|
53
|
+
utils.logSuccess(`${tool.displayName} configured - ${updatedCount} file${updatedCount > 1 ? "s" : ""} updated:`);
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
logger_1.logger.info();
|
|
57
|
+
utils.logBullet(`${tool.displayName} - all files up to date`);
|
|
58
|
+
}
|
|
59
|
+
for (const file of result.files) {
|
|
60
|
+
const status = file.updated ? "(updated)" : "(unchanged)";
|
|
61
|
+
utils.logBullet(` ${file.path} ${status}`);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
logger_1.logger.info();
|
|
65
|
+
if (anyUpdates) {
|
|
66
|
+
utils.logSuccess("AI tools configuration complete!");
|
|
67
|
+
logger_1.logger.info();
|
|
68
|
+
logger_1.logger.info("Next steps:");
|
|
69
|
+
utils.logBullet("Restart your AI tools to load the new configuration");
|
|
70
|
+
utils.logBullet("Try asking your AI assistant about your Firebase project structure");
|
|
71
|
+
utils.logBullet("AI assistants now understand Firebase CLI commands and debugging");
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
utils.logSuccess("All AI tools are already up to date.");
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
exports.doSetup = doSetup;
|
|
78
|
+
function getEnabledFeatures(config) {
|
|
79
|
+
const features = [];
|
|
80
|
+
if (config.functions)
|
|
81
|
+
features.push("functions");
|
|
82
|
+
return features;
|
|
83
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.actuate = exports.askQuestions = void 0;
|
|
4
|
+
const path_1 = require("path");
|
|
5
|
+
const prompt_1 = require("../../../prompt");
|
|
6
|
+
const templates_1 = require("../../../templates");
|
|
7
|
+
const ensureProjectConfigured_1 = require("../../../apptesting/ensureProjectConfigured");
|
|
8
|
+
const SMOKE_TEST_YAML_TEMPLATE = (0, templates_1.readTemplateSync)("init/apptesting/smoke_test.yaml");
|
|
9
|
+
async function askQuestions(setup) {
|
|
10
|
+
setup.featureInfo = {
|
|
11
|
+
...setup.featureInfo,
|
|
12
|
+
apptesting: {
|
|
13
|
+
testDir: setup.featureInfo?.apptesting?.testDir ||
|
|
14
|
+
(await (0, prompt_1.input)({
|
|
15
|
+
message: "What do you want to use as your test directory?",
|
|
16
|
+
default: "tests",
|
|
17
|
+
})),
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
if (setup.projectId) {
|
|
21
|
+
await (0, ensureProjectConfigured_1.ensureProjectConfigured)(setup.projectId);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.askQuestions = askQuestions;
|
|
25
|
+
async function actuate(setup, config) {
|
|
26
|
+
const info = setup.featureInfo?.apptesting;
|
|
27
|
+
if (!info) {
|
|
28
|
+
throw new Error("App Testing feature RequiredInfo is not provided");
|
|
29
|
+
}
|
|
30
|
+
const testDir = info.testDir;
|
|
31
|
+
config.set("apptesting.testDir", testDir);
|
|
32
|
+
await config.askWriteProjectFile((0, path_1.join)(testDir, "smoke_test.yaml"), SMOKE_TEST_YAML_TEMPLATE);
|
|
33
|
+
}
|
|
34
|
+
exports.actuate = actuate;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createFlutterApp = exports.createNextApp = exports.createReactApp = void 0;
|
|
4
|
+
const child_process_1 = require("child_process");
|
|
5
|
+
const clc = require("colorette");
|
|
6
|
+
const utils_1 = require("../../../utils");
|
|
7
|
+
async function createReactApp(webAppId) {
|
|
8
|
+
const args = ["create", "vite@latest", webAppId, "--", "--template", "react"];
|
|
9
|
+
await executeCommand("npm", args);
|
|
10
|
+
}
|
|
11
|
+
exports.createReactApp = createReactApp;
|
|
12
|
+
async function createNextApp(webAppId) {
|
|
13
|
+
const args = [
|
|
14
|
+
"create-next-app@latest",
|
|
15
|
+
webAppId,
|
|
16
|
+
"--ts",
|
|
17
|
+
"--eslint",
|
|
18
|
+
"--tailwind",
|
|
19
|
+
"--src-dir",
|
|
20
|
+
"--app",
|
|
21
|
+
"--turbopack",
|
|
22
|
+
"--import-alias",
|
|
23
|
+
'"@/*"',
|
|
24
|
+
"--skip-install",
|
|
25
|
+
];
|
|
26
|
+
await executeCommand("npx", args);
|
|
27
|
+
}
|
|
28
|
+
exports.createNextApp = createNextApp;
|
|
29
|
+
async function createFlutterApp(webAppId) {
|
|
30
|
+
const args = ["create", webAppId];
|
|
31
|
+
await executeCommand("flutter", args);
|
|
32
|
+
}
|
|
33
|
+
exports.createFlutterApp = createFlutterApp;
|
|
34
|
+
async function executeCommand(command, args) {
|
|
35
|
+
(0, utils_1.logLabeledBullet)("dataconnect", `> ${clc.bold(`${command} ${args.join(" ")}`)}`);
|
|
36
|
+
return new Promise((resolve, reject) => {
|
|
37
|
+
const childProcess = (0, child_process_1.spawn)(command, args, {
|
|
38
|
+
stdio: "inherit",
|
|
39
|
+
shell: true,
|
|
40
|
+
});
|
|
41
|
+
childProcess.on("close", (code) => {
|
|
42
|
+
if (code === 0) {
|
|
43
|
+
resolve();
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
reject(new Error(`Command failed with exit code ${code}`));
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
childProcess.on("error", (err) => {
|
|
50
|
+
reject(err);
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
}
|