@agentic-sdlc-kit/contracts 0.0.0-stage → 0.8.0
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/LICENSE +21 -0
- package/README.md +42 -2
- package/dist/agent/capability.d.ts +9 -0
- package/dist/agent/capability.d.ts.map +1 -0
- package/dist/agent/capability.js +31 -0
- package/dist/agent/capability.js.map +1 -0
- package/dist/agent/errors.d.ts +30 -0
- package/dist/agent/errors.d.ts.map +1 -0
- package/dist/agent/errors.js +62 -0
- package/dist/agent/errors.js.map +1 -0
- package/dist/agent/events.d.ts +222 -0
- package/dist/agent/events.d.ts.map +1 -0
- package/dist/agent/events.js +92 -0
- package/dist/agent/events.js.map +1 -0
- package/dist/agent/execution.d.ts +553 -0
- package/dist/agent/execution.d.ts.map +1 -0
- package/dist/agent/execution.js +229 -0
- package/dist/agent/execution.js.map +1 -0
- package/dist/agent/index.d.ts +8 -0
- package/dist/agent/index.d.ts.map +1 -0
- package/dist/agent/index.js +19 -0
- package/dist/agent/index.js.map +1 -0
- package/dist/agent/policy.d.ts +135 -0
- package/dist/agent/policy.d.ts.map +1 -0
- package/dist/agent/policy.js +78 -0
- package/dist/agent/policy.js.map +1 -0
- package/dist/agent/provider.d.ts +82 -0
- package/dist/agent/provider.d.ts.map +1 -0
- package/dist/agent/provider.js +33 -0
- package/dist/agent/provider.js.map +1 -0
- package/dist/agent/session.d.ts +17 -0
- package/dist/agent/session.d.ts.map +1 -0
- package/dist/agent/session.js +23 -0
- package/dist/agent/session.js.map +1 -0
- package/dist/application/application-context.d.ts +512 -0
- package/dist/application/application-context.d.ts.map +1 -0
- package/dist/application/application-context.js +42 -0
- package/dist/application/application-context.js.map +1 -0
- package/dist/application/application-persistence.d.ts +846 -0
- package/dist/application/application-persistence.d.ts.map +1 -0
- package/dist/application/application-persistence.js +37 -0
- package/dist/application/application-persistence.js.map +1 -0
- package/dist/application/application-state.d.ts +89 -0
- package/dist/application/application-state.d.ts.map +1 -0
- package/dist/application/application-state.js +66 -0
- package/dist/application/application-state.js.map +1 -0
- package/dist/application/application-transitions.d.ts +23 -0
- package/dist/application/application-transitions.d.ts.map +1 -0
- package/dist/application/application-transitions.js +60 -0
- package/dist/application/application-transitions.js.map +1 -0
- package/dist/application/index.d.ts +5 -0
- package/dist/application/index.d.ts.map +1 -0
- package/dist/application/index.js +6 -0
- package/dist/application/index.js.map +1 -0
- package/dist/architecture/api-contract.d.ts +259 -0
- package/dist/architecture/api-contract.d.ts.map +1 -0
- package/dist/architecture/api-contract.js +43 -0
- package/dist/architecture/api-contract.js.map +1 -0
- package/dist/architecture/architecture-approval.d.ts +40 -0
- package/dist/architecture/architecture-approval.d.ts.map +1 -0
- package/dist/architecture/architecture-approval.js +24 -0
- package/dist/architecture/architecture-approval.js.map +1 -0
- package/dist/architecture/architecture-options.d.ts +103 -0
- package/dist/architecture/architecture-options.d.ts.map +1 -0
- package/dist/architecture/architecture-options.js +35 -0
- package/dist/architecture/architecture-options.js.map +1 -0
- package/dist/architecture/component-map.d.ts +76 -0
- package/dist/architecture/component-map.d.ts.map +1 -0
- package/dist/architecture/component-map.js +28 -0
- package/dist/architecture/component-map.js.map +1 -0
- package/dist/architecture/data-model.d.ts +252 -0
- package/dist/architecture/data-model.d.ts.map +1 -0
- package/dist/architecture/data-model.js +53 -0
- package/dist/architecture/data-model.js.map +1 -0
- package/dist/architecture/index.d.ts +8 -0
- package/dist/architecture/index.d.ts.map +1 -0
- package/dist/architecture/index.js +9 -0
- package/dist/architecture/index.js.map +1 -0
- package/dist/architecture/operational-design.d.ts +134 -0
- package/dist/architecture/operational-design.d.ts.map +1 -0
- package/dist/architecture/operational-design.js +46 -0
- package/dist/architecture/operational-design.js.map +1 -0
- package/dist/architecture/security-design.d.ts +107 -0
- package/dist/architecture/security-design.d.ts.map +1 -0
- package/dist/architecture/security-design.js +40 -0
- package/dist/architecture/security-design.js.map +1 -0
- package/dist/common/errors.d.ts +40 -0
- package/dist/common/errors.d.ts.map +1 -0
- package/dist/common/errors.js +45 -0
- package/dist/common/errors.js.map +1 -0
- package/dist/common/identifier.d.ts +12 -0
- package/dist/common/identifier.d.ts.map +1 -0
- package/dist/common/identifier.js +21 -0
- package/dist/common/identifier.js.map +1 -0
- package/dist/common/index.d.ts +4 -0
- package/dist/common/index.d.ts.map +1 -0
- package/dist/common/index.js +5 -0
- package/dist/common/index.js.map +1 -0
- package/dist/common/result.d.ts +28 -0
- package/dist/common/result.d.ts.map +1 -0
- package/dist/common/result.js +33 -0
- package/dist/common/result.js.map +1 -0
- package/dist/evaluation/benchmark.d.ts +88 -0
- package/dist/evaluation/benchmark.d.ts.map +1 -0
- package/dist/evaluation/benchmark.js +34 -0
- package/dist/evaluation/benchmark.js.map +1 -0
- package/dist/evaluation/index.d.ts +3 -0
- package/dist/evaluation/index.d.ts.map +1 -0
- package/dist/evaluation/index.js +4 -0
- package/dist/evaluation/index.js.map +1 -0
- package/dist/evaluation/metrics.d.ts +164 -0
- package/dist/evaluation/metrics.d.ts.map +1 -0
- package/dist/evaluation/metrics.js +64 -0
- package/dist/evaluation/metrics.js.map +1 -0
- package/dist/evolution/experiment.d.ts +85 -0
- package/dist/evolution/experiment.d.ts.map +1 -0
- package/dist/evolution/experiment.js +52 -0
- package/dist/evolution/experiment.js.map +1 -0
- package/dist/evolution/improvement-hypothesis.d.ts +98 -0
- package/dist/evolution/improvement-hypothesis.d.ts.map +1 -0
- package/dist/evolution/improvement-hypothesis.js +59 -0
- package/dist/evolution/improvement-hypothesis.js.map +1 -0
- package/dist/evolution/index.d.ts +3 -0
- package/dist/evolution/index.d.ts.map +1 -0
- package/dist/evolution/index.js +4 -0
- package/dist/evolution/index.js.map +1 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +43 -0
- package/dist/index.js.map +1 -0
- package/dist/installer/index.d.ts +4 -0
- package/dist/installer/index.d.ts.map +1 -0
- package/dist/installer/index.js +5 -0
- package/dist/installer/index.js.map +1 -0
- package/dist/installer/install-plan.d.ts +168 -0
- package/dist/installer/install-plan.d.ts.map +1 -0
- package/dist/installer/install-plan.js +40 -0
- package/dist/installer/install-plan.js.map +1 -0
- package/dist/installer/ownership-manifest.d.ts +78 -0
- package/dist/installer/ownership-manifest.d.ts.map +1 -0
- package/dist/installer/ownership-manifest.js +30 -0
- package/dist/installer/ownership-manifest.js.map +1 -0
- package/dist/installer/package-manifest.d.ts +55 -0
- package/dist/installer/package-manifest.d.ts.map +1 -0
- package/dist/installer/package-manifest.js +46 -0
- package/dist/installer/package-manifest.js.map +1 -0
- package/dist/learning/engineering-lesson.d.ts +84 -0
- package/dist/learning/engineering-lesson.d.ts.map +1 -0
- package/dist/learning/engineering-lesson.js +47 -0
- package/dist/learning/engineering-lesson.js.map +1 -0
- package/dist/learning/engineering-memory.d.ts +66 -0
- package/dist/learning/engineering-memory.d.ts.map +1 -0
- package/dist/learning/engineering-memory.js +44 -0
- package/dist/learning/engineering-memory.js.map +1 -0
- package/dist/learning/experience-episode.d.ts +176 -0
- package/dist/learning/experience-episode.d.ts.map +1 -0
- package/dist/learning/experience-episode.js +68 -0
- package/dist/learning/experience-episode.js.map +1 -0
- package/dist/learning/experience.d.ts +68 -0
- package/dist/learning/experience.d.ts.map +1 -0
- package/dist/learning/experience.js +22 -0
- package/dist/learning/experience.js.map +1 -0
- package/dist/learning/hypothesis.d.ts +57 -0
- package/dist/learning/hypothesis.d.ts.map +1 -0
- package/dist/learning/hypothesis.js +27 -0
- package/dist/learning/hypothesis.js.map +1 -0
- package/dist/learning/index.d.ts +8 -0
- package/dist/learning/index.d.ts.map +1 -0
- package/dist/learning/index.js +9 -0
- package/dist/learning/index.js.map +1 -0
- package/dist/learning/memory.d.ts +42 -0
- package/dist/learning/memory.d.ts.map +1 -0
- package/dist/learning/memory.js +20 -0
- package/dist/learning/memory.js.map +1 -0
- package/dist/learning/promotion.d.ts +31 -0
- package/dist/learning/promotion.d.ts.map +1 -0
- package/dist/learning/promotion.js +16 -0
- package/dist/learning/promotion.js.map +1 -0
- package/dist/maintenance/bug-fix-workflow.d.ts +57 -0
- package/dist/maintenance/bug-fix-workflow.d.ts.map +1 -0
- package/dist/maintenance/bug-fix-workflow.js +100 -0
- package/dist/maintenance/bug-fix-workflow.js.map +1 -0
- package/dist/maintenance/bug-report.d.ts +62 -0
- package/dist/maintenance/bug-report.d.ts.map +1 -0
- package/dist/maintenance/bug-report.js +49 -0
- package/dist/maintenance/bug-report.js.map +1 -0
- package/dist/maintenance/index.d.ts +6 -0
- package/dist/maintenance/index.d.ts.map +1 -0
- package/dist/maintenance/index.js +7 -0
- package/dist/maintenance/index.js.map +1 -0
- package/dist/maintenance/performance-baseline.d.ts +80 -0
- package/dist/maintenance/performance-baseline.d.ts.map +1 -0
- package/dist/maintenance/performance-baseline.js +32 -0
- package/dist/maintenance/performance-baseline.js.map +1 -0
- package/dist/maintenance/refactor-contract.d.ts +158 -0
- package/dist/maintenance/refactor-contract.d.ts.map +1 -0
- package/dist/maintenance/refactor-contract.js +65 -0
- package/dist/maintenance/refactor-contract.js.map +1 -0
- package/dist/maintenance/refactor-workflow.d.ts +79 -0
- package/dist/maintenance/refactor-workflow.d.ts.map +1 -0
- package/dist/maintenance/refactor-workflow.js +100 -0
- package/dist/maintenance/refactor-workflow.js.map +1 -0
- package/dist/observer/event-schema.d.ts +49 -0
- package/dist/observer/event-schema.d.ts.map +1 -0
- package/dist/observer/event-schema.js +48 -0
- package/dist/observer/event-schema.js.map +1 -0
- package/dist/observer/index.d.ts +5 -0
- package/dist/observer/index.d.ts.map +1 -0
- package/dist/observer/index.js +6 -0
- package/dist/observer/index.js.map +1 -0
- package/dist/observer/journal.d.ts +83 -0
- package/dist/observer/journal.d.ts.map +1 -0
- package/dist/observer/journal.js +76 -0
- package/dist/observer/journal.js.map +1 -0
- package/dist/observer/retention.d.ts +25 -0
- package/dist/observer/retention.d.ts.map +1 -0
- package/dist/observer/retention.js +21 -0
- package/dist/observer/retention.js.map +1 -0
- package/dist/observer/run-summary.d.ts +260 -0
- package/dist/observer/run-summary.d.ts.map +1 -0
- package/dist/observer/run-summary.js +32 -0
- package/dist/observer/run-summary.js.map +1 -0
- package/dist/patterns/index.d.ts +2 -0
- package/dist/patterns/index.d.ts.map +1 -0
- package/dist/patterns/index.js +3 -0
- package/dist/patterns/index.js.map +1 -0
- package/dist/patterns/pattern.d.ts +106 -0
- package/dist/patterns/pattern.d.ts.map +1 -0
- package/dist/patterns/pattern.js +69 -0
- package/dist/patterns/pattern.js.map +1 -0
- package/dist/planning/index.d.ts +2 -0
- package/dist/planning/index.d.ts.map +1 -0
- package/dist/planning/index.js +3 -0
- package/dist/planning/index.js.map +1 -0
- package/dist/planning/task.d.ts +178 -0
- package/dist/planning/task.d.ts.map +1 -0
- package/dist/planning/task.js +35 -0
- package/dist/planning/task.js.map +1 -0
- package/dist/policy/index.d.ts +2 -0
- package/dist/policy/index.d.ts.map +1 -0
- package/dist/policy/index.js +3 -0
- package/dist/policy/index.js.map +1 -0
- package/dist/policy/policy.d.ts +83 -0
- package/dist/policy/policy.d.ts.map +1 -0
- package/dist/policy/policy.js +57 -0
- package/dist/policy/policy.js.map +1 -0
- package/dist/product/index.d.ts +5 -0
- package/dist/product/index.d.ts.map +1 -0
- package/dist/product/index.js +6 -0
- package/dist/product/index.js.map +1 -0
- package/dist/product/mvp-scope.d.ts +25 -0
- package/dist/product/mvp-scope.d.ts.map +1 -0
- package/dist/product/mvp-scope.js +18 -0
- package/dist/product/mvp-scope.js.map +1 -0
- package/dist/product/product-brief.d.ts +94 -0
- package/dist/product/product-brief.d.ts.map +1 -0
- package/dist/product/product-brief.js +44 -0
- package/dist/product/product-brief.js.map +1 -0
- package/dist/product/requirements.d.ts +251 -0
- package/dist/product/requirements.d.ts.map +1 -0
- package/dist/product/requirements.js +50 -0
- package/dist/product/requirements.js.map +1 -0
- package/dist/product/traceability.d.ts +50 -0
- package/dist/product/traceability.d.ts.map +1 -0
- package/dist/product/traceability.js +20 -0
- package/dist/product/traceability.js.map +1 -0
- package/dist/project/index.d.ts +3 -0
- package/dist/project/index.d.ts.map +1 -0
- package/dist/project/index.js +4 -0
- package/dist/project/index.js.map +1 -0
- package/dist/project/project-profile.d.ts +79 -0
- package/dist/project/project-profile.d.ts.map +1 -0
- package/dist/project/project-profile.js +53 -0
- package/dist/project/project-profile.js.map +1 -0
- package/dist/project/repository-scan.d.ts +82 -0
- package/dist/project/repository-scan.d.ts.map +1 -0
- package/dist/project/repository-scan.js +29 -0
- package/dist/project/repository-scan.js.map +1 -0
- package/dist/routing/capability-registry.d.ts +87 -0
- package/dist/routing/capability-registry.d.ts.map +1 -0
- package/dist/routing/capability-registry.js +26 -0
- package/dist/routing/capability-registry.js.map +1 -0
- package/dist/routing/escalation.d.ts +25 -0
- package/dist/routing/escalation.d.ts.map +1 -0
- package/dist/routing/escalation.js +21 -0
- package/dist/routing/escalation.js.map +1 -0
- package/dist/routing/index.d.ts +5 -0
- package/dist/routing/index.d.ts.map +1 -0
- package/dist/routing/index.js +6 -0
- package/dist/routing/index.js.map +1 -0
- package/dist/routing/routing-policy.d.ts +103 -0
- package/dist/routing/routing-policy.d.ts.map +1 -0
- package/dist/routing/routing-policy.js +32 -0
- package/dist/routing/routing-policy.js.map +1 -0
- package/dist/routing/routing-request.d.ts +63 -0
- package/dist/routing/routing-request.d.ts.map +1 -0
- package/dist/routing/routing-request.js +46 -0
- package/dist/routing/routing-request.js.map +1 -0
- package/dist/runtime-guard/action-classification.d.ts +54 -0
- package/dist/runtime-guard/action-classification.d.ts.map +1 -0
- package/dist/runtime-guard/action-classification.js +90 -0
- package/dist/runtime-guard/action-classification.js.map +1 -0
- package/dist/runtime-guard/audit-event.d.ts +98 -0
- package/dist/runtime-guard/audit-event.d.ts.map +1 -0
- package/dist/runtime-guard/audit-event.js +45 -0
- package/dist/runtime-guard/audit-event.js.map +1 -0
- package/dist/runtime-guard/index.d.ts +4 -0
- package/dist/runtime-guard/index.d.ts.map +1 -0
- package/dist/runtime-guard/index.js +5 -0
- package/dist/runtime-guard/index.js.map +1 -0
- package/dist/runtime-guard/policy-schema.d.ts +139 -0
- package/dist/runtime-guard/policy-schema.d.ts.map +1 -0
- package/dist/runtime-guard/policy-schema.js +50 -0
- package/dist/runtime-guard/policy-schema.js.map +1 -0
- package/dist/scaffolding/index.d.ts +3 -0
- package/dist/scaffolding/index.d.ts.map +1 -0
- package/dist/scaffolding/index.js +4 -0
- package/dist/scaffolding/index.js.map +1 -0
- package/dist/scaffolding/scaffold-contract.d.ts +528 -0
- package/dist/scaffolding/scaffold-contract.d.ts.map +1 -0
- package/dist/scaffolding/scaffold-contract.js +50 -0
- package/dist/scaffolding/scaffold-contract.js.map +1 -0
- package/dist/scaffolding/template-manifest.d.ts +105 -0
- package/dist/scaffolding/template-manifest.d.ts.map +1 -0
- package/dist/scaffolding/template-manifest.js +44 -0
- package/dist/scaffolding/template-manifest.js.map +1 -0
- package/dist/secret-guard/detection-rule.d.ts +33 -0
- package/dist/secret-guard/detection-rule.d.ts.map +1 -0
- package/dist/secret-guard/detection-rule.js +109 -0
- package/dist/secret-guard/detection-rule.js.map +1 -0
- package/dist/secret-guard/finding.d.ts +89 -0
- package/dist/secret-guard/finding.d.ts.map +1 -0
- package/dist/secret-guard/finding.js +85 -0
- package/dist/secret-guard/finding.js.map +1 -0
- package/dist/secret-guard/index.d.ts +5 -0
- package/dist/secret-guard/index.d.ts.map +1 -0
- package/dist/secret-guard/index.js +6 -0
- package/dist/secret-guard/index.js.map +1 -0
- package/dist/secret-guard/redaction-policy.d.ts +26 -0
- package/dist/secret-guard/redaction-policy.d.ts.map +1 -0
- package/dist/secret-guard/redaction-policy.js +30 -0
- package/dist/secret-guard/redaction-policy.js.map +1 -0
- package/dist/secret-guard/scanner-failure.d.ts +59 -0
- package/dist/secret-guard/scanner-failure.d.ts.map +1 -0
- package/dist/secret-guard/scanner-failure.js +40 -0
- package/dist/secret-guard/scanner-failure.js.map +1 -0
- package/dist/specification/index.d.ts +2 -0
- package/dist/specification/index.d.ts.map +1 -0
- package/dist/specification/index.js +3 -0
- package/dist/specification/index.js.map +1 -0
- package/dist/specification/specification.d.ts +229 -0
- package/dist/specification/specification.d.ts.map +1 -0
- package/dist/specification/specification.js +67 -0
- package/dist/specification/specification.js.map +1 -0
- package/dist/stack-pack/index.d.ts +2 -0
- package/dist/stack-pack/index.d.ts.map +1 -0
- package/dist/stack-pack/index.js +3 -0
- package/dist/stack-pack/index.js.map +1 -0
- package/dist/stack-pack/manifest.d.ts +88 -0
- package/dist/stack-pack/manifest.d.ts.map +1 -0
- package/dist/stack-pack/manifest.js +51 -0
- package/dist/stack-pack/manifest.js.map +1 -0
- package/dist/verification/index.d.ts +2 -0
- package/dist/verification/index.d.ts.map +1 -0
- package/dist/verification/index.js +3 -0
- package/dist/verification/index.js.map +1 -0
- package/dist/verification/report.d.ts +95 -0
- package/dist/verification/report.d.ts.map +1 -0
- package/dist/verification/report.js +57 -0
- package/dist/verification/report.js.map +1 -0
- package/dist/workflow/index.d.ts +3 -0
- package/dist/workflow/index.d.ts.map +1 -0
- package/dist/workflow/index.js +4 -0
- package/dist/workflow/index.js.map +1 -0
- package/dist/workflow/next-action.d.ts +130 -0
- package/dist/workflow/next-action.d.ts.map +1 -0
- package/dist/workflow/next-action.js +92 -0
- package/dist/workflow/next-action.js.map +1 -0
- package/dist/workflow/workflow.d.ts +68 -0
- package/dist/workflow/workflow.d.ts.map +1 -0
- package/dist/workflow/workflow.js +33 -0
- package/dist/workflow/workflow.js.map +1 -0
- package/package.json +31 -3
- package/src/agent/agent.test.ts +451 -0
- package/src/agent/capability.ts +35 -0
- package/src/agent/errors.ts +69 -0
- package/src/agent/events.ts +107 -0
- package/src/agent/execution.ts +275 -0
- package/src/agent/index.ts +19 -0
- package/src/agent/policy.ts +82 -0
- package/src/agent/provider.ts +124 -0
- package/src/agent/session.ts +29 -0
- package/src/application/application-context.ts +47 -0
- package/src/application/application-persistence.ts +44 -0
- package/src/application/application-state.test.ts +107 -0
- package/src/application/application-state.ts +81 -0
- package/src/application/application-transitions.ts +71 -0
- package/src/application/index.ts +5 -0
- package/src/architecture/api-contract.ts +56 -0
- package/src/architecture/architecture-approval.ts +27 -0
- package/src/architecture/architecture-options.ts +42 -0
- package/src/architecture/architecture.test.ts +263 -0
- package/src/architecture/component-map.ts +35 -0
- package/src/architecture/data-model.ts +66 -0
- package/src/architecture/index.ts +8 -0
- package/src/architecture/operational-design.ts +55 -0
- package/src/architecture/security-design.ts +47 -0
- package/src/common/errors.test.ts +46 -0
- package/src/common/errors.ts +114 -0
- package/src/common/identifier.test.ts +51 -0
- package/src/common/identifier.ts +33 -0
- package/src/common/index.ts +4 -0
- package/src/common/result.test.ts +52 -0
- package/src/common/result.ts +50 -0
- package/src/evaluation/benchmark.ts +42 -0
- package/src/evaluation/index.ts +3 -0
- package/src/evaluation/metrics.ts +76 -0
- package/src/evolution/experiment.ts +61 -0
- package/src/evolution/improvement-hypothesis.ts +67 -0
- package/src/evolution/index.ts +3 -0
- package/src/index.test.ts +54 -0
- package/src/index.ts +53 -0
- package/src/installer/index.ts +4 -0
- package/src/installer/install-plan.ts +49 -0
- package/src/installer/ownership-manifest.ts +36 -0
- package/src/installer/package-manifest.ts +54 -0
- package/src/learning/engineering-lesson.ts +55 -0
- package/src/learning/engineering-memory.ts +51 -0
- package/src/learning/experience-episode.ts +76 -0
- package/src/learning/experience.ts +27 -0
- package/src/learning/hypothesis.ts +33 -0
- package/src/learning/index.ts +8 -0
- package/src/learning/memory.ts +25 -0
- package/src/learning/promotion.ts +19 -0
- package/src/maintenance/bug-fix-workflow.ts +119 -0
- package/src/maintenance/bug-report.ts +58 -0
- package/src/maintenance/index.ts +6 -0
- package/src/maintenance/maintenance.test.ts +219 -0
- package/src/maintenance/performance-baseline.ts +35 -0
- package/src/maintenance/refactor-contract.ts +77 -0
- package/src/maintenance/refactor-workflow.ts +121 -0
- package/src/observer/event-schema.ts +54 -0
- package/src/observer/index.ts +5 -0
- package/src/observer/journal.test.ts +73 -0
- package/src/observer/journal.ts +84 -0
- package/src/observer/retention.ts +24 -0
- package/src/observer/run-summary.ts +37 -0
- package/src/patterns/index.ts +2 -0
- package/src/patterns/pattern.ts +80 -0
- package/src/planning/index.ts +2 -0
- package/src/planning/task.ts +47 -0
- package/src/policy/index.ts +2 -0
- package/src/policy/policy.test.ts +50 -0
- package/src/policy/policy.ts +67 -0
- package/src/product/index.ts +5 -0
- package/src/product/mvp-scope.ts +21 -0
- package/src/product/product-brief.test.ts +108 -0
- package/src/product/product-brief.ts +53 -0
- package/src/product/requirements.ts +59 -0
- package/src/product/traceability.ts +25 -0
- package/src/project/index.ts +3 -0
- package/src/project/project-profile.test.ts +98 -0
- package/src/project/project-profile.ts +65 -0
- package/src/project/repository-scan.ts +34 -0
- package/src/routing/capability-registry.ts +31 -0
- package/src/routing/escalation.ts +24 -0
- package/src/routing/index.ts +5 -0
- package/src/routing/routing-policy.ts +38 -0
- package/src/routing/routing-request.ts +55 -0
- package/src/runtime-guard/action-classification.ts +99 -0
- package/src/runtime-guard/audit-event.ts +49 -0
- package/src/runtime-guard/index.ts +4 -0
- package/src/runtime-guard/policy-schema.ts +56 -0
- package/src/runtime-guard/runtime-guard.test.ts +147 -0
- package/src/scaffolding/index.ts +3 -0
- package/src/scaffolding/scaffold-contract.test.ts +107 -0
- package/src/scaffolding/scaffold-contract.ts +63 -0
- package/src/scaffolding/template-manifest.ts +52 -0
- package/src/secret-guard/detection-rule.ts +115 -0
- package/src/secret-guard/finding.ts +93 -0
- package/src/secret-guard/index.ts +5 -0
- package/src/secret-guard/redaction-policy.ts +34 -0
- package/src/secret-guard/scanner-failure.ts +47 -0
- package/src/secret-guard/secret-guard.test.ts +130 -0
- package/src/specification/index.ts +2 -0
- package/src/specification/specification.ts +79 -0
- package/src/stack-pack/index.ts +2 -0
- package/src/stack-pack/manifest.ts +60 -0
- package/src/verification/index.ts +2 -0
- package/src/verification/report.test.ts +91 -0
- package/src/verification/report.ts +62 -0
- package/src/workflow/index.ts +3 -0
- package/src/workflow/next-action.test.ts +101 -0
- package/src/workflow/next-action.ts +101 -0
- package/src/workflow/workflow.ts +49 -0
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
// packages/contracts/src/application/application-state.test.ts
|
|
2
|
+
import { describe, expect, it } from 'vitest';
|
|
3
|
+
import { ApplicationStateSchema } from './application-state.js';
|
|
4
|
+
import {
|
|
5
|
+
COMPLETABLE_STAGES,
|
|
6
|
+
STAGE_ORDER,
|
|
7
|
+
TARGET_STATUS,
|
|
8
|
+
TRANSITIONS_BY_STATUS,
|
|
9
|
+
revisableFrom,
|
|
10
|
+
} from './application-transitions.js';
|
|
11
|
+
|
|
12
|
+
describe('ApplicationStateSchema', () => {
|
|
13
|
+
it('accepts a fresh pending state at the intake stage', () => {
|
|
14
|
+
const r = ApplicationStateSchema.safeParse({
|
|
15
|
+
schemaVersion: 1,
|
|
16
|
+
runId: 'RUN-001',
|
|
17
|
+
status: 'pending',
|
|
18
|
+
stage: 'intake',
|
|
19
|
+
stageHistory: [],
|
|
20
|
+
revisions: [],
|
|
21
|
+
});
|
|
22
|
+
expect(r.success).toBe(true);
|
|
23
|
+
});
|
|
24
|
+
it('rejects an unknown stage', () => {
|
|
25
|
+
const r = ApplicationStateSchema.safeParse({
|
|
26
|
+
schemaVersion: 1,
|
|
27
|
+
runId: 'RUN-001',
|
|
28
|
+
status: 'pending',
|
|
29
|
+
stage: 'bogus',
|
|
30
|
+
stageHistory: [],
|
|
31
|
+
revisions: [],
|
|
32
|
+
});
|
|
33
|
+
expect(r.success).toBe(false);
|
|
34
|
+
});
|
|
35
|
+
it('rejects an unknown status', () => {
|
|
36
|
+
const r = ApplicationStateSchema.safeParse({
|
|
37
|
+
schemaVersion: 1,
|
|
38
|
+
runId: 'RUN-001',
|
|
39
|
+
status: 'paused',
|
|
40
|
+
stage: 'intake',
|
|
41
|
+
stageHistory: [],
|
|
42
|
+
revisions: [],
|
|
43
|
+
});
|
|
44
|
+
expect(r.success).toBe(false);
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
describe('STAGE_ORDER', () => {
|
|
49
|
+
it('lists all 10 stages in canonical order', () => {
|
|
50
|
+
expect(STAGE_ORDER).toEqual([
|
|
51
|
+
'intake',
|
|
52
|
+
'discovery',
|
|
53
|
+
'requirements',
|
|
54
|
+
'architecture',
|
|
55
|
+
'planning',
|
|
56
|
+
'scaffolding',
|
|
57
|
+
'implementation',
|
|
58
|
+
'verification',
|
|
59
|
+
'review',
|
|
60
|
+
'release',
|
|
61
|
+
]);
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
describe('TRANSITIONS_BY_STATUS', () => {
|
|
66
|
+
it('allows start only from pending', () => {
|
|
67
|
+
expect(TRANSITIONS_BY_STATUS.pending).toEqual(['start']);
|
|
68
|
+
});
|
|
69
|
+
it('allows advance/block/complete/fail/revise from in_progress', () => {
|
|
70
|
+
expect(TRANSITIONS_BY_STATUS.in_progress).toContain('advance');
|
|
71
|
+
expect(TRANSITIONS_BY_STATUS.in_progress).toContain('block');
|
|
72
|
+
expect(TRANSITIONS_BY_STATUS.in_progress).toContain('complete');
|
|
73
|
+
expect(TRANSITIONS_BY_STATUS.in_progress).toContain('fail');
|
|
74
|
+
expect(TRANSITIONS_BY_STATUS.in_progress).toContain('revise');
|
|
75
|
+
});
|
|
76
|
+
it('makes completed and failed terminal', () => {
|
|
77
|
+
expect(TRANSITIONS_BY_STATUS.completed).toEqual([]);
|
|
78
|
+
expect(TRANSITIONS_BY_STATUS.failed).toEqual([]);
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
describe('TARGET_STATUS', () => {
|
|
83
|
+
it('maps every transition to a status', () => {
|
|
84
|
+
expect(TARGET_STATUS.start).toBe('in_progress');
|
|
85
|
+
expect(TARGET_STATUS.advance).toBe('in_progress');
|
|
86
|
+
expect(TARGET_STATUS.block).toBe('blocked');
|
|
87
|
+
expect(TARGET_STATUS.resume).toBe('in_progress');
|
|
88
|
+
expect(TARGET_STATUS.complete).toBe('completed');
|
|
89
|
+
expect(TARGET_STATUS.fail).toBe('failed');
|
|
90
|
+
expect(TARGET_STATUS.revise).toBe('in_progress');
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
describe('COMPLETABLE_STAGES', () => {
|
|
95
|
+
it('only allows complete from the release stage', () => {
|
|
96
|
+
expect(COMPLETABLE_STAGES).toEqual(['release']);
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
describe('revisableFrom', () => {
|
|
101
|
+
it('returns all prior stages for a given stage', () => {
|
|
102
|
+
expect(revisableFrom('architecture')).toEqual(['intake', 'discovery', 'requirements']);
|
|
103
|
+
});
|
|
104
|
+
it('returns an empty array for the first stage', () => {
|
|
105
|
+
expect(revisableFrom('intake')).toEqual([]);
|
|
106
|
+
});
|
|
107
|
+
});
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
// packages/contracts/src/application/application-state.ts
|
|
2
|
+
//
|
|
3
|
+
// Application workflow state (M8 Phase A — M8-01, M8-02).
|
|
4
|
+
//
|
|
5
|
+
// The /kit:app workflow has a richer lifecycle than the generic feature
|
|
6
|
+
// workflow because it covers product discovery, architecture, scaffolding,
|
|
7
|
+
// and release — not just implementation. The state machine is defined
|
|
8
|
+
// here; the transition table is in application-transitions.ts and is
|
|
9
|
+
// enforced by core/workflows/application/transitions.ts.
|
|
10
|
+
//
|
|
11
|
+
// INVARIANT (ADR-0010): completed and failed are terminal. No transition
|
|
12
|
+
// may turn failed back into completed without a new run.
|
|
13
|
+
//
|
|
14
|
+
// See post-M7 roadmap §2.2 and ADR-0010.
|
|
15
|
+
|
|
16
|
+
import { z } from 'zod';
|
|
17
|
+
import type { RunId, TaskId } from '../common/identifier.js';
|
|
18
|
+
|
|
19
|
+
export const APPLICATION_STAGE = z.enum([
|
|
20
|
+
'intake', // product brief captured
|
|
21
|
+
'discovery', // problem & user analysis
|
|
22
|
+
'requirements', // PRD + functional + non-functional
|
|
23
|
+
'architecture', // ADRs + component map + data model + API + security
|
|
24
|
+
'planning', // vertical-slice plan
|
|
25
|
+
'scaffolding', // initial project structure
|
|
26
|
+
'implementation', // M5 engine drives incremental slices
|
|
27
|
+
'verification', // M6 engine drives verification
|
|
28
|
+
'review', // independent review
|
|
29
|
+
'release', // release readiness
|
|
30
|
+
]);
|
|
31
|
+
export type ApplicationStage = z.infer<typeof APPLICATION_STAGE>;
|
|
32
|
+
|
|
33
|
+
export const APPLICATION_STATUS = z.enum([
|
|
34
|
+
'pending', // workflow created, not started
|
|
35
|
+
'in_progress', // a stage is currently executing
|
|
36
|
+
'blocked', // waiting on approval or unresolved decision
|
|
37
|
+
'completed', // release shipped and verified
|
|
38
|
+
'failed', // a stage failed or verification failed
|
|
39
|
+
]);
|
|
40
|
+
export type ApplicationStatus = z.infer<typeof APPLICATION_STATUS>;
|
|
41
|
+
|
|
42
|
+
export const APPLICATION_TRANSITION = z.enum([
|
|
43
|
+
'start', // pending → in_progress
|
|
44
|
+
'advance', // in_progress → in_progress (next stage)
|
|
45
|
+
'block', // in_progress → blocked
|
|
46
|
+
'resume', // blocked → in_progress
|
|
47
|
+
'complete', // in_progress → completed (after release stage)
|
|
48
|
+
'fail', // in_progress|blocked → failed
|
|
49
|
+
'revise', // in_progress → in_progress (revisit prior stage)
|
|
50
|
+
]);
|
|
51
|
+
export type ApplicationTransition = z.infer<typeof APPLICATION_TRANSITION>;
|
|
52
|
+
|
|
53
|
+
export const ApplicationStateSchema = z.object({
|
|
54
|
+
schemaVersion: z.literal(1),
|
|
55
|
+
runId: z.string(),
|
|
56
|
+
status: APPLICATION_STATUS,
|
|
57
|
+
stage: APPLICATION_STAGE,
|
|
58
|
+
startedAt: z.string().optional(),
|
|
59
|
+
currentTaskId: z.string().optional(),
|
|
60
|
+
stageHistory: z.array(
|
|
61
|
+
z.object({
|
|
62
|
+
stage: APPLICATION_STAGE,
|
|
63
|
+
enteredAt: z.string(),
|
|
64
|
+
exitedAt: z.string().optional(),
|
|
65
|
+
outcome: z
|
|
66
|
+
.enum(['pending', 'advanced', 'blocked', 'completed', 'failed', 'revised'])
|
|
67
|
+
.optional(),
|
|
68
|
+
}),
|
|
69
|
+
),
|
|
70
|
+
revisions: z.array(
|
|
71
|
+
z.object({
|
|
72
|
+
fromStage: APPLICATION_STAGE,
|
|
73
|
+
toStage: APPLICATION_STAGE,
|
|
74
|
+
reason: z.string(),
|
|
75
|
+
revisedAt: z.string(),
|
|
76
|
+
}),
|
|
77
|
+
),
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
export type ApplicationState = z.infer<typeof ApplicationStateSchema>;
|
|
81
|
+
export type { RunId, TaskId };
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
// packages/contracts/src/application/application-transitions.ts
|
|
2
|
+
//
|
|
3
|
+
// Application workflow transition table (M8 Phase A — M8-02).
|
|
4
|
+
//
|
|
5
|
+
// Allowed transitions and their target stage. This is the *contract*; the
|
|
6
|
+
// pure-function enforcement lives in core/workflows/application/transitions.ts.
|
|
7
|
+
//
|
|
8
|
+
// See post-M7 roadmap §2.2 and ADR-0010.
|
|
9
|
+
|
|
10
|
+
import type {
|
|
11
|
+
ApplicationStage,
|
|
12
|
+
ApplicationStatus,
|
|
13
|
+
ApplicationTransition,
|
|
14
|
+
} from './application-state.js';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Stages in canonical order. `advance` moves to the next stage in this
|
|
18
|
+
* list. `revise` may move to any prior stage.
|
|
19
|
+
*/
|
|
20
|
+
export const STAGE_ORDER: ReadonlyArray<ApplicationStage> = [
|
|
21
|
+
'intake',
|
|
22
|
+
'discovery',
|
|
23
|
+
'requirements',
|
|
24
|
+
'architecture',
|
|
25
|
+
'planning',
|
|
26
|
+
'scaffolding',
|
|
27
|
+
'implementation',
|
|
28
|
+
'verification',
|
|
29
|
+
'review',
|
|
30
|
+
'release',
|
|
31
|
+
];
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Per-status allowed transitions.
|
|
35
|
+
*/
|
|
36
|
+
export const TRANSITIONS_BY_STATUS: Readonly<
|
|
37
|
+
Record<ApplicationStatus, ReadonlyArray<ApplicationTransition>>
|
|
38
|
+
> = {
|
|
39
|
+
pending: ['start'],
|
|
40
|
+
in_progress: ['advance', 'block', 'complete', 'fail', 'revise'],
|
|
41
|
+
blocked: ['resume', 'fail'],
|
|
42
|
+
completed: [],
|
|
43
|
+
failed: [],
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* The target status for a transition (independent of stage).
|
|
48
|
+
*/
|
|
49
|
+
export const TARGET_STATUS: Readonly<Record<ApplicationTransition, ApplicationStatus>> = {
|
|
50
|
+
start: 'in_progress',
|
|
51
|
+
advance: 'in_progress',
|
|
52
|
+
block: 'blocked',
|
|
53
|
+
resume: 'in_progress',
|
|
54
|
+
complete: 'completed',
|
|
55
|
+
fail: 'failed',
|
|
56
|
+
revise: 'in_progress',
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* The release stage is the only stage from which `complete` is allowed.
|
|
61
|
+
*/
|
|
62
|
+
export const COMPLETABLE_STAGES: ReadonlyArray<ApplicationStage> = ['release'];
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Stages reachable via `revise` from a given stage = all earlier stages.
|
|
66
|
+
*/
|
|
67
|
+
export function revisableFrom(stage: ApplicationStage): ReadonlyArray<ApplicationStage> {
|
|
68
|
+
const idx = STAGE_ORDER.indexOf(stage);
|
|
69
|
+
if (idx <= 0) return [];
|
|
70
|
+
return STAGE_ORDER.slice(0, idx);
|
|
71
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// packages/contracts/src/architecture/api-contract.ts
|
|
2
|
+
//
|
|
3
|
+
// API design contract (M8 Phase C — M8-15).
|
|
4
|
+
//
|
|
5
|
+
// The kit uses a minimal, OpenAPI-flavored contract rather than a full
|
|
6
|
+
// OpenAPI 3.1 document. This keeps the contract reviewable and lets a
|
|
7
|
+
// later stage emit a full OpenAPI document if needed.
|
|
8
|
+
|
|
9
|
+
import { z } from 'zod';
|
|
10
|
+
|
|
11
|
+
export const HttpMethodSchema = z.enum(['GET', 'POST', 'PUT', 'PATCH', 'DELETE']);
|
|
12
|
+
|
|
13
|
+
export const ParameterLocationSchema = z.enum(['path', 'query', 'header', 'body']);
|
|
14
|
+
|
|
15
|
+
export const ParameterSchema = z.object({
|
|
16
|
+
name: z.string().min(1),
|
|
17
|
+
location: ParameterLocationSchema,
|
|
18
|
+
type: z.string().min(1),
|
|
19
|
+
required: z.boolean(),
|
|
20
|
+
description: z.string().min(1),
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export const ResponseSchema = z.object({
|
|
24
|
+
status: z.number().int().min(100).max(599),
|
|
25
|
+
description: z.string().min(1),
|
|
26
|
+
// Reference to a DataModel entity or a free-form shape name.
|
|
27
|
+
bodyRef: z.string().optional(),
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export const EndpointSchema = z.object({
|
|
31
|
+
id: z.string(),
|
|
32
|
+
method: HttpMethodSchema,
|
|
33
|
+
path: z.string().min(1).startsWith('/'),
|
|
34
|
+
operationId: z.string().min(1),
|
|
35
|
+
summary: z.string().min(1),
|
|
36
|
+
parameters: z.array(ParameterSchema).default([]),
|
|
37
|
+
responses: z.array(ResponseSchema).min(1),
|
|
38
|
+
// Authentication required?
|
|
39
|
+
requiresAuth: z.boolean().default(true),
|
|
40
|
+
// Required role(s) if any.
|
|
41
|
+
requiredRoles: z.array(z.string()).default([]),
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
export const ApiContractSchema = z.object({
|
|
45
|
+
schemaVersion: z.literal(1),
|
|
46
|
+
briefId: z.string(),
|
|
47
|
+
baseUrl: z.string().optional(),
|
|
48
|
+
endpoints: z.array(EndpointSchema),
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
export type HttpMethod = z.infer<typeof HttpMethodSchema>;
|
|
52
|
+
export type ParameterLocation = z.infer<typeof ParameterLocationSchema>;
|
|
53
|
+
export type Parameter = z.infer<typeof ParameterSchema>;
|
|
54
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
55
|
+
export type Endpoint = z.infer<typeof EndpointSchema>;
|
|
56
|
+
export type ApiContract = z.infer<typeof ApiContractSchema>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// packages/contracts/src/architecture/architecture-approval.ts
|
|
2
|
+
//
|
|
3
|
+
// Architecture approval contract (M8 Phase C — M8-19).
|
|
4
|
+
//
|
|
5
|
+
// Once an architecture option is selected, the kit freezes the design
|
|
6
|
+
// baseline as a set of ADR references. Any subsequent revision must go
|
|
7
|
+
// through `revise` transition and produce a new ADR.
|
|
8
|
+
|
|
9
|
+
import { z } from 'zod';
|
|
10
|
+
|
|
11
|
+
export const ArchitectureApprovalSchema = z.object({
|
|
12
|
+
schemaVersion: z.literal(1),
|
|
13
|
+
briefId: z.string(),
|
|
14
|
+
selectedOptionId: z.string(),
|
|
15
|
+
// ADR IDs that document the approved decisions.
|
|
16
|
+
adrIds: z.array(z.string()),
|
|
17
|
+
// References to the architecture sub-artifacts.
|
|
18
|
+
componentMapId: z.string(),
|
|
19
|
+
dataModelId: z.string(),
|
|
20
|
+
apiContractId: z.string(),
|
|
21
|
+
securityDesignId: z.string(),
|
|
22
|
+
operationalDesignId: z.string(),
|
|
23
|
+
approvedBy: z.string(),
|
|
24
|
+
approvedAt: z.string(),
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export type ArchitectureApproval = z.infer<typeof ArchitectureApprovalSchema>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// packages/contracts/src/architecture/architecture-options.ts
|
|
2
|
+
//
|
|
3
|
+
// Architecture options contract (M8 Phase C — M8-12).
|
|
4
|
+
//
|
|
5
|
+
// The kit proposes alternative architecture options; the developer picks
|
|
6
|
+
// one. The choice is recorded as an ADR. The kit MUST NOT default to
|
|
7
|
+
// microservices or distributed infrastructure; every option must be
|
|
8
|
+
// justified by actual requirements.
|
|
9
|
+
|
|
10
|
+
import { z } from 'zod';
|
|
11
|
+
|
|
12
|
+
export const ArchitectureOptionKindSchema = z.enum([
|
|
13
|
+
'modular-monolith',
|
|
14
|
+
'microservices',
|
|
15
|
+
'modular-monolith-with-bounded-contexts',
|
|
16
|
+
'serverless',
|
|
17
|
+
'other',
|
|
18
|
+
]);
|
|
19
|
+
|
|
20
|
+
export const ArchitectureOptionSchema = z.object({
|
|
21
|
+
id: z.string(),
|
|
22
|
+
kind: ArchitectureOptionKindSchema,
|
|
23
|
+
name: z.string().min(1),
|
|
24
|
+
rationale: z.string().min(1),
|
|
25
|
+
pros: z.array(z.string()),
|
|
26
|
+
cons: z.array(z.string()),
|
|
27
|
+
// Requirements that justify this option (must trace to a real requirement).
|
|
28
|
+
justifiedBy: z.array(z.string()),
|
|
29
|
+
rejected: z.boolean().default(false),
|
|
30
|
+
rejectionReason: z.string().optional(),
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
export const ArchitectureOptionsSchema = z.object({
|
|
34
|
+
schemaVersion: z.literal(1),
|
|
35
|
+
briefId: z.string(),
|
|
36
|
+
options: z.array(ArchitectureOptionSchema).min(2, 'at least two options required'),
|
|
37
|
+
selectedOptionId: z.string(),
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
export type ArchitectureOptionKind = z.infer<typeof ArchitectureOptionKindSchema>;
|
|
41
|
+
export type ArchitectureOption = z.infer<typeof ArchitectureOptionSchema>;
|
|
42
|
+
export type ArchitectureOptions = z.infer<typeof ArchitectureOptionsSchema>;
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
// packages/contracts/src/architecture/architecture.test.ts
|
|
2
|
+
import { describe, expect, it } from 'vitest';
|
|
3
|
+
import { ArchitectureOptionsSchema } from './architecture-options.js';
|
|
4
|
+
import { ComponentMapSchema } from './component-map.js';
|
|
5
|
+
import { DataModelSchema } from './data-model.js';
|
|
6
|
+
import { ApiContractSchema } from './api-contract.js';
|
|
7
|
+
import { SecurityDesignSchema } from './security-design.js';
|
|
8
|
+
import { OperationalDesignSchema } from './operational-design.js';
|
|
9
|
+
import { ArchitectureApprovalSchema } from './architecture-approval.js';
|
|
10
|
+
|
|
11
|
+
describe('ArchitectureOptionsSchema', () => {
|
|
12
|
+
it('accepts at least two options and a selection', () => {
|
|
13
|
+
expect(
|
|
14
|
+
ArchitectureOptionsSchema.safeParse({
|
|
15
|
+
schemaVersion: 1,
|
|
16
|
+
briefId: 'BRIEF-001',
|
|
17
|
+
options: [
|
|
18
|
+
{
|
|
19
|
+
id: 'OPT-1',
|
|
20
|
+
kind: 'modular-monolith',
|
|
21
|
+
name: 'Modular Monolith',
|
|
22
|
+
rationale: 'small team, fast iteration',
|
|
23
|
+
pros: ['simple deploy'],
|
|
24
|
+
cons: ['scaling limits'],
|
|
25
|
+
justifiedBy: ['FR-1'],
|
|
26
|
+
rejected: false,
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
id: 'OPT-2',
|
|
30
|
+
kind: 'microservices',
|
|
31
|
+
name: 'Microservices',
|
|
32
|
+
rationale: 'independent scaling',
|
|
33
|
+
pros: ['scale independently'],
|
|
34
|
+
cons: ['operational complexity'],
|
|
35
|
+
justifiedBy: ['NFR-perf'],
|
|
36
|
+
rejected: true,
|
|
37
|
+
rejectionReason: 'team too small',
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
selectedOptionId: 'OPT-1',
|
|
41
|
+
}).success,
|
|
42
|
+
).toBe(true);
|
|
43
|
+
});
|
|
44
|
+
it('rejects a single-option set', () => {
|
|
45
|
+
expect(
|
|
46
|
+
ArchitectureOptionsSchema.safeParse({
|
|
47
|
+
schemaVersion: 1,
|
|
48
|
+
briefId: 'BRIEF-001',
|
|
49
|
+
options: [
|
|
50
|
+
{
|
|
51
|
+
id: 'OPT-1',
|
|
52
|
+
kind: 'modular-monolith',
|
|
53
|
+
name: 'x',
|
|
54
|
+
rationale: 'y',
|
|
55
|
+
pros: [],
|
|
56
|
+
cons: [],
|
|
57
|
+
justifiedBy: [],
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
selectedOptionId: 'OPT-1',
|
|
61
|
+
}).success,
|
|
62
|
+
).toBe(false);
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
describe('ComponentMapSchema', () => {
|
|
67
|
+
it('accepts a valid map', () => {
|
|
68
|
+
expect(
|
|
69
|
+
ComponentMapSchema.safeParse({
|
|
70
|
+
schemaVersion: 1,
|
|
71
|
+
briefId: 'BRIEF-001',
|
|
72
|
+
components: [
|
|
73
|
+
{
|
|
74
|
+
id: 'C-1',
|
|
75
|
+
kind: 'backend',
|
|
76
|
+
name: 'API',
|
|
77
|
+
responsibility: 'serves REST',
|
|
78
|
+
dependsOn: [],
|
|
79
|
+
filePaths: [],
|
|
80
|
+
},
|
|
81
|
+
],
|
|
82
|
+
}).success,
|
|
83
|
+
).toBe(true);
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
describe('DataModelSchema', () => {
|
|
88
|
+
it('accepts a valid model with a reference field', () => {
|
|
89
|
+
expect(
|
|
90
|
+
DataModelSchema.safeParse({
|
|
91
|
+
schemaVersion: 1,
|
|
92
|
+
briefId: 'BRIEF-001',
|
|
93
|
+
entities: [
|
|
94
|
+
{
|
|
95
|
+
id: 'E-1',
|
|
96
|
+
name: 'User',
|
|
97
|
+
fields: [
|
|
98
|
+
{ name: 'id', type: 'uuid', required: true, unique: true, indexed: true },
|
|
99
|
+
{
|
|
100
|
+
name: 'orgId',
|
|
101
|
+
type: 'reference',
|
|
102
|
+
required: true,
|
|
103
|
+
unique: false,
|
|
104
|
+
indexed: false,
|
|
105
|
+
references: 'Org',
|
|
106
|
+
},
|
|
107
|
+
],
|
|
108
|
+
conventions: [],
|
|
109
|
+
},
|
|
110
|
+
],
|
|
111
|
+
relationships: [
|
|
112
|
+
{
|
|
113
|
+
id: 'R-1',
|
|
114
|
+
fromEntityId: 'E-1',
|
|
115
|
+
toEntityId: 'E-2',
|
|
116
|
+
kind: 'many-to-one',
|
|
117
|
+
enforcedAt: 'database',
|
|
118
|
+
},
|
|
119
|
+
],
|
|
120
|
+
}).success,
|
|
121
|
+
).toBe(false); // 'many-to-one' is not a valid RelationshipKind
|
|
122
|
+
});
|
|
123
|
+
it('accepts with a valid relationship kind', () => {
|
|
124
|
+
expect(
|
|
125
|
+
DataModelSchema.safeParse({
|
|
126
|
+
schemaVersion: 1,
|
|
127
|
+
briefId: 'BRIEF-001',
|
|
128
|
+
entities: [
|
|
129
|
+
{
|
|
130
|
+
id: 'E-1',
|
|
131
|
+
name: 'User',
|
|
132
|
+
fields: [{ name: 'id', type: 'uuid', required: true, unique: true, indexed: true }],
|
|
133
|
+
conventions: [],
|
|
134
|
+
},
|
|
135
|
+
],
|
|
136
|
+
relationships: [
|
|
137
|
+
{
|
|
138
|
+
id: 'R-1',
|
|
139
|
+
fromEntityId: 'E-1',
|
|
140
|
+
toEntityId: 'E-2',
|
|
141
|
+
kind: 'one-to-many',
|
|
142
|
+
enforcedAt: 'database',
|
|
143
|
+
},
|
|
144
|
+
],
|
|
145
|
+
}).success,
|
|
146
|
+
).toBe(true);
|
|
147
|
+
});
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
describe('ApiContractSchema', () => {
|
|
151
|
+
it('accepts a valid contract', () => {
|
|
152
|
+
expect(
|
|
153
|
+
ApiContractSchema.safeParse({
|
|
154
|
+
schemaVersion: 1,
|
|
155
|
+
briefId: 'BRIEF-001',
|
|
156
|
+
endpoints: [
|
|
157
|
+
{
|
|
158
|
+
id: 'EP-1',
|
|
159
|
+
method: 'GET',
|
|
160
|
+
path: '/users',
|
|
161
|
+
operationId: 'listUsers',
|
|
162
|
+
summary: 'List users',
|
|
163
|
+
parameters: [],
|
|
164
|
+
responses: [{ status: 200, description: 'ok' }],
|
|
165
|
+
requiresAuth: true,
|
|
166
|
+
requiredRoles: ['admin'],
|
|
167
|
+
},
|
|
168
|
+
],
|
|
169
|
+
}).success,
|
|
170
|
+
).toBe(true);
|
|
171
|
+
});
|
|
172
|
+
it('rejects a path that does not start with /', () => {
|
|
173
|
+
expect(
|
|
174
|
+
ApiContractSchema.safeParse({
|
|
175
|
+
schemaVersion: 1,
|
|
176
|
+
briefId: 'BRIEF-001',
|
|
177
|
+
endpoints: [
|
|
178
|
+
{
|
|
179
|
+
id: 'EP-1',
|
|
180
|
+
method: 'GET',
|
|
181
|
+
path: 'users',
|
|
182
|
+
operationId: 'listUsers',
|
|
183
|
+
summary: 'List users',
|
|
184
|
+
parameters: [],
|
|
185
|
+
responses: [{ status: 200, description: 'ok' }],
|
|
186
|
+
},
|
|
187
|
+
],
|
|
188
|
+
}).success,
|
|
189
|
+
).toBe(false);
|
|
190
|
+
});
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
describe('SecurityDesignSchema', () => {
|
|
194
|
+
it('accepts a valid design', () => {
|
|
195
|
+
expect(
|
|
196
|
+
SecurityDesignSchema.safeParse({
|
|
197
|
+
schemaVersion: 1,
|
|
198
|
+
briefId: 'BRIEF-001',
|
|
199
|
+
authentication: {
|
|
200
|
+
method: 'jwt',
|
|
201
|
+
rationale: 'stateless, mobile-friendly',
|
|
202
|
+
credentialStore: 'env',
|
|
203
|
+
},
|
|
204
|
+
authorization: {
|
|
205
|
+
model: 'rbac',
|
|
206
|
+
roles: ['admin', 'user'],
|
|
207
|
+
protectedResources: ['/admin'],
|
|
208
|
+
},
|
|
209
|
+
threats: [
|
|
210
|
+
{
|
|
211
|
+
id: 'T-1',
|
|
212
|
+
threat: 'token theft',
|
|
213
|
+
severity: 'high',
|
|
214
|
+
mitigation: 'short TTL + refresh rotation',
|
|
215
|
+
},
|
|
216
|
+
],
|
|
217
|
+
secrets: { loader: 'env', rotationPolicy: 'manual quarterly' },
|
|
218
|
+
}).success,
|
|
219
|
+
).toBe(true);
|
|
220
|
+
});
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
describe('OperationalDesignSchema', () => {
|
|
224
|
+
it('accepts a valid design', () => {
|
|
225
|
+
expect(
|
|
226
|
+
OperationalDesignSchema.safeParse({
|
|
227
|
+
schemaVersion: 1,
|
|
228
|
+
briefId: 'BRIEF-001',
|
|
229
|
+
deployment: {
|
|
230
|
+
target: 'container-orchestrated',
|
|
231
|
+
rationale: 'auto-scaling',
|
|
232
|
+
regions: ['us-east'],
|
|
233
|
+
},
|
|
234
|
+
configuration: {
|
|
235
|
+
source: 'env',
|
|
236
|
+
variables: [{ name: 'DATABASE_URL', required: true, sensitive: true, description: 'DB' }],
|
|
237
|
+
},
|
|
238
|
+
observability: { channels: ['logs', 'metrics'], sinks: ['stdout'] },
|
|
239
|
+
scaling: { strategy: 'horizontal', triggers: ['cpu>80%'] },
|
|
240
|
+
}).success,
|
|
241
|
+
).toBe(true);
|
|
242
|
+
});
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
describe('ArchitectureApprovalSchema', () => {
|
|
246
|
+
it('accepts a valid approval', () => {
|
|
247
|
+
expect(
|
|
248
|
+
ArchitectureApprovalSchema.safeParse({
|
|
249
|
+
schemaVersion: 1,
|
|
250
|
+
briefId: 'BRIEF-001',
|
|
251
|
+
selectedOptionId: 'OPT-1',
|
|
252
|
+
adrIds: ['ADR-0100'],
|
|
253
|
+
componentMapId: 'CM-1',
|
|
254
|
+
dataModelId: 'DM-1',
|
|
255
|
+
apiContractId: 'API-1',
|
|
256
|
+
securityDesignId: 'SD-1',
|
|
257
|
+
operationalDesignId: 'OD-1',
|
|
258
|
+
approvedBy: 'lead',
|
|
259
|
+
approvedAt: '2026-01-01T00:00:00.000Z',
|
|
260
|
+
}).success,
|
|
261
|
+
).toBe(true);
|
|
262
|
+
});
|
|
263
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// packages/contracts/src/architecture/component-map.ts
|
|
2
|
+
//
|
|
3
|
+
// Component and module map (M8 Phase C — M8-13).
|
|
4
|
+
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
|
|
7
|
+
export const ComponentKindSchema = z.enum([
|
|
8
|
+
'frontend',
|
|
9
|
+
'backend',
|
|
10
|
+
'service',
|
|
11
|
+
'data-store',
|
|
12
|
+
'external-integration',
|
|
13
|
+
'background-job',
|
|
14
|
+
'shared-library',
|
|
15
|
+
]);
|
|
16
|
+
|
|
17
|
+
export const ComponentSchema = z.object({
|
|
18
|
+
id: z.string(),
|
|
19
|
+
kind: ComponentKindSchema,
|
|
20
|
+
name: z.string().min(1),
|
|
21
|
+
responsibility: z.string().min(1),
|
|
22
|
+
dependsOn: z.array(z.string()),
|
|
23
|
+
// Files / modules where this component lives. Filled in during scaffolding.
|
|
24
|
+
filePaths: z.array(z.string()).default([]),
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export const ComponentMapSchema = z.object({
|
|
28
|
+
schemaVersion: z.literal(1),
|
|
29
|
+
briefId: z.string(),
|
|
30
|
+
components: z.array(ComponentSchema),
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
export type ComponentKind = z.infer<typeof ComponentKindSchema>;
|
|
34
|
+
export type Component = z.infer<typeof ComponentSchema>;
|
|
35
|
+
export type ComponentMap = z.infer<typeof ComponentMapSchema>;
|