@aiready/context-analyzer 0.22.14 → 0.22.16

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 (51) hide show
  1. package/.turbo/turbo-build.log +19 -19
  2. package/.turbo/turbo-format-check.log +1 -1
  3. package/.turbo/turbo-lint.log +1 -1
  4. package/.turbo/turbo-test.log +347 -25
  5. package/.turbo/turbo-type-check.log +1 -1
  6. package/dist/chunk-2LEHY2GV.mjs +1287 -0
  7. package/dist/chunk-P2ZQGQAO.mjs +1282 -0
  8. package/dist/chunk-QGI23DBA.mjs +1282 -0
  9. package/dist/chunk-QTB4KYCX.mjs +1260 -0
  10. package/dist/chunk-RQ5BQLT6.mjs +102 -0
  11. package/dist/chunk-VYFHSGV6.mjs +1283 -0
  12. package/dist/chunk-WLXLBWDU.mjs +96 -0
  13. package/dist/chunk-XDYPMFCH.mjs +1250 -0
  14. package/dist/cli-action-332WE54N.mjs +95 -0
  15. package/dist/cli-action-7QXG7LHS.mjs +95 -0
  16. package/dist/cli-action-BIX6TYXF.mjs +95 -0
  17. package/dist/cli-action-BUGVCH44.mjs +95 -0
  18. package/dist/cli-action-JKG3R6RV.mjs +93 -0
  19. package/dist/cli-action-RO24U52W.mjs +95 -0
  20. package/dist/cli-action-WAZ5KM6X.mjs +95 -0
  21. package/dist/cli-action-XDKINE2R.mjs +95 -0
  22. package/dist/cli-action-Y6VATXMV.mjs +95 -0
  23. package/dist/cli.js +79 -31
  24. package/dist/cli.mjs +1 -1
  25. package/dist/console-report-CVGRMWEU.mjs +74 -0
  26. package/dist/html-report-BYGKWC3K.mjs +73 -0
  27. package/dist/index.d.mts +4 -2
  28. package/dist/index.d.ts +4 -2
  29. package/dist/index.js +71 -25
  30. package/dist/index.mjs +3 -3
  31. package/dist/orchestrator-2KQNMO2L.mjs +10 -0
  32. package/dist/orchestrator-66ZVNOLR.mjs +10 -0
  33. package/dist/orchestrator-KM2OJPZD.mjs +10 -0
  34. package/dist/orchestrator-MKDZPRBA.mjs +10 -0
  35. package/dist/orchestrator-QSHWWBWS.mjs +10 -0
  36. package/dist/orchestrator-WFQPMNSD.mjs +10 -0
  37. package/dist/python-context-H2OLC5JN.mjs +162 -0
  38. package/dist/python-context-OBP7JD5P.mjs +162 -0
  39. package/package.json +8 -6
  40. package/src/__tests__/analyzer.test.ts +4 -3
  41. package/src/__tests__/issue-analyzer.test.ts +4 -2
  42. package/src/classify/file-classifiers.ts +14 -13
  43. package/src/cli-action.ts +6 -3
  44. package/src/graph-builder.ts +43 -8
  45. package/src/issue-analyzer.ts +19 -7
  46. package/src/orchestrator.ts +6 -4
  47. package/src/report/console-report.ts +2 -2
  48. package/src/report/html-report.ts +2 -2
  49. package/src/semantic/domain-inference.ts +1 -1
  50. package/src/types.ts +2 -0
  51. package/src/utils/dependency-graph-utils.ts +22 -13
@@ -0,0 +1,96 @@
1
+ // src/utils/dependency-graph-utils.ts
2
+ function calculateImportDepthFromEdges(file, edges, visited = /* @__PURE__ */ new Set(), depth = 0) {
3
+ if (visited.has(file)) return depth;
4
+ const dependencies = edges.get(file);
5
+ if (!dependencies || dependencies.size === 0) return depth;
6
+ const nextVisited = new Set(visited);
7
+ nextVisited.add(file);
8
+ let maxDepth = depth;
9
+ for (const dep of dependencies) {
10
+ maxDepth = Math.max(
11
+ maxDepth,
12
+ calculateImportDepthFromEdges(dep, edges, nextVisited, depth + 1)
13
+ );
14
+ }
15
+ return maxDepth;
16
+ }
17
+ function getTransitiveDependenciesFromEdges(file, edges, visited = /* @__PURE__ */ new Set()) {
18
+ const result = /* @__PURE__ */ new Set();
19
+ function dfs(current) {
20
+ if (visited.has(current)) return;
21
+ visited.add(current);
22
+ const dependencies = edges.get(current);
23
+ if (!dependencies) return;
24
+ for (const dep of dependencies) {
25
+ if (dep !== file) {
26
+ result.add(dep);
27
+ dfs(dep);
28
+ }
29
+ }
30
+ }
31
+ dfs(file);
32
+ return Array.from(result);
33
+ }
34
+ function detectGraphCycles(edges) {
35
+ const cycles = [];
36
+ const visited = /* @__PURE__ */ new Set();
37
+ const recursionStack = /* @__PURE__ */ new Set();
38
+ function dfs(file, path) {
39
+ if (recursionStack.has(file)) {
40
+ const cycleStart = path.indexOf(file);
41
+ if (cycleStart !== -1) {
42
+ cycles.push([...path.slice(cycleStart), file]);
43
+ }
44
+ return;
45
+ }
46
+ if (visited.has(file)) return;
47
+ visited.add(file);
48
+ recursionStack.add(file);
49
+ const dependencies = edges.get(file);
50
+ if (dependencies) {
51
+ for (const dep of dependencies) {
52
+ dfs(dep, [...path, file]);
53
+ }
54
+ }
55
+ recursionStack.delete(file);
56
+ }
57
+ for (const file of edges.keys()) {
58
+ if (!visited.has(file)) {
59
+ dfs(file, []);
60
+ }
61
+ }
62
+ return cycles;
63
+ }
64
+ function detectGraphCyclesFromFile(file, edges) {
65
+ const cycles = [];
66
+ const visited = /* @__PURE__ */ new Set();
67
+ const recursionStack = /* @__PURE__ */ new Set();
68
+ function dfs(current, path) {
69
+ if (recursionStack.has(current)) {
70
+ const cycleStart = path.indexOf(current);
71
+ if (cycleStart !== -1) {
72
+ cycles.push([...path.slice(cycleStart), current]);
73
+ }
74
+ return;
75
+ }
76
+ if (visited.has(current)) return;
77
+ visited.add(current);
78
+ recursionStack.add(current);
79
+ const dependencies = edges.get(current);
80
+ if (dependencies) {
81
+ for (const dep of dependencies) {
82
+ dfs(dep, [...path, current]);
83
+ }
84
+ }
85
+ recursionStack.delete(current);
86
+ }
87
+ dfs(file, []);
88
+ return cycles;
89
+ }
90
+
91
+ export {
92
+ calculateImportDepthFromEdges,
93
+ getTransitiveDependenciesFromEdges,
94
+ detectGraphCycles,
95
+ detectGraphCyclesFromFile
96
+ };