@aiready/agent-grounding 0.1.4 ā 0.1.6
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 +8 -8
- package/.turbo/turbo-test.log +4 -4
- package/dist/chunk-NHDH733I.mjs +336 -0
- package/dist/cli.js +81 -23
- package/dist/cli.mjs +43 -11
- package/dist/index.js +44 -14
- package/dist/index.mjs +1 -1
- package/package.json +3 -3
- package/src/__tests__/analyzer.test.ts +30 -10
- package/src/analyzer.ts +89 -27
- package/src/cli.ts +58 -17
- package/src/scoring.ts +14 -9
- package/src/types.ts +6 -1
package/src/cli.ts
CHANGED
|
@@ -7,15 +7,23 @@ import type { AgentGroundingOptions } from './types';
|
|
|
7
7
|
import chalk from 'chalk';
|
|
8
8
|
import { writeFileSync, mkdirSync, existsSync } from 'fs';
|
|
9
9
|
import { dirname } from 'path';
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
loadConfig,
|
|
12
|
+
mergeConfigWithDefaults,
|
|
13
|
+
resolveOutputPath,
|
|
14
|
+
} from '@aiready/core';
|
|
11
15
|
|
|
12
16
|
const program = new Command();
|
|
13
17
|
|
|
14
18
|
program
|
|
15
19
|
.name('aiready-agent-grounding')
|
|
16
|
-
.description(
|
|
20
|
+
.description(
|
|
21
|
+
'Measure how well an AI agent can navigate your codebase autonomously'
|
|
22
|
+
)
|
|
17
23
|
.version('0.1.0')
|
|
18
|
-
.addHelpText(
|
|
24
|
+
.addHelpText(
|
|
25
|
+
'after',
|
|
26
|
+
`
|
|
19
27
|
GROUNDING DIMENSIONS:
|
|
20
28
|
Structure Clarity Deep directory trees slow and confuse agents
|
|
21
29
|
Self-Documentation Vague file names (utils, helpers) hide intent
|
|
@@ -27,10 +35,19 @@ EXAMPLES:
|
|
|
27
35
|
aiready-agent-grounding . # Full analysis
|
|
28
36
|
aiready-agent-grounding src/ --output json # JSON report
|
|
29
37
|
aiready-agent-grounding . --max-depth 3 # Stricter depth limit
|
|
30
|
-
`
|
|
38
|
+
`
|
|
39
|
+
)
|
|
31
40
|
.argument('<directory>', 'Directory to analyze')
|
|
32
|
-
.option(
|
|
33
|
-
|
|
41
|
+
.option(
|
|
42
|
+
'--max-depth <n>',
|
|
43
|
+
'Max recommended directory depth (default: 4)',
|
|
44
|
+
'4'
|
|
45
|
+
)
|
|
46
|
+
.option(
|
|
47
|
+
'--readme-stale-days <n>',
|
|
48
|
+
'Days after which README is considered stale (default: 90)',
|
|
49
|
+
'90'
|
|
50
|
+
)
|
|
34
51
|
.option('--include <patterns>', 'File patterns to include (comma-separated)')
|
|
35
52
|
.option('--exclude <patterns>', 'File patterns to exclude (comma-separated)')
|
|
36
53
|
.option('-o, --output <format>', 'Output format: console|json', 'console')
|
|
@@ -47,8 +64,12 @@ EXAMPLES:
|
|
|
47
64
|
|
|
48
65
|
const finalOptions: AgentGroundingOptions = {
|
|
49
66
|
rootDir: directory,
|
|
50
|
-
maxRecommendedDepth:
|
|
51
|
-
|
|
67
|
+
maxRecommendedDepth:
|
|
68
|
+
parseInt(options.maxDepth ?? '4', 10) ||
|
|
69
|
+
mergedConfig.maxRecommendedDepth,
|
|
70
|
+
readmeStaleDays:
|
|
71
|
+
parseInt(options.readmeStaleDays ?? '90', 10) ||
|
|
72
|
+
mergedConfig.readmeStaleDays,
|
|
52
73
|
include: options.include?.split(','),
|
|
53
74
|
exclude: options.exclude?.split(','),
|
|
54
75
|
};
|
|
@@ -62,7 +83,7 @@ EXAMPLES:
|
|
|
62
83
|
const outputPath = resolveOutputPath(
|
|
63
84
|
options.outputFile,
|
|
64
85
|
`agent-grounding-report-${new Date().toISOString().split('T')[0]}.json`,
|
|
65
|
-
directory
|
|
86
|
+
directory
|
|
66
87
|
);
|
|
67
88
|
const dir = dirname(outputPath);
|
|
68
89
|
if (!existsSync(dir)) mkdirSync(dir, { recursive: true });
|
|
@@ -84,11 +105,15 @@ function scoreColor(score: number) {
|
|
|
84
105
|
}
|
|
85
106
|
|
|
86
107
|
function displayConsoleReport(report: any, scoring: any, elapsed: string) {
|
|
87
|
-
const { summary,
|
|
108
|
+
const { summary, issues, recommendations } = report;
|
|
88
109
|
|
|
89
110
|
console.log(chalk.bold('\nš§ Agent Grounding Analysis\n'));
|
|
90
|
-
console.log(
|
|
91
|
-
|
|
111
|
+
console.log(
|
|
112
|
+
`Score: ${scoreColor(summary.score)(summary.score + '/100')} (${summary.rating.toUpperCase()})`
|
|
113
|
+
);
|
|
114
|
+
console.log(
|
|
115
|
+
`Files: ${chalk.cyan(summary.filesAnalyzed)} Directories: ${chalk.cyan(summary.directoriesAnalyzed)}`
|
|
116
|
+
);
|
|
92
117
|
console.log(`Analysis: ${chalk.gray(elapsed + 's')}\n`);
|
|
93
118
|
|
|
94
119
|
console.log(chalk.bold('š Dimension Scores\n'));
|
|
@@ -101,24 +126,40 @@ function displayConsoleReport(report: any, scoring: any, elapsed: string) {
|
|
|
101
126
|
];
|
|
102
127
|
for (const [name, val] of dims) {
|
|
103
128
|
const bar = 'ā'.repeat(Math.round((val as number) / 10)).padEnd(10, 'ā');
|
|
104
|
-
console.log(
|
|
129
|
+
console.log(
|
|
130
|
+
` ${String(name).padEnd(22)} ${scoreColor(val as number)(bar)} ${val}/100`
|
|
131
|
+
);
|
|
105
132
|
}
|
|
106
133
|
|
|
107
134
|
if (issues.length > 0) {
|
|
108
135
|
console.log(chalk.bold('\nā ļø Issues Found\n'));
|
|
109
136
|
for (const issue of issues) {
|
|
110
|
-
const sev =
|
|
137
|
+
const sev =
|
|
138
|
+
issue.severity === 'critical'
|
|
139
|
+
? chalk.red
|
|
140
|
+
: issue.severity === 'major'
|
|
141
|
+
? chalk.yellow
|
|
142
|
+
: chalk.blue;
|
|
111
143
|
console.log(`${sev(issue.severity.toUpperCase())} ${issue.message}`);
|
|
112
|
-
if (issue.suggestion)
|
|
144
|
+
if (issue.suggestion)
|
|
145
|
+
console.log(
|
|
146
|
+
` ${chalk.dim('ā')} ${chalk.italic(issue.suggestion)}`
|
|
147
|
+
);
|
|
113
148
|
console.log();
|
|
114
149
|
}
|
|
115
150
|
} else {
|
|
116
|
-
console.log(
|
|
151
|
+
console.log(
|
|
152
|
+
chalk.green(
|
|
153
|
+
'\n⨠No grounding issues found ā agents can navigate freely!\n'
|
|
154
|
+
)
|
|
155
|
+
);
|
|
117
156
|
}
|
|
118
157
|
|
|
119
158
|
if (recommendations.length > 0) {
|
|
120
159
|
console.log(chalk.bold('š” Recommendations\n'));
|
|
121
|
-
recommendations.forEach((rec: string, i: number) =>
|
|
160
|
+
recommendations.forEach((rec: string, i: number) =>
|
|
161
|
+
console.log(`${i + 1}. ${rec}`)
|
|
162
|
+
);
|
|
122
163
|
}
|
|
123
164
|
console.log();
|
|
124
165
|
}
|
package/src/scoring.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { calculateAgentGrounding } from '@aiready/core';
|
|
2
1
|
import type { ToolScoringOutput } from '@aiready/core';
|
|
3
2
|
import type { AgentGroundingReport } from './types';
|
|
4
3
|
|
|
@@ -6,8 +5,10 @@ import type { AgentGroundingReport } from './types';
|
|
|
6
5
|
* Convert agent grounding report into a ToolScoringOutput
|
|
7
6
|
* for inclusion in the unified AIReady score.
|
|
8
7
|
*/
|
|
9
|
-
export function calculateGroundingScore(
|
|
10
|
-
|
|
8
|
+
export function calculateGroundingScore(
|
|
9
|
+
report: AgentGroundingReport
|
|
10
|
+
): ToolScoringOutput {
|
|
11
|
+
const { summary, rawData, recommendations } = report;
|
|
11
12
|
|
|
12
13
|
const factors: ToolScoringOutput['factors'] = [
|
|
13
14
|
{
|
|
@@ -24,7 +25,9 @@ export function calculateGroundingScore(report: AgentGroundingReport): ToolScori
|
|
|
24
25
|
name: 'Entry Points',
|
|
25
26
|
impact: Math.round(summary.dimensions.entryPointScore - 50),
|
|
26
27
|
description: rawData.hasRootReadme
|
|
27
|
-
? rawData.readmeIsFresh
|
|
28
|
+
? rawData.readmeIsFresh
|
|
29
|
+
? 'README present and fresh'
|
|
30
|
+
: 'README present but stale'
|
|
28
31
|
: 'No root README',
|
|
29
32
|
},
|
|
30
33
|
{
|
|
@@ -39,11 +42,13 @@ export function calculateGroundingScore(report: AgentGroundingReport): ToolScori
|
|
|
39
42
|
},
|
|
40
43
|
];
|
|
41
44
|
|
|
42
|
-
const recs: ToolScoringOutput['recommendations'] = recommendations.map(
|
|
43
|
-
action
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
const recs: ToolScoringOutput['recommendations'] = recommendations.map(
|
|
46
|
+
(action) => ({
|
|
47
|
+
action,
|
|
48
|
+
estimatedImpact: 6,
|
|
49
|
+
priority: summary.score < 50 ? 'high' : 'medium',
|
|
50
|
+
})
|
|
51
|
+
);
|
|
47
52
|
|
|
48
53
|
return {
|
|
49
54
|
toolName: 'agent-grounding',
|
package/src/types.ts
CHANGED
|
@@ -12,7 +12,12 @@ export interface AgentGroundingOptions extends ScanOptions {
|
|
|
12
12
|
export interface AgentGroundingIssue extends Issue {
|
|
13
13
|
type: 'agent-navigation-failure';
|
|
14
14
|
/** Which grounding dimension is affected */
|
|
15
|
-
dimension:
|
|
15
|
+
dimension:
|
|
16
|
+
| 'structure-clarity'
|
|
17
|
+
| 'self-documentation'
|
|
18
|
+
| 'entry-point'
|
|
19
|
+
| 'api-clarity'
|
|
20
|
+
| 'domain-consistency';
|
|
16
21
|
}
|
|
17
22
|
|
|
18
23
|
export interface AgentGroundingReport {
|