Imported from ElliotBadinger/whatsapp-bot-scanner (
AGENTS.md). Install upstream withnpx skills add ElliotBadinger/whatsapp-bot-scanner. Copyright stays with the author.
Repository Guidelines
Project Structure & Module Organization
services/control-plane,services/scan-orchestrator, andservices/wa-clienthost the Fastify services; keep authored TypeScript in eachsrc/directory and generated JavaScript indist/.packages/sharedexports queue contracts, config loaders, and logging helpers that every service imports via the@wbscanner/...alias.- Support assets live in
docs/(architecture, security, runbooks),db/plusscripts/(SQL migrations and seed runners), andobservability/,grafana/,reverse-proxy/(monitoring and ingress).
Build, Test, and Development Commands
make build,make up, andmake downorchestrate the Docker stack; pair withmake logsto tail cross-service output while diagnosing issues.npm run buildcompiles all workspaces; scope to one service withnpm --workspace services/<name> run build.npm run devlaunches any workspacedevscripts (e.g.,ts-node src/index.ts), so stop lingering sessions before rebuilding containers.- Use
npm run migrateandnpm run seedfor database workflows defined in thescripts/helpers.
Coding Style & Naming Conventions
.editorconfigenforces UTF-8, LF endings, trimmed whitespace, and two-space indentation—configure your editor accordingly.tsconfig.base.jsonenables strict typing and ES2020 targets; prefer explicit return types on exported functions and keep async flows promise-based.- Name files and queues in kebab-case (
domain-scanner.ts,link-score-queue), and log via the sharedloggerto maintain consistent formatting.
Testing Guidelines
- Jest is configured by
packages/shared/jest.config.js; place specs in__tests__/or name them<feature>.test.tsto match the default regex. - Run
npm test --workspacesbefore opening a PR; add workspace-specifictestscripts when services gain coverage. - For integration checks, bring the stack up with
make up, hit Fastify endpoints or BullMQ queues through shared clients, and document manual steps indocs/RUNBOOKS.md. - For any files created or modified, add or update applicable unit, regression, integration, performance, mutation, property-based, and end-to-end tests.
Commit & Pull Request Guidelines
- Follow conventional commits:
type(scope): summary, wherescopemaps to a service or package (e.g.,feat(control-plane): add mute audit log); keep subjects imperative and under 72 characters. - Reference migrations, dashboards, or external tickets in the body when relevant, and squash fixups before pushing.
- Pull requests should highlight behaviour changes, deployment or rollback notes, and test evidence; add screenshots or logs when altering APIs, dashboards, or alert rules.
- Changes must be delivered via pull requests (do not push directly to the default branch).
- After completing any code change or documentation update, agents must create a descriptive commit and push the branch before handing off work. Do not leave uncommitted edits in the workspace.
Security & Configuration Tips
- Clone
.env.examplewhen provisioning environments, never commit secrets, and rotate WhatsApp sessions stored bywa-clientwhen sharing stacks. - Revisit
docs/SECURITY_PRIVACY.mdanddocs/THREAT_MODEL.mdwhen adding external calls or persistence, and keep the control-plane bearer token guard on new routes.