faf-cli 2.3.4 → 2.3.5
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 +6 -4
- 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/quick.d.ts.map +1 -1
- package/dist/commands/quick.js +30 -5
- package/dist/commands/quick.js.map +1 -1
- 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/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/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/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/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 +2 -2
|
@@ -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,+CA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ACrB,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,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 🎯 Universal Fuzzy Detection - Google-style intelligence for ALL inputs
|
|
3
|
+
* "Close enough is good enough"
|
|
4
|
+
*/
|
|
5
|
+
interface FuzzyMatch {
|
|
6
|
+
detected: boolean;
|
|
7
|
+
type: string;
|
|
8
|
+
confidence: 'high' | 'medium' | 'low' | 'none';
|
|
9
|
+
suggestion?: string;
|
|
10
|
+
needsConfirmation: boolean;
|
|
11
|
+
corrected?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare class UniversalFuzzyDetector {
|
|
14
|
+
private static readonly PROJECT_PATTERNS;
|
|
15
|
+
private static readonly TYPO_CORRECTIONS;
|
|
16
|
+
private static readonly LANGUAGE_PATTERNS;
|
|
17
|
+
/**
|
|
18
|
+
* Detect project type with fuzzy matching
|
|
19
|
+
*/
|
|
20
|
+
static detectProjectType(input: string): FuzzyMatch;
|
|
21
|
+
/**
|
|
22
|
+
* Detect language with fuzzy matching
|
|
23
|
+
*/
|
|
24
|
+
static detectLanguage(input: string): FuzzyMatch;
|
|
25
|
+
/**
|
|
26
|
+
* Detect with pattern matching
|
|
27
|
+
*/
|
|
28
|
+
private static detectWithPatterns;
|
|
29
|
+
/**
|
|
30
|
+
* Correct common typos across all inputs
|
|
31
|
+
*/
|
|
32
|
+
private static correctTypos;
|
|
33
|
+
/**
|
|
34
|
+
* Fuzzy match with Levenshtein distance
|
|
35
|
+
*/
|
|
36
|
+
private static fuzzyMatch;
|
|
37
|
+
/**
|
|
38
|
+
* Calculate Levenshtein distance
|
|
39
|
+
*/
|
|
40
|
+
private static levenshteinDistance;
|
|
41
|
+
/**
|
|
42
|
+
* Check for project context
|
|
43
|
+
*/
|
|
44
|
+
private static hasProjectContext;
|
|
45
|
+
/**
|
|
46
|
+
* Guess project type from context
|
|
47
|
+
*/
|
|
48
|
+
private static guessProjectType;
|
|
49
|
+
/**
|
|
50
|
+
* Get all suggestions for input
|
|
51
|
+
*/
|
|
52
|
+
static getSuggestions(input: string, limit?: number): string[];
|
|
53
|
+
}
|
|
54
|
+
export {};
|
|
55
|
+
/**
|
|
56
|
+
* Examples:
|
|
57
|
+
*
|
|
58
|
+
* detectProjectType("raect app") → "react" (typo corrected)
|
|
59
|
+
* detectProjectType("chr ext") → "chrome-extension" (fuzzy match)
|
|
60
|
+
* detectProjectType("moblie game") → "mobile" + "game" (multiple detections)
|
|
61
|
+
* detectLanguage("typscript") → "typescript" (typo corrected)
|
|
62
|
+
* detectLanguage("js") → "javascript" (abbreviation)
|
|
63
|
+
*/
|
|
64
|
+
//# sourceMappingURL=universal-fuzzy-detector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"universal-fuzzy-detector.d.ts","sourceRoot":"","sources":["../../src/utils/universal-fuzzy-detector.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,UAAU,UAAU;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,GAAG,QAAQ,GAAG,KAAK,GAAG,MAAM,CAAC;IAC/C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,qBAAa,sBAAsB;IAGjC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAwEtC;IAGF,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAgFtC;IAGF,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,iBAAiB,CAevC;IAEF;;OAEG;IACH,MAAM,CAAC,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU;IAwBnD;;OAEG;IACH,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU;IAqChD;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,kBAAkB;IA8CjC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,YAAY;IAY3B;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,UAAU;IAUzB;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,mBAAmB;IA4BlC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAQhC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAS/B;;OAEG;IACH,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,GAAE,MAAU,GAAG,MAAM,EAAE;CAsBlE;;AAED;;;;;;;;GAQG"}
|