@task-mcp/shared 1.0.22 → 1.0.24
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/dist/algorithms/critical-path.d.ts +47 -0
- package/dist/algorithms/critical-path.d.ts.map +1 -0
- package/dist/algorithms/critical-path.js +340 -0
- package/dist/algorithms/critical-path.js.map +1 -0
- package/dist/algorithms/critical-path.test.d.ts +2 -0
- package/dist/algorithms/critical-path.test.d.ts.map +1 -0
- package/dist/algorithms/critical-path.test.js +184 -0
- package/dist/algorithms/critical-path.test.js.map +1 -0
- package/dist/algorithms/dependency-integrity.d.ts +81 -0
- package/dist/algorithms/dependency-integrity.d.ts.map +1 -0
- package/dist/algorithms/dependency-integrity.js +209 -0
- package/dist/algorithms/dependency-integrity.js.map +1 -0
- package/dist/algorithms/dependency-integrity.test.d.ts +2 -0
- package/dist/algorithms/dependency-integrity.test.d.ts.map +1 -0
- package/dist/algorithms/dependency-integrity.test.js +296 -0
- package/dist/algorithms/dependency-integrity.test.js.map +1 -0
- package/dist/algorithms/index.d.ts +5 -0
- package/dist/algorithms/index.d.ts.map +1 -0
- package/dist/algorithms/index.js +5 -0
- package/dist/algorithms/index.js.map +1 -0
- package/dist/algorithms/tech-analysis.d.ts +106 -0
- package/dist/algorithms/tech-analysis.d.ts.map +1 -0
- package/dist/algorithms/tech-analysis.js +351 -0
- package/dist/algorithms/tech-analysis.js.map +1 -0
- package/dist/algorithms/tech-analysis.test.d.ts +2 -0
- package/dist/algorithms/tech-analysis.test.d.ts.map +1 -0
- package/dist/algorithms/tech-analysis.test.js +330 -0
- package/dist/algorithms/tech-analysis.test.js.map +1 -0
- package/dist/algorithms/topological-sort.d.ts +58 -0
- package/dist/algorithms/topological-sort.d.ts.map +1 -0
- package/dist/algorithms/topological-sort.js +201 -0
- package/dist/algorithms/topological-sort.js.map +1 -0
- package/dist/algorithms/topological-sort.test.d.ts +2 -0
- package/dist/algorithms/topological-sort.test.d.ts.map +1 -0
- package/dist/algorithms/topological-sort.test.js +154 -0
- package/dist/algorithms/topological-sort.test.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/schemas/inbox.d.ts +55 -0
- package/dist/schemas/inbox.d.ts.map +1 -0
- package/dist/schemas/inbox.js +25 -0
- package/dist/schemas/inbox.js.map +1 -0
- package/dist/schemas/index.d.ts +7 -0
- package/dist/schemas/index.d.ts.map +1 -0
- package/dist/schemas/index.js +17 -0
- package/dist/schemas/index.js.map +1 -0
- package/dist/schemas/llm-guide.d.ts +147 -0
- package/dist/schemas/llm-guide.d.ts.map +1 -0
- package/dist/schemas/llm-guide.js +72 -0
- package/dist/schemas/llm-guide.js.map +1 -0
- package/dist/schemas/project.d.ts +177 -0
- package/dist/schemas/project.d.ts.map +1 -0
- package/dist/schemas/project.js +56 -0
- package/dist/schemas/project.js.map +1 -0
- package/dist/schemas/response-format.d.ts +148 -0
- package/dist/schemas/response-format.d.ts.map +1 -0
- package/dist/schemas/response-format.js +18 -0
- package/dist/schemas/response-format.js.map +1 -0
- package/dist/schemas/response-schema.d.ts +307 -0
- package/dist/schemas/response-schema.d.ts.map +1 -0
- package/dist/schemas/response-schema.js +78 -0
- package/dist/schemas/response-schema.js.map +1 -0
- package/dist/schemas/response-schema.test.d.ts +2 -0
- package/dist/schemas/response-schema.test.d.ts.map +1 -0
- package/dist/schemas/response-schema.test.js +256 -0
- package/dist/schemas/response-schema.test.js.map +1 -0
- package/dist/schemas/state.d.ts +17 -0
- package/dist/schemas/state.d.ts.map +1 -0
- package/dist/schemas/state.js +17 -0
- package/dist/schemas/state.js.map +1 -0
- package/dist/schemas/task.d.ts +881 -0
- package/dist/schemas/task.d.ts.map +1 -0
- package/dist/schemas/task.js +177 -0
- package/dist/schemas/task.js.map +1 -0
- package/dist/schemas/view.d.ts +143 -0
- package/dist/schemas/view.d.ts.map +1 -0
- package/dist/schemas/view.js +48 -0
- package/dist/schemas/view.js.map +1 -0
- package/dist/utils/dashboard-renderer.d.ts +93 -0
- package/dist/utils/dashboard-renderer.d.ts.map +1 -0
- package/dist/utils/dashboard-renderer.js +416 -0
- package/dist/utils/dashboard-renderer.js.map +1 -0
- package/dist/utils/dashboard-renderer.test.d.ts +2 -0
- package/dist/utils/dashboard-renderer.test.d.ts.map +1 -0
- package/dist/utils/dashboard-renderer.test.js +772 -0
- package/dist/utils/dashboard-renderer.test.js.map +1 -0
- package/dist/utils/date.d.ts +94 -0
- package/dist/utils/date.d.ts.map +1 -0
- package/dist/utils/date.js +323 -0
- package/dist/utils/date.js.map +1 -0
- package/dist/utils/date.test.d.ts +2 -0
- package/dist/utils/date.test.d.ts.map +1 -0
- package/dist/utils/date.test.js +276 -0
- package/dist/utils/date.test.js.map +1 -0
- package/dist/utils/hierarchy.d.ts +102 -0
- package/dist/utils/hierarchy.d.ts.map +1 -0
- package/dist/utils/hierarchy.js +236 -0
- package/dist/utils/hierarchy.js.map +1 -0
- package/dist/utils/hierarchy.test.d.ts +2 -0
- package/dist/utils/hierarchy.test.d.ts.map +1 -0
- package/dist/utils/hierarchy.test.js +423 -0
- package/dist/utils/hierarchy.test.js.map +1 -0
- package/dist/utils/id.d.ts +60 -0
- package/dist/utils/id.d.ts.map +1 -0
- package/dist/utils/id.js +118 -0
- package/dist/utils/id.js.map +1 -0
- package/dist/utils/id.test.d.ts +2 -0
- package/dist/utils/id.test.d.ts.map +1 -0
- package/dist/utils/id.test.js +193 -0
- package/dist/utils/id.test.js.map +1 -0
- package/dist/utils/index.d.ts +12 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +34 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/natural-language.d.ts +111 -0
- package/dist/utils/natural-language.d.ts.map +1 -0
- package/dist/utils/natural-language.js +297 -0
- package/dist/utils/natural-language.js.map +1 -0
- package/dist/utils/natural-language.test.d.ts +2 -0
- package/dist/utils/natural-language.test.d.ts.map +1 -0
- package/dist/utils/natural-language.test.js +197 -0
- package/dist/utils/natural-language.test.js.map +1 -0
- package/dist/utils/priority-queue.d.ts +17 -0
- package/dist/utils/priority-queue.d.ts.map +1 -0
- package/dist/utils/priority-queue.js +62 -0
- package/dist/utils/priority-queue.js.map +1 -0
- package/dist/utils/priority-queue.test.d.ts +2 -0
- package/dist/utils/priority-queue.test.d.ts.map +1 -0
- package/dist/utils/priority-queue.test.js +82 -0
- package/dist/utils/priority-queue.test.js.map +1 -0
- package/dist/utils/projection.d.ts +65 -0
- package/dist/utils/projection.d.ts.map +1 -0
- package/dist/utils/projection.js +180 -0
- package/dist/utils/projection.js.map +1 -0
- package/dist/utils/projection.test.d.ts +2 -0
- package/dist/utils/projection.test.d.ts.map +1 -0
- package/dist/utils/projection.test.js +341 -0
- package/dist/utils/projection.test.js.map +1 -0
- package/dist/utils/terminal-ui.d.ts +208 -0
- package/dist/utils/terminal-ui.d.ts.map +1 -0
- package/dist/utils/terminal-ui.js +614 -0
- package/dist/utils/terminal-ui.js.map +1 -0
- package/dist/utils/terminal-ui.test.d.ts +2 -0
- package/dist/utils/terminal-ui.test.d.ts.map +1 -0
- package/dist/utils/terminal-ui.test.js +683 -0
- package/dist/utils/terminal-ui.test.js.map +1 -0
- package/dist/utils/workspace.d.ts +102 -0
- package/dist/utils/workspace.d.ts.map +1 -0
- package/dist/utils/workspace.js +183 -0
- package/dist/utils/workspace.js.map +1 -0
- package/dist/utils/workspace.test.d.ts +2 -0
- package/dist/utils/workspace.test.d.ts.map +1 -0
- package/dist/utils/workspace.test.js +97 -0
- package/dist/utils/workspace.test.js.map +1 -0
- package/package.json +5 -1
- package/src/algorithms/critical-path.test.ts +227 -0
- package/src/algorithms/critical-path.ts +14 -34
- package/src/algorithms/dependency-integrity.test.ts +335 -0
- package/src/algorithms/dependency-integrity.ts +4 -13
- package/src/algorithms/tech-analysis.test.ts +405 -0
- package/src/algorithms/tech-analysis.ts +27 -27
- package/src/algorithms/topological-sort.test.ts +182 -0
- package/src/algorithms/topological-sort.ts +6 -10
- package/src/schemas/index.ts +2 -13
- package/src/schemas/response-format.ts +6 -6
- package/src/schemas/response-schema.test.ts +314 -0
- package/src/schemas/response-schema.ts +25 -20
- package/src/schemas/task.ts +4 -22
- package/src/utils/dashboard-renderer.test.ts +976 -0
- package/src/utils/dashboard-renderer.ts +27 -59
- package/src/utils/date.test.ts +329 -0
- package/src/utils/date.ts +2 -10
- package/src/utils/hierarchy.test.ts +488 -0
- package/src/utils/hierarchy.ts +4 -5
- package/src/utils/id.test.ts +235 -0
- package/src/utils/index.ts +7 -1
- package/src/utils/natural-language.test.ts +234 -0
- package/src/utils/priority-queue.test.ts +103 -0
- package/src/utils/projection.test.ts +430 -0
- package/src/utils/terminal-ui.test.ts +831 -0
- package/src/utils/terminal-ui.ts +53 -54
- package/src/utils/workspace.test.ts +125 -0
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
import { describe, test, expect } from "bun:test";
|
|
2
|
+
import { suggestSafeOrder, findBreakingChanges, findHighRiskTasks, groupByTechArea, getComplexitySummary, getTechStackSummary, suggestSubtaskCount, } from "./tech-analysis.js";
|
|
3
|
+
// Helper to create mock tasks with tech stack analysis
|
|
4
|
+
function createTask(id, options = {}) {
|
|
5
|
+
const task = {
|
|
6
|
+
id,
|
|
7
|
+
title: `Task ${id}`,
|
|
8
|
+
status: options.status ?? "pending",
|
|
9
|
+
priority: options.priority ?? "medium",
|
|
10
|
+
workspace: "test-workspace",
|
|
11
|
+
createdAt: new Date().toISOString(),
|
|
12
|
+
updatedAt: new Date().toISOString(),
|
|
13
|
+
};
|
|
14
|
+
if (options.areas || options.riskLevel !== undefined || options.hasBreakingChange !== undefined) {
|
|
15
|
+
task.techStack = {};
|
|
16
|
+
if (options.areas) {
|
|
17
|
+
task.techStack.areas = options.areas;
|
|
18
|
+
}
|
|
19
|
+
if (options.riskLevel !== undefined) {
|
|
20
|
+
task.techStack.riskLevel = options.riskLevel;
|
|
21
|
+
}
|
|
22
|
+
if (options.hasBreakingChange !== undefined) {
|
|
23
|
+
task.techStack.hasBreakingChange = options.hasBreakingChange;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
if (options.complexityScore !== undefined) {
|
|
27
|
+
task.complexity = {
|
|
28
|
+
score: options.complexityScore,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
return task;
|
|
32
|
+
}
|
|
33
|
+
describe("suggestSafeOrder", () => {
|
|
34
|
+
test("returns empty result for empty input", () => {
|
|
35
|
+
const result = suggestSafeOrder([]);
|
|
36
|
+
expect(result.orderedTasks).toEqual([]);
|
|
37
|
+
expect(result.phases).toEqual([]);
|
|
38
|
+
expect(result.summary.totalTasks).toBe(0);
|
|
39
|
+
});
|
|
40
|
+
test("returns empty for all completed tasks", () => {
|
|
41
|
+
const tasks = [createTask("A", { status: "completed" })];
|
|
42
|
+
const result = suggestSafeOrder(tasks);
|
|
43
|
+
expect(result.orderedTasks).toEqual([]);
|
|
44
|
+
});
|
|
45
|
+
test("orders by tech level (schema before backend)", () => {
|
|
46
|
+
const tasks = [
|
|
47
|
+
createTask("backend-task", { areas: ["backend"] }),
|
|
48
|
+
createTask("schema-task", { areas: ["schema"] }),
|
|
49
|
+
];
|
|
50
|
+
const result = suggestSafeOrder(tasks);
|
|
51
|
+
expect(result.orderedTasks[0].id).toBe("schema-task");
|
|
52
|
+
expect(result.orderedTasks[1].id).toBe("backend-task");
|
|
53
|
+
});
|
|
54
|
+
test("orders by tech level (full chain)", () => {
|
|
55
|
+
const tasks = [
|
|
56
|
+
createTask("frontend", { areas: ["frontend"] }),
|
|
57
|
+
createTask("backend", { areas: ["backend"] }),
|
|
58
|
+
createTask("schema", { areas: ["schema"] }),
|
|
59
|
+
createTask("test", { areas: ["test"] }),
|
|
60
|
+
createTask("devops", { areas: ["devops"] }),
|
|
61
|
+
];
|
|
62
|
+
const result = suggestSafeOrder(tasks);
|
|
63
|
+
const order = result.orderedTasks.map((t) => t.id);
|
|
64
|
+
expect(order).toEqual(["schema", "devops", "backend", "frontend", "test"]);
|
|
65
|
+
});
|
|
66
|
+
test("orders by risk level within same tech level", () => {
|
|
67
|
+
const tasks = [
|
|
68
|
+
createTask("high-risk", { areas: ["backend"], riskLevel: "high" }),
|
|
69
|
+
createTask("low-risk", { areas: ["backend"], riskLevel: "low" }),
|
|
70
|
+
createTask("medium-risk", { areas: ["backend"], riskLevel: "medium" }),
|
|
71
|
+
];
|
|
72
|
+
const result = suggestSafeOrder(tasks);
|
|
73
|
+
const order = result.orderedTasks.map((t) => t.id);
|
|
74
|
+
expect(order).toEqual(["low-risk", "medium-risk", "high-risk"]);
|
|
75
|
+
});
|
|
76
|
+
test("puts breaking changes last within same tech/risk level", () => {
|
|
77
|
+
const tasks = [
|
|
78
|
+
createTask("breaking", { areas: ["backend"], riskLevel: "low", hasBreakingChange: true }),
|
|
79
|
+
createTask("safe", { areas: ["backend"], riskLevel: "low", hasBreakingChange: false }),
|
|
80
|
+
];
|
|
81
|
+
const result = suggestSafeOrder(tasks);
|
|
82
|
+
expect(result.orderedTasks[0].id).toBe("safe");
|
|
83
|
+
expect(result.orderedTasks[1].id).toBe("breaking");
|
|
84
|
+
});
|
|
85
|
+
test("uses priority as tiebreaker", () => {
|
|
86
|
+
const tasks = [
|
|
87
|
+
createTask("low-priority", { areas: ["backend"], priority: "low" }),
|
|
88
|
+
createTask("high-priority", { areas: ["backend"], priority: "high" }),
|
|
89
|
+
];
|
|
90
|
+
const result = suggestSafeOrder(tasks);
|
|
91
|
+
expect(result.orderedTasks[0].id).toBe("high-priority");
|
|
92
|
+
expect(result.orderedTasks[1].id).toBe("low-priority");
|
|
93
|
+
});
|
|
94
|
+
test("groups tasks into phases by tech level", () => {
|
|
95
|
+
const tasks = [
|
|
96
|
+
createTask("schema1", { areas: ["schema"] }),
|
|
97
|
+
createTask("schema2", { areas: ["schema"] }),
|
|
98
|
+
createTask("backend1", { areas: ["backend"] }),
|
|
99
|
+
];
|
|
100
|
+
const result = suggestSafeOrder(tasks);
|
|
101
|
+
expect(result.phases.length).toBe(2);
|
|
102
|
+
expect(result.phases[0].primaryArea).toBe("schema");
|
|
103
|
+
expect(result.phases[0].tasks.length).toBe(2);
|
|
104
|
+
expect(result.phases[1].primaryArea).toBe("backend");
|
|
105
|
+
expect(result.phases[1].tasks.length).toBe(1);
|
|
106
|
+
});
|
|
107
|
+
test("calculates summary statistics correctly", () => {
|
|
108
|
+
const tasks = [
|
|
109
|
+
createTask("t1", { areas: ["backend"], hasBreakingChange: true }),
|
|
110
|
+
createTask("t2", { areas: ["backend"], riskLevel: "high" }),
|
|
111
|
+
createTask("t3", { areas: ["backend"], riskLevel: "critical" }),
|
|
112
|
+
createTask("t4", { areas: ["backend"] }),
|
|
113
|
+
];
|
|
114
|
+
const result = suggestSafeOrder(tasks);
|
|
115
|
+
expect(result.summary.totalTasks).toBe(4);
|
|
116
|
+
expect(result.summary.breakingChanges).toBe(1);
|
|
117
|
+
expect(result.summary.highRiskCount).toBe(2);
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
describe("findBreakingChanges", () => {
|
|
121
|
+
test("returns empty for no breaking changes", () => {
|
|
122
|
+
const tasks = [
|
|
123
|
+
createTask("t1", { areas: ["backend"], hasBreakingChange: false }),
|
|
124
|
+
createTask("t2", { areas: ["backend"] }),
|
|
125
|
+
];
|
|
126
|
+
const result = findBreakingChanges(tasks);
|
|
127
|
+
expect(result).toEqual([]);
|
|
128
|
+
});
|
|
129
|
+
test("finds tasks with breaking changes", () => {
|
|
130
|
+
const tasks = [
|
|
131
|
+
createTask("t1", { areas: ["backend"], hasBreakingChange: true }),
|
|
132
|
+
createTask("t2", { areas: ["backend"], hasBreakingChange: false }),
|
|
133
|
+
createTask("t3", { areas: ["schema"], hasBreakingChange: true }),
|
|
134
|
+
];
|
|
135
|
+
const result = findBreakingChanges(tasks);
|
|
136
|
+
expect(result.length).toBe(2);
|
|
137
|
+
expect(result.map((t) => t.id).sort()).toEqual(["t1", "t3"]);
|
|
138
|
+
});
|
|
139
|
+
test("excludes completed tasks", () => {
|
|
140
|
+
const tasks = [
|
|
141
|
+
createTask("t1", { status: "completed", areas: ["backend"], hasBreakingChange: true }),
|
|
142
|
+
createTask("t2", { status: "pending", areas: ["backend"], hasBreakingChange: true }),
|
|
143
|
+
];
|
|
144
|
+
const result = findBreakingChanges(tasks);
|
|
145
|
+
expect(result.length).toBe(1);
|
|
146
|
+
expect(result[0].id).toBe("t2");
|
|
147
|
+
});
|
|
148
|
+
});
|
|
149
|
+
describe("findHighRiskTasks", () => {
|
|
150
|
+
test("returns empty for no high-risk tasks", () => {
|
|
151
|
+
const tasks = [
|
|
152
|
+
createTask("t1", { areas: ["backend"], riskLevel: "low" }),
|
|
153
|
+
createTask("t2", { areas: ["backend"], riskLevel: "medium" }),
|
|
154
|
+
];
|
|
155
|
+
const result = findHighRiskTasks(tasks);
|
|
156
|
+
expect(result).toEqual([]);
|
|
157
|
+
});
|
|
158
|
+
test("finds high and critical risk tasks", () => {
|
|
159
|
+
const tasks = [
|
|
160
|
+
createTask("t1", { areas: ["backend"], riskLevel: "low" }),
|
|
161
|
+
createTask("t2", { areas: ["backend"], riskLevel: "high" }),
|
|
162
|
+
createTask("t3", { areas: ["backend"], riskLevel: "critical" }),
|
|
163
|
+
];
|
|
164
|
+
const result = findHighRiskTasks(tasks);
|
|
165
|
+
expect(result.length).toBe(2);
|
|
166
|
+
expect(result.map((t) => t.id).sort()).toEqual(["t2", "t3"]);
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
describe("groupByTechArea", () => {
|
|
170
|
+
test("returns all areas with empty arrays for empty input", () => {
|
|
171
|
+
const result = groupByTechArea([]);
|
|
172
|
+
expect(result.get("schema")).toEqual([]);
|
|
173
|
+
expect(result.get("backend")).toEqual([]);
|
|
174
|
+
expect(result.get("frontend")).toEqual([]);
|
|
175
|
+
});
|
|
176
|
+
test("groups tasks by their tech areas", () => {
|
|
177
|
+
const tasks = [
|
|
178
|
+
createTask("t1", { areas: ["backend"] }),
|
|
179
|
+
createTask("t2", { areas: ["backend"] }),
|
|
180
|
+
createTask("t3", { areas: ["frontend"] }),
|
|
181
|
+
];
|
|
182
|
+
const result = groupByTechArea(tasks);
|
|
183
|
+
expect(result.get("backend").length).toBe(2);
|
|
184
|
+
expect(result.get("frontend").length).toBe(1);
|
|
185
|
+
expect(result.get("schema").length).toBe(0);
|
|
186
|
+
});
|
|
187
|
+
test("task appears in multiple groups if it spans multiple areas", () => {
|
|
188
|
+
const tasks = [createTask("fullstack", { areas: ["backend", "frontend"] })];
|
|
189
|
+
const result = groupByTechArea(tasks);
|
|
190
|
+
expect(result.get("backend").length).toBe(1);
|
|
191
|
+
expect(result.get("frontend").length).toBe(1);
|
|
192
|
+
expect(result.get("backend")[0].id).toBe("fullstack");
|
|
193
|
+
});
|
|
194
|
+
test("defaults to backend if no area specified", () => {
|
|
195
|
+
const tasks = [createTask("t1", {})];
|
|
196
|
+
const result = groupByTechArea(tasks);
|
|
197
|
+
expect(result.get("backend").length).toBe(1);
|
|
198
|
+
});
|
|
199
|
+
test("excludes completed tasks", () => {
|
|
200
|
+
const tasks = [
|
|
201
|
+
createTask("t1", { status: "completed", areas: ["backend"] }),
|
|
202
|
+
createTask("t2", { status: "pending", areas: ["backend"] }),
|
|
203
|
+
];
|
|
204
|
+
const result = groupByTechArea(tasks);
|
|
205
|
+
expect(result.get("backend").length).toBe(1);
|
|
206
|
+
});
|
|
207
|
+
});
|
|
208
|
+
describe("getComplexitySummary", () => {
|
|
209
|
+
test("returns empty summary for no tasks", () => {
|
|
210
|
+
const result = getComplexitySummary([]);
|
|
211
|
+
expect(result.distribution).toEqual({ low: 0, medium: 0, high: 0 });
|
|
212
|
+
expect(result.needsBreakdown).toEqual([]);
|
|
213
|
+
expect(result.averageScore).toBe(0);
|
|
214
|
+
expect(result.unanalyzed).toEqual([]);
|
|
215
|
+
});
|
|
216
|
+
test("calculates distribution correctly", () => {
|
|
217
|
+
const tasks = [
|
|
218
|
+
createTask("t1", { complexityScore: 2 }), // low
|
|
219
|
+
createTask("t2", { complexityScore: 3 }), // low
|
|
220
|
+
createTask("t3", { complexityScore: 5 }), // medium
|
|
221
|
+
createTask("t4", { complexityScore: 8 }), // high
|
|
222
|
+
];
|
|
223
|
+
const result = getComplexitySummary(tasks);
|
|
224
|
+
expect(result.distribution.low).toBe(2);
|
|
225
|
+
expect(result.distribution.medium).toBe(1);
|
|
226
|
+
expect(result.distribution.high).toBe(1);
|
|
227
|
+
});
|
|
228
|
+
test("identifies tasks needing breakdown (score >= 7)", () => {
|
|
229
|
+
const tasks = [
|
|
230
|
+
createTask("t1", { complexityScore: 6 }),
|
|
231
|
+
createTask("t2", { complexityScore: 7 }),
|
|
232
|
+
createTask("t3", { complexityScore: 9 }),
|
|
233
|
+
];
|
|
234
|
+
const result = getComplexitySummary(tasks);
|
|
235
|
+
expect(result.needsBreakdown.length).toBe(2);
|
|
236
|
+
expect(result.needsBreakdown.map((t) => t.id).sort()).toEqual(["t2", "t3"]);
|
|
237
|
+
});
|
|
238
|
+
test("calculates average score correctly", () => {
|
|
239
|
+
const tasks = [
|
|
240
|
+
createTask("t1", { complexityScore: 2 }),
|
|
241
|
+
createTask("t2", { complexityScore: 6 }),
|
|
242
|
+
createTask("t3", { complexityScore: 10 }),
|
|
243
|
+
];
|
|
244
|
+
const result = getComplexitySummary(tasks);
|
|
245
|
+
expect(result.averageScore).toBe(6); // (2+6+10)/3
|
|
246
|
+
});
|
|
247
|
+
test("identifies unanalyzed tasks", () => {
|
|
248
|
+
const tasks = [createTask("analyzed", { complexityScore: 5 }), createTask("not-analyzed", {})];
|
|
249
|
+
const result = getComplexitySummary(tasks);
|
|
250
|
+
expect(result.unanalyzed.length).toBe(1);
|
|
251
|
+
expect(result.unanalyzed[0].id).toBe("not-analyzed");
|
|
252
|
+
});
|
|
253
|
+
test("excludes completed tasks", () => {
|
|
254
|
+
const tasks = [
|
|
255
|
+
createTask("t1", { status: "completed", complexityScore: 10 }),
|
|
256
|
+
createTask("t2", { status: "pending", complexityScore: 5 }),
|
|
257
|
+
];
|
|
258
|
+
const result = getComplexitySummary(tasks);
|
|
259
|
+
expect(result.distribution.high).toBe(0);
|
|
260
|
+
expect(result.distribution.medium).toBe(1);
|
|
261
|
+
});
|
|
262
|
+
});
|
|
263
|
+
describe("getTechStackSummary", () => {
|
|
264
|
+
test("returns empty summary for no tasks", () => {
|
|
265
|
+
const result = getTechStackSummary([]);
|
|
266
|
+
expect(result.areaCounts.schema).toBe(0);
|
|
267
|
+
expect(result.breakingChanges).toEqual([]);
|
|
268
|
+
expect(result.unanalyzed).toEqual([]);
|
|
269
|
+
});
|
|
270
|
+
test("counts tasks by area correctly", () => {
|
|
271
|
+
const tasks = [
|
|
272
|
+
createTask("t1", { areas: ["backend"] }),
|
|
273
|
+
createTask("t2", { areas: ["backend", "frontend"] }),
|
|
274
|
+
createTask("t3", { areas: ["schema"] }),
|
|
275
|
+
];
|
|
276
|
+
const result = getTechStackSummary(tasks);
|
|
277
|
+
expect(result.areaCounts.backend).toBe(2);
|
|
278
|
+
expect(result.areaCounts.frontend).toBe(1);
|
|
279
|
+
expect(result.areaCounts.schema).toBe(1);
|
|
280
|
+
});
|
|
281
|
+
test("tracks risk distribution", () => {
|
|
282
|
+
const tasks = [
|
|
283
|
+
createTask("t1", { areas: ["backend"], riskLevel: "low" }),
|
|
284
|
+
createTask("t2", { areas: ["backend"], riskLevel: "medium" }),
|
|
285
|
+
createTask("t3", { areas: ["backend"], riskLevel: "high" }),
|
|
286
|
+
];
|
|
287
|
+
const result = getTechStackSummary(tasks);
|
|
288
|
+
expect(result.riskDistribution.low).toBe(1);
|
|
289
|
+
expect(result.riskDistribution.medium).toBe(1);
|
|
290
|
+
expect(result.riskDistribution.high).toBe(1);
|
|
291
|
+
});
|
|
292
|
+
test("identifies breaking changes", () => {
|
|
293
|
+
const tasks = [
|
|
294
|
+
createTask("t1", { areas: ["backend"], hasBreakingChange: true }),
|
|
295
|
+
createTask("t2", { areas: ["backend"], hasBreakingChange: false }),
|
|
296
|
+
];
|
|
297
|
+
const result = getTechStackSummary(tasks);
|
|
298
|
+
expect(result.breakingChanges.length).toBe(1);
|
|
299
|
+
expect(result.breakingChanges[0].id).toBe("t1");
|
|
300
|
+
});
|
|
301
|
+
test("identifies unanalyzed tasks", () => {
|
|
302
|
+
const tasks = [createTask("analyzed", { areas: ["backend"] }), createTask("not-analyzed", {})];
|
|
303
|
+
const result = getTechStackSummary(tasks);
|
|
304
|
+
expect(result.unanalyzed.length).toBe(1);
|
|
305
|
+
expect(result.unanalyzed[0].id).toBe("not-analyzed");
|
|
306
|
+
});
|
|
307
|
+
});
|
|
308
|
+
describe("suggestSubtaskCount", () => {
|
|
309
|
+
test("returns 0 for very low complexity (1-2)", () => {
|
|
310
|
+
expect(suggestSubtaskCount(1)).toBe(0);
|
|
311
|
+
expect(suggestSubtaskCount(2)).toBe(0);
|
|
312
|
+
});
|
|
313
|
+
test("returns 2 for low complexity (3-4)", () => {
|
|
314
|
+
expect(suggestSubtaskCount(3)).toBe(2);
|
|
315
|
+
expect(suggestSubtaskCount(4)).toBe(2);
|
|
316
|
+
});
|
|
317
|
+
test("returns 3-4 for medium complexity (5-6)", () => {
|
|
318
|
+
expect(suggestSubtaskCount(5)).toBe(4);
|
|
319
|
+
expect(suggestSubtaskCount(6)).toBe(4);
|
|
320
|
+
});
|
|
321
|
+
test("returns 5-6 for high complexity (7-8)", () => {
|
|
322
|
+
expect(suggestSubtaskCount(7)).toBe(6);
|
|
323
|
+
expect(suggestSubtaskCount(8)).toBe(6);
|
|
324
|
+
});
|
|
325
|
+
test("returns 7-10 for very high complexity (9-10)", () => {
|
|
326
|
+
expect(suggestSubtaskCount(9)).toBe(9);
|
|
327
|
+
expect(suggestSubtaskCount(10)).toBe(10);
|
|
328
|
+
});
|
|
329
|
+
});
|
|
330
|
+
//# sourceMappingURL=tech-analysis.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tech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AAC;IAEH,IAAI,CAAC,yCAAyC,EAAE,GAAG,EAAE;QACnD,MAAM,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACvC,MAAM,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACzC,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,uCAAuC,EAAE,GAAG,EAAE;QACjD,MAAM,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACvC,MAAM,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACzC,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,8CAA8C,EAAE,GAAG,EAAE;QACxD,MAAM,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACvC,MAAM,CAAC,mBAAmB,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { Task } from "../schemas/task.js";
|
|
2
|
+
/**
|
|
3
|
+
* Node representation for graph algorithms
|
|
4
|
+
*/
|
|
5
|
+
export interface TaskNode {
|
|
6
|
+
id: string;
|
|
7
|
+
dependencies: string[];
|
|
8
|
+
priority: number;
|
|
9
|
+
estimate: number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Convert priority string to numeric value
|
|
13
|
+
*/
|
|
14
|
+
export declare function priorityToNumber(priority: string): number;
|
|
15
|
+
/**
|
|
16
|
+
* Convert Task to TaskNode
|
|
17
|
+
*/
|
|
18
|
+
export declare function taskToNode(task: Task): TaskNode;
|
|
19
|
+
/**
|
|
20
|
+
* Topological sort using Kahn's algorithm with priority tie-breaking
|
|
21
|
+
*
|
|
22
|
+
* Returns tasks in optimal execution order:
|
|
23
|
+
* 1. Respects dependencies (blocked_by relationships)
|
|
24
|
+
* 2. Higher priority tasks come first when dependencies allow
|
|
25
|
+
*
|
|
26
|
+
* @throws Error if circular dependency detected
|
|
27
|
+
*/
|
|
28
|
+
export declare function topologicalSort(tasks: Task[]): Task[];
|
|
29
|
+
/**
|
|
30
|
+
* Detect if adding a dependency would create a cycle
|
|
31
|
+
*/
|
|
32
|
+
export declare function wouldCreateCycle(tasks: Task[], fromId: string, toId: string): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Build inverted indices for efficient dependency lookups
|
|
35
|
+
* Returns:
|
|
36
|
+
* - dependentsIndex: taskId -> [tasks that depend on this task]
|
|
37
|
+
* - dependenciesIndex: taskId -> [tasks this task depends on]
|
|
38
|
+
*
|
|
39
|
+
* Time complexity: O(n + e) where n = tasks, e = edges
|
|
40
|
+
*/
|
|
41
|
+
export declare function buildDependencyIndices(tasks: Task[]): {
|
|
42
|
+
taskMap: Map<string, Task>;
|
|
43
|
+
dependentsIndex: Map<string, string[]>;
|
|
44
|
+
dependenciesIndex: Map<string, string[]>;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Find all tasks that depend on a given task (directly or transitively)
|
|
48
|
+
*
|
|
49
|
+
* Time complexity: O(n + e) with inverted index
|
|
50
|
+
*/
|
|
51
|
+
export declare function findDependents(tasks: Task[], taskId: string): Task[];
|
|
52
|
+
/**
|
|
53
|
+
* Find all tasks that a given task depends on (directly or transitively)
|
|
54
|
+
*
|
|
55
|
+
* Time complexity: O(n + e) with pre-built index
|
|
56
|
+
*/
|
|
57
|
+
export declare function findDependencies(tasks: Task[], taskId: string): Task[];
|
|
58
|
+
//# sourceMappingURL=topological-sort.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"topological-sort.d.ts","sourceRoot":"","sources":["../../src/algorithms/topological-sort.ts"],"names":[],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
* Convert priority string to numeric value
|
|
4
|
+
*/
|
|
5
|
+
export function priorityToNumber(priority) {
|
|
6
|
+
const map = {
|
|
7
|
+
critical: 4,
|
|
8
|
+
high: 3,
|
|
9
|
+
medium: 2,
|
|
10
|
+
low: 1,
|
|
11
|
+
};
|
|
12
|
+
return map[priority] ?? 2;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Convert Task to TaskNode
|
|
16
|
+
*/
|
|
17
|
+
export function taskToNode(task) {
|
|
18
|
+
return {
|
|
19
|
+
id: task.id,
|
|
20
|
+
dependencies: (task.dependencies ?? [])
|
|
21
|
+
.filter((d) => d.type === "blocked_by")
|
|
22
|
+
.map((d) => d.taskId),
|
|
23
|
+
priority: priorityToNumber(task.priority),
|
|
24
|
+
estimate: task.estimate?.expected ?? 0,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Topological sort using Kahn's algorithm with priority tie-breaking
|
|
29
|
+
*
|
|
30
|
+
* Returns tasks in optimal execution order:
|
|
31
|
+
* 1. Respects dependencies (blocked_by relationships)
|
|
32
|
+
* 2. Higher priority tasks come first when dependencies allow
|
|
33
|
+
*
|
|
34
|
+
* @throws Error if circular dependency detected
|
|
35
|
+
*/
|
|
36
|
+
export function topologicalSort(tasks) {
|
|
37
|
+
const nodes = tasks.map(taskToNode);
|
|
38
|
+
const nodeMap = new Map(nodes.map((n) => [n.id, n]));
|
|
39
|
+
const taskMap = new Map(tasks.map((t) => [t.id, t]));
|
|
40
|
+
// Calculate in-degree for each node
|
|
41
|
+
const inDegree = new Map();
|
|
42
|
+
const adjacency = new Map();
|
|
43
|
+
for (const node of nodes) {
|
|
44
|
+
inDegree.set(node.id, 0);
|
|
45
|
+
adjacency.set(node.id, []);
|
|
46
|
+
}
|
|
47
|
+
// Build graph: if A is blocked_by B, then B -> A (B must come before A)
|
|
48
|
+
for (const node of nodes) {
|
|
49
|
+
for (const depId of node.dependencies) {
|
|
50
|
+
if (nodeMap.has(depId)) {
|
|
51
|
+
const adj = adjacency.get(depId);
|
|
52
|
+
if (adj)
|
|
53
|
+
adj.push(node.id);
|
|
54
|
+
inDegree.set(node.id, (inDegree.get(node.id) ?? 0) + 1);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
// Initialize priority queue with nodes that have no dependencies
|
|
59
|
+
// Using max-heap: higher priority comes out first
|
|
60
|
+
const queue = new PriorityQueue((a, b) => a.priority - b.priority);
|
|
61
|
+
for (const node of nodes) {
|
|
62
|
+
if (inDegree.get(node.id) === 0) {
|
|
63
|
+
queue.push(node);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
const result = [];
|
|
67
|
+
while (queue.length > 0) {
|
|
68
|
+
const current = queue.pop();
|
|
69
|
+
const task = taskMap.get(current.id);
|
|
70
|
+
if (task) {
|
|
71
|
+
result.push(task);
|
|
72
|
+
}
|
|
73
|
+
// Update neighbors
|
|
74
|
+
for (const neighborId of adjacency.get(current.id)) {
|
|
75
|
+
const newDegree = inDegree.get(neighborId) - 1;
|
|
76
|
+
inDegree.set(neighborId, newDegree);
|
|
77
|
+
if (newDegree === 0) {
|
|
78
|
+
const neighborNode = nodeMap.get(neighborId);
|
|
79
|
+
queue.push(neighborNode); // O(log n) insertion maintains heap property
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
// Check for cycles
|
|
84
|
+
if (result.length !== tasks.length) {
|
|
85
|
+
const remaining = tasks.filter((t) => !result.some((r) => r.id === t.id));
|
|
86
|
+
const cycleIds = remaining.map((t) => t.id).join(", ");
|
|
87
|
+
throw new Error(`Circular dependency detected among tasks: ${cycleIds}`);
|
|
88
|
+
}
|
|
89
|
+
return result;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Detect if adding a dependency would create a cycle
|
|
93
|
+
*/
|
|
94
|
+
export function wouldCreateCycle(tasks, fromId, toId) {
|
|
95
|
+
// Create a temporary task list with the new dependency
|
|
96
|
+
const tempTasks = tasks.map((t) => {
|
|
97
|
+
if (t.id === fromId) {
|
|
98
|
+
return {
|
|
99
|
+
...t,
|
|
100
|
+
dependencies: [...(t.dependencies ?? []), { taskId: toId, type: "blocked_by" }],
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
return t;
|
|
104
|
+
});
|
|
105
|
+
try {
|
|
106
|
+
topologicalSort(tempTasks);
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
catch {
|
|
110
|
+
return true;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Build inverted indices for efficient dependency lookups
|
|
115
|
+
* Returns:
|
|
116
|
+
* - dependentsIndex: taskId -> [tasks that depend on this task]
|
|
117
|
+
* - dependenciesIndex: taskId -> [tasks this task depends on]
|
|
118
|
+
*
|
|
119
|
+
* Time complexity: O(n + e) where n = tasks, e = edges
|
|
120
|
+
*/
|
|
121
|
+
export function buildDependencyIndices(tasks) {
|
|
122
|
+
const taskMap = new Map();
|
|
123
|
+
const dependentsIndex = new Map();
|
|
124
|
+
const dependenciesIndex = new Map();
|
|
125
|
+
// Initialize maps - O(n)
|
|
126
|
+
for (const task of tasks) {
|
|
127
|
+
taskMap.set(task.id, task);
|
|
128
|
+
dependentsIndex.set(task.id, []);
|
|
129
|
+
dependenciesIndex.set(task.id, []);
|
|
130
|
+
}
|
|
131
|
+
// Build indices - O(e)
|
|
132
|
+
for (const task of tasks) {
|
|
133
|
+
const deps = (task.dependencies ?? [])
|
|
134
|
+
.filter((d) => d.type === "blocked_by")
|
|
135
|
+
.map((d) => d.taskId);
|
|
136
|
+
// Store direct dependencies for this task
|
|
137
|
+
dependenciesIndex.set(task.id, deps.filter((depId) => taskMap.has(depId)));
|
|
138
|
+
// Update dependents index (reverse lookup)
|
|
139
|
+
for (const depId of deps) {
|
|
140
|
+
if (taskMap.has(depId)) {
|
|
141
|
+
dependentsIndex.get(depId).push(task.id);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return { taskMap, dependentsIndex, dependenciesIndex };
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Find all tasks that depend on a given task (directly or transitively)
|
|
149
|
+
*
|
|
150
|
+
* Time complexity: O(n + e) with inverted index
|
|
151
|
+
*/
|
|
152
|
+
export function findDependents(tasks, taskId) {
|
|
153
|
+
const { taskMap, dependentsIndex } = buildDependencyIndices(tasks);
|
|
154
|
+
const visited = new Set();
|
|
155
|
+
const result = [];
|
|
156
|
+
function dfs(id) {
|
|
157
|
+
const dependentIds = dependentsIndex.get(id);
|
|
158
|
+
if (!dependentIds)
|
|
159
|
+
return;
|
|
160
|
+
for (const depId of dependentIds) {
|
|
161
|
+
if (!visited.has(depId)) {
|
|
162
|
+
visited.add(depId);
|
|
163
|
+
const task = taskMap.get(depId);
|
|
164
|
+
if (task) {
|
|
165
|
+
result.push(task);
|
|
166
|
+
dfs(depId);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
dfs(taskId);
|
|
172
|
+
return result;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Find all tasks that a given task depends on (directly or transitively)
|
|
176
|
+
*
|
|
177
|
+
* Time complexity: O(n + e) with pre-built index
|
|
178
|
+
*/
|
|
179
|
+
export function findDependencies(tasks, taskId) {
|
|
180
|
+
const { taskMap, dependenciesIndex } = buildDependencyIndices(tasks);
|
|
181
|
+
const visited = new Set();
|
|
182
|
+
const result = [];
|
|
183
|
+
function dfs(id) {
|
|
184
|
+
const depIds = dependenciesIndex.get(id);
|
|
185
|
+
if (!depIds)
|
|
186
|
+
return;
|
|
187
|
+
for (const depId of depIds) {
|
|
188
|
+
if (!visited.has(depId)) {
|
|
189
|
+
visited.add(depId);
|
|
190
|
+
const depTask = taskMap.get(depId);
|
|
191
|
+
if (depTask) {
|
|
192
|
+
result.push(depTask);
|
|
193
|
+
dfs(depId);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
dfs(taskId);
|
|
199
|
+
return result;
|
|
200
|
+
}
|
|
201
|
+
//# sourceMappingURL=topological-sort.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"topological-sort.js","sourceRoot":"","sources":["../../src/algorithms/topological-sort.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAY3D;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,QAAgB;IAC/C,MAAM,GAAG,GAA2B;QAClC,QAAQ,EAAE,CAAC;QACX,IAAI,EAAE,CAAC;QACP,MAAM,EAAE,CAAC;QACT,GAAG,EAAE,CAAC;KACP,CAAC;IACF,OAAO,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AAC5B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,IAAU;IACnC,OAAO;QACL,EAAE,EAAE,IAAI,CAAC,EAAE;QACX,YAAY,EAAE,CAAC,IAAI,CAAC,YAAY,IAAI,EAAE,CAAC;aACpC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,YAAY,CAAC;aACtC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC;QACvB,QAAQ,EAAE,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC;QACzC,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,QAAQ,IAAI,CAAC;KACvC,CAAC;AACJ,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,eAAe,CAAC,KAAa;IAC3C,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IACpC,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,C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AC,CAAC;gBACb,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,GAAG,CAAC,MAAM,CAAC,CAAC;IACZ,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"topological-sort.test.d.ts","sourceRoot":"","sources":["../../src/algorithms/topological-sort.test.ts"],"names":[],"mappings":""}
|