Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions templates/assistant-ui/.cursor/rules/echo_rules.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
---
description: Guidelines and best practices for building Echo-powered Next.js applications
globs: **/*.ts,**/*.tsx,**/*.js,**/*.jsx
---

# Echo Next.js Guidelines

## Echo Provider Setup
- Always wrap your application with `EchoProvider` from `@merit-systems/echo-next-sdk/client` in a client component
- The provider must receive an `appId` from environment variable `NEXT_PUBLIC_ECHO_APP_ID`
- Example provider setup:
```tsx
'use client';

import { EchoProvider } from '@merit-systems/echo-next-sdk/client';

export function Providers({ children }: { children: React.ReactNode }) {
return (
<EchoProvider config={{ appId: process.env.NEXT_PUBLIC_ECHO_APP_ID! }}>
{children}
</EchoProvider>
);
}
```

## AI Provider Integration
- Use `useEchoModelProviders()` from `@merit-systems/echo-react-sdk` to get AI model providers
- Supported providers: OpenAI, Anthropic, Google, OpenRouter, Groq, xAI
- Example usage:
```tsx
import { useEchoModelProviders } from '@merit-systems/echo-react-sdk';
import { generateText } from 'ai';

const { openai, anthropic } = useEchoModelProviders();
const response = await generateText({
model: openai('gpt-4o'),
prompt: '...',
});
```

## Authentication
- Echo handles OAuth authentication automatically through the provider
- Use `useEcho()` hook to access user state and authentication methods
- Use `EchoSignIn` and `EchoSignOut` components for auth UI
- Do NOT implement custom OAuth flows - use Echo's built-in components

## Token Balance
- Use `EchoTokens` component to display user's token balance
- Use `useEcho()` hook to programmatically access balance information
- Check balance before making expensive AI calls

## Environment Variables
- Required: `NEXT_PUBLIC_ECHO_APP_ID` - Your Echo application ID
- Optional: `ECHO_API_KEY` - For server-side API access
- Never expose API keys in client-side code

## API Routes
- For server-side AI calls, use the Echo TypeScript SDK: `@merit-systems/echo-typescript-sdk`
- Initialize with API key: `EchoClient({ apiKey: process.env.ECHO_API_KEY })`
- Server routes should proxy through Echo's infrastructure

## Component Patterns
- Use `'use client'` directive for components that use Echo hooks
- Echo components handle loading and error states internally
- Prefer `EchoSignIn` over custom login forms

## Error Handling
- Check for insufficient funds using `InsufficientFundsModal` component
- Handle authentication errors gracefully
- Always provide fallback UI for unauthenticated state
70 changes: 70 additions & 0 deletions templates/authjs/.cursor/rules/echo_rules.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
---
description: Guidelines and best practices for building Echo-powered Next.js applications
globs: **/*.ts,**/*.tsx,**/*.js,**/*.jsx
---

# Echo Next.js Guidelines

## Echo Provider Setup
- Always wrap your application with `EchoProvider` from `@merit-systems/echo-next-sdk/client` in a client component
- The provider must receive an `appId` from environment variable `NEXT_PUBLIC_ECHO_APP_ID`
- Example provider setup:
```tsx
'use client';

import { EchoProvider } from '@merit-systems/echo-next-sdk/client';

export function Providers({ children }: { children: React.ReactNode }) {
return (
<EchoProvider config={{ appId: process.env.NEXT_PUBLIC_ECHO_APP_ID! }}>
{children}
</EchoProvider>
);
}
```

## AI Provider Integration
- Use `useEchoModelProviders()` from `@merit-systems/echo-react-sdk` to get AI model providers
- Supported providers: OpenAI, Anthropic, Google, OpenRouter, Groq, xAI
- Example usage:
```tsx
import { useEchoModelProviders } from '@merit-systems/echo-react-sdk';
import { generateText } from 'ai';

const { openai, anthropic } = useEchoModelProviders();
const response = await generateText({
model: openai('gpt-4o'),
prompt: '...',
});
```

## Authentication
- Echo handles OAuth authentication automatically through the provider
- Use `useEcho()` hook to access user state and authentication methods
- Use `EchoSignIn` and `EchoSignOut` components for auth UI
- Do NOT implement custom OAuth flows - use Echo's built-in components

## Token Balance
- Use `EchoTokens` component to display user's token balance
- Use `useEcho()` hook to programmatically access balance information
- Check balance before making expensive AI calls

## Environment Variables
- Required: `NEXT_PUBLIC_ECHO_APP_ID` - Your Echo application ID
- Optional: `ECHO_API_KEY` - For server-side API access
- Never expose API keys in client-side code

## API Routes
- For server-side AI calls, use the Echo TypeScript SDK: `@merit-systems/echo-typescript-sdk`
- Initialize with API key: `EchoClient({ apiKey: process.env.ECHO_API_KEY })`
- Server routes should proxy through Echo's infrastructure

## Component Patterns
- Use `'use client'` directive for components that use Echo hooks
- Echo components handle loading and error states internally
- Prefer `EchoSignIn` over custom login forms

## Error Handling
- Check for insufficient funds using `InsufficientFundsModal` component
- Handle authentication errors gracefully
- Always provide fallback UI for unauthenticated state
71 changes: 71 additions & 0 deletions templates/echo-cli/.cursor/rules/echo_rules.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---
description: Guidelines and best practices for building Echo-powered CLI applications
globs: **/*.ts,**/*.js
---

# Echo CLI Guidelines

## Authentication
- Use `loginWithEcho` for OAuth-based authentication
- Use `loginWithWallet` for wallet-based authentication
- Check authentication status with `isAuthenticated()` utility
- Handle logout with the `logout` command

## Echo TypeScript SDK
- Initialize client with: `EchoClient({ apiKey: process.env.ECHO_API_KEY })`
- For OAuth tokens, use `OAuthTokenProvider`
- For API keys, use `ApiKeyTokenProvider`

## CLI Framework
- Use `commander` for command structure
- Use `@clack/prompts` for interactive prompts
- Always check `isCancel()` after prompts to handle cancellation
- Example command structure:
```typescript
import { Command } from 'commander';
import { select, isCancel } from '@clack/prompts';

const program = new Command();
program
.command('login')
.description('Authenticate with Echo')
.action(async () => {
const method = await select({
message: 'Choose auth method:',
options: [
{ value: 'echo', label: 'Echo OAuth' },
{ value: 'wallet', label: 'Wallet' },
],
});
if (isCancel(method)) process.exit(0);
// Handle login...
});
```

## Model Selection
- Use `selectModel` function for model selection
- Support multiple AI providers through Echo
- Display available models to user before selection

## Chat Sessions
- Use `startChatSession` for new conversations
- Use `resumeChatSession` to continue existing conversations
- Store conversation history locally with `showConversationHistory`
- Support export with `exportConversationHistory`

## Wallet Operations
- Show balance with `showLocalWalletBalance`
- Display address with `showLocalWalletAddress`
- Support funding with `fundWallet`
- Allow private key export with `exportPrivateKey`

## Error Handling
- Always wrap async operations in try/catch
- Display user-friendly error messages
- Handle network errors gracefully
- Provide retry options for failed operations

## Output Formatting
- Use the `info`, `warning`, and `header` utilities from `@/print`
- Display ASCII art header with `ECHODEX_ASCII_ART`
- Keep output clean and readable
70 changes: 70 additions & 0 deletions templates/next-chat/.cursor/rules/echo_rules.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
---
description: Guidelines and best practices for building Echo-powered Next.js applications
globs: **/*.ts,**/*.tsx,**/*.js,**/*.jsx
---

# Echo Next.js Guidelines

## Echo Provider Setup
- Always wrap your application with `EchoProvider` from `@merit-systems/echo-next-sdk/client` in a client component
- The provider must receive an `appId` from environment variable `NEXT_PUBLIC_ECHO_APP_ID`
- Example provider setup:
```tsx
'use client';

import { EchoProvider } from '@merit-systems/echo-next-sdk/client';

export function Providers({ children }: { children: React.ReactNode }) {
return (
<EchoProvider config={{ appId: process.env.NEXT_PUBLIC_ECHO_APP_ID! }}>
{children}
</EchoProvider>
);
}
```

## AI Provider Integration
- Use `useEchoModelProviders()` from `@merit-systems/echo-react-sdk` to get AI model providers
- Supported providers: OpenAI, Anthropic, Google, OpenRouter, Groq, xAI
- Example usage:
```tsx
import { useEchoModelProviders } from '@merit-systems/echo-react-sdk';
import { generateText } from 'ai';

const { openai, anthropic } = useEchoModelProviders();
const response = await generateText({
model: openai('gpt-4o'),
prompt: '...',
});
```

## Authentication
- Echo handles OAuth authentication automatically through the provider
- Use `useEcho()` hook to access user state and authentication methods
- Use `EchoSignIn` and `EchoSignOut` components for auth UI
- Do NOT implement custom OAuth flows - use Echo's built-in components

## Token Balance
- Use `EchoTokens` component to display user's token balance
- Use `useEcho()` hook to programmatically access balance information
- Check balance before making expensive AI calls

## Environment Variables
- Required: `NEXT_PUBLIC_ECHO_APP_ID` - Your Echo application ID
- Optional: `ECHO_API_KEY` - For server-side API access
- Never expose API keys in client-side code

## API Routes
- For server-side AI calls, use the Echo TypeScript SDK: `@merit-systems/echo-typescript-sdk`
- Initialize with API key: `EchoClient({ apiKey: process.env.ECHO_API_KEY })`
- Server routes should proxy through Echo's infrastructure

## Component Patterns
- Use `'use client'` directive for components that use Echo hooks
- Echo components handle loading and error states internally
- Prefer `EchoSignIn` over custom login forms

## Error Handling
- Check for insufficient funds using `InsufficientFundsModal` component
- Handle authentication errors gracefully
- Always provide fallback UI for unauthenticated state
70 changes: 70 additions & 0 deletions templates/next-image/.cursor/rules/echo_rules.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
---
description: Guidelines and best practices for building Echo-powered Next.js applications
globs: **/*.ts,**/*.tsx,**/*.js,**/*.jsx
---

# Echo Next.js Guidelines

## Echo Provider Setup
- Always wrap your application with `EchoProvider` from `@merit-systems/echo-next-sdk/client` in a client component
- The provider must receive an `appId` from environment variable `NEXT_PUBLIC_ECHO_APP_ID`
- Example provider setup:
```tsx
'use client';

import { EchoProvider } from '@merit-systems/echo-next-sdk/client';

export function Providers({ children }: { children: React.ReactNode }) {
return (
<EchoProvider config={{ appId: process.env.NEXT_PUBLIC_ECHO_APP_ID! }}>
{children}
</EchoProvider>
);
}
```

## AI Provider Integration
- Use `useEchoModelProviders()` from `@merit-systems/echo-react-sdk` to get AI model providers
- Supported providers: OpenAI, Anthropic, Google, OpenRouter, Groq, xAI
- Example usage:
```tsx
import { useEchoModelProviders } from '@merit-systems/echo-react-sdk';
import { generateText } from 'ai';

const { openai, anthropic } = useEchoModelProviders();
const response = await generateText({
model: openai('gpt-4o'),
prompt: '...',
});
```

## Authentication
- Echo handles OAuth authentication automatically through the provider
- Use `useEcho()` hook to access user state and authentication methods
- Use `EchoSignIn` and `EchoSignOut` components for auth UI
- Do NOT implement custom OAuth flows - use Echo's built-in components

## Token Balance
- Use `EchoTokens` component to display user's token balance
- Use `useEcho()` hook to programmatically access balance information
- Check balance before making expensive AI calls

## Environment Variables
- Required: `NEXT_PUBLIC_ECHO_APP_ID` - Your Echo application ID
- Optional: `ECHO_API_KEY` - For server-side API access
- Never expose API keys in client-side code

## API Routes
- For server-side AI calls, use the Echo TypeScript SDK: `@merit-systems/echo-typescript-sdk`
- Initialize with API key: `EchoClient({ apiKey: process.env.ECHO_API_KEY })`
- Server routes should proxy through Echo's infrastructure

## Component Patterns
- Use `'use client'` directive for components that use Echo hooks
- Echo components handle loading and error states internally
- Prefer `EchoSignIn` over custom login forms

## Error Handling
- Check for insufficient funds using `InsufficientFundsModal` component
- Handle authentication errors gracefully
- Always provide fallback UI for unauthenticated state
Loading