auvezy-terminal-remote 0.4.4 → 0.5.0

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
@@ -1,107 +1,121 @@
1
+ <div align="center">
2
+
3
+ <img src="./frontend/public/icons/atr-icon.svg" alt="auvezy-terminal-remote logo" width="96" height="96">
4
+
1
5
  # auvezy-terminal-remote
2
6
 
3
- > 局域网内通过手机 / 平板浏览器远程控制 PC 上的任意终端程序(zsh / bash / claude / 任何 CLI)。
4
- >
5
- > 一行命令 `atr <program>`,多终端多实例自动出现在浏览器顶栏 tab 切换。
7
+ [![npm](https://img.shields.io/npm/v/auvezy-terminal-remote?style=flat-square&color=b6f09c&labelColor=0a0c0f)](https://www.npmjs.com/package/auvezy-terminal-remote)
8
+ [![license](https://img.shields.io/badge/license-PolyForm--NC--1.0.0-b6f09c?style=flat-square&labelColor=0a0c0f)](./LICENSE)
9
+ [![node](https://img.shields.io/node/v/auvezy-terminal-remote?style=flat-square&color=b6f09c&labelColor=0a0c0f)](https://nodejs.org)
10
+ [![stars](https://img.shields.io/github/stars/jjj201200/auvezy-terminal-remote?style=flat-square&color=b6f09c&labelColor=0a0c0f)](https://github.com/jjj201200/auvezy-terminal-remote)
6
11
 
7
- ## 这是什么
12
+ **English** · [简体中文](./README.zh-CN.md)
8
13
 
9
- 你坐在沙发上拿着手机,PC 上某个 CLI(Claude Code / 部署脚本 / 调试会话…)正在跑一个长任务。你希望:
14
+ Remote-control any terminal program on your PC from a phone or tablet
15
+ browser over LAN. One command — `atr [program]` — and every instance
16
+ shows up as a tab in your browser's top bar.
10
17
 
11
- - 实时看到终端输出(包括 ANSI 颜色)
12
- - 输入下一条指令、按方向键
13
- - Claude 触发审批 hook 时,手机锁屏弹通知
14
- - 不开公网、不依赖云
18
+ <img src="./frontend/public/screenshots/desktop.png" alt="Webapp running Claude Code in a browser tab" width="720">
15
19
 
16
- 这正是这个项目要做的。把 PTY 输出经 WebSocket 桥到 webapp,
17
- 把 webapp 输入桥回 PTY。仅绑 LAN IP,用 token + 本地 cookie 鉴权。
20
+ </div>
18
21
 
19
- ## 安装
22
+ ## ✨ Features
20
23
 
21
- ```bash
22
- npm install -g auvezy-terminal-remote
23
- ```
24
+ - **PTY bridge** — node-pty + xterm.js 5, full ANSI, alt-screen TUI safe
25
+ - **Claude Code / TUI tuned** — Ink/Yoga reflow fix on resize, alt-screen blocklist, "adapt to current device" PTY sizing
26
+ - **Multi-instance** — every `atr` grabs the next free port; one tab bar shows them all
27
+ - **Multi-client** — many browsers / `attach` clients on one instance, with master arbitration
28
+ - **Mobile-first PWA** — IME guard, long-press, swipe scroll, viewport-aware fit, install to home screen
29
+ - **Custom shortcuts & commands** — define on-screen keys and saved command snippets in the settings panel
30
+ - **Reconnect with replay** — scrollback rehydrated on every reconnect, alt-screen TUIs protected
31
+ - **LAN-only by design** — token + port-bound cookie, `timingSafeEqual`, loopback-only `/api/hook`
32
+ - **WSL aware** — mirrored / NAT auto-detected, PowerShell port-forward script generated
24
33
 
25
- ## 使用
34
+ Full inventory in [`docs/FEATURES.md`](./docs/FEATURES.md).
35
+
36
+ ## 📦 Install
26
37
 
27
38
  ```bash
28
- atr # 跑当前 $SHELL(zsh / bash 自动检测)
29
- atr claude # 跑 claude
30
- atr zsh # 跑 zsh
31
- atr claude --resume foo # 透传任意参数给子进程
39
+ npm install -g auvezy-terminal-remote # -g is required (it's a CLI)
32
40
  ```
33
41
 
34
- 启动后扫终端打印的二维码 webapp 自动登录(token `~/.auvezy/terminal-remote/config.json`)。
42
+ > ⚠️ The default `npm i` command shown on the npm package page is **missing
43
+ > `-g`** — without it the `atr` binary won't be on your PATH.
35
44
 
36
- **多实例**:在不同终端多次 `atr <prog>`,每次会自动占一个新端口(3000、3001、3002…),
37
- 浏览器顶栏会自动出现新 tab,点击即可切换。
45
+ ## 🚀 Quick start
38
46
 
39
47
  ```bash
40
- atr list # 列出本机所有实例
41
- atr stop # 停止本机所有实例
42
- atr attach <url> # 命令行接管已有实例
48
+ atr # runs your $SHELL (zsh / bash auto-detected)
49
+ atr claude # runs claude
50
+ atr claude --resume foo # extra args passed through to claude
43
51
  ```
44
52
 
45
- ## 启动选项
53
+ After it starts, scan the QR code printed in the terminal — the webapp
54
+ logs in automatically (token lives in `~/.auvezy/terminal-remote/config.json`).
55
+
56
+ Run `atr` in different terminals to spawn more instances; the browser tab
57
+ bar updates live.
58
+
59
+ ## 🔧 Usage
46
60
 
47
61
  ```
48
- atr [子命令] [选项]
49
-
50
- 子命令:
51
- start 启动 backend(默认)
52
- attach attach 到运行中的实例(命令行接管)
53
- list 列出本机所有运行中实例
54
- stop 停止本机所有实例
55
-
56
- 选项:
57
- -p, --port <n> 端口(默认 3000,多实例自动递增;除非 -S)
58
- -S, --strict-port 严格端口模式:被占即报错退出,不自适应
59
- --spawn-timeout <s> PTY spawn 兜底秒数(默认 30;0=不超时;
60
- 首个浏览器连入 / 按 Enter / 超时三选一触发)
61
- --wait-confirm 强制必须按 Enter 才 spawn(覆盖浏览器/超时触发)
62
- --name <s> 实例名(用于 webapp 显示)
63
- --no-terminal 不打印二维码(CI / 守护进程友好)
64
- --command <cmd> PTY 启动命令(默认当前 $SHELL)
65
- --args <json> 命令参数(JSON 数组字符串)
66
- -h, --help 显示帮助
67
- -v, --version 显示版本号
62
+ atr [atr-flags...] [program] [program-args...]
63
+ atr <subcommand> [args]
68
64
  ```
69
65
 
70
- 环境变量:
66
+ Most-used flags:
71
67
 
72
- | 变量 | 用途 |
68
+ | Flag | Purpose |
73
69
  |---|---|
74
- | `OCR_COMMAND` | 子进程命令(默认 `$SHELL`,没有则 `/bin/sh`;显式设为 `claude` 跑 Claude)|
75
- | `OCR_ARGS` | 命令参数(JSON 数组字符串,如 `'["-c","tail -f /dev/null"]'`)|
76
- | `OCR_CWD` | 子进程工作目录(默认 `process.cwd()`)|
77
- | `OCR_ANSI_FILTER` | 是否过滤 alt-screen 输出(默认 `false`)。设 `true` 让 vim/htop 退出后重连回放更干净;但全程 alt-screen TUI(claude/tmux/...)仍受内置黑名单保护 |
78
- | `OCR_ANSI_FILTER_TUI_NAMES` | 追加自家 alt-screen TUI 黑名单(逗号分隔),例如 `"lazygit,k9s,gh-dash"` |
79
- | `VAPID_PUBLIC_KEY` / `VAPID_PRIVATE_KEY` | 注入 VAPID(高优先级,跳过文件)|
80
- | `PORT` | `--port` |
81
- | `STRICT_PORT` | 同 `--strict-port`(设 `true` 启用严格模式)|
82
- | `OCR_SPAWN_TIMEOUT` | 同 `--spawn-timeout`(秒;0 = 无超时)|
83
- | `AUTH_TOKEN` | 指定 token(默认自动生成)|
84
- | `LOG_LEVEL` | pino 级别(默认 info)|
70
+ | `-p, --port <n>` | Port (default 3000, auto-increments) |
71
+ | `--name <s>` | Instance name (shown in webapp) |
72
+ | `--no-terminal` | Don't print QR (CI / daemon-friendly) |
73
+ | `--workdir <path>` | Child process cwd |
74
+ | `--token <s>` | Use a fixed token instead of auto-generated |
75
+
76
+ Subcommands: `atr list` · `atr stop [pattern]` · `atr attach <url>`.
85
77
 
86
- ## 配置
78
+ Full reference (all flags, env vars, config file): [`docs/CLI.md`](./docs/CLI.md).
79
+ Run `atr -h` for the inline help.
87
80
 
88
- 启动时自动读 `~/.auvezy/terminal-remote/config.json`(首次启动自动生成)。
89
- VAPID 在 `~/.auvezy/terminal-remote/vapid.json`,多实例注册表在
90
- `~/.auvezy/terminal-remote/instances/<port>.json`。
81
+ ## 📱 Install as a PWA
91
82
 
92
- ## WSL 中跑、Windows 浏览器访问
83
+ The webapp ships with a manifest. "Add to Home Screen" gives a near-native
84
+ app: no browser chrome, status bar tinted to match.
93
85
 
94
- WSL2 的两种网络模式行为不同:
86
+ - **iOS Safari** — share button → "Add to Home Screen"
87
+ - **Android Chrome** — top-right ⋮ → "Install app"
95
88
 
96
- - **mirrored 模式**(Win11 22H2+ 默认):WSL 直接拿 Windows LAN IP(如 `192.168.x.x`),
97
- Windows 浏览器可以直接用 banner 上的 IP 访问,无需任何额外配置
98
- - **NAT 模式**(默认):WSL 在 `172.x.x.x` 私网,Windows 浏览器无法直连。
99
- backend 启动时会自动检测并在 banner 末尾打印 PowerShell 配置命令
89
+ ## 🌐 WSL Windows browser
100
90
 
101
- ## 系统要求
91
+ WSL2 backend works out of the box on **mirrored mode**. On **NAT mode**
92
+ the banner prints a one-shot PowerShell snippet to make the port reachable
93
+ from Windows. Details: [`docs/WSL.md`](./docs/WSL.md).
94
+
95
+ ## 🛣️ Roadmap
96
+
97
+ Planned, evaluating, and explicitly out-of-scope items live in
98
+ [`docs/ROADMAP.md`](./docs/ROADMAP.md). The README only lists what already ships.
99
+
100
+ ## 🏛️ Architecture
101
+
102
+ - Module diagram & data flow: [`docs/ARCHITECTURE.md`](./docs/ARCHITECTURE.md)
103
+ - Design doc & ADRs: [`docs/plans/open-claude-remote-clone/`](./docs/plans/open-claude-remote-clone/)
104
+
105
+ ## 🛠️ Development
106
+
107
+ ```bash
108
+ git clone https://github.com/jjj201200/auvezy-terminal-remote.git
109
+ cd auvezy-terminal-remote
110
+ bash install.sh # checks Node 20+ / pnpm 9+ / build deps → installs → builds
111
+ pnpm dev # backend (tsx watch) + frontend (vite) in parallel
112
+ pnpm test # shared + backend + frontend unit tests
113
+ ```
102
114
 
103
- - Node.js 20
115
+ Gitee mirror (faster from mainland China):
116
+ `git clone https://gitee.com/drowsyflesh/auvezy-terminal-remote.git`
104
117
 
105
- ## 许可
118
+ ## License
106
119
 
107
- 专有软件,保留所有权利。详见 LICENSE
120
+ [PolyForm Noncommercial 1.0.0](./LICENSE) — free for personal, educational,
121
+ and nonprofit use. Commercial use requires a separate license.