@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,72 @@
|
|
|
1
|
+
import React, { memo } from "react";
|
|
2
|
+
import { Handle, Position } from "reactflow";
|
|
3
|
+
|
|
4
|
+
const NODE_WIDTH = 250;
|
|
5
|
+
const NODE_HEIGHT = 80;
|
|
6
|
+
const DEFAULT_BG = "var(--ts-layer-goal)";
|
|
7
|
+
|
|
8
|
+
export interface FGCAGoalNodeProps {
|
|
9
|
+
data: {
|
|
10
|
+
id: number;
|
|
11
|
+
name: string;
|
|
12
|
+
level?: number;
|
|
13
|
+
bgColor?: string;
|
|
14
|
+
borderColor?: string;
|
|
15
|
+
borderWidth?: number;
|
|
16
|
+
};
|
|
17
|
+
isConnectable?: boolean;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const FGCAGoalNode = memo(({ data, isConnectable }: FGCAGoalNodeProps) => {
|
|
21
|
+
const level = data.level ?? 0;
|
|
22
|
+
const bg = data.bgColor ?? DEFAULT_BG;
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<div
|
|
26
|
+
style={{
|
|
27
|
+
background: bg,
|
|
28
|
+
width: NODE_WIDTH,
|
|
29
|
+
height: NODE_HEIGHT,
|
|
30
|
+
padding: "6px 8px",
|
|
31
|
+
fontSize: "12px",
|
|
32
|
+
borderColor: data.borderColor ?? "var(--ts-node-stroke)",
|
|
33
|
+
borderWidth: data.borderWidth ?? 1,
|
|
34
|
+
borderStyle: "solid",
|
|
35
|
+
borderRadius: "0.75rem",
|
|
36
|
+
boxShadow: "0 1px 4px rgba(0,0,0,0.12)",
|
|
37
|
+
display: "flex",
|
|
38
|
+
flexDirection: "column",
|
|
39
|
+
justifyContent: "center",
|
|
40
|
+
alignItems: "center",
|
|
41
|
+
textAlign: "center",
|
|
42
|
+
color: "var(--ts-text-primary)",
|
|
43
|
+
}}
|
|
44
|
+
>
|
|
45
|
+
<Handle type="target" position={Position.Left} isConnectable={false} style={{ background: "var(--ts-node-stroke)" }} />
|
|
46
|
+
<Handle type="source" position={Position.Right} isConnectable={isConnectable} style={{ background: "var(--ts-node-stroke)" }} />
|
|
47
|
+
<div
|
|
48
|
+
style={{
|
|
49
|
+
fontWeight: 600,
|
|
50
|
+
lineHeight: 1.2,
|
|
51
|
+
overflow: "hidden",
|
|
52
|
+
display: "-webkit-box",
|
|
53
|
+
WebkitLineClamp: 2,
|
|
54
|
+
WebkitBoxOrient: "vertical",
|
|
55
|
+
wordBreak: "break-word",
|
|
56
|
+
padding: "0 4px",
|
|
57
|
+
width: "100%",
|
|
58
|
+
}}
|
|
59
|
+
title={data.name}
|
|
60
|
+
>
|
|
61
|
+
{data.name}
|
|
62
|
+
</div>
|
|
63
|
+
<div style={{ fontSize: "10px", color: "var(--ts-text-secondary)", marginTop: 2 }}>
|
|
64
|
+
G-{String(data.id).padStart(4, "0")} | Lvl: {level}
|
|
65
|
+
</div>
|
|
66
|
+
</div>
|
|
67
|
+
);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
FGCAGoalNode.displayName = "FGCAGoalNode";
|
|
71
|
+
|
|
72
|
+
export default FGCAGoalNode;
|
|
@@ -0,0 +1,400 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical-form FGCA parser + validator.
|
|
3
|
+
*
|
|
4
|
+
* Accepts the methodology's canonical FGCA YAML shape (see
|
|
5
|
+
* `transitrix/methodology` `notations/02-fgca.md`):
|
|
6
|
+
*
|
|
7
|
+
* - Flat top-level arrays, no `fgca:` wrapper.
|
|
8
|
+
* - Typed string IDs per `IDS_AND_REFERENCES.md` (`FACTOR-1`,
|
|
9
|
+
* `GOAL-RET-1`, `CHANGE-1`, `ACTIVITY-ONBOARD-1`).
|
|
10
|
+
* - Plural canonical-direction cross-references: `goal.factors`,
|
|
11
|
+
* `change.goals`, `activity.changes`, `activity.goals`.
|
|
12
|
+
* - Per-notation validation codes `FGCA-001 … FGCA-015`.
|
|
13
|
+
*
|
|
14
|
+
* Returns the validation result plus, on success, an internal `FGCADoc`
|
|
15
|
+
* representation built from the canonical input — string IDs are kept
|
|
16
|
+
* as strings; the existing `buildFGCALayout` consumes `id: number`
|
|
17
|
+
* historically but the layout code only uses IDs as opaque keys, so
|
|
18
|
+
* string IDs work fine.
|
|
19
|
+
*
|
|
20
|
+
* Strategy hub #63: this lives at the input boundary so the library's
|
|
21
|
+
* internal types (currently using DSM-API form — numeric IDs and
|
|
22
|
+
* singular cross-refs) can stay where they are. A follow-up task can
|
|
23
|
+
* unify the internal types with the canonical form across all sister
|
|
24
|
+
* modules.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
import type {
|
|
28
|
+
ActivityItem,
|
|
29
|
+
BdnChangeWithActivities,
|
|
30
|
+
FactorItem,
|
|
31
|
+
GoalItem,
|
|
32
|
+
} from './types.js';
|
|
33
|
+
import type { FGCADoc } from './validate.js';
|
|
34
|
+
import type {
|
|
35
|
+
ValidationError,
|
|
36
|
+
ValidationWarning,
|
|
37
|
+
ValidationResult,
|
|
38
|
+
} from '../validation-types.js';
|
|
39
|
+
|
|
40
|
+
export interface CanonicalFGCAResult extends ValidationResult {
|
|
41
|
+
/** On success, the internal-form FGCADoc derived from the canonical input. */
|
|
42
|
+
parsed?: FGCADoc;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Canonical ID grammars per IDS_AND_REFERENCES.md §1. The TYPE prefix
|
|
46
|
+
// is fixed per layer; middle segments are optional; the terminal is a
|
|
47
|
+
// positive integer with no leading zeros.
|
|
48
|
+
const FACTOR_ID_RE = /^FACTOR(-[A-Z0-9][A-Z0-9_]*)*-\d+$/;
|
|
49
|
+
const GOAL_ID_RE = /^GOAL(-[A-Z0-9][A-Z0-9_]*)*-\d+$/;
|
|
50
|
+
const CHANGE_ID_RE = /^CHANGE(-[A-Z0-9][A-Z0-9_]*)*-\d+$/;
|
|
51
|
+
const ACTIVITY_ID_RE = /^ACTIVITY(-[A-Z0-9][A-Z0-9_]*)*-\d+$/;
|
|
52
|
+
const FGCA_DOC_ID_RE = /^FGCA(-[A-Z0-9][A-Z0-9_]*)*-\d+$/;
|
|
53
|
+
const CONSTRAINT_ID_RE = /^CONSTRAINT(-[A-Z0-9][A-Z0-9_]*)*-\d+$/;
|
|
54
|
+
|
|
55
|
+
function isNonEmptyString(v: unknown): v is string {
|
|
56
|
+
return typeof v === 'string' && v.trim().length > 0;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function asObjectArray(v: unknown): Array<Record<string, unknown>> | null {
|
|
60
|
+
if (!Array.isArray(v)) return null;
|
|
61
|
+
return v.map((el) => (el && typeof el === 'object' ? (el as Record<string, unknown>) : null) as Record<string, unknown>);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
interface InternalIdMap {
|
|
65
|
+
/** Canonical typed-string ID → internal numeric ID for layout consumption. */
|
|
66
|
+
toInternal: Map<string, number>;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Validate canonical FGCA YAML and, on success, return an internal-form
|
|
71
|
+
* `FGCADoc` ready for `buildFGCALayout`.
|
|
72
|
+
*/
|
|
73
|
+
export function parseCanonicalFGCA(input: unknown): CanonicalFGCAResult {
|
|
74
|
+
const errors: ValidationError[] = [];
|
|
75
|
+
const warnings: ValidationWarning[] = [];
|
|
76
|
+
|
|
77
|
+
if (!input || typeof input !== 'object') {
|
|
78
|
+
return {
|
|
79
|
+
valid: false,
|
|
80
|
+
errors: [{ code: 'FGCA-001', message: 'document root is not an object' }],
|
|
81
|
+
warnings,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const raw = input as Record<string, unknown>;
|
|
86
|
+
|
|
87
|
+
if ('notation' in raw && raw['notation'] !== 'fgca') {
|
|
88
|
+
return {
|
|
89
|
+
valid: false,
|
|
90
|
+
errors: [
|
|
91
|
+
{
|
|
92
|
+
code: 'FGCA-001',
|
|
93
|
+
message: `notation must be "fgca", got "${String(raw['notation'])}"`,
|
|
94
|
+
},
|
|
95
|
+
],
|
|
96
|
+
warnings,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// FGCA-002 — document id (optional in v1.4 per the canonical spec? — spec
|
|
101
|
+
// says required; absence is FGCA-002).
|
|
102
|
+
if (raw['id'] !== undefined) {
|
|
103
|
+
if (!isNonEmptyString(raw['id']) || !FGCA_DOC_ID_RE.test(raw['id'])) {
|
|
104
|
+
errors.push({
|
|
105
|
+
code: 'FGCA-002',
|
|
106
|
+
message: `id "${String(raw['id'])}" must match FGCA-[<middle>-]<INTEGER>`,
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
} else {
|
|
110
|
+
errors.push({ code: 'FGCA-002', message: 'document id is required' });
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if (!isNonEmptyString(raw['name'])) {
|
|
114
|
+
errors.push({ code: 'FGCA-003', message: 'name is required' });
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const factorsRaw = asObjectArray(raw['factors']);
|
|
118
|
+
const goalsRaw = asObjectArray(raw['goals']);
|
|
119
|
+
const changesRaw = asObjectArray(raw['changes']);
|
|
120
|
+
const activitiesRaw = asObjectArray(raw['activities']);
|
|
121
|
+
|
|
122
|
+
if (factorsRaw === null) errors.push({ code: 'FGCA-004', message: 'factors must be an array', path: 'factors' });
|
|
123
|
+
if (goalsRaw === null) errors.push({ code: 'FGCA-004', message: 'goals must be an array', path: 'goals' });
|
|
124
|
+
if (changesRaw === null) errors.push({ code: 'FGCA-004', message: 'changes must be an array', path: 'changes' });
|
|
125
|
+
if (activitiesRaw === null) errors.push({ code: 'FGCA-004', message: 'activities must be an array', path: 'activities' });
|
|
126
|
+
|
|
127
|
+
if (errors.length > 0) return { valid: false, errors, warnings };
|
|
128
|
+
|
|
129
|
+
// From here we know all four arrays exist.
|
|
130
|
+
const factors = factorsRaw!;
|
|
131
|
+
const goals = goalsRaw!;
|
|
132
|
+
const changes = changesRaw!;
|
|
133
|
+
const activities = activitiesRaw!;
|
|
134
|
+
|
|
135
|
+
// Per-layer ID maps + duplicate detection. (FGCA-006: unique within a layer.)
|
|
136
|
+
const factorIds = new Set<string>();
|
|
137
|
+
const goalIds = new Set<string>();
|
|
138
|
+
const changeIds = new Set<string>();
|
|
139
|
+
const activityIds = new Set<string>();
|
|
140
|
+
|
|
141
|
+
function checkLayerElement(
|
|
142
|
+
el: Record<string, unknown> | null,
|
|
143
|
+
path: string,
|
|
144
|
+
idRe: RegExp,
|
|
145
|
+
seen: Set<string>,
|
|
146
|
+
): { id: string; name: string } | null {
|
|
147
|
+
if (!el) {
|
|
148
|
+
errors.push({ code: 'FGCA-005', message: `${path} must be an object`, path });
|
|
149
|
+
return null;
|
|
150
|
+
}
|
|
151
|
+
const id = el['id'];
|
|
152
|
+
const name = el['name'];
|
|
153
|
+
if (!isNonEmptyString(id)) {
|
|
154
|
+
errors.push({ code: 'FGCA-005', message: `${path}.id is required`, path });
|
|
155
|
+
return null;
|
|
156
|
+
}
|
|
157
|
+
if (!isNonEmptyString(name)) {
|
|
158
|
+
errors.push({ code: 'FGCA-005', message: `${path}.name is required`, path });
|
|
159
|
+
}
|
|
160
|
+
if (!idRe.test(id)) {
|
|
161
|
+
errors.push({
|
|
162
|
+
code: 'FGCA-007',
|
|
163
|
+
message: `${path}.id "${id}" does not match the canonical grammar for its layer`,
|
|
164
|
+
path,
|
|
165
|
+
});
|
|
166
|
+
return null;
|
|
167
|
+
}
|
|
168
|
+
if (seen.has(id)) {
|
|
169
|
+
errors.push({ code: 'FGCA-006', message: `Duplicate id "${id}"`, path });
|
|
170
|
+
} else {
|
|
171
|
+
seen.add(id);
|
|
172
|
+
}
|
|
173
|
+
return { id, name: isNonEmptyString(name) ? name : '' };
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
factors.forEach((el, i) => checkLayerElement(el, `factors[${i}]`, FACTOR_ID_RE, factorIds));
|
|
177
|
+
goals.forEach((el, i) => checkLayerElement(el, `goals[${i}]`, GOAL_ID_RE, goalIds));
|
|
178
|
+
changes.forEach((el, i) => checkLayerElement(el, `changes[${i}]`, CHANGE_ID_RE, changeIds));
|
|
179
|
+
activities.forEach((el, i) => checkLayerElement(el, `activities[${i}]`, ACTIVITY_ID_RE, activityIds));
|
|
180
|
+
|
|
181
|
+
if (errors.length > 0) return { valid: false, errors, warnings };
|
|
182
|
+
|
|
183
|
+
// Cross-refs.
|
|
184
|
+
function checkRefArray(
|
|
185
|
+
el: Record<string, unknown>,
|
|
186
|
+
field: string,
|
|
187
|
+
targets: Set<string>,
|
|
188
|
+
refRe: RegExp,
|
|
189
|
+
code: string,
|
|
190
|
+
path: string,
|
|
191
|
+
): string[] {
|
|
192
|
+
const ref = el[field];
|
|
193
|
+
if (ref === undefined || ref === null) return [];
|
|
194
|
+
if (!Array.isArray(ref)) {
|
|
195
|
+
errors.push({ code: 'FGCA-007', message: `${path}.${field} must be an array of IDs`, path });
|
|
196
|
+
return [];
|
|
197
|
+
}
|
|
198
|
+
const out: string[] = [];
|
|
199
|
+
for (const r of ref) {
|
|
200
|
+
if (!isNonEmptyString(r)) {
|
|
201
|
+
errors.push({ code: 'FGCA-007', message: `${path}.${field}[] entries must be non-empty strings`, path });
|
|
202
|
+
continue;
|
|
203
|
+
}
|
|
204
|
+
if (!refRe.test(r)) {
|
|
205
|
+
errors.push({ code: 'FGCA-007', message: `${path}.${field}[] entry "${r}" does not match the expected grammar`, path });
|
|
206
|
+
continue;
|
|
207
|
+
}
|
|
208
|
+
if (!targets.has(r)) {
|
|
209
|
+
errors.push({ code, message: `${path}.${field}[] references undeclared element "${r}"`, path });
|
|
210
|
+
continue;
|
|
211
|
+
}
|
|
212
|
+
out.push(r);
|
|
213
|
+
}
|
|
214
|
+
return out;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
// Build internal id-maps (canonical string ID → internal sequential number).
|
|
218
|
+
const idMap: InternalIdMap = { toInternal: new Map() };
|
|
219
|
+
const allCanonicalIds = [...factorIds, ...goalIds, ...changeIds, ...activityIds];
|
|
220
|
+
allCanonicalIds.forEach((id, i) => idMap.toInternal.set(id, i + 1));
|
|
221
|
+
|
|
222
|
+
function intId(canonical: string): number {
|
|
223
|
+
const n = idMap.toInternal.get(canonical);
|
|
224
|
+
if (n === undefined) {
|
|
225
|
+
// Shouldn't happen — we built the map from the same sets.
|
|
226
|
+
throw new Error(`internal: canonical id "${canonical}" not mapped`);
|
|
227
|
+
}
|
|
228
|
+
return n;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// Layer entries (internal form).
|
|
232
|
+
const internalFactors: FactorItem[] = factors.map((el) => ({
|
|
233
|
+
id: intId(String(el!['id'])),
|
|
234
|
+
name: String(el!['name'] ?? ''),
|
|
235
|
+
}));
|
|
236
|
+
|
|
237
|
+
const internalGoals: GoalItem[] = goals.map((el, i) => {
|
|
238
|
+
const refIds = checkRefArray(el!, 'factors', factorIds, FACTOR_ID_RE, 'FGCA-008', `goals[${i}]`);
|
|
239
|
+
return {
|
|
240
|
+
id: intId(String(el!['id'])),
|
|
241
|
+
name: String(el!['name'] ?? ''),
|
|
242
|
+
factor: refIds.map((r) => ({ id: intId(r) })),
|
|
243
|
+
};
|
|
244
|
+
});
|
|
245
|
+
|
|
246
|
+
// Build a reverse mapping: which changes does each activity reference (via
|
|
247
|
+
// canonical activity.changes)? Used to populate the internal `change.activity_ids`.
|
|
248
|
+
const activityChangesByCanonicalActivityId = new Map<string, string[]>();
|
|
249
|
+
activities.forEach((el, i) => {
|
|
250
|
+
const refIds = checkRefArray(el!, 'changes', changeIds, CHANGE_ID_RE, 'FGCA-010', `activities[${i}]`);
|
|
251
|
+
activityChangesByCanonicalActivityId.set(String(el!['id']), refIds);
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
// For each change, find the activities that reference it.
|
|
255
|
+
const activitiesForChange = new Map<string, string[]>();
|
|
256
|
+
for (const [actId, changeIdsForAct] of activityChangesByCanonicalActivityId.entries()) {
|
|
257
|
+
for (const cid of changeIdsForAct) {
|
|
258
|
+
const arr = activitiesForChange.get(cid) ?? [];
|
|
259
|
+
arr.push(actId);
|
|
260
|
+
activitiesForChange.set(cid, arr);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
const internalChanges: BdnChangeWithActivities[] = changes.map((el, i) => {
|
|
265
|
+
const goalRefs = checkRefArray(el!, 'goals', goalIds, GOAL_ID_RE, 'FGCA-009', `changes[${i}]`);
|
|
266
|
+
// Internal `change.goal_id` is singular; canonical `change.goals` is plural.
|
|
267
|
+
// First goal wins for the singular field; warn (not error) if multiple.
|
|
268
|
+
if (goalRefs.length > 1) {
|
|
269
|
+
warnings.push({
|
|
270
|
+
code: 'FGCA-009',
|
|
271
|
+
message: `changes[${i}].goals lists ${goalRefs.length} goals; the internal layout uses the first one (${goalRefs[0]}). Multi-goal changes are not lossy for the canonical spec — only the layout linearises them.`,
|
|
272
|
+
path: `changes[${i}].goals`,
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
const canonicalChangeId = String(el!['id']);
|
|
276
|
+
const linkedActivityIds = activitiesForChange.get(canonicalChangeId) ?? [];
|
|
277
|
+
return {
|
|
278
|
+
id: intId(canonicalChangeId),
|
|
279
|
+
name: String(el!['name'] ?? ''),
|
|
280
|
+
goal_id: goalRefs.length > 0 ? intId(goalRefs[0]) : 0,
|
|
281
|
+
activity_ids: linkedActivityIds.map((aid) => intId(aid)),
|
|
282
|
+
};
|
|
283
|
+
});
|
|
284
|
+
|
|
285
|
+
const internalActivities: ActivityItem[] = activities.map((el, i) => {
|
|
286
|
+
const goalRefs = checkRefArray(el!, 'goals', goalIds, GOAL_ID_RE, 'FGCA-011', `activities[${i}]`);
|
|
287
|
+
return {
|
|
288
|
+
id: intId(String(el!['id'])),
|
|
289
|
+
name: String(el!['name'] ?? ''),
|
|
290
|
+
goal_id: goalRefs.length > 0 ? intId(goalRefs[0]) : null,
|
|
291
|
+
};
|
|
292
|
+
});
|
|
293
|
+
|
|
294
|
+
// FACTOR.references_constraint grammar check (FGCA-015).
|
|
295
|
+
factors.forEach((el, i) => {
|
|
296
|
+
const rc = el!['references_constraint'];
|
|
297
|
+
if (rc === undefined || rc === null) return;
|
|
298
|
+
if (!Array.isArray(rc)) {
|
|
299
|
+
errors.push({ code: 'FGCA-015', message: `factors[${i}].references_constraint must be an array of IDs`, path: `factors[${i}].references_constraint` });
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
for (const r of rc) {
|
|
303
|
+
if (typeof r !== 'string' || !CONSTRAINT_ID_RE.test(r)) {
|
|
304
|
+
errors.push({
|
|
305
|
+
code: 'FGCA-015',
|
|
306
|
+
message: `factors[${i}].references_constraint[] entry "${String(r)}" must match CONSTRAINT-[<middle>-]<INTEGER>`,
|
|
307
|
+
path: `factors[${i}].references_constraint`,
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
});
|
|
312
|
+
|
|
313
|
+
if (errors.length > 0) return { valid: false, errors, warnings };
|
|
314
|
+
|
|
315
|
+
const parsed: FGCADoc = {
|
|
316
|
+
notation: 'fgca',
|
|
317
|
+
spec_version: typeof raw['spec_version'] === 'string' ? (raw['spec_version'] as string) : undefined,
|
|
318
|
+
factors: internalFactors,
|
|
319
|
+
goals: internalGoals,
|
|
320
|
+
changes: internalChanges,
|
|
321
|
+
activities: internalActivities,
|
|
322
|
+
};
|
|
323
|
+
|
|
324
|
+
return { valid: true, errors, warnings, parsed };
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
const FGA_DOC_ID_RE = /^FGA(-[A-Z0-9][A-Z0-9_]*)*-\d+$/;
|
|
328
|
+
|
|
329
|
+
/** On success, the internal-form FGCADoc derived from canonical FGA input. */
|
|
330
|
+
export interface CanonicalFGAResult extends ValidationResult {
|
|
331
|
+
parsed?: FGCADoc;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* Canonical-form FGA parser + validator.
|
|
336
|
+
*
|
|
337
|
+
* FGA is the canonical FGCA chain minus the `changes[]` layer — flat
|
|
338
|
+
* top-level `factors[]` + `goals[]` + `activities[]`, with `activity.goals[]`
|
|
339
|
+
* linking activities straight to goals (no intermediate change). It reuses
|
|
340
|
+
* `parseCanonicalFGCA` by injecting an empty `changes` array and remapping
|
|
341
|
+
* the FGCA-NNN codes to the FGA-NNN registry (`notations/03-fga.md`,
|
|
342
|
+
* FGA-001..011). The resulting internal `FGCADoc` carries `activity.goal_id`,
|
|
343
|
+
* which is exactly what the renderer needs to draw goal → activity edges —
|
|
344
|
+
* the field whose absence produced the "FGA nodes render, no edges" bug
|
|
345
|
+
* (transitrix/methodology#65 / vkgeorgia/strategy#65).
|
|
346
|
+
*
|
|
347
|
+
* Lives beside `parseCanonicalFGCA` (rather than inline in the extension) so
|
|
348
|
+
* the canonical FGA path is unit-testable and the library owns the single
|
|
349
|
+
* canon shape — flat form only, no `fga:` wrapper.
|
|
350
|
+
*/
|
|
351
|
+
export function parseCanonicalFGA(input: unknown): CanonicalFGAResult {
|
|
352
|
+
if (!input || typeof input !== 'object') {
|
|
353
|
+
return { valid: false, errors: [{ code: 'FGA-001', message: 'document root is not an object' }], warnings: [] };
|
|
354
|
+
}
|
|
355
|
+
const raw = input as Record<string, unknown>;
|
|
356
|
+
if ('notation' in raw && raw['notation'] !== 'fga') {
|
|
357
|
+
return {
|
|
358
|
+
valid: false,
|
|
359
|
+
errors: [{ code: 'FGA-001', message: `notation must be "fga", got "${String(raw['notation'])}"` }],
|
|
360
|
+
warnings: [],
|
|
361
|
+
};
|
|
362
|
+
}
|
|
363
|
+
if (raw['id'] === undefined) {
|
|
364
|
+
return { valid: false, errors: [{ code: 'FGA-002', message: 'document id is required' }], warnings: [] };
|
|
365
|
+
}
|
|
366
|
+
if (typeof raw['id'] !== 'string' || !FGA_DOC_ID_RE.test(raw['id'])) {
|
|
367
|
+
return {
|
|
368
|
+
valid: false,
|
|
369
|
+
errors: [{ code: 'FGA-002', message: `id "${String(raw['id'])}" must match FGA-[<middle>-]<INTEGER>` }],
|
|
370
|
+
warnings: [],
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
// Forward to the FGCA parser with synthetic FGCA notation + doc id + empty
|
|
375
|
+
// changes. Per-layer / per-ref checks all reuse the FGCA implementation;
|
|
376
|
+
// codes are remapped on the way out. FGCA-009 / 010 / 014 (changes-related)
|
|
377
|
+
// are unreachable here because `changes` is empty.
|
|
378
|
+
const synth = { ...raw, notation: 'fgca', id: 'FGCA-FROM-FGA-1', changes: [] };
|
|
379
|
+
const r = parseCanonicalFGCA(synth);
|
|
380
|
+
const remap: Record<string, string> = {
|
|
381
|
+
'FGCA-001': 'FGA-001',
|
|
382
|
+
'FGCA-002': 'FGA-002',
|
|
383
|
+
'FGCA-003': 'FGA-003',
|
|
384
|
+
'FGCA-004': 'FGA-004',
|
|
385
|
+
'FGCA-005': 'FGA-005',
|
|
386
|
+
'FGCA-006': 'FGA-006',
|
|
387
|
+
'FGCA-007': 'FGA-007',
|
|
388
|
+
'FGCA-008': 'FGA-008',
|
|
389
|
+
'FGCA-011': 'FGA-009',
|
|
390
|
+
'FGCA-012': 'FGA-010',
|
|
391
|
+
'FGCA-015': 'FGA-007',
|
|
392
|
+
};
|
|
393
|
+
const remapCode = (c: string): string => remap[c] ?? c;
|
|
394
|
+
return {
|
|
395
|
+
valid: r.valid,
|
|
396
|
+
errors: r.errors.map((e) => ({ ...e, code: remapCode(e.code) })),
|
|
397
|
+
warnings: r.warnings.map((w) => ({ ...w, code: remapCode(w.code) })),
|
|
398
|
+
parsed: r.parsed,
|
|
399
|
+
};
|
|
400
|
+
}
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
// Pure column-layout geometry for the static FGCA / FGA previews.
|
|
2
|
+
//
|
|
3
|
+
// This is the layout the Studio extension's `fgca-preview.ts` renders to SVG
|
|
4
|
+
// (NOT the ReactFlow `buildFGCALayout` in `./layout.ts`, which targets the
|
|
5
|
+
// interactive web UI). It lives here — rather than inline in the extension —
|
|
6
|
+
// so the gap geometry is unit-testable: the extension has no test harness.
|
|
7
|
+
//
|
|
8
|
+
// No React, no DOM, no vscode. Safe to call in Node.js or a test environment.
|
|
9
|
+
|
|
10
|
+
import type { Scope } from '../scope.js';
|
|
11
|
+
|
|
12
|
+
export type FGCAPreviewColumn = 'factor' | 'goal' | 'change' | 'activity';
|
|
13
|
+
|
|
14
|
+
export interface FGCAPreviewFactor {
|
|
15
|
+
id: number | string;
|
|
16
|
+
name: string;
|
|
17
|
+
}
|
|
18
|
+
export interface FGCAPreviewGoal {
|
|
19
|
+
id: number | string;
|
|
20
|
+
name: string;
|
|
21
|
+
level?: number;
|
|
22
|
+
factor?: Array<{ id: number | string }>;
|
|
23
|
+
}
|
|
24
|
+
export interface FGCAPreviewChange {
|
|
25
|
+
id: number | string;
|
|
26
|
+
name: string;
|
|
27
|
+
goal_id: number | string;
|
|
28
|
+
activity_ids: Array<number | string>;
|
|
29
|
+
}
|
|
30
|
+
export interface FGCAPreviewActivity {
|
|
31
|
+
id: number | string;
|
|
32
|
+
name: string;
|
|
33
|
+
goal_id?: number | string | null;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** Structural input the preview layout needs — a subset of the parsed FGCA/FGA doc. */
|
|
37
|
+
export interface FGCAPreviewDoc {
|
|
38
|
+
factors: FGCAPreviewFactor[];
|
|
39
|
+
goals: FGCAPreviewGoal[];
|
|
40
|
+
changes?: FGCAPreviewChange[];
|
|
41
|
+
activities: FGCAPreviewActivity[];
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface FGCAPreviewLayoutOptions {
|
|
45
|
+
/** FGA hides the Changes column and links Goal → Activity directly. */
|
|
46
|
+
hideChanges?: boolean;
|
|
47
|
+
/** Horizontal gap (px) between columns. Default matches the historical hardcoded value. */
|
|
48
|
+
colGap?: number;
|
|
49
|
+
/** Vertical gap (px) between stacked nodes within a column. Default matches the historical hardcoded value. */
|
|
50
|
+
rowGap?: number;
|
|
51
|
+
/** Trim to a level cap or a single root goal (vkgeorgia/strategy#77). Defaults to 'all'. */
|
|
52
|
+
scope?: Scope;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Trims an FGCA/FGA doc to a scope (vkgeorgia/strategy#77).
|
|
57
|
+
*
|
|
58
|
+
* FGCA/FGA goals are flat (no parent_id), so:
|
|
59
|
+
* - 'level' → goals with `(level ?? 0) <= maxLevel`.
|
|
60
|
+
* - 'root' → the single goal whose id matches `rootGoalId` (empty when absent).
|
|
61
|
+
*
|
|
62
|
+
* Factors, changes and activities are then kept only when they touch a visible
|
|
63
|
+
* goal: a factor referenced by a visible goal, a change whose `goal_id` is
|
|
64
|
+
* visible, an activity bound to a visible goal directly or via a visible
|
|
65
|
+
* change. Pure and exported so an access-control layer can reuse it.
|
|
66
|
+
*/
|
|
67
|
+
export function selectScopedFGCA(doc: FGCAPreviewDoc, scope: Scope): FGCAPreviewDoc {
|
|
68
|
+
if (scope.mode === 'all') return doc;
|
|
69
|
+
|
|
70
|
+
const visibleGoals =
|
|
71
|
+
scope.mode === 'level'
|
|
72
|
+
? doc.goals.filter(g => (g.level ?? 0) <= scope.maxLevel)
|
|
73
|
+
: doc.goals.filter(g => String(g.id) === scope.rootGoalId);
|
|
74
|
+
|
|
75
|
+
const visibleGoalIds = new Set(visibleGoals.map(g => g.id));
|
|
76
|
+
|
|
77
|
+
const changes = doc.changes ?? [];
|
|
78
|
+
const visibleChanges = changes.filter(c => visibleGoalIds.has(c.goal_id));
|
|
79
|
+
const activityIdsViaChange = new Set(visibleChanges.flatMap(c => c.activity_ids));
|
|
80
|
+
|
|
81
|
+
const visibleActivities = doc.activities.filter(
|
|
82
|
+
a => (a.goal_id != null && visibleGoalIds.has(a.goal_id)) || activityIdsViaChange.has(a.id),
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
const factorIds = new Set(visibleGoals.flatMap(g => (g.factor ?? []).map(f => f.id)));
|
|
86
|
+
const visibleFactors = doc.factors.filter(f => factorIds.has(f.id));
|
|
87
|
+
|
|
88
|
+
return {
|
|
89
|
+
factors: visibleFactors,
|
|
90
|
+
goals: visibleGoals,
|
|
91
|
+
changes: doc.changes === undefined ? undefined : visibleChanges,
|
|
92
|
+
activities: visibleActivities,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export interface FGCAPreviewNode {
|
|
97
|
+
id: string;
|
|
98
|
+
x: number;
|
|
99
|
+
y: number;
|
|
100
|
+
label: string;
|
|
101
|
+
col: FGCAPreviewColumn;
|
|
102
|
+
}
|
|
103
|
+
export interface FGCAPreviewEdge {
|
|
104
|
+
sx: number;
|
|
105
|
+
sy: number;
|
|
106
|
+
tx: number;
|
|
107
|
+
ty: number;
|
|
108
|
+
}
|
|
109
|
+
/** Per-column header anchor — lets the renderer draw column headers without recomputing the stride. */
|
|
110
|
+
export interface FGCAPreviewColumnPos {
|
|
111
|
+
col: FGCAPreviewColumn;
|
|
112
|
+
x: number;
|
|
113
|
+
}
|
|
114
|
+
export interface FGCAPreviewLayout {
|
|
115
|
+
nodes: FGCAPreviewNode[];
|
|
116
|
+
edges: FGCAPreviewEdge[];
|
|
117
|
+
columns: FGCAPreviewColumnPos[];
|
|
118
|
+
width: number;
|
|
119
|
+
height: number;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// Fixed node + frame geometry. Only the inter-node gaps are user-configurable
|
|
123
|
+
// (vkgeorgia/strategy#75); node size and padding stay constant.
|
|
124
|
+
export const FGCA_NODE_W = 220;
|
|
125
|
+
export const FGCA_NODE_H = 72;
|
|
126
|
+
export const FGCA_HEADER_H = 32;
|
|
127
|
+
export const FGCA_PAD = 20;
|
|
128
|
+
export const FGCA_DEFAULT_COL_GAP = 160;
|
|
129
|
+
export const FGCA_DEFAULT_ROW_GAP = 20;
|
|
130
|
+
|
|
131
|
+
export function layoutFGCAPreview(
|
|
132
|
+
inputDoc: FGCAPreviewDoc,
|
|
133
|
+
options: FGCAPreviewLayoutOptions = {},
|
|
134
|
+
): FGCAPreviewLayout {
|
|
135
|
+
const {
|
|
136
|
+
hideChanges = false,
|
|
137
|
+
colGap = FGCA_DEFAULT_COL_GAP,
|
|
138
|
+
rowGap = FGCA_DEFAULT_ROW_GAP,
|
|
139
|
+
scope = { mode: 'all' },
|
|
140
|
+
} = options;
|
|
141
|
+
|
|
142
|
+
// Trim to scope first; everything below lays out the visible subset only.
|
|
143
|
+
const doc = selectScopedFGCA(inputDoc, scope);
|
|
144
|
+
|
|
145
|
+
const colStride = FGCA_NODE_W + colGap;
|
|
146
|
+
const cols: FGCAPreviewColumn[] = hideChanges
|
|
147
|
+
? ['factor', 'goal', 'activity']
|
|
148
|
+
: ['factor', 'goal', 'change', 'activity'];
|
|
149
|
+
const changes = doc.changes ?? [];
|
|
150
|
+
const colItems: Record<FGCAPreviewColumn, Array<{ id: string; label: string }>> = {
|
|
151
|
+
factor: doc.factors.map(f => ({ id: `factor_${f.id}`, label: f.name })),
|
|
152
|
+
goal: doc.goals.map(g => ({ id: `goal_${g.id}`, label: g.name })),
|
|
153
|
+
change: changes.map(c => ({ id: `change_${c.id}`, label: c.name })),
|
|
154
|
+
activity: doc.activities.map(a => ({ id: `activity_${a.id}`, label: a.name })),
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
const nodeMap = new Map<string, FGCAPreviewNode>();
|
|
158
|
+
const nodes: FGCAPreviewNode[] = [];
|
|
159
|
+
const columns: FGCAPreviewColumnPos[] = [];
|
|
160
|
+
|
|
161
|
+
for (let ci = 0; ci < cols.length; ci++) {
|
|
162
|
+
const col = cols[ci];
|
|
163
|
+
const x = FGCA_PAD + ci * colStride;
|
|
164
|
+
columns.push({ col, x });
|
|
165
|
+
let y = FGCA_PAD + FGCA_HEADER_H + rowGap;
|
|
166
|
+
for (const item of colItems[col]) {
|
|
167
|
+
const node: FGCAPreviewNode = { id: item.id, x, y, label: item.label, col };
|
|
168
|
+
nodes.push(node);
|
|
169
|
+
nodeMap.set(item.id, node);
|
|
170
|
+
y += FGCA_NODE_H + rowGap;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
const edges: FGCAPreviewEdge[] = [];
|
|
175
|
+
function addEdge(sourceId: string, targetId: string): void {
|
|
176
|
+
const s = nodeMap.get(sourceId);
|
|
177
|
+
const t = nodeMap.get(targetId);
|
|
178
|
+
if (!s || !t) return;
|
|
179
|
+
edges.push({ sx: s.x + FGCA_NODE_W, sy: s.y + FGCA_NODE_H / 2, tx: t.x, ty: t.y + FGCA_NODE_H / 2 });
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
for (const g of doc.goals) {
|
|
183
|
+
for (const f of (g.factor ?? [])) addEdge(`factor_${f.id}`, `goal_${g.id}`);
|
|
184
|
+
}
|
|
185
|
+
if (hideChanges) {
|
|
186
|
+
const connectedViaChange = new Set<number | string>();
|
|
187
|
+
for (const c of changes) {
|
|
188
|
+
for (const aid of c.activity_ids) {
|
|
189
|
+
addEdge(`goal_${c.goal_id}`, `activity_${aid}`);
|
|
190
|
+
connectedViaChange.add(aid);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
for (const a of doc.activities) {
|
|
194
|
+
if (a.goal_id != null && !connectedViaChange.has(a.id)) {
|
|
195
|
+
addEdge(`goal_${a.goal_id}`, `activity_${a.id}`);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
} else {
|
|
199
|
+
for (const c of changes) addEdge(`goal_${c.goal_id}`, `change_${c.id}`);
|
|
200
|
+
for (const c of changes) for (const aid of c.activity_ids) addEdge(`change_${c.id}`, `activity_${aid}`);
|
|
201
|
+
const coveredActivities = new Set(changes.flatMap(c => c.activity_ids));
|
|
202
|
+
for (const a of doc.activities) {
|
|
203
|
+
if (a.goal_id != null && !coveredActivities.has(a.id)) {
|
|
204
|
+
addEdge(`goal_${a.goal_id}`, `activity_${a.id}`);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
const maxNodeBottom = nodes.reduce(
|
|
210
|
+
(m, n) => Math.max(m, n.y + FGCA_NODE_H),
|
|
211
|
+
FGCA_PAD + FGCA_HEADER_H + rowGap + FGCA_NODE_H,
|
|
212
|
+
);
|
|
213
|
+
const width = FGCA_PAD * 2 + cols.length * colStride - colGap;
|
|
214
|
+
const height = maxNodeBottom + FGCA_PAD;
|
|
215
|
+
|
|
216
|
+
return { nodes, edges, columns, width, height };
|
|
217
|
+
}
|