@aiready/deps 0.14.25 → 0.14.27
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 +20 -20
- package/.turbo/turbo-format-check.log +1 -1
- package/.turbo/turbo-format.log +8 -7
- package/.turbo/turbo-lint$colon$fix.log +1 -1
- package/.turbo/turbo-lint.log +1 -1
- package/.turbo/turbo-test.log +23 -41
- 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,24 +1,24 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> @aiready/deps@0.14.
|
|
3
|
+
> @aiready/deps@0.14.26 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
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
+
[32mESM[39m [1mdist/cli.mjs [22m[32m896.00 B[39m
|
|
13
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m1.84 KB[39m
|
|
14
|
+
[32mESM[39m [1mdist/chunk-OYUZF7F5.mjs [22m[32m6.37 KB[39m
|
|
15
|
+
[32mESM[39m ⚡️ Build success in 101ms
|
|
16
|
+
[32mCJS[39m [1mdist/index.js [22m[32m8.91 KB[39m
|
|
17
|
+
[32mCJS[39m [1mdist/cli.js [22m[32m8.50 KB[39m
|
|
18
|
+
[32mCJS[39m ⚡️ Build success in 103ms
|
|
19
|
+
[34mDTS[39m Build start
|
|
20
|
+
[32mDTS[39m ⚡️ Build success in 4216ms
|
|
21
|
+
[32mDTS[39m [1mdist/cli.d.ts [22m[32m108.00 B[39m
|
|
22
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m1.18 KB[39m
|
|
23
|
+
[32mDTS[39m [1mdist/cli.d.mts [22m[32m108.00 B[39m
|
|
24
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m1.18 KB[39m
|
package/.turbo/turbo-format.log
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> @aiready/deps@0.14.
|
|
3
|
+
> @aiready/deps@0.14.26 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 18ms (unchanged)
|
|
8
|
+
src/__tests__/analyzer.test.ts[2K[1G[90msrc/__tests__/analyzer.test.ts[39m 37ms (unchanged)
|
|
9
|
+
src/__tests__/contract.test.ts[2K[1G[90msrc/__tests__/contract.test.ts[39m 7ms (unchanged)
|
|
9
10
|
src/__tests__/provider.test.ts[2K[1G[90msrc/__tests__/provider.test.ts[39m 2ms (unchanged)
|
|
10
11
|
src/__tests__/scoring.test.ts[2K[1G[90msrc/__tests__/scoring.test.ts[39m 4ms (unchanged)
|
|
11
|
-
src/analyzer.ts[2K[1G[90msrc/analyzer.ts[39m
|
|
12
|
-
src/cli.ts[2K[1G[90msrc/cli.ts[39m
|
|
12
|
+
src/analyzer.ts[2K[1G[90msrc/analyzer.ts[39m 19ms (unchanged)
|
|
13
|
+
src/cli.ts[2K[1G[90msrc/cli.ts[39m 2ms (unchanged)
|
|
13
14
|
src/index.ts[2K[1G[90msrc/index.ts[39m 1ms (unchanged)
|
|
14
|
-
src/provider.ts[2K[1G[90msrc/provider.ts[39m
|
|
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,28 +1,19 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> @aiready/deps@0.14.
|
|
3
|
+
> @aiready/deps@0.14.26 test /Users/pengcao/projects/aiready/packages/deps
|
|
4
4
|
> vitest run
|
|
5
5
|
|
|
6
6
|
[?25l
|
|
7
7
|
RUN v4.1.4 /Users/pengcao/projects/aiready/packages/deps
|
|
8
8
|
|
|
9
9
|
[?2026h
|
|
10
|
-
❯ src/__tests__/
|
|
10
|
+
❯ src/__tests__/provider.test.ts [queued]
|
|
11
11
|
|
|
12
12
|
Test Files 0 passed (4)
|
|
13
13
|
Tests 0 passed (0)
|
|
14
|
-
Start at
|
|
15
|
-
Duration
|
|
14
|
+
Start at 07:13:58
|
|
15
|
+
Duration 204ms
|
|
16
16
|
[?2026l[?2026h[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K
|
|
17
|
-
❯ src/__tests__/analyzer.test.ts [queued]
|
|
18
|
-
❯ src/__tests__/contract.test.ts [queued]
|
|
19
|
-
❯ src/__tests__/scoring.test.ts [queued]
|
|
20
|
-
|
|
21
|
-
Test Files 0 passed (4)
|
|
22
|
-
Tests 0 passed (0)
|
|
23
|
-
Start at 09:20:45
|
|
24
|
-
Duration 924ms
|
|
25
|
-
[?2026l[?2026h[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K
|
|
26
17
|
❯ src/__tests__/analyzer.test.ts [queued]
|
|
27
18
|
❯ src/__tests__/contract.test.ts [queued]
|
|
28
19
|
❯ src/__tests__/provider.test.ts [queued]
|
|
@@ -30,44 +21,35 @@
|
|
|
30
21
|
|
|
31
22
|
Test Files 0 passed (4)
|
|
32
23
|
Tests 0 passed (0)
|
|
33
|
-
Start at
|
|
34
|
-
Duration
|
|
24
|
+
Start at 07:13:58
|
|
25
|
+
Duration 953ms
|
|
35
26
|
[?2026l[?2026h[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K
|
|
36
27
|
❯ src/__tests__/analyzer.test.ts [queued]
|
|
37
28
|
❯ src/__tests__/contract.test.ts [queued]
|
|
38
29
|
❯ src/__tests__/provider.test.ts [queued]
|
|
39
|
-
❯ src/__tests__/scoring.test.ts
|
|
30
|
+
❯ src/__tests__/scoring.test.ts 0/2
|
|
40
31
|
|
|
41
32
|
Test Files 0 passed (4)
|
|
42
|
-
Tests 0 passed (
|
|
43
|
-
Start at
|
|
44
|
-
Duration 1.
|
|
45
|
-
[?2026l[?2026h[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K
|
|
46
|
-
❯ src/__tests__/analyzer.test.ts 0/4
|
|
47
|
-
❯ src/__tests__/contract.test.ts [queued]
|
|
48
|
-
❯ src/__tests__/provider.test.ts [queued]
|
|
49
|
-
❯ src/__tests__/scoring.test.ts [queued]
|
|
33
|
+
Tests 0 passed (2)
|
|
34
|
+
Start at 07:13:58
|
|
35
|
+
Duration 1.05s
|
|
36
|
+
[?2026l[?2026h[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K ✓ src/__tests__/scoring.test.ts (2 tests) 2ms
|
|
50
37
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
Duration 2.63s
|
|
55
|
-
[?2026l[?2026h[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K ✓ src/__tests__/analyzer.test.ts (4 tests) 49ms
|
|
56
|
-
✓ src/__tests__/scoring.test.ts (2 tests) 41ms
|
|
57
|
-
|
|
58
|
-
❯ src/__tests__/contract.test.ts 0/1
|
|
59
|
-
❯ src/__tests__/provider.test.ts [queued]
|
|
38
|
+
❯ src/__tests__/analyzer.test.ts [queued]
|
|
39
|
+
❯ src/__tests__/contract.test.ts [queued]
|
|
40
|
+
❯ src/__tests__/provider.test.ts 0/2
|
|
60
41
|
|
|
61
|
-
Test Files
|
|
62
|
-
Tests
|
|
63
|
-
Start at
|
|
64
|
-
Duration
|
|
65
|
-
[?2026l[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K ✓ src/__tests__/
|
|
66
|
-
✓ src/__tests__/
|
|
42
|
+
Test Files 1 passed (4)
|
|
43
|
+
Tests 2 passed (4)
|
|
44
|
+
Start at 07:13:58
|
|
45
|
+
Duration 1.36s
|
|
46
|
+
[?2026l[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K ✓ src/__tests__/provider.test.ts (2 tests) 2ms
|
|
47
|
+
✓ src/__tests__/analyzer.test.ts (4 tests) 9ms
|
|
48
|
+
✓ src/__tests__/contract.test.ts (1 test) 18ms
|
|
67
49
|
|
|
68
50
|
Test Files 4 passed (4)
|
|
69
51
|
Tests 9 passed (9)
|
|
70
|
-
Start at
|
|
71
|
-
Duration
|
|
52
|
+
Start at 07:13:58
|
|
53
|
+
Duration 1.51s (transform 1.37s, setup 0ms, import 4.28s, tests 31ms, environment 0ms)
|
|
72
54
|
|
|
73
55
|
[?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.27",
|
|
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.5"
|
|
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
|
{
|