AGENTS.mdā¢2.43 kB
# Repository Guidelines
## Project Structure & Module Organization
- `src/lib` holds core services (DatabaseManager, ClipboardManager, SessionManager, OperationLogger, FileHandler) that implement cut/copy/paste state and persistence.
- `src/tools` exports `ClipboardTools` bridging the library to MCP agents; keep orchestrations there.
- Tests live beside code in `__tests__` folders; mimic directory layout when adding new specs.
- Built artifacts emit to `dist/` via `tsc`; never check the folder in.
## Build, Test, and Development Commands
- `npm run build` -> TypeScript compile to ES modules in `dist/`.
- `npm test` -> Jest suite with ESM support; runs fast unit tests.
- `npm run test:watch` -> Jest watch mode for iterative work.
- `npm run test:coverage` -> Enforces 80% global thresholds defined in `jest.config.js`.
- `npm run lint` / `npm run format` -> ESLint + Prettier; always lint before pushing.
## Coding Style & Naming Conventions
- TypeScript strict mode; prefer explicit return types on exported functions to satisfy lint warnings.
- Use ES module imports with `.js` extension when targeting compiled output (see existing files).
- Files and directories use kebab-case; classes PascalCase; functions and variables camelCase.
- Prettier enforces 2-space indent, 100-character width, semicolons, and single quotes; do not hand-edit formatting.
## Testing Guidelines
- Write Jest specs in `__tests__` folders or `*.test.ts`; mirror source structure for discoverability.
- Mock filesystem/database boundaries sparingly; prefer exercising `ClipboardManager` + `DatabaseManager` together to maintain undo coverage.
- Keep coverage >=80%; run `npm run test:coverage` before PRs and include rationale if lower.
## Commit & Pull Request Guidelines
- Craft commit subjects in imperative voice (`Add session timeout guard`); keep summaries <=72 characters.
- Reference scope in the body when touching multiple modules (`lib:` or `tools:` tags help).
- PRs should describe behavior changes, list test commands run, and link issues or TODO items when relevant; include CLI output snippets only when they illustrate behavior.
## Security & Configuration Tips
- Database defaults to `$HOME/.mcp-clipboard/clipboard.db`; avoid committing sample data and redact paths in issues.
- File mutations happen in place; double-check line ranges in `ClipboardTools` operations before running integration tests on live codebases.