@astrosheep/keiyaku 0.1.76 → 0.1.78
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 +88 -96
- package/build/.tsbuildinfo +1 -1
- package/build/config/apply-argument-descriptions.js +1 -1
- package/build/config/base-rules.js +14 -7
- package/build/config/dotenv.js +17 -11
- package/build/config/keiyaku-home.js +9 -0
- package/build/config/settings.js +41 -24
- package/build/config/term-presets/resolver.js +0 -3
- package/build/errno.js +3 -0
- package/build/flow-error.js +2 -0
- package/build/generated/version.js +1 -1
- package/build/git/diff/constants.js +1 -0
- package/build/git/diff/filter.js +3 -18
- package/build/git/diff/parsers.js +149 -61
- package/build/git/diff/preview.js +16 -2
- package/build/git/diff/read.js +32 -20
- package/build/git/snapshot.js +5 -24
- package/build/git/worktree.js +5 -4
- package/build/mcp/responses.js +3 -2
- package/build/mcp/server.js +61 -69
- package/build/protocol/draft-artifacts.js +2 -1
- package/build/protocol/file-guards.js +2 -1
- package/build/protocol/markdown/lex.js +52 -14
- package/build/protocol/markdown/normalization.js +3 -2
- package/build/protocol/markdown/parser.js +2 -2
- package/build/protocol/response-history.js +44 -5
- package/build/protocol/status-previews.js +20 -8
- package/build/protocol/summon-draft.js +3 -2
- package/build/protocol/summon-input.js +1 -0
- package/build/protocol/trace.js +1 -1
- package/build/tools/amend/index.js +11 -21
- package/build/tools/ask/index.js +11 -18
- package/build/tools/ask/persist.js +60 -37
- package/build/tools/ask/run.js +17 -7
- package/build/tools/create-handler.js +31 -0
- package/build/tools/drive/index.js +11 -24
- package/build/tools/drive/run.js +9 -5
- package/build/tools/petition/claim-gates.js +38 -9
- package/build/tools/petition/claim.js +20 -2
- package/build/tools/petition/forfeit.js +4 -1
- package/build/tools/petition/index.js +43 -58
- package/build/tools/petition/run.js +12 -0
- package/build/tools/round/head-guard.js +10 -0
- package/build/tools/round/incremental-diff.js +6 -2
- package/build/tools/round/report.js +24 -2
- package/build/tools/round/run.js +6 -0
- package/build/tools/round/worktree.js +6 -2
- package/build/tools/status/index.js +11 -24
- package/build/tools/status/read.js +6 -4
- package/build/tools/summon/index.js +17 -27
- package/build/tools/summon/run.js +21 -18
- package/package.json +6 -6
- package/build/git/diff/stat.js +0 -9
package/README.md
CHANGED
|
@@ -1,148 +1,140 @@
|
|
|
1
1
|
# Keiyaku
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
MCP server。AI 的代码改动跑在独立 branch 上,task 写进 repo,没你许可不准结束。
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
```bash
|
|
6
|
+
npm install -g @astrosheep/keiyaku
|
|
7
|
+
```
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
---
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
- Explicit contracts: the goal/rules/criteria live in `KEIYAKU.md` so “what are we doing?” is always answered by a file, not a scrolling chat.
|
|
13
|
-
- Review-driven iteration: you drive the rounds; the tool optimizes for diffs and verification, not vibes.
|
|
14
|
-
- Verdict-gated finish: the contract ends via `petition` (CLAIM/FORFEIT) so “done” is an explicit decision with gates (oath + scores).
|
|
11
|
+
## 装之前
|
|
15
12
|
|
|
16
|
-
|
|
13
|
+
少一个都别来问为什么不能用:
|
|
17
14
|
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
15
|
+
- **Git repo**,worktree 干净的。脏的不给用。
|
|
16
|
+
- **MCP client**。Claude Desktop、Claude Code、随便什么 stdio 的。
|
|
17
|
+
- **Subagent CLI**。[`claude`](https://docs.anthropic.com/en/docs/claude-code) 或 [`gemini`](https://github.com/google-gemini/gemini-cli),装好,登录好。Keiyaku 自己不跑代码,全丢给 subprocess。没装 = 什么都不会发生。
|
|
21
18
|
|
|
22
|
-
|
|
19
|
+
---
|
|
23
20
|
|
|
24
|
-
|
|
21
|
+
## 配置
|
|
25
22
|
|
|
26
|
-
|
|
27
|
-
- A round trace (`KEIYAKU_TRACE.md`) that records iterations
|
|
28
|
-
- A final petition (`petition`) that requests a CLAIM or FORFEIT verdict
|
|
23
|
+
Claude Desktop (`~/Library/Application Support/Claude/claude_desktop_config.json`):
|
|
29
24
|
|
|
30
|
-
|
|
25
|
+
```json
|
|
26
|
+
{
|
|
27
|
+
"mcpServers": {
|
|
28
|
+
"keiyaku": {
|
|
29
|
+
"command": "npx",
|
|
30
|
+
"args": ["-y", "@astrosheep/keiyaku"]
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
```
|
|
31
35
|
|
|
32
|
-
|
|
36
|
+
重启 client。打开 git repo。跑 `status`。完了。
|
|
33
37
|
|
|
34
|
-
|
|
38
|
+
---
|
|
35
39
|
|
|
36
|
-
|
|
37
|
-
2. Review the round output and repo diff.
|
|
38
|
-
3. `drive`: issue the next directive (fixes, refinements, tests, cleanup).
|
|
39
|
-
4. `ask`: optionally verify independently (tests, static checks, targeted inspection).
|
|
40
|
-
5. `petition`:
|
|
41
|
-
- `CLAIM` to request acceptance (requires oath + 0-10 scores).
|
|
42
|
-
- `FORFEIT` to abandon and discard the contract.
|
|
40
|
+
## 流程
|
|
43
41
|
|
|
44
|
-
|
|
42
|
+
```
|
|
43
|
+
ask (随时) | summon → [drive | ask]* → petition
|
|
44
|
+
```
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
---
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
- `drive`: run the next round (mutates the repo)
|
|
50
|
-
- `ask`: stateless delegation (analysis, running tests/scripts, debugging). No keiyaku branch required.
|
|
51
|
-
- `petition`: submit `CLAIM` or `FORFEIT` to close the contract (verdict-gated)
|
|
52
|
-
- `status`: read-only contract/protocol status and readiness hints
|
|
53
|
-
- `help`: usage guide and protocol notes
|
|
48
|
+
## 工具
|
|
54
49
|
|
|
55
|
-
|
|
50
|
+
**`ask`** — 问东西用的。不开 branch,不建 contract,随便用。
|
|
56
51
|
|
|
57
|
-
|
|
52
|
+
```
|
|
53
|
+
retry 逻辑在哪?跑一下那个文件的 unit test。
|
|
54
|
+
```
|
|
58
55
|
|
|
59
|
-
|
|
56
|
+
---
|
|
60
57
|
|
|
61
|
-
|
|
62
|
-
npm install -g @astrosheep/keiyaku
|
|
63
|
-
keiyaku --version
|
|
64
|
-
```
|
|
58
|
+
**`summon`** — 开 branch,写 contract。repo 必须干净。
|
|
65
59
|
|
|
66
|
-
|
|
60
|
+
criteria 写多具体,结果就有多具体。写 "make it better" 就别怪 AI 自由发挥。
|
|
67
61
|
|
|
68
|
-
```
|
|
69
|
-
|
|
62
|
+
```
|
|
63
|
+
summon:
|
|
64
|
+
title: "Retry logic for HTTP client"
|
|
65
|
+
goal: "5xx failures retry up to 3 times with exponential backoff"
|
|
66
|
+
criteria:
|
|
67
|
+
- Retry unit tests pass
|
|
68
|
+
- Public API unchanged
|
|
69
|
+
- Existing tests still pass
|
|
70
70
|
```
|
|
71
71
|
|
|
72
|
-
|
|
72
|
+
---
|
|
73
73
|
|
|
74
|
-
|
|
74
|
+
**`drive`** — 下一轮。看完 diff,说哪里不对,再跑一轮。
|
|
75
75
|
|
|
76
|
-
```json
|
|
77
|
-
{
|
|
78
|
-
"mcpServers": {
|
|
79
|
-
"keiyaku": {
|
|
80
|
-
"command": "npx",
|
|
81
|
-
"args": ["-y", "@astrosheep/keiyaku"]
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
76
|
```
|
|
86
|
-
|
|
87
|
-
### Streamable HTTP
|
|
88
|
-
|
|
89
|
-
```bash
|
|
90
|
-
KEIYAKU_MCP_TRANSPORT=streamable-http \
|
|
91
|
-
KEIYAKU_MCP_HTTP_HOST=127.0.0.1 \
|
|
92
|
-
KEIYAKU_MCP_HTTP_PORT=3000 \
|
|
93
|
-
npx -y @astrosheep/keiyaku
|
|
77
|
+
Backoff 是 1.5x,应该 2x。改掉,test 也更新。
|
|
94
78
|
```
|
|
95
79
|
|
|
96
|
-
|
|
80
|
+
---
|
|
97
81
|
|
|
98
|
-
|
|
82
|
+
**`petition`** — 结束 task。
|
|
99
83
|
|
|
100
|
-
|
|
84
|
+
`CLAIM` = 我验证过了,criteria 全过了。`FORFEIT` = 不要了,全部丢掉。
|
|
101
85
|
|
|
102
|
-
|
|
103
|
-
- `KEIYAKU_TRACE.md`: round-by-round trace
|
|
104
|
-
- `KEIYAKU.draft.md`: optional recovery draft when start fails
|
|
105
|
-
- `.keiyaku/response/*.md`: persisted responses for `summon`, `drive`, and `ask`
|
|
106
|
-
- `.keiyaku/draft/*`: internal drafts (used for recovery and workflow safety)
|
|
86
|
+
要打分 (0–10),要宣誓。gate 是真的会拒绝你的。没检查就别来。
|
|
107
87
|
|
|
108
|
-
|
|
88
|
+
---
|
|
109
89
|
|
|
110
|
-
|
|
111
|
-
- `.keiyaku/response/`
|
|
90
|
+
**`status`** — 现在什么状态,什么在挡路。
|
|
112
91
|
|
|
113
|
-
|
|
92
|
+
**`help`** — 完整参考。
|
|
114
93
|
|
|
115
|
-
|
|
94
|
+
---
|
|
116
95
|
|
|
117
|
-
|
|
96
|
+
## 写进 repo 的东西
|
|
118
97
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
98
|
+
| 文件 | |
|
|
99
|
+
|------|--|
|
|
100
|
+
| `KEIYAKU.md` | 当前 contract |
|
|
101
|
+
| `KEIYAKU_TRACE.md` | 每轮记录 |
|
|
102
|
+
| `KEIYAKU.draft.md` | summon 失败时的恢复用 draft |
|
|
103
|
+
| `.keiyaku/response/*.md` | 每轮输出 |
|
|
122
104
|
|
|
123
|
-
|
|
105
|
+
不想 track 就加 `.gitignore`:
|
|
124
106
|
|
|
125
|
-
|
|
126
|
-
|
|
107
|
+
```gitignore
|
|
108
|
+
.keiyaku/draft/
|
|
109
|
+
.keiyaku/response/
|
|
110
|
+
```
|
|
127
111
|
|
|
128
|
-
|
|
112
|
+
---
|
|
129
113
|
|
|
130
|
-
|
|
131
|
-
- `KEIYAKU_FAKE_SUBAGENT`: `0` | `1` | `abort-wait` (stub subagent execution)
|
|
132
|
-
- `KEIYAKU_SUBAGENT_EXEC_TIMEOUT_MS`: total execution timeout for all providers
|
|
133
|
-
- `KEIYAKU_SUBAGENT_EXEC_IDLE_TIMEOUT_MS`: idle timeout for all providers, reset by subprocess output or streamed SDK events
|
|
114
|
+
## 进阶
|
|
134
115
|
|
|
135
|
-
|
|
116
|
+
```bash
|
|
117
|
+
keiyaku dump-env
|
|
118
|
+
```
|
|
136
119
|
|
|
137
|
-
|
|
138
|
-
|
|
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` | — | 空闲超时 |
|
|
126
|
+
| `KEIYAKU_INCREMENTAL_DIFF_MODE` | `targeted` | `targeted` \| `stat` \| `unified` |
|
|
127
|
+
| `KEIYAKU_FAKE_SUBAGENT` | `0` | `1` = 测试用 stub |
|
|
139
128
|
|
|
140
|
-
|
|
129
|
+
HTTP transport:
|
|
141
130
|
|
|
142
131
|
```bash
|
|
143
|
-
|
|
132
|
+
KEIYAKU_MCP_TRANSPORT=streamable-http \
|
|
133
|
+
KEIYAKU_MCP_HTTP_HOST=127.0.0.1 \
|
|
134
|
+
KEIYAKU_MCP_HTTP_PORT=3000 \
|
|
135
|
+
npx -y @astrosheep/keiyaku
|
|
144
136
|
```
|
|
145
137
|
|
|
146
|
-
|
|
138
|
+
---
|
|
147
139
|
|
|
148
140
|
MIT
|