@christang/keel 5.221.0 → 5.222.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 +15 -6
- package/README.zh-CN.md +11 -5
- package/assets/bootstrap/AGENTS.md +1 -1
- package/bin/keel.js +11 -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/scripts/pretooluse-guard.js +63 -13
- package/scripts/validation/common.py +2 -2
- package/scripts/validation/docs.py +2 -2
- package/scripts/validation/guard.py +177 -0
- package/scripts/validation/registry.py +4 -0
- package/src/core/config.js +23 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "keel",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.222.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
|
@@ -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
|
@@ -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
|
@@ -2700,7 +2700,7 @@ function printStandingAuthorizationSurface(repo) {
|
|
|
2700
2700
|
// observes none that an agent runs, so the scope is a declaration carried to
|
|
2701
2701
|
// the people who read it rather than a boundary anything holds. A reader who
|
|
2702
2702
|
// took it for a sandbox would be relying on nothing.
|
|
2703
|
-
if ([...scopes.entries()].some(([action, scope]) => scope !== null && action !== "push" && action !== "push-protected")) {
|
|
2703
|
+
if ([...scopes.entries()].some(([action, scope]) => scope !== null && action !== "push" && action !== "push-protected" && action !== "push-tag")) {
|
|
2704
2704
|
printDoctorLine(
|
|
2705
2705
|
"scope",
|
|
2706
2706
|
"carried",
|
|
@@ -2736,6 +2736,16 @@ function printStandingAuthorizationSurface(repo) {
|
|
|
2736
2736
|
printDoctorLine("roles", name, reach.length ? reach.join(", ") : "no scoped grant");
|
|
2737
2737
|
}
|
|
2738
2738
|
}
|
|
2739
|
+
if (scopes.get("push-tag")) {
|
|
2740
|
+
printDoctorLine(
|
|
2741
|
+
"tag push",
|
|
2742
|
+
"enforced",
|
|
2743
|
+
"the Claude write guard enforces these globs: it allows a `git push` of "
|
|
2744
|
+
+ "an explicit tag only through them, and for a session of the role after `@`; "
|
|
2745
|
+
+ "`--tags`, `--follow-tags` and a tag deletion keep their verdicts; "
|
|
2746
|
+
+ "on Codex the scope is carried, not enforced"
|
|
2747
|
+
);
|
|
2748
|
+
}
|
|
2739
2749
|
if (scopes.get("push")) {
|
|
2740
2750
|
printDoctorLine(
|
|
2741
2751
|
"push scope",
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@christang/keel",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.222.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.222.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.222.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.222.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",
|
|
@@ -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.222.0"
|
|
39
39
|
|
|
40
40
|
|
|
41
|
-
PROTOCOL_VERSION = "5.
|
|
41
|
+
PROTOCOL_VERSION = "5.222.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:
|
|
@@ -1129,6 +1129,58 @@ def validate_push_protected_declaration_scenario() -> int:
|
|
|
1129
1129
|
return 0
|
|
1130
1130
|
|
|
1131
1131
|
|
|
1132
|
+
def validate_push_tag_declaration_scenario() -> int:
|
|
1133
|
+
"""Issue #499: `push-tag:<glob>[@<role>]` is accepted, reported and enforced by name."""
|
|
1134
|
+
label = "push-tag-declaration:"
|
|
1135
|
+
with tempfile.TemporaryDirectory(prefix="keel-push-tag-decl-") as raw_tmp:
|
|
1136
|
+
root = Path(raw_tmp)
|
|
1137
|
+
|
|
1138
|
+
def fixture(name: str, entries: list[str]) -> Path:
|
|
1139
|
+
repo = root / name
|
|
1140
|
+
repo.mkdir()
|
|
1141
|
+
write_authorize_config(repo, "authorize:\n" + "".join(f" - {e}\n" for e in entries))
|
|
1142
|
+
return repo
|
|
1143
|
+
|
|
1144
|
+
doctor = run_keel(fixture("good", ["push-tag:v*", "push-tag:cbb-parked-*@kaiwu-pm-cbb"]), "--doctor")
|
|
1145
|
+
if doctor.returncode != 0:
|
|
1146
|
+
report(f"{label} doctor failed on a valid declaration: {doctor.stdout}{doctor.stderr}")
|
|
1147
|
+
return 1
|
|
1148
|
+
line = next((l for l in doctor.stdout.splitlines() if l.strip().startswith("push-tag:")), "")
|
|
1149
|
+
for needle in ("authorized", "v*"):
|
|
1150
|
+
if needle not in line:
|
|
1151
|
+
report(f"{label} doctor's push-tag line lacks {needle!r}: {line!r}")
|
|
1152
|
+
report(doctor.stdout)
|
|
1153
|
+
return 1
|
|
1154
|
+
if "push-tag:cbb-parked-*@kaiwu-pm-cbb" not in doctor.stdout:
|
|
1155
|
+
report(f"{label} doctor does not name the role-limited entry: {doctor.stdout}")
|
|
1156
|
+
return 1
|
|
1157
|
+
tag_line = next((l for l in doctor.stdout.splitlines() if l.strip().startswith("tag push:")), "")
|
|
1158
|
+
if "write guard enforces" not in tag_line:
|
|
1159
|
+
report(f"{label} doctor's tag push line does not say the guard enforces it: {tag_line!r}")
|
|
1160
|
+
return 1
|
|
1161
|
+
if "does not enforce" in doctor.stdout:
|
|
1162
|
+
report(f"{label} doctor calls the tag scope carried and not enforced: {doctor.stdout}")
|
|
1163
|
+
return 1
|
|
1164
|
+
beside = run_keel(fixture("beside-push", ["push", "push-tag:v*"]), "--doctor")
|
|
1165
|
+
if beside.returncode != 0:
|
|
1166
|
+
report(f"{label} a bare push beside push-tag:v* was refused: {beside.stdout}{beside.stderr}")
|
|
1167
|
+
return 1
|
|
1168
|
+
for name, entries in (
|
|
1169
|
+
("bare", ["push-tag"]),
|
|
1170
|
+
("bad-glob", ["push-tag:v$"]),
|
|
1171
|
+
("bad-role", ["push-tag:v*@Not"]),
|
|
1172
|
+
):
|
|
1173
|
+
refused = run_keel(fixture(name, entries), "--doctor")
|
|
1174
|
+
if refused.returncode == 0:
|
|
1175
|
+
report(f"{label} {entries!r} was accepted.")
|
|
1176
|
+
return 1
|
|
1177
|
+
if "push-tag:<tag glob>" not in refused.stdout + refused.stderr:
|
|
1178
|
+
report(f"{label} {entries!r} was refused without naming the form: {refused.stdout}")
|
|
1179
|
+
return 1
|
|
1180
|
+
report("push-tag-declaration scenario passed.")
|
|
1181
|
+
return 0
|
|
1182
|
+
|
|
1183
|
+
|
|
1132
1184
|
def validate_authorize_push_close_cleanup_scenario() -> int:
|
|
1133
1185
|
"""Issue #257: `push:<glob>`, `issue-close:<owner>/<repo>`, `cleanup:scratch`.
|
|
1134
1186
|
|
|
@@ -4263,6 +4315,131 @@ def validate_push_guard_follow_tags_scenario() -> int:
|
|
|
4263
4315
|
return 0
|
|
4264
4316
|
|
|
4265
4317
|
|
|
4318
|
+
@contextlib.contextmanager
|
|
4319
|
+
def push_tag_session(prefix: str):
|
|
4320
|
+
"""Issue #499: two worktrees bound to roles, and the real hook run against them.
|
|
4321
|
+
|
|
4322
|
+
Yields `(pm, rtl, declare, expect)`. `pm` is bound to `kaiwu-pm-cbb` and `rtl`
|
|
4323
|
+
to `rtl`; `declare` writes an `authorize:` block into both; `expect` runs the
|
|
4324
|
+
real PreToolUse hook and checks the verdict and the words it names.
|
|
4325
|
+
"""
|
|
4326
|
+
with tempfile.TemporaryDirectory(prefix=prefix) as raw:
|
|
4327
|
+
base = Path(raw)
|
|
4328
|
+
repo = mailbox_repository(base / "repo")
|
|
4329
|
+
pm = chat_worktree(repo, base / "pm")
|
|
4330
|
+
rtl = chat_worktree(repo, base / "rtl")
|
|
4331
|
+
env = chat_environment()
|
|
4332
|
+
run_keel(pm, "chat", "role", "--set", "kaiwu-pm-cbb", env=env)
|
|
4333
|
+
run_keel(rtl, "chat", "role", "--set", "rtl", env=env)
|
|
4334
|
+
hook_env = {
|
|
4335
|
+
k: v for k, v in os.environ.items()
|
|
4336
|
+
if k not in ("KEEL_CHAT_ROLE", "KEEL_MAIL_ROLE") and not k.startswith("GIT_CONFIG")
|
|
4337
|
+
}
|
|
4338
|
+
hook_env["CLAUDE_PLUGIN_ROOT"] = str(ROOT / PLUGIN_ROOT)
|
|
4339
|
+
|
|
4340
|
+
def declare(entries: list[str]) -> None:
|
|
4341
|
+
for cwd in (pm, rtl):
|
|
4342
|
+
write_authorize_config(cwd, "authorize:\n" + "".join(f" - {e}\n" for e in entries))
|
|
4343
|
+
|
|
4344
|
+
def expect(label: str, what: str, cwd: Path, command: str, want: str, needles: tuple[str, ...] = ()) -> bool:
|
|
4345
|
+
event = {"tool_name": "Bash", "tool_input": {"command": command}, "cwd": str(cwd), "permission_mode": "default"}
|
|
4346
|
+
result = subprocess.run(
|
|
4347
|
+
["node", str(ROOT / PLUGIN_ROOT / "scripts/pretooluse-guard.js")],
|
|
4348
|
+
cwd=cwd, env=hook_env, input=json.dumps(event), text=True, capture_output=True, check=False,
|
|
4349
|
+
)
|
|
4350
|
+
decision = pretooluse_decision(result) or {"permissionDecision": "pass"}
|
|
4351
|
+
if decision.get("permissionDecision") != want:
|
|
4352
|
+
verdict = "allowed" if decision.get("permissionDecision") == "pass" else decision.get("permissionDecision")
|
|
4353
|
+
report(f"{label} {what} was {verdict}, not {want} ({command!r}): {decision!r}")
|
|
4354
|
+
return False
|
|
4355
|
+
reason = decision.get("permissionDecisionReason", "")
|
|
4356
|
+
for needle in needles:
|
|
4357
|
+
if needle not in reason:
|
|
4358
|
+
report(f"{label} {what} does not name {needle!r}: {reason!r}")
|
|
4359
|
+
return False
|
|
4360
|
+
return True
|
|
4361
|
+
|
|
4362
|
+
yield pm, rtl, declare, expect
|
|
4363
|
+
|
|
4364
|
+
|
|
4365
|
+
def validate_push_tag_grant_scenario() -> int:
|
|
4366
|
+
"""Issue #499: a granted role pushes a granted tag; nobody else pushes it."""
|
|
4367
|
+
label = "push-tag-grant:"
|
|
4368
|
+
with push_tag_session("keel-push-tag-grant-") as (pm, rtl, declare, expect):
|
|
4369
|
+
declare(["push-tag:cbb-parked-*@kaiwu-pm-cbb"])
|
|
4370
|
+
granted = (
|
|
4371
|
+
("an explicit refs/tags refspec", "git push origin refs/tags/cbb-parked-1101-design"),
|
|
4372
|
+
("the `tag <name>` form", "git push origin tag cbb-parked-1101-design"),
|
|
4373
|
+
("HEAD to a new tag", "git push origin HEAD:refs/tags/cbb-parked-1101-verify"),
|
|
4374
|
+
("a tag to the same tag", "git push origin refs/tags/cbb-parked-1101-design:refs/tags/cbb-parked-1101-design"),
|
|
4375
|
+
)
|
|
4376
|
+
for what, command in granted:
|
|
4377
|
+
if not expect(label, f"the granted role's push of {what}", pm, command, "pass"):
|
|
4378
|
+
return 1
|
|
4379
|
+
if not expect(label, "another role's push of a granted tag", rtl,
|
|
4380
|
+
"git push origin refs/tags/cbb-parked-1101-design", "deny", ("kaiwu-pm-cbb",)):
|
|
4381
|
+
return 1
|
|
4382
|
+
if not expect(label, "the granted role's push of a tag outside the glob", pm,
|
|
4383
|
+
"git push origin refs/tags/other-1", "deny", ("push-tag:",)):
|
|
4384
|
+
return 1
|
|
4385
|
+
report("push-tag-grant scenario passed.")
|
|
4386
|
+
return 0
|
|
4387
|
+
|
|
4388
|
+
|
|
4389
|
+
def validate_push_tag_branches_scenario() -> int:
|
|
4390
|
+
"""Issue #499: a tag beside a branch is judged by its own rule, and a tag-only
|
|
4391
|
+
declaration leaves branch pushes alone."""
|
|
4392
|
+
label = "push-tag-branches:"
|
|
4393
|
+
with push_tag_session("keel-push-tag-branches-") as (pm, rtl, declare, expect):
|
|
4394
|
+
declare(["push:claude/*", "push-tag:v*"])
|
|
4395
|
+
if not expect(label, "a granted branch and a granted tag together", rtl,
|
|
4396
|
+
"git push origin claude/x refs/tags/v1", "pass"):
|
|
4397
|
+
return 1
|
|
4398
|
+
if not expect(label, "an ungranted branch beside a granted tag", rtl,
|
|
4399
|
+
"git push origin main refs/tags/v1", "deny", ("`main`",)):
|
|
4400
|
+
return 1
|
|
4401
|
+
if not expect(label, "a granted branch beside an ungranted tag", rtl,
|
|
4402
|
+
"git push origin claude/x refs/tags/w1", "deny", ("push-tag:",)):
|
|
4403
|
+
return 1
|
|
4404
|
+
declare(["push-tag:v*"])
|
|
4405
|
+
if not expect(label, "a branch push when only tags are declared", rtl, "git push origin feature-1", "pass"):
|
|
4406
|
+
return 1
|
|
4407
|
+
if not expect(label, "a granted tag when only tags are declared", rtl, "git push origin refs/tags/v1", "pass"):
|
|
4408
|
+
return 1
|
|
4409
|
+
if not expect(label, "an ungranted tag when only tags are declared", rtl,
|
|
4410
|
+
"git push origin refs/tags/w1", "deny", ("push-tag:",)):
|
|
4411
|
+
return 1
|
|
4412
|
+
declare(["push-protected:main", "push-tag:v*"])
|
|
4413
|
+
if not expect(label, "a protected branch with a granted tag", rtl, "git push origin main refs/tags/v1", "ask",
|
|
4414
|
+
("`main`",)):
|
|
4415
|
+
return 1
|
|
4416
|
+
report("push-tag-branches scenario passed.")
|
|
4417
|
+
return 0
|
|
4418
|
+
|
|
4419
|
+
|
|
4420
|
+
def validate_push_tag_keeps_verdicts_scenario() -> int:
|
|
4421
|
+
"""Issue #499: the tag grant changes nothing about bulk tag pushes, deletions
|
|
4422
|
+
or a repository without the grant."""
|
|
4423
|
+
label = "push-tag-keeps-verdicts:"
|
|
4424
|
+
with push_tag_session("keel-push-tag-verdicts-") as (pm, rtl, declare, expect):
|
|
4425
|
+
declare(["push:claude/*", "push-tag:cbb-parked-*"])
|
|
4426
|
+
for what, command, needles in (
|
|
4427
|
+
("--tags", "git push --tags origin", ("--tags",)),
|
|
4428
|
+
("--mirror", "git push --mirror origin", ("--mirror",)),
|
|
4429
|
+
("--follow-tags to an unprotected branch", "git push --follow-tags origin claude/x", ("--no-follow-tags",)),
|
|
4430
|
+
("--delete of a granted tag", "git push origin --delete refs/tags/cbb-parked-1101-design", ("is not a branch",)),
|
|
4431
|
+
("a colon refspec deleting a granted tag", "git push origin :refs/tags/cbb-parked-1101-design", ("is not a branch",)),
|
|
4432
|
+
):
|
|
4433
|
+
if not expect(label, f"a push with {what}", rtl, command, "deny", needles):
|
|
4434
|
+
return 1
|
|
4435
|
+
declare(["push:claude/*"])
|
|
4436
|
+
if not expect(label, "an explicit tag with no tag grant declared", rtl,
|
|
4437
|
+
"git push origin refs/tags/v1", "deny", ("is not a branch",)):
|
|
4438
|
+
return 1
|
|
4439
|
+
report("push-tag-keeps-verdicts scenario passed.")
|
|
4440
|
+
return 0
|
|
4441
|
+
|
|
4442
|
+
|
|
4266
4443
|
def validate_touch_write_guard_scenario() -> int:
|
|
4267
4444
|
with tempfile.TemporaryDirectory(
|
|
4268
4445
|
prefix="keel-touch-guard-", ignore_cleanup_errors=True
|
|
@@ -228,6 +228,7 @@ SCENARIOS: tuple = (
|
|
|
228
228
|
),
|
|
229
229
|
("authorize-push-close-cleanup", guard.validate_authorize_push_close_cleanup_scenario),
|
|
230
230
|
("push-protected-declaration", guard.validate_push_protected_declaration_scenario),
|
|
231
|
+
("push-tag-declaration", guard.validate_push_tag_declaration_scenario),
|
|
231
232
|
("authorize-block-reads-every-line", guard.validate_authorize_block_reads_every_line_scenario),
|
|
232
233
|
(
|
|
233
234
|
"standing-authorization-sync-confusion",
|
|
@@ -531,6 +532,9 @@ SCENARIOS: tuple = (
|
|
|
531
532
|
("push-guard-cd-before-push", guard.validate_push_guard_cd_before_push_scenario),
|
|
532
533
|
("push-guard-redirects", guard.validate_push_guard_redirects_scenario),
|
|
533
534
|
("push-guard-follow-tags", guard.validate_push_guard_follow_tags_scenario),
|
|
535
|
+
("push-tag-grant", guard.validate_push_tag_grant_scenario),
|
|
536
|
+
("push-tag-branches", guard.validate_push_tag_branches_scenario),
|
|
537
|
+
("push-tag-keeps-verdicts", guard.validate_push_tag_keeps_verdicts_scenario),
|
|
534
538
|
("push-protected-guard", guard.validate_push_protected_guard_scenario),
|
|
535
539
|
("authorize-role-scoped", guard.validate_authorize_role_scoped_scenario),
|
|
536
540
|
("touch-guard-record-layer", guard.validate_touch_guard_record_layer_scenario),
|
package/src/core/config.js
CHANGED
|
@@ -44,6 +44,11 @@ const STANDING_AUTHORIZATION_ACTIONS = [
|
|
|
44
44
|
// through `keel branches prune` (#469). Its one scope, `merged`, says which
|
|
45
45
|
// branches it reaches; each deletion is recorded with its sha first.
|
|
46
46
|
"delete-branch",
|
|
47
|
+
// Pushing an explicit tag whose name matches the glob, which the Claude
|
|
48
|
+
// write guard otherwise refuses as not a branch (#499); `@<role>` limits who
|
|
49
|
+
// may. It grants no bulk tag push and no tag deletion, and it widens no
|
|
50
|
+
// branch, so a bare `push` beside it is not a mixed declaration.
|
|
51
|
+
"push-tag",
|
|
47
52
|
];
|
|
48
53
|
|
|
49
54
|
// The actions whose credential reaches further than the checkout the
|
|
@@ -53,7 +58,7 @@ const STANDING_AUTHORIZATION_ACTIONS = [
|
|
|
53
58
|
// actions are declared with the resource they may reach and refused bare —
|
|
54
59
|
// accepting the bare form as a convenience would make the narrow form optional
|
|
55
60
|
// and the wide one the default, which is the decision inverted.
|
|
56
|
-
const SCOPED_AUTHORIZATION_ACTIONS = new Set(["issue", "chat-reply", "issue-close", "cleanup", "push-protected", "delete-branch"]);
|
|
61
|
+
const SCOPED_AUTHORIZATION_ACTIONS = new Set(["issue", "chat-reply", "issue-close", "cleanup", "push-protected", "delete-branch", "push-tag"]);
|
|
57
62
|
|
|
58
63
|
// Actions whose scope narrows them but is not required (#257). A bare `push`
|
|
59
64
|
// keeps the meaning it always had; `push:<branch glob>` limits it to matching
|
|
@@ -79,6 +84,8 @@ const AUTHORIZATION_SCOPES = {
|
|
|
79
84
|
// `**` across them, as Touch globs do.
|
|
80
85
|
push: { form: "<branch glob>", pattern: /^[A-Za-z0-9._/*-]+$/ },
|
|
81
86
|
"push-protected": { form: "<branch glob>", pattern: /^[A-Za-z0-9._/*-]+$/ },
|
|
87
|
+
// Tag-name characters and `*`, which matches within one `/` segment.
|
|
88
|
+
"push-tag": { form: "<tag glob>", pattern: /^[A-Za-z0-9._/*-]+$/ },
|
|
82
89
|
};
|
|
83
90
|
|
|
84
91
|
// `@<role pattern>` after any scope (#378): chat-role characters and `*`,
|
|
@@ -359,6 +366,14 @@ function standingAuthorizationUnknownMessage(unknown, problems = []) {
|
|
|
359
366
|
);
|
|
360
367
|
continue;
|
|
361
368
|
}
|
|
369
|
+
if (problem.action === "push-tag") {
|
|
370
|
+
notes.push(
|
|
371
|
+
`\`${problem.entry}\` is not \`push-tag:<tag glob>\` or \`push-tag:<tag glob>@<role>\` — `
|
|
372
|
+
+ "a glob of letters, digits, `.`, `_`, `-`, `/`, and `*`, and a chat role of lowercase "
|
|
373
|
+
+ "letters, digits, and hyphens. It takes a tag glob because a tag push is granted by name."
|
|
374
|
+
);
|
|
375
|
+
continue;
|
|
376
|
+
}
|
|
362
377
|
if (problem.action === "push") {
|
|
363
378
|
notes.push(
|
|
364
379
|
`\`${problem.entry}\` does not name a branch glob as \`push:<branch glob>\` — `
|
|
@@ -446,6 +461,7 @@ function readStandingAuthorization(repo, options = {}) {
|
|
|
446
461
|
// author believes they granted the typo too.
|
|
447
462
|
const pushGlobs = [];
|
|
448
463
|
const protectedPushes = [];
|
|
464
|
+
const pushTags = [];
|
|
449
465
|
for (const entry of declared) {
|
|
450
466
|
const classified = classifyAuthorizationEntry(entry);
|
|
451
467
|
if (classified.action === "push" && classified.scope !== null && !pushGlobs.includes(classified.scope)) {
|
|
@@ -454,6 +470,9 @@ function readStandingAuthorization(repo, options = {}) {
|
|
|
454
470
|
if (classified.action === "push-protected" && !protectedPushes.includes(classified.scope)) {
|
|
455
471
|
protectedPushes.push(classified.scope);
|
|
456
472
|
}
|
|
473
|
+
if (classified.action === "push-tag" && !pushTags.includes(classified.scope)) {
|
|
474
|
+
pushTags.push(classified.scope);
|
|
475
|
+
}
|
|
457
476
|
}
|
|
458
477
|
const anyScopedPush = entries.some((e) => (e.action === "push" && e.scope !== null) || e.action === "push-protected");
|
|
459
478
|
if (anyScopedPush && declared.includes("push")) {
|
|
@@ -470,6 +489,7 @@ function readStandingAuthorization(repo, options = {}) {
|
|
|
470
489
|
chatReplyGroups: [],
|
|
471
490
|
pushGlobs: [],
|
|
472
491
|
protectedPushes: [],
|
|
492
|
+
pushTags: [],
|
|
473
493
|
otherRoles: [],
|
|
474
494
|
entries: [],
|
|
475
495
|
role,
|
|
@@ -480,7 +500,8 @@ function readStandingAuthorization(repo, options = {}) {
|
|
|
480
500
|
if (chatReplyGroups.length) scopes.set("chat-reply", chatReplyGroups.join(", "));
|
|
481
501
|
if (pushGlobs.length) scopes.set("push", pushGlobs.join(", "));
|
|
482
502
|
if (protectedPushes.length) scopes.set("push-protected", protectedPushes.join(", "));
|
|
483
|
-
|
|
503
|
+
if (pushTags.length) scopes.set("push-tag", pushTags.join(", "));
|
|
504
|
+
return { declared, scopes, chatReplyGroups, pushGlobs, protectedPushes, pushTags, otherRoles, entries, role, unknown, message: null };
|
|
484
505
|
}
|
|
485
506
|
|
|
486
507
|
// `full_mode_paths:` — the paths whose change always routes Full, whatever the
|