faf-cli 2.1.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/LICENSE +21 -0
- package/README.md +227 -0
- package/dist/cli.d.ts +8 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +1249 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/ai-analyze.d.ts +18 -0
- package/dist/commands/ai-analyze.d.ts.map +1 -0
- package/dist/commands/ai-analyze.js +226 -0
- package/dist/commands/ai-analyze.js.map +1 -0
- package/dist/commands/ai-enhance.d.ts +17 -0
- package/dist/commands/ai-enhance.d.ts.map +1 -0
- package/dist/commands/ai-enhance.js +278 -0
- package/dist/commands/ai-enhance.js.map +1 -0
- package/dist/commands/audit.d.ts +11 -0
- package/dist/commands/audit.d.ts.map +1 -0
- package/dist/commands/audit.js +180 -0
- package/dist/commands/audit.js.map +1 -0
- package/dist/commands/auto.d.ts +27 -0
- package/dist/commands/auto.d.ts.map +1 -0
- package/dist/commands/auto.js +106 -0
- package/dist/commands/auto.js.map +1 -0
- package/dist/commands/bi-sync.d.ts +43 -0
- package/dist/commands/bi-sync.d.ts.map +1 -0
- package/dist/commands/bi-sync.js +224 -0
- package/dist/commands/bi-sync.js.map +1 -0
- package/dist/commands/chat.d.ts +6 -0
- package/dist/commands/chat.d.ts.map +1 -0
- package/dist/commands/chat.js +227 -0
- package/dist/commands/chat.js.map +1 -0
- package/dist/commands/check.d.ts +15 -0
- package/dist/commands/check.d.ts.map +1 -0
- package/dist/commands/check.js +58 -0
- package/dist/commands/check.js.map +1 -0
- package/dist/commands/clear.d.ts +15 -0
- package/dist/commands/clear.d.ts.map +1 -0
- package/dist/commands/clear.js +167 -0
- package/dist/commands/clear.js.map +1 -0
- package/dist/commands/commit.d.ts +8 -0
- package/dist/commands/commit.d.ts.map +1 -0
- package/dist/commands/commit.js +164 -0
- package/dist/commands/commit.js.map +1 -0
- package/dist/commands/convert.d.ts +19 -0
- package/dist/commands/convert.d.ts.map +1 -0
- package/dist/commands/convert.js +102 -0
- package/dist/commands/convert.js.map +1 -0
- package/dist/commands/credit.d.ts +13 -0
- package/dist/commands/credit.d.ts.map +1 -0
- package/dist/commands/credit.js +149 -0
- package/dist/commands/credit.js.map +1 -0
- package/dist/commands/edit-helper.d.ts +6 -0
- package/dist/commands/edit-helper.d.ts.map +1 -0
- package/dist/commands/edit-helper.js +55 -0
- package/dist/commands/edit-helper.js.map +1 -0
- package/dist/commands/edit.d.ts +14 -0
- package/dist/commands/edit.d.ts.map +1 -0
- package/dist/commands/edit.js +196 -0
- package/dist/commands/edit.js.map +1 -0
- package/dist/commands/faf-auth.d.ts +10 -0
- package/dist/commands/faf-auth.d.ts.map +1 -0
- package/dist/commands/faf-auth.js +162 -0
- package/dist/commands/faf-auth.js.map +1 -0
- package/dist/commands/faf-dna.d.ts +9 -0
- package/dist/commands/faf-dna.d.ts.map +1 -0
- package/dist/commands/faf-dna.js +141 -0
- package/dist/commands/faf-dna.js.map +1 -0
- package/dist/commands/faf-log.d.ts +9 -0
- package/dist/commands/faf-log.d.ts.map +1 -0
- package/dist/commands/faf-log.js +135 -0
- package/dist/commands/faf-log.js.map +1 -0
- package/dist/commands/faf-recover.d.ts +3 -0
- package/dist/commands/faf-recover.d.ts.map +1 -0
- package/dist/commands/faf-recover.js +299 -0
- package/dist/commands/faf-recover.js.map +1 -0
- package/dist/commands/faf-update.d.ts +9 -0
- package/dist/commands/faf-update.d.ts.map +1 -0
- package/dist/commands/faf-update.js +68 -0
- package/dist/commands/faf-update.js.map +1 -0
- package/dist/commands/faq.d.ts +12 -0
- package/dist/commands/faq.d.ts.map +1 -0
- package/dist/commands/faq.js +84 -0
- package/dist/commands/faq.js.map +1 -0
- package/dist/commands/flow.d.ts +11 -0
- package/dist/commands/flow.d.ts.map +1 -0
- package/dist/commands/flow.js +117 -0
- package/dist/commands/flow.js.map +1 -0
- package/dist/commands/formats.d.ts +12 -0
- package/dist/commands/formats.d.ts.map +1 -0
- package/dist/commands/formats.js +109 -0
- package/dist/commands/formats.js.map +1 -0
- package/dist/commands/index.d.ts +14 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +443 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/init.d.ts +14 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +202 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/lint.d.ts +11 -0
- package/dist/commands/lint.d.ts.map +1 -0
- package/dist/commands/lint.js +269 -0
- package/dist/commands/lint.js.map +1 -0
- package/dist/commands/mirror.d.ts +7 -0
- package/dist/commands/mirror.d.ts.map +1 -0
- package/dist/commands/mirror.js +130 -0
- package/dist/commands/mirror.js.map +1 -0
- package/dist/commands/score.d.ts +11 -0
- package/dist/commands/score.d.ts.map +1 -0
- package/dist/commands/score.js +192 -0
- package/dist/commands/score.js.map +1 -0
- package/dist/commands/search.d.ts +16 -0
- package/dist/commands/search.d.ts.map +1 -0
- package/dist/commands/search.js +174 -0
- package/dist/commands/search.js.map +1 -0
- package/dist/commands/share.d.ts +17 -0
- package/dist/commands/share.d.ts.map +1 -0
- package/dist/commands/share.js +260 -0
- package/dist/commands/share.js.map +1 -0
- package/dist/commands/show.d.ts +10 -0
- package/dist/commands/show.d.ts.map +1 -0
- package/dist/commands/show.js +167 -0
- package/dist/commands/show.js.map +1 -0
- package/dist/commands/stacks.d.ts +51 -0
- package/dist/commands/stacks.d.ts.map +1 -0
- package/dist/commands/stacks.js +180 -0
- package/dist/commands/stacks.js.map +1 -0
- package/dist/commands/status.d.ts +13 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +158 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/sync.d.ts +11 -0
- package/dist/commands/sync.d.ts.map +1 -0
- package/dist/commands/sync.js +300 -0
- package/dist/commands/sync.js.map +1 -0
- package/dist/commands/todo.d.ts +14 -0
- package/dist/commands/todo.d.ts.map +1 -0
- package/dist/commands/todo.js +279 -0
- package/dist/commands/todo.js.map +1 -0
- package/dist/commands/trust.d.ts +33 -0
- package/dist/commands/trust.d.ts.map +1 -0
- package/dist/commands/trust.js +316 -0
- package/dist/commands/trust.js.map +1 -0
- package/dist/commands/validate.d.ts +11 -0
- package/dist/commands/validate.d.ts.map +1 -0
- package/dist/commands/validate.js +100 -0
- package/dist/commands/validate.js.map +1 -0
- package/dist/commands/verify.d.ts +36 -0
- package/dist/commands/verify.d.ts.map +1 -0
- package/dist/commands/verify.js +194 -0
- package/dist/commands/verify.js.map +1 -0
- package/dist/commands/version.d.ts +5 -0
- package/dist/commands/version.d.ts.map +1 -0
- package/dist/commands/version.js +33 -0
- package/dist/commands/version.js.map +1 -0
- package/dist/commands/vibe.d.ts +7 -0
- package/dist/commands/vibe.d.ts.map +1 -0
- package/dist/commands/vibe.js +78 -0
- package/dist/commands/vibe.js.map +1 -0
- package/dist/converters/faf-converters.d.ts +43 -0
- package/dist/converters/faf-converters.d.ts.map +1 -0
- package/dist/converters/faf-converters.js +186 -0
- package/dist/converters/faf-converters.js.map +1 -0
- package/dist/engine-bridge.d.ts +35 -0
- package/dist/engine-bridge.d.ts.map +1 -0
- package/dist/engine-bridge.js +76 -0
- package/dist/engine-bridge.js.map +1 -0
- package/dist/engines/claude-todo-engine.d.ts +115 -0
- package/dist/engines/claude-todo-engine.d.ts.map +1 -0
- package/dist/engines/claude-todo-engine.js +346 -0
- package/dist/engines/claude-todo-engine.js.map +1 -0
- package/dist/engines/drop-coach.d.ts +64 -0
- package/dist/engines/drop-coach.d.ts.map +1 -0
- package/dist/engines/drop-coach.js +222 -0
- package/dist/engines/drop-coach.js.map +1 -0
- package/dist/engines/fab-formats-processor.d.ts +167 -0
- package/dist/engines/fab-formats-processor.d.ts.map +1 -0
- package/dist/engines/fab-formats-processor.js +1274 -0
- package/dist/engines/fab-formats-processor.js.map +1 -0
- package/dist/engines/faf-dna.d.ts +160 -0
- package/dist/engines/faf-dna.d.ts.map +1 -0
- package/dist/engines/faf-dna.js +522 -0
- package/dist/engines/faf-dna.js.map +1 -0
- package/dist/engines/relentless-context-extractor.d.ts +101 -0
- package/dist/engines/relentless-context-extractor.d.ts.map +1 -0
- package/dist/engines/relentless-context-extractor.js +625 -0
- package/dist/engines/relentless-context-extractor.js.map +1 -0
- package/dist/fix-once/colors.d.ts +83 -0
- package/dist/fix-once/colors.d.ts.map +1 -0
- package/dist/fix-once/colors.js +145 -0
- package/dist/fix-once/colors.js.map +1 -0
- package/dist/fix-once/types.d.ts +258 -0
- package/dist/fix-once/types.d.ts.map +1 -0
- package/dist/fix-once/types.js +26 -0
- package/dist/fix-once/types.js.map +1 -0
- package/dist/framework-detector.d.ts +286 -0
- package/dist/framework-detector.d.ts.map +1 -0
- package/dist/framework-detector.js +782 -0
- package/dist/framework-detector.js.map +1 -0
- package/dist/generators/faf-generator-championship.d.ts +11 -0
- package/dist/generators/faf-generator-championship.d.ts.map +1 -0
- package/dist/generators/faf-generator-championship.js +371 -0
- package/dist/generators/faf-generator-championship.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +34 -0
- package/dist/index.js.map +1 -0
- package/dist/output/experience-manager.d.ts +58 -0
- package/dist/output/experience-manager.d.ts.map +1 -0
- package/dist/output/experience-manager.js +212 -0
- package/dist/output/experience-manager.js.map +1 -0
- package/dist/schema/faf-schema.d.ts +92 -0
- package/dist/schema/faf-schema.d.ts.map +1 -0
- package/dist/schema/faf-schema.js +173 -0
- package/dist/schema/faf-schema.js.map +1 -0
- package/dist/scoring/championship-scorer.d.ts +114 -0
- package/dist/scoring/championship-scorer.d.ts.map +1 -0
- package/dist/scoring/championship-scorer.js +380 -0
- package/dist/scoring/championship-scorer.js.map +1 -0
- package/dist/scoring/score-calculator.d.ts +29 -0
- package/dist/scoring/score-calculator.d.ts.map +1 -0
- package/dist/scoring/score-calculator.js +520 -0
- package/dist/scoring/score-calculator.js.map +1 -0
- package/dist/telemetry/analytics.d.ts +74 -0
- package/dist/telemetry/analytics.d.ts.map +1 -0
- package/dist/telemetry/analytics.js +370 -0
- package/dist/telemetry/analytics.js.map +1 -0
- package/dist/utils/balance-visualizer.d.ts +38 -0
- package/dist/utils/balance-visualizer.d.ts.map +1 -0
- package/dist/utils/balance-visualizer.js +196 -0
- package/dist/utils/balance-visualizer.js.map +1 -0
- package/dist/utils/championship-style.d.ts +110 -0
- package/dist/utils/championship-style.d.ts.map +1 -0
- package/dist/utils/championship-style.js +213 -0
- package/dist/utils/championship-style.js.map +1 -0
- package/dist/utils/color-utils.d.ts +17 -0
- package/dist/utils/color-utils.d.ts.map +1 -0
- package/dist/utils/color-utils.js +96 -0
- package/dist/utils/color-utils.js.map +1 -0
- package/dist/utils/fab-formats-engine.d.ts +76 -0
- package/dist/utils/fab-formats-engine.d.ts.map +1 -0
- package/dist/utils/fab-formats-engine.js +424 -0
- package/dist/utils/fab-formats-engine.js.map +1 -0
- package/dist/utils/fafignore-parser.d.ts +21 -0
- package/dist/utils/fafignore-parser.d.ts.map +1 -0
- package/dist/utils/fafignore-parser.js +178 -0
- package/dist/utils/fafignore-parser.js.map +1 -0
- package/dist/utils/file-utils.d.ts +65 -0
- package/dist/utils/file-utils.d.ts.map +1 -0
- package/dist/utils/file-utils.js +598 -0
- package/dist/utils/file-utils.js.map +1 -0
- package/dist/utils/platform-detector.d.ts +31 -0
- package/dist/utils/platform-detector.d.ts.map +1 -0
- package/dist/utils/platform-detector.js +218 -0
- package/dist/utils/platform-detector.js.map +1 -0
- package/dist/utils/technical-credit.d.ts +36 -0
- package/dist/utils/technical-credit.d.ts.map +1 -0
- package/dist/utils/technical-credit.js +286 -0
- package/dist/utils/technical-credit.js.map +1 -0
- package/dist/utils/trust-cache.d.ts +29 -0
- package/dist/utils/trust-cache.d.ts.map +1 -0
- package/dist/utils/trust-cache.js +123 -0
- package/dist/utils/trust-cache.js.map +1 -0
- package/dist/utils/turbo-cat-knowledge.d.ts +82 -0
- package/dist/utils/turbo-cat-knowledge.d.ts.map +1 -0
- package/dist/utils/turbo-cat-knowledge.js +1346 -0
- package/dist/utils/turbo-cat-knowledge.js.map +1 -0
- package/dist/utils/turbo-cat-pyramid.d.ts +38 -0
- package/dist/utils/turbo-cat-pyramid.d.ts.map +1 -0
- package/dist/utils/turbo-cat-pyramid.js +287 -0
- package/dist/utils/turbo-cat-pyramid.js.map +1 -0
- package/dist/utils/turbo-cat.d.ts +92 -0
- package/dist/utils/turbo-cat.d.ts.map +1 -0
- package/dist/utils/turbo-cat.js +412 -0
- package/dist/utils/turbo-cat.js.map +1 -0
- package/dist/utils/vibe-sync.d.ts +25 -0
- package/dist/utils/vibe-sync.d.ts.map +1 -0
- package/dist/utils/vibe-sync.js +169 -0
- package/dist/utils/vibe-sync.js.map +1 -0
- package/dist/utils/yaml-generator.d.ts +39 -0
- package/dist/utils/yaml-generator.d.ts.map +1 -0
- package/dist/utils/yaml-generator.js +345 -0
- package/dist/utils/yaml-generator.js.map +1 -0
- package/package.json +96 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 📁 File Utilities
|
|
3
|
+
* Helper functions for finding and working with .faf files
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Find .faf file in current directory or parent directories
|
|
7
|
+
*/
|
|
8
|
+
export declare function findFafFile(startDir?: string): Promise<string | null>;
|
|
9
|
+
/**
|
|
10
|
+
* Check if file exists and is readable
|
|
11
|
+
*/
|
|
12
|
+
export declare function fileExists(filePath: string): Promise<boolean>;
|
|
13
|
+
/**
|
|
14
|
+
* Get file modification time
|
|
15
|
+
*/
|
|
16
|
+
export declare function getFileModTime(filePath: string): Promise<Date | null>;
|
|
17
|
+
/**
|
|
18
|
+
* Find package.json in project
|
|
19
|
+
*/
|
|
20
|
+
export declare function findPackageJson(startDir?: string): Promise<string | null>;
|
|
21
|
+
/**
|
|
22
|
+
* Find pyproject.toml in project (Python Poetry/PEP 518)
|
|
23
|
+
*/
|
|
24
|
+
export declare function findPyprojectToml(startDir?: string): Promise<string | null>;
|
|
25
|
+
/**
|
|
26
|
+
* Find requirements.txt in project (Python pip)
|
|
27
|
+
*/
|
|
28
|
+
export declare function findRequirementsTxt(startDir?: string): Promise<string | null>;
|
|
29
|
+
/**
|
|
30
|
+
* Find tsconfig.json in project (TypeScript)
|
|
31
|
+
*/
|
|
32
|
+
export declare function findTsConfig(startDir?: string): Promise<string | null>;
|
|
33
|
+
/**
|
|
34
|
+
* Analyze tsconfig.json for F1-Inspired TypeScript intelligence
|
|
35
|
+
*/
|
|
36
|
+
export declare function analyzeTsConfig(filePath: string): Promise<TypeScriptContext | null>;
|
|
37
|
+
export interface TypeScriptContext {
|
|
38
|
+
target: string;
|
|
39
|
+
module: string;
|
|
40
|
+
moduleResolution: string;
|
|
41
|
+
strict: boolean;
|
|
42
|
+
strictnessLevel: "basic" | "strict" | "ultra_strict" | "f1_inspired";
|
|
43
|
+
frameworkIntegration: string;
|
|
44
|
+
performanceOptimizations: string[];
|
|
45
|
+
includes: string[];
|
|
46
|
+
excludes: string[];
|
|
47
|
+
engineeringQuality: "standard" | "professional" | "f1_inspired";
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Detect project type from files and structure
|
|
51
|
+
*/
|
|
52
|
+
export declare function detectProjectType(projectDir?: string): Promise<string>;
|
|
53
|
+
/**
|
|
54
|
+
* Calculate days since file was modified
|
|
55
|
+
*/
|
|
56
|
+
export declare function daysSinceModified(date: Date): number;
|
|
57
|
+
/**
|
|
58
|
+
* Detect Python project type using dependency files (Option A)
|
|
59
|
+
*/
|
|
60
|
+
export declare function detectPythonProjectType(projectDir: string): Promise<string>;
|
|
61
|
+
/**
|
|
62
|
+
* Detect Python frameworks using code patterns (Option B)
|
|
63
|
+
*/
|
|
64
|
+
export declare function detectPythonPatterns(projectDir: string, pythonFiles: string[]): Promise<string>;
|
|
65
|
+
//# sourceMappingURL=file-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-utils.d.ts","sourceRoot":"","sources":["../../src/utils/file-utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH;;GAEG;AACH,wBAAsB,WAAW,CAC/B,QAAQ,GAAE,MAAsB,GAC/B,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CA+DxB;AAED;;GAEG;AACH,wBAAsB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAOnE;AAED;;GAEG;AACH,wBAAsB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,CAO3E;AAED;;GAEG;AACH,wBAAsB,eAAe,CACnC,QAAQ,GAAE,MAAsB,GAC/B,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAcxB;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CACrC,QAAQ,GAAE,MAAsB,GAC/B,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAcxB;AAED;;GAEG;AACH,wBAAsB,mBAAmB,CACvC,QAAQ,GAAE,MAAsB,GAC/B,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAcxB;AAED;;GAEG;AACH,wBAAsB,YAAY,CAChC,QAAQ,GAAE,MAAsB,GAC/B,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAcxB;AAED;;GAEG;AACH,wBAAsB,eAAe,CACnC,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAiCnC;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,EAAE,MAAM,CAAC;IACzB,MAAM,EAAE,OAAO,CAAC;IAChB,eAAe,EAAE,OAAO,GAAG,QAAQ,GAAG,cAAc,GAAG,aAAa,CAAC;IACrE,oBAAoB,EAAE,MAAM,CAAC;IAC7B,wBAAwB,EAAE,MAAM,EAAE,CAAC;IACnC,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,kBAAkB,EAAE,UAAU,GAAG,cAAc,GAAG,aAAa,CAAC;CACjE;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CACrC,UAAU,GAAE,MAAsB,GACjC,OAAO,CAAC,MAAM,CAAC,CAqGjB;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAIpD;AAED;;GAEG;AACH,wBAAsB,uBAAuB,CAC3C,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,MAAM,CAAC,CAejB;AA+CD;;GAEG;AACH,wBAAsB,oBAAoB,CACxC,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EAAE,GACpB,OAAO,CAAC,MAAM,CAAC,CAwDjB"}
|
|
@@ -0,0 +1,598 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* 📁 File Utilities
|
|
4
|
+
* Helper functions for finding and working with .faf files
|
|
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.findFafFile = findFafFile;
|
|
11
|
+
exports.fileExists = fileExists;
|
|
12
|
+
exports.getFileModTime = getFileModTime;
|
|
13
|
+
exports.findPackageJson = findPackageJson;
|
|
14
|
+
exports.findPyprojectToml = findPyprojectToml;
|
|
15
|
+
exports.findRequirementsTxt = findRequirementsTxt;
|
|
16
|
+
exports.findTsConfig = findTsConfig;
|
|
17
|
+
exports.analyzeTsConfig = analyzeTsConfig;
|
|
18
|
+
exports.detectProjectType = detectProjectType;
|
|
19
|
+
exports.daysSinceModified = daysSinceModified;
|
|
20
|
+
exports.detectPythonProjectType = detectPythonProjectType;
|
|
21
|
+
exports.detectPythonPatterns = detectPythonPatterns;
|
|
22
|
+
const fs_1 = require("fs");
|
|
23
|
+
const path_1 = __importDefault(require("path"));
|
|
24
|
+
const glob_1 = require("glob");
|
|
25
|
+
const fafignore_parser_1 = require("./fafignore-parser");
|
|
26
|
+
/**
|
|
27
|
+
* Find .faf file in current directory or parent directories
|
|
28
|
+
*/
|
|
29
|
+
async function findFafFile(startDir = process.cwd()) {
|
|
30
|
+
let currentDir = path_1.default.resolve(startDir);
|
|
31
|
+
// Check up to 10 parent directories to avoid infinite loops
|
|
32
|
+
for (let i = 0; i < 10; i++) {
|
|
33
|
+
try {
|
|
34
|
+
// First, try simple fs.readdir approach
|
|
35
|
+
const files = await fs_1.promises.readdir(currentDir);
|
|
36
|
+
// Filter for EXACTLY .faf files (not .faf.backup, .fafignore, etc.)
|
|
37
|
+
const fafFiles = files.filter((file) => {
|
|
38
|
+
// Must be exactly '.faf' or match pattern like 'project.faf'
|
|
39
|
+
// Exclude: .faf.backup*, .fafignore, faf-*, etc.
|
|
40
|
+
const isExactFaf = file === '.faf';
|
|
41
|
+
const isNamedFaf = file.match(/^[^.]+\.faf$/) !== null; // like 'project.faf'
|
|
42
|
+
const isNotBackup = !file.includes('.faf.');
|
|
43
|
+
const isNotFafIgnore = file !== '.fafignore';
|
|
44
|
+
return (isExactFaf || isNamedFaf) && isNotBackup && isNotFafIgnore;
|
|
45
|
+
});
|
|
46
|
+
if (fafFiles.length > 0) {
|
|
47
|
+
// Sort to prioritize .faf over named files like project.faf
|
|
48
|
+
const sortedFafFiles = fafFiles.sort((a, b) => {
|
|
49
|
+
if (a === '.faf') {
|
|
50
|
+
return -1;
|
|
51
|
+
} // .faf comes first
|
|
52
|
+
if (b === '.faf') {
|
|
53
|
+
return 1;
|
|
54
|
+
} // .faf comes first
|
|
55
|
+
return a.localeCompare(b); // alphabetical otherwise
|
|
56
|
+
});
|
|
57
|
+
// Check all matching files, not just the first one
|
|
58
|
+
// This handles cases where .faf directory exists alongside project.faf file
|
|
59
|
+
for (const fafFile of sortedFafFiles) {
|
|
60
|
+
const fafPath = path_1.default.join(currentDir, fafFile);
|
|
61
|
+
// Verify it's a file (not directory) and readable
|
|
62
|
+
try {
|
|
63
|
+
const stats = await fs_1.promises.stat(fafPath);
|
|
64
|
+
if (stats.isFile() && await fileExists(fafPath)) {
|
|
65
|
+
return fafPath;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
catch {
|
|
69
|
+
// Skip if stat fails, continue to next file
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
// Move to parent directory
|
|
74
|
+
const parentDir = path_1.default.dirname(currentDir);
|
|
75
|
+
if (parentDir === currentDir) {
|
|
76
|
+
// Reached filesystem root
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
79
|
+
currentDir = parentDir;
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
// Skip this directory if we can't read it
|
|
83
|
+
const parentDir = path_1.default.dirname(currentDir);
|
|
84
|
+
if (parentDir === currentDir) {
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
currentDir = parentDir;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Check if file exists and is readable
|
|
94
|
+
*/
|
|
95
|
+
async function fileExists(filePath) {
|
|
96
|
+
try {
|
|
97
|
+
await fs_1.promises.access(filePath, fs_1.promises.constants.F_OK | fs_1.promises.constants.R_OK);
|
|
98
|
+
return true;
|
|
99
|
+
}
|
|
100
|
+
catch {
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Get file modification time
|
|
106
|
+
*/
|
|
107
|
+
async function getFileModTime(filePath) {
|
|
108
|
+
try {
|
|
109
|
+
const stats = await fs_1.promises.stat(filePath);
|
|
110
|
+
return stats.mtime;
|
|
111
|
+
}
|
|
112
|
+
catch {
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Find package.json in project
|
|
118
|
+
*/
|
|
119
|
+
async function findPackageJson(startDir = process.cwd()) {
|
|
120
|
+
let currentDir = path_1.default.resolve(startDir); // Fix: resolve to absolute path
|
|
121
|
+
while (currentDir !== path_1.default.dirname(currentDir)) {
|
|
122
|
+
const packagePath = path_1.default.join(currentDir, "package.json");
|
|
123
|
+
if (await fileExists(packagePath)) {
|
|
124
|
+
return packagePath;
|
|
125
|
+
}
|
|
126
|
+
currentDir = path_1.default.dirname(currentDir);
|
|
127
|
+
}
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Find pyproject.toml in project (Python Poetry/PEP 518)
|
|
132
|
+
*/
|
|
133
|
+
async function findPyprojectToml(startDir = process.cwd()) {
|
|
134
|
+
let currentDir = path_1.default.resolve(startDir); // Fix: resolve to absolute path
|
|
135
|
+
while (currentDir !== path_1.default.dirname(currentDir)) {
|
|
136
|
+
const pyprojectPath = path_1.default.join(currentDir, "pyproject.toml");
|
|
137
|
+
if (await fileExists(pyprojectPath)) {
|
|
138
|
+
return pyprojectPath;
|
|
139
|
+
}
|
|
140
|
+
currentDir = path_1.default.dirname(currentDir);
|
|
141
|
+
}
|
|
142
|
+
return null;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Find requirements.txt in project (Python pip)
|
|
146
|
+
*/
|
|
147
|
+
async function findRequirementsTxt(startDir = process.cwd()) {
|
|
148
|
+
let currentDir = path_1.default.resolve(startDir); // Fix: resolve to absolute path
|
|
149
|
+
while (currentDir !== path_1.default.dirname(currentDir)) {
|
|
150
|
+
const requirementsPath = path_1.default.join(currentDir, "requirements.txt");
|
|
151
|
+
if (await fileExists(requirementsPath)) {
|
|
152
|
+
return requirementsPath;
|
|
153
|
+
}
|
|
154
|
+
currentDir = path_1.default.dirname(currentDir);
|
|
155
|
+
}
|
|
156
|
+
return null;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Find tsconfig.json in project (TypeScript)
|
|
160
|
+
*/
|
|
161
|
+
async function findTsConfig(startDir = process.cwd()) {
|
|
162
|
+
let currentDir = path_1.default.resolve(startDir); // Fix: resolve to absolute path
|
|
163
|
+
while (currentDir !== path_1.default.dirname(currentDir)) {
|
|
164
|
+
const tsconfigPath = path_1.default.join(currentDir, "tsconfig.json");
|
|
165
|
+
if (await fileExists(tsconfigPath)) {
|
|
166
|
+
return tsconfigPath;
|
|
167
|
+
}
|
|
168
|
+
currentDir = path_1.default.dirname(currentDir);
|
|
169
|
+
}
|
|
170
|
+
return null;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Analyze tsconfig.json for F1-Inspired TypeScript intelligence
|
|
174
|
+
*/
|
|
175
|
+
async function analyzeTsConfig(filePath) {
|
|
176
|
+
try {
|
|
177
|
+
const content = await fs_1.promises.readFile(filePath, "utf-8");
|
|
178
|
+
// Strip comments from JSON (tsconfig.json often has comments)
|
|
179
|
+
const cleanedContent = content
|
|
180
|
+
.replace(/\/\*[\s\S]*?\*\//g, "") // Remove /* */ comments
|
|
181
|
+
.replace(/\/\/.*$/gm, ""); // Remove // comments
|
|
182
|
+
const config = JSON.parse(cleanedContent);
|
|
183
|
+
const compilerOptions = config.compilerOptions || {};
|
|
184
|
+
// Detect F1-Inspired engineering quality
|
|
185
|
+
const strictnessLevel = calculateStrictnessLevel(compilerOptions);
|
|
186
|
+
const frameworkIntegration = detectFrameworkIntegration(compilerOptions, config);
|
|
187
|
+
const performanceOptimizations = detectPerformanceConfig(compilerOptions);
|
|
188
|
+
return {
|
|
189
|
+
target: compilerOptions.target || "ES5",
|
|
190
|
+
module: compilerOptions.module || "CommonJS",
|
|
191
|
+
moduleResolution: compilerOptions.moduleResolution || "node",
|
|
192
|
+
strict: compilerOptions.strict || false,
|
|
193
|
+
strictnessLevel,
|
|
194
|
+
frameworkIntegration,
|
|
195
|
+
performanceOptimizations,
|
|
196
|
+
includes: config.include || [],
|
|
197
|
+
excludes: config.exclude || [],
|
|
198
|
+
engineeringQuality: assessEngineeringQuality(compilerOptions),
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
catch {
|
|
202
|
+
return null;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Detect project type from files and structure
|
|
207
|
+
*/
|
|
208
|
+
async function detectProjectType(projectDir = process.cwd()) {
|
|
209
|
+
// Python detection first (Option A: Dependency-based)
|
|
210
|
+
const pythonType = await detectPythonProjectType(projectDir);
|
|
211
|
+
if (pythonType !== "latest-idea") {
|
|
212
|
+
return pythonType;
|
|
213
|
+
}
|
|
214
|
+
// TypeScript detection - only check current directory for tsconfig.json
|
|
215
|
+
const tsconfigPath = path_1.default.join(projectDir, "tsconfig.json");
|
|
216
|
+
let hasTypeScript = false;
|
|
217
|
+
if (await fileExists(tsconfigPath)) {
|
|
218
|
+
hasTypeScript = true;
|
|
219
|
+
}
|
|
220
|
+
// JavaScript/TypeScript detection (existing logic)
|
|
221
|
+
const packageJsonPath = path_1.default.join(projectDir, "package.json");
|
|
222
|
+
if (await fileExists(packageJsonPath)) {
|
|
223
|
+
try {
|
|
224
|
+
const packageContent = await fs_1.promises.readFile(packageJsonPath, "utf-8");
|
|
225
|
+
const packageData = JSON.parse(packageContent);
|
|
226
|
+
// Check dependencies for framework indicators
|
|
227
|
+
const deps = {
|
|
228
|
+
...packageData.dependencies,
|
|
229
|
+
...packageData.devDependencies,
|
|
230
|
+
};
|
|
231
|
+
// Detect TypeScript in dependencies
|
|
232
|
+
if (deps.typescript ||
|
|
233
|
+
deps["@types/node"] ||
|
|
234
|
+
Object.keys(deps).some((dep) => dep.startsWith("@types/"))) {
|
|
235
|
+
hasTypeScript = true;
|
|
236
|
+
}
|
|
237
|
+
// Framework detection with TypeScript awareness
|
|
238
|
+
if (deps.svelte || deps["@sveltejs/kit"]) {
|
|
239
|
+
return hasTypeScript ? "svelte-ts" : "svelte";
|
|
240
|
+
}
|
|
241
|
+
if (deps.react || deps["react-dom"]) {
|
|
242
|
+
return hasTypeScript ? "react-ts" : "react";
|
|
243
|
+
}
|
|
244
|
+
if (deps.vue || deps["@vue/core"]) {
|
|
245
|
+
return hasTypeScript ? "vue-ts" : "vue";
|
|
246
|
+
}
|
|
247
|
+
if (deps.angular || deps["@angular/core"]) {
|
|
248
|
+
return "angular";
|
|
249
|
+
} // Angular is TS by default
|
|
250
|
+
if (deps.express || deps.fastify) {
|
|
251
|
+
return hasTypeScript ? "node-api-ts" : "node-api";
|
|
252
|
+
}
|
|
253
|
+
if (deps.next || deps.nuxt) {
|
|
254
|
+
return hasTypeScript ? "fullstack-ts" : "fullstack";
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
catch {
|
|
258
|
+
// Continue with file-based detection
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
// Get ignore patterns from .fafignore
|
|
262
|
+
const ignorePatterns = await (0, fafignore_parser_1.parseFafIgnore)(projectDir);
|
|
263
|
+
// File-based detection
|
|
264
|
+
const files = await new Promise((resolve, reject) => {
|
|
265
|
+
(0, glob_1.glob)("**/*.{svelte,jsx,tsx,vue,ts,js,py}", {
|
|
266
|
+
cwd: projectDir,
|
|
267
|
+
ignore: ignorePatterns.filter((p) => !p.startsWith("*.")), // glob doesn't like *.ext patterns
|
|
268
|
+
}, (err, matches) => {
|
|
269
|
+
if (err) {
|
|
270
|
+
reject(err);
|
|
271
|
+
}
|
|
272
|
+
else {
|
|
273
|
+
resolve(matches);
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
});
|
|
277
|
+
// Python pattern detection (Option B)
|
|
278
|
+
if (files.some((f) => f.endsWith(".py"))) {
|
|
279
|
+
const pythonPatternType = await detectPythonPatterns(projectDir, files.filter((f) => f.endsWith(".py")));
|
|
280
|
+
if (pythonPatternType !== "python-generic") {
|
|
281
|
+
return pythonPatternType;
|
|
282
|
+
}
|
|
283
|
+
return "python-generic";
|
|
284
|
+
}
|
|
285
|
+
// TypeScript file detection
|
|
286
|
+
if (files.some((f) => f.endsWith(".ts") && !f.endsWith(".d.ts"))) {
|
|
287
|
+
hasTypeScript = true;
|
|
288
|
+
}
|
|
289
|
+
if (files.some((f) => f.endsWith(".svelte"))) {
|
|
290
|
+
return hasTypeScript ? "svelte-ts" : "svelte";
|
|
291
|
+
}
|
|
292
|
+
if (files.some((f) => f.endsWith(".jsx") || f.endsWith(".tsx"))) {
|
|
293
|
+
return hasTypeScript ? "react-ts" : "react";
|
|
294
|
+
}
|
|
295
|
+
if (files.some((f) => f.endsWith(".vue"))) {
|
|
296
|
+
return hasTypeScript ? "vue-ts" : "vue";
|
|
297
|
+
}
|
|
298
|
+
// Pure TypeScript project detection
|
|
299
|
+
if (hasTypeScript) {
|
|
300
|
+
return "typescript";
|
|
301
|
+
}
|
|
302
|
+
return "latest-idea";
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Calculate days since file was modified
|
|
306
|
+
*/
|
|
307
|
+
function daysSinceModified(date) {
|
|
308
|
+
const now = new Date();
|
|
309
|
+
const diffTime = Math.abs(now.getTime() - date.getTime());
|
|
310
|
+
return Math.ceil(diffTime / (1000 * 60 * 60 * 24));
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* Detect Python project type using dependency files (Option A)
|
|
314
|
+
*/
|
|
315
|
+
async function detectPythonProjectType(projectDir) {
|
|
316
|
+
// Priority order: pyproject.toml > requirements.txt
|
|
317
|
+
const pyprojectPath = await findPyprojectToml(projectDir);
|
|
318
|
+
if (pyprojectPath) {
|
|
319
|
+
const framework = await analyzePyprojectToml(pyprojectPath);
|
|
320
|
+
if (framework) {
|
|
321
|
+
return framework;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
const requirementsPath = await findRequirementsTxt(projectDir);
|
|
325
|
+
if (requirementsPath) {
|
|
326
|
+
const framework = await analyzeRequirementsTxt(requirementsPath);
|
|
327
|
+
if (framework) {
|
|
328
|
+
return framework;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
return "latest-idea";
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* Analyze pyproject.toml for Python frameworks
|
|
335
|
+
*/
|
|
336
|
+
async function analyzePyprojectToml(filePath) {
|
|
337
|
+
try {
|
|
338
|
+
const content = await fs_1.promises.readFile(filePath, "utf-8");
|
|
339
|
+
// Simple string-based detection for now (could use TOML parser later)
|
|
340
|
+
if (content.includes("fastapi")) {
|
|
341
|
+
return "python-fastapi";
|
|
342
|
+
}
|
|
343
|
+
if (content.includes("django")) {
|
|
344
|
+
return "python-django";
|
|
345
|
+
}
|
|
346
|
+
if (content.includes("flask")) {
|
|
347
|
+
return "python-flask";
|
|
348
|
+
}
|
|
349
|
+
if (content.includes("starlette")) {
|
|
350
|
+
return "python-starlette";
|
|
351
|
+
}
|
|
352
|
+
// If it has Python dependencies but no specific framework
|
|
353
|
+
if (content.includes("python = ")) {
|
|
354
|
+
return "python-generic";
|
|
355
|
+
}
|
|
356
|
+
return null;
|
|
357
|
+
}
|
|
358
|
+
catch {
|
|
359
|
+
return null;
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Analyze requirements.txt for Python frameworks
|
|
364
|
+
*/
|
|
365
|
+
async function analyzeRequirementsTxt(filePath) {
|
|
366
|
+
try {
|
|
367
|
+
const content = await fs_1.promises.readFile(filePath, "utf-8");
|
|
368
|
+
if (content.includes("fastapi")) {
|
|
369
|
+
return "python-fastapi";
|
|
370
|
+
}
|
|
371
|
+
if (content.includes("django")) {
|
|
372
|
+
return "python-django";
|
|
373
|
+
}
|
|
374
|
+
if (content.includes("flask")) {
|
|
375
|
+
return "python-flask";
|
|
376
|
+
}
|
|
377
|
+
if (content.includes("starlette")) {
|
|
378
|
+
return "python-starlette";
|
|
379
|
+
}
|
|
380
|
+
// Any Python packages detected
|
|
381
|
+
if (content.trim().length > 0) {
|
|
382
|
+
return "python-generic";
|
|
383
|
+
}
|
|
384
|
+
return null;
|
|
385
|
+
}
|
|
386
|
+
catch {
|
|
387
|
+
return null;
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
/**
|
|
391
|
+
* Detect Python frameworks using code patterns (Option B)
|
|
392
|
+
*/
|
|
393
|
+
async function detectPythonPatterns(projectDir, pythonFiles) {
|
|
394
|
+
try {
|
|
395
|
+
// Check main Python files first (main.py, app.py, api.py)
|
|
396
|
+
const mainFiles = pythonFiles.filter((f) => f.includes("main.py") || f.includes("app.py") || f.includes("api.py"));
|
|
397
|
+
const filesToCheck = mainFiles.length > 0 ? mainFiles : pythonFiles.slice(0, 5);
|
|
398
|
+
for (const file of filesToCheck) {
|
|
399
|
+
const filePath = path_1.default.join(projectDir, file);
|
|
400
|
+
try {
|
|
401
|
+
const content = await fs_1.promises.readFile(filePath, "utf-8");
|
|
402
|
+
// FastAPI patterns
|
|
403
|
+
if (content.includes("from fastapi import") ||
|
|
404
|
+
content.includes("FastAPI()")) {
|
|
405
|
+
return "python-fastapi";
|
|
406
|
+
}
|
|
407
|
+
// Django patterns
|
|
408
|
+
if (content.includes("from django.") ||
|
|
409
|
+
content.includes("django.http")) {
|
|
410
|
+
return "python-django";
|
|
411
|
+
}
|
|
412
|
+
// Flask patterns
|
|
413
|
+
if (content.includes("from flask import") ||
|
|
414
|
+
content.includes("Flask(")) {
|
|
415
|
+
return "python-flask";
|
|
416
|
+
}
|
|
417
|
+
// Starlette patterns
|
|
418
|
+
if (content.includes("from starlette.") ||
|
|
419
|
+
content.includes("Starlette(")) {
|
|
420
|
+
return "python-starlette";
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
catch {
|
|
424
|
+
continue;
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
return "python-generic";
|
|
428
|
+
}
|
|
429
|
+
catch {
|
|
430
|
+
return "python-generic";
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
/**
|
|
434
|
+
* Calculate TypeScript strictness level for F1-Inspired quality assessment
|
|
435
|
+
*/
|
|
436
|
+
function calculateStrictnessLevel(compilerOptions) {
|
|
437
|
+
let strictnessScore = 0;
|
|
438
|
+
// Basic strictness
|
|
439
|
+
if (compilerOptions.strict) {
|
|
440
|
+
strictnessScore += 2;
|
|
441
|
+
}
|
|
442
|
+
if (compilerOptions.noImplicitAny) {
|
|
443
|
+
strictnessScore += 1;
|
|
444
|
+
}
|
|
445
|
+
if (compilerOptions.strictNullChecks) {
|
|
446
|
+
strictnessScore += 1;
|
|
447
|
+
}
|
|
448
|
+
// Advanced strictness
|
|
449
|
+
if (compilerOptions.exactOptionalPropertyTypes) {
|
|
450
|
+
strictnessScore += 2;
|
|
451
|
+
}
|
|
452
|
+
if (compilerOptions.noUncheckedIndexedAccess) {
|
|
453
|
+
strictnessScore += 2;
|
|
454
|
+
}
|
|
455
|
+
if (compilerOptions.noImplicitReturns) {
|
|
456
|
+
strictnessScore += 1;
|
|
457
|
+
}
|
|
458
|
+
if (compilerOptions.noFallthroughCasesInSwitch) {
|
|
459
|
+
strictnessScore += 1;
|
|
460
|
+
}
|
|
461
|
+
if (compilerOptions.noUnusedLocals) {
|
|
462
|
+
strictnessScore += 1;
|
|
463
|
+
}
|
|
464
|
+
if (compilerOptions.noUnusedParameters) {
|
|
465
|
+
strictnessScore += 1;
|
|
466
|
+
}
|
|
467
|
+
// F1-Inspired ultra-strict
|
|
468
|
+
if (compilerOptions.allowUnreachableCode === false) {
|
|
469
|
+
strictnessScore += 1;
|
|
470
|
+
}
|
|
471
|
+
if (compilerOptions.allowUnusedLabels === false) {
|
|
472
|
+
strictnessScore += 1;
|
|
473
|
+
}
|
|
474
|
+
if (compilerOptions.noPropertyAccessFromIndexSignature) {
|
|
475
|
+
strictnessScore += 1;
|
|
476
|
+
}
|
|
477
|
+
if (compilerOptions.verbatimModuleSyntax) {
|
|
478
|
+
strictnessScore += 1;
|
|
479
|
+
}
|
|
480
|
+
if (strictnessScore >= 12) {
|
|
481
|
+
return "f1_inspired";
|
|
482
|
+
}
|
|
483
|
+
if (strictnessScore >= 8) {
|
|
484
|
+
return "ultra_strict";
|
|
485
|
+
}
|
|
486
|
+
if (strictnessScore >= 4) {
|
|
487
|
+
return "strict";
|
|
488
|
+
}
|
|
489
|
+
return "basic";
|
|
490
|
+
}
|
|
491
|
+
/**
|
|
492
|
+
* Detect framework integration patterns
|
|
493
|
+
*/
|
|
494
|
+
function detectFrameworkIntegration(compilerOptions, config) {
|
|
495
|
+
const includes = config.include || [];
|
|
496
|
+
const includesStr = includes.join(" ");
|
|
497
|
+
// Svelte detection
|
|
498
|
+
if (includesStr.includes("svelte") || config.extends?.includes("svelte")) {
|
|
499
|
+
if (compilerOptions.verbatimModuleSyntax) {
|
|
500
|
+
return "svelte_5_runes_native";
|
|
501
|
+
}
|
|
502
|
+
return "svelte_native";
|
|
503
|
+
}
|
|
504
|
+
// React detection
|
|
505
|
+
if (compilerOptions.jsx) {
|
|
506
|
+
if (compilerOptions.jsx === "react-jsx") {
|
|
507
|
+
return "react_17_native";
|
|
508
|
+
}
|
|
509
|
+
return "react_native";
|
|
510
|
+
}
|
|
511
|
+
// Next.js detection
|
|
512
|
+
if (config.extends?.includes("next")) {
|
|
513
|
+
return "nextjs_native";
|
|
514
|
+
}
|
|
515
|
+
// Vue detection
|
|
516
|
+
if (includesStr.includes("vue")) {
|
|
517
|
+
return "vue_native";
|
|
518
|
+
}
|
|
519
|
+
// Node.js detection
|
|
520
|
+
if (compilerOptions.moduleResolution === "NodeNext") {
|
|
521
|
+
return "nodejs_native";
|
|
522
|
+
}
|
|
523
|
+
if (compilerOptions.module === "NodeNext") {
|
|
524
|
+
return "nodejs_esm_native";
|
|
525
|
+
}
|
|
526
|
+
// Pure TypeScript project detection
|
|
527
|
+
if (compilerOptions.target &&
|
|
528
|
+
compilerOptions.module &&
|
|
529
|
+
!compilerOptions.jsx) {
|
|
530
|
+
return "pure_typescript";
|
|
531
|
+
}
|
|
532
|
+
return "standard";
|
|
533
|
+
}
|
|
534
|
+
/**
|
|
535
|
+
* Detect performance optimizations
|
|
536
|
+
*/
|
|
537
|
+
function detectPerformanceConfig(compilerOptions) {
|
|
538
|
+
const optimizations = [];
|
|
539
|
+
if (compilerOptions.target && compilerOptions.target.includes("2022")) {
|
|
540
|
+
optimizations.push("modern_target_es2022");
|
|
541
|
+
}
|
|
542
|
+
if (compilerOptions.moduleResolution === "NodeNext") {
|
|
543
|
+
optimizations.push("nodejs_native_modules");
|
|
544
|
+
}
|
|
545
|
+
if (compilerOptions.verbatimModuleSyntax) {
|
|
546
|
+
optimizations.push("verbatim_module_syntax");
|
|
547
|
+
}
|
|
548
|
+
if (compilerOptions.isolatedModules) {
|
|
549
|
+
optimizations.push("isolated_modules");
|
|
550
|
+
}
|
|
551
|
+
if (compilerOptions.skipLibCheck) {
|
|
552
|
+
optimizations.push("skip_lib_check");
|
|
553
|
+
}
|
|
554
|
+
if (compilerOptions.allowImportingTsExtensions) {
|
|
555
|
+
optimizations.push("ts_extension_imports");
|
|
556
|
+
}
|
|
557
|
+
return optimizations;
|
|
558
|
+
}
|
|
559
|
+
/**
|
|
560
|
+
* Assess overall engineering quality based on configuration
|
|
561
|
+
*/
|
|
562
|
+
function assessEngineeringQuality(compilerOptions) {
|
|
563
|
+
let qualityScore = 0;
|
|
564
|
+
// Quality indicators
|
|
565
|
+
if (compilerOptions.declaration) {
|
|
566
|
+
qualityScore += 1;
|
|
567
|
+
}
|
|
568
|
+
if (compilerOptions.declarationMap) {
|
|
569
|
+
qualityScore += 1;
|
|
570
|
+
}
|
|
571
|
+
if (compilerOptions.sourceMap) {
|
|
572
|
+
qualityScore += 1;
|
|
573
|
+
}
|
|
574
|
+
if (compilerOptions.forceConsistentCasingInFileNames) {
|
|
575
|
+
qualityScore += 1;
|
|
576
|
+
}
|
|
577
|
+
if (compilerOptions.removeComments === false) {
|
|
578
|
+
qualityScore += 1;
|
|
579
|
+
} // Keeping docs
|
|
580
|
+
// F1-Inspired indicators
|
|
581
|
+
if (compilerOptions.exactOptionalPropertyTypes) {
|
|
582
|
+
qualityScore += 2;
|
|
583
|
+
}
|
|
584
|
+
if (compilerOptions.noUncheckedIndexedAccess) {
|
|
585
|
+
qualityScore += 2;
|
|
586
|
+
}
|
|
587
|
+
if (compilerOptions.verbatimModuleSyntax) {
|
|
588
|
+
qualityScore += 2;
|
|
589
|
+
}
|
|
590
|
+
if (qualityScore >= 8) {
|
|
591
|
+
return "f1_inspired";
|
|
592
|
+
}
|
|
593
|
+
if (qualityScore >= 5) {
|
|
594
|
+
return "professional";
|
|
595
|
+
}
|
|
596
|
+
return "standard";
|
|
597
|
+
}
|
|
598
|
+
//# sourceMappingURL=file-utils.js.map
|