@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
package/dist/cli.js
CHANGED
|
@@ -293,7 +293,7 @@ var init_python_context = __esm({
|
|
|
293
293
|
var import_commander = require("commander");
|
|
294
294
|
|
|
295
295
|
// src/cli-action.ts
|
|
296
|
-
var
|
|
296
|
+
var import_core9 = require("@aiready/core");
|
|
297
297
|
|
|
298
298
|
// src/orchestrator.ts
|
|
299
299
|
var import_core6 = require("@aiready/core");
|
|
@@ -1726,182 +1726,70 @@ function displayConsoleReport(summary, results, maxResults = 10) {
|
|
|
1726
1726
|
}
|
|
1727
1727
|
|
|
1728
1728
|
// src/report/html-report.ts
|
|
1729
|
+
var import_core8 = require("@aiready/core");
|
|
1729
1730
|
function generateHTMLReport(summary, results) {
|
|
1730
1731
|
const totalIssues = summary.criticalIssues + summary.majorIssues + summary.minorIssues;
|
|
1731
1732
|
void results;
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
line-height: 1.6;
|
|
1742
|
-
color: #333;
|
|
1743
|
-
max-width: 1200px;
|
|
1744
|
-
margin: 0 auto;
|
|
1745
|
-
padding: 20px;
|
|
1746
|
-
background-color: #f5f5f5;
|
|
1747
|
-
}
|
|
1748
|
-
h1, h2, h3 { color: #2c3e50; }
|
|
1749
|
-
.header {
|
|
1750
|
-
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
1751
|
-
color: white;
|
|
1752
|
-
padding: 30px;
|
|
1753
|
-
border-radius: 8px;
|
|
1754
|
-
margin-bottom: 30px;
|
|
1755
|
-
}
|
|
1756
|
-
.summary {
|
|
1757
|
-
display: grid;
|
|
1758
|
-
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
|
|
1759
|
-
gap: 20px;
|
|
1760
|
-
margin-bottom: 30px;
|
|
1761
|
-
}
|
|
1762
|
-
.card {
|
|
1763
|
-
background: white;
|
|
1764
|
-
padding: 20px;
|
|
1765
|
-
border-radius: 8px;
|
|
1766
|
-
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
|
1767
|
-
}
|
|
1768
|
-
.metric {
|
|
1769
|
-
font-size: 2em;
|
|
1770
|
-
font-weight: bold;
|
|
1771
|
-
color: #667eea;
|
|
1772
|
-
}
|
|
1773
|
-
.label {
|
|
1774
|
-
color: #666;
|
|
1775
|
-
font-size: 0.9em;
|
|
1776
|
-
margin-top: 5px;
|
|
1777
|
-
}
|
|
1778
|
-
.issue-critical { color: #e74c3c; }
|
|
1779
|
-
.issue-major { color: #f39c12; }
|
|
1780
|
-
.issue-minor { color: #3498db; }
|
|
1781
|
-
table {
|
|
1782
|
-
width: 100%;
|
|
1783
|
-
border-collapse: collapse;
|
|
1784
|
-
background: white;
|
|
1785
|
-
border-radius: 8px;
|
|
1786
|
-
overflow: hidden;
|
|
1787
|
-
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
|
1788
|
-
}
|
|
1789
|
-
th, td {
|
|
1790
|
-
padding: 12px;
|
|
1791
|
-
text-align: left;
|
|
1792
|
-
border-bottom: 1px solid #eee;
|
|
1793
|
-
}
|
|
1794
|
-
th {
|
|
1795
|
-
background-color: #667eea;
|
|
1796
|
-
color: white;
|
|
1797
|
-
font-weight: 600;
|
|
1798
|
-
}
|
|
1799
|
-
tr:hover { background-color: #f8f9fa; }
|
|
1800
|
-
.footer {
|
|
1801
|
-
text-align: center;
|
|
1802
|
-
margin-top: 40px;
|
|
1803
|
-
padding: 20px;
|
|
1804
|
-
color: #666;
|
|
1805
|
-
font-size: 0.9em;
|
|
1733
|
+
const head = (0, import_core8.generateReportHead)("AIReady Context Analysis Report");
|
|
1734
|
+
const stats = (0, import_core8.generateStatCards)([
|
|
1735
|
+
{ value: summary.totalFiles, label: "Files Analyzed" },
|
|
1736
|
+
{ value: summary.totalTokens.toLocaleString(), label: "Total Tokens" },
|
|
1737
|
+
{ value: summary.avgContextBudget.toFixed(0), label: "Avg Context Budget" },
|
|
1738
|
+
{
|
|
1739
|
+
value: totalIssues,
|
|
1740
|
+
label: "Total Issues",
|
|
1741
|
+
color: totalIssues > 0 ? "#f39c12" : void 0
|
|
1806
1742
|
}
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
<
|
|
1810
|
-
|
|
1811
|
-
<h1>\u{1F50D} AIReady Context Analysis Report</h1>
|
|
1812
|
-
<p>Generated on ${(/* @__PURE__ */ new Date()).toLocaleString()}</p>
|
|
1813
|
-
</div>
|
|
1814
|
-
|
|
1815
|
-
<div class="summary">
|
|
1816
|
-
<div class="card">
|
|
1817
|
-
<div class="metric">${summary.totalFiles}</div>
|
|
1818
|
-
<div class="label">Files Analyzed</div>
|
|
1819
|
-
</div>
|
|
1820
|
-
<div class="card">
|
|
1821
|
-
<div class="metric">${summary.totalTokens.toLocaleString()}</div>
|
|
1822
|
-
<div class="label">Total Tokens</div>
|
|
1823
|
-
</div>
|
|
1824
|
-
<div class="card">
|
|
1825
|
-
<div class="metric">${summary.avgContextBudget.toFixed(0)}</div>
|
|
1826
|
-
<div class="label">Avg Context Budget</div>
|
|
1827
|
-
</div>
|
|
1828
|
-
<div class="card">
|
|
1829
|
-
<div class="metric ${totalIssues > 0 ? "issue-major" : ""}">${totalIssues}</div>
|
|
1830
|
-
<div class="label">Total Issues</div>
|
|
1831
|
-
</div>
|
|
1743
|
+
]);
|
|
1744
|
+
let body = `<div style="background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 30px; border-radius: 8px; margin-bottom: 30px;">
|
|
1745
|
+
<h1 style="border: none; color: white; margin: 0;">\u{1F50D} AIReady Context Analysis Report</h1>
|
|
1746
|
+
<p style="margin: 10px 0 0 0;">Generated on ${(/* @__PURE__ */ new Date()).toLocaleString()}</p>
|
|
1832
1747
|
</div>
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1748
|
+
${stats}`;
|
|
1749
|
+
if (totalIssues > 0) {
|
|
1750
|
+
body += `<div class="card" style="margin-bottom: 30px;">
|
|
1836
1751
|
<h2>\u26A0\uFE0F Issues Summary</h2>
|
|
1837
1752
|
<p>
|
|
1838
|
-
<span class="
|
|
1839
|
-
<span class="
|
|
1840
|
-
<span class="
|
|
1753
|
+
<span class="critical">\u{1F534} Critical: ${summary.criticalIssues}</span>
|
|
1754
|
+
<span class="major">\u{1F7E1} Major: ${summary.majorIssues}</span>
|
|
1755
|
+
<span class="minor">\u{1F535} Minor: ${summary.minorIssues}</span>
|
|
1841
1756
|
</p>
|
|
1842
1757
|
<p><strong>Potential Savings:</strong> ${summary.totalPotentialSavings.toLocaleString()} tokens</p>
|
|
1843
|
-
</div
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1758
|
+
</div>`;
|
|
1759
|
+
}
|
|
1760
|
+
if (summary.fragmentedModules.length > 0) {
|
|
1761
|
+
const fragmentedRows = summary.fragmentedModules.map((m) => [
|
|
1762
|
+
m.domain,
|
|
1763
|
+
String(m.files.length),
|
|
1764
|
+
`${(m.fragmentationScore * 100).toFixed(0)}%`,
|
|
1765
|
+
m.totalTokens.toLocaleString()
|
|
1766
|
+
]);
|
|
1767
|
+
body += `<div class="card" style="margin-bottom: 30px;">
|
|
1848
1768
|
<h2>\u{1F9E9} Fragmented Modules</h2>
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
${summary.fragmentedModules.map(
|
|
1860
|
-
(m) => `
|
|
1861
|
-
<tr>
|
|
1862
|
-
<td>${m.domain}</td>
|
|
1863
|
-
<td>${m.files.length}</td>
|
|
1864
|
-
<td>${(m.fragmentationScore * 100).toFixed(0)}%</td>
|
|
1865
|
-
<td>${m.totalTokens.toLocaleString()}</td>
|
|
1866
|
-
</tr>
|
|
1867
|
-
`
|
|
1868
|
-
).join("")}
|
|
1869
|
-
</tbody>
|
|
1870
|
-
</table>
|
|
1871
|
-
</div>
|
|
1872
|
-
` : ""}
|
|
1873
|
-
|
|
1874
|
-
${summary.topExpensiveFiles.length > 0 ? `
|
|
1875
|
-
<div class="card" style="margin-bottom: 30px;">
|
|
1769
|
+
${(0, import_core8.generateTable)({ headers: ["Domain", "Files", "Fragmentation", "Token Cost"], rows: fragmentedRows })}
|
|
1770
|
+
</div>`;
|
|
1771
|
+
}
|
|
1772
|
+
if (summary.topExpensiveFiles.length > 0) {
|
|
1773
|
+
const expensiveRows = summary.topExpensiveFiles.map((f) => [
|
|
1774
|
+
f.file,
|
|
1775
|
+
`${f.contextBudget.toLocaleString()} tokens`,
|
|
1776
|
+
`<span class="issue-${f.severity}">${f.severity.toUpperCase()}</span>`
|
|
1777
|
+
]);
|
|
1778
|
+
body += `<div class="card" style="margin-bottom: 30px;">
|
|
1876
1779
|
<h2>\u{1F4B8} Most Expensive Files</h2>
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
<td>${f.contextBudget.toLocaleString()} tokens</td>
|
|
1891
|
-
<td class="issue-${f.severity}">${f.severity.toUpperCase()}</td>
|
|
1892
|
-
</tr>
|
|
1893
|
-
`
|
|
1894
|
-
).join("")}
|
|
1895
|
-
</tbody>
|
|
1896
|
-
</table>
|
|
1897
|
-
</div>
|
|
1898
|
-
` : ""}
|
|
1899
|
-
|
|
1900
|
-
<div class="footer">
|
|
1901
|
-
<p>Generated by <strong>@aiready/context-analyzer</strong></p>
|
|
1902
|
-
<p>Like AIReady? <a href="https://github.com/caopengau/aiready-context-analyzer">Star us on GitHub</a></p>
|
|
1903
|
-
<p>Found a bug? <a href="https://github.com/caopengau/aiready-context-analyzer/issues">Report it here</a></p>
|
|
1904
|
-
</div>
|
|
1780
|
+
${(0, import_core8.generateTable)({ headers: ["File", "Context Budget", "Severity"], rows: expensiveRows })}
|
|
1781
|
+
</div>`;
|
|
1782
|
+
}
|
|
1783
|
+
const footer = (0, import_core8.generateReportFooter)({
|
|
1784
|
+
title: "Context Analysis Report",
|
|
1785
|
+
packageName: "context-analyzer",
|
|
1786
|
+
packageUrl: "https://github.com/caopengau/aiready-context-analyzer",
|
|
1787
|
+
bugUrl: "https://github.com/caopengau/aiready-context-analyzer/issues"
|
|
1788
|
+
});
|
|
1789
|
+
return `${head}
|
|
1790
|
+
<body>
|
|
1791
|
+
${body}
|
|
1792
|
+
${footer}
|
|
1905
1793
|
</body>
|
|
1906
1794
|
</html>`;
|
|
1907
1795
|
}
|
|
@@ -1997,7 +1885,7 @@ async function contextActionHandler(directory, options) {
|
|
|
1997
1885
|
exclude: void 0,
|
|
1998
1886
|
maxResults: 10
|
|
1999
1887
|
};
|
|
2000
|
-
let finalOptions = await (0,
|
|
1888
|
+
let finalOptions = await (0, import_core9.loadMergedConfig)(directory, defaults, {
|
|
2001
1889
|
maxDepth: options.maxDepth ? parseInt(options.maxDepth) : void 0,
|
|
2002
1890
|
maxContextBudget: options.maxContext ? parseInt(options.maxContext) : void 0,
|
|
2003
1891
|
minCohesion: options.minCohesion ? parseFloat(options.minCohesion) : void 0,
|
|
@@ -2013,9 +1901,9 @@ async function contextActionHandler(directory, options) {
|
|
|
2013
1901
|
}
|
|
2014
1902
|
const results = await analyzeContext(finalOptions);
|
|
2015
1903
|
const summary = generateSummary(results, finalOptions);
|
|
2016
|
-
const duration = (0,
|
|
1904
|
+
const duration = (0, import_core9.getElapsedTime)(startTime);
|
|
2017
1905
|
if (options.output === "json") {
|
|
2018
|
-
(0,
|
|
1906
|
+
(0, import_core9.handleJSONOutput)(
|
|
2019
1907
|
{
|
|
2020
1908
|
summary: {
|
|
2021
1909
|
...summary,
|
|
@@ -2032,7 +1920,7 @@ async function contextActionHandler(directory, options) {
|
|
|
2032
1920
|
);
|
|
2033
1921
|
} else if (options.output === "html") {
|
|
2034
1922
|
const html = generateHTMLReport(summary, results);
|
|
2035
|
-
const outputPath = (0,
|
|
1923
|
+
const outputPath = (0, import_core9.resolveOutputPath)(
|
|
2036
1924
|
directory,
|
|
2037
1925
|
options.outputFile,
|
|
2038
1926
|
"context-report.html"
|
|
@@ -2047,7 +1935,7 @@ async function contextActionHandler(directory, options) {
|
|
|
2047
1935
|
`));
|
|
2048
1936
|
}
|
|
2049
1937
|
} catch (error) {
|
|
2050
|
-
(0,
|
|
1938
|
+
(0, import_core9.handleCLIError)(error, "context-analyzer");
|
|
2051
1939
|
}
|
|
2052
1940
|
}
|
|
2053
1941
|
|
package/dist/cli.mjs
CHANGED
package/dist/index.js
CHANGED
|
@@ -352,7 +352,7 @@ __export(index_exports, {
|
|
|
352
352
|
runInteractiveSetup: () => runInteractiveSetup
|
|
353
353
|
});
|
|
354
354
|
module.exports = __toCommonJS(index_exports);
|
|
355
|
-
var
|
|
355
|
+
var import_core12 = require("@aiready/core");
|
|
356
356
|
|
|
357
357
|
// src/provider.ts
|
|
358
358
|
var import_core9 = require("@aiready/core");
|
|
@@ -2204,182 +2204,70 @@ function displayConsoleReport(summary, results, maxResults = 10) {
|
|
|
2204
2204
|
}
|
|
2205
2205
|
|
|
2206
2206
|
// src/report/html-report.ts
|
|
2207
|
+
var import_core11 = require("@aiready/core");
|
|
2207
2208
|
function generateHTMLReport(summary, results) {
|
|
2208
2209
|
const totalIssues = summary.criticalIssues + summary.majorIssues + summary.minorIssues;
|
|
2209
2210
|
void results;
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
line-height: 1.6;
|
|
2220
|
-
color: #333;
|
|
2221
|
-
max-width: 1200px;
|
|
2222
|
-
margin: 0 auto;
|
|
2223
|
-
padding: 20px;
|
|
2224
|
-
background-color: #f5f5f5;
|
|
2225
|
-
}
|
|
2226
|
-
h1, h2, h3 { color: #2c3e50; }
|
|
2227
|
-
.header {
|
|
2228
|
-
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
2229
|
-
color: white;
|
|
2230
|
-
padding: 30px;
|
|
2231
|
-
border-radius: 8px;
|
|
2232
|
-
margin-bottom: 30px;
|
|
2233
|
-
}
|
|
2234
|
-
.summary {
|
|
2235
|
-
display: grid;
|
|
2236
|
-
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
|
|
2237
|
-
gap: 20px;
|
|
2238
|
-
margin-bottom: 30px;
|
|
2239
|
-
}
|
|
2240
|
-
.card {
|
|
2241
|
-
background: white;
|
|
2242
|
-
padding: 20px;
|
|
2243
|
-
border-radius: 8px;
|
|
2244
|
-
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
|
2245
|
-
}
|
|
2246
|
-
.metric {
|
|
2247
|
-
font-size: 2em;
|
|
2248
|
-
font-weight: bold;
|
|
2249
|
-
color: #667eea;
|
|
2250
|
-
}
|
|
2251
|
-
.label {
|
|
2252
|
-
color: #666;
|
|
2253
|
-
font-size: 0.9em;
|
|
2254
|
-
margin-top: 5px;
|
|
2255
|
-
}
|
|
2256
|
-
.issue-critical { color: #e74c3c; }
|
|
2257
|
-
.issue-major { color: #f39c12; }
|
|
2258
|
-
.issue-minor { color: #3498db; }
|
|
2259
|
-
table {
|
|
2260
|
-
width: 100%;
|
|
2261
|
-
border-collapse: collapse;
|
|
2262
|
-
background: white;
|
|
2263
|
-
border-radius: 8px;
|
|
2264
|
-
overflow: hidden;
|
|
2265
|
-
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
|
2266
|
-
}
|
|
2267
|
-
th, td {
|
|
2268
|
-
padding: 12px;
|
|
2269
|
-
text-align: left;
|
|
2270
|
-
border-bottom: 1px solid #eee;
|
|
2271
|
-
}
|
|
2272
|
-
th {
|
|
2273
|
-
background-color: #667eea;
|
|
2274
|
-
color: white;
|
|
2275
|
-
font-weight: 600;
|
|
2276
|
-
}
|
|
2277
|
-
tr:hover { background-color: #f8f9fa; }
|
|
2278
|
-
.footer {
|
|
2279
|
-
text-align: center;
|
|
2280
|
-
margin-top: 40px;
|
|
2281
|
-
padding: 20px;
|
|
2282
|
-
color: #666;
|
|
2283
|
-
font-size: 0.9em;
|
|
2211
|
+
const head = (0, import_core11.generateReportHead)("AIReady Context Analysis Report");
|
|
2212
|
+
const stats = (0, import_core11.generateStatCards)([
|
|
2213
|
+
{ value: summary.totalFiles, label: "Files Analyzed" },
|
|
2214
|
+
{ value: summary.totalTokens.toLocaleString(), label: "Total Tokens" },
|
|
2215
|
+
{ value: summary.avgContextBudget.toFixed(0), label: "Avg Context Budget" },
|
|
2216
|
+
{
|
|
2217
|
+
value: totalIssues,
|
|
2218
|
+
label: "Total Issues",
|
|
2219
|
+
color: totalIssues > 0 ? "#f39c12" : void 0
|
|
2284
2220
|
}
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
<
|
|
2288
|
-
|
|
2289
|
-
<h1>\u{1F50D} AIReady Context Analysis Report</h1>
|
|
2290
|
-
<p>Generated on ${(/* @__PURE__ */ new Date()).toLocaleString()}</p>
|
|
2291
|
-
</div>
|
|
2292
|
-
|
|
2293
|
-
<div class="summary">
|
|
2294
|
-
<div class="card">
|
|
2295
|
-
<div class="metric">${summary.totalFiles}</div>
|
|
2296
|
-
<div class="label">Files Analyzed</div>
|
|
2297
|
-
</div>
|
|
2298
|
-
<div class="card">
|
|
2299
|
-
<div class="metric">${summary.totalTokens.toLocaleString()}</div>
|
|
2300
|
-
<div class="label">Total Tokens</div>
|
|
2301
|
-
</div>
|
|
2302
|
-
<div class="card">
|
|
2303
|
-
<div class="metric">${summary.avgContextBudget.toFixed(0)}</div>
|
|
2304
|
-
<div class="label">Avg Context Budget</div>
|
|
2305
|
-
</div>
|
|
2306
|
-
<div class="card">
|
|
2307
|
-
<div class="metric ${totalIssues > 0 ? "issue-major" : ""}">${totalIssues}</div>
|
|
2308
|
-
<div class="label">Total Issues</div>
|
|
2309
|
-
</div>
|
|
2221
|
+
]);
|
|
2222
|
+
let body = `<div style="background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 30px; border-radius: 8px; margin-bottom: 30px;">
|
|
2223
|
+
<h1 style="border: none; color: white; margin: 0;">\u{1F50D} AIReady Context Analysis Report</h1>
|
|
2224
|
+
<p style="margin: 10px 0 0 0;">Generated on ${(/* @__PURE__ */ new Date()).toLocaleString()}</p>
|
|
2310
2225
|
</div>
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2226
|
+
${stats}`;
|
|
2227
|
+
if (totalIssues > 0) {
|
|
2228
|
+
body += `<div class="card" style="margin-bottom: 30px;">
|
|
2314
2229
|
<h2>\u26A0\uFE0F Issues Summary</h2>
|
|
2315
2230
|
<p>
|
|
2316
|
-
<span class="
|
|
2317
|
-
<span class="
|
|
2318
|
-
<span class="
|
|
2231
|
+
<span class="critical">\u{1F534} Critical: ${summary.criticalIssues}</span>
|
|
2232
|
+
<span class="major">\u{1F7E1} Major: ${summary.majorIssues}</span>
|
|
2233
|
+
<span class="minor">\u{1F535} Minor: ${summary.minorIssues}</span>
|
|
2319
2234
|
</p>
|
|
2320
2235
|
<p><strong>Potential Savings:</strong> ${summary.totalPotentialSavings.toLocaleString()} tokens</p>
|
|
2321
|
-
</div
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2236
|
+
</div>`;
|
|
2237
|
+
}
|
|
2238
|
+
if (summary.fragmentedModules.length > 0) {
|
|
2239
|
+
const fragmentedRows = summary.fragmentedModules.map((m) => [
|
|
2240
|
+
m.domain,
|
|
2241
|
+
String(m.files.length),
|
|
2242
|
+
`${(m.fragmentationScore * 100).toFixed(0)}%`,
|
|
2243
|
+
m.totalTokens.toLocaleString()
|
|
2244
|
+
]);
|
|
2245
|
+
body += `<div class="card" style="margin-bottom: 30px;">
|
|
2326
2246
|
<h2>\u{1F9E9} Fragmented Modules</h2>
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
${summary.fragmentedModules.map(
|
|
2338
|
-
(m) => `
|
|
2339
|
-
<tr>
|
|
2340
|
-
<td>${m.domain}</td>
|
|
2341
|
-
<td>${m.files.length}</td>
|
|
2342
|
-
<td>${(m.fragmentationScore * 100).toFixed(0)}%</td>
|
|
2343
|
-
<td>${m.totalTokens.toLocaleString()}</td>
|
|
2344
|
-
</tr>
|
|
2345
|
-
`
|
|
2346
|
-
).join("")}
|
|
2347
|
-
</tbody>
|
|
2348
|
-
</table>
|
|
2349
|
-
</div>
|
|
2350
|
-
` : ""}
|
|
2351
|
-
|
|
2352
|
-
${summary.topExpensiveFiles.length > 0 ? `
|
|
2353
|
-
<div class="card" style="margin-bottom: 30px;">
|
|
2247
|
+
${(0, import_core11.generateTable)({ headers: ["Domain", "Files", "Fragmentation", "Token Cost"], rows: fragmentedRows })}
|
|
2248
|
+
</div>`;
|
|
2249
|
+
}
|
|
2250
|
+
if (summary.topExpensiveFiles.length > 0) {
|
|
2251
|
+
const expensiveRows = summary.topExpensiveFiles.map((f) => [
|
|
2252
|
+
f.file,
|
|
2253
|
+
`${f.contextBudget.toLocaleString()} tokens`,
|
|
2254
|
+
`<span class="issue-${f.severity}">${f.severity.toUpperCase()}</span>`
|
|
2255
|
+
]);
|
|
2256
|
+
body += `<div class="card" style="margin-bottom: 30px;">
|
|
2354
2257
|
<h2>\u{1F4B8} Most Expensive Files</h2>
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
<td>${f.contextBudget.toLocaleString()} tokens</td>
|
|
2369
|
-
<td class="issue-${f.severity}">${f.severity.toUpperCase()}</td>
|
|
2370
|
-
</tr>
|
|
2371
|
-
`
|
|
2372
|
-
).join("")}
|
|
2373
|
-
</tbody>
|
|
2374
|
-
</table>
|
|
2375
|
-
</div>
|
|
2376
|
-
` : ""}
|
|
2377
|
-
|
|
2378
|
-
<div class="footer">
|
|
2379
|
-
<p>Generated by <strong>@aiready/context-analyzer</strong></p>
|
|
2380
|
-
<p>Like AIReady? <a href="https://github.com/caopengau/aiready-context-analyzer">Star us on GitHub</a></p>
|
|
2381
|
-
<p>Found a bug? <a href="https://github.com/caopengau/aiready-context-analyzer/issues">Report it here</a></p>
|
|
2382
|
-
</div>
|
|
2258
|
+
${(0, import_core11.generateTable)({ headers: ["File", "Context Budget", "Severity"], rows: expensiveRows })}
|
|
2259
|
+
</div>`;
|
|
2260
|
+
}
|
|
2261
|
+
const footer = (0, import_core11.generateReportFooter)({
|
|
2262
|
+
title: "Context Analysis Report",
|
|
2263
|
+
packageName: "context-analyzer",
|
|
2264
|
+
packageUrl: "https://github.com/caopengau/aiready-context-analyzer",
|
|
2265
|
+
bugUrl: "https://github.com/caopengau/aiready-context-analyzer/issues"
|
|
2266
|
+
});
|
|
2267
|
+
return `${head}
|
|
2268
|
+
<body>
|
|
2269
|
+
${body}
|
|
2270
|
+
${footer}
|
|
2383
2271
|
</body>
|
|
2384
2272
|
</html>`;
|
|
2385
2273
|
}
|
|
@@ -2458,7 +2346,7 @@ async function runInteractiveSetup(directory, current) {
|
|
|
2458
2346
|
}
|
|
2459
2347
|
|
|
2460
2348
|
// src/index.ts
|
|
2461
|
-
|
|
2349
|
+
import_core12.ToolRegistry.register(ContextAnalyzerProvider);
|
|
2462
2350
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2463
2351
|
0 && (module.exports = {
|
|
2464
2352
|
BARREL_EXPORT_MIN_EXPORTS,
|
package/dist/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiready/context-analyzer",
|
|
3
|
-
"version": "0.21.
|
|
3
|
+
"version": "0.21.23",
|
|
4
4
|
"description": "AI context window cost analysis - detect fragmented code, deep import chains, and expensive context budgets",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"commander": "^14.0.0",
|
|
50
50
|
"chalk": "^5.3.0",
|
|
51
51
|
"prompts": "^2.4.2",
|
|
52
|
-
"@aiready/core": "0.23.
|
|
52
|
+
"@aiready/core": "0.23.20"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@types/node": "^24.0.0",
|