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.
Files changed (100) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/CLAUDE.md +5 -5
  3. package/README.md +70 -14
  4. package/assets/thumbnail.png +0 -0
  5. package/dist/src/faf-core/commands/agents.d.ts +29 -0
  6. package/dist/src/faf-core/commands/agents.js +140 -0
  7. package/dist/src/faf-core/commands/agents.js.map +1 -0
  8. package/dist/src/faf-core/commands/bi-sync.d.ts +9 -5
  9. package/dist/src/faf-core/commands/bi-sync.js +89 -85
  10. package/dist/src/faf-core/commands/bi-sync.js.map +1 -1
  11. package/dist/src/faf-core/commands/conductor.d.ts +25 -0
  12. package/dist/src/faf-core/commands/conductor.js +157 -0
  13. package/dist/src/faf-core/commands/conductor.js.map +1 -0
  14. package/dist/src/faf-core/commands/cursor.d.ts +29 -0
  15. package/dist/src/faf-core/commands/cursor.js +134 -0
  16. package/dist/src/faf-core/commands/cursor.js.map +1 -0
  17. package/dist/src/faf-core/commands/gemini.d.ts +29 -0
  18. package/dist/src/faf-core/commands/gemini.js +133 -0
  19. package/dist/src/faf-core/commands/gemini.js.map +1 -0
  20. package/dist/src/faf-core/commands/git-context.d.ts +23 -0
  21. package/dist/src/faf-core/commands/git-context.js +66 -0
  22. package/dist/src/faf-core/commands/git-context.js.map +1 -0
  23. package/dist/src/faf-core/commands/human.d.ts +27 -0
  24. package/dist/src/faf-core/commands/human.js +183 -0
  25. package/dist/src/faf-core/commands/human.js.map +1 -0
  26. package/dist/src/faf-core/commands/readme.d.ts +47 -0
  27. package/dist/src/faf-core/commands/readme.js +361 -0
  28. package/dist/src/faf-core/commands/readme.js.map +1 -0
  29. package/dist/src/faf-core/engines/fab-formats-processor.js +3 -3
  30. package/dist/src/faf-core/engines/fab-formats-processor.js.map +1 -1
  31. package/dist/src/faf-core/engines/faf-dna.d.ts +1 -1
  32. package/dist/src/faf-core/engines/faf-dna.js +4 -3
  33. package/dist/src/faf-core/engines/faf-dna.js.map +1 -1
  34. package/dist/src/faf-core/generators/faf-generator-championship.js +9 -8
  35. package/dist/src/faf-core/generators/faf-generator-championship.js.map +1 -1
  36. package/dist/src/faf-core/parsers/agents-parser.d.ts +59 -0
  37. package/dist/src/faf-core/parsers/agents-parser.js +324 -0
  38. package/dist/src/faf-core/parsers/agents-parser.js.map +1 -0
  39. package/dist/src/faf-core/parsers/conductor-parser.d.ts +85 -0
  40. package/dist/src/faf-core/parsers/conductor-parser.js +293 -0
  41. package/dist/src/faf-core/parsers/conductor-parser.js.map +1 -0
  42. package/dist/src/faf-core/parsers/cursorrules-parser.d.ts +57 -0
  43. package/dist/src/faf-core/parsers/cursorrules-parser.js +317 -0
  44. package/dist/src/faf-core/parsers/cursorrules-parser.js.map +1 -0
  45. package/dist/src/faf-core/parsers/faf-git-generator.d.ts +53 -0
  46. package/dist/src/faf-core/parsers/faf-git-generator.js +512 -0
  47. package/dist/src/faf-core/parsers/faf-git-generator.js.map +1 -0
  48. package/dist/src/faf-core/parsers/gemini-parser.d.ts +57 -0
  49. package/dist/src/faf-core/parsers/gemini-parser.js +263 -0
  50. package/dist/src/faf-core/parsers/gemini-parser.js.map +1 -0
  51. package/dist/src/faf-core/parsers/github-extractor.d.ts +61 -0
  52. package/dist/src/faf-core/parsers/github-extractor.js +374 -0
  53. package/dist/src/faf-core/parsers/github-extractor.js.map +1 -0
  54. package/dist/src/faf-core/parsers/index.d.ts +12 -0
  55. package/dist/src/{compiler → faf-core/parsers}/index.js +10 -5
  56. package/dist/src/faf-core/parsers/index.js.map +1 -0
  57. package/dist/src/faf-core/parsers/slot-counter.d.ts +55 -0
  58. package/dist/src/faf-core/parsers/slot-counter.js +100 -0
  59. package/dist/src/faf-core/parsers/slot-counter.js.map +1 -0
  60. package/dist/src/faf-core/utils/balance-visualizer.js +3 -3
  61. package/dist/src/faf-core/utils/balance-visualizer.js.map +1 -1
  62. package/dist/src/handlers/championship-tools.d.ts +10 -5
  63. package/dist/src/handlers/championship-tools.js +259 -232
  64. package/dist/src/handlers/championship-tools.js.map +1 -1
  65. package/dist/src/handlers/engine-adapter.js +238 -5
  66. package/dist/src/handlers/engine-adapter.js.map +1 -1
  67. package/dist/src/handlers/tools.d.ts +61 -0
  68. package/dist/src/handlers/tools.js +2103 -102
  69. package/dist/src/handlers/tools.js.map +1 -1
  70. package/dist/src/index.js +0 -0
  71. package/dist/src/types/tool-visibility.js +51 -10
  72. package/dist/src/types/tool-visibility.js.map +1 -1
  73. package/dist/src/utils/championship-format.js +11 -9
  74. package/dist/src/utils/championship-format.js.map +1 -1
  75. package/dist/src/utils/path-resolver.js +56 -2
  76. package/dist/src/utils/path-resolver.js.map +1 -1
  77. package/dist/src/utils/visual-style.js +7 -5
  78. package/dist/src/utils/visual-style.js.map +1 -1
  79. package/dist/src/version.js +24 -11
  80. package/dist/src/version.js.map +1 -1
  81. package/package.json +5 -3
  82. package/project.faf +14 -18
  83. package/dist/index.json +0 -1
  84. package/dist/src/compiler/index.d.ts +0 -7
  85. package/dist/src/compiler/index.js.map +0 -1
  86. package/dist/src/compiler/scorer.d.ts +0 -53
  87. package/dist/src/compiler/scorer.js +0 -189
  88. package/dist/src/compiler/scorer.js.map +0 -1
  89. package/dist/src/compiler/slot-validator.d.ts +0 -32
  90. package/dist/src/compiler/slot-validator.js +0 -293
  91. package/dist/src/compiler/slot-validator.js.map +0 -1
  92. package/dist/src/compiler/type-detector.d.ts +0 -62
  93. package/dist/src/compiler/type-detector.js +0 -388
  94. package/dist/src/compiler/type-detector.js.map +0 -1
  95. package/dist/src/types/project-types.d.ts +0 -22
  96. package/dist/src/types/project-types.js +0 -85
  97. package/dist/src/types/project-types.js.map +0 -1
  98. package/dist/src/types/slots.d.ts +0 -39
  99. package/dist/src/types/slots.js +0 -162
  100. package/dist/src/types/slots.js.map +0 -1
@@ -0,0 +1,85 @@
1
+ /**
2
+ * Conductor Format Parser
3
+ *
4
+ * Parses Google's Conductor extension format (conductor/ directory)
5
+ * for bidirectional interoperability with FAF.
6
+ *
7
+ * Ported from faf-cli for claude-faf-mcp v4.5.0
8
+ */
9
+ export interface ConductorProduct {
10
+ title: string;
11
+ description: string;
12
+ goals: string[];
13
+ users: string[];
14
+ features: string[];
15
+ }
16
+ export interface ConductorTechStack {
17
+ languages: string[];
18
+ frameworks: string[];
19
+ databases: string[];
20
+ infrastructure: string[];
21
+ }
22
+ export interface ConductorWorkflow {
23
+ developmentProcess: string[];
24
+ commitStrategy: string[];
25
+ reviewProcess: string[];
26
+ }
27
+ export interface ConductorGuidelines {
28
+ proseStyle: string[];
29
+ brandingRules: string[];
30
+ visualIdentity: string[];
31
+ }
32
+ export interface ConductorDirectory {
33
+ product?: ConductorProduct;
34
+ techStack?: ConductorTechStack;
35
+ workflow?: ConductorWorkflow;
36
+ guidelines?: ConductorGuidelines;
37
+ styleguides?: Record<string, string[]>;
38
+ }
39
+ export interface FafFromConductor {
40
+ project: {
41
+ name: string;
42
+ description: string;
43
+ type: string;
44
+ goals: string[];
45
+ stack: {
46
+ languages: string[];
47
+ frameworks: string[];
48
+ databases: string[];
49
+ infrastructure: string[];
50
+ };
51
+ rules: string[];
52
+ guidelines: string[];
53
+ };
54
+ metadata: {
55
+ source: string;
56
+ imported: string;
57
+ conductor_version?: string;
58
+ };
59
+ }
60
+ export interface ImportResult {
61
+ success: boolean;
62
+ faf: FafFromConductor;
63
+ warnings: string[];
64
+ filesProcessed: string[];
65
+ }
66
+ export interface ExportResult {
67
+ success: boolean;
68
+ filesGenerated: string[];
69
+ warnings: string[];
70
+ }
71
+ /**
72
+ * Parse markdown content and extract sections by heading
73
+ */
74
+ export declare function parseMarkdownSections(content: string): Record<string, string>;
75
+ /**
76
+ * Extract bullet points from markdown content
77
+ */
78
+ export declare function extractBulletPoints(content: string): string[];
79
+ export declare function parseProductMd(content: string): ConductorProduct;
80
+ export declare function parseTechStackMd(content: string): ConductorTechStack;
81
+ export declare function parseWorkflowMd(content: string): ConductorWorkflow;
82
+ export declare function parseGuidelinesMd(content: string): ConductorGuidelines;
83
+ export declare function conductorImport(conductorPath: string): Promise<ImportResult>;
84
+ export declare function conductorExport(faf: FafFromConductor, outputPath: string): Promise<ExportResult>;
85
+ export declare function detectConductor(basePath: string): Promise<boolean>;
@@ -0,0 +1,293 @@
1
+ "use strict";
2
+ /**
3
+ * Conductor Format Parser
4
+ *
5
+ * Parses Google's Conductor extension format (conductor/ directory)
6
+ * for bidirectional interoperability with FAF.
7
+ *
8
+ * Ported from faf-cli for claude-faf-mcp v4.5.0
9
+ */
10
+ var __importDefault = (this && this.__importDefault) || function (mod) {
11
+ return (mod && mod.__esModule) ? mod : { "default": mod };
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.parseMarkdownSections = parseMarkdownSections;
15
+ exports.extractBulletPoints = extractBulletPoints;
16
+ exports.parseProductMd = parseProductMd;
17
+ exports.parseTechStackMd = parseTechStackMd;
18
+ exports.parseWorkflowMd = parseWorkflowMd;
19
+ exports.parseGuidelinesMd = parseGuidelinesMd;
20
+ exports.conductorImport = conductorImport;
21
+ exports.conductorExport = conductorExport;
22
+ exports.detectConductor = detectConductor;
23
+ const fs_1 = require("fs");
24
+ const path_1 = __importDefault(require("path"));
25
+ // ============================================================================
26
+ // Markdown Parsing
27
+ // ============================================================================
28
+ /**
29
+ * Parse markdown content and extract sections by heading
30
+ */
31
+ function parseMarkdownSections(content) {
32
+ const sections = {};
33
+ const lines = content.split('\n');
34
+ let currentSection = '_intro';
35
+ let currentContent = [];
36
+ for (const line of lines) {
37
+ const headingMatch = line.match(/^##\s+(.+)$/);
38
+ if (headingMatch) {
39
+ if (currentContent.length > 0) {
40
+ sections[currentSection] = currentContent.join('\n').trim();
41
+ }
42
+ currentSection = headingMatch[1].toLowerCase().replace(/\s+/g, '_');
43
+ currentContent = [];
44
+ }
45
+ else if (line.match(/^#\s+(.+)$/)) {
46
+ const titleMatch = line.match(/^#\s+(.+)$/);
47
+ if (titleMatch) {
48
+ sections['_title'] = titleMatch[1];
49
+ }
50
+ }
51
+ else {
52
+ currentContent.push(line);
53
+ }
54
+ }
55
+ if (currentContent.length > 0) {
56
+ sections[currentSection] = currentContent.join('\n').trim();
57
+ }
58
+ return sections;
59
+ }
60
+ /**
61
+ * Extract bullet points from markdown content
62
+ */
63
+ function extractBulletPoints(content) {
64
+ const lines = content.split('\n');
65
+ const bullets = [];
66
+ for (const line of lines) {
67
+ const bulletMatch = line.match(/^[-*]\s+(.+)$/);
68
+ if (bulletMatch) {
69
+ bullets.push(bulletMatch[1].trim());
70
+ }
71
+ }
72
+ return bullets;
73
+ }
74
+ // ============================================================================
75
+ // File Parsers
76
+ // ============================================================================
77
+ function parseProductMd(content) {
78
+ const sections = parseMarkdownSections(content);
79
+ return {
80
+ title: sections['_title'] || 'Unknown Project',
81
+ description: sections['overview'] || '',
82
+ goals: extractBulletPoints(sections['goals'] || ''),
83
+ users: extractBulletPoints(sections['target_users'] || ''),
84
+ features: extractBulletPoints(sections['key_features'] || ''),
85
+ };
86
+ }
87
+ function parseTechStackMd(content) {
88
+ const sections = parseMarkdownSections(content);
89
+ return {
90
+ languages: extractBulletPoints(sections['languages'] || ''),
91
+ frameworks: extractBulletPoints(sections['frameworks'] || ''),
92
+ databases: extractBulletPoints(sections['databases'] || ''),
93
+ infrastructure: extractBulletPoints(sections['infrastructure'] || ''),
94
+ };
95
+ }
96
+ function parseWorkflowMd(content) {
97
+ const sections = parseMarkdownSections(content);
98
+ return {
99
+ developmentProcess: extractBulletPoints(sections['development_process'] || ''),
100
+ commitStrategy: extractBulletPoints(sections['commit_strategy'] || ''),
101
+ reviewProcess: extractBulletPoints(sections['review_process'] || ''),
102
+ };
103
+ }
104
+ function parseGuidelinesMd(content) {
105
+ const sections = parseMarkdownSections(content);
106
+ return {
107
+ proseStyle: extractBulletPoints(sections['prose_style'] || ''),
108
+ brandingRules: extractBulletPoints(sections['branding_rules'] || ''),
109
+ visualIdentity: extractBulletPoints(sections['visual_identity'] || ''),
110
+ };
111
+ }
112
+ // ============================================================================
113
+ // Import: Conductor -> FAF
114
+ // ============================================================================
115
+ async function conductorImport(conductorPath) {
116
+ const warnings = [];
117
+ const filesProcessed = [];
118
+ const faf = {
119
+ project: {
120
+ name: 'Unknown',
121
+ description: '',
122
+ type: 'conductor-import',
123
+ goals: [],
124
+ stack: {
125
+ languages: [],
126
+ frameworks: [],
127
+ databases: [],
128
+ infrastructure: [],
129
+ },
130
+ rules: [],
131
+ guidelines: [],
132
+ },
133
+ metadata: {
134
+ source: 'conductor',
135
+ imported: new Date().toISOString(),
136
+ },
137
+ };
138
+ // Parse product.md
139
+ const productPath = path_1.default.join(conductorPath, 'product.md');
140
+ try {
141
+ const content = await fs_1.promises.readFile(productPath, 'utf-8');
142
+ const product = parseProductMd(content);
143
+ faf.project.name = product.title;
144
+ faf.project.description = product.description;
145
+ faf.project.goals = product.goals;
146
+ filesProcessed.push('product.md');
147
+ }
148
+ catch {
149
+ warnings.push('product.md not found - using defaults');
150
+ }
151
+ // Parse tech-stack.md
152
+ const techStackPath = path_1.default.join(conductorPath, 'tech-stack.md');
153
+ try {
154
+ const content = await fs_1.promises.readFile(techStackPath, 'utf-8');
155
+ const techStack = parseTechStackMd(content);
156
+ faf.project.stack = techStack;
157
+ filesProcessed.push('tech-stack.md');
158
+ }
159
+ catch {
160
+ warnings.push('tech-stack.md not found - stack will be empty');
161
+ }
162
+ // Parse workflow.md
163
+ const workflowPath = path_1.default.join(conductorPath, 'workflow.md');
164
+ try {
165
+ const content = await fs_1.promises.readFile(workflowPath, 'utf-8');
166
+ const workflow = parseWorkflowMd(content);
167
+ faf.project.rules = [
168
+ ...workflow.developmentProcess,
169
+ ...workflow.commitStrategy,
170
+ ...workflow.reviewProcess,
171
+ ];
172
+ filesProcessed.push('workflow.md');
173
+ }
174
+ catch {
175
+ warnings.push('workflow.md not found - rules will be empty');
176
+ }
177
+ // Parse product-guidelines.md
178
+ const guidelinesPath = path_1.default.join(conductorPath, 'product-guidelines.md');
179
+ try {
180
+ const content = await fs_1.promises.readFile(guidelinesPath, 'utf-8');
181
+ const guidelines = parseGuidelinesMd(content);
182
+ faf.project.guidelines = [
183
+ ...guidelines.proseStyle,
184
+ ...guidelines.brandingRules,
185
+ ...guidelines.visualIdentity,
186
+ ];
187
+ filesProcessed.push('product-guidelines.md');
188
+ }
189
+ catch {
190
+ warnings.push('product-guidelines.md not found - guidelines will be empty');
191
+ }
192
+ return {
193
+ success: filesProcessed.length > 0,
194
+ faf,
195
+ warnings,
196
+ filesProcessed,
197
+ };
198
+ }
199
+ // ============================================================================
200
+ // Export: FAF -> Conductor
201
+ // ============================================================================
202
+ async function conductorExport(faf, outputPath) {
203
+ const filesGenerated = [];
204
+ const warnings = [];
205
+ // Ensure output directory exists
206
+ try {
207
+ await fs_1.promises.mkdir(outputPath, { recursive: true });
208
+ }
209
+ catch (err) {
210
+ return {
211
+ success: false,
212
+ filesGenerated: [],
213
+ warnings: [`Failed to create output directory: ${err}`],
214
+ };
215
+ }
216
+ // Generate product.md
217
+ const productContent = `# ${faf.project.name}
218
+
219
+ ## Overview
220
+ ${faf.project.description}
221
+
222
+ ## Goals
223
+ ${faf.project.goals.map(g => `- ${g}`).join('\n')}
224
+ `;
225
+ await fs_1.promises.writeFile(path_1.default.join(outputPath, 'product.md'), productContent);
226
+ filesGenerated.push('product.md');
227
+ // Generate tech-stack.md
228
+ const techStackContent = `# Tech Stack
229
+
230
+ ## Languages
231
+ ${faf.project.stack.languages.map(l => `- ${l}`).join('\n')}
232
+
233
+ ## Frameworks
234
+ ${faf.project.stack.frameworks.map(f => `- ${f}`).join('\n')}
235
+
236
+ ## Databases
237
+ ${faf.project.stack.databases.map(d => `- ${d}`).join('\n')}
238
+
239
+ ## Infrastructure
240
+ ${faf.project.stack.infrastructure.map(i => `- ${i}`).join('\n')}
241
+ `;
242
+ await fs_1.promises.writeFile(path_1.default.join(outputPath, 'tech-stack.md'), techStackContent);
243
+ filesGenerated.push('tech-stack.md');
244
+ // Generate workflow.md
245
+ const workflowContent = `# Workflow
246
+
247
+ ## Rules
248
+ ${faf.project.rules.map(r => `- ${r}`).join('\n')}
249
+ `;
250
+ await fs_1.promises.writeFile(path_1.default.join(outputPath, 'workflow.md'), workflowContent);
251
+ filesGenerated.push('workflow.md');
252
+ // Generate product-guidelines.md
253
+ const guidelinesContent = `# Product Guidelines
254
+
255
+ ## Guidelines
256
+ ${faf.project.guidelines.map(g => `- ${g}`).join('\n')}
257
+ `;
258
+ await fs_1.promises.writeFile(path_1.default.join(outputPath, 'product-guidelines.md'), guidelinesContent);
259
+ filesGenerated.push('product-guidelines.md');
260
+ return {
261
+ success: true,
262
+ filesGenerated,
263
+ warnings,
264
+ };
265
+ }
266
+ // ============================================================================
267
+ // Detection
268
+ // ============================================================================
269
+ async function detectConductor(basePath) {
270
+ const conductorPath = path_1.default.join(basePath, 'conductor');
271
+ try {
272
+ const stat = await fs_1.promises.stat(conductorPath);
273
+ if (!stat.isDirectory()) {
274
+ return false;
275
+ }
276
+ }
277
+ catch {
278
+ return false;
279
+ }
280
+ // Check for at least one required file
281
+ const requiredFiles = ['product.md', 'tech-stack.md', 'workflow.md'];
282
+ for (const file of requiredFiles) {
283
+ try {
284
+ await fs_1.promises.access(path_1.default.join(conductorPath, file));
285
+ return true;
286
+ }
287
+ catch {
288
+ continue;
289
+ }
290
+ }
291
+ return false;
292
+ }
293
+ //# sourceMappingURL=conductor-parser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conductor-parser.js","sourceRoot":"","sources":["../../../../src/faf-core/parsers/conductor-parser.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;;;AAsFH,sDA6BC;AAKD,kDAYC;AAMD,wCAUC;AAED,4CASC;AAED,0CAQC;AAED,8CAQC;AAMD,0CAqFC;AAMD,0CAuEC;AAMD,0CAsBC;AArXD,2BAAoC;AACpC,gDAAwB;AA4ExB,+EAA+E;AAC/E,mBAAmB;AACnB,+EAA+E;AAE/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+EAA+E;AAC/E,YAAY;AACZ,+EAA+E;AAExE,KAAK,UAAU,eAAe,CAAC,QAAgB;IACpD,MAAM,aAAa,GAAG,cAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;IAEvD,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,MAAM,aAAE,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAC1C,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;YAAA,OAAO,KAAK,CAAC;QAAA,CAAC;IAC1C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;IAED,uCAAuC;IACvC,MAAM,aAAa,GAAG,CAAC,YAAY,EAAE,eAAe,EAAE,aAAa,CAAC,CAAC;IACrE,KAAK,MAAM,IAAI,IAAI,aAAa,EAAE,CAAC;QACjC,IAAI,CAAC;YACH,MAAM,aAAE,CAAC,MAAM,CAAC,cAAI,CAAC,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC,CAAC;YAChD,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,MAAM,CAAC;YACP,SAAS;QACX,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,57 @@
1
+ /**
2
+ * .cursorrules Parser
3
+ *
4
+ * Parses Cursor IDE .cursorrules files for bidirectional
5
+ * interoperability with FAF.
6
+ *
7
+ * .cursorrules Structure:
8
+ * - Free-form markdown with sections
9
+ * - H2: Section headers (optional)
10
+ * - Bullets/paragraphs: Guidelines and rules
11
+ *
12
+ * Note: This generates legacy .cursorrules (single file).
13
+ * The new .cursor/rules/ MDC directory format is a future enhancement.
14
+ *
15
+ * Ported from faf-cli for claude-faf-mcp v4.5.0
16
+ */
17
+ export interface CursorRulesSection {
18
+ title: string;
19
+ content: string[];
20
+ }
21
+ export interface CursorRulesFile {
22
+ projectName: string;
23
+ sections: CursorRulesSection[];
24
+ rawLines: string[];
25
+ }
26
+ export interface FafFromCursor {
27
+ project: {
28
+ name: string;
29
+ description: string;
30
+ type: string;
31
+ rules: string[];
32
+ guidelines: string[];
33
+ codingStyle: string[];
34
+ };
35
+ metadata: {
36
+ source: string;
37
+ imported: string;
38
+ };
39
+ }
40
+ export interface CursorImportResult {
41
+ success: boolean;
42
+ faf: FafFromCursor;
43
+ warnings: string[];
44
+ sectionsFound: string[];
45
+ }
46
+ export interface CursorExportResult {
47
+ success: boolean;
48
+ filePath: string;
49
+ warnings: string[];
50
+ }
51
+ /**
52
+ * Parse .cursorrules file content
53
+ */
54
+ export declare function parseCursorRules(content: string): CursorRulesFile;
55
+ export declare function cursorImport(cursorPath: string): Promise<CursorImportResult>;
56
+ export declare function cursorExport(fafContent: any, outputPath: string): Promise<CursorExportResult>;
57
+ export declare function detectCursorRules(basePath: string): Promise<string | null>;