feat: add .cursor/rules/echo_rules.mdc to all echo-start templates#795
feat: add .cursor/rules/echo_rules.mdc to all echo-start templates#795LogicLeapLtd wants to merge 1 commit into
Conversation
Closes Merit-Systems#636 Each template now ships with a .cursor/rules/echo_rules.mdc file tailored to its framework (Next.js, React/Vite, CLI, Auth.js, assistant-ui, video, image generation). Rules cover: - What Echo does and the user-pays model - Required env vars and where they belong - The correct import path for Echo-wrapped providers - Framework-specific code patterns (streaming, polling, session handling) - Common pitfalls (deprecated model IDs, client-side key exposure, 402 handling) Templates covered: next, next-chat, react, react-chat, next-image, react-image, next-video-template, nextjs-api-key-template, assistant-ui, echo-cli, authjs
|
@LogicLeapLtd is attempting to deploy a commit to the Merit Systems Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0b2badc676
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| import { AssistantRuntimeProvider } from '@assistant-ui/react'; | ||
| import { useVercelUseChatRuntime } from '@assistant-ui/react-ai-sdk'; | ||
| import { useChat } from 'ai/react'; |
There was a problem hiding this comment.
Use the actual assistant-ui runtime API
In this template the installed assistant-ui integration is wired through useChatRuntime from @assistant-ui/react-ai-sdk (templates/assistant-ui/app/page.tsx) and the server returns toUIMessageStreamResponse() (templates/assistant-ui/app/api/chat/route.ts), but this rule tells Cursor to generate code with the legacy/non-template useVercelUseChatRuntime, ai/react, and toDataStreamResponse() pattern. If a user asks Cursor to modify the assistant-ui template, the generated runtime/route will no longer match the AI SDK v5 transport used by the template, leading to compile-time or streaming protocol failures.
Useful? React with 👍 / 👎.
| jwt({ token, account }) { | ||
| if (account?.echoApiKey) token.echoApiKey = account.echoApiKey; |
There was a problem hiding this comment.
Preserve Auth.js access token session fields
The Auth.js template stores the Echo OAuth token as account.access_token / session.accessToken (templates/authjs/src/auth/index.ts) and getEchoClient() reads session.accessToken, but this new guidance tells Cursor to use account.echoApiKey, token.echoApiKey, and session.echoApiKey. Following these rules in this template will create undefined credentials or TypeScript errors instead of passing the Echo access token to EchoClient, breaking authenticated AI routes.
Useful? React with 👍 / 👎.
/claim #636
Closes #636
What this adds
Each of the 11 echo-start templates now ships with a
.cursor/rules/echo_rules.mdcfile so Cursor users get in-editor guidance specific to their template out of the box.Every file has proper MDC front-matter (
description,globs,alwaysApply: true) and framework-tailored content covering:nextnext-chatconvertToModelMessages, streaming, model selectorreactreact-chatuseChathook, backend proxynext-imagegenerateImage, deprecated model IDs to avoidreact-imagenext-video-templatenextjs-api-key-templateassistant-uiecho-cliauthjsHow to verify
npx create-echo-app.