Credit: thanks @SlayTheDragons whose PR
https://github.com/dyad-sh/dyad/pull/1665 paved the way for this
implementation.
<!-- CURSOR_SUMMARY -->
> [!NOTE]
> Adds _shared module support for Supabase edge functions with
import-map packaging and automatic redeploys; updates deployment to
include full function directories plus shared files, and adds path
utilities and tests.
>
> - **Supabase Edge Functions**
> - **Shared Modules Support**: Detect `_shared` changes and redeploy
all functions; regular function changes deploy only that function.
> - **Deployment Overhaul**: `deploySupabaseFunctions` now uploads full
function directories plus `_shared` files via multipart form-data, sets
`entrypoint_path`, and writes `import_map.json` (`_shared/` →
`../_shared/`).
> - **Function Discovery & Packaging**: Add file collection helpers
(`listFilesWithStats`, `loadZipEntries`) and path utilities
(`toPosixPath`, `findFunctionDirectory`, `stripSupabaseFunctionsPrefix`)
with signature-based caching for `_shared`.
> - **APIs & Utils**: Introduce `isSharedServerModule`, refine
`isServerFunction` (excludes `_shared`), add
`extractFunctionNameFromPath`, and `buildSignature`.
> - **IPC Changes**
> - Update file edit/rename/delete flows to track shared module edits
and trigger full redeploys; otherwise deploy per-function using
extracted name and `appPath`.
> - **Prompts**
> - Document `_shared` usage and import pattern in Supabase prompt.
> - **Tests**
> - Add tests for function/shared detection, name extraction, path
handling, and signature building.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
f35599ec0e708e2ef6b7e78ae7901b29953a6dff. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Adds support for shared modules for Supabase edge functions. Shared code
in supabase/functions/_shared is now bundled via an import map and
triggers redeploys across all functions when changed.
- **New Features**
- Detects shared modules in supabase/functions/_shared and redeploys all
functions when they change.
- Deploys full function directories plus shared files, and writes an
import_map.json that resolves "_shared/" imports.
- Auto-deploys only the affected function on file changes; switches to
redeploy-all when a shared module is touched.
- **Refactors**
- deploySupabaseFunction now uploads multiple files (function + shared)
using multipart form-data and sets entrypoint/import map.
- Added file collection, path utilities, and shared-file caching via
content signatures to reduce redundant reads.
- Updated deployAllSupabaseFunctions to skip non-function dirs (e.g.,
_shared) and use functionPath.
- Added tests for function/shared detection, path handling, and
signature building.
<sup>Written for commit 302d84625d9e61477db9ada052a027b29ff18cef.
Summary will update automatically on new commits.</sup>
<!-- End of auto-generated description by cubic. -->
#1784
<!-- CURSOR_SUMMARY -->
> [!NOTE]
> After reverting to a previous version, automatically deploy all
Supabase edge functions; failures are logged as warnings without
blocking the revert.
>
> - **Version Revert Flow (`src/ipc/handlers/version_handlers.ts`)**:
> - After revert, re-deploy all Supabase edge functions when
`app.supabaseProjectId` is present via `deployAllSupabaseFunctions`.
> - Aggregate deployment errors into `warningMessage` (non-blocking);
logs successes/failures.
> - Initialize `warningMessage` to an empty string.
> - **Supabase Utilities (`src/supabase_admin/supabase_utils.ts`)**:
> - Add `deployAllSupabaseFunctions`: scans `supabase/functions/*`,
ensures `index.ts`, reads content, calls `deploySupabaseFunctions`,
logs, collects errors; skips if directory missing.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
c29333c0f951b60b4e80da0b46cf0287d03bdae1. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Automatically re-deploys Supabase edge functions after restoring a
previous app version to keep functions in sync with reverted code.
Deployment failures surface as warnings and do not block the revert.
- **New Features**
- Re-deploy all Supabase edge functions on version revert when an app
has a Supabase project ID.
- Added deployAllSupabaseFunctions: scans supabase/functions, deploys
each index.ts sequentially, skips missing files, collects errors, and
logs warnings.
<sup>Written for commit c29333c0f951b60b4e80da0b46cf0287d03bdae1.
Summary will update automatically on new commits.</sup>
<!-- End of auto-generated description by cubic. -->
<!-- This is an auto-generated description by cubic. -->
## Summary by cubic
Adds Supabase database branch selection per app, with a new schema field
and UI to choose a branch after connecting a project. Resets branch when
changing or disconnecting the project to keep state consistent.
- **New Features**
- Added apps.supabase_branch_id column.
- Branch dropdown in SupabaseConnector shown after a project is
connected; selection persists and triggers app refresh.
- New state and hooks: supabaseBranchesAtom, loadBranches(projectId),
setAppBranch(branchId).
- IPC endpoints: supabase:list-branches and supabase:set-app-branch;
setting/unsetting project also clears the branch.
- **Migration**
- Apply drizzle migration 0013_supabase_branch.sql to add the
supabase_branch_id column (defaults to null).
<!-- End of auto-generated description by cubic. -->
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Adds Supabase database branch selection per app, including parent
project tracking, new IPC endpoints, UI dropdown, and an accompanying DB
migration with e2e tests.
>
> - **Database**:
> - Add `apps.supabase_parent_project_id` via migration
`drizzle/0015_complete_old_lace.sql`; snapshot and journal updated.
> - **IPC/Main**:
> - New `supabase:list-branches` handler and management client
`listSupabaseBranches` (real API + test stubs).
> - Update `supabase:set-app-project` to accept `{ projectId,
parentProjectId?, appId }`; unset clears both IDs.
> - `get-app` resolves `supabaseProjectName` using
`supabase_parent_project_id` when present.
> - **Types & Client**:
> - Add `SupabaseBranch`, `SetSupabaseAppProjectParams`, and
`App.supabaseParentProjectId`; expose `listSupabaseBranches` and updated
`setSupabaseAppProject` in `ipc_client` and preload whitelist.
> - **UI/Hooks**:
> - Supabase UI: branch dropdown in `SupabaseConnector` with
`loadBranches`, selection persists via updated `setAppProject`.
> - State: add `supabaseBranchesAtom`; `useSupabase` gets `branches`,
`loadBranches`, new param shape for `setAppProject`.
> - TokenBar/ChatInput: add `data-testid` for token bar and toggle.
> - **Supabase Context (tests)**:
> - Test build returns large context for `test-branch-project-id` to
validate branch selection.
> - **E2E Tests**:
> - Add `supabase_branch.spec.ts` and snapshot verifying branch
selection affects token usage.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
33054278db8396b4371ed6e8224105cb5684b7ac. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
fixes#1010
<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Disable automatic JWT verification for Supabase Edge Functions and
update prompts/templates to require and demonstrate manual auth
handling. Fixes#1010.
- **Bug Fixes**
- Set verify_jwt: false in function deployment.
- Updated Supabase prompt with an Authentication section and guidance to
manually verify tokens.
- Adjusted the hello function template to check the Authorization header
and return 401 when missing.
<!-- End of auto-generated description by cubic. -->