@transitrix/diagrams 1.8.6 → 1.8.7

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.
Files changed (247) hide show
  1. package/package.json +7 -2
  2. package/dist/__tests__/edge-path.test.d.ts +0 -1
  3. package/dist/__tests__/edge-path.test.js +0 -55
  4. package/dist/__tests__/node-size-presets.test.d.ts +0 -1
  5. package/dist/__tests__/node-size-presets.test.js +0 -30
  6. package/dist/__tests__/scope.test.d.ts +0 -1
  7. package/dist/__tests__/scope.test.js +0 -23
  8. package/dist/__tests__/yaml-normalize.test.d.ts +0 -1
  9. package/dist/__tests__/yaml-normalize.test.js +0 -148
  10. package/dist/activities/__tests__/cpm.test.d.ts +0 -1
  11. package/dist/activities/__tests__/cpm.test.js +0 -146
  12. package/dist/activities/__tests__/gantt.test.d.ts +0 -1
  13. package/dist/activities/__tests__/gantt.test.js +0 -263
  14. package/dist/activities/__tests__/layout.test.d.ts +0 -1
  15. package/dist/activities/__tests__/layout.test.js +0 -98
  16. package/dist/activities/__tests__/validate.test.d.ts +0 -1
  17. package/dist/activities/__tests__/validate.test.js +0 -397
  18. package/dist/activity-card/__tests__/example.test.d.ts +0 -1
  19. package/dist/activity-card/__tests__/example.test.js +0 -73
  20. package/dist/activity-card/__tests__/layout.test.d.ts +0 -1
  21. package/dist/activity-card/__tests__/layout.test.js +0 -141
  22. package/dist/activity-card/__tests__/resolver.test.d.ts +0 -1
  23. package/dist/activity-card/__tests__/resolver.test.js +0 -325
  24. package/dist/activity-card/__tests__/validate.test.d.ts +0 -1
  25. package/dist/activity-card/__tests__/validate.test.js +0 -149
  26. package/dist/actor/__tests__/validate.test.d.ts +0 -1
  27. package/dist/actor/__tests__/validate.test.js +0 -95
  28. package/dist/applications/__tests__/validate.test.d.ts +0 -1
  29. package/dist/applications/__tests__/validate.test.js +0 -223
  30. package/dist/assertion/__tests__/example.test.d.ts +0 -1
  31. package/dist/assertion/__tests__/example.test.js +0 -32
  32. package/dist/assertion/__tests__/validate.test.d.ts +0 -1
  33. package/dist/assertion/__tests__/validate.test.js +0 -130
  34. package/dist/blocks/__tests__/layout.test.d.ts +0 -1
  35. package/dist/blocks/__tests__/layout.test.js +0 -153
  36. package/dist/blocks/__tests__/validate.test.d.ts +0 -1
  37. package/dist/blocks/__tests__/validate.test.js +0 -235
  38. package/dist/business-service/__tests__/validate.test.d.ts +0 -1
  39. package/dist/business-service/__tests__/validate.test.js +0 -135
  40. package/dist/capability-map/__tests__/CapabilityMapView.test.d.ts +0 -1
  41. package/dist/capability-map/__tests__/CapabilityMapView.test.js +0 -217
  42. package/dist/capability-map/__tests__/address.test.d.ts +0 -1
  43. package/dist/capability-map/__tests__/address.test.js +0 -49
  44. package/dist/capability-map/__tests__/dsm-layout.test.d.ts +0 -1
  45. package/dist/capability-map/__tests__/dsm-layout.test.js +0 -46
  46. package/dist/capability-map/__tests__/dsm-mutations.test.d.ts +0 -1
  47. package/dist/capability-map/__tests__/dsm-mutations.test.js +0 -125
  48. package/dist/capability-map/__tests__/dsm-validate.test.d.ts +0 -1
  49. package/dist/capability-map/__tests__/dsm-validate.test.js +0 -56
  50. package/dist/capability-map/__tests__/validate.test.d.ts +0 -1
  51. package/dist/capability-map/__tests__/validate.test.js +0 -212
  52. package/dist/change/__tests__/validate.test.d.ts +0 -1
  53. package/dist/change/__tests__/validate.test.js +0 -79
  54. package/dist/codex/__tests__/example.test.d.ts +0 -1
  55. package/dist/codex/__tests__/example.test.js +0 -33
  56. package/dist/codex/__tests__/validate.test.d.ts +0 -1
  57. package/dist/codex/__tests__/validate.test.js +0 -68
  58. package/dist/compliance/__tests__/canon-catalog.test.d.ts +0 -1
  59. package/dist/compliance/__tests__/canon-catalog.test.js +0 -60
  60. package/dist/compliance/__tests__/classify.test.d.ts +0 -1
  61. package/dist/compliance/__tests__/classify.test.js +0 -58
  62. package/dist/compliance/__tests__/confidence.test.d.ts +0 -1
  63. package/dist/compliance/__tests__/confidence.test.js +0 -78
  64. package/dist/compliance/__tests__/coverage-metric.test.d.ts +0 -1
  65. package/dist/compliance/__tests__/coverage-metric.test.js +0 -264
  66. package/dist/compliance/__tests__/demo-scenario.test.d.ts +0 -1
  67. package/dist/compliance/__tests__/demo-scenario.test.js +0 -226
  68. package/dist/compliance/__tests__/example.test.d.ts +0 -1
  69. package/dist/compliance/__tests__/example.test.js +0 -51
  70. package/dist/compliance/__tests__/gap-report.test.d.ts +0 -1
  71. package/dist/compliance/__tests__/gap-report.test.js +0 -113
  72. package/dist/compliance/__tests__/html.test.d.ts +0 -1
  73. package/dist/compliance/__tests__/html.test.js +0 -122
  74. package/dist/compliance/__tests__/impact.test.d.ts +0 -1
  75. package/dist/compliance/__tests__/impact.test.js +0 -913
  76. package/dist/compliance/__tests__/markdown.test.d.ts +0 -1
  77. package/dist/compliance/__tests__/markdown.test.js +0 -85
  78. package/dist/compliance/__tests__/trace.test.d.ts +0 -1
  79. package/dist/compliance/__tests__/trace.test.js +0 -144
  80. package/dist/compliance/__tests__/view-resolution.test.d.ts +0 -1
  81. package/dist/compliance/__tests__/view-resolution.test.js +0 -59
  82. package/dist/compliance/__tests__/views.test.d.ts +0 -1
  83. package/dist/compliance/__tests__/views.test.js +0 -59
  84. package/dist/compliance-matrix/__tests__/build.test.d.ts +0 -1
  85. package/dist/compliance-matrix/__tests__/build.test.js +0 -183
  86. package/dist/compliance-matrix/__tests__/example.test.d.ts +0 -1
  87. package/dist/compliance-matrix/__tests__/example.test.js +0 -49
  88. package/dist/confidence/__tests__/score.test.d.ts +0 -1
  89. package/dist/confidence/__tests__/score.test.js +0 -188
  90. package/dist/constraint/__tests__/example.test.d.ts +0 -1
  91. package/dist/constraint/__tests__/example.test.js +0 -14
  92. package/dist/constraint/__tests__/validate.test.d.ts +0 -1
  93. package/dist/constraint/__tests__/validate.test.js +0 -58
  94. package/dist/factor/__tests__/validate.test.d.ts +0 -1
  95. package/dist/factor/__tests__/validate.test.js +0 -112
  96. package/dist/fgca/__tests__/chain-table.test.d.ts +0 -1
  97. package/dist/fgca/__tests__/chain-table.test.js +0 -158
  98. package/dist/fgca/__tests__/layout.test.d.ts +0 -1
  99. package/dist/fgca/__tests__/layout.test.js +0 -140
  100. package/dist/fgca/__tests__/parse-canonical.test.d.ts +0 -1
  101. package/dist/fgca/__tests__/parse-canonical.test.js +0 -268
  102. package/dist/fgca/__tests__/preview-layout.test.d.ts +0 -1
  103. package/dist/fgca/__tests__/preview-layout.test.js +0 -106
  104. package/dist/fgca/__tests__/resolver.test.d.ts +0 -1
  105. package/dist/fgca/__tests__/resolver.test.js +0 -185
  106. package/dist/fgca/__tests__/validate.test.d.ts +0 -1
  107. package/dist/fgca/__tests__/validate.test.js +0 -125
  108. package/dist/goals/__tests__/GoalTreeView.test.d.ts +0 -1
  109. package/dist/goals/__tests__/GoalTreeView.test.js +0 -337
  110. package/dist/goals/__tests__/layout.test.d.ts +0 -1
  111. package/dist/goals/__tests__/layout.test.js +0 -153
  112. package/dist/goals/__tests__/mutations.test.d.ts +0 -1
  113. package/dist/goals/__tests__/mutations.test.js +0 -134
  114. package/dist/goals/__tests__/parse-canonical.test.d.ts +0 -1
  115. package/dist/goals/__tests__/parse-canonical.test.js +0 -131
  116. package/dist/goals/__tests__/validate.test.d.ts +0 -1
  117. package/dist/goals/__tests__/validate.test.js +0 -183
  118. package/dist/integration/__tests__/validate.test.d.ts +0 -1
  119. package/dist/integration/__tests__/validate.test.js +0 -169
  120. package/dist/location/__tests__/validate.test.d.ts +0 -1
  121. package/dist/location/__tests__/validate.test.js +0 -107
  122. package/dist/node/__tests__/validate.test.d.ts +0 -1
  123. package/dist/node/__tests__/validate.test.js +0 -100
  124. package/dist/process-blueprint/__tests__/compliance-lane.test.d.ts +0 -1
  125. package/dist/process-blueprint/__tests__/compliance-lane.test.js +0 -272
  126. package/dist/process-blueprint/__tests__/layout.test.d.ts +0 -1
  127. package/dist/process-blueprint/__tests__/layout.test.js +0 -196
  128. package/dist/process-blueprint/__tests__/validate.test.d.ts +0 -1
  129. package/dist/process-blueprint/__tests__/validate.test.js +0 -280
  130. package/dist/process-map/__tests__/validate.test.d.ts +0 -1
  131. package/dist/process-map/__tests__/validate.test.js +0 -199
  132. package/dist/products/__tests__/validate.test.d.ts +0 -1
  133. package/dist/products/__tests__/validate.test.js +0 -210
  134. package/dist/repo-validate/__tests__/validate-repo.test.d.ts +0 -1
  135. package/dist/repo-validate/__tests__/validate-repo.test.js +0 -576
  136. package/dist/requirement/__tests__/example.test.d.ts +0 -1
  137. package/dist/requirement/__tests__/example.test.js +0 -21
  138. package/dist/requirement/__tests__/validate.test.d.ts +0 -1
  139. package/dist/requirement/__tests__/validate.test.js +0 -80
  140. package/dist/scenarios/__tests__/validate.test.d.ts +0 -1
  141. package/dist/scenarios/__tests__/validate.test.js +0 -183
  142. package/dist/stakeholder/__tests__/validate.test.d.ts +0 -1
  143. package/dist/stakeholder/__tests__/validate.test.js +0 -88
  144. package/dist/target-state/__tests__/validate.test.d.ts +0 -1
  145. package/dist/target-state/__tests__/validate.test.js +0 -78
  146. package/dist/technology-service/__tests__/validate.test.d.ts +0 -1
  147. package/dist/technology-service/__tests__/validate.test.js +0 -121
  148. package/dist/theme/__tests__/tokens.test.d.ts +0 -1
  149. package/dist/theme/__tests__/tokens.test.js +0 -159
  150. package/dist/webview/__tests__/entity-text-layout.test.d.ts +0 -1
  151. package/dist/webview/__tests__/entity-text-layout.test.js +0 -155
  152. package/dist/webview/__tests__/entry-notations.test.d.ts +0 -1
  153. package/dist/webview/__tests__/entry-notations.test.js +0 -62
  154. package/dist/webview/__tests__/entry.test.d.ts +0 -1
  155. package/dist/webview/__tests__/entry.test.js +0 -56
  156. package/dist/webview/__tests__/render-activities.test.d.ts +0 -1
  157. package/dist/webview/__tests__/render-activities.test.js +0 -91
  158. package/dist/webview/__tests__/render-blocks.test.d.ts +0 -1
  159. package/dist/webview/__tests__/render-blocks.test.js +0 -175
  160. package/dist/webview/__tests__/render-goals.test.d.ts +0 -1
  161. package/dist/webview/__tests__/render-goals.test.js +0 -120
  162. package/dist/webview/__tests__/render-process.test.d.ts +0 -1
  163. package/dist/webview/__tests__/render-process.test.js +0 -463
  164. package/dist/webview/__tests__/render-util.test.d.ts +0 -1
  165. package/dist/webview/__tests__/render-util.test.js +0 -54
  166. package/src/__tests__/edge-path.test.ts +0 -67
  167. package/src/__tests__/node-size-presets.test.ts +0 -50
  168. package/src/__tests__/scope.test.ts +0 -27
  169. package/src/__tests__/yaml-normalize.test.ts +0 -158
  170. package/src/activities/__tests__/cpm.test.ts +0 -164
  171. package/src/activities/__tests__/gantt.test.ts +0 -290
  172. package/src/activities/__tests__/layout.test.ts +0 -112
  173. package/src/activities/__tests__/validate.test.ts +0 -446
  174. package/src/activity-card/__tests__/example.test.ts +0 -83
  175. package/src/activity-card/__tests__/layout.test.ts +0 -162
  176. package/src/activity-card/__tests__/resolver.test.ts +0 -357
  177. package/src/activity-card/__tests__/validate.test.ts +0 -167
  178. package/src/actor/__tests__/validate.test.ts +0 -114
  179. package/src/applications/__tests__/validate.test.ts +0 -256
  180. package/src/assertion/__tests__/example.test.ts +0 -37
  181. package/src/assertion/__tests__/validate.test.ts +0 -142
  182. package/src/blocks/__tests__/layout.test.ts +0 -169
  183. package/src/blocks/__tests__/validate.test.ts +0 -260
  184. package/src/business-service/__tests__/validate.test.ts +0 -160
  185. package/src/capability-map/__tests__/CapabilityMapView.test.tsx +0 -232
  186. package/src/capability-map/__tests__/address.test.ts +0 -59
  187. package/src/capability-map/__tests__/dsm-layout.test.ts +0 -52
  188. package/src/capability-map/__tests__/dsm-mutations.test.ts +0 -141
  189. package/src/capability-map/__tests__/dsm-validate.test.ts +0 -65
  190. package/src/capability-map/__tests__/validate.test.ts +0 -238
  191. package/src/change/__tests__/validate.test.ts +0 -97
  192. package/src/codex/__tests__/example.test.ts +0 -40
  193. package/src/codex/__tests__/validate.test.ts +0 -84
  194. package/src/compliance/__tests__/canon-catalog.test.ts +0 -68
  195. package/src/compliance/__tests__/classify.test.ts +0 -64
  196. package/src/compliance/__tests__/confidence.test.ts +0 -98
  197. package/src/compliance/__tests__/coverage-metric.test.ts +0 -300
  198. package/src/compliance/__tests__/demo-scenario.test.ts +0 -273
  199. package/src/compliance/__tests__/example.test.ts +0 -57
  200. package/src/compliance/__tests__/gap-report.test.ts +0 -129
  201. package/src/compliance/__tests__/html.test.ts +0 -142
  202. package/src/compliance/__tests__/impact.test.ts +0 -1060
  203. package/src/compliance/__tests__/markdown.test.ts +0 -95
  204. package/src/compliance/__tests__/trace.test.ts +0 -157
  205. package/src/compliance/__tests__/view-resolution.test.ts +0 -80
  206. package/src/compliance/__tests__/views.test.ts +0 -64
  207. package/src/compliance-matrix/__tests__/build.test.ts +0 -200
  208. package/src/compliance-matrix/__tests__/example.test.ts +0 -57
  209. package/src/confidence/__tests__/score.test.ts +0 -254
  210. package/src/constraint/__tests__/example.test.ts +0 -19
  211. package/src/constraint/__tests__/validate.test.ts +0 -68
  212. package/src/factor/__tests__/validate.test.ts +0 -133
  213. package/src/fgca/__tests__/chain-table.test.ts +0 -172
  214. package/src/fgca/__tests__/layout.test.ts +0 -179
  215. package/src/fgca/__tests__/parse-canonical.test.ts +0 -296
  216. package/src/fgca/__tests__/preview-layout.test.ts +0 -124
  217. package/src/fgca/__tests__/resolver.test.ts +0 -209
  218. package/src/fgca/__tests__/validate.test.ts +0 -142
  219. package/src/goals/__tests__/GoalTreeView.test.tsx +0 -361
  220. package/src/goals/__tests__/layout.test.ts +0 -175
  221. package/src/goals/__tests__/mutations.test.ts +0 -153
  222. package/src/goals/__tests__/parse-canonical.test.ts +0 -147
  223. package/src/goals/__tests__/validate.test.ts +0 -202
  224. package/src/integration/__tests__/validate.test.ts +0 -203
  225. package/src/location/__tests__/validate.test.ts +0 -127
  226. package/src/node/__tests__/validate.test.ts +0 -118
  227. package/src/process-blueprint/__tests__/compliance-lane.test.ts +0 -320
  228. package/src/process-blueprint/__tests__/layout.test.ts +0 -240
  229. package/src/process-blueprint/__tests__/validate.test.ts +0 -310
  230. package/src/process-map/__tests__/validate.test.ts +0 -223
  231. package/src/products/__tests__/validate.test.ts +0 -239
  232. package/src/repo-validate/__tests__/validate-repo.test.ts +0 -699
  233. package/src/requirement/__tests__/example.test.ts +0 -24
  234. package/src/requirement/__tests__/validate.test.ts +0 -96
  235. package/src/scenarios/__tests__/validate.test.ts +0 -209
  236. package/src/stakeholder/__tests__/validate.test.ts +0 -105
  237. package/src/target-state/__tests__/validate.test.ts +0 -95
  238. package/src/technology-service/__tests__/validate.test.ts +0 -143
  239. package/src/theme/__tests__/tokens.test.ts +0 -185
  240. package/src/webview/__tests__/entity-text-layout.test.ts +0 -182
  241. package/src/webview/__tests__/entry-notations.test.ts +0 -77
  242. package/src/webview/__tests__/entry.test.ts +0 -64
  243. package/src/webview/__tests__/render-activities.test.ts +0 -100
  244. package/src/webview/__tests__/render-blocks.test.ts +0 -206
  245. package/src/webview/__tests__/render-goals.test.ts +0 -128
  246. package/src/webview/__tests__/render-process.test.ts +0 -538
  247. package/src/webview/__tests__/render-util.test.ts +0 -66
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@transitrix/diagrams",
3
- "version": "1.8.6",
3
+ "version": "1.8.7",
4
4
  "type": "module",
5
5
  "description": "Shared rendering, validation, and pure mutations for Transitrix custom diagram formats.",
6
6
  "license": "MIT",
@@ -31,7 +31,12 @@
31
31
  },
32
32
  "files": [
33
33
  "dist",
34
- "src"
34
+ "src",
35
+ "!src/**/__tests__",
36
+ "!src/**/*.test.ts",
37
+ "!src/**/*.test.tsx",
38
+ "!src/**/*.js.map",
39
+ "!src/**/*.d.ts.map"
35
40
  ],
36
41
  "scripts": {
37
42
  "build": "tsc -p .",
@@ -1 +0,0 @@
1
- export {};
@@ -1,55 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import { horizontalCubicEdgePath, EDGE_MIN_HANDLE } from '../edge-path.js';
3
- describe('horizontalCubicEdgePath', () => {
4
- // A short horizontal edge: |dx|=40 < EDGE_MIN_HANDLE*2, |dy|=0, so the
5
- // base handle is the floor (64).
6
- const sx = 0, sy = 0, tx = 40, ty = 0;
7
- it('curvature 1 uses the floor handle (historical appearance)', () => {
8
- const d = horizontalCubicEdgePath(sx, sy, tx, ty, 1);
9
- // handle = max(64, 20, 0) = 64
10
- expect(d).toBe(`M0,0 C${EDGE_MIN_HANDLE},0 ${40 - EDGE_MIN_HANDLE},0 40,0`);
11
- });
12
- it('default curvature equals explicit curvature 1', () => {
13
- expect(horizontalCubicEdgePath(sx, sy, tx, ty)).toBe(horizontalCubicEdgePath(sx, sy, tx, ty, 1));
14
- });
15
- it('curvature 0 collapses control points onto the endpoints (straight line)', () => {
16
- const d = horizontalCubicEdgePath(sx, sy, tx, ty, 0);
17
- expect(d).toBe('M0,0 C0,0 40,0 40,0');
18
- });
19
- it('changing curvature changes the path output (AC#6)', () => {
20
- const a = horizontalCubicEdgePath(sx, sy, tx, ty, 1);
21
- const b = horizontalCubicEdgePath(sx, sy, tx, ty, 2);
22
- expect(b).not.toBe(a);
23
- });
24
- it('larger curvature pushes the control handles further out', () => {
25
- const handleOf = (curv) => {
26
- // First control point x is `sx + handle`; parse it back out.
27
- const m = horizontalCubicEdgePath(0, 0, 40, 0, curv).match(/^M0,0 C(-?\d+(?:\.\d+)?),0/);
28
- return Number(m[1]);
29
- };
30
- expect(handleOf(2)).toBeGreaterThan(handleOf(1));
31
- expect(handleOf(0.5)).toBeLessThan(handleOf(1));
32
- expect(handleOf(2)).toBe(2 * EDGE_MIN_HANDLE);
33
- });
34
- it('handle scales with the vertical span for stacked nodes', () => {
35
- // |dy|=200 ⇒ base handle = max(64, 0, 160) = 160; ×1 = 160.
36
- const d = horizontalCubicEdgePath(0, 0, 0, 200, 1);
37
- expect(d).toBe('M0,0 C160,0 -160,200 0,200');
38
- });
39
- it('entryCurvature independently scales the arrival handle', () => {
40
- // exit handle = max(64,20,0)*1 = 64; entry handle = max(64,20,0)*2 = 128.
41
- const d = horizontalCubicEdgePath(0, 0, 40, 0, 1, 2);
42
- expect(d).toBe(`M0,0 C${EDGE_MIN_HANDLE},0 ${40 - EDGE_MIN_HANDLE * 2},0 40,0`);
43
- });
44
- it('omitting entryCurvature gives symmetric handles (historical behaviour)', () => {
45
- expect(horizontalCubicEdgePath(0, 0, 40, 0, 0.5)).toBe(horizontalCubicEdgePath(0, 0, 40, 0, 0.5, 0.5));
46
- });
47
- it('caps the handle for a tall edge with a narrow column gap, instead of overshooting the target', () => {
48
- // A network-view edge spanning several rows (|dy|=500) with a typical
49
- // adjacent-column gap (dx=80): uncapped, |dy|*0.8=400 would push the exit
50
- // control point 320px past the target's x, producing an exaggerated
51
- // S-bow. Capped at 160, the control points stay close to the endpoints.
52
- const d = horizontalCubicEdgePath(0, 0, 80, 500, 1);
53
- expect(d).toBe('M0,0 C160,0 -80,500 80,500');
54
- });
55
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,30 +0,0 @@
1
- import { describe, expect, it } from 'vitest';
2
- import { ACTION_NODE_SIZE, BLOCKS_LEAF_SIZE, CAPABILITY_MAP_NODE_SIZE, DGCA_NODE_SIZE, ENTITY_NODE_HEIGHT, ENTITY_NODE_SIZE, ENTITY_NODE_WIDTH, GOALS_NODE_SIZE, PROCESS_BLUEPRINT_SIZE, resolveGoalsNodeSize, } from '../node-size-presets.js';
3
- describe('node-size-presets', () => {
4
- it('uses shared width and height tiers for entity nodes', () => {
5
- expect(ENTITY_NODE_WIDTH).toEqual({ compact: 200, normal: 250, wide: 320 });
6
- expect(ENTITY_NODE_HEIGHT).toEqual({ compact: 72, normal: 80, wide: 96 });
7
- expect(ENTITY_NODE_SIZE.normal).toEqual({ width: 250, height: 80 });
8
- expect(ENTITY_NODE_SIZE.compact).toEqual({ width: 200, height: 72 });
9
- expect(ENTITY_NODE_SIZE.wide).toEqual({ width: 320, height: 96 });
10
- });
11
- it('exposes the same entity sizes for every box-based notation', () => {
12
- for (const table of [GOALS_NODE_SIZE, DGCA_NODE_SIZE, BLOCKS_LEAF_SIZE, ACTION_NODE_SIZE]) {
13
- expect(table).toBe(ENTITY_NODE_SIZE);
14
- expect(table.normal).toEqual(ENTITY_NODE_SIZE.normal);
15
- }
16
- expect(CAPABILITY_MAP_NODE_SIZE.normal).toEqual({
17
- nodeWidth: ENTITY_NODE_WIDTH.normal,
18
- nodeHeight: ENTITY_NODE_HEIGHT.normal,
19
- });
20
- });
21
- it('scales wide above normal and compact below', () => {
22
- expect(resolveGoalsNodeSize('wide').height).toBeGreaterThan(resolveGoalsNodeSize('normal').height);
23
- expect(resolveGoalsNodeSize('compact').height).toBeLessThan(resolveGoalsNodeSize('normal').height);
24
- expect(resolveGoalsNodeSize('wide').width).toBeGreaterThan(resolveGoalsNodeSize('normal').width);
25
- });
26
- it('scales process blueprint from the same tier ratios', () => {
27
- expect(PROCESS_BLUEPRINT_SIZE.wide.stageColumnWidth).toBeGreaterThan(PROCESS_BLUEPRINT_SIZE.normal.stageColumnWidth);
28
- expect(PROCESS_BLUEPRINT_SIZE.compact.goalRowHeight).toBeLessThan(PROCESS_BLUEPRINT_SIZE.normal.goalRowHeight);
29
- });
30
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,23 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import { checkScopeRoot, SCOPE_MISSING_ROOT_CODE } from '../scope.js';
3
- describe('checkScopeRoot', () => {
4
- it('returns null for non-root scopes', () => {
5
- expect(checkScopeRoot({ mode: 'all' }, [1, 2])).toBeNull();
6
- expect(checkScopeRoot({ mode: 'level', maxLevel: 1 }, [1, 2])).toBeNull();
7
- });
8
- it('returns null when the root id is present (numeric ids compared as strings)', () => {
9
- const scope = { mode: 'root', rootGoalId: '2' };
10
- expect(checkScopeRoot(scope, [1, 2, 3])).toBeNull();
11
- });
12
- it('returns a SCOPE-001 warning when the root id is absent', () => {
13
- const scope = { mode: 'root', rootGoalId: '99' };
14
- const w = checkScopeRoot(scope, [1, 2, 3]);
15
- expect(w).not.toBeNull();
16
- expect(w.code).toBe(SCOPE_MISSING_ROOT_CODE);
17
- expect(w.message).toContain('99');
18
- });
19
- it('handles string goal ids', () => {
20
- expect(checkScopeRoot({ mode: 'root', rootGoalId: 'g1' }, ['g1', 'g2'])).toBeNull();
21
- expect(checkScopeRoot({ mode: 'root', rootGoalId: 'gX' }, ['g1', 'g2'])).not.toBeNull();
22
- });
23
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,148 +0,0 @@
1
- import { describe, it, expect, beforeAll, afterAll } from 'vitest';
2
- import yaml from 'js-yaml';
3
- import { coerceDatesToIsoStrings } from '../yaml-normalize.js';
4
- import { validateActivities } from '../activities/index.js';
5
- describe('coerceDatesToIsoStrings', () => {
6
- it('replaces top-level Date with ISO YYYY-MM-DD string', () => {
7
- const out = coerceDatesToIsoStrings(new Date(Date.UTC(2026, 5, 1))); // 2026-06-01 UTC
8
- expect(out).toBe('2026-06-01');
9
- });
10
- it('replaces Date values inside nested arrays of objects', () => {
11
- const input = {
12
- activities: [
13
- { id: 'A-001', start_date: new Date(Date.UTC(2026, 5, 1)), end_date: new Date(Date.UTC(2026, 5, 5)) },
14
- { id: 'A-002', start_date: '2026-06-06' },
15
- ],
16
- };
17
- coerceDatesToIsoStrings(input);
18
- expect(input.activities[0].start_date).toBe('2026-06-01');
19
- expect(input.activities[0].end_date).toBe('2026-06-05');
20
- expect(input.activities[1].start_date).toBe('2026-06-06');
21
- });
22
- it('walks objects recursively', () => {
23
- const input = {
24
- project: { start_date: new Date(Date.UTC(2026, 0, 15)) },
25
- };
26
- coerceDatesToIsoStrings(input);
27
- expect(input.project.start_date).toBe('2026-01-15');
28
- });
29
- it('leaves non-Date values untouched', () => {
30
- const input = {
31
- notation: 'activities',
32
- activities: [{ id: 'A-001', duration: 3, start_date: '2026-06-01' }],
33
- };
34
- const out = coerceDatesToIsoStrings(input);
35
- expect(out).toBe(input);
36
- expect(input.activities[0].start_date).toBe('2026-06-01');
37
- expect(input.activities[0].duration).toBe(3);
38
- });
39
- it('handles null, undefined, and primitive scalars', () => {
40
- expect(coerceDatesToIsoStrings(null)).toBe(null);
41
- expect(coerceDatesToIsoStrings(undefined)).toBe(undefined);
42
- expect(coerceDatesToIsoStrings('hello')).toBe('hello');
43
- expect(coerceDatesToIsoStrings(42)).toBe(42);
44
- expect(coerceDatesToIsoStrings(true)).toBe(true);
45
- });
46
- it('handles arrays that contain bare Date elements', () => {
47
- const arr = [new Date(Date.UTC(2026, 5, 1)), 'x', { d: new Date(Date.UTC(2026, 5, 2)) }];
48
- coerceDatesToIsoStrings(arr);
49
- expect(arr[0]).toBe('2026-06-01');
50
- expect(arr[1]).toBe('x');
51
- expect(arr[2].d).toBe('2026-06-02');
52
- });
53
- });
54
- describe('coerceDatesToIsoStrings — js-yaml integration', () => {
55
- it('quoted ISO dates are preserved untouched', () => {
56
- const text = [
57
- 'notation: action',
58
- 'actions:',
59
- ' - id: "A-001"',
60
- ' name: "Quoted dates"',
61
- ' duration: 3',
62
- ' start_date: "2026-06-01"',
63
- ' end_date: "2026-06-03"',
64
- '',
65
- ].join('\n');
66
- const parsed = yaml.load(text);
67
- coerceDatesToIsoStrings(parsed);
68
- expect(parsed.actions[0].start_date).toBe('2026-06-01');
69
- expect(parsed.actions[0].end_date).toBe('2026-06-03');
70
- const v = validateActivities(parsed);
71
- expect(v.valid).toBe(true);
72
- });
73
- it('bare ISO dates are coerced to ISO strings and pass validation', () => {
74
- const text = [
75
- 'notation: action',
76
- 'actions:',
77
- ' - id: "A-001"',
78
- ' name: "Bare dates"',
79
- ' duration: 3',
80
- ' start_date: 2026-06-01',
81
- ' end_date: 2026-06-03',
82
- '',
83
- ].join('\n');
84
- const parsed = yaml.load(text);
85
- // Without coercion, js-yaml returns Date instances and the validator
86
- // would emit ACT-008 because typeof !== 'string'. Sanity-check that
87
- // assumption before normalisation.
88
- expect(parsed.actions[0].start_date).toBeInstanceOf(Date);
89
- coerceDatesToIsoStrings(parsed);
90
- expect(parsed.actions[0].start_date).toBe('2026-06-01');
91
- expect(parsed.actions[0].end_date).toBe('2026-06-03');
92
- const v = validateActivities(parsed);
93
- expect(v.valid).toBe(true);
94
- });
95
- });
96
- // The issue calls out the timezone trap: a Date built from a bare ISO
97
- // date is midnight UTC, but if we used `getFullYear / getMonth / getDate`
98
- // instead of the UTC variants, a non-UTC process timezone would shift the
99
- // day. Pin a non-UTC TZ for this block so the regression bites if anyone
100
- // later swaps to local-time accessors.
101
- describe('coerceDatesToIsoStrings — non-UTC timezone', () => {
102
- const originalTz = process.env.TZ;
103
- beforeAll(() => {
104
- // Pacific/Auckland is UTC+12/+13 — the most aggressive eastward shift
105
- // available without DST gymnastics. If local-time accessors are used,
106
- // `2026-06-01` parsed as midnight UTC reads back as `2026-06-01 12:00
107
- // local`, which is still the right day — so use a westward TZ for the
108
- // real test below. Auckland is here as a sanity case.
109
- process.env.TZ = 'Pacific/Auckland';
110
- });
111
- afterAll(() => {
112
- if (originalTz === undefined) {
113
- delete process.env.TZ;
114
- }
115
- else {
116
- process.env.TZ = originalTz;
117
- }
118
- });
119
- it('does not drift the day forward in an eastward timezone', () => {
120
- const text = 'd: 2026-06-01\n';
121
- const parsed = yaml.load(text);
122
- coerceDatesToIsoStrings(parsed);
123
- expect(parsed.d).toBe('2026-06-01');
124
- });
125
- });
126
- describe('coerceDatesToIsoStrings — westward (negative offset) timezone', () => {
127
- const originalTz = process.env.TZ;
128
- beforeAll(() => {
129
- // Pacific/Honolulu is UTC-10, no DST. Midnight UTC `2026-06-01` reads
130
- // back as `2026-05-31 14:00 local`. Local-time accessors would yield
131
- // `2026-05-31` — wrong by one day. UTC accessors yield `2026-06-01`.
132
- process.env.TZ = 'Pacific/Honolulu';
133
- });
134
- afterAll(() => {
135
- if (originalTz === undefined) {
136
- delete process.env.TZ;
137
- }
138
- else {
139
- process.env.TZ = originalTz;
140
- }
141
- });
142
- it('does not drift the day backward in a westward timezone', () => {
143
- const text = 'd: 2026-06-01\n';
144
- const parsed = yaml.load(text);
145
- coerceDatesToIsoStrings(parsed);
146
- expect(parsed.d).toBe('2026-06-01');
147
- });
148
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,146 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import { computeCpm } from '../cpm.js';
3
- // PMBoK textbook example (5-activity network):
4
- // A(5) → B(8) → D(7)
5
- // A(5) → C(3) → D(7)
6
- // D(7) → E(4)
7
- // Critical path: A→B→D→E = 5+8+7+4 = 24
8
- // A: ES=0, EF=5, LS=0, LF=5, slack=0 (critical)
9
- // B: ES=5, EF=13, LS=5, LF=13, slack=0 (critical)
10
- // C: ES=5, EF=8, LS=10, LF=13, slack=5
11
- // D: ES=13, EF=20, LS=13, LF=20, slack=0 (critical)
12
- // E: ES=20, EF=24, LS=20, LF=24, slack=0 (critical)
13
- const pmBokActivities = [
14
- { id: 'A', name: 'A', duration: 5 },
15
- { id: 'B', name: 'B', duration: 8, predecessors: ['A'] },
16
- { id: 'C', name: 'C', duration: 3, predecessors: ['A'] },
17
- { id: 'D', name: 'D', duration: 7, predecessors: ['B', 'C'] },
18
- { id: 'E', name: 'E', duration: 4, predecessors: ['D'] },
19
- ];
20
- describe('computeCpm — PMBoK textbook example', () => {
21
- const result = computeCpm(pmBokActivities);
22
- it('computes ES for each activity', () => {
23
- expect(result.get('A').es).toBe(0);
24
- expect(result.get('B').es).toBe(5);
25
- expect(result.get('C').es).toBe(5);
26
- expect(result.get('D').es).toBe(13);
27
- expect(result.get('E').es).toBe(20);
28
- });
29
- it('computes EF for each activity', () => {
30
- expect(result.get('A').ef).toBe(5);
31
- expect(result.get('B').ef).toBe(13);
32
- expect(result.get('C').ef).toBe(8);
33
- expect(result.get('D').ef).toBe(20);
34
- expect(result.get('E').ef).toBe(24);
35
- });
36
- it('computes LS for each activity', () => {
37
- expect(result.get('A').ls).toBe(0);
38
- expect(result.get('B').ls).toBe(5);
39
- expect(result.get('C').ls).toBe(10);
40
- expect(result.get('D').ls).toBe(13);
41
- expect(result.get('E').ls).toBe(20);
42
- });
43
- it('computes LF for each activity', () => {
44
- expect(result.get('A').lf).toBe(5);
45
- expect(result.get('B').lf).toBe(13);
46
- expect(result.get('C').lf).toBe(13);
47
- expect(result.get('D').lf).toBe(20);
48
- expect(result.get('E').lf).toBe(24);
49
- });
50
- it('computes slack', () => {
51
- expect(result.get('A').slack).toBe(0);
52
- expect(result.get('B').slack).toBe(0);
53
- expect(result.get('C').slack).toBe(5);
54
- expect(result.get('D').slack).toBe(0);
55
- expect(result.get('E').slack).toBe(0);
56
- });
57
- it('marks critical path activities', () => {
58
- expect(result.get('A').isCritical).toBe(true);
59
- expect(result.get('B').isCritical).toBe(true);
60
- expect(result.get('C').isCritical).toBe(false);
61
- expect(result.get('D').isCritical).toBe(true);
62
- expect(result.get('E').isCritical).toBe(true);
63
- });
64
- });
65
- describe('computeCpm — edge cases', () => {
66
- it('returns empty map for empty input', () => {
67
- const result = computeCpm([]);
68
- expect(result.size).toBe(0);
69
- });
70
- it('single node with no predecessors: ES=0, EF=duration, slack=0', () => {
71
- const result = computeCpm([{ id: 'A', name: 'A', duration: 5 }]);
72
- expect(result.get('A').es).toBe(0);
73
- expect(result.get('A').ef).toBe(5);
74
- expect(result.get('A').slack).toBe(0);
75
- expect(result.get('A').isCritical).toBe(true);
76
- });
77
- it('activity with no duration treated as zero-duration', () => {
78
- const result = computeCpm([{ id: 'A', name: 'Milestone' }]);
79
- expect(result.get('A').ef).toBe(0);
80
- });
81
- it('linear chain A(3)→B(5)→C(2): total=10, all critical', () => {
82
- const activities = [
83
- { id: 'A', name: 'A', duration: 3 },
84
- { id: 'B', name: 'B', duration: 5, predecessors: ['A'] },
85
- { id: 'C', name: 'C', duration: 2, predecessors: ['B'] },
86
- ];
87
- const result = computeCpm(activities);
88
- expect(result.get('A').ef).toBe(3);
89
- expect(result.get('B').ef).toBe(8);
90
- expect(result.get('C').ef).toBe(10);
91
- expect(result.get('A').isCritical).toBe(true);
92
- expect(result.get('B').isCritical).toBe(true);
93
- expect(result.get('C').isCritical).toBe(true);
94
- });
95
- it('parallel paths: longer path is critical, shorter has positive slack', () => {
96
- // A(1) → C(10)
97
- // B(5) → C(10)
98
- // merge at D(2): predecessors [C]
99
- // path via A: 1+10+2=13; path via B: 5+10+2=17 → critical
100
- const activities = [
101
- { id: 'A', name: 'A', duration: 1 },
102
- { id: 'B', name: 'B', duration: 5 },
103
- { id: 'C', name: 'C', duration: 10, predecessors: ['A', 'B'] },
104
- { id: 'D', name: 'D', duration: 2, predecessors: ['C'] },
105
- ];
106
- const result = computeCpm(activities);
107
- // C.es = max(EF[A], EF[B]) = max(1,5) = 5
108
- expect(result.get('C').es).toBe(5);
109
- expect(result.get('A').isCritical).toBe(false);
110
- expect(result.get('B').isCritical).toBe(true);
111
- expect(result.get('C').isCritical).toBe(true);
112
- expect(result.get('D').isCritical).toBe(true);
113
- expect(result.get('A').slack).toBe(4);
114
- expect(result.get('B').slack).toBe(0);
115
- });
116
- });
117
- describe('computeCpm — cycle defence', () => {
118
- // Pre-release should-fix: Kahn's topo-order silently omits cyclic nodes.
119
- // The validator's ACT-006 is the authoritative cycle error, but
120
- // layoutActivities is reachable without validation, so computeCpm must
121
- // still produce an entry for every activity (filled with neutral values
122
- // for omitted cyclic ones) — otherwise consumers see `undefined` and
123
- // bars render without CPM data.
124
- it('emits entries for every activity on a 2-node mutual cycle', () => {
125
- const result = computeCpm([
126
- { id: 'A', name: 'A', duration: 3, predecessors: ['B'] },
127
- { id: 'B', name: 'B', duration: 2, predecessors: ['A'] },
128
- ]);
129
- expect(result.size).toBe(2);
130
- expect(result.get('A')).toMatchObject({ es: 0, ef: 0, slack: 0, isCritical: false });
131
- expect(result.get('B')).toMatchObject({ es: 0, ef: 0, slack: 0, isCritical: false });
132
- });
133
- it('keeps real CPM data for the acyclic prefix when a cycle exists downstream', () => {
134
- // A → B is acyclic; C ↔ D is a mutual cycle disconnected from A/B.
135
- const result = computeCpm([
136
- { id: 'A', name: 'A', duration: 5 },
137
- { id: 'B', name: 'B', duration: 3, predecessors: ['A'] },
138
- { id: 'C', name: 'C', duration: 2, predecessors: ['D'] },
139
- { id: 'D', name: 'D', duration: 2, predecessors: ['C'] },
140
- ]);
141
- expect(result.get('A')?.ef).toBe(5);
142
- expect(result.get('B')?.ef).toBe(8);
143
- expect(result.get('C')).toMatchObject({ es: 0, ef: 0, isCritical: false });
144
- expect(result.get('D')).toMatchObject({ es: 0, ef: 0, isCritical: false });
145
- });
146
- });
@@ -1 +0,0 @@
1
- export {};