faf-mcp 1.3.1 → 2.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 +32 -0
- package/CLAUDE.md +5 -5
- package/README.md +70 -14
- package/assets/thumbnail.png +0 -0
- package/dist/src/faf-core/commands/agents.d.ts +29 -0
- package/dist/src/faf-core/commands/agents.js +140 -0
- package/dist/src/faf-core/commands/agents.js.map +1 -0
- package/dist/src/faf-core/commands/bi-sync.d.ts +9 -5
- package/dist/src/faf-core/commands/bi-sync.js +89 -85
- package/dist/src/faf-core/commands/bi-sync.js.map +1 -1
- package/dist/src/faf-core/commands/conductor.d.ts +25 -0
- package/dist/src/faf-core/commands/conductor.js +157 -0
- package/dist/src/faf-core/commands/conductor.js.map +1 -0
- package/dist/src/faf-core/commands/cursor.d.ts +29 -0
- package/dist/src/faf-core/commands/cursor.js +134 -0
- package/dist/src/faf-core/commands/cursor.js.map +1 -0
- package/dist/src/faf-core/commands/gemini.d.ts +29 -0
- package/dist/src/faf-core/commands/gemini.js +133 -0
- package/dist/src/faf-core/commands/gemini.js.map +1 -0
- package/dist/src/faf-core/commands/git-context.d.ts +23 -0
- package/dist/src/faf-core/commands/git-context.js +66 -0
- package/dist/src/faf-core/commands/git-context.js.map +1 -0
- package/dist/src/faf-core/commands/human.d.ts +27 -0
- package/dist/src/faf-core/commands/human.js +183 -0
- package/dist/src/faf-core/commands/human.js.map +1 -0
- package/dist/src/faf-core/commands/readme.d.ts +47 -0
- package/dist/src/faf-core/commands/readme.js +361 -0
- package/dist/src/faf-core/commands/readme.js.map +1 -0
- package/dist/src/faf-core/engines/fab-formats-processor.js +3 -3
- package/dist/src/faf-core/engines/fab-formats-processor.js.map +1 -1
- package/dist/src/faf-core/engines/faf-dna.d.ts +1 -1
- package/dist/src/faf-core/engines/faf-dna.js +4 -3
- package/dist/src/faf-core/engines/faf-dna.js.map +1 -1
- package/dist/src/faf-core/generators/faf-generator-championship.js +9 -8
- package/dist/src/faf-core/generators/faf-generator-championship.js.map +1 -1
- package/dist/src/faf-core/parsers/agents-parser.d.ts +59 -0
- package/dist/src/faf-core/parsers/agents-parser.js +324 -0
- package/dist/src/faf-core/parsers/agents-parser.js.map +1 -0
- package/dist/src/faf-core/parsers/conductor-parser.d.ts +85 -0
- package/dist/src/faf-core/parsers/conductor-parser.js +293 -0
- package/dist/src/faf-core/parsers/conductor-parser.js.map +1 -0
- package/dist/src/faf-core/parsers/cursorrules-parser.d.ts +57 -0
- package/dist/src/faf-core/parsers/cursorrules-parser.js +317 -0
- package/dist/src/faf-core/parsers/cursorrules-parser.js.map +1 -0
- package/dist/src/faf-core/parsers/faf-git-generator.d.ts +53 -0
- package/dist/src/faf-core/parsers/faf-git-generator.js +512 -0
- package/dist/src/faf-core/parsers/faf-git-generator.js.map +1 -0
- package/dist/src/faf-core/parsers/gemini-parser.d.ts +57 -0
- package/dist/src/faf-core/parsers/gemini-parser.js +263 -0
- package/dist/src/faf-core/parsers/gemini-parser.js.map +1 -0
- package/dist/src/faf-core/parsers/github-extractor.d.ts +61 -0
- package/dist/src/faf-core/parsers/github-extractor.js +374 -0
- package/dist/src/faf-core/parsers/github-extractor.js.map +1 -0
- package/dist/src/faf-core/parsers/index.d.ts +12 -0
- package/dist/src/{compiler → faf-core/parsers}/index.js +10 -5
- package/dist/src/faf-core/parsers/index.js.map +1 -0
- package/dist/src/faf-core/parsers/slot-counter.d.ts +55 -0
- package/dist/src/faf-core/parsers/slot-counter.js +100 -0
- package/dist/src/faf-core/parsers/slot-counter.js.map +1 -0
- package/dist/src/faf-core/utils/balance-visualizer.js +3 -3
- package/dist/src/faf-core/utils/balance-visualizer.js.map +1 -1
- package/dist/src/handlers/championship-tools.d.ts +10 -5
- package/dist/src/handlers/championship-tools.js +259 -232
- package/dist/src/handlers/championship-tools.js.map +1 -1
- package/dist/src/handlers/engine-adapter.js +238 -5
- package/dist/src/handlers/engine-adapter.js.map +1 -1
- package/dist/src/handlers/tools.d.ts +61 -0
- package/dist/src/handlers/tools.js +2103 -102
- package/dist/src/handlers/tools.js.map +1 -1
- package/dist/src/index.js +0 -0
- package/dist/src/types/tool-visibility.js +51 -10
- package/dist/src/types/tool-visibility.js.map +1 -1
- package/dist/src/utils/championship-format.js +11 -9
- package/dist/src/utils/championship-format.js.map +1 -1
- package/dist/src/utils/path-resolver.js +56 -2
- package/dist/src/utils/path-resolver.js.map +1 -1
- package/dist/src/utils/visual-style.js +7 -5
- package/dist/src/utils/visual-style.js.map +1 -1
- package/dist/src/version.js +24 -11
- package/dist/src/version.js.map +1 -1
- package/package.json +5 -3
- package/project.faf +14 -18
- package/dist/index.json +0 -1
- package/dist/src/compiler/index.d.ts +0 -7
- package/dist/src/compiler/index.js.map +0 -1
- package/dist/src/compiler/scorer.d.ts +0 -53
- package/dist/src/compiler/scorer.js +0 -189
- package/dist/src/compiler/scorer.js.map +0 -1
- package/dist/src/compiler/slot-validator.d.ts +0 -32
- package/dist/src/compiler/slot-validator.js +0 -293
- package/dist/src/compiler/slot-validator.js.map +0 -1
- package/dist/src/compiler/type-detector.d.ts +0 -62
- package/dist/src/compiler/type-detector.js +0 -388
- package/dist/src/compiler/type-detector.js.map +0 -1
- package/dist/src/types/project-types.d.ts +0 -22
- package/dist/src/types/project-types.js +0 -85
- package/dist/src/types/project-types.js.map +0 -1
- package/dist/src/types/slots.d.ts +0 -39
- package/dist/src/types/slots.js +0 -162
- package/dist/src/types/slots.js.map +0 -1
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* .cursorrules Parser
|
|
4
|
+
*
|
|
5
|
+
* Parses Cursor IDE .cursorrules files for bidirectional
|
|
6
|
+
* interoperability with FAF.
|
|
7
|
+
*
|
|
8
|
+
* .cursorrules Structure:
|
|
9
|
+
* - Free-form markdown with sections
|
|
10
|
+
* - H2: Section headers (optional)
|
|
11
|
+
* - Bullets/paragraphs: Guidelines and rules
|
|
12
|
+
*
|
|
13
|
+
* Note: This generates legacy .cursorrules (single file).
|
|
14
|
+
* The new .cursor/rules/ MDC directory format is a future enhancement.
|
|
15
|
+
*
|
|
16
|
+
* Ported from faf-cli for claude-faf-mcp v4.5.0
|
|
17
|
+
*/
|
|
18
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
19
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
20
|
+
};
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.parseCursorRules = parseCursorRules;
|
|
23
|
+
exports.cursorImport = cursorImport;
|
|
24
|
+
exports.cursorExport = cursorExport;
|
|
25
|
+
exports.detectCursorRules = detectCursorRules;
|
|
26
|
+
const fs_1 = require("fs");
|
|
27
|
+
const path_1 = __importDefault(require("path"));
|
|
28
|
+
// ============================================================================
|
|
29
|
+
// Parsing
|
|
30
|
+
// ============================================================================
|
|
31
|
+
/**
|
|
32
|
+
* Parse .cursorrules file content
|
|
33
|
+
*/
|
|
34
|
+
function parseCursorRules(content) {
|
|
35
|
+
// Strip BOM and normalize line endings (Windows \r\n, old Mac \r)
|
|
36
|
+
const normalized = content.replace(/^\uFEFF/, '').replace(/\r\n/g, '\n').replace(/\r/g, '\n');
|
|
37
|
+
const lines = normalized.split('\n');
|
|
38
|
+
let projectName = 'Unknown Project';
|
|
39
|
+
const sections = [];
|
|
40
|
+
let currentSection = null;
|
|
41
|
+
const rawLines = [];
|
|
42
|
+
for (const line of lines) {
|
|
43
|
+
rawLines.push(line);
|
|
44
|
+
// H1 = Project name
|
|
45
|
+
const h1Match = line.match(/^#\s+(?:Project:\s*)?(.+)$/);
|
|
46
|
+
if (h1Match) {
|
|
47
|
+
projectName = h1Match[1].trim();
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
// H2 = Section header
|
|
51
|
+
const h2Match = line.match(/^##\s+(.+)$/);
|
|
52
|
+
if (h2Match) {
|
|
53
|
+
if (currentSection) {
|
|
54
|
+
sections.push(currentSection);
|
|
55
|
+
}
|
|
56
|
+
currentSection = {
|
|
57
|
+
title: h2Match[1].trim(),
|
|
58
|
+
content: [],
|
|
59
|
+
};
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
// Bullet point
|
|
63
|
+
const bulletMatch = line.match(/^[-*]\s+(.+)$/);
|
|
64
|
+
if (bulletMatch && currentSection) {
|
|
65
|
+
currentSection.content.push(bulletMatch[1].trim());
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
// Non-empty line in a section (paragraph text)
|
|
69
|
+
const trimmed = line.trim();
|
|
70
|
+
if (trimmed && currentSection && !trimmed.startsWith('#')) {
|
|
71
|
+
currentSection.content.push(trimmed);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
// Push last section
|
|
75
|
+
if (currentSection) {
|
|
76
|
+
sections.push(currentSection);
|
|
77
|
+
}
|
|
78
|
+
return { projectName, sections, rawLines };
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Categorize .cursorrules sections into FAF structure
|
|
82
|
+
*/
|
|
83
|
+
function categorizeSections(sections) {
|
|
84
|
+
const rules = [];
|
|
85
|
+
const guidelines = [];
|
|
86
|
+
const codingStyle = [];
|
|
87
|
+
for (const section of sections) {
|
|
88
|
+
const titleLower = section.title.toLowerCase();
|
|
89
|
+
if (titleLower.includes('coding') || titleLower.includes('style') || titleLower.includes('format') || titleLower.includes('convention')) {
|
|
90
|
+
codingStyle.push(...section.content);
|
|
91
|
+
}
|
|
92
|
+
else if (titleLower.includes('rule') || titleLower.includes('constraint') || titleLower.includes('requirement') || titleLower.includes('preference')) {
|
|
93
|
+
rules.push(...section.content);
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
// Default to guidelines
|
|
97
|
+
guidelines.push(...section.content);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return { rules, guidelines, codingStyle };
|
|
101
|
+
}
|
|
102
|
+
// ============================================================================
|
|
103
|
+
// Import: .cursorrules -> FAF
|
|
104
|
+
// ============================================================================
|
|
105
|
+
async function cursorImport(cursorPath) {
|
|
106
|
+
const warnings = [];
|
|
107
|
+
// Check if file exists
|
|
108
|
+
try {
|
|
109
|
+
await fs_1.promises.access(cursorPath);
|
|
110
|
+
}
|
|
111
|
+
catch {
|
|
112
|
+
return {
|
|
113
|
+
success: false,
|
|
114
|
+
faf: createEmptyFaf(),
|
|
115
|
+
warnings: [`.cursorrules not found: ${cursorPath}`],
|
|
116
|
+
sectionsFound: [],
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
// Read and parse
|
|
120
|
+
const content = await fs_1.promises.readFile(cursorPath, 'utf-8');
|
|
121
|
+
const parsed = parseCursorRules(content);
|
|
122
|
+
if (parsed.sections.length === 0) {
|
|
123
|
+
warnings.push('No sections found in .cursorrules — treating all content as guidelines');
|
|
124
|
+
// If no sections, treat all non-empty lines as guidelines
|
|
125
|
+
const allLines = parsed.rawLines
|
|
126
|
+
.map(l => l.trim())
|
|
127
|
+
.filter(l => l && !l.startsWith('#'));
|
|
128
|
+
const faf = {
|
|
129
|
+
project: {
|
|
130
|
+
name: parsed.projectName,
|
|
131
|
+
description: 'Imported from .cursorrules',
|
|
132
|
+
type: 'cursor-import',
|
|
133
|
+
rules: [],
|
|
134
|
+
guidelines: allLines,
|
|
135
|
+
codingStyle: [],
|
|
136
|
+
},
|
|
137
|
+
metadata: {
|
|
138
|
+
source: 'cursor',
|
|
139
|
+
imported: new Date().toISOString(),
|
|
140
|
+
},
|
|
141
|
+
};
|
|
142
|
+
return {
|
|
143
|
+
success: true,
|
|
144
|
+
faf,
|
|
145
|
+
warnings,
|
|
146
|
+
sectionsFound: [],
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
const { rules, guidelines, codingStyle } = categorizeSections(parsed.sections);
|
|
150
|
+
const faf = {
|
|
151
|
+
project: {
|
|
152
|
+
name: parsed.projectName,
|
|
153
|
+
description: 'Imported from .cursorrules',
|
|
154
|
+
type: 'cursor-import',
|
|
155
|
+
rules,
|
|
156
|
+
guidelines,
|
|
157
|
+
codingStyle,
|
|
158
|
+
},
|
|
159
|
+
metadata: {
|
|
160
|
+
source: 'cursor',
|
|
161
|
+
imported: new Date().toISOString(),
|
|
162
|
+
},
|
|
163
|
+
};
|
|
164
|
+
return {
|
|
165
|
+
success: true,
|
|
166
|
+
faf,
|
|
167
|
+
warnings,
|
|
168
|
+
sectionsFound: parsed.sections.map(s => s.title),
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
function createEmptyFaf() {
|
|
172
|
+
return {
|
|
173
|
+
project: {
|
|
174
|
+
name: 'Unknown',
|
|
175
|
+
description: '',
|
|
176
|
+
type: 'cursor-import',
|
|
177
|
+
rules: [],
|
|
178
|
+
guidelines: [],
|
|
179
|
+
codingStyle: [],
|
|
180
|
+
},
|
|
181
|
+
metadata: {
|
|
182
|
+
source: 'cursor',
|
|
183
|
+
imported: new Date().toISOString(),
|
|
184
|
+
},
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
// ============================================================================
|
|
188
|
+
// Export: FAF -> .cursorrules
|
|
189
|
+
// ============================================================================
|
|
190
|
+
async function cursorExport(fafContent, outputPath) {
|
|
191
|
+
const warnings = [];
|
|
192
|
+
// Build .cursorrules content
|
|
193
|
+
const lines = [];
|
|
194
|
+
// Project header
|
|
195
|
+
const projectName = fafContent.project?.name || fafContent.name || 'My Project';
|
|
196
|
+
const projectGoal = fafContent.project?.goal || fafContent.project?.description || fafContent.ai_tldr?.project || '';
|
|
197
|
+
lines.push(`# ${projectName}`);
|
|
198
|
+
lines.push('');
|
|
199
|
+
if (projectGoal) {
|
|
200
|
+
lines.push(projectGoal);
|
|
201
|
+
lines.push('');
|
|
202
|
+
}
|
|
203
|
+
// Tech Stack section
|
|
204
|
+
const stack = fafContent.stack || fafContent.project?.stack || {};
|
|
205
|
+
const hasStack = stack.frontend || stack.backend || stack.build || stack.runtime;
|
|
206
|
+
if (hasStack) {
|
|
207
|
+
lines.push('## Tech Stack');
|
|
208
|
+
lines.push('');
|
|
209
|
+
if (stack.frontend)
|
|
210
|
+
lines.push(`- Frontend: ${stack.frontend}`);
|
|
211
|
+
if (stack.backend)
|
|
212
|
+
lines.push(`- Backend: ${stack.backend}`);
|
|
213
|
+
if (stack.runtime)
|
|
214
|
+
lines.push(`- Runtime: ${stack.runtime}`);
|
|
215
|
+
if (stack.build)
|
|
216
|
+
lines.push(`- Build: ${stack.build}`);
|
|
217
|
+
if (stack.package_manager)
|
|
218
|
+
lines.push(`- Package Manager: ${stack.package_manager}`);
|
|
219
|
+
if (stack.languages?.length > 0) {
|
|
220
|
+
lines.push(`- Languages: ${stack.languages.join(', ')}`);
|
|
221
|
+
}
|
|
222
|
+
if (stack.frameworks?.length > 0) {
|
|
223
|
+
lines.push(`- Frameworks: ${stack.frameworks.join(', ')}`);
|
|
224
|
+
}
|
|
225
|
+
lines.push('');
|
|
226
|
+
}
|
|
227
|
+
// Coding Standards section
|
|
228
|
+
const warnings_list = fafContent.ai_instructions?.warnings || [];
|
|
229
|
+
const workingStyle = fafContent.ai_instructions?.working_style || {};
|
|
230
|
+
const codingStyleItems = fafContent.project?.codingStyle || [];
|
|
231
|
+
const styleItems = [...codingStyleItems, ...warnings_list];
|
|
232
|
+
if (workingStyle.quality_bar)
|
|
233
|
+
styleItems.push(`Quality bar: ${workingStyle.quality_bar}`);
|
|
234
|
+
if (workingStyle.testing)
|
|
235
|
+
styleItems.push(`Testing: ${workingStyle.testing}`);
|
|
236
|
+
if (styleItems.length > 0) {
|
|
237
|
+
lines.push('## Coding Standards');
|
|
238
|
+
lines.push('');
|
|
239
|
+
for (const item of styleItems) {
|
|
240
|
+
lines.push(`- ${item}`);
|
|
241
|
+
}
|
|
242
|
+
lines.push('');
|
|
243
|
+
}
|
|
244
|
+
// Preferences section
|
|
245
|
+
const preferences = fafContent.preferences || {};
|
|
246
|
+
const prefItems = [];
|
|
247
|
+
if (preferences.quality_bar)
|
|
248
|
+
prefItems.push(`Quality bar: ${preferences.quality_bar}`);
|
|
249
|
+
if (preferences.commit_style)
|
|
250
|
+
prefItems.push(`Commit style: ${preferences.commit_style}`);
|
|
251
|
+
if (preferences.response_style)
|
|
252
|
+
prefItems.push(`Response style: ${preferences.response_style}`);
|
|
253
|
+
if (preferences.testing)
|
|
254
|
+
prefItems.push(`Testing: ${preferences.testing}`);
|
|
255
|
+
if (preferences.documentation)
|
|
256
|
+
prefItems.push(`Documentation: ${preferences.documentation}`);
|
|
257
|
+
if (prefItems.length > 0) {
|
|
258
|
+
lines.push('## Preferences');
|
|
259
|
+
lines.push('');
|
|
260
|
+
for (const item of prefItems) {
|
|
261
|
+
lines.push(`- ${item}`);
|
|
262
|
+
}
|
|
263
|
+
lines.push('');
|
|
264
|
+
}
|
|
265
|
+
// Build Commands section
|
|
266
|
+
const howContext = fafContent.human_context?.how || fafContent.context?.how;
|
|
267
|
+
if (howContext) {
|
|
268
|
+
lines.push('## Build Commands');
|
|
269
|
+
lines.push('');
|
|
270
|
+
lines.push(`- ${howContext}`);
|
|
271
|
+
lines.push('');
|
|
272
|
+
}
|
|
273
|
+
// General Instructions (rules + guidelines)
|
|
274
|
+
const ruleItems = fafContent.project?.rules || [];
|
|
275
|
+
const guidelineItems = fafContent.project?.guidelines || [];
|
|
276
|
+
const generalInstructions = [...ruleItems, ...guidelineItems];
|
|
277
|
+
if (generalInstructions.length > 0) {
|
|
278
|
+
lines.push('## General Instructions');
|
|
279
|
+
lines.push('');
|
|
280
|
+
for (const item of generalInstructions) {
|
|
281
|
+
lines.push(`- ${item}`);
|
|
282
|
+
}
|
|
283
|
+
lines.push('');
|
|
284
|
+
}
|
|
285
|
+
// Footer
|
|
286
|
+
lines.push('---');
|
|
287
|
+
lines.push(`Generated from project.faf by claude-faf-mcp — ${new Date().toISOString().split('T')[0]}`);
|
|
288
|
+
lines.push('');
|
|
289
|
+
// Write file
|
|
290
|
+
const content = lines.join('\n');
|
|
291
|
+
await fs_1.promises.writeFile(outputPath, content);
|
|
292
|
+
return {
|
|
293
|
+
success: true,
|
|
294
|
+
filePath: outputPath,
|
|
295
|
+
warnings,
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
// ============================================================================
|
|
299
|
+
// Detection
|
|
300
|
+
// ============================================================================
|
|
301
|
+
async function detectCursorRules(basePath) {
|
|
302
|
+
const possiblePaths = [
|
|
303
|
+
path_1.default.join(basePath, '.cursorrules'),
|
|
304
|
+
path_1.default.join(basePath, '.cursor-rules'),
|
|
305
|
+
];
|
|
306
|
+
for (const p of possiblePaths) {
|
|
307
|
+
try {
|
|
308
|
+
await fs_1.promises.access(p);
|
|
309
|
+
return p;
|
|
310
|
+
}
|
|
311
|
+
catch {
|
|
312
|
+
continue;
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
return null;
|
|
316
|
+
}
|
|
317
|
+
//# sourceMappingURL=cursorrules-parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cursorrules-parser.js","sourceRoot":"","sources":["../../../../src/faf-core/parsers/cursorrules-parser.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;;;AAuDH,4CAoDC;AAkCD,oCAwEC;AAuBD,oCAgHC;AAMD,8CAgBC;AAhXD,2BAAoC;AACpC,gDAAwB;AA6CxB,+EAA+E;AAC/E,UAAU;AACV,+EAA+E;AAE/E;;GAEG;AACH,SAAgB,gBAAgB,CAAC,OAAe;IAC9C,kEAAkE;IAClE,MAAM,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAC9F,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACrC,IAAI,WAAW,GAAG,iBAAiB,CAAC;IACpC,MAAM,QAAQ,GAAyB,EAAE,CAAC;IAC1C,IAAI,cAAc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AAY;AACZ,+EAA+E;AAExE,KAAK,UAAU,iBAAiB,CAAC,QAAgB;IACtD,MAAM,aAAa,GAAG;QACpB,cAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,cAAc,CAAC;QACnC,cAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,eAAe,CAAC;KACrC,CAAC;IAEF,KAAK,MAAM,CAAC,IAAI,aAAa,EAAE,CAAC;QAC9B,IAAI,CAAC;YACH,MAAM,aAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;YACnB,OAAO,CAAC,CAAC;QACX,CAAC;QAAC,MAAM,CAAC;YACP,SAAS;QACX,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FAF Generation for `faf git`
|
|
3
|
+
*
|
|
4
|
+
* Generates clean, accurate .faf files from GitHub repos without cloning.
|
|
5
|
+
* Output is compact and PR-ready — every line adds value.
|
|
6
|
+
*
|
|
7
|
+
* Ported from faf-cli for claude-faf-mcp v4.5.0
|
|
8
|
+
*/
|
|
9
|
+
import type { GitHubMetadata } from './github-extractor.js';
|
|
10
|
+
export interface Enhanced6Ws {
|
|
11
|
+
who: string;
|
|
12
|
+
what: string;
|
|
13
|
+
why: string;
|
|
14
|
+
where: string;
|
|
15
|
+
when: string;
|
|
16
|
+
how: string;
|
|
17
|
+
confidence: number;
|
|
18
|
+
}
|
|
19
|
+
export interface StackAnalysis {
|
|
20
|
+
frontend?: string;
|
|
21
|
+
backend?: string;
|
|
22
|
+
database?: string;
|
|
23
|
+
testing?: string;
|
|
24
|
+
buildTool?: string;
|
|
25
|
+
runtime?: string;
|
|
26
|
+
language?: string;
|
|
27
|
+
hosting?: string;
|
|
28
|
+
frameworks: string[];
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Extract 6 Ws from README content
|
|
32
|
+
*/
|
|
33
|
+
export declare function extract6WsFromReadme(readme: string, metadata: GitHubMetadata): Enhanced6Ws;
|
|
34
|
+
/**
|
|
35
|
+
* Extract stack from GitHub API languages array (source of truth)
|
|
36
|
+
* Languages are sorted by percentage descending — first entry is primary.
|
|
37
|
+
*/
|
|
38
|
+
export declare function extractFromLanguages(metadata: GitHubMetadata): StackAnalysis;
|
|
39
|
+
/**
|
|
40
|
+
* Analyze package.json for npm ecosystem details
|
|
41
|
+
*/
|
|
42
|
+
export declare function analyzePackageJson(packageJson: any, _metadata: GitHubMetadata): StackAnalysis;
|
|
43
|
+
/**
|
|
44
|
+
* Generate clean .faf file from GitHub repo metadata
|
|
45
|
+
*/
|
|
46
|
+
export declare function generateEnhancedFaf(metadata: GitHubMetadata, _files: any[]): Promise<{
|
|
47
|
+
content: string;
|
|
48
|
+
score: number;
|
|
49
|
+
}>;
|
|
50
|
+
/**
|
|
51
|
+
* Score tier for display (not written to file)
|
|
52
|
+
*/
|
|
53
|
+
export declare function getScoreTier(score: number): string;
|