@motivation-labs/crosscheck 0.3.1-beta.4d8f1c5.0 → 0.3.1-beta.4fbfe4e.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.
Files changed (54) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +244 -51
  3. package/README.zh.md +294 -0
  4. package/assets/logo.png +0 -0
  5. package/crosscheck.config.example.yml +19 -0
  6. package/dist/__tests__/issue.test.d.ts +2 -0
  7. package/dist/__tests__/issue.test.d.ts.map +1 -0
  8. package/dist/__tests__/issue.test.js +244 -0
  9. package/dist/__tests__/issue.test.js.map +1 -0
  10. package/dist/__tests__/optimize.test.js +2 -0
  11. package/dist/__tests__/optimize.test.js.map +1 -1
  12. package/dist/cli.js +18 -0
  13. package/dist/cli.js.map +1 -1
  14. package/dist/commands/impact.d.ts +38 -0
  15. package/dist/commands/impact.d.ts.map +1 -0
  16. package/dist/commands/impact.js +210 -0
  17. package/dist/commands/impact.js.map +1 -0
  18. package/dist/commands/init.d.ts.map +1 -1
  19. package/dist/commands/init.js +4 -3
  20. package/dist/commands/init.js.map +1 -1
  21. package/dist/commands/issue.d.ts +23 -0
  22. package/dist/commands/issue.d.ts.map +1 -0
  23. package/dist/commands/issue.js +284 -0
  24. package/dist/commands/issue.js.map +1 -0
  25. package/dist/commands/review.d.ts.map +1 -1
  26. package/dist/commands/review.js +1 -3
  27. package/dist/commands/review.js.map +1 -1
  28. package/dist/commands/serve.d.ts.map +1 -1
  29. package/dist/commands/serve.js +0 -1
  30. package/dist/commands/serve.js.map +1 -1
  31. package/dist/commands/status.d.ts.map +1 -1
  32. package/dist/commands/status.js +11 -0
  33. package/dist/commands/status.js.map +1 -1
  34. package/dist/commands/watch.d.ts.map +1 -1
  35. package/dist/commands/watch.js +55 -2
  36. package/dist/commands/watch.js.map +1 -1
  37. package/dist/config/schema.d.ts +66 -0
  38. package/dist/config/schema.d.ts.map +1 -1
  39. package/dist/config/schema.js +14 -0
  40. package/dist/config/schema.js.map +1 -1
  41. package/dist/github/webhook.d.ts +6 -2
  42. package/dist/github/webhook.d.ts.map +1 -1
  43. package/dist/lib/log-analysis.d.ts +17 -0
  44. package/dist/lib/log-analysis.d.ts.map +1 -0
  45. package/dist/lib/log-analysis.js +72 -0
  46. package/dist/lib/log-analysis.js.map +1 -0
  47. package/dist/lib/runner.js +1 -1
  48. package/dist/lib/runner.js.map +1 -1
  49. package/dist/reviewers/codex.d.ts.map +1 -1
  50. package/dist/reviewers/codex.js +11 -2
  51. package/dist/reviewers/codex.js.map +1 -1
  52. package/get-started.md +841 -0
  53. package/get-started.zh.md +839 -0
  54. package/package.json +6 -2
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2025 Motivation Labs
3
+ Copyright (c) 2025–2026 Motivation Labs LLC.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,103 +1,296 @@
1
+ <div align="right">
2
+ <h5><a href="./README.zh.md">🌏 &nbsp;中文</a></h5>
3
+ </div>
4
+
5
+ <p align="center">
6
+ <img src="./assets/logo.png" alt="crosscheck" width="160" />
7
+ </p>
8
+
9
+ <p align="center"><em>Building crosscheck with crosscheck.</em></p>
10
+
1
11
  # crosscheck
2
12
 
3
- Cross-vendor AI code review orchestrator. When Claude Code opens a PR, Codex reviews it. When Codex opens a PR, Claude reviews it. Runs locally using your existing subscriptions — no separate API billing required.
13
+ **A lightweight orchestration layer that makes your AI coding agents review each other's work then fix it.**
4
14
 
5
- ```bash
6
- npm install -g @motivation-labs/crosscheck # stable
7
- npm install -g @motivation-labs/crosscheck@beta # latest features
8
- crosscheck init
9
- crosscheck review https://github.com/owner/repo/pull/123 --reviewer codex
15
+ When Claude Code opens a PR, Codex reviews it. When Codex opens a PR, Claude reviews it. If issues are found on a Claude-authored PR, Claude commits fixes and pushes them back. All of this runs on your laptop, against your existing subscriptions, with a single command.
16
+
17
+ ```
18
+ GitHub PR → crosscheck watch → AI review posted → fixes committed
10
19
  ```
11
20
 
21
+ > Inspired by [Symphony](https://github.com/openai/symphony) — OpenAI's spec-driven multi-agent framework. Where Symphony coordinates agents at the product level, crosscheck stays at the level engineers already live in: pull requests, diffs, and code review. No new abstractions — just the CR + fix loop, automated.
22
+
12
23
  ---
13
24
 
14
- **[→ Full documentation: get-started.md](./get-started.md)**
25
+ ## Why
26
+
27
+ Coding agents ship fast. They also make confident, plausible mistakes. The fix isn't a human reviewer on every AI-authored PR — it's the *other* AI reviewing it. Claude and Codex have complementary blind spots; cross-vendor review catches more issues than either model alone, without adding human latency to every commit.
15
28
 
16
- Covers prerequisites, install, all commands and flags, full config reference, and how it works under the hood.
29
+ crosscheck wires that loop:
30
+
31
+ | | |
32
+ |---|---|
33
+ | **Local execution, always listening** | Runs on your machine. `crosscheck watch` opens a tunnel and keeps running. No cloud, no infra, no SaaS. |
34
+ | **Subscription-funded** | Uses `claude` and `codex` CLIs against your existing Claude Pro/Max and ChatGPT Plus/Pro plans. No per-token API billing. Reviews are free once you're subscribed. |
35
+ | **Cross-vendor by default** | Claude reviews Codex PRs; Codex reviews Claude PRs. Each model brings different training and different failure modes. The overlap is where bugs hide. |
36
+ | **Self-improving** | `crosscheck diagnose` surfaces failure patterns from logs. `crosscheck optimize` feeds them to your AI and updates reviewer instructions automatically. |
17
37
 
18
38
  ---
19
39
 
20
40
  ## Quick start
21
41
 
22
- **1. Install CLIs and authenticate**
23
-
24
42
  ```bash
25
- # crosscheck
43
+ # 1. Install crosscheck and the agent CLIs
26
44
  npm install -g @motivation-labs/crosscheck
45
+ npm install -g @anthropic-ai/claude-code && claude # Claude Pro/Max subscription
46
+ npm install -g @openai/codex && codex login --device-auth # ChatGPT Plus/Pro subscription
47
+ brew install gh && gh auth login # GitHub CLI
48
+
49
+ # 2. Check your environment
50
+ crosscheck init
51
+
52
+ # 3. Test against a single PR
53
+ crosscheck review https://github.com/your-org/repo/pull/42
54
+
55
+ # 4. Run continuously
56
+ crosscheck watch
57
+ ```
27
58
 
28
- # Claude Code uses your claude.ai Pro/Max subscription
29
- npm install -g @anthropic-ai/claude-code && claude
59
+ `crosscheck watch` opens a `localhost.run` SSH tunnel (no install, no account), auto-registers a GitHub webhook, and starts listening. GitHub delivers PR events; crosscheck routes them to the right reviewer.
30
60
 
31
- # Codex — uses your ChatGPT Plus/Pro subscription
32
- npm install -g @openai/codex && codex login --device-auth
61
+ ---
62
+
63
+ ## How it works
64
+
65
+ ```
66
+ ┌────────────────────────────────────────────────────────────────┐
67
+ │ Your laptop │
68
+ │ │
69
+ │ crosscheck watch │
70
+ │ ├── SSH tunnel (localhost.run) ◄──── GitHub webhook │
71
+ │ ├── Webhook server (:7891) │
72
+ │ └── PR handler │
73
+ │ ├── detect origin (Claude Code? Codex? other?) │
74
+ │ ├── clone PR branch │
75
+ │ ├── run reviewer (cross-vendor assignment) │
76
+ │ ├── post review comment │
77
+ │ └── address step (fix issues, push [crosscheck] commit) │
78
+ └────────────────────────────────────────────────────────────────┘
79
+ ```
80
+
81
+ **Routing** reads PR body patterns. `Generated with [Claude Code]` → Codex reviews. `Generated with [OpenAI Codex]` → Claude reviews. `allowed_authors` restricts reviews to your agent accounts.
82
+
83
+ **The address step** (optional, enabled via workflow config) runs after the review. The author agent reads its own review comment and commits fixes back to the PR branch. Commits are prefixed `[crosscheck]`. Hard cap: 5 address commits per PR.
84
+
85
+ **The feedback loop** closes via `crosscheck diagnose` → `crosscheck optimize`. Failure patterns and quality signals from `~/.crosscheck/logs/` feed back into improved reviewer instructions — no manual config editing required.
86
+
87
+ ---
88
+
89
+ ## watch output
33
90
 
34
- # GitHub CLI
35
- brew install gh && gh auth login
36
91
  ```
92
+ $ crosscheck watch
93
+
94
+ "Move fast and review things."
95
+
96
+ crosscheck watch
97
+
98
+ repos your-org/your-repo
99
+ mode cross-vendor
100
+ quality balanced
101
+ config ./crosscheck.config.yml ← edit to change above
102
+
103
+ ✓ tunnel ready: https://abc123.lhr.life
104
+ ✓ webhook registered for your-org/your-repo
105
+ Waiting for PR events — Ctrl+C to stop.
106
+
107
+ PR #47 opened: add retry logic for flaky network calls
108
+ origin=claude reviewer=codex
109
+ codex reviewing... (12s)
110
+ review complete (12s)
111
+ posted → github.com/your-org/your-repo/pull/47
112
+ NEEDS WORK
113
+
114
+ PR #48 opened: implement caching layer
115
+ origin=codex reviewer=claude
116
+ claude reviewing... (18s)
117
+ review complete (18s)
118
+ posted → github.com/your-org/your-repo/pull/48
119
+ APPROVE
120
+ ```
121
+
122
+ ---
37
123
 
38
- **2. Set env vars**
124
+ ## Commands
39
125
 
40
126
  ```bash
41
- export GITHUB_TOKEN=ghp_... # needs repo + pull-requests:write scope
42
- export CROSSCHECK_WEBHOOK_SECRET=secret # any random string
127
+ crosscheck init # check prerequisites, write starter config
128
+ crosscheck review <pr-url> # one-shot review of a specific PR
129
+ crosscheck watch # local dev — tunnel + auto-webhook + listening
130
+ crosscheck serve # always-on — fixed port, register webhook once
131
+ crosscheck status # auth state, config, log summary, CLI versions
132
+ crosscheck diagnose # surface failure patterns from review logs
133
+ crosscheck optimize [--apply] # update reviewer instructions from diagnose output
134
+ crosscheck impact [--money] # time saved, issues caught, code quality trends
43
135
  ```
44
136
 
45
- **3. Init and test**
137
+ ---
138
+
139
+ ## Configuration
140
+
141
+ `crosscheck.config.yml` lives in your project root. Coding agents can read and modify it directly.
142
+
143
+ ```yaml
144
+ # Which repos/orgs to watch (at least one required)
145
+ orgs:
146
+ - your-org # covers every repo in the org
147
+
148
+ # Only review PRs from these GitHub accounts
149
+ routing:
150
+ allowed_authors:
151
+ - your-claude-bot-account
152
+ - your-codex-bot-account
153
+
154
+ # Review depth
155
+ quality:
156
+ tier: balanced # fast | balanced | thorough
157
+
158
+ # Optional spend cap
159
+ budget:
160
+ per_review_usd: 2.0
161
+ codex_monthly_usd: 50
162
+
163
+ # Tunnel backend (watch mode only)
164
+ # localhost.run — zero install, reconnects automatically (default)
165
+ # smee — stable channel URL, queues events while offline
166
+ tunnel:
167
+ backend: localhost.run
168
+ ```
169
+
170
+ Full configuration reference: [get-started.md](./get-started.md)
171
+
172
+ ---
173
+
174
+ ## Self-improving reviews
175
+
176
+ Every review outcome is logged to `~/.crosscheck/logs/YYYY-MM-DD.ndjson`. Over time, patterns emerge — which commands the reviewer tries to run (and fails), verdict distributions, review duration trends.
46
177
 
47
178
  ```bash
48
- crosscheck init
49
- crosscheck review https://github.com/owner/repo/pull/123 --reviewer codex
179
+ # See what's going wrong
180
+ $ crosscheck diagnose
181
+
182
+ crosscheck diagnose (2026-01-01 → 2026-05-08 · 3 log files)
183
+
184
+ Reviews 47 total — 28 APPROVE 14 NEEDS WORK 5 BLOCK
185
+ Failure rate codex 12% / claude 4%
186
+
187
+ Suggestions
188
+ ─────────────────────────────────────────────────────────────
189
+ ✦ codex runs `npm test` during review (7 occurrences)
190
+ → add to instructions: "Do not run npm, tsc, or test commands."
191
+ ✦ 3 reviews timed out on large PRs (>400 lines changed)
192
+ → consider quality.tier: fast for PRs above a size threshold
193
+
194
+ # Apply the suggested fixes automatically
195
+ $ crosscheck optimize --apply
196
+ agent claude (lower failure rate: 4% vs codex 12%)
197
+ writing ~/.crosscheck/instructions.md
198
+ + Do not run npm, tsc, jest, or any build/test commands.
199
+ + Flag PRs over 400 lines changed as too large to review thoroughly.
200
+ done
201
+
202
+ # Measure the compounding value
203
+ $ crosscheck impact --money
204
+
205
+ crosscheck impact (all time · 47 reviews)
206
+
207
+ Time saved
208
+ ──────────────────────────────────────────────
209
+ Reviews run 47
210
+ Avg AI review time ~14 min
211
+ Assumed human time 60 min ⓘ
212
+ Total time saved ~43 h
213
+
214
+ Issues caught
215
+ ──────────────────────────────────────────────
216
+ APPROVE 28 (60%)
217
+ NEEDS WORK 14 (30%) ← actionable feedback
218
+ BLOCK 5 (11%) ← potential bugs / breaking changes
219
+ Total issues caught 19
220
+
221
+ Estimated value: ~$8,450
222
+ (43h × $150/hr + 19 issues × $150/issue)
50
223
  ```
51
224
 
52
- **4. Run continuously**
225
+ ---
226
+
227
+ ## Deployment
228
+
229
+ ### Laptop — `crosscheck watch`
230
+
231
+ Zero configuration. SSH tunnel through `localhost.run` handles NAT — no port-forwarding, no cloud account. If the tunnel goes silent without exiting, the health check detects it within ~2 minutes and forces a reconnect + webhook re-registration.
53
232
 
54
233
  ```bash
55
- # Local dev — tunnels via localhost.run (SSH), auto-registers webhook
56
234
  crosscheck watch
235
+ # → opens tunnel, registers webhook, starts listening
236
+ ```
237
+
238
+ ### Server — `crosscheck serve`
57
239
 
58
- # Always-on machine listens on fixed port, you register webhook once
240
+ Bind to a fixed port on a machine with a public IP. Register the webhook once.
241
+
242
+ ```bash
59
243
  crosscheck serve
244
+ # → listens on :7891, you register https://your-server/webhook manually
60
245
  ```
61
246
 
62
- ---
63
-
64
- ## Goals
247
+ ### smee.io — stable relay (optional)
65
248
 
66
- - **Use your existing subscriptions** no per-token API billing; runs `claude` and `codex` CLIs locally
67
- - **Zero infrastructure** — a single command on any machine with both CLIs installed
68
- - **Config-as-code** — one flat YAML file, readable and writable by coding agents
69
- - **Two deployment modes** — `watch` for laptops, `serve` for always-on machines
249
+ `localhost.run` drops events if your laptop is offline when a PR opens. [smee.io](https://smee.io) queues them and replays on reconnect — useful when the reviewer machine isn't always on.
70
250
 
71
- ## Non-goals
251
+ ```bash
252
+ npm install -g smee-client
253
+ # Visit https://smee.io/new — copy the channel URL
254
+ ```
72
255
 
73
- - Not a replacement for human code review
74
- - Not a merge gate — posts comments, does not block PRs
75
- - Not a hosted service — runs on your machine, against your CLIs
256
+ ```yaml
257
+ # crosscheck.config.yml
258
+ tunnel:
259
+ backend: smee
260
+ smee_channel: https://smee.io/your-channel-id
261
+ ```
76
262
 
77
263
  ---
78
264
 
79
265
  ## Requirements
80
266
 
81
- | Dependency | Why it's needed | Install |
82
- |---|---|---|
83
- | Node.js 18+ | Runs crosscheck itself | [nodejs.org](https://nodejs.org) |
84
- | Claude Code CLI | Performs AI code review on Codex PRs | `npm install -g @anthropic-ai/claude-code` |
85
- | Codex CLI | Performs AI code review on Claude PRs | `npm install -g @openai/codex` |
86
- | GitHub CLI (`gh`) | Clones PR branches, posts review comments, registers webhooks | `brew install gh` |
87
- | `GITHUB_TOKEN` | Authenticates GitHub API calls (webhook registration, comment posting) | [github.com/settings/tokens](https://github.com/settings/tokens) — needs `repo` + `write:org` scopes |
267
+ | | Minimum |
268
+ |---|---|
269
+ | Node.js | 18+ |
270
+ | Claude Code CLI | latest `npm install -g @anthropic-ai/claude-code` |
271
+ | Codex CLI | latest `npm install -g @openai/codex` |
272
+ | GitHub CLI | 2.65+ `brew install gh` |
88
273
 
89
- ### `watch` mode only
274
+ `GITHUB_TOKEN` is derived automatically when `gh auth login` has been run. No manual export required.
90
275
 
91
- `watch` mode needs a public URL so GitHub can deliver webhook events to your laptop. Since laptops are behind NAT, a tunnel is required. crosscheck uses `localhost.run` — no install, no account, just SSH (pre-installed on macOS/Linux):
276
+ ---
92
277
 
93
- ```
94
- GitHub → ssh tunnel → localhost:7891
95
- ```
278
+ ## Documentation
279
+
280
+ | | |
281
+ |---|---|
282
+ | **[get-started.md](./get-started.md)** | Full setup guide — prerequisites, all commands and flags, complete config reference, how it works, FAQ |
283
+ | **[crosscheck.config.example.yml](./crosscheck.config.example.yml)** | Annotated config file with every option |
284
+ | **[AGENT.md](./AGENT.md)** | Harness document used by `crosscheck optimize` — how the AI improves reviewer instructions |
285
+
286
+ ---
287
+
288
+ ## Contributing
96
289
 
97
- No tunnel is needed for `serve` mode, which assumes the machine already has a publicly reachable IP.
290
+ Issues and PRs welcome at [github.com/Motivation-Labs/crosscheck](https://github.com/Motivation-Labs/crosscheck).
98
291
 
99
292
  ---
100
293
 
101
294
  ## License
102
295
 
103
- MIT
296
+ [MIT](./LICENSE) — Copyright (c) 2025–2026 Motivation Labs LLC.
package/README.zh.md ADDED
@@ -0,0 +1,294 @@
1
+ <div align="right">
2
+ <h5><a href="./README.md">🌐 &nbsp;English</a></h5>
3
+ </div>
4
+
5
+ <p align="center">
6
+ <img src="./assets/logo.png" alt="crosscheck" width="160" />
7
+ </p>
8
+
9
+ # crosscheck
10
+
11
+ **一个轻量级编排层,让你的 AI 编程助手互相审查代码——并自动修复问题。**
12
+
13
+ 当 Claude Code 提交 PR 时,由 Codex 审查;当 Codex 提交 PR 时,由 Claude 审查。发现问题后,原作者 Agent 提交修复并推送回去。这一切都在你的本地机器上运行,使用你已有的订阅,一条命令即可启动。
14
+
15
+ ```
16
+ GitHub PR → crosscheck watch → AI 审查意见发布 → 修复提交
17
+ ```
18
+
19
+ > 灵感来自 [Symphony](https://github.com/openai/symphony) —— OpenAI 的规范驱动多智能体框架。Symphony 在产品/交付层面协调 Agent,而 crosscheck 保持在工程师最熟悉的工作层面:Pull Request、代码差异和 Code Review。无需引入新的抽象概念——只是将 CR + 修复的工作流程自动化。
20
+
21
+ ---
22
+
23
+ ## 为什么选择 crosscheck
24
+
25
+ AI 编程助手提交代码的速度很快,但也会自信地犯下看似合理的错误。解决方案不是让人类审查每一个 AI 提交的 PR——而是让*另一个* AI 来审查。Claude 和 Codex 有互补的盲点,跨供应商审查比任何单一模型都能发现更多问题,同时不会给每次提交增加人工审查的延迟。
26
+
27
+ crosscheck 将这个闭环连接起来:
28
+
29
+ | | |
30
+ |---|---|
31
+ | **本地执行,持续监听** | 在你的机器上运行。`crosscheck watch` 打开隧道后持续运行,无需云服务、基础设施或 SaaS。 |
32
+ | **订阅驱动,无额外计费** | 调用 `claude` 和 `codex` 命令行工具,使用你已有的 Claude Pro/Max 和 ChatGPT Plus/Pro 订阅。无需按 token 付费,订阅后审查完全免费。 |
33
+ | **默认跨供应商** | Claude 审查 Codex 的 PR;Codex 审查 Claude 的 PR。每个模型有不同的训练数据和不同的故障模式,交叉点正是 Bug 藏身之处。 |
34
+ | **持续自我优化** | `crosscheck diagnose` 从日志中发现失败模式,`crosscheck optimize` 将这些模式反馈给 AI,自动更新审查指令。 |
35
+
36
+ ---
37
+
38
+ ## 快速开始
39
+
40
+ ```bash
41
+ # 1. 安装 crosscheck 及 Agent CLI
42
+ npm install -g @motivation-labs/crosscheck
43
+ npm install -g @anthropic-ai/claude-code && claude # 需要 Claude Pro/Max 订阅
44
+ npm install -g @openai/codex && codex login --device-auth # 需要 ChatGPT Plus/Pro 订阅
45
+ brew install gh && gh auth login # GitHub CLI
46
+
47
+ # 2. 检查运行环境
48
+ crosscheck init
49
+
50
+ # 3. 对单个 PR 进行测试
51
+ crosscheck review https://github.com/your-org/repo/pull/42
52
+
53
+ # 4. 持续运行
54
+ crosscheck watch
55
+ ```
56
+
57
+ `crosscheck watch` 会通过 `localhost.run` 建立 SSH 隧道(无需安装任何软件,无需账号),自动注册 GitHub Webhook,然后开始监听。GitHub 推送 PR 事件后,crosscheck 将其路由到正确的审查者。
58
+
59
+ ---
60
+
61
+ ## 工作原理
62
+
63
+ ```
64
+ ┌────────────────────────────────────────────────────────────────┐
65
+ │ 你的笔记本 │
66
+ │ │
67
+ │ crosscheck watch │
68
+ │ ├── SSH 隧道 (localhost.run) ◄──── GitHub Webhook │
69
+ │ ├── Webhook 服务器 (:7891) │
70
+ │ └── PR 处理器 │
71
+ │ ├── 识别来源 (Claude Code? Codex? 其他?) │
72
+ │ ├── 克隆 PR 分支 │
73
+ │ ├── 运行审查者 (跨供应商分配) │
74
+ │ ├── 发布审查评论 │
75
+ │ └── 地址步骤 (修复问题,推送 [crosscheck] 提交) │
76
+ └────────────────────────────────────────────────────────────────┘
77
+ ```
78
+
79
+ **路由** 基于 PR 正文的匹配模式。`Generated with [Claude Code]` → 由 Codex 审查;`Generated with [OpenAI Codex]` → 由 Claude 审查。`allowed_authors` 字段将审查限制在你的 Agent 账号提交的 PR 上。
80
+
81
+ **地址步骤**(可选,通过工作流配置启用)在审查完成后运行。原作者 Agent 读取自己的审查评论并将修复提交回 PR 分支,提交前缀为 `[crosscheck]`,每个 PR 最多提交 5 次修复。
82
+
83
+ **反馈闭环** 通过 `crosscheck diagnose` → `crosscheck optimize` 实现。`~/.crosscheck/logs/` 中的失败模式和质量信号会自动反馈为更好的审查指令,无需手动编辑配置。
84
+
85
+ ---
86
+
87
+ ## watch 运行输出示例
88
+
89
+ ```
90
+ $ crosscheck watch
91
+
92
+ "Move fast and review things."
93
+
94
+ crosscheck watch
95
+
96
+ repos your-org/your-repo
97
+ mode cross-vendor
98
+ quality balanced
99
+ config ./crosscheck.config.yml ← 编辑此文件可修改配置
100
+
101
+ ✓ 隧道已就绪: https://abc123.lhr.life
102
+ ✓ 已为 your-org/your-repo 注册 Webhook
103
+ 等待 PR 事件 — 按 Ctrl+C 停止。
104
+
105
+ PR #47 opened: add retry logic for flaky network calls
106
+ origin=claude reviewer=codex
107
+ codex reviewing... (12s)
108
+ review complete (12s)
109
+ posted → github.com/your-org/your-repo/pull/47
110
+ NEEDS WORK
111
+
112
+ PR #48 opened: implement caching layer
113
+ origin=codex reviewer=claude
114
+ claude reviewing... (18s)
115
+ review complete (18s)
116
+ posted → github.com/your-org/your-repo/pull/48
117
+ APPROVE
118
+ ```
119
+
120
+ ---
121
+
122
+ ## 命令列表
123
+
124
+ ```bash
125
+ crosscheck init # 检查环境,生成初始配置文件
126
+ crosscheck review <pr-url> # 对指定 PR 进行一次性审查
127
+ crosscheck watch # 本地开发模式——隧道 + 自动 Webhook + 监听
128
+ crosscheck serve # 常驻模式——固定端口,手动注册 Webhook
129
+ crosscheck status # 查看认证状态、配置、日志摘要、CLI 版本
130
+ crosscheck diagnose # 从审查日志中提取失败模式
131
+ crosscheck optimize [--apply] # 根据 diagnose 输出更新审查指令
132
+ crosscheck impact [--money] # 节省时间、发现问题、代码质量趋势报告
133
+ ```
134
+
135
+ ---
136
+
137
+ ## 配置说明
138
+
139
+ `crosscheck.config.yml` 位于项目根目录,AI 编程助手可以直接读取和修改它。
140
+
141
+ ```yaml
142
+ # 监听的组织/仓库(至少配置一项)
143
+ orgs:
144
+ - your-org # 覆盖该组织下的所有仓库
145
+
146
+ # 仅审查这些 GitHub 账号提交的 PR
147
+ routing:
148
+ allowed_authors:
149
+ - your-claude-bot-account
150
+ - your-codex-bot-account
151
+
152
+ # 审查深度
153
+ quality:
154
+ tier: balanced # fast(快速)| balanced(均衡)| thorough(深度)
155
+
156
+ # 可选费用上限
157
+ budget:
158
+ per_review_usd: 2.0
159
+ codex_monthly_usd: 50
160
+
161
+ # 隧道后端(仅 watch 模式使用)
162
+ # localhost.run — 无需安装,自动重连(默认)
163
+ # smee — 稳定的频道 URL,离线时事件排队
164
+ tunnel:
165
+ backend: localhost.run
166
+ ```
167
+
168
+ 完整配置参考:[get-started.zh.md](./get-started.zh.md)
169
+
170
+ ---
171
+
172
+ ## 持续自我优化
173
+
174
+ 每次审查结果都会记录到 `~/.crosscheck/logs/YYYY-MM-DD.ndjson`。随着时间推移,规律会逐渐显现——审查者尝试运行(并失败)的命令、判断分布、审查时长趋势。
175
+
176
+ ```bash
177
+ # 查看问题所在
178
+ $ crosscheck diagnose
179
+
180
+ crosscheck diagnose (2026-01-01 → 2026-05-08 · 3 个日志文件)
181
+
182
+ 审查总计 47 次 — 28 APPROVE 14 NEEDS WORK 5 BLOCK
183
+ 失败率 codex 12% / claude 4%
184
+
185
+ 建议
186
+ ─────────────────────────────────────────────────────────────
187
+ ✦ codex 在审查时尝试运行 `npm test`(7 次)
188
+ → 在 instructions 中添加:"不要运行 npm、tsc 或测试命令。"
189
+ ✦ 3 次审查在大型 PR(>400 行改动)上超时
190
+ → 考虑为超过一定大小的 PR 设置 quality.tier: fast
191
+
192
+ # 自动应用修复建议
193
+ $ crosscheck optimize --apply
194
+ agent claude(失败率更低:4% vs codex 12%)
195
+ 正在写入 ~/.crosscheck/instructions.md
196
+ + 不要运行 npm、tsc、jest 或任何构建/测试命令。
197
+ + 将超过 400 行改动的 PR 标记为过大,无法进行深度审查。
198
+ 完成
199
+
200
+ # 量化累计价值
201
+ $ crosscheck impact --money
202
+
203
+ crosscheck impact (全部时间 · 47 次审查)
204
+
205
+ 节省时间
206
+ ──────────────────────────────────────────────
207
+ 审查次数 47
208
+ AI 平均审查时间 ~14 分钟
209
+ 人工预估时间 60 分钟 ⓘ
210
+ 共节省时间 ~43 小时
211
+
212
+ 发现问题
213
+ ──────────────────────────────────────────────
214
+ APPROVE 28 (60%)
215
+ NEEDS WORK 14 (30%) ← 可操作的反馈
216
+ BLOCK 5 (11%) ← 潜在 Bug / 破坏性变更
217
+ 共发现问题 19
218
+
219
+ 估算价值: ~$8,450
220
+ (43h × $150/hr + 19 个问题 × $150/个)
221
+ ```
222
+
223
+ ---
224
+
225
+ ## 部署方式
226
+
227
+ ### 笔记本 — `crosscheck watch`
228
+
229
+ 零配置。通过 `localhost.run` 建立 SSH 隧道处理 NAT 穿透,无需端口转发,无需云账号。如果隧道静默断开,健康检查会在约 2 分钟内检测到并强制重连 + 重新注册 Webhook。
230
+
231
+ ```bash
232
+ crosscheck watch
233
+ # → 打开隧道,注册 Webhook,开始监听
234
+ ```
235
+
236
+ ### 服务器 — `crosscheck serve`
237
+
238
+ 绑定到具有公网 IP 的机器上的固定端口,手动注册一次 Webhook 即可。
239
+
240
+ ```bash
241
+ crosscheck serve
242
+ # → 监听 :7891,手动注册 https://your-server/webhook
243
+ ```
244
+
245
+ ### smee.io — 稳定中继(可选)
246
+
247
+ 当笔记本离线时,`localhost.run` 会丢失事件。[smee.io](https://smee.io) 会将事件排队,在重新连接后回放——适合审查机器不总是在线的团队。
248
+
249
+ ```bash
250
+ npm install -g smee-client
251
+ # 访问 https://smee.io/new — 复制频道 URL
252
+ ```
253
+
254
+ ```yaml
255
+ # crosscheck.config.yml
256
+ tunnel:
257
+ backend: smee
258
+ smee_channel: https://smee.io/your-channel-id
259
+ ```
260
+
261
+ ---
262
+
263
+ ## 系统要求
264
+
265
+ | | 最低版本 |
266
+ |---|---|
267
+ | Node.js | 18+ |
268
+ | Claude Code CLI | 最新版 — `npm install -g @anthropic-ai/claude-code` |
269
+ | Codex CLI | 最新版 — `npm install -g @openai/codex` |
270
+ | GitHub CLI | 2.65+ — `brew install gh` |
271
+
272
+ 运行 `gh auth login` 后,`GITHUB_TOKEN` 会自动获取,无需手动导出。
273
+
274
+ ---
275
+
276
+ ## 文档
277
+
278
+ | | |
279
+ |---|---|
280
+ | **[get-started.zh.md](./get-started.zh.md)** | 完整安装指南——前置条件、所有命令与参数、完整配置参考、工作原理、常见问题 |
281
+ | **[crosscheck.config.example.yml](./crosscheck.config.example.yml)** | 带注释的配置文件示例(每个选项均有说明) |
282
+ | **[AGENT.md](./AGENT.md)** | `crosscheck optimize` 使用的 Harness 文档——AI 如何优化审查指令 |
283
+
284
+ ---
285
+
286
+ ## 参与贡献
287
+
288
+ 欢迎提交 Issue 和 PR:[github.com/Motivation-Labs/crosscheck](https://github.com/Motivation-Labs/crosscheck)
289
+
290
+ ---
291
+
292
+ ## 许可证
293
+
294
+ [MIT](./LICENSE) — Copyright (c) 2025–2026 Motivation Labs LLC.
Binary file
@@ -75,6 +75,25 @@ routing:
75
75
  - "Generated with \\[OpenAI Codex\\]" # Codex attribution footer
76
76
  - "Co-Authored-By: codex"
77
77
 
78
+ # ─── Tunnel (watch mode only) ────────────────────────────────────────────────
79
+ # Controls how crosscheck watch receives GitHub webhook events on your laptop.
80
+ #
81
+ # localhost.run (default) — zero config, SSH tunnel, random URL each restart.
82
+ # No install required. URL changes on reconnect → webhook re-registered automatically.
83
+ # Limitation: events delivered while the tunnel is down are lost.
84
+ #
85
+ # smee — webhook relay via smee.io. Stable channel URL; events are queued and
86
+ # replayed even when your laptop is offline or watch is restarted.
87
+ # Setup:
88
+ # 1. npm install -g smee-client
89
+ # 2. Visit https://smee.io/new — copy the channel URL
90
+ # 3. Point your GitHub org/repo webhook Payload URL to the channel URL
91
+ # 4. Set tunnel.smee_channel below
92
+ #
93
+ # tunnel:
94
+ # backend: smee
95
+ # smee_channel: https://smee.io/your-channel-id
96
+
78
97
  # ─── Server (serve mode only) ────────────────────────────────────────────────
79
98
  server:
80
99
  port: 7891
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=issue.test.d.ts.map