zen-gitsync 2.6.8 → 2.7.1
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/ui/public/assets/index-B3tYubJy.js +78 -0
- package/src/ui/public/assets/index-D43E11BH.css +1 -0
- package/src/ui/public/assets/{vendor-Cl3C22xu.js → vendor-CSWa5gWa.js} +14 -14
- package/src/ui/public/index.html +3 -3
- package/src/ui/server/index.js +149 -1
- package/src/ui/public/assets/index-DVrs6nuO.js +0 -78
- package/src/ui/public/assets/index-oq3DAZAl.css +0 -1
package/src/ui/public/index.html
CHANGED
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
7
7
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
8
8
|
<title>Zen-GitSync - Git同步工具</title>
|
|
9
|
-
<script type="module" crossorigin src="/assets/index-
|
|
10
|
-
<link rel="modulepreload" crossorigin href="/assets/vendor-
|
|
9
|
+
<script type="module" crossorigin src="/assets/index-B3tYubJy.js"></script>
|
|
10
|
+
<link rel="modulepreload" crossorigin href="/assets/vendor-CSWa5gWa.js">
|
|
11
11
|
<link rel="stylesheet" crossorigin href="/assets/vendor-HJmoQ7iQ.css">
|
|
12
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
12
|
+
<link rel="stylesheet" crossorigin href="/assets/index-D43E11BH.css">
|
|
13
13
|
</head>
|
|
14
14
|
<body>
|
|
15
15
|
<div id="app"></div>
|
package/src/ui/server/index.js
CHANGED
|
@@ -3547,6 +3547,153 @@ async function startUIServer(noOpen = false, savePort = false) {
|
|
|
3547
3547
|
}
|
|
3548
3548
|
});
|
|
3549
3549
|
|
|
3550
|
+
// ============ Git Tag 相关接口 ============
|
|
3551
|
+
|
|
3552
|
+
// 创建标签
|
|
3553
|
+
app.post('/api/create-tag', async (req, res) => {
|
|
3554
|
+
try {
|
|
3555
|
+
const { tagName, message, type, commit } = req.body;
|
|
3556
|
+
|
|
3557
|
+
if (!tagName) {
|
|
3558
|
+
return res.status(400).json({ success: false, error: '缺少标签名称' });
|
|
3559
|
+
}
|
|
3560
|
+
|
|
3561
|
+
let command = 'git tag';
|
|
3562
|
+
|
|
3563
|
+
if (type === 'annotated') {
|
|
3564
|
+
// 附注标签
|
|
3565
|
+
if (!message) {
|
|
3566
|
+
return res.status(400).json({ success: false, error: '附注标签需要提供说明信息' });
|
|
3567
|
+
}
|
|
3568
|
+
command += ` -a "${tagName}" -m "${message}"`;
|
|
3569
|
+
} else {
|
|
3570
|
+
// 轻量标签
|
|
3571
|
+
command += ` "${tagName}"`;
|
|
3572
|
+
}
|
|
3573
|
+
|
|
3574
|
+
// 如果指定了commit,添加到命令中
|
|
3575
|
+
if (commit && commit.trim()) {
|
|
3576
|
+
command += ` ${commit.trim()}`;
|
|
3577
|
+
}
|
|
3578
|
+
|
|
3579
|
+
const { stdout } = await execGitCommand(command);
|
|
3580
|
+
|
|
3581
|
+
res.json({
|
|
3582
|
+
success: true,
|
|
3583
|
+
message: '标签创建成功',
|
|
3584
|
+
output: stdout
|
|
3585
|
+
});
|
|
3586
|
+
} catch (error) {
|
|
3587
|
+
console.error('创建标签失败:', error);
|
|
3588
|
+
res.status(500).json({ success: false, error: error.message });
|
|
3589
|
+
}
|
|
3590
|
+
});
|
|
3591
|
+
|
|
3592
|
+
// 获取标签列表
|
|
3593
|
+
app.get('/api/list-tags', async (req, res) => {
|
|
3594
|
+
try {
|
|
3595
|
+
// 使用 git tag -n --format 获取详细信息
|
|
3596
|
+
const { stdout } = await execGitCommand(
|
|
3597
|
+
'git tag -n --format="%(refname:short)|%(objectname:short)|%(creatordate:iso8601)|%(subject)"'
|
|
3598
|
+
);
|
|
3599
|
+
|
|
3600
|
+
if (!stdout.trim()) {
|
|
3601
|
+
return res.json({ success: true, tags: [] });
|
|
3602
|
+
}
|
|
3603
|
+
|
|
3604
|
+
const tags = stdout.trim().split('\n').map(line => {
|
|
3605
|
+
const [name, commit, date, message] = line.split('|');
|
|
3606
|
+
return {
|
|
3607
|
+
name: name || '',
|
|
3608
|
+
commit: commit || '',
|
|
3609
|
+
date: date || '',
|
|
3610
|
+
message: message || '',
|
|
3611
|
+
type: 'lightweight' // 默认为轻量标签
|
|
3612
|
+
};
|
|
3613
|
+
});
|
|
3614
|
+
|
|
3615
|
+
// 检测哪些是附注标签
|
|
3616
|
+
for (const tag of tags) {
|
|
3617
|
+
try {
|
|
3618
|
+
const { stdout: typeCheck } = await execGitCommand(
|
|
3619
|
+
`git cat-file -t ${tag.name}`,
|
|
3620
|
+
{ log: false }
|
|
3621
|
+
);
|
|
3622
|
+
if (typeCheck.trim() === 'tag') {
|
|
3623
|
+
tag.type = 'annotated';
|
|
3624
|
+
}
|
|
3625
|
+
} catch (error) {
|
|
3626
|
+
// 忽略错误,保持默认值
|
|
3627
|
+
}
|
|
3628
|
+
}
|
|
3629
|
+
|
|
3630
|
+
res.json({ success: true, tags });
|
|
3631
|
+
} catch (error) {
|
|
3632
|
+
console.error('获取标签列表失败:', error);
|
|
3633
|
+
res.status(500).json({ success: false, error: error.message });
|
|
3634
|
+
}
|
|
3635
|
+
});
|
|
3636
|
+
|
|
3637
|
+
// 推送标签到远程
|
|
3638
|
+
app.post('/api/push-tag', async (req, res) => {
|
|
3639
|
+
try {
|
|
3640
|
+
const { tagName } = req.body;
|
|
3641
|
+
|
|
3642
|
+
if (!tagName) {
|
|
3643
|
+
return res.status(400).json({ success: false, error: '缺少标签名称' });
|
|
3644
|
+
}
|
|
3645
|
+
|
|
3646
|
+
const { stdout } = await execGitCommand(`git push origin ${tagName}`);
|
|
3647
|
+
|
|
3648
|
+
res.json({
|
|
3649
|
+
success: true,
|
|
3650
|
+
message: '标签推送成功',
|
|
3651
|
+
output: stdout
|
|
3652
|
+
});
|
|
3653
|
+
} catch (error) {
|
|
3654
|
+
console.error('推送标签失败:', error);
|
|
3655
|
+
res.status(500).json({ success: false, error: error.message });
|
|
3656
|
+
}
|
|
3657
|
+
});
|
|
3658
|
+
|
|
3659
|
+
// 推送所有标签到远程
|
|
3660
|
+
app.post('/api/push-all-tags', async (req, res) => {
|
|
3661
|
+
try {
|
|
3662
|
+
const { stdout } = await execGitCommand('git push origin --tags');
|
|
3663
|
+
|
|
3664
|
+
res.json({
|
|
3665
|
+
success: true,
|
|
3666
|
+
message: '所有标签推送成功',
|
|
3667
|
+
output: stdout
|
|
3668
|
+
});
|
|
3669
|
+
} catch (error) {
|
|
3670
|
+
console.error('推送所有标签失败:', error);
|
|
3671
|
+
res.status(500).json({ success: false, error: error.message });
|
|
3672
|
+
}
|
|
3673
|
+
});
|
|
3674
|
+
|
|
3675
|
+
// 删除标签
|
|
3676
|
+
app.post('/api/delete-tag', async (req, res) => {
|
|
3677
|
+
try {
|
|
3678
|
+
const { tagName } = req.body;
|
|
3679
|
+
|
|
3680
|
+
if (!tagName) {
|
|
3681
|
+
return res.status(400).json({ success: false, error: '缺少标签名称' });
|
|
3682
|
+
}
|
|
3683
|
+
|
|
3684
|
+
const { stdout } = await execGitCommand(`git tag -d ${tagName}`);
|
|
3685
|
+
|
|
3686
|
+
res.json({
|
|
3687
|
+
success: true,
|
|
3688
|
+
message: '标签删除成功',
|
|
3689
|
+
output: stdout
|
|
3690
|
+
});
|
|
3691
|
+
} catch (error) {
|
|
3692
|
+
console.error('删除标签失败:', error);
|
|
3693
|
+
res.status(500).json({ success: false, error: error.message });
|
|
3694
|
+
}
|
|
3695
|
+
});
|
|
3696
|
+
|
|
3550
3697
|
// 锁定文件
|
|
3551
3698
|
app.post('/api/lock-file', async (req, res) => {
|
|
3552
3699
|
try {
|
|
@@ -3693,7 +3840,8 @@ async function startUIServer(noOpen = false, savePort = false) {
|
|
|
3693
3840
|
relativePath: relativePath || '.',
|
|
3694
3841
|
name: packageData.name || path.basename(dir),
|
|
3695
3842
|
scripts: packageData.scripts,
|
|
3696
|
-
version: packageData.version || '0.0.0'
|
|
3843
|
+
version: packageData.version || '0.0.0',
|
|
3844
|
+
repository: packageData.repository
|
|
3697
3845
|
});
|
|
3698
3846
|
return true;
|
|
3699
3847
|
}
|