Refactor Supabase prompt to use dynamic code injection (#2222)
Changed the Supabase prompt from using $$SUPABASE_CLIENT_CODE$$
placeholder replacement to dynamically constructing the system prompt
with the actual Supabase client code. This is more reliable and removes
the need for post-processing the AI response.
Changes:
- Convert SUPABASE_AVAILABLE_SYSTEM_PROMPT to
getSupabaseAvailableSystemPrompt() function
- Pass supabaseClientCode parameter when constructing system prompt
- Remove response chunk processing that replaced
$$SUPABASE_CLIENT_CODE$$
- Update prompt to instruct AI to write to appropriate file path instead
of hardcoding <dyad-write>
- Update test fixture to contain actual expected Supabase client code
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Refactors Supabase integration to embed real client code directly in
the system prompt, eliminating placeholder replacement and making
generation deterministic.
>
> - Replace `SUPABASE_AVAILABLE_SYSTEM_PROMPT` with
`getSupabaseAvailableSystemPrompt(supabaseClientCode)` and update
instructions to create `src/integrations/supabase/client.ts` and add
`@supabase/supabase-js`
> - In `chat_stream_handlers.ts` and `token_count_handlers.ts`, fetch
`supabaseClientCode` via `getSupabaseClientCode` and append
`getSupabaseAvailableSystemPrompt(...)` to `systemPrompt`
> - Remove response-time placeholder replacement logic for
`$$SUPABASE_CLIENT_CODE$$` in streaming handler
> - Update e2e fixture `generate-supabase-client.md` to include the
concrete client implementation
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
dfec59bfd59df71af534db92b4d8f1a6f1606047. 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
Refactors the Supabase prompt to inject the real client code into the
system prompt, replacing the $$SUPABASE_CLIENT_CODE$$ placeholder. This
removes response post-processing and makes client file creation more
reliable.
- **Refactors**
- Replace SUPABASE_AVAILABLE_SYSTEM_PROMPT constant with
getSupabaseAvailableSystemPrompt(supabaseClientCode).
- Build the system prompt with supabaseClientCode in chat and token
count handlers.
- Remove placeholder replacement from chat stream response handling.
- Update prompt to embed the actual client code, instruct the correct
file path, and add the @supabase/supabase-js dependency.
- Update e2e fixture to include the expected Supabase client code.
<sup>Written for commit dfec59bfd59df71af534db92b4d8f1a6f1606047.
Summary will update on new commits.</sup>
<!-- End of auto-generated description by cubic. -->
---------
Co-authored-by:
Claude <noreply@anthropic.com>
正在显示
请
注册
或者
登录
后发表评论