@aiready/context-analyzer 0.21.22 → 0.21.23
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 +26 -25
- package/.turbo/turbo-lint.log +5 -5
- package/.turbo/turbo-test.log +104 -41
- package/coverage/clover.xml +2615 -1242
- package/coverage/coverage-final.json +30 -13
- package/coverage/dist/chunk-64U3PNO3.mjs.html +367 -0
- package/coverage/dist/chunk-J3MUOWHC.mjs.html +5326 -0
- package/coverage/dist/index.html +146 -0
- package/coverage/{classifier.ts.html → dist/index.mjs.html} +537 -912
- package/coverage/index.html +84 -189
- package/coverage/src/analyzer.ts.html +88 -0
- package/coverage/src/analyzers/index.html +116 -0
- package/coverage/src/analyzers/python-context.ts.html +910 -0
- package/coverage/{ast-utils.ts.html → src/ast-utils.ts.html} +84 -54
- package/coverage/src/classifier.ts.html +892 -0
- package/coverage/src/classify/classification-patterns.ts.html +307 -0
- package/coverage/src/classify/file-classifiers.ts.html +973 -0
- package/coverage/src/classify/index.html +131 -0
- package/coverage/{cluster-detector.ts.html → src/cluster-detector.ts.html} +154 -91
- package/coverage/{defaults.ts.html → src/defaults.ts.html} +74 -65
- package/coverage/{graph-builder.ts.html → src/graph-builder.ts.html} +268 -229
- package/coverage/src/index.html +341 -0
- package/coverage/{index.ts.html → src/index.ts.html} +70 -13
- package/coverage/{scoring.ts.html → src/issue-analyzer.ts.html} +201 -261
- package/coverage/src/mapper.ts.html +439 -0
- package/coverage/{metrics.ts.html → src/metrics.ts.html} +201 -132
- package/coverage/src/orchestrator.ts.html +493 -0
- package/coverage/{provider.ts.html → src/provider.ts.html} +21 -21
- package/coverage/{remediation.ts.html → src/remediation.ts.html} +112 -52
- package/coverage/src/report/console-report.ts.html +415 -0
- package/coverage/src/report/html-report.ts.html +361 -0
- package/coverage/src/report/index.html +146 -0
- package/coverage/src/report/interactive-setup.ts.html +373 -0
- package/coverage/src/scoring.ts.html +895 -0
- package/coverage/src/semantic/co-usage.ts.html +340 -0
- package/coverage/src/semantic/consolidation.ts.html +223 -0
- package/coverage/src/semantic/domain-inference.ts.html +859 -0
- package/coverage/src/semantic/index.html +161 -0
- package/coverage/src/semantic/type-graph.ts.html +163 -0
- package/coverage/{summary.ts.html → src/summary.ts.html} +155 -275
- package/coverage/{types.ts.html → src/types.ts.html} +133 -31
- package/coverage/src/utils/dependency-graph-utils.ts.html +463 -0
- package/coverage/src/utils/index.html +131 -0
- package/coverage/src/utils/string-utils.ts.html +148 -0
- package/dist/chunk-J3MUOWHC.mjs +1747 -0
- package/dist/cli.js +59 -171
- package/dist/cli.mjs +1 -1
- package/dist/index.js +55 -167
- package/dist/index.mjs +1 -1
- package/package.json +2 -2
- package/src/__tests__/consolidation.test.ts +247 -0
- package/src/__tests__/defaults.test.ts +121 -0
- package/src/__tests__/domain-inference.test.ts +420 -0
- package/src/__tests__/issue-analyzer.test.ts +155 -0
- package/src/__tests__/orchestrator.test.ts +143 -0
- package/src/__tests__/python-context.test.ts +98 -0
- package/src/__tests__/report/console-report.test.ts +292 -0
- package/src/__tests__/report/html-report.test.ts +232 -0
- package/src/report/html-report.ts +58 -174
- package/coverage/analyzer.ts.html +0 -1369
- package/coverage/semantic-analysis.ts.html +0 -1201
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { analyzeContext } from '../analyzer';
|
|
2
2
|
import { generateSummary } from '../summary';
|
|
3
|
+
import {
|
|
4
|
+
generateReportHead,
|
|
5
|
+
generateStatCards,
|
|
6
|
+
generateTable,
|
|
7
|
+
generateReportFooter,
|
|
8
|
+
} from '@aiready/core';
|
|
3
9
|
|
|
4
10
|
/**
|
|
5
11
|
* Generate HTML report
|
|
@@ -14,195 +20,73 @@ export function generateHTMLReport(
|
|
|
14
20
|
// 'results' may be used in templates later; reference to avoid lint warnings
|
|
15
21
|
void results;
|
|
16
22
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
margin: 0 auto;
|
|
30
|
-
padding: 20px;
|
|
31
|
-
background-color: #f5f5f5;
|
|
32
|
-
}
|
|
33
|
-
h1, h2, h3 { color: #2c3e50; }
|
|
34
|
-
.header {
|
|
35
|
-
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
36
|
-
color: white;
|
|
37
|
-
padding: 30px;
|
|
38
|
-
border-radius: 8px;
|
|
39
|
-
margin-bottom: 30px;
|
|
40
|
-
}
|
|
41
|
-
.summary {
|
|
42
|
-
display: grid;
|
|
43
|
-
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
|
|
44
|
-
gap: 20px;
|
|
45
|
-
margin-bottom: 30px;
|
|
46
|
-
}
|
|
47
|
-
.card {
|
|
48
|
-
background: white;
|
|
49
|
-
padding: 20px;
|
|
50
|
-
border-radius: 8px;
|
|
51
|
-
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
|
52
|
-
}
|
|
53
|
-
.metric {
|
|
54
|
-
font-size: 2em;
|
|
55
|
-
font-weight: bold;
|
|
56
|
-
color: #667eea;
|
|
57
|
-
}
|
|
58
|
-
.label {
|
|
59
|
-
color: #666;
|
|
60
|
-
font-size: 0.9em;
|
|
61
|
-
margin-top: 5px;
|
|
62
|
-
}
|
|
63
|
-
.issue-critical { color: #e74c3c; }
|
|
64
|
-
.issue-major { color: #f39c12; }
|
|
65
|
-
.issue-minor { color: #3498db; }
|
|
66
|
-
table {
|
|
67
|
-
width: 100%;
|
|
68
|
-
border-collapse: collapse;
|
|
69
|
-
background: white;
|
|
70
|
-
border-radius: 8px;
|
|
71
|
-
overflow: hidden;
|
|
72
|
-
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
|
73
|
-
}
|
|
74
|
-
th, td {
|
|
75
|
-
padding: 12px;
|
|
76
|
-
text-align: left;
|
|
77
|
-
border-bottom: 1px solid #eee;
|
|
78
|
-
}
|
|
79
|
-
th {
|
|
80
|
-
background-color: #667eea;
|
|
81
|
-
color: white;
|
|
82
|
-
font-weight: 600;
|
|
83
|
-
}
|
|
84
|
-
tr:hover { background-color: #f8f9fa; }
|
|
85
|
-
.footer {
|
|
86
|
-
text-align: center;
|
|
87
|
-
margin-top: 40px;
|
|
88
|
-
padding: 20px;
|
|
89
|
-
color: #666;
|
|
90
|
-
font-size: 0.9em;
|
|
91
|
-
}
|
|
92
|
-
</style>
|
|
93
|
-
</head>
|
|
94
|
-
<body>
|
|
95
|
-
<div class="header">
|
|
96
|
-
<h1>🔍 AIReady Context Analysis Report</h1>
|
|
97
|
-
<p>Generated on ${new Date().toLocaleString()}</p>
|
|
98
|
-
</div>
|
|
23
|
+
const head = generateReportHead('AIReady Context Analysis Report');
|
|
24
|
+
|
|
25
|
+
const stats = generateStatCards([
|
|
26
|
+
{ value: summary.totalFiles, label: 'Files Analyzed' },
|
|
27
|
+
{ value: summary.totalTokens.toLocaleString(), label: 'Total Tokens' },
|
|
28
|
+
{ value: summary.avgContextBudget.toFixed(0), label: 'Avg Context Budget' },
|
|
29
|
+
{
|
|
30
|
+
value: totalIssues,
|
|
31
|
+
label: 'Total Issues',
|
|
32
|
+
color: totalIssues > 0 ? '#f39c12' : undefined,
|
|
33
|
+
},
|
|
34
|
+
]);
|
|
99
35
|
|
|
100
|
-
|
|
101
|
-
<
|
|
102
|
-
|
|
103
|
-
<div class="label">Files Analyzed</div>
|
|
104
|
-
</div>
|
|
105
|
-
<div class="card">
|
|
106
|
-
<div class="metric">${summary.totalTokens.toLocaleString()}</div>
|
|
107
|
-
<div class="label">Total Tokens</div>
|
|
108
|
-
</div>
|
|
109
|
-
<div class="card">
|
|
110
|
-
<div class="metric">${summary.avgContextBudget.toFixed(0)}</div>
|
|
111
|
-
<div class="label">Avg Context Budget</div>
|
|
112
|
-
</div>
|
|
113
|
-
<div class="card">
|
|
114
|
-
<div class="metric ${totalIssues > 0 ? 'issue-major' : ''}">${totalIssues}</div>
|
|
115
|
-
<div class="label">Total Issues</div>
|
|
116
|
-
</div>
|
|
36
|
+
let body = `<div style="background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 30px; border-radius: 8px; margin-bottom: 30px;">
|
|
37
|
+
<h1 style="border: none; color: white; margin: 0;">🔍 AIReady Context Analysis Report</h1>
|
|
38
|
+
<p style="margin: 10px 0 0 0;">Generated on ${new Date().toLocaleString()}</p>
|
|
117
39
|
</div>
|
|
40
|
+
${stats}`;
|
|
118
41
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
? `
|
|
122
|
-
<div class="card" style="margin-bottom: 30px;">
|
|
42
|
+
if (totalIssues > 0) {
|
|
43
|
+
body += `<div class="card" style="margin-bottom: 30px;">
|
|
123
44
|
<h2>⚠️ Issues Summary</h2>
|
|
124
45
|
<p>
|
|
125
|
-
<span class="
|
|
126
|
-
<span class="
|
|
127
|
-
<span class="
|
|
46
|
+
<span class="critical">🔴 Critical: ${summary.criticalIssues}</span>
|
|
47
|
+
<span class="major">🟡 Major: ${summary.majorIssues}</span>
|
|
48
|
+
<span class="minor">🔵 Minor: ${summary.minorIssues}</span>
|
|
128
49
|
</p>
|
|
129
50
|
<p><strong>Potential Savings:</strong> ${summary.totalPotentialSavings.toLocaleString()} tokens</p>
|
|
130
|
-
</div
|
|
131
|
-
`
|
|
132
|
-
: ''
|
|
51
|
+
</div>`;
|
|
133
52
|
}
|
|
134
53
|
|
|
135
|
-
|
|
136
|
-
summary.fragmentedModules.
|
|
137
|
-
|
|
138
|
-
|
|
54
|
+
if (summary.fragmentedModules.length > 0) {
|
|
55
|
+
const fragmentedRows = summary.fragmentedModules.map((m) => [
|
|
56
|
+
m.domain,
|
|
57
|
+
String(m.files.length),
|
|
58
|
+
`${(m.fragmentationScore * 100).toFixed(0)}%`,
|
|
59
|
+
m.totalTokens.toLocaleString(),
|
|
60
|
+
]);
|
|
61
|
+
body += `<div class="card" style="margin-bottom: 30px;">
|
|
139
62
|
<h2>🧩 Fragmented Modules</h2>
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
<tr>
|
|
143
|
-
<th>Domain</th>
|
|
144
|
-
<th>Files</th>
|
|
145
|
-
<th>Fragmentation</th>
|
|
146
|
-
<th>Token Cost</th>
|
|
147
|
-
</tr>
|
|
148
|
-
</thead>
|
|
149
|
-
<tbody>
|
|
150
|
-
${summary.fragmentedModules
|
|
151
|
-
.map(
|
|
152
|
-
(m) => `
|
|
153
|
-
<tr>
|
|
154
|
-
<td>${m.domain}</td>
|
|
155
|
-
<td>${m.files.length}</td>
|
|
156
|
-
<td>${(m.fragmentationScore * 100).toFixed(0)}%</td>
|
|
157
|
-
<td>${m.totalTokens.toLocaleString()}</td>
|
|
158
|
-
</tr>
|
|
159
|
-
`
|
|
160
|
-
)
|
|
161
|
-
.join('')}
|
|
162
|
-
</tbody>
|
|
163
|
-
</table>
|
|
164
|
-
</div>
|
|
165
|
-
`
|
|
166
|
-
: ''
|
|
63
|
+
${generateTable({ headers: ['Domain', 'Files', 'Fragmentation', 'Token Cost'], rows: fragmentedRows })}
|
|
64
|
+
</div>`;
|
|
167
65
|
}
|
|
168
66
|
|
|
169
|
-
|
|
170
|
-
summary.topExpensiveFiles.
|
|
171
|
-
|
|
172
|
-
|
|
67
|
+
if (summary.topExpensiveFiles.length > 0) {
|
|
68
|
+
const expensiveRows = summary.topExpensiveFiles.map((f) => [
|
|
69
|
+
f.file,
|
|
70
|
+
`${f.contextBudget.toLocaleString()} tokens`,
|
|
71
|
+
`<span class="issue-${f.severity}">${f.severity.toUpperCase()}</span>`,
|
|
72
|
+
]);
|
|
73
|
+
body += `<div class="card" style="margin-bottom: 30px;">
|
|
173
74
|
<h2>💸 Most Expensive Files</h2>
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
<tr>
|
|
177
|
-
<th>File</th>
|
|
178
|
-
<th>Context Budget</th>
|
|
179
|
-
<th>Severity</th>
|
|
180
|
-
</tr>
|
|
181
|
-
</thead>
|
|
182
|
-
<tbody>
|
|
183
|
-
${summary.topExpensiveFiles
|
|
184
|
-
.map(
|
|
185
|
-
(f) => `
|
|
186
|
-
<tr>
|
|
187
|
-
<td>${f.file}</td>
|
|
188
|
-
<td>${f.contextBudget.toLocaleString()} tokens</td>
|
|
189
|
-
<td class="issue-${f.severity}">${f.severity.toUpperCase()}</td>
|
|
190
|
-
</tr>
|
|
191
|
-
`
|
|
192
|
-
)
|
|
193
|
-
.join('')}
|
|
194
|
-
</tbody>
|
|
195
|
-
</table>
|
|
196
|
-
</div>
|
|
197
|
-
`
|
|
198
|
-
: ''
|
|
75
|
+
${generateTable({ headers: ['File', 'Context Budget', 'Severity'], rows: expensiveRows })}
|
|
76
|
+
</div>`;
|
|
199
77
|
}
|
|
200
78
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
79
|
+
const footer = generateReportFooter({
|
|
80
|
+
title: 'Context Analysis Report',
|
|
81
|
+
packageName: 'context-analyzer',
|
|
82
|
+
packageUrl: 'https://github.com/caopengau/aiready-context-analyzer',
|
|
83
|
+
bugUrl: 'https://github.com/caopengau/aiready-context-analyzer/issues',
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
return `${head}
|
|
87
|
+
<body>
|
|
88
|
+
${body}
|
|
89
|
+
${footer}
|
|
206
90
|
</body>
|
|
207
91
|
</html>`;
|
|
208
92
|
}
|