From de7f28ab2c1d8a14ad6954eb35ebdd7c4b8fe123 Mon Sep 17 00:00:00 2001 From: Aryan Falahatpisheh Date: Tue, 19 May 2026 08:53:56 -0400 Subject: [PATCH 01/10] Create agent skills for ABIU and Local Builds --- skills/firebase-app-hosting-basics/SKILL.md | 18 ++++ .../references/local_builds.md | 94 +++++++++++++++++++ .../references/runtimes_and_abiu.md | 44 +++++++++ 3 files changed, 156 insertions(+) create mode 100644 skills/firebase-app-hosting-basics/references/local_builds.md create mode 100644 skills/firebase-app-hosting-basics/references/runtimes_and_abiu.md diff --git a/skills/firebase-app-hosting-basics/SKILL.md b/skills/firebase-app-hosting-basics/SKILL.md index 4aa23b71..e9d3c1fc 100644 --- a/skills/firebase-app-hosting-basics/SKILL.md +++ b/skills/firebase-app-hosting-basics/SKILL.md @@ -47,12 +47,30 @@ This is the recommended flow for most users. 3. If the app needs safe access to sensitive keys, use `npx -y firebase-tools@latest apphosting:secrets` commands to set and grant access to secrets. 4. Run `npx -y firebase-tools@latest deploy` when you are ready to deploy. +### Deploy via Local Builds (Experimental) + +If you want faster deployments by bypassing Cloud Build queues, you can compile your full-stack web application locally. +1. Set up the experiments and configure `"localBuild": true` in your `firebase.json` file. +2. Run `npx -y firebase-tools@latest deploy --only apphosting` to compile and deploy the pre-built assets. + +> [!CAUTION] +> **SECURITY WARNING FOR CODING AGENTS (AI ASSISTANTS):** +> - **DO NOT** bypass confirmation using `--allow-local-build-secrets` unless explicitly requested by the developer. +> - **PAUSE AND WARN** the developer of the severe risk that raw secret values will be downloaded locally and may get permanently compiled into public client-side bundles or cached artifacts. +> - Review the strict operating system, framework, and security limitations in the [Local Builds Reference](references/local_builds.md). + ### Automated deployment via GitHub (CI/CD) Alternatively, set up a backend connected to a GitHub repository for automated deployments "git push" deployments. This is only recommended for more advanced users, and is not required to use App Hosting. See [CLI Commands](references/cli_commands.md) for more information on how to set this up using CLI commands. +## Runtimes & Automatic Base Image Updates (ABIU) + +App Hosting supports versioned Node.js runtimes with Automatic Base Image Updates (ABIU) to apply security patches without redeploys. +- **CRITICAL**: AI Assistants **MUST** inspect the project's `package.json` and check the `engines.node` field before recommending a runtime version or creating a backend. Mismatched runtimes trigger build-time errors. +- For a complete guide on setup, CLI flags, and lifecycle management, see [Runtimes & ABIU](references/runtimes_and_abiu.md). + ## Emulation See [Emulation](references/emulation.md) for more information on how to test your app locally using the Firebase Local Emulator Suite. diff --git a/skills/firebase-app-hosting-basics/references/local_builds.md b/skills/firebase-app-hosting-basics/references/local_builds.md new file mode 100644 index 00000000..bec9a27c --- /dev/null +++ b/skills/firebase-app-hosting-basics/references/local_builds.md @@ -0,0 +1,94 @@ +# App Hosting Local Builds (Experimental) + +App Hosting Local Builds is an experimental feature that compiles your full-stack web application (e.g. Next.js) on your local development machine instead of using Google Cloud Build in the cloud. Once compiled, the Firebase CLI packages the pre-built standalone assets and uploads them directly to Cloud Run. + +This feature is highly useful for faster deployments, bypassing cloud build queue times, and debugging build outputs locally. + +> [!WARNING] +> This is an early preview of prototype code and you are likely to encounter bugs. Do NOT use this with production backends or sensitive data. Only use test backends and non-sensitive test data as you evaluate this feature. + +--- + +## Mandatory Rules for Coding Agents + +> [!CAUTION] +> **CRITICAL SECURITY INSTRUCTION FOR CODING AGENTS (AI ASSISTANTS):** +> 1. **DO NOT** run local builds with the `--allow-local-build-secrets` flag unless the developer has explicitly instructed you to bypass confirmations for build secrets. +> 2. **PAUSE AND WARN** the user if you detect any `BUILD`-available secrets in `apphosting.yaml`. You must explain that: +> - Local builds will download the raw, unencrypted secret values from Google Cloud Secret Manager to your local machine. +> - These raw secret values can easily be permanently baked into your client-side JavaScript bundles (e.g. due to Next.js bundler behavior) or left behind in local build artifacts/temporary files. +> 3. **GET EXPLICIT APPROVAL** from the user before proceeding with a local build when secrets are configured. + +--- + +## Setup and Configuration + +### 1. Enable Experiments +Enable the required experimental CLI preview flags on your local machine: +```bash +npx -y firebase-tools@latest experiments:enable abiu +npx -y firebase-tools@latest experiments:enable apphostinglocalbuilds +``` + +> [!NOTE] +> The experiment `universalMaker` is no longer a separate experiment name in the Firebase CLI. All binary management and building capabilities are fully handled under the `apphostinglocalbuilds` experiment. + +### 2. Configure `firebase.json` +To instruct the Firebase CLI to perform a local build during deploy, set `"localBuild": true` in the `apphosting` block of your `firebase.json`: + +```json +{ + "apphosting": [ + { + "backendId": "my-local-build-backend", + "localBuild": true, + "rootDir": "/", + "ignore": [ + "node_modules", + ".git", + "firebase-debug.log", + "firebase-debug.*.log", + "functions" + ] + } + ] +} +``` + +--- + +## Technical Details (How It Works Under the Hood) + +When you execute `npx -y firebase-tools@latest deploy --only apphosting`, the local build flow performs the following steps: + +1. **Isolated Scratch Workspace**: The CLI creates a temporary scratch folder named `.local_build_` in your project root and copies all project files into it. It applies your `firebase.json` ignore patterns and respects `.gitignore` to ensure a clean build context matching what would have been sent to Cloud Build. +2. **Secret Injection**: If your `apphosting.yaml` environment contains secrets marked for `BUILD` availability: + - In interactive mode, the CLI will prompt you with a warning before downloading. + - In non-interactive mode (e.g. CI scripts), the deployment will abort with an error unless the `--allow-local-build-secrets` flag is provided. + - The CLI programmatically fetches the raw values from GCP Secret Manager and injects them into the local build process's `process.env`. +3. **Universal Maker Execution**: The CLI downloads the architecture-aware **Universal Maker** build engine binary (caching it at `~/.cache/firebase/universal-maker/`), verifies its size and SHA256 checksum, and executes it in the scratch folder to compile the application. +4. **Output Extraction**: The CLI parses the generated `build_output.json` and `.apphosting/bundle.yaml` to extract the application's start-up `runCommand` and stand-alone output files (e.g., `.next/standalone`). +5. **Tarball Compacting & GCS Upload**: The standalone output folder and configurations are compressed into an optimized `.tar.gz` tarball (ignoring unneeded source or `node_modules`), uploaded to GCS, and the `.local_build_` directory is safely deleted. +6. **Rollout Deployment**: The App Hosting API is invoked with a `locallyBuilt` source payload containing the storage URL, start-up `runCommand`, and discovered environment variables. + +--- + +## All Limitations & Warnings + +Before adopting local builds, you must be aware of the following strict limitations: + +### 1. Host Platform Restrictions +The pre-compiled Universal Maker build binary only supports a subset of operating systems and architectures: +- **macOS**: Only macOS Apple Silicon (`darwin_arm64`) is supported. macOS Intel (`darwin_x64`) is **not** supported. +- **Linux**: Only Linux x86-64 (`linux_x64`) is supported. Linux ARM (`linux_arm64`) is **not** supported. +- **Windows**: Windows (`win32`) is **not** supported. Windows developers must deploy from source or run the CLI inside a WSL (Windows Subsystem for Linux) environment. + +### 2. Framework Restrictions (Next.js Hardcoding) +The current local build implementation has Next.js-specific output directory path assumptions. Other frameworks (like Angular or SvelteKit) may fail or produce packaging errors during the rollout phase unless they compile into an identical standalone folder structure. + +### 3. Security & Secret Exposure Caveats +If your build depends on secrets marked for `BUILD` availability, the CLI downloads the raw, unencrypted values from Cloud Secret Manager to inject them into the local process. +- Depending on your bundler configuration (e.g., Next.js's `NEXT_PUBLIC_` variable prefix), **sensitive raw secrets may get compiled/embedded directly into your client-side Javascript bundles**, exposing them in public files. Use build-time secrets with extreme caution. + +### 4. Local Directory Collisions +If a local build is force-quit or crashes mid-execution, the temporary folder `.local_build_` remains in your workspace. Future deployments will fail immediately with a directory collision error until you manually delete this folder. diff --git a/skills/firebase-app-hosting-basics/references/runtimes_and_abiu.md b/skills/firebase-app-hosting-basics/references/runtimes_and_abiu.md new file mode 100644 index 00000000..996e0d4a --- /dev/null +++ b/skills/firebase-app-hosting-basics/references/runtimes_and_abiu.md @@ -0,0 +1,44 @@ +# App Hosting Runtimes & Automatic Base Image Updates (ABIU) + +Firebase App Hosting allows you to choose a specific runtime environment (e.g., versioned Node.js) for your backend. When you choose a versioned runtime, **Automatic Base Image Updates (ABIU)** automatically applies security patches to your underlying OS/runtime container without requiring you to rebuild or redeploy. + +--- + +## Mandatory Rules for Coding Agents + +> [!IMPORTANT] +> **CRITICAL RUNTIME COMPATIBILITY INSTRUCTION FOR CODING AGENTS (AI ASSISTANTS):** +> 1. **ALWAYS CHECK `package.json` FIRST**: Before recommending a runtime version or running backend creation commands, you **MUST** read the user's `package.json` file and inspect the `engines.node` field: +> - *Example*: If `package.json` has `"engines": { "node": ">=22.0.0" }`, you **MUST** select `nodejs22` or `nodejs24`. +> 2. **PREVENT MISMATCH FAILURES**: If you create a backend with a runtime version that is incompatible with the `engines` field of their `package.json`, the deployment **will fail** during the Cloud Build phase. +> 3. **WARN ON DEFAULT RUNTIME**: If the default unversioned `nodejs` runtime is used: +> - Warn the developer that **ABIU is completely disabled**, leaving their container without automated security patches. +> - Advise the developer to migrate to a versioned runtime (like `nodejs22`) to receive automatic security updates. + +--- + +## Setup and Configuration + +### 1. Enable runtime Selection +Ensure the `abiu` experiment is enabled on the local CLI: +```bash +npx -y firebase-tools@latest experiments:enable abiu +``` + +### 2. Specifying runtime During Backend Creation +When creating a new backend programmatically or in non-interactive environments, specify the target versioned runtime using the `--runtime` flag: +```bash +npx -y firebase-tools@latest apphosting:backends:create --runtime nodejs22 --backend my-backend-name --primary-region us-central1 +``` + +--- + +## Runtime Lifecycles & Support + +Runtimes progress through the following lifecycle phases (mirroring Cloud Run's support): + +| Lifecycle State | Description | Agent Actions | +| :--- | :--- | :--- | +| **Supported** | Fully supported. ABIU security patches are active. | Recommend these versions to users. | +| **Deprecated** | Approaching end of support. Existing apps continue running, but warnings appear in the Console. | Warn the user to migrate to a newer version as soon as possible. | +| **Decommissioned** | Completely unsupported. New builds or backends using this version will fail with errors. Existing containers may stop working or be deleted. | **NEVER** allow creation of new backends on decommissioned versions. Assist the user in upgrading. | From d8a733d9711a12fd5633ae4f2593097e88fe8d55 Mon Sep 17 00:00:00 2001 From: Aryan Falahatpisheh Date: Tue, 19 May 2026 09:07:41 -0400 Subject: [PATCH 02/10] Improve document formatting and wording. --- .../references/local_builds.md | 20 +++++++++---------- .../references/runtimes_and_abiu.md | 9 +++------ 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/skills/firebase-app-hosting-basics/references/local_builds.md b/skills/firebase-app-hosting-basics/references/local_builds.md index bec9a27c..92886375 100644 --- a/skills/firebase-app-hosting-basics/references/local_builds.md +++ b/skills/firebase-app-hosting-basics/references/local_builds.md @@ -79,16 +79,14 @@ Before adopting local builds, you must be aware of the following strict limitati ### 1. Host Platform Restrictions The pre-compiled Universal Maker build binary only supports a subset of operating systems and architectures: -- **macOS**: Only macOS Apple Silicon (`darwin_arm64`) is supported. macOS Intel (`darwin_x64`) is **not** supported. -- **Linux**: Only Linux x86-64 (`linux_x64`) is supported. Linux ARM (`linux_arm64`) is **not** supported. -- **Windows**: Windows (`win32`) is **not** supported. Windows developers must deploy from source or run the CLI inside a WSL (Windows Subsystem for Linux) environment. +- **macOS**: Only macOS Apple Silicon (`darwin_arm64`) is supported. macOS Intel (`darwin_x64`) is not supported. +- **Linux**: Only Linux x86-64 (`linux_x64`) is supported. Linux ARM (`linux_arm64`) is not supported. +- **Windows**: Windows (`win32`) is not supported. Windows developers must deploy from source or run the CLI inside a WSL (Windows Subsystem for Linux) environment. -### 2. Framework Restrictions (Next.js Hardcoding) -The current local build implementation has Next.js-specific output directory path assumptions. Other frameworks (like Angular or SvelteKit) may fail or produce packaging errors during the rollout phase unless they compile into an identical standalone folder structure. +### 2. Security & Secret Exposure Caveats +If your build depends on secrets marked for `BUILD` availability, the CLI fetches the raw, unencrypted values from Cloud Secret Manager and sets them as environment variables in the build context. +- **General Build-Time Risk**: Developers must be extremely cautious when using build-available secrets. Ensure your application code and build scripts do not accidentally expose or embed these sensitive values into client-side bundles, compiled files, or public assets. This risk is universal and is equally critical whether you compile locally or remotely on Google Cloud Build. -### 3. Security & Secret Exposure Caveats -If your build depends on secrets marked for `BUILD` availability, the CLI downloads the raw, unencrypted values from Cloud Secret Manager to inject them into the local process. -- Depending on your bundler configuration (e.g., Next.js's `NEXT_PUBLIC_` variable prefix), **sensitive raw secrets may get compiled/embedded directly into your client-side Javascript bundles**, exposing them in public files. Use build-time secrets with extreme caution. - -### 4. Local Directory Collisions -If a local build is force-quit or crashes mid-execution, the temporary folder `.local_build_` remains in your workspace. Future deployments will fail immediately with a directory collision error until you manually delete this folder. +### 3. Local Directory Collisions & Artifact Leftovers +The local build pipeline creates intermediate workspace directories (such as `.local_build_`) during the compilation process. +- **Interrupted Cleanup**: While the CLI is designed to automatically delete these intermediate folders upon a successful build, **if the build process is interrupted, force-quit, or crashes mid-execution, these artifacts may be left on your system**. You will need to manually delete these leftover directories to secure any cached environment variables and to prevent subsequent `firebase deploy` commands from blocking due to directory collisions. diff --git a/skills/firebase-app-hosting-basics/references/runtimes_and_abiu.md b/skills/firebase-app-hosting-basics/references/runtimes_and_abiu.md index 996e0d4a..f9b61599 100644 --- a/skills/firebase-app-hosting-basics/references/runtimes_and_abiu.md +++ b/skills/firebase-app-hosting-basics/references/runtimes_and_abiu.md @@ -8,12 +8,9 @@ Firebase App Hosting allows you to choose a specific runtime environment (e.g., > [!IMPORTANT] > **CRITICAL RUNTIME COMPATIBILITY INSTRUCTION FOR CODING AGENTS (AI ASSISTANTS):** -> 1. **ALWAYS CHECK `package.json` FIRST**: Before recommending a runtime version or running backend creation commands, you **MUST** read the user's `package.json` file and inspect the `engines.node` field: -> - *Example*: If `package.json` has `"engines": { "node": ">=22.0.0" }`, you **MUST** select `nodejs22` or `nodejs24`. -> 2. **PREVENT MISMATCH FAILURES**: If you create a backend with a runtime version that is incompatible with the `engines` field of their `package.json`, the deployment **will fail** during the Cloud Build phase. -> 3. **WARN ON DEFAULT RUNTIME**: If the default unversioned `nodejs` runtime is used: -> - Warn the developer that **ABIU is completely disabled**, leaving their container without automated security patches. -> - Advise the developer to migrate to a versioned runtime (like `nodejs22`) to receive automatic security updates. +> 1. **Inspect package.json first**: Before recommending a runtime version or running backend creation commands, you **MUST** read the user's `package.json` file and inspect the `engines.node` field (e.g., if `"engines": { "node": ">=22.0.0" }` is specified, you must select `nodejs22` or `nodejs24`). +> 2. **Prevent mismatch failures**: Creating a backend with a runtime version that is incompatible with the `engines` field will trigger a build failure during the Cloud Build phase. +> 3. **Warn on default runtime**: If the default unversioned `nodejs` runtime is used, warn the developer that ABIU is completely disabled (leaving their container without automated security updates) and recommend migrating to a versioned runtime (e.g. `nodejs22`). --- From 1326f7e3135cef2e236f4582928f56689fbc83a3 Mon Sep 17 00:00:00 2001 From: Aryan Falahatpisheh Date: Mon, 24 Aug 2026 14:18:19 -0400 Subject: [PATCH 03/10] Update skills/firebase-app-hosting-basics/references/local_builds.md Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- skills/firebase-app-hosting-basics/references/local_builds.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/skills/firebase-app-hosting-basics/references/local_builds.md b/skills/firebase-app-hosting-basics/references/local_builds.md index 92886375..e1d4e2f3 100644 --- a/skills/firebase-app-hosting-basics/references/local_builds.md +++ b/skills/firebase-app-hosting-basics/references/local_builds.md @@ -81,7 +81,7 @@ Before adopting local builds, you must be aware of the following strict limitati The pre-compiled Universal Maker build binary only supports a subset of operating systems and architectures: - **macOS**: Only macOS Apple Silicon (`darwin_arm64`) is supported. macOS Intel (`darwin_x64`) is not supported. - **Linux**: Only Linux x86-64 (`linux_x64`) is supported. Linux ARM (`linux_arm64`) is not supported. -- **Windows**: Windows (`win32`) is not supported. Windows developers must deploy from source or run the CLI inside a WSL (Windows Subsystem for Linux) environment. +- **Windows**: Windows (`win32`) is not supported. Windows developers must either deploy from source (using Cloud Build) or run the CLI inside a WSL (Windows Subsystem for Linux) environment to perform local builds. ### 2. Security & Secret Exposure Caveats If your build depends on secrets marked for `BUILD` availability, the CLI fetches the raw, unencrypted values from Cloud Secret Manager and sets them as environment variables in the build context. From 26a55efaef28ddbb816082ab397093fef7007368 Mon Sep 17 00:00:00 2001 From: Aryan Falahatpisheh Date: Mon, 24 Aug 2026 14:18:25 -0400 Subject: [PATCH 04/10] Update skills/firebase-app-hosting-basics/references/runtimes_and_abiu.md Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- .../firebase-app-hosting-basics/references/runtimes_and_abiu.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/skills/firebase-app-hosting-basics/references/runtimes_and_abiu.md b/skills/firebase-app-hosting-basics/references/runtimes_and_abiu.md index f9b61599..62ccb3a4 100644 --- a/skills/firebase-app-hosting-basics/references/runtimes_and_abiu.md +++ b/skills/firebase-app-hosting-basics/references/runtimes_and_abiu.md @@ -22,7 +22,7 @@ Ensure the `abiu` experiment is enabled on the local CLI: npx -y firebase-tools@latest experiments:enable abiu ``` -### 2. Specifying runtime During Backend Creation +### 2. Specifying Runtime During Backend Creation When creating a new backend programmatically or in non-interactive environments, specify the target versioned runtime using the `--runtime` flag: ```bash npx -y firebase-tools@latest apphosting:backends:create --runtime nodejs22 --backend my-backend-name --primary-region us-central1 From cfa29ac5e1cfba23046430531ca7638c0f1b1b92 Mon Sep 17 00:00:00 2001 From: Aryan Falahatpisheh Date: Mon, 24 Aug 2026 14:18:39 -0400 Subject: [PATCH 05/10] Update skills/firebase-app-hosting-basics/SKILL.md Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- skills/firebase-app-hosting-basics/SKILL.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/skills/firebase-app-hosting-basics/SKILL.md b/skills/firebase-app-hosting-basics/SKILL.md index e9d3c1fc..bd977fe7 100644 --- a/skills/firebase-app-hosting-basics/SKILL.md +++ b/skills/firebase-app-hosting-basics/SKILL.md @@ -50,7 +50,7 @@ This is the recommended flow for most users. ### Deploy via Local Builds (Experimental) If you want faster deployments by bypassing Cloud Build queues, you can compile your full-stack web application locally. -1. Set up the experiments and configure `"localBuild": true` in your `firebase.json` file. +1. Enable the `abiu` and `apphostinglocalbuilds` experiments and configure `"localBuild": true` in your `firebase.json` file. 2. Run `npx -y firebase-tools@latest deploy --only apphosting` to compile and deploy the pre-built assets. > [!CAUTION] From 9b634369dff9ab694863374066c75e06913c26e1 Mon Sep 17 00:00:00 2001 From: Aryan Falahatpisheh Date: Mon, 24 Aug 2026 14:18:48 -0400 Subject: [PATCH 06/10] Update skills/firebase-app-hosting-basics/references/runtimes_and_abiu.md Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- .../firebase-app-hosting-basics/references/runtimes_and_abiu.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/skills/firebase-app-hosting-basics/references/runtimes_and_abiu.md b/skills/firebase-app-hosting-basics/references/runtimes_and_abiu.md index 62ccb3a4..4d6d8683 100644 --- a/skills/firebase-app-hosting-basics/references/runtimes_and_abiu.md +++ b/skills/firebase-app-hosting-basics/references/runtimes_and_abiu.md @@ -16,7 +16,7 @@ Firebase App Hosting allows you to choose a specific runtime environment (e.g., ## Setup and Configuration -### 1. Enable runtime Selection +### 1. Enable Runtime Selection Ensure the `abiu` experiment is enabled on the local CLI: ```bash npx -y firebase-tools@latest experiments:enable abiu From 59bf3a208492011716672bc1fd14750e4c91637e Mon Sep 17 00:00:00 2001 From: Aryan Falahatpisheh Date: Mon, 24 Aug 2026 17:13:52 -0400 Subject: [PATCH 07/10] Format markdown files with mdformat --- skills/firebase-ai-logic-basics/SKILL.md | 82 +++++----- skills/firebase-app-hosting-basics/SKILL.md | 40 +++-- .../references/local_builds.md | 143 +++++++++++++----- .../references/runtimes_and_abiu.md | 52 +++++-- skills/firebase-basics/SKILL.md | 7 +- skills/firebase-remote-config-basics/SKILL.md | 2 +- 6 files changed, 210 insertions(+), 116 deletions(-) diff --git a/skills/firebase-ai-logic-basics/SKILL.md b/skills/firebase-ai-logic-basics/SKILL.md index 065c6777..cc6fe467 100644 --- a/skills/firebase-ai-logic-basics/SKILL.md +++ b/skills/firebase-ai-logic-basics/SKILL.md @@ -18,10 +18,10 @@ of Google's AI integration platform for mobile and web developers. It supports the two Gemini API providers: -- **Gemini Developer API**: It has a free tier ideal for prototyping, and - pay-as-you-go for production -- **Agent Platform Gemini API** (formerly branded Vertex AI): Ideal for scale - with enterprise-grade production readiness, requires Blaze plan +- **Gemini Developer API**: It has a free tier ideal for prototyping, and + pay-as-you-go for production +- **Agent Platform Gemini API** (formerly branded Vertex AI): Ideal for scale + with enterprise-grade production readiness, requires Blaze plan Use the Gemini Developer API as a default, and only Agent Platform Gemini API (formerly branded Vertex AI) if the application requires it. @@ -30,13 +30,13 @@ Use the Gemini Developer API as a default, and only Agent Platform Gemini API ### Prerequisites -- Before starting, ensure you have **Node.js 16+** and npm installed. Install - them if they aren’t already available. -- Identify the platform the user is interested in building on prior to - starting: Android, iOS, Flutter or Web. -- If their platform is unsupported, Direct the user to Firebase Docs to learn - how to set up AI Logic for their application (share this link with the user - https://firebase.google.com/docs/ai-logic/get-started) +- Before starting, ensure you have **Node.js 16+** and npm installed. Install + them if they aren’t already available. +- Identify the platform the user is interested in building on prior to starting: + Android, iOS, Flutter or Web. +- If their platform is unsupported, Direct the user to Firebase Docs to learn + how to set up AI Logic for their application (share this link with the user + https://firebase.google.com/docs/ai-logic/get-started) ### Installation @@ -97,7 +97,7 @@ faster display of results. > [Firebase AI Logic Models documentation](https://firebase.google.com/docs/ai-logic/models.md.txt) > for the currently supported image generation (Nano Banana) model names. -- Requires an upgraded Blaze pay-as-you-go billing plan. +- Requires an upgraded Blaze pay-as-you-go billing plan. ### Search Grounding with the built in googleSearch tool @@ -140,27 +140,26 @@ Tokens** during development and testing to bypass standard attestation. ##### Local Development (Auto-Generated) -1. Configure your code's App Check provider to use the debug factory: - * **Web**: Set `self.FIREBASE_APPCHECK_DEBUG_TOKEN = true;` before - initializing App Check. - * **Android**: Install `DebugAppCheckProviderFactory.getInstance()`. - * **iOS**: Set provider factory to `AppCheckDebugProviderFactory()`. -2. Run your app in the emulator/localhost. -3. Look at your runtime debugger console / Logcat logs for the generated UUID: - * *Example:* `AppCheck debug token: - "123a4567-b89c-12d3-e456-789012345678"` -4. Register this token in the Firebase Console under **Security > App Check > - Apps > Manage debug tokens**. +1. Configure your code's App Check provider to use the debug factory: + - **Web**: Set `self.FIREBASE_APPCHECK_DEBUG_TOKEN = true;` before + initializing App Check. + - **Android**: Install `DebugAppCheckProviderFactory.getInstance()`. + - **iOS**: Set provider factory to `AppCheckDebugProviderFactory()`. +1. Run your app in the emulator/localhost. +1. Look at your runtime debugger console / Logcat logs for the generated UUID: + - *Example:* `AppCheck debug token: "123a4567-b89c-12d3-e456-789012345678"` +1. Register this token in the Firebase Console under **Security > App Check > + Apps > Manage debug tokens**. ##### CI/CD Pipelines (Pre-Provisioned) -1. Generate and register a new debug token in the Firebase Console under - **Security > App Check > Apps > Manage debug tokens**. -2. Add this token string as an encrypted secret in your CI system (e.g. - `APP_CHECK_DEBUG_TOKEN`). -3. Configure your build to pass this secret as an environment variable to the - SDK during test execution (e.g. `self.FIREBASE_APPCHECK_DEBUG_TOKEN = - process.env.APP_CHECK_DEBUG_TOKEN`). +1. Generate and register a new debug token in the Firebase Console under + **Security > App Check > Apps > Manage debug tokens**. +1. Add this token string as an encrypted secret in your CI system (e.g. + `APP_CHECK_DEBUG_TOKEN`). +1. Configure your build to pass this secret as an environment variable to the + SDK during test execution (e.g. + `self.FIREBASE_APPCHECK_DEBUG_TOKEN = process.env.APP_CHECK_DEBUG_TOKEN`). ### Remote Config @@ -177,21 +176,14 @@ without deploying new client code. See ## Initialization Code References -| Language, | Gemini API | Context URL | -: Framework, : provider : : -: Platform : : : -| :---------- | :--------- | :---------------------------------------------- | -| Web Modular | Gemini | firebase://docs/ai-logic/get-started | -: API : Developer : : -: : API : : -: : (Developer : : -: : API) : : -| iOS (Swift) | Gemini | [ios_setup.md](references/ios_setup.md) | -: : Developer : : -: : API : : -| Flutter | Gemini | [flutter_setup.md](references/flutter_setup.md) | -: (Dart) : Developer : : -: : API : : +| Language, | Gemini API | Context URL | : Framework, : provider : : : Platform +: : : | :\---------- | :--------- | +:---------------------------------------------- | | Web Modular | Gemini | +firebase://docs/ai-logic/get-started | : API : Developer : : : : API : : : : +(Developer : : : : API) : : | iOS (Swift) | Gemini | +[ios_setup.md](references/ios_setup.md) | : : Developer : : : : API : : | +Flutter | Gemini | [flutter_setup.md](references/flutter_setup.md) | : (Dart) : +Developer : : : : API : : > [!WARNING] **CRITICAL: Use current model names:** Always check the > [Firebase AI Logic Models documentation](https://firebase.google.com/docs/ai-logic/models.md.txt) diff --git a/skills/firebase-app-hosting-basics/SKILL.md b/skills/firebase-app-hosting-basics/SKILL.md index 02b096c5..a276a2e0 100644 --- a/skills/firebase-app-hosting-basics/SKILL.md +++ b/skills/firebase-app-hosting-basics/SKILL.md @@ -39,7 +39,7 @@ to upgrade their plan. This is the recommended flow for most users. 1. Configure `firebase.json` with an `apphosting` block. - + ```json { "apphosting": { @@ -55,25 +55,36 @@ This is the recommended flow for most users. } } ``` + 1. Create or edit `apphosting.yaml`- see [Configuration](references/configuration.md) for more information on how to do so. + 1. If the app needs safe access to sensitive keys, use `npx -y firebase-tools@latest apphosting:secrets` commands to set and grant access to secrets. + 1. Run `npx -y firebase-tools@latest deploy` when you are ready to deploy. ### Deploy via Local Builds (Experimental) -If you want faster deployments by bypassing Cloud Build queues, you can compile your full-stack web application locally. -1. Enable the `abiu` and `apphostinglocalbuilds` experiments and configure `"localBuild": true` in your `firebase.json` file. -2. Run `npx -y firebase-tools@latest deploy --only apphosting` to compile and deploy the pre-built assets. +If you want faster deployments by bypassing Cloud Build queues, you can compile +your full-stack web application locally. + +1. Enable the `abiu` and `apphostinglocalbuilds` experiments and configure + `"localBuild": true` in your `firebase.json` file. +1. Run `npx -y firebase-tools@latest deploy --only apphosting` to compile and + deploy the pre-built assets. -> [!CAUTION] -> **SECURITY WARNING FOR CODING AGENTS (AI ASSISTANTS):** -> - **DO NOT** bypass confirmation using `--allow-local-build-secrets` unless explicitly requested by the developer. -> - **PAUSE AND WARN** the developer of the severe risk that raw secret values will be downloaded locally and may get permanently compiled into public client-side bundles or cached artifacts. -> - Review the strict operating system, framework, and security limitations in the [Local Builds Reference](references/local_builds.md). +> [!CAUTION] **SECURITY WARNING FOR CODING AGENTS (AI ASSISTANTS):** +> +> - **DO NOT** bypass confirmation using `--allow-local-build-secrets` unless +> explicitly requested by the developer. +> - **PAUSE AND WARN** the developer of the severe risk that raw secret values +> will be downloaded locally and may get permanently compiled into public +> client-side bundles or cached artifacts. +> - Review the strict operating system, framework, and security limitations in +> the [Local Builds Reference](references/local_builds.md). ### Automated deployment via GitHub (CI/CD) @@ -85,9 +96,14 @@ this up using CLI commands. ## Runtimes & Automatic Base Image Updates (ABIU) -App Hosting supports versioned Node.js runtimes with Automatic Base Image Updates (ABIU) to apply security patches without redeploys. -- **CRITICAL**: AI Assistants **MUST** inspect the project's `package.json` and check the `engines.node` field before recommending a runtime version or creating a backend. Mismatched runtimes trigger build-time errors. -- For a complete guide on setup, CLI flags, and lifecycle management, see [Runtimes & ABIU](references/runtimes_and_abiu.md). +App Hosting supports versioned Node.js runtimes with Automatic Base Image +Updates (ABIU) to apply security patches without redeploys. + +- **CRITICAL**: AI Assistants **MUST** inspect the project's `package.json` and + check the `engines.node` field before recommending a runtime version or + creating a backend. Mismatched runtimes trigger build-time errors. +- For a complete guide on setup, CLI flags, and lifecycle management, see + [Runtimes & ABIU](references/runtimes_and_abiu.md). ## Emulation diff --git a/skills/firebase-app-hosting-basics/references/local_builds.md b/skills/firebase-app-hosting-basics/references/local_builds.md index e1d4e2f3..11d5f089 100644 --- a/skills/firebase-app-hosting-basics/references/local_builds.md +++ b/skills/firebase-app-hosting-basics/references/local_builds.md @@ -1,40 +1,60 @@ # App Hosting Local Builds (Experimental) -App Hosting Local Builds is an experimental feature that compiles your full-stack web application (e.g. Next.js) on your local development machine instead of using Google Cloud Build in the cloud. Once compiled, the Firebase CLI packages the pre-built standalone assets and uploads them directly to Cloud Run. +App Hosting Local Builds is an experimental feature that compiles your +full-stack web application (e.g. Next.js) on your local development machine +instead of using Google Cloud Build in the cloud. Once compiled, the Firebase +CLI packages the pre-built standalone assets and uploads them directly to Cloud +Run. -This feature is highly useful for faster deployments, bypassing cloud build queue times, and debugging build outputs locally. +This feature is highly useful for faster deployments, bypassing cloud build +queue times, and debugging build outputs locally. -> [!WARNING] -> This is an early preview of prototype code and you are likely to encounter bugs. Do NOT use this with production backends or sensitive data. Only use test backends and non-sensitive test data as you evaluate this feature. +> [!WARNING] This is an early preview of prototype code and you are likely to +> encounter bugs. Do NOT use this with production backends or sensitive data. +> Only use test backends and non-sensitive test data as you evaluate this +> feature. ---- +______________________________________________________________________ ## Mandatory Rules for Coding Agents -> [!CAUTION] -> **CRITICAL SECURITY INSTRUCTION FOR CODING AGENTS (AI ASSISTANTS):** -> 1. **DO NOT** run local builds with the `--allow-local-build-secrets` flag unless the developer has explicitly instructed you to bypass confirmations for build secrets. -> 2. **PAUSE AND WARN** the user if you detect any `BUILD`-available secrets in `apphosting.yaml`. You must explain that: -> - Local builds will download the raw, unencrypted secret values from Google Cloud Secret Manager to your local machine. -> - These raw secret values can easily be permanently baked into your client-side JavaScript bundles (e.g. due to Next.js bundler behavior) or left behind in local build artifacts/temporary files. -> 3. **GET EXPLICIT APPROVAL** from the user before proceeding with a local build when secrets are configured. - ---- +> [!CAUTION] **CRITICAL SECURITY INSTRUCTION FOR CODING AGENTS (AI +> ASSISTANTS):** +> +> 1. **DO NOT** run local builds with the `--allow-local-build-secrets` flag +> unless the developer has explicitly instructed you to bypass confirmations +> for build secrets. +> 1. **PAUSE AND WARN** the user if you detect any `BUILD`-available secrets in +> `apphosting.yaml`. You must explain that: +> - Local builds will download the raw, unencrypted secret values from Google +> Cloud Secret Manager to your local machine. +> - These raw secret values can easily be permanently baked into your +> client-side JavaScript bundles (e.g. due to Next.js bundler behavior) or +> left behind in local build artifacts/temporary files. +> 1. **GET EXPLICIT APPROVAL** from the user before proceeding with a local +> build when secrets are configured. + +______________________________________________________________________ ## Setup and Configuration ### 1. Enable Experiments + Enable the required experimental CLI preview flags on your local machine: + ```bash npx -y firebase-tools@latest experiments:enable abiu npx -y firebase-tools@latest experiments:enable apphostinglocalbuilds ``` -> [!NOTE] -> The experiment `universalMaker` is no longer a separate experiment name in the Firebase CLI. All binary management and building capabilities are fully handled under the `apphostinglocalbuilds` experiment. +> [!NOTE] The experiment `universalMaker` is no longer a separate experiment +> name in the Firebase CLI. All binary management and building capabilities are +> fully handled under the `apphostinglocalbuilds` experiment. ### 2. Configure `firebase.json` -To instruct the Firebase CLI to perform a local build during deploy, set `"localBuild": true` in the `apphosting` block of your `firebase.json`: + +To instruct the Firebase CLI to perform a local build during deploy, set +`"localBuild": true` in the `apphosting` block of your `firebase.json`: ```json { @@ -55,38 +75,81 @@ To instruct the Firebase CLI to perform a local build during deploy, set `"local } ``` ---- +______________________________________________________________________ ## Technical Details (How It Works Under the Hood) -When you execute `npx -y firebase-tools@latest deploy --only apphosting`, the local build flow performs the following steps: - -1. **Isolated Scratch Workspace**: The CLI creates a temporary scratch folder named `.local_build_` in your project root and copies all project files into it. It applies your `firebase.json` ignore patterns and respects `.gitignore` to ensure a clean build context matching what would have been sent to Cloud Build. -2. **Secret Injection**: If your `apphosting.yaml` environment contains secrets marked for `BUILD` availability: - - In interactive mode, the CLI will prompt you with a warning before downloading. - - In non-interactive mode (e.g. CI scripts), the deployment will abort with an error unless the `--allow-local-build-secrets` flag is provided. - - The CLI programmatically fetches the raw values from GCP Secret Manager and injects them into the local build process's `process.env`. -3. **Universal Maker Execution**: The CLI downloads the architecture-aware **Universal Maker** build engine binary (caching it at `~/.cache/firebase/universal-maker/`), verifies its size and SHA256 checksum, and executes it in the scratch folder to compile the application. -4. **Output Extraction**: The CLI parses the generated `build_output.json` and `.apphosting/bundle.yaml` to extract the application's start-up `runCommand` and stand-alone output files (e.g., `.next/standalone`). -5. **Tarball Compacting & GCS Upload**: The standalone output folder and configurations are compressed into an optimized `.tar.gz` tarball (ignoring unneeded source or `node_modules`), uploaded to GCS, and the `.local_build_` directory is safely deleted. -6. **Rollout Deployment**: The App Hosting API is invoked with a `locallyBuilt` source payload containing the storage URL, start-up `runCommand`, and discovered environment variables. - ---- +When you execute `npx -y firebase-tools@latest deploy --only apphosting`, the +local build flow performs the following steps: + +1. **Isolated Scratch Workspace**: The CLI creates a temporary scratch folder + named `.local_build_` in your project root and copies all project + files into it. It applies your `firebase.json` ignore patterns and respects + `.gitignore` to ensure a clean build context matching what would have been + sent to Cloud Build. +1. **Secret Injection**: If your `apphosting.yaml` environment contains secrets + marked for `BUILD` availability: + - In interactive mode, the CLI will prompt you with a warning before + downloading. + - In non-interactive mode (e.g. CI scripts), the deployment will abort with + an error unless the `--allow-local-build-secrets` flag is provided. + - The CLI programmatically fetches the raw values from GCP Secret Manager and + injects them into the local build process's `process.env`. +1. **Universal Maker Execution**: The CLI downloads the architecture-aware + **Universal Maker** build engine binary (caching it at + `~/.cache/firebase/universal-maker/`), verifies its size and SHA256 checksum, + and executes it in the scratch folder to compile the application. +1. **Output Extraction**: The CLI parses the generated `build_output.json` and + `.apphosting/bundle.yaml` to extract the application's start-up `runCommand` + and stand-alone output files (e.g., `.next/standalone`). +1. **Tarball Compacting & GCS Upload**: The standalone output folder and + configurations are compressed into an optimized `.tar.gz` tarball (ignoring + unneeded source or `node_modules`), uploaded to GCS, and the + `.local_build_` directory is safely deleted. +1. **Rollout Deployment**: The App Hosting API is invoked with a `locallyBuilt` + source payload containing the storage URL, start-up `runCommand`, and + discovered environment variables. + +______________________________________________________________________ ## All Limitations & Warnings -Before adopting local builds, you must be aware of the following strict limitations: +Before adopting local builds, you must be aware of the following strict +limitations: ### 1. Host Platform Restrictions -The pre-compiled Universal Maker build binary only supports a subset of operating systems and architectures: -- **macOS**: Only macOS Apple Silicon (`darwin_arm64`) is supported. macOS Intel (`darwin_x64`) is not supported. -- **Linux**: Only Linux x86-64 (`linux_x64`) is supported. Linux ARM (`linux_arm64`) is not supported. -- **Windows**: Windows (`win32`) is not supported. Windows developers must either deploy from source (using Cloud Build) or run the CLI inside a WSL (Windows Subsystem for Linux) environment to perform local builds. + +The pre-compiled Universal Maker build binary only supports a subset of +operating systems and architectures: + +- **macOS**: Only macOS Apple Silicon (`darwin_arm64`) is supported. macOS Intel + (`darwin_x64`) is not supported. +- **Linux**: Only Linux x86-64 (`linux_x64`) is supported. Linux ARM + (`linux_arm64`) is not supported. +- **Windows**: Windows (`win32`) is not supported. Windows developers must + either deploy from source (using Cloud Build) or run the CLI inside a WSL + (Windows Subsystem for Linux) environment to perform local builds. ### 2. Security & Secret Exposure Caveats -If your build depends on secrets marked for `BUILD` availability, the CLI fetches the raw, unencrypted values from Cloud Secret Manager and sets them as environment variables in the build context. -- **General Build-Time Risk**: Developers must be extremely cautious when using build-available secrets. Ensure your application code and build scripts do not accidentally expose or embed these sensitive values into client-side bundles, compiled files, or public assets. This risk is universal and is equally critical whether you compile locally or remotely on Google Cloud Build. + +If your build depends on secrets marked for `BUILD` availability, the CLI +fetches the raw, unencrypted values from Cloud Secret Manager and sets them as +environment variables in the build context. + +- **General Build-Time Risk**: Developers must be extremely cautious when using + build-available secrets. Ensure your application code and build scripts do not + accidentally expose or embed these sensitive values into client-side bundles, + compiled files, or public assets. This risk is universal and is equally + critical whether you compile locally or remotely on Google Cloud Build. ### 3. Local Directory Collisions & Artifact Leftovers -The local build pipeline creates intermediate workspace directories (such as `.local_build_`) during the compilation process. -- **Interrupted Cleanup**: While the CLI is designed to automatically delete these intermediate folders upon a successful build, **if the build process is interrupted, force-quit, or crashes mid-execution, these artifacts may be left on your system**. You will need to manually delete these leftover directories to secure any cached environment variables and to prevent subsequent `firebase deploy` commands from blocking due to directory collisions. + +The local build pipeline creates intermediate workspace directories (such as +`.local_build_`) during the compilation process. + +- **Interrupted Cleanup**: While the CLI is designed to automatically delete + these intermediate folders upon a successful build, **if the build process is + interrupted, force-quit, or crashes mid-execution, these artifacts may be left + on your system**. You will need to manually delete these leftover directories + to secure any cached environment variables and to prevent subsequent + `firebase deploy` commands from blocking due to directory collisions. diff --git a/skills/firebase-app-hosting-basics/references/runtimes_and_abiu.md b/skills/firebase-app-hosting-basics/references/runtimes_and_abiu.md index 4d6d8683..268a412d 100644 --- a/skills/firebase-app-hosting-basics/references/runtimes_and_abiu.md +++ b/skills/firebase-app-hosting-basics/references/runtimes_and_abiu.md @@ -1,41 +1,61 @@ # App Hosting Runtimes & Automatic Base Image Updates (ABIU) -Firebase App Hosting allows you to choose a specific runtime environment (e.g., versioned Node.js) for your backend. When you choose a versioned runtime, **Automatic Base Image Updates (ABIU)** automatically applies security patches to your underlying OS/runtime container without requiring you to rebuild or redeploy. +Firebase App Hosting allows you to choose a specific runtime environment (e.g., +versioned Node.js) for your backend. When you choose a versioned runtime, +**Automatic Base Image Updates (ABIU)** automatically applies security patches +to your underlying OS/runtime container without requiring you to rebuild or +redeploy. ---- +______________________________________________________________________ ## Mandatory Rules for Coding Agents -> [!IMPORTANT] -> **CRITICAL RUNTIME COMPATIBILITY INSTRUCTION FOR CODING AGENTS (AI ASSISTANTS):** -> 1. **Inspect package.json first**: Before recommending a runtime version or running backend creation commands, you **MUST** read the user's `package.json` file and inspect the `engines.node` field (e.g., if `"engines": { "node": ">=22.0.0" }` is specified, you must select `nodejs22` or `nodejs24`). -> 2. **Prevent mismatch failures**: Creating a backend with a runtime version that is incompatible with the `engines` field will trigger a build failure during the Cloud Build phase. -> 3. **Warn on default runtime**: If the default unversioned `nodejs` runtime is used, warn the developer that ABIU is completely disabled (leaving their container without automated security updates) and recommend migrating to a versioned runtime (e.g. `nodejs22`). - ---- +> [!IMPORTANT] **CRITICAL RUNTIME COMPATIBILITY INSTRUCTION FOR CODING AGENTS +> (AI ASSISTANTS):** +> +> 1. **Inspect package.json first**: Before recommending a runtime version or +> running backend creation commands, you **MUST** read the user's +> `package.json` file and inspect the `engines.node` field (e.g., if +> `"engines": { "node": ">=22.0.0" }` is specified, you must select +> `nodejs22` or `nodejs24`). +> 1. **Prevent mismatch failures**: Creating a backend with a runtime version +> that is incompatible with the `engines` field will trigger a build failure +> during the Cloud Build phase. +> 1. **Warn on default runtime**: If the default unversioned `nodejs` runtime is +> used, warn the developer that ABIU is completely disabled (leaving their +> container without automated security updates) and recommend migrating to a +> versioned runtime (e.g. `nodejs22`). + +______________________________________________________________________ ## Setup and Configuration ### 1. Enable Runtime Selection + Ensure the `abiu` experiment is enabled on the local CLI: + ```bash npx -y firebase-tools@latest experiments:enable abiu ``` ### 2. Specifying Runtime During Backend Creation -When creating a new backend programmatically or in non-interactive environments, specify the target versioned runtime using the `--runtime` flag: + +When creating a new backend programmatically or in non-interactive environments, +specify the target versioned runtime using the `--runtime` flag: + ```bash npx -y firebase-tools@latest apphosting:backends:create --runtime nodejs22 --backend my-backend-name --primary-region us-central1 ``` ---- +______________________________________________________________________ ## Runtime Lifecycles & Support -Runtimes progress through the following lifecycle phases (mirroring Cloud Run's support): +Runtimes progress through the following lifecycle phases (mirroring Cloud Run's +support): -| Lifecycle State | Description | Agent Actions | -| :--- | :--- | :--- | -| **Supported** | Fully supported. ABIU security patches are active. | Recommend these versions to users. | -| **Deprecated** | Approaching end of support. Existing apps continue running, but warnings appear in the Console. | Warn the user to migrate to a newer version as soon as possible. | +| Lifecycle State | Description | Agent Actions | +| :----------------- | :------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------- | +| **Supported** | Fully supported. ABIU security patches are active. | Recommend these versions to users. | +| **Deprecated** | Approaching end of support. Existing apps continue running, but warnings appear in the Console. | Warn the user to migrate to a newer version as soon as possible. | | **Decommissioned** | Completely unsupported. New builds or backends using this version will fail with errors. Existing containers may stop working or be deleted. | **NEVER** allow creation of new backends on decommissioned versions. Assist the user in upgrading. | diff --git a/skills/firebase-basics/SKILL.md b/skills/firebase-basics/SKILL.md index 22b6ef16..4093b8ce 100644 --- a/skills/firebase-basics/SKILL.md +++ b/skills/firebase-basics/SKILL.md @@ -57,11 +57,13 @@ Complete these setup steps before proceeding: - **If using an existing Project ID:** 1. Check the current project by running `npx -y firebase-tools@latest use`. + 1. If the command outputs `Active Project: `, confirm with the user if this is the intended project. + 1. If not, or if no project is active, set the project provided by the user: - + ```bash npx -y firebase-tools@latest use ``` @@ -141,8 +143,9 @@ Adhere to these principles: - **Login Issues:** If the browser fails to open during the login step, use `npx -y firebase-tools@latest login --no-localhost` instead. + - **Genkit:** If using Genkit, install the skills: - + ```bash npx skills add genkit-ai/skills ``` diff --git a/skills/firebase-remote-config-basics/SKILL.md b/skills/firebase-remote-config-basics/SKILL.md index 772b1e14..43c84acc 100644 --- a/skills/firebase-remote-config-basics/SKILL.md +++ b/skills/firebase-remote-config-basics/SKILL.md @@ -105,7 +105,7 @@ history through the terminal: ``` - Deploy: Execute the partial deployment command - + ```bash npx -y firebase-tools@latest deploy --only remoteconfig ``` From c3061b922703441d50d488affadce1a0c727477b Mon Sep 17 00:00:00 2001 From: Aryan Falahatpisheh Date: Mon, 24 Aug 2026 17:16:02 -0400 Subject: [PATCH 08/10] Revert formatting on files outside of apphosting skill --- skills/firebase-ai-logic-basics/SKILL.md | 82 ++++++++++--------- skills/firebase-basics/SKILL.md | 7 +- skills/firebase-remote-config-basics/SKILL.md | 2 +- 3 files changed, 48 insertions(+), 43 deletions(-) diff --git a/skills/firebase-ai-logic-basics/SKILL.md b/skills/firebase-ai-logic-basics/SKILL.md index cc6fe467..065c6777 100644 --- a/skills/firebase-ai-logic-basics/SKILL.md +++ b/skills/firebase-ai-logic-basics/SKILL.md @@ -18,10 +18,10 @@ of Google's AI integration platform for mobile and web developers. It supports the two Gemini API providers: -- **Gemini Developer API**: It has a free tier ideal for prototyping, and - pay-as-you-go for production -- **Agent Platform Gemini API** (formerly branded Vertex AI): Ideal for scale - with enterprise-grade production readiness, requires Blaze plan +- **Gemini Developer API**: It has a free tier ideal for prototyping, and + pay-as-you-go for production +- **Agent Platform Gemini API** (formerly branded Vertex AI): Ideal for scale + with enterprise-grade production readiness, requires Blaze plan Use the Gemini Developer API as a default, and only Agent Platform Gemini API (formerly branded Vertex AI) if the application requires it. @@ -30,13 +30,13 @@ Use the Gemini Developer API as a default, and only Agent Platform Gemini API ### Prerequisites -- Before starting, ensure you have **Node.js 16+** and npm installed. Install - them if they aren’t already available. -- Identify the platform the user is interested in building on prior to starting: - Android, iOS, Flutter or Web. -- If their platform is unsupported, Direct the user to Firebase Docs to learn - how to set up AI Logic for their application (share this link with the user - https://firebase.google.com/docs/ai-logic/get-started) +- Before starting, ensure you have **Node.js 16+** and npm installed. Install + them if they aren’t already available. +- Identify the platform the user is interested in building on prior to + starting: Android, iOS, Flutter or Web. +- If their platform is unsupported, Direct the user to Firebase Docs to learn + how to set up AI Logic for their application (share this link with the user + https://firebase.google.com/docs/ai-logic/get-started) ### Installation @@ -97,7 +97,7 @@ faster display of results. > [Firebase AI Logic Models documentation](https://firebase.google.com/docs/ai-logic/models.md.txt) > for the currently supported image generation (Nano Banana) model names. -- Requires an upgraded Blaze pay-as-you-go billing plan. +- Requires an upgraded Blaze pay-as-you-go billing plan. ### Search Grounding with the built in googleSearch tool @@ -140,26 +140,27 @@ Tokens** during development and testing to bypass standard attestation. ##### Local Development (Auto-Generated) -1. Configure your code's App Check provider to use the debug factory: - - **Web**: Set `self.FIREBASE_APPCHECK_DEBUG_TOKEN = true;` before - initializing App Check. - - **Android**: Install `DebugAppCheckProviderFactory.getInstance()`. - - **iOS**: Set provider factory to `AppCheckDebugProviderFactory()`. -1. Run your app in the emulator/localhost. -1. Look at your runtime debugger console / Logcat logs for the generated UUID: - - *Example:* `AppCheck debug token: "123a4567-b89c-12d3-e456-789012345678"` -1. Register this token in the Firebase Console under **Security > App Check > - Apps > Manage debug tokens**. +1. Configure your code's App Check provider to use the debug factory: + * **Web**: Set `self.FIREBASE_APPCHECK_DEBUG_TOKEN = true;` before + initializing App Check. + * **Android**: Install `DebugAppCheckProviderFactory.getInstance()`. + * **iOS**: Set provider factory to `AppCheckDebugProviderFactory()`. +2. Run your app in the emulator/localhost. +3. Look at your runtime debugger console / Logcat logs for the generated UUID: + * *Example:* `AppCheck debug token: + "123a4567-b89c-12d3-e456-789012345678"` +4. Register this token in the Firebase Console under **Security > App Check > + Apps > Manage debug tokens**. ##### CI/CD Pipelines (Pre-Provisioned) -1. Generate and register a new debug token in the Firebase Console under - **Security > App Check > Apps > Manage debug tokens**. -1. Add this token string as an encrypted secret in your CI system (e.g. - `APP_CHECK_DEBUG_TOKEN`). -1. Configure your build to pass this secret as an environment variable to the - SDK during test execution (e.g. - `self.FIREBASE_APPCHECK_DEBUG_TOKEN = process.env.APP_CHECK_DEBUG_TOKEN`). +1. Generate and register a new debug token in the Firebase Console under + **Security > App Check > Apps > Manage debug tokens**. +2. Add this token string as an encrypted secret in your CI system (e.g. + `APP_CHECK_DEBUG_TOKEN`). +3. Configure your build to pass this secret as an environment variable to the + SDK during test execution (e.g. `self.FIREBASE_APPCHECK_DEBUG_TOKEN = + process.env.APP_CHECK_DEBUG_TOKEN`). ### Remote Config @@ -176,14 +177,21 @@ without deploying new client code. See ## Initialization Code References -| Language, | Gemini API | Context URL | : Framework, : provider : : : Platform -: : : | :\---------- | :--------- | -:---------------------------------------------- | | Web Modular | Gemini | -firebase://docs/ai-logic/get-started | : API : Developer : : : : API : : : : -(Developer : : : : API) : : | iOS (Swift) | Gemini | -[ios_setup.md](references/ios_setup.md) | : : Developer : : : : API : : | -Flutter | Gemini | [flutter_setup.md](references/flutter_setup.md) | : (Dart) : -Developer : : : : API : : +| Language, | Gemini API | Context URL | +: Framework, : provider : : +: Platform : : : +| :---------- | :--------- | :---------------------------------------------- | +| Web Modular | Gemini | firebase://docs/ai-logic/get-started | +: API : Developer : : +: : API : : +: : (Developer : : +: : API) : : +| iOS (Swift) | Gemini | [ios_setup.md](references/ios_setup.md) | +: : Developer : : +: : API : : +| Flutter | Gemini | [flutter_setup.md](references/flutter_setup.md) | +: (Dart) : Developer : : +: : API : : > [!WARNING] **CRITICAL: Use current model names:** Always check the > [Firebase AI Logic Models documentation](https://firebase.google.com/docs/ai-logic/models.md.txt) diff --git a/skills/firebase-basics/SKILL.md b/skills/firebase-basics/SKILL.md index 4093b8ce..22b6ef16 100644 --- a/skills/firebase-basics/SKILL.md +++ b/skills/firebase-basics/SKILL.md @@ -57,13 +57,11 @@ Complete these setup steps before proceeding: - **If using an existing Project ID:** 1. Check the current project by running `npx -y firebase-tools@latest use`. - 1. If the command outputs `Active Project: `, confirm with the user if this is the intended project. - 1. If not, or if no project is active, set the project provided by the user: - + ```bash npx -y firebase-tools@latest use ``` @@ -143,9 +141,8 @@ Adhere to these principles: - **Login Issues:** If the browser fails to open during the login step, use `npx -y firebase-tools@latest login --no-localhost` instead. - - **Genkit:** If using Genkit, install the skills: - + ```bash npx skills add genkit-ai/skills ``` diff --git a/skills/firebase-remote-config-basics/SKILL.md b/skills/firebase-remote-config-basics/SKILL.md index 43c84acc..772b1e14 100644 --- a/skills/firebase-remote-config-basics/SKILL.md +++ b/skills/firebase-remote-config-basics/SKILL.md @@ -105,7 +105,7 @@ history through the terminal: ``` - Deploy: Execute the partial deployment command - + ```bash npx -y firebase-tools@latest deploy --only remoteconfig ``` From 11b53a76018efbc45685158e20a4d9fe559d537c Mon Sep 17 00:00:00 2001 From: Aryan Falahatpisheh Date: Mon, 24 Aug 2026 17:20:32 -0400 Subject: [PATCH 09/10] Remove abiu experiment flag mentions as it is enabled by default --- skills/firebase-app-hosting-basics/SKILL.md | 2 +- .../references/local_builds.md | 5 ++--- .../references/runtimes_and_abiu.md | 12 +----------- 3 files changed, 4 insertions(+), 15 deletions(-) diff --git a/skills/firebase-app-hosting-basics/SKILL.md b/skills/firebase-app-hosting-basics/SKILL.md index a276a2e0..69cd82a1 100644 --- a/skills/firebase-app-hosting-basics/SKILL.md +++ b/skills/firebase-app-hosting-basics/SKILL.md @@ -71,7 +71,7 @@ This is the recommended flow for most users. If you want faster deployments by bypassing Cloud Build queues, you can compile your full-stack web application locally. -1. Enable the `abiu` and `apphostinglocalbuilds` experiments and configure +1. Enable the `apphostinglocalbuilds` experiment and configure `"localBuild": true` in your `firebase.json` file. 1. Run `npx -y firebase-tools@latest deploy --only apphosting` to compile and deploy the pre-built assets. diff --git a/skills/firebase-app-hosting-basics/references/local_builds.md b/skills/firebase-app-hosting-basics/references/local_builds.md index 11d5f089..6dfd375b 100644 --- a/skills/firebase-app-hosting-basics/references/local_builds.md +++ b/skills/firebase-app-hosting-basics/references/local_builds.md @@ -38,12 +38,11 @@ ______________________________________________________________________ ## Setup and Configuration -### 1. Enable Experiments +### 1. Enable Experiment -Enable the required experimental CLI preview flags on your local machine: +Enable the experimental CLI preview flag on your local machine: ```bash -npx -y firebase-tools@latest experiments:enable abiu npx -y firebase-tools@latest experiments:enable apphostinglocalbuilds ``` diff --git a/skills/firebase-app-hosting-basics/references/runtimes_and_abiu.md b/skills/firebase-app-hosting-basics/references/runtimes_and_abiu.md index 268a412d..2a57c14d 100644 --- a/skills/firebase-app-hosting-basics/references/runtimes_and_abiu.md +++ b/skills/firebase-app-hosting-basics/references/runtimes_and_abiu.md @@ -28,17 +28,7 @@ ______________________________________________________________________ ______________________________________________________________________ -## Setup and Configuration - -### 1. Enable Runtime Selection - -Ensure the `abiu` experiment is enabled on the local CLI: - -```bash -npx -y firebase-tools@latest experiments:enable abiu -``` - -### 2. Specifying Runtime During Backend Creation +## Specifying Runtime During Backend Creation When creating a new backend programmatically or in non-interactive environments, specify the target versioned runtime using the `--runtime` flag: From 57d6e00da77869fcdf1a78160a073afc83eed6a3 Mon Sep 17 00:00:00 2001 From: Aryan Falahatpisheh Date: Mon, 24 Aug 2026 17:21:08 -0400 Subject: [PATCH 10/10] Remove obsolete universalMaker note --- skills/firebase-app-hosting-basics/references/local_builds.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/skills/firebase-app-hosting-basics/references/local_builds.md b/skills/firebase-app-hosting-basics/references/local_builds.md index 6dfd375b..a7e18c37 100644 --- a/skills/firebase-app-hosting-basics/references/local_builds.md +++ b/skills/firebase-app-hosting-basics/references/local_builds.md @@ -46,10 +46,6 @@ Enable the experimental CLI preview flag on your local machine: npx -y firebase-tools@latest experiments:enable apphostinglocalbuilds ``` -> [!NOTE] The experiment `universalMaker` is no longer a separate experiment -> name in the Firebase CLI. All binary management and building capabilities are -> fully handled under the `apphostinglocalbuilds` experiment. - ### 2. Configure `firebase.json` To instruct the Firebase CLI to perform a local build during deploy, set