petdex-cc 0.1.6 → 0.1.7
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 +21 -21
- package/README.md +287 -112
- package/README_CN.md +283 -110
- package/dist/bin/cli.js +13 -13
- package/dist/src/hooks/write-scripts.js +21 -21
- package/dist/src/renderer/index.html +264 -264
- package/dist/src/renderer/wander.d.ts +8 -0
- package/dist/src/renderer/wander.d.ts.map +1 -0
- package/dist/src/renderer/wander.js +137 -0
- package/dist/src/renderer/wander.js.map +1 -0
- package/package.json +12 -2
- package/src/hooks/bridge.ps1 +11 -11
- package/src/hooks/bridge.sh +9 -9
package/README_CN.md
CHANGED
|
@@ -1,46 +1,114 @@
|
|
|
1
1
|
<div align="center">
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<br />
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
# ✨ petdex-cc ✨
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
### Claude Code 桌面宠物伴侣
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
[]()
|
|
11
|
-
[]()
|
|
12
|
-
[]()
|
|
13
|
-
[](https://petdex.crafter.run/zh)
|
|
9
|
+
**住在屏幕上的动画宠物,实时响应你的每一次编码操作**
|
|
14
10
|
|
|
15
|
-
|
|
11
|
+
<br />
|
|
12
|
+
|
|
13
|
+
[](https://www.npmjs.com/package/petdex-cc)
|
|
14
|
+
[]()
|
|
15
|
+
[]()
|
|
16
|
+
[](./LICENSE)
|
|
17
|
+
[](https://petdex.crafter.run/zh)
|
|
18
|
+
[](https://github.com/devnomad-byte/petdex-cc/stargazers)
|
|
19
|
+
|
|
20
|
+
<br />
|
|
21
|
+
|
|
22
|
+
[🌐 English](./README.md) · [🇨🇳 中文文档](./README_CN.md)
|
|
16
23
|
|
|
17
24
|
</div>
|
|
18
25
|
|
|
19
26
|
---
|
|
20
27
|
|
|
21
|
-
|
|
28
|
+
<div align="center">
|
|
29
|
+
|
|
30
|
+
<img src="./boba.gif" alt="petdex-cc 演示" width="600" />
|
|
31
|
+
|
|
32
|
+
</div>
|
|
22
33
|
|
|
23
|
-
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
<div align="center">
|
|
37
|
+
|
|
38
|
+
🐾 **一条命令,唤醒你的专属宠物** 🐾
|
|
39
|
+
|
|
40
|
+
</div>
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
npx petdex-cc install boba
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
<div align="center">
|
|
47
|
+
<i>宠物立刻出现在桌面上,开始响应你的 Claude Code 操作 🎉</i>
|
|
48
|
+
</div>
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## 🌟 为什么选择 petdex-cc?
|
|
24
53
|
|
|
25
54
|
> **和 `npx petdex install` 有什么区别?**
|
|
55
|
+
>
|
|
26
56
|
> 原始的 `petdex` 命令提供基础宠物展示。`petdex-cc` 额外增加了**深度 Claude Code 集成** —— 通过 hooks 接入你的编码流程,包含等级成长系统、AI 生成语音、时段问候、互动特效。你的宠物不只是一个装饰,它*参与*你的编码过程。
|
|
27
57
|
|
|
28
|
-
>
|
|
58
|
+
<table>
|
|
59
|
+
<tr>
|
|
60
|
+
<td width="50%">
|
|
61
|
+
|
|
62
|
+
🎯 **实时反应**
|
|
63
|
+
|
|
64
|
+
读文件、编辑代码、运行命令、完成任务、遇到错误时,宠物同步改变动画
|
|
65
|
+
|
|
66
|
+
</td>
|
|
67
|
+
<td width="50%">
|
|
68
|
+
|
|
69
|
+
🏆 **8 级成长体系**
|
|
70
|
+
|
|
71
|
+
Byte → Process → Thread → Module → Kernel → Neural → Quantum → Singularity
|
|
72
|
+
|
|
73
|
+
</td>
|
|
74
|
+
</tr>
|
|
75
|
+
<tr>
|
|
76
|
+
<td width="50%">
|
|
29
77
|
|
|
30
|
-
|
|
78
|
+
🤖 **AI 语音气泡**
|
|
31
79
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
80
|
+
基于 Claude 生成的上下文感知中文对话,无 API Key 时使用内置台词
|
|
81
|
+
|
|
82
|
+
</td>
|
|
83
|
+
<td width="50%">
|
|
84
|
+
|
|
85
|
+
🕐 **时段问候**
|
|
86
|
+
|
|
87
|
+
早上好、午安、下午茶、下班、晚安、凌晨问候
|
|
88
|
+
|
|
89
|
+
</td>
|
|
90
|
+
</tr>
|
|
91
|
+
<tr>
|
|
92
|
+
<td width="50%">
|
|
93
|
+
|
|
94
|
+
🎮 **互动体验**
|
|
95
|
+
|
|
96
|
+
拖拽宠物到任意位置、右键菜单、快速点击彩蛋
|
|
97
|
+
|
|
98
|
+
</td>
|
|
99
|
+
<td width="50%">
|
|
100
|
+
|
|
101
|
+
💾 **状态持久化**
|
|
102
|
+
|
|
103
|
+
等级和事件数重启不丢失(HMAC 签名防篡改)
|
|
104
|
+
|
|
105
|
+
</td>
|
|
106
|
+
</tr>
|
|
107
|
+
</table>
|
|
40
108
|
|
|
41
109
|
---
|
|
42
110
|
|
|
43
|
-
## 快速开始
|
|
111
|
+
## 🚀 快速开始
|
|
44
112
|
|
|
45
113
|
### 环境要求
|
|
46
114
|
|
|
@@ -57,70 +125,156 @@ petdex-cc 为你的 Claude Code 工作流带来**动画桌面宠物**。从 [Pet
|
|
|
57
125
|
npx petdex-cc install boba
|
|
58
126
|
```
|
|
59
127
|
|
|
60
|
-
|
|
128
|
+
### 🐾 热门宠物
|
|
129
|
+
|
|
130
|
+
<table>
|
|
131
|
+
<tr>
|
|
132
|
+
<th>Slug</th>
|
|
133
|
+
<th>名称</th>
|
|
134
|
+
<th>描述</th>
|
|
135
|
+
</tr>
|
|
136
|
+
<tr>
|
|
137
|
+
<td><code>boba</code></td>
|
|
138
|
+
<td>🦦 Boba</td>
|
|
139
|
+
<td>喝着珍珠奶茶的小水獭</td>
|
|
140
|
+
</tr>
|
|
141
|
+
<tr>
|
|
142
|
+
<td><code>doraemon</code></td>
|
|
143
|
+
<td>🐱 哆啦A梦</td>
|
|
144
|
+
<td>来自未来的蓝色机器猫</td>
|
|
145
|
+
</tr>
|
|
146
|
+
<tr>
|
|
147
|
+
<td><code>noir-webling</code></td>
|
|
148
|
+
<td>🕷️ Noir Webling</td>
|
|
149
|
+
<td>戴礼帽的单色蜘蛛侦探</td>
|
|
150
|
+
</tr>
|
|
151
|
+
<tr>
|
|
152
|
+
<td><code>ikun-hoops</code></td>
|
|
153
|
+
<td>🏀 IKUN Hoops</td>
|
|
154
|
+
<td>穿卫衣拿篮球的小鸡</td>
|
|
155
|
+
</tr>
|
|
156
|
+
<tr>
|
|
157
|
+
<td><code>ddo-zvzo</code></td>
|
|
158
|
+
<td>😎 ddo-zvzo</td>
|
|
159
|
+
<td>会戴墨镜的紫色吉祥物</td>
|
|
160
|
+
</tr>
|
|
161
|
+
<tr>
|
|
162
|
+
<td><code>mochi</code></td>
|
|
163
|
+
<td>🐱 Mochi</td>
|
|
164
|
+
<td>橘白色可爱小猫</td>
|
|
165
|
+
</tr>
|
|
166
|
+
</table>
|
|
167
|
+
|
|
168
|
+
> 浏览全部 1,569+ 款宠物 → [**petdex.crafter.run/zh**](https://petdex.crafter.run/zh) 🎨
|
|
169
|
+
|
|
170
|
+
<details>
|
|
171
|
+
<summary>🌏 国内用户加速(必看)</summary>
|
|
172
|
+
|
|
173
|
+
<br />
|
|
174
|
+
|
|
175
|
+
首次安装需要下载 Electron 二进制文件(~100MB),默认从 GitHub 下载,国内可能很慢或无法访问。安装前配置国内镜像:
|
|
61
176
|
|
|
62
|
-
|
|
177
|
+
```bash
|
|
178
|
+
# 设置 npm 淘宝镜像源
|
|
179
|
+
npm config set registry https://registry.npmmirror.com
|
|
63
180
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
181
|
+
# 设置 Electron 下载镜像
|
|
182
|
+
npm config set electron_mirror https://npmmirror.com/mirrors/electron/
|
|
183
|
+
|
|
184
|
+
# 然后安装
|
|
185
|
+
npx petdex-cc install boba
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
以上配置永久生效,只需设置一次。
|
|
189
|
+
|
|
190
|
+
</details>
|
|
191
|
+
|
|
192
|
+
<details>
|
|
193
|
+
<summary>🔧 常见问题</summary>
|
|
194
|
+
|
|
195
|
+
<br />
|
|
196
|
+
|
|
197
|
+
**`ERR_MODULE_NOT_FOUND: Cannot find package '@electron/remote'`**
|
|
198
|
+
|
|
199
|
+
这是 0.1.6 之前版本的 bug。更新到最新版即可:
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
npm uninstall -g petdex-cc
|
|
203
|
+
npx petdex-cc install boba
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
**`EPERM` / `EBUSY` 文件被锁**
|
|
207
|
+
|
|
208
|
+
宠物进程仍在运行,锁住了文件。先停止宠物:
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
# Windows PowerShell
|
|
212
|
+
Stop-Process -Name electron -Force -ErrorAction SilentlyContinue
|
|
72
213
|
|
|
73
|
-
|
|
214
|
+
# macOS / Linux
|
|
215
|
+
pkill -f electron
|
|
216
|
+
|
|
217
|
+
# 然后重新安装
|
|
218
|
+
npx petdex-cc install boba
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
**安装时 `ECONNRESET` / `ETIMEDOUT`**
|
|
222
|
+
|
|
223
|
+
Electron 无法从 GitHub 下载。请配置国内镜像(见上方「国内用户加速」)。
|
|
224
|
+
|
|
225
|
+
</details>
|
|
74
226
|
|
|
75
227
|
---
|
|
76
228
|
|
|
77
|
-
## 你的宠物会做什么
|
|
229
|
+
## 🎬 你的宠物会做什么
|
|
78
230
|
|
|
79
231
|
Claude Code 的每一次操作都会触发宠物反应:
|
|
80
232
|
|
|
81
233
|
| Claude Code 事件 | 宠物动画 | 语音气泡 |
|
|
82
234
|
|---|---|---|
|
|
83
|
-
| 会话开始 | 挥手 | "Let's get to work!" |
|
|
84
|
-
| 读取文件 | 审视 | "Reading 文件名..." |
|
|
85
|
-
| 编辑文件 | 待机 | "Edited 文件名" |
|
|
86
|
-
| 运行命令 | 奔跑 | "Running command..." |
|
|
87
|
-
| 搜索文件 | 等待 | "Searching..." |
|
|
88
|
-
| 工具失败 | 垂头 | "Oops, something went wrong" + AI 鼓励 |
|
|
89
|
-
| 任务完成 | 跳跃 | "Task complete!" + AI 庆祝 |
|
|
90
|
-
| Claude 停止 | 跳跃 | "Task complete!"(60% 概率触发 AI) |
|
|
91
|
-
| Claude 报错 | 垂头 | 错误信息 + AI 安慰 |
|
|
92
|
-
| 空闲 10+ 分钟 | 挥手 | 时段问候(中文) |
|
|
93
|
-
| 等级提升 | 当前状态 | "Level up! Kernel!" + 特效激活 |
|
|
94
|
-
|
|
95
|
-
### 互动操作
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
235
|
+
| 🟢 会话开始 | 挥手 👋 | "Let's get to work!" |
|
|
236
|
+
| 📖 读取文件 | 审视 🔍 | "Reading 文件名..." |
|
|
237
|
+
| ✏️ 编辑文件 | 待机 | "Edited 文件名" |
|
|
238
|
+
| ▶️ 运行命令 | 奔跑 🏃 | "Running command..." |
|
|
239
|
+
| 🔍 搜索文件 | 等待 ⏳ | "Searching..." |
|
|
240
|
+
| ❌ 工具失败 | 垂头 😢 | "Oops, something went wrong" + AI 鼓励 |
|
|
241
|
+
| ✅ 任务完成 | 跳跃 🎉 | "Task complete!" + AI 庆祝 |
|
|
242
|
+
| 🛑 Claude 停止 | 跳跃 | "Task complete!"(60% 概率触发 AI) |
|
|
243
|
+
| ⚠️ Claude 报错 | 垂头 | 错误信息 + AI 安慰 |
|
|
244
|
+
| 💤 空闲 10+ 分钟 | 挥手 | 时段问候(中文) |
|
|
245
|
+
| ⬆️ 等级提升 | 当前状态 | "Level up! Kernel!" + 特效激活 |
|
|
246
|
+
|
|
247
|
+
### 🎮 互动操作
|
|
248
|
+
|
|
249
|
+
| 操作 | 效果 |
|
|
250
|
+
|---|---|
|
|
251
|
+
| **拖拽** | 点击拖动宠物到屏幕任意位置 |
|
|
252
|
+
| **右键** | 上下文菜单:显示/隐藏、关于、退出 |
|
|
253
|
+
| **系统托盘** | 右下角任务栏图标 |
|
|
254
|
+
| **彩蛋** | 快速连续点击,触发递进式反应(2→4→6→9→12→15 次) |
|
|
101
255
|
|
|
102
256
|
---
|
|
103
257
|
|
|
104
|
-
## 等级系统
|
|
258
|
+
## 🏆 等级系统
|
|
105
259
|
|
|
106
|
-
|
|
260
|
+
你的宠物随你的编码而成长,每次 Claude Code 操作算一次事件,累积升级:
|
|
107
261
|
|
|
108
|
-
| 等级 | 名称 | 所需事件数 |
|
|
262
|
+
| 等级 | 名称 | 所需事件数 | | 视觉效果 |
|
|
109
263
|
|:---:|---|---:|---|---|
|
|
110
|
-
| 1 | **Byte** | 0 |
|
|
111
|
-
| 2 | **Process** | 50 |
|
|
112
|
-
| 3 | **Thread** | 200 |
|
|
113
|
-
| 4 | **Module** | 500 |
|
|
114
|
-
| 5 | **Kernel** | 1,000 |
|
|
115
|
-
| 6 | **Neural** | 2,000 |
|
|
116
|
-
| 7 | **Quantum** | 5,000 |
|
|
117
|
-
| 8 | **Singularity** | 10,000 |
|
|
264
|
+
| 1 | **Byte** | 0 | ⚪ 基础宠物 |
|
|
265
|
+
| 2 | **Process** | 50 | 🟢 呼吸式发光 |
|
|
266
|
+
| 3 | **Thread** | 200 | 🔵 旋转光环 |
|
|
267
|
+
| 4 | **Module** | 500 | 🟣 增强光环 |
|
|
268
|
+
| 5 | **Kernel** | 1,000 | 🟡 漂浮光点粒子 |
|
|
269
|
+
| 6 | **Neural** | 2,000 | 🩷 粒子风暴 |
|
|
270
|
+
| 7 | **Quantum** | 5,000 | 🩵 能量场 |
|
|
271
|
+
| 8 | **Singularity** | 10,000 | 🌟 金色光环 + 全部特效 |
|
|
118
272
|
|
|
119
273
|
---
|
|
120
274
|
|
|
121
|
-
## AI 语音
|
|
275
|
+
## 🤖 AI 语音
|
|
122
276
|
|
|
123
|
-
当 Anthropic API Key 可用时(自动从 Claude Code
|
|
277
|
+
当 Anthropic API Key 可用时(自动从 Claude Code 设置读取),宠物会生成**上下文感知的中文语音**:
|
|
124
278
|
|
|
125
279
|
| 场景 | 触发时机 | AI 生成示例 |
|
|
126
280
|
|---|---|---|
|
|
@@ -135,7 +289,7 @@ Claude Code 的每一次操作都会触发宠物反应:
|
|
|
135
289
|
|
|
136
290
|
---
|
|
137
291
|
|
|
138
|
-
## 命令参考
|
|
292
|
+
## 📋 命令参考
|
|
139
293
|
|
|
140
294
|
```bash
|
|
141
295
|
petdex-cc install <slug> # 下载宠物、配置 hooks、启动
|
|
@@ -148,7 +302,10 @@ petdex-cc uninstall # 移除 hooks、停止宠物、删除所有数据
|
|
|
148
302
|
petdex-cc config [选项] # 配置设置
|
|
149
303
|
```
|
|
150
304
|
|
|
151
|
-
|
|
305
|
+
<details>
|
|
306
|
+
<summary>⚙️ 配置选项</summary>
|
|
307
|
+
|
|
308
|
+
<br />
|
|
152
309
|
|
|
153
310
|
```bash
|
|
154
311
|
petdex-cc config --api-key <key> # Anthropic API Key(用于 AI 语音)
|
|
@@ -158,9 +315,11 @@ petdex-cc config --cooldown <分钟> # AI 调用冷却时间(默
|
|
|
158
315
|
|
|
159
316
|
> API 凭据会自动从 `~/.claude/settings.json` 读取,大多数用户无需手动配置。
|
|
160
317
|
|
|
318
|
+
</details>
|
|
319
|
+
|
|
161
320
|
---
|
|
162
321
|
|
|
163
|
-
## 架构设计
|
|
322
|
+
## 🏗️ 架构设计
|
|
164
323
|
|
|
165
324
|
```
|
|
166
325
|
┌─────────────────────────────────────────────────┐
|
|
@@ -200,25 +359,10 @@ petdex-cc config --cooldown <分钟> # AI 调用冷却时间(默
|
|
|
200
359
|
└──────────────────┘
|
|
201
360
|
```
|
|
202
361
|
|
|
203
|
-
|
|
362
|
+
<details>
|
|
363
|
+
<summary>📁 项目结构</summary>
|
|
204
364
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
```bash
|
|
208
|
-
git clone https://github.com/devnomad-byte/petdex-cc.git
|
|
209
|
-
cd petdex-cc
|
|
210
|
-
npm install
|
|
211
|
-
npm run build
|
|
212
|
-
|
|
213
|
-
# 开发模式启动
|
|
214
|
-
npx electron .
|
|
215
|
-
|
|
216
|
-
# 全局安装使用 CLI
|
|
217
|
-
npm link
|
|
218
|
-
petdex-cc install boba
|
|
219
|
-
```
|
|
220
|
-
|
|
221
|
-
### 项目结构
|
|
365
|
+
<br />
|
|
222
366
|
|
|
223
367
|
```
|
|
224
368
|
petdex-cc/
|
|
@@ -241,21 +385,38 @@ petdex-cc/
|
|
|
241
385
|
│ │ └── context-menu.ts 右键菜单
|
|
242
386
|
│ ├── cli/ CLI 命令实现
|
|
243
387
|
│ ├── hooks/ Claude Code hooks 注册
|
|
244
|
-
│ │ ├── register.ts 写入 ~/.claude/settings.json
|
|
245
|
-
│ │ ├── write-scripts.ts 跨平台 bridge 脚本
|
|
246
|
-
│ │ ├── bridge.ps1 Windows PowerShell bridge
|
|
247
|
-
│ │ └── bridge.sh Unix bash bridge
|
|
248
388
|
│ ├── petdex-api/ Petdex 注册中心客户端
|
|
249
|
-
│ │ ├── client.ts 清单获取 + slug 查询
|
|
250
|
-
│ │ └── download.ts 流式下载 + 进度回调
|
|
251
389
|
│ └── shared/ 共享类型和常量
|
|
252
390
|
```
|
|
253
391
|
|
|
392
|
+
</details>
|
|
393
|
+
|
|
394
|
+
---
|
|
395
|
+
|
|
396
|
+
## 🔧 开发者安装
|
|
397
|
+
|
|
398
|
+
```bash
|
|
399
|
+
git clone https://github.com/devnomad-byte/petdex-cc.git
|
|
400
|
+
cd petdex-cc
|
|
401
|
+
npm install
|
|
402
|
+
npm run build
|
|
403
|
+
|
|
404
|
+
# 开发模式启动
|
|
405
|
+
npx electron .
|
|
406
|
+
|
|
407
|
+
# 全局安装使用 CLI
|
|
408
|
+
npm link
|
|
409
|
+
petdex-cc install boba
|
|
410
|
+
```
|
|
411
|
+
|
|
254
412
|
---
|
|
255
413
|
|
|
256
|
-
## 配置参考
|
|
414
|
+
## ⚙️ 配置参考
|
|
415
|
+
|
|
416
|
+
<details>
|
|
417
|
+
<summary>自动检测配置</summary>
|
|
257
418
|
|
|
258
|
-
|
|
419
|
+
<br />
|
|
259
420
|
|
|
260
421
|
petdex-cc 自动从 `~/.claude/settings.json` 读取以下配置:
|
|
261
422
|
|
|
@@ -264,15 +425,12 @@ petdex-cc 自动从 `~/.claude/settings.json` 读取以下配置:
|
|
|
264
425
|
| `ANTHROPIC_AUTH_TOKEN` | AI 语音的 API Key |
|
|
265
426
|
| `ANTHROPIC_BASE_URL` | AI 语音的 API 端点 |
|
|
266
427
|
|
|
267
|
-
|
|
428
|
+
</details>
|
|
268
429
|
|
|
269
|
-
|
|
430
|
+
<details>
|
|
431
|
+
<summary>数据目录</summary>
|
|
270
432
|
|
|
271
|
-
|
|
272
|
-
petdex-cc config --api-key <key> --api-base-url <url> --cooldown 2
|
|
273
|
-
```
|
|
274
|
-
|
|
275
|
-
### 数据目录
|
|
433
|
+
<br />
|
|
276
434
|
|
|
277
435
|
| 路径 | 内容 |
|
|
278
436
|
|---|---|
|
|
@@ -282,11 +440,11 @@ petdex-cc config --api-key <key> --api-base-url <url> --cooldown 2
|
|
|
282
440
|
| `~/.petdex-cc/hooks/` | Bridge 脚本 |
|
|
283
441
|
| `~/.petdex-cc/config.json` | 用户配置(API Key、冷却时间) |
|
|
284
442
|
|
|
285
|
-
|
|
443
|
+
</details>
|
|
286
444
|
|
|
287
|
-
|
|
445
|
+
---
|
|
288
446
|
|
|
289
|
-
|
|
447
|
+
## 🪝 Hooks 参考
|
|
290
448
|
|
|
291
449
|
| Hook | 匹配器 | 触发时机 |
|
|
292
450
|
|---|---|---|
|
|
@@ -301,7 +459,7 @@ petdex-cc 在 `~/.claude/settings.json` 中注册以下 hooks:
|
|
|
301
459
|
|
|
302
460
|
---
|
|
303
461
|
|
|
304
|
-
## 后续计划
|
|
462
|
+
## 🗺️ 后续计划
|
|
305
463
|
|
|
306
464
|
- [ ] 支持 Cursor
|
|
307
465
|
- [ ] 支持 Windsurf
|
|
@@ -311,13 +469,28 @@ petdex-cc 在 `~/.claude/settings.json` 中注册以下 hooks:
|
|
|
311
469
|
|
|
312
470
|
---
|
|
313
471
|
|
|
314
|
-
|
|
472
|
+
<div align="center">
|
|
473
|
+
|
|
474
|
+
## ⭐ Star 趋势
|
|
475
|
+
|
|
476
|
+
<a href="https://www.star-history.com/?repos=devnomad-byte%2Fpetdex-cc&type=date&legend=top-left">
|
|
477
|
+
<picture>
|
|
478
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/chart?repos=devnomad-byte/petdex-cc&type=date&theme=dark&legend=top-left" />
|
|
479
|
+
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/chart?repos=devnomad-byte/petdex-cc&type=date&legend=top-left" />
|
|
480
|
+
<img alt="Star History Chart" src="https://api.star-history.com/chart?repos=devnomad-byte/petdex-cc&type=date&legend=top-left" />
|
|
481
|
+
</picture>
|
|
482
|
+
</a>
|
|
483
|
+
|
|
484
|
+
<br />
|
|
485
|
+
|
|
486
|
+
## 📄 许可证
|
|
315
487
|
|
|
316
488
|
[MIT](./LICENSE)
|
|
317
489
|
|
|
318
|
-
|
|
490
|
+
<br />
|
|
491
|
+
|
|
492
|
+
为 [Claude Code](https://docs.anthropic.com/en/docs/claude-code) 社区用心打造 💜
|
|
493
|
+
|
|
494
|
+
宠物来自 [**Petdex**](https://petdex.crafter.run/zh) · 1,569+ 款社区宠物,持续更新中
|
|
319
495
|
|
|
320
|
-
<div align="center">
|
|
321
|
-
<sub>为 <a href="https://docs.anthropic.com/en/docs/claude-code">Claude Code</a> 社区用心打造</sub><br />
|
|
322
|
-
<sub>宠物来自 <a href="https://petdex.crafter.run/zh">Petdex</a></sub>
|
|
323
496
|
</div>
|
package/dist/bin/cli.js
CHANGED
|
@@ -56,19 +56,19 @@ async function main() {
|
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
function printHelp() {
|
|
59
|
-
console.log(`
|
|
60
|
-
petdex-cc - Desktop pet companion for Claude Code
|
|
61
|
-
|
|
62
|
-
Commands:
|
|
63
|
-
install <slug> Install a pet from Petdex and configure hooks
|
|
64
|
-
start Start the desktop pet
|
|
65
|
-
stop Stop the desktop pet
|
|
66
|
-
list List available pets from Petdex
|
|
67
|
-
switch <slug> Switch to a different pet
|
|
68
|
-
status Show current pet status and level
|
|
69
|
-
uninstall Remove petdex-cc hooks and data
|
|
70
|
-
config Configure API key and settings
|
|
71
|
-
help Show this help message
|
|
59
|
+
console.log(`
|
|
60
|
+
petdex-cc - Desktop pet companion for Claude Code
|
|
61
|
+
|
|
62
|
+
Commands:
|
|
63
|
+
install <slug> Install a pet from Petdex and configure hooks
|
|
64
|
+
start Start the desktop pet
|
|
65
|
+
stop Stop the desktop pet
|
|
66
|
+
list List available pets from Petdex
|
|
67
|
+
switch <slug> Switch to a different pet
|
|
68
|
+
status Show current pet status and level
|
|
69
|
+
uninstall Remove petdex-cc hooks and data
|
|
70
|
+
config Configure API key and settings
|
|
71
|
+
help Show this help message
|
|
72
72
|
`);
|
|
73
73
|
}
|
|
74
74
|
main().catch((err) => {
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
import * as fs from "fs";
|
|
2
2
|
import * as path from "path";
|
|
3
3
|
import { homedir } from "node:os";
|
|
4
|
-
const BRIDGE_SH = `#!/bin/bash
|
|
5
|
-
INPUT=$(cat)
|
|
6
|
-
PORT_FILE="$HOME/.petdex-cc/data/port.lock"
|
|
7
|
-
PORT=17321
|
|
8
|
-
if [ -f "$PORT_FILE" ]; then
|
|
9
|
-
PORT=$(cat "$PORT_FILE" 2>/dev/null || echo "17321")
|
|
10
|
-
fi
|
|
11
|
-
curl -s -X POST "http://localhost:$PORT/event" \\
|
|
12
|
-
-H "Content-Type: application/json" \\
|
|
13
|
-
-d "$INPUT" > /dev/null 2>&1 &
|
|
4
|
+
const BRIDGE_SH = `#!/bin/bash
|
|
5
|
+
INPUT=$(cat)
|
|
6
|
+
PORT_FILE="$HOME/.petdex-cc/data/port.lock"
|
|
7
|
+
PORT=17321
|
|
8
|
+
if [ -f "$PORT_FILE" ]; then
|
|
9
|
+
PORT=$(cat "$PORT_FILE" 2>/dev/null || echo "17321")
|
|
10
|
+
fi
|
|
11
|
+
curl -s -X POST "http://localhost:$PORT/event" \\
|
|
12
|
+
-H "Content-Type: application/json" \\
|
|
13
|
+
-d "$INPUT" > /dev/null 2>&1 &
|
|
14
14
|
`;
|
|
15
|
-
const BRIDGE_PS1 = `$inputJson = [System.Console]::In.ReadToEnd()
|
|
16
|
-
$portFile = Join-Path $env:USERPROFILE ".petdex-cc\\data\\port.lock"
|
|
17
|
-
$port = 17321
|
|
18
|
-
if (Test-Path $portFile) {
|
|
19
|
-
$port = Get-Content $portFile -ErrorAction SilentlyContinue
|
|
20
|
-
if (-not $port) { $port = 17321 }
|
|
21
|
-
}
|
|
22
|
-
$url = "http://localhost:$port/event"
|
|
23
|
-
try {
|
|
24
|
-
Invoke-WebRequest -Uri $url -Method POST -ContentType "application/json" -Body $inputJson -UseBasicParsing -TimeoutSec 5 | Out-Null
|
|
25
|
-
} catch {}
|
|
15
|
+
const BRIDGE_PS1 = `$inputJson = [System.Console]::In.ReadToEnd()
|
|
16
|
+
$portFile = Join-Path $env:USERPROFILE ".petdex-cc\\data\\port.lock"
|
|
17
|
+
$port = 17321
|
|
18
|
+
if (Test-Path $portFile) {
|
|
19
|
+
$port = Get-Content $portFile -ErrorAction SilentlyContinue
|
|
20
|
+
if (-not $port) { $port = 17321 }
|
|
21
|
+
}
|
|
22
|
+
$url = "http://localhost:$port/event"
|
|
23
|
+
try {
|
|
24
|
+
Invoke-WebRequest -Uri $url -Method POST -ContentType "application/json" -Body $inputJson -UseBasicParsing -TimeoutSec 5 | Out-Null
|
|
25
|
+
} catch {}
|
|
26
26
|
`;
|
|
27
27
|
export function writeBridgeScripts() {
|
|
28
28
|
const hooksDir = path.join(homedir(), ".petdex-cc", "hooks");
|