@aiready/deps 0.9.2 → 0.9.5

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.
@@ -1,6 +1,6 @@
1
1
 
2
2
  
3
- > @aiready/deps@0.9.1 build /Users/pengcao/projects/aiready/packages/deps
3
+ > @aiready/deps@0.9.4 build /Users/pengcao/projects/aiready/packages/deps
4
4
  > tsup src/index.ts src/cli.ts --format cjs,esm --dts
5
5
 
6
6
  CLI Building entry: src/cli.ts, src/index.ts
@@ -10,7 +10,7 @@
10
10
  CJS Build start
11
11
  ESM Build start
12
12
 
13
-  WARN  ▲ [WARNING] The condition "types" here will never be used as it comes after both "import" and "require" [package.json] 8:13:04 pm
13
+  WARN  ▲ [WARNING] The condition "types" here will never be used as it comes after both "import" and "require" [package.json] 9:38:41 pm
14
14
 
15
15
  package.json:32:6:
16
16
   32 │ "types": "./dist/index.d.ts"
@@ -31,7 +31,7 @@
31
31
 
32
32
 
33
33
 
34
-  WARN  ▲ [WARNING] The condition "types" here will never be used as it comes after both "import" and "require" [package.json] 8:13:04 pm
34
+  WARN  ▲ [WARNING] The condition "types" here will never be used as it comes after both "import" and "require" [package.json] 9:38:41 pm
35
35
 
36
36
  package.json:32:6:
37
37
   32 │ "types": "./dist/index.d.ts"
@@ -51,16 +51,16 @@
51
51
 
52
52
 
53
53
 
54
- ESM dist/chunk-MN25J52Z.mjs 3.13 KB
54
+ CJS dist/index.js 3.89 KB
55
+ CJS dist/cli.js 5.87 KB
56
+ CJS ⚡️ Build success in 137ms
55
57
  ESM dist/cli.mjs 1.33 KB
56
58
  ESM dist/index.mjs 80.00 B
57
- ESM ⚡️ Build success in 114ms
58
- CJS dist/cli.js 5.80 KB
59
- CJS dist/index.js 3.82 KB
60
- CJS ⚡️ Build success in 114ms
59
+ ESM dist/chunk-4D7DCOHZ.mjs 3.18 KB
60
+ ESM ⚡️ Build success in 138ms
61
61
  DTS Build start
62
- DTS ⚡️ Build success in 3449ms
62
+ DTS ⚡️ Build success in 3723ms
63
63
  DTS dist/cli.d.ts 108.00 B
64
- DTS dist/index.d.ts 839.00 B
64
+ DTS dist/index.d.ts 857.00 B
65
65
  DTS dist/cli.d.mts 108.00 B
66
- DTS dist/index.d.mts 839.00 B
66
+ DTS dist/index.d.mts 857.00 B
@@ -1,6 +1,6 @@
1
1
 
2
2
  
3
- > @aiready/deps@0.9.1 test /Users/pengcao/projects/aiready/packages/deps
3
+ > @aiready/deps@0.9.4 test /Users/pengcao/projects/aiready/packages/deps
4
4
  > vitest run
5
5
 
6
6
  [?25l
@@ -10,7 +10,7 @@
10
10
 
11
11
   Test Files  1 passed (1)
12
12
   Tests  1 passed (1)
13
-  Start at  20:13:24
14
-  Duration  1.45s (transform 387ms, setup 0ms, import 1.21s, tests 6ms, environment 0ms)
13
+  Start at  21:39:02
14
+  Duration  1.15s (transform 169ms, setup 0ms, import 791ms, tests 6ms, environment 0ms)
15
15
 
16
16
  [?25h
@@ -0,0 +1,97 @@
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, existsSync } from "fs";
11
+ import { join } from "path";
12
+ async function analyzeDeps(options) {
13
+ const rootDir = options.rootDir;
14
+ const packageJsonPath = join(rootDir, "package.json");
15
+ let totalPackages = 0;
16
+ let outdatedPackages = 0;
17
+ let deprecatedPackages = 0;
18
+ let trainingCutoffSkew = 0;
19
+ const issues = [];
20
+ if (existsSync(packageJsonPath)) {
21
+ try {
22
+ const content = readFileSync(packageJsonPath, "utf-8");
23
+ const pkg = JSON.parse(content);
24
+ const allDeps = {
25
+ ...pkg.dependencies || {},
26
+ ...pkg.devDependencies || {},
27
+ ...pkg.peerDependencies || {}
28
+ };
29
+ const depNames = Object.keys(allDeps);
30
+ totalPackages = depNames.length;
31
+ for (const [name, version] of Object.entries(allDeps)) {
32
+ const vStr = String(version).replace(/[^0-9.]/g, "");
33
+ const major = parseInt(vStr.split(".")[0] || "0", 10);
34
+ if ([
35
+ "request",
36
+ "moment",
37
+ "tslint",
38
+ "mkdirp",
39
+ "uuid",
40
+ "node-uuid"
41
+ ].includes(name) && major < 4) {
42
+ deprecatedPackages++;
43
+ issues.push({
44
+ type: IssueType.DependencyHealth,
45
+ severity: Severity.Major,
46
+ message: `Dependency '${name}' is known to be deprecated. AI assistants may use outdated APIs.`,
47
+ location: { file: packageJsonPath, line: 1 }
48
+ });
49
+ }
50
+ if (major === 0) {
51
+ outdatedPackages++;
52
+ issues.push({
53
+ type: IssueType.DependencyHealth,
54
+ severity: Severity.Minor,
55
+ message: `Dependency '${name}' (${version}) is pre-v1. APIs often unstable and hard for AI to predict.`,
56
+ location: { file: packageJsonPath, line: 1 }
57
+ });
58
+ }
59
+ }
60
+ let skewSignals = 0;
61
+ if (allDeps["next"] && allDeps["next"].includes("15")) skewSignals++;
62
+ if (allDeps["react"] && allDeps["react"].includes("19")) skewSignals++;
63
+ if (allDeps["typescript"] && allDeps["typescript"].includes("5.6"))
64
+ skewSignals++;
65
+ trainingCutoffSkew = totalPackages > 0 ? skewSignals / totalPackages * 5 : 0;
66
+ trainingCutoffSkew = Math.min(1, trainingCutoffSkew);
67
+ } catch {
68
+ }
69
+ }
70
+ const riskResult = calculateDependencyHealth({
71
+ totalPackages,
72
+ outdatedPackages,
73
+ deprecatedPackages,
74
+ trainingCutoffSkew
75
+ });
76
+ return {
77
+ summary: {
78
+ filesAnalyzed: existsSync(packageJsonPath) ? 1 : 0,
79
+ packagesAnalyzed: totalPackages,
80
+ score: riskResult.score,
81
+ rating: riskResult.rating
82
+ },
83
+ issues,
84
+ rawData: {
85
+ totalPackages,
86
+ outdatedPackages,
87
+ deprecatedPackages,
88
+ trainingCutoffSkew
89
+ },
90
+ recommendations: riskResult.recommendations
91
+ };
92
+ }
93
+
94
+ export {
95
+ __require,
96
+ analyzeDeps
97
+ };
package/dist/cli.js CHANGED
@@ -71,8 +71,8 @@ async function analyzeDeps(options) {
71
71
  ].includes(name) && major < 4) {
72
72
  deprecatedPackages++;
73
73
  issues.push({
74
- type: "dependency-health",
75
- severity: "major",
74
+ type: import_core.IssueType.DependencyHealth,
75
+ severity: import_core.Severity.Major,
76
76
  message: `Dependency '${name}' is known to be deprecated. AI assistants may use outdated APIs.`,
77
77
  location: { file: packageJsonPath, line: 1 }
78
78
  });
@@ -80,8 +80,8 @@ async function analyzeDeps(options) {
80
80
  if (major === 0) {
81
81
  outdatedPackages++;
82
82
  issues.push({
83
- type: "dependency-health",
84
- severity: "minor",
83
+ type: import_core.IssueType.DependencyHealth,
84
+ severity: import_core.Severity.Minor,
85
85
  message: `Dependency '${name}' (${version}) is pre-v1. APIs often unstable and hard for AI to predict.`,
86
86
  location: { file: packageJsonPath, line: 1 }
87
87
  });
package/dist/cli.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  __require,
3
3
  analyzeDeps
4
- } from "./chunk-MN25J52Z.mjs";
4
+ } from "./chunk-4D7DCOHZ.mjs";
5
5
 
6
6
  // src/cli.ts
7
7
  import { Command } from "commander";
package/dist/index.d.mts CHANGED
@@ -1,11 +1,11 @@
1
- import { Issue, ScanOptions } from '@aiready/core';
1
+ import { Issue, IssueType, ScanOptions } from '@aiready/core';
2
2
 
3
3
  interface DepsOptions extends ScanOptions {
4
4
  /** The year the AI model was trained. Defaults to 2023. */
5
5
  trainingCutoffYear?: number;
6
6
  }
7
7
  interface DepsIssue extends Issue {
8
- type: 'dependency-health';
8
+ type: IssueType.DependencyHealth;
9
9
  }
10
10
  interface DepsReport {
11
11
  summary: {
package/dist/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
- import { Issue, ScanOptions } from '@aiready/core';
1
+ import { Issue, IssueType, ScanOptions } from '@aiready/core';
2
2
 
3
3
  interface DepsOptions extends ScanOptions {
4
4
  /** The year the AI model was trained. Defaults to 2023. */
5
5
  trainingCutoffYear?: number;
6
6
  }
7
7
  interface DepsIssue extends Issue {
8
- type: 'dependency-health';
8
+ type: IssueType.DependencyHealth;
9
9
  }
10
10
  interface DepsReport {
11
11
  summary: {
package/dist/index.js CHANGED
@@ -60,8 +60,8 @@ async function analyzeDeps(options) {
60
60
  ].includes(name) && major < 4) {
61
61
  deprecatedPackages++;
62
62
  issues.push({
63
- type: "dependency-health",
64
- severity: "major",
63
+ type: import_core.IssueType.DependencyHealth,
64
+ severity: import_core.Severity.Major,
65
65
  message: `Dependency '${name}' is known to be deprecated. AI assistants may use outdated APIs.`,
66
66
  location: { file: packageJsonPath, line: 1 }
67
67
  });
@@ -69,8 +69,8 @@ async function analyzeDeps(options) {
69
69
  if (major === 0) {
70
70
  outdatedPackages++;
71
71
  issues.push({
72
- type: "dependency-health",
73
- severity: "minor",
72
+ type: import_core.IssueType.DependencyHealth,
73
+ severity: import_core.Severity.Minor,
74
74
  message: `Dependency '${name}' (${version}) is pre-v1. APIs often unstable and hard for AI to predict.`,
75
75
  location: { file: packageJsonPath, line: 1 }
76
76
  });
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  analyzeDeps
3
- } from "./chunk-MN25J52Z.mjs";
3
+ } from "./chunk-4D7DCOHZ.mjs";
4
4
  export {
5
5
  analyzeDeps
6
6
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiready/deps",
3
- "version": "0.9.2",
3
+ "version": "0.9.5",
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.0",
10
10
  "picocolors": "^1.0.0",
11
11
  "semver": "^7.6.0",
12
- "@aiready/core": "0.19.2"
12
+ "@aiready/core": "0.19.5"
13
13
  },
14
14
  "devDependencies": {
15
15
  "@types/node": "^24.0.0",
package/src/analyzer.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { calculateDependencyHealth } from '@aiready/core';
1
+ import { calculateDependencyHealth, Severity, IssueType } from '@aiready/core';
2
2
  import type { DepsOptions, DepsReport, DepsIssue } from './types';
3
3
  import { readFileSync, existsSync } from 'fs';
4
4
  import { join } from 'path';
@@ -47,8 +47,8 @@ export async function analyzeDeps(options: DepsOptions): Promise<DepsReport> {
47
47
  ) {
48
48
  deprecatedPackages++;
49
49
  issues.push({
50
- type: 'dependency-health',
51
- severity: 'major',
50
+ type: IssueType.DependencyHealth,
51
+ severity: Severity.Major,
52
52
  message: `Dependency '${name}' is known to be deprecated. AI assistants may use outdated APIs.`,
53
53
  location: { file: packageJsonPath, line: 1 },
54
54
  });
@@ -58,8 +58,8 @@ export async function analyzeDeps(options: DepsOptions): Promise<DepsReport> {
58
58
  if (major === 0) {
59
59
  outdatedPackages++;
60
60
  issues.push({
61
- type: 'dependency-health',
62
- severity: 'minor',
61
+ type: IssueType.DependencyHealth,
62
+ severity: Severity.Minor,
63
63
  message: `Dependency '${name}' (${version}) is pre-v1. APIs often unstable and hard for AI to predict.`,
64
64
  location: { file: packageJsonPath, line: 1 },
65
65
  });
package/src/types.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { ScanOptions, Issue } from '@aiready/core';
1
+ import type { ScanOptions, Issue, IssueType } from '@aiready/core';
2
2
 
3
3
  export interface DepsOptions extends ScanOptions {
4
4
  /** The year the AI model was trained. Defaults to 2023. */
@@ -6,7 +6,7 @@ export interface DepsOptions extends ScanOptions {
6
6
  }
7
7
 
8
8
  export interface DepsIssue extends Issue {
9
- type: 'dependency-health';
9
+ type: IssueType.DependencyHealth;
10
10
  }
11
11
 
12
12
  export interface DepsReport {