@devtrack-solution/codesdd 1.2.3 → 1.2.4

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 (213) hide show
  1. package/.sdd/skills/curated/devtrack-api/SKILL.md +98 -12
  2. package/.sdd/skills/curated/devtrack-api/agents/claude-code.yaml +10 -0
  3. package/.sdd/skills/curated/devtrack-api/agents/codex.yaml +10 -0
  4. package/.sdd/skills/curated/devtrack-api/agents/cursor.yaml +10 -0
  5. package/.sdd/skills/curated/devtrack-api/agents/gemini.yaml +10 -0
  6. package/.sdd/skills/curated/devtrack-api/agents/kimi.yaml +10 -0
  7. package/.sdd/skills/curated/devtrack-api/agents/openai.yaml +5 -3
  8. package/.sdd/skills/curated/devtrack-api/agents/opencode.yaml +12 -0
  9. package/.sdd/skills/curated/devtrack-api/references/application-presentation.md +61 -5
  10. package/.sdd/skills/curated/devtrack-api/references/consumer-sync-policy.md +15 -3
  11. package/.sdd/skills/curated/devtrack-api/references/contract-pack.yaml +1951 -0
  12. package/.sdd/skills/curated/devtrack-api/references/domain-modeling.md +16 -14
  13. package/.sdd/skills/curated/devtrack-api/references/field-validation-protocol.md +40 -0
  14. package/.sdd/skills/curated/devtrack-api/references/foundation-layout.md +19 -2
  15. package/.sdd/skills/curated/devtrack-api/references/generated-artifact-invalidation.md +97 -0
  16. package/.sdd/skills/curated/devtrack-api/references/implementation-checklist.md +30 -1
  17. package/.sdd/skills/curated/devtrack-api/references/portable-agent-contract.md +42 -0
  18. package/.sdd/skills/curated/devtrack-api/references/testing-validation.md +22 -1
  19. package/.sdd/skills/curated/devtrack-api/references/typeorm-infrastructure.md +9 -7
  20. package/README.md +280 -29
  21. package/dist/applications/sdd/index.d.ts +16 -0
  22. package/dist/applications/sdd/index.js +16 -0
  23. package/dist/cli/program.js +180 -11
  24. package/dist/commands/config.js +197 -10
  25. package/dist/commands/sdd/execution.js +408 -16
  26. package/dist/commands/sdd/plugin.js +5 -0
  27. package/dist/commands/sdd/shared.d.ts +1 -0
  28. package/dist/commands/sdd/shared.js +10 -0
  29. package/dist/commands/sdd.js +157 -7
  30. package/dist/core/cli/command-matrix.d.ts +18 -0
  31. package/dist/core/cli/command-matrix.js +157 -0
  32. package/dist/core/cli-command-quality.js +11 -0
  33. package/dist/core/completions/command-registry.js +45 -0
  34. package/dist/core/config-schema.d.ts +31 -1
  35. package/dist/core/config-schema.js +79 -5
  36. package/dist/core/config.d.ts +1 -0
  37. package/dist/core/config.js +11 -0
  38. package/dist/core/global-config.d.ts +29 -0
  39. package/dist/core/init.d.ts +2 -2
  40. package/dist/core/init.js +13 -14
  41. package/dist/core/sdd/agent-binding.d.ts +19 -19
  42. package/dist/core/sdd/agent-runtime-contract.d.ts +204 -0
  43. package/dist/core/sdd/agent-runtime-contract.js +200 -0
  44. package/dist/core/sdd/allocator-recovery.d.ts +14 -0
  45. package/dist/core/sdd/allocator-recovery.js +30 -0
  46. package/dist/core/sdd/allocator-security.d.ts +18 -0
  47. package/dist/core/sdd/allocator-security.js +36 -0
  48. package/dist/core/sdd/api-foundation-baseline.d.ts +111 -0
  49. package/dist/core/sdd/api-foundation-baseline.js +151 -0
  50. package/dist/core/sdd/api-foundation-parity.d.ts +114 -0
  51. package/dist/core/sdd/api-foundation-parity.js +131 -0
  52. package/dist/core/sdd/api-profile-catalog.d.ts +36 -0
  53. package/dist/core/sdd/api-profile-catalog.js +132 -0
  54. package/dist/core/sdd/api-profile-dry-run-projection.d.ts +93 -0
  55. package/dist/core/sdd/api-profile-dry-run-projection.js +370 -0
  56. package/dist/core/sdd/api-profile-recipes.d.ts +82 -0
  57. package/dist/core/sdd/api-profile-recipes.js +484 -0
  58. package/dist/core/sdd/artifact-id-allocator.d.ts +368 -0
  59. package/dist/core/sdd/artifact-id-allocator.js +510 -0
  60. package/dist/core/sdd/check.d.ts +52 -1
  61. package/dist/core/sdd/check.js +326 -11
  62. package/dist/core/sdd/coordination/coordination-adapters.d.ts +15 -8
  63. package/dist/core/sdd/coordination/coordination-adapters.js +43 -15
  64. package/dist/core/sdd/coordination/index.d.ts +1 -0
  65. package/dist/core/sdd/coordination/index.js +1 -0
  66. package/dist/core/sdd/coordination/redis-runtime.d.ts +131 -0
  67. package/dist/core/sdd/coordination/redis-runtime.js +698 -0
  68. package/dist/core/sdd/deepagent-contracts.d.ts +99 -5
  69. package/dist/core/sdd/deepagent-contracts.js +62 -0
  70. package/dist/core/sdd/deepagents/reversa-subagents.d.ts +3 -3
  71. package/dist/core/sdd/default-bootstrap-files.d.ts +2 -2
  72. package/dist/core/sdd/default-bootstrap-files.js +14 -10
  73. package/dist/core/sdd/default-skills.js +115 -9
  74. package/dist/core/sdd/devtrack-api-appliance.d.ts +42 -1
  75. package/dist/core/sdd/devtrack-api-appliance.js +159 -32
  76. package/dist/core/sdd/devtrack-api-architecture.d.ts +16 -0
  77. package/dist/core/sdd/devtrack-api-architecture.js +86 -0
  78. package/dist/core/sdd/docs-sync.js +24 -18
  79. package/dist/core/sdd/domain/capability-diff.d.ts +63 -0
  80. package/dist/core/sdd/domain/capability-diff.js +200 -0
  81. package/dist/core/sdd/domain/change-safety-guardrails.d.ts +74 -0
  82. package/dist/core/sdd/domain/change-safety-guardrails.js +333 -0
  83. package/dist/core/sdd/domain/semantic-intent-classifier.d.ts +29 -0
  84. package/dist/core/sdd/domain/semantic-intent-classifier.js +117 -0
  85. package/dist/core/sdd/enterprise-mutating-command-gate.d.ts +27 -0
  86. package/dist/core/sdd/enterprise-mutating-command-gate.js +104 -0
  87. package/dist/core/sdd/enterprise-provenance-gates.d.ts +20 -0
  88. package/dist/core/sdd/enterprise-provenance-gates.js +63 -0
  89. package/dist/core/sdd/enterprise-provisioning-policy.d.ts +26 -0
  90. package/dist/core/sdd/enterprise-provisioning-policy.js +104 -0
  91. package/dist/core/sdd/foundation-artifact-map-validator.d.ts +16 -0
  92. package/dist/core/sdd/foundation-artifact-map-validator.js +71 -0
  93. package/dist/core/sdd/foundation-layer-manifest.d.ts +24 -0
  94. package/dist/core/sdd/foundation-layer-manifest.js +117 -0
  95. package/dist/core/sdd/governance-schemas.d.ts +2 -2
  96. package/dist/core/sdd/governance-schemas.js +11 -2
  97. package/dist/core/sdd/intent-guard.d.ts +22 -0
  98. package/dist/core/sdd/intent-guard.js +67 -0
  99. package/dist/core/sdd/json-schema.js +13 -1
  100. package/dist/core/sdd/legacy-operations.js +169 -5
  101. package/dist/core/sdd/migrate-workspace.js +39 -0
  102. package/dist/core/sdd/package-security-gates.d.ts +21 -0
  103. package/dist/core/sdd/package-security-gates.js +121 -0
  104. package/dist/core/sdd/package-structure-gate.d.ts +85 -3
  105. package/dist/core/sdd/package-structure-gate.js +384 -11
  106. package/dist/core/sdd/parallel-feat-automation.d.ts +185 -7
  107. package/dist/core/sdd/parallel-feat-automation.js +212 -0
  108. package/dist/core/sdd/plugin-broker.d.ts +223 -4
  109. package/dist/core/sdd/plugin-broker.js +10 -0
  110. package/dist/core/sdd/plugin-cli.d.ts +30 -0
  111. package/dist/core/sdd/plugin-cli.js +70 -3
  112. package/dist/core/sdd/plugin-evidence.d.ts +73 -0
  113. package/dist/core/sdd/plugin-manifest.d.ts +69 -1
  114. package/dist/core/sdd/plugin-manifest.js +10 -0
  115. package/dist/core/sdd/plugin-policy-pack.d.ts +1 -1
  116. package/dist/core/sdd/plugin-policy.js +6 -1
  117. package/dist/core/sdd/plugin-registry.d.ts +138 -2
  118. package/dist/core/sdd/plugin-sdk-contract.d.ts +363 -0
  119. package/dist/core/sdd/plugin-sdk-contract.js +268 -0
  120. package/dist/core/sdd/plugin-skill-binding.d.ts +1 -1
  121. package/dist/core/sdd/quality-validation.d.ts +89 -16
  122. package/dist/core/sdd/release-readiness.d.ts +68 -0
  123. package/dist/core/sdd/release-readiness.js +767 -0
  124. package/dist/core/sdd/reversa-architecture-extractor.d.ts +13 -0
  125. package/dist/core/sdd/reversa-architecture-extractor.js +89 -0
  126. package/dist/core/sdd/reversa-artifact-writer.d.ts +18 -0
  127. package/dist/core/sdd/reversa-artifact-writer.js +40 -0
  128. package/dist/core/sdd/reversa-command-policy.d.ts +136 -0
  129. package/dist/core/sdd/reversa-command-policy.js +361 -0
  130. package/dist/core/sdd/reversa-data-extractor.d.ts +11 -0
  131. package/dist/core/sdd/reversa-data-extractor.js +73 -0
  132. package/dist/core/sdd/reversa-equivalence.d.ts +20 -0
  133. package/dist/core/sdd/reversa-equivalence.js +34 -0
  134. package/dist/core/sdd/reversa-evidence.d.ts +298 -0
  135. package/dist/core/sdd/reversa-evidence.js +118 -0
  136. package/dist/core/sdd/reversa-reconstruction.d.ts +29 -0
  137. package/dist/core/sdd/reversa-reconstruction.js +32 -0
  138. package/dist/core/sdd/reversa-rules-extractor.d.ts +12 -0
  139. package/dist/core/sdd/reversa-rules-extractor.js +86 -0
  140. package/dist/core/sdd/reversa-source-safety.d.ts +19 -0
  141. package/dist/core/sdd/reversa-source-safety.js +105 -0
  142. package/dist/core/sdd/reversa-surface-scout.d.ts +13 -0
  143. package/dist/core/sdd/reversa-surface-scout.js +85 -0
  144. package/dist/core/sdd/reversa-ux-mapper.d.ts +11 -0
  145. package/dist/core/sdd/reversa-ux-mapper.js +73 -0
  146. package/dist/core/sdd/runtime-boundary-contract.d.ts +45 -0
  147. package/dist/core/sdd/runtime-boundary-contract.js +90 -0
  148. package/dist/core/sdd/sdk-agent-plugin-quality-gates.d.ts +150 -0
  149. package/dist/core/sdd/sdk-agent-plugin-quality-gates.js +258 -0
  150. package/dist/core/sdd/services/agent-run.service.d.ts +38 -6
  151. package/dist/core/sdd/services/agent-run.service.js +73 -1
  152. package/dist/core/sdd/services/archive-quality-coherence.service.d.ts +17 -0
  153. package/dist/core/sdd/services/archive-quality-coherence.service.js +141 -0
  154. package/dist/core/sdd/services/capability-diff.service.d.ts +18 -0
  155. package/dist/core/sdd/services/capability-diff.service.js +26 -0
  156. package/dist/core/sdd/services/change-safety-preflight.service.d.ts +17 -0
  157. package/dist/core/sdd/services/change-safety-preflight.service.js +17 -0
  158. package/dist/core/sdd/services/context.service.d.ts +43 -340
  159. package/dist/core/sdd/services/context.service.js +323 -9
  160. package/dist/core/sdd/services/decide.service.js +1 -1
  161. package/dist/core/sdd/services/finalize.service.d.ts +27 -0
  162. package/dist/core/sdd/services/finalize.service.js +226 -18
  163. package/dist/core/sdd/services/frontend-impact.service.d.ts +1 -1
  164. package/dist/core/sdd/services/historical-quality-regression.service.d.ts +35 -0
  165. package/dist/core/sdd/services/historical-quality-regression.service.js +228 -0
  166. package/dist/core/sdd/services/ingest-deposito.service.js +1 -1
  167. package/dist/core/sdd/services/planning-execution-coherence.service.d.ts +45 -0
  168. package/dist/core/sdd/services/planning-execution-coherence.service.js +225 -0
  169. package/dist/core/sdd/services/semantic-intent-classifier.service.d.ts +6 -0
  170. package/dist/core/sdd/services/semantic-intent-classifier.service.js +7 -0
  171. package/dist/core/sdd/state.d.ts +1 -0
  172. package/dist/core/sdd/state.js +266 -34
  173. package/dist/core/sdd/store/sdd-stores.js +2 -2
  174. package/dist/core/sdd/structural-health.d.ts +13 -13
  175. package/dist/core/sdd/types.d.ts +30 -15
  176. package/dist/core/sdd/types.js +4 -0
  177. package/dist/core/sdd/views.js +17 -0
  178. package/dist/core/sdd/workspace-schemas.d.ts +428 -7
  179. package/dist/core/sdd/workspace-schemas.js +223 -70
  180. package/dist/core/shared/skill-generation.d.ts +2 -0
  181. package/dist/core/shared/skill-generation.js +19 -2
  182. package/dist/core/shared/tool-detection.d.ts +19 -0
  183. package/dist/core/shared/tool-detection.js +89 -0
  184. package/dist/domains/sdd/index.d.ts +6 -0
  185. package/dist/domains/sdd/index.js +6 -0
  186. package/dist/infrastructures/sdd/index.d.ts +7 -0
  187. package/dist/infrastructures/sdd/index.js +6 -0
  188. package/dist/presentations/cli/sdd/index.d.ts +3 -0
  189. package/dist/presentations/cli/sdd/index.js +3 -0
  190. package/dist/shared/sdd/index.d.ts +3 -0
  191. package/dist/shared/sdd/index.js +2 -0
  192. package/package.json +14 -10
  193. package/schemas/sdd/2-plan.schema.json +207 -2
  194. package/schemas/sdd/5-quality.schema.json +324 -25
  195. package/schemas/sdd/agent-runtime-command-plan.schema.json +212 -0
  196. package/schemas/sdd/agent-runtime-opencode-run-evidence.schema.json +270 -0
  197. package/schemas/sdd/codesdd-plugin.schema.json +171 -0
  198. package/schemas/sdd/deepagent-run-request.schema.json +316 -0
  199. package/schemas/sdd/parallel-feat-automation-plan.schema.json +89 -0
  200. package/schemas/sdd/parallel-feat-scheduler-request.schema.json +116 -0
  201. package/schemas/sdd/parallel-feat-scheduler-result.schema.json +404 -0
  202. package/schemas/sdd/plugin-artifact-manifest.schema.json +109 -0
  203. package/schemas/sdd/plugin-artifact-map.schema.json +223 -0
  204. package/schemas/sdd/plugin-evidence-manifest.schema.json +109 -0
  205. package/schemas/sdd/plugin-language-runtime.schema.json +103 -0
  206. package/schemas/sdd/plugin-package-governance.schema.json +74 -0
  207. package/schemas/sdd/plugin-registry.schema.json +171 -0
  208. package/schemas/sdd/plugin-runtime-invocation-plan.schema.json +109 -0
  209. package/schemas/sdd/quality-evidence-bundle.schema.json +109 -0
  210. package/schemas/sdd/reversa-evidence-bundle.schema.json +466 -0
  211. package/schemas/sdd/sdk-agent-plugin-quality-gate-input.schema.json +168 -0
  212. package/schemas/sdd/sdk-agent-plugin-quality-gate-report.schema.json +160 -0
  213. package/schemas/sdd/workspace-catalog.schema.json +5298 -1409
@@ -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
 
@@ -202,7 +198,8 @@ export class Example
202
198
  Rules:
203
199
 
204
200
  - Extend `GenericBusinessObject<T>` when the object owns invariants.
205
- - Implement `IValidator` when following the canonical BO pattern.
201
+ - Implement the BO interface first and `IValidator` second: `implements <Name>Interface, IValidator`.
202
+ - Keep the class declaration ordered as `extends GenericBusinessObject<T>` before `implements ...`.
206
203
  - Validate before transform through `GenericBusinessObject` constructor behavior.
207
204
  - Normalize data in `loadData` or `transform`.
208
205
  - Expose read-only getters; clone arrays/objects/dates to avoid external mutation.
@@ -211,6 +208,7 @@ Rules:
211
208
  - Throw domain exceptions, usually `BusinessValidationException`, not HTTP exceptions.
212
209
  - Do not inject repositories, services, loggers, config, SDKs, or framework dependencies into domain objects.
213
210
  - Do not publish events, send messages, call providers, or persist data from the domain object directly.
211
+ - The observed `src/domain/auth/business-objects/api-keys.bo.ts` static utility is a named Foundation exception. Do not use it as the model for new aggregate BO files.
214
212
 
215
213
  ## Value Objects: `.vo.ts`
216
214
 
@@ -291,16 +289,18 @@ export class PessoaValidator {
291
289
  }
292
290
  ```
293
291
 
294
- Presentation validators must not replace domain validators. Presentation validates request shape; domain validates business invariants.
292
+ 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
293
 
296
294
  ## Repository Ports
297
295
 
298
- Repository ports belong in domain when they represent domain aggregate persistence:
296
+ For BO-pattern contexts, repository ports belong in application `ports/out`:
299
297
 
300
298
  ```text
301
- src/domain/<context>/repository-ports/<name>-repository.port.ts
299
+ src/application/business/<context>/ports/out/<name>-repository.port.ts
302
300
  ```
303
301
 
302
+ Domain `repository-ports/` exists only when extending the closed legacy entity-pattern contexts already present in Foundation (`pessoas`, `wallets`).
303
+
304
304
  Pattern:
305
305
 
306
306
  ```ts
@@ -319,17 +319,19 @@ Rules:
319
319
  - Export a `Symbol` and an interface.
320
320
  - Return domain objects, not ORM entities.
321
321
  - 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.
322
+ - For BO-pattern contexts, this port is an application outbound port even when it returns a domain BO.
323
+ - Do not expose query builders, transactions, connection objects, ORM entities, or provider SDK types through ports.
324
324
 
325
325
  ## Domain Events
326
326
 
327
- Use domain events for business facts:
327
+ Use domain events for business facts only when extending an existing entity-pattern context:
328
328
 
329
329
  ```text
330
330
  src/domain/<context>/events/<name>-created.event.ts
331
331
  ```
332
332
 
333
+ For BO-pattern contexts, emit integration or domain-like events from application handlers unless an ADR deliberately extends the pattern.
334
+
333
335
  Keep events serializable and framework-free:
334
336
 
335
337
  ```ts
@@ -93,3 +93,43 @@ CodeSDD may close the field-validation expectation only when:
93
93
  - the evidence remains in the consumer repository, with only a summary and reference retained here.
94
94
 
95
95
  If this evidence is not yet available, CodeSDD should keep a follow-up SDD item or formal exception instead of claiming field adoption is proven.
96
+
97
+ ## FEAT-0378 Consumer Evidence Summary
98
+
99
+ FEAT-0378 records the EPIC-0080 consumer-field validation boundary without importing private consumer ledgers into this repository.
100
+
101
+ Summary reference packet:
102
+
103
+ ```yaml
104
+ devtrack_api_field_validation_summary:
105
+ protocol: devtrack-api-field-validation-v1
106
+ feature_ref: FEAT-0378
107
+ governing_decision_ref: ADR-FEAT-0378
108
+ profile: foundation-compatible
109
+ codesdd_source_ref: FEAT-0378 active workspace
110
+ foundation_source_ref: devtrack-foundation-api audited projection via FEAT-0373 through FEAT-0376
111
+ sync_evidence_ref: consumer-sync-policy.md#feat-0378-consumer-evidence-sync-rule
112
+ private_ledger_boundary: consumer-held evidence only; do not copy ledgers into CodeSDD
113
+ consumer_evidence_refs:
114
+ - ref: consumer-owned-devtrack-api-deb-1
115
+ kind: approved_owner_reference
116
+ ledger_location: consumer CodeSDD quality ledger or handoff
117
+ status: accepted_exception
118
+ - ref: consumer-owned-devtrack-api-deb-2
119
+ kind: approved_owner_reference
120
+ ledger_location: consumer CodeSDD quality ledger or handoff
121
+ status: accepted_exception
122
+ divergence_matrix:
123
+ D-01: accepted_exception
124
+ D-02: accepted_exception
125
+ D-03: accepted_exception
126
+ D-04: accepted_exception
127
+ D-05: accepted_exception
128
+ D-06: accepted_exception
129
+ D-07: accepted_exception
130
+ D-08: accepted_exception
131
+ accepted_exception_ref: ADR-FEAT-0378
132
+ open_policy_findings: []
133
+ ```
134
+
135
+ The `accepted_exception` status above is a privacy-preserving governance closure, not a copy of consumer evidence. Operators must resolve each opaque `consumer-owned-*` reference in the consumer repository before using the packet to claim field adoption for that consumer. If either reference cannot be resolved, the consuming project remains blocked or excepted under its own CodeSDD quality ledger.
@@ -58,6 +58,18 @@ Folders forbidden in BO-pattern:
58
58
  - `events/` — emit domain events from application use cases, not domain artifacts, when the context is BO-pattern. Foundation emits events from application handlers.
59
59
  - `validators/` — present only in legacy entity-pattern; BO-pattern validates inside the BO (`validate()` method).
60
60
 
61
+ Canonical BO class shape for new aggregate/business objects:
62
+
63
+ ```text
64
+ export class <Name>
65
+ extends GenericBusinessObject<<Name>Type.Output>
66
+ implements <Name>Interface, IValidator
67
+ ```
68
+
69
+ Order matters: `extends GenericBusinessObject<T>` first, then `implements <Name>Interface, IValidator`. The BO interface declares read-only getters, behavior methods, and `toPersistenceObject()`. The class validates through `public validate(...)`, normalizes through `protected transform(...)` or `static loadData(...)`, exposes read-only getters, and returns domain persistence data from `toPersistenceObject()`.
70
+
71
+ Observed exception in the current Foundation tree: `src/domain/auth/business-objects/api-keys.bo.ts` is a static domain utility named `ApiKeysDomain`; do not use it as the template for new aggregate BOs.
72
+
61
73
  Contexts currently using BO-pattern in Foundation:
62
74
 
63
75
  | Context | Path | Notes |
@@ -206,13 +218,17 @@ src/infrastructure/adapters/orm/entities/<name>.orm-entity.ts
206
218
  src/infrastructure/adapters/orm/repositories/<name>.typeorm-repository.ts
207
219
  src/infrastructure/adapters/orm/mappers/<name>.mapper.ts
208
220
  src/infrastructure/adapters/orm/migrations/<timestamp>-<action>.migration.ts
221
+ src/infrastructure/adapters/orm/typeorm.module.ts
209
222
  src/infrastructure/adapters/orm/<context>-orm.module.ts
210
223
  src/infrastructure/adapters/orm/typeorm.config.ts
211
224
  src/infrastructure/adapters/orm/typeorm-cli.datasource.ts
212
- src/infrastructure/adapters/orm/typeorm.module.ts
213
225
  ```
214
226
 
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/`.
227
+ Observed ORM modules in Foundation: `auth-orm.module.ts`, `pessoas-orm.module.ts`, `sync-engine-orm.module.ts`, `typeorm.module.ts`, `wallets-orm.module.ts`.
228
+
229
+ `typeorm.module.ts` is the root TypeORM module. It calls `TypeOrmModule.forRootAsync`, references `typeorm.config.ts`, and registers base entities through `TypeOrmModule.forFeature`.
230
+
231
+ `<context>-orm.module.ts` files are context-level provider modules. They import `TypeOrmModule.forFeature([...])`, register concrete `*.typeorm-repository.ts` adapters, bind the owning repository/service port symbols with `useExisting`, and export those port symbols. Do **not** create entity-specific modules such as `category-entity-orm.module.ts` or any `src/infrastructure/<context>/persistence/typeorm/` tree.
216
232
 
217
233
  ### 5.2 Adapter ports (shared)
218
234
 
@@ -276,6 +292,7 @@ Aliases are mandatory in `src/` and tests. Same-folder relative imports are forb
276
292
  | `src/infrastructure/<context>/persistence/typeorm/` | `src/infrastructure/adapters/orm/` |
277
293
  | `src/infrastructure/<context>/adapters/` | `src/infrastructure/adapters/<subsystem>/` |
278
294
  | `src/infrastructure/<context>/repositories/` | `src/infrastructure/adapters/orm/repositories/` |
295
+ | `src/infrastructure/adapters/orm/<entity>-orm.module.ts` | `src/infrastructure/adapters/orm/<context>-orm.module.ts` |
279
296
  | `src/presentation/<context>/` (no transport) | `src/presentation/rest/<context>/` (or other transport) |
280
297
  | `entities/` in new domain context | `business-objects/` |
281
298
  | `repository-ports/` in new domain context | application `ports/out/<name>-repository.port.ts` |
@@ -0,0 +1,97 @@
1
+ # devtrack-api Generated Artifact Invalidation
2
+
3
+ ## Scope
4
+
5
+ This policy governs generated `devtrack-api` previews, scaffold dry-runs, caches, artifact maps, validation manifests, and evidence bundles created before the EPIC-0080 Foundation-compatible gates became active.
6
+
7
+ It applies to artifacts produced or consumed by:
8
+
9
+ - `codesdd sdd plugin devtrack-api scaffold-dry-run`;
10
+ - package-structure previews and `human_validation_gate` payloads;
11
+ - Foundation artifact maps and semantic validator results;
12
+ - generated evidence stored in `.sdd/plugin-evidence/`, `.sdd/active/`, `.sdd/archived/`, `outputs/`, or disposable `~/.codesdd/cache` entries.
13
+
14
+ ## Default Rule
15
+
16
+ Pre-charter generated artifacts are noncanonical by default. They are evidence only until revalidated against the active `foundation-compatible` contract.
17
+
18
+ An artifact must not be treated as Foundation-compatible when it lacks any of the following:
19
+
20
+ - selected derivation profile;
21
+ - artifact-map validation result;
22
+ - package preview material signature;
23
+ - `human_validation_gate.status` using only `approved`, `corrected`, `pending`, or `rejected`;
24
+ - semantic validator profile outcome for `foundation-compatible`;
25
+ - sync evidence for the `devtrack-api` skill copy when the artifact came from a consumer repository;
26
+ - D-01 through D-08 field-validation summary or formal exception when the artifact claims consumer adoption.
27
+
28
+ ## Classification
29
+
30
+ Use exactly one classification per generated artifact:
31
+
32
+ | Classification | Meaning | Required action |
33
+ | --- | --- | --- |
34
+ | `revalidated` | The artifact was regenerated or checked against the active contract and passed the applicable profile gates. | Record command, profile, validator output, material signature, and approval state in the owning FEAT quality ledger. |
35
+ | `invalidated` | The artifact predates active gates, fails P0 validation, has stale approval, or cannot be traced to current sources. | Mark noncanonical, exclude from Foundation-compatible claims, and regenerate before use. |
36
+ | `grandfathered` | The artifact remains useful as historical evidence but is not used as an executable or compatibility claim. | Record owner, scope, reason, review deadline, rollback trigger, and governing ADR/FEAT quality entry. |
37
+ | `not_applicable` | The artifact is unrelated to `devtrack-api` generated output or is disposable cache without governance value. | Keep disposable or ignore; do not promote to CodeSDD state. |
38
+
39
+ ## Revalidation Procedure
40
+
41
+ Before reusing a legacy generated artifact:
42
+
43
+ 1. Identify the artifact owner, path, generator command, source commit or release, selected profile, and creation time when available.
44
+ 2. Re-run the active non-mutating generator or validator for the same intent.
45
+ 3. Compare the current artifact map and preview material signature with the legacy artifact.
46
+ 4. Run semantic validation for the selected profile.
47
+ 5. Reset any prior `approved` or `corrected` `human_validation_gate.status` to `pending` when source material, profile, exception refs, artifact map, preview structure, or validator scope changed.
48
+ 6. Record the classification in the owning FEAT quality ledger.
49
+
50
+ Minimum validation commands:
51
+
52
+ ```bash
53
+ codesdd sdd plugin devtrack-api scaffold-dry-run
54
+ codesdd sdd check --render
55
+ codesdd sdd diagnose --json
56
+ ```
57
+
58
+ When source code or TypeScript validator contracts changed, also run the targeted validator tests:
59
+
60
+ ```bash
61
+ pnpm exec vitest run test/core/sdd/devtrack-api-appliance.test.ts test/core/sdd/foundation-artifact-map-validator.test.ts test/core/sdd/package-structure-gate.test.ts test/core/sdd/devtrack-api-architecture.test.ts
62
+ ```
63
+
64
+ ## Invalidation Triggers
65
+
66
+ Invalidate or reset approval for a generated artifact when any trigger applies:
67
+
68
+ - artifact predates `ADR-FEAT-0373`;
69
+ - artifact predates artifact-map gate evidence from `ADR-FEAT-0374`;
70
+ - package preview lacks the FEAT-0375 material signature or Foundation `tests/` projection;
71
+ - semantic validator output lacks FEAT-0376 drift classes or profile outcomes;
72
+ - consumer field-validation references changed after `ADR-FEAT-0378`;
73
+ - artifact uses plural CodeSDD roots as `devtrack-api` output;
74
+ - artifact uses forbidden Foundation alias shapes or omits `@tests/*`;
75
+ - artifact lacks provenance for source refs, decision refs, profile, or exception refs;
76
+ - disposable cache cannot be tied to the current project fingerprint.
77
+
78
+ ## Grandfathering Rule
79
+
80
+ Grandfathering never means compatible. It means the artifact remains useful for history, comparison, or rollback only.
81
+
82
+ A grandfathered artifact must record:
83
+
84
+ - owner;
85
+ - artifact path or opaque reference;
86
+ - reason;
87
+ - accepted risk;
88
+ - compensating control;
89
+ - review deadline;
90
+ - rollback trigger;
91
+ - governing ADR, DEB, or FEAT quality entry.
92
+
93
+ ## Closure Rule
94
+
95
+ EPIC-0080 closure may cite legacy generated artifacts only when every cited artifact is `revalidated`, `invalidated`, `grandfathered`, or `not_applicable`.
96
+
97
+ Any uncategorized legacy artifact blocks the compatibility claim it supports. Disposable cache may be ignored only when it is not referenced by a FEAT quality ledger, ADR, preview, artifact map, validator result, or consumer evidence summary.
@@ -20,6 +20,22 @@
20
20
  - Keep the scope narrow; do not repair unrelated architecture unless it blocks the requested work.
21
21
  - Prefer local patterns over generic best practices when both are valid.
22
22
 
23
+ ## Tool-Level API Baseline Pass
24
+
25
+ - For API, backend, scaffold, CRUD, or route work, infer the minimum operational API baseline unless the user explicitly selected a prototype/docs-only exception.
26
+ - The plan asks whether authentication is required and which mechanism applies: JWT bearer, API key, session, machine-to-machine credential, or public route.
27
+ - The plan asks whether authorization is required and which role, permission, policy, ownership, or tenancy rule applies.
28
+ - Public routes are explicitly named; lack of auth/authz discussion is not treated as public by default.
29
+ - New API projects/scaffolds include `package.json`, `.env.example`, `tsconfig.json`, Nest CLI config, lint/test config, and validation commands.
30
+ - Root scripts include build, start, development start, production start, lint, unit tests, coverage, e2e tests, and migrations when persistent schema changes exist.
31
+ - Root scripts include `cleanup` and `cleanup:install`; cleanup removes dependency installs, build output, caches, lockfiles, and TypeScript compilation residue unless an ADR preserves a canonical lockfile.
32
+ - `start` and `start:dev` invoke `node scripts/kill-port.js` before Nest starts and continue after terminating any process bound to the configured port.
33
+ - Scripts can be invoked with `npm run` and `pnpm run`; nested package-script calls use `npm run` and `npm install` so Docker builds do not need pnpm by default.
34
+ - `.env.example` uses placeholders for new variables and includes Swagger server settings when OpenAPI is configured.
35
+ - REST APIs include root Swagger/OpenAPI bootstrap with `DocumentBuilder`, `SwaggerModule.createDocument`, and `SwaggerModule.setup("docs", app, document)`.
36
+ - Each user-facing route has an application input port plus use case before controller wiring is considered complete.
37
+ - Protected routes include route guards/decorators and Swagger security documentation.
38
+
23
39
  ## Design Slice
24
40
 
25
41
  - Identify touched layers.
@@ -29,6 +45,7 @@
29
45
  - Decide whether persistence needs a domain repository port or an application output port.
30
46
  - Decide whether a public endpoint is appropriate. Internal AWS lifecycle work should not get public endpoints.
31
47
  - Decide whether the change affects API contracts, migrations, environment variables, queues, LLM tools, prompts, or security-sensitive behavior.
48
+ - For each route, name the input port, use case, controller/transport, request DTO/presentation validator, response DTO when applicable, guard/decorator, and Swagger operation/response docs.
32
49
 
33
50
  ## Domain Pass
34
51
 
@@ -78,7 +95,7 @@
78
95
  - Mapper ends with `.mapper.ts`.
79
96
  - Repository implements a port.
80
97
  - 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.
98
+ - New entity is added to TypeORM config, CLI datasource, `typeorm.module.ts`, the owning `<context>-orm.module.ts`, and infrastructure module as needed.
82
99
  - Migration SQL matches entity decorators.
83
100
  - Unique violations are translated to domain/shared exceptions.
84
101
  - No Prisma artifacts.
@@ -98,12 +115,24 @@
98
115
  - No unhandled promises.
99
116
  - No broad lint disables without a narrow reason.
100
117
 
118
+ ## Root Package And Runtime Pass
119
+
120
+ - `package.json` contains scripts needed to build, run, lint, test, collect coverage, run e2e, cleanup, cleanup:install, and execute migrations when applicable.
121
+ - `scripts/cleanup.sh` removes dependency installs, build outputs, caches, lockfiles, and compilation residue unless a FEAT/ADR records a narrower cleanup contract.
122
+ - `scripts/kill-port.js` supports explicit script arguments and `PORT`/`APP_PORT`, covers Unix and Windows termination paths, and is wired before `start` and `start:dev`.
123
+ - Script composition uses `npm run` and `npm install` internally so `npm` and `pnpm` entrypoints remain valid without requiring pnpm in Docker.
124
+ - `package.json` includes `@nestjs/swagger` for REST APIs with OpenAPI docs.
125
+ - `.env.example` exists and documents every new runtime variable with safe placeholder values.
126
+ - `src/main.ts` wires global validation and Swagger/OpenAPI when REST is present.
127
+ - Runtime configuration reads Swagger server settings through typed config instead of hard-coded secrets or deployment URLs.
128
+
101
129
  ## Security And Data Pass
102
130
 
103
131
  - No secrets, tokens, private keys, cookies, credentials, or connection strings are added to code, tests, docs, logs, prompts, or handoff.
104
132
  - `.env.example` is updated when variable names change; `.env` real values are not copied.
105
133
  - Logs avoid sensitive payloads, raw prompts, full provider responses, and personal data unless existing policy allows it.
106
134
  - Auth, authorization, tenancy, encryption, PII, retention, and audit behavior are unchanged unless the task requires it.
135
+ - Auth/authz planning decisions are not left pending for new routes; protected routes have guards/decorators and public routes have explicit exceptions.
107
136
  - Destructive operations are not executed unless explicitly requested and scoped.
108
137
  - Public endpoints do not expose internal lifecycle envelopes or infrastructure payloads.
109
138
 
@@ -0,0 +1,42 @@
1
+ # Portable Agent Contract
2
+
3
+ Use this reference when adapting the CodeSDD API profile family through the `devtrack-api` compatibility skill 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 compatibility trigger surface; keep `name: devtrack-api`, but public API work should name one of `minimal-rest`, `rest-auth-rbac`, `rest-crud-typeorm`, `evented-api`, `ai-agent-api`, or `full-foundation-compatible`.
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
+ - `devtrack-api` is a compatibility-only alias and must not be presented as the normal public profile for new API projects.
11
+ - CodeSDD state remains canonical for planning, quality, and finalize evidence.
12
+ - `devtrack-foundation-api` source and the Foundation layout reference win over generated assumptions.
13
+ - Do not persist hidden memory or parallel backlog outside `.sdd`.
14
+ - If the host cannot read `agents/*.yaml`, it must still be able to follow `SKILL.md` and this reference.
15
+
16
+ ## Agent Matrix
17
+
18
+ | Agent | Canonical id | Adapter file | Expected behavior |
19
+ | --- | --- | --- | --- |
20
+ | OpenAI host adapter | `openai` | `agents/openai.yaml` | Provide interface metadata for OpenAI/Codex-compatible skill hosts; not a separate planning source. |
21
+ | Codex | `codex` | `agents/codex.yaml` | Read CodeSDD policy first, load FEAT context, use repository evidence, and preserve user changes. |
22
+ | Claude Code | `claude` | `agents/claude-code.yaml` | Read AGENTS/CLAUDE files, keep changes scoped, and report unavailable tools honestly. |
23
+ | Cursor | `cursor` | `agents/cursor.yaml` | Use repository-local context and avoid detached plans that bypass CodeSDD. |
24
+ | Gemini | `gemini` | `agents/gemini.yaml` | Prefer explicit references and validation commands over inferred NestJS or TypeORM APIs. |
25
+ | Kimi | `kimi` | `agents/kimi.yaml` | Treat markdown skill text as authoritative and produce compact, evidence-backed edits. |
26
+ | OpenCode | `opencode` | `agents/opencode.yaml` | Use `opencode` for local skill sync and `open-code` only when an MCP provider contract requires it. |
27
+ | Generic | `generic-markdown-cli` | none required | Read `SKILL.md`, then relevant references, then report evidence in CodeSDD quality artifacts. |
28
+
29
+ ## Evidence Expectations
30
+
31
+ Every agent must leave enough evidence for another agent to continue:
32
+
33
+ - files changed and why;
34
+ - selected CodeSDD API profile id and selected derivation governance profile from `contract-pack.yaml`;
35
+ - Foundation source/layout evidence used;
36
+ - relevant DTAPI rule ids checked;
37
+ - validation commands run, skipped, or unavailable;
38
+ - residual drift, exception status, and ADR or follow-up FEAT references.
39
+
40
+ ## Isolation
41
+
42
+ `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`.
@@ -28,10 +28,31 @@ pnpm migration:show
28
28
  pnpm migration:run
29
29
  ```
30
30
 
31
- Use `pnpm` because the repo is configured around it.
31
+ Use `pnpm` for this CodeSDD repository because the repo is configured around it.
32
32
 
33
33
  Before using a script for a version-sensitive claim, confirm it exists in `package.json`.
34
34
 
35
+ For generated or linked DevTrack API projects, package scripts must also be
36
+ valid through `npm run`. When runtime scripts are touched, validate or inspect
37
+ both entrypoints:
38
+
39
+ ```bash
40
+ npm run build
41
+ npm run start -- --help
42
+ npm run start:dev -- --help
43
+ npm run cleanup
44
+ npm run cleanup:install
45
+ pnpm run build
46
+ pnpm run start:dev -- --help
47
+ ```
48
+
49
+ Generated package-script composition must use `npm run` and `npm install`
50
+ internally so Docker images do not require pnpm by default. `start` and
51
+ `start:dev` must run `node scripts/kill-port.js` before Nest starts, and
52
+ `cleanup` must remove dependency installs, build outputs, caches, lockfiles,
53
+ and TypeScript compilation residue unless a FEAT/ADR records a narrower
54
+ cleanup contract.
55
+
35
56
  ## Test Selection
36
57
 
37
58
  Choose the smallest useful validation:
@@ -32,12 +32,14 @@ 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/typeorm.module.ts
36
+ src/infrastructure/adapters/orm/<context>-orm.module.ts
36
37
  src/infrastructure/adapters/orm/typeorm.config.ts
37
38
  src/infrastructure/adapters/orm/typeorm-cli.datasource.ts
38
- src/infrastructure/adapters/orm/typeorm.module.ts
39
39
  ```
40
40
 
41
+ Observed ORM modules in Foundation: `auth-orm.module.ts`, `pessoas-orm.module.ts`, `sync-engine-orm.module.ts`, `typeorm.module.ts`, `wallets-orm.module.ts`.
42
+
41
43
  ## ORM Entities
42
44
 
43
45
  Pattern:
@@ -128,7 +130,7 @@ Pattern:
128
130
  import { Injectable } from '@nestjs/common';
129
131
  import { InjectRepository } from '@nestjs/typeorm';
130
132
  import type { Repository } from 'typeorm';
131
- import type { ExampleRepositoryPort } from '@domain/example/repository-ports/example-repository.port';
133
+ import type { ExampleRepositoryPort } from '@application/business/example/ports/out/example-repository.port';
132
134
  import type { Example } from '@domain/example/business-objects/example.bo';
133
135
  import { DuplicateEntityException } from '@domain/exceptions/duplicate-entity.exception';
134
136
  import { GenericRepository } from '@infrastructure/adapter/orm/generic-repository';
@@ -188,7 +190,7 @@ Pattern:
188
190
  ```ts
189
191
  import { Global, Module } from '@nestjs/common';
190
192
  import { TypeOrmModule } from '@nestjs/typeorm';
191
- import { ExampleRepositoryPortSymbol } from '@domain/example/repository-ports/example-repository.port';
193
+ import { ExampleRepositoryPortSymbol } from '@application/business/example/ports/out/example-repository.port';
192
194
  import { ExampleOrmEntity } from '@infrastructure/adapters/orm/entities/example.orm-entity';
193
195
  import { ExampleTypeOrmRepository } from '@infrastructure/adapters/orm/repositories/example.typeorm-repository';
194
196
 
@@ -204,10 +206,10 @@ import { ExampleTypeOrmRepository } from '@infrastructure/adapters/orm/repositor
204
206
  ],
205
207
  exports: [ExampleRepositoryPortSymbol],
206
208
  })
207
- export class ExamplesOrmModule {}
209
+ export class ExampleOrmModule {}
208
210
  ```
209
211
 
210
- Wire new ORM modules into `src/infrastructure/infrastructure.module.ts` when they must be available to the app.
212
+ Foundation uses `src/infrastructure/adapters/orm/typeorm.module.ts` for root TypeORM configuration and `src/infrastructure/adapters/orm/<context>-orm.module.ts` for repository provider modules. Add a new context module when a new persisted context introduces repositories. Do not create per-entity modules; module ownership is by context.
211
213
 
212
214
  ## TypeORM Root Wiring
213
215
 
@@ -216,7 +218,7 @@ When adding a new ORM entity, update all relevant places:
216
218
  - `src/infrastructure/adapters/orm/typeorm.config.ts`
217
219
  - `src/infrastructure/adapters/orm/typeorm-cli.datasource.ts`
218
220
  - `src/infrastructure/adapters/orm/typeorm.module.ts`
219
- - new or existing `*-orm.module.ts`
221
+ - `src/infrastructure/adapters/orm/<context>-orm.module.ts`
220
222
  - `src/infrastructure/infrastructure.module.ts`
221
223
 
222
224
  Do not rely on glob entity discovery for new application entities unless the repo switches to that pattern.