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,246 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// claude-faf-mcp/src/handlers/fileHandler.ts
|
|
3
|
+
// 🏎️ FAF File Operations - Production Ready Implementation
|
|
4
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
5
|
+
if (k2 === undefined) k2 = k;
|
|
6
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
7
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
8
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
9
|
+
}
|
|
10
|
+
Object.defineProperty(o, k2, desc);
|
|
11
|
+
}) : (function(o, m, k, k2) {
|
|
12
|
+
if (k2 === undefined) k2 = k;
|
|
13
|
+
o[k2] = m[k];
|
|
14
|
+
}));
|
|
15
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
16
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
17
|
+
}) : function(o, v) {
|
|
18
|
+
o["default"] = v;
|
|
19
|
+
});
|
|
20
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
21
|
+
var ownKeys = function(o) {
|
|
22
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
23
|
+
var ar = [];
|
|
24
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
25
|
+
return ar;
|
|
26
|
+
};
|
|
27
|
+
return ownKeys(o);
|
|
28
|
+
};
|
|
29
|
+
return function (mod) {
|
|
30
|
+
if (mod && mod.__esModule) return mod;
|
|
31
|
+
var result = {};
|
|
32
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
33
|
+
__setModuleDefault(result, mod);
|
|
34
|
+
return result;
|
|
35
|
+
};
|
|
36
|
+
})();
|
|
37
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
+
exports.fileHandlers = exports.fafWriteTool = exports.fafReadTool = exports.PathValidator = void 0;
|
|
39
|
+
exports.handleFafRead = handleFafRead;
|
|
40
|
+
exports.handleFafWrite = handleFafWrite;
|
|
41
|
+
const fs = __importStar(require("fs/promises"));
|
|
42
|
+
const path = __importStar(require("path"));
|
|
43
|
+
/**
|
|
44
|
+
* Security validator for file paths
|
|
45
|
+
*/
|
|
46
|
+
class PathValidator {
|
|
47
|
+
static FORBIDDEN_PATHS = ['/etc', '/sys', '/proc', '/private/etc'];
|
|
48
|
+
static MAX_FILE_SIZE = 50 * 1024 * 1024; // 50MB
|
|
49
|
+
static validate(filePath) {
|
|
50
|
+
// Normalize and resolve path
|
|
51
|
+
const normalized = path.normalize(filePath);
|
|
52
|
+
const resolved = path.resolve(filePath);
|
|
53
|
+
// Check for path traversal
|
|
54
|
+
if (normalized.includes('..')) {
|
|
55
|
+
return { valid: false, error: 'Path traversal detected' };
|
|
56
|
+
}
|
|
57
|
+
// Check forbidden paths
|
|
58
|
+
for (const forbidden of this.FORBIDDEN_PATHS) {
|
|
59
|
+
if (resolved.startsWith(forbidden)) {
|
|
60
|
+
return { valid: false, error: `Access to ${forbidden} is forbidden` };
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return { valid: true };
|
|
64
|
+
}
|
|
65
|
+
static async checkFileSize(filePath) {
|
|
66
|
+
try {
|
|
67
|
+
const stats = await fs.stat(filePath);
|
|
68
|
+
if (stats.size > this.MAX_FILE_SIZE) {
|
|
69
|
+
return {
|
|
70
|
+
valid: false,
|
|
71
|
+
error: `File too large: ${(stats.size / 1024 / 1024).toFixed(2)}MB (max: 50MB)`
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
return { valid: true };
|
|
75
|
+
}
|
|
76
|
+
catch (_error) {
|
|
77
|
+
// File doesn't exist yet (for write operations)
|
|
78
|
+
return { valid: true };
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
exports.PathValidator = PathValidator;
|
|
83
|
+
/**
|
|
84
|
+
* FAF Read Tool Definition
|
|
85
|
+
*/
|
|
86
|
+
exports.fafReadTool = {
|
|
87
|
+
name: 'faf_read',
|
|
88
|
+
description: 'Read content from any file on the local filesystem',
|
|
89
|
+
inputSchema: {
|
|
90
|
+
type: 'object',
|
|
91
|
+
properties: {
|
|
92
|
+
path: {
|
|
93
|
+
type: 'string',
|
|
94
|
+
description: 'Absolute or relative file path to read'
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
required: ['path']
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* FAF Write Tool Definition
|
|
102
|
+
*/
|
|
103
|
+
exports.fafWriteTool = {
|
|
104
|
+
name: 'faf_write',
|
|
105
|
+
description: 'Write content to any file on the local filesystem',
|
|
106
|
+
inputSchema: {
|
|
107
|
+
type: 'object',
|
|
108
|
+
properties: {
|
|
109
|
+
path: {
|
|
110
|
+
type: 'string',
|
|
111
|
+
description: 'Absolute or relative file path to write'
|
|
112
|
+
},
|
|
113
|
+
content: {
|
|
114
|
+
type: 'string',
|
|
115
|
+
description: 'Content to write to the file'
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
required: ['path', 'content']
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
/**
|
|
122
|
+
* Handle faf_read tool execution
|
|
123
|
+
*/
|
|
124
|
+
async function handleFafRead(args) {
|
|
125
|
+
const startTime = Date.now();
|
|
126
|
+
try {
|
|
127
|
+
const { path: filePath } = args;
|
|
128
|
+
// Validate path
|
|
129
|
+
const pathValidation = PathValidator.validate(filePath);
|
|
130
|
+
if (!pathValidation.valid) {
|
|
131
|
+
return {
|
|
132
|
+
content: [{
|
|
133
|
+
type: 'text',
|
|
134
|
+
text: `❌ Security error: ${pathValidation.error}`
|
|
135
|
+
}],
|
|
136
|
+
isError: true
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
// Check file size
|
|
140
|
+
const sizeValidation = await PathValidator.checkFileSize(filePath);
|
|
141
|
+
if (!sizeValidation.valid) {
|
|
142
|
+
return {
|
|
143
|
+
content: [{
|
|
144
|
+
type: 'text',
|
|
145
|
+
text: `❌ ${sizeValidation.error}`
|
|
146
|
+
}],
|
|
147
|
+
isError: true
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
// Read file with timeout
|
|
151
|
+
const content = await Promise.race([
|
|
152
|
+
fs.readFile(filePath, 'utf8'),
|
|
153
|
+
new Promise((_, reject) => setTimeout(() => reject(new Error('Read timeout (30s)')), 30000))
|
|
154
|
+
]);
|
|
155
|
+
const duration = Date.now() - startTime;
|
|
156
|
+
const stats = await fs.stat(filePath);
|
|
157
|
+
return {
|
|
158
|
+
content: [{
|
|
159
|
+
type: 'text',
|
|
160
|
+
text: content
|
|
161
|
+
}],
|
|
162
|
+
metadata: {
|
|
163
|
+
duration_ms: duration,
|
|
164
|
+
file_size: stats.size,
|
|
165
|
+
file_path: path.resolve(filePath),
|
|
166
|
+
message: `✅ Read ${stats.size} bytes in ${duration}ms`
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
catch (error) {
|
|
171
|
+
return {
|
|
172
|
+
content: [{
|
|
173
|
+
type: 'text',
|
|
174
|
+
text: `❌ Failed to read file: ${error.message}`
|
|
175
|
+
}],
|
|
176
|
+
isError: true
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Handle faf_write tool execution
|
|
182
|
+
*/
|
|
183
|
+
async function handleFafWrite(args) {
|
|
184
|
+
const startTime = Date.now();
|
|
185
|
+
try {
|
|
186
|
+
const { path: filePath, content } = args;
|
|
187
|
+
// Validate path
|
|
188
|
+
const pathValidation = PathValidator.validate(filePath);
|
|
189
|
+
if (!pathValidation.valid) {
|
|
190
|
+
return {
|
|
191
|
+
content: [{
|
|
192
|
+
type: 'text',
|
|
193
|
+
text: `❌ Security error: ${pathValidation.error}`
|
|
194
|
+
}],
|
|
195
|
+
isError: true
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
// Check content size
|
|
199
|
+
const contentSize = Buffer.byteLength(content, 'utf8');
|
|
200
|
+
if (contentSize > 50 * 1024 * 1024) {
|
|
201
|
+
return {
|
|
202
|
+
content: [{
|
|
203
|
+
type: 'text',
|
|
204
|
+
text: `❌ Content too large: ${(contentSize / 1024 / 1024).toFixed(2)}MB (max: 50MB)`
|
|
205
|
+
}],
|
|
206
|
+
isError: true
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
// Create directory if needed
|
|
210
|
+
const dir = path.dirname(filePath);
|
|
211
|
+
await fs.mkdir(dir, { recursive: true });
|
|
212
|
+
// Write file with timeout
|
|
213
|
+
await Promise.race([
|
|
214
|
+
fs.writeFile(filePath, content, 'utf8'),
|
|
215
|
+
new Promise((_, reject) => setTimeout(() => reject(new Error('Write timeout (30s)')), 30000))
|
|
216
|
+
]);
|
|
217
|
+
const duration = Date.now() - startTime;
|
|
218
|
+
return {
|
|
219
|
+
content: [{
|
|
220
|
+
type: 'text',
|
|
221
|
+
text: `✅ Successfully wrote ${contentSize} bytes to ${path.resolve(filePath)}`
|
|
222
|
+
}],
|
|
223
|
+
metadata: {
|
|
224
|
+
duration_ms: duration,
|
|
225
|
+
bytes_written: contentSize,
|
|
226
|
+
file_path: path.resolve(filePath),
|
|
227
|
+
message: `✅ Write completed in ${duration}ms`
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
catch (error) {
|
|
232
|
+
return {
|
|
233
|
+
content: [{
|
|
234
|
+
type: 'text',
|
|
235
|
+
text: `❌ Failed to write file: ${error.message}`
|
|
236
|
+
}],
|
|
237
|
+
isError: true
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
// Export handlers
|
|
242
|
+
exports.fileHandlers = {
|
|
243
|
+
faf_read: handleFafRead,
|
|
244
|
+
faf_write: handleFafWrite
|
|
245
|
+
};
|
|
246
|
+
//# sourceMappingURL=fileHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fileHandler.js","sourceRoot":"","sources":["../../../src/handlers/fileHandler.ts"],"names":[],"mappings":";AAAA,6CAA6C;AAC7C,4DAA4D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6F5D,sCA+DC;AAKD,wCAkEC;AAjOD,gDAAkC;AAClC,2CAA6B;AAG7B;;GAEG;AACH,MAAa,aAAa;IAChB,MAAM,CAAU,eAAe,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;IAC5E,MAAM,CAAU,aAAa,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC,OAAO;IAEjE,MAAM,CAAC,QAAQ,CAAC,QAAgB;QAC9B,6BAA6B;QAC7B,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,QAA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C,CAAC;QAEH,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC;QAExC,OAAO;YACL,OAAO,EAAE,CAAC;oBACR,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,wBAAwB,WAAW,aAAa,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;iBAC/E,CAAC;YACF,QAAQ,EAAE;gBACR,WAAW,EAAE,QAAQ;gBACrB,aAAa,EAAE,WAAW;gBAC1B,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC;gBACjC,OAAO,EAAE,wBAAwB,QAAQ,IAAI;aAC9C;SACF,CAAC;IAEJ,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,OAAO;YACL,OAAO,EAAE,CAAC;oBACR,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,2BAA2B,KAAK,CAAC,OAAO,EAAE;iBACjD,CAAC;YACF,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;AACH,CAAC;AAED,kBAAkB;AACL,QAAA,YAAY,GAAG;IAC1B,QAAQ,EAAE,aAAa;IACvB,SAAS,EAAE,cAAc;CAC1B,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Resource } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
import { FafEngineAdapter } from './engine-adapter';
|
|
3
|
+
export declare class FafResourceHandler {
|
|
4
|
+
private engineAdapter;
|
|
5
|
+
constructor(engineAdapter: FafEngineAdapter);
|
|
6
|
+
listResources(): Promise<{
|
|
7
|
+
resources: Resource[];
|
|
8
|
+
}>;
|
|
9
|
+
readResource(uri: string): Promise<{
|
|
10
|
+
contents: {
|
|
11
|
+
uri: string;
|
|
12
|
+
mimeType: string;
|
|
13
|
+
text: any;
|
|
14
|
+
}[];
|
|
15
|
+
}>;
|
|
16
|
+
private getFafContext;
|
|
17
|
+
private getFafStatus;
|
|
18
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FafResourceHandler = void 0;
|
|
4
|
+
class FafResourceHandler {
|
|
5
|
+
engineAdapter;
|
|
6
|
+
constructor(engineAdapter) {
|
|
7
|
+
this.engineAdapter = engineAdapter;
|
|
8
|
+
}
|
|
9
|
+
async listResources() {
|
|
10
|
+
// Get the working directory for file system resources
|
|
11
|
+
const workingDir = process.env.FAF_WORKING_DIR ?? process.cwd();
|
|
12
|
+
return {
|
|
13
|
+
resources: [
|
|
14
|
+
{
|
|
15
|
+
uri: 'claude-faf://context',
|
|
16
|
+
name: 'Current FAF Context',
|
|
17
|
+
description: 'Current project FAF context and metadata',
|
|
18
|
+
mimeType: 'application/json'
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
uri: 'claude-faf://status',
|
|
22
|
+
name: 'FAF Status Summary',
|
|
23
|
+
description: 'Project health and AI readiness status',
|
|
24
|
+
mimeType: 'text/plain'
|
|
25
|
+
},
|
|
26
|
+
// Declare file system access for the working directory
|
|
27
|
+
{
|
|
28
|
+
uri: `file://${workingDir}`,
|
|
29
|
+
name: 'FAF Working Directory',
|
|
30
|
+
description: 'File system access for FAF operations',
|
|
31
|
+
mimeType: 'text/directory'
|
|
32
|
+
}
|
|
33
|
+
]
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
async readResource(uri) {
|
|
37
|
+
// Handle file:// URIs for file system access
|
|
38
|
+
if (uri.startsWith('file://')) {
|
|
39
|
+
return {
|
|
40
|
+
contents: [{
|
|
41
|
+
uri: uri,
|
|
42
|
+
mimeType: 'text/directory',
|
|
43
|
+
text: `File system resource: ${uri.replace('file://', '')}`
|
|
44
|
+
}]
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
switch (uri) {
|
|
48
|
+
case 'claude-faf://context':
|
|
49
|
+
return await this.getFafContext();
|
|
50
|
+
case 'claude-faf://status':
|
|
51
|
+
return await this.getFafStatus();
|
|
52
|
+
default:
|
|
53
|
+
throw new Error(`Unknown resource: ${uri}`);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
async getFafContext() {
|
|
57
|
+
const result = await this.engineAdapter.callEngine('status', ['--json']);
|
|
58
|
+
return {
|
|
59
|
+
contents: [{
|
|
60
|
+
uri: 'claude-faf://context',
|
|
61
|
+
mimeType: 'application/json',
|
|
62
|
+
text: JSON.stringify(result.success ? result.data : { error: result.error }, null, 2)
|
|
63
|
+
}]
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
async getFafStatus() {
|
|
67
|
+
const result = await this.engineAdapter.callEngine('status');
|
|
68
|
+
return {
|
|
69
|
+
contents: [{
|
|
70
|
+
uri: 'claude-faf://status',
|
|
71
|
+
mimeType: 'text/plain',
|
|
72
|
+
text: result.success ? (result.data?.output ?? String(result.data)) : `Error: ${result.error ?? 'Unknown error'}`
|
|
73
|
+
}]
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
exports.FafResourceHandler = FafResourceHandler;
|
|
78
|
+
//# sourceMappingURL=resources.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resources.js","sourceRoot":"","sources":["../../../src/handlers/resources.ts"],"names":[],"mappings":";;;AAGA,MAAa,kBAAkB;IACT;IAApB,YAAoB,aAA+B;QAA/B,kBAAa,GAAb,aAAa,CAAkB;IAAG,CAAC;IAEvD,KAAK,CAAC,aAAa;QACjB,sDAAsD;QACtD,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;QAEhE,OAAO;YACL,SAAS,EAAE;gBACT;oBACE,GAAG,EAAE,sBAAsB;oBAC3B,IAAI,EAAE,qBAAqB;oBAC3B,WAAW,EAAE,0CAA0C;oBACvD,QAAQ,EAAE,kBAAkB;iBAC7B;gBACD;oBACE,GAAG,EAAE,qBAAqB;oBAC1B,IAAI,EAAE,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AI,EAAE,CAAC,CAAC;iBACtF,CAAC;SACH,CAAC;IACJ,CAAC;IAEO,KAAK,CAAC,YAAY;QACxB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QAE7D,OAAO;YACL,QAAQ,EAAE,CAAC;oBACT,GAAG,EAAE,qBAAqB;oBAC1B,QAAQ,EAAE,YAAY;oBACtB,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,MAAM,CAAC,KAAK,IAAI,eAAe,EAAE;iBAClH,CAAC;SACH,CAAC;IACJ,CAAC;CACF;AA7ED,gDA6EC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 🏎️ FAF MCP Tool Registry with Visibility Support - v2.8.0
|
|
3
|
+
* Central registry for all MCP tools with metadata
|
|
4
|
+
* Championship-grade organization
|
|
5
|
+
*/
|
|
6
|
+
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
7
|
+
import { FafMcpTool } from '../types/mcp-tools.js';
|
|
8
|
+
/**
|
|
9
|
+
* Check if a tool should be visible based on configuration
|
|
10
|
+
*/
|
|
11
|
+
export declare function shouldShowTool(toolName: string, showAdvanced: boolean): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Add metadata to a tool definition
|
|
14
|
+
*/
|
|
15
|
+
export declare function enrichToolWithMetadata(tool: Tool): FafMcpTool;
|
|
16
|
+
/**
|
|
17
|
+
* Filter tools based on visibility configuration
|
|
18
|
+
*/
|
|
19
|
+
export declare function filterTools(tools: Tool[], showAdvanced: boolean): FafMcpTool[];
|
|
20
|
+
/**
|
|
21
|
+
* Get tool count summary
|
|
22
|
+
*/
|
|
23
|
+
export declare function getToolCountSummary(showAdvanced: boolean): string;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* 🏎️ FAF MCP Tool Registry with Visibility Support - v2.8.0
|
|
4
|
+
* Central registry for all MCP tools with metadata
|
|
5
|
+
* Championship-grade organization
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.shouldShowTool = shouldShowTool;
|
|
9
|
+
exports.enrichToolWithMetadata = enrichToolWithMetadata;
|
|
10
|
+
exports.filterTools = filterTools;
|
|
11
|
+
exports.getToolCountSummary = getToolCountSummary;
|
|
12
|
+
const tool_visibility_js_1 = require("../types/tool-visibility.js");
|
|
13
|
+
/**
|
|
14
|
+
* Check if a tool should be visible based on configuration
|
|
15
|
+
*/
|
|
16
|
+
function shouldShowTool(toolName, showAdvanced) {
|
|
17
|
+
const metadata = (0, tool_visibility_js_1.getToolMetadata)(toolName);
|
|
18
|
+
// If no metadata found, show by default for backward compatibility
|
|
19
|
+
if (!metadata) {
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
// If showAdvanced is true, show all tools
|
|
23
|
+
if (showAdvanced) {
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
// Otherwise, only show core tools
|
|
27
|
+
return metadata.visibility === 'core';
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Add metadata to a tool definition
|
|
31
|
+
*/
|
|
32
|
+
function enrichToolWithMetadata(tool) {
|
|
33
|
+
const metadata = (0, tool_visibility_js_1.getToolMetadata)(tool.name);
|
|
34
|
+
if (!metadata) {
|
|
35
|
+
// Return tool as-is if no metadata found
|
|
36
|
+
return tool;
|
|
37
|
+
}
|
|
38
|
+
return {
|
|
39
|
+
...tool,
|
|
40
|
+
metadata: {
|
|
41
|
+
visibility: metadata.visibility,
|
|
42
|
+
category: metadata.category,
|
|
43
|
+
priority: metadata.priority,
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Filter tools based on visibility configuration
|
|
49
|
+
*/
|
|
50
|
+
function filterTools(tools, showAdvanced) {
|
|
51
|
+
return tools
|
|
52
|
+
.filter((tool) => shouldShowTool(tool.name, showAdvanced))
|
|
53
|
+
.map((tool) => enrichToolWithMetadata(tool));
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Get tool count summary
|
|
57
|
+
*/
|
|
58
|
+
function getToolCountSummary(showAdvanced) {
|
|
59
|
+
const coreCount = Object.values(tool_visibility_js_1.TOOL_REGISTRY).filter((t) => t.visibility === 'core').length;
|
|
60
|
+
const totalCount = Object.values(tool_visibility_js_1.TOOL_REGISTRY).length;
|
|
61
|
+
if (showAdvanced) {
|
|
62
|
+
return `${totalCount} tools (${coreCount} core + ${totalCount - coreCount} advanced)`;
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
return `${coreCount} core tools`;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=tool-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-registry.js","sourceRoot":"","sources":["../../../src/handlers/tool-registry.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AASH,wCAeC;AAKD,wDAgBC;AAKD,kCAIC;AAKD,kDASC;AAjED,oEAA6E;AAG7E;;GAEG;AACH,SAAgB,cAAc,CAAC,QAAgB,EAAE,YAAqB;IACpE,MAAM,QAAQ,GAAG,IAAA,oCAAe,EAAC,QAAQ,CAAC,CAAC;IAE3C,mEAAmE;IACnE,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO,IAAI,CAAC;IACd,CAAC;IAED,0CAA0C;IAC1C,IAAI,YAAY,EAAE,CAAC;QACjB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,kCAAkC;IAClC,OAAO,QAAQ,CAAC,UAAU,KAAK,MAAM,CAAC;AACxC,CAAC;AAED;;GAEG;AACH,SAAgB,sBAAsB,CAAC,IAAU;IAC/C,MA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
+
*/
|
|
5
|
+
export interface FafToolArgs {
|
|
6
|
+
directory?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface FafDisplayArgs {
|
|
9
|
+
directory?: string;
|
|
10
|
+
output?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface FafAutoArgs {
|
|
13
|
+
directory?: string;
|
|
14
|
+
force?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface FafChooseArgs {
|
|
17
|
+
scan_dir?: string;
|
|
18
|
+
auto_open?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface FafInitArgs {
|
|
21
|
+
directory?: string;
|
|
22
|
+
force?: boolean;
|
|
23
|
+
template?: string;
|
|
24
|
+
project_type?: string;
|
|
25
|
+
}
|
|
26
|
+
export interface FafShowArgs {
|
|
27
|
+
command?: 'score' | 'status' | 'auto';
|
|
28
|
+
directory?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface FafScoreArgs {
|
|
31
|
+
directory?: string;
|
|
32
|
+
save?: boolean;
|
|
33
|
+
format?: 'markdown' | 'html' | 'json' | 'ascii';
|
|
34
|
+
full?: boolean;
|
|
35
|
+
}
|
|
36
|
+
export interface FafSyncArgs {
|
|
37
|
+
direction?: string;
|
|
38
|
+
}
|
|
39
|
+
export interface FafBiSyncArgs {
|
|
40
|
+
watch?: boolean;
|
|
41
|
+
force?: boolean;
|
|
42
|
+
}
|
|
43
|
+
export interface FafTrustArgs {
|
|
44
|
+
mode?: 'confidence' | 'garage' | 'panic' | 'validated';
|
|
45
|
+
}
|
|
46
|
+
export interface FafCreditArgs {
|
|
47
|
+
award?: boolean;
|
|
48
|
+
}
|
|
49
|
+
export interface FafTodoArgs {
|
|
50
|
+
add?: string;
|
|
51
|
+
complete?: number;
|
|
52
|
+
}
|
|
53
|
+
export interface FafChatArgs {
|
|
54
|
+
prompt?: string;
|
|
55
|
+
}
|
|
56
|
+
export interface FafShareArgs {
|
|
57
|
+
sanitize?: boolean;
|
|
58
|
+
}
|
|
59
|
+
export interface FafEnhanceArgs {
|
|
60
|
+
model?: string;
|
|
61
|
+
focus?: string;
|
|
62
|
+
}
|
|
63
|
+
export interface FafAnalyzeArgs {
|
|
64
|
+
model?: string;
|
|
65
|
+
depth?: string;
|
|
66
|
+
models?: string[];
|
|
67
|
+
}
|
|
68
|
+
export interface FafVerifyArgs {
|
|
69
|
+
checksum?: string;
|
|
70
|
+
models?: string[];
|
|
71
|
+
}
|
|
72
|
+
export interface FafSearchArgs {
|
|
73
|
+
query?: string;
|
|
74
|
+
type?: 'content' | 'filename' | 'both';
|
|
75
|
+
directory?: string;
|
|
76
|
+
}
|
|
77
|
+
export interface FafFaqArgs {
|
|
78
|
+
topic?: string;
|
|
79
|
+
}
|
|
80
|
+
export interface FafStatusArgs {
|
|
81
|
+
detailed?: boolean;
|
|
82
|
+
json?: boolean;
|
|
83
|
+
directory?: string;
|
|
84
|
+
}
|
|
85
|
+
export interface FafClearArgs {
|
|
86
|
+
cache?: boolean;
|
|
87
|
+
force?: boolean;
|
|
88
|
+
all?: boolean;
|
|
89
|
+
}
|
|
90
|
+
export interface FafEditArgs {
|
|
91
|
+
field?: string;
|
|
92
|
+
value?: string;
|
|
93
|
+
path?: string;
|
|
94
|
+
}
|
|
95
|
+
export interface FafListArgs {
|
|
96
|
+
pattern?: string;
|
|
97
|
+
path?: string;
|
|
98
|
+
recursive?: boolean;
|
|
99
|
+
}
|
|
100
|
+
export interface FafExistsArgs {
|
|
101
|
+
path?: string;
|
|
102
|
+
}
|
|
103
|
+
export interface FafDeleteArgs {
|
|
104
|
+
path?: string;
|
|
105
|
+
force?: boolean;
|
|
106
|
+
recursive?: boolean;
|
|
107
|
+
}
|
|
108
|
+
export interface FafMoveArgs {
|
|
109
|
+
source?: string;
|
|
110
|
+
destination?: string;
|
|
111
|
+
from?: string;
|
|
112
|
+
to?: string;
|
|
113
|
+
}
|
|
114
|
+
export interface FafCopyArgs {
|
|
115
|
+
source?: string;
|
|
116
|
+
destination?: string;
|
|
117
|
+
from?: string;
|
|
118
|
+
to?: string;
|
|
119
|
+
}
|
|
120
|
+
export interface FafMkdirArgs {
|
|
121
|
+
path?: string;
|
|
122
|
+
recursive?: boolean;
|
|
123
|
+
}
|
|
124
|
+
export interface FafReadArgs {
|
|
125
|
+
path: string;
|
|
126
|
+
}
|
|
127
|
+
export interface FafWriteArgs {
|
|
128
|
+
path: string;
|
|
129
|
+
content: string;
|
|
130
|
+
}
|
|
131
|
+
export interface FafFormatsArgs {
|
|
132
|
+
directory?: string;
|
|
133
|
+
}
|
|
134
|
+
export interface FafValidateArgs {
|
|
135
|
+
file?: string;
|
|
136
|
+
}
|
|
137
|
+
export interface FafDoctorArgs {
|
|
138
|
+
directory?: string;
|
|
139
|
+
}
|
|
140
|
+
export interface FafDnaArgs {
|
|
141
|
+
file?: string;
|
|
142
|
+
}
|
|
143
|
+
export interface FafLogArgs {
|
|
144
|
+
file?: string;
|
|
145
|
+
limit?: number;
|
|
146
|
+
}
|
|
147
|
+
export interface FafUpdateArgs {
|
|
148
|
+
file?: string;
|
|
149
|
+
force?: boolean;
|
|
150
|
+
}
|
|
151
|
+
export interface FafRecoverArgs {
|
|
152
|
+
file?: string;
|
|
153
|
+
timestamp?: string;
|
|
154
|
+
}
|
|
155
|
+
export interface FafAuthArgs {
|
|
156
|
+
action?: 'login' | 'logout' | 'status';
|
|
157
|
+
}
|
|
158
|
+
export interface FafAuditArgs {
|
|
159
|
+
file?: string;
|
|
160
|
+
detailed?: boolean;
|
|
161
|
+
}
|
|
162
|
+
export interface FafMigrateArgs {
|
|
163
|
+
directory?: string;
|
|
164
|
+
backup?: boolean;
|
|
165
|
+
}
|
|
166
|
+
export interface EmptyArgs {
|
|
167
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-types.js","sourceRoot":"","sources":["../../../src/handlers/tool-types.ts"],"names":[],"mappings":";AAAA;;;GAGG"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { CallToolResult, Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
import { FafEngineAdapter } from './engine-adapter';
|
|
3
|
+
export declare class FafToolHandler {
|
|
4
|
+
private engineAdapter;
|
|
5
|
+
constructor(engineAdapter: FafEngineAdapter);
|
|
6
|
+
listTools(): Promise<{
|
|
7
|
+
tools: Tool[];
|
|
8
|
+
}>;
|
|
9
|
+
callTool(name: string, args: any): Promise<CallToolResult>;
|
|
10
|
+
private handleFafStatus;
|
|
11
|
+
private handleFafScore;
|
|
12
|
+
private handleFafInit;
|
|
13
|
+
private handleFafTrust;
|
|
14
|
+
private handleFafSync;
|
|
15
|
+
private handleFafEnhance;
|
|
16
|
+
private handleFafBiSync;
|
|
17
|
+
private handleFafClear;
|
|
18
|
+
private handleFafAbout;
|
|
19
|
+
private handleFafWhat;
|
|
20
|
+
private handleFafDebug;
|
|
21
|
+
private handleFafChat;
|
|
22
|
+
private handleFafFriday;
|
|
23
|
+
private handleFafGuide;
|
|
24
|
+
private handleFafList;
|
|
25
|
+
}
|