@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.
- package/.sdd/skills/curated/devtrack-api/SKILL.md +98 -12
- package/.sdd/skills/curated/devtrack-api/agents/claude-code.yaml +10 -0
- package/.sdd/skills/curated/devtrack-api/agents/codex.yaml +10 -0
- package/.sdd/skills/curated/devtrack-api/agents/cursor.yaml +10 -0
- package/.sdd/skills/curated/devtrack-api/agents/gemini.yaml +10 -0
- package/.sdd/skills/curated/devtrack-api/agents/kimi.yaml +10 -0
- package/.sdd/skills/curated/devtrack-api/agents/openai.yaml +5 -3
- package/.sdd/skills/curated/devtrack-api/agents/opencode.yaml +12 -0
- package/.sdd/skills/curated/devtrack-api/references/application-presentation.md +61 -5
- package/.sdd/skills/curated/devtrack-api/references/consumer-sync-policy.md +15 -3
- package/.sdd/skills/curated/devtrack-api/references/contract-pack.yaml +1951 -0
- package/.sdd/skills/curated/devtrack-api/references/domain-modeling.md +16 -14
- package/.sdd/skills/curated/devtrack-api/references/field-validation-protocol.md +40 -0
- package/.sdd/skills/curated/devtrack-api/references/foundation-layout.md +19 -2
- package/.sdd/skills/curated/devtrack-api/references/generated-artifact-invalidation.md +97 -0
- package/.sdd/skills/curated/devtrack-api/references/implementation-checklist.md +30 -1
- package/.sdd/skills/curated/devtrack-api/references/portable-agent-contract.md +42 -0
- package/.sdd/skills/curated/devtrack-api/references/testing-validation.md +22 -1
- package/.sdd/skills/curated/devtrack-api/references/typeorm-infrastructure.md +9 -7
- package/README.md +280 -29
- package/dist/applications/sdd/index.d.ts +16 -0
- package/dist/applications/sdd/index.js +16 -0
- package/dist/cli/program.js +180 -11
- package/dist/commands/config.js +197 -10
- package/dist/commands/sdd/execution.js +408 -16
- package/dist/commands/sdd/plugin.js +5 -0
- package/dist/commands/sdd/shared.d.ts +1 -0
- package/dist/commands/sdd/shared.js +10 -0
- package/dist/commands/sdd.js +157 -7
- package/dist/core/cli/command-matrix.d.ts +18 -0
- package/dist/core/cli/command-matrix.js +157 -0
- package/dist/core/cli-command-quality.js +11 -0
- package/dist/core/completions/command-registry.js +45 -0
- package/dist/core/config-schema.d.ts +31 -1
- package/dist/core/config-schema.js +79 -5
- package/dist/core/config.d.ts +1 -0
- package/dist/core/config.js +11 -0
- package/dist/core/global-config.d.ts +29 -0
- package/dist/core/init.d.ts +2 -2
- package/dist/core/init.js +13 -14
- package/dist/core/sdd/agent-binding.d.ts +19 -19
- package/dist/core/sdd/agent-runtime-contract.d.ts +204 -0
- package/dist/core/sdd/agent-runtime-contract.js +200 -0
- package/dist/core/sdd/allocator-recovery.d.ts +14 -0
- package/dist/core/sdd/allocator-recovery.js +30 -0
- package/dist/core/sdd/allocator-security.d.ts +18 -0
- package/dist/core/sdd/allocator-security.js +36 -0
- package/dist/core/sdd/api-foundation-baseline.d.ts +111 -0
- package/dist/core/sdd/api-foundation-baseline.js +151 -0
- package/dist/core/sdd/api-foundation-parity.d.ts +114 -0
- package/dist/core/sdd/api-foundation-parity.js +131 -0
- package/dist/core/sdd/api-profile-catalog.d.ts +36 -0
- package/dist/core/sdd/api-profile-catalog.js +132 -0
- package/dist/core/sdd/api-profile-dry-run-projection.d.ts +93 -0
- package/dist/core/sdd/api-profile-dry-run-projection.js +370 -0
- package/dist/core/sdd/api-profile-recipes.d.ts +82 -0
- package/dist/core/sdd/api-profile-recipes.js +484 -0
- package/dist/core/sdd/artifact-id-allocator.d.ts +368 -0
- package/dist/core/sdd/artifact-id-allocator.js +510 -0
- package/dist/core/sdd/check.d.ts +52 -1
- package/dist/core/sdd/check.js +326 -11
- package/dist/core/sdd/coordination/coordination-adapters.d.ts +15 -8
- package/dist/core/sdd/coordination/coordination-adapters.js +43 -15
- package/dist/core/sdd/coordination/index.d.ts +1 -0
- package/dist/core/sdd/coordination/index.js +1 -0
- package/dist/core/sdd/coordination/redis-runtime.d.ts +131 -0
- package/dist/core/sdd/coordination/redis-runtime.js +698 -0
- package/dist/core/sdd/deepagent-contracts.d.ts +99 -5
- package/dist/core/sdd/deepagent-contracts.js +62 -0
- package/dist/core/sdd/deepagents/reversa-subagents.d.ts +3 -3
- package/dist/core/sdd/default-bootstrap-files.d.ts +2 -2
- package/dist/core/sdd/default-bootstrap-files.js +14 -10
- package/dist/core/sdd/default-skills.js +115 -9
- package/dist/core/sdd/devtrack-api-appliance.d.ts +42 -1
- package/dist/core/sdd/devtrack-api-appliance.js +159 -32
- package/dist/core/sdd/devtrack-api-architecture.d.ts +16 -0
- package/dist/core/sdd/devtrack-api-architecture.js +86 -0
- package/dist/core/sdd/docs-sync.js +24 -18
- package/dist/core/sdd/domain/capability-diff.d.ts +63 -0
- package/dist/core/sdd/domain/capability-diff.js +200 -0
- package/dist/core/sdd/domain/change-safety-guardrails.d.ts +74 -0
- package/dist/core/sdd/domain/change-safety-guardrails.js +333 -0
- package/dist/core/sdd/domain/semantic-intent-classifier.d.ts +29 -0
- package/dist/core/sdd/domain/semantic-intent-classifier.js +117 -0
- package/dist/core/sdd/enterprise-mutating-command-gate.d.ts +27 -0
- package/dist/core/sdd/enterprise-mutating-command-gate.js +104 -0
- package/dist/core/sdd/enterprise-provenance-gates.d.ts +20 -0
- package/dist/core/sdd/enterprise-provenance-gates.js +63 -0
- package/dist/core/sdd/enterprise-provisioning-policy.d.ts +26 -0
- package/dist/core/sdd/enterprise-provisioning-policy.js +104 -0
- package/dist/core/sdd/foundation-artifact-map-validator.d.ts +16 -0
- package/dist/core/sdd/foundation-artifact-map-validator.js +71 -0
- package/dist/core/sdd/foundation-layer-manifest.d.ts +24 -0
- package/dist/core/sdd/foundation-layer-manifest.js +117 -0
- package/dist/core/sdd/governance-schemas.d.ts +2 -2
- package/dist/core/sdd/governance-schemas.js +11 -2
- package/dist/core/sdd/intent-guard.d.ts +22 -0
- package/dist/core/sdd/intent-guard.js +67 -0
- package/dist/core/sdd/json-schema.js +13 -1
- package/dist/core/sdd/legacy-operations.js +169 -5
- package/dist/core/sdd/migrate-workspace.js +39 -0
- package/dist/core/sdd/package-security-gates.d.ts +21 -0
- package/dist/core/sdd/package-security-gates.js +121 -0
- package/dist/core/sdd/package-structure-gate.d.ts +85 -3
- package/dist/core/sdd/package-structure-gate.js +384 -11
- package/dist/core/sdd/parallel-feat-automation.d.ts +185 -7
- package/dist/core/sdd/parallel-feat-automation.js +212 -0
- package/dist/core/sdd/plugin-broker.d.ts +223 -4
- package/dist/core/sdd/plugin-broker.js +10 -0
- package/dist/core/sdd/plugin-cli.d.ts +30 -0
- package/dist/core/sdd/plugin-cli.js +70 -3
- package/dist/core/sdd/plugin-evidence.d.ts +73 -0
- package/dist/core/sdd/plugin-manifest.d.ts +69 -1
- package/dist/core/sdd/plugin-manifest.js +10 -0
- package/dist/core/sdd/plugin-policy-pack.d.ts +1 -1
- package/dist/core/sdd/plugin-policy.js +6 -1
- package/dist/core/sdd/plugin-registry.d.ts +138 -2
- package/dist/core/sdd/plugin-sdk-contract.d.ts +363 -0
- package/dist/core/sdd/plugin-sdk-contract.js +268 -0
- package/dist/core/sdd/plugin-skill-binding.d.ts +1 -1
- package/dist/core/sdd/quality-validation.d.ts +89 -16
- package/dist/core/sdd/release-readiness.d.ts +68 -0
- package/dist/core/sdd/release-readiness.js +767 -0
- package/dist/core/sdd/reversa-architecture-extractor.d.ts +13 -0
- package/dist/core/sdd/reversa-architecture-extractor.js +89 -0
- package/dist/core/sdd/reversa-artifact-writer.d.ts +18 -0
- package/dist/core/sdd/reversa-artifact-writer.js +40 -0
- package/dist/core/sdd/reversa-command-policy.d.ts +136 -0
- package/dist/core/sdd/reversa-command-policy.js +361 -0
- package/dist/core/sdd/reversa-data-extractor.d.ts +11 -0
- package/dist/core/sdd/reversa-data-extractor.js +73 -0
- package/dist/core/sdd/reversa-equivalence.d.ts +20 -0
- package/dist/core/sdd/reversa-equivalence.js +34 -0
- package/dist/core/sdd/reversa-evidence.d.ts +298 -0
- package/dist/core/sdd/reversa-evidence.js +118 -0
- package/dist/core/sdd/reversa-reconstruction.d.ts +29 -0
- package/dist/core/sdd/reversa-reconstruction.js +32 -0
- package/dist/core/sdd/reversa-rules-extractor.d.ts +12 -0
- package/dist/core/sdd/reversa-rules-extractor.js +86 -0
- package/dist/core/sdd/reversa-source-safety.d.ts +19 -0
- package/dist/core/sdd/reversa-source-safety.js +105 -0
- package/dist/core/sdd/reversa-surface-scout.d.ts +13 -0
- package/dist/core/sdd/reversa-surface-scout.js +85 -0
- package/dist/core/sdd/reversa-ux-mapper.d.ts +11 -0
- package/dist/core/sdd/reversa-ux-mapper.js +73 -0
- package/dist/core/sdd/runtime-boundary-contract.d.ts +45 -0
- package/dist/core/sdd/runtime-boundary-contract.js +90 -0
- package/dist/core/sdd/sdk-agent-plugin-quality-gates.d.ts +150 -0
- package/dist/core/sdd/sdk-agent-plugin-quality-gates.js +258 -0
- package/dist/core/sdd/services/agent-run.service.d.ts +38 -6
- package/dist/core/sdd/services/agent-run.service.js +73 -1
- package/dist/core/sdd/services/archive-quality-coherence.service.d.ts +17 -0
- package/dist/core/sdd/services/archive-quality-coherence.service.js +141 -0
- package/dist/core/sdd/services/capability-diff.service.d.ts +18 -0
- package/dist/core/sdd/services/capability-diff.service.js +26 -0
- package/dist/core/sdd/services/change-safety-preflight.service.d.ts +17 -0
- package/dist/core/sdd/services/change-safety-preflight.service.js +17 -0
- package/dist/core/sdd/services/context.service.d.ts +43 -340
- package/dist/core/sdd/services/context.service.js +323 -9
- package/dist/core/sdd/services/decide.service.js +1 -1
- package/dist/core/sdd/services/finalize.service.d.ts +27 -0
- package/dist/core/sdd/services/finalize.service.js +226 -18
- package/dist/core/sdd/services/frontend-impact.service.d.ts +1 -1
- package/dist/core/sdd/services/historical-quality-regression.service.d.ts +35 -0
- package/dist/core/sdd/services/historical-quality-regression.service.js +228 -0
- package/dist/core/sdd/services/ingest-deposito.service.js +1 -1
- package/dist/core/sdd/services/planning-execution-coherence.service.d.ts +45 -0
- package/dist/core/sdd/services/planning-execution-coherence.service.js +225 -0
- package/dist/core/sdd/services/semantic-intent-classifier.service.d.ts +6 -0
- package/dist/core/sdd/services/semantic-intent-classifier.service.js +7 -0
- package/dist/core/sdd/state.d.ts +1 -0
- package/dist/core/sdd/state.js +266 -34
- package/dist/core/sdd/store/sdd-stores.js +2 -2
- package/dist/core/sdd/structural-health.d.ts +13 -13
- package/dist/core/sdd/types.d.ts +30 -15
- package/dist/core/sdd/types.js +4 -0
- package/dist/core/sdd/views.js +17 -0
- package/dist/core/sdd/workspace-schemas.d.ts +428 -7
- package/dist/core/sdd/workspace-schemas.js +223 -70
- package/dist/core/shared/skill-generation.d.ts +2 -0
- package/dist/core/shared/skill-generation.js +19 -2
- package/dist/core/shared/tool-detection.d.ts +19 -0
- package/dist/core/shared/tool-detection.js +89 -0
- package/dist/domains/sdd/index.d.ts +6 -0
- package/dist/domains/sdd/index.js +6 -0
- package/dist/infrastructures/sdd/index.d.ts +7 -0
- package/dist/infrastructures/sdd/index.js +6 -0
- package/dist/presentations/cli/sdd/index.d.ts +3 -0
- package/dist/presentations/cli/sdd/index.js +3 -0
- package/dist/shared/sdd/index.d.ts +3 -0
- package/dist/shared/sdd/index.js +2 -0
- package/package.json +14 -10
- package/schemas/sdd/2-plan.schema.json +207 -2
- package/schemas/sdd/5-quality.schema.json +324 -25
- package/schemas/sdd/agent-runtime-command-plan.schema.json +212 -0
- package/schemas/sdd/agent-runtime-opencode-run-evidence.schema.json +270 -0
- package/schemas/sdd/codesdd-plugin.schema.json +171 -0
- package/schemas/sdd/deepagent-run-request.schema.json +316 -0
- package/schemas/sdd/parallel-feat-automation-plan.schema.json +89 -0
- package/schemas/sdd/parallel-feat-scheduler-request.schema.json +116 -0
- package/schemas/sdd/parallel-feat-scheduler-result.schema.json +404 -0
- package/schemas/sdd/plugin-artifact-manifest.schema.json +109 -0
- package/schemas/sdd/plugin-artifact-map.schema.json +223 -0
- package/schemas/sdd/plugin-evidence-manifest.schema.json +109 -0
- package/schemas/sdd/plugin-language-runtime.schema.json +103 -0
- package/schemas/sdd/plugin-package-governance.schema.json +74 -0
- package/schemas/sdd/plugin-registry.schema.json +171 -0
- package/schemas/sdd/plugin-runtime-invocation-plan.schema.json +109 -0
- package/schemas/sdd/quality-evidence-bundle.schema.json +109 -0
- package/schemas/sdd/reversa-evidence-bundle.schema.json +466 -0
- package/schemas/sdd/sdk-agent-plugin-quality-gate-input.schema.json +168 -0
- package/schemas/sdd/sdk-agent-plugin-quality-gate-report.schema.json +160 -0
- package/schemas/sdd/workspace-catalog.schema.json +5298 -1409
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: devtrack-api
|
|
3
|
-
description:
|
|
3
|
+
description: Compatibility skill for CodeSDD API profiles derived from DevTrack Foundation API. Use the named profiles minimal-rest, rest-auth-rbac, rest-crud-typeorm, evented-api, ai-agent-api, or full-foundation-compatible for NestJS TypeScript backend work using TypeORM, Foundation boundaries, Swagger/OpenAPI, .env.example, package scripts, route guards, auth/authz planning, and evidence-based validation.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
#
|
|
6
|
+
# CodeSDD API Profiles
|
|
7
7
|
|
|
8
8
|
## Mission
|
|
9
9
|
|
|
10
|
-
Use this skill as the local architecture, quality, safety, and delivery contract for `devtrack-foundation-api
|
|
10
|
+
Use this compatibility skill as the local architecture, quality, safety, and delivery contract for CodeSDD API profiles derived from `devtrack-foundation-api`.
|
|
11
11
|
|
|
12
12
|
The goal is not only to produce code. The goal is to preserve architectural integrity, avoid unsafe changes, validate outcomes with evidence, and leave a reliable handoff that any capable engineering agent can continue.
|
|
13
13
|
|
|
@@ -18,6 +18,7 @@ These rules apply to any assistant, automation host, IDE agent, command-line cod
|
|
|
18
18
|
- Stay model-agnostic. Do not depend on a specific LLM, vendor, chat product, IDE, plugin, or hidden tool.
|
|
19
19
|
- Prefer repository evidence over memory, assumptions, examples, or generated guesses.
|
|
20
20
|
- Do not invent APIs, flags, files, package scripts, class names, module names, environment variables, database objects, or behavior.
|
|
21
|
+
- Treat the minimum operational API baseline as an explicit requirement for API/scaffold work. Use Foundation evidence to infer OpenAPI docs, `.env.example`, package scripts, use cases, route guards, and auth/authz planning unless the user explicitly limits the work to a prototype, docs-only review, or a recorded exception profile.
|
|
21
22
|
- Verify version-sensitive details from local files such as `package.json`, lockfiles, configs, migrations, source code, or official docs when available.
|
|
22
23
|
- Keep work scoped to the user request and the active CodeSDD feature when one exists.
|
|
23
24
|
- Preserve user changes in a dirty worktree. Never overwrite unrelated modifications.
|
|
@@ -26,12 +27,15 @@ These rules apply to any assistant, automation host, IDE agent, command-line cod
|
|
|
26
27
|
- Do not create external memory, backlog, workflow, scratchpad, context, or handoff stores.
|
|
27
28
|
- Do not use BRV in this environment.
|
|
28
29
|
- Never introduce Prisma. Persistence is TypeORM only.
|
|
30
|
+
- 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.
|
|
31
|
+
- 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.
|
|
32
|
+
- 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
33
|
|
|
30
34
|
## Operating Mode
|
|
31
35
|
|
|
32
36
|
Repository files are the source for implementation facts. CodeSDD is the source for operational planning, progress, dependencies, blockers, quality, and handoff.
|
|
33
37
|
|
|
34
|
-
When CodeSDD is governing a project and the user asks for API or backend work without explicitly selecting another skill/profile, `devtrack-api`
|
|
38
|
+
When CodeSDD is governing a project and the user asks for API or backend work without explicitly selecting another skill/profile, choose a CodeSDD API profile from the profile family below. `devtrack-api` remains the compatibility skill id and legacy alias, not the preferred public profile name for new API requests. Explicit Python/Flask/LangGraph API work uses the dedicated Python skill/profile instead.
|
|
35
39
|
|
|
36
40
|
Before edits in the API repository:
|
|
37
41
|
|
|
@@ -60,37 +64,108 @@ Treat the repository as a production-grade system:
|
|
|
60
64
|
|
|
61
65
|
Load only the files needed for the task, but always load governance and layout before code changes:
|
|
62
66
|
|
|
63
|
-
- Always read [contract-pack.yaml](references/contract-pack.yaml) before planning, approving, or executing a
|
|
67
|
+
- Always read [contract-pack.yaml](references/contract-pack.yaml) before planning, approving, or executing a CodeSDD API profile project, debate, EPIC, or FEAT. It is the machine-readable contract pack for API profile ids, compatibility alias behavior, derivation profiles, P0/P1/P2 severity, early package preview, human validation, and `codesdd-validate` drift remediation.
|
|
68
|
+
- 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
69
|
- Always read [architecture-governance.md](references/architecture-governance.md) before code changes.
|
|
65
70
|
- 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
71
|
- Read [consumer-sync-policy.md](references/consumer-sync-policy.md) before copying, updating, validating, or accepting `devtrack-api` in a consumer repository.
|
|
67
72
|
- 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.
|
|
73
|
+
- Read [generated-artifact-invalidation.md](references/generated-artifact-invalidation.md) before reusing, approving, grandfathering, or citing generated previews, scaffold dry-runs, caches, artifact maps, validator results, or evidence bundles created before the active Foundation-compatible gates.
|
|
68
74
|
- 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
|
|
75
|
+
- 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
76
|
- 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
77
|
- 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
78
|
- Read [testing-validation.md](references/testing-validation.md) before finishing or when choosing tests.
|
|
73
79
|
- Use [implementation-checklist.md](references/implementation-checklist.md) as the final pass checklist.
|
|
74
80
|
|
|
81
|
+
## CodeSDD API Profile Family
|
|
82
|
+
|
|
83
|
+
New API/backend requests should name one of these public profile ids:
|
|
84
|
+
|
|
85
|
+
- `minimal-rest`: smallest production-grade REST API baseline with Swagger/OpenAPI, `.env.example`, package scripts, DTOs, use cases, structured errors, health/root wiring, and route/use-case tests.
|
|
86
|
+
- `rest-auth-rbac`: REST API with authentication and authorization planning, JWT strategy, route guards, permission decorators, authenticated-user request boundary, protected Swagger/OpenAPI bearer docs, and allow/deny route tests.
|
|
87
|
+
- `rest-crud-typeorm`: REST CRUD API with BO-pattern domain artifact, application repository port, transactional use cases, TypeORM entity/repository/mapper in infrastructure, migration scripts, pagination/filtering, uniqueness checks, and CRUD persistence tests.
|
|
88
|
+
- `evented-api`: API with application event contracts for BO-pattern contexts, application handlers, event publisher ports, queue delivery adapters, idempotency boundaries, retry/error policy, event contract docs, and event tests.
|
|
89
|
+
- `ai-agent-api`: API for AI agent workflows with endpoint DTOs, application use-case ports, provider/tool/audit ports, prompt safety policy, redaction service, redacted provider configuration, audit adapters, deterministic tests, and no live credentials.
|
|
90
|
+
- `full-foundation-compatible`: strict full compatibility with `devtrack-foundation-api` architecture and conventions.
|
|
91
|
+
|
|
92
|
+
The legacy `devtrack-api` request/profile name is compatibility-only and resolves to `full-foundation-compatible` with a migration notice. Do not expose `devtrack-api` as the normal public identity for future API projects.
|
|
93
|
+
|
|
75
94
|
## Contract Pack And Derivation Profiles
|
|
76
95
|
|
|
77
|
-
The structured contract lives in [contract-pack.yaml](references/contract-pack.yaml). Treat it as the executable policy source that future CodeSDD gates can import. The Markdown skill explains the rules; the YAML contract names the profiles, severities, rule ids, drift map, and evidence expectations.
|
|
96
|
+
The structured contract lives in [contract-pack.yaml](references/contract-pack.yaml). Treat it as the executable policy source that future CodeSDD gates can import. The Markdown skill explains the rules; the YAML contract names the CodeSDD API profile ids, compatibility aliases, derivation profiles, severities, rule ids, drift map, and evidence expectations.
|
|
78
97
|
|
|
79
|
-
Every
|
|
98
|
+
Every CodeSDD API profile plan must also select exactly one derivation governance profile before implementation:
|
|
80
99
|
|
|
81
100
|
- `prototype`: exploratory only. It cannot be reported as Foundation-compatible unless a later FEAT upgrades and validates it.
|
|
82
101
|
- `foundation-compatible`: default for derived DevTrack APIs. P0 drift blocks finalize; P1 drift requires remediation or formal exception.
|
|
83
102
|
- `enterprise-strict`: audit-grade mode. P0 and P1 drift block finalize; P2 drift requires evidence or ADR-backed exception.
|
|
84
103
|
|
|
85
|
-
For the first two or three DEBs of a new
|
|
104
|
+
For the first two or three DEBs of a new CodeSDD API profile project or major API theme, CodeSDD must generate a package-structure preview and ask the human planner to approve or correct it before FEAT execution. Missing API profile selection, missing derivation profile selection, missing preview, missing human validation, or declarative-only skill evidence are contract defects.
|
|
86
105
|
|
|
87
106
|
The `codesdd-validate` field failure is mapped in the contract pack under `codesdd_validate_drift_map`. Future planning, validator, finalize, provenance, and field-validation FEATs must consume that map instead of reinterpreting the failure from memory.
|
|
88
107
|
|
|
108
|
+
Generated previews, dry-runs, caches, artifact maps, validator results, and evidence bundles created before the EPIC-0080 gates are noncanonical by default. Use `generated-artifact-invalidation.md` to classify each as `revalidated`, `invalidated`, `grandfathered`, or `not_applicable`; do not treat legacy generated output as Foundation-compatible unless the active contract revalidates it.
|
|
109
|
+
|
|
110
|
+
## CodeSDD Artifact Frontmatter Baseline
|
|
111
|
+
|
|
112
|
+
When generating, filling, reviewing, or copying CodeSDD governance artifacts for API work, keep YAML frontmatter schema-compatible before handing control back to `codesdd` commands. Do not rely on the consumer project to repair malformed governance files.
|
|
113
|
+
|
|
114
|
+
For DEB artifacts, `decision.mediator.accepted_risks` must be an array of objects, never an array of strings:
|
|
115
|
+
|
|
116
|
+
```yaml
|
|
117
|
+
decision:
|
|
118
|
+
mediator:
|
|
119
|
+
accepted_risks:
|
|
120
|
+
- risk: "Local JWT authentication requires tested hashing, refresh token rotation, and expiry policy."
|
|
121
|
+
mitigation: "Cover register, login, refresh, logout, expired token, invalid token, and inactive user cases before finalize."
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
If the source material only provides a free-text risk, preserve it as `risk` and add an explicit `mitigation` field such as the required test, follow-up FEAT, ADR exception, rollback condition, or human validation gate. A DEB that cannot pass `codesdd sdd decide <DEB-ID> --outcome epic` is not ready for EPIC promotion.
|
|
125
|
+
|
|
126
|
+
## Tool-Level API Baseline
|
|
127
|
+
|
|
128
|
+
When a user asks CodeSDD for an API, backend tool, scaffold, CRUD slice, or new REST capability governed by a CodeSDD API profile, the agent must infer the minimum API baseline even when the user does not spell it out. This is not arbitrary invention; it is the default tool contract derived from Foundation and must be implemented or explicitly excepted before handoff.
|
|
129
|
+
|
|
130
|
+
Minimum root package baseline:
|
|
131
|
+
|
|
132
|
+
- `package.json` with Foundation-compatible scripts for build, start, development start, production start, lint, unit tests, coverage, e2e tests, cleanup, cleanup:install, and migrations when persistent schema changes are present.
|
|
133
|
+
- `scripts/cleanup.sh` that removes dependency installs, build outputs, caches, lockfiles, and TypeScript compilation residue unless an ADR preserves a canonical lockfile for the target project.
|
|
134
|
+
- `scripts/kill-port.js` invoked by both `start` and `start:dev` before Nest starts; it must resolve the configured port from a script argument or `PORT`/`APP_PORT`, terminate the current listener, and continue bootstrap.
|
|
135
|
+
- Generated scripts must work through both `npm run ...` and `pnpm run ...`; nested package-script composition uses `npm run` and `npm install` so Docker images do not need pnpm unless the target records an ADR-backed opt-in.
|
|
136
|
+
- `.env.example` for every environment variable introduced by the change. Use placeholders only; never copy real `.env` values.
|
|
137
|
+
- `tsconfig.json` alias map, Nest CLI configuration, lint/test configuration, and validation commands aligned to local package evidence.
|
|
138
|
+
- `src/main.ts` bootstrap with global validation and OpenAPI wiring when the project exposes REST.
|
|
139
|
+
|
|
140
|
+
Minimum API documentation baseline:
|
|
141
|
+
|
|
142
|
+
- Install and wire `@nestjs/swagger` when missing and the selected profile is not a documented prototype exception.
|
|
143
|
+
- Configure `DocumentBuilder`, `SwaggerModule.createDocument`, and `SwaggerModule.setup("docs", app, document)` at bootstrap.
|
|
144
|
+
- Include local/prod Swagger server settings such as `SWAGGER_SERVER_LOCAL` and optional `SWAGGER_SERVER_PROD` through typed configuration.
|
|
145
|
+
- Decorate controllers with `@ApiTags`, `@ApiOperation`, response decorators, and `@ApiBearerAuth("bearer")` when protected by bearer auth.
|
|
146
|
+
- Decorate transport DTOs and presentation validators with `@ApiProperty` or `@ApiPropertyOptional`; Swagger examples must not expose secrets or internal provider payloads.
|
|
147
|
+
|
|
148
|
+
Minimum application slice baseline:
|
|
149
|
+
|
|
150
|
+
- Every user-facing route maps to an application input port and a use case in `src/application/business/<context>/ports/in/` and `src/application/business/<context>/use-cases/`.
|
|
151
|
+
- Controllers inject the input port symbol and do transport mapping only.
|
|
152
|
+
- Controllers must not call repositories, TypeORM, infrastructure adapters, domain validators, or services as a substitute for a use case.
|
|
153
|
+
|
|
154
|
+
Minimum auth/authz planning baseline:
|
|
155
|
+
|
|
156
|
+
- During planning, ask whether the API requires authentication and authorization.
|
|
157
|
+
- Capture the expected mechanism: JWT bearer, API key, session, machine-to-machine credential, public route, role, permission, policy, tenancy, and docs visibility.
|
|
158
|
+
- If the user does not answer and implementation must proceed, choose the safest local default: protect non-health, non-login, non-registration, non-public write routes with the existing guard pattern, record the assumption, and ask for confirmation in the handoff.
|
|
159
|
+
- Route guards and auth decorators live in presentation transport folders such as `src/presentation/rest/<context>/guards/` and `src/presentation/rest/<context>/decorators/`. Application-layer policy checks belong in use cases or application services when the policy is business/application behavior.
|
|
160
|
+
- Public routes must be explicitly marked in the plan and documentation; silence is not a public-route decision.
|
|
161
|
+
|
|
162
|
+
Prototype exceptions are allowed only when the selected derivation profile permits warning-only handling. Even then, record the omitted baseline items as follow-up work and do not claim Foundation compatibility.
|
|
163
|
+
|
|
89
164
|
## Layer Order
|
|
90
165
|
|
|
91
166
|
Implement from inside out unless the task is purely presentation or infrastructure:
|
|
92
167
|
|
|
93
|
-
1. `src/domain`: business rules, BOs, VOs, types
|
|
168
|
+
1. `src/domain`: business rules, BOs, VOs, and types. Validators, events, entities, and domain repository ports are legacy entity-pattern only.
|
|
94
169
|
2. `src/application`: orchestration, use cases, services, handlers, agents/tools, ports in/out.
|
|
95
170
|
3. `src/infrastructure`: concrete adapters, TypeORM, AWS, queue, cache, HTTP, LLM, vector store, Temporal, settings.
|
|
96
171
|
4. `src/presentation`: REST/GraphQL/CLI/WebSocket entrypoints and request validation.
|
|
@@ -125,6 +200,8 @@ src/domain/<context>/types/<name>.type.ts
|
|
|
125
200
|
src/domain/<context>/constants/<name>.const.ts (optional)
|
|
126
201
|
```
|
|
127
202
|
|
|
203
|
+
New aggregate BO classes follow this shape: `extends GenericBusinessObject<T>` and `implements <Name>Interface, IValidator`, in that order. The observed `src/domain/auth/business-objects/api-keys.bo.ts` static utility is a named Foundation exception and must not become the model for new aggregate BO files.
|
|
204
|
+
|
|
128
205
|
**Domain (entity-pattern — legacy `pessoas` and `wallets` only)**
|
|
129
206
|
|
|
130
207
|
```text
|
|
@@ -180,11 +257,16 @@ src/infrastructure/adapters/orm/entities/<name>.orm-entity.ts
|
|
|
180
257
|
src/infrastructure/adapters/orm/repositories/<name>.typeorm-repository.ts
|
|
181
258
|
src/infrastructure/adapters/orm/mappers/<name>.mapper.ts
|
|
182
259
|
src/infrastructure/adapters/orm/migrations/<timestamp>-<action>.migration.ts
|
|
260
|
+
src/infrastructure/adapters/orm/typeorm.module.ts
|
|
183
261
|
src/infrastructure/adapters/orm/<context>-orm.module.ts
|
|
184
262
|
```
|
|
185
263
|
|
|
186
264
|
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
265
|
|
|
266
|
+
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`.
|
|
267
|
+
|
|
268
|
+
The ORM subsystem uses `src/infrastructure/adapters/orm/typeorm.module.ts` as the root TypeORM module and `src/infrastructure/adapters/orm/<context>-orm.module.ts` for context repository providers. Context ORM modules import `TypeOrmModule.forFeature([...])`, provide concrete `*.typeorm-repository.ts` adapters, bind the owning port symbol with `useExisting`, and export the port symbols required by application/domain ports.
|
|
269
|
+
|
|
188
270
|
**Presentation (segmented by transport before context)**
|
|
189
271
|
|
|
190
272
|
```text
|
|
@@ -206,7 +288,7 @@ Other transports follow the same shape under `graphql/`, `cli/`, `websocket/`, o
|
|
|
206
288
|
- REST controllers end with `.controller.ts`, one class per file.
|
|
207
289
|
- REST DTOs end with `.dto.ts`.
|
|
208
290
|
- Presentation validators end with `.presentation-validator.ts`.
|
|
209
|
-
- Nest modules end with `.application.module.ts
|
|
291
|
+
- Nest modules end with `.application.module.ts` or `.module.ts` by layer. TypeORM root wiring is exactly `typeorm.module.ts`; context persistence modules end with `-orm.module.ts`.
|
|
210
292
|
|
|
211
293
|
## Forbidden Patterns
|
|
212
294
|
|
|
@@ -216,6 +298,7 @@ These layouts have been observed in derived debates and plans and **must be reje
|
|
|
216
298
|
- `<name>.schema.ts` for TypeORM entities — use `<name>.orm-entity.ts`.
|
|
217
299
|
- `<name>.value-object.ts` — use `<name>.vo.ts`.
|
|
218
300
|
- `<name>.repository.ts` (ambiguous) — use `<name>.typeorm-repository.ts` in infrastructure, `<name>-repository.port.ts` in port.
|
|
301
|
+
- `src/infrastructure/adapters/orm/<entity>-orm.module.ts` — context modules are allowed, entity-specific modules are not; use `<context>-orm.module.ts`.
|
|
219
302
|
- `src/infrastructure/<context>/persistence/typeorm/` — use `src/infrastructure/adapters/orm/`.
|
|
220
303
|
- `src/infrastructure/<context>/adapters/` — use `src/infrastructure/adapters/<subsystem>/`.
|
|
221
304
|
- `src/infrastructure/<context>/repositories/` — use `src/infrastructure/adapters/orm/repositories/`.
|
|
@@ -230,6 +313,9 @@ When producing an implementation plan (the "Arquivo NestJS | Ação" table insid
|
|
|
230
313
|
1. For each proposed path, match it against Canonical Paths. If it does not match, replace it with the canonical equivalent or flag it as an explicit architectural divergence requiring ADR.
|
|
231
314
|
2. For each new domain context, declare the chosen pattern (BO or entity) and justify the choice. The default is BO; declaring entity for a new context requires citing the ADR.
|
|
232
315
|
3. Cross-check against [foundation-layout.md](references/foundation-layout.md). Skill compliance is verifiable: every path either exists as a pattern in Foundation or is forbidden.
|
|
316
|
+
4. For each public route, name the application input port and use case that owns the action.
|
|
317
|
+
5. For each route, record the auth/authz decision: guard, decorator, role/permission/policy, public exception, and Swagger security documentation.
|
|
318
|
+
6. For each new API project or scaffold, include the root package baseline: `.env.example`, package scripts, OpenAPI bootstrap, validation commands, and typed runtime configuration.
|
|
233
319
|
|
|
234
320
|
A plan that fails this gate corrupts the downstream FEAT execution and the discovery quality ledger. Fix the plan before merging the debate.
|
|
235
321
|
|
|
@@ -247,7 +333,7 @@ A plan that fails this gate corrupts the downstream FEAT execution and the disco
|
|
|
247
333
|
A valid change must satisfy all relevant checks:
|
|
248
334
|
|
|
249
335
|
- 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
|
|
336
|
+
- It keeps BO-pattern business invariants in domain business objects and value objects; domain validators apply only to existing entity-pattern contexts.
|
|
251
337
|
- It keeps orchestration in application use cases, services, or handlers.
|
|
252
338
|
- It keeps transport mapping and request validation in presentation.
|
|
253
339
|
- It keeps concrete integrations in infrastructure.
|
|
@@ -0,0 +1,10 @@
|
|
|
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.
|
|
9
|
+
- For new API work, select minimal-rest, rest-auth-rbac, rest-crud-typeorm, evented-api, ai-agent-api, or full-foundation-compatible; devtrack-api is compatibility-only.
|
|
10
|
+
- For API scaffold or route work, apply the tool-level baseline for Swagger, .env.example, cleanup/cleanup:install, port-safe start/start:dev scripts, use cases, and auth/authz planning.
|
|
@@ -0,0 +1,10 @@
|
|
|
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.
|
|
9
|
+
- For new API work, select minimal-rest, rest-auth-rbac, rest-crud-typeorm, evented-api, ai-agent-api, or full-foundation-compatible; devtrack-api is compatibility-only.
|
|
10
|
+
- For API scaffold or route work, apply the tool-level baseline for Swagger, .env.example, cleanup/cleanup:install, port-safe start/start:dev scripts, use cases, and auth/authz planning.
|
|
@@ -0,0 +1,10 @@
|
|
|
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.
|
|
9
|
+
- For new API work, select minimal-rest, rest-auth-rbac, rest-crud-typeorm, evented-api, ai-agent-api, or full-foundation-compatible; devtrack-api is compatibility-only.
|
|
10
|
+
- For API scaffold or route work, apply the tool-level baseline for Swagger, .env.example, cleanup/cleanup:install, port-safe start/start:dev scripts, use cases, and auth/authz planning.
|
|
@@ -0,0 +1,10 @@
|
|
|
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.
|
|
9
|
+
- For new API work, select minimal-rest, rest-auth-rbac, rest-crud-typeorm, evented-api, ai-agent-api, or full-foundation-compatible; devtrack-api is compatibility-only.
|
|
10
|
+
- For API scaffold or route work, apply the tool-level baseline for Swagger, .env.example, cleanup/cleanup:install, port-safe start/start:dev scripts, use cases, and auth/authz planning.
|
|
@@ -0,0 +1,10 @@
|
|
|
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.
|
|
9
|
+
- For new API work, select minimal-rest, rest-auth-rbac, rest-crud-typeorm, evented-api, ai-agent-api, or full-foundation-compatible; devtrack-api is compatibility-only.
|
|
10
|
+
- For API scaffold or route work, apply the tool-level baseline for Swagger, .env.example, cleanup/cleanup:install, port-safe start/start:dev scripts, use cases, and auth/authz planning.
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
interface:
|
|
2
|
-
display_name: "
|
|
3
|
-
short_description: "
|
|
4
|
-
default_prompt: "Use
|
|
2
|
+
display_name: "CodeSDD API Profiles"
|
|
3
|
+
short_description: "Governed CodeSDD API profile guidance with DevTrack Foundation fidelity."
|
|
4
|
+
default_prompt: "Use the CodeSDD API profile family to implement, review, refactor, test, or document NestJS API work. Select minimal-rest, rest-auth-rbac, rest-crud-typeorm, evented-api, ai-agent-api, or full-foundation-compatible; treat devtrack-api as a compatibility-only skill id. Preserve TypeORM, strict imports, Swagger/OpenAPI, .env.example, package scripts with cleanup/cleanup:install and port-safe start/start:dev bootstrap, application use cases, route guards, auth/authz planning, and validation evidence."
|
|
5
|
+
policy:
|
|
6
|
+
allow_implicit_invocation: true
|
|
@@ -0,0 +1,12 @@
|
|
|
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.
|
|
11
|
+
- For new API work, select minimal-rest, rest-auth-rbac, rest-crud-typeorm, evented-api, ai-agent-api, or full-foundation-compatible; devtrack-api is compatibility-only.
|
|
12
|
+
- For API scaffold or route work, apply the tool-level baseline for Swagger, .env.example, cleanup/cleanup:install, port-safe start/start:dev scripts, use cases, and auth/authz planning.
|
|
@@ -54,6 +54,12 @@ Use `business` for standard API modules and `intelligence` for agent/conversatio
|
|
|
54
54
|
- Keep transactions behind ports or infrastructure abstractions unless a local pattern already defines an application-level unit-of-work port.
|
|
55
55
|
- Do not log secrets, tokens, raw provider payloads, full prompts with sensitive data, or personal data beyond what existing policy allows.
|
|
56
56
|
|
|
57
|
+
## Use-Case Requirement For API Slices
|
|
58
|
+
|
|
59
|
+
Every REST, GraphQL, CLI, WebSocket, agent, or tool entrypoint that represents a user/system action must call an application input port backed by a use case. A route without `src/application/business/<context>/ports/in/<verb-noun>.use-case.port.ts` and `src/application/business/<context>/use-cases/<verb-noun>.use-case.ts` is incomplete for Foundation-compatible work.
|
|
60
|
+
|
|
61
|
+
Controllers and other transports do transport mapping only. They must not call repositories, TypeORM, infrastructure adapters, domain validators, or application services as a shortcut around a use case. If a route is operationally read-only, health-only, or intentionally public, record that exception in the plan and still keep business behavior in application.
|
|
62
|
+
|
|
57
63
|
## Input Ports
|
|
58
64
|
|
|
59
65
|
Input ports expose use cases to presentation or other application modules.
|
|
@@ -126,8 +132,8 @@ Pattern:
|
|
|
126
132
|
```ts
|
|
127
133
|
import { Inject, Injectable, Logger, Optional } from '@nestjs/common';
|
|
128
134
|
import { Example } from '@domain/example/business-objects/example.bo';
|
|
129
|
-
import { ExampleRepositoryPortSymbol } from '@
|
|
130
|
-
import type { ExampleRepositoryPort } from '@
|
|
135
|
+
import { ExampleRepositoryPortSymbol } from '@application/business/example/ports/out/example-repository.port';
|
|
136
|
+
import type { ExampleRepositoryPort } from '@application/business/example/ports/out/example-repository.port';
|
|
131
137
|
import type { ExampleType } from '@domain/example/types/example.type';
|
|
132
138
|
import type { CreateExampleUseCasePort } from '@application/business/example/ports/in/create-example.use-case.port';
|
|
133
139
|
import { ExampleProducerPortSymbol } from '@application/business/example/ports/out/example-producer.port';
|
|
@@ -255,6 +261,50 @@ Presentation must be thin. It maps request input to application input and return
|
|
|
255
261
|
|
|
256
262
|
Presentation must not become a backdoor for business rules, infrastructure access, provider calls, or internal payload exposure.
|
|
257
263
|
|
|
264
|
+
## API Documentation And Auth Planning
|
|
265
|
+
|
|
266
|
+
OpenAPI/Swagger is part of the minimum API baseline for REST APIs. A derived API or scaffold that exposes REST should include the root bootstrap and route-level decorators unless an explicit prototype exception records the omission.
|
|
267
|
+
|
|
268
|
+
Root bootstrap requirements:
|
|
269
|
+
|
|
270
|
+
```ts
|
|
271
|
+
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
|
|
272
|
+
|
|
273
|
+
const docBuilder = new DocumentBuilder()
|
|
274
|
+
.setTitle('<api title>')
|
|
275
|
+
.setDescription('<api description>')
|
|
276
|
+
.setVersion('1.0')
|
|
277
|
+
.addServer(appConfig.swagger.serverLocal, 'Local Development')
|
|
278
|
+
.addBearerAuth(
|
|
279
|
+
{
|
|
280
|
+
type: 'http',
|
|
281
|
+
scheme: 'bearer',
|
|
282
|
+
bearerFormat: 'JWT',
|
|
283
|
+
name: 'JWT',
|
|
284
|
+
in: 'header',
|
|
285
|
+
},
|
|
286
|
+
'bearer',
|
|
287
|
+
);
|
|
288
|
+
|
|
289
|
+
if (appConfig.swagger.serverProd) {
|
|
290
|
+
docBuilder.addServer(appConfig.swagger.serverProd, 'Production');
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
const document = SwaggerModule.createDocument(app, docBuilder.build());
|
|
294
|
+
SwaggerModule.setup('docs', app, document);
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
The corresponding runtime configuration must expose documented placeholders in `.env.example`, including `SWAGGER_SERVER_LOCAL` and optional `SWAGGER_SERVER_PROD` when production docs are configured.
|
|
298
|
+
|
|
299
|
+
Before implementing routes, the plan must ask or record:
|
|
300
|
+
|
|
301
|
+
- Is authentication required? If yes, which mechanism: JWT bearer, API key, session, machine-to-machine credential, or another Foundation-compatible guard?
|
|
302
|
+
- Is authorization required? If yes, which role, permission, policy, ownership, or tenancy rule applies?
|
|
303
|
+
- Which routes are intentionally public, and how are those public exceptions documented?
|
|
304
|
+
- Should Swagger show bearer security (`@ApiBearerAuth("bearer")`) or another documented security scheme?
|
|
305
|
+
|
|
306
|
+
When the answer is unknown and work must continue, protect non-health, non-login, non-registration, non-public write routes with the existing guard pattern and record the assumption.
|
|
307
|
+
|
|
258
308
|
## REST Controllers
|
|
259
309
|
|
|
260
310
|
Rules:
|
|
@@ -267,20 +317,25 @@ Rules:
|
|
|
267
317
|
- Do not call repositories, TypeORM, AWS SDK, queues, LLM providers, vector stores, or domain validators directly.
|
|
268
318
|
- Do not return raw domain internals, provider responses, internal lifecycle payloads, or sensitive data.
|
|
269
319
|
- Keep error mapping aligned with existing exception filters and controller patterns.
|
|
320
|
+
- Document every route with `@ApiTags`, `@ApiOperation`, and response decorators such as `@ApiCreatedResponse`, `@ApiOkResponse`, `@ApiBadRequestResponse`, or `@ApiUnauthorizedResponse`.
|
|
321
|
+
- Use `@ApiBearerAuth("bearer")` and `@UseGuards(JwtAuthGuard)` or the applicable guard/decorator for protected routes.
|
|
322
|
+
- Permission, role, tenancy, or ownership checks must be explicit through presentation guards/decorators and/or application policy use cases. Do not leave auth/authz implicit.
|
|
323
|
+
- Public routes must be explicitly marked in the plan and docs.
|
|
270
324
|
|
|
271
325
|
Pattern:
|
|
272
326
|
|
|
273
327
|
```ts
|
|
274
|
-
import { Body, Controller, Post } from '@nestjs/common';
|
|
275
|
-
import { ApiCreatedResponse, ApiOperation, ApiTags } from '@nestjs/swagger';
|
|
328
|
+
import { Body, Controller, Inject, Post, UseGuards } from '@nestjs/common';
|
|
329
|
+
import { ApiBearerAuth, ApiCreatedResponse, ApiOperation, ApiTags } from '@nestjs/swagger';
|
|
276
330
|
import { randomUUID } from 'crypto';
|
|
277
|
-
import { Inject } from '@nestjs/common';
|
|
278
331
|
import { CreateExampleUseCasePortSymbol } from '@application/business/example/ports/in/create-example.use-case.port';
|
|
279
332
|
import type { CreateExampleUseCasePort } from '@application/business/example/ports/in/create-example.use-case.port';
|
|
280
333
|
import { GenericController } from '@presentation/generic-controller';
|
|
334
|
+
import { JwtAuthGuard } from '@presentation/rest/auth/guards/jwt-auth.guard';
|
|
281
335
|
import { CreateExamplePresentationValidator } from '@presentation/rest/example/presentation-validators/create-example.presentation-validator';
|
|
282
336
|
|
|
283
337
|
@ApiTags('Examples')
|
|
338
|
+
@ApiBearerAuth('bearer')
|
|
284
339
|
@Controller('examples')
|
|
285
340
|
export class CreateExampleController extends GenericController<CreateExampleUseCasePort> {
|
|
286
341
|
constructor(@Inject(CreateExampleUseCasePortSymbol) useCase: CreateExampleUseCasePort) {
|
|
@@ -288,6 +343,7 @@ export class CreateExampleController extends GenericController<CreateExampleUseC
|
|
|
288
343
|
}
|
|
289
344
|
|
|
290
345
|
@Post()
|
|
346
|
+
@UseGuards(JwtAuthGuard)
|
|
291
347
|
@ApiOperation({ summary: 'Criar example' })
|
|
292
348
|
@ApiCreatedResponse({ description: 'Example criado com sucesso' })
|
|
293
349
|
async handle(@Body() validator: CreateExamplePresentationValidator) {
|
|
@@ -7,8 +7,8 @@ This policy governs every copy of `.sdd/skills/curated/devtrack-api/` that CodeS
|
|
|
7
7
|
It covers:
|
|
8
8
|
|
|
9
9
|
- `SKILL.md`
|
|
10
|
-
- `agents/
|
|
11
|
-
- all files under `references/`, including `contract-pack.yaml`
|
|
10
|
+
- all files under `agents/`, including Codex, OpenAI, Claude Code, Cursor, Gemini, Kimi, OpenCode, and any generic markdown/CLI adapter materialized by the contract pack;
|
|
11
|
+
- all files under `references/`, including `contract-pack.yaml`, `field-validation-protocol.md`, and `generated-artifact-invalidation.md`.
|
|
12
12
|
|
|
13
13
|
It does not make CodeSDD the canonical backend implementation source. `devtrack-foundation-api` remains the backend architecture ground truth; CodeSDD owns the skill distribution and consumer materialization contract.
|
|
14
14
|
|
|
@@ -86,8 +86,20 @@ If a consumer copy needs an urgent local correction:
|
|
|
86
86
|
|
|
87
87
|
A consumer copy is current only when:
|
|
88
88
|
|
|
89
|
-
- `SKILL.md`, `agents
|
|
89
|
+
- `SKILL.md`, every `agents/*` adapter, and every `references/*.md` file match the intended CodeSDD source commit or release;
|
|
90
90
|
- `references/contract-pack.yaml` matches the intended CodeSDD source commit or release;
|
|
91
91
|
- the consumer FEAT quality or handoff records source version, update command, and diff result;
|
|
92
92
|
- no durable edits exist only in the consumer copy;
|
|
93
93
|
- any Foundation-driven guidance change passed the CodeSDD Foundation-layout conformance test first.
|
|
94
|
+
|
|
95
|
+
## FEAT-0378 Consumer Evidence Sync Rule
|
|
96
|
+
|
|
97
|
+
For FEAT-0378, CodeSDD records only summary references for consumer-owned field evidence:
|
|
98
|
+
|
|
99
|
+
- consumer-held debates remain in the consumer repository quality ledger or handoff;
|
|
100
|
+
- CodeSDD may store opaque references to at least two approved consumer evidence owners;
|
|
101
|
+
- D-01 through D-08 closure may be represented here only as `closed`, `not_applicable`, or `accepted_exception`;
|
|
102
|
+
- `accepted_exception` rows must point to `ADR-FEAT-0378` or a consumer-owned ADR/decision;
|
|
103
|
+
- unresolved opaque references block consumer-local adoption claims, but do not require copying private ledgers into this repository.
|
|
104
|
+
|
|
105
|
+
This keeps the distribution contract auditable while preserving the one-way materialization boundary: CodeSDD owns the reusable `devtrack-api` skill and protocol, and the consumer project owns its private implementation evidence.
|