@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.
Files changed (61) hide show
  1. package/.turbo/turbo-build.log +26 -25
  2. package/.turbo/turbo-lint.log +5 -5
  3. package/.turbo/turbo-test.log +104 -41
  4. package/coverage/clover.xml +2615 -1242
  5. package/coverage/coverage-final.json +30 -13
  6. package/coverage/dist/chunk-64U3PNO3.mjs.html +367 -0
  7. package/coverage/dist/chunk-J3MUOWHC.mjs.html +5326 -0
  8. package/coverage/dist/index.html +146 -0
  9. package/coverage/{classifier.ts.html → dist/index.mjs.html} +537 -912
  10. package/coverage/index.html +84 -189
  11. package/coverage/src/analyzer.ts.html +88 -0
  12. package/coverage/src/analyzers/index.html +116 -0
  13. package/coverage/src/analyzers/python-context.ts.html +910 -0
  14. package/coverage/{ast-utils.ts.html → src/ast-utils.ts.html} +84 -54
  15. package/coverage/src/classifier.ts.html +892 -0
  16. package/coverage/src/classify/classification-patterns.ts.html +307 -0
  17. package/coverage/src/classify/file-classifiers.ts.html +973 -0
  18. package/coverage/src/classify/index.html +131 -0
  19. package/coverage/{cluster-detector.ts.html → src/cluster-detector.ts.html} +154 -91
  20. package/coverage/{defaults.ts.html → src/defaults.ts.html} +74 -65
  21. package/coverage/{graph-builder.ts.html → src/graph-builder.ts.html} +268 -229
  22. package/coverage/src/index.html +341 -0
  23. package/coverage/{index.ts.html → src/index.ts.html} +70 -13
  24. package/coverage/{scoring.ts.html → src/issue-analyzer.ts.html} +201 -261
  25. package/coverage/src/mapper.ts.html +439 -0
  26. package/coverage/{metrics.ts.html → src/metrics.ts.html} +201 -132
  27. package/coverage/src/orchestrator.ts.html +493 -0
  28. package/coverage/{provider.ts.html → src/provider.ts.html} +21 -21
  29. package/coverage/{remediation.ts.html → src/remediation.ts.html} +112 -52
  30. package/coverage/src/report/console-report.ts.html +415 -0
  31. package/coverage/src/report/html-report.ts.html +361 -0
  32. package/coverage/src/report/index.html +146 -0
  33. package/coverage/src/report/interactive-setup.ts.html +373 -0
  34. package/coverage/src/scoring.ts.html +895 -0
  35. package/coverage/src/semantic/co-usage.ts.html +340 -0
  36. package/coverage/src/semantic/consolidation.ts.html +223 -0
  37. package/coverage/src/semantic/domain-inference.ts.html +859 -0
  38. package/coverage/src/semantic/index.html +161 -0
  39. package/coverage/src/semantic/type-graph.ts.html +163 -0
  40. package/coverage/{summary.ts.html → src/summary.ts.html} +155 -275
  41. package/coverage/{types.ts.html → src/types.ts.html} +133 -31
  42. package/coverage/src/utils/dependency-graph-utils.ts.html +463 -0
  43. package/coverage/src/utils/index.html +131 -0
  44. package/coverage/src/utils/string-utils.ts.html +148 -0
  45. package/dist/chunk-J3MUOWHC.mjs +1747 -0
  46. package/dist/cli.js +59 -171
  47. package/dist/cli.mjs +1 -1
  48. package/dist/index.js +55 -167
  49. package/dist/index.mjs +1 -1
  50. package/package.json +2 -2
  51. package/src/__tests__/consolidation.test.ts +247 -0
  52. package/src/__tests__/defaults.test.ts +121 -0
  53. package/src/__tests__/domain-inference.test.ts +420 -0
  54. package/src/__tests__/issue-analyzer.test.ts +155 -0
  55. package/src/__tests__/orchestrator.test.ts +143 -0
  56. package/src/__tests__/python-context.test.ts +98 -0
  57. package/src/__tests__/report/console-report.test.ts +292 -0
  58. package/src/__tests__/report/html-report.test.ts +232 -0
  59. package/src/report/html-report.ts +58 -174
  60. package/coverage/analyzer.ts.html +0 -1369
  61. 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 import_core8 = require("@aiready/core");
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
- return `<!DOCTYPE html>
1733
- <html lang="en">
1734
- <head>
1735
- <meta charset="UTF-8">
1736
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
1737
- <title>aiready Context Analysis Report</title>
1738
- <style>
1739
- body {
1740
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
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
- </style>
1808
- </head>
1809
- <body>
1810
- <div class="header">
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
- ${totalIssues > 0 ? `
1835
- <div class="card" style="margin-bottom: 30px;">
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="issue-critical">\u{1F534} Critical: ${summary.criticalIssues}</span> &nbsp;
1839
- <span class="issue-major">\u{1F7E1} Major: ${summary.majorIssues}</span> &nbsp;
1840
- <span class="issue-minor">\u{1F535} Minor: ${summary.minorIssues}</span>
1753
+ <span class="critical">\u{1F534} Critical: ${summary.criticalIssues}</span> &nbsp;
1754
+ <span class="major">\u{1F7E1} Major: ${summary.majorIssues}</span> &nbsp;
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
- ${summary.fragmentedModules.length > 0 ? `
1847
- <div class="card" style="margin-bottom: 30px;">
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
- <table>
1850
- <thead>
1851
- <tr>
1852
- <th>Domain</th>
1853
- <th>Files</th>
1854
- <th>Fragmentation</th>
1855
- <th>Token Cost</th>
1856
- </tr>
1857
- </thead>
1858
- <tbody>
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
- <table>
1878
- <thead>
1879
- <tr>
1880
- <th>File</th>
1881
- <th>Context Budget</th>
1882
- <th>Severity</th>
1883
- </tr>
1884
- </thead>
1885
- <tbody>
1886
- ${summary.topExpensiveFiles.map(
1887
- (f) => `
1888
- <tr>
1889
- <td>${f.file}</td>
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, import_core8.loadMergedConfig)(directory, defaults, {
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, import_core8.getElapsedTime)(startTime);
1904
+ const duration = (0, import_core9.getElapsedTime)(startTime);
2017
1905
  if (options.output === "json") {
2018
- (0, import_core8.handleJSONOutput)(
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, import_core8.resolveOutputPath)(
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, import_core8.handleCLIError)(error, "context-analyzer");
1938
+ (0, import_core9.handleCLIError)(error, "context-analyzer");
2051
1939
  }
2052
1940
  }
2053
1941
 
package/dist/cli.mjs CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  generateHTMLReport,
6
6
  generateSummary,
7
7
  runInteractiveSetup
8
- } from "./chunk-CBWM3EK5.mjs";
8
+ } from "./chunk-J3MUOWHC.mjs";
9
9
  import "./chunk-64U3PNO3.mjs";
10
10
 
11
11
  // src/cli.ts
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 import_core11 = require("@aiready/core");
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
- return `<!DOCTYPE html>
2211
- <html lang="en">
2212
- <head>
2213
- <meta charset="UTF-8">
2214
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
2215
- <title>aiready Context Analysis Report</title>
2216
- <style>
2217
- body {
2218
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
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
- </style>
2286
- </head>
2287
- <body>
2288
- <div class="header">
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
- ${totalIssues > 0 ? `
2313
- <div class="card" style="margin-bottom: 30px;">
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="issue-critical">\u{1F534} Critical: ${summary.criticalIssues}</span> &nbsp;
2317
- <span class="issue-major">\u{1F7E1} Major: ${summary.majorIssues}</span> &nbsp;
2318
- <span class="issue-minor">\u{1F535} Minor: ${summary.minorIssues}</span>
2231
+ <span class="critical">\u{1F534} Critical: ${summary.criticalIssues}</span> &nbsp;
2232
+ <span class="major">\u{1F7E1} Major: ${summary.majorIssues}</span> &nbsp;
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
- ${summary.fragmentedModules.length > 0 ? `
2325
- <div class="card" style="margin-bottom: 30px;">
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
- <table>
2328
- <thead>
2329
- <tr>
2330
- <th>Domain</th>
2331
- <th>Files</th>
2332
- <th>Fragmentation</th>
2333
- <th>Token Cost</th>
2334
- </tr>
2335
- </thead>
2336
- <tbody>
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
- <table>
2356
- <thead>
2357
- <tr>
2358
- <th>File</th>
2359
- <th>Context Budget</th>
2360
- <th>Severity</th>
2361
- </tr>
2362
- </thead>
2363
- <tbody>
2364
- ${summary.topExpensiveFiles.map(
2365
- (f) => `
2366
- <tr>
2367
- <td>${f.file}</td>
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
- import_core11.ToolRegistry.register(ContextAnalyzerProvider);
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
@@ -52,7 +52,7 @@ import {
52
52
  isTypeDefinition,
53
53
  isUtilityModule,
54
54
  runInteractiveSetup
55
- } from "./chunk-CBWM3EK5.mjs";
55
+ } from "./chunk-J3MUOWHC.mjs";
56
56
  import "./chunk-64U3PNO3.mjs";
57
57
 
58
58
  // src/index.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiready/context-analyzer",
3
- "version": "0.21.22",
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.19"
52
+ "@aiready/core": "0.23.20"
53
53
  },
54
54
  "devDependencies": {
55
55
  "@types/node": "^24.0.0",