diff --git a/templates/assistant-ui/.cursor/rules/echo_rules.mdc b/templates/assistant-ui/.cursor/rules/echo_rules.mdc new file mode 100644 index 000000000..49c0af2bc --- /dev/null +++ b/templates/assistant-ui/.cursor/rules/echo_rules.mdc @@ -0,0 +1,28 @@ +--- +description: Guidelines for building Echo-powered chat applications with assistant-ui, AI SDK v5, and the assistant-ui React component library +globs: **/*.ts,**/*.tsx,**/*.js,**/*.jsx +--- + +# Echo Assistant-UI Guidelines + +## SDK Setup +- Server-side: Initialize in `src/echo/index.ts` with `@merit-systems/echo-next-sdk` +- Client-side: Wrap app with `EchoProvider` from `@merit-systems/echo-next-sdk/client` + +## Assistant-UI Integration + +### Runtime Provider +- Use `AssistantRuntimeProvider` and `useEdgeRuntime` from `@assistant-ui/react` +- Use `@assistant-ui/react-markdown` for rendering markdown in messages +- Use `@assistant-ui/react-ai-sdk` for AI SDK v5 integration + +### Chat Components +- Use `@assistant-ui/react` primitives: `Thread`, `ThreadWelcome`, `Composer`, `AssistantMessage`, `UserMessage` + +### Streaming API Route +- Use `streamText` from `ai` with Echo-proxied models +- Import models from `@/echo`, not directly from `@ai-sdk/openai` + +## Environment Variables +- `ECHO_APP_ID` — Server-side Echo identifier +- `NEXT_PUBLIC_ECHO_APP_ID` — Client-side Echo identifier diff --git a/templates/authjs/.cursor/rules/echo_rules.mdc b/templates/authjs/.cursor/rules/echo_rules.mdc new file mode 100644 index 000000000..d147b9381 --- /dev/null +++ b/templates/authjs/.cursor/rules/echo_rules.mdc @@ -0,0 +1,24 @@ +--- +description: Guidelines for building Echo-powered Next.js applications with Auth.js (NextAuth v5) authentication, including provider setup and session management +globs: **/*.ts,**/*.tsx,**/*.js,**/*.jsx +--- + +# Echo Auth.js Integration Guidelines + +## SDK Setup +- Server-side: Initialize Echo in `src/echo/index.ts` with `@merit-systems/echo-next-sdk` +- Auth: Configure Auth.js with the Echo provider + +## Auth.js Configuration +- Use `EchoProvider` from `@merit-systems/echo-authjs-provider` +- Mount Auth.js handlers at `src/app/api/auth/[...nextauth]/route.ts` +- Server components: `const session = await auth()` +- Client components: Use `useSession()` from `next-auth/react` + +## Echo TypeScript SDK +- Use `@merit-systems/echo-typescript-sdk` for server-side Echo API calls + +## Environment Variables +- `ECHO_APP_ID` — Echo application identifier (also used as Auth.js client ID) +- `AUTH_SECRET` — NextAuth secret for session encryption +- `NEXTAUTH_URL` — Deployment URL for Auth.js callbacks diff --git a/templates/echo-cli/.cursor/rules/echo_rules.mdc b/templates/echo-cli/.cursor/rules/echo_rules.mdc new file mode 100644 index 000000000..1d7564c95 --- /dev/null +++ b/templates/echo-cli/.cursor/rules/echo_rules.mdc @@ -0,0 +1,24 @@ +--- +description: Guidelines for building Echo-powered CLI applications, including SDK setup, authentication flows, wallet integration, and AI chat sessions +globs: **/*.ts,**/*.js +--- + +# Echo CLI Guidelines + +## SDK Setup +- Use `@merit-systems/echo-typescript-sdk` for server/CLI contexts +- Use `@merit-systems/ai-x402` for x402 payment protocol integration +- Use `@ai-sdk/openai` and `ai` for CLI chat + +## Authentication +- Echo OAuth — Browser-based OAuth with PKCE +- Crypto Wallet — WalletConnect or local wallet with private key +- Use `conf` package for persistent configuration storage + +## CLI Framework +- Use `commander` for command definitions +- Use `@clack/prompts` for interactive selection +- Use `chalk` for colored output, `ora` for spinners, `cli-table3` for tables + +## Environment Variables +- `ECHO_APP_ID` — Echo application identifier diff --git a/templates/next-chat/.cursor/rules/echo_rules.mdc b/templates/next-chat/.cursor/rules/echo_rules.mdc new file mode 100644 index 000000000..6b4c3ad1f --- /dev/null +++ b/templates/next-chat/.cursor/rules/echo_rules.mdc @@ -0,0 +1,24 @@ +--- +description: Guidelines for building Echo-powered Next.js chat applications with AI SDK streaming, shadcn/ui components, and real-time message handling +globs: **/*.ts,**/*.tsx,**/*.js,**/*.jsx +--- + +# Echo Next.js Chat Guidelines + +## SDK Setup +- Server-side: Initialize in `src/echo/index.ts` with `@merit-systems/echo-next-sdk` +- Client-side: Wrap app with `EchoProvider` from `@merit-systems/echo-next-sdk/client` +- Use `EchoTokens` component for authentication and token management + +## Chat Integration +- Use `useChat` hook from `@ai-sdk/react` +- Use `streamText` from `ai` with Echo-proxied models in API routes +- Always verify authentication with `isSignedIn()` before AI calls + +## UI Components +- Use shadcn/ui components +- Use Tailwind CSS v4 for styling + +## Environment Variables +- `ECHO_APP_ID` — Server-side Echo identifier +- `NEXT_PUBLIC_ECHO_APP_ID` — Client-side Echo identifier diff --git a/templates/next-image/.cursor/rules/echo_rules.mdc b/templates/next-image/.cursor/rules/echo_rules.mdc new file mode 100644 index 000000000..572ecd311 --- /dev/null +++ b/templates/next-image/.cursor/rules/echo_rules.mdc @@ -0,0 +1,24 @@ +--- +description: Guidelines for building Echo-powered Next.js image generation applications with AI SDK, image models, and gallery components +globs: **/*.ts,**/*.tsx,**/*.js,**/*.jsx +--- + +# Echo Next.js Image Generation Guidelines + +## SDK Setup +- Server-side: Initialize in `src/echo/index.ts` with `@merit-systems/echo-next-sdk` +- Client-side: Wrap app with `EchoProvider` from `@merit-systems/echo-next-sdk/client` +- Use `EchoTokens` component for authentication and token management + +## Image Generation +- Use `experimental_generateImage` from `ai` for image generation +- Display generated images with proper loading states +- Use `next/image` for optimized image rendering when possible + +## UI Components +- Use shadcn/ui components +- Build a gallery component for displaying generated images + +## Environment Variables +- `ECHO_APP_ID` — Server-side Echo identifier +- `NEXT_PUBLIC_ECHO_APP_ID` — Client-side Echo identifier diff --git a/templates/next-video-template/.cursor/rules/echo_rules.mdc b/templates/next-video-template/.cursor/rules/echo_rules.mdc new file mode 100644 index 000000000..cd1594c36 --- /dev/null +++ b/templates/next-video-template/.cursor/rules/echo_rules.mdc @@ -0,0 +1,24 @@ +--- +description: Guidelines for building Echo-powered Next.js video generation applications with AI video models and video player components +globs: **/*.ts,**/*.tsx,**/*.js,**/*.jsx +--- + +# Echo Next.js Video Generation Guidelines + +## SDK Setup +- Server-side: Initialize in `src/echo/index.ts` with `@merit-systems/echo-next-sdk` +- Client-side: Wrap app with `EchoProvider` from `@merit-systems/echo-next-sdk/client` +- Use `EchoTokens` component for authentication and token management + +## Video Generation +- Use Echo-proxied models for video generation +- Build a custom video player or use HTML5 `