@devtrack-solution/codesdd 1.2.3 → 1.2.4-rc3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. package/.sdd/skills/curated/devtrack-api/SKILL.md +12 -5
  2. package/.sdd/skills/curated/devtrack-api/agents/claude-code.yaml +8 -0
  3. package/.sdd/skills/curated/devtrack-api/agents/codex.yaml +8 -0
  4. package/.sdd/skills/curated/devtrack-api/agents/cursor.yaml +8 -0
  5. package/.sdd/skills/curated/devtrack-api/agents/gemini.yaml +8 -0
  6. package/.sdd/skills/curated/devtrack-api/agents/kimi.yaml +8 -0
  7. package/.sdd/skills/curated/devtrack-api/agents/openai.yaml +4 -2
  8. package/.sdd/skills/curated/devtrack-api/agents/opencode.yaml +10 -0
  9. package/.sdd/skills/curated/devtrack-api/references/application-presentation.md +2 -2
  10. package/.sdd/skills/curated/devtrack-api/references/contract-pack.yaml +55 -0
  11. package/.sdd/skills/curated/devtrack-api/references/domain-modeling.md +13 -13
  12. package/.sdd/skills/curated/devtrack-api/references/foundation-layout.md +2 -3
  13. package/.sdd/skills/curated/devtrack-api/references/implementation-checklist.md +1 -1
  14. package/.sdd/skills/curated/devtrack-api/references/portable-agent-contract.md +41 -0
  15. package/.sdd/skills/curated/devtrack-api/references/typeorm-infrastructure.md +7 -9
  16. package/README.md +159 -5
  17. package/dist/applications/sdd/index.d.ts +16 -0
  18. package/dist/applications/sdd/index.js +16 -0
  19. package/dist/commands/config.js +171 -10
  20. package/dist/commands/sdd/execution.js +345 -15
  21. package/dist/commands/sdd/plugin.js +5 -0
  22. package/dist/commands/sdd/shared.d.ts +1 -0
  23. package/dist/commands/sdd/shared.js +10 -0
  24. package/dist/commands/sdd.js +38 -3
  25. package/dist/core/cli/command-matrix.js +9 -0
  26. package/dist/core/cli-command-quality.js +9 -0
  27. package/dist/core/completions/command-registry.js +45 -0
  28. package/dist/core/config-schema.d.ts +18 -1
  29. package/dist/core/config-schema.js +48 -5
  30. package/dist/core/global-config.d.ts +16 -0
  31. package/dist/core/sdd/agent-binding.d.ts +10 -10
  32. package/dist/core/sdd/agent-runtime-contract.d.ts +204 -0
  33. package/dist/core/sdd/agent-runtime-contract.js +200 -0
  34. package/dist/core/sdd/check.d.ts +2 -0
  35. package/dist/core/sdd/check.js +40 -2
  36. package/dist/core/sdd/coordination/coordination-adapters.d.ts +15 -8
  37. package/dist/core/sdd/coordination/coordination-adapters.js +43 -15
  38. package/dist/core/sdd/coordination/index.d.ts +1 -0
  39. package/dist/core/sdd/coordination/index.js +1 -0
  40. package/dist/core/sdd/coordination/redis-runtime.d.ts +131 -0
  41. package/dist/core/sdd/coordination/redis-runtime.js +698 -0
  42. package/dist/core/sdd/deepagent-contracts.d.ts +98 -4
  43. package/dist/core/sdd/deepagent-contracts.js +62 -0
  44. package/dist/core/sdd/default-bootstrap-files.d.ts +2 -2
  45. package/dist/core/sdd/default-bootstrap-files.js +14 -8
  46. package/dist/core/sdd/default-skills.js +108 -4
  47. package/dist/core/sdd/devtrack-api-appliance.d.ts +8 -1
  48. package/dist/core/sdd/devtrack-api-appliance.js +46 -23
  49. package/dist/core/sdd/docs-sync.js +21 -15
  50. package/dist/core/sdd/domain/capability-diff.d.ts +63 -0
  51. package/dist/core/sdd/domain/capability-diff.js +200 -0
  52. package/dist/core/sdd/domain/change-safety-guardrails.d.ts +74 -0
  53. package/dist/core/sdd/domain/change-safety-guardrails.js +333 -0
  54. package/dist/core/sdd/domain/semantic-intent-classifier.d.ts +29 -0
  55. package/dist/core/sdd/domain/semantic-intent-classifier.js +117 -0
  56. package/dist/core/sdd/foundation-artifact-map-validator.d.ts +16 -0
  57. package/dist/core/sdd/foundation-artifact-map-validator.js +71 -0
  58. package/dist/core/sdd/foundation-layer-manifest.d.ts +24 -0
  59. package/dist/core/sdd/foundation-layer-manifest.js +117 -0
  60. package/dist/core/sdd/intent-guard.d.ts +22 -0
  61. package/dist/core/sdd/intent-guard.js +67 -0
  62. package/dist/core/sdd/json-schema.js +9 -1
  63. package/dist/core/sdd/legacy-operations.js +76 -1
  64. package/dist/core/sdd/migrate-workspace.js +39 -0
  65. package/dist/core/sdd/package-security-gates.d.ts +21 -0
  66. package/dist/core/sdd/package-security-gates.js +119 -0
  67. package/dist/core/sdd/package-structure-gate.js +3 -8
  68. package/dist/core/sdd/parallel-feat-automation.d.ts +181 -3
  69. package/dist/core/sdd/parallel-feat-automation.js +212 -0
  70. package/dist/core/sdd/plugin-broker.d.ts +223 -4
  71. package/dist/core/sdd/plugin-broker.js +10 -0
  72. package/dist/core/sdd/plugin-cli.d.ts +30 -0
  73. package/dist/core/sdd/plugin-cli.js +70 -3
  74. package/dist/core/sdd/plugin-evidence.d.ts +73 -0
  75. package/dist/core/sdd/plugin-manifest.d.ts +69 -1
  76. package/dist/core/sdd/plugin-manifest.js +10 -0
  77. package/dist/core/sdd/plugin-policy-pack.d.ts +1 -1
  78. package/dist/core/sdd/plugin-registry.d.ts +141 -5
  79. package/dist/core/sdd/plugin-sdk-contract.d.ts +363 -0
  80. package/dist/core/sdd/plugin-sdk-contract.js +268 -0
  81. package/dist/core/sdd/plugin-skill-binding.d.ts +1 -1
  82. package/dist/core/sdd/quality-validation.d.ts +84 -11
  83. package/dist/core/sdd/release-readiness.d.ts +19 -0
  84. package/dist/core/sdd/release-readiness.js +472 -0
  85. package/dist/core/sdd/runtime-boundary-contract.d.ts +45 -0
  86. package/dist/core/sdd/runtime-boundary-contract.js +90 -0
  87. package/dist/core/sdd/sdk-agent-plugin-quality-gates.d.ts +150 -0
  88. package/dist/core/sdd/sdk-agent-plugin-quality-gates.js +258 -0
  89. package/dist/core/sdd/services/agent-run.service.d.ts +38 -6
  90. package/dist/core/sdd/services/agent-run.service.js +73 -1
  91. package/dist/core/sdd/services/capability-diff.service.d.ts +18 -0
  92. package/dist/core/sdd/services/capability-diff.service.js +26 -0
  93. package/dist/core/sdd/services/change-safety-preflight.service.d.ts +17 -0
  94. package/dist/core/sdd/services/change-safety-preflight.service.js +17 -0
  95. package/dist/core/sdd/services/context.service.d.ts +43 -340
  96. package/dist/core/sdd/services/context.service.js +323 -9
  97. package/dist/core/sdd/services/finalize.service.d.ts +25 -0
  98. package/dist/core/sdd/services/finalize.service.js +178 -16
  99. package/dist/core/sdd/services/frontend-impact.service.d.ts +1 -1
  100. package/dist/core/sdd/services/semantic-intent-classifier.service.d.ts +6 -0
  101. package/dist/core/sdd/services/semantic-intent-classifier.service.js +7 -0
  102. package/dist/core/sdd/state.d.ts +1 -0
  103. package/dist/core/sdd/state.js +251 -29
  104. package/dist/core/sdd/store/sdd-stores.js +2 -2
  105. package/dist/core/sdd/structural-health.d.ts +13 -13
  106. package/dist/core/sdd/types.d.ts +27 -12
  107. package/dist/core/sdd/types.js +4 -0
  108. package/dist/core/sdd/views.js +17 -0
  109. package/dist/core/sdd/workspace-schemas.d.ts +387 -7
  110. package/dist/core/sdd/workspace-schemas.js +196 -64
  111. package/dist/domains/sdd/index.d.ts +6 -0
  112. package/dist/domains/sdd/index.js +6 -0
  113. package/dist/infrastructures/sdd/index.d.ts +7 -0
  114. package/dist/infrastructures/sdd/index.js +6 -0
  115. package/dist/presentations/cli/sdd/index.d.ts +3 -0
  116. package/dist/presentations/cli/sdd/index.js +3 -0
  117. package/dist/shared/sdd/index.d.ts +3 -0
  118. package/dist/shared/sdd/index.js +2 -0
  119. package/package.json +9 -6
  120. package/schemas/sdd/2-plan.schema.json +207 -2
  121. package/schemas/sdd/5-quality.schema.json +281 -25
  122. package/schemas/sdd/agent-runtime-command-plan.schema.json +212 -0
  123. package/schemas/sdd/agent-runtime-opencode-run-evidence.schema.json +270 -0
  124. package/schemas/sdd/codesdd-plugin.schema.json +171 -0
  125. package/schemas/sdd/deepagent-run-request.schema.json +316 -0
  126. package/schemas/sdd/parallel-feat-automation-plan.schema.json +89 -0
  127. package/schemas/sdd/parallel-feat-scheduler-request.schema.json +116 -0
  128. package/schemas/sdd/parallel-feat-scheduler-result.schema.json +404 -0
  129. package/schemas/sdd/plugin-artifact-manifest.schema.json +109 -0
  130. package/schemas/sdd/plugin-artifact-map.schema.json +223 -0
  131. package/schemas/sdd/plugin-evidence-manifest.schema.json +109 -0
  132. package/schemas/sdd/plugin-language-runtime.schema.json +103 -0
  133. package/schemas/sdd/plugin-package-governance.schema.json +74 -0
  134. package/schemas/sdd/plugin-registry.schema.json +171 -0
  135. package/schemas/sdd/plugin-runtime-invocation-plan.schema.json +109 -0
  136. package/schemas/sdd/quality-evidence-bundle.schema.json +109 -0
  137. package/schemas/sdd/sdk-agent-plugin-quality-gate-input.schema.json +168 -0
  138. package/schemas/sdd/sdk-agent-plugin-quality-gate-report.schema.json +160 -0
  139. package/schemas/sdd/workspace-catalog.schema.json +3776 -398
@@ -26,6 +26,9 @@ These rules apply to any assistant, automation host, IDE agent, command-line cod
26
26
  - Do not create external memory, backlog, workflow, scratchpad, context, or handoff stores.
27
27
  - Do not use BRV in this environment.
28
28
  - Never introduce Prisma. Persistence is TypeORM only.
29
+ - Treat this skill as isolated from `devtrack-angular` and `devtrack-flutter`; share only explicit API contracts, DTO boundaries, schemas, generated clients, and documented platform contracts.
30
+ - Treat `agents/*.yaml` files as host adapters only. `SKILL.md`, `references/contract-pack.yaml`, and the Foundation source/layout references remain canonical across Codex, Claude Code, Cursor, Gemini, Kimi, OpenCode, and equivalent markdown/CLI agents.
31
+ - If this skill conflicts with `devtrack-foundation-api` source or Foundation layout evidence, Foundation wins unless a governed ADR or contract-pack exception explicitly records the divergence.
29
32
 
30
33
  ## Operating Mode
31
34
 
@@ -61,12 +64,13 @@ Treat the repository as a production-grade system:
61
64
  Load only the files needed for the task, but always load governance and layout before code changes:
62
65
 
63
66
  - Always read [contract-pack.yaml](references/contract-pack.yaml) before planning, approving, or executing a `devtrack-api` project, debate, EPIC, or FEAT. It is the machine-readable contract pack for derivation profiles, P0/P1/P2 severity, early package preview, human validation, and `codesdd-validate` drift remediation.
67
+ - Read [portable-agent-contract.md](references/portable-agent-contract.md) when adapting this skill for Codex, Claude Code, Cursor, Gemini, Kimi, OpenCode, or a generic markdown/CLI agent.
64
68
  - Always read [architecture-governance.md](references/architecture-governance.md) before code changes.
65
69
  - Always read [foundation-layout.md](references/foundation-layout.md) before producing any implementation plan, debate, or code change that proposes new file paths. Foundation layout is canonical, not advisory.
66
70
  - Read [consumer-sync-policy.md](references/consumer-sync-policy.md) before copying, updating, validating, or accepting `devtrack-api` in a consumer repository.
67
71
  - Read [field-validation-protocol.md](references/field-validation-protocol.md) before declaring `devtrack-api` adoption validated in a consumer project or closing field-evidence expectations.
68
72
  - Read [imports-lint.md](references/imports-lint.md) before editing imports or fixing lint.
69
- - Read [domain-modeling.md](references/domain-modeling.md) for `domain/`, `.type.ts`, `.bo.ts`, `.vo.ts`, validators, events, and repository ports.
73
+ - Read [domain-modeling.md](references/domain-modeling.md) for `domain/`, `.type.ts`, `.bo.ts`, `.vo.ts`, the closed legacy entity-pattern, validators, events, and repository-port placement.
70
74
  - Read [application-presentation.md](references/application-presentation.md) for use cases, services, handlers, ports, modules, controllers, DTO validators, GraphQL, CLI, WebSocket, agents, and tools.
71
75
  - Read [typeorm-infrastructure.md](references/typeorm-infrastructure.md) for TypeORM entities, repositories, mappers, migrations, modules, config, infrastructure adapters, settings, queues, AWS, and provider integrations.
72
76
  - Read [testing-validation.md](references/testing-validation.md) before finishing or when choosing tests.
@@ -90,7 +94,7 @@ The `codesdd-validate` field failure is mapped in the contract pack under `codes
90
94
 
91
95
  Implement from inside out unless the task is purely presentation or infrastructure:
92
96
 
93
- 1. `src/domain`: business rules, BOs, VOs, types, validators, events, repository port contracts.
97
+ 1. `src/domain`: business rules, BOs, VOs, and types. Validators, events, entities, and domain repository ports are legacy entity-pattern only.
94
98
  2. `src/application`: orchestration, use cases, services, handlers, agents/tools, ports in/out.
95
99
  3. `src/infrastructure`: concrete adapters, TypeORM, AWS, queue, cache, HTTP, LLM, vector store, Temporal, settings.
96
100
  4. `src/presentation`: REST/GraphQL/CLI/WebSocket entrypoints and request validation.
@@ -180,11 +184,13 @@ src/infrastructure/adapters/orm/entities/<name>.orm-entity.ts
180
184
  src/infrastructure/adapters/orm/repositories/<name>.typeorm-repository.ts
181
185
  src/infrastructure/adapters/orm/mappers/<name>.mapper.ts
182
186
  src/infrastructure/adapters/orm/migrations/<timestamp>-<action>.migration.ts
183
- src/infrastructure/adapters/orm/<context>-orm.module.ts
187
+ src/infrastructure/adapters/orm/orm.module.ts
184
188
  ```
185
189
 
186
190
  Known subsystems in Foundation: `auth`, `aws`, `cache`, `configuration`, `http`, `llm`, `orm`, `queue`, `redis`, `sync-engine`, `temporal`, `vector-store`. Add a new subsystem folder only when no existing subsystem covers the integration.
187
191
 
192
+ The ORM subsystem has one Nest module only: `src/infrastructure/adapters/orm/orm.module.ts`. Do not create entity/context modules such as `<context>-orm.module.ts`; wire and export all `*.typeorm-repository.ts` providers through `orm.module.ts`.
193
+
188
194
  **Presentation (segmented by transport before context)**
189
195
 
190
196
  ```text
@@ -206,7 +212,7 @@ Other transports follow the same shape under `graphql/`, `cli/`, `websocket/`, o
206
212
  - REST controllers end with `.controller.ts`, one class per file.
207
213
  - REST DTOs end with `.dto.ts`.
208
214
  - Presentation validators end with `.presentation-validator.ts`.
209
- - Nest modules end with `.application.module.ts`, `.module.ts`, or `-orm.module.ts` by layer.
215
+ - Nest modules end with `.application.module.ts` or `.module.ts` by layer. The ORM module is exactly `orm.module.ts`.
210
216
 
211
217
  ## Forbidden Patterns
212
218
 
@@ -216,6 +222,7 @@ These layouts have been observed in derived debates and plans and **must be reje
216
222
  - `<name>.schema.ts` for TypeORM entities — use `<name>.orm-entity.ts`.
217
223
  - `<name>.value-object.ts` — use `<name>.vo.ts`.
218
224
  - `<name>.repository.ts` (ambiguous) — use `<name>.typeorm-repository.ts` in infrastructure, `<name>-repository.port.ts` in port.
225
+ - `src/infrastructure/adapters/orm/*-orm.module.ts` — use the single `src/infrastructure/adapters/orm/orm.module.ts`.
219
226
  - `src/infrastructure/<context>/persistence/typeorm/` — use `src/infrastructure/adapters/orm/`.
220
227
  - `src/infrastructure/<context>/adapters/` — use `src/infrastructure/adapters/<subsystem>/`.
221
228
  - `src/infrastructure/<context>/repositories/` — use `src/infrastructure/adapters/orm/repositories/`.
@@ -247,7 +254,7 @@ A plan that fails this gate corrupts the downstream FEAT execution and the disco
247
254
  A valid change must satisfy all relevant checks:
248
255
 
249
256
  - It matches the current repository patterns unless the user explicitly requested a better pattern and the migration cost is justified.
250
- - It keeps business invariants in domain objects, value objects, or domain validators.
257
+ - It keeps BO-pattern business invariants in domain business objects and value objects; domain validators apply only to existing entity-pattern contexts.
251
258
  - It keeps orchestration in application use cases, services, or handlers.
252
259
  - It keeps transport mapping and request validation in presentation.
253
260
  - It keeps concrete integrations in infrastructure.
@@ -0,0 +1,8 @@
1
+ agent_id: claude
2
+ display_name: Claude Code
3
+ skill_id: devtrack-api
4
+ adapter_type: markdown-skill
5
+ canonical_skill: ../SKILL.md
6
+ notes:
7
+ - Treat this adapter as a host mapping only; SKILL.md and references remain canonical.
8
+ - Preserve dirty worktrees and report unavailable commands honestly.
@@ -0,0 +1,8 @@
1
+ agent_id: codex
2
+ display_name: Codex
3
+ skill_id: devtrack-api
4
+ adapter_type: markdown-skill
5
+ canonical_skill: ../SKILL.md
6
+ notes:
7
+ - Read CodeSDD policy and FEAT context before edits.
8
+ - Load contract-pack.yaml and Foundation layout before backend/API changes.
@@ -0,0 +1,8 @@
1
+ agent_id: cursor
2
+ display_name: Cursor
3
+ skill_id: devtrack-api
4
+ adapter_type: markdown-skill
5
+ canonical_skill: ../SKILL.md
6
+ notes:
7
+ - Keep Cursor edits scoped to CodeSDD FEAT context.
8
+ - Do not bypass Foundation layout or TypeORM constraints.
@@ -0,0 +1,8 @@
1
+ agent_id: gemini
2
+ display_name: Gemini
3
+ skill_id: devtrack-api
4
+ adapter_type: markdown-skill
5
+ canonical_skill: ../SKILL.md
6
+ notes:
7
+ - Verify version-sensitive NestJS and TypeORM details before asserting APIs.
8
+ - Use contract-pack rule ids in validation notes.
@@ -0,0 +1,8 @@
1
+ agent_id: kimi
2
+ display_name: Kimi
3
+ skill_id: devtrack-api
4
+ adapter_type: markdown-skill
5
+ canonical_skill: ../SKILL.md
6
+ notes:
7
+ - Use the markdown skill and references as the complete contract.
8
+ - Produce compact, evidence-backed changes and handoff notes.
@@ -1,4 +1,6 @@
1
1
  interface:
2
2
  display_name: "DevTrack API"
3
- short_description: "Portable DevTrack API engineering governance, architecture, safety, validation, and quality skill."
4
- default_prompt: "Use $devtrack-api to implement, review, refactor, test, or document DevTrack API work with CodeSDD, DDD/Clean Architecture, TypeORM, strict import boundaries, evidence-based validation, and safe operational constraints."
3
+ short_description: "Governed DevTrack API architecture and Foundation fidelity."
4
+ default_prompt: "Use $devtrack-api to implement, review, refactor, test, or document DevTrack API work with CodeSDD, Foundation-compatible NestJS, TypeORM, strict imports, and validation evidence."
5
+ policy:
6
+ allow_implicit_invocation: true
@@ -0,0 +1,10 @@
1
+ agent_id: opencode
2
+ display_name: OpenCode
3
+ skill_id: devtrack-api
4
+ adapter_type: markdown-skill
5
+ canonical_skill: ../SKILL.md
6
+ aliases:
7
+ - open-code
8
+ notes:
9
+ - Use opencode for local skill sync targets.
10
+ - Use open-code only when an MCP provider manifest requires that provider id.
@@ -126,8 +126,8 @@ Pattern:
126
126
  ```ts
127
127
  import { Inject, Injectable, Logger, Optional } from '@nestjs/common';
128
128
  import { Example } from '@domain/example/business-objects/example.bo';
129
- import { ExampleRepositoryPortSymbol } from '@domain/example/repository-ports/example-repository.port';
130
- import type { ExampleRepositoryPort } from '@domain/example/repository-ports/example-repository.port';
129
+ import { ExampleRepositoryPortSymbol } from '@application/business/example/ports/out/example-repository.port';
130
+ import type { ExampleRepositoryPort } from '@application/business/example/ports/out/example-repository.port';
131
131
  import type { ExampleType } from '@domain/example/types/example.type';
132
132
  import type { CreateExampleUseCasePort } from '@application/business/example/ports/in/create-example.use-case.port';
133
133
  import { ExampleProducerPortSymbol } from '@application/business/example/ports/out/example-producer.port';
@@ -12,6 +12,44 @@ authority:
12
12
  - .sdd/skills/curated/devtrack-api/SKILL.md
13
13
  - this contract pack
14
14
  consumer_rule: Consumer copies are one-way CodeSDD materializations and must not become upstream sources of truth.
15
+ foundation_wins_rule: If devtrack-api guidance conflicts with devtrack-foundation-api source or Foundation layout evidence, Foundation wins unless a governed ADR or contract-pack exception records the divergence.
16
+ isolation_rule: devtrack-api governs backend/API work only; devtrack-angular remains the isolated Angular Admin/backoffice skill and devtrack-flutter remains the isolated Flutter/Dart skill.
17
+ portable_agents:
18
+ canonical_targets:
19
+ - openai
20
+ - codex
21
+ - claude
22
+ - cursor
23
+ - gemini
24
+ - kimi
25
+ - opencode
26
+ - generic-markdown-cli
27
+ aliases:
28
+ claude-code: claude
29
+ kimmy-code: kimi
30
+ kilo-code: generic-markdown-cli
31
+ open-code: opencode
32
+ OpenCode: opencode
33
+ Kimi: kimi
34
+ artifact_map:
35
+ openai: agents/openai.yaml
36
+ codex: agents/codex.yaml
37
+ claude: agents/claude-code.yaml
38
+ cursor: agents/cursor.yaml
39
+ gemini: agents/gemini.yaml
40
+ kimi: agents/kimi.yaml
41
+ opencode: agents/opencode.yaml
42
+ generic-markdown-cli: SKILL.md
43
+ required_artifacts:
44
+ - SKILL.md
45
+ - agents/openai.yaml
46
+ - agents/codex.yaml
47
+ - agents/claude-code.yaml
48
+ - agents/cursor.yaml
49
+ - agents/gemini.yaml
50
+ - agents/kimi.yaml
51
+ - agents/opencode.yaml
52
+ - references/portable-agent-contract.md
15
53
  derivation_profiles:
16
54
  prototype:
17
55
  default: false
@@ -62,6 +100,21 @@ severity_model:
62
100
  meaning: Lower-risk drift, documentation gap, or profile-specific variance.
63
101
  required_action: Record evidence, exception, or follow-up before closure.
64
102
  rules:
103
+ - id: DTAPI-P0-FOUNDATION-001
104
+ severity: P0
105
+ title: Foundation evidence wins over generated or adapter-specific guidance.
106
+ applies_to:
107
+ - DEB
108
+ - EPIC
109
+ - FEAT
110
+ - source
111
+ - validator
112
+ detect:
113
+ - plan, code, or agent adapter diverges from devtrack-foundation-api source without ADR
114
+ - generated path, module, import, or TypeORM rule conflicts with foundation-layout.md
115
+ required_response:
116
+ - align with devtrack-foundation-api source or foundation-layout.md
117
+ - or record an ADR-backed and profile-compatible exception before execution or finalize
65
118
  - id: DTAPI-P0-PROFILE-001
66
119
  severity: P0
67
120
  title: Derivation profile must be explicit before implementation.
@@ -97,6 +150,7 @@ rules:
97
150
  - forbidden paths from SKILL.md or foundation-layout.md
98
151
  - new domain entities folder outside approved legacy contexts
99
152
  - context-owned infrastructure adapters
153
+ - per-context or per-entity TypeORM modules under src/infrastructure/adapters/orm
100
154
  - transport-less presentation context folders
101
155
  required_response:
102
156
  - replace with canonical path
@@ -127,6 +181,7 @@ rules:
127
181
  - files ending in .typeorm-repository.ts without InjectRepository or Repository usage
128
182
  - in-memory Map persistence inside TypeORM-named repositories
129
183
  - missing TypeOrmModule.forFeature wiring for concrete ORM repositories
184
+ - concrete ORM repositories not provided and exported through src/infrastructure/adapters/orm/orm.module.ts
130
185
  required_response:
131
186
  - implement real TypeORM repository wiring
132
187
  - rename prototype adapters so they do not claim TypeORM compatibility
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## Domain Intent
4
4
 
5
- Domain code expresses business language, invariants, state transitions, and persistence contracts for aggregates. It must remain framework-free and portable.
5
+ Domain code expresses business language, invariants, and state transitions. It must remain framework-free and portable.
6
6
 
7
7
  Domain is the last place where business truth should be guessed. When a rule is unclear, inspect existing domain objects, tests, use cases, and SDD context before adding a new invariant.
8
8
 
@@ -14,14 +14,10 @@ Use these folders by intent:
14
14
  src/domain/<context>/types
15
15
  src/domain/<context>/business-objects
16
16
  src/domain/<context>/value-objects
17
- src/domain/<context>/entities
18
- src/domain/<context>/validators
19
- src/domain/<context>/events
20
- src/domain/<context>/repository-ports
21
17
  src/domain/<context>/constants
22
18
  ```
23
19
 
24
- Use `business-objects/` and `value-objects/` for new canonical aggregate work, especially intelligence. Use `entities/` when extending a context that already uses domain entities, such as `pessoas` or `wallets`.
20
+ Use `business-objects/` and `value-objects/` for new canonical aggregate work. Use `entities/`, `validators/`, `events/`, and `repository-ports/` only when extending a context that already uses the legacy entity-pattern, currently `pessoas` or `wallets`.
25
21
 
26
22
  Do not create domain folders for transport, database, provider, prompt, SDK, queue, cache, HTTP, or UI concerns.
27
23
 
@@ -31,7 +27,7 @@ Before adding a domain artifact, decide:
31
27
 
32
28
  - Is this a durable business concept or just transport/persistence shape?
33
29
  - Does it own invariants or only type information?
34
- - Is it an aggregate/business object, value object, legacy entity, validator, event, constant, or repository port?
30
+ - Is it a business object, value object, type, constant, or an ADR-backed extension to a legacy entity-pattern context?
35
31
  - Does existing domain language already cover it?
36
32
  - Which tests should prove normalization, invalid paths, and immutability?
37
33
 
@@ -291,16 +287,18 @@ export class PessoaValidator {
291
287
  }
292
288
  ```
293
289
 
294
- Presentation validators must not replace domain validators. Presentation validates request shape; domain validates business invariants.
290
+ Presentation validators must not replace domain invariants. Presentation validates request shape; BO-pattern contexts validate inside BOs and VOs. Domain validators are limited to existing entity-pattern contexts.
295
291
 
296
292
  ## Repository Ports
297
293
 
298
- Repository ports belong in domain when they represent domain aggregate persistence:
294
+ For BO-pattern contexts, repository ports belong in application `ports/out`:
299
295
 
300
296
  ```text
301
- src/domain/<context>/repository-ports/<name>-repository.port.ts
297
+ src/application/business/<context>/ports/out/<name>-repository.port.ts
302
298
  ```
303
299
 
300
+ Domain `repository-ports/` exists only when extending the closed legacy entity-pattern contexts already present in Foundation (`pessoas`, `wallets`).
301
+
304
302
  Pattern:
305
303
 
306
304
  ```ts
@@ -319,17 +317,19 @@ Rules:
319
317
  - Export a `Symbol` and an interface.
320
318
  - Return domain objects, not ORM entities.
321
319
  - Keep persistence technology out of the port name, except implementation names in infrastructure.
322
- - Application ports can also describe repositories when the persistence need is application-specific rather than aggregate-owned. Follow existing module patterns.
323
- - Do not expose query builders, transactions, connection objects, ORM entities, or provider SDK types through domain ports.
320
+ - For BO-pattern contexts, this port is an application outbound port even when it returns a domain BO.
321
+ - Do not expose query builders, transactions, connection objects, ORM entities, or provider SDK types through ports.
324
322
 
325
323
  ## Domain Events
326
324
 
327
- Use domain events for business facts:
325
+ Use domain events for business facts only when extending an existing entity-pattern context:
328
326
 
329
327
  ```text
330
328
  src/domain/<context>/events/<name>-created.event.ts
331
329
  ```
332
330
 
331
+ For BO-pattern contexts, emit integration or domain-like events from application handlers unless an ADR deliberately extends the pattern.
332
+
333
333
  Keep events serializable and framework-free:
334
334
 
335
335
  ```ts
@@ -206,13 +206,12 @@ src/infrastructure/adapters/orm/entities/<name>.orm-entity.ts
206
206
  src/infrastructure/adapters/orm/repositories/<name>.typeorm-repository.ts
207
207
  src/infrastructure/adapters/orm/mappers/<name>.mapper.ts
208
208
  src/infrastructure/adapters/orm/migrations/<timestamp>-<action>.migration.ts
209
- src/infrastructure/adapters/orm/<context>-orm.module.ts
209
+ src/infrastructure/adapters/orm/orm.module.ts
210
210
  src/infrastructure/adapters/orm/typeorm.config.ts
211
211
  src/infrastructure/adapters/orm/typeorm-cli.datasource.ts
212
- src/infrastructure/adapters/orm/typeorm.module.ts
213
212
  ```
214
213
 
215
- The `<context>-orm.module.ts` files (e.g., `auth-orm.module.ts`, `pessoas-orm.module.ts`, `wallets-orm.module.ts`, `sync-engine-orm.module.ts`) wire per-context TypeORM artifacts inside the centralized `orm/` folder. Do **not** create `src/infrastructure/<context>/persistence/typeorm/`.
214
+ The ORM subsystem has one Nest module only: `src/infrastructure/adapters/orm/orm.module.ts`. It registers TypeORM entities, concrete `*.typeorm-repository.ts` providers, mapper dependencies when needed, and exports the repository providers/tokens required by application ports. Do **not** create per-context or per-entity modules such as `auth-orm.module.ts`, `pessoas-orm.module.ts`, `wallets-orm.module.ts`, or `sync-engine-orm.module.ts`. Do **not** create `src/infrastructure/<context>/persistence/typeorm/`.
216
215
 
217
216
  ### 5.2 Adapter ports (shared)
218
217
 
@@ -78,7 +78,7 @@
78
78
  - Mapper ends with `.mapper.ts`.
79
79
  - Repository implements a port.
80
80
  - Mapper is stateless and maps domain <-> ORM only.
81
- - New entity is added to TypeORM config, CLI datasource, root module, ORM feature module, and infrastructure module as needed.
81
+ - New entity is added to TypeORM config, CLI datasource, the single `orm.module.ts`, and infrastructure module as needed.
82
82
  - Migration SQL matches entity decorators.
83
83
  - Unique violations are translated to domain/shared exceptions.
84
84
  - No Prisma artifacts.
@@ -0,0 +1,41 @@
1
+ # Portable Agent Contract
2
+
3
+ Use this reference when adapting `devtrack-api` for Codex, Claude Code, Cursor, Gemini, Kimi, OpenCode, or any markdown/CLI coding agent.
4
+
5
+ ## Common Rules
6
+
7
+ - The `SKILL.md` frontmatter is the trigger surface; keep `name: devtrack-api` and a direct description of NestJS, TypeORM, DDD, Clean Architecture, CodeSDD, and Foundation-compatible API work.
8
+ - The body is the runtime contract; detailed Foundation rules live in `references/`.
9
+ - Agent-specific files in `agents/` are adapters, not separate sources of truth.
10
+ - CodeSDD state remains canonical for planning, quality, and finalize evidence.
11
+ - `devtrack-foundation-api` source and the Foundation layout reference win over generated assumptions.
12
+ - Do not persist hidden memory or parallel backlog outside `.sdd`.
13
+ - If the host cannot read `agents/*.yaml`, it must still be able to follow `SKILL.md` and this reference.
14
+
15
+ ## Agent Matrix
16
+
17
+ | Agent | Canonical id | Adapter file | Expected behavior |
18
+ | --- | --- | --- | --- |
19
+ | OpenAI host adapter | `openai` | `agents/openai.yaml` | Provide interface metadata for OpenAI/Codex-compatible skill hosts; not a separate planning source. |
20
+ | Codex | `codex` | `agents/codex.yaml` | Read CodeSDD policy first, load FEAT context, use repository evidence, and preserve user changes. |
21
+ | Claude Code | `claude` | `agents/claude-code.yaml` | Read AGENTS/CLAUDE files, keep changes scoped, and report unavailable tools honestly. |
22
+ | Cursor | `cursor` | `agents/cursor.yaml` | Use repository-local context and avoid detached plans that bypass CodeSDD. |
23
+ | Gemini | `gemini` | `agents/gemini.yaml` | Prefer explicit references and validation commands over inferred NestJS or TypeORM APIs. |
24
+ | Kimi | `kimi` | `agents/kimi.yaml` | Treat markdown skill text as authoritative and produce compact, evidence-backed edits. |
25
+ | OpenCode | `opencode` | `agents/opencode.yaml` | Use `opencode` for local skill sync and `open-code` only when an MCP provider contract requires it. |
26
+ | Generic | `generic-markdown-cli` | none required | Read `SKILL.md`, then relevant references, then report evidence in CodeSDD quality artifacts. |
27
+
28
+ ## Evidence Expectations
29
+
30
+ Every agent must leave enough evidence for another agent to continue:
31
+
32
+ - files changed and why;
33
+ - selected derivation profile from `contract-pack.yaml`;
34
+ - Foundation source/layout evidence used;
35
+ - relevant DTAPI rule ids checked;
36
+ - validation commands run, skipped, or unavailable;
37
+ - residual drift, exception status, and ADR or follow-up FEAT references.
38
+
39
+ ## Isolation
40
+
41
+ `devtrack-api` governs backend/API layout and Foundation fidelity. It may publish API contracts or DTO expectations to frontend or mobile consumers, but it does not govern Angular page structure, UI-kit adapters, Formly schemas, NGXS state, Flutter widget layout, Flutter routing, Flutter localization, or frontend/mobile accessibility gates. Angular Admin belongs to `devtrack-angular`; Flutter/Dart app work belongs to `devtrack-flutter`.
@@ -32,10 +32,9 @@ src/infrastructure/adapters/orm/entities/<name>.orm-entity.ts
32
32
  src/infrastructure/adapters/orm/mappers/<name>.mapper.ts
33
33
  src/infrastructure/adapters/orm/repositories/<name>.typeorm-repository.ts
34
34
  src/infrastructure/adapters/orm/migrations/<timestamp>-<action>.migration.ts
35
- src/infrastructure/adapters/orm/<module>-orm.module.ts
35
+ src/infrastructure/adapters/orm/orm.module.ts
36
36
  src/infrastructure/adapters/orm/typeorm.config.ts
37
37
  src/infrastructure/adapters/orm/typeorm-cli.datasource.ts
38
- src/infrastructure/adapters/orm/typeorm.module.ts
39
38
  ```
40
39
 
41
40
  ## ORM Entities
@@ -128,7 +127,7 @@ Pattern:
128
127
  import { Injectable } from '@nestjs/common';
129
128
  import { InjectRepository } from '@nestjs/typeorm';
130
129
  import type { Repository } from 'typeorm';
131
- import type { ExampleRepositoryPort } from '@domain/example/repository-ports/example-repository.port';
130
+ import type { ExampleRepositoryPort } from '@application/business/example/ports/out/example-repository.port';
132
131
  import type { Example } from '@domain/example/business-objects/example.bo';
133
132
  import { DuplicateEntityException } from '@domain/exceptions/duplicate-entity.exception';
134
133
  import { GenericRepository } from '@infrastructure/adapter/orm/generic-repository';
@@ -181,14 +180,14 @@ Rules:
181
180
  - Do not leak `Repository`, `QueryRunner`, `DataSource`, or ORM entities through ports.
182
181
  - Keep transaction ownership explicit and aligned with existing repository/unit-of-work patterns.
183
182
 
184
- ## ORM Modules
183
+ ## ORM Module
185
184
 
186
185
  Pattern:
187
186
 
188
187
  ```ts
189
188
  import { Global, Module } from '@nestjs/common';
190
189
  import { TypeOrmModule } from '@nestjs/typeorm';
191
- import { ExampleRepositoryPortSymbol } from '@domain/example/repository-ports/example-repository.port';
190
+ import { ExampleRepositoryPortSymbol } from '@application/business/example/ports/out/example-repository.port';
192
191
  import { ExampleOrmEntity } from '@infrastructure/adapters/orm/entities/example.orm-entity';
193
192
  import { ExampleTypeOrmRepository } from '@infrastructure/adapters/orm/repositories/example.typeorm-repository';
194
193
 
@@ -204,10 +203,10 @@ import { ExampleTypeOrmRepository } from '@infrastructure/adapters/orm/repositor
204
203
  ],
205
204
  exports: [ExampleRepositoryPortSymbol],
206
205
  })
207
- export class ExamplesOrmModule {}
206
+ export class OrmModule {}
208
207
  ```
209
208
 
210
- Wire new ORM modules into `src/infrastructure/infrastructure.module.ts` when they must be available to the app.
209
+ The ORM subsystem must have one Nest module only: `src/infrastructure/adapters/orm/orm.module.ts`. Do not create `*-orm.module.ts` files per entity, context, or feature. Add every new `*.typeorm-repository.ts` provider to this module and export the repository provider and/or its application port token from this module.
211
210
 
212
211
  ## TypeORM Root Wiring
213
212
 
@@ -215,8 +214,7 @@ When adding a new ORM entity, update all relevant places:
215
214
 
216
215
  - `src/infrastructure/adapters/orm/typeorm.config.ts`
217
216
  - `src/infrastructure/adapters/orm/typeorm-cli.datasource.ts`
218
- - `src/infrastructure/adapters/orm/typeorm.module.ts`
219
- - new or existing `*-orm.module.ts`
217
+ - `src/infrastructure/adapters/orm/orm.module.ts`
220
218
  - `src/infrastructure/infrastructure.module.ts`
221
219
 
222
220
  Do not rely on glob entity discovery for new application entities unless the repo switches to that pattern.