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
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* 🔗 Bi-Sync Engine - Mk3 Bundled Edition
|
|
4
4
|
* Revolutionary project.faf ↔ CLAUDE.md Synchronization
|
|
5
|
+
* v4.5.0: Added agents/cursor/gemini/all flags for multi-format sync
|
|
5
6
|
*/
|
|
6
7
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
8
|
if (k2 === undefined) k2 = k;
|
|
@@ -37,102 +38,74 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
37
38
|
};
|
|
38
39
|
})();
|
|
39
40
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
-
exports.
|
|
41
|
+
exports.fafToClaudeMd = fafToClaudeMd;
|
|
41
42
|
exports.syncBiDirectional = syncBiDirectional;
|
|
42
43
|
const yaml_1 = require("../fix-once/yaml");
|
|
43
44
|
const path = __importStar(require("path"));
|
|
44
45
|
const fs_1 = require("fs");
|
|
45
46
|
const file_utils_1 = require("../utils/file-utils");
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
'.windsurfrules': { filename: '.windsurfrules', displayName: 'Windsurf' },
|
|
50
|
-
'CLAUDE.md': { filename: 'CLAUDE.md', displayName: 'Claude Desktop' }
|
|
51
|
-
};
|
|
52
|
-
async function detectPlatformTargets(projectDir) {
|
|
53
|
-
const existingTargets = [];
|
|
54
|
-
for (const targetKey of Object.keys(PLATFORM_TARGETS)) {
|
|
55
|
-
const targetPath = path.join(projectDir, PLATFORM_TARGETS[targetKey].filename);
|
|
56
|
-
if (await (0, file_utils_1.fileExists)(targetPath)) {
|
|
57
|
-
existingTargets.push(targetKey);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
return existingTargets;
|
|
61
|
-
}
|
|
62
|
-
function resolveTargets(targetOption, existingTargets) {
|
|
63
|
-
if (targetOption === 'all') {
|
|
64
|
-
return Object.keys(PLATFORM_TARGETS);
|
|
65
|
-
}
|
|
66
|
-
if (targetOption && targetOption !== 'auto' && PLATFORM_TARGETS[targetOption]) {
|
|
67
|
-
return [targetOption];
|
|
68
|
-
}
|
|
69
|
-
// Auto-detect: use existing files or default to CLAUDE.md
|
|
70
|
-
return existingTargets.length > 0 ? existingTargets : ['CLAUDE.md'];
|
|
71
|
-
}
|
|
47
|
+
const agents_js_1 = require("./agents.js");
|
|
48
|
+
const cursor_js_1 = require("./cursor.js");
|
|
49
|
+
const gemini_js_1 = require("./gemini.js");
|
|
72
50
|
/**
|
|
73
|
-
* 🔄 Convert project.faf YAML content to
|
|
51
|
+
* 🔄 Convert project.faf YAML content to CLAUDE.md Markdown format
|
|
74
52
|
*/
|
|
75
|
-
function
|
|
53
|
+
function fafToClaudeMd(fafContent) {
|
|
76
54
|
try {
|
|
77
55
|
const fafData = (0, yaml_1.parse)(fafContent);
|
|
78
|
-
|
|
79
|
-
const headerName = platformInfo.filename.toUpperCase().replace(/\./g, '');
|
|
80
|
-
let content = `# 🏎️ ${headerName} - ${fafData.project?.name || 'Project'} Persistent Context\n\n`;
|
|
81
|
-
content += `**Platform:** ${platformInfo.displayName}\n`;
|
|
82
|
-
content += `**Synced from:** project.faf (IANA format: application/vnd.faf+yaml)\n\n`;
|
|
56
|
+
let claudeMd = `# 🏎️ CLAUDE.md - ${fafData.project?.name || 'Project'} Persistent Context & Intelligence\n\n`;
|
|
83
57
|
// Project State
|
|
84
58
|
if (fafData.project) {
|
|
85
|
-
|
|
59
|
+
claudeMd += `## PROJECT STATE: ${fafData.context_quality?.overall_assessment || 'ACTIVE'} 🚀\n`;
|
|
86
60
|
if (fafData.project.goal) {
|
|
87
|
-
|
|
61
|
+
claudeMd += `**Current Position:** ${fafData.project.goal}\n`;
|
|
88
62
|
}
|
|
89
|
-
|
|
90
|
-
|
|
63
|
+
claudeMd += `**Tyre Compound:** ULTRASOFT C5 (Maximum Performance)\n\n`;
|
|
64
|
+
claudeMd += `---\n\n`;
|
|
91
65
|
}
|
|
92
66
|
// Core Context
|
|
93
|
-
|
|
67
|
+
claudeMd += `## 🎨 CORE CONTEXT\n\n`;
|
|
94
68
|
if (fafData.project) {
|
|
95
|
-
|
|
96
|
-
|
|
69
|
+
claudeMd += `### Project Identity\n`;
|
|
70
|
+
claudeMd += `- **Name:** ${fafData.project.name || 'Unknown'}\n`;
|
|
97
71
|
if (fafData.instant_context?.tech_stack) {
|
|
98
|
-
|
|
72
|
+
claudeMd += `- **Stack:** ${fafData.instant_context.tech_stack}\n`;
|
|
99
73
|
}
|
|
100
|
-
|
|
74
|
+
claudeMd += `- **Quality:** F1-INSPIRED (Championship Performance)\n\n`;
|
|
101
75
|
}
|
|
102
76
|
// Technical Context
|
|
103
77
|
if (fafData.instant_context) {
|
|
104
|
-
|
|
78
|
+
claudeMd += `### Technical Architecture\n`;
|
|
105
79
|
if (fafData.instant_context.what_building) {
|
|
106
|
-
|
|
80
|
+
claudeMd += `- **What Building:** ${fafData.instant_context.what_building}\n`;
|
|
107
81
|
}
|
|
108
82
|
if (fafData.instant_context.main_language) {
|
|
109
|
-
|
|
83
|
+
claudeMd += `- **Main Language:** ${fafData.instant_context.main_language}\n`;
|
|
110
84
|
}
|
|
111
|
-
|
|
85
|
+
claudeMd += `\n`;
|
|
112
86
|
}
|
|
113
87
|
// Context Quality
|
|
114
88
|
if (fafData.context_quality) {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
89
|
+
claudeMd += `### 📊 Context Quality Status\n`;
|
|
90
|
+
claudeMd += `- **Overall Assessment:** ${fafData.context_quality.overall_assessment || 'Good'}\n`;
|
|
91
|
+
claudeMd += `- **Last Updated:** ${new Date().toISOString().split('T')[0]}\n\n`;
|
|
118
92
|
}
|
|
119
93
|
// Championship Footer
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
return content;
|
|
94
|
+
claudeMd += `---\n\n`;
|
|
95
|
+
claudeMd += `**STATUS: BI-SYNC ACTIVE 🔗 - Synchronized with .faf context!**\n\n`;
|
|
96
|
+
claudeMd += `*Last Sync: ${new Date().toISOString()}*\n`;
|
|
97
|
+
claudeMd += `*Sync Engine: F1-Inspired Software Engineering*\n`;
|
|
98
|
+
claudeMd += `*🏎️⚡️_championship_sync*\n`;
|
|
99
|
+
return claudeMd;
|
|
127
100
|
}
|
|
128
101
|
catch (error) {
|
|
129
102
|
throw new Error(`Failed to convert .faf to CLAUDE.md: ${error instanceof Error ? error.message : String(error)}`);
|
|
130
103
|
}
|
|
131
104
|
}
|
|
132
105
|
/**
|
|
133
|
-
* 🔗 Main Bi-Sync function
|
|
106
|
+
* 🔗 Main Bi-Sync function
|
|
134
107
|
*/
|
|
135
|
-
async function syncBiDirectional(projectPath,
|
|
108
|
+
async function syncBiDirectional(projectPath, _options = {}) {
|
|
136
109
|
const startTime = Date.now();
|
|
137
110
|
const result = {
|
|
138
111
|
success: false,
|
|
@@ -151,41 +124,72 @@ async function syncBiDirectional(projectPath, options = {}) {
|
|
|
151
124
|
return result;
|
|
152
125
|
}
|
|
153
126
|
const projectDir = path.dirname(fafPath);
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
const targetsToSync = resolveTargets(options.target, existingTargets);
|
|
127
|
+
const claudeMdPath = path.join(projectDir, 'CLAUDE.md');
|
|
128
|
+
// Check what exists
|
|
129
|
+
const claudeMdExists = await (0, file_utils_1.fileExists)(claudeMdPath);
|
|
158
130
|
// Read .faf content
|
|
159
131
|
const fafContent = await fs_1.promises.readFile(fafPath, 'utf-8');
|
|
160
132
|
const fafData = (0, yaml_1.parse)(fafContent);
|
|
161
133
|
const currentScore = fafData.faf_score || '0%';
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
const
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
134
|
+
if (!claudeMdExists) {
|
|
135
|
+
// Create CLAUDE.md from project.faf
|
|
136
|
+
const claudeMdContent = fafToClaudeMd(fafContent);
|
|
137
|
+
await fs_1.promises.writeFile(claudeMdPath, claudeMdContent, 'utf-8');
|
|
138
|
+
result.success = true;
|
|
139
|
+
result.direction = 'faf-to-claude';
|
|
140
|
+
result.filesChanged.push('CLAUDE.md');
|
|
141
|
+
result.message = `CLAUDE.md created! Bi-sync now active! FAF Score: ${currentScore}`;
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
// Both files exist - update CLAUDE.md from project.faf
|
|
145
|
+
const claudeMdContent = fafToClaudeMd(fafContent);
|
|
146
|
+
await fs_1.promises.writeFile(claudeMdPath, claudeMdContent, 'utf-8');
|
|
147
|
+
result.success = true;
|
|
148
|
+
result.direction = 'faf-to-claude';
|
|
149
|
+
result.filesChanged.push('CLAUDE.md');
|
|
150
|
+
result.message = `Files synchronized! Perfect harmony achieved! FAF Score: ${currentScore}`;
|
|
151
|
+
}
|
|
152
|
+
// v4.5.0: Chain additional format exports if requested
|
|
153
|
+
const doAgents = _options.agents || _options.all;
|
|
154
|
+
const doCursor = _options.cursor || _options.all;
|
|
155
|
+
const doGemini = _options.gemini || _options.all;
|
|
156
|
+
if (doAgents) {
|
|
157
|
+
try {
|
|
158
|
+
const agentsResult = await (0, agents_js_1.agentsExportCommand)(projectDir, { force: true });
|
|
159
|
+
if (agentsResult.success) {
|
|
160
|
+
result.filesChanged.push('AGENTS.md');
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
catch {
|
|
164
|
+
// Non-fatal — CLAUDE.md sync already succeeded
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
if (doCursor) {
|
|
168
|
+
try {
|
|
169
|
+
const cursorResult = await (0, cursor_js_1.cursorExportCommand)(projectDir, { force: true });
|
|
170
|
+
if (cursorResult.success) {
|
|
171
|
+
result.filesChanged.push('.cursorrules');
|
|
171
172
|
}
|
|
172
173
|
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
result.filesChanged.push(path.basename(targetPath));
|
|
174
|
+
catch {
|
|
175
|
+
// Non-fatal
|
|
176
|
+
}
|
|
177
177
|
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
178
|
+
if (doGemini) {
|
|
179
|
+
try {
|
|
180
|
+
const geminiResult = await (0, gemini_js_1.geminiExportCommand)(projectDir, { force: true });
|
|
181
|
+
if (geminiResult.success) {
|
|
182
|
+
result.filesChanged.push('GEMINI.md');
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
catch {
|
|
186
|
+
// Non-fatal
|
|
187
|
+
}
|
|
184
188
|
}
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
result.message = `Synced to ${targetsToSync.length} platforms (${platforms})! FAF Score: ${currentScore}`;
|
|
189
|
+
if (result.filesChanged.length > 1) {
|
|
190
|
+
result.message += ` | Also synced: ${result.filesChanged.filter(f => f !== 'CLAUDE.md').join(', ')}`;
|
|
188
191
|
}
|
|
192
|
+
result.duration = Date.now() - startTime;
|
|
189
193
|
return result;
|
|
190
194
|
}
|
|
191
195
|
catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bi-sync.js","sourceRoot":"","sources":["../../../../src/faf-core/commands/bi-sync.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"bi-sync.js","sourceRoot":"","sources":["../../../../src/faf-core/commands/bi-sync.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCH,sCA2DC;AAKD,8CAuGC;AAtMD,2CAAsD;AACtD,2CAA6B;AAC7B,2BAAoC;AACpC,oDAA8D;AAC9D,2CAAkD;AAClD,2CAAkD;AAClD,2CAAkD;AAsBlD;;GAEG;AACH,SAAgB,aAAa,CAAC,UAAkB;IAC9C,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,IAAA,YAAS,EAAC,UAAU,CAAC,CAAC;QAEtC,IAAI,QAAQ,GAAG,qBAAqB,OAAO,CAAC,OAAO,EAAE,IAAI,IAAI,SAAS,wCAAwC,CAAC;QAE/G,gBAAgB;QAChB,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;YACpB,QAAQ,IAAI,qBAAqB,OAAO,CAAC,eAAe,EAAE,kBAAkB,IAAI,QAAQ,OAAO,CAAC;YAChG,IAAI,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;gBACzB,QAAQ,IAAI,yBAAyB,OAAO,CAAC,OAAO,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AC;YACnC,MAAM,CAAC,OAAO,IAAI,mBAAmB,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,WAAW,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QACvG,CAAC;QAED,MAAM,CAAC,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC;QACzC,OAAO,MAAM,CAAC;IAEhB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,CAAC,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC;QACzC,MAAM,CAAC,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC;QACxE,OAAO,MAAM,CAAC;IAChB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Conductor Command - v4.5.0 Interop Edition
|
|
3
|
+
*
|
|
4
|
+
* Import/Export between conductor/ directory and project.faf
|
|
5
|
+
* Bundled command — no CLI dependency required.
|
|
6
|
+
*/
|
|
7
|
+
export interface ConductorCommandResult {
|
|
8
|
+
success: boolean;
|
|
9
|
+
action: 'import' | 'export';
|
|
10
|
+
message: string;
|
|
11
|
+
data?: any;
|
|
12
|
+
warnings?: string[];
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Import conductor/ directory into project.faf
|
|
16
|
+
*/
|
|
17
|
+
export declare function conductorImportCommand(projectPath: string, options?: {
|
|
18
|
+
merge?: boolean;
|
|
19
|
+
}): Promise<ConductorCommandResult>;
|
|
20
|
+
/**
|
|
21
|
+
* Export project.faf to conductor/ directory
|
|
22
|
+
*/
|
|
23
|
+
export declare function conductorExportCommand(projectPath: string, options?: {
|
|
24
|
+
force?: boolean;
|
|
25
|
+
}): Promise<ConductorCommandResult>;
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Conductor Command - v4.5.0 Interop Edition
|
|
4
|
+
*
|
|
5
|
+
* Import/Export between conductor/ directory and project.faf
|
|
6
|
+
* Bundled command — no CLI dependency required.
|
|
7
|
+
*/
|
|
8
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.conductorImportCommand = conductorImportCommand;
|
|
13
|
+
exports.conductorExportCommand = conductorExportCommand;
|
|
14
|
+
const path_1 = __importDefault(require("path"));
|
|
15
|
+
const fs_1 = require("fs");
|
|
16
|
+
const file_utils_js_1 = require("../utils/file-utils.js");
|
|
17
|
+
const yaml_js_1 = require("../fix-once/yaml.js");
|
|
18
|
+
const conductor_parser_js_1 = require("../parsers/conductor-parser.js");
|
|
19
|
+
/**
|
|
20
|
+
* Import conductor/ directory into project.faf
|
|
21
|
+
*/
|
|
22
|
+
async function conductorImportCommand(projectPath, options = {}) {
|
|
23
|
+
const hasConductor = await (0, conductor_parser_js_1.detectConductor)(projectPath);
|
|
24
|
+
if (!hasConductor) {
|
|
25
|
+
return {
|
|
26
|
+
success: false,
|
|
27
|
+
action: 'import',
|
|
28
|
+
message: 'No conductor/ directory found in project',
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
const conductorPath = path_1.default.join(projectPath, 'conductor');
|
|
32
|
+
const result = await (0, conductor_parser_js_1.conductorImport)(conductorPath);
|
|
33
|
+
if (!result.success) {
|
|
34
|
+
return {
|
|
35
|
+
success: false,
|
|
36
|
+
action: 'import',
|
|
37
|
+
message: result.warnings.join(', '),
|
|
38
|
+
warnings: result.warnings,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
if (options.merge) {
|
|
42
|
+
const fafPath = await (0, file_utils_js_1.findFafFile)(projectPath);
|
|
43
|
+
if (fafPath) {
|
|
44
|
+
try {
|
|
45
|
+
const existingContent = await fs_1.promises.readFile(fafPath, 'utf-8');
|
|
46
|
+
const existingFaf = (0, yaml_js_1.parse)(existingContent);
|
|
47
|
+
const merged = {
|
|
48
|
+
...existingFaf,
|
|
49
|
+
project: {
|
|
50
|
+
...(existingFaf.project || {}),
|
|
51
|
+
name: result.faf.project.name || existingFaf.project?.name,
|
|
52
|
+
description: result.faf.project.description || existingFaf.project?.description,
|
|
53
|
+
goals: [
|
|
54
|
+
...(existingFaf.project?.goals || []),
|
|
55
|
+
...result.faf.project.goals,
|
|
56
|
+
],
|
|
57
|
+
stack: {
|
|
58
|
+
...(existingFaf.project?.stack || {}),
|
|
59
|
+
...result.faf.project.stack,
|
|
60
|
+
},
|
|
61
|
+
rules: [
|
|
62
|
+
...(existingFaf.project?.rules || []),
|
|
63
|
+
...result.faf.project.rules,
|
|
64
|
+
],
|
|
65
|
+
guidelines: [
|
|
66
|
+
...(existingFaf.project?.guidelines || []),
|
|
67
|
+
...result.faf.project.guidelines,
|
|
68
|
+
],
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
const yamlContent = (0, yaml_js_1.stringify)(merged);
|
|
72
|
+
await fs_1.promises.writeFile(fafPath, yamlContent);
|
|
73
|
+
return {
|
|
74
|
+
success: true,
|
|
75
|
+
action: 'import',
|
|
76
|
+
message: `Merged conductor/ into existing .faf (${result.filesProcessed.length} files)`,
|
|
77
|
+
data: { filesProcessed: result.filesProcessed, merged: true },
|
|
78
|
+
warnings: result.warnings,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
// Fall through
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return {
|
|
87
|
+
success: true,
|
|
88
|
+
action: 'import',
|
|
89
|
+
message: `Imported conductor/ (${result.filesProcessed.length} files processed)`,
|
|
90
|
+
data: { faf: result.faf, filesProcessed: result.filesProcessed },
|
|
91
|
+
warnings: result.warnings,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Export project.faf to conductor/ directory
|
|
96
|
+
*/
|
|
97
|
+
async function conductorExportCommand(projectPath, options = {}) {
|
|
98
|
+
const fafPath = await (0, file_utils_js_1.findFafFile)(projectPath);
|
|
99
|
+
if (!fafPath) {
|
|
100
|
+
return {
|
|
101
|
+
success: false,
|
|
102
|
+
action: 'export',
|
|
103
|
+
message: 'No .faf file found. Run faf init first.',
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
const outputPath = path_1.default.join(projectPath, 'conductor');
|
|
107
|
+
// Check if conductor/ already exists
|
|
108
|
+
if (!options.force) {
|
|
109
|
+
try {
|
|
110
|
+
const stat = await fs_1.promises.stat(outputPath);
|
|
111
|
+
if (stat.isDirectory()) {
|
|
112
|
+
return {
|
|
113
|
+
success: false,
|
|
114
|
+
action: 'export',
|
|
115
|
+
message: 'conductor/ directory already exists. Use force: true to overwrite.',
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
catch {
|
|
120
|
+
// Doesn't exist, proceed
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
const fafContent = await fs_1.promises.readFile(fafPath, 'utf-8');
|
|
124
|
+
const fafData = (0, yaml_js_1.parse)(fafContent);
|
|
125
|
+
// Build the conductor-compatible structure
|
|
126
|
+
const conductorFaf = {
|
|
127
|
+
project: {
|
|
128
|
+
name: fafData.project?.name || 'Unknown',
|
|
129
|
+
description: fafData.project?.description || fafData.project?.goal || '',
|
|
130
|
+
type: fafData.project?.type || 'application',
|
|
131
|
+
goals: fafData.project?.goals || [],
|
|
132
|
+
stack: {
|
|
133
|
+
languages: fafData.stack?.languages || fafData.project?.stack?.languages || [],
|
|
134
|
+
frameworks: fafData.stack?.frameworks || fafData.project?.stack?.frameworks || [],
|
|
135
|
+
databases: fafData.stack?.databases || fafData.project?.stack?.databases || [],
|
|
136
|
+
infrastructure: fafData.stack?.infrastructure || fafData.project?.stack?.infrastructure || [],
|
|
137
|
+
},
|
|
138
|
+
rules: fafData.project?.rules || [],
|
|
139
|
+
guidelines: fafData.project?.guidelines || [],
|
|
140
|
+
},
|
|
141
|
+
metadata: {
|
|
142
|
+
source: 'faf',
|
|
143
|
+
imported: new Date().toISOString(),
|
|
144
|
+
},
|
|
145
|
+
};
|
|
146
|
+
const result = await (0, conductor_parser_js_1.conductorExport)(conductorFaf, outputPath);
|
|
147
|
+
return {
|
|
148
|
+
success: result.success,
|
|
149
|
+
action: 'export',
|
|
150
|
+
message: result.success
|
|
151
|
+
? `Exported project.faf to conductor/ (${result.filesGenerated.length} files)`
|
|
152
|
+
: 'Export failed',
|
|
153
|
+
data: { filesGenerated: result.filesGenerated },
|
|
154
|
+
warnings: result.warnings,
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
//# sourceMappingURL=conductor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conductor.js","sourceRoot":"","sources":["../../../../src/faf-core/commands/conductor.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;AAwBH,wDAiFC;AAKD,wDAmEC;AA/KD,gDAAwB;AACxB,2BAAoC;AACpC,0DAAqD;AACrD,iDAAqF;AACrF,wEAKwC;AAUxC;;GAEG;AACI,KAAK,UAAU,sBAAsB,CAC1C,WAAmB,EACnB,UAA+B,EAAE;IAEjC,MAAM,YAAY,GAAG,MAAM,IAAA,qCAAe,EAAC,WAAW,CAAC,CAAC;IAExD,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,OAAO;YACL,OAAO,EAAE,KAAK;YACd,MAAM,EAAE,QAAQ;YAChB,OAAO,EAAE,0CAA0C;SACpD,CAAC;IACJ,CAAC;IAED,MAAM,aAAa,GAAG,cAAI,CAAC,IAAI,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;IAC1D,MAAM,MAAM,GAAG,MAAM,IAAA,qCAAe,EAAC,aAAa,CAAC,CAAC;IAEpD,IAAI,CAA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OAAO,CAAC,KAAK,EAAE,SAAS,IAAI,OAAO,CAAC,OAAO,EAAE,KAAK,EAAE,SAAS,IAAI,EAAE;gBAC9E,cAAc,EAAE,OAAO,CAAC,KAAK,EAAE,cAAc,IAAI,OAAO,CAAC,OAAO,EAAE,KAAK,EAAE,cAAc,IAAI,EAAE;aAC9F;YACD,KAAK,EAAE,OAAO,CAAC,OAAO,EAAE,KAAK,IAAI,EAAE;YACnC,UAAU,EAAE,OAAO,CAAC,OAAO,EAAE,UAAU,IAAI,EAAE;SAC9C;QACD,QAAQ,EAAE;YACR,MAAM,EAAE,KAAK;YACb,QAAQ,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACnC;KACF,CAAC;IAEF,MAAM,MAAM,GAAG,MAAM,IAAA,qCAAe,EAAC,YAAY,EAAE,UAAU,CAAC,CAAC;IAE/D,OAAO;QACL,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,MAAM,EAAE,QAAQ;QAChB,OAAO,EAAE,MAAM,CAAC,OAAO;YACrB,CAAC,CAAC,uCAAuC,MAAM,CAAC,cAAc,CAAC,MAAM,SAAS;YAC9E,CAAC,CAAC,eAAe;QACnB,IAAI,EAAE,EAAE,cAAc,EAAE,MAAM,CAAC,cAAc,EAAE;QAC/C,QAAQ,EAAE,MAAM,CAAC,QAAQ;KAC1B,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cursor Command - v4.5.0 Interop Edition
|
|
3
|
+
*
|
|
4
|
+
* Import/Export/Sync between .cursorrules and project.faf
|
|
5
|
+
* Bundled command — no CLI dependency required.
|
|
6
|
+
*/
|
|
7
|
+
export interface CursorCommandResult {
|
|
8
|
+
success: boolean;
|
|
9
|
+
action: 'import' | 'export' | 'sync';
|
|
10
|
+
message: string;
|
|
11
|
+
data?: any;
|
|
12
|
+
warnings?: string[];
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Import .cursorrules into project.faf
|
|
16
|
+
*/
|
|
17
|
+
export declare function cursorImportCommand(projectPath: string, options?: {
|
|
18
|
+
merge?: boolean;
|
|
19
|
+
}): Promise<CursorCommandResult>;
|
|
20
|
+
/**
|
|
21
|
+
* Export project.faf to .cursorrules
|
|
22
|
+
*/
|
|
23
|
+
export declare function cursorExportCommand(projectPath: string, options?: {
|
|
24
|
+
force?: boolean;
|
|
25
|
+
}): Promise<CursorCommandResult>;
|
|
26
|
+
/**
|
|
27
|
+
* Sync .cursorrules <-> project.faf
|
|
28
|
+
*/
|
|
29
|
+
export declare function cursorSyncCommand(projectPath: string): Promise<CursorCommandResult>;
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Cursor Command - v4.5.0 Interop Edition
|
|
4
|
+
*
|
|
5
|
+
* Import/Export/Sync between .cursorrules and project.faf
|
|
6
|
+
* Bundled command — no CLI dependency required.
|
|
7
|
+
*/
|
|
8
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.cursorImportCommand = cursorImportCommand;
|
|
13
|
+
exports.cursorExportCommand = cursorExportCommand;
|
|
14
|
+
exports.cursorSyncCommand = cursorSyncCommand;
|
|
15
|
+
const path_1 = __importDefault(require("path"));
|
|
16
|
+
const fs_1 = require("fs");
|
|
17
|
+
const file_utils_js_1 = require("../utils/file-utils.js");
|
|
18
|
+
const yaml_js_1 = require("../fix-once/yaml.js");
|
|
19
|
+
const cursorrules_parser_js_1 = require("../parsers/cursorrules-parser.js");
|
|
20
|
+
/**
|
|
21
|
+
* Import .cursorrules into project.faf
|
|
22
|
+
*/
|
|
23
|
+
async function cursorImportCommand(projectPath, options = {}) {
|
|
24
|
+
const cursorPath = await (0, cursorrules_parser_js_1.detectCursorRules)(projectPath);
|
|
25
|
+
if (!cursorPath) {
|
|
26
|
+
return {
|
|
27
|
+
success: false,
|
|
28
|
+
action: 'import',
|
|
29
|
+
message: 'No .cursorrules found in project directory',
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
const result = await (0, cursorrules_parser_js_1.cursorImport)(cursorPath);
|
|
33
|
+
if (!result.success) {
|
|
34
|
+
return {
|
|
35
|
+
success: false,
|
|
36
|
+
action: 'import',
|
|
37
|
+
message: result.warnings.join(', '),
|
|
38
|
+
warnings: result.warnings,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
// If merge mode, read existing .faf and merge
|
|
42
|
+
if (options.merge) {
|
|
43
|
+
const fafPath = await (0, file_utils_js_1.findFafFile)(projectPath);
|
|
44
|
+
if (fafPath) {
|
|
45
|
+
try {
|
|
46
|
+
const existingContent = await fs_1.promises.readFile(fafPath, 'utf-8');
|
|
47
|
+
const existingFaf = (0, yaml_js_1.parse)(existingContent);
|
|
48
|
+
const merged = {
|
|
49
|
+
...existingFaf,
|
|
50
|
+
project: {
|
|
51
|
+
...(existingFaf.project || {}),
|
|
52
|
+
rules: [
|
|
53
|
+
...(existingFaf.project?.rules || []),
|
|
54
|
+
...result.faf.project.rules,
|
|
55
|
+
],
|
|
56
|
+
guidelines: [
|
|
57
|
+
...(existingFaf.project?.guidelines || []),
|
|
58
|
+
...result.faf.project.guidelines,
|
|
59
|
+
],
|
|
60
|
+
codingStyle: [
|
|
61
|
+
...(existingFaf.project?.codingStyle || []),
|
|
62
|
+
...result.faf.project.codingStyle,
|
|
63
|
+
],
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
const yamlContent = (0, yaml_js_1.stringify)(merged);
|
|
67
|
+
await fs_1.promises.writeFile(fafPath, yamlContent);
|
|
68
|
+
return {
|
|
69
|
+
success: true,
|
|
70
|
+
action: 'import',
|
|
71
|
+
message: `Merged .cursorrules into existing .faf (${result.sectionsFound.length} sections)`,
|
|
72
|
+
data: { sectionsFound: result.sectionsFound, merged: true },
|
|
73
|
+
warnings: result.warnings,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
// Fall through to return import data
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return {
|
|
82
|
+
success: true,
|
|
83
|
+
action: 'import',
|
|
84
|
+
message: `Imported .cursorrules (${result.sectionsFound.length} sections found)`,
|
|
85
|
+
data: { faf: result.faf, sectionsFound: result.sectionsFound },
|
|
86
|
+
warnings: result.warnings,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Export project.faf to .cursorrules
|
|
91
|
+
*/
|
|
92
|
+
async function cursorExportCommand(projectPath, options = {}) {
|
|
93
|
+
const fafPath = await (0, file_utils_js_1.findFafFile)(projectPath);
|
|
94
|
+
if (!fafPath) {
|
|
95
|
+
return {
|
|
96
|
+
success: false,
|
|
97
|
+
action: 'export',
|
|
98
|
+
message: 'No .faf file found. Run faf init first.',
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
const outputPath = path_1.default.join(projectPath, '.cursorrules');
|
|
102
|
+
if (!options.force) {
|
|
103
|
+
try {
|
|
104
|
+
await fs_1.promises.access(outputPath);
|
|
105
|
+
return {
|
|
106
|
+
success: false,
|
|
107
|
+
action: 'export',
|
|
108
|
+
message: '.cursorrules already exists. Use force: true to overwrite.',
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
catch {
|
|
112
|
+
// File doesn't exist, proceed
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
const fafContent = await fs_1.promises.readFile(fafPath, 'utf-8');
|
|
116
|
+
const fafData = (0, yaml_js_1.parse)(fafContent);
|
|
117
|
+
const result = await (0, cursorrules_parser_js_1.cursorExport)(fafData, outputPath);
|
|
118
|
+
return {
|
|
119
|
+
success: result.success,
|
|
120
|
+
action: 'export',
|
|
121
|
+
message: result.success
|
|
122
|
+
? `Exported project.faf to .cursorrules`
|
|
123
|
+
: 'Export failed',
|
|
124
|
+
data: { filePath: result.filePath },
|
|
125
|
+
warnings: result.warnings,
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Sync .cursorrules <-> project.faf
|
|
130
|
+
*/
|
|
131
|
+
async function cursorSyncCommand(projectPath) {
|
|
132
|
+
return await cursorExportCommand(projectPath, { force: true });
|
|
133
|
+
}
|
|
134
|
+
//# sourceMappingURL=cursor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cursor.js","sourceRoot":"","sources":["../../../../src/faf-core/commands/cursor.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;AAuBH,kDA2EC;AAKD,kDAyCC;AAKD,8CAIC;AAvJD,gDAAwB;AACxB,2BAAoC;AACpC,0DAAqD;AACrD,iDAAqF;AACrF,4EAI0C;AAU1C;;GAEG;AACI,KAAK,UAAU,mBAAmB,CACvC,WAAmB,EACnB,UAA+B,EAAE;IAEjC,MAAM,UAAU,GAAG,MAAM,IAAA,yCAAiB,EAAC,WAAW,CAAC,CAAC;IAExD,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO;YACL,OAAO,EAAE,KAAK;YACd,MAAM,EAAE,QAAQ;YAChB,OAAO,EAAE,4CAA4C;SACtD,CAAC;IACJ,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,IAAA,oCAAY,EAAC,UAAU,CAAC,CAAC;IAE9C,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,OAAO;YACL,OAAO,EAAE,KAAK;YACd,MAAM,EAAE,QAAQ;YAChB,OAAO,EAAE,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC;YACnC,QAAQ,EAAE,MAAM,CAAC,QAAQ;SAC1B,CAAC;IACJ,CAAC;IAED,8CAA8C;IAC9C,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;QAClB,MAAM,OAAO,GAAG,MAAM,IAAA,2BAAW,EAAC,WAAW,CAAC,C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