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,172 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* 🔥 YAML FIX-ONCE ABSTRACTION
|
|
4
|
+
*
|
|
5
|
+
* ROCK SOLID YAML PARSING - FIX ONCE, DONE FOREVER
|
|
6
|
+
*
|
|
7
|
+
* This module handles ALL YAML edge cases:
|
|
8
|
+
* ✅ Empty files
|
|
9
|
+
* ✅ Null/undefined content
|
|
10
|
+
* ✅ Invalid YAML syntax
|
|
11
|
+
* ✅ Type validation
|
|
12
|
+
* ✅ Corrupted files
|
|
13
|
+
* ✅ Clear error messages
|
|
14
|
+
* ✅ Primitive vs Object validation
|
|
15
|
+
*
|
|
16
|
+
* NEVER touch raw YAML parsing outside this file.
|
|
17
|
+
*/
|
|
18
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
19
|
+
if (k2 === undefined) k2 = k;
|
|
20
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
21
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
22
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
23
|
+
}
|
|
24
|
+
Object.defineProperty(o, k2, desc);
|
|
25
|
+
}) : (function(o, m, k, k2) {
|
|
26
|
+
if (k2 === undefined) k2 = k;
|
|
27
|
+
o[k2] = m[k];
|
|
28
|
+
}));
|
|
29
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
30
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
31
|
+
}) : function(o, v) {
|
|
32
|
+
o["default"] = v;
|
|
33
|
+
});
|
|
34
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
35
|
+
var ownKeys = function(o) {
|
|
36
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
37
|
+
var ar = [];
|
|
38
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
39
|
+
return ar;
|
|
40
|
+
};
|
|
41
|
+
return ownKeys(o);
|
|
42
|
+
};
|
|
43
|
+
return function (mod) {
|
|
44
|
+
if (mod && mod.__esModule) return mod;
|
|
45
|
+
var result = {};
|
|
46
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
47
|
+
__setModuleDefault(result, mod);
|
|
48
|
+
return result;
|
|
49
|
+
};
|
|
50
|
+
})();
|
|
51
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
52
|
+
exports.YAML = exports.Document = exports.parseDocument = void 0;
|
|
53
|
+
exports.parse = parse;
|
|
54
|
+
exports.stringify = stringify;
|
|
55
|
+
const yaml = __importStar(require("yaml"));
|
|
56
|
+
const colors_1 = require("./colors");
|
|
57
|
+
/**
|
|
58
|
+
* Safe YAML parse - handles ALL edge cases
|
|
59
|
+
* ROCK SOLID - FIX ONCE, DONE FOREVER
|
|
60
|
+
*/
|
|
61
|
+
function parse(content, options) {
|
|
62
|
+
const filepath = options?.filepath || 'unknown file';
|
|
63
|
+
// Edge case 1: Null/undefined (CHECK FIRST before any operations)
|
|
64
|
+
if (content === null || content === undefined) {
|
|
65
|
+
throw new Error(`${colors_1.chalk.red('Empty content passed to YAML parser')}\n` +
|
|
66
|
+
`File: ${filepath}\n` +
|
|
67
|
+
`Fix: Ensure file exists and has content before parsing`);
|
|
68
|
+
}
|
|
69
|
+
// Edge case 2: Not a string (CHECK BEFORE calling string methods)
|
|
70
|
+
if (typeof content !== 'string') {
|
|
71
|
+
throw new Error(`${colors_1.chalk.red('Invalid content type passed to YAML parser')}\n` +
|
|
72
|
+
`Expected: string\n` +
|
|
73
|
+
`Got: ${typeof content}\n` +
|
|
74
|
+
`File: ${filepath}`);
|
|
75
|
+
}
|
|
76
|
+
// Edge case 3: Empty string or whitespace only
|
|
77
|
+
if (content.trim() === '') {
|
|
78
|
+
throw new Error(`${colors_1.chalk.red('Empty .faf file detected')}\n` +
|
|
79
|
+
`File: ${filepath}\n` +
|
|
80
|
+
`Fix: Run ${colors_1.chalk.cyan('faf init')} to recreate the file`);
|
|
81
|
+
}
|
|
82
|
+
// Edge case 4: Parse YAML and handle syntax errors
|
|
83
|
+
let result;
|
|
84
|
+
try {
|
|
85
|
+
result = yaml.parse(content);
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
// Wrap yaml parsing errors with helpful context
|
|
89
|
+
throw new Error(`${colors_1.chalk.red('Invalid YAML syntax')}\n` +
|
|
90
|
+
`File: ${filepath}\n` +
|
|
91
|
+
`Error: ${error.message}\n` +
|
|
92
|
+
`Fix: Check file syntax or run ${colors_1.chalk.cyan('faf init --force')} to recreate`);
|
|
93
|
+
}
|
|
94
|
+
// Edge case 5: Parsed successfully but result is null/undefined
|
|
95
|
+
// (valid YAML like "null" or "~" or empty documents)
|
|
96
|
+
if (result === null || result === undefined) {
|
|
97
|
+
throw new Error(`${colors_1.chalk.red('YAML file parsed but contains no data')}\n` +
|
|
98
|
+
`File: ${filepath}\n` +
|
|
99
|
+
`Fix: Ensure file has valid YAML content or run ${colors_1.chalk.cyan('faf init')}`);
|
|
100
|
+
}
|
|
101
|
+
// Edge case 6: Parsed to primitive (not an object)
|
|
102
|
+
// .faf files must be YAML objects, not scalars
|
|
103
|
+
if (typeof result !== 'object' || Array.isArray(result)) {
|
|
104
|
+
throw new Error(`${colors_1.chalk.red('Invalid .faf structure - must be a YAML object')}\n` +
|
|
105
|
+
`File: ${filepath}\n` +
|
|
106
|
+
`Got: ${Array.isArray(result) ? 'array' : typeof result}\n` +
|
|
107
|
+
`Fix: .faf files must contain key-value pairs, not ${Array.isArray(result) ? 'lists' : 'simple values'}`);
|
|
108
|
+
}
|
|
109
|
+
return result;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Safe YAML stringify - handles edge cases
|
|
113
|
+
* ROCK SOLID - FIX ONCE, DONE FOREVER
|
|
114
|
+
*/
|
|
115
|
+
function stringify(data, options) {
|
|
116
|
+
// Edge case 1: Null/undefined data
|
|
117
|
+
if (data === null || data === undefined) {
|
|
118
|
+
throw new Error(`${colors_1.chalk.red('Cannot stringify null/undefined data to YAML')}\n` +
|
|
119
|
+
`Fix: Provide valid data object`);
|
|
120
|
+
}
|
|
121
|
+
// Edge case 2: Not an object (primitives should not be stringified for .faf)
|
|
122
|
+
if (typeof data !== 'object' || Array.isArray(data)) {
|
|
123
|
+
throw new Error(`${colors_1.chalk.red('Invalid data for .faf stringify')}\n` +
|
|
124
|
+
`Expected: object\n` +
|
|
125
|
+
`Got: ${Array.isArray(data) ? 'array' : typeof data}\n` +
|
|
126
|
+
`Fix: .faf files must be objects with key-value pairs`);
|
|
127
|
+
}
|
|
128
|
+
// Edge case 3: Stringify and catch any errors
|
|
129
|
+
try {
|
|
130
|
+
const result = yaml.stringify(data, options);
|
|
131
|
+
// Edge case 4: Empty result
|
|
132
|
+
if (!result || result.trim() === '') {
|
|
133
|
+
throw new Error('Stringify produced empty output');
|
|
134
|
+
}
|
|
135
|
+
return result;
|
|
136
|
+
}
|
|
137
|
+
catch (error) {
|
|
138
|
+
throw new Error(`${colors_1.chalk.red('Failed to convert data to YAML')}\n` +
|
|
139
|
+
`Error: ${error.message}`);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
// Export raw versions for advanced usage (use with caution)
|
|
143
|
+
exports.parseDocument = yaml.parseDocument;
|
|
144
|
+
exports.Document = yaml.Document;
|
|
145
|
+
// Re-export as default for compatibility
|
|
146
|
+
exports.default = {
|
|
147
|
+
parse,
|
|
148
|
+
stringify,
|
|
149
|
+
Document: exports.Document,
|
|
150
|
+
parseDocument: exports.parseDocument
|
|
151
|
+
};
|
|
152
|
+
// Also export as YAML for compatibility
|
|
153
|
+
exports.YAML = {
|
|
154
|
+
parse,
|
|
155
|
+
stringify,
|
|
156
|
+
Document: exports.Document,
|
|
157
|
+
parseDocument: exports.parseDocument
|
|
158
|
+
};
|
|
159
|
+
/**
|
|
160
|
+
* 🔥 ROCK SOLID STATUS: ACHIEVED
|
|
161
|
+
*
|
|
162
|
+
* All edge cases handled:
|
|
163
|
+
* ✅ Null/undefined → Clear error
|
|
164
|
+
* ✅ Empty files → Clear error
|
|
165
|
+
* ✅ Wrong types → Clear error
|
|
166
|
+
* ✅ Invalid YAML → Wrapped error with context
|
|
167
|
+
* ✅ Primitives → Clear error (.faf must be objects)
|
|
168
|
+
* ✅ Arrays → Clear error (.faf must be objects)
|
|
169
|
+
*
|
|
170
|
+
* FIX ONCE, DONE FOREVER
|
|
171
|
+
*/
|
|
172
|
+
//# sourceMappingURL=yaml.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"yaml.js","sourceRoot":"","sources":["../../../../src/faf-core/fix-once/yaml.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASH,sBAmEC;AAMD,8BA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6
|
+
projectType?: string;
|
|
7
|
+
outputPath: string;
|
|
8
|
+
projectRoot: string;
|
|
9
|
+
projectName?: string;
|
|
10
|
+
projectGoal?: string;
|
|
11
|
+
mainLanguage?: string;
|
|
12
|
+
framework?: string;
|
|
13
|
+
hosting?: string;
|
|
14
|
+
[key: string]: any;
|
|
15
|
+
}
|
|
16
|
+
export declare function generateFafFromProject(options: GenerateOptions): Promise<string>;
|
|
@@ -0,0 +1,462 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* 🏎️ Championship .faf Generator
|
|
4
|
+
* Uses FAB-FORMATS Power Unit for 86%+ context extraction
|
|
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.generateFafFromProject = generateFafFromProject;
|
|
11
|
+
const fs_1 = require("fs");
|
|
12
|
+
const path_1 = __importDefault(require("path"));
|
|
13
|
+
const file_utils_1 = require("../utils/file-utils");
|
|
14
|
+
const yaml_generator_1 = require("../utils/yaml-generator");
|
|
15
|
+
const fab_formats_processor_1 = require("../engines/fab-formats-processor");
|
|
16
|
+
const relentless_context_extractor_1 = require("../engines/relentless-context-extractor");
|
|
17
|
+
async function generateFafFromProject(options) {
|
|
18
|
+
const { projectType, projectRoot } = options;
|
|
19
|
+
// Validate projectRoot
|
|
20
|
+
if (!projectRoot || typeof projectRoot !== 'string') {
|
|
21
|
+
throw new Error(`Invalid projectRoot: ${projectRoot}. Expected a valid directory path.`);
|
|
22
|
+
}
|
|
23
|
+
// Read README.md if available (HUMAN CONTEXT SOURCE)
|
|
24
|
+
let readmeData = {};
|
|
25
|
+
const readmePath = path_1.default.join(projectRoot, "README.md");
|
|
26
|
+
try {
|
|
27
|
+
const readmeContent = await fs_1.promises.readFile(readmePath, "utf-8");
|
|
28
|
+
readmeData = extractReadmeContext(readmeContent);
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
// Continue without README data
|
|
32
|
+
}
|
|
33
|
+
// Read package.json if available (JavaScript projects)
|
|
34
|
+
const packageJsonPath = await (0, file_utils_1.findPackageJson)(projectRoot);
|
|
35
|
+
let packageData = {};
|
|
36
|
+
if (packageJsonPath) {
|
|
37
|
+
try {
|
|
38
|
+
const content = await fs_1.promises.readFile(packageJsonPath, "utf-8");
|
|
39
|
+
packageData = JSON.parse(content);
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
// Continue without package.json data
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
// Read pyproject.toml if available (Python projects)
|
|
46
|
+
const pyprojectPath = await (0, file_utils_1.findPyprojectToml)(projectRoot);
|
|
47
|
+
let pyprojectData = {};
|
|
48
|
+
if (pyprojectPath) {
|
|
49
|
+
try {
|
|
50
|
+
const content = await fs_1.promises.readFile(pyprojectPath, "utf-8");
|
|
51
|
+
// Basic parsing for Python projects
|
|
52
|
+
if (content.includes('[tool.poetry]')) {
|
|
53
|
+
pyprojectData.packageManager = 'Poetry';
|
|
54
|
+
}
|
|
55
|
+
const nameMatch = content.match(/name\s*=\s*"([^"]+)"/);
|
|
56
|
+
if (nameMatch) {
|
|
57
|
+
pyprojectData.name = nameMatch[1];
|
|
58
|
+
}
|
|
59
|
+
const descMatch = content.match(/description\s*=\s*"([^"]+)"/);
|
|
60
|
+
if (descMatch) {
|
|
61
|
+
pyprojectData.description = descMatch[1];
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
catch {
|
|
65
|
+
// Continue without pyproject.toml data
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
// Read requirements.txt if available (Python projects)
|
|
69
|
+
const requirementsPath = await (0, file_utils_1.findRequirementsTxt)(projectRoot);
|
|
70
|
+
let requirementsData = {};
|
|
71
|
+
if (requirementsPath) {
|
|
72
|
+
try {
|
|
73
|
+
const content = await fs_1.promises.readFile(requirementsPath, "utf-8");
|
|
74
|
+
const lines = content.split('\n').filter(line => line && !line.startsWith('#'));
|
|
75
|
+
requirementsData.dependencies = lines;
|
|
76
|
+
}
|
|
77
|
+
catch {
|
|
78
|
+
// Continue without requirements.txt data
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
// 🏎️ CHAMPIONSHIP ENGINE - FAB-FORMATS Power Unit with 150+ handlers!
|
|
82
|
+
const fabProcessor = new fab_formats_processor_1.FabFormatsProcessor();
|
|
83
|
+
let fabAnalysis;
|
|
84
|
+
try {
|
|
85
|
+
fabAnalysis = await fabProcessor.processFiles(projectRoot);
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
// Fallback to empty analysis if discovery fails
|
|
89
|
+
fabAnalysis = {
|
|
90
|
+
results: [],
|
|
91
|
+
totalBonus: 0,
|
|
92
|
+
context: {},
|
|
93
|
+
qualityMetrics: {
|
|
94
|
+
highestGrade: 'MINIMAL',
|
|
95
|
+
averageScore: 0,
|
|
96
|
+
filesCovered: 0,
|
|
97
|
+
intelligenceDepth: 0
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
// 🏎️ AERO PACKAGE - RelentlessContextExtractor for human context!
|
|
102
|
+
let humanContext;
|
|
103
|
+
try {
|
|
104
|
+
humanContext = await relentless_context_extractor_1.relentlessExtractor.extractFromProject(projectRoot);
|
|
105
|
+
}
|
|
106
|
+
catch {
|
|
107
|
+
// Fallback to empty context
|
|
108
|
+
humanContext = null;
|
|
109
|
+
}
|
|
110
|
+
// TypeScript configuration analysis
|
|
111
|
+
const tsConfigPath = await (0, file_utils_1.findTsConfig)(projectRoot);
|
|
112
|
+
let tsContext = null;
|
|
113
|
+
if (tsConfigPath) {
|
|
114
|
+
const result = await (0, file_utils_1.analyzeTsConfig)(tsConfigPath);
|
|
115
|
+
if (result) {
|
|
116
|
+
tsContext = result;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
// START ENHANCED SCORING - Championship grade with FAB-FORMATS!
|
|
120
|
+
let enhancedScore = 10; // Base score for having a project
|
|
121
|
+
// Map all discovered slots (21-slot system)
|
|
122
|
+
const contextSlotsFilled = {};
|
|
123
|
+
// IF: Quick mode data takes priority (user explicitly provided it)
|
|
124
|
+
if (options.projectGoal) {
|
|
125
|
+
contextSlotsFilled['project_goal'] = options.projectGoal;
|
|
126
|
+
}
|
|
127
|
+
if (options.projectName) {
|
|
128
|
+
contextSlotsFilled['project_name'] = options.projectName;
|
|
129
|
+
}
|
|
130
|
+
if (options.mainLanguage) {
|
|
131
|
+
contextSlotsFilled['main_language'] = options.mainLanguage;
|
|
132
|
+
}
|
|
133
|
+
if (options.framework && options.framework !== 'none') {
|
|
134
|
+
contextSlotsFilled['framework'] = options.framework;
|
|
135
|
+
}
|
|
136
|
+
if (options.hosting && options.hosting !== 'cloud') {
|
|
137
|
+
contextSlotsFilled['hosting'] = options.hosting;
|
|
138
|
+
}
|
|
139
|
+
// Apply championship context extraction
|
|
140
|
+
if (fabAnalysis.context) {
|
|
141
|
+
const ctx = fabAnalysis.context;
|
|
142
|
+
// Technical slots (15) - only fill if not already set by quick mode
|
|
143
|
+
if (ctx.projectName && !contextSlotsFilled['project_name'])
|
|
144
|
+
contextSlotsFilled['project_name'] = ctx.projectName;
|
|
145
|
+
if (ctx.projectGoal && !contextSlotsFilled['project_goal'])
|
|
146
|
+
contextSlotsFilled['project_goal'] = ctx.projectGoal;
|
|
147
|
+
if (ctx.mainLanguage)
|
|
148
|
+
contextSlotsFilled['main_language'] = ctx.mainLanguage;
|
|
149
|
+
if (ctx.framework)
|
|
150
|
+
contextSlotsFilled['framework'] = ctx.framework;
|
|
151
|
+
if (ctx.backend)
|
|
152
|
+
contextSlotsFilled['backend'] = ctx.backend;
|
|
153
|
+
if (ctx.server)
|
|
154
|
+
contextSlotsFilled['server'] = ctx.server;
|
|
155
|
+
if (ctx.apiType)
|
|
156
|
+
contextSlotsFilled['api_type'] = ctx.apiType;
|
|
157
|
+
if (ctx.database)
|
|
158
|
+
contextSlotsFilled['database'] = ctx.database;
|
|
159
|
+
if (ctx.hosting)
|
|
160
|
+
contextSlotsFilled['hosting'] = ctx.hosting;
|
|
161
|
+
if (ctx.cicd)
|
|
162
|
+
contextSlotsFilled['cicd'] = ctx.cicd;
|
|
163
|
+
if (ctx.buildTool)
|
|
164
|
+
contextSlotsFilled['build_tool'] = ctx.buildTool;
|
|
165
|
+
if (ctx.packageManager)
|
|
166
|
+
contextSlotsFilled['package_manager'] = ctx.packageManager;
|
|
167
|
+
if (ctx.testFramework)
|
|
168
|
+
contextSlotsFilled['test_framework'] = ctx.testFramework;
|
|
169
|
+
if (ctx.linter)
|
|
170
|
+
contextSlotsFilled['linter'] = ctx.linter;
|
|
171
|
+
// Human context slots (6 W's)
|
|
172
|
+
if (ctx.targetUser)
|
|
173
|
+
contextSlotsFilled['who'] = ctx.targetUser;
|
|
174
|
+
if (ctx.coreProblem)
|
|
175
|
+
contextSlotsFilled['what'] = ctx.coreProblem;
|
|
176
|
+
if (ctx.missionPurpose)
|
|
177
|
+
contextSlotsFilled['why'] = ctx.missionPurpose;
|
|
178
|
+
if (ctx.deploymentMarket)
|
|
179
|
+
contextSlotsFilled['where'] = ctx.deploymentMarket;
|
|
180
|
+
if (ctx.timeline)
|
|
181
|
+
contextSlotsFilled['when'] = ctx.timeline;
|
|
182
|
+
if (ctx.approach)
|
|
183
|
+
contextSlotsFilled['how'] = ctx.approach;
|
|
184
|
+
}
|
|
185
|
+
// Apply RELENTLESS human context extraction (overrides if higher confidence)
|
|
186
|
+
if (humanContext) {
|
|
187
|
+
if (humanContext.who.confidence === 'CERTAIN' || !contextSlotsFilled['who']) {
|
|
188
|
+
contextSlotsFilled['who'] = humanContext.who.value;
|
|
189
|
+
}
|
|
190
|
+
if (humanContext.what.confidence === 'CERTAIN' || !contextSlotsFilled['what']) {
|
|
191
|
+
contextSlotsFilled['what'] = humanContext.what.value;
|
|
192
|
+
}
|
|
193
|
+
if (humanContext.why.confidence === 'CERTAIN' || !contextSlotsFilled['why']) {
|
|
194
|
+
contextSlotsFilled['why'] = humanContext.why.value;
|
|
195
|
+
}
|
|
196
|
+
if (humanContext.where.confidence === 'CERTAIN' || !contextSlotsFilled['where']) {
|
|
197
|
+
contextSlotsFilled['where'] = humanContext.where.value;
|
|
198
|
+
}
|
|
199
|
+
if (humanContext.when.confidence === 'CERTAIN' || !contextSlotsFilled['when']) {
|
|
200
|
+
contextSlotsFilled['when'] = humanContext.when.value;
|
|
201
|
+
}
|
|
202
|
+
if (humanContext.how.confidence === 'CERTAIN' || !contextSlotsFilled['how']) {
|
|
203
|
+
contextSlotsFilled['how'] = humanContext.how.value;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
// CLI-specific detection and smart slot reuse
|
|
207
|
+
const deps = {
|
|
208
|
+
...packageData.dependencies,
|
|
209
|
+
...packageData.devDependencies
|
|
210
|
+
};
|
|
211
|
+
const isCLI = packageData.bin ||
|
|
212
|
+
packageData.name?.includes('cli') ||
|
|
213
|
+
packageData.keywords?.includes('cli') ||
|
|
214
|
+
packageData.keywords?.includes('command-line') ||
|
|
215
|
+
deps?.commander ||
|
|
216
|
+
deps?.yargs ||
|
|
217
|
+
deps?.oclif ||
|
|
218
|
+
deps?.inquirer;
|
|
219
|
+
if (isCLI) {
|
|
220
|
+
// Smart slot reuse for CLI projects
|
|
221
|
+
contextSlotsFilled['framework'] = 'CLI'; // frontend = CLI
|
|
222
|
+
contextSlotsFilled['api_type'] = 'CLI';
|
|
223
|
+
contextSlotsFilled['hosting'] = 'npm registry';
|
|
224
|
+
contextSlotsFilled['backend'] = 'Node.js';
|
|
225
|
+
// Detect terminal UI framework
|
|
226
|
+
if (deps?.chalk)
|
|
227
|
+
contextSlotsFilled['css_framework'] = 'chalk (terminal colors)';
|
|
228
|
+
else if (deps?.colors)
|
|
229
|
+
contextSlotsFilled['css_framework'] = 'colors';
|
|
230
|
+
else if (deps?.ora)
|
|
231
|
+
contextSlotsFilled['css_framework'] = 'ora';
|
|
232
|
+
// Detect interactive framework
|
|
233
|
+
if (deps?.inquirer)
|
|
234
|
+
contextSlotsFilled['ui_library'] = 'inquirer (interactive prompts)';
|
|
235
|
+
else if (deps?.prompts)
|
|
236
|
+
contextSlotsFilled['ui_library'] = 'prompts';
|
|
237
|
+
else if (deps?.enquirer)
|
|
238
|
+
contextSlotsFilled['ui_library'] = 'enquirer';
|
|
239
|
+
// Detect CLI framework
|
|
240
|
+
if (deps?.commander)
|
|
241
|
+
contextSlotsFilled['cli_framework'] = 'commander';
|
|
242
|
+
else if (deps?.yargs)
|
|
243
|
+
contextSlotsFilled['cli_framework'] = 'yargs';
|
|
244
|
+
else if (deps?.oclif)
|
|
245
|
+
contextSlotsFilled['cli_framework'] = 'oclif';
|
|
246
|
+
// Detect runtime
|
|
247
|
+
if (packageData.engines?.node) {
|
|
248
|
+
contextSlotsFilled['runtime'] = `Node.js ${packageData.engines.node}`;
|
|
249
|
+
}
|
|
250
|
+
else {
|
|
251
|
+
contextSlotsFilled['runtime'] = 'Node.js v16+';
|
|
252
|
+
}
|
|
253
|
+
// Detect build system
|
|
254
|
+
if (deps?.typescript || deps?.['@types/node']) {
|
|
255
|
+
contextSlotsFilled['build_tool'] = 'TypeScript (tsc)';
|
|
256
|
+
}
|
|
257
|
+
// Detect testing
|
|
258
|
+
if (deps?.jest)
|
|
259
|
+
contextSlotsFilled['test_framework'] = 'Jest';
|
|
260
|
+
else if (deps?.mocha)
|
|
261
|
+
contextSlotsFilled['test_framework'] = 'Mocha';
|
|
262
|
+
else if (deps?.vitest)
|
|
263
|
+
contextSlotsFilled['test_framework'] = 'Vitest';
|
|
264
|
+
// Detect CI/CD - check for .github/workflows directory
|
|
265
|
+
try {
|
|
266
|
+
const githubWorkflowsPath = path_1.default.join(projectRoot, '.github', 'workflows');
|
|
267
|
+
const githubWorkflowsExists = await fs_1.promises.access(githubWorkflowsPath).then(() => true).catch(() => false);
|
|
268
|
+
if (githubWorkflowsExists) {
|
|
269
|
+
contextSlotsFilled['cicd'] = 'GitHub Actions';
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
catch {
|
|
273
|
+
// Continue without CI/CD detection
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
// Override with package.json if more specific
|
|
277
|
+
if (packageData.name && !contextSlotsFilled['project_name']) {
|
|
278
|
+
contextSlotsFilled['project_name'] = packageData.name;
|
|
279
|
+
}
|
|
280
|
+
if (packageData.description && !contextSlotsFilled['project_goal']) {
|
|
281
|
+
contextSlotsFilled['project_goal'] = packageData.description;
|
|
282
|
+
}
|
|
283
|
+
// Override with pyproject.toml for Python projects
|
|
284
|
+
if (pyprojectData.name && !contextSlotsFilled['project_name']) {
|
|
285
|
+
contextSlotsFilled['project_name'] = pyprojectData.name;
|
|
286
|
+
}
|
|
287
|
+
if (pyprojectData.description && !contextSlotsFilled['project_goal']) {
|
|
288
|
+
contextSlotsFilled['project_goal'] = pyprojectData.description;
|
|
289
|
+
}
|
|
290
|
+
// Apply README data (human context priority)
|
|
291
|
+
if (readmeData.projectName && !contextSlotsFilled['project_name']) {
|
|
292
|
+
contextSlotsFilled['project_name'] = readmeData.projectName;
|
|
293
|
+
}
|
|
294
|
+
if (readmeData.description && !contextSlotsFilled['project_goal']) {
|
|
295
|
+
contextSlotsFilled['project_goal'] = readmeData.description;
|
|
296
|
+
}
|
|
297
|
+
if (readmeData.targetUser && !contextSlotsFilled['who']) {
|
|
298
|
+
contextSlotsFilled['who'] = readmeData.targetUser;
|
|
299
|
+
}
|
|
300
|
+
// Calculate slot-based score
|
|
301
|
+
const technicalSlots = [
|
|
302
|
+
'project_name', 'project_goal', 'main_language', 'framework',
|
|
303
|
+
'backend', 'server', 'api_type', 'database', 'hosting',
|
|
304
|
+
'cicd', 'build_tool', 'package_manager', 'test_framework', 'linter'
|
|
305
|
+
];
|
|
306
|
+
const humanSlots = ['who', 'what', 'why', 'where', 'when', 'how'];
|
|
307
|
+
let technicalFilled = 0;
|
|
308
|
+
let humanFilled = 0;
|
|
309
|
+
technicalSlots.forEach(slot => {
|
|
310
|
+
if (contextSlotsFilled[slot]) {
|
|
311
|
+
technicalFilled++;
|
|
312
|
+
enhancedScore += 4; // Each technical slot = 4%
|
|
313
|
+
}
|
|
314
|
+
});
|
|
315
|
+
humanSlots.forEach(slot => {
|
|
316
|
+
if (contextSlotsFilled[slot]) {
|
|
317
|
+
humanFilled++;
|
|
318
|
+
enhancedScore += 5; // Each human slot = 5%
|
|
319
|
+
}
|
|
320
|
+
});
|
|
321
|
+
// Quality bonuses from FAB-FORMATS
|
|
322
|
+
if (fabAnalysis.qualityMetrics) {
|
|
323
|
+
const grade = fabAnalysis.qualityMetrics.highestGrade;
|
|
324
|
+
if (grade === 'EXCEPTIONAL') {
|
|
325
|
+
enhancedScore += 20;
|
|
326
|
+
}
|
|
327
|
+
else if (grade === 'PROFESSIONAL') {
|
|
328
|
+
enhancedScore += 15;
|
|
329
|
+
}
|
|
330
|
+
else if (grade === 'GOOD') {
|
|
331
|
+
enhancedScore += 10;
|
|
332
|
+
}
|
|
333
|
+
else if (grade === 'BASIC') {
|
|
334
|
+
enhancedScore += 5;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
// Intelligence depth bonus
|
|
338
|
+
if (fabAnalysis.qualityMetrics.intelligenceDepth > 80) {
|
|
339
|
+
enhancedScore += 15;
|
|
340
|
+
}
|
|
341
|
+
else if (fabAnalysis.qualityMetrics.intelligenceDepth > 60) {
|
|
342
|
+
enhancedScore += 10;
|
|
343
|
+
}
|
|
344
|
+
else if (fabAnalysis.qualityMetrics.intelligenceDepth > 40) {
|
|
345
|
+
enhancedScore += 5;
|
|
346
|
+
}
|
|
347
|
+
// TypeScript bonus
|
|
348
|
+
if (tsContext) {
|
|
349
|
+
enhancedScore += 5;
|
|
350
|
+
if (tsContext.strictMode) {
|
|
351
|
+
enhancedScore += 5;
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
// Cap at 99% (100% requires human verification)
|
|
355
|
+
const fafScore = Math.min(Math.round(enhancedScore), 99);
|
|
356
|
+
// Build confidence level
|
|
357
|
+
let confidence = 'LOW';
|
|
358
|
+
if (fafScore >= 85)
|
|
359
|
+
confidence = 'HIGH';
|
|
360
|
+
else if (fafScore >= 70)
|
|
361
|
+
confidence = 'GOOD';
|
|
362
|
+
else if (fafScore >= 50)
|
|
363
|
+
confidence = 'MODERATE';
|
|
364
|
+
// Build quality indicators
|
|
365
|
+
const qualityIndicators = [];
|
|
366
|
+
if (fabAnalysis.qualityMetrics.highestGrade === 'EXCEPTIONAL') {
|
|
367
|
+
qualityIndicators.push('Exceptional project structure');
|
|
368
|
+
}
|
|
369
|
+
if (fabAnalysis.qualityMetrics.filesCovered > 10) {
|
|
370
|
+
qualityIndicators.push('Comprehensive file coverage');
|
|
371
|
+
}
|
|
372
|
+
if (technicalFilled >= 10) {
|
|
373
|
+
qualityIndicators.push('Rich technical context');
|
|
374
|
+
}
|
|
375
|
+
if (humanFilled >= 3) {
|
|
376
|
+
qualityIndicators.push('Strong human context');
|
|
377
|
+
}
|
|
378
|
+
if (tsContext?.strictMode) {
|
|
379
|
+
qualityIndicators.push('TypeScript strict mode');
|
|
380
|
+
}
|
|
381
|
+
// Extract the stack for display
|
|
382
|
+
const stack = {
|
|
383
|
+
frontend: contextSlotsFilled['framework'] || packageData.dependencies?.react ? 'React' : undefined,
|
|
384
|
+
backend: contextSlotsFilled['backend'],
|
|
385
|
+
database: contextSlotsFilled['database'],
|
|
386
|
+
build: contextSlotsFilled['build_tool'],
|
|
387
|
+
package_manager: contextSlotsFilled['package_manager'] || 'npm',
|
|
388
|
+
hosting: contextSlotsFilled['hosting'],
|
|
389
|
+
};
|
|
390
|
+
// Build the data structure for generateFafContent
|
|
391
|
+
const fafData = {
|
|
392
|
+
projectName: contextSlotsFilled['project_name'] || path_1.default.basename(projectRoot),
|
|
393
|
+
projectGoal: contextSlotsFilled['project_goal'] || 'Build amazing software',
|
|
394
|
+
mainLanguage: contextSlotsFilled['main_language'] || 'JavaScript',
|
|
395
|
+
framework: contextSlotsFilled['framework'] || 'None',
|
|
396
|
+
cssFramework: contextSlotsFilled['css_framework'] || undefined,
|
|
397
|
+
uiLibrary: contextSlotsFilled['ui_library'] || undefined,
|
|
398
|
+
stateManagement: undefined,
|
|
399
|
+
backend: contextSlotsFilled['backend'] || 'None',
|
|
400
|
+
apiType: contextSlotsFilled['api_type'] || 'REST',
|
|
401
|
+
server: contextSlotsFilled['runtime'] || contextSlotsFilled['server'] || 'None',
|
|
402
|
+
database: contextSlotsFilled['database'] || 'None',
|
|
403
|
+
connection: 'None',
|
|
404
|
+
hosting: contextSlotsFilled['hosting'] || 'None',
|
|
405
|
+
buildTool: contextSlotsFilled['build_tool'] || 'None',
|
|
406
|
+
packageManager: contextSlotsFilled['package_manager'] || 'npm',
|
|
407
|
+
cicd: contextSlotsFilled['cicd'] || 'None',
|
|
408
|
+
fafScore,
|
|
409
|
+
slotBasedPercentage: Math.round(((technicalFilled + humanFilled) / 21) * 100),
|
|
410
|
+
projectType, // Pass project type for compiler slot-filling patterns
|
|
411
|
+
// Human Context (Project Details)
|
|
412
|
+
targetUser: contextSlotsFilled['who'],
|
|
413
|
+
coreProblem: contextSlotsFilled['what'],
|
|
414
|
+
missionPurpose: contextSlotsFilled['why'],
|
|
415
|
+
deploymentMarket: contextSlotsFilled['where'],
|
|
416
|
+
timeline: contextSlotsFilled['when'],
|
|
417
|
+
approach: contextSlotsFilled['how'],
|
|
418
|
+
// Quality indicators
|
|
419
|
+
qualityIndicators,
|
|
420
|
+
fabFormatsIntelligence: {
|
|
421
|
+
filesAnalyzed: fabAnalysis.results.length,
|
|
422
|
+
totalIntelligence: fabAnalysis.totalBonus,
|
|
423
|
+
highestGrade: fabAnalysis.qualityMetrics.highestGrade,
|
|
424
|
+
depth: fabAnalysis.qualityMetrics.intelligenceDepth
|
|
425
|
+
}
|
|
426
|
+
};
|
|
427
|
+
// Generate YAML content
|
|
428
|
+
const content = (0, yaml_generator_1.generateFafContent)(fafData);
|
|
429
|
+
return content;
|
|
430
|
+
}
|
|
431
|
+
/**
|
|
432
|
+
* Extract context from README.md
|
|
433
|
+
*/
|
|
434
|
+
function extractReadmeContext(content) {
|
|
435
|
+
const context = {};
|
|
436
|
+
// Extract project name from title
|
|
437
|
+
const titleMatch = content.match(/^#\s+(.+)$/m);
|
|
438
|
+
if (titleMatch) {
|
|
439
|
+
context.projectName = titleMatch[1].trim();
|
|
440
|
+
}
|
|
441
|
+
// Extract description from first paragraph or description section
|
|
442
|
+
const descMatch = content.match(/^#+\s+(?:description|about|overview|introduction)\s*\n+(.+?)(?:\n#|\n\n#|$)/ims);
|
|
443
|
+
if (descMatch) {
|
|
444
|
+
context.description = descMatch[1].trim().substring(0, 200);
|
|
445
|
+
}
|
|
446
|
+
else {
|
|
447
|
+
// Try to get first paragraph after title
|
|
448
|
+
const firstParaMatch = content.match(/^#\s+.+\n+(.+?)(?:\n#|\n\n#|$)/ms);
|
|
449
|
+
if (firstParaMatch) {
|
|
450
|
+
context.description = firstParaMatch[1].trim().substring(0, 200);
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
// Look for target users
|
|
454
|
+
if (content.match(/##\s+(?:for\s+)?(?:developers|engineers|teams)/i)) {
|
|
455
|
+
context.targetUser = 'Developers';
|
|
456
|
+
}
|
|
457
|
+
else if (content.match(/##\s+(?:for\s+)?(?:users|customers|clients)/i)) {
|
|
458
|
+
context.targetUser = 'End users';
|
|
459
|
+
}
|
|
460
|
+
return context;
|
|
461
|
+
}
|
|
462
|
+
//# sourceMappingURL=faf-generator-championship.js.map
|