sloth-d2c-mcp 1.0.4-beta80 → 1.0.4-beta82
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.
|
@@ -35,7 +35,7 @@ export class FileManager {
|
|
|
35
35
|
getFilePath(fileKey, nodeId, filename) {
|
|
36
36
|
// 清理文件名中的特殊字符
|
|
37
37
|
const cleanFileKey = fileKey.replace(/[^a-zA-Z0-9\u4e00-\u9fff\u3400-\u4dbf-_]/g, '_');
|
|
38
|
-
const cleanNodeId = nodeId ? nodeId.replace(/[^a-zA-Z0-9\u4e00-\u9fff\u3400-\u4dbf-_
|
|
38
|
+
const cleanNodeId = nodeId ? nodeId.replace(/[^a-zA-Z0-9\u4e00-\u9fff\u3400-\u4dbf-_]/g, '_') : 'root';
|
|
39
39
|
const cleanFilename = filename.replace(/[^a-zA-Z0-9\u4e00-\u9fff\u3400-\u4dbf-_.]/g, '_');
|
|
40
40
|
return path.join(this.baseDir, cleanFileKey, cleanNodeId, cleanFilename);
|
|
41
41
|
}
|
|
@@ -54,7 +54,7 @@ export class FileManager {
|
|
|
54
54
|
}
|
|
55
55
|
// 清理文件名中的特殊字符
|
|
56
56
|
const cleanFileKey = fileKey.replace(/[^a-zA-Z0-9\u4e00-\u9fff\u3400-\u4dbf-_]/g, '_');
|
|
57
|
-
const cleanNodeId = nodeId ? nodeId.replace(/[^a-zA-Z0-9\u4e00-\u9fff\u3400-\u4dbf-_
|
|
57
|
+
const cleanNodeId = nodeId ? nodeId.replace(/[^a-zA-Z0-9\u4e00-\u9fff\u3400-\u4dbf-_]/g, '_') : 'root';
|
|
58
58
|
const cleanFilename = filename.replace(/[^a-zA-Z0-9\u4e00-\u9fff\u3400-\u4dbf-_.]/g, '_');
|
|
59
59
|
if (skipParsePath) {
|
|
60
60
|
return path.join(this.workspaceRoot, '.sloth', fileKey, nodeId || 'root', cleanFilename);
|
|
@@ -179,7 +179,7 @@ export class FileManager {
|
|
|
179
179
|
async cleanupNode(fileKey, nodeId) {
|
|
180
180
|
try {
|
|
181
181
|
const cleanFileKey = fileKey.replace(/[^a-zA-Z0-9-_]/g, '_');
|
|
182
|
-
const cleanNodeId = nodeId ? nodeId.replace(/[^a-zA-Z0-9-_
|
|
182
|
+
const cleanNodeId = nodeId ? nodeId.replace(/[^a-zA-Z0-9-_]/g, '_') : 'root';
|
|
183
183
|
const nodeDir = path.join(this.baseDir, cleanFileKey, cleanNodeId);
|
|
184
184
|
await fs.rm(nodeDir, { recursive: true, force: true });
|
|
185
185
|
Logger.log(`节点目录已清理: ${nodeDir}`);
|
|
@@ -234,7 +234,7 @@ export class FileManager {
|
|
|
234
234
|
*/
|
|
235
235
|
getNodeDir(fileKey, nodeId) {
|
|
236
236
|
const cleanFileKey = fileKey.replace(/[^a-zA-Z0-9-_]/g, '_');
|
|
237
|
-
const cleanNodeId = nodeId ? nodeId.replace(/[^a-zA-Z0-9-_
|
|
237
|
+
const cleanNodeId = nodeId ? nodeId.replace(/[^a-zA-Z0-9-_]/g, '_') : 'root';
|
|
238
238
|
return path.join(this.baseDir, cleanFileKey, cleanNodeId);
|
|
239
239
|
}
|
|
240
240
|
/**
|
|
@@ -706,7 +706,7 @@ export class FileManager {
|
|
|
706
706
|
now.getMinutes().toString().padStart(2, '0') +
|
|
707
707
|
now.getSeconds().toString().padStart(2, '0');
|
|
708
708
|
const cleanFileKey = fileKey.replace(/[^a-zA-Z0-9-_]/g, '_');
|
|
709
|
-
const cleanNodeId = nodeId ? nodeId.replace(/[^a-zA-Z0-9-_
|
|
709
|
+
const cleanNodeId = nodeId ? nodeId.replace(/[^a-zA-Z0-9-_]/g, '_') : 'root';
|
|
710
710
|
// 归档路径:.sloth/{fileKey}/{nodeId}/history/{timestamp}/absolute.html
|
|
711
711
|
const archiveDir = path.join(this.workspaceRoot, '.sloth', cleanFileKey, cleanNodeId, 'history', timestamp);
|
|
712
712
|
try {
|
|
@@ -751,7 +751,7 @@ export class FileManager {
|
|
|
751
751
|
return [];
|
|
752
752
|
}
|
|
753
753
|
const cleanFileKey = fileKey.replace(/[^a-zA-Z0-9-_]/g, '_');
|
|
754
|
-
const cleanNodeId = nodeId ? nodeId.replace(/[^a-zA-Z0-9-_
|
|
754
|
+
const cleanNodeId = nodeId ? nodeId.replace(/[^a-zA-Z0-9-_]/g, '_') : 'root';
|
|
755
755
|
const historyDir = path.join(this.workspaceRoot, '.sloth', cleanFileKey, cleanNodeId, 'history');
|
|
756
756
|
try {
|
|
757
757
|
const entries = await fs.readdir(historyDir, { withFileTypes: true });
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
-
"buildTime": "2025-12-
|
|
2
|
+
"buildTime": "2025-12-23T05:35:46.297Z",
|
|
3
3
|
"mode": "build",
|
|
4
4
|
"pages": {
|
|
5
5
|
"main": {
|
|
6
6
|
"file": "index.html",
|
|
7
|
-
"size":
|
|
7
|
+
"size": 1628662,
|
|
8
8
|
"sizeFormatted": "1.55 MB"
|
|
9
9
|
},
|
|
10
10
|
"detail": {
|
|
@@ -13,6 +13,6 @@
|
|
|
13
13
|
"sizeFormatted": "275.07 KB"
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
|
-
"totalSize":
|
|
16
|
+
"totalSize": 1910333,
|
|
17
17
|
"totalSizeFormatted": "1.82 MB"
|
|
18
18
|
}
|