@critical-path/core 0.36.0 → 0.36.1

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 (185) hide show
  1. package/package.json +5 -1
  2. package/CHANGELOG.md +0 -593
  3. package/dist/deliverables.test.d.ts +0 -2
  4. package/dist/deliverables.test.d.ts.map +0 -1
  5. package/dist/deliverables.test.js +0 -232
  6. package/dist/deliverables.test.js.map +0 -1
  7. package/dist/domain/calendar.test.d.ts +0 -2
  8. package/dist/domain/calendar.test.d.ts.map +0 -1
  9. package/dist/domain/calendar.test.js +0 -181
  10. package/dist/domain/calendar.test.js.map +0 -1
  11. package/dist/domain/cpm.test.d.ts +0 -2
  12. package/dist/domain/cpm.test.d.ts.map +0 -1
  13. package/dist/domain/cpm.test.js +0 -166
  14. package/dist/domain/cpm.test.js.map +0 -1
  15. package/dist/domain/ddd.test.d.ts +0 -2
  16. package/dist/domain/ddd.test.d.ts.map +0 -1
  17. package/dist/domain/ddd.test.js +0 -349
  18. package/dist/domain/ddd.test.js.map +0 -1
  19. package/dist/domain/ladder.test.d.ts +0 -2
  20. package/dist/domain/ladder.test.d.ts.map +0 -1
  21. package/dist/domain/ladder.test.js +0 -213
  22. package/dist/domain/ladder.test.js.map +0 -1
  23. package/dist/domain/metrics.test.d.ts +0 -2
  24. package/dist/domain/metrics.test.d.ts.map +0 -1
  25. package/dist/domain/metrics.test.js +0 -252
  26. package/dist/domain/metrics.test.js.map +0 -1
  27. package/dist/domain/task-duration.test.d.ts +0 -2
  28. package/dist/domain/task-duration.test.d.ts.map +0 -1
  29. package/dist/domain/task-duration.test.js +0 -307
  30. package/dist/domain/task-duration.test.js.map +0 -1
  31. package/dist/domain/workload.test.d.ts +0 -2
  32. package/dist/domain/workload.test.d.ts.map +0 -1
  33. package/dist/domain/workload.test.js +0 -261
  34. package/dist/domain/workload.test.js.map +0 -1
  35. package/dist/engine/actor.test.d.ts +0 -2
  36. package/dist/engine/actor.test.d.ts.map +0 -1
  37. package/dist/engine/actor.test.js +0 -54
  38. package/dist/engine/actor.test.js.map +0 -1
  39. package/dist/engine/authorization.test.d.ts +0 -2
  40. package/dist/engine/authorization.test.d.ts.map +0 -1
  41. package/dist/engine/authorization.test.js +0 -154
  42. package/dist/engine/authorization.test.js.map +0 -1
  43. package/dist/engine/cascade.test.d.ts +0 -2
  44. package/dist/engine/cascade.test.d.ts.map +0 -1
  45. package/dist/engine/cascade.test.js +0 -99
  46. package/dist/engine/cascade.test.js.map +0 -1
  47. package/dist/engine/config.test.d.ts +0 -2
  48. package/dist/engine/config.test.d.ts.map +0 -1
  49. package/dist/engine/config.test.js +0 -46
  50. package/dist/engine/config.test.js.map +0 -1
  51. package/dist/engine/entity-events.test.d.ts +0 -2
  52. package/dist/engine/entity-events.test.d.ts.map +0 -1
  53. package/dist/engine/entity-events.test.js +0 -61
  54. package/dist/engine/entity-events.test.js.map +0 -1
  55. package/dist/index.test.d.ts +0 -2
  56. package/dist/index.test.d.ts.map +0 -1
  57. package/dist/index.test.js +0 -429
  58. package/dist/index.test.js.map +0 -1
  59. package/dist/plugins/plugins.test.d.ts +0 -2
  60. package/dist/plugins/plugins.test.d.ts.map +0 -1
  61. package/dist/plugins/plugins.test.js +0 -137
  62. package/dist/plugins/plugins.test.js.map +0 -1
  63. package/dist/schemas/schemas.test.d.ts +0 -2
  64. package/dist/schemas/schemas.test.d.ts.map +0 -1
  65. package/dist/schemas/schemas.test.js +0 -58
  66. package/dist/schemas/schemas.test.js.map +0 -1
  67. package/dist/status.test.d.ts +0 -2
  68. package/dist/status.test.d.ts.map +0 -1
  69. package/dist/status.test.js +0 -295
  70. package/dist/status.test.js.map +0 -1
  71. package/dist/storage/storage.test.d.ts +0 -2
  72. package/dist/storage/storage.test.d.ts.map +0 -1
  73. package/dist/storage/storage.test.js +0 -236
  74. package/dist/storage/storage.test.js.map +0 -1
  75. package/dist/storage/upload-limits.test.d.ts +0 -2
  76. package/dist/storage/upload-limits.test.d.ts.map +0 -1
  77. package/dist/storage/upload-limits.test.js +0 -31
  78. package/dist/storage/upload-limits.test.js.map +0 -1
  79. package/dist/store/conformance.test.d.ts +0 -2
  80. package/dist/store/conformance.test.d.ts.map +0 -1
  81. package/dist/store/conformance.test.js +0 -15
  82. package/dist/store/conformance.test.js.map +0 -1
  83. package/dist/store/firebase.test.d.ts +0 -2
  84. package/dist/store/firebase.test.d.ts.map +0 -1
  85. package/dist/store/firebase.test.js +0 -103
  86. package/dist/store/firebase.test.js.map +0 -1
  87. package/dist/store/query.test.d.ts +0 -2
  88. package/dist/store/query.test.d.ts.map +0 -1
  89. package/dist/store/query.test.js +0 -89
  90. package/dist/store/query.test.js.map +0 -1
  91. package/dist/store/sqlite.test.d.ts +0 -2
  92. package/dist/store/sqlite.test.d.ts.map +0 -1
  93. package/dist/store/sqlite.test.js +0 -177
  94. package/dist/store/sqlite.test.js.map +0 -1
  95. package/dist/task-state.test.d.ts +0 -2
  96. package/dist/task-state.test.d.ts.map +0 -1
  97. package/dist/task-state.test.js +0 -423
  98. package/dist/task-state.test.js.map +0 -1
  99. package/dist/use-case-validation.test.d.ts +0 -2
  100. package/dist/use-case-validation.test.d.ts.map +0 -1
  101. package/dist/use-case-validation.test.js +0 -281
  102. package/dist/use-case-validation.test.js.map +0 -1
  103. package/dist/utils/fractional-index.test.d.ts +0 -2
  104. package/dist/utils/fractional-index.test.d.ts.map +0 -1
  105. package/dist/utils/fractional-index.test.js +0 -182
  106. package/dist/utils/fractional-index.test.js.map +0 -1
  107. package/dist/utils/key.test.d.ts +0 -2
  108. package/dist/utils/key.test.d.ts.map +0 -1
  109. package/dist/utils/key.test.js +0 -65
  110. package/dist/utils/key.test.js.map +0 -1
  111. package/dist/utils/mentions.test.d.ts +0 -2
  112. package/dist/utils/mentions.test.d.ts.map +0 -1
  113. package/dist/utils/mentions.test.js +0 -114
  114. package/dist/utils/mentions.test.js.map +0 -1
  115. package/dist/webhooks/webhooks.test.d.ts +0 -2
  116. package/dist/webhooks/webhooks.test.d.ts.map +0 -1
  117. package/dist/webhooks/webhooks.test.js +0 -154
  118. package/dist/webhooks/webhooks.test.js.map +0 -1
  119. package/src/deliverables.test.ts +0 -284
  120. package/src/domain/authorization.ts +0 -82
  121. package/src/domain/calendar.test.ts +0 -216
  122. package/src/domain/calendar.ts +0 -502
  123. package/src/domain/cpm.test.ts +0 -189
  124. package/src/domain/cpm.ts +0 -258
  125. package/src/domain/custom-fields.ts +0 -172
  126. package/src/domain/ddd.test.ts +0 -442
  127. package/src/domain/entities.ts +0 -798
  128. package/src/domain/errors.ts +0 -38
  129. package/src/domain/events.ts +0 -369
  130. package/src/domain/graph.ts +0 -70
  131. package/src/domain/index.ts +0 -12
  132. package/src/domain/ladder.test.ts +0 -251
  133. package/src/domain/ladder.ts +0 -474
  134. package/src/domain/metrics.test.ts +0 -288
  135. package/src/domain/metrics.ts +0 -497
  136. package/src/domain/task-duration.test.ts +0 -354
  137. package/src/domain/workload.test.ts +0 -311
  138. package/src/domain/workload.ts +0 -457
  139. package/src/engine/actor.test.ts +0 -63
  140. package/src/engine/authorization.test.ts +0 -199
  141. package/src/engine/cascade.test.ts +0 -121
  142. package/src/engine/config.test.ts +0 -51
  143. package/src/engine/entity-events.test.ts +0 -67
  144. package/src/engine/index.ts +0 -2495
  145. package/src/index.test.ts +0 -514
  146. package/src/index.ts +0 -9
  147. package/src/plugins/index.ts +0 -103
  148. package/src/plugins/plugins.test.ts +0 -161
  149. package/src/schemas/index.ts +0 -402
  150. package/src/schemas/schemas.test.ts +0 -116
  151. package/src/status.test.ts +0 -354
  152. package/src/storage/file-storage.ts +0 -200
  153. package/src/storage/firebase-storage.ts +0 -209
  154. package/src/storage/index.ts +0 -3
  155. package/src/storage/s3.ts +0 -151
  156. package/src/storage/storage.test.ts +0 -274
  157. package/src/storage/upload-limits.test.ts +0 -41
  158. package/src/store/conformance.test.ts +0 -15
  159. package/src/store/firebase.test.ts +0 -131
  160. package/src/store/firebase.ts +0 -658
  161. package/src/store/index.ts +0 -623
  162. package/src/store/query.test.ts +0 -110
  163. package/src/store/query.ts +0 -113
  164. package/src/store/sqlite.test.ts +0 -218
  165. package/src/store/sqlite.ts +0 -1480
  166. package/src/task-state.test.ts +0 -506
  167. package/src/testing/conformance.ts +0 -319
  168. package/src/testing/index.ts +0 -1
  169. package/src/types/index.ts +0 -871
  170. package/src/use-case-validation.test.ts +0 -324
  171. package/src/utils/fractional-index.test.ts +0 -228
  172. package/src/utils/fractional-index.ts +0 -254
  173. package/src/utils/index.ts +0 -7
  174. package/src/utils/key.test.ts +0 -76
  175. package/src/utils/key.ts +0 -62
  176. package/src/utils/mentions.test.ts +0 -132
  177. package/src/utils/mentions.ts +0 -131
  178. package/src/utils/status.ts +0 -419
  179. package/src/utils/workflow.ts +0 -306
  180. package/src/webhooks/dispatcher.ts +0 -190
  181. package/src/webhooks/index.ts +0 -2
  182. package/src/webhooks/signature.ts +0 -57
  183. package/src/webhooks/webhooks.test.ts +0 -201
  184. package/tsconfig.json +0 -8
  185. package/tsconfig.tsbuildinfo +0 -1
@@ -1,251 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import { CriticalPathEngine } from '../engine/index.js';
3
- import {
4
- aggregateConcreteEvidenceForTask,
5
- computeMacroPhases,
6
- buildTimelineLadder
7
- } from './ladder.js';
8
- import type { Task, TaskContainer, Attachment, Deliverable, TimeEntry } from '../types/index.js';
9
-
10
- describe('Ladder of Abstraction Domain Logic', () => {
11
- const now = '2026-09-11T10:00:00.000Z';
12
-
13
- it('aggregates concrete evidence, daily effort distribution, and reality delta for a task', () => {
14
- const task: Task = {
15
- id: 'task-design',
16
- projectId: 'proj-1',
17
- title: 'Design Checkout Flow',
18
- status: 'in_progress',
19
- semanticStatus: 'in_progress',
20
- priority: 'high',
21
- plannedStartDate: '2026-09-01T09:00:00.000Z',
22
- actualStartDate: '2026-09-02T10:00:00.000Z',
23
- dueDate: '2026-09-15T18:00:00.000Z',
24
- estimatedHours: 20,
25
- todos: [
26
- { id: 'todo-1', title: 'Sketch wireframes', completed: true, completedAt: '2026-09-03T12:00:00.000Z' },
27
- { id: 'todo-2', title: 'Component specs', completed: false }
28
- ],
29
- createdAt: now,
30
- updatedAt: now
31
- };
32
-
33
- const attachments: Attachment[] = [
34
- {
35
- id: 'att-1',
36
- taskId: 'task-design',
37
- uploaderId: 'user-1',
38
- filename: 'checkout_mockup.png',
39
- mimeType: 'image/png',
40
- sizeBytes: 204800,
41
- url: 'https://cdn.example.com/checkout_mockup.png',
42
- artifactType: 'deliverable',
43
- createdAt: now,
44
- updatedAt: now
45
- }
46
- ];
47
-
48
- const deliverables: Deliverable[] = [
49
- {
50
- id: 'deliv-1',
51
- projectId: 'proj-1',
52
- title: 'Checkout Prototype',
53
- status: 'in_production',
54
- format: 'Figma',
55
- outputUrls: ['https://figma.com/file/12345'],
56
- createdAt: now,
57
- updatedAt: now
58
- }
59
- ];
60
- task.deliverableId = 'deliv-1';
61
-
62
- const timeEntries: TimeEntry[] = [
63
- { id: 'te-1', taskId: 'task-design', userId: 'user-1', hours: 4, loggedAt: '2026-09-02T16:00:00.000Z' },
64
- { id: 'te-2', taskId: 'task-design', userId: 'user-1', hours: 6, loggedAt: '2026-09-03T17:00:00.000Z' },
65
- { id: 'te-3', taskId: 'task-design', userId: 'user-1', hours: 3, loggedAt: '2026-09-03T19:00:00.000Z' }
66
- ];
67
-
68
- const evidence = aggregateConcreteEvidenceForTask(
69
- task,
70
- attachments,
71
- deliverables,
72
- timeEntries,
73
- []
74
- );
75
-
76
- expect(evidence.taskId).toBe('task-design');
77
- expect(evidence.attachments).toHaveLength(1);
78
- expect(evidence.deliverables).toHaveLength(1);
79
- expect(evidence.todos).toHaveLength(2);
80
- expect(evidence.timeEntries).toHaveLength(3);
81
-
82
- // Check daily effort distribution (aggregated by day)
83
- expect(evidence.dailyEffortDistribution).toEqual([
84
- { date: '2026-09-02', hours: 4 },
85
- { date: '2026-09-03', hours: 9 } // 6 + 3
86
- ]);
87
-
88
- // Evidence summary
89
- expect(evidence.evidenceSummary.attachmentCount).toBe(1);
90
- expect(evidence.evidenceSummary.deliverableCount).toBe(1);
91
- expect(evidence.evidenceSummary.completedTodoCount).toBe(1);
92
- expect(evidence.evidenceSummary.totalLoggedHours).toBe(13);
93
- expect(evidence.evidenceSummary.hasVisualAsset).toBe(true);
94
-
95
- // Reality delta
96
- expect(evidence.realityDelta.plannedStartDate).toBe('2026-09-01T09:00:00.000Z');
97
- expect(evidence.realityDelta.actualStartDate).toBe('2026-09-02T10:00:00.000Z');
98
- expect(evidence.realityDelta.estimatedHours).toBe(20);
99
- expect(evidence.realityDelta.loggedHours).toBe(13);
100
- expect(evidence.realityDelta.varianceHours).toBe(-7); // Under budget by 7h
101
- expect(evidence.realityDelta.isOverEstimate).toBe(false);
102
- });
103
-
104
- it('computes macro phase rollups across containers with dates and progress weighting', () => {
105
- const containers: TaskContainer[] = [
106
- { id: 'c-research', projectId: 'p1', name: 'Research Phase', createdAt: now, updatedAt: now },
107
- { id: 'c-dev', projectId: 'p1', name: 'Development Phase', createdAt: now, updatedAt: now }
108
- ];
109
-
110
- const tasks: Task[] = [
111
- {
112
- id: 't-1',
113
- projectId: 'p1',
114
- containerId: 'c-research',
115
- title: 'User Interviews',
116
- status: 'done',
117
- semanticStatus: 'completed',
118
- priority: 'medium',
119
- progress: 100,
120
- plannedStartDate: '2026-09-01',
121
- dueDate: '2026-09-05',
122
- estimatedHours: 10,
123
- loggedHours: 10,
124
- createdAt: now,
125
- updatedAt: now
126
- },
127
- {
128
- id: 't-2',
129
- projectId: 'p1',
130
- containerId: 'c-dev',
131
- title: 'API Setup',
132
- status: 'in_progress',
133
- semanticStatus: 'in_progress',
134
- priority: 'high',
135
- progress: 50,
136
- plannedStartDate: '2026-09-06',
137
- dueDate: '2026-09-20',
138
- estimatedHours: 40,
139
- loggedHours: 20,
140
- createdAt: now,
141
- updatedAt: now
142
- }
143
- ];
144
-
145
- const criticalTaskIds = new Set(['t-2']);
146
- const phases = computeMacroPhases(tasks, containers, [], criticalTaskIds);
147
-
148
- expect(phases).toHaveLength(2);
149
-
150
- const researchPhase = phases.find((p) => p.id === 'c-research')!;
151
- expect(researchPhase.name).toBe('Research Phase');
152
- expect(researchPhase.startDate).toBe('2026-09-01');
153
- expect(researchPhase.endDate).toBe('2026-09-05');
154
- expect(researchPhase.progressPercentage).toBe(100);
155
- expect(researchPhase.health).toBe('completed');
156
- expect(researchPhase.isCritical).toBe(false);
157
-
158
- const devPhase = phases.find((p) => p.id === 'c-dev')!;
159
- expect(devPhase.name).toBe('Development Phase');
160
- expect(devPhase.startDate).toBe('2026-09-06');
161
- expect(devPhase.endDate).toBe('2026-09-20');
162
- expect(devPhase.progressPercentage).toBe(50);
163
- expect(devPhase.isCritical).toBe(true);
164
- expect(devPhase.criticalTaskCount).toBe(1);
165
- });
166
-
167
- it('integrates seamlessly with CriticalPathEngine APIs', async () => {
168
- const engine = new CriticalPathEngine();
169
- const project = await engine.createProject({ name: 'Timeline Ladder Project' });
170
-
171
- const c1 = await engine.store.createContainer({
172
- projectId: project.id,
173
- name: 'Phase 1: Design'
174
- });
175
-
176
- const t1 = await engine.createTask({
177
- projectId: project.id,
178
- containerId: c1.id,
179
- title: 'Wireframes',
180
- status: 'done',
181
- estimatedHours: 5,
182
- progress: 100,
183
- plannedStartDate: '2026-09-01',
184
- dueDate: '2026-09-05'
185
- });
186
-
187
- const t2 = await engine.createTask({
188
- projectId: project.id,
189
- containerId: c1.id,
190
- title: 'Visual Assets',
191
- status: 'in_progress',
192
- estimatedHours: 15,
193
- progress: 30,
194
- plannedStartDate: '2026-09-06',
195
- dueDate: '2026-09-12'
196
- });
197
-
198
- await engine.addDependency({
199
- taskId: t2.id,
200
- dependsOnTaskId: t1.id,
201
- type: 'blocking'
202
- });
203
-
204
- await engine.logTime({
205
- taskId: t2.id,
206
- userId: 'designer-1',
207
- hours: 4.5,
208
- loggedAt: '2026-09-07T12:00:00Z'
209
- });
210
-
211
- // 1. Calculate CPM
212
- const cpmAnalysis = await engine.calculateCriticalPath(project.id);
213
- expect(cpmAnalysis.totalDurationHours).toBe(20);
214
- expect(cpmAnalysis.criticalTaskIds).toEqual([t1.id, t2.id]);
215
-
216
- // 2. Query full Timeline Ladder
217
- const ladder = await engine.getTimelineLadder(project.id);
218
- expect(ladder.macro).toBeDefined();
219
- expect(ladder.macro?.projectName).toBe('Timeline Ladder Project');
220
- expect(ladder.macro?.criticalPathDurationHours).toBe(20);
221
- expect(ladder.macro?.phases).toHaveLength(1);
222
- expect(ladder.macro?.phases[0].name).toBe('Phase 1: Design');
223
-
224
- expect(ladder.standard).toBeDefined();
225
- expect(ladder.standard?.tasks).toHaveLength(2);
226
- const standardT2 = ladder.standard?.tasks.find((t) => t.id === t2.id)!;
227
- expect(standardT2.cpm?.earlyStart).toBe(5);
228
- expect(standardT2.cpm?.earlyFinish).toBe(20);
229
- expect(standardT2.blockingTaskIds).toEqual([t1.id]);
230
- expect(standardT2.concreteEvidenceSummary.timeEntryCount).toBe(1);
231
-
232
- expect(ladder.concrete).toBeDefined();
233
- const concreteT2 = ladder.concrete?.[t2.id]!;
234
- expect(concreteT2.timeEntries).toHaveLength(1);
235
- expect(concreteT2.dailyEffortDistribution).toEqual([{ date: '2026-09-07', hours: 4.5 }]);
236
- expect(concreteT2.realityDelta.loggedHours).toBe(4.5);
237
-
238
- // 3. Query filtered ladder levels
239
- const macroOnly = await engine.getTimelineLadder(project.id, { level: 'macro' });
240
- expect(macroOnly.macro).toBeDefined();
241
- expect(macroOnly.standard).toBeUndefined();
242
- expect(macroOnly.concrete).toBeUndefined();
243
-
244
- // 4. Query single task ladder zoom
245
- const taskLadder = await engine.getTaskLadder(t2.id);
246
- expect(taskLadder).not.toBeNull();
247
- expect(taskLadder?.macroPhase?.name).toBe('Phase 1: Design');
248
- expect(taskLadder?.standard.id).toBe(t2.id);
249
- expect(taskLadder?.concrete.dailyEffortDistribution).toEqual([{ date: '2026-09-07', hours: 4.5 }]);
250
- });
251
- });