Skip to content

feat: add extension-to-functions-codebase migration skill#143

Open
shettyvarun268 wants to merge 3 commits into
firebase:mainfrom
shettyvarun268:migrate-extension-v2
Open

feat: add extension-to-functions-codebase migration skill#143
shettyvarun268 wants to merge 3 commits into
firebase:mainfrom
shettyvarun268:migrate-extension-v2

Conversation

@shettyvarun268

Copy link
Copy Markdown

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.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread skills/extension-to-functions-codebase/SKILL.md Outdated
Comment thread skills/extension-to-functions-codebase/references/configuration-migration.md Outdated
Comment thread skills/extension-to-functions-codebase/references/configuration-migration.md Outdated
| 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 |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For consistency with the other direct imports listed in the table (such as onDocumentWritten() and onMessagePublished()), the V2 equivalent for scheduled functions should be listed as onSchedule() instead of scheduler.onSchedule().

Comment thread skills/extension-to-functions-codebase/references/signature-mapping.md Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant