zen-gitsync 2.12.2 → 2.12.4
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/LICENSE +190 -21
- package/index.js +25 -11
- package/package.json +18 -5
- package/scripts/convert-colors-to-vars.cjs +286 -272
- package/scripts/convert-fontsize-to-vars.cjs +221 -207
- package/scripts/convert-spacing-to-vars.cjs +256 -242
- package/scripts/convert-to-standard-vars.cjs +282 -268
- package/scripts/release.js +599 -585
- package/src/config.js +350 -336
- package/src/gitCommit.js +455 -440
- package/src/ui/public/assets/{EditorView-bnJmBq-i.js → EditorView-BZaOzahT.js} +2 -2
- package/src/ui/public/assets/EditorView-CbqSI9nw.css +1 -0
- package/src/ui/public/assets/{SourceMapView-Rz5SD0A0.js → SourceMapView-D_8mnVt2.js} +3 -3
- package/src/ui/public/assets/SourceMapView-DyMK80hS.css +1 -0
- package/src/ui/public/assets/{index-Bo3tntQh.js → index-BgFwmXzV.js} +11 -11
- package/src/ui/public/assets/{index-bOs5P8fz.css → index-Dsi6tg7k.css} +1 -1
- package/src/ui/public/index.html +2 -2
- package/src/ui/server/index.js +410 -396
- package/src/ui/server/middleware/requestLogger.js +51 -37
- package/src/ui/server/routes/branchStatus.js +101 -87
- package/src/ui/server/routes/code.js +110 -96
- package/src/ui/server/routes/codeAnalysis.js +995 -981
- package/src/ui/server/routes/config.js +1190 -1158
- package/src/ui/server/routes/exec.js +272 -258
- package/src/ui/server/routes/fileOpen.js +279 -265
- package/src/ui/server/routes/fs.js +701 -687
- package/src/ui/server/routes/git/diff.js +352 -338
- package/src/ui/server/routes/git/diffUtils.js +128 -114
- package/src/ui/server/routes/git/stash.js +552 -538
- package/src/ui/server/routes/git/tags.js +172 -158
- package/src/ui/server/routes/git.js +190 -176
- package/src/ui/server/routes/gitOps.js +1179 -1165
- package/src/ui/server/routes/instances.js +14 -0
- package/src/ui/server/routes/npm.js +1023 -1009
- package/src/ui/server/routes/process.js +82 -68
- package/src/ui/server/routes/status.js +67 -53
- package/src/ui/server/routes/terminal.js +319 -305
- package/src/ui/server/socket/registerUiSocketHandlers.js +226 -212
- package/src/ui/server/utils/createSavePortToFile.js +46 -32
- package/src/ui/server/utils/instanceRegistry.js +14 -0
- package/src/ui/server/utils/pathGuard.js +14 -0
- package/src/ui/server/utils/pathGuard.test.js +14 -0
- package/src/ui/server/utils/randomStartPort.js +14 -0
- package/src/ui/server/utils/startServerOnAvailablePort.js +101 -87
- package/src/utils/index.js +14 -0
- package/src/ui/public/assets/EditorView-CHBjgiZc.css +0 -1
- package/src/ui/public/assets/SourceMapView-DhQX0K7t.css +0 -1
|
@@ -1,158 +1,172 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
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
|
+
export function registerGitTagRoutes({ app, execGitCommand, clearCommandHistory }) {
|
|
16
|
+
// ============ Git Tag 相关接口 ============
|
|
17
|
+
|
|
18
|
+
// 创建标签
|
|
19
|
+
app.post('/api/create-tag', async (req, res) => {
|
|
20
|
+
try {
|
|
21
|
+
const { tagName, message, type, commit } = req.body;
|
|
22
|
+
|
|
23
|
+
if (!tagName) {
|
|
24
|
+
return res.status(400).json({ success: false, error: '缺少标签名称' });
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
let command = 'git tag';
|
|
28
|
+
|
|
29
|
+
if (type === 'annotated') {
|
|
30
|
+
// 附注标签
|
|
31
|
+
if (!message) {
|
|
32
|
+
return res.status(400).json({ success: false, error: '附注标签需要提供说明信息' });
|
|
33
|
+
}
|
|
34
|
+
command += ` -a "${tagName}" -m "${message}"`;
|
|
35
|
+
} else {
|
|
36
|
+
// 轻量标签
|
|
37
|
+
command += ` "${tagName}"`;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// 如果指定了commit,添加到命令中
|
|
41
|
+
if (commit && commit.trim()) {
|
|
42
|
+
command += ` ${commit.trim()}`;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const { stdout } = await execGitCommand(command);
|
|
46
|
+
|
|
47
|
+
res.json({
|
|
48
|
+
success: true,
|
|
49
|
+
message: '标签创建成功',
|
|
50
|
+
output: stdout
|
|
51
|
+
});
|
|
52
|
+
} catch (error) {
|
|
53
|
+
console.error('创建标签失败:', error);
|
|
54
|
+
res.status(500).json({ success: false, error: error.message });
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
// 获取标签列表
|
|
59
|
+
app.get('/api/list-tags', async (req, res) => {
|
|
60
|
+
try {
|
|
61
|
+
// 使用 git tag -n --format 获取详细信息
|
|
62
|
+
const { stdout } = await execGitCommand(
|
|
63
|
+
'git tag -n --format="%(refname:short)|%(objectname:short)|%(creatordate:iso8601)|%(subject)"'
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
if (!stdout.trim()) {
|
|
67
|
+
return res.json({ success: true, tags: [] });
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const tags = stdout.trim().split('\n').map(line => {
|
|
71
|
+
const [name, commit, date, message] = line.split('|');
|
|
72
|
+
return {
|
|
73
|
+
name: name || '',
|
|
74
|
+
commit: commit || '',
|
|
75
|
+
date: date || '',
|
|
76
|
+
message: message || '',
|
|
77
|
+
type: 'lightweight' // 默认为轻量标签
|
|
78
|
+
};
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
// 检测哪些是附注标签
|
|
82
|
+
for (const tag of tags) {
|
|
83
|
+
try {
|
|
84
|
+
const { stdout: typeCheck } = await execGitCommand(
|
|
85
|
+
`git cat-file -t ${tag.name}`,
|
|
86
|
+
{ log: false }
|
|
87
|
+
);
|
|
88
|
+
if (typeCheck.trim() === 'tag') {
|
|
89
|
+
tag.type = 'annotated';
|
|
90
|
+
}
|
|
91
|
+
} catch (error) {
|
|
92
|
+
// 忽略错误,保持默认值
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
res.json({ success: true, tags });
|
|
97
|
+
} catch (error) {
|
|
98
|
+
console.error('获取标签列表失败:', error);
|
|
99
|
+
res.status(500).json({ success: false, error: error.message });
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
// 推送标签到远程
|
|
104
|
+
app.post('/api/push-tag', async (req, res) => {
|
|
105
|
+
try {
|
|
106
|
+
const { tagName } = req.body;
|
|
107
|
+
|
|
108
|
+
if (!tagName) {
|
|
109
|
+
return res.status(400).json({ success: false, error: '缺少标签名称' });
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const { stdout } = await execGitCommand(`git push origin ${tagName}`);
|
|
113
|
+
|
|
114
|
+
res.json({
|
|
115
|
+
success: true,
|
|
116
|
+
message: '标签推送成功',
|
|
117
|
+
output: stdout
|
|
118
|
+
});
|
|
119
|
+
} catch (error) {
|
|
120
|
+
console.error('推送标签失败:', error);
|
|
121
|
+
res.status(500).json({ success: false, error: error.message });
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
// 推送所有标签到远程
|
|
126
|
+
app.post('/api/push-all-tags', async (req, res) => {
|
|
127
|
+
try {
|
|
128
|
+
const { stdout } = await execGitCommand('git push origin --tags');
|
|
129
|
+
|
|
130
|
+
res.json({
|
|
131
|
+
success: true,
|
|
132
|
+
message: '所有标签推送成功',
|
|
133
|
+
output: stdout
|
|
134
|
+
});
|
|
135
|
+
} catch (error) {
|
|
136
|
+
console.error('推送所有标签失败:', error);
|
|
137
|
+
res.status(500).json({ success: false, error: error.message });
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
// 删除标签
|
|
142
|
+
app.post('/api/delete-tag', async (req, res) => {
|
|
143
|
+
try {
|
|
144
|
+
const { tagName } = req.body;
|
|
145
|
+
|
|
146
|
+
if (!tagName) {
|
|
147
|
+
return res.status(400).json({ success: false, error: '缺少标签名称' });
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
const { stdout } = await execGitCommand(`git tag -d ${tagName}`);
|
|
151
|
+
|
|
152
|
+
res.json({
|
|
153
|
+
success: true,
|
|
154
|
+
message: '标签删除成功',
|
|
155
|
+
output: stdout
|
|
156
|
+
});
|
|
157
|
+
} catch (error) {
|
|
158
|
+
console.error('删除标签失败:', error);
|
|
159
|
+
res.status(500).json({ success: false, error: error.message });
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
// 添加命令历史的清空API
|
|
164
|
+
app.post('/api/clear-command-history', async (req, res) => {
|
|
165
|
+
try {
|
|
166
|
+
const result = clearCommandHistory();
|
|
167
|
+
res.json({ success: result });
|
|
168
|
+
} catch (error) {
|
|
169
|
+
res.status(500).json({ success: false, error: error.message });
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
}
|