@agiflowai/scaffold-mcp 0.5.0 → 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/README.md +11 -71
- package/dist/ScaffoldConfigLoader-CI0T6zdG.js +142 -0
- package/dist/{ScaffoldConfigLoader-DzcV5a_c.cjs → ScaffoldConfigLoader-DQMCLVGD.cjs} +1 -1
- package/dist/ScaffoldConfigLoader-DhthV6xq.js +3 -0
- package/dist/{ScaffoldService-BgFWAOLQ.cjs → ScaffoldService-B-L4gwHt.cjs} +6 -0
- package/dist/ScaffoldService-Cx4ZonaT.cjs +3 -0
- package/dist/ScaffoldService-DVsusUh5.js +3 -0
- package/dist/ScaffoldService-QgQKHMM-.js +290 -0
- package/dist/TemplateService-BZRt3NI8.cjs +3 -0
- package/dist/TemplateService-CiZJA06s.js +79 -0
- package/dist/TemplateService-DropYdp8.js +3 -0
- package/dist/VariableReplacementService-B3qARIC9.js +66 -0
- package/dist/{VariableReplacementService-YUpL5nAC.cjs → VariableReplacementService-BrJ1PdKm.cjs} +1 -1
- package/dist/VariableReplacementService-D8C-IsP-.js +3 -0
- package/dist/cli.cjs +1363 -0
- package/dist/cli.d.cts +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +1355 -0
- package/dist/index.cjs +32 -3144
- package/dist/index.d.cts +798 -0
- package/dist/index.d.ts +799 -0
- package/dist/index.js +7 -0
- package/dist/stdio-Cz5aRdvr.cjs +2210 -0
- package/dist/stdio-Dmpwju2k.js +2074 -0
- package/package.json +19 -4
- package/dist/ScaffoldService-BvD9WvRi.cjs +0 -3
- package/dist/TemplateService-B5EZjPB0.cjs +0 -3
- /package/dist/{ScaffoldConfigLoader-1Pcv9cxm.cjs → ScaffoldConfigLoader-BrmvENTo.cjs} +0 -0
- /package/dist/{TemplateService-_KpkoLfZ.cjs → TemplateService-DRubcvS9.cjs} +0 -0
- /package/dist/{VariableReplacementService-ClshNY_C.cjs → VariableReplacementService-BL84vnKk.cjs} +0 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { log } from "@agiflowai/aicode-utils";
|
|
3
|
+
|
|
4
|
+
//#region src/services/VariableReplacementService.ts
|
|
5
|
+
var VariableReplacementService = class {
|
|
6
|
+
binaryExtensions = [
|
|
7
|
+
".png",
|
|
8
|
+
".jpg",
|
|
9
|
+
".jpeg",
|
|
10
|
+
".gif",
|
|
11
|
+
".ico",
|
|
12
|
+
".woff",
|
|
13
|
+
".woff2",
|
|
14
|
+
".ttf",
|
|
15
|
+
".eot",
|
|
16
|
+
".pdf",
|
|
17
|
+
".zip",
|
|
18
|
+
".tar",
|
|
19
|
+
".gz",
|
|
20
|
+
".exe",
|
|
21
|
+
".dll",
|
|
22
|
+
".so",
|
|
23
|
+
".dylib"
|
|
24
|
+
];
|
|
25
|
+
constructor(fileSystem, templateService) {
|
|
26
|
+
this.fileSystem = fileSystem;
|
|
27
|
+
this.templateService = templateService;
|
|
28
|
+
}
|
|
29
|
+
async processFilesForVariableReplacement(dirPath, variables) {
|
|
30
|
+
let items = [];
|
|
31
|
+
try {
|
|
32
|
+
items = await this.fileSystem.readdir(dirPath);
|
|
33
|
+
} catch (error) {
|
|
34
|
+
log.warn(`Skipping directory ${dirPath}: ${error}`);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
for (const item of items) {
|
|
38
|
+
if (!item) continue;
|
|
39
|
+
const itemPath = path.join(dirPath, item);
|
|
40
|
+
try {
|
|
41
|
+
const stat = await this.fileSystem.stat(itemPath);
|
|
42
|
+
if (stat.isDirectory()) await this.processFilesForVariableReplacement(itemPath, variables);
|
|
43
|
+
else if (stat.isFile()) await this.replaceVariablesInFile(itemPath, variables);
|
|
44
|
+
} catch (error) {
|
|
45
|
+
log.warn(`Skipping item ${itemPath}: ${error}`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
async replaceVariablesInFile(filePath, variables) {
|
|
50
|
+
try {
|
|
51
|
+
if (this.isBinaryFile(filePath)) return;
|
|
52
|
+
const content = await this.fileSystem.readFile(filePath, "utf8");
|
|
53
|
+
const renderedContent = this.templateService.renderString(content, variables);
|
|
54
|
+
await this.fileSystem.writeFile(filePath, renderedContent, "utf8");
|
|
55
|
+
} catch (error) {
|
|
56
|
+
log.warn(`Skipping file ${filePath}: ${error}`);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
isBinaryFile(filePath) {
|
|
60
|
+
const ext = path.extname(filePath).toLowerCase();
|
|
61
|
+
return this.binaryExtensions.includes(ext);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
//#endregion
|
|
66
|
+
export { VariableReplacementService };
|
package/dist/{VariableReplacementService-YUpL5nAC.cjs → VariableReplacementService-BrJ1PdKm.cjs}
RENAMED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const require_VariableReplacementService = require('./VariableReplacementService-
|
|
1
|
+
const require_VariableReplacementService = require('./VariableReplacementService-BL84vnKk.cjs');
|
|
2
2
|
|
|
3
3
|
exports.VariableReplacementService = require_VariableReplacementService.VariableReplacementService;
|