@tina_summer/codepocket 2.5.3 → 2.5.6
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 +1 -31
- package/bin/codepocket.js +20 -5
- package/package.json +7 -1
- package/vendor/cpkt-hub +1 -0
- package/vendor/cpkt-hub-linux +1 -0
- package/vendor/cpkt-hub.exe +1 -0
package/README.md
CHANGED
|
@@ -6,7 +6,6 @@ CodePocket 的本地连接器,让你的手机通过微信小程序远程控制
|
|
|
6
6
|
|
|
7
7
|
- 电脑已安装 [Claude Code CLI](https://claude.ai)(终端运行 `claude` 验证)
|
|
8
8
|
- Node.js 18+
|
|
9
|
-
- **Hub 二进制** (`cpkt-hub`) — 见下方 [安装 Hub](#安装-hub)
|
|
10
9
|
|
|
11
10
|
## 安装
|
|
12
11
|
|
|
@@ -14,36 +13,7 @@ CodePocket 的本地连接器,让你的手机通过微信小程序远程控制
|
|
|
14
13
|
npm i -g @tina_summer/codepocket
|
|
15
14
|
```
|
|
16
15
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
Connector 启动时需要 `cpkt-hub` 二进制(Claude Code 进程管理器)。**npm 包不含此二进制**,需要单独下载。
|
|
20
|
-
|
|
21
|
-
### 自动安装 (推荐)
|
|
22
|
-
|
|
23
|
-
```bash
|
|
24
|
-
codepocket install-hub
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
自动检测平台、从 GitHub Releases 下载对应版本、放到 `~/.codepocket/bin/`。
|
|
28
|
-
|
|
29
|
-
### 手动安装
|
|
30
|
-
|
|
31
|
-
1. 前往 [Releases](https://github.com/TinaSummer/CodePocket/releases/latest) 下载对应平台:
|
|
32
|
-
- macOS: `cpkt-hub-darwin-arm64` 或 `cpkt-hub-darwin-x64`
|
|
33
|
-
- Linux: `cpkt-hub-linux-x64`
|
|
34
|
-
- Windows: `cpkt-hub-win32-x64.exe`
|
|
35
|
-
2. 重命名为 `cpkt-hub` (macOS/Linux) 或 `cpkt-hub.exe` (Windows)
|
|
36
|
-
3. 放到以下任一位置:
|
|
37
|
-
- `~/.codepocket/bin/cpkt-hub`
|
|
38
|
-
- `/usr/local/bin/cpkt-hub` (需 sudo)
|
|
39
|
-
- 任何 PATH 中的目录
|
|
40
|
-
|
|
41
|
-
```bash
|
|
42
|
-
# 示例: macOS arm64
|
|
43
|
-
curl -L -o ~/.codepocket/bin/cpkt-hub \
|
|
44
|
-
https://github.com/TinaSummer/CodePocket/releases/latest/download/cpkt-hub-darwin-arm64
|
|
45
|
-
chmod +x ~/.codepocket/bin/cpkt-hub
|
|
46
|
-
```
|
|
16
|
+
npm 包已内置 Hub 二进制(macOS / Linux / Windows),无需额外下载。如需手动更新 Hub,可运行 `codepocket install-hub`。
|
|
47
17
|
|
|
48
18
|
## 使用
|
|
49
19
|
|
package/bin/codepocket.js
CHANGED
|
@@ -126,11 +126,18 @@ function findClaudeSessionFile(directory) {
|
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
function findHubBin() {
|
|
129
|
-
// 1. Platform-specific npm package
|
|
129
|
+
// 1. Platform-specific npm package via optionalDependencies
|
|
130
|
+
// npm hoists optionalDeps to top-level node_modules alongside the main package,
|
|
131
|
+
// so the sibling path covers both global and local installs.
|
|
130
132
|
const platformTag = `${process.platform}-${process.arch}`
|
|
131
133
|
const platformBinName = process.platform === 'win32' ? 'codepocket.exe' : 'codepocket'
|
|
132
|
-
const
|
|
133
|
-
|
|
134
|
+
const platformCandidates = [
|
|
135
|
+
path.join(__dirname, '..', '..', `codepocket-${platformTag}`, 'bin', platformBinName),
|
|
136
|
+
path.join(__dirname, '..', 'node_modules', '@tina_summer', `codepocket-${platformTag}`, 'bin', platformBinName),
|
|
137
|
+
]
|
|
138
|
+
for (const p of platformCandidates) {
|
|
139
|
+
if (fs.existsSync(p)) return p
|
|
140
|
+
}
|
|
134
141
|
|
|
135
142
|
// 2. Bundled vendor binary (dev mode)
|
|
136
143
|
const vendorBinName = process.platform === 'win32' ? 'cpkt-hub.exe'
|
|
@@ -155,8 +162,10 @@ function findHubBin() {
|
|
|
155
162
|
async function installHub() {
|
|
156
163
|
const platformKey = `${process.platform}-${process.arch}`
|
|
157
164
|
const assetName = process.platform === 'win32'
|
|
158
|
-
?
|
|
159
|
-
:
|
|
165
|
+
? 'cpkt-hub.exe'
|
|
166
|
+
: process.platform === 'linux'
|
|
167
|
+
? 'cpkt-hub-linux'
|
|
168
|
+
: 'cpkt-hub'
|
|
160
169
|
const url = `https://github.com/TinaSummer/CodePocket/releases/latest/download/${assetName}`
|
|
161
170
|
|
|
162
171
|
const binDir = path.join(CONFIG_DIR, 'bin')
|
|
@@ -164,6 +173,12 @@ async function installHub() {
|
|
|
164
173
|
const destName = process.platform === 'win32' ? 'cpkt-hub.exe' : 'cpkt-hub'
|
|
165
174
|
const destPath = path.join(binDir, destName)
|
|
166
175
|
|
|
176
|
+
// Skip download if already installed (idempotent for re-runs)
|
|
177
|
+
if (fs.existsSync(destPath)) {
|
|
178
|
+
console.log(`[codepocket] ✓ Hub 已安装: ${destPath}`)
|
|
179
|
+
return
|
|
180
|
+
}
|
|
181
|
+
|
|
167
182
|
console.log(`[codepocket] 正在下载 Hub 二进制 (${platformKey})...`)
|
|
168
183
|
console.log(`[codepocket] URL: ${url}`)
|
|
169
184
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tina_summer/codepocket",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.6",
|
|
4
4
|
"description": "CodePocket — 基于ClaudeCode的微信小程序工作台",
|
|
5
5
|
"bin": {
|
|
6
6
|
"codepocket": "bin/codepocket.js",
|
|
@@ -19,6 +19,12 @@
|
|
|
19
19
|
"qrcode-terminal": "^0.12.0",
|
|
20
20
|
"ws": "^8.18.0"
|
|
21
21
|
},
|
|
22
|
+
"optionalDependencies": {
|
|
23
|
+
"@tina_summer/codepocket-darwin-arm64": "2.5.6",
|
|
24
|
+
"@tina_summer/codepocket-darwin-x64": "2.5.6",
|
|
25
|
+
"@tina_summer/codepocket-linux-x64": "2.5.6",
|
|
26
|
+
"@tina_summer/codepocket-win32-x64": "2.5.6"
|
|
27
|
+
},
|
|
22
28
|
"engines": {
|
|
23
29
|
"node": ">=18"
|
|
24
30
|
},
|
package/vendor/cpkt-hub
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Not Found
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Not Found
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Not Found
|