@chemx/starter-kit 26.9.11-481 → 26.9.12-107

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 (46) hide show
  1. package/cli/audit/ai-slop-detector.js +262 -0
  2. package/cli/audit/extended-visitors.js +359 -0
  3. package/cli/audit/history.js +19 -2
  4. package/cli/audit/metrics.js +69 -0
  5. package/cli/audit/prompts.js +175 -48
  6. package/cli/audit/reporter-banner.d.ts +3 -0
  7. package/cli/audit/reporter-banner.js +74 -0
  8. package/cli/audit/reporter-grades.js +11 -26
  9. package/cli/audit/reporter-grouping-markdown.js +83 -0
  10. package/cli/audit/reporter-grouping.d.ts +42 -0
  11. package/cli/audit/reporter-grouping.js +243 -0
  12. package/cli/audit/reporter-markdown.js +34 -22
  13. package/cli/audit/reporter-sections.d.ts +10 -0
  14. package/cli/audit/reporter-sections.js +259 -0
  15. package/cli/audit/reporter-summary.d.ts +4 -0
  16. package/cli/audit/reporter-summary.js +142 -0
  17. package/cli/audit/reporter-utils.js +13 -1
  18. package/cli/audit/reporter.d.ts +16 -0
  19. package/cli/audit/reporter.js +47 -420
  20. package/cli/audit/rules-helpers.js +16 -0
  21. package/cli/audit/rules-registry.js +88 -1
  22. package/cli/audit/rules.js +32 -1
  23. package/cli/audit/social-git.js +133 -131
  24. package/cli/audit/social.js +15 -2
  25. package/cli/audit/types.d.ts +28 -27
  26. package/cli/audit.js +56 -3
  27. package/cli/badge.js +262 -0
  28. package/cli/generator-templates.js +264 -0
  29. package/cli/generator.d.ts +10 -0
  30. package/cli/generator.js +151 -0
  31. package/cli/help.js +17 -7
  32. package/cli/index.js +26 -16
  33. package/cli/installer.d.ts +2 -0
  34. package/cli/installer.js +52 -38
  35. package/cli/license.js +17 -4
  36. package/cli/navigator-actions.js +63 -1
  37. package/cli/navigator-banner.js +17 -6
  38. package/cli/navigator-grades.js +9 -0
  39. package/cli/navigator-menu.js +36 -0
  40. package/cli/navigator-share.js +7 -4
  41. package/cli/navigator.d.ts +5 -1
  42. package/cli/navigator.js +49 -12
  43. package/cli/scaffold.js +3 -54
  44. package/cli/terminal.js +4 -1
  45. package/docs/CHANGELOG.md +50 -0
  46. package/package.json +1 -1
@@ -0,0 +1,142 @@
1
+ import {
2
+ CYAN,
3
+ GREEN,
4
+ YELLOW,
5
+ RED,
6
+ ORANGE,
7
+ DIM,
8
+ BOLD,
9
+ RESET,
10
+ groupViolationsBySeverity,
11
+ resolveHotspotBadge
12
+ } from './reporter-utils.js';
13
+ import { renderGroupedViolationsTerminal } from './reporter-grouping.js';
14
+ import { buildMasterPrompt, formatPromptBox } from './prompts.js';
15
+
16
+ const isDegradedPillar = ([_, pillar]) => pillar.status !== 'PASSED';
17
+ const isPassedPillar = ([_, pillar]) => pillar.status === 'PASSED';
18
+ const isExtremeMonolith = (h) => h.lineCount >= 2000;
19
+ const isSevereMonolith = (h) => h.lineCount >= 1000;
20
+
21
+ const formatFailureHotspot = (h, idx) => {
22
+ const monolithBadge = resolveHotspotBadge(h.lineCount);
23
+ return ` [#${idx + 1}] ${YELLOW}${h.filePath}${RESET} (${h.lineCount} lines, ${h.violationCount} hazards)${monolithBadge}`;
24
+ };
25
+
26
+ export const formatFailuresSection = (report) => {
27
+ const { violations, pillars, hotspots } = report;
28
+ const { critical, high, medium, low } = groupViolationsBySeverity(violations);
29
+ const lines = [];
30
+
31
+ lines.push('');
32
+ lines.push(`${RED}======================================================================${RESET}`);
33
+ lines.push(`${BOLD}${RED} FAILED & DEGRADED CHECKS : HAZARDS, DEBTS & HOTSPOTS${RESET}`);
34
+ lines.push(`${DIM} Consolidated breakdown of all failed architectural checks${RESET}`);
35
+ lines.push(`${RED}======================================================================${RESET}`);
36
+
37
+ if (violations.length === 0 && hotspots.length === 0) {
38
+ lines.push(`\n ${GREEN}${BOLD}✔ ZERO FAILURES DETECTED!${RESET}`);
39
+ lines.push(` All ${Object.keys(pillars).length} Chemical X Molecular Architecture Pillars are 100% Compliant.\n`);
40
+ lines.push(`${RED}======================================================================${RESET}\n`);
41
+ return lines.join('\n');
42
+ }
43
+
44
+ lines.push(` Total Hazards Flagged: ${BOLD}${RED}${violations.length}${RESET}`);
45
+ const critDesc = critical.length > 0 ? `${RED}${BOLD}${critical.length} (Immediate Action Required)${RESET}` : `${GREEN}0${RESET}`;
46
+ lines.push(` Critical Hazards: ${critDesc}`);
47
+ const debtsTotal = high.length + medium.length;
48
+ const debtsDesc = debtsTotal > 0 ? `${ORANGE}${BOLD}${debtsTotal}${RESET}` : `${GREEN}0${RESET}`;
49
+ lines.push(` High/Med Debts: ${debtsDesc}`);
50
+ const lowDesc = low.length > 0 ? `${YELLOW}${low.length}${RESET}` : `${GREEN}0${RESET}`;
51
+ lines.push(` Low Hygiene Issues: ${lowDesc}`);
52
+ const hotspotsDesc = hotspots.length > 0 ? `${YELLOW}${hotspots.length}${RESET}` : `${GREEN}0${RESET}`;
53
+ lines.push(` Hotspot Files: ${hotspotsDesc}`);
54
+ lines.push(`${RED}----------------------------------------------------------------------${RESET}`);
55
+
56
+ if (critical.length > 0) {
57
+ lines.push(`\n ${BOLD}${RED}🚨 CRITICAL HAZARDS (${critical.length}) : IMMEDIATE ACTION REQUIRED${RESET}\n`);
58
+ lines.push(renderGroupedViolationsTerminal(critical));
59
+ }
60
+
61
+ if (debtsTotal > 0) {
62
+ lines.push(` ${BOLD}${ORANGE}⚠️ HIGH & MEDIUM HAZARDS (${debtsTotal}) : ARCHITECTURE DEBTS${RESET}\n`);
63
+ lines.push(renderGroupedViolationsTerminal([...high, ...medium]));
64
+ }
65
+
66
+ if (low.length > 0) {
67
+ lines.push(` ${BOLD}${YELLOW}🧹 LOW & HYGIENE ISSUES (${low.length})${RESET}\n`);
68
+ lines.push(renderGroupedViolationsTerminal(low));
69
+ }
70
+
71
+ const failedPillars = Object.entries(pillars).filter(isDegradedPillar);
72
+ if (failedPillars.length > 0) {
73
+ lines.push(` ${BOLD}${RED}🏛️ FAILED / DEGRADED PILLARS (${failedPillars.length})${RESET}`);
74
+ for (const [name, p] of failedPillars) {
75
+ lines.push(` ✕ ${YELLOW}${name}${RESET}: ${p.violations} violations (${p.critical} Critical, ${p.high} High, ${p.medium} Med)`);
76
+ }
77
+ lines.push('');
78
+ }
79
+
80
+ if (hotspots.length > 0) {
81
+ lines.push(` ${BOLD}${YELLOW}🔥 REFACTORING HOTSPOTS (${hotspots.length})${RESET}`);
82
+ for (let idx = 0; idx < hotspots.length; idx++) {
83
+ lines.push(formatFailureHotspot(hotspots[idx], idx));
84
+ }
85
+ lines.push('');
86
+ }
87
+
88
+ const prompt = buildMasterPrompt(report);
89
+ if (prompt) {
90
+ lines.push(formatPromptBox('🤖 AI AGENT REFACTORING PROMPT (ALL FAILED CHECKS)', prompt));
91
+ }
92
+
93
+ lines.push(`${RED}======================================================================${RESET}\n`);
94
+ return lines.join('\n');
95
+ };
96
+
97
+ export const formatPassesSection = (report) => {
98
+ const { metrics, health, pillars, hotspots, contextAnalysis } = report;
99
+ const passedPillars = Object.entries(pillars).filter(isPassedPillar);
100
+ const lines = [];
101
+
102
+ lines.push('');
103
+ lines.push(`${GREEN}======================================================================${RESET}`);
104
+ lines.push(`${BOLD}${GREEN} PASSED & COMPLIANT CHECKS : CLEAN ARCHITECTURE STANDARDS${RESET}`);
105
+ lines.push(`${DIM} Consolidated breakdown of verified compliant areas${RESET}`);
106
+ lines.push(`${GREEN}======================================================================${RESET}`);
107
+
108
+ lines.push(` Molecular Health Score: ${BOLD}${GREEN}${health.score}/100${RESET} [Grade: ${BOLD}${GREEN}${health.grade}${RESET}]`);
109
+ lines.push(` Passing Pillars: ${BOLD}${GREEN}${passedPillars.length} / ${Object.keys(pillars).length} Pillars PASSED${RESET}`);
110
+ lines.push(` Capsule Compliance: ${BOLD}${GREEN}${metrics.moleculeCompliantPct}%${RESET} molecules compliant (< 100 lines of code)`);
111
+ lines.push(` Total Files Scanned: ${metrics.scannedFiles} source files (${metrics.totalLoc} total lines of code)`);
112
+ lines.push(`${GREEN}----------------------------------------------------------------------${RESET}`);
113
+
114
+ lines.push(`\n ${BOLD}${GREEN}✔ COMPLIANT ARCHITECTURAL PILLARS:${RESET}`);
115
+ if (passedPillars.length === 0) {
116
+ lines.push(` ${YELLOW}No pillars are completely hazard-free.${RESET}\n`);
117
+ } else {
118
+ for (const [name] of passedPillars) {
119
+ lines.push(` ${GREEN}✔${RESET} ${name} ${DIM}(0 violations)${RESET}`);
120
+ }
121
+ lines.push('');
122
+ }
123
+
124
+ lines.push(` ${BOLD}${CYAN}STANDARDS MET & CLEAN AREAS:${RESET}`);
125
+ if (metrics.moleculeCompliantPct === 100) {
126
+ lines.push(` ${GREEN}✔${RESET} 100% Molecule Capsule Limit (< 100 lines per molecule)`);
127
+ }
128
+ const hasExtremeMonolith = hotspots.some(isExtremeMonolith);
129
+ if (!hasExtremeMonolith) {
130
+ lines.push(` ${GREEN}✔${RESET} Zero Extreme Monoliths (0 files >= 2,000 lines of code)`);
131
+ }
132
+ const hasSevereMonolith = hotspots.some(isSevereMonolith);
133
+ if (!hasSevereMonolith) {
134
+ lines.push(` ${GREEN}✔${RESET} Zero Severe Monoliths (0 files >= 1,000 lines of code)`);
135
+ }
136
+ if (contextAnalysis.riskLevel === 'LOW') {
137
+ lines.push(` ${GREEN}✔${RESET} Low Context Hazard & Token Burn Risk`);
138
+ }
139
+
140
+ lines.push(`\n${GREEN}======================================================================${RESET}\n`);
141
+ return lines.join('\n');
142
+ };
@@ -70,6 +70,14 @@ export const resolveRiskColor = (riskLevel) => {
70
70
  return GREEN;
71
71
  };
72
72
 
73
+ export const resolveTopSectionColor = (report) => {
74
+ const hasNoViolations = (report?.violations?.length ?? 0) === 0;
75
+ const hasNoHotspots = (report?.hotspots?.length ?? 0) === 0;
76
+ const areAllPillarsPassed = Object.values(report?.pillars ?? {}).every((p) => p.status === 'PASSED');
77
+ const isAllPassed = hasNoViolations && hasNoHotspots && areAllPillarsPassed;
78
+ return isAllPassed ? GREEN : CYAN;
79
+ };
80
+
73
81
  export const resolveHotspotBadge = (lineCount) => {
74
82
  if (lineCount >= 2000) return ` ${RED}[CRITICAL MONOLITH >= 2,000 lines of code]${RESET}`;
75
83
  if (lineCount >= 1000) return ` ${ORANGE}[SEVERE MONOLITH >= 1,000 lines of code]${RESET}`;
@@ -102,7 +110,11 @@ export const PILLAR_EMOJIS = {
102
110
  'Type Architecture & Data Integrity': '🛡️',
103
111
  'Design System & Styling Hygiene': '🎨',
104
112
  'Timers & Macro-Task Discipline': '⏱️',
105
- 'Global Hygiene & Typography': '🧹'
113
+ 'Global Hygiene & Typography': '🧹',
114
+ 'Accessibility & Semantic Integrity': '♿',
115
+ 'Security & Content Safety': '🔒',
116
+ 'Testing Discipline': '🧪',
117
+ 'Naming Conventions': '🏷️'
106
118
  };
107
119
 
108
120
  export const NUMBER_EMOJIS = ['1️⃣', '2️⃣', '3️⃣', '4️⃣', '5️⃣', '6️⃣', '7️⃣', '8️⃣', '9️⃣', '🔟'];
@@ -0,0 +1,16 @@
1
+ import type { AuditReport } from './types';
2
+
3
+ export * from './reporter-ascii';
4
+ export * from './reporter-banner';
5
+ export * from './reporter-sections';
6
+ export * from './reporter-summary';
7
+ export * from './reporter-grouping';
8
+
9
+ export declare function formatTerminalReport(report: AuditReport): string;
10
+ export declare function generateMarkdownReport(report: AuditReport): string;
11
+ export declare function resolveTopSectionColor(report: AuditReport): string;
12
+ export declare function formatGradeFSection(report: AuditReport): string;
13
+ export declare function formatGradeDSection(report: AuditReport): string;
14
+ export declare function formatGradeCSection(report: AuditReport): string;
15
+ export declare function formatGradeBSection(report: AuditReport): string;
16
+ export declare function formatGradeASection(report: AuditReport): string;