zen-gitsync 2.11.2 → 2.11.3

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.
@@ -10,10 +10,10 @@
10
10
  <link rel="preconnect" href="https://fonts.googleapis.com" />
11
11
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
12
12
  <link href="https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet" />
13
- <script type="module" crossorigin src="/assets/index-C4_PwIYq.js"></script>
14
- <link rel="modulepreload" crossorigin href="/assets/vendor-B12x6pMa.js">
15
- <link rel="stylesheet" crossorigin href="/assets/vendor-BeS3b13U.css">
16
- <link rel="stylesheet" crossorigin href="/assets/index-CeUTujBp.css">
13
+ <script type="module" crossorigin src="/assets/index-B0KjkiTF.js"></script>
14
+ <link rel="modulepreload" crossorigin href="/assets/vendor-BSAE54oX.js">
15
+ <link rel="stylesheet" crossorigin href="/assets/vendor-COoKXBNX.css">
16
+ <link rel="stylesheet" crossorigin href="/assets/index-vy-kFr2X.css">
17
17
  </head>
18
18
  <body>
19
19
  <div id="app"></div>
@@ -644,6 +644,23 @@ export function registerConfigRoutes({
644
644
  }
645
645
  })
646
646
 
647
+ // 保存提交设置
648
+ app.post('/api/config/save-commit-settings', express.json(), async (req, res) => {
649
+ try {
650
+ const { isStandardCommit, skipHooks, autoQuickPushOnEnter, autoSetDefaultMessage, autoClosePushModal } = req.body
651
+ const config = await configManager.loadConfig()
652
+ if (isStandardCommit !== undefined) config.isStandardCommit = Boolean(isStandardCommit)
653
+ if (skipHooks !== undefined) config.skipHooks = Boolean(skipHooks)
654
+ if (autoQuickPushOnEnter !== undefined) config.autoQuickPushOnEnter = Boolean(autoQuickPushOnEnter)
655
+ if (autoSetDefaultMessage !== undefined) config.autoSetDefaultMessage = Boolean(autoSetDefaultMessage)
656
+ if (autoClosePushModal !== undefined) config.autoClosePushModal = Boolean(autoClosePushModal)
657
+ await configManager.saveConfig(config)
658
+ res.json({ success: true })
659
+ } catch (error) {
660
+ res.status(500).json({ success: false, error: error.message })
661
+ }
662
+ })
663
+
647
664
  // 保存"一键推送成功后启动项"
648
665
  app.post('/api/config/save-after-quick-push-action', express.json(), async (req, res) => {
649
666
  try {
@@ -3,6 +3,34 @@ import path from 'path';
3
3
  import open from 'open';
4
4
  import { spawn } from 'child_process';
5
5
 
6
+ function spawnDetached(command, args, options = {}) {
7
+ return new Promise((resolve, reject) => {
8
+ const child = spawn(command, args, {
9
+ detached: true,
10
+ stdio: 'ignore',
11
+ ...options
12
+ });
13
+
14
+ child.on('error', reject);
15
+ child.on('spawn', () => {
16
+ child.unref();
17
+ resolve('success');
18
+ });
19
+ });
20
+ }
21
+
22
+ async function launchClaudeCode(dirPath) {
23
+ if (process.platform === 'win32') {
24
+ return spawnDetached('cmd.exe', ['/c', 'start', '""', 'claude'], {
25
+ cwd: dirPath
26
+ });
27
+ }
28
+
29
+ return spawnDetached('claude', [], {
30
+ cwd: dirPath
31
+ });
32
+ }
33
+
6
34
  export function registerFileOpenRoutes({
7
35
  app
8
36
  }) {
@@ -180,11 +208,7 @@ export function registerFileOpenRoutes({
180
208
  }
181
209
 
182
210
  try {
183
- await new Promise((resolve, reject) => {
184
- const vscodeProcess = spawn('code', [dirPath], { detached: true, stdio: 'ignore' });
185
- vscodeProcess.on('error', reject);
186
- vscodeProcess.on('spawn', () => { vscodeProcess.unref(); resolve('success'); });
187
- });
211
+ await spawnDetached('code', [dirPath]);
188
212
  res.json({ success: true, message: '已用 VSCode 打开目录' });
189
213
  } catch {
190
214
  // fallback:通过 open 模块指定 code 应用
@@ -199,4 +223,32 @@ export function registerFileOpenRoutes({
199
223
  res.status(500).json({ success: false, error: error.message });
200
224
  }
201
225
  });
226
+
227
+ // 用 Claude Code 打开目录
228
+ app.post('/api/open-directory-with-claude-code', async (req, res) => {
229
+ try {
230
+ const { path: dirPath } = req.body;
231
+ if (!dirPath) {
232
+ return res.status(400).json({ success: false, error: '目录路径不能为空' });
233
+ }
234
+
235
+ try {
236
+ await fs.access(dirPath);
237
+ } catch (error) {
238
+ return res.status(400).json({ success: false, error: `目录不存在或不可访问: ${dirPath}` });
239
+ }
240
+
241
+ try {
242
+ await launchClaudeCode(dirPath);
243
+ res.json({ success: true, message: '已用 Claude Code 打开目录' });
244
+ } catch (error) {
245
+ res.status(400).json({
246
+ success: false,
247
+ error: '未检测到 Claude Code,请先安装并确保可以在终端中直接运行 claude'
248
+ });
249
+ }
250
+ } catch (error) {
251
+ res.status(500).json({ success: false, error: error.message });
252
+ }
253
+ });
202
254
  }