@astrosheep/keiyaku 0.1.77 → 0.1.79

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 (51) hide show
  1. package/README.md +46 -38
  2. package/build/.tsbuildinfo +1 -1
  3. package/build/config/apply-argument-descriptions.js +1 -1
  4. package/build/config/base-rules.js +2 -1
  5. package/build/config/dotenv.js +2 -1
  6. package/build/config/settings.js +2 -7
  7. package/build/config/term-presets/default-preset.js +3 -4
  8. package/build/config/term-presets/resolver.js +0 -3
  9. package/build/errno.js +3 -0
  10. package/build/flow-error.js +2 -0
  11. package/build/generated/version.js +1 -1
  12. package/build/git/diff/constants.js +1 -0
  13. package/build/git/diff/filter.js +3 -18
  14. package/build/git/diff/parsers.js +149 -61
  15. package/build/git/diff/preview.js +16 -2
  16. package/build/git/diff/read.js +32 -20
  17. package/build/git/snapshot.js +5 -24
  18. package/build/git/worktree.js +5 -4
  19. package/build/mcp/server.js +61 -69
  20. package/build/protocol/draft-artifacts.js +2 -1
  21. package/build/protocol/file-guards.js +2 -1
  22. package/build/protocol/markdown/lex.js +52 -14
  23. package/build/protocol/markdown/normalization.js +3 -2
  24. package/build/protocol/markdown/parser.js +2 -2
  25. package/build/protocol/response-history.js +44 -5
  26. package/build/protocol/status-previews.js +20 -8
  27. package/build/protocol/summon-draft.js +3 -2
  28. package/build/protocol/summon-input.js +1 -0
  29. package/build/tools/amend/index.js +11 -21
  30. package/build/tools/ask/index.js +11 -18
  31. package/build/tools/ask/persist.js +60 -37
  32. package/build/tools/ask/run.js +15 -5
  33. package/build/tools/create-handler.js +31 -0
  34. package/build/tools/drive/index.js +11 -24
  35. package/build/tools/drive/run.js +9 -5
  36. package/build/tools/petition/claim-gates.js +24 -1
  37. package/build/tools/petition/claim.js +19 -2
  38. package/build/tools/petition/forfeit.js +4 -1
  39. package/build/tools/petition/index.js +43 -58
  40. package/build/tools/petition/run.js +12 -0
  41. package/build/tools/round/head-guard.js +10 -0
  42. package/build/tools/round/incremental-diff.js +6 -2
  43. package/build/tools/round/report.js +24 -2
  44. package/build/tools/round/run.js +6 -0
  45. package/build/tools/round/worktree.js +6 -2
  46. package/build/tools/status/index.js +11 -24
  47. package/build/tools/status/read.js +6 -4
  48. package/build/tools/summon/index.js +17 -27
  49. package/build/tools/summon/run.js +21 -18
  50. package/package.json +6 -6
  51. package/build/git/diff/stat.js +0 -9
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Keiyaku
2
2
 
3
- MCP serverAI 的代码改动跑在独立 branch 上,task 写进 repo,没你许可不准结束。
3
+ MCP server. AI code changes run on an isolated branch. Tasks are written into the repo. Nothing closes without your sign-off.
4
4
 
5
5
  ```bash
6
6
  npm install -g @astrosheep/keiyaku
@@ -8,17 +8,25 @@ npm install -g @astrosheep/keiyaku
8
8
 
9
9
  ---
10
10
 
11
- ## 装之前
11
+ ## Before You Start
12
12
 
13
- 少一个都别来问为什么不能用:
13
+ Missing any of these? Don't come crying.
14
14
 
15
- - **Git repo**,worktree 干净的。脏的不给用。
16
- - **MCP client**。Claude DesktopClaude Code、随便什么 stdio 的。
17
- - **Subagent CLI**。[`claude`](https://docs.anthropic.com/en/docs/claude-code) [`gemini`](https://github.com/google-gemini/gemini-cli),装好,登录好。Keiyaku 自己不跑代码,全丢给 subprocess。没装 = 什么都不会发生。
15
+ - **Git repo.** Clean worktree. Dirty = refused.
16
+ - **MCP client.** Claude Desktop, Claude Code, anything stdio.
17
+ - **Subagent CLI.** [`claude`](https://docs.anthropic.com/en/docs/claude-code), [`gemini`](https://github.com/google-gemini/gemini-cli), or [`codex`](https://github.com/openai/codex). Installed. Logged in. Keiyaku doesn't run code itself — it delegates everything to a subprocess. No CLI = nothing happens.
18
+
19
+ **Codex users, one extra step.** Codex clears env before spawning MCP servers. Add this to your `~/.codex/config.toml` or keiyaku won't know when it's running as a subagent:
20
+
21
+ ```toml
22
+ [mcp_servers.keiyaku]
23
+ # ... rest of your config ...
24
+ env_vars = ["KEIYAKU_DISABLE_SUBAGENT_SPAWN"]
25
+ ```
18
26
 
19
27
  ---
20
28
 
21
- ## 配置
29
+ ## Setup
22
30
 
23
31
  Claude Desktop (`~/Library/Application Support/Claude/claude_desktop_config.json`):
24
32
 
@@ -33,31 +41,31 @@ Claude Desktop (`~/Library/Application Support/Claude/claude_desktop_config.json
33
41
  }
34
42
  ```
35
43
 
36
- 重启 client。打开 git repo。跑 `status`。完了。
44
+ Restart client. Open a git repo. Run `status`. Done.
37
45
 
38
46
  ---
39
47
 
40
- ## 流程
48
+ ## Flow
41
49
 
42
50
  ```
43
- ask (随时) | summon → [drive | ask]* → petition
51
+ ask (anytime) | summon → [drive | ask]* → petition
44
52
  ```
45
53
 
46
54
  ---
47
55
 
48
- ## 工具
56
+ ## Tools
49
57
 
50
- **`ask`** — 问东西用的。不开 branch,不建 contract,随便用。
58
+ **`ask`** — For questions. No branch, no contract. Use it freely.
51
59
 
52
60
  ```
53
- retry 逻辑在哪?跑一下那个文件的 unit test。
61
+ Where's the retry logic? Run the unit tests for that file.
54
62
  ```
55
63
 
56
64
  ---
57
65
 
58
- **`summon`** — branch,写 contract。repo 必须干净。
66
+ **`summon`** — Opens a branch, writes the contract. Repo must be clean.
59
67
 
60
- criteria 写多具体,结果就有多具体。写 "make it better" 就别怪 AI 自由发挥。
68
+ Vague criteria = vague results. Write "make it better" and don't blame anyone but yourself.
61
69
 
62
70
  ```
63
71
  summon:
@@ -71,38 +79,38 @@ summon:
71
79
 
72
80
  ---
73
81
 
74
- **`drive`** — 下一轮。看完 diff,说哪里不对,再跑一轮。
82
+ **`drive`** — Next round. Review the diff, say what's wrong, run another round.
75
83
 
76
84
  ```
77
- Backoff 1.5x,应该 2x。改掉,test 也更新。
85
+ Backoff is 1.5x, should be 2x. Fix it, update the tests too.
78
86
  ```
79
87
 
80
88
  ---
81
89
 
82
- **`petition`** — 结束 task
90
+ **`petition`** — Close the task.
83
91
 
84
- `CLAIM` = 我验证过了,criteria 全过了。`FORFEIT` = 不要了,全部丢掉。
92
+ `CLAIM` = verified, all criteria pass. `FORFEIT` = abandon, throw everything away.
85
93
 
86
- 要打分 (0–10),要宣誓。gate 是真的会拒绝你的。没检查就别来。
94
+ Scores required (0–10). Oath required. The gates will actually reject you. Don't show up without checking.
87
95
 
88
96
  ---
89
97
 
90
- **`status`** — 现在什么状态,什么在挡路。
98
+ **`status`** — Current state and what's blocking you.
91
99
 
92
- **`help`** — 完整参考。
100
+ **`help`** — Full reference.
93
101
 
94
102
  ---
95
103
 
96
- ## 写进 repo 的东西
104
+ ## What Gets Written to the Repo
97
105
 
98
- | 文件 | |
106
+ | File | |
99
107
  |------|--|
100
- | `KEIYAKU.md` | 当前 contract |
101
- | `KEIYAKU_TRACE.md` | 每轮记录 |
102
- | `KEIYAKU.draft.md` | summon 失败时的恢复用 draft |
103
- | `.keiyaku/response/*.md` | 每轮输出 |
108
+ | `KEIYAKU.md` | Active contract |
109
+ | `KEIYAKU_TRACE.md` | Per-round log |
110
+ | `KEIYAKU.draft.md` | Recovery draft if summon fails |
111
+ | `.keiyaku/response/*.md` | Per-round output |
104
112
 
105
- 不想 track 就加 `.gitignore`:
113
+ Don't want these tracked:
106
114
 
107
115
  ```gitignore
108
116
  .keiyaku/draft/
@@ -111,22 +119,22 @@ Backoff 是 1.5x,应该 2x。改掉,test 也更新。
111
119
 
112
120
  ---
113
121
 
114
- ## 进阶
122
+ ## Advanced
115
123
 
116
124
  ```bash
117
125
  keiyaku dump-env
118
126
  ```
119
127
 
120
- | 变量 | 默认值 | |
121
- |------|--------|--|
122
- | `KEIYAKU_MCP_TRANSPORT` | `stdio` | `stdio` `streamable-http` |
123
- | `KEIYAKU_MCP_HTTP_PORT` | `3000` | HTTP 端口 |
124
- | `KEIYAKU_SUBAGENT_EXEC_TIMEOUT_MS` | — | 执行超时 |
125
- | `KEIYAKU_SUBAGENT_EXEC_IDLE_TIMEOUT_MS` | — | 空闲超时 |
128
+ | Variable | Default | |
129
+ |----------|---------|--|
130
+ | `KEIYAKU_MCP_TRANSPORT` | `stdio` | `stdio` or `streamable-http` |
131
+ | `KEIYAKU_MCP_HTTP_PORT` | `3000` | HTTP port |
132
+ | `KEIYAKU_SUBAGENT_EXEC_TIMEOUT_MS` | — | Execution timeout |
133
+ | `KEIYAKU_SUBAGENT_EXEC_IDLE_TIMEOUT_MS` | — | Idle timeout |
126
134
  | `KEIYAKU_INCREMENTAL_DIFF_MODE` | `targeted` | `targeted` \| `stat` \| `unified` |
127
- | `KEIYAKU_FAKE_SUBAGENT` | `0` | `1` = 测试用 stub |
135
+ | `KEIYAKU_FAKE_SUBAGENT` | `0` | `1` = test stub |
128
136
 
129
- HTTP transport
137
+ HTTP transport:
130
138
 
131
139
  ```bash
132
140
  KEIYAKU_MCP_TRANSPORT=streamable-http \