@ytchuan/flowlink 1.0.3 → 1.0.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/README.md CHANGED
@@ -38,6 +38,7 @@ flowlink
38
38
  ```
39
39
 
40
40
  > 首次安装会下载 Electron(~150MB),包内已配置国内镜像加速下载。
41
+ > `flowlink` 默认后台运行,不占用终端。如需调试,使用 `flowlink --foreground` 前台运行。
41
42
 
42
43
  ## 版本更新
43
44
 
package/bin/flowlink.js CHANGED
@@ -3,6 +3,10 @@
3
3
  /**
4
4
  * FlowLink CLI 入口
5
5
  * npm install -g @ytchuan/flowlink 后,用户直接执行 flowlink 即可启动
6
+ *
7
+ * 用法:
8
+ * flowlink # 后台运行(推荐)
9
+ * flowlink --foreground # 前台运行(调试用,终端显示日志)
6
10
  */
7
11
  const { spawn } = require('child_process')
8
12
  const path = require('path')
@@ -13,12 +17,25 @@ const electronPath = require('electron')
13
17
  // 应用根目录(bin 的上一级)
14
18
  const appDir = path.join(__dirname, '..')
15
19
 
16
- // 启动 Electron
17
- const child = spawn(electronPath, [appDir], {
18
- stdio: 'inherit',
19
- env: process.env,
20
- })
20
+ // 检查是否前台模式(调试用)
21
+ const isForeground = process.argv.includes('--foreground') || process.argv.includes('-f')
21
22
 
22
- child.on('close', (code) => {
23
- process.exitCode = code
24
- })
23
+ if (isForeground) {
24
+ // 前台模式:继承终端,显示日志,Ctrl+C 退出
25
+ const child = spawn(electronPath, [appDir], {
26
+ stdio: 'inherit',
27
+ env: process.env,
28
+ })
29
+ child.on('close', (code) => {
30
+ process.exitCode = code
31
+ })
32
+ } else {
33
+ // 后台模式:分离进程,立即返回终端控制权给用户
34
+ const child = spawn(electronPath, [appDir], {
35
+ detached: true,
36
+ stdio: 'ignore',
37
+ env: process.env,
38
+ })
39
+ child.unref() // 允许父进程退出,不等待子进程
40
+ console.log('FlowLink 已在后台启动')
41
+ }
package/main.js CHANGED
@@ -248,6 +248,16 @@ function registerIpcHandlers() {
248
248
  // ---- App 生命周期 ----
249
249
  app.whenReady().then(() => {
250
250
  registerIpcHandlers()
251
+
252
+ // macOS: 设置 Dock 图标(非打包模式下默认显示 Electron 图标)
253
+ if (process.platform === 'darwin' && app.dock) {
254
+ const { nativeImage } = require('electron')
255
+ const dockIcon = nativeImage.createFromPath(path.join(__dirname, 'assets', 'logo512.png'))
256
+ if (!dockIcon.isEmpty()) {
257
+ app.dock.setIcon(dockIcon)
258
+ }
259
+ }
260
+
251
261
  createWindow()
252
262
 
253
263
  // 调度服务不随软件启动,由主页"启动服务"按钮触发(scheduler:start)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ytchuan/flowlink",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "FlowLink 桌面客户端 - AI 服务调度与管理",
5
5
  "main": "main.js",
6
6
  "bin": {