@fengye404/termpilot 0.1.5 → 0.1.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 +101 -34
- package/dist/cli.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,7 +10,83 @@ TermPilot 是一个终端优先的远程控制工具。电脑上跑 `tmux` 会
|
|
|
10
10
|
- 手机端不安装,直接打开 relay 域名
|
|
11
11
|
- relay 同时负责消息中继和网页托管
|
|
12
12
|
|
|
13
|
-
##
|
|
13
|
+
## 5 分钟快速上手
|
|
14
|
+
|
|
15
|
+
### 1. 启动 relay
|
|
16
|
+
|
|
17
|
+
在云服务器或一台能被手机访问到的机器上执行:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install -g @fengye404/termpilot
|
|
21
|
+
termpilot relay
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
如果你只是先本地体验,也可以直接在自己电脑上跑 relay,然后让手机走局域网访问。
|
|
25
|
+
|
|
26
|
+
### 2. 启动电脑 agent
|
|
27
|
+
|
|
28
|
+
在你的电脑上执行:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npm install -g @fengye404/termpilot
|
|
32
|
+
termpilot agent --relay ws://your-domain.com:8787/ws
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
这条命令会直接:
|
|
36
|
+
|
|
37
|
+
- 后台启动 agent
|
|
38
|
+
- 复用已有本地 agent(如果已经在跑)
|
|
39
|
+
- 输出一次性配对码
|
|
40
|
+
|
|
41
|
+
常用管理命令:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
termpilot agent status
|
|
45
|
+
termpilot agent stop
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### 3. 手机完成配对
|
|
49
|
+
|
|
50
|
+
手机浏览器直接打开 relay 域名:
|
|
51
|
+
|
|
52
|
+
- `http://your-domain.com:8787`
|
|
53
|
+
- 或反代后的 `https://your-domain.com`
|
|
54
|
+
|
|
55
|
+
然后:
|
|
56
|
+
|
|
57
|
+
1. 输入电脑端刚打印出来的配对码
|
|
58
|
+
2. 点“配对”
|
|
59
|
+
3. 成功后直接进入会话列表
|
|
60
|
+
|
|
61
|
+
### 4. 直接跑一个可同步的任务
|
|
62
|
+
|
|
63
|
+
日常最短路径是:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
termpilot claude code
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
或者:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
termpilot open code
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
这会直接:
|
|
76
|
+
|
|
77
|
+
- 创建一个受 TermPilot 管理的 `tmux` 会话
|
|
78
|
+
- 把命令写进这个会话
|
|
79
|
+
- 当前终端自动 attach 进去
|
|
80
|
+
- 手机端同步看到同一个会话
|
|
81
|
+
|
|
82
|
+
### 5. 你现在应该能做到什么
|
|
83
|
+
|
|
84
|
+
此时你可以:
|
|
85
|
+
|
|
86
|
+
- 在电脑上看 `claude code` / `open code` 的流式输出
|
|
87
|
+
- 在手机上看同一份输出
|
|
88
|
+
- 在手机上补一条命令、发快捷键、关闭会话
|
|
89
|
+
- 随时在电脑和手机之间切换
|
|
14
90
|
|
|
15
91
|
### 服务器
|
|
16
92
|
|
|
@@ -33,7 +109,7 @@ termpilot relay
|
|
|
33
109
|
常用参数:
|
|
34
110
|
|
|
35
111
|
```bash
|
|
36
|
-
termpilot relay
|
|
112
|
+
termpilot relay
|
|
37
113
|
DATABASE_URL=postgresql://user:pass@127.0.0.1:5432/termpilot termpilot relay
|
|
38
114
|
```
|
|
39
115
|
|
|
@@ -44,12 +120,6 @@ npm install -g @fengye404/termpilot
|
|
|
44
120
|
termpilot agent --relay ws://your-domain.com/ws
|
|
45
121
|
```
|
|
46
122
|
|
|
47
|
-
这条命令现在会:
|
|
48
|
-
|
|
49
|
-
- 在后台启动 agent
|
|
50
|
-
- 判断这台电脑是否已经有本地 agent 在运行
|
|
51
|
-
- 直接输出一次性配对码
|
|
52
|
-
|
|
53
123
|
如果你只是想看调试日志,可以显式前台运行:
|
|
54
124
|
|
|
55
125
|
```bash
|
|
@@ -89,29 +159,23 @@ termpilot agent --relay ws://127.0.0.1:8787/ws
|
|
|
89
159
|
- 点进一个会话后才进入终端详情页
|
|
90
160
|
- 连接信息和设备设置都在页面底部折叠区
|
|
91
161
|
|
|
92
|
-
##
|
|
93
|
-
|
|
94
|
-
电脑上直接启动后台 agent:
|
|
95
|
-
|
|
96
|
-
```bash
|
|
97
|
-
termpilot agent --relay ws://your-domain.com/ws
|
|
98
|
-
```
|
|
162
|
+
## 日常使用
|
|
99
163
|
|
|
100
|
-
|
|
164
|
+
### 直接把命令交给 TermPilot
|
|
101
165
|
|
|
102
166
|
```bash
|
|
103
167
|
termpilot claude code
|
|
168
|
+
termpilot open code
|
|
104
169
|
```
|
|
105
170
|
|
|
106
|
-
|
|
171
|
+
如果你想跑别的命令,也可以直接:
|
|
107
172
|
|
|
108
173
|
```bash
|
|
109
|
-
termpilot
|
|
174
|
+
termpilot npm run dev
|
|
175
|
+
termpilot python worker.py
|
|
110
176
|
```
|
|
111
177
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
## 日常使用
|
|
178
|
+
### 手动管理会话
|
|
115
179
|
|
|
116
180
|
创建会话并进入:
|
|
117
181
|
|
|
@@ -121,13 +185,7 @@ termpilot list
|
|
|
121
185
|
termpilot attach --sid <sid>
|
|
122
186
|
```
|
|
123
187
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
```bash
|
|
127
|
-
termpilot claude code
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
在会话里运行:
|
|
188
|
+
进入会话以后,你仍然可以自己手动运行:
|
|
131
189
|
|
|
132
190
|
```bash
|
|
133
191
|
claude code
|
|
@@ -158,12 +216,21 @@ termpilot doctor
|
|
|
158
216
|
## 最佳实践
|
|
159
217
|
|
|
160
218
|
1. 需要跨端同步的任务,一开始就用 `termpilot create` 创建,不要先在普通终端里跑再想着接管。
|
|
161
|
-
2.
|
|
162
|
-
3.
|
|
163
|
-
4.
|
|
164
|
-
5.
|
|
165
|
-
6.
|
|
166
|
-
7.
|
|
219
|
+
2. 如果只是想“开一个会话然后立刻跑起来”,优先用 `termpilot claude code` 这类直达命令,不必手动 `create + attach`。
|
|
220
|
+
3. 一个长期任务用一个独立会话,名称直接写任务语义,比如 `claude-main`、`deploy-watch`、`batch-fix`。
|
|
221
|
+
4. 电脑前重操作优先 `termpilot attach`;手机更适合看进度、发短命令、补快捷键和关闭会话。
|
|
222
|
+
5. 普通 iTerm / Terminal 标签页不是 TermPilot 管理对象,不要指望后面“无缝接管”进来。
|
|
223
|
+
6. 手机优先走一次性配对码,不要长期传播访问令牌。
|
|
224
|
+
7. 要长期使用 relay,优先放到 HTTPS/WSS 域名后面,并接 PostgreSQL;本地演示可以先用内存模式。
|
|
225
|
+
8. 换手机或访问权变更时,先 `termpilot grants`,再 `termpilot revoke --token ...`。
|
|
226
|
+
9. 想排查控制历史时先看 `termpilot audit --limit 30`。
|
|
227
|
+
|
|
228
|
+
## 常见坑
|
|
229
|
+
|
|
230
|
+
- `termpilot agent --relay ...` 不会停在前台,这是正常的;它默认就是后台守护进程。
|
|
231
|
+
- 手机上看不到任务时,先确认这个任务是不是通过 `termpilot ...` 或 `termpilot create` 启动的。
|
|
232
|
+
- 首次配对优先用 `termpilot agent --relay ...` 拿配对码;`termpilot pair` 只是补充命令。
|
|
233
|
+
- 外网正式使用时,不要长期直接裸奔 `ws://IP:8787/ws`,最好上域名和反代。
|
|
167
234
|
|
|
168
235
|
## 本地开发
|
|
169
236
|
|
package/dist/cli.js
CHANGED
|
@@ -2099,7 +2099,7 @@ var RELAY_ENV_FLAGS = [
|
|
|
2099
2099
|
function printHelp2() {
|
|
2100
2100
|
console.log(`TermPilot \u7528\u6CD5\uFF1A
|
|
2101
2101
|
|
|
2102
|
-
termpilot relay
|
|
2102
|
+
termpilot relay
|
|
2103
2103
|
termpilot agent [--relay ws://127.0.0.1:8787/ws] [--device-id pc-main]
|
|
2104
2104
|
termpilot agent status
|
|
2105
2105
|
termpilot agent stop
|