@aiready/cli 0.14.1 → 0.14.3

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 (33) hide show
  1. package/.aiready/aiready-report-20260314-164626.json +2 -5
  2. package/.aiready/aiready-report-20260314-164741.json +2 -5
  3. package/.turbo/turbo-build.log +7 -7
  4. package/.turbo/turbo-test.log +19 -110
  5. package/dist/cli.js +149 -125
  6. package/dist/cli.mjs +69 -45
  7. package/package.json +12 -12
  8. package/packages/core/src/.aiready/aiready-report-20260314-161145.json +4 -10
  9. package/packages/core/src/.aiready/aiready-report-20260314-161152.json +10 -28
  10. package/packages/pattern-detect/src/.aiready/aiready-report-20260314-161139.json +4 -10
  11. package/src/.aiready/aiready-report-20260312-103623.json +3 -9
  12. package/src/.aiready/aiready-report-20260312-110843.json +3 -9
  13. package/src/.aiready/aiready-report-20260312-110955.json +3 -9
  14. package/src/.aiready/aiready-report-20260314-203209.json +30713 -0
  15. package/src/.aiready/aiready-report-20260314-203736.json +30713 -0
  16. package/src/.aiready/aiready-report-20260314-203857.json +30713 -0
  17. package/src/.aiready/aiready-report-20260314-204047.json +30713 -0
  18. package/src/__tests__/config-shape.test.ts +1 -1
  19. package/src/cli.ts +2 -1
  20. package/src/commands/__tests__/consistency.test.ts +3 -0
  21. package/src/commands/__tests__/extra-commands.test.ts +29 -37
  22. package/src/commands/__tests__/scan.test.ts +3 -1
  23. package/src/commands/__tests__/visualize.test.ts +3 -7
  24. package/src/commands/ai-signal-clarity.ts +1 -56
  25. package/src/commands/deps-health.ts +1 -65
  26. package/src/commands/doc-drift.ts +1 -62
  27. package/src/commands/init.ts +62 -2
  28. package/src/commands/scan.ts +11 -8
  29. package/src/commands/shared/configured-tool-action.ts +35 -0
  30. package/src/commands/shared/standard-tool-actions.ts +126 -0
  31. package/src/commands/visualize.ts +2 -3
  32. package/src/utils/helpers.ts +85 -36
  33. package/vitest.config.ts +5 -12
package/dist/cli.js CHANGED
@@ -33,7 +33,7 @@ var import_url = require("url");
33
33
  var import_chalk3 = __toESM(require("chalk"));
34
34
  var import_fs3 = require("fs");
35
35
  var import_path3 = require("path");
36
- var import_core3 = require("@aiready/core");
36
+ var import_core5 = require("@aiready/core");
37
37
 
38
38
  // src/index.ts
39
39
  var import_core = require("@aiready/core");
@@ -294,34 +294,13 @@ async function scoreUnified(results, options) {
294
294
  var import_path = require("path");
295
295
  var import_fs = require("fs");
296
296
  var import_chalk = __toESM(require("chalk"));
297
+ var import_core2 = require("@aiready/core");
298
+ var import_core3 = require("@aiready/core");
297
299
  function getReportTimestamp() {
298
300
  const now = /* @__PURE__ */ new Date();
299
301
  const pad = (n) => String(n).padStart(2, "0");
300
302
  return `${now.getFullYear()}${pad(now.getMonth() + 1)}${pad(now.getDate())}-${pad(now.getHours())}${pad(now.getMinutes())}${pad(now.getSeconds())}`;
301
303
  }
302
- function findLatestScanReport(dirPath) {
303
- const aireadyDir = (0, import_path.resolve)(dirPath, ".aiready");
304
- if (!(0, import_fs.existsSync)(aireadyDir)) {
305
- return null;
306
- }
307
- let files = (0, import_fs.readdirSync)(aireadyDir).filter(
308
- (f) => f.startsWith("aiready-report-") && f.endsWith(".json")
309
- );
310
- if (files.length === 0) {
311
- files = (0, import_fs.readdirSync)(aireadyDir).filter(
312
- (f) => f.startsWith("aiready-scan-") && f.endsWith(".json")
313
- );
314
- }
315
- if (files.length === 0) {
316
- return null;
317
- }
318
- const sortedFiles = files.map((f) => ({
319
- name: f,
320
- path: (0, import_path.resolve)(aireadyDir, f),
321
- mtime: (0, import_fs.statSync)((0, import_path.resolve)(aireadyDir, f)).mtime
322
- })).sort((a, b) => b.mtime.getTime() - a.mtime.getTime());
323
- return sortedFiles[0].path;
324
- }
325
304
  async function warnIfGraphCapExceeded(report, dirPath) {
326
305
  try {
327
306
  const { loadConfig: loadConfig4 } = await import("@aiready/core");
@@ -412,7 +391,7 @@ function generateMarkdownReport(report, elapsedTime) {
412
391
  var import_fs2 = __toESM(require("fs"));
413
392
  var import_path2 = require("path");
414
393
  var import_chalk2 = __toESM(require("chalk"));
415
- var import_core2 = require("@aiready/core");
394
+ var import_core4 = require("@aiready/core");
416
395
  async function uploadAction(file, options) {
417
396
  const startTime = Date.now();
418
397
  const filePath = (0, import_path2.resolve)(process.cwd(), file);
@@ -497,7 +476,7 @@ async function uploadAction(file, options) {
497
476
  console.log(import_chalk2.default.dim(` Score: ${result.analysis.aiScore}/100`));
498
477
  }
499
478
  } catch (error) {
500
- (0, import_core2.handleCLIError)(error, "Upload");
479
+ (0, import_core4.handleCLIError)(error, "Upload");
501
480
  }
502
481
  }
503
482
  var uploadHelpText = `
@@ -516,7 +495,7 @@ async function scanAction(directory, options) {
516
495
  console.log(import_chalk3.default.blue("\u{1F680} Starting AIReady unified analysis...\n"));
517
496
  const startTime = Date.now();
518
497
  const resolvedDir = (0, import_path3.resolve)(process.cwd(), directory || ".");
519
- const repoMetadata = (0, import_core3.getRepoMetadata)(resolvedDir);
498
+ const repoMetadata = (0, import_core5.getRepoMetadata)(resolvedDir);
520
499
  try {
521
500
  const defaults = {
522
501
  tools: [
@@ -542,43 +521,43 @@ async function scanAction(directory, options) {
542
521
  switch (options.profile.toLowerCase()) {
543
522
  case "agentic":
544
523
  profileTools = [
545
- import_core3.ToolName.AiSignalClarity,
546
- import_core3.ToolName.AgentGrounding,
547
- import_core3.ToolName.TestabilityIndex
524
+ import_core5.ToolName.AiSignalClarity,
525
+ import_core5.ToolName.AgentGrounding,
526
+ import_core5.ToolName.TestabilityIndex
548
527
  ];
549
528
  break;
550
529
  case "cost":
551
- profileTools = [import_core3.ToolName.PatternDetect, import_core3.ToolName.ContextAnalyzer];
530
+ profileTools = [import_core5.ToolName.PatternDetect, import_core5.ToolName.ContextAnalyzer];
552
531
  break;
553
532
  case "logic":
554
533
  profileTools = [
555
- import_core3.ToolName.TestabilityIndex,
556
- import_core3.ToolName.NamingConsistency,
557
- import_core3.ToolName.ContextAnalyzer,
558
- import_core3.ToolName.PatternDetect,
559
- import_core3.ToolName.ChangeAmplification
534
+ import_core5.ToolName.TestabilityIndex,
535
+ import_core5.ToolName.NamingConsistency,
536
+ import_core5.ToolName.ContextAnalyzer,
537
+ import_core5.ToolName.PatternDetect,
538
+ import_core5.ToolName.ChangeAmplification
560
539
  ];
561
540
  break;
562
541
  case "ui":
563
542
  profileTools = [
564
- import_core3.ToolName.NamingConsistency,
565
- import_core3.ToolName.ContextAnalyzer,
566
- import_core3.ToolName.PatternDetect,
567
- import_core3.ToolName.DocDrift,
568
- import_core3.ToolName.AiSignalClarity
543
+ import_core5.ToolName.NamingConsistency,
544
+ import_core5.ToolName.ContextAnalyzer,
545
+ import_core5.ToolName.PatternDetect,
546
+ import_core5.ToolName.DocDrift,
547
+ import_core5.ToolName.AiSignalClarity
569
548
  ];
570
549
  break;
571
550
  case "security":
572
551
  profileTools = [
573
- import_core3.ToolName.NamingConsistency,
574
- import_core3.ToolName.TestabilityIndex
552
+ import_core5.ToolName.NamingConsistency,
553
+ import_core5.ToolName.TestabilityIndex
575
554
  ];
576
555
  break;
577
556
  case "onboarding":
578
557
  profileTools = [
579
- import_core3.ToolName.ContextAnalyzer,
580
- import_core3.ToolName.NamingConsistency,
581
- import_core3.ToolName.AgentGrounding
558
+ import_core5.ToolName.ContextAnalyzer,
559
+ import_core5.ToolName.NamingConsistency,
560
+ import_core5.ToolName.AgentGrounding
582
561
  ];
583
562
  break;
584
563
  default:
@@ -595,22 +574,22 @@ async function scanAction(directory, options) {
595
574
  exclude: options.exclude?.split(",")
596
575
  };
597
576
  if (profileTools) cliOverrides.tools = profileTools;
598
- const baseOptions = await (0, import_core3.loadMergedConfig)(
577
+ const baseOptions = await (0, import_core5.loadMergedConfig)(
599
578
  resolvedDir,
600
579
  defaults,
601
580
  cliOverrides
602
581
  );
603
- let finalOptions = { ...baseOptions };
604
- if (baseOptions.tools.includes(import_core3.ToolName.PatternDetect) || baseOptions.tools.includes("patterns")) {
582
+ const finalOptions = { ...baseOptions };
583
+ if (baseOptions.tools.includes(import_core5.ToolName.PatternDetect) || baseOptions.tools.includes("patterns")) {
605
584
  const { getSmartDefaults } = await import("@aiready/pattern-detect");
606
585
  const patternSmartDefaults = await getSmartDefaults(
607
586
  resolvedDir,
608
- finalOptions.toolConfigs?.[import_core3.ToolName.PatternDetect] || {}
587
+ finalOptions.toolConfigs?.[import_core5.ToolName.PatternDetect] || {}
609
588
  );
610
589
  if (!finalOptions.toolConfigs) finalOptions.toolConfigs = {};
611
- finalOptions.toolConfigs[import_core3.ToolName.PatternDetect] = {
590
+ finalOptions.toolConfigs[import_core5.ToolName.PatternDetect] = {
612
591
  ...patternSmartDefaults,
613
- ...finalOptions.toolConfigs[import_core3.ToolName.PatternDetect]
592
+ ...finalOptions.toolConfigs[import_core5.ToolName.PatternDetect]
614
593
  };
615
594
  }
616
595
  console.log(import_chalk3.default.cyan("\n=== AIReady Run Preview ==="));
@@ -662,7 +641,7 @@ async function scanAction(directory, options) {
662
641
  }
663
642
  });
664
643
  console.log(import_chalk3.default.bold("\n\u{1F4CA} AI Readiness Overall Score"));
665
- console.log(` ${(0, import_core3.formatScore)(scoringResult)}`);
644
+ console.log(` ${(0, import_core5.formatScore)(scoringResult)}`);
666
645
  console.log(import_chalk3.default.dim(` (Scoring Profile: ${scoringProfile})`));
667
646
  if (options.compareTo) {
668
647
  try {
@@ -711,7 +690,7 @@ async function scanAction(directory, options) {
711
690
  0
712
691
  );
713
692
  if (totalContext > 0) {
714
- const unifiedBudget = (0, import_core3.calculateTokenBudget)({
693
+ const unifiedBudget = (0, import_core5.calculateTokenBudget)({
715
694
  totalContextTokens: totalContext,
716
695
  wastedTokens: {
717
696
  duplication: totalWastedDuplication,
@@ -760,8 +739,8 @@ async function scanAction(directory, options) {
760
739
  if (scoringResult.breakdown) {
761
740
  console.log(import_chalk3.default.bold("\nTool breakdown:"));
762
741
  scoringResult.breakdown.forEach((tool) => {
763
- const rating = (0, import_core3.getRating)(tool.score);
764
- const emoji = (0, import_core3.getRatingDisplay)(rating).emoji;
742
+ const rating = (0, import_core5.getRating)(tool.score);
743
+ const emoji = (0, import_core5.getRatingDisplay)(rating).emoji;
765
744
  console.log(
766
745
  ` - ${tool.toolName}: ${tool.score}/100 (${rating}) ${emoji}`
767
746
  );
@@ -812,8 +791,8 @@ async function scanAction(directory, options) {
812
791
  totalFilesSet.add(r.fileName);
813
792
  allResults.push(r);
814
793
  r.issues?.forEach((i) => {
815
- if (i.severity === import_core3.Severity.Critical) criticalCount++;
816
- if (i.severity === import_core3.Severity.Major) majorCount++;
794
+ if (i.severity === import_core5.Severity.Critical) criticalCount++;
795
+ if (i.severity === import_core5.Severity.Major) majorCount++;
817
796
  });
818
797
  });
819
798
  });
@@ -834,13 +813,13 @@ async function scanAction(directory, options) {
834
813
  repository: repoMetadata
835
814
  };
836
815
  const outputFormat = options.output || finalOptions.output?.format || "console";
837
- const outputPath = (0, import_core3.resolveOutputPath)(
816
+ const outputPath = (0, import_core5.resolveOutputPath)(
838
817
  options.outputFile || finalOptions.output?.file,
839
818
  `aiready-report-${getReportTimestamp()}.json`,
840
819
  resolvedDir
841
820
  );
842
821
  if (outputFormat === "json") {
843
- (0, import_core3.handleJSONOutput)(
822
+ (0, import_core5.handleJSONOutput)(
844
823
  outputData,
845
824
  outputPath,
846
825
  `\u2705 Report saved to ${outputPath}`
@@ -860,21 +839,21 @@ async function scanAction(directory, options) {
860
839
  });
861
840
  }
862
841
  await warnIfGraphCapExceeded(outputData, resolvedDir);
863
- const isCI = options.ci || process.env.CI === "true";
864
- if (isCI && scoringResult) {
842
+ if (scoringResult) {
865
843
  const threshold = options.threshold ? parseInt(options.threshold) : void 0;
866
844
  const failOnLevel = options.failOn || "critical";
845
+ const isCI = options.ci || process.env.CI === "true";
867
846
  let shouldFail = false;
868
847
  let failReason = "";
869
848
  const report = mapToUnifiedReport(results, scoringResult);
870
- if (report.results && report.results.length > 0) {
849
+ if (isCI && report.results && report.results.length > 0) {
871
850
  console.log(
872
851
  import_chalk3.default.cyan(
873
852
  `
874
853
  \u{1F4DD} Emitting GitHub Action annotations for ${report.results.length} issues...`
875
854
  )
876
855
  );
877
- (0, import_core3.emitIssuesAsAnnotations)(report.results);
856
+ (0, import_core5.emitIssuesAsAnnotations)(report.results);
878
857
  }
879
858
  if (threshold && scoringResult.overall < threshold) {
880
859
  shouldFail = true;
@@ -891,14 +870,14 @@ async function scanAction(directory, options) {
891
870
  }
892
871
  if (shouldFail) {
893
872
  console.log(import_chalk3.default.red(`
894
- \u{1F6AB} PR BLOCKED: ${failReason}`));
873
+ \u{1F6AB} SCAN FAILED: ${failReason}`));
895
874
  process.exit(1);
896
875
  } else {
897
- console.log(import_chalk3.default.green("\n\u2705 PR PASSED"));
876
+ console.log(import_chalk3.default.green("\n\u2705 SCAN PASSED"));
898
877
  }
899
878
  }
900
879
  } catch (error) {
901
- (0, import_core3.handleCLIError)(error, "Analysis");
880
+ (0, import_core5.handleCLIError)(error, "Analysis");
902
881
  }
903
882
  }
904
883
  var scanHelpText = `...`;
@@ -907,7 +886,7 @@ var scanHelpText = `...`;
907
886
  var import_fs4 = require("fs");
908
887
  var import_path4 = require("path");
909
888
  var import_chalk4 = __toESM(require("chalk"));
910
- var import_core4 = require("@aiready/core");
889
+ var import_core6 = require("@aiready/core");
911
890
  async function initAction(options) {
912
891
  const fileExt = options.format === "js" ? "js" : "json";
913
892
  const fileName = fileExt === "js" ? "aiready.config.js" : "aiready.json";
@@ -918,7 +897,7 @@ async function initAction(options) {
918
897
  );
919
898
  process.exit(1);
920
899
  }
921
- const defaultConfig = {
900
+ const baseConfig = {
922
901
  scan: {
923
902
  include: [
924
903
  "src/**/*.ts",
@@ -934,42 +913,88 @@ async function initAction(options) {
934
913
  "**/*.spec.ts"
935
914
  ],
936
915
  tools: [
937
- import_core4.ToolName.PatternDetect,
938
- import_core4.ToolName.ContextAnalyzer,
939
- import_core4.ToolName.NamingConsistency,
940
- import_core4.ToolName.AiSignalClarity,
941
- import_core4.ToolName.AgentGrounding,
942
- import_core4.ToolName.TestabilityIndex,
943
- import_core4.ToolName.DocDrift,
944
- import_core4.ToolName.DependencyHealth,
945
- import_core4.ToolName.ChangeAmplification
916
+ import_core6.ToolName.PatternDetect,
917
+ import_core6.ToolName.ContextAnalyzer,
918
+ import_core6.ToolName.NamingConsistency,
919
+ import_core6.ToolName.AiSignalClarity,
920
+ import_core6.ToolName.AgentGrounding,
921
+ import_core6.ToolName.TestabilityIndex,
922
+ import_core6.ToolName.DocDrift,
923
+ import_core6.ToolName.DependencyHealth,
924
+ import_core6.ToolName.ChangeAmplification
946
925
  ]
947
926
  },
948
927
  tools: {
949
- [import_core4.ToolName.PatternDetect]: {
928
+ [import_core6.ToolName.PatternDetect]: {
950
929
  minSimilarity: 0.8,
951
- minLines: 5
930
+ minLines: 5,
931
+ ...options.full ? {
932
+ batchSize: 50,
933
+ approx: true,
934
+ minSharedTokens: 10,
935
+ maxCandidatesPerBlock: 100
936
+ } : {}
952
937
  },
953
- [import_core4.ToolName.ContextAnalyzer]: {
938
+ [import_core6.ToolName.ContextAnalyzer]: {
954
939
  maxContextBudget: 128e3,
955
- minCohesion: 0.6
940
+ minCohesion: 0.6,
941
+ ...options.full ? {
942
+ maxDepth: 7,
943
+ maxFragmentation: 0.4,
944
+ focus: "all",
945
+ includeNodeModules: false
946
+ } : {}
956
947
  },
957
- [import_core4.ToolName.NamingConsistency]: {
958
- shortWords: ["id", "db", "ui", "ai"]
948
+ [import_core6.ToolName.NamingConsistency]: {
949
+ shortWords: ["id", "db", "ui", "ai"],
950
+ ...options.full ? { acceptedAbbreviations: [], disableChecks: [] } : {}
959
951
  },
960
- [import_core4.ToolName.AiSignalClarity]: {
952
+ [import_core6.ToolName.AiSignalClarity]: {
961
953
  checkMagicLiterals: true,
962
954
  checkBooleanTraps: true,
963
955
  checkAmbiguousNames: true,
964
- checkUndocumentedExports: true
965
- }
956
+ checkUndocumentedExports: true,
957
+ ...options.full ? { checkImplicitSideEffects: false, checkDeepCallbacks: false } : {}
958
+ },
959
+ ...options.full ? {
960
+ [import_core6.ToolName.AgentGrounding]: {
961
+ maxRecommendedDepth: 5,
962
+ readmeStaleDays: 30
963
+ },
964
+ [import_core6.ToolName.TestabilityIndex]: {
965
+ minCoverageRatio: 0.7,
966
+ testPatterns: ["**/*.test.ts", "**/__tests__/**"]
967
+ },
968
+ [import_core6.ToolName.DocDrift]: {
969
+ maxCommits: 50,
970
+ staleMonths: 3
971
+ },
972
+ [import_core6.ToolName.DependencyHealth]: {
973
+ trainingCutoffYear: 2023
974
+ }
975
+ } : {}
966
976
  },
967
977
  scoring: {
968
978
  threshold: 70,
969
- showBreakdown: true
970
- }
979
+ showBreakdown: true,
980
+ ...options.full ? { profile: "default" } : {}
981
+ },
982
+ ...options.full ? {
983
+ output: {
984
+ format: fileExt,
985
+ file: "aiready-report.json"
986
+ },
987
+ visualizer: {
988
+ groupingDirs: ["packages", "src", "lib"],
989
+ graph: {
990
+ maxNodes: 5e3,
991
+ maxEdges: 1e4
992
+ }
993
+ }
994
+ } : {}
971
995
  };
972
- let content = "";
996
+ const defaultConfig = baseConfig;
997
+ let content;
973
998
  if (fileExt === "js") {
974
999
  content = `/** @type {import('@aiready/core').AIReadyConfig} */
975
1000
  module.exports = ${JSON.stringify(
@@ -1001,7 +1026,7 @@ module.exports = ${JSON.stringify(
1001
1026
  // src/commands/patterns.ts
1002
1027
  var import_chalk5 = __toESM(require("chalk"));
1003
1028
  var import_path5 = require("path");
1004
- var import_core5 = require("@aiready/core");
1029
+ var import_core7 = require("@aiready/core");
1005
1030
  async function patternsAction(directory, options) {
1006
1031
  console.log(import_chalk5.default.blue("\u{1F50D} Analyzing patterns...\n"));
1007
1032
  const startTime = Date.now();
@@ -1034,14 +1059,14 @@ async function patternsAction(directory, options) {
1034
1059
  if (options.minSharedTokens) {
1035
1060
  cliOptions.minSharedTokens = parseInt(options.minSharedTokens);
1036
1061
  }
1037
- const finalOptions = await (0, import_core5.loadMergedConfig)(
1062
+ const finalOptions = await (0, import_core7.loadMergedConfig)(
1038
1063
  resolvedDir,
1039
1064
  defaults,
1040
1065
  cliOptions
1041
1066
  );
1042
1067
  const { analyzePatterns, generateSummary, calculatePatternScore } = await import("@aiready/pattern-detect");
1043
1068
  const { results, duplicates } = await analyzePatterns(finalOptions);
1044
- const elapsedTime = (0, import_core5.getElapsedTime)(startTime);
1069
+ const elapsedTime = (0, import_core7.getElapsedTime)(startTime);
1045
1070
  const summary = generateSummary(results);
1046
1071
  let patternScore;
1047
1072
  if (options.score) {
@@ -1055,12 +1080,12 @@ async function patternsAction(directory, options) {
1055
1080
  summary: { ...summary, executionTime: parseFloat(elapsedTime) },
1056
1081
  ...patternScore && { scoring: patternScore }
1057
1082
  };
1058
- const outputPath = (0, import_core5.resolveOutputPath)(
1083
+ const outputPath = (0, import_core7.resolveOutputPath)(
1059
1084
  userOutputFile,
1060
1085
  `aiready-report-${getReportTimestamp()}.json`,
1061
1086
  resolvedDir
1062
1087
  );
1063
- (0, import_core5.handleJSONOutput)(
1088
+ (0, import_core7.handleJSONOutput)(
1064
1089
  outputData,
1065
1090
  outputPath,
1066
1091
  `\u2705 Results saved to ${outputPath}`
@@ -1127,12 +1152,12 @@ async function patternsAction(directory, options) {
1127
1152
  console.log(import_chalk5.default.cyan(divider));
1128
1153
  console.log(import_chalk5.default.bold.white(" AI READINESS SCORE (Patterns)"));
1129
1154
  console.log(import_chalk5.default.cyan(divider) + "\n");
1130
- console.log((0, import_core5.formatToolScore)(patternScore));
1155
+ console.log((0, import_core7.formatToolScore)(patternScore));
1131
1156
  console.log();
1132
1157
  }
1133
1158
  }
1134
1159
  } catch (error) {
1135
- (0, import_core5.handleCLIError)(error, "Pattern analysis");
1160
+ (0, import_core7.handleCLIError)(error, "Pattern analysis");
1136
1161
  }
1137
1162
  }
1138
1163
  var patternsHelpText = `
@@ -1145,7 +1170,7 @@ EXAMPLES:
1145
1170
  // src/commands/context.ts
1146
1171
  var import_chalk6 = __toESM(require("chalk"));
1147
1172
  var import_path6 = require("path");
1148
- var import_core6 = require("@aiready/core");
1173
+ var import_core8 = require("@aiready/core");
1149
1174
  async function contextAction(directory, options) {
1150
1175
  console.log(import_chalk6.default.blue("\u{1F9E0} Analyzing context costs...\n"));
1151
1176
  const startTime = Date.now();
@@ -1161,7 +1186,7 @@ async function contextAction(directory, options) {
1161
1186
  file: void 0
1162
1187
  }
1163
1188
  };
1164
- const baseOptions = await (0, import_core6.loadMergedConfig)(resolvedDir, defaults, {
1189
+ const baseOptions = await (0, import_core8.loadMergedConfig)(resolvedDir, defaults, {
1165
1190
  maxDepth: options.maxDepth ? parseInt(options.maxDepth) : void 0,
1166
1191
  maxContextBudget: options.maxContext ? parseInt(options.maxContext) : void 0,
1167
1192
  include: options.include?.split(","),
@@ -1187,7 +1212,7 @@ async function contextAction(directory, options) {
1187
1212
  console.log("");
1188
1213
  const { analyzeContext, generateSummary, calculateContextScore } = await import("@aiready/context-analyzer");
1189
1214
  const results = await analyzeContext(finalOptions);
1190
- const elapsedTime = (0, import_core6.getElapsedTime)(startTime);
1215
+ const elapsedTime = (0, import_core8.getElapsedTime)(startTime);
1191
1216
  const summary = generateSummary(results);
1192
1217
  let contextScore;
1193
1218
  if (options.score) {
@@ -1201,12 +1226,12 @@ async function contextAction(directory, options) {
1201
1226
  summary: { ...summary, executionTime: parseFloat(elapsedTime) },
1202
1227
  ...contextScore && { scoring: contextScore }
1203
1228
  };
1204
- const outputPath = (0, import_core6.resolveOutputPath)(
1229
+ const outputPath = (0, import_core8.resolveOutputPath)(
1205
1230
  userOutputFile,
1206
1231
  `aiready-report-${getReportTimestamp()}.json`,
1207
1232
  resolvedDir
1208
1233
  );
1209
- (0, import_core6.handleJSONOutput)(
1234
+ (0, import_core8.handleJSONOutput)(
1210
1235
  outputData,
1211
1236
  outputPath,
1212
1237
  `\u2705 Results saved to ${outputPath}`
@@ -1333,12 +1358,12 @@ async function contextAction(directory, options) {
1333
1358
  console.log(import_chalk6.default.cyan(divider));
1334
1359
  console.log(import_chalk6.default.bold.white(" AI READINESS SCORE (Context)"));
1335
1360
  console.log(import_chalk6.default.cyan(divider) + "\n");
1336
- console.log((0, import_core6.formatToolScore)(contextScore));
1361
+ console.log((0, import_core8.formatToolScore)(contextScore));
1337
1362
  console.log();
1338
1363
  }
1339
1364
  }
1340
1365
  } catch (error) {
1341
- (0, import_core6.handleCLIError)(error, "Context analysis");
1366
+ (0, import_core8.handleCLIError)(error, "Context analysis");
1342
1367
  }
1343
1368
  }
1344
1369
 
@@ -1346,7 +1371,7 @@ async function contextAction(directory, options) {
1346
1371
  var import_chalk7 = __toESM(require("chalk"));
1347
1372
  var import_fs5 = require("fs");
1348
1373
  var import_path7 = require("path");
1349
- var import_core7 = require("@aiready/core");
1374
+ var import_core9 = require("@aiready/core");
1350
1375
  async function consistencyAction(directory, options) {
1351
1376
  console.log(import_chalk7.default.blue("\u{1F50D} Analyzing consistency...\n"));
1352
1377
  const startTime = Date.now();
@@ -1363,7 +1388,7 @@ async function consistencyAction(directory, options) {
1363
1388
  file: void 0
1364
1389
  }
1365
1390
  };
1366
- const finalOptions = await (0, import_core7.loadMergedConfig)(resolvedDir, defaults, {
1391
+ const finalOptions = await (0, import_core9.loadMergedConfig)(resolvedDir, defaults, {
1367
1392
  checkNaming: options.naming !== false,
1368
1393
  checkPatterns: options.patterns !== false,
1369
1394
  minSeverity: options.minSeverity,
@@ -1372,7 +1397,7 @@ async function consistencyAction(directory, options) {
1372
1397
  });
1373
1398
  const { analyzeConsistency, calculateConsistencyScore } = await import("@aiready/consistency");
1374
1399
  const report = await analyzeConsistency(finalOptions);
1375
- const elapsedTime = (0, import_core7.getElapsedTime)(startTime);
1400
+ const elapsedTime = (0, import_core9.getElapsedTime)(startTime);
1376
1401
  let consistencyScore;
1377
1402
  if (options.score) {
1378
1403
  const issues = report.results?.flatMap((r) => r.issues) || [];
@@ -1392,19 +1417,19 @@ async function consistencyAction(directory, options) {
1392
1417
  },
1393
1418
  ...consistencyScore && { scoring: consistencyScore }
1394
1419
  };
1395
- const outputPath = (0, import_core7.resolveOutputPath)(
1420
+ const outputPath = (0, import_core9.resolveOutputPath)(
1396
1421
  userOutputFile,
1397
1422
  `aiready-report-${getReportTimestamp()}.json`,
1398
1423
  resolvedDir
1399
1424
  );
1400
- (0, import_core7.handleJSONOutput)(
1425
+ (0, import_core9.handleJSONOutput)(
1401
1426
  outputData,
1402
1427
  outputPath,
1403
1428
  `\u2705 Results saved to ${outputPath}`
1404
1429
  );
1405
1430
  } else if (outputFormat === "markdown") {
1406
1431
  const markdown = generateMarkdownReport(report, elapsedTime);
1407
- const outputPath = (0, import_core7.resolveOutputPath)(
1432
+ const outputPath = (0, import_core9.resolveOutputPath)(
1408
1433
  userOutputFile,
1409
1434
  `aiready-report-${getReportTimestamp()}.md`,
1410
1435
  resolvedDir
@@ -1501,12 +1526,12 @@ async function consistencyAction(directory, options) {
1501
1526
  }
1502
1527
  if (consistencyScore) {
1503
1528
  console.log(import_chalk7.default.bold("\n\u{1F4CA} AI Readiness Score (Consistency)\n"));
1504
- console.log((0, import_core7.formatToolScore)(consistencyScore));
1529
+ console.log((0, import_core9.formatToolScore)(consistencyScore));
1505
1530
  console.log();
1506
1531
  }
1507
1532
  }
1508
1533
  } catch (error) {
1509
- (0, import_core7.handleCLIError)(error, "Consistency analysis");
1534
+ (0, import_core9.handleCLIError)(error, "Consistency analysis");
1510
1535
  }
1511
1536
  }
1512
1537
 
@@ -1515,14 +1540,14 @@ var import_chalk8 = __toESM(require("chalk"));
1515
1540
  var import_fs6 = require("fs");
1516
1541
  var import_path8 = require("path");
1517
1542
  var import_child_process = require("child_process");
1518
- var import_core8 = require("@aiready/core");
1519
- var import_core9 = require("@aiready/core");
1543
+ var import_core10 = require("@aiready/core");
1544
+ var import_core11 = require("@aiready/core");
1520
1545
  async function visualizeAction(directory, options) {
1521
1546
  try {
1522
1547
  const dirPath = (0, import_path8.resolve)(process.cwd(), directory || ".");
1523
1548
  let reportPath = options.report ? (0, import_path8.resolve)(dirPath, options.report) : null;
1524
1549
  if (!reportPath || !(0, import_fs6.existsSync)(reportPath)) {
1525
- const latestScan = findLatestScanReport(dirPath);
1550
+ const latestScan = (0, import_core11.findLatestReport)(dirPath);
1526
1551
  if (latestScan) {
1527
1552
  reportPath = latestScan;
1528
1553
  console.log(
@@ -1679,7 +1704,7 @@ Or specify a custom report:
1679
1704
  }
1680
1705
  }
1681
1706
  console.log("Generating HTML...");
1682
- const html = (0, import_core9.generateHTML)(graph);
1707
+ const html = (0, import_core11.generateHTML)(graph);
1683
1708
  const defaultOutput = "visualization.html";
1684
1709
  const outPath = (0, import_path8.resolve)(dirPath, options.output || defaultOutput);
1685
1710
  (0, import_fs6.writeFileSync)(outPath, html, "utf8");
@@ -1729,7 +1754,7 @@ Or specify a custom report:
1729
1754
  }
1730
1755
  }
1731
1756
  } catch (err) {
1732
- (0, import_core8.handleCLIError)(err, "Visualization");
1757
+ (0, import_core10.handleCLIError)(err, "Visualization");
1733
1758
  }
1734
1759
  }
1735
1760
  var visualizeHelpText = `
@@ -1759,21 +1784,20 @@ NOTES:
1759
1784
  - Same options as 'visualize'. Use --serve to host the static HTML, or --dev for live reload.
1760
1785
  `;
1761
1786
 
1762
- // src/commands/ai-signal-clarity.ts
1787
+ // src/commands/shared/standard-tool-actions.ts
1763
1788
  var import_chalk9 = __toESM(require("chalk"));
1764
- var import_core10 = require("@aiready/core");
1765
1789
 
1766
1790
  // src/commands/agent-grounding.ts
1767
1791
  var import_chalk10 = __toESM(require("chalk"));
1768
- var import_core11 = require("@aiready/core");
1792
+ var import_core12 = require("@aiready/core");
1769
1793
 
1770
1794
  // src/commands/testability.ts
1771
1795
  var import_chalk11 = __toESM(require("chalk"));
1772
- var import_core12 = require("@aiready/core");
1796
+ var import_core13 = require("@aiready/core");
1773
1797
  async function testabilityAction(directory, options) {
1774
1798
  const { analyzeTestability, calculateTestabilityScore } = await import("@aiready/testability");
1775
- const config = await (0, import_core12.loadConfig)(directory);
1776
- const merged = (0, import_core12.mergeConfigWithDefaults)(config, {
1799
+ const config = await (0, import_core13.loadConfig)(directory);
1800
+ const merged = (0, import_core13.mergeConfigWithDefaults)(config, {
1777
1801
  minCoverageRatio: 0.3
1778
1802
  });
1779
1803
  const report = await analyzeTestability({
@@ -1974,9 +1998,9 @@ program.command("scan").description(
1974
1998
  program.command("init").description("Generate a default configuration (aiready.json)").option("-f, --force", "Overwrite existing configuration file").option(
1975
1999
  "--js",
1976
2000
  "Generate configuration as a JavaScript file (aiready.config.js)"
1977
- ).action(async (options) => {
2001
+ ).option("--full", "Generate a full configuration with all available options").action(async (options) => {
1978
2002
  const format = options.js ? "js" : "json";
1979
- await initAction({ force: options.force, format });
2003
+ await initAction({ force: options.force, format, full: options.full });
1980
2004
  });
1981
2005
  program.command("patterns").description("Detect duplicate code patterns that confuse AI models").argument("[directory]", "Directory to analyze", ".").option("-s, --similarity <number>", "Minimum similarity score (0-1)", "0.40").option("-l, --min-lines <number>", "Minimum lines to consider", "5").option(
1982
2006
  "--max-candidates <number>",