faf-mcp 1.0.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/CHANGELOG.md +34 -0
- package/CLAUDE.md +73 -0
- package/LICENSE +22 -0
- package/README.md +165 -0
- package/assets/Project-faf-pckg-json-README.png +0 -0
- package/assets/icons/faf-icon-128.png +0 -0
- package/assets/icons/faf-icon-256.png +0 -0
- package/assets/icons/faf-icon-48.png +0 -0
- package/assets/icons/faf-icon-512.png +0 -0
- package/assets/icons/orange-smiley.svg +6 -0
- package/dist/src/compiler/index.d.ts +7 -0
- package/dist/src/compiler/index.js +24 -0
- package/dist/src/compiler/index.js.map +1 -0
- package/dist/src/compiler/scorer.d.ts +53 -0
- package/dist/src/compiler/scorer.js +189 -0
- package/dist/src/compiler/scorer.js.map +1 -0
- package/dist/src/compiler/slot-validator.d.ts +32 -0
- package/dist/src/compiler/slot-validator.js +293 -0
- package/dist/src/compiler/slot-validator.js.map +1 -0
- package/dist/src/compiler/type-detector.d.ts +62 -0
- package/dist/src/compiler/type-detector.js +388 -0
- package/dist/src/compiler/type-detector.js.map +1 -0
- package/dist/src/config/visibility.d.ts +41 -0
- package/dist/src/config/visibility.js +158 -0
- package/dist/src/config/visibility.js.map +1 -0
- package/dist/src/faf-core/commands/audit.d.ts +21 -0
- package/dist/src/faf-core/commands/audit.js +83 -0
- package/dist/src/faf-core/commands/audit.js.map +1 -0
- package/dist/src/faf-core/commands/auto.d.ts +25 -0
- package/dist/src/faf-core/commands/auto.js +74 -0
- package/dist/src/faf-core/commands/auto.js.map +1 -0
- package/dist/src/faf-core/commands/bi-sync.d.ts +26 -0
- package/dist/src/faf-core/commands/bi-sync.js +157 -0
- package/dist/src/faf-core/commands/bi-sync.js.map +1 -0
- package/dist/src/faf-core/commands/doctor.d.ts +17 -0
- package/dist/src/faf-core/commands/doctor.js +198 -0
- package/dist/src/faf-core/commands/doctor.js.map +1 -0
- package/dist/src/faf-core/commands/enhance.d.ts +46 -0
- package/dist/src/faf-core/commands/enhance.js +360 -0
- package/dist/src/faf-core/commands/enhance.js.map +1 -0
- package/dist/src/faf-core/commands/formats.d.ts +22 -0
- package/dist/src/faf-core/commands/formats.js +117 -0
- package/dist/src/faf-core/commands/formats.js.map +1 -0
- package/dist/src/faf-core/commands/init.d.ts +26 -0
- package/dist/src/faf-core/commands/init.js +114 -0
- package/dist/src/faf-core/commands/init.js.map +1 -0
- package/dist/src/faf-core/commands/innit.d.ts +7 -0
- package/dist/src/faf-core/commands/innit.js +13 -0
- package/dist/src/faf-core/commands/innit.js.map +1 -0
- package/dist/src/faf-core/commands/migrate.d.ts +15 -0
- package/dist/src/faf-core/commands/migrate.js +86 -0
- package/dist/src/faf-core/commands/migrate.js.map +1 -0
- package/dist/src/faf-core/commands/quick.d.ts +16 -0
- package/dist/src/faf-core/commands/quick.js +184 -0
- package/dist/src/faf-core/commands/quick.js.map +1 -0
- package/dist/src/faf-core/commands/score.d.ts +47 -0
- package/dist/src/faf-core/commands/score.js +49 -0
- package/dist/src/faf-core/commands/score.js.map +1 -0
- package/dist/src/faf-core/commands/sync.d.ts +16 -0
- package/dist/src/faf-core/commands/sync.js +210 -0
- package/dist/src/faf-core/commands/sync.js.map +1 -0
- package/dist/src/faf-core/commands/update.d.ts +12 -0
- package/dist/src/faf-core/commands/update.js +46 -0
- package/dist/src/faf-core/commands/update.js.map +1 -0
- package/dist/src/faf-core/commands/validate.d.ts +21 -0
- package/dist/src/faf-core/commands/validate.js +81 -0
- package/dist/src/faf-core/commands/validate.js.map +1 -0
- package/dist/src/faf-core/compiler/faf-compiler.d.ts +138 -0
- package/dist/src/faf-core/compiler/faf-compiler.js +794 -0
- package/dist/src/faf-core/compiler/faf-compiler.js.map +1 -0
- package/dist/src/faf-core/engines/dependency-tsa.d.ts +88 -0
- package/dist/src/faf-core/engines/dependency-tsa.js +361 -0
- package/dist/src/faf-core/engines/dependency-tsa.js.map +1 -0
- package/dist/src/faf-core/engines/fab-formats-processor.d.ts +166 -0
- package/dist/src/faf-core/engines/fab-formats-processor.js +1274 -0
- package/dist/src/faf-core/engines/fab-formats-processor.js.map +1 -0
- package/dist/src/faf-core/engines/faf-dna.d.ts +159 -0
- package/dist/src/faf-core/engines/faf-dna.js +554 -0
- package/dist/src/faf-core/engines/faf-dna.js.map +1 -0
- package/dist/src/faf-core/engines/relentless-context-extractor.d.ts +100 -0
- package/dist/src/faf-core/engines/relentless-context-extractor.js +625 -0
- package/dist/src/faf-core/engines/relentless-context-extractor.js.map +1 -0
- package/dist/src/faf-core/fix-once/colors.d.ts +104 -0
- package/dist/src/faf-core/fix-once/colors.js +236 -0
- package/dist/src/faf-core/fix-once/colors.js.map +1 -0
- package/dist/src/faf-core/fix-once/types.d.ts +257 -0
- package/dist/src/faf-core/fix-once/types.js +26 -0
- package/dist/src/faf-core/fix-once/types.js.map +1 -0
- package/dist/src/faf-core/fix-once/yaml.d.ts +57 -0
- package/dist/src/faf-core/fix-once/yaml.js +172 -0
- package/dist/src/faf-core/fix-once/yaml.js.map +1 -0
- package/dist/src/faf-core/generators/faf-generator-championship.d.ts +16 -0
- package/dist/src/faf-core/generators/faf-generator-championship.js +462 -0
- package/dist/src/faf-core/generators/faf-generator-championship.js.map +1 -0
- package/dist/src/faf-core/utils/balance-visualizer.d.ts +37 -0
- package/dist/src/faf-core/utils/balance-visualizer.js +197 -0
- package/dist/src/faf-core/utils/balance-visualizer.js.map +1 -0
- package/dist/src/faf-core/utils/championship-style.d.ts +109 -0
- package/dist/src/faf-core/utils/championship-style.js +219 -0
- package/dist/src/faf-core/utils/championship-style.js.map +1 -0
- package/dist/src/faf-core/utils/chrome-extension-detector.d.ts +73 -0
- package/dist/src/faf-core/utils/chrome-extension-detector.js +268 -0
- package/dist/src/faf-core/utils/chrome-extension-detector.js.map +1 -0
- package/dist/src/faf-core/utils/fafignore-parser.d.ts +20 -0
- package/dist/src/faf-core/utils/fafignore-parser.js +178 -0
- package/dist/src/faf-core/utils/fafignore-parser.js.map +1 -0
- package/dist/src/faf-core/utils/file-utils.d.ts +112 -0
- package/dist/src/faf-core/utils/file-utils.js +846 -0
- package/dist/src/faf-core/utils/file-utils.js.map +1 -0
- package/dist/src/faf-core/utils/native-file-finder.d.ts +115 -0
- package/dist/src/faf-core/utils/native-file-finder.js +211 -0
- package/dist/src/faf-core/utils/native-file-finder.js.map +1 -0
- package/dist/src/faf-core/utils/platform-detector.d.ts +30 -0
- package/dist/src/faf-core/utils/platform-detector.js +218 -0
- package/dist/src/faf-core/utils/platform-detector.js.map +1 -0
- package/dist/src/faf-core/utils/technical-credit.d.ts +35 -0
- package/dist/src/faf-core/utils/technical-credit.js +286 -0
- package/dist/src/faf-core/utils/technical-credit.js.map +1 -0
- package/dist/src/faf-core/utils/yaml-generator.d.ts +41 -0
- package/dist/src/faf-core/utils/yaml-generator.js +360 -0
- package/dist/src/faf-core/utils/yaml-generator.js.map +1 -0
- package/dist/src/handlers/behavioral-instruction.d.ts +16 -0
- package/dist/src/handlers/behavioral-instruction.js +43 -0
- package/dist/src/handlers/behavioral-instruction.js.map +1 -0
- package/dist/src/handlers/championship-tools.d.ts +113 -0
- package/dist/src/handlers/championship-tools.js +2602 -0
- package/dist/src/handlers/championship-tools.js.map +1 -0
- package/dist/src/handlers/engine-adapter.d.ts +28 -0
- package/dist/src/handlers/engine-adapter.js +603 -0
- package/dist/src/handlers/engine-adapter.js.map +1 -0
- package/dist/src/handlers/fileHandler.d.ts +36 -0
- package/dist/src/handlers/fileHandler.js +246 -0
- package/dist/src/handlers/fileHandler.js.map +1 -0
- package/dist/src/handlers/resources.d.ts +18 -0
- package/dist/src/handlers/resources.js +78 -0
- package/dist/src/handlers/resources.js.map +1 -0
- package/dist/src/handlers/tool-registry.d.ts +23 -0
- package/dist/src/handlers/tool-registry.js +68 -0
- package/dist/src/handlers/tool-registry.js.map +1 -0
- package/dist/src/handlers/tool-types.d.ts +167 -0
- package/dist/src/handlers/tool-types.js +7 -0
- package/dist/src/handlers/tool-types.js.map +1 -0
- package/dist/src/handlers/tools.d.ts +25 -0
- package/dist/src/handlers/tools.js +1168 -0
- package/dist/src/handlers/tools.js.map +1 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.js +17 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/server.d.ts +28 -0
- package/dist/src/server.js +179 -0
- package/dist/src/server.js.map +1 -0
- package/dist/src/test-all-functions.d.ts +15 -0
- package/dist/src/test-all-functions.js +163 -0
- package/dist/src/test-all-functions.js.map +1 -0
- package/dist/src/types/mcp-tools.d.ts +53 -0
- package/dist/src/types/mcp-tools.js +77 -0
- package/dist/src/types/mcp-tools.js.map +1 -0
- package/dist/src/types/project-types.d.ts +22 -0
- package/dist/src/types/project-types.js +85 -0
- package/dist/src/types/project-types.js.map +1 -0
- package/dist/src/types/slots.d.ts +39 -0
- package/dist/src/types/slots.js +162 -0
- package/dist/src/types/slots.js.map +1 -0
- package/dist/src/types/tool-visibility.d.ts +36 -0
- package/dist/src/types/tool-visibility.js +510 -0
- package/dist/src/types/tool-visibility.js.map +1 -0
- package/dist/src/utils/auto-path-detection.d.ts +26 -0
- package/dist/src/utils/auto-path-detection.js +198 -0
- package/dist/src/utils/auto-path-detection.js.map +1 -0
- package/dist/src/utils/championship-format.d.ts +30 -0
- package/dist/src/utils/championship-format.js +79 -0
- package/dist/src/utils/championship-format.js.map +1 -0
- package/dist/src/utils/cli-detector.d.ts +20 -0
- package/dist/src/utils/cli-detector.js +230 -0
- package/dist/src/utils/cli-detector.js.map +1 -0
- package/dist/src/utils/display-protocol.d.ts +57 -0
- package/dist/src/utils/display-protocol.js +131 -0
- package/dist/src/utils/display-protocol.js.map +1 -0
- package/dist/src/utils/faf-file-finder.d.ts +59 -0
- package/dist/src/utils/faf-file-finder.js +139 -0
- package/dist/src/utils/faf-file-finder.js.map +1 -0
- package/dist/src/utils/fuzzy-detector.d.ts +56 -0
- package/dist/src/utils/fuzzy-detector.js +221 -0
- package/dist/src/utils/fuzzy-detector.js.map +1 -0
- package/dist/src/utils/path-resolver.d.ts +51 -0
- package/dist/src/utils/path-resolver.js +214 -0
- package/dist/src/utils/path-resolver.js.map +1 -0
- package/dist/src/utils/type-guards.d.ts +9 -0
- package/dist/src/utils/type-guards.js +27 -0
- package/dist/src/utils/type-guards.js.map +1 -0
- package/dist/src/utils/username-detector.d.ts +27 -0
- package/dist/src/utils/username-detector.js +90 -0
- package/dist/src/utils/username-detector.js.map +1 -0
- package/dist/src/utils/visual-style.d.ts +62 -0
- package/dist/src/utils/visual-style.js +164 -0
- package/dist/src/utils/visual-style.js.map +1 -0
- package/dist/src/version.d.ts +9 -0
- package/dist/src/version.js +37 -0
- package/dist/src/version.js.map +1 -0
- package/package.json +114 -0
- package/scripts/discord-sync-curated.js +233 -0
- package/scripts/discord-sync-final.js +218 -0
- package/scripts/discord-sync-simple.js +175 -0
- package/scripts/discord-sync-working.js +187 -0
- package/scripts/discord-sync.js +181 -0
- package/scripts/postinstall.js +46 -0
- package/skill/SKILL.md +385 -0
|
@@ -0,0 +1,73 @@
|
|
|
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
|
+
*/
|
|
@@ -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/faf-core/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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AAM,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,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 🚫 .fafignore Parser
|
|
3
|
+
* Handles exclusion patterns for .faf file generation
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Parse .fafignore file and return patterns
|
|
7
|
+
*/
|
|
8
|
+
export declare function parseFafIgnore(projectRoot: string): Promise<string[]>;
|
|
9
|
+
/**
|
|
10
|
+
* Check if a file path should be ignored
|
|
11
|
+
*/
|
|
12
|
+
export declare function shouldIgnore(filePath: string, patterns: string[]): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Create a default .fafignore file with helpful comments
|
|
15
|
+
*/
|
|
16
|
+
export declare function createDefaultFafIgnore(projectRoot: string): Promise<void>;
|
|
17
|
+
/**
|
|
18
|
+
* Get file size limit for inclusion (default 1MB)
|
|
19
|
+
*/
|
|
20
|
+
export declare function getFileSizeLimit(): number;
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* 🚫 .fafignore Parser
|
|
4
|
+
* Handles exclusion patterns for .faf file generation
|
|
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.parseFafIgnore = parseFafIgnore;
|
|
11
|
+
exports.shouldIgnore = shouldIgnore;
|
|
12
|
+
exports.createDefaultFafIgnore = createDefaultFafIgnore;
|
|
13
|
+
exports.getFileSizeLimit = getFileSizeLimit;
|
|
14
|
+
const fs_1 = require("fs");
|
|
15
|
+
const path_1 = __importDefault(require("path"));
|
|
16
|
+
const file_utils_1 = require("./file-utils");
|
|
17
|
+
/**
|
|
18
|
+
* Default patterns to always exclude
|
|
19
|
+
* These are common directories/files that shouldn't be in AI context
|
|
20
|
+
*/
|
|
21
|
+
const DEFAULT_IGNORE_PATTERNS = [
|
|
22
|
+
// JavaScript/Node
|
|
23
|
+
"node_modules/",
|
|
24
|
+
"dist/",
|
|
25
|
+
"build/",
|
|
26
|
+
"coverage/",
|
|
27
|
+
".next/",
|
|
28
|
+
".nuxt/",
|
|
29
|
+
"out/",
|
|
30
|
+
// Python
|
|
31
|
+
"__pycache__/",
|
|
32
|
+
"*.pyc",
|
|
33
|
+
".venv/",
|
|
34
|
+
"venv/",
|
|
35
|
+
".pytest_cache/",
|
|
36
|
+
".mypy_cache/",
|
|
37
|
+
// Version Control
|
|
38
|
+
".git/",
|
|
39
|
+
".svn/",
|
|
40
|
+
".hg/",
|
|
41
|
+
// IDE/Editor
|
|
42
|
+
".vscode/",
|
|
43
|
+
".idea/",
|
|
44
|
+
"*.swp",
|
|
45
|
+
".DS_Store",
|
|
46
|
+
// Sensitive files
|
|
47
|
+
".env",
|
|
48
|
+
".env.*",
|
|
49
|
+
"*.key",
|
|
50
|
+
"*.pem",
|
|
51
|
+
"*.cert",
|
|
52
|
+
// Logs and temp
|
|
53
|
+
"*.log",
|
|
54
|
+
"logs/",
|
|
55
|
+
"tmp/",
|
|
56
|
+
"temp/",
|
|
57
|
+
// Package files
|
|
58
|
+
"*.tgz",
|
|
59
|
+
"*.tar.gz",
|
|
60
|
+
"*.zip",
|
|
61
|
+
// Media files (usually not needed for code context)
|
|
62
|
+
"*.jpg",
|
|
63
|
+
"*.jpeg",
|
|
64
|
+
"*.png",
|
|
65
|
+
"*.gif",
|
|
66
|
+
"*.mp4",
|
|
67
|
+
"*.mov",
|
|
68
|
+
"*.avi",
|
|
69
|
+
];
|
|
70
|
+
/**
|
|
71
|
+
* Parse .fafignore file and return patterns
|
|
72
|
+
*/
|
|
73
|
+
async function parseFafIgnore(projectRoot) {
|
|
74
|
+
const fafIgnorePath = path_1.default.join(projectRoot, ".fafignore");
|
|
75
|
+
// Start with default patterns
|
|
76
|
+
let patterns = [...DEFAULT_IGNORE_PATTERNS];
|
|
77
|
+
// Check if .fafignore exists
|
|
78
|
+
if (await (0, file_utils_1.fileExists)(fafIgnorePath)) {
|
|
79
|
+
try {
|
|
80
|
+
const content = await fs_1.promises.readFile(fafIgnorePath, "utf-8");
|
|
81
|
+
const userPatterns = content
|
|
82
|
+
.split("\n")
|
|
83
|
+
.map((line) => line.trim())
|
|
84
|
+
.filter((line) => line && !line.startsWith("#")); // Remove empty lines and comments
|
|
85
|
+
// Add user patterns
|
|
86
|
+
patterns = [...patterns, ...userPatterns];
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
console.warn("Warning: Could not read .fafignore file");
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
// Remove duplicates
|
|
93
|
+
return [...new Set(patterns)];
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Check if a file path should be ignored
|
|
97
|
+
*/
|
|
98
|
+
function shouldIgnore(filePath, patterns) {
|
|
99
|
+
const normalizedPath = filePath.replace(/\\/g, "/");
|
|
100
|
+
for (const pattern of patterns) {
|
|
101
|
+
// Handle directory patterns (ending with /)
|
|
102
|
+
if (pattern.endsWith("/")) {
|
|
103
|
+
const dir = pattern.slice(0, -1);
|
|
104
|
+
if (normalizedPath.includes(`/${dir}/`) ||
|
|
105
|
+
normalizedPath.startsWith(`${dir}/`)) {
|
|
106
|
+
return true;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
// Handle file extension patterns (*.ext)
|
|
110
|
+
if (pattern.startsWith("*.")) {
|
|
111
|
+
const ext = pattern.slice(1);
|
|
112
|
+
if (normalizedPath.endsWith(ext)) {
|
|
113
|
+
return true;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
// Handle exact matches
|
|
117
|
+
if (normalizedPath.includes(pattern) || normalizedPath.endsWith(pattern)) {
|
|
118
|
+
return true;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return false;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Create a default .fafignore file with helpful comments
|
|
125
|
+
*/
|
|
126
|
+
async function createDefaultFafIgnore(projectRoot) {
|
|
127
|
+
const fafIgnorePath = path_1.default.join(projectRoot, ".fafignore");
|
|
128
|
+
const content = `# .fafignore - Exclude files/directories from .faf context
|
|
129
|
+
# Similar to .gitignore syntax
|
|
130
|
+
# Lines starting with # are comments
|
|
131
|
+
|
|
132
|
+
# Dependencies and build outputs
|
|
133
|
+
node_modules/
|
|
134
|
+
dist/
|
|
135
|
+
build/
|
|
136
|
+
coverage/
|
|
137
|
+
|
|
138
|
+
# Python environments
|
|
139
|
+
__pycache__/
|
|
140
|
+
venv/
|
|
141
|
+
.venv/
|
|
142
|
+
|
|
143
|
+
# IDE and system files
|
|
144
|
+
.vscode/
|
|
145
|
+
.idea/
|
|
146
|
+
.DS_Store
|
|
147
|
+
|
|
148
|
+
# Sensitive files
|
|
149
|
+
.env
|
|
150
|
+
.env.*
|
|
151
|
+
*.key
|
|
152
|
+
*.pem
|
|
153
|
+
|
|
154
|
+
# Logs and temporary files
|
|
155
|
+
*.log
|
|
156
|
+
logs/
|
|
157
|
+
tmp/
|
|
158
|
+
temp/
|
|
159
|
+
|
|
160
|
+
# Large media files
|
|
161
|
+
*.jpg
|
|
162
|
+
*.png
|
|
163
|
+
*.mp4
|
|
164
|
+
*.pdf
|
|
165
|
+
|
|
166
|
+
# Custom exclusions (add your own below)
|
|
167
|
+
# example: my-large-data-folder/
|
|
168
|
+
# example: *.generated.ts
|
|
169
|
+
`;
|
|
170
|
+
await fs_1.promises.writeFile(fafIgnorePath, content, "utf-8");
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Get file size limit for inclusion (default 1MB)
|
|
174
|
+
*/
|
|
175
|
+
function getFileSizeLimit() {
|
|
176
|
+
return 1024 * 1024; // 1MB
|
|
177
|
+
}
|
|
178
|
+
//# sourceMappingURL=fafignore-parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fafignore-parser.js","sourceRoot":"","sources":["../../../../src/faf-core/utils/fafignore-parser.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;AAsEH,wCAwBC;AAKD,oCA8BC;AAKD,wDAiDC;AAKD,4CAEC;AA5LD,2BAAoC;AACpC,gDAAwB;AACxB,6CAA0C;AAE1C;;;GAGG;AACH,MAAM,uBAAuB,GAAG;IAC9B,kBAAkB;IAClB,eAAe;IACf,OAAO;IACP,QAAQ;IACR,WAAW;IACX,QAAQ;IACR,QAAQ;IACR,MAAM;IAEN,SAAS;IACT,cAAc;IACd,OAAO;IACP,QAAQ;IACR,OAAO;IACP,gBAAgB;IAChB,cAAc;IAEd,kBAAkB;IAClB,OAAO;IACP,OAAO;IACP,MAAM;IAEN,aAAa;IACb,UAAU;IACV,QAAQ;IACR,OAAO;IACP,WAAW;IAEX,kBAAkB;IAClB,MAAM;IACN,QAAQ;IACR,OAAO;IACP,OAAO;IACP,QAAQ;IAER,gBAAgB;IAChB,OAAO;IACP,OAAO;IACP,MAAM;IACN,OAAO;IAEP,gBAAgB;IAChB,OAAO;IACP,UAAU;IACV,OAAO;IAEP,oDAAoD;IACpD,OAAO;IACP,QAAQ;IACR,OAAO;IACP,OAAO;IACP,OAAO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|
|
5
|
+
/**
|
|
6
|
+
* Find project.faf file in current directory or parent directories
|
|
7
|
+
*
|
|
8
|
+
* v3.0.0: ONLY supports project.faf (no legacy .faf support)
|
|
9
|
+
*/
|
|
10
|
+
export declare function findFafFile(startDir?: string): Promise<string | null>;
|
|
11
|
+
/**
|
|
12
|
+
* Check if file exists and is readable
|
|
13
|
+
*/
|
|
14
|
+
export declare function fileExists(filePath: string): Promise<boolean>;
|
|
15
|
+
/**
|
|
16
|
+
* Get file modification time
|
|
17
|
+
*/
|
|
18
|
+
export declare function getFileModTime(filePath: string): Promise<Date | null>;
|
|
19
|
+
/**
|
|
20
|
+
* Find package.json in project
|
|
21
|
+
*/
|
|
22
|
+
export declare function findPackageJson(startDir?: string): Promise<string | null>;
|
|
23
|
+
/**
|
|
24
|
+
* Find pyproject.toml in project (Python Poetry/PEP 518)
|
|
25
|
+
*/
|
|
26
|
+
export declare function findPyprojectToml(startDir?: string): Promise<string | null>;
|
|
27
|
+
/**
|
|
28
|
+
* Find requirements.txt in project (Python pip)
|
|
29
|
+
*/
|
|
30
|
+
export declare function findRequirementsTxt(startDir?: string): Promise<string | null>;
|
|
31
|
+
/**
|
|
32
|
+
* Find tsconfig.json in project (TypeScript)
|
|
33
|
+
*/
|
|
34
|
+
export declare function findTsConfig(startDir?: string): Promise<string | null>;
|
|
35
|
+
/**
|
|
36
|
+
* Analyze tsconfig.json for F1-Inspired TypeScript intelligence
|
|
37
|
+
*/
|
|
38
|
+
export declare function analyzeTsConfig(filePath: string): Promise<TypeScriptContext | null>;
|
|
39
|
+
export interface TypeScriptContext {
|
|
40
|
+
target: string;
|
|
41
|
+
module: string;
|
|
42
|
+
moduleResolution: string;
|
|
43
|
+
strict: boolean;
|
|
44
|
+
strictnessLevel: "basic" | "strict" | "ultra_strict" | "f1_inspired";
|
|
45
|
+
frameworkIntegration: string;
|
|
46
|
+
performanceOptimizations: string[];
|
|
47
|
+
includes: string[];
|
|
48
|
+
excludes: string[];
|
|
49
|
+
engineeringQuality: "standard" | "professional" | "f1_inspired";
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Detect n8n workflow files in directory
|
|
53
|
+
*/
|
|
54
|
+
export declare function findN8nWorkflows(projectDir?: string): Promise<string[]>;
|
|
55
|
+
/**
|
|
56
|
+
* Find Make.com scenario files in a project directory
|
|
57
|
+
*
|
|
58
|
+
* Detects Make.com blueprint JSON files by checking for:
|
|
59
|
+
* - name string (scenario name)
|
|
60
|
+
* - flow array (modules/steps)
|
|
61
|
+
* - metadata object (scenario metadata)
|
|
62
|
+
*
|
|
63
|
+
* @param projectDir - Directory to search (defaults to cwd)
|
|
64
|
+
* @returns Array of Make.com scenario file names
|
|
65
|
+
*/
|
|
66
|
+
export declare function findMakeScenarios(projectDir?: string): Promise<string[]>;
|
|
67
|
+
/**
|
|
68
|
+
* Find Google Opal mini-app files in a project directory
|
|
69
|
+
*
|
|
70
|
+
* Detects Opal mini-app JSON files by checking for:
|
|
71
|
+
* - steps array (mini-app steps)
|
|
72
|
+
* - model string (AI model used)
|
|
73
|
+
*
|
|
74
|
+
* @param projectDir - Directory to search (defaults to cwd)
|
|
75
|
+
* @returns Array of Opal mini-app file names
|
|
76
|
+
*/
|
|
77
|
+
export declare function findOpalMiniApps(projectDir?: string): Promise<string[]>;
|
|
78
|
+
/**
|
|
79
|
+
* Find OpenAI Assistant files in a project directory
|
|
80
|
+
*
|
|
81
|
+
* Detects OpenAI Assistant JSON files (OpenAPI 3.x schemas) by checking for:
|
|
82
|
+
* - openapi string (OpenAPI version)
|
|
83
|
+
* - paths object (API endpoints/actions)
|
|
84
|
+
*
|
|
85
|
+
* @param projectDir - Directory to search (defaults to cwd)
|
|
86
|
+
* @returns Array of OpenAI Assistant file names
|
|
87
|
+
*/
|
|
88
|
+
export declare function findOpenAIAssistants(projectDir?: string): Promise<string[]>;
|
|
89
|
+
/**
|
|
90
|
+
* Detect project type from files and structure
|
|
91
|
+
*
|
|
92
|
+
* CHAMPIONSHIP DETECTION STRATEGY:
|
|
93
|
+
* 1. 😽 TURBO-CAT: Format discovery (finds config files)
|
|
94
|
+
* 2. 🛂 TSA: Dependency intelligence (analyzes actual usage)
|
|
95
|
+
* 3. Cross-reference both engines for definitive answer
|
|
96
|
+
* 4. Fallback to file patterns if engines unavailable
|
|
97
|
+
*
|
|
98
|
+
* Goal: Championship-grade detection using existing engines
|
|
99
|
+
*/
|
|
100
|
+
export declare function detectProjectType(projectDir?: string): Promise<string>;
|
|
101
|
+
/**
|
|
102
|
+
* Calculate days since file was modified
|
|
103
|
+
*/
|
|
104
|
+
export declare function daysSinceModified(date: Date): number;
|
|
105
|
+
/**
|
|
106
|
+
* Detect Python project type using dependency files (Option A)
|
|
107
|
+
*/
|
|
108
|
+
export declare function detectPythonProjectType(projectDir: string): Promise<string>;
|
|
109
|
+
/**
|
|
110
|
+
* Detect Python frameworks using code patterns (Option B)
|
|
111
|
+
*/
|
|
112
|
+
export declare function detectPythonPatterns(projectDir: string, pythonFiles: string[]): Promise<string>;
|