@aiready/cli 0.14.17 → 0.14.22
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/dist/cli.js +299 -295
- package/dist/cli.mjs +262 -258
- package/package.json +12 -12
package/dist/cli.js
CHANGED
|
@@ -30,10 +30,10 @@ var import_path9 = require("path");
|
|
|
30
30
|
var import_url = require("url");
|
|
31
31
|
|
|
32
32
|
// src/commands/scan.ts
|
|
33
|
-
var
|
|
33
|
+
var import_chalk5 = __toESM(require("chalk"));
|
|
34
34
|
var import_fs3 = require("fs");
|
|
35
35
|
var import_path3 = require("path");
|
|
36
|
-
var
|
|
36
|
+
var import_core7 = require("@aiready/core");
|
|
37
37
|
|
|
38
38
|
// src/index.ts
|
|
39
39
|
var import_core = require("@aiready/core");
|
|
@@ -651,7 +651,7 @@ async function uploadAction(file, options) {
|
|
|
651
651
|
(0, import_core5.handleCLIError)(error, "Upload");
|
|
652
652
|
}
|
|
653
653
|
}
|
|
654
|
-
var
|
|
654
|
+
var UPLOAD_HELP_TEXT = `
|
|
655
655
|
EXAMPLES:
|
|
656
656
|
$ aiready upload report.json --api-key ar_...
|
|
657
657
|
$ aiready upload .aiready/latest.json
|
|
@@ -662,12 +662,83 @@ ENVIRONMENT VARIABLES:
|
|
|
662
662
|
AIREADY_SERVER Custom platform URL (default: https://dev.platform.getaiready.dev)
|
|
663
663
|
`;
|
|
664
664
|
|
|
665
|
+
// src/commands/scan-helpers.ts
|
|
666
|
+
var import_chalk4 = __toESM(require("chalk"));
|
|
667
|
+
var import_core6 = require("@aiready/core");
|
|
668
|
+
function getProfileTools(profile) {
|
|
669
|
+
switch (profile.toLowerCase()) {
|
|
670
|
+
case "agentic":
|
|
671
|
+
return [
|
|
672
|
+
import_core6.ToolName.AiSignalClarity,
|
|
673
|
+
import_core6.ToolName.AgentGrounding,
|
|
674
|
+
import_core6.ToolName.TestabilityIndex
|
|
675
|
+
];
|
|
676
|
+
case "cost":
|
|
677
|
+
return [import_core6.ToolName.PatternDetect, import_core6.ToolName.ContextAnalyzer];
|
|
678
|
+
case "logic":
|
|
679
|
+
return [
|
|
680
|
+
import_core6.ToolName.TestabilityIndex,
|
|
681
|
+
import_core6.ToolName.NamingConsistency,
|
|
682
|
+
import_core6.ToolName.ContextAnalyzer,
|
|
683
|
+
import_core6.ToolName.PatternDetect,
|
|
684
|
+
import_core6.ToolName.ChangeAmplification
|
|
685
|
+
];
|
|
686
|
+
case "ui":
|
|
687
|
+
return [
|
|
688
|
+
import_core6.ToolName.NamingConsistency,
|
|
689
|
+
import_core6.ToolName.ContextAnalyzer,
|
|
690
|
+
import_core6.ToolName.PatternDetect,
|
|
691
|
+
import_core6.ToolName.DocDrift,
|
|
692
|
+
import_core6.ToolName.AiSignalClarity
|
|
693
|
+
];
|
|
694
|
+
case "security":
|
|
695
|
+
return [import_core6.ToolName.NamingConsistency, import_core6.ToolName.TestabilityIndex];
|
|
696
|
+
case "onboarding":
|
|
697
|
+
return [
|
|
698
|
+
import_core6.ToolName.ContextAnalyzer,
|
|
699
|
+
import_core6.ToolName.NamingConsistency,
|
|
700
|
+
import_core6.ToolName.AgentGrounding
|
|
701
|
+
];
|
|
702
|
+
default:
|
|
703
|
+
console.log(
|
|
704
|
+
import_chalk4.default.yellow(`
|
|
705
|
+
\u26A0\uFE0F Unknown profile '${profile}'. Using defaults.`)
|
|
706
|
+
);
|
|
707
|
+
return void 0;
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
function createProgressCallback() {
|
|
711
|
+
return (event) => {
|
|
712
|
+
if (event.message) {
|
|
713
|
+
process.stdout.write(`\r\x1B[K [${event.tool}] ${event.message}`);
|
|
714
|
+
return;
|
|
715
|
+
}
|
|
716
|
+
process.stdout.write("\r\x1B[K");
|
|
717
|
+
console.log(import_chalk4.default.cyan(`--- ${event.tool.toUpperCase()} RESULTS ---`));
|
|
718
|
+
const toolResult = event.data;
|
|
719
|
+
if (toolResult && toolResult.summary) {
|
|
720
|
+
if (toolResult.summary.totalIssues !== void 0)
|
|
721
|
+
console.log(
|
|
722
|
+
` Issues found: ${import_chalk4.default.bold(toolResult.summary.totalIssues)}`
|
|
723
|
+
);
|
|
724
|
+
if (toolResult.summary.score !== void 0)
|
|
725
|
+
console.log(
|
|
726
|
+
` Tool Score: ${import_chalk4.default.bold(toolResult.summary.score)}/100`
|
|
727
|
+
);
|
|
728
|
+
if (toolResult.summary.totalFiles !== void 0)
|
|
729
|
+
console.log(
|
|
730
|
+
` Files analyzed: ${import_chalk4.default.bold(toolResult.summary.totalFiles)}`
|
|
731
|
+
);
|
|
732
|
+
}
|
|
733
|
+
};
|
|
734
|
+
}
|
|
735
|
+
|
|
665
736
|
// src/commands/scan.ts
|
|
666
737
|
async function scanAction(directory, options) {
|
|
667
|
-
console.log(
|
|
738
|
+
console.log(import_chalk5.default.blue("\u{1F680} Starting AIReady unified analysis...\n"));
|
|
668
739
|
const startTime = Date.now();
|
|
669
740
|
const resolvedDir = (0, import_path3.resolve)(process.cwd(), directory ?? ".");
|
|
670
|
-
const repoMetadata = (0,
|
|
741
|
+
const repoMetadata = (0, import_core7.getRepoMetadata)(resolvedDir);
|
|
671
742
|
try {
|
|
672
743
|
const defaults = {
|
|
673
744
|
tools: [
|
|
@@ -690,104 +761,37 @@ async function scanAction(directory, options) {
|
|
|
690
761
|
};
|
|
691
762
|
let profileTools = options.tools ? options.tools.split(",").map((t) => t.trim()) : void 0;
|
|
692
763
|
if (options.profile) {
|
|
693
|
-
|
|
694
|
-
case "agentic":
|
|
695
|
-
profileTools = [
|
|
696
|
-
import_core6.ToolName.AiSignalClarity,
|
|
697
|
-
import_core6.ToolName.AgentGrounding,
|
|
698
|
-
import_core6.ToolName.TestabilityIndex
|
|
699
|
-
];
|
|
700
|
-
break;
|
|
701
|
-
case "cost":
|
|
702
|
-
profileTools = [import_core6.ToolName.PatternDetect, import_core6.ToolName.ContextAnalyzer];
|
|
703
|
-
break;
|
|
704
|
-
case "logic":
|
|
705
|
-
profileTools = [
|
|
706
|
-
import_core6.ToolName.TestabilityIndex,
|
|
707
|
-
import_core6.ToolName.NamingConsistency,
|
|
708
|
-
import_core6.ToolName.ContextAnalyzer,
|
|
709
|
-
import_core6.ToolName.PatternDetect,
|
|
710
|
-
import_core6.ToolName.ChangeAmplification
|
|
711
|
-
];
|
|
712
|
-
break;
|
|
713
|
-
case "ui":
|
|
714
|
-
profileTools = [
|
|
715
|
-
import_core6.ToolName.NamingConsistency,
|
|
716
|
-
import_core6.ToolName.ContextAnalyzer,
|
|
717
|
-
import_core6.ToolName.PatternDetect,
|
|
718
|
-
import_core6.ToolName.DocDrift,
|
|
719
|
-
import_core6.ToolName.AiSignalClarity
|
|
720
|
-
];
|
|
721
|
-
break;
|
|
722
|
-
case "security":
|
|
723
|
-
profileTools = [
|
|
724
|
-
import_core6.ToolName.NamingConsistency,
|
|
725
|
-
import_core6.ToolName.TestabilityIndex
|
|
726
|
-
];
|
|
727
|
-
break;
|
|
728
|
-
case "onboarding":
|
|
729
|
-
profileTools = [
|
|
730
|
-
import_core6.ToolName.ContextAnalyzer,
|
|
731
|
-
import_core6.ToolName.NamingConsistency,
|
|
732
|
-
import_core6.ToolName.AgentGrounding
|
|
733
|
-
];
|
|
734
|
-
break;
|
|
735
|
-
default:
|
|
736
|
-
console.log(
|
|
737
|
-
import_chalk4.default.yellow(
|
|
738
|
-
`
|
|
739
|
-
\u26A0\uFE0F Unknown profile '${options.profile}'. Using defaults.`
|
|
740
|
-
)
|
|
741
|
-
);
|
|
742
|
-
}
|
|
764
|
+
profileTools = getProfileTools(options.profile);
|
|
743
765
|
}
|
|
744
766
|
const cliOverrides = {
|
|
745
767
|
include: options.include?.split(","),
|
|
746
768
|
exclude: options.exclude?.split(",")
|
|
747
769
|
};
|
|
748
770
|
if (profileTools) cliOverrides.tools = profileTools;
|
|
749
|
-
const baseOptions = await (0,
|
|
771
|
+
const baseOptions = await (0, import_core7.loadMergedConfig)(
|
|
750
772
|
resolvedDir,
|
|
751
773
|
defaults,
|
|
752
774
|
cliOverrides
|
|
753
775
|
);
|
|
754
776
|
const finalOptions = { ...baseOptions };
|
|
755
|
-
if (baseOptions.tools.includes(
|
|
777
|
+
if (baseOptions.tools.includes(import_core7.ToolName.PatternDetect) || baseOptions.tools.includes("patterns")) {
|
|
756
778
|
const { getSmartDefaults } = await import("@aiready/pattern-detect");
|
|
757
779
|
const patternSmartDefaults = await getSmartDefaults(
|
|
758
780
|
resolvedDir,
|
|
759
|
-
finalOptions.toolConfigs?.[
|
|
781
|
+
finalOptions.toolConfigs?.[import_core7.ToolName.PatternDetect] ?? {}
|
|
760
782
|
);
|
|
761
783
|
if (!finalOptions.toolConfigs) finalOptions.toolConfigs = {};
|
|
762
|
-
finalOptions.toolConfigs[
|
|
784
|
+
finalOptions.toolConfigs[import_core7.ToolName.PatternDetect] = {
|
|
763
785
|
...patternSmartDefaults,
|
|
764
|
-
...finalOptions.toolConfigs[
|
|
786
|
+
...finalOptions.toolConfigs[import_core7.ToolName.PatternDetect]
|
|
765
787
|
};
|
|
766
788
|
}
|
|
767
|
-
console.log(
|
|
789
|
+
console.log(import_chalk5.default.cyan("\n=== AIReady Run Preview ==="));
|
|
768
790
|
console.log(
|
|
769
|
-
|
|
791
|
+
import_chalk5.default.white("Tools to run:"),
|
|
770
792
|
(finalOptions.tools ?? []).join(", ")
|
|
771
793
|
);
|
|
772
|
-
const progressCallback = (
|
|
773
|
-
if (event.message) {
|
|
774
|
-
process.stdout.write(`\r\x1B[K [${event.tool}] ${event.message}`);
|
|
775
|
-
return;
|
|
776
|
-
}
|
|
777
|
-
process.stdout.write("\r\x1B[K");
|
|
778
|
-
console.log(import_chalk4.default.cyan(`--- ${event.tool.toUpperCase()} RESULTS ---`));
|
|
779
|
-
const res = event.data;
|
|
780
|
-
if (res && res.summary) {
|
|
781
|
-
if (res.summary.totalIssues !== void 0)
|
|
782
|
-
console.log(` Issues found: ${import_chalk4.default.bold(res.summary.totalIssues)}`);
|
|
783
|
-
if (res.summary.score !== void 0)
|
|
784
|
-
console.log(` Tool Score: ${import_chalk4.default.bold(res.summary.score)}/100`);
|
|
785
|
-
if (res.summary.totalFiles !== void 0)
|
|
786
|
-
console.log(
|
|
787
|
-
` Files analyzed: ${import_chalk4.default.bold(res.summary.totalFiles)}`
|
|
788
|
-
);
|
|
789
|
-
}
|
|
790
|
-
};
|
|
794
|
+
const progressCallback = createProgressCallback();
|
|
791
795
|
const scoringProfile = options.profile ?? baseOptions.scoring?.profile ?? "default";
|
|
792
796
|
const results = await analyzeUnified({
|
|
793
797
|
...finalOptions,
|
|
@@ -818,19 +822,19 @@ async function scanAction(directory, options) {
|
|
|
818
822
|
const diffStr = diff > 0 ? `+${diff}` : String(diff);
|
|
819
823
|
if (diff > 0)
|
|
820
824
|
console.log(
|
|
821
|
-
|
|
825
|
+
import_chalk5.default.green(
|
|
822
826
|
` \u{1F4C8} Trend: ${diffStr} compared to ${options.compareTo} (${prevScore} \u2192 ${scoringResult.overall})`
|
|
823
827
|
)
|
|
824
828
|
);
|
|
825
829
|
else if (diff < 0)
|
|
826
830
|
console.log(
|
|
827
|
-
|
|
831
|
+
import_chalk5.default.red(
|
|
828
832
|
` \u{1F4C9} Trend: ${diffStr} compared to ${options.compareTo} (${prevScore} \u2192 ${scoringResult.overall})`
|
|
829
833
|
)
|
|
830
834
|
);
|
|
831
835
|
else
|
|
832
836
|
console.log(
|
|
833
|
-
|
|
837
|
+
import_chalk5.default.blue(
|
|
834
838
|
` \u2796 Trend: No change (${prevScore} \u2192 ${scoringResult.overall})`
|
|
835
839
|
)
|
|
836
840
|
);
|
|
@@ -854,7 +858,7 @@ async function scanAction(directory, options) {
|
|
|
854
858
|
0
|
|
855
859
|
);
|
|
856
860
|
if (totalContext > 0) {
|
|
857
|
-
const unifiedBudget = (0,
|
|
861
|
+
const unifiedBudget = (0, import_core7.calculateTokenBudget)({
|
|
858
862
|
totalContextTokens: totalContext,
|
|
859
863
|
wastedTokens: {
|
|
860
864
|
duplication: totalWastedDuplication,
|
|
@@ -890,19 +894,19 @@ async function scanAction(directory, options) {
|
|
|
890
894
|
}
|
|
891
895
|
}
|
|
892
896
|
console.log(
|
|
893
|
-
|
|
897
|
+
import_chalk5.default.dim(
|
|
894
898
|
"\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"
|
|
895
899
|
)
|
|
896
900
|
);
|
|
897
|
-
console.log(
|
|
898
|
-
console.log(
|
|
901
|
+
console.log(import_chalk5.default.dim("\u{1F4AC} Found a bug or have a metric idea?"));
|
|
902
|
+
console.log(import_chalk5.default.dim("\u{1F449} Copy/paste this to your AI agent:"));
|
|
899
903
|
console.log(
|
|
900
|
-
|
|
904
|
+
import_chalk5.default.cyan(
|
|
901
905
|
` "Any feedback for the tools? Please use 'aiready bug' to report \u2764\uFE0F"`
|
|
902
906
|
)
|
|
903
907
|
);
|
|
904
908
|
console.log(
|
|
905
|
-
|
|
909
|
+
import_chalk5.default.dim(
|
|
906
910
|
"\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"
|
|
907
911
|
)
|
|
908
912
|
);
|
|
@@ -911,13 +915,13 @@ async function scanAction(directory, options) {
|
|
|
911
915
|
repository: repoMetadata
|
|
912
916
|
};
|
|
913
917
|
const outputFormat = options.output ?? finalOptions.output?.format ?? "console";
|
|
914
|
-
const outputPath = (0,
|
|
918
|
+
const outputPath = (0, import_core7.resolveOutputPath)(
|
|
915
919
|
options.outputFile ?? finalOptions.output?.file,
|
|
916
920
|
`aiready-report-${getReportTimestamp()}.json`,
|
|
917
921
|
resolvedDir
|
|
918
922
|
);
|
|
919
923
|
if (outputFormat === "json") {
|
|
920
|
-
(0,
|
|
924
|
+
(0, import_core7.handleJSONOutput)(
|
|
921
925
|
outputData,
|
|
922
926
|
outputPath,
|
|
923
927
|
`\u2705 Report saved to ${outputPath}`
|
|
@@ -925,7 +929,7 @@ async function scanAction(directory, options) {
|
|
|
925
929
|
} else {
|
|
926
930
|
try {
|
|
927
931
|
(0, import_fs3.writeFileSync)(outputPath, JSON.stringify(outputData, null, 2));
|
|
928
|
-
console.log(
|
|
932
|
+
console.log(import_chalk5.default.dim(`\u2705 Report auto-persisted to ${outputPath}`));
|
|
929
933
|
} catch (err) {
|
|
930
934
|
void err;
|
|
931
935
|
}
|
|
@@ -946,12 +950,12 @@ async function scanAction(directory, options) {
|
|
|
946
950
|
const report = mapToUnifiedReport(results, scoringResult);
|
|
947
951
|
if (isCI && report.results && report.results.length > 0) {
|
|
948
952
|
console.log(
|
|
949
|
-
|
|
953
|
+
import_chalk5.default.cyan(
|
|
950
954
|
`
|
|
951
955
|
\u{1F4DD} Emitting GitHub Action annotations for ${report.results.length} issues...`
|
|
952
956
|
)
|
|
953
957
|
);
|
|
954
|
-
(0,
|
|
958
|
+
(0, import_core7.emitIssuesAsAnnotations)(report.results);
|
|
955
959
|
}
|
|
956
960
|
if (threshold && scoringResult.overall < threshold) {
|
|
957
961
|
shouldFail = true;
|
|
@@ -967,31 +971,31 @@ async function scanAction(directory, options) {
|
|
|
967
971
|
}
|
|
968
972
|
}
|
|
969
973
|
if (shouldFail) {
|
|
970
|
-
console.log(
|
|
974
|
+
console.log(import_chalk5.default.red(`
|
|
971
975
|
\u{1F6AB} SCAN FAILED: ${failReason}`));
|
|
972
976
|
process.exit(1);
|
|
973
977
|
} else {
|
|
974
|
-
console.log(
|
|
978
|
+
console.log(import_chalk5.default.green("\n\u2705 SCAN PASSED"));
|
|
975
979
|
}
|
|
976
980
|
}
|
|
977
981
|
} catch (error) {
|
|
978
|
-
(0,
|
|
982
|
+
(0, import_core7.handleCLIError)(error, "Analysis");
|
|
979
983
|
}
|
|
980
984
|
}
|
|
981
|
-
var
|
|
985
|
+
var SCAN_HELP_TEXT = `...`;
|
|
982
986
|
|
|
983
987
|
// src/commands/init.ts
|
|
984
988
|
var import_fs4 = require("fs");
|
|
985
989
|
var import_path4 = require("path");
|
|
986
|
-
var
|
|
987
|
-
var
|
|
990
|
+
var import_chalk6 = __toESM(require("chalk"));
|
|
991
|
+
var import_core8 = require("@aiready/core");
|
|
988
992
|
async function initAction(options) {
|
|
989
993
|
const fileExt = options.format === "js" ? "js" : "json";
|
|
990
994
|
const fileName = fileExt === "js" ? "aiready.config.js" : "aiready.json";
|
|
991
995
|
const filePath = (0, import_path4.join)(process.cwd(), fileName);
|
|
992
996
|
if ((0, import_fs4.existsSync)(filePath) && !options.force) {
|
|
993
997
|
console.error(
|
|
994
|
-
|
|
998
|
+
import_chalk6.default.red(`Error: ${fileName} already exists. Use --force to overwrite.`)
|
|
995
999
|
);
|
|
996
1000
|
process.exit(1);
|
|
997
1001
|
}
|
|
@@ -1015,15 +1019,15 @@ async function initAction(options) {
|
|
|
1015
1019
|
"**/*.spec.ts"
|
|
1016
1020
|
],
|
|
1017
1021
|
tools: [
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1022
|
+
import_core8.ToolName.PatternDetect,
|
|
1023
|
+
import_core8.ToolName.ContextAnalyzer,
|
|
1024
|
+
import_core8.ToolName.NamingConsistency,
|
|
1025
|
+
import_core8.ToolName.AiSignalClarity,
|
|
1026
|
+
import_core8.ToolName.AgentGrounding,
|
|
1027
|
+
import_core8.ToolName.TestabilityIndex,
|
|
1028
|
+
import_core8.ToolName.DocDrift,
|
|
1029
|
+
import_core8.ToolName.DependencyHealth,
|
|
1030
|
+
import_core8.ToolName.ChangeAmplification
|
|
1027
1031
|
]
|
|
1028
1032
|
},
|
|
1029
1033
|
// Output preferences
|
|
@@ -1038,7 +1042,7 @@ async function initAction(options) {
|
|
|
1038
1042
|
},
|
|
1039
1043
|
// Tool-specific configurations
|
|
1040
1044
|
tools: {
|
|
1041
|
-
[
|
|
1045
|
+
[import_core8.ToolName.PatternDetect]: {
|
|
1042
1046
|
// Core detection thresholds
|
|
1043
1047
|
minSimilarity: 0.4,
|
|
1044
1048
|
// Jaccard similarity threshold (0-1)
|
|
@@ -1068,7 +1072,7 @@ async function initAction(options) {
|
|
|
1068
1072
|
// Add any additional advanced options here
|
|
1069
1073
|
} : {}
|
|
1070
1074
|
},
|
|
1071
|
-
[
|
|
1075
|
+
[import_core8.ToolName.ContextAnalyzer]: {
|
|
1072
1076
|
// Smart defaults are generated dynamically based on repository size
|
|
1073
1077
|
// These are fallback values for when smart defaults can't be calculated
|
|
1074
1078
|
maxContextBudget: 25e3,
|
|
@@ -1085,7 +1089,7 @@ async function initAction(options) {
|
|
|
1085
1089
|
includeNodeModules: false
|
|
1086
1090
|
// Whether to include node_modules in analysis
|
|
1087
1091
|
},
|
|
1088
|
-
[
|
|
1092
|
+
[import_core8.ToolName.NamingConsistency]: {
|
|
1089
1093
|
// Core checks
|
|
1090
1094
|
checkNaming: true,
|
|
1091
1095
|
// Check naming conventions and quality
|
|
@@ -1132,7 +1136,7 @@ async function initAction(options) {
|
|
|
1132
1136
|
],
|
|
1133
1137
|
...options.full ? { disableChecks: [] } : {}
|
|
1134
1138
|
},
|
|
1135
|
-
[
|
|
1139
|
+
[import_core8.ToolName.AiSignalClarity]: {
|
|
1136
1140
|
// All signal clarity checks enabled by default
|
|
1137
1141
|
checkMagicLiterals: true,
|
|
1138
1142
|
// Detect magic numbers and strings
|
|
@@ -1151,7 +1155,7 @@ async function initAction(options) {
|
|
|
1151
1155
|
checkLargeFiles: true
|
|
1152
1156
|
// Detect files that are too large
|
|
1153
1157
|
},
|
|
1154
|
-
[
|
|
1158
|
+
[import_core8.ToolName.AgentGrounding]: {
|
|
1155
1159
|
// Structure clarity
|
|
1156
1160
|
maxRecommendedDepth: 4,
|
|
1157
1161
|
// Max directory depth before flagging as "too deep"
|
|
@@ -1162,7 +1166,7 @@ async function initAction(options) {
|
|
|
1162
1166
|
additionalVagueNames: ["stuff", "misc", "temp", "test"]
|
|
1163
1167
|
// Custom vague file names
|
|
1164
1168
|
},
|
|
1165
|
-
[
|
|
1169
|
+
[import_core8.ToolName.TestabilityIndex]: {
|
|
1166
1170
|
// Coverage thresholds
|
|
1167
1171
|
minCoverageRatio: 0.3,
|
|
1168
1172
|
// Minimum acceptable test/source ratio
|
|
@@ -1172,19 +1176,19 @@ async function initAction(options) {
|
|
|
1172
1176
|
maxDepth: 10
|
|
1173
1177
|
// Maximum scan depth
|
|
1174
1178
|
},
|
|
1175
|
-
[
|
|
1179
|
+
[import_core8.ToolName.DocDrift]: {
|
|
1176
1180
|
// Drift detection
|
|
1177
1181
|
maxCommits: 50,
|
|
1178
1182
|
// Maximum commit distance to check for drift
|
|
1179
1183
|
staleMonths: 3
|
|
1180
1184
|
// Consider comments older than this as outdated
|
|
1181
1185
|
},
|
|
1182
|
-
[
|
|
1186
|
+
[import_core8.ToolName.DependencyHealth]: {
|
|
1183
1187
|
// Training cutoff for AI knowledge assessment
|
|
1184
1188
|
trainingCutoffYear: 2023
|
|
1185
1189
|
// Year cutoff for AI training data
|
|
1186
1190
|
},
|
|
1187
|
-
[
|
|
1191
|
+
[import_core8.ToolName.ChangeAmplification]: {
|
|
1188
1192
|
// Change amplification primarily relies on global scan settings
|
|
1189
1193
|
// No additional tool-specific configuration required
|
|
1190
1194
|
}
|
|
@@ -1213,26 +1217,26 @@ module.exports = ${JSON.stringify(defaultConfig, null, 2)};
|
|
|
1213
1217
|
try {
|
|
1214
1218
|
(0, import_fs4.writeFileSync)(filePath, content, "utf8");
|
|
1215
1219
|
console.log(
|
|
1216
|
-
|
|
1217
|
-
\u2705 Created default configuration: ${
|
|
1220
|
+
import_chalk6.default.green(`
|
|
1221
|
+
\u2705 Created default configuration: ${import_chalk6.default.bold(fileName)}`)
|
|
1218
1222
|
);
|
|
1219
1223
|
console.log(
|
|
1220
|
-
|
|
1224
|
+
import_chalk6.default.cyan("You can now fine-tune your settings and run AIReady with:")
|
|
1221
1225
|
);
|
|
1222
|
-
console.log(
|
|
1226
|
+
console.log(import_chalk6.default.white(` $ aiready scan
|
|
1223
1227
|
`));
|
|
1224
1228
|
} catch (error) {
|
|
1225
|
-
console.error(
|
|
1229
|
+
console.error(import_chalk6.default.red(`Failed to write configuration file: ${error}`));
|
|
1226
1230
|
process.exit(1);
|
|
1227
1231
|
}
|
|
1228
1232
|
}
|
|
1229
1233
|
|
|
1230
1234
|
// src/commands/patterns.ts
|
|
1231
|
-
var
|
|
1235
|
+
var import_chalk7 = __toESM(require("chalk"));
|
|
1232
1236
|
var import_path5 = require("path");
|
|
1233
|
-
var
|
|
1237
|
+
var import_core9 = require("@aiready/core");
|
|
1234
1238
|
async function patternsAction(directory, options) {
|
|
1235
|
-
console.log(
|
|
1239
|
+
console.log(import_chalk7.default.blue("\u{1F50D} Analyzing patterns...\n"));
|
|
1236
1240
|
const startTime = Date.now();
|
|
1237
1241
|
const resolvedDir = (0, import_path5.resolve)(process.cwd(), directory ?? ".");
|
|
1238
1242
|
try {
|
|
@@ -1263,7 +1267,7 @@ async function patternsAction(directory, options) {
|
|
|
1263
1267
|
if (options.minSharedTokens) {
|
|
1264
1268
|
cliOptions.minSharedTokens = parseInt(options.minSharedTokens);
|
|
1265
1269
|
}
|
|
1266
|
-
const finalOptions = await (0,
|
|
1270
|
+
const finalOptions = await (0, import_core9.loadMergedConfig)(
|
|
1267
1271
|
resolvedDir,
|
|
1268
1272
|
defaults,
|
|
1269
1273
|
cliOptions
|
|
@@ -1272,7 +1276,7 @@ async function patternsAction(directory, options) {
|
|
|
1272
1276
|
const { results, duplicates } = await analyzePatterns(
|
|
1273
1277
|
finalOptions
|
|
1274
1278
|
);
|
|
1275
|
-
const elapsedTime = (0,
|
|
1279
|
+
const elapsedTime = (0, import_core9.getElapsedTime)(startTime);
|
|
1276
1280
|
const summary = generateSummary(results);
|
|
1277
1281
|
let patternScore;
|
|
1278
1282
|
if (options.score) {
|
|
@@ -1286,12 +1290,12 @@ async function patternsAction(directory, options) {
|
|
|
1286
1290
|
summary: { ...summary, executionTime: parseFloat(elapsedTime) },
|
|
1287
1291
|
...patternScore && { scoring: patternScore }
|
|
1288
1292
|
};
|
|
1289
|
-
const outputPath = (0,
|
|
1293
|
+
const outputPath = (0, import_core9.resolveOutputPath)(
|
|
1290
1294
|
userOutputFile,
|
|
1291
1295
|
`aiready-report-${getReportTimestamp()}.json`,
|
|
1292
1296
|
resolvedDir
|
|
1293
1297
|
);
|
|
1294
|
-
(0,
|
|
1298
|
+
(0, import_core9.handleJSONOutput)(
|
|
1295
1299
|
outputData,
|
|
1296
1300
|
outputPath,
|
|
1297
1301
|
`\u2705 Results saved to ${outputPath}`
|
|
@@ -1300,38 +1304,38 @@ async function patternsAction(directory, options) {
|
|
|
1300
1304
|
const terminalWidth = process.stdout.columns || 80;
|
|
1301
1305
|
const dividerWidth = Math.min(60, terminalWidth - 2);
|
|
1302
1306
|
const divider = "\u2501".repeat(dividerWidth);
|
|
1303
|
-
console.log(
|
|
1304
|
-
console.log(
|
|
1305
|
-
console.log(
|
|
1307
|
+
console.log(import_chalk7.default.cyan(divider));
|
|
1308
|
+
console.log(import_chalk7.default.bold.white(" PATTERN ANALYSIS SUMMARY"));
|
|
1309
|
+
console.log(import_chalk7.default.cyan(divider) + "\n");
|
|
1306
1310
|
console.log(
|
|
1307
|
-
|
|
1311
|
+
import_chalk7.default.white(`\u{1F4C1} Files analyzed: ${import_chalk7.default.bold(results.length)}`)
|
|
1308
1312
|
);
|
|
1309
1313
|
console.log(
|
|
1310
|
-
|
|
1311
|
-
`\u26A0 Duplicate patterns found: ${
|
|
1314
|
+
import_chalk7.default.yellow(
|
|
1315
|
+
`\u26A0 Duplicate patterns found: ${import_chalk7.default.bold(summary.totalPatterns)}`
|
|
1312
1316
|
)
|
|
1313
1317
|
);
|
|
1314
1318
|
console.log(
|
|
1315
|
-
|
|
1316
|
-
`\u{1F4B0} Token cost (wasted): ${
|
|
1319
|
+
import_chalk7.default.red(
|
|
1320
|
+
`\u{1F4B0} Token cost (wasted): ${import_chalk7.default.bold(summary.totalTokenCost.toLocaleString())}`
|
|
1317
1321
|
)
|
|
1318
1322
|
);
|
|
1319
1323
|
console.log(
|
|
1320
|
-
|
|
1324
|
+
import_chalk7.default.gray(`\u23F1 Analysis time: ${import_chalk7.default.bold(elapsedTime + "s")}`)
|
|
1321
1325
|
);
|
|
1322
1326
|
const sortedTypes = Object.entries(summary.patternsByType || {}).filter(([, count]) => count > 0).sort(([, a], [, b]) => b - a);
|
|
1323
1327
|
if (sortedTypes.length > 0) {
|
|
1324
|
-
console.log(
|
|
1325
|
-
console.log(
|
|
1326
|
-
console.log(
|
|
1328
|
+
console.log(import_chalk7.default.cyan("\n" + divider));
|
|
1329
|
+
console.log(import_chalk7.default.bold.white(" PATTERNS BY TYPE"));
|
|
1330
|
+
console.log(import_chalk7.default.cyan(divider) + "\n");
|
|
1327
1331
|
sortedTypes.forEach(([type, count]) => {
|
|
1328
|
-
console.log(` ${
|
|
1332
|
+
console.log(` ${import_chalk7.default.white(type.padEnd(15))} ${import_chalk7.default.bold(count)}`);
|
|
1329
1333
|
});
|
|
1330
1334
|
}
|
|
1331
1335
|
if (summary.totalPatterns > 0 && duplicates.length > 0) {
|
|
1332
|
-
console.log(
|
|
1333
|
-
console.log(
|
|
1334
|
-
console.log(
|
|
1336
|
+
console.log(import_chalk7.default.cyan("\n" + divider));
|
|
1337
|
+
console.log(import_chalk7.default.bold.white(" TOP DUPLICATE PATTERNS"));
|
|
1338
|
+
console.log(import_chalk7.default.cyan(divider) + "\n");
|
|
1335
1339
|
const topDuplicates = [...duplicates].sort((a, b) => b.similarity - a.similarity).slice(0, 10);
|
|
1336
1340
|
topDuplicates.forEach((dup) => {
|
|
1337
1341
|
const severity = dup.similarity > 0.95 ? "CRITICAL" : dup.similarity > 0.9 ? "HIGH" : "MEDIUM";
|
|
@@ -1339,34 +1343,34 @@ async function patternsAction(directory, options) {
|
|
|
1339
1343
|
const file1Name = dup.file1.split("/").pop() || dup.file1;
|
|
1340
1344
|
const file2Name = dup.file2.split("/").pop() || dup.file2;
|
|
1341
1345
|
console.log(
|
|
1342
|
-
`${severityIcon} ${severity}: ${
|
|
1346
|
+
`${severityIcon} ${severity}: ${import_chalk7.default.bold(file1Name)} \u2194 ${import_chalk7.default.bold(file2Name)}`
|
|
1343
1347
|
);
|
|
1344
1348
|
console.log(
|
|
1345
|
-
` Similarity: ${
|
|
1349
|
+
` Similarity: ${import_chalk7.default.bold(Math.round(dup.similarity * 100) + "%")} | Wasted: ${import_chalk7.default.bold(dup.tokenCost.toLocaleString())} tokens each`
|
|
1346
1350
|
);
|
|
1347
1351
|
console.log(
|
|
1348
|
-
` Lines: ${
|
|
1352
|
+
` Lines: ${import_chalk7.default.cyan(dup.line1 + "-" + dup.endLine1)} \u2194 ${import_chalk7.default.cyan(dup.line2 + "-" + dup.endLine2)}
|
|
1349
1353
|
`
|
|
1350
1354
|
);
|
|
1351
1355
|
});
|
|
1352
1356
|
} else {
|
|
1353
1357
|
console.log(
|
|
1354
|
-
|
|
1358
|
+
import_chalk7.default.green("\n\u2728 Great! No duplicate patterns detected.\n")
|
|
1355
1359
|
);
|
|
1356
1360
|
}
|
|
1357
1361
|
if (patternScore) {
|
|
1358
|
-
console.log(
|
|
1359
|
-
console.log(
|
|
1360
|
-
console.log(
|
|
1361
|
-
console.log((0,
|
|
1362
|
+
console.log(import_chalk7.default.cyan(divider));
|
|
1363
|
+
console.log(import_chalk7.default.bold.white(" AI READINESS SCORE (Patterns)"));
|
|
1364
|
+
console.log(import_chalk7.default.cyan(divider) + "\n");
|
|
1365
|
+
console.log((0, import_core9.formatToolScore)(patternScore));
|
|
1362
1366
|
console.log();
|
|
1363
1367
|
}
|
|
1364
1368
|
}
|
|
1365
1369
|
} catch (error) {
|
|
1366
|
-
(0,
|
|
1370
|
+
(0, import_core9.handleCLIError)(error, "Pattern analysis");
|
|
1367
1371
|
}
|
|
1368
1372
|
}
|
|
1369
|
-
var
|
|
1373
|
+
var PATTERNS_HELP_TEXT = `
|
|
1370
1374
|
EXAMPLES:
|
|
1371
1375
|
$ aiready patterns # Default analysis
|
|
1372
1376
|
$ aiready patterns --similarity 0.6 # Stricter matching
|
|
@@ -1374,11 +1378,11 @@ EXAMPLES:
|
|
|
1374
1378
|
`;
|
|
1375
1379
|
|
|
1376
1380
|
// src/commands/context.ts
|
|
1377
|
-
var
|
|
1381
|
+
var import_chalk8 = __toESM(require("chalk"));
|
|
1378
1382
|
var import_path6 = require("path");
|
|
1379
|
-
var
|
|
1383
|
+
var import_core10 = require("@aiready/core");
|
|
1380
1384
|
async function contextAction(directory, options) {
|
|
1381
|
-
console.log(
|
|
1385
|
+
console.log(import_chalk8.default.blue("\u{1F9E0} Analyzing context costs...\n"));
|
|
1382
1386
|
const startTime = Date.now();
|
|
1383
1387
|
const resolvedDir = (0, import_path6.resolve)(process.cwd(), directory ?? ".");
|
|
1384
1388
|
try {
|
|
@@ -1392,7 +1396,7 @@ async function contextAction(directory, options) {
|
|
|
1392
1396
|
file: void 0
|
|
1393
1397
|
}
|
|
1394
1398
|
};
|
|
1395
|
-
const baseOptions = await (0,
|
|
1399
|
+
const baseOptions = await (0, import_core10.loadMergedConfig)(resolvedDir, defaults, {
|
|
1396
1400
|
maxDepth: options.maxDepth ? parseInt(options.maxDepth) : void 0,
|
|
1397
1401
|
maxContextBudget: options.maxContext ? parseInt(options.maxContext) : void 0,
|
|
1398
1402
|
include: options.include?.split(","),
|
|
@@ -1418,7 +1422,7 @@ async function contextAction(directory, options) {
|
|
|
1418
1422
|
console.log("");
|
|
1419
1423
|
const { analyzeContext, generateSummary, calculateContextScore } = await import("@aiready/context-analyzer");
|
|
1420
1424
|
const results = await analyzeContext(finalOptions);
|
|
1421
|
-
const elapsedTime = (0,
|
|
1425
|
+
const elapsedTime = (0, import_core10.getElapsedTime)(startTime);
|
|
1422
1426
|
const summary = generateSummary(results);
|
|
1423
1427
|
let contextScore;
|
|
1424
1428
|
if (options.score) {
|
|
@@ -1432,12 +1436,12 @@ async function contextAction(directory, options) {
|
|
|
1432
1436
|
summary: { ...summary, executionTime: parseFloat(elapsedTime) },
|
|
1433
1437
|
...contextScore && { scoring: contextScore }
|
|
1434
1438
|
};
|
|
1435
|
-
const outputPath = (0,
|
|
1439
|
+
const outputPath = (0, import_core10.resolveOutputPath)(
|
|
1436
1440
|
userOutputFile,
|
|
1437
1441
|
`aiready-report-${getReportTimestamp()}.json`,
|
|
1438
1442
|
resolvedDir
|
|
1439
1443
|
);
|
|
1440
|
-
(0,
|
|
1444
|
+
(0, import_core10.handleJSONOutput)(
|
|
1441
1445
|
outputData,
|
|
1442
1446
|
outputPath,
|
|
1443
1447
|
`\u2705 Results saved to ${outputPath}`
|
|
@@ -1446,85 +1450,85 @@ async function contextAction(directory, options) {
|
|
|
1446
1450
|
const terminalWidth = process.stdout.columns ?? 80;
|
|
1447
1451
|
const dividerWidth = Math.min(60, terminalWidth - 2);
|
|
1448
1452
|
const divider = "\u2501".repeat(dividerWidth);
|
|
1449
|
-
console.log(
|
|
1450
|
-
console.log(
|
|
1451
|
-
console.log(
|
|
1453
|
+
console.log(import_chalk8.default.cyan(divider));
|
|
1454
|
+
console.log(import_chalk8.default.bold.white(" CONTEXT ANALYSIS SUMMARY"));
|
|
1455
|
+
console.log(import_chalk8.default.cyan(divider) + "\n");
|
|
1452
1456
|
console.log(
|
|
1453
|
-
|
|
1457
|
+
import_chalk8.default.white(`\u{1F4C1} Files analyzed: ${import_chalk8.default.bold(summary.totalFiles)}`)
|
|
1454
1458
|
);
|
|
1455
1459
|
console.log(
|
|
1456
|
-
|
|
1457
|
-
`\u{1F4CA} Total tokens: ${
|
|
1460
|
+
import_chalk8.default.white(
|
|
1461
|
+
`\u{1F4CA} Total tokens: ${import_chalk8.default.bold(summary.totalTokens.toLocaleString())}`
|
|
1458
1462
|
)
|
|
1459
1463
|
);
|
|
1460
1464
|
console.log(
|
|
1461
|
-
|
|
1462
|
-
`\u{1F4B0} Avg context budget: ${
|
|
1465
|
+
import_chalk8.default.yellow(
|
|
1466
|
+
`\u{1F4B0} Avg context budget: ${import_chalk8.default.bold(summary.avgContextBudget.toFixed(0))} tokens/file`
|
|
1463
1467
|
)
|
|
1464
1468
|
);
|
|
1465
1469
|
console.log(
|
|
1466
|
-
|
|
1470
|
+
import_chalk8.default.white(`\u23F1 Analysis time: ${import_chalk8.default.bold(elapsedTime + "s")}
|
|
1467
1471
|
`)
|
|
1468
1472
|
);
|
|
1469
1473
|
const totalIssues = summary.criticalIssues + summary.majorIssues + summary.minorIssues;
|
|
1470
1474
|
if (totalIssues > 0) {
|
|
1471
|
-
console.log(
|
|
1475
|
+
console.log(import_chalk8.default.bold("\u26A0\uFE0F Issues Found:\n"));
|
|
1472
1476
|
if (summary.criticalIssues > 0) {
|
|
1473
1477
|
console.log(
|
|
1474
|
-
|
|
1478
|
+
import_chalk8.default.red(` \u{1F534} Critical: ${import_chalk8.default.bold(summary.criticalIssues)}`)
|
|
1475
1479
|
);
|
|
1476
1480
|
}
|
|
1477
1481
|
if (summary.majorIssues > 0) {
|
|
1478
1482
|
console.log(
|
|
1479
|
-
|
|
1483
|
+
import_chalk8.default.yellow(` \u{1F7E1} Major: ${import_chalk8.default.bold(summary.majorIssues)}`)
|
|
1480
1484
|
);
|
|
1481
1485
|
}
|
|
1482
1486
|
if (summary.minorIssues > 0) {
|
|
1483
1487
|
console.log(
|
|
1484
|
-
|
|
1488
|
+
import_chalk8.default.blue(` \u{1F535} Minor: ${import_chalk8.default.bold(summary.minorIssues)}`)
|
|
1485
1489
|
);
|
|
1486
1490
|
}
|
|
1487
1491
|
console.log(
|
|
1488
|
-
|
|
1492
|
+
import_chalk8.default.green(
|
|
1489
1493
|
`
|
|
1490
|
-
\u{1F4A1} Potential savings: ${
|
|
1494
|
+
\u{1F4A1} Potential savings: ${import_chalk8.default.bold(summary.totalPotentialSavings.toLocaleString())} tokens
|
|
1491
1495
|
`
|
|
1492
1496
|
)
|
|
1493
1497
|
);
|
|
1494
1498
|
} else {
|
|
1495
|
-
console.log(
|
|
1499
|
+
console.log(import_chalk8.default.green("\u2705 No significant issues found!\n"));
|
|
1496
1500
|
}
|
|
1497
1501
|
if (summary.deepFiles.length > 0) {
|
|
1498
|
-
console.log(
|
|
1502
|
+
console.log(import_chalk8.default.bold("\u{1F4CF} Deep Import Chains:\n"));
|
|
1499
1503
|
console.log(
|
|
1500
|
-
|
|
1504
|
+
import_chalk8.default.gray(` Average depth: ${summary.avgImportDepth.toFixed(1)}`)
|
|
1501
1505
|
);
|
|
1502
1506
|
console.log(
|
|
1503
|
-
|
|
1507
|
+
import_chalk8.default.gray(` Maximum depth: ${summary.maxImportDepth}
|
|
1504
1508
|
`)
|
|
1505
1509
|
);
|
|
1506
1510
|
summary.deepFiles.slice(0, 10).forEach((item) => {
|
|
1507
1511
|
const fileName = item.file.split("/").slice(-2).join("/");
|
|
1508
1512
|
console.log(
|
|
1509
|
-
` ${
|
|
1513
|
+
` ${import_chalk8.default.cyan("\u2192")} ${import_chalk8.default.white(fileName)} ${import_chalk8.default.dim(`(depth: ${item.depth})`)}`
|
|
1510
1514
|
);
|
|
1511
1515
|
});
|
|
1512
1516
|
console.log();
|
|
1513
1517
|
}
|
|
1514
1518
|
if (summary.fragmentedModules.length > 0) {
|
|
1515
|
-
console.log(
|
|
1519
|
+
console.log(import_chalk8.default.bold("\u{1F9E9} Fragmented Modules:\n"));
|
|
1516
1520
|
console.log(
|
|
1517
|
-
|
|
1521
|
+
import_chalk8.default.gray(
|
|
1518
1522
|
` Average fragmentation: ${(summary.avgFragmentation * 100).toFixed(0)}%
|
|
1519
1523
|
`
|
|
1520
1524
|
)
|
|
1521
1525
|
);
|
|
1522
1526
|
summary.fragmentedModules.slice(0, 10).forEach((module2) => {
|
|
1523
1527
|
console.log(
|
|
1524
|
-
` ${
|
|
1528
|
+
` ${import_chalk8.default.yellow("\u25CF")} ${import_chalk8.default.white(module2.domain)} - ${import_chalk8.default.dim(`${module2.files.length} files, ${(module2.fragmentationScore * 100).toFixed(0)}% scattered`)}`
|
|
1525
1529
|
);
|
|
1526
1530
|
console.log(
|
|
1527
|
-
|
|
1531
|
+
import_chalk8.default.dim(
|
|
1528
1532
|
` Token cost: ${module2.totalTokens.toLocaleString()}, Cohesion: ${(module2.avgCohesion * 100).toFixed(0)}%`
|
|
1529
1533
|
)
|
|
1530
1534
|
);
|
|
@@ -1532,9 +1536,9 @@ async function contextAction(directory, options) {
|
|
|
1532
1536
|
console.log();
|
|
1533
1537
|
}
|
|
1534
1538
|
if (summary.lowCohesionFiles.length > 0) {
|
|
1535
|
-
console.log(
|
|
1539
|
+
console.log(import_chalk8.default.bold("\u{1F500} Low Cohesion Files:\n"));
|
|
1536
1540
|
console.log(
|
|
1537
|
-
|
|
1541
|
+
import_chalk8.default.gray(
|
|
1538
1542
|
` Average cohesion: ${(summary.avgCohesion * 100).toFixed(0)}%
|
|
1539
1543
|
`
|
|
1540
1544
|
)
|
|
@@ -1542,44 +1546,44 @@ async function contextAction(directory, options) {
|
|
|
1542
1546
|
summary.lowCohesionFiles.slice(0, 10).forEach((item) => {
|
|
1543
1547
|
const fileName = item.file.split("/").slice(-2).join("/");
|
|
1544
1548
|
const scorePercent = (item.score * 100).toFixed(0);
|
|
1545
|
-
const color = item.score < 0.4 ?
|
|
1549
|
+
const color = item.score < 0.4 ? import_chalk8.default.red : import_chalk8.default.yellow;
|
|
1546
1550
|
console.log(
|
|
1547
|
-
` ${color("\u25CB")} ${
|
|
1551
|
+
` ${color("\u25CB")} ${import_chalk8.default.white(fileName)} ${import_chalk8.default.dim(`(${scorePercent}% cohesion)`)}`
|
|
1548
1552
|
);
|
|
1549
1553
|
});
|
|
1550
1554
|
console.log();
|
|
1551
1555
|
}
|
|
1552
1556
|
if (summary.topExpensiveFiles.length > 0) {
|
|
1553
|
-
console.log(
|
|
1557
|
+
console.log(import_chalk8.default.bold("\u{1F4B8} Most Expensive Files (Context Budget):\n"));
|
|
1554
1558
|
summary.topExpensiveFiles.slice(0, 10).forEach((item) => {
|
|
1555
1559
|
const fileName = item.file.split("/").slice(-2).join("/");
|
|
1556
|
-
const severityColor = item.severity === "critical" ?
|
|
1560
|
+
const severityColor = item.severity === "critical" ? import_chalk8.default.red : item.severity === "major" ? import_chalk8.default.yellow : import_chalk8.default.blue;
|
|
1557
1561
|
console.log(
|
|
1558
|
-
` ${severityColor("\u25CF")} ${
|
|
1562
|
+
` ${severityColor("\u25CF")} ${import_chalk8.default.white(fileName)} ${import_chalk8.default.dim(`(${item.contextBudget.toLocaleString()} tokens)`)}`
|
|
1559
1563
|
);
|
|
1560
1564
|
});
|
|
1561
1565
|
console.log();
|
|
1562
1566
|
}
|
|
1563
1567
|
if (contextScore) {
|
|
1564
|
-
console.log(
|
|
1565
|
-
console.log(
|
|
1566
|
-
console.log(
|
|
1567
|
-
console.log((0,
|
|
1568
|
+
console.log(import_chalk8.default.cyan(divider));
|
|
1569
|
+
console.log(import_chalk8.default.bold.white(" AI READINESS SCORE (Context)"));
|
|
1570
|
+
console.log(import_chalk8.default.cyan(divider) + "\n");
|
|
1571
|
+
console.log((0, import_core10.formatToolScore)(contextScore));
|
|
1568
1572
|
console.log();
|
|
1569
1573
|
}
|
|
1570
1574
|
}
|
|
1571
1575
|
} catch (error) {
|
|
1572
|
-
(0,
|
|
1576
|
+
(0, import_core10.handleCLIError)(error, "Context analysis");
|
|
1573
1577
|
}
|
|
1574
1578
|
}
|
|
1575
1579
|
|
|
1576
1580
|
// src/commands/consistency.ts
|
|
1577
|
-
var
|
|
1581
|
+
var import_chalk9 = __toESM(require("chalk"));
|
|
1578
1582
|
var import_fs5 = require("fs");
|
|
1579
1583
|
var import_path7 = require("path");
|
|
1580
|
-
var
|
|
1584
|
+
var import_core11 = require("@aiready/core");
|
|
1581
1585
|
async function consistencyAction(directory, options) {
|
|
1582
|
-
console.log(
|
|
1586
|
+
console.log(import_chalk9.default.blue("\u{1F50D} Analyzing consistency...\n"));
|
|
1583
1587
|
const startTime = Date.now();
|
|
1584
1588
|
const resolvedDir = (0, import_path7.resolve)(process.cwd(), directory ?? ".");
|
|
1585
1589
|
try {
|
|
@@ -1594,7 +1598,7 @@ async function consistencyAction(directory, options) {
|
|
|
1594
1598
|
file: void 0
|
|
1595
1599
|
}
|
|
1596
1600
|
};
|
|
1597
|
-
const finalOptions = await (0,
|
|
1601
|
+
const finalOptions = await (0, import_core11.loadMergedConfig)(resolvedDir, defaults, {
|
|
1598
1602
|
checkNaming: options.naming !== false,
|
|
1599
1603
|
checkPatterns: options.patterns !== false,
|
|
1600
1604
|
minSeverity: options.minSeverity,
|
|
@@ -1603,7 +1607,7 @@ async function consistencyAction(directory, options) {
|
|
|
1603
1607
|
});
|
|
1604
1608
|
const { analyzeConsistency, calculateConsistencyScore } = await import("@aiready/consistency");
|
|
1605
1609
|
const report = await analyzeConsistency(finalOptions);
|
|
1606
|
-
const elapsedTime = (0,
|
|
1610
|
+
const elapsedTime = (0, import_core11.getElapsedTime)(startTime);
|
|
1607
1611
|
let consistencyScore;
|
|
1608
1612
|
if (options.score) {
|
|
1609
1613
|
const issues = report.results?.flatMap((r) => r.issues) ?? [];
|
|
@@ -1623,41 +1627,41 @@ async function consistencyAction(directory, options) {
|
|
|
1623
1627
|
},
|
|
1624
1628
|
...consistencyScore && { scoring: consistencyScore }
|
|
1625
1629
|
};
|
|
1626
|
-
const outputPath = (0,
|
|
1630
|
+
const outputPath = (0, import_core11.resolveOutputPath)(
|
|
1627
1631
|
userOutputFile,
|
|
1628
1632
|
`aiready-report-${getReportTimestamp()}.json`,
|
|
1629
1633
|
resolvedDir
|
|
1630
1634
|
);
|
|
1631
|
-
(0,
|
|
1635
|
+
(0, import_core11.handleJSONOutput)(
|
|
1632
1636
|
outputData,
|
|
1633
1637
|
outputPath,
|
|
1634
1638
|
`\u2705 Results saved to ${outputPath}`
|
|
1635
1639
|
);
|
|
1636
1640
|
} else if (outputFormat === "markdown") {
|
|
1637
1641
|
const markdown = generateMarkdownReport(report, elapsedTime);
|
|
1638
|
-
const outputPath = (0,
|
|
1642
|
+
const outputPath = (0, import_core11.resolveOutputPath)(
|
|
1639
1643
|
userOutputFile,
|
|
1640
1644
|
`aiready-report-${getReportTimestamp()}.md`,
|
|
1641
1645
|
resolvedDir
|
|
1642
1646
|
);
|
|
1643
1647
|
(0, import_fs5.writeFileSync)(outputPath, markdown);
|
|
1644
|
-
console.log(
|
|
1648
|
+
console.log(import_chalk9.default.green(`\u2705 Report saved to ${outputPath}`));
|
|
1645
1649
|
} else {
|
|
1646
|
-
console.log(
|
|
1650
|
+
console.log(import_chalk9.default.bold("\n\u{1F4CA} Summary\n"));
|
|
1647
1651
|
console.log(
|
|
1648
|
-
`Files Analyzed: ${
|
|
1652
|
+
`Files Analyzed: ${import_chalk9.default.cyan(report.summary.filesAnalyzed)}`
|
|
1649
1653
|
);
|
|
1650
|
-
console.log(`Total Issues: ${
|
|
1651
|
-
console.log(` Naming: ${
|
|
1652
|
-
console.log(` Patterns: ${
|
|
1654
|
+
console.log(`Total Issues: ${import_chalk9.default.yellow(report.summary.totalIssues)}`);
|
|
1655
|
+
console.log(` Naming: ${import_chalk9.default.yellow(report.summary.namingIssues)}`);
|
|
1656
|
+
console.log(` Patterns: ${import_chalk9.default.yellow(report.summary.patternIssues)}`);
|
|
1653
1657
|
console.log(
|
|
1654
|
-
` Architecture: ${
|
|
1658
|
+
` Architecture: ${import_chalk9.default.yellow(report.summary.architectureIssues ?? 0)}`
|
|
1655
1659
|
);
|
|
1656
|
-
console.log(`Analysis Time: ${
|
|
1660
|
+
console.log(`Analysis Time: ${import_chalk9.default.gray(elapsedTime + "s")}
|
|
1657
1661
|
`);
|
|
1658
1662
|
if (report.summary.totalIssues === 0) {
|
|
1659
1663
|
console.log(
|
|
1660
|
-
|
|
1664
|
+
import_chalk9.default.green(
|
|
1661
1665
|
"\u2728 No consistency issues found! Your codebase is well-maintained.\n"
|
|
1662
1666
|
)
|
|
1663
1667
|
);
|
|
@@ -1669,20 +1673,20 @@ async function consistencyAction(directory, options) {
|
|
|
1669
1673
|
(r) => r.issues.some((i) => i.category === "patterns")
|
|
1670
1674
|
);
|
|
1671
1675
|
if (namingResults.length > 0) {
|
|
1672
|
-
console.log(
|
|
1676
|
+
console.log(import_chalk9.default.bold("\u{1F3F7}\uFE0F Naming Issues\n"));
|
|
1673
1677
|
let shown = 0;
|
|
1674
|
-
for (const
|
|
1678
|
+
for (const namingFileResult of namingResults) {
|
|
1675
1679
|
if (shown >= 5) break;
|
|
1676
|
-
for (const issue of
|
|
1680
|
+
for (const issue of namingFileResult.issues) {
|
|
1677
1681
|
if (shown >= 5) break;
|
|
1678
|
-
const severityColor = issue.severity === "critical" ?
|
|
1682
|
+
const severityColor = issue.severity === "critical" ? import_chalk9.default.red : issue.severity === "major" ? import_chalk9.default.yellow : issue.severity === "minor" ? import_chalk9.default.blue : import_chalk9.default.gray;
|
|
1679
1683
|
console.log(
|
|
1680
|
-
`${severityColor(issue.severity.toUpperCase())} ${
|
|
1684
|
+
`${severityColor(issue.severity.toUpperCase())} ${import_chalk9.default.dim(`${issue.location.file}:${issue.location.line}`)}`
|
|
1681
1685
|
);
|
|
1682
1686
|
console.log(` ${issue.message}`);
|
|
1683
1687
|
if (issue.suggestion) {
|
|
1684
1688
|
console.log(
|
|
1685
|
-
` ${
|
|
1689
|
+
` ${import_chalk9.default.dim("\u2192")} ${import_chalk9.default.italic(issue.suggestion)}`
|
|
1686
1690
|
);
|
|
1687
1691
|
}
|
|
1688
1692
|
console.log();
|
|
@@ -1691,25 +1695,25 @@ async function consistencyAction(directory, options) {
|
|
|
1691
1695
|
}
|
|
1692
1696
|
const remaining = namingResults.reduce((sum, r) => sum + r.issues.length, 0) - shown;
|
|
1693
1697
|
if (remaining > 0) {
|
|
1694
|
-
console.log(
|
|
1698
|
+
console.log(import_chalk9.default.dim(` ... and ${remaining} more issues
|
|
1695
1699
|
`));
|
|
1696
1700
|
}
|
|
1697
1701
|
}
|
|
1698
1702
|
if (patternResults.length > 0) {
|
|
1699
|
-
console.log(
|
|
1703
|
+
console.log(import_chalk9.default.bold("\u{1F504} Pattern Issues\n"));
|
|
1700
1704
|
let shown = 0;
|
|
1701
|
-
for (const
|
|
1705
|
+
for (const patternFileResult of patternResults) {
|
|
1702
1706
|
if (shown >= 5) break;
|
|
1703
|
-
for (const issue of
|
|
1707
|
+
for (const issue of patternFileResult.issues) {
|
|
1704
1708
|
if (shown >= 5) break;
|
|
1705
|
-
const severityColor = issue.severity === "critical" ?
|
|
1709
|
+
const severityColor = issue.severity === "critical" ? import_chalk9.default.red : issue.severity === "major" ? import_chalk9.default.yellow : issue.severity === "minor" ? import_chalk9.default.blue : import_chalk9.default.gray;
|
|
1706
1710
|
console.log(
|
|
1707
|
-
`${severityColor(issue.severity.toUpperCase())} ${
|
|
1711
|
+
`${severityColor(issue.severity.toUpperCase())} ${import_chalk9.default.dim(`${issue.location.file}:${issue.location.line}`)}`
|
|
1708
1712
|
);
|
|
1709
1713
|
console.log(` ${issue.message}`);
|
|
1710
1714
|
if (issue.suggestion) {
|
|
1711
1715
|
console.log(
|
|
1712
|
-
` ${
|
|
1716
|
+
` ${import_chalk9.default.dim("\u2192")} ${import_chalk9.default.italic(issue.suggestion)}`
|
|
1713
1717
|
);
|
|
1714
1718
|
}
|
|
1715
1719
|
console.log();
|
|
@@ -1718,12 +1722,12 @@ async function consistencyAction(directory, options) {
|
|
|
1718
1722
|
}
|
|
1719
1723
|
const remaining = patternResults.reduce((sum, r) => sum + r.issues.length, 0) - shown;
|
|
1720
1724
|
if (remaining > 0) {
|
|
1721
|
-
console.log(
|
|
1725
|
+
console.log(import_chalk9.default.dim(` ... and ${remaining} more issues
|
|
1722
1726
|
`));
|
|
1723
1727
|
}
|
|
1724
1728
|
}
|
|
1725
1729
|
if (report.recommendations.length > 0) {
|
|
1726
|
-
console.log(
|
|
1730
|
+
console.log(import_chalk9.default.bold("\u{1F4A1} Recommendations\n"));
|
|
1727
1731
|
report.recommendations.forEach((rec, i) => {
|
|
1728
1732
|
console.log(`${i + 1}. ${rec}`);
|
|
1729
1733
|
});
|
|
@@ -1731,38 +1735,38 @@ async function consistencyAction(directory, options) {
|
|
|
1731
1735
|
}
|
|
1732
1736
|
}
|
|
1733
1737
|
if (consistencyScore) {
|
|
1734
|
-
console.log(
|
|
1735
|
-
console.log((0,
|
|
1738
|
+
console.log(import_chalk9.default.bold("\n\u{1F4CA} AI Readiness Score (Consistency)\n"));
|
|
1739
|
+
console.log((0, import_core11.formatToolScore)(consistencyScore));
|
|
1736
1740
|
console.log();
|
|
1737
1741
|
}
|
|
1738
1742
|
}
|
|
1739
1743
|
} catch (error) {
|
|
1740
|
-
(0,
|
|
1744
|
+
(0, import_core11.handleCLIError)(error, "Consistency analysis");
|
|
1741
1745
|
}
|
|
1742
1746
|
}
|
|
1743
1747
|
|
|
1744
1748
|
// src/commands/visualize.ts
|
|
1745
|
-
var
|
|
1749
|
+
var import_chalk10 = __toESM(require("chalk"));
|
|
1746
1750
|
var import_fs6 = require("fs");
|
|
1747
1751
|
var import_path8 = require("path");
|
|
1748
1752
|
var import_child_process = require("child_process");
|
|
1749
|
-
var import_core11 = require("@aiready/core");
|
|
1750
1753
|
var import_core12 = require("@aiready/core");
|
|
1754
|
+
var import_core13 = require("@aiready/core");
|
|
1751
1755
|
async function visualizeAction(directory, options) {
|
|
1752
1756
|
try {
|
|
1753
1757
|
const dirPath = (0, import_path8.resolve)(process.cwd(), directory ?? ".");
|
|
1754
1758
|
let reportPath = options.report ? (0, import_path8.resolve)(dirPath, options.report) : null;
|
|
1755
1759
|
if (!reportPath || !(0, import_fs6.existsSync)(reportPath)) {
|
|
1756
|
-
const latestScan = (0,
|
|
1760
|
+
const latestScan = (0, import_core13.findLatestReport)(dirPath);
|
|
1757
1761
|
if (latestScan) {
|
|
1758
1762
|
reportPath = latestScan;
|
|
1759
1763
|
console.log(
|
|
1760
|
-
|
|
1764
|
+
import_chalk10.default.dim(`Found latest report: ${latestScan.split("/").pop()}`)
|
|
1761
1765
|
);
|
|
1762
1766
|
} else {
|
|
1763
|
-
console.error(
|
|
1767
|
+
console.error(import_chalk10.default.red("\u274C No AI readiness report found"));
|
|
1764
1768
|
console.log(
|
|
1765
|
-
|
|
1769
|
+
import_chalk10.default.dim(
|
|
1766
1770
|
`
|
|
1767
1771
|
Generate a report with:
|
|
1768
1772
|
aiready scan --output json
|
|
@@ -1892,29 +1896,29 @@ Or specify a custom report:
|
|
|
1892
1896
|
return;
|
|
1893
1897
|
} else {
|
|
1894
1898
|
console.log(
|
|
1895
|
-
|
|
1899
|
+
import_chalk10.default.yellow(
|
|
1896
1900
|
"\u26A0\uFE0F Dev server not available (requires local @aiready/visualizer with web assets)."
|
|
1897
1901
|
)
|
|
1898
1902
|
);
|
|
1899
1903
|
console.log(
|
|
1900
|
-
|
|
1904
|
+
import_chalk10.default.cyan(" Falling back to static HTML generation...\n")
|
|
1901
1905
|
);
|
|
1902
1906
|
useDevMode = false;
|
|
1903
1907
|
}
|
|
1904
1908
|
} catch (err) {
|
|
1905
1909
|
console.error("Failed to start dev server:", err);
|
|
1906
1910
|
console.log(
|
|
1907
|
-
|
|
1911
|
+
import_chalk10.default.cyan(" Falling back to static HTML generation...\n")
|
|
1908
1912
|
);
|
|
1909
1913
|
useDevMode = false;
|
|
1910
1914
|
}
|
|
1911
1915
|
}
|
|
1912
1916
|
console.log("Generating HTML...");
|
|
1913
|
-
const html = (0,
|
|
1917
|
+
const html = (0, import_core13.generateHTML)(graph);
|
|
1914
1918
|
const defaultOutput = "visualization.html";
|
|
1915
1919
|
const outPath = (0, import_path8.resolve)(dirPath, options.output ?? defaultOutput);
|
|
1916
1920
|
(0, import_fs6.writeFileSync)(outPath, html, "utf8");
|
|
1917
|
-
console.log(
|
|
1921
|
+
console.log(import_chalk10.default.green(`\u2705 Visualization written to: ${outPath}`));
|
|
1918
1922
|
if (options.open || options.serve) {
|
|
1919
1923
|
const opener = process.platform === "darwin" ? "open" : process.platform === "win32" ? "start" : "xdg-open";
|
|
1920
1924
|
if (options.serve) {
|
|
@@ -1944,7 +1948,7 @@ Or specify a custom report:
|
|
|
1944
1948
|
server.listen(port, () => {
|
|
1945
1949
|
const addr = `http://localhost:${port}/`;
|
|
1946
1950
|
console.log(
|
|
1947
|
-
|
|
1951
|
+
import_chalk10.default.cyan(`\u{1F310} Local visualization server running at ${addr}`)
|
|
1948
1952
|
);
|
|
1949
1953
|
(0, import_child_process.spawn)(opener, [`"${addr}"`], { shell: true });
|
|
1950
1954
|
});
|
|
@@ -1960,10 +1964,10 @@ Or specify a custom report:
|
|
|
1960
1964
|
}
|
|
1961
1965
|
}
|
|
1962
1966
|
} catch (err) {
|
|
1963
|
-
(0,
|
|
1967
|
+
(0, import_core12.handleCLIError)(err, "Visualization");
|
|
1964
1968
|
}
|
|
1965
1969
|
}
|
|
1966
|
-
var
|
|
1970
|
+
var VISUALIZE_HELP_TEXT = `
|
|
1967
1971
|
EXAMPLES:
|
|
1968
1972
|
$ aiready visualize . # Auto-detects latest report, generates HTML
|
|
1969
1973
|
$ aiready visualize . --report .aiready/aiready-report-20260217-143022.json
|
|
@@ -1980,7 +1984,7 @@ NOTES:
|
|
|
1980
1984
|
- --dev starts a Vite dev server with live reload (requires local @aiready/visualizer installation).
|
|
1981
1985
|
When --dev is not available, it falls back to static HTML generation.
|
|
1982
1986
|
`;
|
|
1983
|
-
var
|
|
1987
|
+
var VISUALISE_HELP_TEXT = `
|
|
1984
1988
|
EXAMPLES:
|
|
1985
1989
|
$ aiready visualise . # Auto-detects latest report
|
|
1986
1990
|
$ aiready visualise . --report .aiready/aiready-report-20260217-143022.json
|
|
@@ -1991,19 +1995,19 @@ NOTES:
|
|
|
1991
1995
|
`;
|
|
1992
1996
|
|
|
1993
1997
|
// src/commands/shared/standard-tool-actions.ts
|
|
1994
|
-
var import_chalk10 = __toESM(require("chalk"));
|
|
1995
|
-
|
|
1996
|
-
// src/commands/agent-grounding.ts
|
|
1997
1998
|
var import_chalk11 = __toESM(require("chalk"));
|
|
1998
|
-
var import_core13 = require("@aiready/core");
|
|
1999
1999
|
|
|
2000
|
-
// src/commands/
|
|
2000
|
+
// src/commands/agent-grounding.ts
|
|
2001
2001
|
var import_chalk12 = __toESM(require("chalk"));
|
|
2002
2002
|
var import_core14 = require("@aiready/core");
|
|
2003
|
+
|
|
2004
|
+
// src/commands/testability.ts
|
|
2005
|
+
var import_chalk13 = __toESM(require("chalk"));
|
|
2006
|
+
var import_core15 = require("@aiready/core");
|
|
2003
2007
|
async function testabilityAction(directory, options) {
|
|
2004
2008
|
const { analyzeTestability, calculateTestabilityScore } = await import("@aiready/testability");
|
|
2005
|
-
const config = await (0,
|
|
2006
|
-
const merged = (0,
|
|
2009
|
+
const config = await (0, import_core15.loadConfig)(directory);
|
|
2010
|
+
const merged = (0, import_core15.mergeConfigWithDefaults)(config, {
|
|
2007
2011
|
minCoverageRatio: 0.3
|
|
2008
2012
|
});
|
|
2009
2013
|
const report = await analyzeTestability({
|
|
@@ -2023,28 +2027,28 @@ async function testabilityAction(directory, options) {
|
|
|
2023
2027
|
"blind-risk": "\u{1F480}"
|
|
2024
2028
|
};
|
|
2025
2029
|
const safetyColors = {
|
|
2026
|
-
safe:
|
|
2027
|
-
"moderate-risk":
|
|
2028
|
-
"high-risk":
|
|
2029
|
-
"blind-risk":
|
|
2030
|
+
safe: import_chalk13.default.green,
|
|
2031
|
+
"moderate-risk": import_chalk13.default.yellow,
|
|
2032
|
+
"high-risk": import_chalk13.default.red,
|
|
2033
|
+
"blind-risk": import_chalk13.default.bgRed.white
|
|
2030
2034
|
};
|
|
2031
2035
|
const safety = report.summary.aiChangeSafetyRating;
|
|
2032
2036
|
const icon = safetyIcons[safety] ?? "\u2753";
|
|
2033
|
-
const color = safetyColors[safety] ??
|
|
2037
|
+
const color = safetyColors[safety] ?? import_chalk13.default.white;
|
|
2034
2038
|
console.log(
|
|
2035
|
-
` \u{1F9EA} Testability: ${
|
|
2039
|
+
` \u{1F9EA} Testability: ${import_chalk13.default.bold(scoring.score + "/100")} (${report.summary.rating})`
|
|
2036
2040
|
);
|
|
2037
2041
|
console.log(
|
|
2038
2042
|
` AI Change Safety: ${color(`${icon} ${safety.toUpperCase()}`)}`
|
|
2039
2043
|
);
|
|
2040
2044
|
console.log(
|
|
2041
|
-
|
|
2045
|
+
import_chalk13.default.dim(
|
|
2042
2046
|
` Coverage: ${Math.round(report.summary.coverageRatio * 100)}% (${report.rawData.testFiles} test / ${report.rawData.sourceFiles} source files)`
|
|
2043
2047
|
)
|
|
2044
2048
|
);
|
|
2045
2049
|
if (safety === "blind-risk") {
|
|
2046
2050
|
console.log(
|
|
2047
|
-
|
|
2051
|
+
import_chalk13.default.red.bold(
|
|
2048
2052
|
"\n \u26A0\uFE0F NO TESTS \u2014 AI changes to this codebase are completely unverifiable!\n"
|
|
2049
2053
|
)
|
|
2050
2054
|
);
|
|
@@ -2056,7 +2060,7 @@ async function testabilityAction(directory, options) {
|
|
|
2056
2060
|
var import_cli = require("@aiready/change-amplification/dist/cli.js");
|
|
2057
2061
|
|
|
2058
2062
|
// src/commands/bug.ts
|
|
2059
|
-
var
|
|
2063
|
+
var import_chalk14 = __toESM(require("chalk"));
|
|
2060
2064
|
var import_child_process2 = require("child_process");
|
|
2061
2065
|
async function bugAction(message, options) {
|
|
2062
2066
|
const repoUrl = "https://github.com/caopengau/aiready-cli";
|
|
@@ -2074,35 +2078,35 @@ Generated via AIReady CLI 'bug' command.
|
|
|
2074
2078
|
Type: ${type}
|
|
2075
2079
|
`.trim();
|
|
2076
2080
|
if (options.submit) {
|
|
2077
|
-
console.log(
|
|
2081
|
+
console.log(import_chalk14.default.blue("\u{1F680} Submitting issue via GitHub CLI...\n"));
|
|
2078
2082
|
try {
|
|
2079
2083
|
(0, import_child_process2.execSync)("gh auth status", { stdio: "ignore" });
|
|
2080
2084
|
const command = `gh issue create --repo ${repoSlug} --title ${JSON.stringify(title)} --body ${JSON.stringify(body)} --label ${label}`;
|
|
2081
2085
|
const output = (0, import_child_process2.execSync)(command, { encoding: "utf8" }).trim();
|
|
2082
|
-
console.log(
|
|
2083
|
-
console.log(
|
|
2086
|
+
console.log(import_chalk14.default.green("\u2705 Issue Created Successfully!"));
|
|
2087
|
+
console.log(import_chalk14.default.cyan(output));
|
|
2084
2088
|
return;
|
|
2085
2089
|
} catch {
|
|
2086
|
-
console.error(
|
|
2090
|
+
console.error(import_chalk14.default.red("\n\u274C Failed to submit via gh CLI."));
|
|
2087
2091
|
console.log(
|
|
2088
|
-
|
|
2092
|
+
import_chalk14.default.yellow(
|
|
2089
2093
|
' Make sure gh is installed and run "gh auth login".\n'
|
|
2090
2094
|
)
|
|
2091
2095
|
);
|
|
2092
|
-
console.log(
|
|
2096
|
+
console.log(import_chalk14.default.dim(" Falling back to URL generation..."));
|
|
2093
2097
|
}
|
|
2094
2098
|
}
|
|
2095
2099
|
const template = type === "bug" ? "bug_report.md" : type === "feature" ? "feature_request.md" : "new_metric_idea.md";
|
|
2096
2100
|
const fullUrl = `${repoUrl}/issues/new?title=${encodeURIComponent(title)}&body=${encodeURIComponent(body)}&labels=${label}&template=${template}`;
|
|
2097
|
-
console.log(
|
|
2098
|
-
console.log(
|
|
2099
|
-
console.log(
|
|
2100
|
-
console.log(
|
|
2101
|
-
console.log(
|
|
2102
|
-
console.log(
|
|
2103
|
-
console.log(
|
|
2101
|
+
console.log(import_chalk14.default.green("\u{1F680} Issue Draft Prepared!\n"));
|
|
2102
|
+
console.log(import_chalk14.default.bold("Title: ") + title);
|
|
2103
|
+
console.log(import_chalk14.default.bold("Type: ") + type);
|
|
2104
|
+
console.log(import_chalk14.default.bold("\nClick the link below to submit this issue:"));
|
|
2105
|
+
console.log(import_chalk14.default.cyan(fullUrl));
|
|
2106
|
+
console.log(import_chalk14.default.bold("\n\u{1F916} [FOR AI AGENTS]:"));
|
|
2107
|
+
console.log(import_chalk14.default.dim(" You have successfully prepared a report."));
|
|
2104
2108
|
console.log(
|
|
2105
|
-
|
|
2109
|
+
import_chalk14.default.dim(
|
|
2106
2110
|
" Please present the URL above to the user so they can finalize the submission."
|
|
2107
2111
|
)
|
|
2108
2112
|
);
|
|
@@ -2111,19 +2115,19 @@ Type: ${type}
|
|
|
2111
2115
|
const bugUrl = `${repoUrl}/issues/new?template=bug_report.md`;
|
|
2112
2116
|
const featureUrl = `${repoUrl}/issues/new?template=feature_request.md`;
|
|
2113
2117
|
const metricUrl = `${repoUrl}/issues/new?template=new_metric_idea.md`;
|
|
2114
|
-
console.log(
|
|
2115
|
-
console.log(` Report a Bug: ${
|
|
2116
|
-
console.log(` Request a Feature: ${
|
|
2117
|
-
console.log(` Suggest a Metric: ${
|
|
2118
|
-
console.log(
|
|
2119
|
-
console.log(
|
|
2118
|
+
console.log(import_chalk14.default.blue("\u{1F4AC} Feedback & Bug Reports\n"));
|
|
2119
|
+
console.log(` Report a Bug: ${import_chalk14.default.cyan(bugUrl)}`);
|
|
2120
|
+
console.log(` Request a Feature: ${import_chalk14.default.cyan(featureUrl)}`);
|
|
2121
|
+
console.log(` Suggest a Metric: ${import_chalk14.default.cyan(metricUrl)}`);
|
|
2122
|
+
console.log(import_chalk14.default.bold("\n\u{1F916} [FOR AI AGENTS]:"));
|
|
2123
|
+
console.log(import_chalk14.default.dim(" To prepare a specific report, run:"));
|
|
2120
2124
|
console.log(
|
|
2121
|
-
|
|
2125
|
+
import_chalk14.default.cyan(
|
|
2122
2126
|
' aiready bug "your description here" --type bug|feature|metric'
|
|
2123
2127
|
)
|
|
2124
2128
|
);
|
|
2125
2129
|
}
|
|
2126
|
-
var
|
|
2130
|
+
var BUG_HELP_TEXT = `
|
|
2127
2131
|
EXAMPLES:
|
|
2128
2132
|
$ aiready bug # Show general links
|
|
2129
2133
|
$ aiready bug "Naming check is too slow" # Prepare a pre-filled bug report
|
|
@@ -2200,7 +2204,7 @@ program.command("scan").description(
|
|
|
2200
2204
|
"--fail-on <level>",
|
|
2201
2205
|
"Fail on issues: critical, major, any",
|
|
2202
2206
|
"critical"
|
|
2203
|
-
).option("--api-key <key>", "Platform API key for automatic upload").option("--upload", "Automatically upload results to the platform").option("--server <url>", "Custom platform URL").addHelpText("after",
|
|
2207
|
+
).option("--api-key <key>", "Platform API key for automatic upload").option("--upload", "Automatically upload results to the platform").option("--server <url>", "Custom platform URL").addHelpText("after", SCAN_HELP_TEXT).action(async (directory, options) => {
|
|
2204
2208
|
await scanAction(directory, options);
|
|
2205
2209
|
});
|
|
2206
2210
|
program.command("init").description("Generate a default configuration (aiready.json)").option("-f, --force", "Overwrite existing configuration file").option(
|
|
@@ -2219,7 +2223,7 @@ program.command("patterns").description("Detect duplicate code patterns that con
|
|
|
2219
2223
|
).option(
|
|
2220
2224
|
"--full-scan",
|
|
2221
2225
|
"Disable smart defaults for comprehensive analysis (slower)"
|
|
2222
|
-
).option("--include <patterns>", "File patterns to include (comma-separated)").option("--exclude <patterns>", "File patterns to exclude (comma-separated)").option("-o, --output <format>", "Output format: console, json", "console").option("--output-file <path>", "Output file path (for json)").option("--score", "Calculate and display AI Readiness Score (0-100)", true).option("--no-score", "Disable calculating AI Readiness Score").addHelpText("after",
|
|
2226
|
+
).option("--include <patterns>", "File patterns to include (comma-separated)").option("--exclude <patterns>", "File patterns to exclude (comma-separated)").option("-o, --output <format>", "Output format: console, json", "console").option("--output-file <path>", "Output file path (for json)").option("--score", "Calculate and display AI Readiness Score (0-100)", true).option("--no-score", "Disable calculating AI Readiness Score").addHelpText("after", PATTERNS_HELP_TEXT).action(async (directory, options) => {
|
|
2223
2227
|
await patternsAction(directory, options);
|
|
2224
2228
|
});
|
|
2225
2229
|
program.command("context").description("Analyze context window costs and dependency fragmentation").argument("[directory]", "Directory to analyze", ".").option("--max-depth <number>", "Maximum acceptable import depth", "5").option(
|
|
@@ -2255,7 +2259,7 @@ program.command("visualise").description("Alias for visualize (British spelling)
|
|
|
2255
2259
|
"--dev",
|
|
2256
2260
|
"Start Vite dev server (live reload) for interactive development",
|
|
2257
2261
|
true
|
|
2258
|
-
).addHelpText("after",
|
|
2262
|
+
).addHelpText("after", VISUALISE_HELP_TEXT).action(async (directory, options) => {
|
|
2259
2263
|
await visualizeAction(directory, options);
|
|
2260
2264
|
});
|
|
2261
2265
|
program.command("visualize").description("Generate interactive visualization from an AIReady report").argument("[directory]", "Directory to analyze", ".").option(
|
|
@@ -2273,7 +2277,7 @@ program.command("visualize").description("Generate interactive visualization fro
|
|
|
2273
2277
|
"--dev",
|
|
2274
2278
|
"Start Vite dev server (live reload) for interactive development",
|
|
2275
2279
|
false
|
|
2276
|
-
).addHelpText("after",
|
|
2280
|
+
).addHelpText("after", VISUALIZE_HELP_TEXT).action(async (directory, options) => {
|
|
2277
2281
|
await visualizeAction(directory, options);
|
|
2278
2282
|
});
|
|
2279
2283
|
program.command("change-amplification").description("Analyze graph metrics for change amplification").argument("[directory]", "Directory to analyze", ".").option("--include <patterns>", "File patterns to include (comma-separated)").option("--exclude <patterns>", "File patterns to exclude (comma-separated)").option("-o, --output <format>", "Output format: console, json", "console").option("--output-file <path>", "Output file path (for json)").action(async (directory, options) => {
|
|
@@ -2282,10 +2286,10 @@ program.command("change-amplification").description("Analyze graph metrics for c
|
|
|
2282
2286
|
program.command("testability").description("Analyze test coverage and AI readiness").argument("[directory]", "Directory to analyze", ".").option("--min-coverage <ratio>", "Minimum acceptable coverage ratio", "0.3").option("--include <patterns>", "File patterns to include (comma-separated)").option("--exclude <patterns>", "File patterns to exclude (comma-separated)").option("-o, --output <format>", "Output format: console, json", "console").option("--output-file <path>", "Output file path (for json)").action(async (directory, options) => {
|
|
2283
2287
|
await testabilityAction(directory, options);
|
|
2284
2288
|
});
|
|
2285
|
-
program.command("upload").description("Upload an AIReady report JSON to the platform").argument("<file>", "Report JSON file to upload").option("--api-key <key>", "Platform API key").option("--repo-id <id>", "Platform repository ID (optional)").option("--server <url>", "Custom platform URL").addHelpText("after",
|
|
2289
|
+
program.command("upload").description("Upload an AIReady report JSON to the platform").argument("<file>", "Report JSON file to upload").option("--api-key <key>", "Platform API key").option("--repo-id <id>", "Platform repository ID (optional)").option("--server <url>", "Custom platform URL").addHelpText("after", UPLOAD_HELP_TEXT).action(async (file, options) => {
|
|
2286
2290
|
await uploadAction(file, options);
|
|
2287
2291
|
});
|
|
2288
|
-
program.command("bug").description("Report a bug or provide feedback (Agent-friendly)").argument("[message]", "Short description of the issue").option("-t, --type <type>", "Issue type: bug, feature, metric", "bug").option("--submit", "Submit the issue directly using the GitHub CLI (gh)").addHelpText("after",
|
|
2292
|
+
program.command("bug").description("Report a bug or provide feedback (Agent-friendly)").argument("[message]", "Short description of the issue").option("-t, --type <type>", "Issue type: bug, feature, metric", "bug").option("--submit", "Submit the issue directly using the GitHub CLI (gh)").addHelpText("after", BUG_HELP_TEXT).action(async (message, options) => {
|
|
2289
2293
|
await bugAction(message, options);
|
|
2290
2294
|
});
|
|
2291
2295
|
program.parse();
|