@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 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { layoutActivities } from '../layout.js';
|
|
3
|
+
const diamondDoc = {
|
|
4
|
+
notation: 'activities',
|
|
5
|
+
activities: [
|
|
6
|
+
{ id: 'A', name: 'Start', duration: 3 },
|
|
7
|
+
{ id: 'B', name: 'Left', duration: 5, predecessors: ['A'] },
|
|
8
|
+
{ id: 'C', name: 'Right', duration: 2, predecessors: ['A'] },
|
|
9
|
+
{ id: 'D', name: 'Merge', duration: 4, predecessors: ['B', 'C'] },
|
|
10
|
+
],
|
|
11
|
+
};
|
|
12
|
+
describe('layoutActivities', () => {
|
|
13
|
+
it('returns empty layout for empty activities', () => {
|
|
14
|
+
const layout = layoutActivities({ notation: 'activities', activities: [] });
|
|
15
|
+
expect(layout.nodes).toHaveLength(0);
|
|
16
|
+
expect(layout.edges).toHaveLength(0);
|
|
17
|
+
});
|
|
18
|
+
it('assigns each node a unique position', () => {
|
|
19
|
+
const layout = layoutActivities(diamondDoc);
|
|
20
|
+
const positions = layout.nodes.map(n => `${n.x},${n.y}`);
|
|
21
|
+
const unique = new Set(positions);
|
|
22
|
+
expect(unique.size).toBe(layout.nodes.length);
|
|
23
|
+
});
|
|
24
|
+
it('assigns predecessors to strictly lower column indices than successors', () => {
|
|
25
|
+
const layout = layoutActivities(diamondDoc);
|
|
26
|
+
const colOf = new Map(layout.nodes.map(n => [n.id, Math.round(n.x / 280)]));
|
|
27
|
+
// A is in col 0; B and C are in col 1; D is in col 2
|
|
28
|
+
expect(colOf.get('A')).toBeLessThan(colOf.get('B'));
|
|
29
|
+
expect(colOf.get('A')).toBeLessThan(colOf.get('C'));
|
|
30
|
+
expect(colOf.get('B')).toBeLessThan(colOf.get('D'));
|
|
31
|
+
expect(colOf.get('C')).toBeLessThan(colOf.get('D'));
|
|
32
|
+
});
|
|
33
|
+
it('produces edges connecting predecessors to successors', () => {
|
|
34
|
+
const layout = layoutActivities(diamondDoc);
|
|
35
|
+
const edgePairs = layout.edges.map(e => `${e.sourceId}->${e.targetId}`);
|
|
36
|
+
expect(edgePairs).toContain('A->B');
|
|
37
|
+
expect(edgePairs).toContain('A->C');
|
|
38
|
+
expect(edgePairs).toContain('B->D');
|
|
39
|
+
expect(edgePairs).toContain('C->D');
|
|
40
|
+
});
|
|
41
|
+
it('marks critical edges correctly', () => {
|
|
42
|
+
// A(3)→B(5)→D(4): critical path = 3+5+4=12; C(2) has slack
|
|
43
|
+
const layout = layoutActivities(diamondDoc);
|
|
44
|
+
const edgeMap = new Map(layout.edges.map(e => [`${e.sourceId}->${e.targetId}`, e.isCritical]));
|
|
45
|
+
expect(edgeMap.get('A->B')).toBe(true);
|
|
46
|
+
expect(edgeMap.get('B->D')).toBe(true);
|
|
47
|
+
expect(edgeMap.get('A->C')).toBe(false);
|
|
48
|
+
expect(edgeMap.get('C->D')).toBe(false);
|
|
49
|
+
});
|
|
50
|
+
it('attaches CPM values to nodes', () => {
|
|
51
|
+
const layout = layoutActivities(diamondDoc);
|
|
52
|
+
const nodeA = layout.nodes.find(n => n.id === 'A');
|
|
53
|
+
expect(nodeA.cpm).toBeDefined();
|
|
54
|
+
expect(nodeA.cpm.es).toBe(0);
|
|
55
|
+
expect(nodeA.cpm.ef).toBe(3);
|
|
56
|
+
expect(nodeA.cpm.isCritical).toBe(true);
|
|
57
|
+
});
|
|
58
|
+
it('respects sort field for ordering within a column', () => {
|
|
59
|
+
const doc = {
|
|
60
|
+
notation: 'activities',
|
|
61
|
+
activities: [
|
|
62
|
+
{ id: 'A', name: 'Root', duration: 1 },
|
|
63
|
+
{ id: 'B', name: 'Second', duration: 1, predecessors: ['A'], sort: 20 },
|
|
64
|
+
{ id: 'C', name: 'First', duration: 1, predecessors: ['A'], sort: 10 },
|
|
65
|
+
],
|
|
66
|
+
};
|
|
67
|
+
const layout = layoutActivities(doc);
|
|
68
|
+
const col1Nodes = layout.nodes.filter(n => n.id === 'B' || n.id === 'C').sort((a, b) => a.y - b.y);
|
|
69
|
+
// C (sort=10) should appear above B (sort=20)
|
|
70
|
+
expect(col1Nodes[0].id).toBe('C');
|
|
71
|
+
expect(col1Nodes[1].id).toBe('B');
|
|
72
|
+
});
|
|
73
|
+
it('computes non-empty bounds for non-empty activities', () => {
|
|
74
|
+
const layout = layoutActivities(diamondDoc);
|
|
75
|
+
expect(layout.bounds.width).toBeGreaterThan(0);
|
|
76
|
+
expect(layout.bounds.height).toBeGreaterThan(0);
|
|
77
|
+
});
|
|
78
|
+
// vkgeorgia/strategy#75 — configurable spacing.
|
|
79
|
+
it('empty options reproduce the default no-arg layout', () => {
|
|
80
|
+
const a = layoutActivities(diamondDoc);
|
|
81
|
+
const b = layoutActivities(diamondDoc, {});
|
|
82
|
+
expect(b.nodes.map(n => `${n.id}:${n.x},${n.y}`)).toEqual(a.nodes.map(n => `${n.id}:${n.x},${n.y}`));
|
|
83
|
+
});
|
|
84
|
+
it('larger horizontalGap pushes downstream columns further right', () => {
|
|
85
|
+
const xOfD = (h) => layoutActivities(diamondDoc, { horizontalGap: h }).nodes.find(n => n.id === 'D').x;
|
|
86
|
+
expect(xOfD(200)).toBeGreaterThan(xOfD(80));
|
|
87
|
+
});
|
|
88
|
+
it('larger verticalGap increases the gap between stacked column nodes', () => {
|
|
89
|
+
const gapOf = (v) => {
|
|
90
|
+
const ys = layoutActivities(diamondDoc, { verticalGap: v })
|
|
91
|
+
.nodes.filter(n => n.id === 'B' || n.id === 'C')
|
|
92
|
+
.map(n => n.y)
|
|
93
|
+
.sort((a, b) => a - b);
|
|
94
|
+
return ys[1] - ys[0];
|
|
95
|
+
};
|
|
96
|
+
expect(gapOf(100)).toBeGreaterThan(gapOf(24));
|
|
97
|
+
});
|
|
98
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,363 @@
|
|
|
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 { validateActivities } from '../validate.js';
|
|
6
|
+
const EXAMPLES_DIR = path.resolve(process.cwd(), '..', '..', 'tests', 'fixtures', 'notation-corpus', 'activities');
|
|
7
|
+
const minimalValid = {
|
|
8
|
+
notation: 'activities',
|
|
9
|
+
activities: [
|
|
10
|
+
{ id: 'A-001', name: 'Start', duration: 3 },
|
|
11
|
+
{ id: 'A-002', name: 'End', duration: 2, predecessors: ['A-001'] },
|
|
12
|
+
],
|
|
13
|
+
};
|
|
14
|
+
describe('validateActivities', () => {
|
|
15
|
+
it('ACT-001 — accepts valid notation field', () => {
|
|
16
|
+
const r = validateActivities(minimalValid);
|
|
17
|
+
expect(r.valid).toBe(true);
|
|
18
|
+
});
|
|
19
|
+
it('ACT-001 — rejects missing notation', () => {
|
|
20
|
+
const r = validateActivities({ activities: [] });
|
|
21
|
+
expect(r.valid).toBe(false);
|
|
22
|
+
expect(r.errors[0].code).toBe('ACT-001');
|
|
23
|
+
});
|
|
24
|
+
it('ACT-001 — rejects wrong notation value', () => {
|
|
25
|
+
const r = validateActivities({ notation: 'bpmn', activities: [] });
|
|
26
|
+
expect(r.valid).toBe(false);
|
|
27
|
+
expect(r.errors[0].code).toBe('ACT-001');
|
|
28
|
+
expect(r.errors[0].message).toContain('"bpmn"');
|
|
29
|
+
});
|
|
30
|
+
it('ACT-002 — rejects activity with missing id', () => {
|
|
31
|
+
const r = validateActivities({
|
|
32
|
+
notation: 'activities',
|
|
33
|
+
activities: [{ name: 'No ID', duration: 1 }],
|
|
34
|
+
});
|
|
35
|
+
expect(r.valid).toBe(false);
|
|
36
|
+
expect(r.errors.some(e => e.code === 'ACT-002')).toBe(true);
|
|
37
|
+
});
|
|
38
|
+
it('ACT-002 — rejects activity with empty id', () => {
|
|
39
|
+
const r = validateActivities({
|
|
40
|
+
notation: 'activities',
|
|
41
|
+
activities: [{ id: ' ', name: 'Empty ID', duration: 1 }],
|
|
42
|
+
});
|
|
43
|
+
expect(r.valid).toBe(false);
|
|
44
|
+
expect(r.errors.some(e => e.code === 'ACT-002')).toBe(true);
|
|
45
|
+
});
|
|
46
|
+
it('ACT-003 — rejects activity with missing name', () => {
|
|
47
|
+
const r = validateActivities({
|
|
48
|
+
notation: 'activities',
|
|
49
|
+
activities: [{ id: 'A-001', duration: 1 }],
|
|
50
|
+
});
|
|
51
|
+
expect(r.valid).toBe(false);
|
|
52
|
+
expect(r.errors.some(e => e.code === 'ACT-003')).toBe(true);
|
|
53
|
+
});
|
|
54
|
+
it('ACT-004 — rejects duplicate ids', () => {
|
|
55
|
+
const r = validateActivities({
|
|
56
|
+
notation: 'activities',
|
|
57
|
+
activities: [
|
|
58
|
+
{ id: 'A-001', name: 'First', duration: 1 },
|
|
59
|
+
{ id: 'A-001', name: 'Duplicate', duration: 2 },
|
|
60
|
+
],
|
|
61
|
+
});
|
|
62
|
+
expect(r.valid).toBe(false);
|
|
63
|
+
expect(r.errors.some(e => e.code === 'ACT-004')).toBe(true);
|
|
64
|
+
});
|
|
65
|
+
it('ACT-005 — rejects unknown predecessor reference', () => {
|
|
66
|
+
const r = validateActivities({
|
|
67
|
+
notation: 'activities',
|
|
68
|
+
activities: [{ id: 'A-001', name: 'Task', duration: 1, predecessors: ['MISSING'] }],
|
|
69
|
+
});
|
|
70
|
+
expect(r.valid).toBe(false);
|
|
71
|
+
expect(r.errors.some(e => e.code === 'ACT-005')).toBe(true);
|
|
72
|
+
});
|
|
73
|
+
it('ACT-005 — passes when predecessor exists', () => {
|
|
74
|
+
const r = validateActivities(minimalValid);
|
|
75
|
+
expect(r.valid).toBe(true);
|
|
76
|
+
expect(r.errors.some(e => e.code === 'ACT-005')).toBe(false);
|
|
77
|
+
});
|
|
78
|
+
it('ACT-006 — rejects cyclic dependency', () => {
|
|
79
|
+
const r = validateActivities({
|
|
80
|
+
notation: 'activities',
|
|
81
|
+
activities: [
|
|
82
|
+
{ id: 'A-001', name: 'Task A', duration: 1, predecessors: ['A-002'] },
|
|
83
|
+
{ id: 'A-002', name: 'Task B', duration: 1, predecessors: ['A-001'] },
|
|
84
|
+
],
|
|
85
|
+
});
|
|
86
|
+
expect(r.valid).toBe(false);
|
|
87
|
+
expect(r.errors.some(e => e.code === 'ACT-006')).toBe(true);
|
|
88
|
+
});
|
|
89
|
+
it('ACT-007 — rejects self-loop', () => {
|
|
90
|
+
const r = validateActivities({
|
|
91
|
+
notation: 'activities',
|
|
92
|
+
activities: [{ id: 'A-001', name: 'Task', duration: 1, predecessors: ['A-001'] }],
|
|
93
|
+
});
|
|
94
|
+
expect(r.valid).toBe(false);
|
|
95
|
+
expect(r.errors.some(e => e.code === 'ACT-007')).toBe(true);
|
|
96
|
+
});
|
|
97
|
+
it('ACT-008 — rejects end_date before start_date', () => {
|
|
98
|
+
const r = validateActivities({
|
|
99
|
+
notation: 'activities',
|
|
100
|
+
activities: [
|
|
101
|
+
{ id: 'A-001', name: 'Task', duration: 5, start_date: '2026-06-10', end_date: '2026-06-01' },
|
|
102
|
+
],
|
|
103
|
+
});
|
|
104
|
+
expect(r.valid).toBe(false);
|
|
105
|
+
expect(r.errors.some(e => e.code === 'ACT-008')).toBe(true);
|
|
106
|
+
});
|
|
107
|
+
it('ACT-008 — accepts end_date equal to start_date', () => {
|
|
108
|
+
const r = validateActivities({
|
|
109
|
+
notation: 'activities',
|
|
110
|
+
activities: [
|
|
111
|
+
{ id: 'A-001', name: 'Task', duration: 0, start_date: '2026-06-01', end_date: '2026-06-01' },
|
|
112
|
+
],
|
|
113
|
+
});
|
|
114
|
+
expect(r.errors.some(e => e.code === 'ACT-008')).toBe(false);
|
|
115
|
+
});
|
|
116
|
+
it('ACT-008 — rejects non-ISO start_date format', () => {
|
|
117
|
+
const r = validateActivities({
|
|
118
|
+
notation: 'activities',
|
|
119
|
+
activities: [
|
|
120
|
+
{ id: 'A-001', name: 'Task', duration: 5, start_date: 'June 1 2026' },
|
|
121
|
+
],
|
|
122
|
+
});
|
|
123
|
+
expect(r.valid).toBe(false);
|
|
124
|
+
expect(r.errors.some(e => e.code === 'ACT-008' && /start_date/.test(e.message))).toBe(true);
|
|
125
|
+
});
|
|
126
|
+
it('ACT-008 — rejects non-ISO end_date format', () => {
|
|
127
|
+
const r = validateActivities({
|
|
128
|
+
notation: 'activities',
|
|
129
|
+
activities: [
|
|
130
|
+
{ id: 'A-001', name: 'Task', duration: 5, end_date: '2026/06/30' },
|
|
131
|
+
],
|
|
132
|
+
});
|
|
133
|
+
expect(r.valid).toBe(false);
|
|
134
|
+
expect(r.errors.some(e => e.code === 'ACT-008' && /end_date/.test(e.message))).toBe(true);
|
|
135
|
+
});
|
|
136
|
+
it('ACT-008 — does not raise the order-compare error when dates are malformed', () => {
|
|
137
|
+
// If start_date and end_date are both wrongly formatted, the file already
|
|
138
|
+
// has two ACT-008 format errors — adding a third "end < start" complaint
|
|
139
|
+
// on top would be misleading because the lexicographic compare is
|
|
140
|
+
// meaningless on non-ISO strings.
|
|
141
|
+
const r = validateActivities({
|
|
142
|
+
notation: 'activities',
|
|
143
|
+
activities: [
|
|
144
|
+
{ id: 'A-001', name: 'Task', duration: 5, start_date: 'tomorrow', end_date: 'yesterday' },
|
|
145
|
+
],
|
|
146
|
+
});
|
|
147
|
+
expect(r.errors.filter(e => e.code === 'ACT-008').length).toBe(2);
|
|
148
|
+
expect(r.errors.every(e => /must be ISO 8601 YYYY-MM-DD/.test(e.message))).toBe(true);
|
|
149
|
+
});
|
|
150
|
+
it('ACT-009 — rejects negative duration', () => {
|
|
151
|
+
const r = validateActivities({
|
|
152
|
+
notation: 'activities',
|
|
153
|
+
activities: [{ id: 'A-001', name: 'Task', duration: -1 }],
|
|
154
|
+
});
|
|
155
|
+
expect(r.valid).toBe(false);
|
|
156
|
+
expect(r.errors.some(e => e.code === 'ACT-009')).toBe(true);
|
|
157
|
+
});
|
|
158
|
+
it('ACT-009 — accepts zero duration', () => {
|
|
159
|
+
const r = validateActivities({
|
|
160
|
+
notation: 'activities',
|
|
161
|
+
activities: [{ id: 'A-001', name: 'Milestone', duration: 0 }],
|
|
162
|
+
});
|
|
163
|
+
expect(r.errors.some(e => e.code === 'ACT-009')).toBe(false);
|
|
164
|
+
});
|
|
165
|
+
it('ACT-010 — rejects singular "goal:" field', () => {
|
|
166
|
+
const r = validateActivities({
|
|
167
|
+
notation: 'activities',
|
|
168
|
+
activities: [{ id: 'A-001', name: 'Task', duration: 1, goal: 'GOAL-001' }],
|
|
169
|
+
});
|
|
170
|
+
expect(r.valid).toBe(false);
|
|
171
|
+
expect(r.errors.some(e => e.code === 'ACT-010')).toBe(true);
|
|
172
|
+
});
|
|
173
|
+
it('ACT-010 — rejects singular "predecessor:" field', () => {
|
|
174
|
+
const r = validateActivities({
|
|
175
|
+
notation: 'activities',
|
|
176
|
+
activities: [
|
|
177
|
+
{ id: 'A-001', name: 'First', duration: 1 },
|
|
178
|
+
{ id: 'A-002', name: 'Task', duration: 1, predecessor: 'A-001' },
|
|
179
|
+
],
|
|
180
|
+
});
|
|
181
|
+
expect(r.valid).toBe(false);
|
|
182
|
+
expect(r.errors.some(e => e.code === 'ACT-010')).toBe(true);
|
|
183
|
+
});
|
|
184
|
+
it('ACT-010 — rejects singular "tag:" field', () => {
|
|
185
|
+
const r = validateActivities({
|
|
186
|
+
notation: 'activities',
|
|
187
|
+
activities: [{ id: 'A-001', name: 'Task', duration: 1, tag: 'q3' }],
|
|
188
|
+
});
|
|
189
|
+
expect(r.valid).toBe(false);
|
|
190
|
+
expect(r.errors.some(e => e.code === 'ACT-010')).toBe(true);
|
|
191
|
+
});
|
|
192
|
+
it('ACT-011 — warns when duration is absent', () => {
|
|
193
|
+
const r = validateActivities({
|
|
194
|
+
notation: 'activities',
|
|
195
|
+
activities: [{ id: 'A-001', name: 'No duration' }],
|
|
196
|
+
});
|
|
197
|
+
expect(r.valid).toBe(true);
|
|
198
|
+
expect(r.warnings.some(w => w.code === 'ACT-011')).toBe(true);
|
|
199
|
+
});
|
|
200
|
+
it('ACT-013 — warns on structurally orphan activity', () => {
|
|
201
|
+
const r = validateActivities({
|
|
202
|
+
notation: 'activities',
|
|
203
|
+
activities: [
|
|
204
|
+
{ id: 'A-001', name: 'Connected', duration: 1 },
|
|
205
|
+
{ id: 'A-002', name: 'Orphan', duration: 1 },
|
|
206
|
+
{ id: 'A-003', name: 'End', duration: 1, predecessors: ['A-001'] },
|
|
207
|
+
],
|
|
208
|
+
});
|
|
209
|
+
expect(r.valid).toBe(true);
|
|
210
|
+
const orphanWarnings = r.warnings.filter(w => w.code === 'ACT-013');
|
|
211
|
+
expect(orphanWarnings.some(w => w.message.includes('A-002'))).toBe(true);
|
|
212
|
+
});
|
|
213
|
+
it('full valid example passes with no errors', () => {
|
|
214
|
+
const r = validateActivities({
|
|
215
|
+
notation: 'activities',
|
|
216
|
+
title: 'Test Project',
|
|
217
|
+
activities: [
|
|
218
|
+
{ id: 'A', name: 'Start', duration: 3 },
|
|
219
|
+
{ id: 'B', name: 'Middle', duration: 5, predecessors: ['A'] },
|
|
220
|
+
{ id: 'C', name: 'End', duration: 2, predecessors: ['B'] },
|
|
221
|
+
],
|
|
222
|
+
});
|
|
223
|
+
expect(r.valid).toBe(true);
|
|
224
|
+
expect(r.errors).toHaveLength(0);
|
|
225
|
+
});
|
|
226
|
+
// ── Project block + calendar (ACT-014, ACT-015) ───────────────────────────
|
|
227
|
+
it('ACT-014 — rejects unknown weekday in working_days', () => {
|
|
228
|
+
const r = validateActivities({
|
|
229
|
+
...minimalValid,
|
|
230
|
+
project: { start_date: '2026-06-01', calendar: { working_days: ['mon', 'funday'] } },
|
|
231
|
+
});
|
|
232
|
+
expect(r.valid).toBe(false);
|
|
233
|
+
expect(r.errors.some(e => e.code === 'ACT-014' && /funday/.test(e.message))).toBe(true);
|
|
234
|
+
});
|
|
235
|
+
it('ACT-014 — rejects duplicate weekday entries', () => {
|
|
236
|
+
const r = validateActivities({
|
|
237
|
+
...minimalValid,
|
|
238
|
+
project: { calendar: { working_days: ['mon', 'tue', 'mon'] } },
|
|
239
|
+
});
|
|
240
|
+
expect(r.valid).toBe(false);
|
|
241
|
+
expect(r.errors.some(e => e.code === 'ACT-014' && /duplicate/i.test(e.message))).toBe(true);
|
|
242
|
+
});
|
|
243
|
+
it('ACT-014 — accepts mixed-case weekday names', () => {
|
|
244
|
+
const r = validateActivities({
|
|
245
|
+
...minimalValid,
|
|
246
|
+
project: { start_date: '2026-06-01', calendar: { working_days: ['MON', 'Tue', 'wed', 'thu', 'fri'] } },
|
|
247
|
+
});
|
|
248
|
+
expect(r.errors.some(e => e.code === 'ACT-014')).toBe(false);
|
|
249
|
+
});
|
|
250
|
+
it('ACT-015 — rejects non-ISO holiday date', () => {
|
|
251
|
+
const r = validateActivities({
|
|
252
|
+
...minimalValid,
|
|
253
|
+
project: { start_date: '2026-06-01', calendar: { holidays: ['2026-07-04', 'July 4 2026'] } },
|
|
254
|
+
});
|
|
255
|
+
expect(r.valid).toBe(false);
|
|
256
|
+
expect(r.errors.some(e => e.code === 'ACT-015' && /July 4 2026/.test(e.message))).toBe(true);
|
|
257
|
+
});
|
|
258
|
+
it('ACT-015 — accepts an array of ISO dates', () => {
|
|
259
|
+
const r = validateActivities({
|
|
260
|
+
...minimalValid,
|
|
261
|
+
project: { start_date: '2026-06-01', calendar: { holidays: ['2026-07-04', '2026-12-25'] } },
|
|
262
|
+
});
|
|
263
|
+
expect(r.errors.some(e => e.code === 'ACT-015')).toBe(false);
|
|
264
|
+
});
|
|
265
|
+
// ── Milestone date equality (ACT-016) ─────────────────────────────────────
|
|
266
|
+
it('ACT-016 — rejects milestone with mismatched start/end dates', () => {
|
|
267
|
+
const r = validateActivities({
|
|
268
|
+
notation: 'activities',
|
|
269
|
+
activities: [
|
|
270
|
+
{ id: 'M-1', name: 'Launch', duration: 0, start_date: '2026-06-01', end_date: '2026-06-02' },
|
|
271
|
+
],
|
|
272
|
+
});
|
|
273
|
+
expect(r.valid).toBe(false);
|
|
274
|
+
expect(r.errors.some(e => e.code === 'ACT-016')).toBe(true);
|
|
275
|
+
});
|
|
276
|
+
it('ACT-016 — accepts milestone with equal start/end dates', () => {
|
|
277
|
+
const r = validateActivities({
|
|
278
|
+
notation: 'activities',
|
|
279
|
+
activities: [
|
|
280
|
+
{ id: 'M-1', name: 'Launch', duration: 0, start_date: '2026-06-01', end_date: '2026-06-01' },
|
|
281
|
+
],
|
|
282
|
+
});
|
|
283
|
+
expect(r.errors.some(e => e.code === 'ACT-016')).toBe(false);
|
|
284
|
+
});
|
|
285
|
+
// ── Phase warnings (ACT-017, ACT-018) ─────────────────────────────────────
|
|
286
|
+
it('ACT-017 — warns when a referenced-as-parent activity carries its own duration', () => {
|
|
287
|
+
const r = validateActivities({
|
|
288
|
+
notation: 'activities',
|
|
289
|
+
activities: [
|
|
290
|
+
{ id: 'PHASE-1', name: 'Design', duration: 5 },
|
|
291
|
+
{ id: 'A-1', name: 'Child', duration: 3, parent: 'PHASE-1' },
|
|
292
|
+
],
|
|
293
|
+
});
|
|
294
|
+
expect(r.valid).toBe(true);
|
|
295
|
+
expect(r.warnings.some(w => w.code === 'ACT-017' && /PHASE-1/.test(w.message))).toBe(true);
|
|
296
|
+
});
|
|
297
|
+
it('ACT-017 — no warning when phase omits duration/dates and rolls up from children', () => {
|
|
298
|
+
const r = validateActivities({
|
|
299
|
+
notation: 'activities',
|
|
300
|
+
activities: [
|
|
301
|
+
{ id: 'PHASE-1', name: 'Design' },
|
|
302
|
+
{ id: 'A-1', name: 'Child', duration: 3, parent: 'PHASE-1' },
|
|
303
|
+
],
|
|
304
|
+
});
|
|
305
|
+
expect(r.warnings.some(w => w.code === 'ACT-017')).toBe(false);
|
|
306
|
+
});
|
|
307
|
+
it('ACT-018 — warns when an activity with no duration is not referenced as parent', () => {
|
|
308
|
+
const r = validateActivities({
|
|
309
|
+
notation: 'activities',
|
|
310
|
+
activities: [
|
|
311
|
+
{ id: 'A-1', name: 'Has duration', duration: 3 },
|
|
312
|
+
{ id: 'P-EMPTY', name: 'Looks like phase but no children' },
|
|
313
|
+
],
|
|
314
|
+
});
|
|
315
|
+
expect(r.warnings.some(w => w.code === 'ACT-018' && /P-EMPTY/.test(w.message))).toBe(true);
|
|
316
|
+
});
|
|
317
|
+
it('ACT-018 — no warning when the no-duration activity has at least one child', () => {
|
|
318
|
+
const r = validateActivities({
|
|
319
|
+
notation: 'activities',
|
|
320
|
+
activities: [
|
|
321
|
+
{ id: 'PHASE-1', name: 'Phase' },
|
|
322
|
+
{ id: 'A-1', name: 'Child', duration: 3, parent: 'PHASE-1' },
|
|
323
|
+
],
|
|
324
|
+
});
|
|
325
|
+
expect(r.warnings.some(w => w.code === 'ACT-018')).toBe(false);
|
|
326
|
+
});
|
|
327
|
+
// ── Gantt-renderability notice (ACT-019) ──────────────────────────────────
|
|
328
|
+
it('ACT-019 — warns when neither project.start_date nor pinned dates exist', () => {
|
|
329
|
+
const r = validateActivities(minimalValid);
|
|
330
|
+
expect(r.warnings.some(w => w.code === 'ACT-019')).toBe(true);
|
|
331
|
+
});
|
|
332
|
+
it('ACT-019 — no warning when project.start_date is set', () => {
|
|
333
|
+
const r = validateActivities({ ...minimalValid, project: { start_date: '2026-06-01' } });
|
|
334
|
+
expect(r.warnings.some(w => w.code === 'ACT-019')).toBe(false);
|
|
335
|
+
});
|
|
336
|
+
it('ACT-019 — no warning when every activity has pinned dates', () => {
|
|
337
|
+
const r = validateActivities({
|
|
338
|
+
notation: 'activities',
|
|
339
|
+
activities: [
|
|
340
|
+
{ id: 'A-1', name: 'A', duration: 3, start_date: '2026-06-01', end_date: '2026-06-04' },
|
|
341
|
+
],
|
|
342
|
+
});
|
|
343
|
+
expect(r.warnings.some(w => w.code === 'ACT-019')).toBe(false);
|
|
344
|
+
});
|
|
345
|
+
it('[blocker] tolerates a null element in activities[] without throwing', () => {
|
|
346
|
+
const r = validateActivities({ ...minimalValid, activities: [null] });
|
|
347
|
+
expect(r.valid).toBe(false);
|
|
348
|
+
expect(r.errors.some(e => e.code === 'SCHEMA_INVALID')).toBe(true);
|
|
349
|
+
});
|
|
350
|
+
});
|
|
351
|
+
describe('activities examples (regression)', () => {
|
|
352
|
+
const files = fs.readdirSync(EXAMPLES_DIR).filter(f => f.endsWith('.yaml'));
|
|
353
|
+
expect(files.length).toBeGreaterThan(0);
|
|
354
|
+
for (const file of files) {
|
|
355
|
+
it(`validates tests/fixtures/notation-corpus/activities/${file}`, () => {
|
|
356
|
+
const text = fs.readFileSync(path.join(EXAMPLES_DIR, file), 'utf8');
|
|
357
|
+
const parsed = yaml.load(text);
|
|
358
|
+
const r = validateActivities(parsed);
|
|
359
|
+
expect(r.errors).toEqual([]);
|
|
360
|
+
expect(r.valid).toBe(true);
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
});
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
export function computeCpm(activities) {
|
|
2
|
+
const result = new Map();
|
|
3
|
+
if (activities.length === 0)
|
|
4
|
+
return result;
|
|
5
|
+
// Build successor map and in-degree for topological sort
|
|
6
|
+
const successors = new Map();
|
|
7
|
+
const predecessors = new Map();
|
|
8
|
+
for (const a of activities) {
|
|
9
|
+
successors.set(a.id, []);
|
|
10
|
+
predecessors.set(a.id, a.predecessors?.filter(p => p !== a.id) ?? []);
|
|
11
|
+
}
|
|
12
|
+
for (const a of activities) {
|
|
13
|
+
for (const pred of (predecessors.get(a.id) ?? [])) {
|
|
14
|
+
successors.get(pred)?.push(a.id);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
// Topological sort (Kahn's)
|
|
18
|
+
const inDegree = new Map();
|
|
19
|
+
for (const a of activities) {
|
|
20
|
+
inDegree.set(a.id, (predecessors.get(a.id) ?? []).length);
|
|
21
|
+
}
|
|
22
|
+
const queue = [];
|
|
23
|
+
for (const a of activities) {
|
|
24
|
+
if ((inDegree.get(a.id) ?? 0) === 0)
|
|
25
|
+
queue.push(a.id);
|
|
26
|
+
}
|
|
27
|
+
const topoOrder = [];
|
|
28
|
+
while (queue.length > 0) {
|
|
29
|
+
const id = queue.shift();
|
|
30
|
+
topoOrder.push(id);
|
|
31
|
+
for (const succ of (successors.get(id) ?? [])) {
|
|
32
|
+
const newDeg = (inDegree.get(succ) ?? 1) - 1;
|
|
33
|
+
inDegree.set(succ, newDeg);
|
|
34
|
+
if (newDeg === 0)
|
|
35
|
+
queue.push(succ);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
const actById = new Map(activities.map(a => [a.id, a]));
|
|
39
|
+
// Forward pass
|
|
40
|
+
const es = new Map();
|
|
41
|
+
const ef = new Map();
|
|
42
|
+
for (const id of topoOrder) {
|
|
43
|
+
const a = actById.get(id);
|
|
44
|
+
const dur = a.duration ?? 0;
|
|
45
|
+
const maxPredEf = Math.max(0, ...(predecessors.get(id) ?? []).map(p => ef.get(p) ?? 0));
|
|
46
|
+
es.set(id, maxPredEf);
|
|
47
|
+
ef.set(id, maxPredEf + dur);
|
|
48
|
+
}
|
|
49
|
+
// Project finish
|
|
50
|
+
const projectFinish = Math.max(0, ...[...ef.values()]);
|
|
51
|
+
// Backward pass
|
|
52
|
+
const ls = new Map();
|
|
53
|
+
const lf = new Map();
|
|
54
|
+
for (const id of [...topoOrder].reverse()) {
|
|
55
|
+
const a = actById.get(id);
|
|
56
|
+
const dur = a.duration ?? 0;
|
|
57
|
+
const succs = successors.get(id) ?? [];
|
|
58
|
+
const minSuccLs = succs.length === 0 ? projectFinish : Math.min(...succs.map(s => ls.get(s) ?? projectFinish));
|
|
59
|
+
lf.set(id, minSuccLs);
|
|
60
|
+
ls.set(id, minSuccLs - dur);
|
|
61
|
+
}
|
|
62
|
+
// Assemble result
|
|
63
|
+
for (const id of topoOrder) {
|
|
64
|
+
const esV = es.get(id) ?? 0;
|
|
65
|
+
const efV = ef.get(id) ?? 0;
|
|
66
|
+
const lsV = ls.get(id) ?? 0;
|
|
67
|
+
const lfV = lf.get(id) ?? 0;
|
|
68
|
+
const slack = lsV - esV;
|
|
69
|
+
result.set(id, { es: esV, ef: efV, ls: lsV, lf: lfV, slack, isCritical: slack <= 0 });
|
|
70
|
+
}
|
|
71
|
+
// Cycle defence: Kahn's topo-order silently omits any activity that's part
|
|
72
|
+
// of a cycle (its in-degree never reaches zero), and the forward/backward
|
|
73
|
+
// passes above skip those nodes. The validator's ACT-006 is the
|
|
74
|
+
// authoritative cycle error — but layoutActivities is reachable without
|
|
75
|
+
// validation, so fill the omitted nodes with neutral CPM values so
|
|
76
|
+
// downstream consumers don't see `undefined` entries. Cyclic activities
|
|
77
|
+
// simply render without critical-path highlighting.
|
|
78
|
+
if (topoOrder.length < activities.length) {
|
|
79
|
+
for (const a of activities) {
|
|
80
|
+
if (!result.has(a.id)) {
|
|
81
|
+
result.set(a.id, { es: 0, ef: 0, ls: 0, lf: 0, slack: 0, isCritical: false });
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return result;
|
|
86
|
+
}
|