|
| 1 | +# AGENTS.md |
| 2 | + |
| 3 | +## Build/Run Commands |
| 4 | +- Build: `pnpm run build` (uses tsc) |
| 5 | +- Dev mode: `pnpm run dev` (tsx watch) |
| 6 | +- Run tests: `pnpm run test` (vitest) |
| 7 | +- Run single test: `pnpm run test <test-file-pattern>` |
| 8 | +- Test watch mode: `pnpm run test:watch` |
| 9 | +- Lint: `pnpm run lint` (eslint) |
| 10 | +- Lint fix: `pnpm run lint:fix` |
| 11 | +- Typecheck: `pnpm run typecheck` (tsc --noEmit) |
| 12 | +- Format: `pnpm run format` (prettier) |
| 13 | +- Format check: `pnpm run format:check` |
| 14 | + |
| 15 | +## Code Style Guidelines |
| 16 | +- Use double quotes for strings |
| 17 | +- No semicolons |
| 18 | +- Use tabs for indentation (TSConfig sets this) |
| 19 | +- Strict TypeScript with all strict flags enabled |
| 20 | +- No unused locals/parameters |
| 21 | +- Exact optional property types |
| 22 | +- No implicit returns/fallthrough cases |
| 23 | +- No unchecked indexed access |
| 24 | +- Use ESNext target and modules |
| 25 | +- Import paths use `@/*` alias for src/ |
| 26 | +- Declaration files and source maps generated |
| 27 | +- Resolve JSON modules enabled |
| 28 | + |
| 29 | +## Naming Conventions |
| 30 | +- Files: kebab-case |
| 31 | +- Types: PascalCase |
| 32 | +- Functions/variables: camelCase |
| 33 | +- Constants: UPPER_SNAKE_CASE |
| 34 | +- Test files: *.test.ts |
| 35 | + |
| 36 | +## Error Handling |
| 37 | +- Use custom error classes from utils/errors.ts |
| 38 | +- Always provide meaningful error messages |
| 39 | +- Use logger.ts for consistent logging |
| 40 | +- Handle dry-run mode in all mutating operations |
| 41 | + |
| 42 | +## Testing |
| 43 | +- Use vitest with globals |
| 44 | +- Place tests alongside source files |
| 45 | +- Use .test.ts extension |
| 46 | +- Mock filesystem with memfs where needed |
| 47 | + |
| 48 | +## Development Practices |
| 49 | +- Use yarn for package management |
| 50 | +- Follow workspaces pattern with packages in `packages/{project}` |
| 51 | +- All code compatible with Cloudflare Workers runtime |
| 52 | +- Use TypeScript for all code with proper typing |
| 53 | +- Follow ES modules format |
| 54 | +- Use `async`/`await` for asynchronous code |
| 55 | +- Write tests for all functionality |
| 56 | +- Use Wrangler for deployments to Cloudflare Workers |
| 57 | + |
| 58 | +## Project Structure |
| 59 | +- `packages/`: Contains all project packages |
| 60 | + - `mcp/`: Main MCP implementation for Cloudflare Workers |
| 61 | + - `test-utils/`: Utilities for testing |
| 62 | +- `examples/`: Contains example implementations |
| 63 | + - `crud-mcp/`: Example CRUD application using MCP framework |
| 64 | + - `simple-prompt-agent/`: Example agent with only a prompt for chatting |
| 65 | +- Main package: packages/mcp/src/index.ts |
| 66 | +- MCP Server implementation: packages/mcp/src/mcp/server.ts |
| 67 | +- Example application: examples/crud-mcp/src/index.ts |
| 68 | + |
| 69 | +## Development Workflow |
| 70 | +1. Install dependencies at root level: `yarn install` |
| 71 | +2. Build all packages: `yarn build` |
| 72 | +3. Run tests: `yarn test` |
| 73 | +4. For specific packages, navigate to directory and use specific scripts |
0 commit comments