@chemx/starter-kit 26.9.9-786 → 26.9.11-481

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 (45) hide show
  1. package/cli/audit/ast-visitors.js +243 -0
  2. package/cli/audit/discussion-store.js +39 -0
  3. package/cli/audit/history.d.ts +69 -0
  4. package/cli/audit/history.js +397 -0
  5. package/cli/audit/metrics.js +179 -0
  6. package/cli/audit/prompts.js +174 -0
  7. package/cli/audit/reporter-ascii.d.ts +4 -0
  8. package/cli/audit/reporter-ascii.js +99 -0
  9. package/cli/audit/reporter-grades.js +275 -0
  10. package/cli/audit/reporter-markdown.js +137 -0
  11. package/cli/audit/reporter-utils.js +125 -0
  12. package/cli/audit/reporter.js +497 -0
  13. package/cli/audit/rules-helpers.js +109 -0
  14. package/cli/audit/rules-registry.js +97 -0
  15. package/cli/audit/rules.js +123 -0
  16. package/cli/audit/social-constants.js +4 -0
  17. package/cli/audit/social-gh.js +126 -0
  18. package/cli/audit/social-git.js +214 -0
  19. package/cli/audit/social-http.js +222 -0
  20. package/cli/audit/social-publisher.js +193 -0
  21. package/cli/audit/social.d.ts +69 -0
  22. package/cli/audit/social.js +303 -0
  23. package/cli/audit/types.d.ts +140 -0
  24. package/cli/audit.d.ts +3 -24
  25. package/cli/audit.js +207 -210
  26. package/cli/help.d.ts +1 -0
  27. package/cli/help.js +136 -0
  28. package/cli/index.js +128 -566
  29. package/cli/installer-templates.js +91 -0
  30. package/cli/installer.d.ts +21 -0
  31. package/cli/installer.js +104 -0
  32. package/cli/license.js +320 -0
  33. package/cli/navigator-actions.js +274 -0
  34. package/cli/navigator-banner.js +98 -0
  35. package/cli/navigator-conversion.js +100 -0
  36. package/cli/navigator-grades.js +87 -0
  37. package/cli/navigator-menu.js +127 -0
  38. package/cli/navigator-paged.js +86 -0
  39. package/cli/navigator-share.js +129 -0
  40. package/cli/navigator.d.ts +43 -0
  41. package/cli/navigator.js +126 -0
  42. package/cli/scaffold.js +148 -0
  43. package/cli/terminal.js +126 -0
  44. package/docs/CHANGELOG.md +101 -0
  45. package/package.json +11 -10
@@ -0,0 +1,303 @@
1
+ import { groupViolationsBySeverity } from './reporter.js';
2
+ import { PILLAR_EMOJIS } from './reporter-utils.js';
3
+
4
+ export {
5
+ parseGitRemoteUrl,
6
+ detectGitRepoInfo,
7
+ detectGitHubUser,
8
+ copyToClipboard
9
+ } from './social-git.js';
10
+
11
+ export {
12
+ publishDiscussionViaHttp,
13
+ publishDiscussionViaGh,
14
+ publishDiscussion,
15
+ publishOrUpdateDiscussion,
16
+ viewDiscussionViaGh,
17
+ viewDiscussionViaHttp,
18
+ postDiscussionCommentViaGh,
19
+ postDiscussionCommentViaHttp,
20
+ editDiscussionViaGh,
21
+ editDiscussionViaHttp,
22
+ findExistingDiscussionViaGh,
23
+ formatArchiveComment,
24
+ getStoredDiscussion,
25
+ saveStoredDiscussion,
26
+ clearStoredDiscussion
27
+ } from './social-publisher.js';
28
+
29
+ export const DISCUSSION_CATEGORY = 'npx chemx audit';
30
+ export const DISCUSSION_CATEGORY_SLUG = 'npx-chemx-audit';
31
+ export const ORG_DISCUSSIONS_URL = 'https://github.com/orgs/Chemical-X-Protocol/discussions';
32
+ export const DEFAULT_DISCUSSION_REPO = 'Chemical-X-Protocol/.github';
33
+
34
+ export const resolveBadgeColor = (score) => {
35
+ if (score >= 90) return '06b6d4';
36
+ if (score >= 70) return 'f59e0b';
37
+ return 'ef4444';
38
+ };
39
+
40
+ export const resolveHotspotTierText = (lineCount) => {
41
+ if (lineCount >= 2000) return '🔴 **CRITICAL (>= 2,000 lines of code)**';
42
+ if (lineCount >= 1000) return '🟠 **SEVERE (>= 1,000 lines of code)**';
43
+ if (lineCount > 500) return '🟡 **WARNING (> 500 lines of code)**';
44
+ return '🟢 Compliant';
45
+ };
46
+
47
+ export const resolvePillarProgressionBadge = (isImproved, beforeStatus, afterStatus) => {
48
+ if (isImproved) return '🟢 **RESOLVED**';
49
+ if (beforeStatus === afterStatus) return '⚪ **UNCHANGED**';
50
+ return '🔴 **DEGRADED**';
51
+ };
52
+
53
+ const isExtremeMonolith = (h) => h.lineCount >= 2000;
54
+ const isSevereMonolith = (h) => h.lineCount >= 1000 && h.lineCount < 2000;
55
+ const isWarningMonolith = (h) => h.lineCount >= 500 && h.lineCount < 1000;
56
+
57
+ export const formatWebUrl = (url) => {
58
+ if (!url || typeof url !== 'string') return '';
59
+ const trimmed = url.trim();
60
+ if (!trimmed) return '';
61
+ const href = /^https?:\/\//i.test(trimmed) ? trimmed : `https://${trimmed}`;
62
+ return `[${href}](${href})`;
63
+ };
64
+
65
+ export const resolveExcessCostPerPass = (tokensObj, fallbackCostPerMillion = 3.0) => {
66
+ if (tokensObj?.excessCostPerPass !== undefined) return tokensObj.excessCostPerPass;
67
+ const costPerMillion = tokensObj?.costPerMillion || fallbackCostPerMillion;
68
+ const excess = tokensObj?.estimatedExcessTokens || 0;
69
+ return Number(((excess / 1000000) * costPerMillion).toFixed(3));
70
+ };
71
+
72
+ export const resolveMonthlyWastePerDev = (tokensObj, fallbackCostPerMillion = 3.0) => {
73
+ if (tokensObj?.monthlyWastePerDev !== undefined) return tokensObj.monthlyWastePerDev;
74
+ const pass = resolveExcessCostPerPass(tokensObj, fallbackCostPerMillion);
75
+ return Number((pass * 20 * 5 * 4).toFixed(2));
76
+ };
77
+
78
+ export const resolveWeeklyWastePerDev = (tokensObj, fallbackCostPerMillion = 3.0) => {
79
+ if (tokensObj?.weeklyWastePerDev !== undefined) return tokensObj.weeklyWastePerDev;
80
+ const pass = resolveExcessCostPerPass(tokensObj, fallbackCostPerMillion);
81
+ return Number((pass * 20 * 5).toFixed(2));
82
+ };
83
+
84
+ export const generateDiscussionContent = (report, username, projectName = 'Codebase', repoUrl = '', liveUrl = '') => {
85
+ const { health, metrics, pillars, hotspots, contextAnalysis, violations } = report;
86
+ const isHighScoring = health.score >= 80;
87
+ const badgeColor = resolveBadgeColor(health.score);
88
+ const encodedGrade = encodeURIComponent(`${health.score}/100 (${health.grade})`);
89
+
90
+ const category = DISCUSSION_CATEGORY;
91
+ const categorySlug = DISCUSSION_CATEGORY_SLUG;
92
+ const prefix = isHighScoring ? '[Showcase]' : '[Teardown]';
93
+ const title = `${prefix} ${projectName} : MHI ${health.score}/100 [Grade: ${health.grade}]`;
94
+
95
+ const lines = [];
96
+ lines.push(`# ${isHighScoring ? 'Crystalline' : 'Architecture'} Audit Report: ${projectName}`);
97
+ lines.push('');
98
+ lines.push(`[![Chemical X MHI](https://img.shields.io/badge/Chemical%20X%20MHI-${encodedGrade}-${badgeColor}?style=for-the-badge)](https://chemicalx.xophz.com)`);
99
+ lines.push('');
100
+ lines.push(`* **Audited by**: @${username}`);
101
+ const resolvedRepoUrl = repoUrl || (/^[\w\-.]+\/[\w\-.]+$/.test(projectName) ? `https://github.com/${projectName}` : '');
102
+ if (resolvedRepoUrl) {
103
+ lines.push(`* **Repository**: [${resolvedRepoUrl}](${resolvedRepoUrl})`);
104
+ }
105
+ if (liveUrl) {
106
+ const formattedWeb = formatWebUrl(liveUrl);
107
+ if (formattedWeb) {
108
+ lines.push(`* **Website**: ${formattedWeb}`);
109
+ }
110
+ }
111
+ lines.push(`* **Molecular Health Index**: **${health.score} / 100** (Grade: **${health.grade}** - ${health.label})`);
112
+ lines.push(`* **Source Files Analyzed**: ${metrics.scannedFiles} files (${metrics.totalLoc} total lines of code)`);
113
+ lines.push(`* **Token Reduction Potential**: **${contextAnalysis.potentialSavingsPct}%** (Estimated ${contextAnalysis.estimatedTokens.toLocaleString()} tokens)`);
114
+ const costPass = resolveExcessCostPerPass(contextAnalysis);
115
+ const costMonth = resolveMonthlyWastePerDev(contextAnalysis);
116
+ const costWeek = resolveWeeklyWastePerDev(contextAnalysis);
117
+ const pricingModel = contextAnalysis?.pricingModel || 'Frontier Blended ($3.00/1M)';
118
+ lines.push(`* **Monolith Cost per Turn**: **$${costPass.toFixed(3)}** (${pricingModel})`);
119
+ lines.push(`* **Projected Dev Context Tax**: **$${costMonth.toFixed(2)} / mo** per engineer ($${costWeek.toFixed(2)} / wk)`);
120
+ lines.push('');
121
+ lines.push('---');
122
+ lines.push('');
123
+ lines.push('## 1. 7-Pillar Architectural Matrix');
124
+ lines.push('');
125
+ lines.push('| Pillar | Status | Hazards |');
126
+ lines.push('| :--- | :---: | :---: |');
127
+
128
+ const resolveStatusDisplay = (status) => {
129
+ if (status === 'PASSED') return '🟢 **PASSED**';
130
+ if (status === 'WARN') return '🟡 **WARN**';
131
+ return '🔴 **FAILED**';
132
+ };
133
+
134
+ const resolveHazardsDisplay = (count, status) => {
135
+ if (count === 0) return '🟢 0';
136
+ if (status === 'FAILED') return `🔴 **${count}**`;
137
+ return `🟡 **${count}**`;
138
+ };
139
+
140
+ for (const [pillarName, data] of Object.entries(pillars)) {
141
+ const icon = PILLAR_EMOJIS[pillarName] || '🏛️';
142
+ const statusText = resolveStatusDisplay(data.status);
143
+ const hazardsText = resolveHazardsDisplay(data.violations, data.status);
144
+ lines.push(`| ${icon} ${pillarName} | ${statusText} | ${hazardsText} |`);
145
+ }
146
+ lines.push('');
147
+
148
+ const { critical, high, medium, low } = groupViolationsBySeverity(violations);
149
+ const extremeMonoliths = hotspots.filter(isExtremeMonolith).length;
150
+ const severeMonoliths = hotspots.filter(isSevereMonolith).length;
151
+ const warningMonoliths = hotspots.filter(isWarningMonolith).length;
152
+ const totalMonoliths = extremeMonoliths + severeMonoliths + warningMonoliths;
153
+
154
+ lines.push('---');
155
+ lines.push('');
156
+ lines.push('## 2. Monolith & Architectural Hazard Summary');
157
+ lines.push('');
158
+ lines.push(`* **Monolith Files (> 500 lines of code)**: **${totalMonoliths} files**`);
159
+ if (totalMonoliths > 0) {
160
+ lines.push(` * Warning Tier (500 - 999 lines of code): ${warningMonoliths} files`);
161
+ lines.push(` * Severe Tier (1,000 - 1,999 lines of code): ${severeMonoliths} files`);
162
+ lines.push(` * Extreme Monoliths (2,000+ lines of code): ${extremeMonoliths} files`);
163
+ }
164
+ lines.push(`* **Hazard Breakdown**: Critical: **${critical.length}** | High/Med: **${high.length + medium.length}** | Low: **${low.length}**`);
165
+ lines.push('');
166
+
167
+ lines.push('---');
168
+ lines.push('');
169
+ if (isHighScoring) {
170
+ lines.push('### Community Takeaway');
171
+ lines.push('This project follows Chemical X Molecular Architecture principles with isolated capsules and self-cleaning hooks.');
172
+ } else {
173
+ lines.push('### Seeking Refactoring Feedback');
174
+ lines.push('Looking for recommendations on breaking down flagged monolithic debts into crystalline molecule capsules (< 100 lines of code). Any advice is welcome!');
175
+ }
176
+ lines.push('');
177
+ lines.push('*Audited using [Chemical X Protocol Starter Kit](https://github.com/Chemical-X-Protocol/awesome-secret-sauce).*');
178
+
179
+ return {
180
+ title,
181
+ category,
182
+ categorySlug,
183
+ body: lines.join('\n')
184
+ };
185
+ };
186
+
187
+ export const generateTransformationDiscussionContent = (
188
+ beforeSnapshot,
189
+ afterSnapshot,
190
+ username,
191
+ projectName = 'Codebase',
192
+ repoUrl = '',
193
+ liveUrl = ''
194
+ ) => {
195
+ const scoreBefore = beforeSnapshot.health.score;
196
+ const scoreAfter = afterSnapshot.health.score;
197
+ const scoreDelta = scoreAfter - scoreBefore;
198
+
199
+ const critDelta = afterSnapshot.violations.critical - beforeSnapshot.violations.critical;
200
+ const totalDelta = afterSnapshot.violations.total - beforeSnapshot.violations.total;
201
+ const monoDelta = afterSnapshot.monoliths.total - beforeSnapshot.monoliths.total;
202
+ const tokensDelta = afterSnapshot.tokens.estimatedExcessTokens - beforeSnapshot.tokens.estimatedExcessTokens;
203
+
204
+ const category = DISCUSSION_CATEGORY;
205
+ const categorySlug = DISCUSSION_CATEGORY_SLUG;
206
+ const title = `[Transformation] ${projectName} : ${beforeSnapshot.health.grade} (${scoreBefore}) -> ${afterSnapshot.health.grade} (${scoreAfter})`;
207
+
208
+ const formatDelta = (val, invertGood = false) => {
209
+ if (val === 0) return '0 (No change)';
210
+ const isGood = invertGood ? val < 0 : val > 0;
211
+ const sign = val > 0 ? `+${val}` : `${val}`;
212
+ return isGood ? `🟢 **${sign}**` : `🔴 **${sign}**`;
213
+ };
214
+
215
+ const costPassBefore = resolveExcessCostPerPass(beforeSnapshot.tokens);
216
+ const costPassAfter = resolveExcessCostPerPass(afterSnapshot.tokens);
217
+ const costPassDelta = Number((costPassAfter - costPassBefore).toFixed(3));
218
+
219
+ const monthlyTaxBefore = resolveMonthlyWastePerDev(beforeSnapshot.tokens);
220
+ const monthlyTaxAfter = resolveMonthlyWastePerDev(afterSnapshot.tokens);
221
+ const monthlyTaxDelta = Number((monthlyTaxAfter - monthlyTaxBefore).toFixed(2));
222
+
223
+ const formatCostPassDelta = (val) => {
224
+ if (val === 0) return '0 (No change)';
225
+ const isGood = val < 0;
226
+ const sign = val > 0 ? `+$${val.toFixed(3)}` : `-$${Math.abs(val).toFixed(3)}`;
227
+ return isGood ? `🟢 **${sign}**` : `🔴 **${sign}**`;
228
+ };
229
+
230
+ const formatMonthlyTaxDelta = (val) => {
231
+ if (val === 0) return '0 (No change)';
232
+ const isGood = val < 0;
233
+ const sign = val > 0 ? `+$${val.toFixed(2)}/mo` : `-$${Math.abs(val).toFixed(2)}/mo`;
234
+ return isGood ? `🟢 **${sign}**` : `🔴 **${sign}**`;
235
+ };
236
+
237
+ const lines = [];
238
+ lines.push(`# 🚀 Architectural Transformation: ${projectName}`);
239
+ lines.push('');
240
+ lines.push(`[![Chemical X Transformation](https://img.shields.io/badge/Chemical%20X-Transformation%20Showcase-62c9ff?style=for-the-badge)](https://chemicalx.xophz.com)`);
241
+ lines.push('');
242
+ lines.push(`* **Audited by**: @${username}`);
243
+ const resolvedRepoUrl = repoUrl || (/^[\w\-.]+\/[\w\-.]+$/.test(projectName) ? `https://github.com/${projectName}` : '');
244
+ if (resolvedRepoUrl) {
245
+ lines.push(`* **Repository**: [${resolvedRepoUrl}](${resolvedRepoUrl})`);
246
+ }
247
+ if (liveUrl) {
248
+ const formattedWeb = formatWebUrl(liveUrl);
249
+ if (formattedWeb) {
250
+ lines.push(`* **Website**: ${formattedWeb}`);
251
+ }
252
+ }
253
+ lines.push(`* **Transformation Summary**: Upgraded codebase from **Grade ${beforeSnapshot.health.grade} (${scoreBefore}/100)** to **Grade ${afterSnapshot.health.grade} (${scoreAfter}/100)**.`);
254
+ lines.push('');
255
+ lines.push('---');
256
+ lines.push('');
257
+ lines.push('## 1. Before vs. After Metric Comparison');
258
+ lines.push('');
259
+ lines.push('| Metric | Before (Baseline) | After (Refactored) | Delta |');
260
+ lines.push('| :--- | :---: | :---: | :---: |');
261
+ lines.push(`| **Molecular Health (MHI)** | ${scoreBefore} / 100 (${beforeSnapshot.health.grade}) | ${scoreAfter} / 100 (${afterSnapshot.health.grade}) | ${formatDelta(scoreDelta)} |`);
262
+ lines.push(`| **Critical Hazards** | ${beforeSnapshot.violations.critical} | ${afterSnapshot.violations.critical} | ${formatDelta(critDelta, true)} |`);
263
+ lines.push(`| **Total Violations** | ${beforeSnapshot.violations.total} | ${afterSnapshot.violations.total} | ${formatDelta(totalDelta, true)} |`);
264
+ lines.push(`| **Monolith Files (> 500 lines of code)** | ${beforeSnapshot.monoliths.total} | ${afterSnapshot.monoliths.total} | ${formatDelta(monoDelta, true)} |`);
265
+ lines.push(`| **Excess Token Burn** | ${beforeSnapshot.tokens.estimatedExcessTokens.toLocaleString()} tok | ${afterSnapshot.tokens.estimatedExcessTokens.toLocaleString()} tok | ${formatDelta(tokensDelta, true)} |`);
266
+ lines.push(`| **Monolith Cost per Turn** | $${costPassBefore.toFixed(3)} | $${costPassAfter.toFixed(3)} | ${formatCostPassDelta(costPassDelta)} |`);
267
+ lines.push(`| **Dev Context Tax (Monthly)** | $${monthlyTaxBefore.toFixed(2)}/mo | $${monthlyTaxAfter.toFixed(2)}/mo | ${formatMonthlyTaxDelta(monthlyTaxDelta)} |`);
268
+ lines.push('');
269
+ lines.push('---');
270
+ lines.push('');
271
+ lines.push('## 2. 7-Pillar Progression');
272
+ lines.push('');
273
+ lines.push('| Pillar | Before Status | After Status | Progression |');
274
+ lines.push('| :--- | :---: | :---: | :---: |');
275
+
276
+ const allPillars = new Set([
277
+ ...Object.keys(beforeSnapshot.pillars || {}),
278
+ ...Object.keys(afterSnapshot.pillars || {})
279
+ ]);
280
+
281
+ for (const pillar of allPillars) {
282
+ const b = beforeSnapshot.pillars?.[pillar] || { status: 'UNKNOWN', violations: 0 };
283
+ const a = afterSnapshot.pillars?.[pillar] || { status: 'UNKNOWN', violations: 0 };
284
+ const icon = PILLAR_EMOJIS[pillar] || '🏛️';
285
+ const isImproved = a.violations < b.violations || (b.status !== 'PASSED' && a.status === 'PASSED');
286
+ const badge = resolvePillarProgressionBadge(isImproved, b.status, a.status);
287
+ lines.push(`| ${icon} ${pillar} | ${b.status} | ${a.status} | ${badge} |`);
288
+ }
289
+ lines.push('');
290
+ lines.push('---');
291
+ lines.push('');
292
+ lines.push('### Community Takeaway');
293
+ lines.push('Refactored using Chemical X Molecular Architecture standards. Monoliths decomposed into crystalline domain capsules (< 100 lines of code) with self-cleaning hooks.');
294
+ lines.push('');
295
+ lines.push('*Transformation tracked via [Chemical X Protocol Starter Kit](https://github.com/Chemical-X-Protocol/awesome-secret-sauce).*');
296
+
297
+ return {
298
+ title,
299
+ category,
300
+ categorySlug,
301
+ body: lines.join('\n')
302
+ };
303
+ };
@@ -0,0 +1,140 @@
1
+ export type SeverityLevel = 'CRITICAL' | 'HIGH' | 'MEDIUM' | 'LOW';
2
+ export type PillarStatus = 'PASSED' | 'WARN' | 'FAILED';
3
+ export type RiskLevel = 'LOW' | 'MODERATE' | 'HIGH';
4
+
5
+ export interface HazardViolation {
6
+ readonly filePath: string;
7
+ readonly line: number;
8
+ readonly column: number;
9
+ readonly hazard: string;
10
+ readonly rule: string;
11
+ readonly severity: SeverityLevel;
12
+ readonly pillar: string;
13
+ readonly directive: string;
14
+ }
15
+
16
+ export interface FileStat {
17
+ readonly fullPath: string;
18
+ readonly relativePath: string;
19
+ readonly lineCount: number;
20
+ readonly charCount: number;
21
+ readonly isMolecule: boolean;
22
+ }
23
+
24
+ export interface CodebaseMetrics {
25
+ readonly scannedFiles: number;
26
+ readonly totalLoc: number;
27
+ readonly avgLoc: number;
28
+ readonly largestFile: {
29
+ readonly filePath: string;
30
+ readonly lineCount: number;
31
+ };
32
+ readonly moleculeCount: number;
33
+ readonly moleculeCompliantCount: number;
34
+ readonly moleculeCompliantPct: number;
35
+ readonly hookCount: number;
36
+ }
37
+
38
+ export interface MolecularHealthScore {
39
+ readonly score: number;
40
+ readonly grade: string;
41
+ readonly label: string;
42
+ }
43
+
44
+ export type QuantumHealthScore = MolecularHealthScore;
45
+
46
+ export interface PillarData {
47
+ readonly pillarKey: string;
48
+ violations: number;
49
+ critical: number;
50
+ high: number;
51
+ medium: number;
52
+ low: number;
53
+ status: PillarStatus;
54
+ }
55
+
56
+ export interface ContextTokenAnalysis {
57
+ readonly estimatedTokens: number;
58
+ readonly estimatedExcessTokens: number;
59
+ readonly potentialSavingsPct: number;
60
+ readonly riskLevel: RiskLevel;
61
+ readonly pricingModel?: string;
62
+ readonly costPerMillion?: number;
63
+ readonly excessCostPerPass?: number;
64
+ readonly weeklyWastePerDev?: number;
65
+ readonly monthlyWastePerDev?: number;
66
+ }
67
+
68
+ export interface HotspotFile {
69
+ readonly filePath: string;
70
+ readonly violationCount: number;
71
+ readonly lineCount: number;
72
+ readonly isMonolith: boolean;
73
+ readonly monolithTier?: 'CRITICAL' | 'SEVERE' | 'WARNING' | null;
74
+ }
75
+
76
+ export interface AuditReport {
77
+ readonly scannedFiles: number;
78
+ readonly totalViolations: number;
79
+ readonly metrics: CodebaseMetrics;
80
+ readonly health: MolecularHealthScore;
81
+ readonly pillars: Record<string, PillarData>;
82
+ readonly contextAnalysis: ContextTokenAnalysis;
83
+ readonly hotspots: readonly HotspotFile[];
84
+ readonly violations: readonly HazardViolation[];
85
+ }
86
+
87
+ export interface AuditOptions {
88
+ readonly dir?: string;
89
+ readonly json?: boolean;
90
+ readonly markdown?: boolean;
91
+ readonly outputFile?: string;
92
+ readonly strict?: boolean;
93
+ }
94
+
95
+ export interface SeverityGroupedViolations {
96
+ readonly critical: readonly HazardViolation[];
97
+ readonly high: readonly HazardViolation[];
98
+ readonly medium: readonly HazardViolation[];
99
+ readonly low: readonly HazardViolation[];
100
+ }
101
+
102
+ export declare function groupViolationsBySeverity(violations: readonly HazardViolation[]): SeverityGroupedViolations;
103
+ export declare function auditCode(content: string, filePath: string, relativePath: string): HazardViolation[];
104
+ export declare function auditFile(filePath: string, relativePath: string): HazardViolation[];
105
+ export declare function scanDirectory(targetDir: string, baseDir: string): HazardViolation[];
106
+ export declare function runAudit(targetDir?: string, options?: AuditOptions): AuditReport;
107
+ export declare function formatTerminalReport(report: AuditReport): string;
108
+ export declare function generateMarkdownReport(report: AuditReport): string;
109
+ export declare function resolveTopSectionColor(report: AuditReport): string;
110
+ export declare function formatScorecardSection(report: AuditReport, themeColor?: string | null): string;
111
+ export declare function formatCriticalSection(report: AuditReport): string;
112
+ export declare function formatHighMediumSection(report: AuditReport): string;
113
+ export declare function formatLowSection(report: AuditReport): string;
114
+ export declare function formatPillarsSection(report: AuditReport, themeColor?: string | null): string;
115
+ export declare function formatHotspotsSection(report: AuditReport, themeColor?: string | null): string;
116
+ export declare function formatContextAnalysisSection(report: AuditReport, themeColor?: string | null): string;
117
+ export declare function formatFailuresSection(report: AuditReport): string;
118
+ export declare function formatPassesSection(report: AuditReport): string;
119
+ export declare function formatGradeFSection(report: AuditReport): string;
120
+ export declare function formatGradeDSection(report: AuditReport): string;
121
+ export declare function formatGradeCSection(report: AuditReport): string;
122
+ export declare function formatGradeBSection(report: AuditReport): string;
123
+ export declare function formatGradeASection(report: AuditReport): string;
124
+ export declare function getChemicalXAsciiBanner(gradeOrReport?: string | AuditReport | null): string;
125
+ export declare function getAsciiGradeLines(grade?: string, color?: string, withEquals?: boolean): readonly string[];
126
+ export declare function formatAsciiGrade(grade?: string, color?: string, indent?: string, withEquals?: boolean): string;
127
+ export declare const REPORT_CARD_ASCII: readonly string[];
128
+ export declare function getReportCardAsciiLines(color?: string): readonly string[];
129
+
130
+ export * from './social';
131
+
132
+ export declare function buildGradeFPrompt(report: AuditReport): string;
133
+ export declare function buildGradeDPrompt(report: AuditReport): string;
134
+ export declare function buildGradeCPrompt(report: AuditReport): string;
135
+ export declare function buildGradeBPrompt(report: AuditReport): string;
136
+ export declare function buildMasterPrompt(report: AuditReport): string;
137
+ export declare function formatPromptBox(title: string, promptText: string): string;
138
+
139
+ export * from './history';
140
+
package/cli/audit.d.ts CHANGED
@@ -1,25 +1,4 @@
1
- export interface HazardViolation {
2
- filePath: string;
3
- line: number;
4
- hazard: string;
5
- rule: string;
6
- directive: string;
7
- }
1
+ export * from './audit/types';
2
+ import defaultAudit from './audit/types';
8
3
 
9
- export interface AuditReport {
10
- scannedFiles: number;
11
- totalViolations: number;
12
- violations: HazardViolation[];
13
- }
14
-
15
- export declare function auditFile(filePath: string, relativePath: string): HazardViolation[];
16
- export declare function scanDirectory(targetDir: string, baseDir: string): HazardViolation[];
17
- export declare function runAudit(targetDir?: string): AuditReport;
18
-
19
- declare const _default: {
20
- auditFile: typeof auditFile;
21
- scanDirectory: typeof scanDirectory;
22
- runAudit: typeof runAudit;
23
- };
24
-
25
- export default _default;
4
+ export default defaultAudit;