- Scope: this file applies when working in
nestjs-yalc. Run commands from that directory. - Runtime: Node 20, ESM (
type: module,moduleResolution: NodeNext, TypeScript strict). Install withnpm ci(workspaces enabled). - Workspaces/packages: app, audit, crud-gen, aws-helpers, data-loader, database, errors, event-manager, field-middleware, graphql, interfaces, jest, logger, types, types-extends, utils; examples in
examples/(skeleton-app, skeleton-module). - When you need package details, read
docs/README.mdand package READMEs (e.g.,crud-gen/README.md) before changing code. - Documentation discipline: whenever you add or change meaningful behavior, update existing docs or create new ones that reflect the change (usage, rationale, examples) before handing off.
- Language: write everything in English (code, comments, docs, commit messages, etc.); use non-English only for domain-specific names that cannot be translated.
- Prefer using
YalcEventServicefrom@nestjs-yalc/event-manager(and the underlying@nestjs-yalc/errorslibrary) for application-level errors instead of throwing raw NestHttpExceptioninstances or usingconsoledirectly. - When you need to log and return an HTTP-aware error, use the HTTP helpers on
YalcEventService(for exampleerrorBadRequest,errorNotFound, orerrorHttp) so that:- logging level is derived from the HTTP status code,
- a structured event payload is emitted,
- and the thrown error carries the correct status code and a safe response body for the client.
- Keep internal diagnostics in
data/internalMessageand client-facing messages in theresponsefield to avoid leaking sensitive information. - Before changing error-handling behavior, read
docs/error-handling.md,docs/errors.md, anddocs/event-manager-service.mdto align with the existing patterns.
- Full check:
npm run ci:checks(runs lint + build +test:covwith coverage thresholds). - During iteration you may run individually:
npm run lint:no-fix,npm run build,npm run test:cov. UseJEST_WORKERSto cap workers; coverage reports land invar/coverage/(test:cov:serveserves them). - Jest defaults to 100% coverage (branches/functions/lines/statements) with overrides for
@nestjs-yalc/app,@nestjs-yalc/logger, and@nestjs-yalc/utils; skipped projects by default: types, graphql, crud-gen, kafka, jest.injectGlobalsis false.
- Use Syncwheel for every source change. Work in an isolated stack lane and never push a managed branch directly.
- Keep each pull request focused on one intent. Before creating a stack, inspect open stacks and pull requests and extend an existing one when it already owns that intent.
- A pull request is not ready to merge until the full
npm run ci:checkssuite and every relevant focused test pass on its current head. - Every pull request requires an independent approving review after the latest push. The author and the person who made the latest push cannot satisfy that review.
- Review the actual diff and affected contracts, not only the pull request description. At minimum assess correctness, failure and concurrency paths, public API compatibility, security and data handling, test strength, documentation, and migration or rollout impact.
- Resolve every blocking finding and every review conversation, then repeat the review against the updated head. A checklist-only or summary-only review is insufficient.
- Merge only through the protected
devbranch after GitHub reports all required checks, approval, and conversation-resolution gates satisfied. - Record validation and review evidence in the pull request using the repository template.
- ESLint + Prettier (single quotes, trailing commas).
no-consoleis an error,eqeqeqenabled,no-floating-promiseswarns. Ignores**/*spec.ts,__tests__,__mocks__,var,jest.config.ts. - TypeScript build emits declarations to
var/dist; strict mode on, paths fromtsconfig.json.
- Do not commit
var/outputs (coverage, dist) ornode_modules/..editorconfig: LF, 2 spaces for TS/JS/JSON, final newline. - Keep generated artefacts out of git; only source/metadata should be committed.
- GitHub Actions
libs.ymlruns lint/build/test on dev/master/PR (Node 20,npm ci --prefer-offline --no-audit). PR labelspr-version-patch/minortrigger the auto version-bump workflow.
- Overview:
docs/README.md - GraphQL CRUD guide:
docs/api-creation.md - Modeling (ModelObject/ModelField):
docs/crud-gen-modeling.md - Dependency factory options:
docs/crud-gen-factory.md - REST usage:
docs/crud-gen-rest.md