@elliotding/ai-agent-mcp 0.1.24 → 0.1.26
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/README.md +27 -0
- package/package.json +4 -1
- package/.prompt-cache/cmd-cmd-client-sdk-ai-hub-generate-testcase.md +0 -101
- package/.prompt-cache/cmd-cmd-client-sdk-ai-hub-submit_zct_job.md +0 -158
- package/.prompt-cache/skill-skill-client-sdk-ai-hub-analyze-conf-status.md +0 -311
- package/.prompt-cache/skill-skill-client-sdk-ai-hub-analyze-sdk-log.md +0 -64
- package/.prompt-cache/skill-skill-client-sdk-ai-hub-analyze-zmb-log-errors.md +0 -84
- package/ai-resource-telemetry.json +0 -40
- package/dist/api/cached-client.d.ts +0 -48
- package/dist/api/cached-client.d.ts.map +0 -1
- package/dist/api/cached-client.js +0 -126
- package/dist/api/cached-client.js.map +0 -1
- package/dist/api/client.d.ts +0 -281
- package/dist/api/client.d.ts.map +0 -1
- package/dist/api/client.js +0 -371
- package/dist/api/client.js.map +0 -1
- package/dist/auth/index.d.ts +0 -8
- package/dist/auth/index.d.ts.map +0 -1
- package/dist/auth/index.js +0 -26
- package/dist/auth/index.js.map +0 -1
- package/dist/auth/middleware.d.ts +0 -36
- package/dist/auth/middleware.d.ts.map +0 -1
- package/dist/auth/middleware.js +0 -194
- package/dist/auth/middleware.js.map +0 -1
- package/dist/auth/permissions.d.ts +0 -60
- package/dist/auth/permissions.d.ts.map +0 -1
- package/dist/auth/permissions.js +0 -262
- package/dist/auth/permissions.js.map +0 -1
- package/dist/auth/token-validator.d.ts +0 -52
- package/dist/auth/token-validator.d.ts.map +0 -1
- package/dist/auth/token-validator.js +0 -215
- package/dist/auth/token-validator.js.map +0 -1
- package/dist/cache/cache-manager.d.ts +0 -49
- package/dist/cache/cache-manager.d.ts.map +0 -1
- package/dist/cache/cache-manager.js +0 -191
- package/dist/cache/cache-manager.js.map +0 -1
- package/dist/cache/index.d.ts +0 -6
- package/dist/cache/index.d.ts.map +0 -1
- package/dist/cache/index.js +0 -12
- package/dist/cache/index.js.map +0 -1
- package/dist/cache/redis-client.d.ts +0 -45
- package/dist/cache/redis-client.d.ts.map +0 -1
- package/dist/cache/redis-client.js +0 -210
- package/dist/cache/redis-client.js.map +0 -1
- package/dist/config/constants.d.ts +0 -28
- package/dist/config/constants.d.ts.map +0 -1
- package/dist/config/constants.js +0 -31
- package/dist/config/constants.js.map +0 -1
- package/dist/config/index.d.ts +0 -71
- package/dist/config/index.d.ts.map +0 -1
- package/dist/config/index.js +0 -190
- package/dist/config/index.js.map +0 -1
- package/dist/filesystem/manager.d.ts +0 -45
- package/dist/filesystem/manager.d.ts.map +0 -1
- package/dist/filesystem/manager.js +0 -246
- package/dist/filesystem/manager.js.map +0 -1
- package/dist/git/multi-source-manager.d.ts +0 -78
- package/dist/git/multi-source-manager.d.ts.map +0 -1
- package/dist/git/multi-source-manager.js +0 -577
- package/dist/git/multi-source-manager.js.map +0 -1
- package/dist/git/operations.d.ts +0 -27
- package/dist/git/operations.d.ts.map +0 -1
- package/dist/git/operations.js +0 -83
- package/dist/git/operations.js.map +0 -1
- package/dist/index.d.ts +0 -6
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -122
- package/dist/index.js.map +0 -1
- package/dist/monitoring/health.d.ts +0 -35
- package/dist/monitoring/health.d.ts.map +0 -1
- package/dist/monitoring/health.js +0 -105
- package/dist/monitoring/health.js.map +0 -1
- package/dist/prompts/cache.d.ts +0 -69
- package/dist/prompts/cache.d.ts.map +0 -1
- package/dist/prompts/cache.js +0 -163
- package/dist/prompts/cache.js.map +0 -1
- package/dist/prompts/generator.d.ts +0 -49
- package/dist/prompts/generator.d.ts.map +0 -1
- package/dist/prompts/generator.js +0 -160
- package/dist/prompts/generator.js.map +0 -1
- package/dist/prompts/index.d.ts +0 -13
- package/dist/prompts/index.d.ts.map +0 -1
- package/dist/prompts/index.js +0 -24
- package/dist/prompts/index.js.map +0 -1
- package/dist/prompts/manager.d.ts +0 -169
- package/dist/prompts/manager.d.ts.map +0 -1
- package/dist/prompts/manager.js +0 -488
- package/dist/prompts/manager.js.map +0 -1
- package/dist/resources/index.d.ts +0 -6
- package/dist/resources/index.d.ts.map +0 -1
- package/dist/resources/index.js +0 -10
- package/dist/resources/index.js.map +0 -1
- package/dist/resources/loader.d.ts +0 -88
- package/dist/resources/loader.d.ts.map +0 -1
- package/dist/resources/loader.js +0 -492
- package/dist/resources/loader.js.map +0 -1
- package/dist/server/http.d.ts +0 -57
- package/dist/server/http.d.ts.map +0 -1
- package/dist/server/http.js +0 -435
- package/dist/server/http.js.map +0 -1
- package/dist/server.d.ts +0 -13
- package/dist/server.d.ts.map +0 -1
- package/dist/server.js +0 -200
- package/dist/server.js.map +0 -1
- package/dist/session/manager.d.ts +0 -91
- package/dist/session/manager.d.ts.map +0 -1
- package/dist/session/manager.js +0 -251
- package/dist/session/manager.js.map +0 -1
- package/dist/telemetry/index.d.ts +0 -3
- package/dist/telemetry/index.d.ts.map +0 -1
- package/dist/telemetry/index.js +0 -7
- package/dist/telemetry/index.js.map +0 -1
- package/dist/telemetry/manager.d.ts +0 -151
- package/dist/telemetry/manager.d.ts.map +0 -1
- package/dist/telemetry/manager.js +0 -367
- package/dist/telemetry/manager.js.map +0 -1
- package/dist/tools/index.d.ts +0 -12
- package/dist/tools/index.d.ts.map +0 -1
- package/dist/tools/index.js +0 -28
- package/dist/tools/index.js.map +0 -1
- package/dist/tools/manage-subscription.d.ts +0 -47
- package/dist/tools/manage-subscription.d.ts.map +0 -1
- package/dist/tools/manage-subscription.js +0 -314
- package/dist/tools/manage-subscription.js.map +0 -1
- package/dist/tools/registry.d.ts +0 -40
- package/dist/tools/registry.d.ts.map +0 -1
- package/dist/tools/registry.js +0 -85
- package/dist/tools/registry.js.map +0 -1
- package/dist/tools/search-resources.d.ts +0 -35
- package/dist/tools/search-resources.d.ts.map +0 -1
- package/dist/tools/search-resources.js +0 -159
- package/dist/tools/search-resources.js.map +0 -1
- package/dist/tools/sync-resources.d.ts +0 -54
- package/dist/tools/sync-resources.d.ts.map +0 -1
- package/dist/tools/sync-resources.js +0 -733
- package/dist/tools/sync-resources.js.map +0 -1
- package/dist/tools/track-usage.d.ts +0 -63
- package/dist/tools/track-usage.d.ts.map +0 -1
- package/dist/tools/track-usage.js +0 -90
- package/dist/tools/track-usage.js.map +0 -1
- package/dist/tools/uninstall-resource.d.ts +0 -30
- package/dist/tools/uninstall-resource.d.ts.map +0 -1
- package/dist/tools/uninstall-resource.js +0 -174
- package/dist/tools/uninstall-resource.js.map +0 -1
- package/dist/tools/upload-resource.d.ts +0 -81
- package/dist/tools/upload-resource.d.ts.map +0 -1
- package/dist/tools/upload-resource.js +0 -393
- package/dist/tools/upload-resource.js.map +0 -1
- package/dist/transport/sse.d.ts +0 -29
- package/dist/transport/sse.d.ts.map +0 -1
- package/dist/transport/sse.js +0 -271
- package/dist/transport/sse.js.map +0 -1
- package/dist/types/errors.d.ts +0 -60
- package/dist/types/errors.d.ts.map +0 -1
- package/dist/types/errors.js +0 -112
- package/dist/types/errors.js.map +0 -1
- package/dist/types/index.d.ts +0 -7
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -23
- package/dist/types/index.js.map +0 -1
- package/dist/types/mcp.d.ts +0 -50
- package/dist/types/mcp.d.ts.map +0 -1
- package/dist/types/mcp.js +0 -6
- package/dist/types/mcp.js.map +0 -1
- package/dist/types/resources.d.ts +0 -109
- package/dist/types/resources.d.ts.map +0 -1
- package/dist/types/resources.js +0 -7
- package/dist/types/resources.js.map +0 -1
- package/dist/types/tools.d.ts +0 -235
- package/dist/types/tools.d.ts.map +0 -1
- package/dist/types/tools.js +0 -6
- package/dist/types/tools.js.map +0 -1
- package/dist/utils/cursor-paths.d.ts +0 -84
- package/dist/utils/cursor-paths.d.ts.map +0 -1
- package/dist/utils/cursor-paths.js +0 -166
- package/dist/utils/cursor-paths.js.map +0 -1
- package/dist/utils/log-cleaner.d.ts +0 -18
- package/dist/utils/log-cleaner.d.ts.map +0 -1
- package/dist/utils/log-cleaner.js +0 -112
- package/dist/utils/log-cleaner.js.map +0 -1
- package/dist/utils/logger.d.ts +0 -59
- package/dist/utils/logger.d.ts.map +0 -1
- package/dist/utils/logger.js +0 -292
- package/dist/utils/logger.js.map +0 -1
- package/dist/utils/validation.d.ts +0 -58
- package/dist/utils/validation.d.ts.map +0 -1
- package/dist/utils/validation.js +0 -214
- package/dist/utils/validation.js.map +0 -1
- package/src/api/cached-client.ts +0 -144
- package/src/api/client.ts +0 -697
- package/src/auth/index.ts +0 -11
- package/src/auth/middleware.ts +0 -244
- package/src/auth/permissions.ts +0 -323
- package/src/auth/token-validator.ts +0 -292
- package/src/cache/cache-manager.ts +0 -243
- package/src/cache/index.ts +0 -6
- package/src/cache/redis-client.ts +0 -249
- package/src/config/constants.ts +0 -33
- package/src/config/index.ts +0 -269
- package/src/filesystem/manager.ts +0 -235
- package/src/git/multi-source-manager.ts +0 -654
- package/src/git/operations.ts +0 -93
- package/src/index.ts +0 -157
- package/src/monitoring/health.ts +0 -132
- package/src/prompts/cache.ts +0 -140
- package/src/prompts/generator.ts +0 -143
- package/src/prompts/index.ts +0 -20
- package/src/prompts/manager.ts +0 -613
- package/src/resources/index.ts +0 -13
- package/src/resources/loader.ts +0 -563
- package/src/server/http.ts +0 -549
- package/src/server.ts +0 -204
- package/src/session/manager.ts +0 -296
- package/src/telemetry/index.ts +0 -10
- package/src/telemetry/manager.ts +0 -419
- package/src/tools/index.ts +0 -12
- package/src/tools/manage-subscription.ts +0 -385
- package/src/tools/registry.ts +0 -97
- package/src/tools/search-resources.ts +0 -185
- package/src/tools/sync-resources.ts +0 -827
- package/src/tools/track-usage.ts +0 -113
- package/src/tools/uninstall-resource.ts +0 -199
- package/src/tools/upload-resource.ts +0 -431
- package/src/transport/sse.ts +0 -308
- package/src/types/errors.ts +0 -146
- package/src/types/index.ts +0 -7
- package/src/types/mcp.ts +0 -61
- package/src/types/resources.ts +0 -141
- package/src/types/tools.ts +0 -284
- package/src/utils/cursor-paths.ts +0 -135
- package/src/utils/log-cleaner.ts +0 -92
- package/src/utils/logger.ts +0 -333
- package/src/utils/validation.ts +0 -262
|
@@ -1,246 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Filesystem Manager
|
|
4
|
-
* Atomic filesystem operations for resource management
|
|
5
|
-
*/
|
|
6
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
-
if (k2 === undefined) k2 = k;
|
|
8
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
-
}
|
|
12
|
-
Object.defineProperty(o, k2, desc);
|
|
13
|
-
}) : (function(o, m, k, k2) {
|
|
14
|
-
if (k2 === undefined) k2 = k;
|
|
15
|
-
o[k2] = m[k];
|
|
16
|
-
}));
|
|
17
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
18
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
19
|
-
}) : function(o, v) {
|
|
20
|
-
o["default"] = v;
|
|
21
|
-
});
|
|
22
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
23
|
-
var ownKeys = function(o) {
|
|
24
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
25
|
-
var ar = [];
|
|
26
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
27
|
-
return ar;
|
|
28
|
-
};
|
|
29
|
-
return ownKeys(o);
|
|
30
|
-
};
|
|
31
|
-
return function (mod) {
|
|
32
|
-
if (mod && mod.__esModule) return mod;
|
|
33
|
-
var result = {};
|
|
34
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
35
|
-
__setModuleDefault(result, mod);
|
|
36
|
-
return result;
|
|
37
|
-
};
|
|
38
|
-
})();
|
|
39
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
-
exports.filesystemManager = void 0;
|
|
41
|
-
const fs = __importStar(require("fs/promises"));
|
|
42
|
-
const fsSync = __importStar(require("fs"));
|
|
43
|
-
const path = __importStar(require("path"));
|
|
44
|
-
const logger_1 = require("../utils/logger");
|
|
45
|
-
const errors_1 = require("../types/errors");
|
|
46
|
-
class FilesystemManager {
|
|
47
|
-
/**
|
|
48
|
-
* Write resource file atomically
|
|
49
|
-
*/
|
|
50
|
-
async writeResource(filePath, content) {
|
|
51
|
-
const tempPath = `${filePath}.tmp`;
|
|
52
|
-
try {
|
|
53
|
-
// Ensure directory exists
|
|
54
|
-
const dir = path.dirname(filePath);
|
|
55
|
-
await fs.mkdir(dir, { recursive: true });
|
|
56
|
-
// Write to temporary file
|
|
57
|
-
await fs.writeFile(tempPath, content, 'utf-8');
|
|
58
|
-
// Validate content (basic check)
|
|
59
|
-
await this.validateResourceContent(tempPath, content);
|
|
60
|
-
// Atomic rename
|
|
61
|
-
await fs.rename(tempPath, filePath);
|
|
62
|
-
logger_1.logger.debug({ filePath }, 'Resource file written successfully');
|
|
63
|
-
}
|
|
64
|
-
catch (error) {
|
|
65
|
-
// Cleanup temporary file
|
|
66
|
-
try {
|
|
67
|
-
await fs.unlink(tempPath);
|
|
68
|
-
}
|
|
69
|
-
catch {
|
|
70
|
-
// Ignore cleanup errors
|
|
71
|
-
}
|
|
72
|
-
throw (0, errors_1.createFileSystemError)('write', filePath, error);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Read resource file with validation
|
|
77
|
-
*/
|
|
78
|
-
async readResource(filePath) {
|
|
79
|
-
try {
|
|
80
|
-
// Check if file exists
|
|
81
|
-
await fs.access(filePath, fsSync.constants.R_OK);
|
|
82
|
-
// Read file
|
|
83
|
-
const content = await fs.readFile(filePath, 'utf-8');
|
|
84
|
-
// Validate format
|
|
85
|
-
await this.validateResourceContent(filePath, content);
|
|
86
|
-
return content;
|
|
87
|
-
}
|
|
88
|
-
catch (error) {
|
|
89
|
-
throw (0, errors_1.createFileSystemError)('read', filePath, error);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Delete resource file with backup
|
|
94
|
-
*/
|
|
95
|
-
async deleteResource(filePath) {
|
|
96
|
-
const backupPath = `${filePath}.backup`;
|
|
97
|
-
try {
|
|
98
|
-
// Create backup
|
|
99
|
-
if (fsSync.existsSync(filePath)) {
|
|
100
|
-
await fs.copyFile(filePath, backupPath);
|
|
101
|
-
}
|
|
102
|
-
// Delete file
|
|
103
|
-
await fs.unlink(filePath);
|
|
104
|
-
// Remove backup on success
|
|
105
|
-
try {
|
|
106
|
-
await fs.unlink(backupPath);
|
|
107
|
-
}
|
|
108
|
-
catch {
|
|
109
|
-
// Ignore backup cleanup errors
|
|
110
|
-
}
|
|
111
|
-
logger_1.logger.debug({ filePath }, 'Resource file deleted successfully');
|
|
112
|
-
}
|
|
113
|
-
catch (error) {
|
|
114
|
-
// Restore from backup on failure
|
|
115
|
-
try {
|
|
116
|
-
if (fsSync.existsSync(backupPath)) {
|
|
117
|
-
await fs.copyFile(backupPath, filePath);
|
|
118
|
-
await fs.unlink(backupPath);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
catch {
|
|
122
|
-
// Ignore restore errors
|
|
123
|
-
}
|
|
124
|
-
throw (0, errors_1.createFileSystemError)('delete', filePath, error);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* Validate resource content
|
|
129
|
-
*/
|
|
130
|
-
async validateResourceContent(filePath, content) {
|
|
131
|
-
const ext = path.extname(filePath);
|
|
132
|
-
// Check if empty
|
|
133
|
-
if (!content || content.trim().length === 0) {
|
|
134
|
-
throw (0, errors_1.createValidationError)(filePath, ext, 'File content is empty');
|
|
135
|
-
}
|
|
136
|
-
// Validate based on file type
|
|
137
|
-
if (ext === '.json') {
|
|
138
|
-
try {
|
|
139
|
-
JSON.parse(content);
|
|
140
|
-
}
|
|
141
|
-
catch (error) {
|
|
142
|
-
throw (0, errors_1.createValidationError)(filePath, 'json', 'Invalid JSON format');
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
else if (ext === '.md') {
|
|
146
|
-
// Basic markdown validation (check for minimum content)
|
|
147
|
-
if (content.length < 10) {
|
|
148
|
-
throw (0, errors_1.createValidationError)(filePath, 'markdown', 'Markdown content too short');
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* Check if file exists
|
|
154
|
-
*/
|
|
155
|
-
async fileExists(filePath) {
|
|
156
|
-
try {
|
|
157
|
-
await fs.access(filePath, fsSync.constants.F_OK);
|
|
158
|
-
return true;
|
|
159
|
-
}
|
|
160
|
-
catch {
|
|
161
|
-
return false;
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
/**
|
|
165
|
-
* List files in directory
|
|
166
|
-
*/
|
|
167
|
-
async listFiles(dirPath, pattern) {
|
|
168
|
-
try {
|
|
169
|
-
const files = await fs.readdir(dirPath, { recursive: true });
|
|
170
|
-
if (pattern) {
|
|
171
|
-
return files.filter((file) => pattern.test(file));
|
|
172
|
-
}
|
|
173
|
-
return files;
|
|
174
|
-
}
|
|
175
|
-
catch (error) {
|
|
176
|
-
throw (0, errors_1.createFileSystemError)('list', dirPath, error);
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
/**
|
|
180
|
-
* Recursively scan a directory and return all text files as FileEntry[]
|
|
181
|
-
* Supported extensions: .md, .mdc, .txt, .yaml, .yml, .json
|
|
182
|
-
*/
|
|
183
|
-
async scanDirectory(dirPath) {
|
|
184
|
-
const TEXT_EXTENSIONS = new Set(['.md', '.mdc', '.txt', '.yaml', '.yml', '.json']);
|
|
185
|
-
const results = [];
|
|
186
|
-
const walk = async (currentPath, relBase) => {
|
|
187
|
-
let entries;
|
|
188
|
-
try {
|
|
189
|
-
entries = await fs.readdir(currentPath, { withFileTypes: true });
|
|
190
|
-
}
|
|
191
|
-
catch (error) {
|
|
192
|
-
throw (0, errors_1.createFileSystemError)('list', currentPath, error);
|
|
193
|
-
}
|
|
194
|
-
for (const entry of entries) {
|
|
195
|
-
const fullPath = path.join(currentPath, entry.name);
|
|
196
|
-
const relPath = path.join(relBase, entry.name);
|
|
197
|
-
if (entry.isDirectory()) {
|
|
198
|
-
await walk(fullPath, relPath);
|
|
199
|
-
}
|
|
200
|
-
else if (entry.isFile()) {
|
|
201
|
-
const ext = path.extname(entry.name).toLowerCase();
|
|
202
|
-
if (TEXT_EXTENSIONS.has(ext)) {
|
|
203
|
-
try {
|
|
204
|
-
const content = await fs.readFile(fullPath, 'utf-8');
|
|
205
|
-
if (content.trim().length > 0) {
|
|
206
|
-
results.push({ path: relPath, content });
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
catch {
|
|
210
|
-
// Skip unreadable files silently
|
|
211
|
-
logger_1.logger.warn({ filePath: fullPath }, 'Skipped unreadable file during directory scan');
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
};
|
|
217
|
-
await walk(dirPath, '');
|
|
218
|
-
if (results.length === 0) {
|
|
219
|
-
throw (0, errors_1.createValidationError)(dirPath, 'directory', `No text files found in directory: ${dirPath}`);
|
|
220
|
-
}
|
|
221
|
-
logger_1.logger.debug({ dirPath, fileCount: results.length }, 'Directory scan completed');
|
|
222
|
-
return results;
|
|
223
|
-
}
|
|
224
|
-
/**
|
|
225
|
-
* Remove empty directories recursively
|
|
226
|
-
*/
|
|
227
|
-
async removeEmptyDirs(dirPath) {
|
|
228
|
-
try {
|
|
229
|
-
const files = await fs.readdir(dirPath);
|
|
230
|
-
if (files.length === 0) {
|
|
231
|
-
await fs.rmdir(dirPath);
|
|
232
|
-
logger_1.logger.debug({ dirPath }, 'Empty directory removed');
|
|
233
|
-
// Check parent directory
|
|
234
|
-
const parentDir = path.dirname(dirPath);
|
|
235
|
-
if (parentDir !== dirPath) {
|
|
236
|
-
await this.removeEmptyDirs(parentDir);
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
catch (error) {
|
|
241
|
-
// Ignore errors (directory might not be empty or already deleted)
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
exports.filesystemManager = new FilesystemManager();
|
|
246
|
-
//# sourceMappingURL=manager.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"manager.js","sourceRoot":"","sources":["../../src/filesystem/manager.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,gDAAkC;AAClC,2CAA6B;AAC7B,2CAA6B;AAC7B,4CAAyC;AACzC,4CAA+E;AAE/E,MAAM,iBAAiB;IACrB;;OAEG;IACH,KAAK,CAAC,aAAa,CAAC,QAAgB,EAAE,OAAe;QACnD,MAAM,QAAQ,GAAG,GAAG,QAAQ,MAAM,CAAC;QAEnC,IAAI,CAAC;YACH,0BAA0B;YAC1B,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;YACnC,MAAM,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;YAEzC,0BAA0B;YAC1B,MAAM,EAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;YAE/C,iCAAiC;YACjC,MAAM,IAAI,CAAC,uBAAuB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;YAEtD,gBAAgB;YAChB,MAAM,EAAE,CAAC,MAAM,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;YAEpC,eAAM,CAAC,KAAK,CAAC,EAAE,QAAQ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|
|
5
|
-
interface SyncResult {
|
|
6
|
-
source: string;
|
|
7
|
-
action: 'cloned' | 'pulled' | 'up-to-date' | 'skipped';
|
|
8
|
-
changes: number;
|
|
9
|
-
duration: number;
|
|
10
|
-
}
|
|
11
|
-
declare class MultiSourceGitManager {
|
|
12
|
-
private configPath;
|
|
13
|
-
private baseDir;
|
|
14
|
-
constructor(baseDir: string);
|
|
15
|
-
/**
|
|
16
|
-
* Load AI Resources configuration
|
|
17
|
-
*/
|
|
18
|
-
private loadConfig;
|
|
19
|
-
/**
|
|
20
|
-
* Get all enabled sources (including default)
|
|
21
|
-
*/
|
|
22
|
-
private getEnabledSources;
|
|
23
|
-
/**
|
|
24
|
-
* Check if a Git repository exists at the given path
|
|
25
|
-
*/
|
|
26
|
-
private repositoryExists;
|
|
27
|
-
/**
|
|
28
|
-
* Get Git repository URL from existing repo
|
|
29
|
-
*/
|
|
30
|
-
private getRepoUrl;
|
|
31
|
-
/**
|
|
32
|
-
* Clone a Git repository
|
|
33
|
-
*/
|
|
34
|
-
private cloneRepository;
|
|
35
|
-
/**
|
|
36
|
-
* Pull latest changes using fetch + fast-forward merge.
|
|
37
|
-
*
|
|
38
|
-
* Deliberately avoids --depth=1 on fetch: shallow fetches truncate local
|
|
39
|
-
* history, causing "no merge base" divergence errors on subsequent pulls.
|
|
40
|
-
*/
|
|
41
|
-
private pullRepository;
|
|
42
|
-
/**
|
|
43
|
-
* Sync a single source repository
|
|
44
|
-
*/
|
|
45
|
-
private syncSource;
|
|
46
|
-
/**
|
|
47
|
-
* Sync all enabled sources
|
|
48
|
-
*/
|
|
49
|
-
syncAllSources(): Promise<SyncResult[]>;
|
|
50
|
-
/**
|
|
51
|
-
* Read the files for a named Command or Skill resource from the local git
|
|
52
|
-
* checkout. Used when the CSP API download returns an empty `files` array
|
|
53
|
-
* (which is expected for Command/Skill resources in MCP Prompt mode — the
|
|
54
|
-
* API only stores metadata; actual file content lives in the git repo).
|
|
55
|
-
*
|
|
56
|
-
* Searches all enabled sources in priority order and returns the first match.
|
|
57
|
-
*
|
|
58
|
-
* @param resourceName The resource name as returned by the subscriptions API.
|
|
59
|
-
* @param resourceType 'command' | 'skill'
|
|
60
|
-
* @returns Array of { path, content } file entries, or [] when not found.
|
|
61
|
-
*/
|
|
62
|
-
readResourceFiles(resourceName: string, resourceType: 'command' | 'skill' | 'rule' | 'mcp'): Promise<Array<{
|
|
63
|
-
path: string;
|
|
64
|
-
content: string;
|
|
65
|
-
}>>;
|
|
66
|
-
/**
|
|
67
|
-
* Check status of all sources without pulling
|
|
68
|
-
*/
|
|
69
|
-
checkAllSources(): Promise<Array<{
|
|
70
|
-
source: string;
|
|
71
|
-
exists: boolean;
|
|
72
|
-
hasRemote: boolean;
|
|
73
|
-
repoUrl: string | null;
|
|
74
|
-
}>>;
|
|
75
|
-
}
|
|
76
|
-
export declare const multiSourceGitManager: MultiSourceGitManager;
|
|
77
|
-
export {};
|
|
78
|
-
//# sourceMappingURL=multi-source-manager.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"multi-source-manager.d.ts","sourceRoot":"","sources":["../../src/git/multi-source-manager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA8BH,UAAU,UAAU;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,QAAQ,GAAG,QAAQ,GAAG,YAAY,GAAG,SAAS,CAAC;IACvD,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,cAAM,qBAAqB;IACzB,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,OAAO,CAAS;gBAEZ,OAAO,EAAE,MAAM;IAK3B;;OAEG;YACW,UAAU;IASxB;;OAEG;YACW,iBAAiB;IAe/B;;OAEG;YACW,gBAAgB;IAU9B;;OAEG;YACW,UAAU;IAWxB;;OAEG;YACW,eAAe;IAwB7B;;;;;OAKG;YACW,cAAc;IAgI5B;;OAEG;YACW,UAAU;IA4GxB;;OAEG;IACG,cAAc,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;IAyC7C;;;;;;;;;;;OAWG;IACG,iBAAiB,CACrB,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,KAAK,GACjD,OAAO,CAAC,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAoIpD;;OAEG;IACG,eAAe,IAAI,OAAO,CAAC,KAAK,CAAC;QACrC,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,OAAO,CAAC;QAChB,SAAS,EAAE,OAAO,CAAC;QACnB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;KACxB,CAAC,CAAC;CAuBJ;AAqDD,eAAO,MAAM,qBAAqB,uBAA+C,CAAC"}
|