@rt-tools/agent-kit 0.24.0 → 0.27.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/agents/business-analyst.md +51 -50
- package/assets/agents/cargo-writer.md +54 -0
- package/assets/agents/conscience.md +37 -35
- package/assets/agents/project-manager.md +49 -48
- package/assets/agents/prose-editor.md +31 -29
- package/assets/agents/qa-engineer.md +50 -48
- package/assets/agents/rules-reviewer.md +63 -58
- package/assets/agents/skill-curator.md +83 -78
- package/assets/agents/spec-critic.md +34 -29
- package/assets/agents/spec-writer.md +35 -32
- package/assets/agents/strict-teacher.md +39 -37
- package/assets/checks/archive-age.mjs +48 -28
- package/assets/checks/archive-prune.mjs +16 -14
- package/assets/checks/board-epic-link.github.mjs +29 -0
- package/assets/checks/board-epics.github.mjs +286 -49
- package/assets/checks/board-folders.mjs +61 -0
- package/assets/checks/board-gh.github.mjs +35 -26
- package/assets/checks/board-long-work.github.mjs +29 -25
- package/assets/checks/board-paths.github.mjs +21 -16
- package/assets/checks/board-pull-state.github.mjs +168 -0
- package/assets/checks/board-runs.github.mjs +45 -43
- package/assets/checks/board-task-dirs.github.mjs +98 -0
- package/assets/checks/board-titles.github.mjs +19 -17
- package/assets/checks/board.github.mjs +133 -194
- package/assets/checks/check-archive-age.mjs +23 -19
- package/assets/checks/check-board.github.mjs +131 -263
- package/assets/checks/check-descriptions.mjs +30 -29
- package/assets/checks/check-doc-paths.mjs +91 -88
- package/assets/checks/check-dupes.mjs +84 -80
- package/assets/checks/check-file-size.mjs +74 -71
- package/assets/checks/check-glossary.mjs +47 -37
- package/assets/checks/check-hook-scope.mjs +30 -27
- package/assets/checks/check-lib-layers.mjs +22 -21
- package/assets/checks/check-profile-drift.mjs +48 -43
- package/assets/checks/check-prose-style.mjs +138 -39
- package/assets/checks/check-push-gate.mjs +53 -50
- package/assets/checks/check-reuse.mjs +50 -40
- package/assets/checks/check-schema-drift.mjs +104 -84
- package/assets/checks/check-specs.mjs +155 -134
- package/assets/checks/check-state-next.mjs +66 -52
- package/assets/checks/check-states.mjs +32 -30
- package/assets/checks/check-styles.mjs +52 -51
- package/assets/checks/check-turn-map.mjs +54 -46
- package/assets/checks/epic-table.github.mjs +268 -0
- package/assets/checks/lib-boundaries.mjs +32 -30
- package/assets/checks/lib-common.mjs +30 -29
- package/assets/checks/lib-domains.mjs +34 -34
- package/assets/checks/lib-manifests.mjs +17 -15
- package/assets/checks/lib-reexports.mjs +18 -18
- package/assets/checks/rt-kit-checks.config.mjs +187 -142
- package/assets/checks/signals.mjs +43 -39
- package/assets/checks/spec-anchors.mjs +114 -87
- package/assets/checks/spec-common.mjs +128 -84
- package/assets/checks/spec-contract.mjs +30 -30
- package/assets/checks/spec-proposed.mjs +27 -24
- package/assets/checks/spec-scenarios.mjs +51 -28
- package/assets/checks/specs-for.mjs +214 -0
- package/assets/checks/task-new.github.mjs +315 -61
- package/assets/commands/feedback.md +65 -59
- package/assets/commands/next-session.md +64 -57
- package/assets/commands/night.md +115 -0
- package/assets/commands/skill-curator.md +83 -79
- package/assets/defaults/gate-map.sh +108 -97
- package/assets/defaults/project.sh +232 -185
- package/assets/defaults/shell.sh +73 -68
- package/assets/defaults/turn-map.md +47 -44
- package/assets/docs/GLOSSARY.md +142 -65
- package/assets/hooks/browser-device-id.sh +16 -12
- package/assets/hooks/browser-guard-device-id.sh +34 -28
- package/assets/hooks/browser-guard-no-asking.sh +5 -4
- package/assets/hooks/browser-guard-no-listing.sh +12 -11
- package/assets/hooks/browser-guard-no-other-drivers.sh +48 -42
- package/assets/hooks/browser-guard-require-select.sh +34 -23
- package/assets/hooks/claim-guard.sh +62 -56
- package/assets/hooks/commit-msg.sh +14 -10
- package/assets/hooks/conscience-guard.sh +91 -45
- package/assets/hooks/constitution-index.sh +16 -16
- package/assets/hooks/deny-tail.sh +28 -26
- package/assets/hooks/dev-server-guard.sh +50 -43
- package/assets/hooks/dispatch.sh +60 -46
- package/assets/hooks/docs-guard.sh +100 -91
- package/assets/hooks/epic-over.sh +49 -0
- package/assets/hooks/epic-stop-guard.sh +108 -0
- package/assets/hooks/exam-guard.sh +105 -93
- package/assets/hooks/git-guard-delivery-conflict.sh +41 -36
- package/assets/hooks/git-guard-delivery-draft.sh +48 -38
- package/assets/hooks/git-guard-delivery-epic.sh +167 -0
- package/assets/hooks/git-guard-delivery-folder.sh +50 -43
- package/assets/hooks/git-guard-delivery-signature.sh +119 -53
- package/assets/hooks/git-guard-delivery.sh +223 -183
- package/assets/hooks/git-guard-main.sh +38 -34
- package/assets/hooks/git-guard-push-tests.sh +99 -87
- package/assets/hooks/glossary-load.sh +23 -22
- package/assets/hooks/grill-gate-ask.sh +12 -11
- package/assets/hooks/grill-gate.sh +94 -87
- package/assets/hooks/guard-note.sh +20 -19
- package/assets/hooks/handoff-entry-guard.sh +45 -25
- package/assets/hooks/handoff-write.sh +74 -67
- package/assets/hooks/hook-input.sh +67 -58
- package/assets/hooks/lint-after-edit.sh +95 -61
- package/assets/hooks/observe.sh +28 -26
- package/assets/hooks/override-write-guard.sh +23 -21
- package/assets/hooks/postmortem-guard.sh +42 -39
- package/assets/hooks/profile-check.sh +22 -20
- package/assets/hooks/proposal-guard.sh +57 -49
- package/assets/hooks/prose-style-guard.sh +49 -24
- package/assets/hooks/qa-dataid-guard.sh +83 -58
- package/assets/hooks/rerun-guard.sh +31 -30
- package/assets/hooks/reuse-first-guard.sh +108 -87
- package/assets/hooks/roles.sh +14 -14
- package/assets/hooks/rule-article.sh +39 -34
- package/assets/hooks/rule-source-guard.sh +47 -42
- package/assets/hooks/skill-gate-layers.sh +63 -57
- package/assets/hooks/skill-gate-rearm.sh +15 -8
- package/assets/hooks/skill-gate.sh +89 -81
- package/assets/hooks/skill-loaded.sh +10 -6
- package/assets/hooks/sql-guard-parse.sh +71 -66
- package/assets/hooks/sql-guard-request.sh +51 -46
- package/assets/hooks/sql-guard-target.sh +60 -51
- package/assets/hooks/sql-guard-write.sh +87 -79
- package/assets/hooks/sql-guard.sh +52 -47
- package/assets/hooks/stand-login-guard.sh +43 -37
- package/assets/hooks/task-context-load.sh +60 -55
- package/assets/hooks/task-flow-context.sh +87 -69
- package/assets/hooks/task-flow-draft-guard.sh +55 -48
- package/assets/hooks/task-flow-guard.sh +67 -64
- package/assets/hooks/turn-entry-load.sh +39 -32
- package/assets/hooks/turn-exit-guard.sh +260 -204
- package/assets/hooks/turn-exit-patterns.sh +63 -0
- package/assets/hooks/utf8.sh +14 -11
- package/assets/hooks/waiting-turn-guard.sh +104 -94
- package/assets/hooks/window-fill-guard.sh +70 -62
- package/assets/hooks/work-start-guard.sh +52 -49
- package/assets/hooks/write-targets.sh +99 -44
- package/assets/laws/autonomous-work.md +29 -27
- package/assets/laws/code-structure.md +31 -30
- package/assets/laws/delivery.md +170 -137
- package/assets/laws/entity-editing.md +52 -50
- package/assets/laws/entity-models.md +14 -13
- package/assets/laws/frontend-application.md +39 -38
- package/assets/laws/lib-imports.md +27 -27
- package/assets/laws/lists.md +31 -29
- package/assets/laws/navigation.md +37 -37
- package/assets/laws/observability.md +41 -40
- package/assets/laws/project-documentation.md +106 -99
- package/assets/laws/reuse-first.md +31 -29
- package/assets/laws/shared-code.md +27 -27
- package/assets/laws/verifiability.md +131 -124
- package/assets/laws/work-conduct.md +250 -244
- package/assets/patterns/admin-lists-screen.md +72 -69
- package/assets/patterns/admin-nav-item.md +51 -46
- package/assets/patterns/angular-patterns-state.md +32 -31
- package/assets/patterns/api-layer-pair.md +33 -31
- package/assets/patterns/autonomous-work-run.md +50 -49
- package/assets/patterns/browser-verification-measure.md +124 -88
- package/assets/patterns/browser-verification-stand.md +169 -157
- package/assets/patterns/component-structure-new.md +51 -42
- package/assets/patterns/dependencies-upgrade.md +55 -39
- package/assets/patterns/doc-style-human.md +55 -37
- package/assets/patterns/doc-style-sweep.md +82 -79
- package/assets/patterns/doc-style-trace.md +87 -81
- package/assets/patterns/doc-style-write.md +130 -122
- package/assets/patterns/entity-aside.md +77 -63
- package/assets/patterns/entity-models-new.md +37 -37
- package/assets/patterns/entity-store.md +33 -33
- package/assets/patterns/git-workflow-commit.azure.md +94 -87
- package/assets/patterns/git-workflow-commit.github.md +160 -142
- package/assets/patterns/git-workflow-commit.gitlab.md +96 -90
- package/assets/patterns/git-workflow-docker.md +165 -147
- package/assets/patterns/git-workflow-freshness.md +45 -45
- package/assets/patterns/git-workflow-merge.md +102 -94
- package/assets/patterns/git-workflow-migration.md +54 -52
- package/assets/patterns/git-workflow-pr-ready.md +57 -56
- package/assets/patterns/git-workflow-pr.azure.md +127 -122
- package/assets/patterns/git-workflow-pr.github.md +186 -177
- package/assets/patterns/git-workflow-pr.gitlab.md +139 -132
- package/assets/patterns/git-workflow-restart.md +35 -31
- package/assets/patterns/git-workflow-secrets.md +80 -73
- package/assets/patterns/git-workflow-stack.md +136 -107
- package/assets/patterns/lib-layers-move.md +62 -53
- package/assets/patterns/lib-layers-new.md +59 -45
- package/assets/patterns/observability-record.md +72 -67
- package/assets/patterns/platform-access-di.md +31 -29
- package/assets/patterns/reuse-first-extend.md +66 -61
- package/assets/patterns/shared-code-new.md +39 -38
- package/assets/patterns/spec-driven-domain.md +161 -151
- package/assets/patterns/spec-driven-rule.md +179 -168
- package/assets/patterns/spec-driven-sweep.md +41 -39
- package/assets/patterns/status-report-table.github.md +48 -36
- package/assets/patterns/styling-bem-component.md +42 -42
- package/assets/patterns/styling-bem-layout.md +39 -34
- package/assets/patterns/styling-bem-sheet.md +59 -58
- package/assets/patterns/task-flow-archive.md +222 -215
- package/assets/patterns/task-flow-close.md +234 -203
- package/assets/patterns/task-flow-handoff.md +154 -145
- package/assets/patterns/task-flow-resume.md +138 -133
- package/assets/patterns/task-flow-start.md +228 -202
- package/assets/patterns/testing-e2e.md +102 -101
- package/assets/patterns/testing-unit.md +77 -70
- package/assets/patterns/ts-procedure.md +32 -29
- package/assets/patterns/turn-entry-map.md +50 -48
- package/assets/pitfalls/agent-kit.md +172 -142
- package/assets/pitfalls/doc-style.md +96 -91
- package/assets/pitfalls/git-workflow.azure.md +49 -46
- package/assets/pitfalls/git-workflow.github.md +270 -234
- package/assets/pitfalls/git-workflow.gitlab.md +49 -45
- package/assets/pitfalls/spec-driven.md +73 -71
- package/assets/pitfalls/styling-bem.md +46 -40
- package/assets/pitfalls/task-flow.md +262 -246
- package/assets/pitfalls/testing.md +99 -92
- package/assets/pitfalls/turn-conduct.md +96 -81
- package/assets/rules/angular-patterns.md +81 -80
- package/assets/rules/api-layer.md +77 -74
- package/assets/rules/autonomous-work.md +87 -74
- package/assets/rules/browser-verification.md +223 -214
- package/assets/rules/component-structure.md +72 -69
- package/assets/rules/dependencies.md +74 -67
- package/assets/rules/deploy-flow.azure.md +118 -108
- package/assets/rules/deploy-flow.github.md +145 -135
- package/assets/rules/deploy-flow.gitlab.md +120 -110
- package/assets/rules/doc-style.md +201 -173
- package/assets/rules/entity-conventions.needs-admin.md +81 -79
- package/assets/rules/entity-models.md +73 -70
- package/assets/rules/git-workflow.azure.md +224 -228
- package/assets/rules/git-workflow.github.md +268 -239
- package/assets/rules/git-workflow.gitlab.md +218 -217
- package/assets/rules/lib-layers.md +85 -86
- package/assets/rules/lists.md +101 -97
- package/assets/rules/navigation.md +78 -78
- package/assets/rules/observability.needs-app.md +165 -153
- package/assets/rules/platform-access.md +76 -75
- package/assets/rules/reuse-first.md +153 -143
- package/assets/rules/shared-code.md +82 -79
- package/assets/rules/spec-driven.md +279 -260
- package/assets/rules/status-report.md +62 -58
- package/assets/rules/styling-bem.md +81 -77
- package/assets/rules/task-flow.md +303 -270
- package/assets/rules/testing.md +224 -209
- package/assets/rules/turn-conduct.md +262 -258
- package/assets/rules/turn-entry.md +92 -87
- package/assets/rules/typescript-conventions.md +94 -88
- package/assets/samples/specs/_template/spec.md +47 -47
- package/assets/samples/tasks/_template/grill.md +20 -20
- package/assets/samples/tasks/_template/plan.md +32 -30
- package/assets/samples/tasks/_template/progress.md +16 -16
- package/assets/skills/agent-kit-extend.md +129 -113
- package/assets/skills/agent-kit.md +259 -233
- package/assets/skills/write-a-skill.md +76 -71
- package/assets/templates/findings.md +19 -19
- package/assets/templates/gate-map.sh +16 -14
- package/assets/templates/implementation.md +28 -27
- package/assets/templates/pattern.md +17 -17
- package/assets/templates/pitfalls.md +6 -6
- package/assets/templates/postmortem.md +24 -23
- package/assets/templates/project.sh +24 -24
- package/assets/templates/proposal.md +62 -60
- package/assets/templates/rule.md +38 -38
- package/assets/workflows/feature.js +46 -46
- package/assets/workflows/plan.js +54 -54
- package/bin/agent-kit.d.ts.map +1 -1
- package/bin/agent-kit.js +8 -1
- package/bin/agent-kit.js.map +1 -1
- package/lib/cargo-prose.d.ts +41 -0
- package/lib/cargo-prose.d.ts.map +1 -0
- package/lib/cargo-prose.js +88 -0
- package/lib/cargo-prose.js.map +1 -0
- package/lib/cargo.d.ts +12 -1
- package/lib/cargo.d.ts.map +1 -1
- package/lib/cargo.js +8 -2
- package/lib/cargo.js.map +1 -1
- package/lib/catalog.d.ts +2 -0
- package/lib/catalog.d.ts.map +1 -1
- package/lib/catalog.js +4 -3
- package/lib/catalog.js.map +1 -1
- package/lib/commands.d.ts.map +1 -1
- package/lib/commands.js +5 -2
- package/lib/commands.js.map +1 -1
- package/lib/companion.js +3 -2
- package/lib/companion.js.map +1 -1
- package/lib/enroll.d.ts +7 -1
- package/lib/enroll.d.ts.map +1 -1
- package/lib/enroll.js +12 -3
- package/lib/enroll.js.map +1 -1
- package/lib/fate.d.ts +29 -0
- package/lib/fate.d.ts.map +1 -0
- package/lib/fate.js +147 -0
- package/lib/fate.js.map +1 -0
- package/lib/override-marks.d.ts +7 -0
- package/lib/override-marks.d.ts.map +1 -1
- package/lib/override-marks.js +14 -0
- package/lib/override-marks.js.map +1 -1
- package/lib/plan.d.ts +11 -0
- package/lib/plan.d.ts.map +1 -1
- package/lib/plan.js +10 -1
- package/lib/plan.js.map +1 -1
- package/lib/ship.d.ts +29 -9
- package/lib/ship.d.ts.map +1 -1
- package/lib/ship.js +44 -2
- package/lib/ship.js.map +1 -1
- package/lib/shipment.d.ts.map +1 -1
- package/lib/shipment.fixture.d.ts +8 -1
- package/lib/shipment.fixture.d.ts.map +1 -1
- package/lib/shipment.fixture.js +9 -0
- package/lib/shipment.fixture.js.map +1 -1
- package/lib/shipment.js +38 -5
- package/lib/shipment.js.map +1 -1
- package/lib/sync.d.ts.map +1 -1
- package/lib/sync.js +45 -11
- package/lib/sync.js.map +1 -1
- package/package.json +1 -1
- package/rt-tools-agent-kit-0.27.0.tgz +0 -0
- package/rt-tools-agent-kit-0.24.0.tgz +0 -0
|
@@ -1,27 +1,30 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
# rt-hook: Stop
|
|
3
|
-
#
|
|
4
|
-
#
|
|
5
|
-
#
|
|
3
|
+
# Requires: hooks/deny-tail.sh
|
|
4
|
+
# Incident guard: a turn in which the executor admitted a miss does not end while there is no
|
|
5
|
+
# incident record. Stop.
|
|
6
6
|
#
|
|
7
|
-
#
|
|
8
|
-
#
|
|
9
|
-
#
|
|
10
|
-
#
|
|
7
|
+
# Why exactly so. An incident — a session in which the executor did the wrong thing and the rules
|
|
8
|
+
# layer did not refuse it — leaves no code behind that could be fixed. Such a session ends with an
|
|
9
|
+
# apology in the chat: the next day the mechanism of the miss is retold already smoothed over,
|
|
10
|
+
# conclusions remain, and no rule follows from conclusions. An analysis happened only when the
|
|
11
|
+
# owner demanded it out loud.
|
|
11
12
|
#
|
|
12
|
-
#
|
|
13
|
-
#
|
|
14
|
-
#
|
|
15
|
-
#
|
|
13
|
+
# The admission is caught by patterns, not by understanding the meaning: the verdict "that was a
|
|
14
|
+
# miss" would be given by the one it inconveniences, and the threshold would drift. The pattern
|
|
15
|
+
# set is visible, is extended by an edit and misses noticeably — a session that admitted a miss
|
|
16
|
+
# in words outside the set is passed by the guard, and this is said out loud in the agreement
|
|
17
|
+
# rather than counted as closed.
|
|
16
18
|
#
|
|
17
|
-
#
|
|
18
|
-
#
|
|
19
|
-
# —
|
|
19
|
+
# It is caught at the end of the turn, not on sending the reply: by the moment of the admission
|
|
20
|
+
# the miss has already happened, and there is nothing to catch earlier. This sets it apart from
|
|
21
|
+
# the conversation guard, which has a tool of its own — a question to the owner.
|
|
20
22
|
#
|
|
21
|
-
#
|
|
22
|
-
#
|
|
23
|
+
# FAIL-OPEN: on any error, with no turn record and on a repeat pass the turn is ALLOWED (exit 0).
|
|
24
|
+
# A broken guard has no right to jam the conversation.
|
|
23
25
|
|
|
24
|
-
#
|
|
26
|
+
# Own name in the observations: the refusal is written by the shared refusal tail, not by the
|
|
27
|
+
# guard itself.
|
|
25
28
|
RT_GUARD_NAME=postmortem-guard
|
|
26
29
|
|
|
27
30
|
. "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/utf8.sh" 2>/dev/null || true
|
|
@@ -33,7 +36,7 @@ input="$RT_HOOK_INPUT"
|
|
|
33
36
|
|
|
34
37
|
command -v jq >/dev/null 2>&1 || exit 0
|
|
35
38
|
|
|
36
|
-
#
|
|
39
|
+
# A repeat pass over the same turn is not judged: the guard has said its word once and lets go.
|
|
37
40
|
active="$(printf '%s' "$input" | jq -r '.stop_hook_active // false' 2>/dev/null)"
|
|
38
41
|
[ "$active" = "true" ] && exit 0
|
|
39
42
|
|
|
@@ -43,11 +46,11 @@ transcript="$(printf '%s' "$input" | jq -r '.transcript_path // empty' 2>/dev/nu
|
|
|
43
46
|
|
|
44
47
|
root="${CLAUDE_PROJECT_DIR:-.}"
|
|
45
48
|
|
|
46
|
-
#
|
|
47
|
-
#
|
|
48
|
-
#
|
|
49
|
-
#
|
|
50
|
-
#
|
|
49
|
+
# The records directory is the tree's own, and the tree settings name it — by the same key the
|
|
50
|
+
# cargo dispatch reads it with. One name for both sides: a tree that moved the directory out of
|
|
51
|
+
# history would otherwise get a guard looking for records at the old address — and it would stay
|
|
52
|
+
# silent forever. The variable remains a bypass for one launch, and an empty string in either of
|
|
53
|
+
# the two is the tree's refusal of the demand: a tree that keeps no records is not forced to.
|
|
51
54
|
if [ -n "${RT_POSTMORTEMS_DIR+set}" ]; then
|
|
52
55
|
notes_dir="$RT_POSTMORTEMS_DIR"
|
|
53
56
|
elif [ -f "$root/.claude/rt-kit.json" ]; then
|
|
@@ -58,14 +61,14 @@ fi
|
|
|
58
61
|
[ -z "$notes_dir" ] && exit 0
|
|
59
62
|
[ -d "$root/$notes_dir" ] || exit 0
|
|
60
63
|
|
|
61
|
-
#
|
|
62
|
-
#
|
|
64
|
+
# Patterns of admitting a miss. The set is open and is extended by an edit: its completeness is
|
|
65
|
+
# an open question of the agreement, not a promise.
|
|
63
66
|
admitted_re='был неправ|был не прав|ошибс|моя ошибк|мой промах|промахнул|проглядел|не проверил|соврал|виноват|извин|прошу прощения|неверно утверждал|утверждение было ложн|принял на веру'
|
|
64
67
|
|
|
65
|
-
#
|
|
66
|
-
#
|
|
68
|
+
# The turn is everything recorded after the owner's last real input. A tool result arrives under
|
|
69
|
+
# the same role, so lines with `tool_result` do not count as input.
|
|
67
70
|
#
|
|
68
|
-
#
|
|
71
|
+
# A tail of 400 lines: the turn record grows all session long, and only the last turn is judged.
|
|
69
72
|
verdict="$(tail -n 400 "$transcript" 2>/dev/null | jq -s -r --arg re "$admitted_re" '
|
|
70
73
|
def is_input:
|
|
71
74
|
.type == "user"
|
|
@@ -78,8 +81,8 @@ verdict="$(tail -n 400 "$transcript" 2>/dev/null | jq -s -r --arg re "$admitted_
|
|
|
78
81
|
| (if $i == null then . else .[$i + 1:] end) as $turn
|
|
79
82
|
| [$turn[] | select(.type == "assistant") | (.message.content // [])[] | select(.type == "text") | .text] as $texts
|
|
80
83
|
| [$turn[] | select(.type == "assistant") | (.message.content // [])[] | select(.type == "tool_use")] as $uses
|
|
81
|
-
#
|
|
82
|
-
#
|
|
84
|
+
# The sign is case-insensitive by a flag, not by lowercasing: lowercasing knows only Latin
|
|
85
|
+
# letters, and a capitalised "Был неправ" would slip past the pattern set silently.
|
|
83
86
|
| (($texts | join("\n")) | test($re; "i")) as $admitted
|
|
84
87
|
| ($uses | map(
|
|
85
88
|
((.name // "") | test("^(Write|Edit|MultiEdit)$"))
|
|
@@ -90,22 +93,22 @@ verdict="$(tail -n 400 "$transcript" 2>/dev/null | jq -s -r --arg re "$admitted_
|
|
|
90
93
|
|
|
91
94
|
[ "$verdict" = "admit" ] || exit 0
|
|
92
95
|
|
|
93
|
-
#
|
|
94
|
-
#
|
|
96
|
+
# A record made during this session lifts the demand even without an edit in this same turn: the
|
|
97
|
+
# analysis may have landed as a file a turn earlier — the one in which the miss was admitted.
|
|
95
98
|
if [ -n "$(find "$root/$notes_dir" -name '*.md' -newermt '-1 day' 2>/dev/null | head -1)" ]; then
|
|
96
99
|
exit 0
|
|
97
100
|
fi
|
|
98
101
|
|
|
99
|
-
reason="BLOCKED by postmortem-guard:
|
|
102
|
+
reason="BLOCKED by postmortem-guard: a miss is admitted in the reply, and there is no record of the incident in \`$notes_dir/\` for today. An incident — a session in which the executor did the wrong thing and the rules layer did not refuse it — is written down in that same session: by the next day the mechanism of the miss is retold already smoothed over, and no rule comes out of it.
|
|
100
103
|
|
|
101
|
-
|
|
104
|
+
The record names: the mechanism of the miss step by step, what was available before it, what caught it and what of this went into the rules layer. Without the last line it is a complaint, not an analysis.
|
|
102
105
|
|
|
103
|
-
$notes_dir
|
|
106
|
+
$notes_dir/<year>-<month>-<day>-<short name>.md
|
|
104
107
|
|
|
105
|
-
|
|
108
|
+
The guard judges one turn: the next session is not refused."
|
|
106
109
|
|
|
107
|
-
#
|
|
108
|
-
#
|
|
110
|
+
# The shared refusal tail: two lawful moves. The file may not be laid out — then there is no
|
|
111
|
+
# tail, and the reason for the refusal stays as it was.
|
|
109
112
|
# shellcheck disable=SC1090
|
|
110
113
|
[ -f "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/deny-tail.sh" ] \
|
|
111
114
|
&& . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/deny-tail.sh" 2>/dev/null
|
|
@@ -116,6 +119,6 @@ deny_tail_text="$(rt_deny_tail "")"
|
|
|
116
119
|
${deny_tail_text}"
|
|
117
120
|
|
|
118
121
|
jq -n --arg r "$reason" '{decision:"block",reason:$r}' 2>/dev/null \
|
|
119
|
-
|| printf '{"decision":"block","reason":"postmortem-guard:
|
|
122
|
+
|| printf '{"decision":"block","reason":"postmortem-guard: a miss is admitted — write the analysis of the incident."}\n'
|
|
120
123
|
|
|
121
124
|
exit 0
|
|
@@ -1,41 +1,43 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
-
#
|
|
3
|
-
#
|
|
4
|
-
#
|
|
2
|
+
# A missing profile function, said out loud. NOT a guard: it has no `rt-hook:` declaration and hooks
|
|
3
|
+
# into no agent event. The guards source it themselves — the same way the gate sources the map and
|
|
4
|
+
# the guards source the observation record.
|
|
5
5
|
#
|
|
6
|
-
#
|
|
7
|
-
#
|
|
8
|
-
#
|
|
9
|
-
#
|
|
10
|
-
#
|
|
6
|
+
# Why it exists. Nine hooks of the package call functions of the tree profile, and in five of them
|
|
7
|
+
# the check stands before any behaviour: no function — exit with zero, having done nothing. Such a
|
|
8
|
+
# guard is worse than a missing one: it lies in the tree, stands in the settings, shows in the hook
|
|
9
|
+
# list and reads as working. Its silence then means three different things at once — "nothing to
|
|
10
|
+
# check", "nothing to check with" and "all is well" — and there is no way to tell them apart.
|
|
11
11
|
#
|
|
12
|
-
#
|
|
13
|
-
#
|
|
12
|
+
# WHAT IS SAID. The function name and the file where it is defined. Once per session: on every call
|
|
13
|
+
# the same line would repeat dozens of times per session and stop being read.
|
|
14
14
|
#
|
|
15
|
-
#
|
|
16
|
-
#
|
|
15
|
+
# THE ACTION PASSES ANYWAY. The hook reports its own incompleteness and does not judge the edit:
|
|
16
|
+
# there is nothing to judge it with, and it has no right to refuse work because of an unconfigured
|
|
17
|
+
# tree.
|
|
17
18
|
|
|
18
|
-
#
|
|
19
|
-
#
|
|
19
|
+
# Where the "already said" mark is put. The temporary files directory, not the tree: the mark lives
|
|
20
|
+
# one session and does not go into history.
|
|
20
21
|
rt_needs_mark_dir() {
|
|
21
22
|
printf '%s' "${TMPDIR:-/tmp}"
|
|
22
23
|
}
|
|
23
24
|
|
|
24
|
-
#
|
|
25
|
+
# Is the profile function there. Success — it is, and the hook works on. Failure — it is not, and
|
|
26
|
+
# this has been said.
|
|
25
27
|
#
|
|
26
28
|
# rt_needs rt_is_app_code task-flow-guard "$sid"
|
|
27
29
|
#
|
|
28
|
-
#
|
|
29
|
-
#
|
|
30
|
+
# The third parameter is the session id, if the hook knows it. If not, the mark is put for the day:
|
|
31
|
+
# without the id, "once per session" would turn into "once in the machine's lifetime".
|
|
30
32
|
rt_needs() {
|
|
31
33
|
command -v "$1" >/dev/null 2>&1 && return 0
|
|
32
34
|
|
|
33
35
|
rt_needs_key="${3:-$(date +%Y%m%d 2>/dev/null || printf 'nosession')}"
|
|
34
36
|
rt_needs_mark="$(rt_needs_mark_dir)/rt-kit-needs-$1-$rt_needs_key"
|
|
35
37
|
if [ ! -f "$rt_needs_mark" ]; then
|
|
36
|
-
printf '%s:
|
|
37
|
-
"${2
|
|
38
|
-
printf '
|
|
38
|
+
printf '%s: no function %s — it is defined in .claude/rt-kit/project.sh, and the default is carried by the package in .claude/rt-kit/defaults/project.sh\n' \
|
|
39
|
+
"${2:-hook}" "$1" >&2
|
|
40
|
+
printf 'the check does not work, the action is let through\n' >&2
|
|
39
41
|
: >"$rt_needs_mark" 2>/dev/null || true
|
|
40
42
|
fi
|
|
41
43
|
|
|
@@ -1,26 +1,29 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
# rt-hook: Stop
|
|
3
|
-
#
|
|
4
|
-
#
|
|
5
|
-
#
|
|
3
|
+
# Requires: hooks/deny-tail.sh
|
|
4
|
+
# Proposal guard: a turn in which the owner said to write or send a proposal to the rules layer
|
|
5
|
+
# does not end until the sending has happened. Stop.
|
|
6
6
|
#
|
|
7
|
-
#
|
|
8
|
-
#
|
|
9
|
-
#
|
|
10
|
-
#
|
|
7
|
+
# Why this way. What is written and not sent lies in the tree indistinguishable from what was
|
|
8
|
+
# sent: it has no record of its own in the rules layer, and the owner reads the work as done until
|
|
9
|
+
# they ask directly. Sending is inconvenient in exactly one place — it writes marks into the
|
|
10
|
+
# proposal files and makes the tree dirty — and with that argument the executor closes the
|
|
11
|
+
# silence of the rules.
|
|
11
12
|
#
|
|
12
|
-
#
|
|
13
|
-
#
|
|
14
|
-
#
|
|
15
|
-
#
|
|
13
|
+
# The request is caught by samples, not by understanding the meaning: the appraisal "the owner
|
|
14
|
+
# asked to send" would be assigned by whoever it hinders. The verb is mandatory: "go through the
|
|
15
|
+
# proposals" is work on what has already arrived, and it does not end with sending. The word
|
|
16
|
+
# "proposal" alone does not count either — it appears in every second turn about something else,
|
|
17
|
+
# and next to it a word about the rules layer or about the package is needed.
|
|
16
18
|
#
|
|
17
|
-
#
|
|
18
|
-
#
|
|
19
|
+
# Sending is a call of the package command without a dry run, made in the same turn: a dry run
|
|
20
|
+
# shows what would leave, creates nothing and leaves no trace outside.
|
|
19
21
|
#
|
|
20
|
-
#
|
|
21
|
-
#
|
|
22
|
+
# FAIL-OPEN: on any error, missing `jq`, missing turn transcript and a repeated pass, the turn is
|
|
23
|
+
# ALLOWED (exit 0). A broken guard has no right to jam the conversation.
|
|
22
24
|
|
|
23
|
-
#
|
|
25
|
+
# Its own name in the observations: the refusal is written by the shared deny tail, not by the
|
|
26
|
+
# guard itself.
|
|
24
27
|
RT_GUARD_NAME=proposal-guard
|
|
25
28
|
|
|
26
29
|
. "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/utf8.sh" 2>/dev/null || true
|
|
@@ -32,7 +35,7 @@ input="$RT_HOOK_INPUT"
|
|
|
32
35
|
|
|
33
36
|
command -v jq >/dev/null 2>&1 || exit 0
|
|
34
37
|
|
|
35
|
-
#
|
|
38
|
+
# A repeated pass over the same turn is not judged: the guard has said its word once and lets go.
|
|
36
39
|
active="$(printf '%s' "$input" | jq -r '.stop_hook_active // false' 2>/dev/null)"
|
|
37
40
|
[ "$active" = "true" ] && exit 0
|
|
38
41
|
|
|
@@ -40,37 +43,41 @@ transcript="$(printf '%s' "$input" | jq -r '.transcript_path // empty' 2>/dev/nu
|
|
|
40
43
|
[ -z "$transcript" ] && exit 0
|
|
41
44
|
[ -f "$transcript" ] || exit 0
|
|
42
45
|
|
|
43
|
-
#
|
|
44
|
-
#
|
|
45
|
-
#
|
|
46
|
-
#
|
|
46
|
+
# The proposals directory is the tree's own. Set to empty, it is the tree's opt-out from the
|
|
47
|
+
# requirement: a tree that does not take the portable rules layer gets no guard imposed on it. No
|
|
48
|
+
# directory on disk — the same: the tree does not use the mechanism, and the guard is not imposed
|
|
49
|
+
# on it. Judging by one variable alone would demand sending where there is nothing to send with
|
|
50
|
+
# and nowhere to send to.
|
|
47
51
|
root="${CLAUDE_PROJECT_DIR:-.}"
|
|
48
52
|
proposals_dir="${RT_PROPOSALS_DIR-.claude/rt-kit/proposals}"
|
|
49
53
|
[ -z "$proposals_dir" ] && exit 0
|
|
50
54
|
[ -d "$root/$proposals_dir" ] || exit 0
|
|
51
55
|
|
|
52
|
-
#
|
|
53
|
-
#
|
|
56
|
+
# The owner's request. The set is open and grows by editing: its completeness is an open question
|
|
57
|
+
# of the agreement, not a promise.
|
|
54
58
|
#
|
|
55
|
-
#
|
|
56
|
-
#
|
|
57
|
-
#
|
|
59
|
+
# Latin script is read on equal terms: a session the owner conducts in English differs from a
|
|
60
|
+
# Russian one by its words, and the requirement in it is the same. It gets no branch of its own —
|
|
61
|
+
# both pairs stand in one sample, otherwise one of them would be edited while the other is
|
|
62
|
+
# forgotten.
|
|
58
63
|
asked_re='(завед|напиш|отправ|пошл|зашл|отошл|выгруз|send|file|open|submit|raise|report)[а-яёa-z]*[^.!?]{0,40}(пропозал|предложени|proposal)|(пропозал|предложени|proposal)[а-яёa-z]*[^.!?]{0,40}(завед|напиш|отправ|пошл|зашл|отошл|выгруз|send|file|open|submit|raise|report)'
|
|
59
64
|
|
|
60
|
-
#
|
|
65
|
+
# The neighbour without which the word "proposal" does not count as a request about the rules
|
|
66
|
+
# layer.
|
|
61
67
|
context_re='пропозал|слою правил|слоя правил|слой правил|пакет|agent-kit|наверх|proposal|rule layer|upstream|package'
|
|
62
68
|
|
|
63
|
-
#
|
|
64
|
-
#
|
|
69
|
+
# A turn is everything recorded after the owner's last real input. A tool result arrives under
|
|
70
|
+
# the same role, so lines with `tool_result` are not counted as input.
|
|
65
71
|
#
|
|
66
|
-
#
|
|
67
|
-
#
|
|
68
|
-
#
|
|
69
|
-
#
|
|
70
|
-
#
|
|
71
|
-
#
|
|
72
|
+
# A compaction summary is not input either, although it arrives under the owner's role and is not
|
|
73
|
+
# a tool result. It retells turns that have already ended, and a request fulfilled yesterday reads
|
|
74
|
+
# in it as said now: a turn in which not a word was said about proposals was refused on a retelling
|
|
75
|
+
# of someone else's request — the proposals directory was empty at the time, and there was nothing
|
|
76
|
+
# to send at all. By its words the summary is indistinguishable from the owner's speech and richer
|
|
77
|
+
# than it, because it retells the whole session at once; it is recognised by a mark on the record,
|
|
78
|
+
# not by the text.
|
|
72
79
|
#
|
|
73
|
-
#
|
|
80
|
+
# A 400-line tail: the transcript grows all session long, and only the last turn is judged.
|
|
74
81
|
verdict="$(tail -n 400 "$transcript" 2>/dev/null | jq -s -r --arg asked "$asked_re" --arg ctx "$context_re" '
|
|
75
82
|
def is_input:
|
|
76
83
|
.type == "user"
|
|
@@ -88,8 +95,8 @@ verdict="$(tail -n 400 "$transcript" 2>/dev/null | jq -s -r --arg asked "$asked_
|
|
|
88
95
|
| (if $i == null then [] else .[$i:] end) as $turn
|
|
89
96
|
| (if $i == null then "" else ($turn[0] | text_of) end) as $said
|
|
90
97
|
| [$turn[] | select(.type == "assistant") | (.message.content // [])[] | select(.type == "tool_use")] as $uses
|
|
91
|
-
#
|
|
92
|
-
#
|
|
98
|
+
# The sign is case-insensitive by a flag, not by lowercasing: lowercasing knows Latin script
|
|
99
|
+
# only, and a capitalised "Send the Proposal" in Cyrillic would pass the sample set silently.
|
|
93
100
|
| (($said | test($asked; "i")) and ($said | test($ctx; "i"))) as $wanted
|
|
94
101
|
| ($uses | map(
|
|
95
102
|
((.name // "") | test("^Bash$"))
|
|
@@ -101,10 +108,11 @@ verdict="$(tail -n 400 "$transcript" 2>/dev/null | jq -s -r --arg asked "$asked_
|
|
|
101
108
|
|
|
102
109
|
[ "$verdict" = "owe" ] || exit 0
|
|
103
110
|
|
|
104
|
-
#
|
|
105
|
-
#
|
|
106
|
-
#
|
|
107
|
-
#
|
|
111
|
+
# The sending command is named as the one that runs in this tree. A tree that installed the
|
|
112
|
+
# package as a dependency calls the binary from its dependencies; a tree where the package lives
|
|
113
|
+
# as sources has no binary at all — there the built bin is called. A command named at random
|
|
114
|
+
# costs the executor a turn: the refusal reads as an instruction, and a `npx agent-kit` call in
|
|
115
|
+
# such a tree answers with an installation refusal.
|
|
108
116
|
if [ -x "$root/node_modules/.bin/agent-kit" ]; then
|
|
109
117
|
propose_cmd="npx agent-kit propose"
|
|
110
118
|
else
|
|
@@ -116,18 +124,18 @@ else
|
|
|
116
124
|
fi
|
|
117
125
|
fi
|
|
118
126
|
|
|
119
|
-
reason="BLOCKED by proposal-guard:
|
|
127
|
+
reason="BLOCKED by proposal-guard: the owner said to create or send a proposal to the rules layer, and no sending happened in this turn. What is written and not sent lies in the tree indistinguishable from what was sent: it has no record of its own in the rules layer, and the owner reads the work as done until they ask outright.
|
|
120
128
|
|
|
121
|
-
|
|
129
|
+
A proposal is written as a file in \`$proposals_dir/\` and leaves in the same turn:
|
|
122
130
|
|
|
123
131
|
$propose_cmd
|
|
124
132
|
|
|
125
|
-
|
|
133
|
+
A dry run is not a sending: it shows what would have left and leaves no trace outward. The sending writes marks into the proposal files and makes the tree dirty — with an open PR they land as a second commit in the same branch, and that is their place, not a reason to postpone.
|
|
126
134
|
|
|
127
|
-
|
|
135
|
+
The guard judges one turn: the next session is not refused."
|
|
128
136
|
|
|
129
|
-
#
|
|
130
|
-
#
|
|
137
|
+
# The shared deny tail: the two lawful moves. The file may not be laid out — then there is no
|
|
138
|
+
# tail, and the reason for the refusal stays the same.
|
|
131
139
|
# shellcheck disable=SC1090
|
|
132
140
|
[ -f "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/deny-tail.sh" ] \
|
|
133
141
|
&& . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/deny-tail.sh" 2>/dev/null
|
|
@@ -138,6 +146,6 @@ deny_tail_text="$(rt_deny_tail "")"
|
|
|
138
146
|
${deny_tail_text}"
|
|
139
147
|
|
|
140
148
|
jq -n --arg r "$reason" '{decision:"block",reason:$r}' 2>/dev/null \
|
|
141
|
-
|| printf '{"decision":"block","reason":"proposal-guard:
|
|
149
|
+
|| printf '{"decision":"block","reason":"proposal-guard: the owner asked for a proposal — send it by the command of the package."}\n'
|
|
142
150
|
|
|
143
151
|
exit 0
|
|
@@ -1,18 +1,25 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
-
# rt-hook: PreToolUse Edit|Write|MultiEdit
|
|
3
|
-
#
|
|
4
|
-
#
|
|
2
|
+
# rt-hook: PreToolUse Edit|Write|MultiEdit|Bash|mcp__webstorm__execute_terminal_command|mcp__webstorm__execute_tool
|
|
3
|
+
# Requires: checks/check-prose-style.mjs, hooks/deny-tail.sh, hooks/write-targets.sh
|
|
4
|
+
# Prose guard: officialese and words that are not written in this tree do not reach the file.
|
|
5
5
|
#
|
|
6
|
-
#
|
|
7
|
-
#
|
|
8
|
-
#
|
|
6
|
+
# The rule about texts demands plain words, and this was held only by the memory of whoever writes:
|
|
7
|
+
# not one wording convention was checked. The owner reads what was written and sees machine prose
|
|
8
|
+
# where the convention demands human prose.
|
|
9
9
|
#
|
|
10
|
-
#
|
|
11
|
-
#
|
|
10
|
+
# Only the new text of the edit is judged, not the whole file: what has accumulated is fixed by a
|
|
11
|
+
# separate piece of work, and refusing an edit of a neighbouring line because of it would make the
|
|
12
|
+
# guard bypassed out of necessity.
|
|
12
13
|
#
|
|
13
|
-
#
|
|
14
|
+
# A write by a shell command is judged the same as one by the edit tool: the same text with the name
|
|
15
|
+
# of the shell instead of the name of the edit gave silence, and a document written by a heredoc
|
|
16
|
+
# went past the wording convention whole. The path is taken by the shared parse of write targets,
|
|
17
|
+
# and the new text is the body of the command — the written text stands inside it.
|
|
18
|
+
#
|
|
19
|
+
# FAIL-OPEN: no node, no check, a foreign tool, not `.md` → pass.
|
|
14
20
|
|
|
15
|
-
#
|
|
21
|
+
# Its own name in the observations: the refusal is recorded by the shared deny tail, not by the
|
|
22
|
+
# guard itself.
|
|
16
23
|
RT_GUARD_NAME=prose-style-guard
|
|
17
24
|
|
|
18
25
|
. "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/utf8.sh" 2>/dev/null || true
|
|
@@ -24,28 +31,46 @@ input="$RT_HOOK_INPUT"
|
|
|
24
31
|
command -v jq >/dev/null 2>&1 || exit 0
|
|
25
32
|
command -v node >/dev/null 2>&1 || exit 0
|
|
26
33
|
|
|
34
|
+
rt_hooks_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
35
|
+
|
|
36
|
+
# The write targets are taken by the shared parse: the same sign serves the guard of the place of an
|
|
37
|
+
# edit, and two copies of it would let through different shapes of a write. No file — a silent
|
|
38
|
+
# default remains, so that the guard does not break on an incomplete layout.
|
|
39
|
+
# shellcheck disable=SC1090
|
|
40
|
+
[ -f "$rt_hooks_dir/write-targets.sh" ] && . "$rt_hooks_dir/write-targets.sh" 2>/dev/null
|
|
41
|
+
command -v rt_write_targets >/dev/null 2>&1 || rt_write_targets() { cat >/dev/null; }
|
|
42
|
+
|
|
27
43
|
tool="$(rt_hook_tool)"
|
|
28
44
|
case "$tool" in
|
|
29
|
-
Edit | Write | MultiEdit)
|
|
45
|
+
Edit | Write | MultiEdit)
|
|
46
|
+
path="$(rt_hook_file)"
|
|
47
|
+
added="$(printf '%s' "$input" | jq -r '.tool_input.new_string // .tool_input.content // ([.tool_input.edits[]?.new_string] | join("\n")) // empty' 2>/dev/null)"
|
|
48
|
+
;;
|
|
49
|
+
Bash | mcp__webstorm__execute_terminal_command | mcp__webstorm__execute_tool)
|
|
50
|
+
cmd="$(rt_hook_cmd)"
|
|
51
|
+
[ -z "$cmd" ] && exit 0
|
|
52
|
+
# The first document among the write targets. A command writing several is judged by one of
|
|
53
|
+
# them: the text is one for the whole command, and a second refusal would repeat the first.
|
|
54
|
+
path="$(printf '%s' "$cmd" | rt_write_targets | grep -m1 '\.md$')"
|
|
55
|
+
# The new text is the body of the command: the written text stands inside it, and the
|
|
56
|
+
# findings of the check name the very lines that go into the file.
|
|
57
|
+
added="$cmd"
|
|
58
|
+
;;
|
|
30
59
|
*) exit 0 ;;
|
|
31
60
|
esac
|
|
32
61
|
|
|
33
|
-
path="$(rt_hook_file)"
|
|
34
62
|
case "$path" in
|
|
35
63
|
*.md) ;;
|
|
36
64
|
*) exit 0 ;;
|
|
37
65
|
esac
|
|
38
66
|
|
|
39
|
-
#
|
|
40
|
-
#
|
|
67
|
+
# The archive and the task folders are not judged: the archive is not edited at all, and the
|
|
68
|
+
# progress is written in haste and lives until the merge.
|
|
41
69
|
case "$path" in
|
|
42
|
-
*/docs/archive/* | */docs/tasks/*) exit 0 ;;
|
|
70
|
+
*/docs/archive/* | */docs/tasks/* | docs/archive/* | docs/tasks/*) exit 0 ;;
|
|
43
71
|
esac
|
|
44
72
|
|
|
45
|
-
added="$(printf '%s' "$input" | jq -r '.tool_input.new_string // .tool_input.content // ([.tool_input.edits[]?.new_string] | join("\n")) // empty' 2>/dev/null)"
|
|
46
73
|
[ -z "$added" ] && exit 0
|
|
47
|
-
|
|
48
|
-
rt_hooks_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
49
74
|
check=""
|
|
50
75
|
for candidate in "$rt_hooks_dir/../checks/check-prose-style.mjs" "$rt_hooks_dir/../rt-kit/checks/check-prose-style.mjs" "${CLAUDE_PROJECT_DIR:-.}/tools/check-prose-style.mjs"; do
|
|
51
76
|
[ -f "$candidate" ] && check="$candidate" && break
|
|
@@ -54,18 +79,18 @@ done
|
|
|
54
79
|
|
|
55
80
|
tmp="$(mktemp -t prose)" || exit 0
|
|
56
81
|
printf '%s\n' "$added" > "$tmp"
|
|
57
|
-
found="$(node "$check" "$tmp" 2>&1 | grep -- '—' | sed 's|.*proba*[^:]*:|
|
|
82
|
+
found="$(node "$check" "$tmp" 2>&1 | grep -- '—' | sed 's|.*proba*[^:]*:| line |' | head -8)"
|
|
58
83
|
rm -f "$tmp"
|
|
59
84
|
[ -z "$found" ] && exit 0
|
|
60
85
|
|
|
61
|
-
reason="BLOCKED by prose-style-guard:
|
|
86
|
+
reason="BLOCKED by prose-style-guard: the new text carries officialese or a word not written in this tree.
|
|
62
87
|
|
|
63
88
|
${found}
|
|
64
89
|
|
|
65
|
-
|
|
90
|
+
Edit the text instead of bypassing the finding: a replacement is named at each of them. Wording is a rule about texts, and the check sees the listed signs, not style at large: a paragraph clean by it may still be bad, a dirty one is bad for certain."
|
|
66
91
|
|
|
67
|
-
#
|
|
68
|
-
#
|
|
92
|
+
# The shared deny tail: the two lawful moves and the lawful form of bypass, if the refusal has one.
|
|
93
|
+
# The file may not be laid out — then there is no tail, and the refusal reason stays as it is.
|
|
69
94
|
# shellcheck disable=SC1090
|
|
70
95
|
[ -f "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/deny-tail.sh" ] \
|
|
71
96
|
&& . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/deny-tail.sh" 2>/dev/null
|
|
@@ -76,5 +101,5 @@ deny_tail_text="$(rt_deny_tail "")"
|
|
|
76
101
|
${deny_tail_text}"
|
|
77
102
|
|
|
78
103
|
jq -n --arg r "$reason" '{hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:$r}}' 2>/dev/null \
|
|
79
|
-
|| printf '{"hookSpecificOutput":{"hookEventName":"PreToolUse","permissionDecision":"deny","permissionDecisionReason":"prose-style-guard:
|
|
104
|
+
|| printf '{"hookSpecificOutput":{"hookEventName":"PreToolUse","permissionDecision":"deny","permissionDecisionReason":"prose-style-guard: officialese in the new text."}}\n'
|
|
80
105
|
exit 0
|