AGENTS.md
packages/cli/AGENTS.mdAGENTS.md
Quality
55/100
Scores the file, not the repository.Length
412 words
3 headings · 0 code blocksRepository
199k
— · pushed 0 days agoLast changed
3 days ago
First indexed 3 days ago.1# AGENTS.md23Guidance specific to the `cli` package. See the root [AGENTS.md](../../AGENTS.md)4for repo-wide conventions.56## TypeORM boundary78TypeORM belongs in the **persistence layer**, not in business logic.910**Allowed to import `@n8n/typeorm`** — entity and repository files, including the11ones co-located inside `src/modules/**`:1213- `src/databases/**`14- a module's `database/entities/**` and `database/repositories/**`15- files named `*.entity.ts` or `*.repository.ts` (some modules keep these at the16 module root)1718These are exempted in `eslint.config.mjs` **by location**, so a genuine `@Entity`19or repository class is never flagged — including the few entity files that lack20the `.entity.ts` suffix (they live in a `database/entities/` folder).2122**Not allowed** — business logic (services, controllers, public-api handlers,23commands, factories) must not import `@n8n/typeorm` or `@n8n/typeorm/...`24subpaths. The `misplaced-n8n-typeorm-import` lint rule enforces this; a new25import — or an inline `eslint-disable` of the rule — fails CI. The same rule also26catches the **relabel dodge**: importing a TypeORM operator/driver type (`In`,27`Not`, `FindOptionsWhere`, `EntityManager`, …) from `@n8n/db`, which28re-exports them from `@n8n/typeorm` — that silences the direct-import check29without decoupling anything. Existing leaks of both kinds are tracked in two30`files`-scoped allowlists in `eslint.config.mjs` (direct `@n8n/typeorm` imports,31and `@n8n/db` relabels) that only ever shrink: never add to them, and never32suppress the rule inline.3334Distinct from that shrink-only ratchet, two files are **permanently** exempted in35`eslint.config.mjs` for legitimate TypeORM use outside the persistence tree —36these are sanctioned, not migration targets, so don't try to relocate them or37suppress the rule:3839- `src/commands/db/revert.ts` — `MigrationExecutor` (CLI migration tooling)40- `src/security-audit/security-audit.repository.ts` — `PackagesRepository`4142Need an operator query (`In`, `IsNull`, `FindOptionsWhere`, …)? Add a43use-case-named repository method (plain parameters, domain-shaped return) rather44than importing the operator into business logic. Relabeling the import to45`@n8n/db` is lint-enforced against, not just convention (see above); likewise46don't string-match `QueryFailedError` or push `.manager` / `createQueryBuilder`47into business logic to dodge the rule. See the root "Persistence layer & the48TypeORM boundary" section for the full rationale.4950## Transactions5152Three patterns coexist while the persistence layer is migrated — new code uses53only the third:54551. **`manager.transaction(...)`** — raw TypeORM, leaks the ORM into business56 logic. Anti-pattern; being removed.572. **`withTransaction(...)`** (`@n8n/db`) — deprecated helper that still hands an58 `EntityManager` to its callback. Removed as call sites migrate.593. **`TransactionRunner.run(ctx, fn)`** (`@n8n/db`) — the target. Inject the60 `TransactionRunner` port and thread the `OperationContext`; the driver handle61 never reaches business logic. Use this for new work.6263See the root AGENTS.md "Transactions" bullet for the full API and a worked64example.65
Also in n8n-io/n8n
Diff this repo’s formatsOne repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| n8n-io/n8n.agents/skills/AGENTS.md · 199k | AGENTS.md | setuparchagent-behaviour | 58/100 | 3 days ago | |
| n8n-io/n8n.github/CLAUDE.md · 199k | CLAUDE.md | styleagent-behaviour | 48/100 | 3 days ago | |
| n8n-io/n8nAGENTS.md · 199k | AGENTS.md | setupbuildtestlint-format+8 | 96/100 | 3 days ago | |
| n8n-io/n8npackages/@n8n/ai-workflow-builder.ee/AGENTS.md · 199k | AGENTS.md | agent-behaviour | 53/100 | 3 days ago | |
| n8n-io/n8npackages/@n8n/db/AGENTS.md · 199k | AGENTS.md | database | 39/100 | 3 days ago | |
| n8n-io/n8npackages/@n8n/engine/AGENTS.md · 199k | AGENTS.md | archdo-not | 59/100 | 3 days ago | |
| n8n-io/n8npackages/@n8n/instance-ai/CLAUDE.md · 199k | CLAUDE.md | buildteststyletesting-strategy+1 | 89/100 | 3 days ago | |
| n8n-io/n8npackages/cli/src/modules/n8n-packages/CLAUDE.md · 199k | CLAUDE.md | stylearchdependenciesmonorepo+2 | 69/100 | 3 days ago | |
| n8n-io/n8npackages/frontend/AGENTS.md · 199k | AGENTS.md | style | 40/100 | 3 days ago | |
| n8n-io/n8npackages/frontend/editor-ui/src/app/stores/workflowDocument/CLAUDE.md · 199k | CLAUDE.md | styleagent-behaviour | 58/100 | 3 days ago | |
| n8n-io/n8npackages/nodes-base/AGENTS.md · 199k | AGENTS.md | teststylearchtypes+5 | 89/100 | 3 days ago | |
| n8n-io/n8npackages/testing/playwright/AGENTS.md · 199k | AGENTS.md | setupbuildtestlint-format+8 | 96/100 | 3 days ago | |
| n8n-io/n8npackages/@n8n/agents/AGENTS.md · 199k | AGENTS.md | buildteststylearch+3 | 100/100 | 3 days ago | |
| n8n-io/n8nscripts/instance-seeding/AGENTS.md · 199k | AGENTS.md | setupstyledo-not | 65/100 | 3 days ago |
Diff against .agents/skills/AGENTS.md Diff against .github/CLAUDE.md Diff against AGENTS.md Diff against packages/@n8n/ai-workflow-builder.ee/AGENTS.md Diff against packages/@n8n/db/AGENTS.md Diff against packages/@n8n/engine/AGENTS.md Diff against packages/@n8n/instance-ai/CLAUDE.md Diff against packages/cli/src/modules/n8n-packages/CLAUDE.md Diff against packages/frontend/AGENTS.md Diff against packages/frontend/editor-ui/src/app/stores/workflowDocument/CLAUDE.md Diff against packages/nodes-base/AGENTS.md Diff against packages/testing/playwright/AGENTS.md Diff against packages/@n8n/agents/AGENTS.md Diff against scripts/instance-seeding/AGENTS.md
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| TryGhost/Ghoste2e/AGENTS.md · 55k | AGENTS.md | setupteststylearch+2 | 100/100 | 3 days ago | |
| elastic/elasticsearchx-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/AGENTS.md · 78k | AGENTS.md | buildtestlint-formatstyle+2 | 100/100 | 3 days ago | |
| mui/material-uiAGENTS.md · 99k | AGENTS.md | setupbuildtestlint-format+9 | 100/100 | 3 days ago | |
| n8n-io/n8npackages/@n8n/agents/AGENTS.md · 199k | AGENTS.md | buildteststylearch+3 | 100/100 | 3 days ago | |
| code-yeongyu/oh-my-openagentpackages/web/AGENTS.md · 67k | AGENTS.md | setupbuildtestlint-format+6 | 100/100 | 2 days ago | |
| duckduckgo/content-scope-scriptsspecial-pages/AGENTS.md · 70 | AGENTS.md | buildteststylearch+3 | 100/100 | 3 days ago | |
| aaif-goose/gooseAGENTS.md · 52k | AGENTS.md | setupbuildtestlint-format+6 | 100/100 | 3 days ago | |
| elastic/elasticsearchx-pack/plugin/inference/AGENTS.md · 78k | AGENTS.md | buildtestlint-formatstyle+3 | 100/100 | 3 days ago |
