feat: add extension-to-functions-codebase migration skill#143
Open
shettyvarun268 wants to merge 3 commits into
Open
feat: add extension-to-functions-codebase migration skill#143shettyvarun268 wants to merge 3 commits into
shettyvarun268 wants to merge 3 commits into
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces a new skill and reference guides for migrating Firebase Extensions to standalone Cloud Functions for Firebase (CF3) codebases, detailing V1 to V2 trigger upgrades. The feedback highlights several areas for improvement: correcting invalid destructuring syntax in the main skill file, fixing malformed markdown backticks in the configuration migration guide, using correct camelCase parameter variables for secret binding examples, and standardizing the V2 function names in the signature mapping reference to use direct imports rather than namespaced ones.
| | V1 Trigger | V2 Equivalent | Shimmed Key | Destructuring Pattern | | ||
| | :--- | :--- | :--- | :--- | | ||
| | `pubsub.topic().onPublish()` | `onMessagePublished()` | `message` | `({ message, context })` | | ||
| | `pubsub.schedule().onRun()` | `scheduler.onSchedule()` | **N/A** | Access `event` directly | |
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces the extension-to-functions-codebase agent skill, designed to guide AI coding assistants through migrating installed Firebase Extensions to standalone Cloud Functions (CF3). It enables fully automated deployments by parsing permission and API requirements from extension.yaml and declaring them directly in code via the new requiresRole() and requiresAPI() SDK methods, completely removing the need for manual service account setup. It also automates the transition of lifecycle events using native SDK hooks (afterInstall/afterUpdate).
To ensure long-term compatibility, the skill instructs the agent to modernize any legacy Functions V1 triggers to V2 using the SDK's destructuring compatibility shim. This shim preserves the existing function bodies, so internal business logic requires no rewriting. The skill also incorporates best practices such as safe git copy sequences, parameterization mappings, and using onInit() for global variable initializations to prevent runtime crashes. Technical reference tables mapping triggers, options, and parameters have been included in a dedicated references/ directory.