RuleStack

Configs

Stacks

Compare

Diff

RuleStack

Configs

Stacks

Compare

Diff

Read API

RuleStack

Configs

Stacks

Compare

Diff

Read API

Diff/novuhq-novu-deepsec-agents ↔ novuhq-novu-cursor-rules-dal-repository

Comparison

A · AGENTS.md · novuhq/novuB · Cursor rules · novuhq/novu
What each file covers, counted
DimensionSharedOnly in AOnly in BOverlap
Sections0310%
Commands0100%
Section tags0210%

What each file covers

Sections

0 shared · 3 only in A · 1 only in B
  • − Agent setup
  • − Common tasks
  • − Reference
  • + DAL Repository Rules

Commands

0 shared · 1 only in A · 0 only in B
  • − pnpm install

Section tags

0 shared · 2 only in A · 1 only in B
  • − setup
  • − agent-behaviour
  • + do-not

Line diff

+26 added−18 removed6 unchanged18.8% identical
novuhq/novu · .deepsec/AGENTS.md
@@ −1 @@
1# Agent setup
 
 
 
 
2 
3This is a deepsec scanning workspace. Each registered project has its
4own setup prompt at `data/<id>/SETUP.md` — open the relevant one when
5asked to set a project up.
6 
7## Common tasks
8 
9- **Set up a project for scanning**: read `data/<id>/SETUP.md` and
10 follow it (read `node_modules/deepsec/SKILL.md`, then fill
11 `data/<id>/INFO.md` from the target codebase).
12- **Add a new project**: run `deepsec init-project <root>` — it
13 scaffolds `data/<id>/` and prints/writes the setup prompt for the
14 new project.
15- **Write a custom matcher** (only after a real true-positive shows you
16 a pattern worth keeping): read
17 `node_modules/deepsec/dist/docs/writing-matchers.md`.
18 
19## Reference
20 
21The deepsec skill is at `node_modules/deepsec/SKILL.md` (after
22`pnpm install`). The full docs ship at
23`node_modules/deepsec/dist/docs/`.
 
 
 
 
 
 
 
 
 
 
 
 
24 
novuhq/novu · .cursor/rules/dal-repository.mdc
@@ +1 @@
1---
2description: Rules for working with DAL repositories in the Novu monorepo
3globs: libs/dal/**/*.ts, **/repositories/**/*.ts
4alwaysApply: false
5---
6 
7### DAL Repository Rules
 
 
8 
9#### Choosing a base class
10 
11- **New repositories must extend `BaseRepositoryV2`** — it enforces required field selection and provides auto-inferred return types (`Pick<Entity, Keys>`).
12- **Existing repositories stay on `BaseRepository`** — `BaseRepository` is deprecated but must not be changed; all 32 existing repos continue to extend it.
13- Do NOT extend `BaseRepository` for any new repository going forward.
 
 
 
 
 
 
14 
15#### BaseRepositoryV2 — required `select`
16 
17- Every read method (`find`, `findOne`, `findById`, `findBatch`, `findWithCursorBasedPagination`) requires an explicit `select` argument — there is no default `SELECT *`.
18- Use array syntax as the default: `find(query, ['_id', 'name', 'status'])`. Array syntax returns exactly the listed fields — `_id` is excluded unless explicitly included.
19- Use object syntax when you need MongoDB-style projections where `_id` is included by default: `findOne(query, { name: 1, email: 1 })`, or explicitly excluded: `findOne(query, { _id: 0, name: 1 })`.
20- Exclusion projections for non-`_id` fields (e.g. `{ name: 0 }`) are intentionally unsupported — they are a compile error.
21- Return types are automatically inferred as `Pick<Entity, Keys>` — do not manually annotate the return type.
22- Use `select: '*'` to retrieve all fields with a fully-typed `Entity` return (instead of a `Pick`). All five read methods support this overload: `find(query, '*')`, `findOne(query, '*')`, `findById(id, '*')`, `findBatch(query, '*')`, and `findWithCursorBasedPagination({ select: '*', ... })`.
23- Omitting `select` entirely is still a compile error — `'*'` is the explicit opt-in for SELECT *.
24 
25#### Enforcement (applies to both V1 and V2)
26 
27- **Never use `_model` or `MongooseModel` directly** in repository methods. Always use the inherited methods (`update`, `find`, `findOne`, `delete`, `create`, `bulkWrite`, etc.) which enforce `_environmentId` / `_organizationId` via the `EnforceEnvOrOrgIds` type.
28- All query methods must include `_environmentId` or `_organizationId` in their filter to satisfy the enforcement type constraint.
29- When adding new repository methods that need `$push`, `$pull`, or other update operators, pass the `environmentId` as a parameter and use `this.update()` with the enforcement fields.
30- For bulk operations, use `this.bulkWrite()` instead of `this._model.updateMany()`.
31- **Transactions**: start via `repository.withTransaction(async (session) => { ... })` and pass `session` to every repo call inside it (e.g. `repo.findOne(query, select, { session })`). Run all operations sequentially — parallel execution (`Promise.all`, etc.) inside a transaction is undefined behaviour in Mongoose.
32 
@@ −1 +1 @@
1−# Agent setup
1+---
2+description: Rules for working with DAL repositories in the Novu monorepo
3+globs: libs/dal/**/*.ts, **/repositories/**/*.ts
4+alwaysApply: false
5+---
26  
3−This is a deepsec scanning workspace. Each registered project has its
4−own setup prompt at `data/<id>/SETUP.md` — open the relevant one when
5−asked to set a project up.
7+### DAL Repository Rules
68  
7−## Common tasks
9+#### Choosing a base class
810  
9−- **Set up a project for scanning**: read `data/<id>/SETUP.md` and
10− follow it (read `node_modules/deepsec/SKILL.md`, then fill
11− `data/<id>/INFO.md` from the target codebase).
12−- **Add a new project**: run `deepsec init-project <root>` — it
13− scaffolds `data/<id>/` and prints/writes the setup prompt for the
14− new project.
15−- **Write a custom matcher** (only after a real true-positive shows you
16− a pattern worth keeping): read
17− `node_modules/deepsec/dist/docs/writing-matchers.md`.
11+- **New repositories must extend `BaseRepositoryV2`** — it enforces required field selection and provides auto-inferred return types (`Pick<Entity, Keys>`).
12+- **Existing repositories stay on `BaseRepository`** — `BaseRepository` is deprecated but must not be changed; all 32 existing repos continue to extend it.
13+- Do NOT extend `BaseRepository` for any new repository going forward.
1814  
19−## Reference
15+#### BaseRepositoryV2 — required `select`
2016  
21−The deepsec skill is at `node_modules/deepsec/SKILL.md` (after
22−`pnpm install`). The full docs ship at
23−`node_modules/deepsec/dist/docs/`.
17+- Every read method (`find`, `findOne`, `findById`, `findBatch`, `findWithCursorBasedPagination`) requires an explicit `select` argument — there is no default `SELECT *`.
18+- Use array syntax as the default: `find(query, ['_id', 'name', 'status'])`. Array syntax returns exactly the listed fields — `_id` is excluded unless explicitly included.
19+- Use object syntax when you need MongoDB-style projections where `_id` is included by default: `findOne(query, { name: 1, email: 1 })`, or explicitly excluded: `findOne(query, { _id: 0, name: 1 })`.
20+- Exclusion projections for non-`_id` fields (e.g. `{ name: 0 }`) are intentionally unsupported — they are a compile error.
21+- Return types are automatically inferred as `Pick<Entity, Keys>` — do not manually annotate the return type.
22+- Use `select: '*'` to retrieve all fields with a fully-typed `Entity` return (instead of a `Pick`). All five read methods support this overload: `find(query, '*')`, `findOne(query, '*')`, `findById(id, '*')`, `findBatch(query, '*')`, and `findWithCursorBasedPagination({ select: '*', ... })`.
23+- Omitting `select` entirely is still a compile error — `'*'` is the explicit opt-in for SELECT *.
24+ 
25+#### Enforcement (applies to both V1 and V2)
26+ 
27+- **Never use `_model` or `MongooseModel` directly** in repository methods. Always use the inherited methods (`update`, `find`, `findOne`, `delete`, `create`, `bulkWrite`, etc.) which enforce `_environmentId` / `_organizationId` via the `EnforceEnvOrOrgIds` type.
28+- All query methods must include `_environmentId` or `_organizationId` in their filter to satisfy the enforcement type constraint.
29+- When adding new repository methods that need `$push`, `$pull`, or other update operators, pass the `environmentId` as a parameter and use `this.update()` with the enforcement fields.
30+- For bulk operations, use `this.bulkWrite()` instead of `this._model.updateMany()`.
31+- **Transactions**: start via `repository.withTransaction(async (session) => { ... })` and pass `session` to every repo call inside it (e.g. `repo.findOne(query, select, { session })`). Run all operations sequentially — parallel execution (`Promise.all`, etc.) inside a transaction is undefined behaviour in Mongoose.
2432  
RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack

RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack

RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack