faf-cli 2.3.4 → 2.4.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/README.md +17 -4
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +128 -5
- package/dist/cli.js.map +1 -1
- package/dist/commands/about.d.ts +10 -0
- package/dist/commands/about.d.ts.map +1 -0
- package/dist/commands/about.js +249 -0
- package/dist/commands/about.js.map +1 -0
- package/dist/commands/art.d.ts +10 -0
- package/dist/commands/art.d.ts.map +1 -0
- package/dist/commands/art.js +129 -0
- package/dist/commands/art.js.map +1 -0
- package/dist/commands/chat.d.ts +1 -0
- package/dist/commands/chat.d.ts.map +1 -1
- package/dist/commands/chat.js +177 -6
- package/dist/commands/chat.js.map +1 -1
- package/dist/commands/license-config.d.ts +10 -0
- package/dist/commands/license-config.d.ts.map +1 -0
- package/dist/commands/license-config.js +140 -0
- package/dist/commands/license-config.js.map +1 -0
- package/dist/commands/license.d.ts +7 -0
- package/dist/commands/license.d.ts.map +1 -0
- package/dist/commands/license.js +60 -0
- package/dist/commands/license.js.map +1 -0
- package/dist/commands/quick.d.ts.map +1 -1
- package/dist/commands/quick.js +30 -5
- package/dist/commands/quick.js.map +1 -1
- package/dist/commands/score-v3.d.ts.map +1 -1
- package/dist/commands/score-v3.js +14 -7
- package/dist/commands/score-v3.js.map +1 -1
- package/dist/commands/score.d.ts.map +1 -1
- package/dist/commands/score.js +30 -10
- package/dist/commands/score.js.map +1 -1
- package/dist/commands/submit-art.d.ts +25 -0
- package/dist/commands/submit-art.d.ts.map +1 -0
- package/dist/commands/submit-art.js +348 -0
- package/dist/commands/submit-art.js.map +1 -0
- package/dist/compiler/faf-compiler.d.ts.map +1 -1
- package/dist/compiler/faf-compiler.js +41 -4
- package/dist/compiler/faf-compiler.js.map +1 -1
- package/dist/engine/engine-loader.d.ts +24 -0
- package/dist/engine/engine-loader.d.ts.map +1 -0
- package/dist/engine/engine-loader.js +156 -0
- package/dist/engine/engine-loader.js.map +1 -0
- package/dist/engine-bridge.d.ts +5 -5
- package/dist/engine-bridge.d.ts.map +1 -1
- package/dist/engine-bridge.js +20 -7
- package/dist/engine-bridge.js.map +1 -1
- package/dist/engine-mk2/mk2-core.d.ts +38 -0
- package/dist/engine-mk2/mk2-core.d.ts.map +1 -0
- package/dist/engine-mk2/mk2-core.js +217 -0
- package/dist/engine-mk2/mk2-core.js.map +1 -0
- package/dist/generators/faf-generator-championship.d.ts +6 -0
- package/dist/generators/faf-generator-championship.d.ts.map +1 -1
- package/dist/generators/faf-generator-championship.js +19 -3
- package/dist/generators/faf-generator-championship.js.map +1 -1
- package/dist/license/license-config.d.ts +59 -0
- package/dist/license/license-config.d.ts.map +1 -0
- package/dist/license/license-config.js +263 -0
- package/dist/license/license-config.js.map +1 -0
- package/dist/license/license-controller.d.ts +41 -0
- package/dist/license/license-controller.d.ts.map +1 -0
- package/dist/license/license-controller.js +243 -0
- package/dist/license/license-controller.js.map +1 -0
- package/dist/tests/test-chrome-fuzzy.d.ts +5 -0
- package/dist/tests/test-chrome-fuzzy.d.ts.map +1 -0
- package/dist/tests/test-chrome-fuzzy.js +71 -0
- package/dist/tests/test-chrome-fuzzy.js.map +1 -0
- package/dist/utils/art-gallery.d.ts +58 -0
- package/dist/utils/art-gallery.d.ts.map +1 -0
- package/dist/utils/art-gallery.js +275 -0
- package/dist/utils/art-gallery.js.map +1 -0
- package/dist/utils/championship-style.d.ts +1 -1
- package/dist/utils/championship-style.d.ts.map +1 -1
- package/dist/utils/championship-style.js +17 -13
- package/dist/utils/championship-style.js.map +1 -1
- package/dist/utils/chrome-extension-confirmer.d.ts +41 -0
- package/dist/utils/chrome-extension-confirmer.d.ts.map +1 -0
- package/dist/utils/chrome-extension-confirmer.js +188 -0
- package/dist/utils/chrome-extension-confirmer.js.map +1 -0
- package/dist/utils/chrome-extension-detector.d.ts +74 -0
- package/dist/utils/chrome-extension-detector.d.ts.map +1 -0
- package/dist/utils/chrome-extension-detector.js +268 -0
- package/dist/utils/chrome-extension-detector.js.map +1 -0
- package/dist/utils/score-header.d.ts +22 -0
- package/dist/utils/score-header.d.ts.map +1 -0
- package/dist/utils/score-header.js +85 -0
- package/dist/utils/score-header.js.map +1 -0
- package/dist/utils/score-indicators.d.ts +47 -0
- package/dist/utils/score-indicators.d.ts.map +1 -0
- package/dist/utils/score-indicators.js +197 -0
- package/dist/utils/score-indicators.js.map +1 -0
- package/dist/utils/universal-fuzzy-detector.d.ts +64 -0
- package/dist/utils/universal-fuzzy-detector.d.ts.map +1 -0
- package/dist/utils/universal-fuzzy-detector.js +381 -0
- package/dist/utils/universal-fuzzy-detector.js.map +1 -0
- package/dist/utils/yaml-generator.js +1 -1
- package/package.json +9 -4
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* 🎯 Chrome Extension Interactive Confirmation
|
|
4
|
+
* Google-style "Did you mean?" with inquirer
|
|
5
|
+
*/
|
|
6
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
|
+
};
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.ChromeExtensionConfirmer = void 0;
|
|
11
|
+
const inquirer_1 = __importDefault(require("inquirer"));
|
|
12
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
13
|
+
const chrome_extension_detector_1 = require("./chrome-extension-detector");
|
|
14
|
+
class ChromeExtensionConfirmer {
|
|
15
|
+
/**
|
|
16
|
+
* Ask user to confirm Chrome Extension detection
|
|
17
|
+
*/
|
|
18
|
+
static async confirmDetection(text, confidence) {
|
|
19
|
+
const messages = {
|
|
20
|
+
medium: `🎯 Detected possible Chrome Extension from: "${chalk_1.default.yellow(text)}"`,
|
|
21
|
+
low: `💭 Found extension-related terms in: "${chalk_1.default.gray(text)}"`
|
|
22
|
+
};
|
|
23
|
+
const questions = {
|
|
24
|
+
medium: 'Did you mean to create a Chrome Extension?',
|
|
25
|
+
low: 'Is this a Chrome Extension project?'
|
|
26
|
+
};
|
|
27
|
+
console.log();
|
|
28
|
+
console.log(messages[confidence]);
|
|
29
|
+
const { confirmed } = await inquirer_1.default.prompt([
|
|
30
|
+
{
|
|
31
|
+
type: 'confirm',
|
|
32
|
+
name: 'confirmed',
|
|
33
|
+
message: questions[confidence],
|
|
34
|
+
default: confidence === 'medium'
|
|
35
|
+
}
|
|
36
|
+
]);
|
|
37
|
+
return confirmed;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Show suggestions for common variations
|
|
41
|
+
*/
|
|
42
|
+
static async selectFromSuggestions(input) {
|
|
43
|
+
const suggestions = this.generateSuggestions(input);
|
|
44
|
+
if (suggestions.length === 0) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
console.log();
|
|
48
|
+
console.log(chalk_1.default.cyan('🔍 Did you mean one of these?'));
|
|
49
|
+
const { selection } = await inquirer_1.default.prompt([
|
|
50
|
+
{
|
|
51
|
+
type: 'list',
|
|
52
|
+
name: 'selection',
|
|
53
|
+
message: 'Select project type:',
|
|
54
|
+
choices: [
|
|
55
|
+
...suggestions.map(s => ({
|
|
56
|
+
name: s.display,
|
|
57
|
+
value: s.value
|
|
58
|
+
})),
|
|
59
|
+
new inquirer_1.default.Separator(),
|
|
60
|
+
{
|
|
61
|
+
name: 'None of these (continue as-is)',
|
|
62
|
+
value: null
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
]);
|
|
67
|
+
return selection;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Generate smart suggestions based on input
|
|
71
|
+
*/
|
|
72
|
+
static generateSuggestions(input) {
|
|
73
|
+
const normalized = input.toLowerCase();
|
|
74
|
+
const suggestions = [];
|
|
75
|
+
// Check for Chrome Extension indicators
|
|
76
|
+
const ceDetection = chrome_extension_detector_1.ChromeExtensionDetector.detect(normalized);
|
|
77
|
+
if (ceDetection.confidence !== 'none') {
|
|
78
|
+
suggestions.push({
|
|
79
|
+
display: '🧩 Chrome Extension - Browser extension for Chrome/Edge',
|
|
80
|
+
value: 'chrome-extension'
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
// Check for related types
|
|
84
|
+
if (normalized.includes('browser') || normalized.includes('web')) {
|
|
85
|
+
if (!suggestions.find(s => s.value === 'chrome-extension')) {
|
|
86
|
+
suggestions.push({
|
|
87
|
+
display: '🌐 Web Application - Traditional web app',
|
|
88
|
+
value: 'web-app'
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
if (normalized.includes('ext') || normalized.includes('plugin')) {
|
|
93
|
+
suggestions.push({
|
|
94
|
+
display: '🔌 Browser Plugin/Extension',
|
|
95
|
+
value: 'browser-extension'
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
if (normalized.includes('popup') || normalized.includes('toolbar')) {
|
|
99
|
+
suggestions.push({
|
|
100
|
+
display: '📱 Chrome Extension with Popup UI',
|
|
101
|
+
value: 'chrome-extension-popup'
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
if (normalized.includes('script') || normalized.includes('inject')) {
|
|
105
|
+
suggestions.push({
|
|
106
|
+
display: '💉 Content Script Extension',
|
|
107
|
+
value: 'chrome-extension-content'
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
return suggestions;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Interactive project type selector with fuzzy search
|
|
114
|
+
*/
|
|
115
|
+
static async selectProjectType(currentInput) {
|
|
116
|
+
const projectTypes = [
|
|
117
|
+
{ name: '🧩 Chrome Extension', value: 'chrome-extension' },
|
|
118
|
+
{ name: '🌐 Web Application', value: 'web-app' },
|
|
119
|
+
{ name: '📱 Mobile App', value: 'mobile' },
|
|
120
|
+
{ name: '⚙️ CLI Tool', value: 'cli' },
|
|
121
|
+
{ name: '📚 Library/Package', value: 'library' },
|
|
122
|
+
{ name: '🔧 API/Backend', value: 'api' },
|
|
123
|
+
{ name: '🎮 Game', value: 'game' },
|
|
124
|
+
{ name: '🤖 Bot/Automation', value: 'bot' },
|
|
125
|
+
{ name: '📊 Data Science', value: 'data-science' },
|
|
126
|
+
{ name: '🎨 Other/Custom', value: 'other' }
|
|
127
|
+
];
|
|
128
|
+
// If we have input, check for matches
|
|
129
|
+
if (currentInput) {
|
|
130
|
+
const detection = chrome_extension_detector_1.ChromeExtensionDetector.detect(currentInput);
|
|
131
|
+
if (detection.confidence === 'high') {
|
|
132
|
+
console.log(chalk_1.default.green('✅ Chrome Extension detected automatically!'));
|
|
133
|
+
return 'chrome-extension';
|
|
134
|
+
}
|
|
135
|
+
if (detection.confidence === 'medium' || detection.confidence === 'low') {
|
|
136
|
+
const confirmed = await this.confirmDetection(currentInput, detection.confidence);
|
|
137
|
+
if (confirmed) {
|
|
138
|
+
return 'chrome-extension';
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
const { projectType } = await inquirer_1.default.prompt([
|
|
143
|
+
{
|
|
144
|
+
type: 'list',
|
|
145
|
+
name: 'projectType',
|
|
146
|
+
message: 'What type of project is this?',
|
|
147
|
+
choices: projectTypes,
|
|
148
|
+
default: currentInput ? this.guessDefault(currentInput) : 'web-app'
|
|
149
|
+
}
|
|
150
|
+
]);
|
|
151
|
+
return projectType;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Guess the most likely default based on input
|
|
155
|
+
*/
|
|
156
|
+
static guessDefault(input) {
|
|
157
|
+
const normalized = input.toLowerCase();
|
|
158
|
+
if (chrome_extension_detector_1.ChromeExtensionDetector.detect(normalized).confidence !== 'none') {
|
|
159
|
+
return 'chrome-extension';
|
|
160
|
+
}
|
|
161
|
+
if (normalized.includes('api') || normalized.includes('backend')) {
|
|
162
|
+
return 'api';
|
|
163
|
+
}
|
|
164
|
+
if (normalized.includes('cli') || normalized.includes('command')) {
|
|
165
|
+
return 'cli';
|
|
166
|
+
}
|
|
167
|
+
if (normalized.includes('library') || normalized.includes('package')) {
|
|
168
|
+
return 'library';
|
|
169
|
+
}
|
|
170
|
+
return 'web-app';
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
exports.ChromeExtensionConfirmer = ChromeExtensionConfirmer;
|
|
174
|
+
/**
|
|
175
|
+
* Example usage:
|
|
176
|
+
*
|
|
177
|
+
* Input: "chr ext for managing tabs"
|
|
178
|
+
* → Shows: "🎯 Detected possible Chrome Extension"
|
|
179
|
+
* → Asks: "Did you mean to create a Chrome Extension?" [Y/n]
|
|
180
|
+
*
|
|
181
|
+
* Input: "c e"
|
|
182
|
+
* → Shows suggestions list with Chrome Extension highlighted
|
|
183
|
+
*
|
|
184
|
+
* Input: "extension"
|
|
185
|
+
* → Shows: "💭 Found extension-related terms"
|
|
186
|
+
* → Asks: "Is this a Chrome Extension project?" [y/N]
|
|
187
|
+
*/
|
|
188
|
+
//# sourceMappingURL=chrome-extension-confirmer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chrome-extension-confirmer.js","sourceRoot":"","sources":["../../src/utils/chrome-extension-confirmer.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH,wDAAgC;AAChC,kDAA0B;AAC1B,2EAAsE;AAEtE,MAAa,wBAAwB;IAEnC;;OAEG;IACH,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAC3B,IAAY,EACZ,UAA4B;QAG5B,MAAM,QAAQ,GAAG;YACf,MAAM,EAAE,gDAAgD,eAAK,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG;YAC7E,GAAG,EAAE,yCAAyC,eAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG;SAClE,CAAC;QAEF,MAAM,SAAS,GAAG;YAChB,MAAM,EAAE,4CAA4C;YACpD,GAAG,EAAE,qCAAqC;SAC3C,CAAC;QAEF,OAAO,CAAC,GAAG,EAAE,CAAC;QACd,OAAO,CAAC,GAAG,CAAC,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AED;;;;;;;;;;;;;GAaG"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 🎯 Chrome Extension Fuzzy Detection - Google-style intelligence
|
|
3
|
+
* "Did you mean Chrome Extension?"
|
|
4
|
+
*/
|
|
5
|
+
interface DetectionResult {
|
|
6
|
+
detected: boolean;
|
|
7
|
+
confidence: 'high' | 'medium' | 'low' | 'none';
|
|
8
|
+
suggestion?: string;
|
|
9
|
+
needsConfirmation: boolean;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Google-style fuzzy matching for Chrome Extension detection
|
|
13
|
+
* Handles typos, abbreviations, and variations
|
|
14
|
+
*/
|
|
15
|
+
export declare class ChromeExtensionDetector {
|
|
16
|
+
private static readonly HIGH_CONFIDENCE;
|
|
17
|
+
private static readonly MEDIUM_CONFIDENCE;
|
|
18
|
+
private static readonly LOW_CONFIDENCE;
|
|
19
|
+
private static readonly TYPO_CORRECTIONS;
|
|
20
|
+
/**
|
|
21
|
+
* Detect if text refers to a Chrome Extension with Google-style intelligence
|
|
22
|
+
*/
|
|
23
|
+
static detect(text: string): DetectionResult;
|
|
24
|
+
/**
|
|
25
|
+
* Correct common typos
|
|
26
|
+
*/
|
|
27
|
+
private static correctTypos;
|
|
28
|
+
/**
|
|
29
|
+
* Fuzzy match with Levenshtein distance
|
|
30
|
+
*/
|
|
31
|
+
private static fuzzyMatch;
|
|
32
|
+
/**
|
|
33
|
+
* Calculate Levenshtein distance between two strings
|
|
34
|
+
*/
|
|
35
|
+
private static levenshteinDistance;
|
|
36
|
+
/**
|
|
37
|
+
* Check for extension-related context
|
|
38
|
+
*/
|
|
39
|
+
private static hasExtensionContext;
|
|
40
|
+
/**
|
|
41
|
+
* Check for spaced patterns like "c e" or "ch ext"
|
|
42
|
+
*/
|
|
43
|
+
private static hasSpacedPattern;
|
|
44
|
+
/**
|
|
45
|
+
* Get user-friendly confirmation message
|
|
46
|
+
*/
|
|
47
|
+
static getConfirmationMessage(result: DetectionResult): string | null;
|
|
48
|
+
/**
|
|
49
|
+
* Check if project has Chrome Extension files (for validation)
|
|
50
|
+
*/
|
|
51
|
+
static hasExtensionFiles(files: string[]): boolean;
|
|
52
|
+
}
|
|
53
|
+
export {};
|
|
54
|
+
/**
|
|
55
|
+
* Examples of detection:
|
|
56
|
+
*
|
|
57
|
+
* HIGH confidence (auto-accept):
|
|
58
|
+
* - "chrome extension" → ✅
|
|
59
|
+
* - "browser extension" → ✅
|
|
60
|
+
*
|
|
61
|
+
* MEDIUM confidence (needs confirmation):
|
|
62
|
+
* - "chr ext" → "Did you mean Chrome Extension?"
|
|
63
|
+
* - "c ext" → "Did you mean Chrome Extension?"
|
|
64
|
+
* - "CE" → "Did you mean Chrome Extension?"
|
|
65
|
+
*
|
|
66
|
+
* TYPO correction (auto-fix):
|
|
67
|
+
* - "chrom extention" → ✅ (corrected)
|
|
68
|
+
* - "chrome extnsion" → ✅ (corrected)
|
|
69
|
+
*
|
|
70
|
+
* LOW confidence (suggest if context):
|
|
71
|
+
* - "extension for managing tabs" → "Possible Chrome Extension?"
|
|
72
|
+
* - "popup manager" → "Possible Chrome Extension?"
|
|
73
|
+
*/
|
|
74
|
+
//# sourceMappingURL=chrome-extension-detector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chrome-extension-detector.d.ts","sourceRoot":"","sources":["../../src/utils/chrome-extension-detector.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,UAAU,eAAe;IACvB,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,MAAM,GAAG,QAAQ,GAAG,KAAK,GAAG,MAAM,CAAC;IAC/C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,OAAO,CAAC;CAC5B;AAED;;;GAGG;AACH,qBAAa,uBAAuB;IAGlC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,eAAe,CAQrC;IAGF,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,iBAAiB,CAYvC;IAGF,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAYpC;IAGF,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAiBtC;IAEF;;OAEG;IACH,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe;IAuE5C;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,YAAY;IAgB3B;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,UAAU;IAazB;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,mBAAmB;IA4BlC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,mBAAmB;IAUlC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAY/B;;OAEG;IACH,MAAM,CAAC,sBAAsB,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,GAAG,IAAI;IAgBrE;;OAEG;IACH,MAAM,CAAC,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO;CAenD;;AAED;;;;;;;;;;;;;;;;;;;GAmBG"}
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* 🎯 Chrome Extension Fuzzy Detection - Google-style intelligence
|
|
4
|
+
* "Did you mean Chrome Extension?"
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.ChromeExtensionDetector = void 0;
|
|
8
|
+
/**
|
|
9
|
+
* Google-style fuzzy matching for Chrome Extension detection
|
|
10
|
+
* Handles typos, abbreviations, and variations
|
|
11
|
+
*/
|
|
12
|
+
class ChromeExtensionDetector {
|
|
13
|
+
// High confidence patterns (exact matches)
|
|
14
|
+
static HIGH_CONFIDENCE = [
|
|
15
|
+
'chrome extension',
|
|
16
|
+
'browser extension',
|
|
17
|
+
'chrome addon',
|
|
18
|
+
'chrome plugin',
|
|
19
|
+
'web extension',
|
|
20
|
+
'manifest v3',
|
|
21
|
+
'manifest v2'
|
|
22
|
+
];
|
|
23
|
+
// Medium confidence patterns (close matches, abbreviations)
|
|
24
|
+
static MEDIUM_CONFIDENCE = [
|
|
25
|
+
'chrome ext',
|
|
26
|
+
'chr ext',
|
|
27
|
+
'chrome-ext',
|
|
28
|
+
'chr extension',
|
|
29
|
+
'extension for chrome',
|
|
30
|
+
'chrome browser extension',
|
|
31
|
+
'google chrome extension',
|
|
32
|
+
'chromium extension',
|
|
33
|
+
'edge extension', // Edge uses same APIs
|
|
34
|
+
'browser addon',
|
|
35
|
+
'browser plug-in'
|
|
36
|
+
];
|
|
37
|
+
// Low confidence patterns (needs confirmation)
|
|
38
|
+
static LOW_CONFIDENCE = [
|
|
39
|
+
'extension',
|
|
40
|
+
'ext',
|
|
41
|
+
'addon',
|
|
42
|
+
'plugin',
|
|
43
|
+
'chrome',
|
|
44
|
+
'browser',
|
|
45
|
+
'popup',
|
|
46
|
+
'content script',
|
|
47
|
+
'background script',
|
|
48
|
+
'browser action',
|
|
49
|
+
'page action'
|
|
50
|
+
];
|
|
51
|
+
// Common typos and their corrections
|
|
52
|
+
static TYPO_CORRECTIONS = {
|
|
53
|
+
'chrom extension': 'chrome extension',
|
|
54
|
+
'chrome extention': 'chrome extension',
|
|
55
|
+
'chrome exension': 'chrome extension',
|
|
56
|
+
'chrome extenstion': 'chrome extension',
|
|
57
|
+
'crome extension': 'chrome extension',
|
|
58
|
+
'chrome extnsion': 'chrome extension',
|
|
59
|
+
'chorme extension': 'chrome extension',
|
|
60
|
+
'chrome etension': 'chrome extension',
|
|
61
|
+
'chormeextension': 'chrome extension',
|
|
62
|
+
'chromeext': 'chrome extension',
|
|
63
|
+
'c-ext': 'chrome extension',
|
|
64
|
+
'c.ext': 'chrome extension',
|
|
65
|
+
'ch ext': 'chrome extension',
|
|
66
|
+
'chr-ext': 'chrome extension',
|
|
67
|
+
'chrome-extension': 'chrome extension',
|
|
68
|
+
'chrome_extension': 'chrome extension'
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Detect if text refers to a Chrome Extension with Google-style intelligence
|
|
72
|
+
*/
|
|
73
|
+
static detect(text) {
|
|
74
|
+
if (!text) {
|
|
75
|
+
return { detected: false, confidence: 'none', needsConfirmation: false };
|
|
76
|
+
}
|
|
77
|
+
const normalized = text.toLowerCase().trim();
|
|
78
|
+
// Step 1: Check for typos and auto-correct
|
|
79
|
+
const corrected = this.correctTypos(normalized);
|
|
80
|
+
if (corrected !== normalized) {
|
|
81
|
+
// We auto-corrected a typo
|
|
82
|
+
return {
|
|
83
|
+
detected: true,
|
|
84
|
+
confidence: 'medium',
|
|
85
|
+
suggestion: `Chrome Extension (auto-corrected from "${text}")`,
|
|
86
|
+
needsConfirmation: false
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
// Step 2: Check high confidence patterns
|
|
90
|
+
for (const pattern of this.HIGH_CONFIDENCE) {
|
|
91
|
+
if (normalized.includes(pattern)) {
|
|
92
|
+
return {
|
|
93
|
+
detected: true,
|
|
94
|
+
confidence: 'high',
|
|
95
|
+
needsConfirmation: false
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
// Step 3: Check medium confidence patterns
|
|
100
|
+
for (const pattern of this.MEDIUM_CONFIDENCE) {
|
|
101
|
+
if (normalized.includes(pattern) ||
|
|
102
|
+
this.fuzzyMatch(normalized, pattern)) {
|
|
103
|
+
return {
|
|
104
|
+
detected: true,
|
|
105
|
+
confidence: 'medium',
|
|
106
|
+
suggestion: 'Chrome Extension',
|
|
107
|
+
needsConfirmation: true // "Did you mean Chrome Extension?"
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
// Step 4: Check low confidence patterns
|
|
112
|
+
for (const pattern of this.LOW_CONFIDENCE) {
|
|
113
|
+
if (normalized.includes(pattern)) {
|
|
114
|
+
// Only suggest if there's additional context
|
|
115
|
+
if (this.hasExtensionContext(normalized)) {
|
|
116
|
+
return {
|
|
117
|
+
detected: false,
|
|
118
|
+
confidence: 'low',
|
|
119
|
+
suggestion: 'Chrome Extension',
|
|
120
|
+
needsConfirmation: true
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
// Step 5: Check for split/spaced variations
|
|
126
|
+
if (this.hasSpacedPattern(normalized)) {
|
|
127
|
+
return {
|
|
128
|
+
detected: true,
|
|
129
|
+
confidence: 'medium',
|
|
130
|
+
suggestion: 'Chrome Extension',
|
|
131
|
+
needsConfirmation: true
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
return { detected: false, confidence: 'none', needsConfirmation: false };
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Correct common typos
|
|
138
|
+
*/
|
|
139
|
+
static correctTypos(text) {
|
|
140
|
+
// Direct typo lookup
|
|
141
|
+
if (this.TYPO_CORRECTIONS[text]) {
|
|
142
|
+
return this.TYPO_CORRECTIONS[text];
|
|
143
|
+
}
|
|
144
|
+
// Check if any typo pattern is in the text
|
|
145
|
+
for (const [typo, correction] of Object.entries(this.TYPO_CORRECTIONS)) {
|
|
146
|
+
if (text.includes(typo)) {
|
|
147
|
+
return text.replace(typo, correction);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return text;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Fuzzy match with Levenshtein distance
|
|
154
|
+
*/
|
|
155
|
+
static fuzzyMatch(text, pattern, threshold = 3) {
|
|
156
|
+
// Check if text contains something close to pattern
|
|
157
|
+
const words = text.split(/\s+/);
|
|
158
|
+
for (const word of words) {
|
|
159
|
+
if (this.levenshteinDistance(word, pattern) <= threshold) {
|
|
160
|
+
return true;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
// Check the whole phrase
|
|
164
|
+
return this.levenshteinDistance(text, pattern) <= threshold;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Calculate Levenshtein distance between two strings
|
|
168
|
+
*/
|
|
169
|
+
static levenshteinDistance(a, b) {
|
|
170
|
+
const matrix = [];
|
|
171
|
+
for (let i = 0; i <= b.length; i++) {
|
|
172
|
+
matrix[i] = [i];
|
|
173
|
+
}
|
|
174
|
+
for (let j = 0; j <= a.length; j++) {
|
|
175
|
+
matrix[0][j] = j;
|
|
176
|
+
}
|
|
177
|
+
for (let i = 1; i <= b.length; i++) {
|
|
178
|
+
for (let j = 1; j <= a.length; j++) {
|
|
179
|
+
if (b.charAt(i - 1) === a.charAt(j - 1)) {
|
|
180
|
+
matrix[i][j] = matrix[i - 1][j - 1];
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
matrix[i][j] = Math.min(matrix[i - 1][j - 1] + 1, // substitution
|
|
184
|
+
matrix[i][j - 1] + 1, // insertion
|
|
185
|
+
matrix[i - 1][j] + 1 // deletion
|
|
186
|
+
);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
return matrix[b.length][a.length];
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Check for extension-related context
|
|
194
|
+
*/
|
|
195
|
+
static hasExtensionContext(text) {
|
|
196
|
+
const contextWords = [
|
|
197
|
+
'tab', 'popup', 'browser', 'chrome', 'manifest',
|
|
198
|
+
'content', 'background', 'inject', 'page', 'action',
|
|
199
|
+
'storage', 'permissions', 'google', 'store'
|
|
200
|
+
];
|
|
201
|
+
return contextWords.some(word => text.includes(word));
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Check for spaced patterns like "c e" or "ch ext"
|
|
205
|
+
*/
|
|
206
|
+
static hasSpacedPattern(text) {
|
|
207
|
+
const spacedPatterns = [
|
|
208
|
+
/c\s+e\s+x?\s*t/, // c e, c e x t
|
|
209
|
+
/ch\s+ext/, // ch ext
|
|
210
|
+
/chr\s+ext/, // chr ext
|
|
211
|
+
/ext\s+for\s+chr/, // ext for chr
|
|
212
|
+
/chrome\s+ex\b/ // chrome ex
|
|
213
|
+
];
|
|
214
|
+
return spacedPatterns.some(pattern => pattern.test(text));
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Get user-friendly confirmation message
|
|
218
|
+
*/
|
|
219
|
+
static getConfirmationMessage(result) {
|
|
220
|
+
if (!result.needsConfirmation) {
|
|
221
|
+
return null;
|
|
222
|
+
}
|
|
223
|
+
if (result.confidence === 'medium') {
|
|
224
|
+
return `Did you mean: Chrome Extension? (detected "${result.suggestion}")`;
|
|
225
|
+
}
|
|
226
|
+
if (result.confidence === 'low') {
|
|
227
|
+
return `Possible Chrome Extension detected. Did you mean to create a Chrome Extension?`;
|
|
228
|
+
}
|
|
229
|
+
return null;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Check if project has Chrome Extension files (for validation)
|
|
233
|
+
*/
|
|
234
|
+
static hasExtensionFiles(files) {
|
|
235
|
+
const extensionFiles = [
|
|
236
|
+
'manifest.json',
|
|
237
|
+
'popup.html',
|
|
238
|
+
'popup.js',
|
|
239
|
+
'background.js',
|
|
240
|
+
'content.js',
|
|
241
|
+
'options.html',
|
|
242
|
+
'service-worker.js'
|
|
243
|
+
];
|
|
244
|
+
return files.some(file => extensionFiles.some(extFile => file.endsWith(extFile)));
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
exports.ChromeExtensionDetector = ChromeExtensionDetector;
|
|
248
|
+
/**
|
|
249
|
+
* Examples of detection:
|
|
250
|
+
*
|
|
251
|
+
* HIGH confidence (auto-accept):
|
|
252
|
+
* - "chrome extension" → ✅
|
|
253
|
+
* - "browser extension" → ✅
|
|
254
|
+
*
|
|
255
|
+
* MEDIUM confidence (needs confirmation):
|
|
256
|
+
* - "chr ext" → "Did you mean Chrome Extension?"
|
|
257
|
+
* - "c ext" → "Did you mean Chrome Extension?"
|
|
258
|
+
* - "CE" → "Did you mean Chrome Extension?"
|
|
259
|
+
*
|
|
260
|
+
* TYPO correction (auto-fix):
|
|
261
|
+
* - "chrom extention" → ✅ (corrected)
|
|
262
|
+
* - "chrome extnsion" → ✅ (corrected)
|
|
263
|
+
*
|
|
264
|
+
* LOW confidence (suggest if context):
|
|
265
|
+
* - "extension for managing tabs" → "Possible Chrome Extension?"
|
|
266
|
+
* - "popup manager" → "Possible Chrome Extension?"
|
|
267
|
+
*/
|
|
268
|
+
//# sourceMappingURL=chrome-extension-detector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chrome-extension-detector.js","sourceRoot":"","sources":["../../src/utils/chrome-extension-detector.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AASH;;;GAGG;AACH,MAAa,uBAAuB;IAElC,2CAA2C;IACnC,MAAM,CAAU,eAAe,GAAG;QACxC,kBAAkB;QAClB,mBAAmB;QACnB,cAAc;QACd,eAAe;QACf,eAAe;QACf,aAAa;QACb,aAAa;KACd,CAAC;IAEF,4DAA4D;IACpD,MAAM,CAAU,iBAAiB,GAAG;QAC1C,YAAY;QACZ,SAAS;QACT,YAAY;QACZ,eAAe;QACf,sBAAsB;QACtB,0BAA0B;QAC1B,yBAAyB;QACzB,oBAAoB;QACpB,gBAAgB,EAAE,sBAAsB;QACxC,eAAe;QACf,iBAAiB;KAClB,CAAC;IAEF,+CAA+C;IACvC,MAAM,CAAU,cAAc,GAAG;QACvC,WAAW;QACX,KAAK;QACL,OAAO;QACP,QAAQ;QACR,QAAQ;QACR,SAAS;QACT,OAAO;QACP,gBAAgB;QAChB,mBAAmB;QACnB,gBAAgB;QAChB,aAAa;KACd,CAAC;IAEF,qCAAqC;IAC7B,MAAM,CAAU,gBAAgB,GAA2B;QACjE,iBAAiB,EAAE,kBAAkB;QACrC,kBAAkB,EAAE,kBAAkB;QACtC,iBAAiB,EAAE,kBAAkB;QACrC,mBAAmB,EAAE,kBAAkB;QACvC,iBAAiB,EAAE,kBAAkB;QACrC,iBAAiB,EAAE,kBAAkB;QACrC,kBAAkB,EAAE,kBAAkB;QACtC,iBAAiB,EAAE,kBAAkB;QACr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,CAAC,gBAAgB,CAAC,IAAY;QAC1C,MAAM,cAAc,GAAG;YACrB,gBAAgB,EAAM,eAAe;YACrC,UAAU,EAAY,SAAS;YAC/B,WAAW,EAAW,UAAU;YAChC,iBAAiB,EAAK,cAAc;YACpC,eAAe,CAAO,YAAY;SACnC,CAAC;QAEF,OAAO,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAC5D,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,sBAAsB,CAAC,MAAuB;QACnD,IAAI,CAAC,MAAM,CAAC,iBAAiB,EAAE,CAAC;YAC9B,OAAO,IAAI,CAAC;QACd,CAAC;QAED,IAAI,MAAM,CAAC,UAAU,KAAK,QAAQ,EAAE,CAAC;YACnC,OAAO,8CAA8C,MAAM,CAAC,UAAU,IAAI,CAAC;QAC7E,CAAC;QAED,IAAI,MAAM,CAAC,UAAU,KAAK,KAAK,EAAE,CAAC;YAChC,OAAO,gFAAgF,CAAC;QAC1F,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,iBAAiB,CAAC,KAAe;QACtC,MAAM,cAAc,GAAG;YACrB,eAAe;YACf,YAAY;YACZ,UAAU;YACV,eAAe;YACf,YAAY;YACZ,cAAc;YACd,mBAAmB;SACpB,CAAC;QAEF,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACvB,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CACvD,CAAC;IACJ,CAAC;;AA3QH,0DA4QC;AAED;;;;;;;;;;;;;;;;;;;GAmBG"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 🏆 Score Header Display - Always visible at top
|
|
3
|
+
* Shows current score + birth score in a clean box
|
|
4
|
+
*/
|
|
5
|
+
export interface ScoreData {
|
|
6
|
+
currentScore: number;
|
|
7
|
+
birthScore?: number;
|
|
8
|
+
aiPredictive?: number;
|
|
9
|
+
dna?: {
|
|
10
|
+
birthWeight?: number;
|
|
11
|
+
currentWeight?: number;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Generate the score header box (always shown unless --quiet)
|
|
16
|
+
*/
|
|
17
|
+
export declare function generateScoreHeader(data: ScoreData): string;
|
|
18
|
+
/**
|
|
19
|
+
* Minimal score line (for when art is disabled)
|
|
20
|
+
*/
|
|
21
|
+
export declare function generateScoreLine(data: ScoreData): string;
|
|
22
|
+
//# sourceMappingURL=score-header.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"score-header.d.ts","sourceRoot":"","sources":["../../src/utils/score-header.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,MAAM,WAAW,SAAS;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,GAAG,CAAC,EAAE;QACJ,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,aAAa,CAAC,EAAE,MAAM,CAAC;KACxB,CAAC;CACH;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CA8C3D;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAsBzD"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* 🏆 Score Header Display - Always visible at top
|
|
4
|
+
* Shows current score + birth score in a clean box
|
|
5
|
+
*/
|
|
6
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
|
+
};
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.generateScoreHeader = generateScoreHeader;
|
|
11
|
+
exports.generateScoreLine = generateScoreLine;
|
|
12
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
13
|
+
const championship_style_1 = require("./championship-style");
|
|
14
|
+
/**
|
|
15
|
+
* Generate the score header box (always shown unless --quiet)
|
|
16
|
+
*/
|
|
17
|
+
function generateScoreHeader(data) {
|
|
18
|
+
const { currentScore, birthScore, aiPredictive, dna } = data;
|
|
19
|
+
// Determine score color based on percentage
|
|
20
|
+
const getScoreColor = (score) => {
|
|
21
|
+
if (score >= 99)
|
|
22
|
+
return championship_style_1.FAF_COLORS.fafOrange; // Big Orange territory!
|
|
23
|
+
if (score >= 85)
|
|
24
|
+
return championship_style_1.FAF_COLORS.fafGreen;
|
|
25
|
+
if (score >= 70)
|
|
26
|
+
return championship_style_1.FAF_COLORS.fafCyan;
|
|
27
|
+
return championship_style_1.FAF_COLORS.fafWhite;
|
|
28
|
+
};
|
|
29
|
+
const scoreColor = getScoreColor(currentScore);
|
|
30
|
+
// Build the score display
|
|
31
|
+
let scoreDisplay = `${scoreColor(currentScore + '%')}`;
|
|
32
|
+
// Add birth score if available
|
|
33
|
+
if (birthScore !== undefined && birthScore !== currentScore) {
|
|
34
|
+
const improvement = currentScore - birthScore;
|
|
35
|
+
if (improvement > 0) {
|
|
36
|
+
scoreDisplay += chalk_1.default.gray(` (↑${improvement}% from birth: ${birthScore}%)`);
|
|
37
|
+
}
|
|
38
|
+
else if (improvement < 0) {
|
|
39
|
+
scoreDisplay += chalk_1.default.gray(` (↓${Math.abs(improvement)}% from birth: ${birthScore}%)`);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
// Add DNA weight info if available
|
|
43
|
+
let dnaDisplay = '';
|
|
44
|
+
if (dna?.currentWeight) {
|
|
45
|
+
dnaDisplay = chalk_1.default.gray(` | Weight: ${dna.currentWeight.toFixed(1)}KB`);
|
|
46
|
+
if (dna.birthWeight && dna.birthWeight !== dna.currentWeight) {
|
|
47
|
+
const growth = ((dna.currentWeight - dna.birthWeight) / dna.birthWeight * 100).toFixed(0);
|
|
48
|
+
dnaDisplay += chalk_1.default.gray(` (+${growth}%)`);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
// AI Predictive (only show if higher than current)
|
|
52
|
+
let aiDisplay = '';
|
|
53
|
+
if (aiPredictive && aiPredictive > currentScore) {
|
|
54
|
+
aiDisplay = chalk_1.default.gray(` > AI-Predictive: ${championship_style_1.FAF_COLORS.fafCyan(aiPredictive + '%')}`);
|
|
55
|
+
}
|
|
56
|
+
// Create the box
|
|
57
|
+
return `╔════════════════════════════════════════════════════════════╗
|
|
58
|
+
║ 🏆 FAF Score: ${scoreDisplay}${dnaDisplay}
|
|
59
|
+
${aiDisplay ? `║ ${aiDisplay}\n` : ''}╚════════════════════════════════════════════════════════════╝`;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Minimal score line (for when art is disabled)
|
|
63
|
+
*/
|
|
64
|
+
function generateScoreLine(data) {
|
|
65
|
+
const { currentScore, birthScore } = data;
|
|
66
|
+
const getScoreColor = (score) => {
|
|
67
|
+
if (score >= 99)
|
|
68
|
+
return championship_style_1.FAF_COLORS.fafOrange;
|
|
69
|
+
if (score >= 85)
|
|
70
|
+
return championship_style_1.FAF_COLORS.fafGreen;
|
|
71
|
+
if (score >= 70)
|
|
72
|
+
return championship_style_1.FAF_COLORS.fafCyan;
|
|
73
|
+
return championship_style_1.FAF_COLORS.fafWhite;
|
|
74
|
+
};
|
|
75
|
+
const scoreColor = getScoreColor(currentScore);
|
|
76
|
+
let line = `🏆 Score: ${scoreColor(currentScore + '%')}`;
|
|
77
|
+
if (birthScore !== undefined && birthScore !== currentScore) {
|
|
78
|
+
const improvement = currentScore - birthScore;
|
|
79
|
+
if (improvement > 0) {
|
|
80
|
+
line += chalk_1.default.gray(` (Birth: ${birthScore}% ↑${improvement}%)`);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return line;
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=score-header.js.map
|