diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..e42daa4 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,46 @@ +# Agent rules for dbmole-mcp + +Applies to every change in this repo, by any agent or human. + +## Code style + +- 4-space indentation +- No semicolons where possible (`semicolons: asNeeded`) +- Single quotes where possible +- Functions as `const fn = () => {}` where possible +- No trailing commas before a closing `}`, `]`, `)` (`trailingCommas: none`) +- Biome enforces all of the above — run `npm run lint:fix` before every commit +- Line width 100 + +## TypeScript discipline + +- No `as unknown as X` double-casts anywhere +- No `@ts-ignore` / `@ts-expect-error` / `any` in `src/` +- In tests prefer typed fakes (see `test/unit/helpers.ts`); a single `as` cast is + a last resort, only when there is genuinely no typed way +- Types must line up by construction — if they don't, fix the design, not the cast + +## Testing + +- TDD: write the failing test first, watch it fail, implement, watch it pass +- Full coverage: unit tests (mocked IO) + integration tests via testcontainers +- Coverage thresholds ≥90% lines/functions on the unit project — never lower them +- `npm run test:unit` (fast), `npm run test:int` (needs Docker) + +## Commits + +- Conventional Commits: `(): ` +- Subject ≤50 chars (hard cap 72), no trailing period +- Body only when the *why* is not obvious from the diff; wrap at 72 +- NO AI attribution: no `Co-Authored-By: Claude ...`, no "Generated with ..." +- No emoji + +## Project constraints + +- stdout is the MCP protocol channel — diagnostics go to `console.error` ONLY, + never `console.log` +- ESM with NodeNext resolution: relative imports need the `.js` extension +- MCP SDK v1 (`@modelcontextprotocol/sdk`): `registerTool` takes a ZodRawShape + (plain object of zod fields), NOT `z.object()`; subpath imports + (`server/mcp.js`, `server/stdio.js`, `client/index.js`, `inMemory.js`, `types.js`) +- zod 3 (`import * as z from 'zod'`) diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..43c994c --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1 @@ +@AGENTS.md