difftab 0.1.1 → 0.1.3
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 +25 -9
- package/README.zh-CN.md +18 -10
- package/bin/difftab.js +2 -2
- package/dist/server/main.js +101 -102
- package/dist/web/app.css +1 -1
- package/dist/web/app.js +15 -15
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
# difftab
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/difftab)
|
|
4
|
+
[](https://nodejs.org)
|
|
5
|
+
[](#never-writes-to-your-repository)
|
|
6
|
+
[](LICENSE)
|
|
4
7
|
|
|
5
8
|
**See what your AI coding agent changed — in one tab.**
|
|
6
9
|
|
|
@@ -10,20 +13,16 @@ while the agent keeps writing. Close the tab and the process exits.
|
|
|
10
13
|
|
|
11
14
|
[中文文档](README.zh-CN.md)
|
|
12
15
|
|
|
13
|
-
##
|
|
16
|
+
## Quick start
|
|
14
17
|
|
|
15
18
|
```bash
|
|
16
|
-
|
|
19
|
+
cd /path/to/your/repo
|
|
20
|
+
npx difftab
|
|
17
21
|
```
|
|
18
22
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
## Usage
|
|
23
|
+
Or install it once — `npm i -g difftab` — and just run `difftab`.
|
|
22
24
|
|
|
23
|
-
|
|
24
|
-
cd /path/to/your/repo
|
|
25
|
-
difftab
|
|
26
|
-
```
|
|
25
|
+
Requires **Node.js 22 or newer** on macOS, Windows or Linux. Zero dependencies.
|
|
27
26
|
|
|
28
27
|
- `--no-open` — print the URL instead of opening a browser
|
|
29
28
|
- `-v`, `--version` — print the version and exit
|
|
@@ -43,9 +42,13 @@ Running it again in the same repository reuses the running instance.
|
|
|
43
42
|
- **Auto-refresh** — a file watcher pushes changes over SSE, falling back to polling where
|
|
44
43
|
recursive watching would exhaust the inotify quota (and saying so in the UI).
|
|
45
44
|
- **Exits on its own** — 45 seconds after the last tab closes.
|
|
45
|
+
- **Cheap to run** — about 30 ms from launch to a listening server, well inside the 300 ms
|
|
46
|
+
budget CI enforces on every commit across nine Node × OS combinations; the JS bundle is
|
|
47
|
+
68 KB gzipped.
|
|
46
48
|
|
|
47
49
|
Empty repositories, interrupted rebases, linked worktrees, submodules, binary and >5 MB
|
|
48
50
|
files, renames, and paths with spaces, quotes, CJK or emoji are handled explicitly.
|
|
51
|
+
|
|
49
52
|
difftab is deliberately a viewer: no editing, history, blame or review workflow
|
|
50
53
|
([out-of-scope list](CONTRIBUTING.md#the-read-only-promise-is-not-negotiable)).
|
|
51
54
|
|
|
@@ -56,6 +59,19 @@ discard, pull, push, branch or stash. Two gates enforce it on every change: a `G
|
|
|
56
59
|
allowlist over every git invocation, and a byte-for-byte comparison of `.git` before and
|
|
57
60
|
after. And `dist/server/main.js` ships unminified, so you can audit it by hand.
|
|
58
61
|
|
|
62
|
+
## Nothing leaves your machine
|
|
63
|
+
|
|
64
|
+
The server binds `127.0.0.1` on a port the kernel picks, and the only HTTP request difftab
|
|
65
|
+
makes is to localhost, to see whether an instance is already running for this repository.
|
|
66
|
+
No telemetry, no account, no cloud.
|
|
67
|
+
|
|
68
|
+
Each session gets a random token, handed to the browser once through the URL and then kept
|
|
69
|
+
in an `HttpOnly; SameSite=Strict` cookie while the URL is redirected clean. Every request
|
|
70
|
+
is checked against the `Host` header — the actual defense against DNS rebinding, rather
|
|
71
|
+
than the token alone — and against `Origin`, and the page runs under a `default-src 'none'`
|
|
72
|
+
CSP that also blocks framing, `<base>` rewriting and form submission. There is no
|
|
73
|
+
development escape hatch: no environment variable relaxes any of those checks.
|
|
74
|
+
|
|
59
75
|
## Development
|
|
60
76
|
|
|
61
77
|
```bash
|
package/README.zh-CN.md
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
# difftab
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/difftab)
|
|
4
|
+
[](https://nodejs.org)
|
|
5
|
+
[](#全程零写操作)
|
|
6
|
+
[](LICENSE)
|
|
4
7
|
|
|
5
8
|
**一个标签页,看懂 AI 编码 Agent 改了哪些代码。**
|
|
6
9
|
|
|
@@ -8,20 +11,16 @@
|
|
|
8
11
|
|
|
9
12
|
[English](README.md)
|
|
10
13
|
|
|
11
|
-
##
|
|
14
|
+
## 快速开始
|
|
12
15
|
|
|
13
16
|
```bash
|
|
14
|
-
|
|
17
|
+
cd /path/to/your/repo
|
|
18
|
+
npx difftab
|
|
15
19
|
```
|
|
16
20
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
## 使用
|
|
21
|
+
也可以装一次——`npm i -g difftab`——之后直接敲 `difftab`。
|
|
20
22
|
|
|
21
|
-
|
|
22
|
-
cd /path/to/your/repo
|
|
23
|
-
difftab
|
|
24
|
-
```
|
|
23
|
+
要求 **Node.js 22 或更高**,macOS / Windows / Linux 三端均支持,零依赖。
|
|
25
24
|
|
|
26
25
|
- `--no-open`——只打印 URL,不拉起浏览器
|
|
27
26
|
- `-v`, `--version`——打印版本号并退出
|
|
@@ -37,13 +36,22 @@ difftab
|
|
|
37
36
|
merge / cherry-pick / revert / bisect / `git am`。
|
|
38
37
|
- **自动刷新**——文件监听经 SSE 推到前端;递归监听会耗尽 inotify 配额的场合改用轮询,并在界面上标注。
|
|
39
38
|
- **自己退出**——最后一个标签页关掉 45 秒后自动退。
|
|
39
|
+
- **跑起来很轻**——从启动到端口就绪约 30ms,远在 CI 每次提交都验的 300ms 预算之内(九个 Node × 平台组合各跑一遍);打包后的 JS gzip 68KB。
|
|
40
|
+
|
|
41
|
+
空仓库、停在中途的 rebase、linked worktree、submodule、二进制与超过 5MB 的文件、重命名,以及带空格、引号、中日韩文字或 emoji 的路径,都是被显式处理的。
|
|
40
42
|
|
|
41
|
-
|
|
43
|
+
difftab 刻意只是个查看器:不编辑、不看历史、不做 blame、不承载评审流程(完整的不做清单见 [CONTRIBUTING.md](CONTRIBUTING.md#the-read-only-promise-is-not-negotiable))。
|
|
42
44
|
|
|
43
45
|
## 全程零写操作
|
|
44
46
|
|
|
45
47
|
不是「尽量」:difftab 只发只读的 git 命令——不 stage、不 commit、不 discard、不 pull / push、不建分支、不 stash。两道门禁在每次改动上守着:一道是覆盖每一次 git 调用的 `GIT_TRACE` 命令白名单,另一道是 `.git` 前后逐字节比对。后端也支持手工审计:`dist/server/main.js` 不压缩不混淆发布。
|
|
46
48
|
|
|
49
|
+
## 全程不外传
|
|
50
|
+
|
|
51
|
+
服务只绑 `127.0.0.1`,端口由内核随机分配,而 difftab 发出的唯一一个 HTTP 请求是打到 localhost 上的,用来确认这个仓库是不是已经有实例在跑。无遥测、无账号、无云端。
|
|
52
|
+
|
|
53
|
+
每次会话生成一个随机 token,先经 URL 交给浏览器,随后落进 `HttpOnly; SameSite=Strict` 的 cookie,并把 URL 上的 query 重定向掉。每个请求都校验 `Host` 头与 `Origin`——`Host` 那道才是 DNS rebinding 的正面防御,光靠 token 挡不住;页面跑在 `default-src 'none'` 的 CSP 之下,被嵌 iframe、`<base>` 改写相对 URL 与表单外发也一并挡掉。后端没有任何开发用的后门:不存在放宽这几道校验的环境变量。
|
|
54
|
+
|
|
47
55
|
## 开发
|
|
48
56
|
|
|
49
57
|
```bash
|
package/bin/difftab.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// difftab CLI 入口 —— 版本守卫。
|
|
3
3
|
//
|
|
4
|
-
// 本文件手写维护,不参与 TypeScript
|
|
4
|
+
// 本文件手写维护,不参与 TypeScript 编译、不作为任何打包入口。
|
|
5
5
|
// 一旦它进了构建管线,就可能被注入超出 Node 22 的语法或被合并进主模块,
|
|
6
6
|
// 低于下限的用户拿到的将是解析期 SyntaxError —— 守卫在解析期即失效。
|
|
7
7
|
//
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
import { writeSync } from 'node:fs';
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
|
-
* 退出前的报错**一律 `writeSync(2, …)`**(
|
|
20
|
+
* 退出前的报错**一律 `writeSync(2, …)`**(红线)。
|
|
21
21
|
*
|
|
22
22
|
* `process.stderr.write(…)` + `process.exit()` 在 Windows 上写**管道**时是异步的,
|
|
23
23
|
* 整条消息会被丢掉 —— 症状是 stderr 全空、只剩一个退出码。而**文件重定向看不出
|