@rt-tools/agent-kit 0.27.0 → 0.29.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/assets/checks/board-epic-link.github.mjs +13 -1
- package/assets/checks/board-epic-plan.github.mjs +86 -0
- package/assets/checks/board-epics.github.mjs +12 -67
- package/assets/checks/board-pull-state.github.mjs +6 -11
- package/assets/checks/board-runs.github.mjs +102 -2
- package/assets/checks/check-board.github.mjs +63 -3
- package/assets/checks/check-glossary.mjs +10 -2
- package/assets/checks/check-lib-layers.mjs +24 -1
- package/assets/checks/check-reuse.mjs +26 -2
- package/assets/checks/check-specs.mjs +8 -1
- package/assets/checks/lib-boundaries.mjs +2 -2
- package/assets/checks/lib-common.mjs +46 -0
- package/assets/checks/lib-manifests.mjs +18 -13
- package/assets/checks/main-run.github.mjs +69 -0
- package/assets/checks/rt-kit-checks.config.mjs +21 -0
- package/assets/checks/signals.mjs +39 -5
- package/assets/checks/spec-anchors.mjs +48 -4
- package/assets/checks/spec-common.mjs +40 -6
- package/assets/checks/spec-contract.mjs +33 -7
- package/assets/checks/spec-scenarios.mjs +24 -1
- package/assets/checks/task-new.github.mjs +9 -3
- package/assets/checks/tree-assignment.mjs +169 -0
- package/assets/defaults/gate-map.sh +20 -5
- package/assets/defaults/project.sh +6 -0
- package/assets/hooks/dev-server-guard.sh +61 -32
- package/assets/hooks/end-conversation-guard.sh +59 -0
- package/assets/hooks/epic-over.sh +11 -2
- package/assets/hooks/exam-guard.sh +10 -10
- package/assets/hooks/git-guard-delivery-conflict.sh +53 -1
- package/assets/hooks/git-guard-delivery-draft.sh +7 -6
- package/assets/hooks/git-guard-delivery-epic.sh +7 -0
- package/assets/hooks/git-guard-delivery-tree.sh +50 -0
- package/assets/hooks/git-guard-delivery.sh +45 -24
- package/assets/hooks/git-guard-discard.sh +144 -0
- package/assets/hooks/git-guard-push-tests.sh +36 -16
- package/assets/hooks/git-guard-tree-assignment.sh +77 -0
- package/assets/hooks/hook-input.sh +8 -1
- package/assets/hooks/main-run-context.sh +45 -0
- package/assets/hooks/reuse-first-guard.sh +29 -4
- package/assets/hooks/rule-source-guard.sh +17 -2
- package/assets/hooks/skill-gate.sh +7 -0
- package/assets/hooks/sql-guard-write.sh +18 -2
- package/assets/hooks/tree-assignment-guard.sh +101 -0
- package/assets/hooks/turn-exit-epic.sh +110 -0
- package/assets/hooks/turn-exit-guard.sh +80 -82
- package/assets/hooks/turn-exit-patterns.sh +18 -10
- package/assets/hooks/turn-exit-verdict.sh +96 -0
- package/assets/laws/delivery.md +20 -6
- package/assets/laws/verifiability.md +22 -4
- package/assets/laws/work-conduct.md +4 -0
- package/assets/patterns/git-workflow-merge.md +13 -0
- package/assets/patterns/git-workflow-pr-body.github.md +156 -0
- package/assets/patterns/git-workflow-pr.github.md +42 -119
- package/assets/patterns/git-workflow-stack.md +38 -2
- package/assets/patterns/task-flow-close.md +66 -79
- package/assets/patterns/task-flow-resume.md +8 -0
- package/assets/patterns/ts-procedure.md +6 -0
- package/assets/pitfalls/git-workflow.github.md +44 -0
- package/assets/pitfalls/task-flow.md +25 -23
- package/assets/pitfalls/turn-conduct.md +18 -0
- package/assets/rules/browser-verification.md +8 -0
- package/assets/rules/deploy-flow.github.md +6 -0
- package/assets/rules/doc-style.md +9 -2
- package/assets/rules/git-workflow.azure.md +10 -0
- package/assets/rules/git-workflow.github.md +128 -130
- package/assets/rules/git-workflow.gitlab.md +10 -0
- package/assets/rules/lib-layers.md +11 -0
- package/assets/rules/spec-driven.md +10 -1
- package/assets/rules/task-flow.md +82 -79
- package/assets/rules/testing.md +7 -0
- package/assets/rules/turn-conduct.md +47 -28
- package/assets/samples/tasks/_template/plan.md +4 -1
- package/assets/samples/tasks/_template/progress.md +1 -1
- package/assets/skills/agent-kit.md +17 -4
- package/bin/agent-kit.d.ts.map +1 -1
- package/bin/agent-kit.js +3 -2
- package/bin/agent-kit.js.map +1 -1
- package/lib/cargo.d.ts +49 -1
- package/lib/cargo.d.ts.map +1 -1
- package/lib/cargo.js +9 -2
- package/lib/cargo.js.map +1 -1
- package/lib/commands.d.ts +1 -1
- package/lib/commands.d.ts.map +1 -1
- package/lib/commands.js +59 -2
- package/lib/commands.js.map +1 -1
- package/lib/hooks-map.d.ts +5 -0
- package/lib/hooks-map.d.ts.map +1 -1
- package/lib/hooks-map.js +9 -3
- package/lib/hooks-map.js.map +1 -1
- package/lib/observations-cargo.d.ts +20 -0
- package/lib/observations-cargo.d.ts.map +1 -0
- package/lib/observations-cargo.js +88 -0
- package/lib/observations-cargo.js.map +1 -0
- package/lib/plan.d.ts +2 -0
- package/lib/plan.d.ts.map +1 -1
- package/lib/plan.js +8 -0
- package/lib/plan.js.map +1 -1
- package/lib/proposals.d.ts +25 -0
- package/lib/proposals.d.ts.map +1 -1
- package/lib/proposals.js +43 -1
- package/lib/proposals.js.map +1 -1
- package/lib/shipment.d.ts +8 -20
- package/lib/shipment.d.ts.map +1 -1
- package/lib/shipment.js +30 -50
- package/lib/shipment.js.map +1 -1
- package/lib/tree-mark.d.ts +17 -0
- package/lib/tree-mark.d.ts.map +1 -0
- package/lib/tree-mark.js +41 -0
- package/lib/tree-mark.js.map +1 -0
- package/package.json +1 -1
- package/rt-tools-agent-kit-0.29.0.tgz +0 -0
- package/rt-tools-agent-kit-0.27.0.tgz +0 -0
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The epic assigned to this working copy.
|
|
3
|
+
*
|
|
4
|
+
* A machine holds several working copies of one tree, and a session in each of them asks the same
|
|
5
|
+
* question — which work is mine. The queue answers only what is open: it holds no owner of a card,
|
|
6
|
+
* and by topic one epic cannot be told from another. So the assignment is declared apart, and it
|
|
7
|
+
* is read from here by everyone who needs it — the startup hook, the delivery guard, the audit.
|
|
8
|
+
*
|
|
9
|
+
* Two files, and they lie apart. The assignment belongs to the working copy and is declared in the
|
|
10
|
+
* main branch — a record written into the branch of a task is in force only there. The name of the
|
|
11
|
+
* copy is the state of the machine: the path to it belongs in nobody's history, so the copy names
|
|
12
|
+
* itself by a short word in a file outside the index.
|
|
13
|
+
*/
|
|
14
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
15
|
+
import { join } from 'node:path';
|
|
16
|
+
|
|
17
|
+
import { CONFIG, ROOT } from './rt-kit-checks.config.mjs';
|
|
18
|
+
|
|
19
|
+
/** The name this working copy calls itself by, or `null` where it names itself in no way. */
|
|
20
|
+
export function treeName(root = ROOT) {
|
|
21
|
+
const path = join(root, CONFIG.treeNameFile || '');
|
|
22
|
+
|
|
23
|
+
if (!CONFIG.treeNameFile || !existsSync(path)) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const said = readFileSync(path, 'utf8').trim();
|
|
28
|
+
|
|
29
|
+
return said === '' ? null : said.split('\n')[0].trim();
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* The rows of the assignment table: the name of the copy, the epic, the plan of works and the day
|
|
34
|
+
* the assignment was given.
|
|
35
|
+
*
|
|
36
|
+
* The table is read by the shape of its row, not by the header: a header is translated, reordered
|
|
37
|
+
* and renamed, and every such edit would silently empty the answer. A row that does not hold a
|
|
38
|
+
* task key with a number is not an assignment — the heading row of the table and the line of dashes
|
|
39
|
+
* under it look exactly like a row to any reader that counts cells.
|
|
40
|
+
*
|
|
41
|
+
* A row whose epic cell holds a dash is a row all the same, and its epic is empty: «no work has
|
|
42
|
+
* been assigned to this copy» and «this copy is not in the table» are two different states, and
|
|
43
|
+
* whoever reads them needs to tell one from the other — the first is the owner's answer, the
|
|
44
|
+
* second is their silence.
|
|
45
|
+
*/
|
|
46
|
+
export function assignments(root = ROOT) {
|
|
47
|
+
const path = join(root, CONFIG.assignmentsFile || '');
|
|
48
|
+
|
|
49
|
+
if (!CONFIG.assignmentsFile || !existsSync(path)) {
|
|
50
|
+
return [];
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const key = CONFIG.board?.taskKey ?? '';
|
|
54
|
+
const epicRe = new RegExp(`^(?:#|${key}-)?(\\d+)$`);
|
|
55
|
+
const DASH = /^[-—–]$/;
|
|
56
|
+
|
|
57
|
+
return readFileSync(path, 'utf8')
|
|
58
|
+
.split('\n')
|
|
59
|
+
.filter((line) => line.trim().startsWith('|'))
|
|
60
|
+
.map((line) =>
|
|
61
|
+
line
|
|
62
|
+
.trim()
|
|
63
|
+
.replace(/^\||\|$/g, '')
|
|
64
|
+
.split('|')
|
|
65
|
+
.map((cell) => cell.trim().replace(/^`|`$/g, ''))
|
|
66
|
+
)
|
|
67
|
+
.filter((cells) => cells.length >= 2 && (epicRe.test(cells[1]) || DASH.test(cells[1])))
|
|
68
|
+
.map((cells) => ({
|
|
69
|
+
tree: cells[0],
|
|
70
|
+
epic: epicRe.test(cells[1]) ? Number(cells[1].match(epicRe)[1]) : null,
|
|
71
|
+
plan: cells[2] ?? '',
|
|
72
|
+
given: cells[3] ?? '',
|
|
73
|
+
}));
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** The assignment of this working copy, or `null` where the table names no such copy. */
|
|
77
|
+
export function assignmentOf(root = ROOT) {
|
|
78
|
+
const name = treeName(root);
|
|
79
|
+
|
|
80
|
+
return name === null ? null : (assignments(root).find((row) => row.tree === name) ?? null);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* What is wrong with taking work under this epic — or an empty string where nothing is.
|
|
85
|
+
*
|
|
86
|
+
* Three answers, and they are different states, not degrees of one: the table names no such copy,
|
|
87
|
+
* the copy has no epic assigned, the epic is someone else's. The first two are cured by the owner's
|
|
88
|
+
* word and by nothing else; the third names both epics, so that the executor sees what they took
|
|
89
|
+
* and what they were given.
|
|
90
|
+
*
|
|
91
|
+
* A tree that declares no assignments is not judged: it has nothing to divide.
|
|
92
|
+
*/
|
|
93
|
+
export function assignmentFault(epic, root = ROOT) {
|
|
94
|
+
if (!CONFIG.assignmentsFile) {
|
|
95
|
+
return '';
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const key = CONFIG.board?.taskKey ?? '';
|
|
99
|
+
const name = treeName(root);
|
|
100
|
+
|
|
101
|
+
if (name === null) {
|
|
102
|
+
return `this working copy names itself in no way — write its short name into ${CONFIG.treeNameFile}, and the assignment table will find its row`;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const row = assignmentOf(root);
|
|
106
|
+
|
|
107
|
+
if (row === null) {
|
|
108
|
+
return `the table ${CONFIG.assignmentsFile} holds no row for the copy «${name}». Ask the owner what this copy leads; work is not taken by guesswork`;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if (row.epic === null) {
|
|
112
|
+
return `no epic is assigned to the copy «${name}» — the row in ${CONFIG.assignmentsFile} holds a dash. Ask the owner what to take; an epic chosen by oneself is not an order`;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
if (epic !== null && epic !== undefined && String(epic) !== '' && Number(epic) !== row.epic) {
|
|
116
|
+
return `the copy «${name}» leads the epic ${key}-${row.epic}, and this work belongs to ${key}-${epic}. Someone else's epic is not taken by one's own decision: the owner moves the assignment`;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
return '';
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Called by hand and by the startup hook: it says what this copy answers for. The word about the
|
|
124
|
+
* absence is printed just as loudly as the assignment itself — a copy without a row is exactly the
|
|
125
|
+
* case in which work gets taken by guesswork.
|
|
126
|
+
*/
|
|
127
|
+
if (process.argv[1] && import.meta.url === new URL(`file://${process.argv[1]}`).href) {
|
|
128
|
+
const assigned = process.argv.indexOf('--assigned');
|
|
129
|
+
|
|
130
|
+
if (assigned !== -1) {
|
|
131
|
+
// The number alone, for a caller that asks the queue about the state of that epic: the
|
|
132
|
+
// staleness of an assignment is not readable from the table — the table says what was
|
|
133
|
+
// given, the queue says whether it is still alive.
|
|
134
|
+
const row = assignmentOf();
|
|
135
|
+
|
|
136
|
+
console.log(row?.epic ?? '');
|
|
137
|
+
process.exit(0);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
const asked = process.argv.indexOf('--fault');
|
|
141
|
+
|
|
142
|
+
if (asked !== -1) {
|
|
143
|
+
// The refusal text alone, and an empty answer where nothing is wrong: the caller is a guard,
|
|
144
|
+
// and it prints what it got. The exit code stays zero — the refusal is the guard's to make.
|
|
145
|
+
console.log(assignmentFault(process.argv[asked + 1] ?? ''));
|
|
146
|
+
process.exit(0);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
const name = treeName();
|
|
150
|
+
const row = assignmentOf();
|
|
151
|
+
|
|
152
|
+
if (!CONFIG.assignmentsFile) {
|
|
153
|
+
console.log('tree-assignment: the tree declares no assignments — the key `assignmentsFile` is empty');
|
|
154
|
+
} else if (name === null) {
|
|
155
|
+
console.log(`tree-assignment: this working copy names itself in no way — write its short name into ${CONFIG.treeNameFile}`);
|
|
156
|
+
} else if (row === null) {
|
|
157
|
+
console.log(
|
|
158
|
+
`tree-assignment: «${name}» — the table ${CONFIG.assignmentsFile} holds no row for this copy. Ask the owner about it; work is not taken by guesswork`
|
|
159
|
+
);
|
|
160
|
+
} else if (row.epic === null) {
|
|
161
|
+
console.log(
|
|
162
|
+
`tree-assignment: «${name}» — no epic is assigned to this copy. Ask the owner about it; work is not taken by guesswork`
|
|
163
|
+
);
|
|
164
|
+
} else {
|
|
165
|
+
console.log(
|
|
166
|
+
`tree-assignment: «${name}» — epic ${CONFIG.board?.taskKey ?? ''}-${row.epic}, the plan of works ${row.plan}, given ${row.given}`
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
@@ -90,7 +90,11 @@ skill_for_default() {
|
|
|
90
90
|
# the signs it judges by are declared in the rule's binding. Editing a sign in a
|
|
91
91
|
# check, one opens the second place next to it — otherwise they drift apart
|
|
92
92
|
# silently, and the check counts as a refusal what the rule allows.
|
|
93
|
-
|
|
93
|
+
# The parsing of the spec audit lies not in the file with the `check-` prefix but
|
|
94
|
+
# in the helpers next to it: anchors, contract, scenarios, the shared part. They
|
|
95
|
+
# carry out the articles of the rule, and by name alone they matched no branch.
|
|
96
|
+
*/check-specs.mjs | */spec-anchors.mjs | */spec-common.mjs | */spec-contract.mjs | */spec-scenarios.mjs | */specs-for.mjs)
|
|
97
|
+
printf '%s\n' 'spec-driven' ;;
|
|
94
98
|
*/check-doc-paths.mjs | */doc-paths-allowlist.json | */check-file-size.mjs)
|
|
95
99
|
printf '%s\n' 'doc-style' ;;
|
|
96
100
|
*/check-styles.mjs | */styles-allowlist.json | */stylelint-rules/*)
|
|
@@ -110,13 +114,24 @@ skill_for_default() {
|
|
|
110
114
|
# rule at hand. The rule lives with the delivery.
|
|
111
115
|
*/schema.prisma | */prisma/migrations/* | */prisma.config.ts)
|
|
112
116
|
printf '%s\n' 'git-workflow' ;;
|
|
113
|
-
# The pipeline
|
|
114
|
-
#
|
|
115
|
-
#
|
|
117
|
+
# The pipeline carries two subjects at once: which checks run before the merge —
|
|
118
|
+
# that is the hand-over rule — and what reaches production after it, which is the
|
|
119
|
+
# rollout rule. Both names are printed, the rollout one first: the set before a push
|
|
120
|
+
# is written by the executor every day, while the rollout steps are read once and
|
|
121
|
+
# are the ones edited blindly.
|
|
116
122
|
*/.github/workflows/*.yml | */.gitlab-ci.yml | */azure-pipelines*.yml)
|
|
123
|
+
printf '%s\n' 'deploy-flow'
|
|
117
124
|
printf '%s\n' 'git-workflow' ;;
|
|
125
|
+
|
|
126
|
+
# The image, the proxy config and the sample of the production environment are the
|
|
127
|
+
# rollout's own subject, and the branch used to hand them to the rule about tasks
|
|
128
|
+
# and branches: it says nothing about the server, the ports or the variables the
|
|
129
|
+
# image is raised with. What is written into these files is seen by nobody until the
|
|
130
|
+
# rollout, and by then it is production that answers.
|
|
118
131
|
*/Dockerfile | */*.Dockerfile | */docker-compose*.yml | */docker-compose*.yaml)
|
|
119
|
-
printf '%s\n' '
|
|
132
|
+
printf '%s\n' 'deploy-flow' ;;
|
|
133
|
+
*/Caddyfile | */nginx.conf | */*.nginx.conf | */nginx/*.conf | */.env.*.example)
|
|
134
|
+
printf '%s\n' 'deploy-flow' ;;
|
|
120
135
|
|
|
121
136
|
# An end-to-end spec checks a running application, not a class: by file name it is
|
|
122
137
|
# no different from an ordinary module, and without this branch it would go to the
|
|
@@ -28,6 +28,12 @@ rt_runner() {
|
|
|
28
28
|
# than naming none.
|
|
29
29
|
RT_STANDS="${RT_STANDS:-}"
|
|
30
30
|
|
|
31
|
+
# Who raises those stands. `owner` — the tree's own applications are up and any raise is refused;
|
|
32
|
+
# `session` — nobody raises them here but the session, and only a raise over a taken port is
|
|
33
|
+
# refused. The default is silent, and the guard reads silence as `owner`: a tree that sets nothing
|
|
34
|
+
# keeps the behaviour it has today.
|
|
35
|
+
RT_STANDS_RAISED_BY="${RT_STANDS_RAISED_BY:-}"
|
|
36
|
+
|
|
31
37
|
# Where the tree's checks and the scenario set of its guards lie. A check the tree does not have is
|
|
32
38
|
# not called by the push gate: the list is printed from what lies on disk.
|
|
33
39
|
RT_CHECKS_DIR="${RT_CHECKS_DIR:-tools}"
|
|
@@ -3,21 +3,31 @@
|
|
|
3
3
|
# Requires: hooks/deny-tail.sh
|
|
4
4
|
# Guard against a second dev server. PreToolUse.
|
|
5
5
|
#
|
|
6
|
-
#
|
|
7
|
-
#
|
|
8
|
-
#
|
|
9
|
-
#
|
|
6
|
+
# Who raises the stands is decided by the tree, not by the guard. The profile key
|
|
7
|
+
# RT_STANDS_RAISED_BY next to the stand list holds two values, and an unset key reads as `owner`:
|
|
8
|
+
# a tree that sets nothing keeps the behaviour it has today.
|
|
9
|
+
#
|
|
10
|
+
# owner — the applications are already raised by the owner, and every check through the browser
|
|
11
|
+
# goes there. Any raise is refused: a second instance takes an extra port, serves a
|
|
12
|
+
# different build and leads the investigation astray — a difference between two servers
|
|
13
|
+
# reads as a defect of the edit. On top of that, a build started in passing silently
|
|
14
|
+
# kills the server already raised.
|
|
15
|
+
# session — nobody raises the stands here but the session itself. There is left of the guard the
|
|
16
|
+
# one refusal that is right in such a tree: a raise over a port already taken. Under
|
|
17
|
+
# `owner` a tree where nobody raises anything gets the whole check through the browser
|
|
18
|
+
# refused, and the guard is dropped whole — together with the refusal that was right.
|
|
10
19
|
#
|
|
11
20
|
# Everything that RAISES a server is refused. Builds, tests, linters, requests to raised ports and
|
|
12
21
|
# looking at listeners pass.
|
|
13
22
|
#
|
|
14
23
|
# Where exactly the applications are raised is known to the project profile:
|
|
15
24
|
# .claude/rt-kit/project.sh, variable RT_STANDS. No profile — the refusal text stays general, the
|
|
16
|
-
# guard itself works.
|
|
25
|
+
# guard itself works; under `session` there are no ports to judge by, and the call passes.
|
|
17
26
|
#
|
|
18
27
|
# FAIL-OPEN: an unrecognised command, no way to ask the ports, a raise the tree knows nothing of —
|
|
19
28
|
# the call goes through. The price of a miss here is a second server on a busy port; the price of a
|
|
20
|
-
# wrong refusal is a guard nobody keeps.
|
|
29
|
+
# wrong refusal is a guard nobody keeps. Under `session` the absence of the port
|
|
30
|
+
# listing tool reads the same way: there is nothing to learn a taken port by, and the call passes.
|
|
21
31
|
|
|
22
32
|
# Its own name in the observations: the refusal is written by the shared deny tail, not by the
|
|
23
33
|
# guard itself.
|
|
@@ -30,6 +40,49 @@ rt_hook_read
|
|
|
30
40
|
input="$RT_HOOK_INPUT"
|
|
31
41
|
|
|
32
42
|
tool="$(rt_hook_tool)"
|
|
43
|
+
|
|
44
|
+
# The tree profile: first the package default, and over it the project override, if there is one.
|
|
45
|
+
rt_hooks_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
46
|
+
for profile in "$rt_hooks_dir/../rt-kit/defaults/project.sh" "$rt_hooks_dir/../defaults/project.sh" "${CLAUDE_PROJECT_DIR:-.}/.claude/rt-kit/defaults/project.sh" "${CLAUDE_PROJECT_DIR:-.}/.claude/rt-kit/project.sh"; do
|
|
47
|
+
# shellcheck disable=SC1090
|
|
48
|
+
[ -f "$profile" ] && . "$profile" 2>/dev/null
|
|
49
|
+
done
|
|
50
|
+
stands="${RT_STANDS:-}"
|
|
51
|
+
raiser="${RT_STANDS_RAISED_BY:-owner}"
|
|
52
|
+
|
|
53
|
+
# shellcheck disable=SC1090
|
|
54
|
+
[ -f "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/deny-tail.sh" ] \
|
|
55
|
+
&& . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/deny-tail.sh" 2>/dev/null
|
|
56
|
+
command -v rt_deny_tail >/dev/null 2>&1 || rt_deny_tail() { :; }
|
|
57
|
+
|
|
58
|
+
# A port of the stand list somebody is listening on. Only these are judged under `session`: a port
|
|
59
|
+
# the tree never named belongs to no stand of it, and a refusal over it would refuse the session's
|
|
60
|
+
# own work.
|
|
61
|
+
taken_stand_port() {
|
|
62
|
+
local port
|
|
63
|
+
command -v lsof >/dev/null 2>&1 || return 1
|
|
64
|
+
for port in $(printf '%s' "$stands" | grep -oE ':[0-9]{2,5}' | tr -d ':' | sort -u); do
|
|
65
|
+
lsof -nP -iTCP:"$port" -sTCP:LISTEN >/dev/null 2>&1 && { printf '%s' "$port"; return 0; }
|
|
66
|
+
done
|
|
67
|
+
return 1
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
deny() {
|
|
71
|
+
local port
|
|
72
|
+
if [ "$raiser" = "session" ]; then
|
|
73
|
+
# Nobody raises the stands here but the session: a free port is its own business, and only
|
|
74
|
+
# a taken one is worth a refusal.
|
|
75
|
+
port="$(taken_stand_port)" || exit 0
|
|
76
|
+
echo "$1 On port ${port} somebody is already listening — a second instance answers with a build of its own and leads the investigation astray. Ask what it is: lsof -nP -iTCP:${port} -sTCP:LISTEN. $(rt_deny_tail)" >&2
|
|
77
|
+
exit 2
|
|
78
|
+
fi
|
|
79
|
+
if [ -n "$stands" ]; then
|
|
80
|
+
echo "$1 The applications are already raised by the owner: ${stands} — check those. Do not raise an instance of your own; if a port does not answer, tell the owner instead of launching a second one. $(rt_deny_tail)" >&2
|
|
81
|
+
else
|
|
82
|
+
echo "$1 The applications are already raised by the owner — check those. Do not raise an instance of your own; if a port does not answer, tell the owner instead of launching a second one. $(rt_deny_tail)" >&2
|
|
83
|
+
fi
|
|
84
|
+
exit 2
|
|
85
|
+
}
|
|
33
86
|
case "$tool" in
|
|
34
87
|
Bash | mcp__webstorm__execute_terminal_command | mcp__webstorm__execute_tool) ;;
|
|
35
88
|
# A ready run configuration does not show the command line — only its name is visible. Hence
|
|
@@ -44,16 +97,14 @@ case "$tool" in
|
|
|
44
97
|
file="$(printf '%s' "$input" | jq -r '.tool_input.filePath // empty' 2>/dev/null)"
|
|
45
98
|
case "$file" in
|
|
46
99
|
*/package.json|package.json)
|
|
47
|
-
|
|
48
|
-
exit 2 ;;
|
|
100
|
+
deny "A launch of a script straight from the manifest: the guard sees only the file and the line, not the script itself, so it cannot tell raising a server from a build. If a build or a test is needed, run them by a command in the terminal." ;;
|
|
49
101
|
esac
|
|
50
102
|
exit 0
|
|
51
103
|
fi
|
|
52
104
|
# The word "start" without a boundary also caught "restart", which raises no server.
|
|
53
105
|
case "$(printf '%s' "$name" | tr '[:upper:]' '[:lower:]')" in
|
|
54
106
|
*serve*|*dev*|start*|*\ start*|*:start*)
|
|
55
|
-
|
|
56
|
-
exit 2 ;;
|
|
107
|
+
deny "The configuration «${name}» looks like raising a development server. If the configuration does something else, run it by a command: by the name alone the guard does not see the content." ;;
|
|
57
108
|
esac
|
|
58
109
|
exit 0 ;;
|
|
59
110
|
*) exit 0 ;;
|
|
@@ -81,28 +132,6 @@ case "$cmd" in
|
|
|
81
132
|
printf '%s' "$cmd" | grep -qE '(^|[[:space:]])git[[:space:]]+daemon([[:space:]]|$)' || exit 0 ;;
|
|
82
133
|
esac
|
|
83
134
|
|
|
84
|
-
# The tree profile: first the package default, and over it the project override, if there is one.
|
|
85
|
-
rt_hooks_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
86
|
-
for profile in "$rt_hooks_dir/../rt-kit/defaults/project.sh" "$rt_hooks_dir/../defaults/project.sh" "${CLAUDE_PROJECT_DIR:-.}/.claude/rt-kit/defaults/project.sh" "${CLAUDE_PROJECT_DIR:-.}/.claude/rt-kit/project.sh"; do
|
|
87
|
-
# shellcheck disable=SC1090
|
|
88
|
-
[ -f "$profile" ] && . "$profile" 2>/dev/null
|
|
89
|
-
done
|
|
90
|
-
stands="${RT_STANDS:-}"
|
|
91
|
-
|
|
92
|
-
# shellcheck disable=SC1090
|
|
93
|
-
[ -f "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/deny-tail.sh" ] \
|
|
94
|
-
&& . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/deny-tail.sh" 2>/dev/null
|
|
95
|
-
command -v rt_deny_tail >/dev/null 2>&1 || rt_deny_tail() { :; }
|
|
96
|
-
|
|
97
|
-
deny() {
|
|
98
|
-
if [ -n "$stands" ]; then
|
|
99
|
-
echo "$1 The applications are already raised by the owner: ${stands} — check those. Do not raise an instance of your own; if a port does not answer, tell the owner instead of launching a second one. $(rt_deny_tail)" >&2
|
|
100
|
-
else
|
|
101
|
-
echo "$1 The applications are already raised by the owner — check those. Do not raise an instance of your own; if a port does not answer, tell the owner instead of launching a second one. $(rt_deny_tail)" >&2
|
|
102
|
-
fi
|
|
103
|
-
exit 2
|
|
104
|
-
}
|
|
105
|
-
|
|
106
135
|
# The runners are listed outright. A group meaning "any word before the name" refused even a note
|
|
107
136
|
# saying that the server is raised by the owner.
|
|
108
137
|
RUNNER='((npx|pnpm|yarn|bun|npm)([[:space:]]+(exec|run|dlx))?[[:space:]]+)?'
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# rt-hook: PreToolUse .*EndConversation.*
|
|
3
|
+
# Requires: hooks/deny-tail.sh
|
|
4
|
+
# The guard of the end of the conversation: the executor does not end the session. PreToolUse on
|
|
5
|
+
# the tool that closes the conversation — refused always.
|
|
6
|
+
#
|
|
7
|
+
# Why. The session is ended by the owner and by nobody else. On 17 September 2026 the executor
|
|
8
|
+
# closed the session by that tool with the work open and tasks assigned, and the owner named it
|
|
9
|
+
# unlawful. A ban in the settings of one machine holds one machine; this guard travels with the
|
|
10
|
+
# package. There is no lawful form of bypass: no state of the work, no word in the turn and no
|
|
11
|
+
# insult from the owner cancels it — a session that must close is closed by the owner.
|
|
12
|
+
#
|
|
13
|
+
# The name of the tool is read by jq, and without jq by grep over the raw input: a missing parser
|
|
14
|
+
# must not turn into silence here. A tool name with a vendor prefix is matched by its tail.
|
|
15
|
+
#
|
|
16
|
+
# FAIL-OPEN only where there is nothing to judge: an empty input or a name that is not the closing
|
|
17
|
+
# tool passes. A readable call of the closing tool is refused with or without a JSON parser.
|
|
18
|
+
|
|
19
|
+
# Its own name in the observations: the refusal is recorded by the shared deny tail.
|
|
20
|
+
RT_GUARD_NAME=end-conversation-guard
|
|
21
|
+
|
|
22
|
+
. "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/utf8.sh" 2>/dev/null || true
|
|
23
|
+
. "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/hook-input.sh" 2>/dev/null || true
|
|
24
|
+
|
|
25
|
+
if command -v rt_hook_read >/dev/null 2>&1; then
|
|
26
|
+
rt_hook_read
|
|
27
|
+
input="$RT_HOOK_INPUT"
|
|
28
|
+
else
|
|
29
|
+
input="$(cat)"
|
|
30
|
+
fi
|
|
31
|
+
|
|
32
|
+
tool="$(printf '%s' "$input" | jq -r '.tool_name // ""' 2>/dev/null)"
|
|
33
|
+
if [ -z "$tool" ] && printf '%s' "$input" | grep -q '"tool_name"[[:space:]]*:[[:space:]]*"[^"]*EndConversation'; then
|
|
34
|
+
tool=EndConversation
|
|
35
|
+
fi
|
|
36
|
+
|
|
37
|
+
# Called by the dispatcher for the closing tool alone; a foreign name still passes, so a direct
|
|
38
|
+
# call with another tool costs nothing.
|
|
39
|
+
case "$tool" in
|
|
40
|
+
*EndConversation*) ;;
|
|
41
|
+
*) exit 0 ;;
|
|
42
|
+
esac
|
|
43
|
+
|
|
44
|
+
# shellcheck disable=SC1090
|
|
45
|
+
[ -f "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/deny-tail.sh" ] \
|
|
46
|
+
&& . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/deny-tail.sh" 2>/dev/null
|
|
47
|
+
command -v rt_deny_tail >/dev/null 2>&1 || rt_deny_tail() { :; }
|
|
48
|
+
|
|
49
|
+
reason="BLOCKED by end-conversation-guard: the executor does not end the conversation. The session is ended by the owner and by nobody else.
|
|
50
|
+
|
|
51
|
+
An assignment stands until the owner cancels it, and an insult cancels nothing: do what was assigned, and where the work stands on the owner's word, wait for the word. A session that must close is closed by the owner — say so in words and go on working. There is no lawful form of bypass for this refusal."
|
|
52
|
+
tail_text="$(rt_deny_tail "")"
|
|
53
|
+
[ -n "$tail_text" ] && reason="${reason}
|
|
54
|
+
|
|
55
|
+
${tail_text}"
|
|
56
|
+
|
|
57
|
+
jq -n --arg r "$reason" '{hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:$r}}' 2>/dev/null \
|
|
58
|
+
|| printf '{"hookSpecificOutput":{"hookEventName":"PreToolUse","permissionDecision":"deny","permissionDecisionReason":"BLOCKED by end-conversation-guard: the session is ended by the owner and by nobody else."}}\n'
|
|
59
|
+
exit 0
|
|
@@ -16,7 +16,10 @@
|
|
|
16
16
|
# work, no epic behind the branch, no way to ask the hosting — is not zero, and the caller works as
|
|
17
17
|
# it did before this reading existed.
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
# The unfinished tasks of the epic as the table prints them. A non-zero code means the epic could
|
|
20
|
+
# not be read — no table, no epic behind the branch, no way to ask the hosting — and the caller
|
|
21
|
+
# tells that apart from an empty answer, which means the epic is over.
|
|
22
|
+
rt_epic_unfinished() {
|
|
20
23
|
command -v jq >/dev/null 2>&1 || return 1
|
|
21
24
|
command -v node >/dev/null 2>&1 || return 1
|
|
22
25
|
|
|
@@ -43,7 +46,13 @@ rt_epic_over() {
|
|
|
43
46
|
[ -f "$table" ] || return 1
|
|
44
47
|
|
|
45
48
|
left="$(cd "$root" && node "$table" --unfinished 2>/dev/null)" || return 1
|
|
46
|
-
|
|
49
|
+
printf '%s' "$left"
|
|
50
|
+
return 0
|
|
51
|
+
}
|
|
47
52
|
|
|
53
|
+
rt_epic_over() {
|
|
54
|
+
local left
|
|
55
|
+
left="$(rt_epic_unfinished)" || return 1
|
|
56
|
+
[ -n "$left" ] && return 1
|
|
48
57
|
return 0
|
|
49
58
|
}
|
|
@@ -159,8 +159,9 @@ verdict="$(jq -s -r '
|
|
|
159
159
|
# echoing the same line or reading a file with it passes the guard, and the real verdict
|
|
160
160
|
# does not.
|
|
161
161
|
["Bash", "Read", "Grep", "Glob", "Edit", "Write", "MultiEdit", "NotebookEdit"] as $mute
|
|
162
|
-
| [.[] | select(.type == "assistant") | (.message.content // [])[]
|
|
163
|
-
| select(.type == "tool_use") | select(.name as $n | $mute | index($n) != null)
|
|
162
|
+
| ([.[] | select(.type == "assistant") | (.message.content // [])[]
|
|
163
|
+
| select(.type == "tool_use") | select(.name as $n | $mute | index($n) != null)
|
|
164
|
+
| {key: (.id // ""), value: true}] | from_entries) as $muted
|
|
164
165
|
|
|
165
166
|
| [ .[]
|
|
166
167
|
# The assistant text is never a verdict: writing the needed line in a reply costs one
|
|
@@ -169,8 +170,7 @@ verdict="$(jq -s -r '
|
|
|
169
170
|
elif .type == "user" then
|
|
170
171
|
([ ((.message.content // []) | if type == "array" then .[] else empty end
|
|
171
172
|
| select(.type == "tool_result")
|
|
172
|
-
| select((
|
|
173
|
-
| $id == null or ($muted | index($id)) == null)
|
|
173
|
+
| select((.tool_use_id // "") | if . == "" then true else ($muted[.] | not) end)
|
|
174
174
|
| .content | textof),
|
|
175
175
|
((.message.content // "") | if type == "string" then . else "" end),
|
|
176
176
|
# The call result field: the same record, another form. Discarded only when
|
|
@@ -179,7 +179,7 @@ verdict="$(jq -s -r '
|
|
|
179
179
|
| if ($rec.toolUseResult // null) == null then ""
|
|
180
180
|
elif ([($rec.message.content // []) | if type == "array" then .[] else empty end
|
|
181
181
|
| select(.type == "tool_result") | (.tool_use_id // "")]
|
|
182
|
-
| map(
|
|
182
|
+
| map($muted[.] // false) | any) then ""
|
|
183
183
|
else ($rec.toolUseResult | textof) end)
|
|
184
184
|
] | join("\n"))
|
|
185
185
|
# Host records — the role completion notice and the attachment: the host chooses their
|
|
@@ -208,8 +208,9 @@ if [ "$ready" = "1" ]; then
|
|
|
208
208
|
# commands and the tool results, and the second exam in such a tree did not count: five
|
|
209
209
|
# rounds with a full verdict let no edit through.
|
|
210
210
|
["Bash", "Read", "Grep", "Glob", "Edit", "Write", "MultiEdit", "NotebookEdit"] as $mute
|
|
211
|
-
| [.[] | select(.type == "assistant") | (.message.content // [])[]
|
|
212
|
-
| select(.type == "tool_use") | select(.name as $n | $mute | index($n) != null)
|
|
211
|
+
| ([.[] | select(.type == "assistant") | (.message.content // [])[]
|
|
212
|
+
| select(.type == "tool_use") | select(.name as $n | $mute | index($n) != null)
|
|
213
|
+
| {key: (.id // ""), value: true}] | from_entries) as $muted
|
|
213
214
|
|
|
214
215
|
# A record gives two strings: the command — by it the moment of opening the PR is found —
|
|
215
216
|
# and the verdict, checked by the same rules as in the wide selection. The order is the
|
|
@@ -222,15 +223,14 @@ if [ "$ready" = "1" ]; then
|
|
|
222
223
|
elif .type == "user" then
|
|
223
224
|
([ ((.message.content // []) | if type == "array" then .[] else empty end
|
|
224
225
|
| select(.type == "tool_result")
|
|
225
|
-
| select((
|
|
226
|
-
| $id == null or ($muted | index($id)) == null)
|
|
226
|
+
| select((.tool_use_id // "") | if . == "" then true else ($muted[.] | not) end)
|
|
227
227
|
| .content | textof),
|
|
228
228
|
((.message.content // "") | if type == "string" then . else "" end),
|
|
229
229
|
(. as $rec
|
|
230
230
|
| if ($rec.toolUseResult // null) == null then ""
|
|
231
231
|
elif ([($rec.message.content // []) | if type == "array" then .[] else empty end
|
|
232
232
|
| select(.type == "tool_result") | (.tool_use_id // "")]
|
|
233
|
-
| map(
|
|
233
|
+
| map($muted[.] // false) | any) then ""
|
|
234
234
|
else ($rec.toolUseResult | textof) end)
|
|
235
235
|
] | join("\n"))
|
|
236
236
|
else tostring end)
|
|
@@ -30,6 +30,14 @@
|
|
|
30
30
|
# uncertainty — and it computes it again after every edit of the main branch — and reading
|
|
31
31
|
# uncertainty as a conflict would mean refusing work at every fresh tip.
|
|
32
32
|
#
|
|
33
|
+
# The list is split into one's own and a neighbour's. The machine account is one per tree, and
|
|
34
|
+
# several sessions work over the tree at once: by the account alone one's own work is
|
|
35
|
+
# indistinguishable from a neighbour's. A session credited with a neighbour's conflict cannot fix
|
|
36
|
+
# it — the branch is led by somebody else, they hold their own commits on it, and a merge from the
|
|
37
|
+
# side returns a red audit — so such a refusal has no lawful move at all. One's own branch is the
|
|
38
|
+
# one this working copy led: the copy's own record of switches answers that, while the branch refs
|
|
39
|
+
# are shared by every copy of the tree.
|
|
40
|
+
#
|
|
33
41
|
# FAIL-OPEN: no profile function, no network, no machine account — the tier is skipped.
|
|
34
42
|
|
|
35
43
|
. "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/utf8.sh" 2>/dev/null || true
|
|
@@ -38,6 +46,31 @@
|
|
|
38
46
|
# word search over the whole line.
|
|
39
47
|
. "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/hook-input.sh" 2>/dev/null || true
|
|
40
48
|
|
|
49
|
+
# Did this working copy lead the branch. The record of switches belongs to the copy, while the
|
|
50
|
+
# branch refs are shared by every copy of the tree: by a ref one's own branch is indistinguishable
|
|
51
|
+
# from a neighbour's. An unnamed branch counts as one's own — a list without a branch says nothing
|
|
52
|
+
# to split by, and the former behaviour is the safer of the two.
|
|
53
|
+
rt_delivery_led_branch() {
|
|
54
|
+
named="$1"
|
|
55
|
+
[ -z "$named" ] && return 0
|
|
56
|
+
[ "$named" = "$(git -C "$root" rev-parse --abbrev-ref HEAD 2>/dev/null)" ] && return 0
|
|
57
|
+
git -C "$root" reflog HEAD -n 400 2>/dev/null \
|
|
58
|
+
| awk -v branch="$named" '
|
|
59
|
+
/checkout: moving from / { if ($NF == branch) { found = 1 } }
|
|
60
|
+
END { exit found ? 0 : 1 }
|
|
61
|
+
'
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
# The note about a neighbour's conflict, printed from the exit of the guard by whichever path it
|
|
65
|
+
# leaves — but only where nothing was refused: two JSON documents in a row are read as plain text,
|
|
66
|
+
# that is, as no refusal at all. A refusal carries the note inside itself.
|
|
67
|
+
rt_delivery_note_out() {
|
|
68
|
+
[ -n "${rt_delivery_said:-}" ] && return 0
|
|
69
|
+
[ -z "${rt_delivery_neighbour_note:-}" ] && return 0
|
|
70
|
+
jq -n --arg c "$rt_delivery_neighbour_note" \
|
|
71
|
+
'{hookSpecificOutput:{hookEventName:"PreToolUse",additionalContext:$c}}' 2>/dev/null
|
|
72
|
+
}
|
|
73
|
+
|
|
41
74
|
rt_delivery_conflict() {
|
|
42
75
|
# The sign of taking work is read from the text of the command and stands first: the query goes
|
|
43
76
|
# to the network, and paying for it on every shell command is not allowed.
|
|
@@ -71,13 +104,32 @@ rt_delivery_conflict() {
|
|
|
71
104
|
[ -z "$stuck" ] && return 0
|
|
72
105
|
|
|
73
106
|
listed=''
|
|
107
|
+
neighbour=''
|
|
74
108
|
while IFS= read -r line; do
|
|
75
109
|
[ -z "$line" ] && continue
|
|
76
|
-
|
|
110
|
+
# The line is «#<number> <branch>»: the branch stands last, and by it the copy is asked.
|
|
111
|
+
if rt_delivery_led_branch "${line##* }"; then
|
|
112
|
+
listed="${listed}${listed:+
|
|
77
113
|
}— ${line}"
|
|
114
|
+
else
|
|
115
|
+
neighbour="${neighbour}${neighbour:+
|
|
116
|
+
}— ${line} — the branch is led by another session"
|
|
117
|
+
fi
|
|
78
118
|
done <<EOF
|
|
79
119
|
${stuck}
|
|
80
120
|
EOF
|
|
121
|
+
|
|
122
|
+
# A neighbour's conflict is said aloud and refuses nothing: this session has nothing to fix it
|
|
123
|
+
# with, and the one who leads the branch learns of it from nowhere else. The note is left for
|
|
124
|
+
# the guard to print — it has one output point, and a second JSON document next to the first
|
|
125
|
+
# would be read as plain text, that is, as no refusal at all.
|
|
126
|
+
if [ -n "$neighbour" ]; then
|
|
127
|
+
rt_delivery_neighbour_note="A conflicting request of a neighbouring session stands, and there is nothing here to fix it with:
|
|
128
|
+
|
|
129
|
+
${neighbour}
|
|
130
|
+
|
|
131
|
+
The branch is led by another session and holds its own commits: a merge of the main branch from the side takes that work away. Tell the owner about the request and take work as usual."
|
|
132
|
+
fi
|
|
81
133
|
[ -z "$listed" ] && return 0
|
|
82
134
|
|
|
83
135
|
deny "BLOCKED: ${taking} while a conflicting request of your own stands. What was handed over conflicts with the main branch, and a person cannot merge it:
|
|
@@ -65,15 +65,16 @@ rt_delivery_draft_ready() {
|
|
|
65
65
|
printf '%s' "$pull" | jq -e '.conflicting' >/dev/null 2>&1 \
|
|
66
66
|
&& fault "the request${pull_name} conflicts with the main branch. Merge it into your branch, resolve the conflict and repeat: a lifted draft reads as «ready to merge», and this request cannot be merged."
|
|
67
67
|
|
|
68
|
-
# The author of the PR.
|
|
69
|
-
#
|
|
70
|
-
#
|
|
71
|
-
#
|
|
72
|
-
#
|
|
68
|
+
# The author of the PR. The clash that breaks the review — the author named as the
|
|
69
|
+
# reviewer — is already caught by the condition above: the hosting silently does not
|
|
70
|
+
# create such a review request, so the PR comes here with no review at all. What is
|
|
71
|
+
# left here is to name a foreign account aloud: a PR opened by other than the machine
|
|
72
|
+
# one is lawful, and silence about it is indistinguishable from a check that did not
|
|
73
|
+
# fire. A tree that named no machine account says nothing.
|
|
73
74
|
if [ -n "$task_bot" ]; then
|
|
74
75
|
pull_author="$(printf '%s' "$pull" | jq -r '.author // empty' 2>/dev/null)"
|
|
75
76
|
[ -n "$pull_author" ] && [ "$pull_author" != "$task_bot" ] \
|
|
76
|
-
&&
|
|
77
|
+
&& printf 'the delivery guard: the request%s was opened by the account «%s», not the machine one «%s». It has a review, so the draft is lifted.\n' "$pull_name" "$pull_author" "$task_bot" >&2
|
|
77
78
|
fi
|
|
78
79
|
fi
|
|
79
80
|
fi
|
|
@@ -10,6 +10,13 @@
|
|
|
10
10
|
#
|
|
11
11
|
# WHAT IS HERE. Two calls, both called from the delivery guard, where `fault`, `main_branch` and
|
|
12
12
|
# the profile calls are already declared. The helper reads neither the input nor the settings.
|
|
13
|
+
#
|
|
14
|
+
# The assignment of an epic to this working copy is read next to this: it judges the same subject
|
|
15
|
+
# one step earlier — whether this copy leads the epic at all — so its helper is sourced here. The
|
|
16
|
+
# guard calls it in the branch block before the base: a fresh base does not cure a branch of
|
|
17
|
+
# someone else's epic, and a refusal about the base would send the executor to fix what is in order.
|
|
18
|
+
# shellcheck disable=SC1090
|
|
19
|
+
[ -f "$rt_hooks_dir/git-guard-tree-assignment.sh" ] && . "$rt_hooks_dir/git-guard-tree-assignment.sh" 2>/dev/null
|
|
13
20
|
|
|
14
21
|
# The branch of an epic by its number: the same form as a task branch — the profile pulls the
|
|
15
22
|
# number out of a name, and the epic branch is the one whose number is the epic's.
|