@christang/keel 5.221.0 → 5.223.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/.claude-plugin/plugin.json +1 -1
- package/README.md +16 -7
- package/README.zh-CN.md +12 -6
- package/assets/bootstrap/AGENTS.md +1 -1
- package/bin/keel.js +16 -1
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/plugins/keel/.claude-plugin/plugin.json +1 -1
- package/plugins/keel/.codex-plugin/plugin.json +1 -1
- package/plugins/keel/commands/feedback.md +38 -0
- package/plugins/keel/scripts/pretooluse-guard.js +63 -13
- package/scripts/validation/common.py +2 -2
- package/scripts/validation/docs.py +2 -2
- package/scripts/validation/feedback.py +324 -0
- package/scripts/validation/guard.py +177 -0
- package/scripts/validation/hosts.py +1 -1
- package/scripts/validation/registry.py +11 -0
- package/src/core/config.js +23 -2
- package/src/core/feedback.js +286 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "keel",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.223.0",
|
|
4
4
|
"description": "Keel OpenSpec execution discipline: stateless continuity, task capsules, deterministic gates, and expectation alignment for Codex and Claude Code.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "TanglmChris",
|
package/README.md
CHANGED
|
@@ -183,7 +183,7 @@ model toward or away from using one (#414).
|
|
|
183
183
|
Do the spec work through OpenSpec's workflow skills (`openspec-propose`, `openspec-apply-change`,
|
|
184
184
|
`openspec-sync-specs`, `openspec-archive-change`); Keel generates them as skills only, with no OpenSpec
|
|
185
185
|
slash commands (#406). Keel's own commands and the skills a person can invoke are listed in
|
|
186
|
-
[docs/commands.md](docs/commands.md). Keel's gates run at the task boundaries. The whole loop:
|
|
186
|
+
[docs/commands.md](docs/commands.md). To report a problem with Keel from any project, run `/keel:feedback <one sentence>` or `keel feedback "<one sentence>"`: it drafts an issue for the Keel repository with the version, the failing command and its output (`--command`, `--output-file`, with `--expected`, `--repro` and `--impact` for the rest, and `--doctor` to attach the doctor output), redacts tokens, Slack IDs, e-mail addresses and local paths, lists similar open issues, and creates nothing until `--create` is run, which needs your approval (`--confirmed`) or a project that declares `issue:TanglmChris/keel`. Keel's gates run at the task boundaries. The whole loop:
|
|
187
187
|
|
|
188
188
|
```
|
|
189
189
|
keel --init → keel context → openspec-apply-change (tasks in order)
|
|
@@ -220,7 +220,7 @@ because a permission granted in conversation does not survive a context reset. D
|
|
|
220
220
|
`keel/config.yaml` instead:
|
|
221
221
|
|
|
222
222
|
```yaml
|
|
223
|
-
authorize: # accepted names: commit, push, push:<branch glob>[@<role>], release, archive, continuation, issue:<owner>/<repo>[@<role>], protocol-refresh, chat-reply:<group>[@<role>], issue-close:<owner>/<repo>[@<role>], cleanup:scratch[@<role>], push-protected:<branch glob>[@<role>], shift-restore, self-shift, delete-branch:merged[@<role>]
|
|
223
|
+
authorize: # accepted names: commit, push, push:<branch glob>[@<role>], release, archive, continuation, issue:<owner>/<repo>[@<role>], protocol-refresh, chat-reply:<group>[@<role>], issue-close:<owner>/<repo>[@<role>], cleanup:scratch[@<role>], push-protected:<branch glob>[@<role>], shift-restore, self-shift, delete-branch:merged[@<role>], push-tag:<tag glob>[@<role>]
|
|
224
224
|
- commit
|
|
225
225
|
- push
|
|
226
226
|
```
|
|
@@ -230,7 +230,7 @@ names `keel/config.yaml` as that entry's source so an inherited authorization is
|
|
|
230
230
|
for one the task decided. A task that authors its own boundary keeps it.
|
|
231
231
|
|
|
232
232
|
The ordinals below count names, not the forms in that comment: `push` and `push:<branch glob>` are
|
|
233
|
-
one name, so the vocabulary is
|
|
233
|
+
one name, so the vocabulary is fifteen names long and `continuation` is the fifth.
|
|
234
234
|
|
|
235
235
|
`continuation`, the fifth name, is accepted and changes nothing. Moving from a durably complete
|
|
236
236
|
task to the next unchecked task of the same change, inside a change whose `tasks.md` you approved,
|
|
@@ -244,7 +244,7 @@ nothing until corrected — fail-closed, never a silent grant.
|
|
|
244
244
|
|
|
245
245
|
`issue:<owner>/<repo>`, the sixth name, names the resource it reaches, and it is refused without
|
|
246
246
|
one; `chat-reply:<group>`, the eighth, `issue-close:<owner>/<repo>` and `cleanup:scratch`, the ninth
|
|
247
|
-
and tenth, `push-protected:<branch glob>`, the eleventh,
|
|
247
|
+
and tenth, `push-protected:<branch glob>`, the eleventh, `delete-branch:merged`, the fourteenth, and `push-tag:<tag glob>`, the fifteenth, are the others that do. The other names, `push` included, act on the checkout the declaration sits in, so each is already bounded by the repository you declared it in. The credentials that open an issue are not:
|
|
248
248
|
`gh` is account-wide, so a bare `issue` would reach every repository your account can touch —
|
|
249
249
|
silently the widest entry in the file, and wider than `push`. Naming the repository keeps the
|
|
250
250
|
grant the size of what it says. Keel carries that scope to `keel --doctor` and to the compiled
|
|
@@ -275,8 +275,17 @@ refused. A permission mode that cannot be relied on to ask, `bypassPermissions`
|
|
|
275
275
|
refused too. Declaring it turns the push check on by itself, and a bare `push` beside it is
|
|
276
276
|
refused.
|
|
277
277
|
|
|
278
|
-
|
|
279
|
-
|
|
278
|
+
`push-tag:<tag glob>`, optionally `@<role>`, lets a session push an explicit tag whose name the glob
|
|
279
|
+
matches (#499): `git push origin refs/tags/<name>`, `<src>:refs/tags/<name>` and `git push origin
|
|
280
|
+
tag <name>`. Without it the Claude write guard refuses every tag refspec as not a branch. A tag
|
|
281
|
+
outside the globs, or one a different role's entry covers, is refused naming `push-tag:` or that
|
|
282
|
+
role; the grant never asks. It changes nothing else: `--tags`, `--mirror`, `--follow-tags`,
|
|
283
|
+
`push.followTags` and deleting a tag keep their verdicts, and no branch grant carries tags. A
|
|
284
|
+
repository that declares only `push-tag:` limits tags and leaves branch pushes alone, and a bare
|
|
285
|
+
`push` beside it is allowed because it widens no branch.
|
|
286
|
+
|
|
287
|
+
Every scoped entry — `push:`, `issue:`, `issue-close:`, `cleanup:`, `chat-reply:`,
|
|
288
|
+
`push-protected:` and `push-tag:` — may end in `@<role>`, or a role pattern such as `@kaiwu-design-*`, where `*`
|
|
280
289
|
matches any run of role characters (#378). Such an entry reaches only a session whose chat role
|
|
281
290
|
matches. A session reads the grants for its own role in the capsule, `keel context`,
|
|
282
291
|
`keel --doctor` and its chat-reply groups, and `keel --doctor` lists, for each bound role, the
|
|
@@ -332,7 +341,7 @@ Three things the declaration is not:
|
|
|
332
341
|
anything.
|
|
333
342
|
- **Not a trigger.** It removes a confirmation, not the step that reaches the action. Nothing
|
|
334
343
|
schedules itself, and no next task is selected for you.
|
|
335
|
-
- **Not open-ended.** The
|
|
344
|
+
- **Not open-ended.** The fifteen names above are the whole vocabulary. An unrecognized entry is
|
|
336
345
|
reported with the accepted names and the declaration authorizes nothing until you fix it — a
|
|
337
346
|
typo never becomes a silent grant.
|
|
338
347
|
|
package/README.zh-CN.md
CHANGED
|
@@ -156,7 +156,7 @@ agent 复跑,也不引导模型去用或不用它(#414)。
|
|
|
156
156
|
|
|
157
157
|
spec 相关的活走 OpenSpec 的工作流 skill(`openspec-propose`、`openspec-apply-change`、`openspec-sync-specs`、
|
|
158
158
|
`openspec-archive-change`);Keel 只生成 skill,不生成 OpenSpec 斜杠命令(#406)。Keel 自己的命令和可以手动调用的技能列在
|
|
159
|
-
[docs/commands.zh-CN.md](docs/commands.zh-CN.md)
|
|
159
|
+
[docs/commands.zh-CN.md](docs/commands.zh-CN.md)。要在任何项目里反馈 Keel 的问题,运行 `/keel:feedback <一句话>` 或 `keel feedback "<一句话>"`:它给 Keel 仓库起草一份带版本、失败命令及其输出的 issue(`--command`、`--output-file`,其余用 `--expected`、`--repro`、`--impact`,`--doctor` 附上诊断输出),脱敏 token、Slack ID、邮箱和本机路径,列出相近的 issue,在运行 `--create` 之前不创建任何东西,而 `--create` 需要你的批准(`--confirmed`)或项目声明了 `issue:TanglmChris/keel`。Keel 的门禁在任务边界处运行。整个回路:
|
|
160
160
|
|
|
161
161
|
```
|
|
162
162
|
keel --init → keel context → openspec-apply-change(按顺序做 task)
|
|
@@ -188,7 +188,7 @@ Keel: add-user-auth#2.1 — next: task-start. Disposable projection; OpenSpec an
|
|
|
188
188
|
改为在 `keel/config.yaml` 里一次性声明:
|
|
189
189
|
|
|
190
190
|
```yaml
|
|
191
|
-
authorize: # accepted names: commit, push, push:<branch glob>[@<role>], release, archive, continuation, issue:<owner>/<repo>[@<role>], protocol-refresh, chat-reply:<group>[@<role>], issue-close:<owner>/<repo>[@<role>], cleanup:scratch[@<role>], push-protected:<branch glob>[@<role>], shift-restore, self-shift, delete-branch:merged[@<role>]
|
|
191
|
+
authorize: # accepted names: commit, push, push:<branch glob>[@<role>], release, archive, continuation, issue:<owner>/<repo>[@<role>], protocol-refresh, chat-reply:<group>[@<role>], issue-close:<owner>/<repo>[@<role>], cleanup:scratch[@<role>], push-protected:<branch glob>[@<role>], shift-restore, self-shift, delete-branch:merged[@<role>], push-tag:<tag glob>[@<role>]
|
|
192
192
|
- commit
|
|
193
193
|
- push
|
|
194
194
|
```
|
|
@@ -196,7 +196,7 @@ authorize: # accepted names: commit, push, push:<branch glob>[@<role>],
|
|
|
196
196
|
没有自己写 `Autonomy boundary:` 的 task 会继承这份声明,编译出的 capsule 会把 `keel/config.yaml`
|
|
197
197
|
标为该条目的来源,这样继承来的授权永远不会被误当成 task 自己做的决定。自己写了边界的 task 保留自己的边界。
|
|
198
198
|
|
|
199
|
-
下文的序数按名字计,不按上面注释里的写法计:`push` 和 `push:<branch glob>` 是同一个名字,所以词汇共
|
|
199
|
+
下文的序数按名字计,不按上面注释里的写法计:`push` 和 `push:<branch glob>` 是同一个名字,所以词汇共 15 个名字,
|
|
200
200
|
`continuation` 是第五个。
|
|
201
201
|
|
|
202
202
|
`continuation`(第五个名字)会被接受,但什么都不改变。在你批准过 `tasks.md` 的同一个 change 里,
|
|
@@ -207,7 +207,7 @@ authorize: # accepted names: commit, push, push:<branch glob>[@<role>],
|
|
|
207
207
|
任何东西——失败即关闭,绝不会悄悄放行。
|
|
208
208
|
|
|
209
209
|
`issue:<owner>/<repo>`(第六个名字)要写明它能触及的资源,不写就被拒绝;`chat-reply:<group>`(第八个)、
|
|
210
|
-
`issue-close:<owner>/<repo>` 和 `cleanup:scratch`(第九、第十个),`push-protected:<branch glob
|
|
210
|
+
`issue-close:<owner>/<repo>` 和 `cleanup:scratch`(第九、第十个),`push-protected:<branch glob>`(第十一个),`delete-branch:merged`(第十四个),以及 `push-tag:<tag glob>`(第十五个)
|
|
211
211
|
也同样要写。其余名字作用于声明所在的 checkout,所以天然被限定在你声明它的那个仓库里。开 issue 用的凭据却不是:
|
|
212
212
|
`gh` 是账号级的,一个裸的 `issue` 能触及你账号能碰到的每个仓库——悄无声息地成为文件里范围最大的条目,比 `push`
|
|
213
213
|
还大。写明仓库,授权的大小就和它字面说的一致。Keel 把这个范围带到 `keel --doctor` 和编译出的 capsule 里,
|
|
@@ -230,7 +230,13 @@ Claude 写入守卫返回 `ask`,于是 Claude Code 请你确认这一条命令
|
|
|
230
230
|
`push-protected:main@iecc-pm` 只让绑定到 `iecc-pm` 的会话得到询问;其他会话一律拒绝。无法保证会询问的权限模式
|
|
231
231
|
`bypassPermissions` 或 `dontAsk` 也被拒绝。声明它本身就会打开推送检查,而在它旁边写裸的 `push` 会被拒绝。
|
|
232
232
|
|
|
233
|
-
|
|
233
|
+
`push-tag:<tag glob>`(可带 `@<role>`)让会话推送名字匹配 glob 的显式标签(#499):`git push origin refs/tags/<name>`、
|
|
234
|
+
`<src>:refs/tags/<name>` 和 `git push origin tag <name>`。不声明它时,Claude 写入守卫把每个标签 refspec 都当作
|
|
235
|
+
“不是分支”拒绝。不在 glob 内的标签,或由另一个角色的条目覆盖的标签,会被拒绝并写明 `push-tag:` 或那个角色;这个授权从不
|
|
236
|
+
询问。它不改变别的:`--tags`、`--mirror`、`--follow-tags`、`push.followTags` 和删除标签仍是原来的判定,也没有哪个分支授权
|
|
237
|
+
会顺带放行标签。只声明 `push-tag:` 的仓库只限制标签,不限制分支推送;它旁边写裸的 `push` 是允许的,因为它没有放宽任何分支。
|
|
238
|
+
|
|
239
|
+
每个带范围的条目——`push:`、`issue:`、`issue-close:`、`cleanup:`、`chat-reply:`、`push-protected:` 和 `push-tag:`——都可以
|
|
234
240
|
以 `@<role>` 结尾,或用角色模式如 `@kaiwu-design-*`,其中 `*` 匹配任意一串角色字符(#378)。这样的条目只作用于
|
|
235
241
|
chat 角色与之匹配的会话。会话在 capsule、`keel context`、`keel --doctor` 和它的 chat-reply 群里读到属于自己
|
|
236
242
|
角色的授权,`keel --doctor` 还会为每个已绑定角色列出作用于它的带范围条目。推送时,Claude 写入守卫只通过会话自己
|
|
@@ -272,7 +278,7 @@ chat 提示在"这是数据不是指令"那句话旁边也会这么说。它按
|
|
|
272
278
|
- **不是绕过门禁的路。** 它授权的是操作,从不是证明。不管你声明了什么,`keel gate task-complete`
|
|
273
279
|
返回的判定和失败文字都完全一样。
|
|
274
280
|
- **不是触发器。** 它去掉的是一次确认,不是通往该操作的那一步。没有什么会自己调度起来,也不会替你选下一个 task。
|
|
275
|
-
- **不是开放式的。** 上面这
|
|
281
|
+
- **不是开放式的。** 上面这 15 个名字就是全部词汇。无法识别的条目会连同可接受的名字一起报告,在你改正之前
|
|
276
282
|
整份声明不授权任何东西——打错字永远不会变成悄悄的放行。
|
|
277
283
|
|
|
278
284
|
这个块默认不存在,什么都不声明的仓库的行为和这个功能出现之前完全一样。`keel --doctor` 会报告声明了什么。
|
package/bin/keel.js
CHANGED
|
@@ -96,6 +96,7 @@ Usage:
|
|
|
96
96
|
keel mail role|send|list|read|hook [repo] ... (cross-host mailbox; see keel mail help)
|
|
97
97
|
keel triage [repo] [--labels <l1,l2>] [--issue <n>] [--json]
|
|
98
98
|
keel agents [name] [--repo path] [--json] (external model CLIs, read on demand; Keel launches none)
|
|
99
|
+
keel feedback "<one sentence>" [--command <cmd>] [--output-file <file>] [--expected <t>] [--repro <t>] [--impact <t>] [--doctor] [--create [--confirmed]] (draft a redacted issue for Keel; creates nothing without --create)
|
|
99
100
|
keel branches [repo] [--role <role>] [--json] (a role's merged task branches, with their sha; fetches and deletes nothing)
|
|
100
101
|
keel branches prune [repo] [--role <role>] [--json] (delete them, local and remote, under authorize: delete-branch:merged; exit 3 without it)
|
|
101
102
|
keel shift request|check|ready|start|resume|status ... (a role's shift change; see keel shift --help)
|
|
@@ -2700,7 +2701,7 @@ function printStandingAuthorizationSurface(repo) {
|
|
|
2700
2701
|
// observes none that an agent runs, so the scope is a declaration carried to
|
|
2701
2702
|
// the people who read it rather than a boundary anything holds. A reader who
|
|
2702
2703
|
// took it for a sandbox would be relying on nothing.
|
|
2703
|
-
if ([...scopes.entries()].some(([action, scope]) => scope !== null && action !== "push" && action !== "push-protected")) {
|
|
2704
|
+
if ([...scopes.entries()].some(([action, scope]) => scope !== null && action !== "push" && action !== "push-protected" && action !== "push-tag")) {
|
|
2704
2705
|
printDoctorLine(
|
|
2705
2706
|
"scope",
|
|
2706
2707
|
"carried",
|
|
@@ -2736,6 +2737,16 @@ function printStandingAuthorizationSurface(repo) {
|
|
|
2736
2737
|
printDoctorLine("roles", name, reach.length ? reach.join(", ") : "no scoped grant");
|
|
2737
2738
|
}
|
|
2738
2739
|
}
|
|
2740
|
+
if (scopes.get("push-tag")) {
|
|
2741
|
+
printDoctorLine(
|
|
2742
|
+
"tag push",
|
|
2743
|
+
"enforced",
|
|
2744
|
+
"the Claude write guard enforces these globs: it allows a `git push` of "
|
|
2745
|
+
+ "an explicit tag only through them, and for a session of the role after `@`; "
|
|
2746
|
+
+ "`--tags`, `--follow-tags` and a tag deletion keep their verdicts; "
|
|
2747
|
+
+ "on Codex the scope is carried, not enforced"
|
|
2748
|
+
);
|
|
2749
|
+
}
|
|
2739
2750
|
if (scopes.get("push")) {
|
|
2740
2751
|
printDoctorLine(
|
|
2741
2752
|
"push scope",
|
|
@@ -3315,6 +3326,10 @@ function main() {
|
|
|
3315
3326
|
if (process.argv[2] === "tick") {
|
|
3316
3327
|
return require("../src/core/tick").runTick(process.argv.slice(3));
|
|
3317
3328
|
}
|
|
3329
|
+
// `keel feedback` likewise: a redacted issue draft for Keel (#505).
|
|
3330
|
+
if (process.argv[2] === "feedback") {
|
|
3331
|
+
return require("../src/core/feedback").runFeedback(process.argv.slice(3));
|
|
3332
|
+
}
|
|
3318
3333
|
if (process.argv[2] === "worktrees") {
|
|
3319
3334
|
return require("../src/core/worktrees").runWorktrees(process.argv.slice(3));
|
|
3320
3335
|
}
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@christang/keel",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.223.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@christang/keel",
|
|
9
|
-
"version": "5.
|
|
9
|
+
"version": "5.223.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@fission-ai/openspec": "^1.4.1"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "keel",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.223.0",
|
|
4
4
|
"description": "Keel OpenSpec execution discipline: stateless continuity, task capsules, deterministic gates, and expectation alignment for Codex and Claude Code.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "TanglmChris",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "keel",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.223.0",
|
|
4
4
|
"description": "Keel OpenSpec execution discipline: stateless continuity, task capsules, deterministic gates, and expectation alignment for Codex and Claude Code.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "TanglmChris",
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Draft a redacted issue for Keel from this session — version, reproduction, near-duplicates — and create it only after the user agrees
|
|
3
|
+
argument-hint: "<one sentence about the problem>"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
File feedback about Keel itself. The mechanism is `keel feedback`; this command only orders the steps and asks before anything is created. It works from any project, not only Keel's.
|
|
7
|
+
|
|
8
|
+
## 1. Draft
|
|
9
|
+
|
|
10
|
+
Take the problem from the arguments: `$ARGUMENTS`, or else ask for one sentence. If a Keel command just failed, pass it and its output so the issue carries them:
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
keel feedback "<one sentence>" --command "<the command that failed>" --output-file <file holding its output> --expected "<what should have happened>" --repro "<the steps>" --impact "<what it blocks>"
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Write the output to a file first and pass the file; do not paste it into the command line. Add `--doctor` only when the problem is about setup, because the doctor output carries local paths (they are redacted, but the user should know it is attached). Nothing is created by this step.
|
|
17
|
+
|
|
18
|
+
## 2. Show it
|
|
19
|
+
|
|
20
|
+
Show the user the whole draft as printed: title, sections, the count of redacted values, and any similar issues. Check it yourself for project content that should not be public — a customer name, an unreleased design — that the redaction cannot know, and fix it by rerunning with the text changed.
|
|
21
|
+
|
|
22
|
+
## 3. Ask
|
|
23
|
+
|
|
24
|
+
Ask through the structured-choice surface, with the first option recommended:
|
|
25
|
+
|
|
26
|
+
- **new issue** — create it now.
|
|
27
|
+
- **add to #n myself** — when a similar issue exists; print the `gh issue comment` command from the draft for the user to run. Keel runs no comment and edits no issue.
|
|
28
|
+
- **cancel** — leave the draft file where it is and stop.
|
|
29
|
+
|
|
30
|
+
## 4. Create, only on "new issue"
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
keel feedback "<the same arguments>" --create --confirmed
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Drop `--confirmed` only when this project's `keel/config.yaml` declares `issue:TanglmChris/keel`; the declaration is the owner's standing approval, and without it `--create` is refused. Add no label, assignee or milestone, and do not add the issue to any `triage:` list: whether it is worth doing stays the owner's decision.
|
|
37
|
+
|
|
38
|
+
Report the issue URL the command prints. If `gh` is missing or not logged in the command exits 4 with the draft saved: give the user the saved file and the `gh issue create` command it printed, and do not retry.
|
|
@@ -204,17 +204,19 @@ function gitOut(cwd, args) {
|
|
|
204
204
|
return result.status === 0 ? String(result.stdout || "").trim() : null;
|
|
205
205
|
}
|
|
206
206
|
|
|
207
|
-
// `push:` and `push-
|
|
208
|
-
// role pattern after `@` limits
|
|
207
|
+
// `push:`, `push-protected:` and `push-tag:` entries ({ glob, role }) of
|
|
208
|
+
// `authorize:`; a role pattern after `@` limits any of them to matching
|
|
209
|
+
// sessions (#378, #499).
|
|
209
210
|
function readPushGlobs(top) {
|
|
210
211
|
let text = "";
|
|
211
212
|
try {
|
|
212
213
|
text = fs.readFileSync(path.join(top, "keel", "config.yaml"), "utf8");
|
|
213
214
|
} catch {
|
|
214
|
-
return { globs: [], protectedEntries: [] };
|
|
215
|
+
return { globs: [], protectedEntries: [], tagEntries: [] };
|
|
215
216
|
}
|
|
216
217
|
const globs = [];
|
|
217
218
|
const protectedEntries = [];
|
|
219
|
+
const tagEntries = [];
|
|
218
220
|
let inBlock = false;
|
|
219
221
|
for (const line of text.split(/\r?\n/)) {
|
|
220
222
|
if (/^\s*#/.test(line) || line.trim() === "") continue;
|
|
@@ -229,8 +231,10 @@ function readPushGlobs(top) {
|
|
|
229
231
|
if (entry) globs.push({ glob: entry[1], role: entry[2] || null });
|
|
230
232
|
const guarded = bare.match(/^\s+-\s*push-protected:([^@\s]+)(?:@(\S+))?\s*$/);
|
|
231
233
|
if (guarded) protectedEntries.push({ glob: guarded[1], role: guarded[2] || null });
|
|
234
|
+
const tagged = bare.match(/^\s+-\s*push-tag:([^@\s]+)(?:@(\S+))?\s*$/);
|
|
235
|
+
if (tagged) tagEntries.push({ glob: tagged[1], role: tagged[2] || null });
|
|
232
236
|
}
|
|
233
|
-
return { globs, protectedEntries };
|
|
237
|
+
return { globs, protectedEntries, tagEntries };
|
|
234
238
|
}
|
|
235
239
|
|
|
236
240
|
// The chat role bound to the worktree at `top` (#245), for a role-limited
|
|
@@ -478,7 +482,9 @@ function pushDestination(dir) {
|
|
|
478
482
|
return remote ? rest.slice(remote.length + 1) : null;
|
|
479
483
|
}
|
|
480
484
|
|
|
481
|
-
// Target branches of one push,
|
|
485
|
+
// Target branches of one push, and the explicit tags it names (#499), or
|
|
486
|
+
// { undetermined: reason[, form] }. A tag is a target only when it is pushed:
|
|
487
|
+
// a deletion, a bulk push and a push carrying tags keep their verdicts.
|
|
482
488
|
function pushTargets(push) {
|
|
483
489
|
if (push.undetermined) return push;
|
|
484
490
|
// Whatever the refspec, the repository it pushes is unknown here (#486 D1).
|
|
@@ -533,7 +539,16 @@ function pushTargets(push) {
|
|
|
533
539
|
return branch ? { targets: [branch], tags } : { undetermined: "the branch has no configured push destination" };
|
|
534
540
|
}
|
|
535
541
|
const targets = [];
|
|
536
|
-
|
|
542
|
+
const tagTargets = [];
|
|
543
|
+
for (let k = 0; k < refspecs.length; k += 1) {
|
|
544
|
+
const raw = refspecs[k];
|
|
545
|
+
// git's `tag <name>` is `refs/tags/<name>:refs/tags/<name>`.
|
|
546
|
+
if (raw === "tag" && k + 1 < refspecs.length) {
|
|
547
|
+
k += 1;
|
|
548
|
+
if (deleting) return { undetermined: `\`tag ${refspecs[k]}\` is not a branch` };
|
|
549
|
+
tagTargets.push({ name: refspecs[k], raw: `tag ${refspecs[k]}` });
|
|
550
|
+
continue;
|
|
551
|
+
}
|
|
537
552
|
const spec = raw.replace(/^\+/, "");
|
|
538
553
|
let dst = spec;
|
|
539
554
|
if (!deleting && spec.includes(":")) dst = spec.slice(spec.indexOf(":") + 1);
|
|
@@ -544,10 +559,16 @@ function pushTargets(push) {
|
|
|
544
559
|
if (!dst) return { undetermined: "HEAD is detached" };
|
|
545
560
|
}
|
|
546
561
|
if (dst.startsWith("refs/heads/")) dst = dst.slice("refs/heads/".length);
|
|
547
|
-
else if (dst.startsWith("refs/")
|
|
562
|
+
else if (dst.startsWith("refs/tags/") && dst.length > "refs/tags/".length && !deleting && !spec.startsWith(":")) {
|
|
563
|
+
tagTargets.push({ name: dst.slice("refs/tags/".length), raw });
|
|
564
|
+
continue;
|
|
565
|
+
} else if (dst.startsWith("refs/")) return { undetermined: `\`${raw}\` is not a branch` };
|
|
548
566
|
targets.push(dst);
|
|
549
567
|
}
|
|
550
|
-
|
|
568
|
+
// A push that also carries tags by itself keeps the verdict it had: the
|
|
569
|
+
// grant names the tags a push sends, and this one sends more (#327).
|
|
570
|
+
if (tags && tagTargets.length) return { undetermined: `\`${tagTargets[0].raw}\` is not a branch` };
|
|
571
|
+
return { targets, tagTargets, tags };
|
|
551
572
|
}
|
|
552
573
|
|
|
553
574
|
function checkPushes(event) {
|
|
@@ -560,11 +581,15 @@ function checkPushes(event) {
|
|
|
560
581
|
for (const push of findPushes(command, cwd)) {
|
|
561
582
|
const top = gitOut(push.dir || cwd, ["rev-parse", "--show-toplevel"]);
|
|
562
583
|
if (!top) continue;
|
|
563
|
-
const { globs, protectedEntries } = readPushGlobs(top);
|
|
564
|
-
if (!globs.length && !protectedEntries.length) continue;
|
|
584
|
+
const { globs, protectedEntries, tagEntries } = readPushGlobs(top);
|
|
585
|
+
if (!globs.length && !protectedEntries.length && !tagEntries.length) continue;
|
|
586
|
+
// Branches are limited by `push:` and `push-protected:` alone: a repository
|
|
587
|
+
// declaring only tag grants leaves branch pushes alone (#499 D4).
|
|
588
|
+
const branchesLimited = globs.length > 0 || protectedEntries.length > 0;
|
|
565
589
|
const declared = [
|
|
566
590
|
...globs.map((e) => `\`push:${e.glob}${e.role ? `@${e.role}` : ""}\``),
|
|
567
591
|
...protectedEntries.map((e) => `\`push-protected:${e.glob}${e.role ? `@${e.role}` : ""}\``),
|
|
592
|
+
...tagEntries.map((e) => `\`push-tag:${e.glob}${e.role ? `@${e.role}` : ""}\``),
|
|
568
593
|
].join(", ");
|
|
569
594
|
const result = pushTargets(push);
|
|
570
595
|
if (result.form) {
|
|
@@ -583,6 +608,15 @@ function checkPushes(event) {
|
|
|
583
608
|
);
|
|
584
609
|
return 0;
|
|
585
610
|
}
|
|
611
|
+
// No tag grant is declared: an explicit tag is, as before, not a branch.
|
|
612
|
+
if (!tagEntries.length && result.tagTargets && result.tagTargets.length) {
|
|
613
|
+
deny(
|
|
614
|
+
`Keel push guard: keel/config.yaml limits push to ${declared}, and the `
|
|
615
|
+
+ `guard cannot tell which branch this push targets: \`${result.tagTargets[0].raw}\` is not a branch. `
|
|
616
|
+
+ `Name the branch, as ${EXPLICIT_FORM}.`
|
|
617
|
+
);
|
|
618
|
+
return 0;
|
|
619
|
+
}
|
|
586
620
|
// A push carrying tags passes on no `push:` glob; only a protected
|
|
587
621
|
// branch's ask can carry it, so each branch must be a protected one.
|
|
588
622
|
if (result.tags && !result.targets.every((b) => protectedEntries.some((e) => globPattern(e.glob).test(b)))) {
|
|
@@ -597,9 +631,25 @@ function checkPushes(event) {
|
|
|
597
631
|
let role;
|
|
598
632
|
const roleOf = () => (role === undefined ? (role = sessionRole(top)) : role);
|
|
599
633
|
const mine = (e) => !e.role || roleMatches(e.role, roleOf());
|
|
600
|
-
const
|
|
601
|
-
|
|
602
|
-
|
|
634
|
+
for (const tag of result.tagTargets || []) {
|
|
635
|
+
if (tagEntries.some((e) => mine(e) && globPattern(e.glob).test(tag.name))) continue;
|
|
636
|
+
// Another role's grant (#378): name who may push it.
|
|
637
|
+
const theirs = tagEntries.filter((e) => e.role && globPattern(e.glob).test(tag.name)).map((e) => e.role);
|
|
638
|
+
deny(
|
|
639
|
+
theirs.length
|
|
640
|
+
? `Keel push guard: tag \`${tag.name}\` may be pushed by role ${theirs.join(" or ")} (keel/config.yaml `
|
|
641
|
+
+ `push-tag), and this session is ${roleOf() ? `role ${roleOf()}` : "bound to no chat role"}.`
|
|
642
|
+
: `Keel push guard: this command pushes tag \`${tag.name}\`, and keel/config.yaml grants tags only through `
|
|
643
|
+
+ `${tagEntries.map((e) => `\`push-tag:${e.glob}${e.role ? `@${e.role}` : ""}\``).join(", ")}. `
|
|
644
|
+
+ "Push a matching tag, or ask the owner; the declaration is theirs to widen."
|
|
645
|
+
);
|
|
646
|
+
return 0;
|
|
647
|
+
}
|
|
648
|
+
const unlisted = !branchesLimited
|
|
649
|
+
? []
|
|
650
|
+
: result.tags
|
|
651
|
+
? result.targets
|
|
652
|
+
: result.targets.filter((branch) => !globs.some((e) => mine(e) && globPattern(e.glob).test(branch)));
|
|
603
653
|
const outside = [];
|
|
604
654
|
for (const branch of unlisted) {
|
|
605
655
|
const entry = protectedEntries.find((e) => globPattern(e.glob).test(branch));
|
|
@@ -35,10 +35,10 @@ os.environ["KEEL_UPDATE_CLAUDE"] = str(Path(tempfile.gettempdir()) / "keel-suite
|
|
|
35
35
|
os.environ["KEEL_UPDATE_CODEX"] = str(Path(tempfile.gettempdir()) / "keel-suite-has-no-codex")
|
|
36
36
|
|
|
37
37
|
|
|
38
|
-
PACKAGE_VERSION = "5.
|
|
38
|
+
PACKAGE_VERSION = "5.223.0"
|
|
39
39
|
|
|
40
40
|
|
|
41
|
-
PROTOCOL_VERSION = "5.
|
|
41
|
+
PROTOCOL_VERSION = "5.223.0"
|
|
42
42
|
|
|
43
43
|
|
|
44
44
|
LEGACY_MANAGED_START = "<!-- keel:start version=2.1 -->"
|
|
@@ -613,7 +613,7 @@ ACCEPTED_AUTHORIZE_NAMES = (
|
|
|
613
613
|
"commit, push, push:<branch glob>[@<role>], release, archive, continuation, "
|
|
614
614
|
"issue:<owner>/<repo>[@<role>], protocol-refresh, chat-reply:<group>[@<role>], "
|
|
615
615
|
"issue-close:<owner>/<repo>[@<role>], cleanup:scratch[@<role>], push-protected:<branch glob>[@<role>], shift-restore, self-shift, "
|
|
616
|
-
"delete-branch:merged[@<role>]"
|
|
616
|
+
"delete-branch:merged[@<role>], push-tag:<tag glob>[@<role>]"
|
|
617
617
|
)
|
|
618
618
|
|
|
619
619
|
|
|
@@ -641,7 +641,7 @@ def validate_continuation_docs_scenario() -> int:
|
|
|
641
641
|
# to spell all of it: a reader copies from the list they are shown.
|
|
642
642
|
for needle in (
|
|
643
643
|
f"accepted names: {ACCEPTED_AUTHORIZE_NAMES}",
|
|
644
|
-
"The
|
|
644
|
+
"The fifteen names above are the whole vocabulary.",
|
|
645
645
|
"`protocol-refresh`, the seventh name",
|
|
646
646
|
):
|
|
647
647
|
if needle not in readme:
|