@transitrix/diagrams 1.0.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 +47 -0
- package/dist/__tests__/edge-path.test.d.ts +1 -0
- package/dist/__tests__/edge-path.test.js +39 -0
- package/dist/__tests__/scope.test.d.ts +1 -0
- package/dist/__tests__/scope.test.js +23 -0
- package/dist/__tests__/yaml-normalize.test.d.ts +1 -0
- package/dist/__tests__/yaml-normalize.test.js +148 -0
- package/dist/activities/__tests__/cpm.test.d.ts +1 -0
- package/dist/activities/__tests__/cpm.test.js +146 -0
- package/dist/activities/__tests__/gantt.test.d.ts +1 -0
- package/dist/activities/__tests__/gantt.test.js +224 -0
- package/dist/activities/__tests__/layout.test.d.ts +1 -0
- package/dist/activities/__tests__/layout.test.js +98 -0
- package/dist/activities/__tests__/validate.test.d.ts +1 -0
- package/dist/activities/__tests__/validate.test.js +363 -0
- package/dist/activities/cpm.d.ts +2 -0
- package/dist/activities/cpm.js +86 -0
- package/dist/activities/gantt.d.ts +6 -0
- package/dist/activities/gantt.js +250 -0
- package/dist/activities/index.d.ts +5 -0
- package/dist/activities/index.js +4 -0
- package/dist/activities/layout.d.ts +2 -0
- package/dist/activities/layout.js +103 -0
- package/dist/activities/types.d.ts +125 -0
- package/dist/activities/types.js +1 -0
- package/dist/activities/validate.d.ts +2 -0
- package/dist/activities/validate.js +326 -0
- package/dist/activity-card/__tests__/example.test.d.ts +1 -0
- package/dist/activity-card/__tests__/example.test.js +56 -0
- package/dist/activity-card/__tests__/layout.test.d.ts +1 -0
- package/dist/activity-card/__tests__/layout.test.js +57 -0
- package/dist/activity-card/__tests__/resolver.test.d.ts +1 -0
- package/dist/activity-card/__tests__/resolver.test.js +146 -0
- package/dist/activity-card/__tests__/validate.test.d.ts +1 -0
- package/dist/activity-card/__tests__/validate.test.js +116 -0
- package/dist/activity-card/index.d.ts +5 -0
- package/dist/activity-card/index.js +3 -0
- package/dist/activity-card/layout.d.ts +7 -0
- package/dist/activity-card/layout.js +167 -0
- package/dist/activity-card/resolver.d.ts +7 -0
- package/dist/activity-card/resolver.js +310 -0
- package/dist/activity-card/types.d.ts +175 -0
- package/dist/activity-card/types.js +20 -0
- package/dist/activity-card/validate.d.ts +3 -0
- package/dist/activity-card/validate.js +145 -0
- package/dist/actor/__tests__/validate.test.d.ts +1 -0
- package/dist/actor/__tests__/validate.test.js +57 -0
- package/dist/actor/index.d.ts +3 -0
- package/dist/actor/index.js +2 -0
- package/dist/actor/types.d.ts +20 -0
- package/dist/actor/types.js +4 -0
- package/dist/actor/validate.d.ts +2 -0
- package/dist/actor/validate.js +34 -0
- package/dist/applications/__tests__/validate.test.d.ts +1 -0
- package/dist/applications/__tests__/validate.test.js +223 -0
- package/dist/applications/index.d.ts +2 -0
- package/dist/applications/index.js +1 -0
- package/dist/applications/types.d.ts +39 -0
- package/dist/applications/types.js +1 -0
- package/dist/applications/validate.d.ts +3 -0
- package/dist/applications/validate.js +109 -0
- package/dist/assertion/__tests__/example.test.d.ts +1 -0
- package/dist/assertion/__tests__/example.test.js +32 -0
- package/dist/assertion/__tests__/validate.test.d.ts +1 -0
- package/dist/assertion/__tests__/validate.test.js +130 -0
- package/dist/assertion/index.d.ts +4 -0
- package/dist/assertion/index.js +2 -0
- package/dist/assertion/types.d.ts +43 -0
- package/dist/assertion/types.js +7 -0
- package/dist/assertion/validate.d.ts +9 -0
- package/dist/assertion/validate.js +137 -0
- package/dist/blocks/__tests__/layout.test.d.ts +1 -0
- package/dist/blocks/__tests__/layout.test.js +153 -0
- package/dist/blocks/__tests__/validate.test.d.ts +1 -0
- package/dist/blocks/__tests__/validate.test.js +235 -0
- package/dist/blocks/index.d.ts +4 -0
- package/dist/blocks/index.js +2 -0
- package/dist/blocks/layout.d.ts +4 -0
- package/dist/blocks/layout.js +145 -0
- package/dist/blocks/types.d.ts +56 -0
- package/dist/blocks/types.js +1 -0
- package/dist/blocks/validate.d.ts +9 -0
- package/dist/blocks/validate.js +186 -0
- package/dist/capability-map/__tests__/validate.test.d.ts +1 -0
- package/dist/capability-map/__tests__/validate.test.js +212 -0
- package/dist/capability-map/index.d.ts +2 -0
- package/dist/capability-map/index.js +1 -0
- package/dist/capability-map/types.d.ts +26 -0
- package/dist/capability-map/types.js +1 -0
- package/dist/capability-map/validate.d.ts +3 -0
- package/dist/capability-map/validate.js +103 -0
- package/dist/change/__tests__/validate.test.d.ts +1 -0
- package/dist/change/__tests__/validate.test.js +73 -0
- package/dist/change/index.d.ts +2 -0
- package/dist/change/index.js +1 -0
- package/dist/change/types.d.ts +17 -0
- package/dist/change/types.js +3 -0
- package/dist/change/validate.d.ts +2 -0
- package/dist/change/validate.js +57 -0
- package/dist/compliance/__tests__/classify.test.d.ts +1 -0
- package/dist/compliance/__tests__/classify.test.js +24 -0
- package/dist/compliance/__tests__/confidence.test.d.ts +1 -0
- package/dist/compliance/__tests__/confidence.test.js +78 -0
- package/dist/compliance/__tests__/coverage-metric.test.d.ts +1 -0
- package/dist/compliance/__tests__/coverage-metric.test.js +164 -0
- package/dist/compliance/__tests__/demo-scenario.test.d.ts +1 -0
- package/dist/compliance/__tests__/demo-scenario.test.js +226 -0
- package/dist/compliance/__tests__/example.test.d.ts +1 -0
- package/dist/compliance/__tests__/example.test.js +51 -0
- package/dist/compliance/__tests__/gap-report.test.d.ts +1 -0
- package/dist/compliance/__tests__/gap-report.test.js +113 -0
- package/dist/compliance/__tests__/html.test.d.ts +1 -0
- package/dist/compliance/__tests__/html.test.js +122 -0
- package/dist/compliance/__tests__/impact.test.d.ts +1 -0
- package/dist/compliance/__tests__/impact.test.js +410 -0
- package/dist/compliance/__tests__/markdown.test.d.ts +1 -0
- package/dist/compliance/__tests__/markdown.test.js +85 -0
- package/dist/compliance/__tests__/views.test.d.ts +1 -0
- package/dist/compliance/__tests__/views.test.js +59 -0
- package/dist/compliance/classify.d.ts +27 -0
- package/dist/compliance/classify.js +60 -0
- package/dist/compliance/confidence.d.ts +27 -0
- package/dist/compliance/confidence.js +43 -0
- package/dist/compliance/coverage-metric.d.ts +74 -0
- package/dist/compliance/coverage-metric.js +181 -0
- package/dist/compliance/gap-report.d.ts +20 -0
- package/dist/compliance/gap-report.js +64 -0
- package/dist/compliance/html.d.ts +22 -0
- package/dist/compliance/html.js +256 -0
- package/dist/compliance/impact.d.ts +251 -0
- package/dist/compliance/impact.js +464 -0
- package/dist/compliance/index.d.ts +16 -0
- package/dist/compliance/index.js +9 -0
- package/dist/compliance/markdown.d.ts +18 -0
- package/dist/compliance/markdown.js +129 -0
- package/dist/compliance/reverse-index.d.ts +8 -0
- package/dist/compliance/reverse-index.js +30 -0
- package/dist/compliance/types.d.ts +98 -0
- package/dist/compliance/types.js +5 -0
- package/dist/compliance/views.d.ts +14 -0
- package/dist/compliance/views.js +35 -0
- package/dist/compliance-matrix/__tests__/build.test.d.ts +1 -0
- package/dist/compliance-matrix/__tests__/build.test.js +183 -0
- package/dist/compliance-matrix/__tests__/example.test.d.ts +1 -0
- package/dist/compliance-matrix/__tests__/example.test.js +49 -0
- package/dist/compliance-matrix/build.d.ts +18 -0
- package/dist/compliance-matrix/build.js +0 -0
- package/dist/compliance-matrix/index.d.ts +2 -0
- package/dist/compliance-matrix/index.js +1 -0
- package/dist/compliance-matrix/types.d.ts +86 -0
- package/dist/compliance-matrix/types.js +8 -0
- package/dist/confidence/__tests__/score.test.d.ts +1 -0
- package/dist/confidence/__tests__/score.test.js +188 -0
- package/dist/confidence/index.d.ts +2 -0
- package/dist/confidence/index.js +1 -0
- package/dist/confidence/score.d.ts +62 -0
- package/dist/confidence/score.js +215 -0
- package/dist/confidence/types.d.ts +79 -0
- package/dist/confidence/types.js +6 -0
- package/dist/edge-path.d.ts +18 -0
- package/dist/edge-path.js +35 -0
- package/dist/element-envelope.d.ts +15 -0
- package/dist/element-envelope.js +55 -0
- package/dist/factor/__tests__/validate.test.d.ts +1 -0
- package/dist/factor/__tests__/validate.test.js +83 -0
- package/dist/factor/index.d.ts +3 -0
- package/dist/factor/index.js +2 -0
- package/dist/factor/types.d.ts +23 -0
- package/dist/factor/types.js +6 -0
- package/dist/factor/validate.d.ts +2 -0
- package/dist/factor/validate.js +69 -0
- package/dist/fgca/__tests__/chain-table.test.d.ts +1 -0
- package/dist/fgca/__tests__/chain-table.test.js +158 -0
- package/dist/fgca/__tests__/layout.test.d.ts +1 -0
- package/dist/fgca/__tests__/layout.test.js +140 -0
- package/dist/fgca/__tests__/parse-canonical.test.d.ts +1 -0
- package/dist/fgca/__tests__/parse-canonical.test.js +224 -0
- package/dist/fgca/__tests__/preview-layout.test.d.ts +1 -0
- package/dist/fgca/__tests__/preview-layout.test.js +106 -0
- package/dist/fgca/__tests__/validate.test.d.ts +1 -0
- package/dist/fgca/__tests__/validate.test.js +125 -0
- package/dist/fgca/chain-table.d.ts +36 -0
- package/dist/fgca/chain-table.js +177 -0
- package/dist/fgca/index.d.ts +16 -0
- package/dist/fgca/index.js +11 -0
- package/dist/fgca/layout.d.ts +27 -0
- package/dist/fgca/layout.js +156 -0
- package/dist/fgca/nodeTypes.d.ts +6 -0
- package/dist/fgca/nodeTypes.js +10 -0
- package/dist/fgca/nodes/FGCAActivityNode.d.ts +13 -0
- package/dist/fgca/nodes/FGCAActivityNode.js +35 -0
- package/dist/fgca/nodes/FGCAChangeNode.d.ts +12 -0
- package/dist/fgca/nodes/FGCAChangeNode.js +35 -0
- package/dist/fgca/nodes/FGCAFactorNode.d.ts +12 -0
- package/dist/fgca/nodes/FGCAFactorNode.js +35 -0
- package/dist/fgca/nodes/FGCAGoalNode.d.ts +14 -0
- package/dist/fgca/nodes/FGCAGoalNode.js +40 -0
- package/dist/fgca/parse-canonical.d.ts +58 -0
- package/dist/fgca/parse-canonical.js +339 -0
- package/dist/fgca/preview-layout.d.ts +87 -0
- package/dist/fgca/preview-layout.js +122 -0
- package/dist/fgca/types.d.ts +39 -0
- package/dist/fgca/types.js +7 -0
- package/dist/fgca/validate.d.ts +14 -0
- package/dist/fgca/validate.js +108 -0
- package/dist/geometry.d.ts +7 -0
- package/dist/geometry.js +2 -0
- package/dist/goals/__tests__/layout.test.d.ts +1 -0
- package/dist/goals/__tests__/layout.test.js +153 -0
- package/dist/goals/__tests__/mutations.test.d.ts +1 -0
- package/dist/goals/__tests__/mutations.test.js +95 -0
- package/dist/goals/__tests__/parse-canonical.test.d.ts +1 -0
- package/dist/goals/__tests__/parse-canonical.test.js +129 -0
- package/dist/goals/__tests__/validate.test.d.ts +1 -0
- package/dist/goals/__tests__/validate.test.js +183 -0
- package/dist/goals/index.d.ts +6 -0
- package/dist/goals/index.js +4 -0
- package/dist/goals/layout.d.ts +11 -0
- package/dist/goals/layout.js +147 -0
- package/dist/goals/mutations.d.ts +6 -0
- package/dist/goals/mutations.js +116 -0
- package/dist/goals/parse-canonical.d.ts +29 -0
- package/dist/goals/parse-canonical.js +257 -0
- package/dist/goals/types.d.ts +71 -0
- package/dist/goals/types.js +1 -0
- package/dist/goals/validate.d.ts +2 -0
- package/dist/goals/validate.js +122 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +23 -0
- package/dist/issues/__tests__/layout.test.d.ts +1 -0
- package/dist/issues/__tests__/layout.test.js +62 -0
- package/dist/issues/__tests__/validate.test.d.ts +1 -0
- package/dist/issues/__tests__/validate.test.js +82 -0
- package/dist/issues/index.d.ts +4 -0
- package/dist/issues/index.js +2 -0
- package/dist/issues/layout.d.ts +10 -0
- package/dist/issues/layout.js +82 -0
- package/dist/issues/types.d.ts +61 -0
- package/dist/issues/types.js +6 -0
- package/dist/issues/validate.d.ts +3 -0
- package/dist/issues/validate.js +143 -0
- package/dist/process-blueprint/__tests__/compliance-lane.test.d.ts +1 -0
- package/dist/process-blueprint/__tests__/compliance-lane.test.js +272 -0
- package/dist/process-blueprint/__tests__/layout.test.d.ts +1 -0
- package/dist/process-blueprint/__tests__/layout.test.js +159 -0
- package/dist/process-blueprint/__tests__/validate.test.d.ts +1 -0
- package/dist/process-blueprint/__tests__/validate.test.js +280 -0
- package/dist/process-blueprint/index.d.ts +4 -0
- package/dist/process-blueprint/index.js +2 -0
- package/dist/process-blueprint/layout.d.ts +2 -0
- package/dist/process-blueprint/layout.js +416 -0
- package/dist/process-blueprint/types.d.ts +220 -0
- package/dist/process-blueprint/types.js +1 -0
- package/dist/process-blueprint/validate.d.ts +3 -0
- package/dist/process-blueprint/validate.js +165 -0
- package/dist/process-map/__tests__/validate.test.d.ts +1 -0
- package/dist/process-map/__tests__/validate.test.js +199 -0
- package/dist/process-map/index.d.ts +2 -0
- package/dist/process-map/index.js +1 -0
- package/dist/process-map/types.d.ts +32 -0
- package/dist/process-map/types.js +1 -0
- package/dist/process-map/validate.d.ts +3 -0
- package/dist/process-map/validate.js +115 -0
- package/dist/products/__tests__/validate.test.d.ts +1 -0
- package/dist/products/__tests__/validate.test.js +210 -0
- package/dist/products/index.d.ts +2 -0
- package/dist/products/index.js +1 -0
- package/dist/products/types.d.ts +28 -0
- package/dist/products/types.js +1 -0
- package/dist/products/validate.d.ts +3 -0
- package/dist/products/validate.js +93 -0
- package/dist/repo-validate/__tests__/validate-repo.test.d.ts +1 -0
- package/dist/repo-validate/__tests__/validate-repo.test.js +132 -0
- package/dist/repo-validate/index.d.ts +2 -0
- package/dist/repo-validate/index.js +1 -0
- package/dist/repo-validate/types.d.ts +34 -0
- package/dist/repo-validate/types.js +14 -0
- package/dist/repo-validate/validate-repo.d.ts +8 -0
- package/dist/repo-validate/validate-repo.js +189 -0
- package/dist/requirement/__tests__/example.test.d.ts +1 -0
- package/dist/requirement/__tests__/example.test.js +21 -0
- package/dist/requirement/__tests__/validate.test.d.ts +1 -0
- package/dist/requirement/__tests__/validate.test.js +80 -0
- package/dist/requirement/index.d.ts +4 -0
- package/dist/requirement/index.js +2 -0
- package/dist/requirement/types.d.ts +25 -0
- package/dist/requirement/types.js +4 -0
- package/dist/requirement/validate.d.ts +7 -0
- package/dist/requirement/validate.js +81 -0
- package/dist/scenarios/__tests__/validate.test.d.ts +1 -0
- package/dist/scenarios/__tests__/validate.test.js +183 -0
- package/dist/scenarios/index.d.ts +2 -0
- package/dist/scenarios/index.js +1 -0
- package/dist/scenarios/types.d.ts +45 -0
- package/dist/scenarios/types.js +1 -0
- package/dist/scenarios/validate.d.ts +3 -0
- package/dist/scenarios/validate.js +110 -0
- package/dist/schema-version.d.ts +16 -0
- package/dist/schema-version.js +16 -0
- package/dist/scope.d.ts +23 -0
- package/dist/scope.js +38 -0
- package/dist/stakeholder/__tests__/validate.test.d.ts +1 -0
- package/dist/stakeholder/__tests__/validate.test.js +86 -0
- package/dist/stakeholder/index.d.ts +3 -0
- package/dist/stakeholder/index.js +2 -0
- package/dist/stakeholder/types.d.ts +24 -0
- package/dist/stakeholder/types.js +5 -0
- package/dist/stakeholder/validate.d.ts +2 -0
- package/dist/stakeholder/validate.js +58 -0
- package/dist/target-state/__tests__/validate.test.d.ts +1 -0
- package/dist/target-state/__tests__/validate.test.js +62 -0
- package/dist/target-state/index.d.ts +2 -0
- package/dist/target-state/index.js +1 -0
- package/dist/target-state/types.d.ts +18 -0
- package/dist/target-state/types.js +7 -0
- package/dist/target-state/validate.d.ts +2 -0
- package/dist/target-state/validate.js +61 -0
- package/dist/theme/index.d.ts +4 -0
- package/dist/theme/index.js +2 -0
- package/dist/theme/themes.d.ts +16 -0
- package/dist/theme/themes.js +213 -0
- package/dist/theme/tokens.d.ts +158 -0
- package/dist/theme/tokens.js +105 -0
- package/dist/typed-id.d.ts +20 -0
- package/dist/typed-id.js +38 -0
- package/dist/validation-types.d.ts +34 -0
- package/dist/validation-types.js +1 -0
- package/dist/webview/__tests__/entry-notations.test.d.ts +1 -0
- package/dist/webview/__tests__/entry-notations.test.js +62 -0
- package/dist/webview/__tests__/entry.test.d.ts +1 -0
- package/dist/webview/__tests__/entry.test.js +56 -0
- package/dist/webview/__tests__/render-goals.test.d.ts +1 -0
- package/dist/webview/__tests__/render-goals.test.js +65 -0
- package/dist/webview/entry.d.ts +38 -0
- package/dist/webview/entry.js +182 -0
- package/dist/webview/render-activities.d.ts +24 -0
- package/dist/webview/render-activities.js +127 -0
- package/dist/webview/render-activity-card.d.ts +5 -0
- package/dist/webview/render-activity-card.js +168 -0
- package/dist/webview/render-applications.d.ts +11 -0
- package/dist/webview/render-applications.js +105 -0
- package/dist/webview/render-blocks.d.ts +5 -0
- package/dist/webview/render-blocks.js +71 -0
- package/dist/webview/render-capability-map.d.ts +7 -0
- package/dist/webview/render-capability-map.js +88 -0
- package/dist/webview/render-fgca.d.ts +8 -0
- package/dist/webview/render-fgca.js +94 -0
- package/dist/webview/render-goals.d.ts +6 -0
- package/dist/webview/render-goals.js +92 -0
- package/dist/webview/render-process-blueprint.d.ts +5 -0
- package/dist/webview/render-process-blueprint.js +135 -0
- package/dist/webview/render-process-map.d.ts +7 -0
- package/dist/webview/render-process-map.js +82 -0
- package/dist/webview/render-products.d.ts +7 -0
- package/dist/webview/render-products.js +81 -0
- package/dist/webview/render-scenarios.d.ts +7 -0
- package/dist/webview/render-scenarios.js +75 -0
- package/dist/webview/render-util.d.ts +16 -0
- package/dist/webview/render-util.js +31 -0
- package/dist/webview/transitrix-render.css +323 -0
- package/dist/webview/transitrix-render.js +6452 -0
- package/dist/webview/transitrix-render.js.map +7 -0
- package/dist/yaml-normalize.d.ts +20 -0
- package/dist/yaml-normalize.js +57 -0
- package/package.json +40 -0
- package/src/__tests__/edge-path.test.ts +46 -0
- package/src/__tests__/scope.test.ts +27 -0
- package/src/__tests__/yaml-normalize.test.ts +158 -0
- package/src/activities/__tests__/cpm.test.ts +164 -0
- package/src/activities/__tests__/gantt.test.ts +245 -0
- package/src/activities/__tests__/layout.test.ts +112 -0
- package/src/activities/__tests__/validate.test.ts +409 -0
- package/src/activities/cpm.ts +95 -0
- package/src/activities/gantt.ts +276 -0
- package/src/activities/index.ts +28 -0
- package/src/activities/layout.ts +112 -0
- package/src/activities/types.ts +148 -0
- package/src/activities/validate.ts +357 -0
- package/src/activity-card/__tests__/example.test.ts +66 -0
- package/src/activity-card/__tests__/layout.test.ts +63 -0
- package/src/activity-card/__tests__/resolver.test.ts +161 -0
- package/src/activity-card/__tests__/validate.test.ts +131 -0
- package/src/activity-card/index.ts +32 -0
- package/src/activity-card/layout.ts +194 -0
- package/src/activity-card/resolver.ts +337 -0
- package/src/activity-card/types.ts +237 -0
- package/src/activity-card/validate.ts +158 -0
- package/src/actor/__tests__/validate.test.ts +67 -0
- package/src/actor/index.ts +3 -0
- package/src/actor/types.ts +29 -0
- package/src/actor/validate.ts +38 -0
- package/src/applications/__tests__/validate.test.ts +256 -0
- package/src/applications/index.ts +11 -0
- package/src/applications/types.ts +43 -0
- package/src/applications/validate.ts +131 -0
- package/src/assertion/__tests__/example.test.ts +37 -0
- package/src/assertion/__tests__/validate.test.ts +142 -0
- package/src/assertion/index.ts +12 -0
- package/src/assertion/types.ts +58 -0
- package/src/assertion/validate.ts +145 -0
- package/src/blocks/__tests__/layout.test.ts +169 -0
- package/src/blocks/__tests__/validate.test.ts +260 -0
- package/src/blocks/index.ts +17 -0
- package/src/blocks/layout.ts +186 -0
- package/src/blocks/types.ts +62 -0
- package/src/blocks/validate.ts +206 -0
- package/src/capability-map/__tests__/validate.test.ts +238 -0
- package/src/capability-map/index.ts +8 -0
- package/src/capability-map/types.ts +29 -0
- package/src/capability-map/validate.ts +127 -0
- package/src/change/__tests__/validate.test.ts +88 -0
- package/src/change/index.ts +2 -0
- package/src/change/types.ts +23 -0
- package/src/change/validate.ts +61 -0
- package/src/compliance/__tests__/classify.test.ts +27 -0
- package/src/compliance/__tests__/confidence.test.ts +98 -0
- package/src/compliance/__tests__/coverage-metric.test.ts +188 -0
- package/src/compliance/__tests__/demo-scenario.test.ts +273 -0
- package/src/compliance/__tests__/example.test.ts +57 -0
- package/src/compliance/__tests__/gap-report.test.ts +129 -0
- package/src/compliance/__tests__/html.test.ts +142 -0
- package/src/compliance/__tests__/impact.test.ts +482 -0
- package/src/compliance/__tests__/markdown.test.ts +95 -0
- package/src/compliance/__tests__/views.test.ts +64 -0
- package/src/compliance/classify.ts +84 -0
- package/src/compliance/confidence.ts +69 -0
- package/src/compliance/coverage-metric.ts +263 -0
- package/src/compliance/gap-report.ts +94 -0
- package/src/compliance/html.ts +295 -0
- package/src/compliance/impact.ts +677 -0
- package/src/compliance/index.ts +56 -0
- package/src/compliance/markdown.ts +135 -0
- package/src/compliance/reverse-index.ts +33 -0
- package/src/compliance/types.ts +120 -0
- package/src/compliance/views.ts +46 -0
- package/src/compliance-matrix/__tests__/build.test.ts +200 -0
- package/src/compliance-matrix/__tests__/example.test.ts +57 -0
- package/src/compliance-matrix/build.ts +0 -0
- package/src/compliance-matrix/index.ts +11 -0
- package/src/compliance-matrix/types.ts +102 -0
- package/src/confidence/__tests__/score.test.ts +254 -0
- package/src/confidence/index.ts +21 -0
- package/src/confidence/score.ts +243 -0
- package/src/confidence/types.ts +96 -0
- package/src/edge-path.ts +44 -0
- package/src/element-envelope.ts +76 -0
- package/src/factor/__tests__/validate.test.ts +98 -0
- package/src/factor/index.ts +8 -0
- package/src/factor/types.ts +41 -0
- package/src/factor/validate.ts +74 -0
- package/src/fgca/__tests__/chain-table.test.ts +172 -0
- package/src/fgca/__tests__/layout.test.ts +179 -0
- package/src/fgca/__tests__/parse-canonical.test.ts +248 -0
- package/src/fgca/__tests__/preview-layout.test.ts +124 -0
- package/src/fgca/__tests__/validate.test.ts +142 -0
- package/src/fgca/chain-table.ts +225 -0
- package/src/fgca/index.ts +45 -0
- package/src/fgca/layout.ts +204 -0
- package/src/fgca/nodeTypes.ts +11 -0
- package/src/fgca/nodes/FGCAActivityNode.tsx +65 -0
- package/src/fgca/nodes/FGCAChangeNode.tsx +64 -0
- package/src/fgca/nodes/FGCAFactorNode.tsx +64 -0
- package/src/fgca/nodes/FGCAGoalNode.tsx +72 -0
- package/src/fgca/parse-canonical.ts +400 -0
- package/src/fgca/preview-layout.ts +217 -0
- package/src/fgca/types.ts +50 -0
- package/src/fgca/validate.ts +126 -0
- package/src/geometry.ts +9 -0
- package/src/goals/__tests__/layout.test.ts +175 -0
- package/src/goals/__tests__/mutations.test.ts +111 -0
- package/src/goals/__tests__/parse-canonical.test.ts +145 -0
- package/src/goals/__tests__/validate.test.ts +202 -0
- package/src/goals/index.ts +21 -0
- package/src/goals/layout.ts +172 -0
- package/src/goals/mutations.ts +123 -0
- package/src/goals/parse-canonical.ts +286 -0
- package/src/goals/types.ts +85 -0
- package/src/goals/validate.ts +136 -0
- package/src/index.ts +23 -0
- package/src/process-blueprint/__tests__/compliance-lane.test.ts +320 -0
- package/src/process-blueprint/__tests__/layout.test.ts +195 -0
- package/src/process-blueprint/__tests__/validate.test.ts +310 -0
- package/src/process-blueprint/index.ts +31 -0
- package/src/process-blueprint/layout.ts +531 -0
- package/src/process-blueprint/types.ts +242 -0
- package/src/process-blueprint/validate.ts +181 -0
- package/src/process-map/__tests__/validate.test.ts +223 -0
- package/src/process-map/index.ts +10 -0
- package/src/process-map/types.ts +36 -0
- package/src/process-map/validate.ts +135 -0
- package/src/products/__tests__/validate.test.ts +239 -0
- package/src/products/index.ts +9 -0
- package/src/products/types.ts +31 -0
- package/src/products/validate.ts +112 -0
- package/src/repo-validate/__tests__/validate-repo.test.ts +149 -0
- package/src/repo-validate/index.ts +2 -0
- package/src/repo-validate/types.ts +50 -0
- package/src/repo-validate/validate-repo.ts +196 -0
- package/src/requirement/__tests__/example.test.ts +24 -0
- package/src/requirement/__tests__/validate.test.ts +96 -0
- package/src/requirement/index.ts +4 -0
- package/src/requirement/types.ts +35 -0
- package/src/requirement/validate.ts +92 -0
- package/src/scenarios/__tests__/validate.test.ts +209 -0
- package/src/scenarios/index.ts +15 -0
- package/src/scenarios/types.ts +37 -0
- package/src/scenarios/validate.ts +122 -0
- package/src/schema-version.ts +16 -0
- package/src/scope.ts +46 -0
- package/src/stakeholder/__tests__/validate.test.ts +101 -0
- package/src/stakeholder/index.ts +3 -0
- package/src/stakeholder/types.ts +33 -0
- package/src/stakeholder/validate.ts +63 -0
- package/src/target-state/__tests__/validate.test.ts +74 -0
- package/src/target-state/index.ts +2 -0
- package/src/target-state/types.ts +28 -0
- package/src/target-state/validate.ts +67 -0
- package/src/theme/index.ts +4 -0
- package/src/theme/themes.ts +237 -0
- package/src/theme/tokens.ts +133 -0
- package/src/typed-id.ts +56 -0
- package/src/validation-types.ts +36 -0
- package/src/webview/__tests__/entry-notations.test.ts +77 -0
- package/src/webview/__tests__/entry.test.ts +64 -0
- package/src/webview/__tests__/render-goals.test.ts +72 -0
- package/src/webview/entry.ts +292 -0
- package/src/webview/render-activities.ts +156 -0
- package/src/webview/render-activity-card.ts +234 -0
- package/src/webview/render-applications.ts +123 -0
- package/src/webview/render-blocks.ts +91 -0
- package/src/webview/render-capability-map.ts +98 -0
- package/src/webview/render-fgca.ts +122 -0
- package/src/webview/render-goals.ts +110 -0
- package/src/webview/render-process-blueprint.ts +207 -0
- package/src/webview/render-process-map.ts +93 -0
- package/src/webview/render-products.ts +91 -0
- package/src/webview/render-scenarios.ts +90 -0
- package/src/webview/render-util.ts +34 -0
- package/src/webview/styles.css +323 -0
- package/src/yaml-normalize.ts +56 -0
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
// Repo-scope validator (vkgeorgia/transitrix-studio#141).
|
|
2
|
+
//
|
|
3
|
+
// Pure port of the whole-repo checks owned by the methodology's
|
|
4
|
+
// `.validators/lint.py`, run over the shared TypeScript model instead of Python.
|
|
5
|
+
// Parity reference: the `acme_corp` worked example, which `lint.py` passes with
|
|
6
|
+
// zero findings — this validator must also produce zero findings on it.
|
|
7
|
+
//
|
|
8
|
+
// Ported checks (mirroring lint.py's phases):
|
|
9
|
+
// 1. YAML syntax (phase 1) — unparseable canon file -> finding.
|
|
10
|
+
// 2. ID uniqueness — same `id` defined in >1 file -> finding.
|
|
11
|
+
// (lint.py silently last-wins; we surface it,
|
|
12
|
+
// but acme_corp has no duplicates, so parity
|
|
13
|
+
// holds on the reference fixture.)
|
|
14
|
+
// 3. Atomicity (phase 3) — element file carrying a `relations:` key.
|
|
15
|
+
// 4. Referential integ. (phase 4) — relation endpoint not resolving to a known
|
|
16
|
+
// element id. We resolve the canonical
|
|
17
|
+
// `from`/`to` keys (the real relation schema)
|
|
18
|
+
// and also accept lint.py's `source`/`target`.
|
|
19
|
+
// 5. Semantic rules (phase 5) — ArchiMate layer-semantics. lint.py ships
|
|
20
|
+
// this as a no-op stub; ported faithfully as a
|
|
21
|
+
// no-op (see `checkLayerSemantics`). Deferred
|
|
22
|
+
// until the methodology defines the rules.
|
|
23
|
+
// 6. Policy (phase 6) — element marked Active/Production with no
|
|
24
|
+
// owner.
|
|
25
|
+
//
|
|
26
|
+
// Findings stay `{ scope, id, message }` — no severity, no target/category
|
|
27
|
+
// taxonomy (deferred per the ADR).
|
|
28
|
+
const PScope = 'repo';
|
|
29
|
+
/** Statuses that, per lint.py's policy check, require an owner. */
|
|
30
|
+
const OWNER_REQUIRED_STATUSES = new Set(['Active', 'Production']);
|
|
31
|
+
function isRecord(v) {
|
|
32
|
+
return typeof v === 'object' && v !== null && !Array.isArray(v);
|
|
33
|
+
}
|
|
34
|
+
/** Read a string `id` from a parsed doc, or `null` if absent/non-string.
|
|
35
|
+
* Mirrors lint.py, which only treats a doc as an element/relation when it has
|
|
36
|
+
* a top-level `id` (sidecars such as versioned-attribute files have no `id`
|
|
37
|
+
* and are ignored). */
|
|
38
|
+
function docId(doc) {
|
|
39
|
+
if (!doc.data)
|
|
40
|
+
return null;
|
|
41
|
+
const id = doc.data['id'];
|
|
42
|
+
return typeof id === 'string' && id.length > 0 ? id : null;
|
|
43
|
+
}
|
|
44
|
+
/** Resolve a relation endpoint, which may be a bare id string or a `{ id }`
|
|
45
|
+
* mapping (lint.py accepts both). Returns the id string or `null`. */
|
|
46
|
+
function endpointId(value) {
|
|
47
|
+
if (typeof value === 'string')
|
|
48
|
+
return value.length > 0 ? value : null;
|
|
49
|
+
if (isRecord(value)) {
|
|
50
|
+
const id = value['id'];
|
|
51
|
+
if (typeof id === 'string' && id.length > 0)
|
|
52
|
+
return id;
|
|
53
|
+
}
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
/** Phase 1 — unparseable canon files surface as findings. */
|
|
57
|
+
function checkSyntax(docs, findings) {
|
|
58
|
+
for (const doc of docs) {
|
|
59
|
+
if (doc.parseError) {
|
|
60
|
+
findings.push({
|
|
61
|
+
scope: PScope,
|
|
62
|
+
id: '',
|
|
63
|
+
message: `YAML syntax error in ${doc.path}: ${doc.parseError}`,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/** Phase 2 (as a check) — the same id defined in more than one file. */
|
|
69
|
+
function checkIdUniqueness(input, findings) {
|
|
70
|
+
const filesById = new Map();
|
|
71
|
+
for (const doc of [...input.elements, ...input.relations]) {
|
|
72
|
+
const id = docId(doc);
|
|
73
|
+
if (!id)
|
|
74
|
+
continue;
|
|
75
|
+
const list = filesById.get(id);
|
|
76
|
+
if (list)
|
|
77
|
+
list.push(doc.path);
|
|
78
|
+
else
|
|
79
|
+
filesById.set(id, [doc.path]);
|
|
80
|
+
}
|
|
81
|
+
for (const [id, files] of filesById) {
|
|
82
|
+
if (files.length > 1) {
|
|
83
|
+
findings.push({
|
|
84
|
+
scope: PScope,
|
|
85
|
+
id,
|
|
86
|
+
message: `Duplicate id '${id}' defined in ${files.length} files: ${files.join(', ')}`,
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
/** Phase 3 — relations must live in their own files, not inline on elements. */
|
|
92
|
+
function checkAtomicity(input, findings) {
|
|
93
|
+
for (const doc of input.elements) {
|
|
94
|
+
const id = docId(doc);
|
|
95
|
+
if (id && doc.data && 'relations' in doc.data) {
|
|
96
|
+
findings.push({
|
|
97
|
+
scope: PScope,
|
|
98
|
+
id,
|
|
99
|
+
message: `Atomicity violation: element '${id}' (${doc.path}) contains a ` +
|
|
100
|
+
`'relations' section. Move relations to separate files under canon/relations/.`,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
/** Phase 4 — every relation endpoint must resolve to a known element id. */
|
|
106
|
+
function checkReferentialIntegrity(input, findings) {
|
|
107
|
+
const elementIds = new Set();
|
|
108
|
+
for (const doc of input.elements) {
|
|
109
|
+
const id = docId(doc);
|
|
110
|
+
if (id)
|
|
111
|
+
elementIds.add(id);
|
|
112
|
+
}
|
|
113
|
+
for (const doc of input.relations) {
|
|
114
|
+
if (!doc.data)
|
|
115
|
+
continue;
|
|
116
|
+
const relId = docId(doc) ?? '';
|
|
117
|
+
// Canonical relation schema uses `from`/`to`; `source`/`target` accepted for
|
|
118
|
+
// lint.py compatibility.
|
|
119
|
+
const fromId = endpointId(doc.data['from']) ?? endpointId(doc.data['source']);
|
|
120
|
+
const toId = endpointId(doc.data['to']) ?? endpointId(doc.data['target']);
|
|
121
|
+
if (fromId && !elementIds.has(fromId)) {
|
|
122
|
+
findings.push({
|
|
123
|
+
scope: PScope,
|
|
124
|
+
id: relId,
|
|
125
|
+
message: `Referential integrity: relation '${relId || doc.path}' endpoint '${fromId}' (from) does not resolve to a known element.`,
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
if (toId && !elementIds.has(toId)) {
|
|
129
|
+
findings.push({
|
|
130
|
+
scope: PScope,
|
|
131
|
+
id: relId,
|
|
132
|
+
message: `Referential integrity: relation '${relId || doc.path}' endpoint '${toId}' (to) does not resolve to a known element.`,
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
/** Phase 5 — ArchiMate layer-semantics on relations.
|
|
138
|
+
*
|
|
139
|
+
* lint.py ships `_check_semantic_rules` as a no-op stub (`pass`). It is ported
|
|
140
|
+
* here faithfully as a no-op so repo-scope validation reaches parity with
|
|
141
|
+
* lint.py on the reference fixture. Real layer-semantics rules are DEFERRED
|
|
142
|
+
* until the methodology defines them; when it does, they land here (a relation
|
|
143
|
+
* whose `type` is illegal between its endpoints' ArchiMate layers). Kept as a
|
|
144
|
+
* named hook so the intent — and the gap — is explicit rather than missing. */
|
|
145
|
+
function checkLayerSemantics(_input, _findings) {
|
|
146
|
+
// Intentionally empty — parity with lint.py's stubbed phase 5. Do not add
|
|
147
|
+
// rules here without coordinating the methodology semantics canon.
|
|
148
|
+
}
|
|
149
|
+
/** Phase 6 — an element that is Active/Production must declare an owner. */
|
|
150
|
+
function checkPolicy(input, findings) {
|
|
151
|
+
for (const doc of input.elements) {
|
|
152
|
+
const id = docId(doc);
|
|
153
|
+
if (!id || !doc.data)
|
|
154
|
+
continue;
|
|
155
|
+
const metadata = doc.data['metadata'];
|
|
156
|
+
if (!isRecord(metadata))
|
|
157
|
+
continue;
|
|
158
|
+
const status = metadata['status'];
|
|
159
|
+
const owner = metadata['owner'];
|
|
160
|
+
if (typeof status === 'string' && OWNER_REQUIRED_STATUSES.has(status) && !owner) {
|
|
161
|
+
findings.push({
|
|
162
|
+
scope: PScope,
|
|
163
|
+
id,
|
|
164
|
+
message: `Policy: element '${id}' has status '${status}' but no owner assigned.`,
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Run all repo-scope checks over a loaded canon model and return the findings.
|
|
171
|
+
* Pure: no IO, deterministic order (syntax, uniqueness, atomicity, referential,
|
|
172
|
+
* semantics, policy). Reaches parity with `lint.py` on the `acme_corp` fixture
|
|
173
|
+
* (zero findings on a clean tree).
|
|
174
|
+
*/
|
|
175
|
+
export function validateRepoModel(input) {
|
|
176
|
+
const findings = [];
|
|
177
|
+
checkSyntax([...input.elements, ...input.relations], findings);
|
|
178
|
+
// A syntax error means the model is not reliably loaded; skip the graph checks
|
|
179
|
+
// and report the syntax problems first (mirrors lint.py, which bails after
|
|
180
|
+
// phase 1 on syntax errors).
|
|
181
|
+
if (findings.length > 0)
|
|
182
|
+
return findings;
|
|
183
|
+
checkIdUniqueness(input, findings);
|
|
184
|
+
checkAtomicity(input, findings);
|
|
185
|
+
checkReferentialIntegrity(input, findings);
|
|
186
|
+
checkLayerSemantics(input, findings);
|
|
187
|
+
checkPolicy(input, findings);
|
|
188
|
+
return findings;
|
|
189
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Conformance test for the shipped REQUIREMENT worked examples — the
|
|
2
|
+
// acme_corp canon files mirrored under `tests/fixtures/notation-corpus/requirement/`. Pins the
|
|
3
|
+
// success signal of vkgeorgia/strategy#84 Phase 1: the library consumes the
|
|
4
|
+
// canonical example files without error.
|
|
5
|
+
import { describe, it, expect } from 'vitest';
|
|
6
|
+
import { readFileSync } from 'node:fs';
|
|
7
|
+
import { fileURLToPath } from 'node:url';
|
|
8
|
+
import path from 'node:path';
|
|
9
|
+
import yaml from 'js-yaml';
|
|
10
|
+
import { validateRequirement } from '../validate.js';
|
|
11
|
+
const dir = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../../../../tests/fixtures/notation-corpus/requirement');
|
|
12
|
+
const load = (f) => yaml.load(readFileSync(path.join(dir, f), 'utf-8'));
|
|
13
|
+
describe('requirement worked examples (acme_corp)', () => {
|
|
14
|
+
for (const f of ['REQUIREMENT-DATA-ERASURE-1.yaml', 'REQUIREMENT-AUDIT-LOG-RETENTION-1.yaml']) {
|
|
15
|
+
it(`validates ${f} without error`, () => {
|
|
16
|
+
const v = validateRequirement(load(f));
|
|
17
|
+
expect(v.valid, JSON.stringify(v.errors)).toBe(true);
|
|
18
|
+
expect(v.errors).toHaveLength(0);
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { validateRequirement } from '../validate.js';
|
|
3
|
+
function valid() {
|
|
4
|
+
return {
|
|
5
|
+
notation: 'requirement',
|
|
6
|
+
id: 'REQUIREMENT-DATA-ERASURE-1',
|
|
7
|
+
name: 'Personal-data erasure within 30 days',
|
|
8
|
+
description: 'The controller must erase personal data within 30 days of a verified request.',
|
|
9
|
+
severity: 'high',
|
|
10
|
+
zone: 'canon',
|
|
11
|
+
admitted_at: '2026-05-28',
|
|
12
|
+
admitted_by: 'v.korobeinikov',
|
|
13
|
+
gate_checks: { uniqueness: 'pass', consistency: 'pass', completeness: 'pass' },
|
|
14
|
+
valid_from: '2017-05-01',
|
|
15
|
+
valid_to: null,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
const codes = (input, opts) => validateRequirement(input, opts).errors.map(e => e.code);
|
|
19
|
+
describe('validateRequirement — positive', () => {
|
|
20
|
+
it('accepts a well-formed requirement', () => {
|
|
21
|
+
const r = validateRequirement(valid());
|
|
22
|
+
expect(r.valid, JSON.stringify(r.errors)).toBe(true);
|
|
23
|
+
expect(r.errors).toHaveLength(0);
|
|
24
|
+
});
|
|
25
|
+
it('accepts an internal-only requirement with no derived_from', () => {
|
|
26
|
+
const r = valid();
|
|
27
|
+
delete r.derived_from;
|
|
28
|
+
r.severity = 'medium';
|
|
29
|
+
expect(validateRequirement(r).valid).toBe(true);
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
describe('validateRequirement — REQ-001 (shape / id grammar)', () => {
|
|
33
|
+
it('flags a missing required field', () => {
|
|
34
|
+
const r = valid();
|
|
35
|
+
delete r.name;
|
|
36
|
+
expect(codes(r)).toContain('REQ-001');
|
|
37
|
+
});
|
|
38
|
+
it('flags an id that violates the grammar', () => {
|
|
39
|
+
expect(codes({ ...valid(), id: 'REQUIREMENT-DATA-ERASURE-001' })).toContain('REQ-001'); // leading zero
|
|
40
|
+
expect(codes({ ...valid(), id: 'REQ-1' })).toContain('REQ-001'); // wrong TYPE
|
|
41
|
+
expect(codes({ ...valid(), id: 'requirement-data-1' })).toContain('REQ-001'); // lowercase TYPE
|
|
42
|
+
});
|
|
43
|
+
it('flags a wrong notation tag and a non-canon zone', () => {
|
|
44
|
+
expect(codes({ ...valid(), notation: 'req' })).toContain('REQ-001');
|
|
45
|
+
expect(codes({ ...valid(), zone: 'sandbox' })).toContain('REQ-001');
|
|
46
|
+
});
|
|
47
|
+
it('flags a missing valid_to key (distinct from a null value)', () => {
|
|
48
|
+
const r = valid();
|
|
49
|
+
delete r.valid_to;
|
|
50
|
+
expect(codes(r)).toContain('REQ-001');
|
|
51
|
+
expect(validateRequirement({ ...valid(), valid_to: null }).valid).toBe(true);
|
|
52
|
+
});
|
|
53
|
+
it('rejects a non-object', () => {
|
|
54
|
+
expect(codes(null)).toEqual(['REQ-001']);
|
|
55
|
+
expect(codes('x')).toEqual(['REQ-001']);
|
|
56
|
+
expect(codes(['a'])).toEqual(['REQ-001']);
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
describe('validateRequirement — REQ-002 (derived_from resolution)', () => {
|
|
60
|
+
it('flags a well-formed allowed-type ref that does not resolve in the catalog', () => {
|
|
61
|
+
const catalog = { typeOf: () => undefined };
|
|
62
|
+
expect(codes({ ...valid(), derived_from: ['LAW-PERSONAL-DATA-2017-1'] }, { catalog })).toContain('REQ-002');
|
|
63
|
+
});
|
|
64
|
+
it('flags a malformed derived_from entry (cannot resolve)', () => {
|
|
65
|
+
expect(codes({ ...valid(), derived_from: ['not an id'] })).toContain('REQ-002');
|
|
66
|
+
});
|
|
67
|
+
it('does not flag REQ-002 without a catalog for a well-formed allowed-type ref', () => {
|
|
68
|
+
expect(codes({ ...valid(), derived_from: ['LAW-PERSONAL-DATA-2017-1'] })).not.toContain('REQ-002');
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
describe('validateRequirement — REQ-003 (derived_from TYPE)', () => {
|
|
72
|
+
it('flags a derived_from TYPE outside LAW/REGULATION/POLICY/INTERNAL_STANDARD', () => {
|
|
73
|
+
expect(codes({ ...valid(), derived_from: ['PRODUCT-MOBILE-1'] })).toContain('REQ-003');
|
|
74
|
+
});
|
|
75
|
+
it('accepts each permitted derived_from TYPE', () => {
|
|
76
|
+
for (const id of ['LAW-X-1', 'REGULATION-X-1', 'POLICY-X-1', 'INTERNAL_STANDARD-X-1']) {
|
|
77
|
+
expect(codes({ ...valid(), derived_from: [id] })).not.toContain('REQ-003');
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export type RequirementSeverity = 'high' | 'medium' | 'low';
|
|
2
|
+
/** Standard canon admission gate checks (CONTRACT.md §6). */
|
|
3
|
+
export interface GateChecks {
|
|
4
|
+
uniqueness?: string;
|
|
5
|
+
consistency?: string;
|
|
6
|
+
completeness?: string;
|
|
7
|
+
}
|
|
8
|
+
/** TYPEs a requirement may be derived from (15-requirement.md §2, REQ-003). */
|
|
9
|
+
export declare const REQUIREMENT_DERIVED_FROM_TYPES: readonly ["LAW", "REGULATION", "POLICY", "INTERNAL_STANDARD"];
|
|
10
|
+
export interface Requirement {
|
|
11
|
+
notation: 'requirement';
|
|
12
|
+
id: string;
|
|
13
|
+
name: string;
|
|
14
|
+
description: string;
|
|
15
|
+
/** Organisation-defined priority. */
|
|
16
|
+
severity?: RequirementSeverity;
|
|
17
|
+
/** Typed IDs of the codex source documents this requirement is drawn from. */
|
|
18
|
+
derived_from?: string[];
|
|
19
|
+
zone: 'canon';
|
|
20
|
+
admitted_at: string;
|
|
21
|
+
admitted_by: string;
|
|
22
|
+
gate_checks: GateChecks;
|
|
23
|
+
valid_from: string;
|
|
24
|
+
valid_to: string | null;
|
|
25
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// REQUIREMENT — motivation-layer positive obligation.
|
|
2
|
+
// Schema: methodology notations/elements/15-requirement.md §2.
|
|
3
|
+
/** TYPEs a requirement may be derived from (15-requirement.md §2, REQ-003). */
|
|
4
|
+
export const REQUIREMENT_DERIVED_FROM_TYPES = ['LAW', 'REGULATION', 'POLICY', 'INTERNAL_STANDARD'];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ValidationResult } from '../validation-types.js';
|
|
2
|
+
import { type CanonCatalog } from '../typed-id.js';
|
|
3
|
+
export interface RequirementValidateOptions {
|
|
4
|
+
/** When provided, REQ-002 enforces that each `derived_from` id is admitted. */
|
|
5
|
+
catalog?: CanonCatalog;
|
|
6
|
+
}
|
|
7
|
+
export declare function validateRequirement(input: unknown, options?: RequirementValidateOptions): ValidationResult;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
// REQUIREMENT validator — methodology notations/elements/15-requirement.md §4.
|
|
2
|
+
//
|
|
3
|
+
// Implements REQ-001..003. The shared HDR-/LIFECYCLE-/REQ-COVERAGE rules are
|
|
4
|
+
// cross-cutting concerns owned elsewhere (CONTRACT.md §8) and are out of scope
|
|
5
|
+
// for this single-artefact validator.
|
|
6
|
+
//
|
|
7
|
+
// REQ-002/003 resolve `derived_from` against the codex zone. Resolution that
|
|
8
|
+
// needs artefact *existence* (REQ-002) only runs when a `CanonCatalog` is
|
|
9
|
+
// supplied; the TYPE check (REQ-003) is derivable from the id prefix and runs
|
|
10
|
+
// either way.
|
|
11
|
+
import { typeOfId, isCanonicalIdOfType } from '../typed-id.js';
|
|
12
|
+
import { REQUIREMENT_DERIVED_FROM_TYPES } from './types.js';
|
|
13
|
+
const REQUIRED_FIELDS = [
|
|
14
|
+
'notation', 'name', 'description', 'zone', 'admitted_at', 'admitted_by', 'gate_checks', 'valid_from',
|
|
15
|
+
];
|
|
16
|
+
export function validateRequirement(input, options = {}) {
|
|
17
|
+
const errors = [];
|
|
18
|
+
const warnings = [];
|
|
19
|
+
if (input === null || typeof input !== 'object' || Array.isArray(input)) {
|
|
20
|
+
errors.push({ code: 'REQ-001', message: 'Requirement must be a YAML mapping.' });
|
|
21
|
+
return { valid: false, errors, warnings };
|
|
22
|
+
}
|
|
23
|
+
const r = input;
|
|
24
|
+
// REQ-001 — id grammar.
|
|
25
|
+
if (!isCanonicalIdOfType(r.id, 'REQUIREMENT')) {
|
|
26
|
+
errors.push({ code: 'REQ-001', message: `id "${String(r.id)}" must match REQUIREMENT-[<middle>-]<INTEGER>.`, path: 'id' });
|
|
27
|
+
}
|
|
28
|
+
// REQ-001 — fixed notation tag.
|
|
29
|
+
if (r.notation !== 'requirement') {
|
|
30
|
+
errors.push({ code: 'REQ-001', message: 'notation must be the fixed value "requirement".', path: 'notation' });
|
|
31
|
+
}
|
|
32
|
+
// REQ-001 — required fields present and non-empty (notation handled above).
|
|
33
|
+
for (const f of REQUIRED_FIELDS) {
|
|
34
|
+
if (f === 'notation')
|
|
35
|
+
continue;
|
|
36
|
+
if (f === 'gate_checks') {
|
|
37
|
+
if (r.gate_checks === null || typeof r.gate_checks !== 'object') {
|
|
38
|
+
errors.push({ code: 'REQ-001', message: 'gate_checks is required and must be a mapping.', path: 'gate_checks' });
|
|
39
|
+
}
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
const v = r[f];
|
|
43
|
+
if (typeof v !== 'string' || v.trim() === '') {
|
|
44
|
+
errors.push({ code: 'REQ-001', message: `${f} is required.`, path: f });
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
// REQ-001 — zone fixed value.
|
|
48
|
+
if (r.zone !== undefined && r.zone !== 'canon') {
|
|
49
|
+
errors.push({ code: 'REQ-001', message: 'zone must be "canon" for a REQUIREMENT.', path: 'zone' });
|
|
50
|
+
}
|
|
51
|
+
// REQ-001 — valid_to key must exist (string or null).
|
|
52
|
+
if (!('valid_to' in r) || !(typeof r.valid_to === 'string' || r.valid_to === null)) {
|
|
53
|
+
errors.push({ code: 'REQ-001', message: 'valid_to is required (an ISO date string or null).', path: 'valid_to' });
|
|
54
|
+
}
|
|
55
|
+
// REQ-002 / REQ-003 — derived_from references.
|
|
56
|
+
if (r.derived_from !== undefined) {
|
|
57
|
+
if (!Array.isArray(r.derived_from)) {
|
|
58
|
+
errors.push({ code: 'REQ-001', message: 'derived_from must be a list of typed IDs.', path: 'derived_from' });
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
r.derived_from.forEach((ref, i) => {
|
|
62
|
+
const type = typeOfId(ref);
|
|
63
|
+
if (!type) {
|
|
64
|
+
// A malformed ref cannot resolve — REQ-002.
|
|
65
|
+
errors.push({ code: 'REQ-002', message: `derived_from[${i}] "${String(ref)}" is not a resolvable typed ID.`, path: `derived_from[${i}]` });
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
if (!REQUIREMENT_DERIVED_FROM_TYPES.includes(type)) {
|
|
69
|
+
// REQ-003 — TYPE not a permitted codex source type (prefix-derivable).
|
|
70
|
+
errors.push({ code: 'REQ-003', message: `derived_from[${i}] TYPE "${type}" is not one of ${REQUIREMENT_DERIVED_FROM_TYPES.join(', ')}.`, path: `derived_from[${i}]` });
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
if (options.catalog && options.catalog.typeOf(ref) === undefined) {
|
|
74
|
+
// REQ-002 — well-formed but not admitted in the codex zone.
|
|
75
|
+
errors.push({ code: 'REQ-002', message: `derived_from[${i}] "${String(ref)}" does not resolve to an admitted codex artefact.`, path: `derived_from[${i}]` });
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return { valid: errors.length === 0, errors, warnings };
|
|
81
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import * as fs from 'node:fs';
|
|
3
|
+
import * as path from 'node:path';
|
|
4
|
+
import yaml from 'js-yaml';
|
|
5
|
+
import { validateScenario } from '../validate.js';
|
|
6
|
+
const EXAMPLES_DIR = path.resolve(process.cwd(), '..', '..', 'tests', 'fixtures', 'notation-corpus', 'scenarios');
|
|
7
|
+
const VALID_SCENARIO = {
|
|
8
|
+
notation: 'scenarios',
|
|
9
|
+
scenario: {
|
|
10
|
+
id: 'SCN-001',
|
|
11
|
+
name: 'Optimistic Growth 2027',
|
|
12
|
+
status: 'Active',
|
|
13
|
+
created_at: '2026-01-01',
|
|
14
|
+
vision: 'Aggressive expansion scenario.',
|
|
15
|
+
factors_view: [
|
|
16
|
+
{ factor_id: 'FAC-MARKET-001', relevance: 'High', impact: 'Revenue growth' },
|
|
17
|
+
{ factor_id: 'FAC-TECH-001', relevance: 'Medium' },
|
|
18
|
+
],
|
|
19
|
+
goals: [{ goal_id: 'GOAL-REV-001' }],
|
|
20
|
+
capabilities: [{ capability_id: 'CAP-ECOMM-001' }],
|
|
21
|
+
activities: [{ activity_id: 'ACT-EXPAND-001' }],
|
|
22
|
+
products: [{ product_id: 'PROD-PLATFORM-001' }],
|
|
23
|
+
processes: [{ process_id: 'PROC-DELIVERY-001' }],
|
|
24
|
+
applications: [{ app_id: 'APP-CRM-001' }, { app_id: 'APP-OMS-001' }],
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
describe('validateScenario', () => {
|
|
28
|
+
it('passes on valid input', () => {
|
|
29
|
+
const r = validateScenario(VALID_SCENARIO);
|
|
30
|
+
expect(r.valid).toBe(true);
|
|
31
|
+
expect(r.errors).toHaveLength(0);
|
|
32
|
+
});
|
|
33
|
+
it('SCN-001: rejects non-object input', () => {
|
|
34
|
+
const r = validateScenario(null);
|
|
35
|
+
expect(r.errors[0].code).toBe('SCN-001');
|
|
36
|
+
});
|
|
37
|
+
it('SCN-001: rejects missing notation', () => {
|
|
38
|
+
const { notation: _, ...rest } = VALID_SCENARIO;
|
|
39
|
+
const r = validateScenario(rest);
|
|
40
|
+
expect(r.errors.some(e => e.code === 'SCN-001')).toBe(true);
|
|
41
|
+
});
|
|
42
|
+
it('SCN-001: rejects wrong notation value', () => {
|
|
43
|
+
const r = validateScenario({ ...VALID_SCENARIO, notation: 'goals' });
|
|
44
|
+
expect(r.errors.some(e => e.code === 'SCN-001')).toBe(true);
|
|
45
|
+
});
|
|
46
|
+
it('SCN-002: rejects missing scenario', () => {
|
|
47
|
+
const r = validateScenario({ notation: 'scenarios' });
|
|
48
|
+
expect(r.errors.some(e => e.code === 'SCN-002')).toBe(true);
|
|
49
|
+
});
|
|
50
|
+
it('SCN-002: rejects missing id/name/status', () => {
|
|
51
|
+
const r = validateScenario({ notation: 'scenarios', scenario: {} });
|
|
52
|
+
expect(r.errors.filter(e => e.code === 'SCN-002').length).toBeGreaterThanOrEqual(3);
|
|
53
|
+
});
|
|
54
|
+
it('SCN-003: rejects invalid status', () => {
|
|
55
|
+
const scn = { ...VALID_SCENARIO.scenario, status: 'Retired' };
|
|
56
|
+
const r = validateScenario({ ...VALID_SCENARIO, scenario: scn });
|
|
57
|
+
expect(r.errors.some(e => e.code === 'SCN-003')).toBe(true);
|
|
58
|
+
});
|
|
59
|
+
it('SCN-003: accepts all valid statuses', () => {
|
|
60
|
+
for (const status of ['Draft', 'Active', 'Archived']) {
|
|
61
|
+
const scn = { ...VALID_SCENARIO.scenario, status };
|
|
62
|
+
const r = validateScenario({ ...VALID_SCENARIO, scenario: scn });
|
|
63
|
+
expect(r.errors.some(e => e.code === 'SCN-003')).toBe(false);
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
it('SCN-004: rejects malformed created_at', () => {
|
|
67
|
+
const scn = { ...VALID_SCENARIO.scenario, created_at: '01-01-2026' };
|
|
68
|
+
const r = validateScenario({ ...VALID_SCENARIO, scenario: scn });
|
|
69
|
+
expect(r.errors.some(e => e.code === 'SCN-004')).toBe(true);
|
|
70
|
+
});
|
|
71
|
+
it('SCN-004: accepts missing created_at', () => {
|
|
72
|
+
const { created_at: _, ...scn } = VALID_SCENARIO.scenario;
|
|
73
|
+
const r = validateScenario({ ...VALID_SCENARIO, scenario: scn });
|
|
74
|
+
expect(r.errors.some(e => e.code === 'SCN-004')).toBe(false);
|
|
75
|
+
});
|
|
76
|
+
it('SCN-005: rejects non-array factors_view', () => {
|
|
77
|
+
const scn = { ...VALID_SCENARIO.scenario, factors_view: 'oops' };
|
|
78
|
+
const r = validateScenario({ ...VALID_SCENARIO, scenario: scn });
|
|
79
|
+
expect(r.errors.some(e => e.code === 'SCN-005')).toBe(true);
|
|
80
|
+
});
|
|
81
|
+
it('SCN-005: rejects factor missing factor_id', () => {
|
|
82
|
+
const scn = { ...VALID_SCENARIO.scenario, factors_view: [{ relevance: 'High' }] };
|
|
83
|
+
const r = validateScenario({ ...VALID_SCENARIO, scenario: scn });
|
|
84
|
+
expect(r.errors.some(e => e.code === 'SCN-005')).toBe(true);
|
|
85
|
+
});
|
|
86
|
+
it('SCN-006: rejects invalid factor relevance', () => {
|
|
87
|
+
const scn = {
|
|
88
|
+
...VALID_SCENARIO.scenario,
|
|
89
|
+
factors_view: [{ factor_id: 'F1', relevance: 'Critical' }],
|
|
90
|
+
};
|
|
91
|
+
const r = validateScenario({ ...VALID_SCENARIO, scenario: scn });
|
|
92
|
+
expect(r.errors.some(e => e.code === 'SCN-006')).toBe(true);
|
|
93
|
+
});
|
|
94
|
+
it('SCN-013: rejects duplicate factor_id', () => {
|
|
95
|
+
const scn = {
|
|
96
|
+
...VALID_SCENARIO.scenario,
|
|
97
|
+
factors_view: [{ factor_id: 'F1' }, { factor_id: 'F1' }],
|
|
98
|
+
};
|
|
99
|
+
const r = validateScenario({ ...VALID_SCENARIO, scenario: scn });
|
|
100
|
+
expect(r.errors.some(e => e.code === 'SCN-013')).toBe(true);
|
|
101
|
+
});
|
|
102
|
+
const refCases = [
|
|
103
|
+
{ field: 'goals', idField: 'goal_id', errorCode: 'SCN-007' },
|
|
104
|
+
{ field: 'capabilities', idField: 'capability_id', errorCode: 'SCN-008' },
|
|
105
|
+
{ field: 'activities', idField: 'activity_id', errorCode: 'SCN-009' },
|
|
106
|
+
{ field: 'products', idField: 'product_id', errorCode: 'SCN-010' },
|
|
107
|
+
{ field: 'processes', idField: 'process_id', errorCode: 'SCN-011' },
|
|
108
|
+
{ field: 'applications', idField: 'app_id', errorCode: 'SCN-012' },
|
|
109
|
+
];
|
|
110
|
+
for (const c of refCases) {
|
|
111
|
+
it(`${c.errorCode}: rejects ${c.field}[*] missing ${c.idField}`, () => {
|
|
112
|
+
const scn = { ...VALID_SCENARIO.scenario, [c.field]: [{}] };
|
|
113
|
+
const r = validateScenario({ ...VALID_SCENARIO, scenario: scn });
|
|
114
|
+
expect(r.errors.some(e => e.code === c.errorCode)).toBe(true);
|
|
115
|
+
});
|
|
116
|
+
it(`${c.errorCode}: rejects non-array ${c.field}`, () => {
|
|
117
|
+
const scn = { ...VALID_SCENARIO.scenario, [c.field]: 'oops' };
|
|
118
|
+
const r = validateScenario({ ...VALID_SCENARIO, scenario: scn });
|
|
119
|
+
expect(r.errors.some(e => e.code === c.errorCode)).toBe(true);
|
|
120
|
+
});
|
|
121
|
+
it(`${c.errorCode}: rejects duplicate ${c.idField}`, () => {
|
|
122
|
+
const scn = {
|
|
123
|
+
...VALID_SCENARIO.scenario,
|
|
124
|
+
[c.field]: [{ [c.idField]: 'X1' }, { [c.idField]: 'X1' }],
|
|
125
|
+
};
|
|
126
|
+
const r = validateScenario({ ...VALID_SCENARIO, scenario: scn });
|
|
127
|
+
expect(r.errors.some(e => e.code === c.errorCode)).toBe(true);
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
it('accepts minimal scenario (id+name+status only)', () => {
|
|
131
|
+
const r = validateScenario({
|
|
132
|
+
notation: 'scenarios',
|
|
133
|
+
scenario: { id: 'S1', name: 'Minimal', status: 'Draft' },
|
|
134
|
+
});
|
|
135
|
+
expect(r.valid).toBe(true);
|
|
136
|
+
});
|
|
137
|
+
it('accepts scenario with all reference lists empty', () => {
|
|
138
|
+
const scn = {
|
|
139
|
+
...VALID_SCENARIO.scenario,
|
|
140
|
+
factors_view: [],
|
|
141
|
+
goals: [],
|
|
142
|
+
capabilities: [],
|
|
143
|
+
activities: [],
|
|
144
|
+
products: [],
|
|
145
|
+
processes: [],
|
|
146
|
+
applications: [],
|
|
147
|
+
};
|
|
148
|
+
const r = validateScenario({ ...VALID_SCENARIO, scenario: scn });
|
|
149
|
+
expect(r.valid).toBe(true);
|
|
150
|
+
});
|
|
151
|
+
// Pre-release blocker regression (orchestrator review 2026-05-21).
|
|
152
|
+
it('[blocker] tolerates a null element in factors_view[] without throwing', () => {
|
|
153
|
+
const scn = { ...VALID_SCENARIO.scenario, factors_view: [null] };
|
|
154
|
+
const r = validateScenario({ ...VALID_SCENARIO, scenario: scn });
|
|
155
|
+
expect(r.valid).toBe(false);
|
|
156
|
+
expect(r.errors.some(e => e.code === 'SCN-005')).toBe(true);
|
|
157
|
+
});
|
|
158
|
+
it('[blocker] tolerates a null element in goals[] without throwing', () => {
|
|
159
|
+
const scn = { ...VALID_SCENARIO.scenario, goals: [null] };
|
|
160
|
+
const r = validateScenario({ ...VALID_SCENARIO, scenario: scn });
|
|
161
|
+
expect(r.valid).toBe(false);
|
|
162
|
+
expect(r.errors.some(e => e.code === 'SCN-007')).toBe(true);
|
|
163
|
+
});
|
|
164
|
+
it('[blocker] tolerates a string element in applications[] without throwing', () => {
|
|
165
|
+
const scn = { ...VALID_SCENARIO.scenario, applications: ['x'] };
|
|
166
|
+
const r = validateScenario({ ...VALID_SCENARIO, scenario: scn });
|
|
167
|
+
expect(r.valid).toBe(false);
|
|
168
|
+
expect(r.errors.some(e => e.code === 'SCN-012')).toBe(true);
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
describe('scenarios examples (regression)', () => {
|
|
172
|
+
const files = fs.readdirSync(EXAMPLES_DIR).filter(f => f.endsWith('.yaml'));
|
|
173
|
+
expect(files.length).toBeGreaterThan(0);
|
|
174
|
+
for (const file of files) {
|
|
175
|
+
it(`validates tests/fixtures/notation-corpus/scenarios/${file}`, () => {
|
|
176
|
+
const text = fs.readFileSync(path.join(EXAMPLES_DIR, file), 'utf8');
|
|
177
|
+
const parsed = yaml.load(text);
|
|
178
|
+
const r = validateScenario(parsed);
|
|
179
|
+
expect(r.errors).toEqual([]);
|
|
180
|
+
expect(r.valid).toBe(true);
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { validateScenario } from './validate.js';
|