zen-gitsync 2.16.6 → 2.16.8
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/package.json +1 -1
- package/src/cli/ai/modelSetup.js +594 -594
- package/src/cli/ai/modelSetup.test.js +496 -496
- package/src/cli/ai/platformGuard.js +200 -200
- package/src/cli/ai/platformGuard.test.js +253 -253
- package/src/gitCommit.js +484 -484
- package/src/ui/public/assets/AgentView-8-xsOmE6.css +1 -0
- package/src/ui/public/assets/AgentView-DSmUynN-.js +4 -0
- package/src/ui/public/assets/AppVersionBadge-CS7Trvp-.css +1 -0
- package/src/ui/public/assets/AppVersionBadge-CcFagCnq.js +2 -0
- package/src/ui/public/assets/BranchSelector-B0eLkAdv.css +1 -0
- package/src/ui/public/assets/BranchSelector-DcYVBQJh.js +1 -0
- package/src/ui/public/assets/CommitForm-CkTI8Xyz.js +6 -0
- package/src/ui/public/assets/CommitForm-DdK8dymc.css +1 -0
- package/src/ui/public/assets/CommonDialog-BFyhw0Qj.js +1 -0
- package/src/ui/public/assets/CommonDialog-ChSKsEz2.css +1 -0
- package/src/ui/public/assets/EditorView-BVod-rjn.css +1 -0
- package/src/ui/public/assets/EditorView-DuHkBSc3.js +0 -0
- package/src/ui/public/assets/FlowExecutionViewer-C063Qjmk.js +1 -0
- package/src/ui/public/assets/FlowExecutionViewer-jNHI5zdm.css +1 -0
- package/src/ui/public/assets/FlowOrchestrationWorkspace-BeJRId5G.js +21 -0
- package/src/ui/public/assets/FlowOrchestrationWorkspace-CYGp-PqS.css +1 -0
- package/src/ui/public/assets/LogList-CeFFytjB.css +1 -0
- package/src/ui/public/assets/LogList-GSeER4cv.js +15 -0
- package/src/ui/public/assets/MindmapView-BQTqx842.css +1 -0
- package/src/ui/public/assets/MindmapView-p7szLCtQ.js +2 -0
- package/src/ui/public/assets/MonitorView-Be6KEUCe.js +1 -0
- package/src/ui/public/assets/MonitorView-TaS4kL0Y.css +1 -0
- package/src/ui/public/assets/ProjectStartupButton-F1k5Km2p.js +1 -0
- package/src/ui/public/assets/ProjectStartupButton-QLPltCK5.css +1 -0
- package/src/ui/public/assets/RemoteRepoCard-BRGNlbeO.css +1 -0
- package/src/ui/public/assets/RemoteRepoCard-CSMFlWDl.js +5 -0
- package/src/ui/public/assets/SourceMapView-BNRjvgzH.css +1 -0
- package/src/ui/public/assets/SourceMapView-Dg5NP_gR.js +3 -0
- package/src/ui/public/assets/{SvgIcon-BQ6bR7l0.css → SvgIcon-CDNsk4-Q.css} +1 -1
- package/src/ui/public/assets/SvgIcon-CYZGHQAE.js +1 -0
- package/src/ui/public/assets/UserInputNode-3OAXiGVh.js +1 -0
- package/src/ui/public/assets/UserInputNode-BVgQkB2l.css +1 -0
- package/src/ui/public/assets/WorkbenchView-8xyxdWAg.js +28 -0
- package/src/ui/public/assets/{WorkbenchView-CQfjF0Gr.css → WorkbenchView-DbF4hH5s.css} +1 -1
- package/src/ui/public/assets/_plugin-vue_export-helper-DgLDQTWK.js +15 -0
- package/src/ui/public/assets/{configStore-CmG77GNj.js → configStore-D5t05s4G.js} +1 -1
- package/src/ui/public/assets/element-plus-CyGhXd7X.js +25 -0
- package/src/ui/public/assets/element-plus-D3Dn7nX0.css +1 -0
- package/src/ui/public/assets/{flow-mindmap-D26cYDAD.js → flow-mindmap-CUvJaYn2.js} +1 -1
- package/src/ui/public/assets/index--onqtBRQ.css +1 -0
- package/src/ui/public/assets/index-DDGvh1mp.js +68 -0
- package/src/ui/public/assets/socket-io-BSgn8Jx2.js +1 -0
- package/src/ui/public/assets/vendor-DVvq7qtS.css +1 -0
- package/src/ui/public/assets/{vendor-lXqgobGS.js → vendor-jF--I87-.js} +88 -37
- package/src/ui/public/assets/vue-flow-CWmfpfPN.js +39 -0
- package/src/ui/public/favicon.svg +75 -75
- package/src/ui/public/index.html +31 -31
- package/src/ui/public/logo.svg +74 -74
- package/src/ui/server/middleware/requestLogger.js +53 -53
- package/src/ui/server/routes/branchStatus.js +105 -105
- package/src/ui/server/routes/fileOpen.js +3 -2
- package/src/ui/server/routes/fs.js +791 -791
- package/src/ui/server/routes/git/diff.js +426 -426
- package/src/ui/server/routes/git/diffUtils.js +149 -149
- package/src/ui/server/routes/git/stash.js +550 -550
- package/src/ui/server/routes/git/tags.js +176 -176
- package/src/ui/server/routes/git.js +181 -181
- package/src/ui/server/routes/gitOps.js +1255 -1255
- package/src/ui/server/routes/process.js +86 -86
- package/src/ui/server/routes/status.js +67 -67
- package/src/ui/server/routes/workbench/pdfText.js +145 -145
- package/src/ui/server/utils/createSavePortToFile.js +48 -48
- package/src/ui/server/utils/instanceRegistry.js +282 -282
- package/src/ui/server/utils/startServerOnAvailablePort.js +116 -116
- package/src/utils/index.js +1173 -1173
- package/src/ui/public/assets/AgentView-D3ltcW16.js +0 -4
- package/src/ui/public/assets/AgentView-DJBC9U8b.css +0 -1
- package/src/ui/public/assets/AppVersionBadge-DEzojWz9.js +0 -2
- package/src/ui/public/assets/AppVersionBadge-Dj6H729N.css +0 -1
- package/src/ui/public/assets/BranchSelector-T_rJm-JY.css +0 -1
- package/src/ui/public/assets/BranchSelector-YgVQRusR.js +0 -1
- package/src/ui/public/assets/CommitForm-B9xoh9cE.js +0 -6
- package/src/ui/public/assets/CommitForm-CUvl0VcF.css +0 -1
- package/src/ui/public/assets/CommonDialog-Cyh3xu0p.css +0 -1
- package/src/ui/public/assets/CommonDialog-DB4V4CKn.js +0 -1
- package/src/ui/public/assets/EditorView-CRYGVw_r.css +0 -1
- package/src/ui/public/assets/EditorView-CsjhdSd_.js +0 -0
- package/src/ui/public/assets/FlowExecutionViewer-B5kh7VxS.css +0 -1
- package/src/ui/public/assets/FlowExecutionViewer-Blax8J71.js +0 -1
- package/src/ui/public/assets/FlowOrchestrationWorkspace-BAQDU9Jd.css +0 -1
- package/src/ui/public/assets/FlowOrchestrationWorkspace-Dm85yYLO.js +0 -21
- package/src/ui/public/assets/LogList-DJYpDUTZ.css +0 -1
- package/src/ui/public/assets/LogList-WxAgsMg0.js +0 -7
- package/src/ui/public/assets/MindmapView-CS2t30Ko.css +0 -1
- package/src/ui/public/assets/MindmapView-_FKSYPEk.js +0 -1
- package/src/ui/public/assets/MonitorView-CynFYBMr.js +0 -1
- package/src/ui/public/assets/MonitorView-DxFogQIt.css +0 -1
- package/src/ui/public/assets/ProjectStartupButton-B5vk2Lu0.js +0 -1
- package/src/ui/public/assets/ProjectStartupButton-B7zvqRj_.css +0 -1
- package/src/ui/public/assets/RemoteRepoCard-B_iW7EZK.js +0 -1
- package/src/ui/public/assets/RemoteRepoCard-d0klonVb.css +0 -1
- package/src/ui/public/assets/SourceMapView-0fHVZr1r.js +0 -3
- package/src/ui/public/assets/SourceMapView-DG_a_076.css +0 -1
- package/src/ui/public/assets/SvgIcon-Ch_wHlf9.js +0 -1
- package/src/ui/public/assets/UserInputNode-DDtvv9Iq.css +0 -1
- package/src/ui/public/assets/UserInputNode-LbWvYQcA.js +0 -1
- package/src/ui/public/assets/WorkbenchView-CYucXDsF.js +0 -12
- package/src/ui/public/assets/_plugin-vue_export-helper-7QfI9jF6.js +0 -15
- package/src/ui/public/assets/ai-chat-ui-BqgKQovY.js +0 -45
- package/src/ui/public/assets/ai-chat-ui-BwlJovCq.css +0 -1
- package/src/ui/public/assets/element-plus-CQrjg9us.css +0 -1
- package/src/ui/public/assets/element-plus-DjpeTxOl.js +0 -24
- package/src/ui/public/assets/index-CmQSuclp.js +0 -38
- package/src/ui/public/assets/index-hGb6cPd0.css +0 -1
- package/src/ui/public/assets/socket-io-z4n873W1.js +0 -1
- package/src/ui/public/assets/vendor-CdOLCu7-.css +0 -1
- package/src/ui/public/assets/vue-flow-CIbkTMWF.js +0 -39
- package/src/ui/server/.claude/codediff.txt +0 -8
|
@@ -1,105 +1,105 @@
|
|
|
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 { asyncRoute, HttpError } from '../utils/asyncRoute.js'
|
|
16
|
-
|
|
17
|
-
import logger from '../utils/logger.js'
|
|
18
|
-
|
|
19
|
-
export function registerBranchStatusRoutes({
|
|
20
|
-
app,
|
|
21
|
-
execGitCommand,
|
|
22
|
-
getIsGitRepo,
|
|
23
|
-
getBranchStatusCache,
|
|
24
|
-
setBranchStatusCache,
|
|
25
|
-
getRecentPushStatus,
|
|
26
|
-
setRecentPushStatus
|
|
27
|
-
}) {
|
|
28
|
-
// 获取当前分支 - 直接读取,不缓存(git symbolic-ref 极快,<5ms)
|
|
29
|
-
app.get('/api/branch', asyncRoute(async (req, res) => {
|
|
30
|
-
try {
|
|
31
|
-
const { stdout } = await execGitCommand(['symbolic-ref', '--short', 'HEAD']);
|
|
32
|
-
res.json({ branch: stdout.trim() });
|
|
33
|
-
} catch (error) {
|
|
34
|
-
res.status(500).json({ error: error.message });
|
|
35
|
-
}
|
|
36
|
-
}));
|
|
37
|
-
|
|
38
|
-
// 获取分支与远程的差异状态(领先/落后提交数)
|
|
39
|
-
app.get('/api/branch-status', asyncRoute(async (req, res) => {
|
|
40
|
-
try {
|
|
41
|
-
if (!getIsGitRepo()) {
|
|
42
|
-
return res.json({ hasUpstream: false, ahead: 0, behind: 0 });
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const now = Date.now();
|
|
46
|
-
const forceRefresh = req.query.force === 'true';
|
|
47
|
-
|
|
48
|
-
const recentPushStatus = getRecentPushStatus();
|
|
49
|
-
const branchStatusCache = getBranchStatusCache();
|
|
50
|
-
|
|
51
|
-
// push 后10秒内直接返回同步状态
|
|
52
|
-
if (recentPushStatus.justPushed &&
|
|
53
|
-
(now - recentPushStatus.pushTime) < recentPushStatus.validDuration) {
|
|
54
|
-
logger.info('检测到最近推送过,直接返回同步状态');
|
|
55
|
-
return res.json({
|
|
56
|
-
hasUpstream: true,
|
|
57
|
-
upstreamBranch: branchStatusCache.upstreamBranch || 'origin/main',
|
|
58
|
-
ahead: 0,
|
|
59
|
-
behind: 0
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// 5秒缓存分支名,防止短时间内重复执行 git symbolic-ref / git rev-parse
|
|
64
|
-
const branchInfoCacheValid = !forceRefresh &&
|
|
65
|
-
branchStatusCache.currentBranch &&
|
|
66
|
-
branchStatusCache.upstreamBranch &&
|
|
67
|
-
(now - branchStatusCache.lastUpdate) < branchStatusCache.cacheTimeout;
|
|
68
|
-
|
|
69
|
-
let currentBranch, upstreamBranch;
|
|
70
|
-
|
|
71
|
-
if (branchInfoCacheValid) {
|
|
72
|
-
currentBranch = branchStatusCache.currentBranch;
|
|
73
|
-
upstreamBranch = branchStatusCache.upstreamBranch;
|
|
74
|
-
logger.info(`使用5秒缓存的分支名: ${currentBranch} -> ${upstreamBranch}`);
|
|
75
|
-
} else {
|
|
76
|
-
// 直接读取,不再走5分钟长缓存
|
|
77
|
-
const { stdout: branchOut } = await execGitCommand(['symbolic-ref', '--short', 'HEAD']);
|
|
78
|
-
currentBranch = branchOut.trim();
|
|
79
|
-
|
|
80
|
-
const { stdout: upstreamOut } = await execGitCommand(
|
|
81
|
-
['rev-parse', '--abbrev-ref', '--symbolic-full-name', '@{u}'],
|
|
82
|
-
{ ignoreError: true }
|
|
83
|
-
);
|
|
84
|
-
upstreamBranch = upstreamOut.trim() || null;
|
|
85
|
-
|
|
86
|
-
if (!upstreamBranch) {
|
|
87
|
-
setBranchStatusCache({ currentBranch: null, upstreamBranch: null, lastUpdate: 0, cacheTimeout: 5000 });
|
|
88
|
-
return res.json({ hasUpstream: false, ahead: 0, behind: 0 });
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
setBranchStatusCache({ currentBranch, upstreamBranch, lastUpdate: now, cacheTimeout: 5000 });
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
const { stdout: aheadBehindOutput } = await execGitCommand(
|
|
95
|
-
['rev-list', '--left-right', '--count', `${currentBranch}...${upstreamBranch}`]
|
|
96
|
-
);
|
|
97
|
-
const [ahead, behind] = aheadBehindOutput.trim().split('\t').map(Number);
|
|
98
|
-
|
|
99
|
-
res.json({ hasUpstream: true, upstreamBranch, ahead, behind });
|
|
100
|
-
} catch (error) {
|
|
101
|
-
logger.error('获取分支状态失败:', error);
|
|
102
|
-
res.status(500).json({ error: error.message });
|
|
103
|
-
}
|
|
104
|
-
}));
|
|
105
|
-
}
|
|
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 { asyncRoute, HttpError } from '../utils/asyncRoute.js'
|
|
16
|
+
|
|
17
|
+
import logger from '../utils/logger.js'
|
|
18
|
+
|
|
19
|
+
export function registerBranchStatusRoutes({
|
|
20
|
+
app,
|
|
21
|
+
execGitCommand,
|
|
22
|
+
getIsGitRepo,
|
|
23
|
+
getBranchStatusCache,
|
|
24
|
+
setBranchStatusCache,
|
|
25
|
+
getRecentPushStatus,
|
|
26
|
+
setRecentPushStatus
|
|
27
|
+
}) {
|
|
28
|
+
// 获取当前分支 - 直接读取,不缓存(git symbolic-ref 极快,<5ms)
|
|
29
|
+
app.get('/api/branch', asyncRoute(async (req, res) => {
|
|
30
|
+
try {
|
|
31
|
+
const { stdout } = await execGitCommand(['symbolic-ref', '--short', 'HEAD']);
|
|
32
|
+
res.json({ branch: stdout.trim() });
|
|
33
|
+
} catch (error) {
|
|
34
|
+
res.status(500).json({ error: error.message });
|
|
35
|
+
}
|
|
36
|
+
}));
|
|
37
|
+
|
|
38
|
+
// 获取分支与远程的差异状态(领先/落后提交数)
|
|
39
|
+
app.get('/api/branch-status', asyncRoute(async (req, res) => {
|
|
40
|
+
try {
|
|
41
|
+
if (!getIsGitRepo()) {
|
|
42
|
+
return res.json({ hasUpstream: false, ahead: 0, behind: 0 });
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const now = Date.now();
|
|
46
|
+
const forceRefresh = req.query.force === 'true';
|
|
47
|
+
|
|
48
|
+
const recentPushStatus = getRecentPushStatus();
|
|
49
|
+
const branchStatusCache = getBranchStatusCache();
|
|
50
|
+
|
|
51
|
+
// push 后10秒内直接返回同步状态
|
|
52
|
+
if (recentPushStatus.justPushed &&
|
|
53
|
+
(now - recentPushStatus.pushTime) < recentPushStatus.validDuration) {
|
|
54
|
+
logger.info('检测到最近推送过,直接返回同步状态');
|
|
55
|
+
return res.json({
|
|
56
|
+
hasUpstream: true,
|
|
57
|
+
upstreamBranch: branchStatusCache.upstreamBranch || 'origin/main',
|
|
58
|
+
ahead: 0,
|
|
59
|
+
behind: 0
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// 5秒缓存分支名,防止短时间内重复执行 git symbolic-ref / git rev-parse
|
|
64
|
+
const branchInfoCacheValid = !forceRefresh &&
|
|
65
|
+
branchStatusCache.currentBranch &&
|
|
66
|
+
branchStatusCache.upstreamBranch &&
|
|
67
|
+
(now - branchStatusCache.lastUpdate) < branchStatusCache.cacheTimeout;
|
|
68
|
+
|
|
69
|
+
let currentBranch, upstreamBranch;
|
|
70
|
+
|
|
71
|
+
if (branchInfoCacheValid) {
|
|
72
|
+
currentBranch = branchStatusCache.currentBranch;
|
|
73
|
+
upstreamBranch = branchStatusCache.upstreamBranch;
|
|
74
|
+
logger.info(`使用5秒缓存的分支名: ${currentBranch} -> ${upstreamBranch}`);
|
|
75
|
+
} else {
|
|
76
|
+
// 直接读取,不再走5分钟长缓存
|
|
77
|
+
const { stdout: branchOut } = await execGitCommand(['symbolic-ref', '--short', 'HEAD']);
|
|
78
|
+
currentBranch = branchOut.trim();
|
|
79
|
+
|
|
80
|
+
const { stdout: upstreamOut } = await execGitCommand(
|
|
81
|
+
['rev-parse', '--abbrev-ref', '--symbolic-full-name', '@{u}'],
|
|
82
|
+
{ ignoreError: true }
|
|
83
|
+
);
|
|
84
|
+
upstreamBranch = upstreamOut.trim() || null;
|
|
85
|
+
|
|
86
|
+
if (!upstreamBranch) {
|
|
87
|
+
setBranchStatusCache({ currentBranch: null, upstreamBranch: null, lastUpdate: 0, cacheTimeout: 5000 });
|
|
88
|
+
return res.json({ hasUpstream: false, ahead: 0, behind: 0 });
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
setBranchStatusCache({ currentBranch, upstreamBranch, lastUpdate: now, cacheTimeout: 5000 });
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const { stdout: aheadBehindOutput } = await execGitCommand(
|
|
95
|
+
['rev-list', '--left-right', '--count', `${currentBranch}...${upstreamBranch}`]
|
|
96
|
+
);
|
|
97
|
+
const [ahead, behind] = aheadBehindOutput.trim().split('\t').map(Number);
|
|
98
|
+
|
|
99
|
+
res.json({ hasUpstream: true, upstreamBranch, ahead, behind });
|
|
100
|
+
} catch (error) {
|
|
101
|
+
logger.error('获取分支状态失败:', error);
|
|
102
|
+
res.status(500).json({ error: error.message });
|
|
103
|
+
}
|
|
104
|
+
}));
|
|
105
|
+
}
|
|
@@ -407,7 +407,8 @@ export function registerFileOpenRoutes({
|
|
|
407
407
|
|
|
408
408
|
// 检测本地工具是否已安装(供前端根据结果决定是否显示对应按钮)
|
|
409
409
|
// 检测方式: spawn 'tool --version',exit 0 即视为已安装
|
|
410
|
-
// 超时
|
|
410
|
+
// 超时 15s:Claude CLI / opencode 等 Node 包装的工具首次冷启动
|
|
411
|
+
// 在 Windows 上经常 5-7s(磁盘 cache + Defender 扫描),3s 永远命中超时。
|
|
411
412
|
app.get('/api/check-tools', asyncRoute(async (req, res) => {
|
|
412
413
|
const checkCmd = (cmd) => new Promise((resolve) => {
|
|
413
414
|
const child = spawn(cmd, ['--version'], {
|
|
@@ -424,7 +425,7 @@ export function registerFileOpenRoutes({
|
|
|
424
425
|
};
|
|
425
426
|
child.on('error', () => finish(false));
|
|
426
427
|
child.on('exit', (code) => finish(code === 0));
|
|
427
|
-
setTimeout(() => finish(false),
|
|
428
|
+
setTimeout(() => finish(false), 15000);
|
|
428
429
|
});
|
|
429
430
|
|
|
430
431
|
const [vscode, claude, codex, opencode] = await Promise.all([
|