frontend-guardian-core 2.7.0 → 2.8.0

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/bin/fg-core.js CHANGED
@@ -38,6 +38,8 @@ import {
38
38
  SmartCache,
39
39
  runFixBot,
40
40
  detectFixBotConfig,
41
+ HistoryReport,
42
+ generateDashboard,
41
43
  } from "../dist/index.js";
42
44
  import pc from "picocolors";
43
45
  import { runWatchMode } from "./watch-mode.js";
@@ -70,7 +72,7 @@ const MODULE_RULES = {
70
72
 
71
73
  function showHelp() {
72
74
  console.log(`
73
- Frontend Guardian Core v2.7.0
75
+ Frontend Guardian Core v2.8.0
74
76
 
75
77
  Usage:
76
78
  fg-core <project-dir> [options]
@@ -108,6 +110,11 @@ Options:
108
110
  --pr-number <n> 指定 PR/MR 编号(配合 --post-comment)
109
111
  --comment-provider <p> 评论平台: github | gitlab(配合 --post-comment)
110
112
  --upload 上传报告到指定位置(需配置 FG_UPLOAD_PROVIDER 等环境变量)
113
+ --save-report 保存完整扫描报告到 .frontend-guardian/history/
114
+ --history 查看历史扫描记录
115
+ --history-module <m> 历史记录按模块过滤(配合 --history)
116
+ --history-limit <n> 历史记录显示条数限制(默认 20)
117
+ --generate-dashboard 生成团队趋势看板 HTML 页面
111
118
  --help, -h 显示帮助
112
119
 
113
120
  Examples:
@@ -162,6 +169,11 @@ async function main() {
162
169
  upload: false,
163
170
  output: undefined,
164
171
  fixBot: false,
172
+ saveReport: false,
173
+ history: false,
174
+ historyModule: undefined,
175
+ historyLimit: 20,
176
+ generateDashboard: false,
165
177
  };
166
178
 
167
179
  for (let i = 0; i < args.length; i++) {
@@ -265,6 +277,21 @@ async function main() {
265
277
  case "--fix-bot":
266
278
  options.fixBot = true;
267
279
  break;
280
+ case "--save-report":
281
+ options.saveReport = true;
282
+ break;
283
+ case "--history":
284
+ options.history = true;
285
+ break;
286
+ case "--history-module":
287
+ options.historyModule = args[++i];
288
+ break;
289
+ case "--history-limit":
290
+ options.historyLimit = parseInt(args[++i], 10) || 20;
291
+ break;
292
+ case "--generate-dashboard":
293
+ options.generateDashboard = true;
294
+ break;
268
295
  case "--help":
269
296
  case "-h":
270
297
  showHelp();
@@ -330,6 +357,53 @@ async function main() {
330
357
  process.exit(0);
331
358
  }
332
359
 
360
+ // v2.8.0: 历史报告查询
361
+ if (options.history) {
362
+ const hr = new HistoryReport(options.projectDir);
363
+ const reports = hr.listReports();
364
+ let filtered = reports;
365
+ if (options.historyModule) {
366
+ filtered = reports.filter((r) => r.module === options.historyModule);
367
+ }
368
+ filtered = filtered.slice(0, options.historyLimit);
369
+
370
+ console.log(pc.cyan("📜 历史扫描记录"));
371
+ if (filtered.length === 0) {
372
+ console.log(pc.gray(" 暂无历史记录"));
373
+ } else {
374
+ console.log(` ${"时间".padEnd(20)} ${"模块".padEnd(15)} ${"C".padStart(4)} ${"W".padStart(4)} ${"S".padStart(4)}`);
375
+ console.log(pc.gray(" " + "-".repeat(50)));
376
+ for (const r of filtered) {
377
+ const time = new Date(r.timestamp).toLocaleString("zh-CN", { month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit" });
378
+ const c = pc.red(String(r.counts.critical).padStart(4));
379
+ const w = pc.yellow(String(r.counts.warning).padStart(4));
380
+ const s = pc.blue(String(r.counts.suggestion).padStart(4));
381
+ console.log(` ${time.padEnd(20)} ${r.module.padEnd(15)} ${c} ${w} ${s}`);
382
+ }
383
+ console.log(pc.gray(` 共 ${reports.length} 条记录` + (options.historyModule ? `,已按模块 "${options.historyModule}" 过滤` : "")));
384
+ }
385
+ process.exit(0);
386
+ }
387
+
388
+ // v2.8.0: 生成趋势看板
389
+ if (options.generateDashboard) {
390
+ const hr = new HistoryReport(options.projectDir);
391
+ const reportList = hr.listReports();
392
+ if (reportList.length === 0) {
393
+ console.log(pc.yellow("⚠️ 暂无历史扫描记录,无法生成看板。请先运行 --save-report 生成历史数据。"));
394
+ process.exit(1);
395
+ }
396
+ const fullReports = reportList
397
+ .map((r) => hr.loadReport(r.filename))
398
+ .filter(Boolean);
399
+ const outputPath = generateDashboard(fullReports, { projectDir: options.projectDir });
400
+ console.log(pc.cyan("📊 趋势看板已生成"));
401
+ console.log(pc.green(` ✅ ${outputPath}`));
402
+ console.log(pc.gray(` 共 ${fullReports.length} 次扫描记录`));
403
+ console.log(pc.gray(" 在浏览器中打开即可查看"));
404
+ process.exit(0);
405
+ }
406
+
333
407
  if (options.watch) {
334
408
  const scanFn = options.module === "all" ? runAllModules : runSingleModule;
335
409
  // v2.6.0: Watch 模式复用 SmartCache,实现缓存预热
@@ -798,6 +872,21 @@ async function runAllModules(options, cacheInstance) {
798
872
  }
799
873
  }
800
874
 
875
+ // v2.8.0: 保存完整扫描报告
876
+ if (options.saveReport) {
877
+ const hr = new HistoryReport(options.projectDir);
878
+ for (const mod of MODULES) {
879
+ const r = allResults[mod];
880
+ if (!r || r.total === 0) continue;
881
+ const allIssues = [...r.issues.critical, ...r.issues.warning, ...r.issues.suggestion];
882
+ const filename = hr.saveFullReport(r, allIssues);
883
+ if (!options.json) {
884
+ console.log(pc.cyan(`💾 报告已保存`));
885
+ console.log(pc.gray(` .frontend-guardian/history/${filename}`));
886
+ }
887
+ }
888
+ }
889
+
801
890
  console.log(
802
891
  pc.gray(
803
892
  `⏱️ 总耗时: ${totalDuration}ms | 扫描 ${totalFilesScanned} 个文件 | ${totalFilesWithIssues} 个文件有问题`
package/dist/index.d.ts CHANGED
@@ -16,7 +16,9 @@ export { installGitHooks, uninstallGitHooks, hasGitHook, detectHusky } from "./u
16
16
  export { generateCIConfig, detectCIProvider } from "./utils/ci-generator.js";
17
17
  export type { CIProvider, CIGeneratorOptions } from "./utils/ci-generator.js";
18
18
  export { HistoryReport } from "./utils/history-report.js";
19
- export type { HistoryEntry, TrendAnalysis } from "./utils/history-report.js";
19
+ export type { HistoryEntry, TrendAnalysis, FullReport } from "./utils/history-report.js";
20
+ export { generateDashboard } from "./utils/dashboard.js";
21
+ export type { DashboardOptions } from "./utils/dashboard.js";
20
22
  export { uploadReport, detectUploadConfig } from "./utils/report-uploader.js";
21
23
  export type { UploadConfig, UploadResult } from "./utils/report-uploader.js";
22
24
  export { runFixBot, detectFixBotConfig } from "./utils/fix-bot.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACnE,YAAY,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACnE,YAAY,EACR,IAAI,EACJ,WAAW,EACX,UAAU,EACV,gBAAgB,EAChB,KAAK,EACL,QAAQ,EACR,UAAU,EACV,aAAa,EACb,WAAW,EACX,SAAS,EACT,GAAG,EACH,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,YAAY,GACf,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AACjF,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnG,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC7E,YAAY,EAAE,UAAU,EAAE,kBAAkB,EAA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AE,aAAa,EAAE,MAAM,mBAAmB,CAAC"}
package/dist/index.js CHANGED
@@ -4,8 +4,8 @@
4
4
  * 导出所有公共 API
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.stylelintIntegration = exports.typescriptIntegration = exports.eslintIntegration = exports.allExternalTools = exports.autoPublishComment = exports.createPublisher = exports.detectPublisherConfig = exports.GitLabMRPublisher = exports.GitHubPRPublisher = exports.isGuardianComment = exports.COMMENT_MARKER = exports.generatePRCommentSummary = exports.generatePRComment = exports.writeJobSummary = exports.isGitHubActions = exports.formatAllAnnotations = exports.formatIssuesAnnotations = exports.formatIssueAnnotation = exports.formatSarif = exports.generateSarif = exports.toBaselineIssue = exports.saveBaseline = exports.loadBaseline = exports.generateBaseline = exports.compareWithBaseline = exports.BaselineManager = exports.detectFixBotConfig = exports.runFixBot = exports.detectUploadConfig = exports.uploadReport = exports.HistoryReport = exports.detectCIProvider = exports.generateCIConfig = exports.detectHusky = exports.hasGitHook = exports.uninstallGitHooks = exports.installGitHooks = exports.generateDefaultConfig = exports.initConfig = exports.loadConfig = exports.detectProjectMeta = exports.walkAST = exports.hasImport = exports.getImports = exports.parseAST = exports.createRegistry = exports.RuleRegistry = exports.SmartCache = exports.createEngine = exports.RuleEngine = void 0;
8
- exports.getJSXTagName = exports.getFileExt = exports.svelteRules = exports.platformRules = exports.hooksRules = exports.componentRules = exports.crossFileRules = exports.namingRules = exports.securityRules = exports.a11yRules = exports.performanceRules = exports.i18nRules = exports.runAllExternalTools = void 0;
7
+ exports.typescriptIntegration = exports.eslintIntegration = exports.allExternalTools = exports.autoPublishComment = exports.createPublisher = exports.detectPublisherConfig = exports.GitLabMRPublisher = exports.GitHubPRPublisher = exports.isGuardianComment = exports.COMMENT_MARKER = exports.generatePRCommentSummary = exports.generatePRComment = exports.writeJobSummary = exports.isGitHubActions = exports.formatAllAnnotations = exports.formatIssuesAnnotations = exports.formatIssueAnnotation = exports.formatSarif = exports.generateSarif = exports.toBaselineIssue = exports.saveBaseline = exports.loadBaseline = exports.generateBaseline = exports.compareWithBaseline = exports.BaselineManager = exports.detectFixBotConfig = exports.runFixBot = exports.detectUploadConfig = exports.uploadReport = exports.generateDashboard = exports.HistoryReport = exports.detectCIProvider = exports.generateCIConfig = exports.detectHusky = exports.hasGitHook = exports.uninstallGitHooks = exports.installGitHooks = exports.generateDefaultConfig = exports.initConfig = exports.loadConfig = exports.detectProjectMeta = exports.walkAST = exports.hasImport = exports.getImports = exports.parseAST = exports.createRegistry = exports.RuleRegistry = exports.SmartCache = exports.createEngine = exports.RuleEngine = void 0;
8
+ exports.getJSXTagName = exports.getFileExt = exports.svelteRules = exports.platformRules = exports.hooksRules = exports.componentRules = exports.crossFileRules = exports.namingRules = exports.securityRules = exports.a11yRules = exports.performanceRules = exports.i18nRules = exports.runAllExternalTools = exports.stylelintIntegration = void 0;
9
9
  var rule_engine_js_1 = require("./engine/rule-engine.js");
10
10
  Object.defineProperty(exports, "RuleEngine", { enumerable: true, get: function () { return rule_engine_js_1.RuleEngine; } });
11
11
  Object.defineProperty(exports, "createEngine", { enumerable: true, get: function () { return rule_engine_js_1.createEngine; } });
@@ -36,6 +36,9 @@ Object.defineProperty(exports, "generateCIConfig", { enumerable: true, get: func
36
36
  Object.defineProperty(exports, "detectCIProvider", { enumerable: true, get: function () { return ci_generator_js_1.detectCIProvider; } });
37
37
  var history_report_js_1 = require("./utils/history-report.js");
38
38
  Object.defineProperty(exports, "HistoryReport", { enumerable: true, get: function () { return history_report_js_1.HistoryReport; } });
39
+ // v2.8.0: 趋势看板
40
+ var dashboard_js_1 = require("./utils/dashboard.js");
41
+ Object.defineProperty(exports, "generateDashboard", { enumerable: true, get: function () { return dashboard_js_1.generateDashboard; } });
39
42
  // v2.5.0: 报告上传
40
43
  var report_uploader_js_1 = require("./utils/report-uploader.js");
41
44
  Object.defineProperty(exports, "uploadReport", { enumerable: true, get: function () { return report_uploader_js_1.uploadReport; } });
package/dist/index.js.map CHANGED
@@ -1 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;AACf,uHAAA,eAAe,OAAA;AAGnB,qBAAqB;AACrB,4DAKoC;AAJhC,kHAAA,iBAAiB,OAAA;AACjB,yHAAA,wBAAwB,OAAA;AACxB,+GAAA,cAAc,OAAA;AACd,kHAAA,iBAAiB,OAAA;AAIrB,2DAMiC;AAL7B,oHAAA,iBAAiB,OAAA;AACjB,oHAAA,iBAAiB,OAAA;AACjB,wHAAA,qBAAqB,OAAA;AACrB,kHAAA,eAAe,OAAA;AACf,qHAAA,kBAAkB,OAAA;AAItB,kBAAkB;AAClB,oDAMiC;AAL7B,4GAAA,gBAAgB,OAAA;AAChB,6GAAA,iBAAiB,OAAA;AACjB,iHAAA,qBAAqB,OAAA;AACrB,gHAAA,oBAAoB,OAAA;AACpB,+GAAA,mBAAmB,OAAA;AAIvB,8DAAuD;AAA9C,4GAAA,SAAS,OAAA;AAElB,4EAAqE;AAA5D,0HAAA,gBAAgB,OAAA;AACzB,8DAAuD;AAA9C,4GAAA,SAAS,OAAA;AAClB,sEAA+D;AAAtD,oHAAA,aAAa,OAAA;AACtB,kEAA2D;AAAlD,gHAAA,WAAW,OAAA;AACpB,0EAAkE;AAAzD,uHAAA,cAAc,OAAA;AACvB,wEAAiE;AAAxD,sHAAA,cAAc,OAAA;AACvB,gEAAyD;AAAhD,8GAAA,UAAU,OAAA;AACnB,sEAA+D;AAAtD,oHAAA,aAAa,OAAA;AACtB,kEAA2D;AAAlD,gHAAA,WAAW,OAAA;AACpB,+CAA8D;AAArD,uGAAA,UAAU,OAAA;AAAE,0GAAA,aAAa,OAAA"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Dashboard — 团队趋势看板生成器
3
+ *
4
+ * v2.8.0 功能:
5
+ * 1. 基于历史报告数据生成静态 HTML 趋势页面
6
+ * 2. 零外部依赖:纯 Canvas 绘制图表,单文件 HTML
7
+ * 3. 可直接浏览器打开或部署到静态托管
8
+ */
9
+ import type { FullReport } from "./history-report.js";
10
+ export interface DashboardOptions {
11
+ /** 项目目录 */
12
+ projectDir: string;
13
+ /** 输出文件路径(默认 ./frontend-guardian-dashboard.html) */
14
+ outputPath?: string;
15
+ /** 标题 */
16
+ title?: string;
17
+ }
18
+ /**
19
+ * 生成趋势看板 HTML
20
+ * @param reports 历史报告列表
21
+ * @param options 选项
22
+ */
23
+ export declare function generateDashboard(reports: FullReport[], options: DashboardOptions): string;
24
+ //# sourceMappingURL=dashboard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dashboard.d.ts","sourceRoot":"","sources":["../../src/utils/dashboard.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEtD,MAAM,WAAW,gBAAgB;IAC7B,WAAW;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,oDAAoD;IACpD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS;IACT,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,UAAU,EAAE,EAAE,OAAO,EAAE,gBAAgB,GAAG,MAAM,CAsS1F"}
@@ -0,0 +1,315 @@
1
+ "use strict";
2
+ /**
3
+ * Dashboard — 团队趋势看板生成器
4
+ *
5
+ * v2.8.0 功能:
6
+ * 1. 基于历史报告数据生成静态 HTML 趋势页面
7
+ * 2. 零外部依赖:纯 Canvas 绘制图表,单文件 HTML
8
+ * 3. 可直接浏览器打开或部署到静态托管
9
+ */
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.generateDashboard = generateDashboard;
12
+ const node_fs_1 = require("node:fs");
13
+ const node_path_1 = require("node:path");
14
+ /**
15
+ * 生成趋势看板 HTML
16
+ * @param reports 历史报告列表
17
+ * @param options 选项
18
+ */
19
+ function generateDashboard(reports, options) {
20
+ const { projectDir, outputPath = (0, node_path_1.resolve)(projectDir, "frontend-guardian-dashboard.html"), title = "Frontend Guardian 趋势看板" } = options;
21
+ if (reports.length === 0) {
22
+ return "";
23
+ }
24
+ // 按时间排序
25
+ const sorted = [...reports].sort((a, b) => a.timestamp - b.timestamp);
26
+ // 统计
27
+ const totalIssues = sorted.map((r) => ({
28
+ time: formatTime(r.timestamp),
29
+ critical: r.result.issues.critical.length,
30
+ warning: r.result.issues.warning.length,
31
+ suggestion: r.result.issues.suggestion.length,
32
+ total: r.result.total,
33
+ }));
34
+ // 模块分布(最新一次扫描)
35
+ const latest = sorted[sorted.length - 1];
36
+ const moduleCounts = sorted.reduce((acc, r) => {
37
+ const mod = r.module;
38
+ if (!acc[mod])
39
+ acc[mod] = { critical: 0, warning: 0, suggestion: 0 };
40
+ acc[mod].critical += r.result.issues.critical.length;
41
+ acc[mod].warning += r.result.issues.warning.length;
42
+ acc[mod].suggestion += r.result.issues.suggestion.length;
43
+ return acc;
44
+ }, {});
45
+ // 修复率:对比最早和最新
46
+ const earliest = sorted[0];
47
+ const fixRate = earliest.result.total > 0 ? Math.round(((earliest.result.total - latest.result.total) / earliest.result.total) * 100) : 0;
48
+ const trendDirection = fixRate >= 0 ? "📉 改善" : "📈 恶化";
49
+ const html = `<!DOCTYPE html>
50
+ <html lang="zh-CN">
51
+ <head>
52
+ <meta charset="UTF-8">
53
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
54
+ <title>${escapeHtml(title)}</title>
55
+ <style>
56
+ * { margin: 0; padding: 0; box-sizing: border-box; }
57
+ body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; background: #f5f7fa; color: #333; line-height: 1.6; }
58
+ .container { max-width: 1200px; margin: 0 auto; padding: 32px 24px; }
59
+ h1 { font-size: 28px; font-weight: 600; margin-bottom: 8px; color: #1a1a2e; }
60
+ .subtitle { color: #888; font-size: 14px; margin-bottom: 32px; }
61
+ .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; margin-bottom: 32px; }
62
+ .card { background: #fff; border-radius: 12px; padding: 24px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
63
+ .card h3 { font-size: 14px; color: #888; margin-bottom: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }
64
+ .big-number { font-size: 42px; font-weight: 700; color: #1a1a2e; }
65
+ .big-number.critical { color: #e74c3c; }
66
+ .big-number.warning { color: #f39c12; }
67
+ .big-number.suggestion { color: #3498db; }
68
+ .trend-badge { display: inline-block; padding: 4px 12px; border-radius: 20px; font-size: 13px; font-weight: 500; margin-top: 8px; }
69
+ .trend-badge.good { background: #d4edda; color: #155724; }
70
+ .trend-badge.bad { background: #f8d7da; color: #721c24; }
71
+ .chart-container { background: #fff; border-radius: 12px; padding: 24px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); margin-bottom: 20px; }
72
+ .chart-container h3 { font-size: 16px; margin-bottom: 16px; color: #1a1a2e; }
73
+ canvas { width: 100%; height: 300px; }
74
+ table { width: 100%; border-collapse: collapse; font-size: 14px; }
75
+ th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #eee; }
76
+ th { font-weight: 600; color: #666; font-size: 12px; text-transform: uppercase; }
77
+ tr:hover { background: #f9fafb; }
78
+ .severity-critical { color: #e74c3c; font-weight: 600; }
79
+ .severity-warning { color: #f39c12; font-weight: 600; }
80
+ .severity-suggestion { color: #3498db; font-weight: 600; }
81
+ .footer { text-align: center; color: #aaa; font-size: 12px; margin-top: 40px; padding-bottom: 24px; }
82
+ </style>
83
+ </head>
84
+ <body>
85
+ <div class="container">
86
+ <h1>📊 ${escapeHtml(title)}</h1>
87
+ <p class="subtitle">生成时间:${new Date().toLocaleString("zh-CN")} | 共 ${reports.length} 次扫描记录</p>
88
+
89
+ <div class="grid">
90
+ <div class="card">
91
+ <h3>🔴 Critical</h3>
92
+ <div class="big-number critical">${latest.result.issues.critical.length}</div>
93
+ </div>
94
+ <div class="card">
95
+ <h3>🟡 Warning</h3>
96
+ <div class="big-number warning">${latest.result.issues.warning.length}</div>
97
+ </div>
98
+ <div class="card">
99
+ <h3>💡 Suggestion</h3>
100
+ <div class="big-number suggestion">${latest.result.issues.suggestion.length}</div>
101
+ </div>
102
+ <div class="card">
103
+ <h3>📈 修复趋势</h3>
104
+ <div class="big-number">${Math.abs(fixRate)}%</div>
105
+ <span class="trend-badge ${fixRate >= 0 ? "good" : "bad"}">${trendDirection}(${earliest.result.total} → ${latest.result.total})</span>
106
+ </div>
107
+ </div>
108
+
109
+ <div class="chart-container">
110
+ <h3>📉 问题趋势(时间线)</h3>
111
+ <canvas id="trendChart"></canvas>
112
+ </div>
113
+
114
+ <div class="grid">
115
+ <div class="chart-container">
116
+ <h3>🍰 模块分布</h3>
117
+ <canvas id="moduleChart"></canvas>
118
+ </div>
119
+ <div class="chart-container">
120
+ <h3>📋 严重级别分布</h3>
121
+ <canvas id="severityChart"></canvas>
122
+ </div>
123
+ </div>
124
+
125
+ <div class="chart-container">
126
+ <h3>📜 扫描历史</h3>
127
+ <table>
128
+ <thead>
129
+ <tr><th>时间</th><th>模块</th><th>Critical</th><th>Warning</th><th>Suggestion</th><th>耗时</th></tr>
130
+ </thead>
131
+ <tbody>
132
+ ${[...sorted].reverse().map((r) => `<tr>
133
+ <td>${formatTime(r.timestamp)}</td>
134
+ <td>${r.module}</td>
135
+ <td class="severity-critical">${r.result.issues.critical.length}</td>
136
+ <td class="severity-warning">${r.result.issues.warning.length}</td>
137
+ <td class="severity-suggestion">${r.result.issues.suggestion.length}</td>
138
+ <td>${r.result.duration}ms</td>
139
+ </tr>`).join("")}
140
+ </tbody>
141
+ </table>
142
+ </div>
143
+
144
+ <div class="footer">
145
+ Generated by frontend-guardian v2.8.0
146
+ </div>
147
+ </div>
148
+
149
+ <script>
150
+ // ── 折线图:问题趋势 ──
151
+ (function() {
152
+ const canvas = document.getElementById('trendChart');
153
+ const ctx = canvas.getContext('2d');
154
+ const dpr = window.devicePixelRatio || 1;
155
+ const rect = canvas.getBoundingClientRect();
156
+ canvas.width = rect.width * dpr;
157
+ canvas.height = rect.height * dpr;
158
+ ctx.scale(dpr, dpr);
159
+
160
+ const data = ${JSON.stringify(totalIssues)};
161
+ const W = rect.width, H = rect.height;
162
+ const pad = { t: 30, r: 30, b: 50, l: 50 };
163
+ const gw = W - pad.l - pad.r, gh = H - pad.t - pad.b;
164
+
165
+ const maxVal = Math.max(...data.map(d => d.total), 1);
166
+ const getX = i => pad.l + (i / (data.length - 1 || 1)) * gw;
167
+ const getY = v => pad.t + gh - (v / maxVal) * gh;
168
+
169
+ // 网格
170
+ ctx.strokeStyle = '#eee';
171
+ ctx.lineWidth = 1;
172
+ for (let i = 0; i <= 4; i++) {
173
+ const y = pad.t + (i / 4) * gh;
174
+ ctx.beginPath(); ctx.moveTo(pad.l, y); ctx.lineTo(W - pad.r, y); ctx.stroke();
175
+ ctx.fillStyle = '#999'; ctx.font = '12px sans-serif';
176
+ ctx.fillText(Math.round(maxVal * (1 - i / 4)), 5, y + 4);
177
+ }
178
+
179
+ // 轴线
180
+ ctx.strokeStyle = '#ddd';
181
+ ctx.beginPath(); ctx.moveTo(pad.l, pad.t); ctx.lineTo(pad.l, H - pad.b); ctx.stroke();
182
+ ctx.beginPath(); ctx.moveTo(pad.l, H - pad.b); ctx.lineTo(W - pad.r, H - pad.b); ctx.stroke();
183
+
184
+ // 数据线
185
+ const colors = { critical: '#e74c3c', warning: '#f39c12', suggestion: '#3498db' };
186
+ ['critical', 'warning', 'suggestion'].forEach(key => {
187
+ ctx.strokeStyle = colors[key];
188
+ ctx.lineWidth = 2;
189
+ ctx.beginPath();
190
+ data.forEach((d, i) => {
191
+ const x = getX(i), y = getY(d[key]);
192
+ if (i === 0) ctx.moveTo(x, y); else ctx.lineTo(x, y);
193
+ });
194
+ ctx.stroke();
195
+ // 点
196
+ ctx.fillStyle = colors[key];
197
+ data.forEach((d, i) => {
198
+ const x = getX(i), y = getY(d[key]);
199
+ ctx.beginPath(); ctx.arc(x, y, 3, 0, Math.PI * 2); ctx.fill();
200
+ });
201
+ });
202
+
203
+ // X轴标签
204
+ ctx.fillStyle = '#999'; ctx.font = '11px sans-serif'; ctx.textAlign = 'center';
205
+ data.forEach((d, i) => {
206
+ if (data.length <= 10 || i % Math.ceil(data.length / 10) === 0) {
207
+ ctx.fillText(d.time, getX(i), H - pad.b + 20);
208
+ }
209
+ });
210
+
211
+ // 图例
212
+ const legend = [{c:'#e74c3c',l:'Critical'},{c:'#f39c12',l:'Warning'},{c:'#3498db',l:'Suggestion'}];
213
+ legend.forEach((item, i) => {
214
+ const lx = W - pad.r - 200 + i * 70;
215
+ ctx.fillStyle = item.c; ctx.fillRect(lx, 10, 12, 12);
216
+ ctx.fillStyle = '#666'; ctx.font = '12px sans-serif'; ctx.textAlign = 'left';
217
+ ctx.fillText(item.l, lx + 16, 21);
218
+ });
219
+ })();
220
+
221
+ // ── 饼图:模块分布 ──
222
+ (function() {
223
+ const canvas = document.getElementById('moduleChart');
224
+ const ctx = canvas.getContext('2d');
225
+ const dpr = window.devicePixelRatio || 1;
226
+ const rect = canvas.getBoundingClientRect();
227
+ canvas.width = rect.width * dpr; canvas.height = rect.height * dpr;
228
+ ctx.scale(dpr, dpr);
229
+ const W = rect.width, H = rect.height;
230
+ const cx = W / 2, cy = H / 2 + 10, r = Math.min(W, H) / 2 - 50;
231
+
232
+ const mods = ${JSON.stringify(Object.entries(moduleCounts).map(([name, counts]) => ({ name, total: counts.critical + counts.warning + counts.suggestion })))};
233
+ const total = mods.reduce((s, m) => s + m.total, 0);
234
+ const colors = ['#e74c3c','#f39c12','#3498db','#2ecc71','#9b59b6','#1abc9c','#e67e22','#34495e'];
235
+
236
+ let angle = -Math.PI / 2;
237
+ mods.forEach((mod, i) => {
238
+ const slice = (mod.total / total) * Math.PI * 2;
239
+ ctx.beginPath();
240
+ ctx.moveTo(cx, cy);
241
+ ctx.arc(cx, cy, r, angle, angle + slice);
242
+ ctx.closePath();
243
+ ctx.fillStyle = colors[i % colors.length];
244
+ ctx.fill();
245
+ ctx.strokeStyle = '#fff'; ctx.lineWidth = 2; ctx.stroke();
246
+
247
+ // 标签
248
+ if (mod.total > 0) {
249
+ const mid = angle + slice / 2;
250
+ const lx = cx + Math.cos(mid) * (r + 25);
251
+ const ly = cy + Math.sin(mid) * (r + 25);
252
+ ctx.fillStyle = '#555'; ctx.font = '12px sans-serif'; ctx.textAlign = 'center';
253
+ ctx.fillText(mod.name, lx, ly);
254
+ ctx.fillStyle = '#999'; ctx.font = '11px sans-serif';
255
+ ctx.fillText(mod.total + ' (' + Math.round(mod.total/total*100) + '%)', lx, ly + 14);
256
+ }
257
+ angle += slice;
258
+ });
259
+ })();
260
+
261
+ // ── 柱状图:严重级别分布 ──
262
+ (function() {
263
+ const canvas = document.getElementById('severityChart');
264
+ const ctx = canvas.getContext('2d');
265
+ const dpr = window.devicePixelRatio || 1;
266
+ const rect = canvas.getBoundingClientRect();
267
+ canvas.width = rect.width * dpr; canvas.height = rect.height * dpr;
268
+ ctx.scale(dpr, dpr);
269
+ const W = rect.width, H = rect.height;
270
+ const pad = { t: 30, r: 30, b: 40, l: 50 };
271
+ const gw = W - pad.l - pad.r, gh = H - pad.t - pad.b;
272
+
273
+ const latest = ${JSON.stringify({ critical: latest.result.issues.critical.length, warning: latest.result.issues.warning.length, suggestion: latest.result.issues.suggestion.length })};
274
+ const bars = [
275
+ { label: 'Critical', value: latest.critical, color: '#e74c3c' },
276
+ { label: 'Warning', value: latest.warning, color: '#f39c12' },
277
+ { label: 'Suggestion', value: latest.suggestion, color: '#3498db' },
278
+ ];
279
+ const maxVal = Math.max(...bars.map(b => b.value), 1);
280
+
281
+ bars.forEach((bar, i) => {
282
+ const bw = gw / bars.length * 0.5;
283
+ const bx = pad.l + (i + 0.5) * (gw / bars.length) - bw / 2;
284
+ const bh = (bar.value / maxVal) * gh;
285
+ const by = pad.t + gh - bh;
286
+ ctx.fillStyle = bar.color;
287
+ ctx.fillRect(bx, by, bw, bh);
288
+ // 标签
289
+ ctx.fillStyle = '#555'; ctx.font = '13px sans-serif'; ctx.textAlign = 'center';
290
+ ctx.fillText(bar.label, bx + bw / 2, H - pad.b + 20);
291
+ ctx.fillStyle = '#333'; ctx.font = 'bold 14px sans-serif';
292
+ ctx.fillText(bar.value, bx + bw / 2, by - 8);
293
+ });
294
+
295
+ // Y轴网格
296
+ ctx.strokeStyle = '#eee'; ctx.lineWidth = 1;
297
+ for (let i = 0; i <= 4; i++) {
298
+ const y = pad.t + (i / 4) * gh;
299
+ ctx.beginPath(); ctx.moveTo(pad.l, y); ctx.lineTo(W - pad.r, y); ctx.stroke();
300
+ }
301
+ })();
302
+ </script>
303
+ </body>
304
+ </html>`;
305
+ (0, node_fs_1.writeFileSync)(outputPath, html, "utf-8");
306
+ return outputPath;
307
+ }
308
+ function formatTime(ts) {
309
+ const d = new Date(ts);
310
+ return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")} ${String(d.getHours()).padStart(2, "0")}:${String(d.getMinutes()).padStart(2, "0")}`;
311
+ }
312
+ function escapeHtml(str) {
313
+ return str.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
314
+ }
315
+ //# sourceMappingURL=dashboard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dashboard.js","sourceRoot":"","sources":["../../src/utils/dashboard.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;AAoBH,8CAsSC;AAxTD,qCAAwC;AACxC,yCAAoC;AAYpC;;;;GAIG;AACH,SAAgB,iBAAiB,CAAC,OAAqB,EAAE,OAAyB;IAC9E,MAAM,EAAE,UAAU,EAAE,UAAU,GAAG,IAAA,mBAAO,EAAC,UAAU,EAAE,kCAAkC,CAAC,EAAE,KAAK,GAAG,wBAAwB,EAAE,GAAG,OAAO,CAAC;IAEvI,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,EAAE,CAAC;IACd,CAAC;IAED,QAAQ;IACR,MAAM,MAAM,GAAG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C,UAAU,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IACzC,OAAO,UAAU,CAAC;AACtB,CAAC;AAED,SAAS,UAAU,CAAC,EAAU;IAC1B,MAAM,CAAC,GAAG,IAAI,IAAI,CAAC,EAAE,CAAC,CAAC;IACvB,OAAO,GAAG,CAAC,CAAC,WAAW,EAAE,IAAI,MAAM,CAAC,CAAC,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC;AACzM,CAAC;AAED,SAAS,UAAU,CAAC,GAAW;IAC3B,OAAO,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AAC1G,CAAC"}
@@ -8,6 +8,24 @@
8
8
  * 4. 团队治理追踪
9
9
  */
10
10
  import type { Issue, ScanResult } from "../types.js";
11
+ /** v2.8.0: 完整扫描报告(持久化到 history 目录) */
12
+ export interface FullReport {
13
+ /** 报告时间戳 */
14
+ timestamp: number;
15
+ /** ISO 格式时间 */
16
+ timestampIso: string;
17
+ /** 扫描模块 */
18
+ module: string;
19
+ /** 完整 issues */
20
+ issues: Issue[];
21
+ /** 扫描结果统计 */
22
+ result: ScanResult;
23
+ /** git 信息 */
24
+ git?: {
25
+ commit?: string;
26
+ branch?: string;
27
+ };
28
+ }
11
29
  export interface HistoryEntry {
12
30
  /** 扫描时间戳 */
13
31
  timestamp: number;
@@ -53,6 +71,8 @@ export declare class HistoryReport {
53
71
  private historyDir;
54
72
  private historyFile;
55
73
  private entries;
74
+ /** v2.8.0: 完整报告存储目录 */
75
+ private reportsDir;
56
76
  constructor(projectDir: string);
57
77
  /**
58
78
  * 记录一次扫描结果
@@ -66,6 +86,30 @@ export declare class HistoryReport {
66
86
  getEntries(): HistoryEntry[];
67
87
  /** 清空历史 */
68
88
  clear(): void;
89
+ /**
90
+ * 保存完整扫描报告到 history/ 目录
91
+ * @param result 扫描结果
92
+ * @param allIssues 所有 issues
93
+ * @returns 保存的文件名
94
+ */
95
+ saveFullReport(result: ScanResult, allIssues: Issue[]): string;
96
+ /**
97
+ * 列出所有完整报告
98
+ */
99
+ listReports(): Array<{
100
+ filename: string;
101
+ timestamp: number;
102
+ module: string;
103
+ counts: {
104
+ critical: number;
105
+ warning: number;
106
+ suggestion: number;
107
+ };
108
+ }>;
109
+ /**
110
+ * 加载指定完整报告
111
+ */
112
+ loadReport(filename: string): FullReport | null;
69
113
  private loadEntries;
70
114
  private save;
71
115
  }
@@ -1 +1 @@
1
- {"version":3,"file":"history-report.d.ts","sourceRoot":"","sources":["../../src/utils/history-report.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAEpD,MAAM,WAAW,YAAY;IACzB,YAAY;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW;IACX,MAAM,EAAE,MAAM,CAAC;IACf,eAAe;IACf,MAAM,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC;IAClE,mBAAmB;IACnB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,YAAY;IACZ,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc;IACd,Q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BAAgB,EAAE,MAAM,EAAE,CAAC;CAC9B;AAOD,qBAAa,aAAa;IACtB,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,OAAO,CAAiB;IAChC,uBAAuB;IACvB,OAAO,CAAC,UAAU,CAAS;gBAEf,UAAU,EAAE,MAAM;IAO9B;;OAEG;IACH,MAAM,CAAC,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,IAAI;IA2CpD;;OAEG;IACH,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,EAAE,GAAG,aAAa;IA2CnE,eAAe;IACf,UAAU,IAAI,YAAY,EAAE;IAI5B,WAAW;IACX,KAAK,IAAI,IAAI;IAOb;;;;;OAKG;IACH,cAAc,CAAC,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,MAAM;IA8C9D;;OAEG;IACH,WAAW,IAAI,KAAK,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE;YAAE,QAAQ,EAAE,MAAM,CAAC;YAAC,OAAO,EAAE,MAAM,CAAC;YAAC,UAAU,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAC;IA+BhJ;;OAEG;IACH,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI;IAS/C,OAAO,CAAC,WAAW;IAYnB,OAAO,CAAC,IAAI;CAUf"}
@@ -20,9 +20,12 @@ class HistoryReport {
20
20
  historyDir;
21
21
  historyFile;
22
22
  entries;
23
+ /** v2.8.0: 完整报告存储目录 */
24
+ reportsDir;
23
25
  constructor(projectDir) {
24
26
  this.historyDir = (0, node_path_1.resolve)(projectDir, ".frontend-guardian");
25
27
  this.historyFile = (0, node_path_1.resolve)(this.historyDir, "history.json");
28
+ this.reportsDir = (0, node_path_1.resolve)(this.historyDir, "history");
26
29
  this.entries = this.loadEntries();
27
30
  }
28
31
  /**
@@ -116,6 +119,103 @@ class HistoryReport {
116
119
  this.entries = [];
117
120
  this.save();
118
121
  }
122
+ // ── v2.8.0: 完整报告持久化 ────────────────────────────────────────────
123
+ /**
124
+ * 保存完整扫描报告到 history/ 目录
125
+ * @param result 扫描结果
126
+ * @param allIssues 所有 issues
127
+ * @returns 保存的文件名
128
+ */
129
+ saveFullReport(result, allIssues) {
130
+ const now = new Date();
131
+ const timestamp = now.getTime();
132
+ const timestampIso = now.toISOString();
133
+ const filename = `${now.getFullYear()}${String(now.getMonth() + 1).padStart(2, "0")}${String(now.getDate()).padStart(2, "0")}-${String(now.getHours()).padStart(2, "0")}${String(now.getMinutes()).padStart(2, "0")}${String(now.getSeconds()).padStart(2, "0")}.json`;
134
+ let git = undefined;
135
+ try {
136
+ const { execSync } = require("node:child_process");
137
+ git = {
138
+ commit: execSync("git rev-parse --short HEAD", {
139
+ cwd: this.historyDir.replace("/.frontend-guardian", ""),
140
+ encoding: "utf-8",
141
+ stdio: ["pipe", "pipe", "ignore"],
142
+ }).trim(),
143
+ branch: execSync("git branch --show-current", {
144
+ cwd: this.historyDir.replace("/.frontend-guardian", ""),
145
+ encoding: "utf-8",
146
+ stdio: ["pipe", "pipe", "ignore"],
147
+ }).trim(),
148
+ };
149
+ }
150
+ catch {
151
+ // 非 git 项目
152
+ }
153
+ const report = {
154
+ timestamp,
155
+ timestampIso,
156
+ module: result.module,
157
+ issues: allIssues,
158
+ result,
159
+ git,
160
+ };
161
+ try {
162
+ if (!(0, node_fs_1.existsSync)(this.reportsDir)) {
163
+ (0, node_fs_1.mkdirSync)(this.reportsDir, { recursive: true });
164
+ }
165
+ (0, node_fs_1.writeFileSync)((0, node_path_1.resolve)(this.reportsDir, filename), JSON.stringify(report, null, 2), "utf-8");
166
+ }
167
+ catch {
168
+ // 静默失败
169
+ }
170
+ return filename;
171
+ }
172
+ /**
173
+ * 列出所有完整报告
174
+ */
175
+ listReports() {
176
+ try {
177
+ if (!(0, node_fs_1.existsSync)(this.reportsDir))
178
+ return [];
179
+ const files = (0, node_fs_1.readdirSync)(this.reportsDir)
180
+ .filter((f) => f.endsWith(".json"))
181
+ .sort()
182
+ .reverse();
183
+ return files.map((filename) => {
184
+ try {
185
+ const raw = (0, node_fs_1.readFileSync)((0, node_path_1.resolve)(this.reportsDir, filename), "utf-8");
186
+ const report = JSON.parse(raw);
187
+ return {
188
+ filename,
189
+ timestamp: report.timestamp,
190
+ module: report.module,
191
+ counts: {
192
+ critical: report.result.issues.critical.length,
193
+ warning: report.result.issues.warning.length,
194
+ suggestion: report.result.issues.suggestion.length,
195
+ },
196
+ };
197
+ }
198
+ catch {
199
+ return { filename, timestamp: 0, module: "unknown", counts: { critical: 0, warning: 0, suggestion: 0 } };
200
+ }
201
+ });
202
+ }
203
+ catch {
204
+ return [];
205
+ }
206
+ }
207
+ /**
208
+ * 加载指定完整报告
209
+ */
210
+ loadReport(filename) {
211
+ try {
212
+ const raw = (0, node_fs_1.readFileSync)((0, node_path_1.resolve)(this.reportsDir, filename), "utf-8");
213
+ return JSON.parse(raw);
214
+ }
215
+ catch {
216
+ return null;
217
+ }
218
+ }
119
219
  loadEntries() {
120
220
  try {
121
221
  if ((0, node_fs_1.existsSync)(this.historyFile)) {
@@ -1 +1 @@
1
- {"version":3,"file":"history-report.js","sourceRoot":"","sources":["../../src/utils/history-report.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;AAEH,qCAA6E;AAC7E,yCAAoC;AA0CpC,wCAAwC;AACxC,SAAS,cAAc,CAAC,KAAY;IAChC,OAAO,GAAG,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC;AACzD,CAAC;AAED,MAAa,aAAa;IACd,UAAU,CAAS;IACnB,WAAW,CAAS;IACpB,OAAO,CAAiB;IAEhC,YAAY,UAAkB;QAC1B,IAAI,CAAC,U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AO,CAAC,CAAC;YACtE,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAe,CAAC;QACzC,CAAC;QAAC,MAAM,CAAC;YACL,OAAO,IAAI,CAAC;QAChB,CAAC;IACL,CAAC;IAEO,WAAW;QACf,IAAI,CAAC;YACD,IAAI,IAAA,oBAAU,EAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC;gBAC/B,MAAM,GAAG,GAAG,IAAA,sBAAY,EAAC,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;gBACpD,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAmB,CAAC;YAC7C,CAAC;QACL,CAAC;QAAC,MAAM,CAAC;YACL,UAAU;QACd,CAAC;QACD,OAAO,EAAE,CAAC;IACd,CAAC;IAEO,IAAI;QACR,IAAI,CAAC;YACD,IAAI,CAAC,IAAA,oBAAU,EAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;gBAC/B,IAAA,mBAAS,EAAC,IAAI,CAAC,UAAU,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;YACpD,CAAC;YACD,IAAA,uBAAa,EAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;QACpF,CAAC;QAAC,MAAM,CAAC;YACL,OAAO;QACX,CAAC;IACL,CAAC;CACJ;AA/OD,sCA+OC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "frontend-guardian-core",
3
- "version": "2.7.0",
3
+ "version": "2.8.0",
4
4
  "description": "Core analysis engine for frontend-guardian — AST-based scanning and auto-fixing",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",