@aiready/cli 0.12.14 → 0.12.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +6 -6
- package/.turbo/turbo-test.log +54 -36
- package/dist/chunk-VOKP7FGM.mjs +303 -0
- package/dist/cli.js +1 -0
- package/dist/cli.mjs +1 -1
- package/dist/index.js +1 -0
- package/dist/index.mjs +1 -1
- package/package.json +12 -12
- package/src/index.ts +4 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> @aiready/cli@0.12.
|
|
3
|
+
> @aiready/cli@0.12.16 build /Users/pengcao/projects/aiready/packages/cli
|
|
4
4
|
> tsup src/index.ts src/cli.ts --format cjs,esm
|
|
5
5
|
|
|
6
6
|
[34mCLI[39m Building entry: src/cli.ts, src/index.ts
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
[34mCJS[39m Build start
|
|
11
11
|
[34mESM[39m Build start
|
|
12
12
|
|
|
13
|
-
[43m[30m WARN [39m[49m [33m▲ [43;33m[[43;30mWARNING[43;33m][0m [1m"import.meta" is not available with the "cjs" output format and will be empty[0m [empty-import-meta]
|
|
13
|
+
[90m[[90m12:19:30 am[90m][39m [43m[30m WARN [39m[49m [33m▲ [43;33m[[43;30mWARNING[43;33m][0m [1m"import.meta" is not available with the "cjs" output format and will be empty[0m [empty-import-meta]
|
|
14
14
|
|
|
15
15
|
src/cli.ts:25:31:
|
|
16
16
|
[37m 25 │ return dirname(fileURLToPath([32mimport.meta[37m.url));
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
[32mCJS[39m [1mdist/cli.js [22m[32m69.48 KB[39m
|
|
24
|
-
[32mCJS[39m [1mdist/index.js [22m[32m10.58 KB[39m
|
|
25
|
-
[32mCJS[39m ⚡️ Build success in 26ms
|
|
26
23
|
[32mESM[39m [1mdist/cli.mjs [22m[32m56.89 KB[39m
|
|
27
|
-
[32mESM[39m [1mdist/chunk-2QOU5KKW.mjs [22m[32m9.48 KB[39m
|
|
28
24
|
[32mESM[39m [1mdist/index.mjs [22m[32m170.00 B[39m
|
|
25
|
+
[32mESM[39m [1mdist/chunk-VOKP7FGM.mjs [22m[32m9.52 KB[39m
|
|
29
26
|
[32mESM[39m ⚡️ Build success in 26ms
|
|
27
|
+
[32mCJS[39m [1mdist/index.js [22m[32m10.62 KB[39m
|
|
28
|
+
[32mCJS[39m [1mdist/cli.js [22m[32m69.52 KB[39m
|
|
29
|
+
[32mCJS[39m ⚡️ Build success in 27ms
|
package/.turbo/turbo-test.log
CHANGED
|
@@ -1,92 +1,110 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> @aiready/cli@0.12.
|
|
3
|
+
> @aiready/cli@0.12.16 test /Users/pengcao/projects/aiready/packages/cli
|
|
4
4
|
> vitest run
|
|
5
5
|
|
|
6
6
|
[?25l
|
|
7
7
|
[1m[46m RUN [49m[22m [36mv4.0.18 [39m[90m/Users/pengcao/projects/aiready/packages/cli[39m
|
|
8
8
|
|
|
9
9
|
[90mstdout[2m | src/__tests__/config-shape.test.ts
|
|
10
|
-
[22m[39m[ToolRegistry#0.
|
|
10
|
+
[22m[39m[ToolRegistry#0.2971650203224203] Registering tool: pattern-detect (patterns, duplicates, duplication)
|
|
11
11
|
|
|
12
12
|
[90mstdout[2m | src/__tests__/cli.test.ts
|
|
13
|
-
[22m[39m[ToolRegistry#0.
|
|
13
|
+
[22m[39m[ToolRegistry#0.0780364686767725] Registering tool: pattern-detect (patterns, duplicates, duplication)
|
|
14
|
+
|
|
15
|
+
[90mstdout[2m | src/__tests__/cli.test.ts
|
|
16
|
+
[22m[39m[ToolRegistry#0.0780364686767725] Registering tool: context-analyzer (context, fragmentation, budget)
|
|
14
17
|
|
|
15
18
|
[90mstdout[2m | src/__tests__/config-shape.test.ts
|
|
16
|
-
[22m[39m[ToolRegistry#0.
|
|
19
|
+
[22m[39m[ToolRegistry#0.2971650203224203] Registering tool: context-analyzer (context, fragmentation, budget)
|
|
17
20
|
|
|
18
21
|
[90mstdout[2m | src/__tests__/cli.test.ts
|
|
19
|
-
[22m[39m[ToolRegistry#0.
|
|
22
|
+
[22m[39m[ToolRegistry#0.0780364686767725] Registering tool: naming-consistency (consistency, naming, standards)
|
|
20
23
|
|
|
21
24
|
[90mstdout[2m | src/__tests__/config-shape.test.ts
|
|
22
|
-
[22m[39m[ToolRegistry#0.
|
|
25
|
+
[22m[39m[ToolRegistry#0.2971650203224203] Registering tool: naming-consistency (consistency, naming, standards)
|
|
23
26
|
|
|
24
27
|
[90mstdout[2m | src/__tests__/cli.test.ts
|
|
25
|
-
[22m[39m[ToolRegistry#0.
|
|
28
|
+
[22m[39m[ToolRegistry#0.0780364686767725] Registering tool: ai-signal-clarity (ai-signal, clarity, hallucination)
|
|
29
|
+
|
|
30
|
+
[90mstdout[2m | src/__tests__/config-shape.test.ts
|
|
31
|
+
[22m[39m[ToolRegistry#0.2971650203224203] Registering tool: ai-signal-clarity (ai-signal, clarity, hallucination)
|
|
26
32
|
|
|
27
33
|
[90mstdout[2m | src/__tests__/cli.test.ts
|
|
28
|
-
[22m[39m[ToolRegistry#0.
|
|
34
|
+
[22m[39m[ToolRegistry#0.0780364686767725] Registering tool: agent-grounding (agent-grounding, grounding, navigation)
|
|
29
35
|
|
|
30
36
|
[90mstdout[2m | src/__tests__/config-shape.test.ts
|
|
31
|
-
[22m[39m[ToolRegistry#0.
|
|
37
|
+
[22m[39m[ToolRegistry#0.2971650203224203] Registering tool: agent-grounding (agent-grounding, grounding, navigation)
|
|
32
38
|
|
|
33
39
|
[90mstdout[2m | src/__tests__/config-shape.test.ts
|
|
34
|
-
[22m[39m[ToolRegistry#0.
|
|
40
|
+
[22m[39m[ToolRegistry#0.2971650203224203] Registering tool: testability-index (testability, tests, verification)
|
|
35
41
|
|
|
36
42
|
[90mstdout[2m | src/__tests__/cli.test.ts
|
|
37
|
-
[22m[39m[ToolRegistry#0.
|
|
43
|
+
[22m[39m[ToolRegistry#0.0780364686767725] Registering tool: testability-index (testability, tests, verification)
|
|
38
44
|
|
|
39
45
|
[90mstdout[2m | src/__tests__/cli.test.ts
|
|
40
|
-
[22m[39m[ToolRegistry#0.
|
|
46
|
+
[22m[39m[ToolRegistry#0.0780364686767725] Registering tool: doc-drift (doc-drift, docs, jsdoc)
|
|
41
47
|
|
|
42
48
|
[90mstdout[2m | src/__tests__/config-shape.test.ts
|
|
43
|
-
[22m[39m[ToolRegistry#0.
|
|
44
|
-
|
|
45
|
-
[90mstdout[2m | src/__tests__/config-shape.test.ts
|
|
46
|
-
[22m[39m[ToolRegistry#0.9033815218908418] Registering tool: doc-drift (doc-drift, docs, jsdoc)
|
|
49
|
+
[22m[39m[ToolRegistry#0.2971650203224203] Registering tool: doc-drift (doc-drift, docs, jsdoc)
|
|
47
50
|
|
|
48
51
|
[90mstdout[2m | src/__tests__/cli.test.ts
|
|
49
|
-
[22m[39m[ToolRegistry#0.
|
|
52
|
+
[22m[39m[ToolRegistry#0.0780364686767725] Registering tool: dependency-health (deps, deps-health, packages)
|
|
50
53
|
|
|
51
54
|
[90mstdout[2m | src/__tests__/config-shape.test.ts
|
|
52
|
-
[22m[39m[ToolRegistry#0.
|
|
55
|
+
[22m[39m[ToolRegistry#0.2971650203224203] Registering tool: dependency-health (deps, deps-health, packages)
|
|
53
56
|
|
|
54
57
|
[90mstdout[2m | src/__tests__/cli.test.ts
|
|
55
|
-
[22m[39m[ToolRegistry#0.
|
|
58
|
+
[22m[39m[ToolRegistry#0.0780364686767725] Registering tool: change-amplification (change-amp, change-amplification, coupling)
|
|
56
59
|
|
|
57
60
|
[90mstdout[2m | src/__tests__/config-shape.test.ts
|
|
58
|
-
[22m[39m[ToolRegistry#0.
|
|
59
|
-
|
|
60
|
-
[90mstdout[2m | src/__tests__/cli.test.ts
|
|
61
|
-
[22m[39m[ToolRegistry#0.9221699210349066] Registering tool: change-amplification (change-amp, change-amplification, coupling)
|
|
61
|
+
[22m[39m[ToolRegistry#0.2971650203224203] Registering tool: change-amplification (change-amp, change-amplification, coupling)
|
|
62
62
|
|
|
63
63
|
[90mstdout[2m | src/__tests__/cli.test.ts[2m > [22m[2mCLI Unified Analysis[2m > [22m[2mshould run unified analysis with both tools
|
|
64
|
-
[22m[39m[ToolRegistry#0.
|
|
65
|
-
[ToolRegistry#0.
|
|
64
|
+
[22m[39m[ToolRegistry#0.0780364686767725] Registering tool: pattern-detect (patterns)
|
|
65
|
+
[ToolRegistry#0.0780364686767725] Registering tool: context-analyzer (context)
|
|
66
66
|
|
|
67
67
|
[90mstdout[2m | src/__tests__/config-shape.test.ts[2m > [22m[2mCLI Configuration Shape[2m > [22m[2mshould generate a strictly portable AIReadyConfig in summary
|
|
68
|
-
[22m[39m[ToolRegistry#0.
|
|
68
|
+
[22m[39m[ToolRegistry#0.2971650203224203] Registering tool: pattern-detect (patterns)
|
|
69
|
+
|
|
70
|
+
[90mstderr[2m | src/__tests__/cli.test.ts[2m > [22m[2mCLI Unified Analysis[2m > [22m[2mshould run unified analysis with both tools
|
|
71
|
+
[22m[39mPython WASM not found in common locations, attempting fallback regex parser
|
|
72
|
+
|
|
73
|
+
[90mstderr[2m | src/__tests__/config-shape.test.ts[2m > [22m[2mCLI Configuration Shape[2m > [22m[2mshould generate a strictly portable AIReadyConfig in summary
|
|
74
|
+
[22m[39mPython WASM not found in common locations, attempting fallback regex parser
|
|
69
75
|
|
|
70
76
|
[90mstdout[2m | src/__tests__/cli.test.ts[2m > [22m[2mCLI Unified Analysis[2m > [22m[2mshould run analysis with only patterns tool
|
|
71
|
-
[22m[39m[ToolRegistry#0.
|
|
72
|
-
[ToolRegistry#0.
|
|
77
|
+
[22m[39m[ToolRegistry#0.0780364686767725] Registering tool: pattern-detect (patterns)
|
|
78
|
+
[ToolRegistry#0.0780364686767725] Registering tool: context-analyzer (context)
|
|
79
|
+
|
|
80
|
+
[90mstderr[2m | src/__tests__/cli.test.ts[2m > [22m[2mCLI Unified Analysis[2m > [22m[2mshould run analysis with only patterns tool
|
|
81
|
+
[22m[39mPython WASM not found in common locations, attempting fallback regex parser
|
|
73
82
|
|
|
74
83
|
[90mstdout[2m | src/__tests__/cli.test.ts[2m > [22m[2mCLI Unified Analysis[2m > [22m[2mshould run analysis with only context tool
|
|
75
|
-
[22m[39m[ToolRegistry#0.
|
|
76
|
-
[ToolRegistry#0.
|
|
84
|
+
[22m[39m[ToolRegistry#0.0780364686767725] Registering tool: pattern-detect (patterns)
|
|
85
|
+
[ToolRegistry#0.0780364686767725] Registering tool: context-analyzer (context)
|
|
86
|
+
|
|
87
|
+
[90mstderr[2m | src/__tests__/cli.test.ts[2m > [22m[2mCLI Unified Analysis[2m > [22m[2mshould run analysis with only context tool
|
|
88
|
+
[22m[39mPython WASM not found in common locations, attempting fallback regex parser
|
|
77
89
|
|
|
78
90
|
[90mstdout[2m | src/__tests__/config-shape.test.ts[2m > [22m[2mCLI Configuration Shape[2m > [22m[2mshould strip internal keys like useSmartDefaults and batchSize
|
|
79
|
-
[22m[39m[ToolRegistry#0.
|
|
91
|
+
[22m[39m[ToolRegistry#0.2971650203224203] Registering tool: pattern-detect (patterns)
|
|
92
|
+
|
|
93
|
+
[90mstderr[2m | src/__tests__/config-shape.test.ts[2m > [22m[2mCLI Configuration Shape[2m > [22m[2mshould strip internal keys like useSmartDefaults and batchSize
|
|
94
|
+
[22m[39mPython WASM not found in common locations, attempting fallback regex parser
|
|
80
95
|
|
|
81
96
|
[90mstdout[2m | src/__tests__/config-shape.test.ts[2m > [22m[2mCLI Configuration Shape[2m > [22m[2mshould produce a config that is compatible with tool specific collection
|
|
82
|
-
[22m[39m[ToolRegistry#0.
|
|
97
|
+
[22m[39m[ToolRegistry#0.2971650203224203] Registering tool: pattern-detect (patterns)
|
|
98
|
+
|
|
99
|
+
[32m✓[39m src/__tests__/cli.test.ts [2m([22m[2m3 tests[22m[2m)[22m[32m 7[2mms[22m[39m
|
|
100
|
+
[90mstderr[2m | src/__tests__/config-shape.test.ts[2m > [22m[2mCLI Configuration Shape[2m > [22m[2mshould produce a config that is compatible with tool specific collection
|
|
101
|
+
[22m[39mPython WASM not found in common locations, attempting fallback regex parser
|
|
83
102
|
|
|
84
|
-
[32m✓[39m src/__tests__/
|
|
85
|
-
[32m✓[39m src/__tests__/config-shape.test.ts [2m([22m[2m3 tests[22m[2m)[22m[32m 3[2mms[22m[39m
|
|
103
|
+
[32m✓[39m src/__tests__/config-shape.test.ts [2m([22m[2m3 tests[22m[2m)[22m[32m 7[2mms[22m[39m
|
|
86
104
|
|
|
87
105
|
[2m Test Files [22m [1m[32m2 passed[39m[22m[90m (2)[39m
|
|
88
106
|
[2m Tests [22m [1m[32m6 passed[39m[22m[90m (6)[39m
|
|
89
|
-
[2m Start at [22m
|
|
90
|
-
[2m Duration [22m
|
|
107
|
+
[2m Start at [22m 00:19:49
|
|
108
|
+
[2m Duration [22m 442ms[2m (transform 237ms, setup 0ms, import 642ms, tests 14ms, environment 0ms)[22m
|
|
91
109
|
|
|
92
110
|
[?25h
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
2
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
3
|
+
}) : x)(function(x) {
|
|
4
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
5
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
// src/index.ts
|
|
9
|
+
import {
|
|
10
|
+
ToolRegistry,
|
|
11
|
+
ToolName,
|
|
12
|
+
calculateOverallScore,
|
|
13
|
+
calculateTokenBudget,
|
|
14
|
+
GLOBAL_INFRA_OPTIONS,
|
|
15
|
+
COMMON_FINE_TUNING_OPTIONS,
|
|
16
|
+
initializeParsers
|
|
17
|
+
} from "@aiready/core";
|
|
18
|
+
import "@aiready/pattern-detect";
|
|
19
|
+
import "@aiready/context-analyzer";
|
|
20
|
+
import "@aiready/consistency";
|
|
21
|
+
import "@aiready/ai-signal-clarity";
|
|
22
|
+
import "@aiready/agent-grounding";
|
|
23
|
+
import "@aiready/testability";
|
|
24
|
+
import "@aiready/doc-drift";
|
|
25
|
+
import "@aiready/deps";
|
|
26
|
+
import "@aiready/change-amplification";
|
|
27
|
+
var TOOL_PACKAGE_MAP = {
|
|
28
|
+
[ToolName.PatternDetect]: "@aiready/pattern-detect",
|
|
29
|
+
[ToolName.ContextAnalyzer]: "@aiready/context-analyzer",
|
|
30
|
+
[ToolName.NamingConsistency]: "@aiready/consistency",
|
|
31
|
+
[ToolName.AiSignalClarity]: "@aiready/ai-signal-clarity",
|
|
32
|
+
[ToolName.AgentGrounding]: "@aiready/agent-grounding",
|
|
33
|
+
[ToolName.TestabilityIndex]: "@aiready/testability",
|
|
34
|
+
[ToolName.DocDrift]: "@aiready/doc-drift",
|
|
35
|
+
[ToolName.DependencyHealth]: "@aiready/deps",
|
|
36
|
+
[ToolName.ChangeAmplification]: "@aiready/change-amplification",
|
|
37
|
+
// Aliases handled by registry
|
|
38
|
+
patterns: "@aiready/pattern-detect",
|
|
39
|
+
duplicates: "@aiready/pattern-detect",
|
|
40
|
+
context: "@aiready/context-analyzer",
|
|
41
|
+
fragmentation: "@aiready/context-analyzer",
|
|
42
|
+
consistency: "@aiready/consistency",
|
|
43
|
+
"ai-signal": "@aiready/ai-signal-clarity",
|
|
44
|
+
grounding: "@aiready/agent-grounding",
|
|
45
|
+
testability: "@aiready/testability",
|
|
46
|
+
"deps-health": "@aiready/deps",
|
|
47
|
+
"change-amp": "@aiready/change-amplification"
|
|
48
|
+
};
|
|
49
|
+
function sanitizeConfigRecursive(obj) {
|
|
50
|
+
if (!obj || typeof obj !== "object" || Array.isArray(obj)) return obj;
|
|
51
|
+
const sanitized = {};
|
|
52
|
+
const infraToStrip = [
|
|
53
|
+
"rootDir",
|
|
54
|
+
"onProgress",
|
|
55
|
+
"progressCallback",
|
|
56
|
+
"streamResults",
|
|
57
|
+
"batchSize",
|
|
58
|
+
"useSmartDefaults"
|
|
59
|
+
];
|
|
60
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
61
|
+
if (infraToStrip.includes(key)) continue;
|
|
62
|
+
if (typeof value === "object" && value !== null && !Array.isArray(value)) {
|
|
63
|
+
sanitized[key] = sanitizeConfigRecursive(value);
|
|
64
|
+
} else {
|
|
65
|
+
sanitized[key] = value;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return sanitized;
|
|
69
|
+
}
|
|
70
|
+
function sanitizeToolConfig(config) {
|
|
71
|
+
return sanitizeConfigRecursive(config);
|
|
72
|
+
}
|
|
73
|
+
async function analyzeUnified(options) {
|
|
74
|
+
await initializeParsers();
|
|
75
|
+
const startTime = Date.now();
|
|
76
|
+
const requestedTools = options.tools || [
|
|
77
|
+
"patterns",
|
|
78
|
+
"context",
|
|
79
|
+
"consistency"
|
|
80
|
+
];
|
|
81
|
+
const result = {
|
|
82
|
+
summary: {
|
|
83
|
+
totalIssues: 0,
|
|
84
|
+
criticalIssues: 0,
|
|
85
|
+
// Added as per instruction
|
|
86
|
+
majorIssues: 0,
|
|
87
|
+
// Added as per instruction
|
|
88
|
+
totalFiles: 0,
|
|
89
|
+
toolsRun: [],
|
|
90
|
+
executionTime: 0,
|
|
91
|
+
config: options,
|
|
92
|
+
toolConfigs: {}
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
for (const toolName of requestedTools) {
|
|
96
|
+
let provider = ToolRegistry.find(toolName);
|
|
97
|
+
if (!provider) {
|
|
98
|
+
const packageName = TOOL_PACKAGE_MAP[toolName] || (toolName.startsWith("@aiready/") ? toolName : `@aiready/${toolName}`);
|
|
99
|
+
try {
|
|
100
|
+
await import(packageName);
|
|
101
|
+
provider = ToolRegistry.find(toolName);
|
|
102
|
+
if (provider) {
|
|
103
|
+
console.log(
|
|
104
|
+
`\u2705 Successfully loaded tool provider: ${toolName} from ${packageName}`
|
|
105
|
+
);
|
|
106
|
+
} else {
|
|
107
|
+
console.log(
|
|
108
|
+
`\u26A0\uFE0F Loaded ${packageName} but provider ${toolName} still not found in registry.`
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
} catch (err) {
|
|
112
|
+
console.log(
|
|
113
|
+
`\u274C Failed to dynamically load tool ${toolName} (${packageName}):`,
|
|
114
|
+
err.message
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
if (!provider) {
|
|
119
|
+
console.warn(
|
|
120
|
+
`\u26A0\uFE0F Warning: Tool provider for '${toolName}' not found. Skipping.`
|
|
121
|
+
);
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
124
|
+
try {
|
|
125
|
+
const sanitizedOptions = { ...options };
|
|
126
|
+
delete sanitizedOptions.onProgress;
|
|
127
|
+
delete sanitizedOptions.progressCallback;
|
|
128
|
+
const toolOptions = {
|
|
129
|
+
rootDir: options.rootDir
|
|
130
|
+
// Always include rootDir
|
|
131
|
+
};
|
|
132
|
+
[...GLOBAL_INFRA_OPTIONS, ...COMMON_FINE_TUNING_OPTIONS].forEach(
|
|
133
|
+
(key) => {
|
|
134
|
+
if (key in options && key !== "toolConfigs" && key !== "tools") {
|
|
135
|
+
toolOptions[key] = options[key];
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
);
|
|
139
|
+
if (options.toolConfigs?.[provider.id]) {
|
|
140
|
+
Object.assign(toolOptions, options.toolConfigs[provider.id]);
|
|
141
|
+
} else if (options.tools && !Array.isArray(options.tools) && typeof options.tools === "object" && options.tools[provider.id]) {
|
|
142
|
+
Object.assign(toolOptions, options.tools[provider.id]);
|
|
143
|
+
} else if (options[provider.id]) {
|
|
144
|
+
Object.assign(toolOptions, options[provider.id]);
|
|
145
|
+
}
|
|
146
|
+
toolOptions.onProgress = (processed, total, message) => {
|
|
147
|
+
if (options.progressCallback) {
|
|
148
|
+
options.progressCallback({
|
|
149
|
+
tool: provider.id,
|
|
150
|
+
processed,
|
|
151
|
+
total,
|
|
152
|
+
message
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
const output = await provider.analyze(toolOptions);
|
|
157
|
+
if (output.metadata) {
|
|
158
|
+
output.metadata.config = sanitizeToolConfig(toolOptions);
|
|
159
|
+
}
|
|
160
|
+
if (options.progressCallback) {
|
|
161
|
+
options.progressCallback({ tool: provider.id, data: output });
|
|
162
|
+
}
|
|
163
|
+
result[provider.id] = output;
|
|
164
|
+
result.summary.toolsRun.push(provider.id);
|
|
165
|
+
if (output.summary?.config) {
|
|
166
|
+
result.summary.toolConfigs[provider.id] = sanitizeToolConfig(
|
|
167
|
+
output.summary.config
|
|
168
|
+
);
|
|
169
|
+
} else if (output.metadata?.config) {
|
|
170
|
+
result.summary.toolConfigs[provider.id] = sanitizeToolConfig(
|
|
171
|
+
output.metadata.config
|
|
172
|
+
);
|
|
173
|
+
} else {
|
|
174
|
+
result.summary.toolConfigs[provider.id] = sanitizeToolConfig(toolOptions);
|
|
175
|
+
}
|
|
176
|
+
const toolFiles = output.summary?.totalFiles || output.summary?.filesAnalyzed || 0;
|
|
177
|
+
if (toolFiles > result.summary.totalFiles) {
|
|
178
|
+
result.summary.totalFiles = toolFiles;
|
|
179
|
+
}
|
|
180
|
+
const issueCount = output.results.reduce(
|
|
181
|
+
(sum, file) => sum + (file.issues?.length || 0),
|
|
182
|
+
0
|
|
183
|
+
);
|
|
184
|
+
result.summary.totalIssues += issueCount;
|
|
185
|
+
if (provider.alias && Array.isArray(provider.alias)) {
|
|
186
|
+
for (const alias of provider.alias) {
|
|
187
|
+
if (!result[alias]) {
|
|
188
|
+
result[alias] = output;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
const camelCaseId = provider.id.replace(
|
|
193
|
+
/-([a-z])/g,
|
|
194
|
+
(g) => g[1].toUpperCase()
|
|
195
|
+
);
|
|
196
|
+
if (camelCaseId !== provider.id && !result[camelCaseId]) {
|
|
197
|
+
result[camelCaseId] = output;
|
|
198
|
+
}
|
|
199
|
+
} catch (err) {
|
|
200
|
+
console.error(`\u274C Error running tool '${provider.id}':`, err);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
result.summary.config = sanitizeConfigRecursive({
|
|
204
|
+
scan: {
|
|
205
|
+
tools: requestedTools,
|
|
206
|
+
include: options.include,
|
|
207
|
+
exclude: options.exclude
|
|
208
|
+
},
|
|
209
|
+
// Use 'tools' for tool-specific configurations to match AIReadyConfig
|
|
210
|
+
tools: result.summary.toolConfigs
|
|
211
|
+
});
|
|
212
|
+
result.summary.executionTime = Date.now() - startTime;
|
|
213
|
+
return result;
|
|
214
|
+
}
|
|
215
|
+
async function scoreUnified(results, options) {
|
|
216
|
+
const toolScores = /* @__PURE__ */ new Map();
|
|
217
|
+
for (const toolId of results.summary.toolsRun) {
|
|
218
|
+
const provider = ToolRegistry.get(toolId);
|
|
219
|
+
if (!provider) continue;
|
|
220
|
+
const output = results[toolId];
|
|
221
|
+
if (!output) continue;
|
|
222
|
+
try {
|
|
223
|
+
const toolScore = provider.score(output, options);
|
|
224
|
+
if (!toolScore.tokenBudget) {
|
|
225
|
+
if (toolId === ToolName.PatternDetect && output.duplicates) {
|
|
226
|
+
const wastedTokens = output.duplicates.reduce(
|
|
227
|
+
(sum, d) => sum + (d.tokenCost || 0),
|
|
228
|
+
0
|
|
229
|
+
);
|
|
230
|
+
toolScore.tokenBudget = calculateTokenBudget({
|
|
231
|
+
totalContextTokens: wastedTokens * 2,
|
|
232
|
+
wastedTokens: {
|
|
233
|
+
duplication: wastedTokens,
|
|
234
|
+
fragmentation: 0,
|
|
235
|
+
chattiness: 0
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
} else if (toolId === ToolName.ContextAnalyzer && output.summary) {
|
|
239
|
+
toolScore.tokenBudget = calculateTokenBudget({
|
|
240
|
+
totalContextTokens: output.summary.totalTokens,
|
|
241
|
+
wastedTokens: {
|
|
242
|
+
duplication: 0,
|
|
243
|
+
fragmentation: output.summary.totalPotentialSavings || 0,
|
|
244
|
+
chattiness: 0
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
toolScores.set(toolId, toolScore);
|
|
250
|
+
} catch (err) {
|
|
251
|
+
console.error(`\u274C Error scoring tool '${toolId}':`, err);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
if (toolScores.size === 0) {
|
|
255
|
+
return {
|
|
256
|
+
overall: 0,
|
|
257
|
+
rating: "Critical",
|
|
258
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
259
|
+
toolsUsed: [],
|
|
260
|
+
breakdown: [],
|
|
261
|
+
calculation: {
|
|
262
|
+
formula: "0 / 0 = 0",
|
|
263
|
+
weights: {},
|
|
264
|
+
normalized: "0 / 0 = 0"
|
|
265
|
+
}
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
return calculateOverallScore(toolScores, options, void 0);
|
|
269
|
+
}
|
|
270
|
+
function generateUnifiedSummary(result) {
|
|
271
|
+
const { summary } = result;
|
|
272
|
+
let output = `\u{1F680} AIReady Analysis Complete
|
|
273
|
+
|
|
274
|
+
`;
|
|
275
|
+
output += `\u{1F4CA} Summary:
|
|
276
|
+
`;
|
|
277
|
+
output += ` Tools run: ${summary.toolsRun.join(", ")}
|
|
278
|
+
`;
|
|
279
|
+
output += ` Total issues found: ${summary.totalIssues}
|
|
280
|
+
`;
|
|
281
|
+
output += ` Execution time: ${(summary.executionTime / 1e3).toFixed(2)}s
|
|
282
|
+
|
|
283
|
+
`;
|
|
284
|
+
for (const provider of ToolRegistry.getAll()) {
|
|
285
|
+
const toolResult = result[provider.id];
|
|
286
|
+
if (toolResult) {
|
|
287
|
+
const issueCount = toolResult.results.reduce(
|
|
288
|
+
(sum, r) => sum + (r.issues?.length || 0),
|
|
289
|
+
0
|
|
290
|
+
);
|
|
291
|
+
output += `\u2022 ${provider.id}: ${issueCount} issues
|
|
292
|
+
`;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
return output;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
export {
|
|
299
|
+
__require,
|
|
300
|
+
analyzeUnified,
|
|
301
|
+
scoreUnified,
|
|
302
|
+
generateUnifiedSummary
|
|
303
|
+
};
|
package/dist/cli.js
CHANGED
|
@@ -93,6 +93,7 @@ function sanitizeToolConfig(config) {
|
|
|
93
93
|
return sanitizeConfigRecursive(config);
|
|
94
94
|
}
|
|
95
95
|
async function analyzeUnified(options) {
|
|
96
|
+
await (0, import_core.initializeParsers)();
|
|
96
97
|
const startTime = Date.now();
|
|
97
98
|
const requestedTools = options.tools || [
|
|
98
99
|
"patterns",
|
package/dist/cli.mjs
CHANGED
package/dist/index.js
CHANGED
|
@@ -82,6 +82,7 @@ function sanitizeToolConfig(config) {
|
|
|
82
82
|
return sanitizeConfigRecursive(config);
|
|
83
83
|
}
|
|
84
84
|
async function analyzeUnified(options) {
|
|
85
|
+
await (0, import_core.initializeParsers)();
|
|
85
86
|
const startTime = Date.now();
|
|
86
87
|
const requestedTools = options.tools || [
|
|
87
88
|
"patterns",
|
package/dist/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiready/cli",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.17",
|
|
4
4
|
"description": "Unified CLI for AIReady analysis tools",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -11,17 +11,17 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"chalk": "^5.3.0",
|
|
13
13
|
"commander": "^14.0.0",
|
|
14
|
-
"@aiready/agent-grounding": "0.11.
|
|
15
|
-
"@aiready/
|
|
16
|
-
"@aiready/
|
|
17
|
-
"@aiready/
|
|
18
|
-
"@aiready/
|
|
19
|
-
"@aiready/
|
|
20
|
-
"@aiready/
|
|
21
|
-
"@aiready/
|
|
22
|
-
"@aiready/
|
|
23
|
-
"@aiready/pattern-detect": "0.14.
|
|
24
|
-
"@aiready/
|
|
14
|
+
"@aiready/agent-grounding": "0.11.15",
|
|
15
|
+
"@aiready/context-analyzer": "0.19.15",
|
|
16
|
+
"@aiready/consistency": "0.18.15",
|
|
17
|
+
"@aiready/core": "0.21.15",
|
|
18
|
+
"@aiready/doc-drift": "0.11.15",
|
|
19
|
+
"@aiready/ai-signal-clarity": "0.11.15",
|
|
20
|
+
"@aiready/visualizer": "0.4.16",
|
|
21
|
+
"@aiready/testability": "0.4.15",
|
|
22
|
+
"@aiready/deps": "0.11.15",
|
|
23
|
+
"@aiready/pattern-detect": "0.14.15",
|
|
24
|
+
"@aiready/change-amplification": "0.11.15"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@types/node": "^24.0.0",
|
package/src/index.ts
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
GLOBAL_SCAN_OPTIONS,
|
|
7
7
|
GLOBAL_INFRA_OPTIONS,
|
|
8
8
|
COMMON_FINE_TUNING_OPTIONS,
|
|
9
|
+
initializeParsers,
|
|
9
10
|
} from '@aiready/core';
|
|
10
11
|
import type {
|
|
11
12
|
AnalysisResult,
|
|
@@ -137,6 +138,9 @@ function sanitizeToolConfig(config: any): any {
|
|
|
137
138
|
export async function analyzeUnified(
|
|
138
139
|
options: UnifiedAnalysisOptions
|
|
139
140
|
): Promise<UnifiedAnalysisResult> {
|
|
141
|
+
// Initialize language parsers
|
|
142
|
+
await initializeParsers();
|
|
143
|
+
|
|
140
144
|
const startTime = Date.now();
|
|
141
145
|
const requestedTools = options.tools || [
|
|
142
146
|
'patterns',
|