AGENTS.md•2.48 kB
# Repository Guidelines
## Project Structure & Module Organization
- Root: README, LICENSE, and project configs.
- `src/`: Source code for the QR code MCP server (e.g., `src/server.ts`, `src/routes/`, `src/services/`).
- `tests/`: Automated tests mirroring `src/` structure (e.g., `tests/services/qrcode.spec.ts`).
- `scripts/`: Helper scripts for local dev or CI (optional).
- `assets/`: Sample QR images and fixtures for tests/examples (optional).
Example layout:
```
src/
server.ts
routes/
services/
utils/
tests/
services/
assets/
```
## Build, Test, and Development Commands
- `npm i` or `pnpm i`: Install dependencies.
- `npm run dev`: Start the server in watch mode (TypeScript + nodemon/ts-node).
- `npm run build`: Compile TypeScript to `dist/`.
- `npm test`: Run unit tests with coverage.
- `npm run lint` / `npm run format`: Lint and format the codebase.
Note: Add these scripts to `package.json` once the scaffolding is in place.
## Coding Style & Naming Conventions
- Language: TypeScript preferred; 2‑space indentation.
- Files: kebab-case (e.g., `qrcode-service.ts`); tests end with `.spec.ts`.
- Naming: camelCase for variables/functions, PascalCase for classes/types, UPPER_SNAKE_CASE for env constants.
- Tools: ESLint (typescript-eslint), Prettier for formatting. Keep imports sorted and paths relative to `src/`.
## Testing Guidelines
- Framework: Vitest or Jest; aim for ≥80% line coverage on services/utils.
- Structure: Mirror `src/` in `tests/`; use fixtures in `assets/`.
- Conventions: `*.spec.ts`; one behavior per test, explicit assertions.
- Run: `npm test` locally and ensure CI passes before opening a PR.
## Commit & Pull Request Guidelines
- Commits: Follow Conventional Commits (e.g., `feat(server): add health endpoint`).
- PRs: Include a clear description, linked issues (e.g., `Closes #12`), screenshots or logs when relevant, and notes on breaking changes or migrations.
- Scope: Keep PRs small and focused; include tests and update docs.
## Security & Configuration Tips
- Configuration via `.env` (never commit secrets). Example: `PORT=3000`.
- Validate and sanitize any input; do not fetch remote URLs without allowlists.
- Add rate limiting and basic request logging for the QR scan endpoints.
- Pin library versions; run `npm audit` regularly.
## Agent-Specific Notes
- Prefer deterministic scripts/outputs to assist automation.
- Keep CLI entry points and HTTP endpoints stable and documented in `README.md`.