zen-gitsync 2.15.11 → 2.15.12

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.
Files changed (69) hide show
  1. package/package.json +3 -3
  2. package/src/gitCommit.js +475 -475
  3. package/src/ui/public/assets/AppVersionBadge-BaXEI9Aq.js +2 -0
  4. package/src/ui/public/assets/BranchSelector-DJhEF0y9.js +1 -0
  5. package/src/ui/public/assets/CommitForm-BfpcK-bz.js +6 -0
  6. package/src/ui/public/assets/ConsoleView-D838O0O6.js +17 -0
  7. package/src/ui/public/assets/CustomCommandManager-BcCK46df.js +1 -0
  8. package/src/ui/public/assets/EditorView-DnnqYNGF.js +0 -0
  9. package/src/ui/public/assets/{FlowExecutionViewer-CJgoxffE.js → FlowExecutionViewer-CSlMmcDS.js} +1 -1
  10. package/src/ui/public/assets/FlowOrchestrationWorkspace-UgHpZ3FR.js +21 -0
  11. package/src/ui/public/assets/LogList-uUgskwwp.js +7 -0
  12. package/src/ui/public/assets/MindmapView-CCmFMiHR.js +1 -0
  13. package/src/ui/public/assets/MonitorView-BxoqeX70.js +1 -0
  14. package/src/ui/public/assets/ProjectStartupButton-C3AwivIB.js +1 -0
  15. package/src/ui/public/assets/{RemoteRepoCard-CKQguRWi.js → RemoteRepoCard-BbxeVpje.js} +1 -1
  16. package/src/ui/public/assets/SourceMapView-DKv-Y6t_.js +3 -0
  17. package/src/ui/public/assets/{SvgIcon-DOkE0Qie.js → SvgIcon-sMM8XFgm.js} +1 -1
  18. package/src/ui/public/assets/TemplateManager-Dzj8rXVw.js +1 -0
  19. package/src/ui/public/assets/UserInputNode-BU7Trzq-.js +1 -0
  20. package/src/ui/public/assets/WorkbenchView-DTgRoOkv.js +12 -0
  21. package/src/ui/public/assets/{_plugin-vue_export-helper-DvV-QrsM.js → _plugin-vue_export-helper-8ryIYVvs.js} +1 -1
  22. package/src/ui/public/assets/{configStore-BRR4SloR.js → configStore-D77uNk8X.js} +1 -1
  23. package/src/ui/public/assets/element-plus-D8SQiesr.js +17 -0
  24. package/src/ui/public/assets/element-plus-DB_sOyH_.css +1 -0
  25. package/src/ui/public/assets/{flow-mindmap-BMvnvRl8.js → flow-mindmap-BLa-kSA7.js} +1 -1
  26. package/src/ui/public/assets/index-CpFreGqX.js +23 -0
  27. package/src/ui/public/assets/{socket-io-C2w3MxRu.js → socket-io-B1foIbJS.js} +1 -1
  28. package/src/ui/public/assets/{vendor--LaaJk9m.js → vendor-B9orL8iU.js} +37 -37
  29. package/src/ui/public/assets/vendor-Dm_yd-By.css +1 -0
  30. package/src/ui/public/assets/{vue-flow-MtbKS8yD.js → vue-flow-BY7LODit.js} +1 -1
  31. package/src/ui/public/favicon.svg +75 -75
  32. package/src/ui/public/index.html +27 -27
  33. package/src/ui/public/logo.svg +74 -74
  34. package/src/ui/server/middleware/requestLogger.js +53 -53
  35. package/src/ui/server/routes/branchStatus.js +105 -105
  36. package/src/ui/server/routes/fileOpen.js +309 -309
  37. package/src/ui/server/routes/fs.js +791 -791
  38. package/src/ui/server/routes/git/diff.js +426 -426
  39. package/src/ui/server/routes/git/diffUtils.js +149 -149
  40. package/src/ui/server/routes/git/stash.js +550 -550
  41. package/src/ui/server/routes/git/tags.js +176 -176
  42. package/src/ui/server/routes/git.js +181 -181
  43. package/src/ui/server/routes/gitOps.js +1211 -1211
  44. package/src/ui/server/routes/process.js +86 -86
  45. package/src/ui/server/routes/status.js +67 -67
  46. package/src/ui/server/utils/createSavePortToFile.js +48 -48
  47. package/src/ui/server/utils/instanceRegistry.js +282 -282
  48. package/src/ui/server/utils/startServerOnAvailablePort.js +116 -116
  49. package/src/utils/index.js +1168 -1168
  50. package/src/ui/public/assets/AppVersionBadge-CEhrATQo.js +0 -2
  51. package/src/ui/public/assets/BranchSelector-xLl3O-4I.js +0 -1
  52. package/src/ui/public/assets/CommitForm--izGtr_x.js +0 -6
  53. package/src/ui/public/assets/ConsoleView-BLYfnXAy.js +0 -17
  54. package/src/ui/public/assets/CustomCommandManager-D8Qd3b9m.js +0 -1
  55. package/src/ui/public/assets/EditorView-DG8tqp3L.js +0 -0
  56. package/src/ui/public/assets/FlowOrchestrationWorkspace-BAIqeASp.js +0 -21
  57. package/src/ui/public/assets/LogList-DjuL8nWB.js +0 -7
  58. package/src/ui/public/assets/MindmapView-DPomtQsu.js +0 -1
  59. package/src/ui/public/assets/MonitorView-gZhz528u.js +0 -1
  60. package/src/ui/public/assets/ProjectStartupButton-C8nDEd8N.js +0 -1
  61. package/src/ui/public/assets/SourceMapView-DfSRy6lc.js +0 -3
  62. package/src/ui/public/assets/TemplateManager-BJZloJIO.js +0 -1
  63. package/src/ui/public/assets/UserInputNode-DpRNQzrz.js +0 -1
  64. package/src/ui/public/assets/WorkbenchView-vaZsec5Z.js +0 -12
  65. package/src/ui/public/assets/element-plus-CL7fBdM_.js +0 -24
  66. package/src/ui/public/assets/element-plus-Cu9Y2raX.css +0 -1
  67. package/src/ui/public/assets/index-BAFCDhj2.js +0 -23
  68. package/src/ui/public/assets/vendor-CCbwTgrE.css +0 -1
  69. package/src/ui/server/.claude/codediff.txt +0 -8
@@ -1,149 +1,149 @@
1
- // Copyright 2026 xz333221
2
- //
3
- // Licensed under the Apache License, Version 2.0 (the "License");
4
- // you may not use this file except in compliance with the License.
5
- // You may obtain a copy of the License at
6
- //
7
- // http://www.apache.org/licenses/LICENSE-2.0
8
- //
9
- // Unless required by applicable law or agreed to in writing, software
10
- // distributed under the License is distributed on an "AS IS" BASIS,
11
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- // See the License for the specific language governing permissions and
13
- // limitations under the License.
14
- //
15
- import logger from '../../utils/logger.js'
16
-
17
- export function createDiffHelpers({ execGitCommand }) {
18
- /**
19
- * 检查文件是否应该跳过diff显示(参考GitLab策略)
20
- * @param {string} filePath - 文件路径
21
- * @param {string} diffCommand - 要执行的git diff命令
22
- * @returns {Promise<{shouldSkip: boolean, reason?: string, stats?: object}>}
23
- */
24
- async function checkShouldSkipDiff(filePath, diffCommand) {
25
- // 1. 检查文件扩展名 - 编译/压缩/二进制文件
26
- const skipExtensions = /\.(min\.js|umd\.cjs|bundle\.js|dist\.js|prod\.js|map|wasm|exe|dll|so|dylib|bin|zip|tar|gz|rar|7z|jar|war|ear|pdf|doc|docx|xls|xlsx|ppt|pptx|jpg|jpeg|png|gif|bmp|ico|mp3|mp4|avi|mov|wmv|flv|webm|mkv|ttf|woff|woff2|eot|otf)$/i;
27
- if (skipExtensions.test(filePath)) {
28
- return {
29
- shouldSkip: true,
30
- reason: '⚠️ 检测到编译/打包/二进制文件,diff已跳过显示。\n\n提示:这类文件通常是自动生成的或二进制文件,不适合查看diff。\n如需查看,请使用命令行。'
31
- };
32
- }
33
-
34
- // 2. 使用 --numstat 快速检查变更量(不获取实际内容,速度快)
35
- try {
36
- // 把传入的 diffCommand 字符串改写成 git diff/show 加 --numstat 的 argv 数组。
37
- // 不再走 shell 模式,避免 Windows cmd.exe 下引号兼容问题(参 utils execGitCommand execFile 化)。
38
- const numstatCommand = diffCommand.replace(/git (diff|show)/, 'git $1 --numstat')
39
- const argvMatch = numstatCommand.trim().match(/^git\s+(\S+)\s*(.*)$/)
40
- let numstatArgs
41
- if (argvMatch) {
42
- const subCmd = argvMatch[1]
43
- const rest = argvMatch[2]
44
- // 简单按空白拆分,带引号段整体保留 -- "--" + 路径
45
- // 这里最常见形态是 'git diff/show -- "--path"' 或 'git diff/show hash -- "--path"'
46
- const tokens = []
47
- const re = /"([^"]*)"|(\S+)/g
48
- let m
49
- while ((m = re.exec(rest)) !== null) tokens.push(m[1] !== undefined ? m[1] : m[2])
50
- // 找到 '--numstat' 位置,把它加到 subCmd 后面作为第一个参数
51
- numstatArgs = [subCmd, '--numstat', ...tokens]
52
- } else {
53
- // fallback: 走旧逻辑(字符串)
54
- numstatArgs = numstatCommand
55
- }
56
- const { stdout: numstat } = await execGitCommand(numstatArgs, { log: false });
57
-
58
- if (numstat.trim()) {
59
- const lines = numstat.trim().split('\n');
60
- for (const line of lines) {
61
- const parts = line.split('\t');
62
- if (parts.length >= 3) {
63
- const added = parts[0];
64
- const deleted = parts[1];
65
-
66
- // 检查是否是二进制文件(显示为 - -)
67
- if (added === '-' && deleted === '-') {
68
- return {
69
- shouldSkip: true,
70
- reason: '⚠️ 检测到二进制文件,diff已跳过显示。\n\n提示:二进制文件无法以文本形式显示diff。'
71
- };
72
- }
73
-
74
- // 检查变更行数是否过多(超过3000行)
75
- const totalChanges = parseInt(added) + parseInt(deleted);
76
- if (!isNaN(totalChanges) && totalChanges > 3000) {
77
- return {
78
- shouldSkip: true,
79
- reason: `⚠️ 变更内容过大 (${totalChanges.toLocaleString()} 行变更),diff已跳过显示以避免浏览器卡顿。\n\n提示:建议使用命令行或专业diff工具查看大文件变更。\n增加:${parseInt(added).toLocaleString()} 行\n删除:${parseInt(deleted).toLocaleString()} 行`,
80
- stats: { added: parseInt(added), deleted: parseInt(deleted), total: totalChanges }
81
- };
82
- }
83
- }
84
- }
85
- }
86
- } catch (error) {
87
- // numstat失败不影响后续流程
88
- logger.info('numstat检查失败,继续执行:', error.message);
89
- }
90
-
91
- // 3. 通过了初步检查
92
- return { shouldSkip: false };
93
- }
94
-
95
- /**
96
- * 检查diff内容大小,如果过大则跳过
97
- * @param {string} diffContent - diff内容
98
- * @param {number} maxSizeKB - 最大大小(KB),默认500KB
99
- * @returns {object|null} - 如果需要跳过返回提示对象,否则返回null
100
- */
101
- function checkDiffSize(diffContent, maxSizeKB = 500) {
102
- const diffSizeKB = Buffer.byteLength(diffContent, 'utf8') / 1024;
103
- if (diffSizeKB > maxSizeKB) {
104
- return {
105
- diff: `⚠️ Diff内容过大 (${diffSizeKB.toFixed(1)} KB),已跳过显示以避免浏览器卡顿。\n\n提示:建议使用命令行查看大文件diff。`,
106
- isLargeFile: true,
107
- size: diffSizeKB
108
- };
109
- }
110
- return null;
111
- }
112
-
113
- /**
114
- * 从 diff 内容中统计增加和删除行数
115
- * @param {string} diffContent - diff内容
116
- * @returns {object} - {added, deleted}
117
- */
118
- function getDiffStats(diffContent) {
119
- if (!diffContent) return { added: 0, deleted: 0 };
120
-
121
- const lines = diffContent.split('\n');
122
- let added = 0;
123
- let deleted = 0;
124
-
125
- for (const line of lines) {
126
- // 跳过diff头部信息
127
- if (line.startsWith('diff ') || line.startsWith('index ') ||
128
- line.startsWith('--- ') || line.startsWith('+++ ') ||
129
- line.startsWith('@@ ')) {
130
- continue;
131
- }
132
-
133
- // 统计增加和删除的行
134
- if (line.startsWith('+')) {
135
- added++;
136
- } else if (line.startsWith('-')) {
137
- deleted++;
138
- }
139
- }
140
-
141
- return { added, deleted };
142
- }
143
-
144
- return {
145
- checkShouldSkipDiff,
146
- checkDiffSize,
147
- getDiffStats
148
- };
149
- }
1
+ // Copyright 2026 xz333221
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+ //
15
+ import logger from '../../utils/logger.js'
16
+
17
+ export function createDiffHelpers({ execGitCommand }) {
18
+ /**
19
+ * 检查文件是否应该跳过diff显示(参考GitLab策略)
20
+ * @param {string} filePath - 文件路径
21
+ * @param {string} diffCommand - 要执行的git diff命令
22
+ * @returns {Promise<{shouldSkip: boolean, reason?: string, stats?: object}>}
23
+ */
24
+ async function checkShouldSkipDiff(filePath, diffCommand) {
25
+ // 1. 检查文件扩展名 - 编译/压缩/二进制文件
26
+ const skipExtensions = /\.(min\.js|umd\.cjs|bundle\.js|dist\.js|prod\.js|map|wasm|exe|dll|so|dylib|bin|zip|tar|gz|rar|7z|jar|war|ear|pdf|doc|docx|xls|xlsx|ppt|pptx|jpg|jpeg|png|gif|bmp|ico|mp3|mp4|avi|mov|wmv|flv|webm|mkv|ttf|woff|woff2|eot|otf)$/i;
27
+ if (skipExtensions.test(filePath)) {
28
+ return {
29
+ shouldSkip: true,
30
+ reason: '⚠️ 检测到编译/打包/二进制文件,diff已跳过显示。\n\n提示:这类文件通常是自动生成的或二进制文件,不适合查看diff。\n如需查看,请使用命令行。'
31
+ };
32
+ }
33
+
34
+ // 2. 使用 --numstat 快速检查变更量(不获取实际内容,速度快)
35
+ try {
36
+ // 把传入的 diffCommand 字符串改写成 git diff/show 加 --numstat 的 argv 数组。
37
+ // 不再走 shell 模式,避免 Windows cmd.exe 下引号兼容问题(参 utils execGitCommand execFile 化)。
38
+ const numstatCommand = diffCommand.replace(/git (diff|show)/, 'git $1 --numstat')
39
+ const argvMatch = numstatCommand.trim().match(/^git\s+(\S+)\s*(.*)$/)
40
+ let numstatArgs
41
+ if (argvMatch) {
42
+ const subCmd = argvMatch[1]
43
+ const rest = argvMatch[2]
44
+ // 简单按空白拆分,带引号段整体保留 -- "--" + 路径
45
+ // 这里最常见形态是 'git diff/show -- "--path"' 或 'git diff/show hash -- "--path"'
46
+ const tokens = []
47
+ const re = /"([^"]*)"|(\S+)/g
48
+ let m
49
+ while ((m = re.exec(rest)) !== null) tokens.push(m[1] !== undefined ? m[1] : m[2])
50
+ // 找到 '--numstat' 位置,把它加到 subCmd 后面作为第一个参数
51
+ numstatArgs = [subCmd, '--numstat', ...tokens]
52
+ } else {
53
+ // fallback: 走旧逻辑(字符串)
54
+ numstatArgs = numstatCommand
55
+ }
56
+ const { stdout: numstat } = await execGitCommand(numstatArgs, { log: false });
57
+
58
+ if (numstat.trim()) {
59
+ const lines = numstat.trim().split('\n');
60
+ for (const line of lines) {
61
+ const parts = line.split('\t');
62
+ if (parts.length >= 3) {
63
+ const added = parts[0];
64
+ const deleted = parts[1];
65
+
66
+ // 检查是否是二进制文件(显示为 - -)
67
+ if (added === '-' && deleted === '-') {
68
+ return {
69
+ shouldSkip: true,
70
+ reason: '⚠️ 检测到二进制文件,diff已跳过显示。\n\n提示:二进制文件无法以文本形式显示diff。'
71
+ };
72
+ }
73
+
74
+ // 检查变更行数是否过多(超过3000行)
75
+ const totalChanges = parseInt(added) + parseInt(deleted);
76
+ if (!isNaN(totalChanges) && totalChanges > 3000) {
77
+ return {
78
+ shouldSkip: true,
79
+ reason: `⚠️ 变更内容过大 (${totalChanges.toLocaleString()} 行变更),diff已跳过显示以避免浏览器卡顿。\n\n提示:建议使用命令行或专业diff工具查看大文件变更。\n增加:${parseInt(added).toLocaleString()} 行\n删除:${parseInt(deleted).toLocaleString()} 行`,
80
+ stats: { added: parseInt(added), deleted: parseInt(deleted), total: totalChanges }
81
+ };
82
+ }
83
+ }
84
+ }
85
+ }
86
+ } catch (error) {
87
+ // numstat失败不影响后续流程
88
+ logger.info('numstat检查失败,继续执行:', error.message);
89
+ }
90
+
91
+ // 3. 通过了初步检查
92
+ return { shouldSkip: false };
93
+ }
94
+
95
+ /**
96
+ * 检查diff内容大小,如果过大则跳过
97
+ * @param {string} diffContent - diff内容
98
+ * @param {number} maxSizeKB - 最大大小(KB),默认500KB
99
+ * @returns {object|null} - 如果需要跳过返回提示对象,否则返回null
100
+ */
101
+ function checkDiffSize(diffContent, maxSizeKB = 500) {
102
+ const diffSizeKB = Buffer.byteLength(diffContent, 'utf8') / 1024;
103
+ if (diffSizeKB > maxSizeKB) {
104
+ return {
105
+ diff: `⚠️ Diff内容过大 (${diffSizeKB.toFixed(1)} KB),已跳过显示以避免浏览器卡顿。\n\n提示:建议使用命令行查看大文件diff。`,
106
+ isLargeFile: true,
107
+ size: diffSizeKB
108
+ };
109
+ }
110
+ return null;
111
+ }
112
+
113
+ /**
114
+ * 从 diff 内容中统计增加和删除行数
115
+ * @param {string} diffContent - diff内容
116
+ * @returns {object} - {added, deleted}
117
+ */
118
+ function getDiffStats(diffContent) {
119
+ if (!diffContent) return { added: 0, deleted: 0 };
120
+
121
+ const lines = diffContent.split('\n');
122
+ let added = 0;
123
+ let deleted = 0;
124
+
125
+ for (const line of lines) {
126
+ // 跳过diff头部信息
127
+ if (line.startsWith('diff ') || line.startsWith('index ') ||
128
+ line.startsWith('--- ') || line.startsWith('+++ ') ||
129
+ line.startsWith('@@ ')) {
130
+ continue;
131
+ }
132
+
133
+ // 统计增加和删除的行
134
+ if (line.startsWith('+')) {
135
+ added++;
136
+ } else if (line.startsWith('-')) {
137
+ deleted++;
138
+ }
139
+ }
140
+
141
+ return { added, deleted };
142
+ }
143
+
144
+ return {
145
+ checkShouldSkipDiff,
146
+ checkDiffSize,
147
+ getDiffStats
148
+ };
149
+ }