@aiready/cli 0.9.9 → 0.9.10

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/cli@0.9.9 build /Users/pengcao/projects/aiready/packages/cli
3
+ > @aiready/cli@0.9.10 build /Users/pengcao/projects/aiready/packages/cli
4
4
  > tsup src/index.ts src/cli.ts --format cjs,esm
5
5
 
6
6
  CLI Building entry: src/cli.ts, src/index.ts
@@ -9,10 +9,10 @@
9
9
  CLI Target: es2020
10
10
  CJS Build start
11
11
  ESM Build start
12
- CJS dist/cli.js 58.06 KB
12
+ CJS dist/cli.js 58.90 KB
13
13
  CJS dist/index.js 4.93 KB
14
- CJS ⚡️ Build success in 26ms
14
+ CJS ⚡️ Build success in 241ms
15
+ ESM dist/cli.mjs 51.71 KB
16
+ ESM dist/chunk-5GZDRZ3T.mjs 4.17 KB
15
17
  ESM dist/index.mjs 138.00 B
16
- ESM dist/chunk-3SG2GLFJ.mjs 3.80 KB
17
- ESM dist/cli.mjs 50.92 KB
18
- ESM ⚡️ Build success in 26ms
18
+ ESM ⚡️ Build success in 241ms
@@ -1,17 +1,17 @@
1
1
 
2
2
  
3
- > @aiready/cli@0.9.9 test /Users/pengcao/projects/aiready/packages/cli
3
+ > @aiready/cli@0.9.10 test /Users/pengcao/projects/aiready/packages/cli
4
4
  > vitest run
5
5
 
6
6
  [?25l
7
7
   RUN  v4.0.18 /Users/pengcao/projects/aiready/packages/cli
8
8
 
9
- ✓ src/__tests__/cli.test.ts (3 tests) 3ms
10
- ✓ dist/__tests__/cli.test.js (3 tests) 2ms
9
+ ✓ src/__tests__/cli.test.ts (3 tests) 25ms
10
+ ✓ dist/__tests__/cli.test.js (3 tests) 10ms
11
11
 
12
12
   Test Files  2 passed (2)
13
13
   Tests  6 passed (6)
14
-  Start at  14:29:26
15
-  Duration  4.74s (transform 2.90s, setup 0ms, import 7.46s, tests 5ms, environment 0ms)
14
+  Start at  23:15:00
15
+  Duration  7.43s (transform 1.74s, setup 0ms, import 10.27s, tests 35ms, environment 0ms)
16
16
 
17
17
  [?25h
package/dist/cli.js CHANGED
@@ -976,14 +976,33 @@ function generateHTML(graph) {
976
976
  </body>
977
977
  </html>`;
978
978
  }
979
+ function findLatestScanReport(dirPath) {
980
+ const aireadyDir = (0, import_path2.resolve)(dirPath, ".aiready");
981
+ if (!(0, import_fs2.existsSync)(aireadyDir)) {
982
+ return null;
983
+ }
984
+ const { readdirSync, statSync } = require("fs");
985
+ const files = readdirSync(aireadyDir).filter((f) => f.startsWith("aiready-scan-") && f.endsWith(".json"));
986
+ if (files.length === 0) {
987
+ return null;
988
+ }
989
+ const sortedFiles = files.map((f) => ({ name: f, path: (0, import_path2.resolve)(aireadyDir, f), mtime: statSync((0, import_path2.resolve)(aireadyDir, f)).mtime })).sort((a, b) => b.mtime.getTime() - a.mtime.getTime());
990
+ return sortedFiles[0].path;
991
+ }
979
992
  async function handleVisualize(directory, options) {
980
993
  try {
981
994
  const dirPath = (0, import_path2.resolve)(process.cwd(), directory || ".");
982
- const reportPath = (0, import_path2.resolve)(dirPath, options.report || "aiready-improvement-report.json");
995
+ let reportPath = (0, import_path2.resolve)(dirPath, options.report || "aiready-improvement-report.json");
983
996
  if (!(0, import_fs2.existsSync)(reportPath)) {
984
- console.error("Report not found at", reportPath);
985
- console.log("Run `aiready scan` to generate the report, or pass --report");
986
- return;
997
+ const latestScan = findLatestScanReport(dirPath);
998
+ if (latestScan) {
999
+ console.log(`Using latest scan report: ${latestScan}`);
1000
+ reportPath = latestScan;
1001
+ } else {
1002
+ console.error("Report not found at", reportPath);
1003
+ console.log("Run `aiready scan --output json` to generate the report, or pass --report");
1004
+ return;
1005
+ }
987
1006
  }
988
1007
  const raw = (0, import_fs2.readFileSync)(reportPath, "utf8");
989
1008
  const report = JSON.parse(raw);
package/dist/cli.mjs CHANGED
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
+ __require,
3
4
  analyzeUnified
4
- } from "./chunk-3SG2GLFJ.mjs";
5
+ } from "./chunk-5GZDRZ3T.mjs";
5
6
 
6
7
  // src/cli.ts
7
8
  import { Command } from "commander";
@@ -880,14 +881,33 @@ function generateHTML(graph) {
880
881
  </body>
881
882
  </html>`;
882
883
  }
884
+ function findLatestScanReport(dirPath) {
885
+ const aireadyDir = resolvePath(dirPath, ".aiready");
886
+ if (!existsSync(aireadyDir)) {
887
+ return null;
888
+ }
889
+ const { readdirSync, statSync } = __require("fs");
890
+ const files = readdirSync(aireadyDir).filter((f) => f.startsWith("aiready-scan-") && f.endsWith(".json"));
891
+ if (files.length === 0) {
892
+ return null;
893
+ }
894
+ const sortedFiles = files.map((f) => ({ name: f, path: resolvePath(aireadyDir, f), mtime: statSync(resolvePath(aireadyDir, f)).mtime })).sort((a, b) => b.mtime.getTime() - a.mtime.getTime());
895
+ return sortedFiles[0].path;
896
+ }
883
897
  async function handleVisualize(directory, options) {
884
898
  try {
885
899
  const dirPath = resolvePath(process.cwd(), directory || ".");
886
- const reportPath = resolvePath(dirPath, options.report || "aiready-improvement-report.json");
900
+ let reportPath = resolvePath(dirPath, options.report || "aiready-improvement-report.json");
887
901
  if (!existsSync(reportPath)) {
888
- console.error("Report not found at", reportPath);
889
- console.log("Run `aiready scan` to generate the report, or pass --report");
890
- return;
902
+ const latestScan = findLatestScanReport(dirPath);
903
+ if (latestScan) {
904
+ console.log(`Using latest scan report: ${latestScan}`);
905
+ reportPath = latestScan;
906
+ } else {
907
+ console.error("Report not found at", reportPath);
908
+ console.log("Run `aiready scan --output json` to generate the report, or pass --report");
909
+ return;
910
+ }
891
911
  }
892
912
  const raw = readFileSync(reportPath, "utf8");
893
913
  const report = JSON.parse(raw);
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  analyzeUnified,
3
3
  generateUnifiedSummary
4
- } from "./chunk-3SG2GLFJ.mjs";
4
+ } from "./chunk-5GZDRZ3T.mjs";
5
5
  export {
6
6
  analyzeUnified,
7
7
  generateUnifiedSummary
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiready/cli",
3
- "version": "0.9.9",
3
+ "version": "0.9.10",
4
4
  "description": "Unified CLI for AIReady analysis tools",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -11,11 +11,11 @@
11
11
  "dependencies": {
12
12
  "commander": "^14.0.0",
13
13
  "chalk": "^5.3.0",
14
- "@aiready/visualizer": "0.1.7",
15
- "@aiready/pattern-detect": "0.11.8",
16
- "@aiready/consistency": "0.8.8",
17
- "@aiready/core": "0.9.8",
18
- "@aiready/context-analyzer": "0.9.8"
14
+ "@aiready/core": "0.9.9",
15
+ "@aiready/context-analyzer": "0.9.9",
16
+ "@aiready/consistency": "0.8.9",
17
+ "@aiready/visualizer": "0.1.8",
18
+ "@aiready/pattern-detect": "0.11.9"
19
19
  },
20
20
  "devDependencies": {
21
21
  "tsup": "^8.3.5",
package/src/cli.ts CHANGED
@@ -1087,14 +1087,46 @@ program
1087
1087
  </html>`;
1088
1088
  }
1089
1089
 
1090
+ /**
1091
+ * Find the latest aiready scan report in the .aiready directory
1092
+ */
1093
+ function findLatestScanReport(dirPath: string): string | null {
1094
+ const aireadyDir = resolvePath(dirPath, '.aiready');
1095
+ if (!existsSync(aireadyDir)) {
1096
+ return null;
1097
+ }
1098
+
1099
+ const { readdirSync, statSync } = require('fs');
1100
+ const files = readdirSync(aireadyDir).filter(f => f.startsWith('aiready-scan-') && f.endsWith('.json'));
1101
+
1102
+ if (files.length === 0) {
1103
+ return null;
1104
+ }
1105
+
1106
+ // Sort by modification time, most recent first
1107
+ const sortedFiles = files
1108
+ .map(f => ({ name: f, path: resolvePath(aireadyDir, f), mtime: statSync(resolvePath(aireadyDir, f)).mtime }))
1109
+ .sort((a, b) => b.mtime.getTime() - a.mtime.getTime());
1110
+
1111
+ return sortedFiles[0].path;
1112
+ }
1113
+
1090
1114
  async function handleVisualize(directory: string | undefined, options: any) {
1091
1115
  try {
1092
1116
  const dirPath = resolvePath(process.cwd(), directory || '.');
1093
- const reportPath = resolvePath(dirPath, options.report || 'aiready-improvement-report.json');
1117
+ let reportPath = resolvePath(dirPath, options.report || 'aiready-improvement-report.json');
1118
+
1119
+ // If report not found, try to find latest scan report
1094
1120
  if (!existsSync(reportPath)) {
1095
- console.error('Report not found at', reportPath);
1096
- console.log('Run `aiready scan` to generate the report, or pass --report');
1097
- return;
1121
+ const latestScan = findLatestScanReport(dirPath);
1122
+ if (latestScan) {
1123
+ console.log(`Using latest scan report: ${latestScan}`);
1124
+ reportPath = latestScan;
1125
+ } else {
1126
+ console.error('Report not found at', reportPath);
1127
+ console.log('Run `aiready scan --output json` to generate the report, or pass --report');
1128
+ return;
1129
+ }
1098
1130
  }
1099
1131
 
1100
1132
  const raw = readFileSync(reportPath, 'utf8');