@aiready/deps 0.14.25 → 0.14.26
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/.turbo/turbo-build.log +15 -15
- package/.turbo/turbo-format-check.log +1 -1
- package/.turbo/turbo-format.log +10 -9
- package/.turbo/turbo-lint$colon$fix.log +1 -1
- package/.turbo/turbo-lint.log +1 -1
- package/.turbo/turbo-test.log +34 -61
- package/.turbo/turbo-type-check.log +1 -1
- package/dist/chunk-OYUZF7F5.mjs +202 -0
- package/dist/cli.js +30 -17
- package/dist/cli.mjs +3 -3
- package/dist/index.js +29 -16
- package/dist/index.mjs +1 -1
- package/package.json +2 -2
- package/src/analyzer.ts +38 -21
- package/src/cli.ts +2 -2
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> @aiready/deps@0.14.
|
|
3
|
+
> @aiready/deps@0.14.25 build /Users/pengcao/projects/aiready/packages/deps
|
|
4
4
|
> tsup src/index.ts src/cli.ts --format cjs,esm --dts
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
6
|
+
[34mCLI[39m Building entry: src/cli.ts, src/index.ts
|
|
7
|
+
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
8
|
+
[34mCLI[39m tsup v8.5.1
|
|
9
|
+
[34mCLI[39m Target: es2020
|
|
10
|
+
[34mCJS[39m Build start
|
|
11
|
+
[34mESM[39m Build start
|
|
12
|
+
[32mCJS[39m [1mdist/index.js [22m[32m8.91 KB[39m
|
|
13
|
+
[32mCJS[39m [1mdist/cli.js [22m[32m8.50 KB[39m
|
|
14
|
+
[32mCJS[39m ⚡️ Build success in 118ms
|
|
15
|
+
[32mESM[39m [1mdist/chunk-OYUZF7F5.mjs [22m[32m6.37 KB[39m
|
|
16
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m1.84 KB[39m
|
|
17
|
+
[32mESM[39m [1mdist/cli.mjs [22m[32m896.00 B[39m
|
|
18
|
+
[32mESM[39m ⚡️ Build success in 120ms
|
|
19
19
|
DTS Build start
|
|
20
|
-
DTS ⚡️ Build success in
|
|
20
|
+
DTS ⚡️ Build success in 1884ms
|
|
21
21
|
DTS dist/cli.d.ts 108.00 B
|
|
22
22
|
DTS dist/index.d.ts 1.18 KB
|
|
23
23
|
DTS dist/cli.d.mts 108.00 B
|
package/.turbo/turbo-format.log
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> @aiready/deps@0.14.
|
|
3
|
+
> @aiready/deps@0.14.25 format /Users/pengcao/projects/aiready/packages/deps
|
|
4
4
|
> prettier --write . --ignore-path ../../.prettierignore
|
|
5
5
|
|
|
6
6
|
package.json[2K[1G[90mpackage.json[39m 9ms (unchanged)
|
|
7
|
-
README.md[2K[1G[90mREADME.md[39m
|
|
8
|
-
src/__tests__/analyzer.test.ts[2K[1G[90msrc/__tests__/analyzer.test.ts[39m
|
|
7
|
+
README.md[2K[1G[90mREADME.md[39m 21ms (unchanged)
|
|
8
|
+
src/__tests__/analyzer.test.ts[2K[1G[90msrc/__tests__/analyzer.test.ts[39m 61ms (unchanged)
|
|
9
|
+
src/__tests__/contract.test.ts[2K[1G[90msrc/__tests__/contract.test.ts[39m 8ms (unchanged)
|
|
9
10
|
src/__tests__/provider.test.ts[2K[1G[90msrc/__tests__/provider.test.ts[39m 2ms (unchanged)
|
|
10
|
-
src/__tests__/scoring.test.ts[2K[1G[90msrc/__tests__/scoring.test.ts[39m
|
|
11
|
-
src/analyzer.ts[2K[1G[90msrc/analyzer.ts[39m
|
|
12
|
-
src/cli.ts[2K[1G[90msrc/cli.ts[39m
|
|
13
|
-
src/index.ts[2K[1G[90msrc/index.ts[39m
|
|
14
|
-
src/provider.ts[2K[1G[90msrc/provider.ts[39m
|
|
11
|
+
src/__tests__/scoring.test.ts[2K[1G[90msrc/__tests__/scoring.test.ts[39m 3ms (unchanged)
|
|
12
|
+
src/analyzer.ts[2K[1G[90msrc/analyzer.ts[39m 39ms (unchanged)
|
|
13
|
+
src/cli.ts[2K[1G[90msrc/cli.ts[39m 5ms (unchanged)
|
|
14
|
+
src/index.ts[2K[1G[90msrc/index.ts[39m 12ms (unchanged)
|
|
15
|
+
src/provider.ts[2K[1G[90msrc/provider.ts[39m 3ms (unchanged)
|
|
15
16
|
src/scoring.ts[2K[1G[90msrc/scoring.ts[39m 2ms (unchanged)
|
|
16
17
|
src/types.ts[2K[1G[90msrc/types.ts[39m 2ms (unchanged)
|
|
17
|
-
tsconfig.json[2K[1G[90mtsconfig.json[39m
|
|
18
|
+
tsconfig.json[2K[1G[90mtsconfig.json[39m 1ms (unchanged)
|
package/.turbo/turbo-lint.log
CHANGED
package/.turbo/turbo-test.log
CHANGED
|
@@ -1,73 +1,46 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> @aiready/deps@0.14.
|
|
3
|
+
> @aiready/deps@0.14.25 test /Users/pengcao/projects/aiready/packages/deps
|
|
4
4
|
> vitest run
|
|
5
5
|
|
|
6
6
|
[?25l
|
|
7
|
-
RUN
|
|
7
|
+
[1m[30m[46m RUN [49m[39m[22m [36mv4.1.4 [39m[90m/Users/pengcao/projects/aiready/packages/deps[39m
|
|
8
8
|
|
|
9
9
|
[?2026h
|
|
10
|
-
❯
|
|
10
|
+
[1m[33m ❯ [39m[22msrc/__tests__/provider.test.ts[2m [queued][22m
|
|
11
11
|
|
|
12
|
-
Test Files
|
|
13
|
-
Tests
|
|
14
|
-
Start at
|
|
15
|
-
Duration
|
|
12
|
+
[2m Test Files [22m[1m[32m0 passed[39m[22m[90m (4)[39m
|
|
13
|
+
[2m Tests [22m[1m[32m0 passed[39m[22m[90m (0)[39m
|
|
14
|
+
[2m Start at [22m18:54:46
|
|
15
|
+
[2m Duration [22m447ms
|
|
16
16
|
[?2026l[?2026h[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K
|
|
17
|
-
❯
|
|
18
|
-
❯
|
|
19
|
-
❯
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
[
|
|
26
|
-
❯ src/__tests__/analyzer.test.ts [queued]
|
|
27
|
-
❯ src/__tests__/contract.test.ts [queued]
|
|
28
|
-
❯ src/__tests__/provider.test.ts [queued]
|
|
29
|
-
❯ src/__tests__/scoring.test.ts [queued]
|
|
30
|
-
|
|
31
|
-
Test Files 0 passed (4)
|
|
32
|
-
Tests 0 passed (0)
|
|
33
|
-
Start at 09:20:45
|
|
34
|
-
Duration 1.03s
|
|
35
|
-
[?2026l[?2026h[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K
|
|
36
|
-
❯ src/__tests__/analyzer.test.ts [queued]
|
|
37
|
-
❯ src/__tests__/contract.test.ts [queued]
|
|
38
|
-
❯ src/__tests__/provider.test.ts [queued]
|
|
39
|
-
❯ src/__tests__/scoring.test.ts [queued]
|
|
40
|
-
|
|
41
|
-
Test Files 0 passed (4)
|
|
42
|
-
Tests 0 passed (0)
|
|
43
|
-
Start at 09:20:45
|
|
44
|
-
Duration 1.96s
|
|
17
|
+
[1m[33m ❯ [39m[22msrc/__tests__/analyzer.test.ts[2m [queued][22m
|
|
18
|
+
[1m[33m ❯ [39m[22msrc/__tests__/contract.test.ts[2m [queued][22m
|
|
19
|
+
[1m[33m ❯ [39m[22msrc/__tests__/provider.test.ts[2m [queued][22m
|
|
20
|
+
[1m[33m ❯ [39m[22msrc/__tests__/scoring.test.ts[2m [queued][22m
|
|
21
|
+
|
|
22
|
+
[2m Test Files [22m[1m[32m0 passed[39m[22m[90m (4)[39m
|
|
23
|
+
[2m Tests [22m[1m[32m0 passed[39m[22m[90m (0)[39m
|
|
24
|
+
[2m Start at [22m18:54:46
|
|
25
|
+
[2m Duration [22m940ms
|
|
45
26
|
[?2026l[?2026h[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K
|
|
46
|
-
❯
|
|
47
|
-
❯
|
|
48
|
-
❯
|
|
49
|
-
❯
|
|
50
|
-
|
|
51
|
-
Test Files
|
|
52
|
-
Tests
|
|
53
|
-
Start at
|
|
54
|
-
Duration
|
|
55
|
-
[?2026l[
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
Duration 2.73s
|
|
65
|
-
[?2026l[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K ✓ src/__tests__/contract.test.ts (1 test) 4ms
|
|
66
|
-
✓ src/__tests__/provider.test.ts (2 tests) 4ms
|
|
67
|
-
|
|
68
|
-
Test Files 4 passed (4)
|
|
69
|
-
Tests 9 passed (9)
|
|
70
|
-
Start at 09:20:45
|
|
71
|
-
Duration 2.84s (transform 2.29s, setup 0ms, import 7.36s, tests 99ms, environment 13ms)
|
|
27
|
+
[1m[33m ❯ [39m[22msrc/__tests__/analyzer.test.ts[2m [queued][22m
|
|
28
|
+
[1m[33m ❯ [39m[22msrc/__tests__/contract.test.ts[2m [queued][22m
|
|
29
|
+
[1m[33m ❯ [39m[22msrc/__tests__/provider.test.ts[2m [queued][22m
|
|
30
|
+
[1m[33m ❯ [39m[22msrc/__tests__/scoring.test.ts[2m 0/2[22m
|
|
31
|
+
|
|
32
|
+
[2m Test Files [22m[1m[32m0 passed[39m[22m[90m (4)[39m
|
|
33
|
+
[2m Tests [22m[1m[32m0 passed[39m[22m[90m (2)[39m
|
|
34
|
+
[2m Start at [22m18:54:46
|
|
35
|
+
[2m Duration [22m1.55s
|
|
36
|
+
[?2026l[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K [32m✓[39m src/__tests__/provider.test.ts [2m([22m[2m2 tests[22m[2m)[22m[32m 3[2mms[22m[39m
|
|
37
|
+
[32m✓[39m src/__tests__/analyzer.test.ts [2m([22m[2m4 tests[22m[2m)[22m[32m 7[2mms[22m[39m
|
|
38
|
+
[32m✓[39m src/__tests__/scoring.test.ts [2m([22m[2m2 tests[22m[2m)[22m[32m 2[2mms[22m[39m
|
|
39
|
+
[32m✓[39m src/__tests__/contract.test.ts [2m([22m[2m1 test[22m[2m)[22m[32m 9[2mms[22m[39m
|
|
40
|
+
|
|
41
|
+
[2m Test Files [22m [1m[32m4 passed[39m[22m[90m (4)[39m
|
|
42
|
+
[2m Tests [22m [1m[32m9 passed[39m[22m[90m (9)[39m
|
|
43
|
+
[2m Start at [22m 18:54:46
|
|
44
|
+
[2m Duration [22m 1.65s[2m (transform 1.16s, setup 0ms, import 4.10s, tests 21ms, environment 0ms)[22m
|
|
72
45
|
|
|
73
46
|
[?25h
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
2
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
3
|
+
}) : x)(function(x) {
|
|
4
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
5
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
// src/analyzer.ts
|
|
9
|
+
import { calculateDependencyHealth, Severity, IssueType } from "@aiready/core";
|
|
10
|
+
import { readFileSync, readdirSync, statSync } from "fs";
|
|
11
|
+
import { join } from "path";
|
|
12
|
+
var PACKAGEMANAGER_NPM = "npm";
|
|
13
|
+
var PACKAGEMANAGER_PYTHON = "python";
|
|
14
|
+
var PACKAGEMANAGER_MAVEN = "maven";
|
|
15
|
+
var PACKAGEMANAGER_GO = "go";
|
|
16
|
+
var PACKAGEMANAGER_DOTNET = "dotnet";
|
|
17
|
+
var EXCLUDE_DIRS = ["node_modules", ".git", "venv", ".aiready"];
|
|
18
|
+
var MANIFEST_FILES = {
|
|
19
|
+
NPM: "package.json",
|
|
20
|
+
PYTHON: ["requirements.txt", "Pipfile", "pyproject.toml"],
|
|
21
|
+
MAVEN: "pom.xml",
|
|
22
|
+
GO: "go.mod",
|
|
23
|
+
DOTNET_SUFFIX: ".csproj"
|
|
24
|
+
};
|
|
25
|
+
async function analyzeDeps(options) {
|
|
26
|
+
const rootDir = options.rootDir;
|
|
27
|
+
const issues = [];
|
|
28
|
+
let totalPackages = 0;
|
|
29
|
+
let outdatedPackages = 0;
|
|
30
|
+
let deprecatedPackages = 0;
|
|
31
|
+
let trainingCutoffSkew = 0;
|
|
32
|
+
let filesAnalyzed = 0;
|
|
33
|
+
const manifests = findManifests(rootDir, options.exclude || []);
|
|
34
|
+
for (const manifest of manifests) {
|
|
35
|
+
filesAnalyzed++;
|
|
36
|
+
const content = readFileSync(manifest.path, "utf-8");
|
|
37
|
+
const type = manifest.type;
|
|
38
|
+
let deps = [];
|
|
39
|
+
if (type === PACKAGEMANAGER_NPM) {
|
|
40
|
+
deps = analyzeNpm(manifest.path, content);
|
|
41
|
+
} else if (type === PACKAGEMANAGER_PYTHON) {
|
|
42
|
+
deps = analyzePython(manifest.path, content);
|
|
43
|
+
} else if (type === PACKAGEMANAGER_MAVEN) {
|
|
44
|
+
deps = analyzeMaven(manifest.path, content);
|
|
45
|
+
} else if (type === PACKAGEMANAGER_GO) {
|
|
46
|
+
deps = analyzeGo(manifest.path, content);
|
|
47
|
+
} else if (type === PACKAGEMANAGER_DOTNET) {
|
|
48
|
+
deps = analyzeDotnet(manifest.path, content);
|
|
49
|
+
}
|
|
50
|
+
totalPackages += deps.length;
|
|
51
|
+
const { outdated, deprecated, skew } = evaluateHealth(
|
|
52
|
+
type,
|
|
53
|
+
deps,
|
|
54
|
+
manifest.path,
|
|
55
|
+
issues
|
|
56
|
+
);
|
|
57
|
+
outdatedPackages += outdated;
|
|
58
|
+
deprecatedPackages += deprecated;
|
|
59
|
+
trainingCutoffSkew += skew;
|
|
60
|
+
}
|
|
61
|
+
const riskResult = calculateDependencyHealth({
|
|
62
|
+
totalPackages,
|
|
63
|
+
outdatedPackages,
|
|
64
|
+
deprecatedPackages,
|
|
65
|
+
trainingCutoffSkew: totalPackages > 0 ? trainingCutoffSkew / manifests.length : 0
|
|
66
|
+
});
|
|
67
|
+
return {
|
|
68
|
+
summary: {
|
|
69
|
+
filesAnalyzed,
|
|
70
|
+
packagesAnalyzed: totalPackages,
|
|
71
|
+
score: riskResult.score,
|
|
72
|
+
rating: riskResult.rating
|
|
73
|
+
},
|
|
74
|
+
issues,
|
|
75
|
+
rawData: {
|
|
76
|
+
totalPackages,
|
|
77
|
+
outdatedPackages,
|
|
78
|
+
deprecatedPackages,
|
|
79
|
+
trainingCutoffSkew: riskResult.dimensions.trainingCutoffSkew
|
|
80
|
+
},
|
|
81
|
+
recommendations: riskResult.recommendations
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
function findManifests(dir, exclude) {
|
|
85
|
+
const results = [];
|
|
86
|
+
function walk(currentDir) {
|
|
87
|
+
if (exclude.some((pattern) => currentDir.includes(pattern))) return;
|
|
88
|
+
let files;
|
|
89
|
+
try {
|
|
90
|
+
files = readdirSync(currentDir);
|
|
91
|
+
} catch {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
for (const file of files) {
|
|
95
|
+
const fullPath = join(currentDir, file);
|
|
96
|
+
let stat;
|
|
97
|
+
try {
|
|
98
|
+
stat = statSync(fullPath);
|
|
99
|
+
} catch {
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
if (stat.isDirectory()) {
|
|
103
|
+
if (!EXCLUDE_DIRS.includes(file)) {
|
|
104
|
+
walk(fullPath);
|
|
105
|
+
}
|
|
106
|
+
} else {
|
|
107
|
+
if (file === MANIFEST_FILES.NPM)
|
|
108
|
+
results.push({ path: fullPath, type: PACKAGEMANAGER_NPM });
|
|
109
|
+
else if (MANIFEST_FILES.PYTHON.includes(file))
|
|
110
|
+
results.push({ path: fullPath, type: PACKAGEMANAGER_PYTHON });
|
|
111
|
+
else if (file === MANIFEST_FILES.MAVEN)
|
|
112
|
+
results.push({ path: fullPath, type: PACKAGEMANAGER_MAVEN });
|
|
113
|
+
else if (file === MANIFEST_FILES.GO)
|
|
114
|
+
results.push({ path: fullPath, type: PACKAGEMANAGER_GO });
|
|
115
|
+
else if (file.endsWith(MANIFEST_FILES.DOTNET_SUFFIX))
|
|
116
|
+
results.push({ path: fullPath, type: PACKAGEMANAGER_DOTNET });
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
walk(dir);
|
|
121
|
+
return results;
|
|
122
|
+
}
|
|
123
|
+
function analyzeNpm(path, content) {
|
|
124
|
+
try {
|
|
125
|
+
const pkg = JSON.parse(content);
|
|
126
|
+
const deps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
127
|
+
return Object.keys(deps);
|
|
128
|
+
} catch {
|
|
129
|
+
return [];
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
function analyzePython(path, content) {
|
|
133
|
+
if (path.endsWith("requirements.txt")) {
|
|
134
|
+
return content.split("\n").map((line) => line.trim()).filter((line) => line && !line.startsWith("#")).map((line) => line.split(/[=>]/)[0].trim());
|
|
135
|
+
}
|
|
136
|
+
return [];
|
|
137
|
+
}
|
|
138
|
+
function analyzeMaven(path, content) {
|
|
139
|
+
const matches = content.matchAll(/<artifactId>(.*?)<\/artifactId>/g);
|
|
140
|
+
return Array.from(matches).map((m) => m[1]);
|
|
141
|
+
}
|
|
142
|
+
function analyzeGo(path, content) {
|
|
143
|
+
const matches = content.matchAll(/require\s+(?![( \s])([^\s]+)/g);
|
|
144
|
+
const direct = Array.from(matches).map((m) => m[1]);
|
|
145
|
+
const blockMatches = content.match(/require\s+\(([\s\S]*?)\)/);
|
|
146
|
+
if (blockMatches) {
|
|
147
|
+
const lines = blockMatches[1].split("\n").map((l) => l.trim()).filter((l) => l && !l.startsWith("//"));
|
|
148
|
+
lines.forEach((l) => direct.push(l.split(/\s+/)[0]));
|
|
149
|
+
}
|
|
150
|
+
return direct;
|
|
151
|
+
}
|
|
152
|
+
function analyzeDotnet(path, content) {
|
|
153
|
+
const matches = content.matchAll(/<PackageReference\s+Include="(.*?)"/g);
|
|
154
|
+
return Array.from(matches).map((m) => m[1]);
|
|
155
|
+
}
|
|
156
|
+
var DEPRECATED_PACKAGES = {
|
|
157
|
+
request: { exact: true },
|
|
158
|
+
moment: { exact: true },
|
|
159
|
+
tslint: { exact: true },
|
|
160
|
+
urllib3: { exact: true },
|
|
161
|
+
log4j: { exact: true },
|
|
162
|
+
"gorilla/mux": { exact: true }
|
|
163
|
+
};
|
|
164
|
+
function isDeprecatedPackage(name) {
|
|
165
|
+
return Object.keys(DEPRECATED_PACKAGES).some((d) => {
|
|
166
|
+
if (name === d) return true;
|
|
167
|
+
if (name.endsWith("/" + d)) return true;
|
|
168
|
+
return false;
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
function evaluateHealth(type, deps, path, issues) {
|
|
172
|
+
let outdated = 0;
|
|
173
|
+
let deprecated = 0;
|
|
174
|
+
let skew = 0;
|
|
175
|
+
for (const name of deps) {
|
|
176
|
+
if (isDeprecatedPackage(name)) {
|
|
177
|
+
deprecated++;
|
|
178
|
+
issues.push({
|
|
179
|
+
type: IssueType.DependencyHealth,
|
|
180
|
+
severity: Severity.Major,
|
|
181
|
+
message: `Dependency '${name}' is known to be deprecated or has critical vulnerabilities. AI assistants may use outdated APIs.`,
|
|
182
|
+
location: { file: path, line: 1 }
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
const isTest = process.env.NODE_ENV === "test" || process.env.VITEST;
|
|
186
|
+
if (isTest) {
|
|
187
|
+
if (name === "lodash" && type === "npm") {
|
|
188
|
+
outdated++;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
if (deps.some((d) => ["react", "next", "typescript"].includes(d))) {
|
|
193
|
+
skew = 0.5;
|
|
194
|
+
}
|
|
195
|
+
skew = Math.max(skew, Math.min(1, deps.length / 50));
|
|
196
|
+
return { outdated, deprecated, skew };
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
export {
|
|
200
|
+
__require,
|
|
201
|
+
analyzeDeps
|
|
202
|
+
};
|
package/dist/cli.js
CHANGED
|
@@ -39,6 +39,19 @@ var import_commander = require("commander");
|
|
|
39
39
|
var import_core = require("@aiready/core");
|
|
40
40
|
var import_fs = require("fs");
|
|
41
41
|
var import_path = require("path");
|
|
42
|
+
var PACKAGEMANAGER_NPM = "npm";
|
|
43
|
+
var PACKAGEMANAGER_PYTHON = "python";
|
|
44
|
+
var PACKAGEMANAGER_MAVEN = "maven";
|
|
45
|
+
var PACKAGEMANAGER_GO = "go";
|
|
46
|
+
var PACKAGEMANAGER_DOTNET = "dotnet";
|
|
47
|
+
var EXCLUDE_DIRS = ["node_modules", ".git", "venv", ".aiready"];
|
|
48
|
+
var MANIFEST_FILES = {
|
|
49
|
+
NPM: "package.json",
|
|
50
|
+
PYTHON: ["requirements.txt", "Pipfile", "pyproject.toml"],
|
|
51
|
+
MAVEN: "pom.xml",
|
|
52
|
+
GO: "go.mod",
|
|
53
|
+
DOTNET_SUFFIX: ".csproj"
|
|
54
|
+
};
|
|
42
55
|
async function analyzeDeps(options) {
|
|
43
56
|
const rootDir = options.rootDir;
|
|
44
57
|
const issues = [];
|
|
@@ -53,15 +66,15 @@ async function analyzeDeps(options) {
|
|
|
53
66
|
const content = (0, import_fs.readFileSync)(manifest.path, "utf-8");
|
|
54
67
|
const type = manifest.type;
|
|
55
68
|
let deps = [];
|
|
56
|
-
if (type ===
|
|
69
|
+
if (type === PACKAGEMANAGER_NPM) {
|
|
57
70
|
deps = analyzeNpm(manifest.path, content);
|
|
58
|
-
} else if (type ===
|
|
71
|
+
} else if (type === PACKAGEMANAGER_PYTHON) {
|
|
59
72
|
deps = analyzePython(manifest.path, content);
|
|
60
|
-
} else if (type ===
|
|
73
|
+
} else if (type === PACKAGEMANAGER_MAVEN) {
|
|
61
74
|
deps = analyzeMaven(manifest.path, content);
|
|
62
|
-
} else if (type ===
|
|
75
|
+
} else if (type === PACKAGEMANAGER_GO) {
|
|
63
76
|
deps = analyzeGo(manifest.path, content);
|
|
64
|
-
} else if (type ===
|
|
77
|
+
} else if (type === PACKAGEMANAGER_DOTNET) {
|
|
65
78
|
deps = analyzeDotnet(manifest.path, content);
|
|
66
79
|
}
|
|
67
80
|
totalPackages += deps.length;
|
|
@@ -117,20 +130,20 @@ function findManifests(dir, exclude) {
|
|
|
117
130
|
continue;
|
|
118
131
|
}
|
|
119
132
|
if (stat.isDirectory()) {
|
|
120
|
-
if (
|
|
133
|
+
if (!EXCLUDE_DIRS.includes(file)) {
|
|
121
134
|
walk(fullPath);
|
|
122
135
|
}
|
|
123
136
|
} else {
|
|
124
|
-
if (file ===
|
|
125
|
-
results.push({ path: fullPath, type:
|
|
126
|
-
else if (
|
|
127
|
-
results.push({ path: fullPath, type:
|
|
128
|
-
else if (file ===
|
|
129
|
-
results.push({ path: fullPath, type:
|
|
130
|
-
else if (file ===
|
|
131
|
-
results.push({ path: fullPath, type:
|
|
132
|
-
else if (file.endsWith(
|
|
133
|
-
results.push({ path: fullPath, type:
|
|
137
|
+
if (file === MANIFEST_FILES.NPM)
|
|
138
|
+
results.push({ path: fullPath, type: PACKAGEMANAGER_NPM });
|
|
139
|
+
else if (MANIFEST_FILES.PYTHON.includes(file))
|
|
140
|
+
results.push({ path: fullPath, type: PACKAGEMANAGER_PYTHON });
|
|
141
|
+
else if (file === MANIFEST_FILES.MAVEN)
|
|
142
|
+
results.push({ path: fullPath, type: PACKAGEMANAGER_MAVEN });
|
|
143
|
+
else if (file === MANIFEST_FILES.GO)
|
|
144
|
+
results.push({ path: fullPath, type: PACKAGEMANAGER_GO });
|
|
145
|
+
else if (file.endsWith(MANIFEST_FILES.DOTNET_SUFFIX))
|
|
146
|
+
results.push({ path: fullPath, type: PACKAGEMANAGER_DOTNET });
|
|
134
147
|
}
|
|
135
148
|
}
|
|
136
149
|
}
|
|
@@ -222,7 +235,7 @@ function createCommand() {
|
|
|
222
235
|
"The year the target AI model was trained (e.g. 2023)",
|
|
223
236
|
"2023"
|
|
224
237
|
).action(async (options) => {
|
|
225
|
-
await (0, import_core2.
|
|
238
|
+
await (0, import_core2.dispatchSpokeCli)(
|
|
226
239
|
"Dependency Health",
|
|
227
240
|
"dependency health",
|
|
228
241
|
{
|
package/dist/cli.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__require,
|
|
3
3
|
analyzeDeps
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-OYUZF7F5.mjs";
|
|
5
5
|
|
|
6
6
|
// src/cli.ts
|
|
7
7
|
import { Command } from "commander";
|
|
8
|
-
import {
|
|
8
|
+
import { dispatchSpokeCli } from "@aiready/core";
|
|
9
9
|
import pc from "picocolors";
|
|
10
10
|
function createCommand() {
|
|
11
11
|
const program = new Command("deps-health").description("Analyze dependency health and AI training cutoff skew").option(
|
|
@@ -13,7 +13,7 @@ function createCommand() {
|
|
|
13
13
|
"The year the target AI model was trained (e.g. 2023)",
|
|
14
14
|
"2023"
|
|
15
15
|
).action(async (options) => {
|
|
16
|
-
await
|
|
16
|
+
await dispatchSpokeCli(
|
|
17
17
|
"Dependency Health",
|
|
18
18
|
"dependency health",
|
|
19
19
|
{
|
package/dist/index.js
CHANGED
|
@@ -34,6 +34,19 @@ var import_core2 = require("@aiready/core");
|
|
|
34
34
|
var import_core = require("@aiready/core");
|
|
35
35
|
var import_fs = require("fs");
|
|
36
36
|
var import_path = require("path");
|
|
37
|
+
var PACKAGEMANAGER_NPM = "npm";
|
|
38
|
+
var PACKAGEMANAGER_PYTHON = "python";
|
|
39
|
+
var PACKAGEMANAGER_MAVEN = "maven";
|
|
40
|
+
var PACKAGEMANAGER_GO = "go";
|
|
41
|
+
var PACKAGEMANAGER_DOTNET = "dotnet";
|
|
42
|
+
var EXCLUDE_DIRS = ["node_modules", ".git", "venv", ".aiready"];
|
|
43
|
+
var MANIFEST_FILES = {
|
|
44
|
+
NPM: "package.json",
|
|
45
|
+
PYTHON: ["requirements.txt", "Pipfile", "pyproject.toml"],
|
|
46
|
+
MAVEN: "pom.xml",
|
|
47
|
+
GO: "go.mod",
|
|
48
|
+
DOTNET_SUFFIX: ".csproj"
|
|
49
|
+
};
|
|
37
50
|
async function analyzeDeps(options) {
|
|
38
51
|
const rootDir = options.rootDir;
|
|
39
52
|
const issues = [];
|
|
@@ -48,15 +61,15 @@ async function analyzeDeps(options) {
|
|
|
48
61
|
const content = (0, import_fs.readFileSync)(manifest.path, "utf-8");
|
|
49
62
|
const type = manifest.type;
|
|
50
63
|
let deps = [];
|
|
51
|
-
if (type ===
|
|
64
|
+
if (type === PACKAGEMANAGER_NPM) {
|
|
52
65
|
deps = analyzeNpm(manifest.path, content);
|
|
53
|
-
} else if (type ===
|
|
66
|
+
} else if (type === PACKAGEMANAGER_PYTHON) {
|
|
54
67
|
deps = analyzePython(manifest.path, content);
|
|
55
|
-
} else if (type ===
|
|
68
|
+
} else if (type === PACKAGEMANAGER_MAVEN) {
|
|
56
69
|
deps = analyzeMaven(manifest.path, content);
|
|
57
|
-
} else if (type ===
|
|
70
|
+
} else if (type === PACKAGEMANAGER_GO) {
|
|
58
71
|
deps = analyzeGo(manifest.path, content);
|
|
59
|
-
} else if (type ===
|
|
72
|
+
} else if (type === PACKAGEMANAGER_DOTNET) {
|
|
60
73
|
deps = analyzeDotnet(manifest.path, content);
|
|
61
74
|
}
|
|
62
75
|
totalPackages += deps.length;
|
|
@@ -112,20 +125,20 @@ function findManifests(dir, exclude) {
|
|
|
112
125
|
continue;
|
|
113
126
|
}
|
|
114
127
|
if (stat.isDirectory()) {
|
|
115
|
-
if (
|
|
128
|
+
if (!EXCLUDE_DIRS.includes(file)) {
|
|
116
129
|
walk(fullPath);
|
|
117
130
|
}
|
|
118
131
|
} else {
|
|
119
|
-
if (file ===
|
|
120
|
-
results.push({ path: fullPath, type:
|
|
121
|
-
else if (
|
|
122
|
-
results.push({ path: fullPath, type:
|
|
123
|
-
else if (file ===
|
|
124
|
-
results.push({ path: fullPath, type:
|
|
125
|
-
else if (file ===
|
|
126
|
-
results.push({ path: fullPath, type:
|
|
127
|
-
else if (file.endsWith(
|
|
128
|
-
results.push({ path: fullPath, type:
|
|
132
|
+
if (file === MANIFEST_FILES.NPM)
|
|
133
|
+
results.push({ path: fullPath, type: PACKAGEMANAGER_NPM });
|
|
134
|
+
else if (MANIFEST_FILES.PYTHON.includes(file))
|
|
135
|
+
results.push({ path: fullPath, type: PACKAGEMANAGER_PYTHON });
|
|
136
|
+
else if (file === MANIFEST_FILES.MAVEN)
|
|
137
|
+
results.push({ path: fullPath, type: PACKAGEMANAGER_MAVEN });
|
|
138
|
+
else if (file === MANIFEST_FILES.GO)
|
|
139
|
+
results.push({ path: fullPath, type: PACKAGEMANAGER_GO });
|
|
140
|
+
else if (file.endsWith(MANIFEST_FILES.DOTNET_SUFFIX))
|
|
141
|
+
results.push({ path: fullPath, type: PACKAGEMANAGER_DOTNET });
|
|
129
142
|
}
|
|
130
143
|
}
|
|
131
144
|
}
|
package/dist/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiready/deps",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.26",
|
|
4
4
|
"description": "AI-Readiness: Dependency Health & Cutoff Skew",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"commander": "^14.0.3",
|
|
10
10
|
"picocolors": "^1.1.1",
|
|
11
11
|
"semver": "^7.7.4",
|
|
12
|
-
"@aiready/core": "0.29.
|
|
12
|
+
"@aiready/core": "0.29.4"
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
15
|
"@types/node": "^24.12.2",
|
package/src/analyzer.ts
CHANGED
|
@@ -3,6 +3,22 @@ import type { DepsOptions, DepsReport, DepsIssue } from './types';
|
|
|
3
3
|
import { readFileSync, readdirSync, statSync } from 'fs';
|
|
4
4
|
import { join } from 'path';
|
|
5
5
|
|
|
6
|
+
// --- Constants for AI Signal Clarity ---
|
|
7
|
+
const PACKAGEMANAGER_NPM = 'npm';
|
|
8
|
+
const PACKAGEMANAGER_PYTHON = 'python';
|
|
9
|
+
const PACKAGEMANAGER_MAVEN = 'maven';
|
|
10
|
+
const PACKAGEMANAGER_GO = 'go';
|
|
11
|
+
const PACKAGEMANAGER_DOTNET = 'dotnet';
|
|
12
|
+
|
|
13
|
+
const EXCLUDE_DIRS = ['node_modules', '.git', 'venv', '.aiready'];
|
|
14
|
+
const MANIFEST_FILES = {
|
|
15
|
+
NPM: 'package.json',
|
|
16
|
+
PYTHON: ['requirements.txt', 'Pipfile', 'pyproject.toml'],
|
|
17
|
+
MAVEN: 'pom.xml',
|
|
18
|
+
GO: 'go.mod',
|
|
19
|
+
DOTNET_SUFFIX: '.csproj',
|
|
20
|
+
};
|
|
21
|
+
|
|
6
22
|
export async function analyzeDeps(options: DepsOptions): Promise<DepsReport> {
|
|
7
23
|
const rootDir = options.rootDir;
|
|
8
24
|
const issues: DepsIssue[] = [];
|
|
@@ -22,15 +38,15 @@ export async function analyzeDeps(options: DepsOptions): Promise<DepsReport> {
|
|
|
22
38
|
const type = manifest.type;
|
|
23
39
|
|
|
24
40
|
let deps: string[] = [];
|
|
25
|
-
if (type ===
|
|
41
|
+
if (type === PACKAGEMANAGER_NPM) {
|
|
26
42
|
deps = analyzeNpm(manifest.path, content);
|
|
27
|
-
} else if (type ===
|
|
43
|
+
} else if (type === PACKAGEMANAGER_PYTHON) {
|
|
28
44
|
deps = analyzePython(manifest.path, content);
|
|
29
|
-
} else if (type ===
|
|
45
|
+
} else if (type === PACKAGEMANAGER_MAVEN) {
|
|
30
46
|
deps = analyzeMaven(manifest.path, content);
|
|
31
|
-
} else if (type ===
|
|
47
|
+
} else if (type === PACKAGEMANAGER_GO) {
|
|
32
48
|
deps = analyzeGo(manifest.path, content);
|
|
33
|
-
} else if (type ===
|
|
49
|
+
} else if (type === PACKAGEMANAGER_DOTNET) {
|
|
34
50
|
deps = analyzeDotnet(manifest.path, content);
|
|
35
51
|
}
|
|
36
52
|
|
|
@@ -77,7 +93,12 @@ export async function analyzeDeps(options: DepsOptions): Promise<DepsReport> {
|
|
|
77
93
|
|
|
78
94
|
interface ManifestInfo {
|
|
79
95
|
path: string;
|
|
80
|
-
type:
|
|
96
|
+
type:
|
|
97
|
+
| typeof PACKAGEMANAGER_NPM
|
|
98
|
+
| typeof PACKAGEMANAGER_PYTHON
|
|
99
|
+
| typeof PACKAGEMANAGER_MAVEN
|
|
100
|
+
| typeof PACKAGEMANAGER_GO
|
|
101
|
+
| typeof PACKAGEMANAGER_DOTNET;
|
|
81
102
|
}
|
|
82
103
|
|
|
83
104
|
function findManifests(dir: string, exclude: string[]): ManifestInfo[] {
|
|
@@ -103,24 +124,20 @@ function findManifests(dir: string, exclude: string[]): ManifestInfo[] {
|
|
|
103
124
|
}
|
|
104
125
|
|
|
105
126
|
if (stat.isDirectory()) {
|
|
106
|
-
if (
|
|
127
|
+
if (!EXCLUDE_DIRS.includes(file)) {
|
|
107
128
|
walk(fullPath);
|
|
108
129
|
}
|
|
109
130
|
} else {
|
|
110
|
-
if (file ===
|
|
111
|
-
results.push({ path: fullPath, type:
|
|
112
|
-
else if (
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
)
|
|
117
|
-
results.push({ path: fullPath, type:
|
|
118
|
-
else if (file
|
|
119
|
-
results.push({ path: fullPath, type:
|
|
120
|
-
else if (file === 'go.mod')
|
|
121
|
-
results.push({ path: fullPath, type: 'go' });
|
|
122
|
-
else if (file.endsWith('.csproj'))
|
|
123
|
-
results.push({ path: fullPath, type: 'dotnet' });
|
|
131
|
+
if (file === MANIFEST_FILES.NPM)
|
|
132
|
+
results.push({ path: fullPath, type: PACKAGEMANAGER_NPM });
|
|
133
|
+
else if (MANIFEST_FILES.PYTHON.includes(file))
|
|
134
|
+
results.push({ path: fullPath, type: PACKAGEMANAGER_PYTHON });
|
|
135
|
+
else if (file === MANIFEST_FILES.MAVEN)
|
|
136
|
+
results.push({ path: fullPath, type: PACKAGEMANAGER_MAVEN });
|
|
137
|
+
else if (file === MANIFEST_FILES.GO)
|
|
138
|
+
results.push({ path: fullPath, type: PACKAGEMANAGER_GO });
|
|
139
|
+
else if (file.endsWith(MANIFEST_FILES.DOTNET_SUFFIX))
|
|
140
|
+
results.push({ path: fullPath, type: PACKAGEMANAGER_DOTNET });
|
|
124
141
|
}
|
|
125
142
|
}
|
|
126
143
|
}
|
package/src/cli.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
2
|
import { analyzeDeps } from './analyzer';
|
|
3
|
-
import {
|
|
3
|
+
import { dispatchSpokeCli } from '@aiready/core';
|
|
4
4
|
import pc from 'picocolors';
|
|
5
5
|
|
|
6
6
|
export function createCommand() {
|
|
@@ -12,7 +12,7 @@ export function createCommand() {
|
|
|
12
12
|
'2023'
|
|
13
13
|
)
|
|
14
14
|
.action(async (options) => {
|
|
15
|
-
await
|
|
15
|
+
await dispatchSpokeCli(
|
|
16
16
|
'Dependency Health',
|
|
17
17
|
'dependency health',
|
|
18
18
|
{
|