desktop-pet-app 0.1.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/README.md ADDED
@@ -0,0 +1,56 @@
1
+ # Desktop Pet
2
+
3
+ 一个可悬浮在桌面的 AI 宠物,支持账号登录、好友协作与 MCP。
4
+
5
+ ## 安装
6
+
7
+ ```bash
8
+ # 公网包(发布后)
9
+ npm install --global desktop-pet-app
10
+
11
+ # 或本地 tgz
12
+ npm install --global ./desktop-pet-app-0.1.1.tgz
13
+ ```
14
+
15
+ 国内网络若拉不到 Electron 二进制,加镜像:
16
+
17
+ ```bash
18
+ ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/ npm install --global ./desktop-pet-app-0.1.1.tgz
19
+ ```
20
+
21
+ 安装后直接启动:
22
+
23
+ ```bash
24
+ desktop-pet
25
+ ```
26
+
27
+ 客户端默认连接 `http://47.94.20.104`,会自动推导 WebSocket、登录和更新接口。只有本地开发或私有部署时才需要设置 `DESKTOP_PET_HOST`。
28
+
29
+ 首次启动后,在宠物右键菜单中选择“登录账号”或“注册账号”。
30
+
31
+ ## 更新
32
+
33
+ 通过 npm 安装的版本使用 npm 更新:
34
+
35
+ ```bash
36
+ npm update --global desktop-pet-app
37
+ ```
38
+
39
+ 如果使用 macOS `.pkg` 或 Windows 安装包安装,桌宠会从服务器的更新接口发现、下载并安装新版本。
40
+
41
+ ## 发布者命令
42
+
43
+ ```bash
44
+ npm run typecheck
45
+ npm test
46
+ npm run pack:check
47
+ npm publish
48
+ ```
49
+
50
+ macOS 原生安装包:
51
+
52
+ ```bash
53
+ npm run package:mac
54
+ ```
55
+
56
+ 发布前请为正式包配置 Apple Developer 签名和公证凭据。
package/bin/cli.js ADDED
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { spawn } = require('node:child_process')
4
+ const fs = require('node:fs')
5
+ const path = require('node:path')
6
+
7
+ let electron
8
+ try {
9
+ electron = require('electron')
10
+ } catch (error) {
11
+ console.error('未找到 electron 包,请重新安装 desktop-pet-app。')
12
+ console.error('若在国内网络安装失败,可先设置镜像再重装:')
13
+ console.error(' ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/ npm install --global <包路径或包名>')
14
+ console.error(error instanceof Error ? error.message : String(error))
15
+ process.exit(1)
16
+ }
17
+
18
+ if (typeof electron !== 'string' || !fs.existsSync(electron)) {
19
+ console.error('electron 已安装但二进制缺失,请用镜像重装:')
20
+ console.error(' ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/ npm install --global --force <包路径或包名>')
21
+ process.exit(1)
22
+ }
23
+
24
+ const appPath = path.join(__dirname, '..')
25
+
26
+ const child = spawn(electron, [appPath, ...process.argv.slice(2)], {
27
+ stdio: 'ignore',
28
+ detached: true
29
+ })
30
+
31
+ child.unref()