app.tsbootstraps the Telegram bot and Mongo connection; keep startup logic centralized there.bot/houses commands, scenes, and middleware modules; pair new flows with text updates underlocales/.- Background jobs, data models, and shared helpers live in
jobs/,models/, andutil/; assets and docs sit inimages/anddocs/. - TypeScript builds to
dist/(read-only); specs mirror runtime code undertests/for quick navigation.
npm installrefreshes dependencies after changes topackage*.json.npm run devruns thepredevTypeScript build then watchesdist/appwith nodemon.npm startexecutes the production path (prestart→tsc) and launches the compiled bot.- Quality gates:
npm run lint,npm run format, andnpm test(Mocha viatsconfig.test.json).
- Prettier enforces 2-space indentation, semicolons, and single quotes; run it before committing.
- ESLint Standard plus TypeScript rules guard the codebase; address warnings instead of disabling them.
- Use camelCase for functions/variables, PascalCase for classes, and descriptive locale keys (
locales/*.json). - Markdown (MD049): Use underscores for emphasis (
_text_) instead of asterisks (*text*) in all.mdfiles.
- Write Mocha + Chai specs in
tests/**, suffixing files with.spec.tsand mirroring source layout. - Prefer unit isolation with proxyquire/sinon; integration flows belong in
tests/ln/. - Ensure
npm testpasses and add fixtures intests/bot/mocks/when altering localization or jobs.
- Commit summaries stay concise sentence case, optionally referencing PRs or issues (
Late payment flow (#705)). - Keep changes scoped; split schema or config adjustments into dedicated commits.
- PRs require behaviour notes, linked issues, and proof of lint/test runs (screenshots for user-facing traces).
- Copy
.env-sampleto.env; never commit actual credentials and document new variables in PRs. - Use
DockerfileandDEPLOY_DIGITALOCEAN.mdwhen rehearsing deployment; confirmnpm startsucceeds inside the image. - Scrub secrets and Telegram transcripts before sharing logs or support artifacts in the repository.