@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,38 +1,43 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
# rt-hook: PreToolUse Edit|Write|MultiEdit|Bash|mcp__webstorm__create_new_file|mcp__webstorm__execute_terminal_command|mcp__webstorm__execute_tool
|
|
3
|
-
#
|
|
4
|
-
#
|
|
3
|
+
# Requires: hooks/profile-check.sh, hooks/deny-tail.sh
|
|
4
|
+
# The "nothing is written from scratch" guard. PreToolUse on an edit of code and markup.
|
|
5
5
|
#
|
|
6
|
-
#
|
|
7
|
-
#
|
|
8
|
-
#
|
|
9
|
-
#
|
|
6
|
+
# Linters know the rules, but they do not know the INVENTORY: the style linter catches a raw
|
|
7
|
+
# colour, the code linter an untyped value, but neither of them knows that a ready-made message is
|
|
8
|
+
# already written, and both silently let through a notification area of one's own with its text,
|
|
9
|
+
# its button and its styles. The guard closes exactly this hole: it checks what is being written
|
|
10
|
+
# against what the tree already has.
|
|
10
11
|
#
|
|
11
|
-
#
|
|
12
|
+
# The rule as a whole is `reuse-first`.
|
|
12
13
|
#
|
|
13
|
-
#
|
|
14
|
-
#
|
|
14
|
+
# What counts as a reinvention is known by the tree profile: the function `rt_reinvented_in <file>`
|
|
15
|
+
# prints a line per rule, four fields separated by tabs:
|
|
15
16
|
#
|
|
16
|
-
#
|
|
17
|
+
# <over what> <pattern> <cancelling pattern> <what to use instead>
|
|
17
18
|
#
|
|
18
|
-
#
|
|
19
|
-
#
|
|
20
|
-
#
|
|
21
|
-
#
|
|
19
|
+
# "Over what" is `added` (only the new text of the edit) or `whole` (the edit together with the
|
|
20
|
+
# content of the file). The second is needed where the sign is visible only as a whole: inheriting
|
|
21
|
+
# a base and the mark of a procedure do not get into a point edit. The "cancelling pattern" puts
|
|
22
|
+
# the rule out: a mapper that already inherits the shared base is never a reinvention; an empty
|
|
23
|
+
# field puts nothing out.
|
|
22
24
|
#
|
|
23
|
-
#
|
|
24
|
-
#
|
|
25
|
-
#
|
|
25
|
+
# The function gets the path and may decide by it on its own — look into the kit inventory, tell
|
|
26
|
+
# the layers of the tree apart, stay silent on a file that already exists. No profile or no
|
|
27
|
+
# function — the guard lets through: the package cannot know the inventory of the tree.
|
|
26
28
|
#
|
|
27
|
-
#
|
|
28
|
-
#
|
|
29
|
+
# The patterns are parsed by `perl`: conjunction and negation are written by lookahead, and without
|
|
30
|
+
# them a hand-made overlay is not to be told from a sticky header, nor a native button from a kit
|
|
31
|
+
# button.
|
|
29
32
|
#
|
|
30
|
-
#
|
|
31
|
-
#
|
|
33
|
+
# The deliberate exit: the departure marker in the text of the edit. It explains what exactly is
|
|
34
|
+
# missing; "these lines were here before" does not count as a reason, and that is why only the NEW
|
|
35
|
+
# text is checked.
|
|
32
36
|
#
|
|
33
|
-
#
|
|
37
|
+
# FAIL-OPEN: no parser, broken input, a foreign tool — let through.
|
|
34
38
|
|
|
35
|
-
#
|
|
39
|
+
# Its own name in the observations: the refusal is written by the shared deny tail, not by the
|
|
40
|
+
# guard itself.
|
|
36
41
|
RT_GUARD_NAME=reuse-first-guard
|
|
37
42
|
|
|
38
43
|
. "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/utf8.sh" 2>/dev/null || true
|
|
@@ -47,22 +52,22 @@ command -v perl >/dev/null 2>&1 || exit 0
|
|
|
47
52
|
tool="$(rt_hook_tool)"
|
|
48
53
|
shell_cmd=""
|
|
49
54
|
case "$tool" in
|
|
50
|
-
#
|
|
51
|
-
#
|
|
55
|
+
# The environment tool creates a file with the same two pieces of data, it only calls them
|
|
56
|
+
# differently — without this branch a file was created past every check.
|
|
52
57
|
Edit | Write | MultiEdit | mcp__webstorm__create_new_file) ;;
|
|
53
|
-
#
|
|
54
|
-
#
|
|
55
|
-
#
|
|
56
|
-
# `2026-08-15-guard-denied-shell-wrote-anyway.md`.
|
|
58
|
+
# A shell command that writes a file is the same edit. Without this branch the guard is
|
|
59
|
+
# bypassed by changing not the tool but the way of writing; the text of the edit is then the
|
|
60
|
+
# command itself, and what it creates in a heredoc is read on a par with the body of the edit.
|
|
61
|
+
# Incident analysis — `2026-08-15-guard-denied-shell-wrote-anyway.md`.
|
|
57
62
|
#
|
|
58
|
-
#
|
|
59
|
-
#
|
|
60
|
-
#
|
|
63
|
+
# The environment terminal runs the same command line and puts it in the same field: without
|
|
64
|
+
# these two names the guard would stand declared on them and let through silently — a state
|
|
65
|
+
# worse than an undeclared one, because from the outside it looks closed.
|
|
61
66
|
Bash | mcp__webstorm__execute_terminal_command | mcp__webstorm__execute_tool)
|
|
62
67
|
shell_cmd="$(rt_hook_cmd)"
|
|
63
68
|
[ -z "$shell_cmd" ] && exit 0
|
|
64
|
-
#
|
|
65
|
-
#
|
|
69
|
+
# The universal executor hides the real command in a nested string: without parsing it the
|
|
70
|
+
# path stands behind a quote, and no pattern reaches it.
|
|
66
71
|
if [ "$tool" = "mcp__webstorm__execute_tool" ] && command -v perl >/dev/null 2>&1; then
|
|
67
72
|
inner="$(printf '%s' "$shell_cmd" | perl -0ne '
|
|
68
73
|
if (/--command(?:=|\s+)(?:"((?:[^"\\]|\\.)*)"|\x27([^\x27]*)\x27|(.+))/s) {
|
|
@@ -75,8 +80,9 @@ case "$tool" in
|
|
|
75
80
|
*) exit 0 ;;
|
|
76
81
|
esac
|
|
77
82
|
|
|
78
|
-
#
|
|
79
|
-
#
|
|
83
|
+
# The tree profile: first the package default, and the project override on top of it, if there is
|
|
84
|
+
# one. It is read before the path is parsed: the paths out of a shell command are extracted by the
|
|
85
|
+
# profile itself.
|
|
80
86
|
rt_hooks_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
81
87
|
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
|
|
82
88
|
# shellcheck disable=SC1090
|
|
@@ -86,7 +92,8 @@ done
|
|
|
86
92
|
if [ -n "$shell_cmd" ]; then
|
|
87
93
|
command -v rt_shell_writes >/dev/null 2>&1 && command -v rt_shell_paths >/dev/null 2>&1 || exit 0
|
|
88
94
|
rt_shell_writes "$shell_cmd" || exit 0
|
|
89
|
-
#
|
|
95
|
+
# Out of the command the first path is taken whose extension the guard cares about: the rest
|
|
96
|
+
# are indifferent to it.
|
|
90
97
|
path=""
|
|
91
98
|
while IFS= read -r candidate; do
|
|
92
99
|
case "$candidate" in
|
|
@@ -99,7 +106,7 @@ EOF
|
|
|
99
106
|
else
|
|
100
107
|
path="$(printf '%s' "$input" | jq -r '.tool_input.file_path // .tool_input.pathInProject // empty' 2>/dev/null)"
|
|
101
108
|
fi
|
|
102
|
-
#
|
|
109
|
+
# A path from the root of the tree is made absolute once, so that the patterns do not double up.
|
|
103
110
|
case "$path" in
|
|
104
111
|
/*) ;;
|
|
105
112
|
?*) path="${CLAUDE_PROJECT_DIR:-.}/$path" ;;
|
|
@@ -109,27 +116,27 @@ case "$path" in
|
|
|
109
116
|
*) exit 0 ;;
|
|
110
117
|
esac
|
|
111
118
|
|
|
112
|
-
#
|
|
113
|
-
#
|
|
119
|
+
# A word about a missing profile function: a hook that left silently is indistinguishable from a
|
|
120
|
+
# working one. The file may be not laid out — then the previous behaviour stays, the silent one.
|
|
114
121
|
# shellcheck disable=SC1090
|
|
115
122
|
[ -f "$rt_hooks_dir/profile-check.sh" ] && . "$rt_hooks_dir/profile-check.sh"
|
|
116
123
|
command -v rt_needs >/dev/null 2>&1 || rt_needs() { command -v "$1" >/dev/null 2>&1; }
|
|
117
124
|
rt_needs rt_reinvented_in reuse-first-guard || exit 0
|
|
118
125
|
|
|
119
|
-
#
|
|
120
|
-
#
|
|
126
|
+
# The rules of this tree apply to the code of this tree: without a positive check the guard would
|
|
127
|
+
# demand assembling from the ready-made in a draft outside the tree as well.
|
|
121
128
|
if rt_needs rt_is_app_code reuse-first-guard; then
|
|
122
129
|
rt_is_app_code "$path" || exit 0
|
|
123
130
|
fi
|
|
124
131
|
|
|
125
|
-
#
|
|
126
|
-
#
|
|
132
|
+
# The ready-made is assembled where it belongs: inside the kit native controls and primitives are
|
|
133
|
+
# in place, and the showcase and the tests are not this guard's concern either.
|
|
127
134
|
if [ -n "${RT_REUSE_SKIP_RE:-}" ] && printf '%s' "$path" | grep -qE "$RT_REUSE_SKIP_RE"; then
|
|
128
135
|
exit 0
|
|
129
136
|
fi
|
|
130
137
|
|
|
131
|
-
#
|
|
132
|
-
#
|
|
138
|
+
# Only the new text: a line that already lay in the file was not created by this edit. For a shell
|
|
139
|
+
# command that text is the command itself: what it puts into the file lies in it.
|
|
133
140
|
if [ -n "$shell_cmd" ]; then
|
|
134
141
|
added="$shell_cmd"
|
|
135
142
|
else
|
|
@@ -140,18 +147,20 @@ else
|
|
|
140
147
|
fi
|
|
141
148
|
[ -z "$added" ] && exit 0
|
|
142
149
|
|
|
143
|
-
#
|
|
144
|
-
#
|
|
145
|
-
#
|
|
150
|
+
# An explicit refusal of the rule: there is no such ready-made, the author realised it and marked
|
|
151
|
+
# it. It is counted by the source text of the edit, before the crossing-out below: the marker
|
|
152
|
+
# usually stands on a line that already lies in the file, and a crossed-out marker would refuse an
|
|
153
|
+
# edit of the neighbouring line.
|
|
146
154
|
case "$added" in
|
|
147
155
|
*native-ok*) exit 0 ;;
|
|
148
156
|
esac
|
|
149
157
|
|
|
150
|
-
#
|
|
151
|
-
#
|
|
152
|
-
#
|
|
158
|
+
# A move is not writing anew. A line that already lies in the file the guard crosses out of the
|
|
159
|
+
# text being checked: a block that travelled together with a screen from one place of the file to
|
|
160
|
+
# another was refused on a par with a new one, and the departure marker had to be set blindly.
|
|
153
161
|
#
|
|
154
|
-
#
|
|
162
|
+
# The comparison goes without indentation: on a move a block changes its indent while staying the
|
|
163
|
+
# same code.
|
|
155
164
|
if [ -f "$path" ]; then
|
|
156
165
|
added="$(
|
|
157
166
|
printf '%s' "$added" | awk '
|
|
@@ -171,8 +180,8 @@ if [ -f "$path" ]; then
|
|
|
171
180
|
[ -z "${added//[[:space:]]/}" ] && exit 0
|
|
172
181
|
fi
|
|
173
182
|
|
|
174
|
-
#
|
|
175
|
-
#
|
|
183
|
+
# A sign visible only as a whole over the file (inheriting a base, the mark of a procedure) is
|
|
184
|
+
# counted by the resulting content: a point edit brings a piece without the class declaration.
|
|
176
185
|
whole="$added"
|
|
177
186
|
if [ -f "$path" ]; then
|
|
178
187
|
whole="$added
|
|
@@ -183,9 +192,9 @@ has_re() {
|
|
|
183
192
|
printf '%s' "$1" | RT_RE="$2" perl -0777 -ne 'exit(/$ENV{RT_RE}/s ? 0 : 1)' 2>/dev/null
|
|
184
193
|
}
|
|
185
194
|
|
|
186
|
-
#
|
|
187
|
-
#
|
|
188
|
-
#
|
|
195
|
+
# What the tree declared as its own: the sets of signs and the file of its own ones. The checks
|
|
196
|
+
# settings are the same ones the full check reads; the directory of the sets is named by the tree
|
|
197
|
+
# profile, because the layout of the checks is each tree's own.
|
|
189
198
|
rt_checks_json="${CLAUDE_PROJECT_DIR:-.}/.claude/rt-kit/checks.json"
|
|
190
199
|
rt_bundles=''
|
|
191
200
|
rt_own_signals=''
|
|
@@ -194,22 +203,22 @@ if [ -f "$rt_checks_json" ]; then
|
|
|
194
203
|
rt_bundles="$(jq -r '.reuse.bundles[]? // empty' "$rt_checks_json" 2>/dev/null | tr '\n' ' ')"
|
|
195
204
|
own="$(jq -r '.reuse.signals // empty' "$rt_checks_json" 2>/dev/null)"
|
|
196
205
|
[ -n "$own" ] && rt_own_signals="${CLAUDE_PROJECT_DIR:-.}/$own"
|
|
197
|
-
#
|
|
198
|
-
#
|
|
206
|
+
# By the same key the full check reads them: a second declaration of the same roots would
|
|
207
|
+
# diverge from the first silently.
|
|
199
208
|
rt_backend_roots="$(jq -r '.backendRoots[]? // empty' "$rt_checks_json" 2>/dev/null | tr '\n' ' ')"
|
|
200
209
|
fi
|
|
201
210
|
|
|
202
|
-
#
|
|
203
|
-
#
|
|
211
|
+
# A path from the root of the tree: the pattern in a sign is written by the tree, and it cannot
|
|
212
|
+
# write it from the root of the machine. The absolute path is needed only to read the file from disk.
|
|
204
213
|
rel_path="${path#"${CLAUDE_PROJECT_DIR:-.}"/}"
|
|
205
214
|
rt_signals_dir="${CLAUDE_PROJECT_DIR:-.}/${RT_REUSE_SIGNALS_DIR:-tools/signals}"
|
|
206
215
|
|
|
207
|
-
#
|
|
208
|
-
#
|
|
216
|
+
# The signs of the declared sets: the full check reads the same files. If the key of a sign matched
|
|
217
|
+
# the key of the tree, the tree wins: it sees its own ready-made, and the package did not see it.
|
|
209
218
|
signals_json() {
|
|
210
219
|
[ -n "$rt_signals_dir" ] || return 0
|
|
211
220
|
[ -d "$rt_signals_dir" ] || return 0
|
|
212
|
-
#
|
|
221
|
+
# The layout header is stripped before parsing: JSON has no comment, and the parse falls on it.
|
|
213
222
|
for name in $rt_bundles; do
|
|
214
223
|
file="$rt_signals_dir/$name.json"
|
|
215
224
|
[ -f "$file" ] && grep -v '^# rt-kit ' "$file" | jq -c '.signals[]?' 2>/dev/null
|
|
@@ -217,8 +226,9 @@ signals_json() {
|
|
|
217
226
|
[ -n "$rt_own_signals" ] && [ -f "$rt_own_signals" ] && grep -v '^# rt-kit ' "$rt_own_signals" | jq -c '.signals[]?' 2>/dev/null
|
|
218
227
|
}
|
|
219
228
|
|
|
220
|
-
#
|
|
221
|
-
#
|
|
229
|
+
# The fields are read one by one, not by parsing the line: a tab in `IFS` is a whitespace separator,
|
|
230
|
+
# and an empty field in the middle collapses, because of which the advice travels into the
|
|
231
|
+
# cancelling pattern and puts the sign out silently.
|
|
222
232
|
field() { printf '%s' "$1" | jq -r "$2 // empty" 2>/dev/null; }
|
|
223
233
|
|
|
224
234
|
found=''
|
|
@@ -231,11 +241,11 @@ while IFS= read -r signal; do
|
|
|
231
241
|
'') ;;
|
|
232
242
|
*) case "$path" in *"$ext") ;; *) continue ;; esac ;;
|
|
233
243
|
esac
|
|
234
|
-
#
|
|
235
|
-
#
|
|
236
|
-
#
|
|
237
|
-
#
|
|
238
|
-
#
|
|
244
|
+
# Skipping the backend roots: a sign declared with it does not apply on the backend at all —
|
|
245
|
+
# another way is accepted there, and the backend has no base class the sign demands. The full
|
|
246
|
+
# check reads the field too; reading it in one of the two would mean refusing by the guard
|
|
247
|
+
# exactly the edit the check lets through — and there would be nothing else to put it through
|
|
248
|
+
# with: the departure marker declares a bypass of the ready-made, and there was no bypass here.
|
|
239
249
|
if [ "$(field "$signal" '.skipBackendRoots')" = 'true' ] && [ -n "$rt_backend_roots" ]; then
|
|
240
250
|
skip_backend=''
|
|
241
251
|
for backend_root in $rt_backend_roots; do
|
|
@@ -244,14 +254,23 @@ while IFS= read -r signal; do
|
|
|
244
254
|
[ -n "$skip_backend" ] && continue
|
|
245
255
|
fi
|
|
246
256
|
|
|
247
|
-
#
|
|
248
|
-
#
|
|
249
|
-
#
|
|
257
|
+
# The name pattern is checked against the path from the root of the tree, not against the file
|
|
258
|
+
# name: the layers the sign separates call their files alike, and by name they are
|
|
259
|
+
# indistinguishable. The full check checks against the path — they must not diverge.
|
|
250
260
|
only_named="$(field "$signal" '.onlyNamed')"
|
|
251
261
|
if [ -n "$only_named" ]; then
|
|
252
262
|
printf '%s' "$rel_path" | grep -qE "$only_named" || continue
|
|
253
263
|
fi
|
|
254
264
|
|
|
265
|
+
# The other side of the name pattern: a tree that writes the ready-made itself takes the source
|
|
266
|
+
# folders of that ready-made out from under the sign. Without it such a tree has one choice —
|
|
267
|
+
# not to take the set at all, and then inside the set of ready-made components nothing catches
|
|
268
|
+
# a bypass of the ready-made. The full check reads the field too: they must not diverge.
|
|
269
|
+
except_named="$(field "$signal" '.exceptNamed')"
|
|
270
|
+
if [ -n "$except_named" ]; then
|
|
271
|
+
printf '%s' "$rel_path" | grep -qE "$except_named" && continue
|
|
272
|
+
fi
|
|
273
|
+
|
|
255
274
|
case "$(field "$signal" '.scope')" in
|
|
256
275
|
whole) text="$whole" ;;
|
|
257
276
|
*) text="$added" ;;
|
|
@@ -282,8 +301,8 @@ done <<EOF
|
|
|
282
301
|
$(signals_json | jq -s -c 'reduce .[] as $one ({}; .[$one.key] = $one) | .[]' 2>/dev/null)
|
|
283
302
|
EOF
|
|
284
303
|
|
|
285
|
-
#
|
|
286
|
-
#
|
|
304
|
+
# The profile function stays the second source: trees have already written it. The fields are read
|
|
305
|
+
# line by line, by the same four columns declared above.
|
|
287
306
|
while IFS= read -r line; do
|
|
288
307
|
[ -z "$line" ] && continue
|
|
289
308
|
signals_seen=1
|
|
@@ -304,33 +323,35 @@ done <<EOF
|
|
|
304
323
|
$(rt_reinvented_in "$path" 2>/dev/null)
|
|
305
324
|
EOF
|
|
306
325
|
|
|
307
|
-
#
|
|
308
|
-
#
|
|
326
|
+
# A guard without a single sign is indistinguishable from a guard that has nothing to refuse. It
|
|
327
|
+
# lets the edit through — there is nothing to stop the work over an unconfigured tree for — but it
|
|
328
|
+
# says what this is configured with.
|
|
309
329
|
if [ "$signals_seen" = 0 ]; then
|
|
310
|
-
printf '%s\n' 'reuse-first-guard:
|
|
330
|
+
printf '%s\n' 'reuse-first-guard: no signs — declare the bundles by the key `reuse.bundles` in the checks config' >&2
|
|
311
331
|
exit 0
|
|
312
332
|
fi
|
|
313
333
|
|
|
314
334
|
[ -z "$found" ] && exit 0
|
|
315
335
|
|
|
316
|
-
reason="BLOCKED:
|
|
336
|
+
reason="BLOCKED: this is already written. File: ${path##*/}
|
|
317
337
|
${found}
|
|
318
338
|
|
|
319
|
-
|
|
320
|
-
|
|
339
|
+
The order of moves: 1) open the ready-made — the barrel of the kit or the base class — and use it; 2) find in the tree a screen where this case is already assembled, and repeat that assembly; 3) if the ready-made really is not enough — extend it in place, at the ready-made, instead of cloning it alongside: a clone takes the edits onto itself and drifts from the original from the very first one.
|
|
340
|
+
A primitive of one's own, a base of one's own and inline styles of one's own are created only with the explicit approval of the owner, and it is asked before the first file is written. A one-off exception is marked by a departure marker on the same line, with an explanation of what exactly the ready-made lacks. Renaming the file does not bypass this."
|
|
321
341
|
|
|
322
|
-
#
|
|
323
|
-
#
|
|
342
|
+
# The shared refusal tail: the two lawful moves and the lawful form of the bypass, if the refusal
|
|
343
|
+
# has one. The file may be not laid out — then there is no tail, and the reason for the refusal
|
|
344
|
+
# stays as it was.
|
|
324
345
|
# shellcheck disable=SC1090
|
|
325
346
|
[ -f "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/deny-tail.sh" ] \
|
|
326
347
|
&& . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/deny-tail.sh" 2>/dev/null
|
|
327
348
|
command -v rt_deny_tail >/dev/null 2>&1 || rt_deny_tail() { :; }
|
|
328
|
-
deny_tail_text="$(rt_deny_tail "
|
|
349
|
+
deny_tail_text="$(rt_deny_tail "a departure marker on the same line, with an explanation of what exactly the ready-made lacks")"
|
|
329
350
|
[ -n "$deny_tail_text" ] && reason="${reason}
|
|
330
351
|
|
|
331
352
|
${deny_tail_text}"
|
|
332
353
|
|
|
333
354
|
jq -n --arg r "$reason" '{hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:$r}}' 2>/dev/null \
|
|
334
|
-
|| printf '{"hookSpecificOutput":{"hookEventName":"PreToolUse","permissionDecision":"deny","permissionDecisionReason":"
|
|
355
|
+
|| printf '{"hookSpecificOutput":{"hookEventName":"PreToolUse","permissionDecision":"deny","permissionDecisionReason":"Something of its own is written where the ready-made already exists."}}\n'
|
|
335
356
|
|
|
336
357
|
exit 0
|
package/assets/hooks/roles.sh
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
-
#
|
|
3
|
-
#
|
|
4
|
-
#
|
|
2
|
+
# The state of a rules-layer role. NOT a guard: it has no `rt-hook:` declaration and hooks into no
|
|
3
|
+
# agent event. The guards that stand at roles source it — the same way the gate sources the map and
|
|
4
|
+
# the guards source the tree profile.
|
|
5
5
|
#
|
|
6
|
-
#
|
|
7
|
-
#
|
|
8
|
-
#
|
|
9
|
-
#
|
|
10
|
-
#
|
|
6
|
+
# Why it exists. A role with a guard at it is not called at the executor's discretion: the guard
|
|
7
|
+
# holds the work until the role has had its say. There was nothing to switch it off with — dropping
|
|
8
|
+
# the role file in the settings removed the role and left the guard, and a tree that the role gets
|
|
9
|
+
# in the way of at this minute was left to cut the guard out of the settings by hand. Now the tree
|
|
10
|
+
# names the disabled roles in one list, and the guard at such a role leaves silently.
|
|
11
11
|
#
|
|
12
|
-
#
|
|
13
|
-
#
|
|
12
|
+
# What is disabled is the mandatory call, not the role itself: the role file stays laid out, and it
|
|
13
|
+
# can be called by hand at any minute.
|
|
14
14
|
#
|
|
15
|
-
#
|
|
16
|
-
#
|
|
17
|
-
#
|
|
15
|
+
# FAIL-OPEN the other way round: everything that was missing reads as "the role is on". No `jq`, no
|
|
16
|
+
# settings, settings that do not parse — the guard works as it did. A broken read that muted a role
|
|
17
|
+
# would switch the rules layer off silently, and there would be nothing to notice it with.
|
|
18
18
|
|
|
19
|
-
#
|
|
19
|
+
# Is the role disabled. Success — disabled.
|
|
20
20
|
#
|
|
21
21
|
# rt_role_off strict-teacher && exit 0
|
|
22
22
|
. "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/utf8.sh" 2>/dev/null || true
|
|
@@ -1,41 +1,45 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
-
#
|
|
3
|
-
#
|
|
2
|
+
# Parsing the applicability sign of a rule article. A helper: it declares no event of its own, and
|
|
3
|
+
# is sourced by whoever needs the text of an article — the rules gate in its refusal.
|
|
4
4
|
#
|
|
5
|
-
#
|
|
6
|
-
#
|
|
7
|
-
# тому: дешевле не читать лишнего, то есть работать хуже разведанным.
|
|
5
|
+
# NOT a guard: it has no `rt-hook:` declaration and hooks into no agent event. The rules gate
|
|
6
|
+
# sources it: an article says whether it applies itself, and the parsing of that lives here.
|
|
8
7
|
#
|
|
9
|
-
#
|
|
10
|
-
#
|
|
8
|
+
# A rule weighs from twenty to sixty kilobytes, while one of its articles covers a particular edit.
|
|
9
|
+
# A refusal that calls the whole rule pays the full price of the rule for the decision — and teaches
|
|
10
|
+
# the wrong thing: it is cheaper to read nothing extra, that is, to work less well explored.
|
|
11
11
|
#
|
|
12
|
-
#
|
|
12
|
+
# The sign stands at the article itself: the gate map knows the path and the rule, but does not know
|
|
13
|
+
# which of two dozen articles is about that path. An article knows everything about itself.
|
|
14
|
+
#
|
|
15
|
+
# - **The article heading.** The text of the article, as usual.
|
|
13
16
|
# <!-- rt-when: *.scss *.css -->
|
|
14
17
|
#
|
|
15
|
-
#
|
|
16
|
-
#
|
|
17
|
-
#
|
|
18
|
+
# The comment is not visible in the assembled markup and does not get in the way of reading the
|
|
19
|
+
# article; the patterns are separated by a space and are matched against the edit path by the shell
|
|
20
|
+
# itself, not by a word search: a search names the wrong article and says nothing about it.
|
|
18
21
|
#
|
|
19
|
-
#
|
|
20
|
-
#
|
|
22
|
+
# FAIL-OPEN: an article without a sign is lawful, and so is a rule without a single sign. If not one
|
|
23
|
+
# fitting article was found — nothing is printed, and the caller is left with the refusal it had.
|
|
21
24
|
|
|
22
|
-
#
|
|
23
|
-
#
|
|
25
|
+
# The articles of a rule whose sign matched the edit path. Arguments: the rule file, the edit path.
|
|
26
|
+
# Prints the text of the fitting articles whole, article by article, separated by an empty line.
|
|
24
27
|
rt_rule_articles() {
|
|
25
28
|
rule_file="$1"
|
|
26
29
|
edited="$2"
|
|
27
30
|
[ -f "$rule_file" ] || return 0
|
|
28
31
|
[ -n "$edited" ] || return 0
|
|
29
32
|
|
|
30
|
-
#
|
|
31
|
-
#
|
|
32
|
-
#
|
|
33
|
+
# The articles are picked in two passes: first the line numbers where the signs stand and the
|
|
34
|
+
# patterns themselves, then the text of the article whose pattern matched. The matching is done
|
|
35
|
+
# by the shell: `case` knows the rules of paths, a text parser does not.
|
|
33
36
|
while IFS=' ' read -r line patterns; do
|
|
34
37
|
[ -n "$line" ] || continue
|
|
35
38
|
hit=''
|
|
36
|
-
#
|
|
37
|
-
#
|
|
38
|
-
#
|
|
39
|
+
# The patterns are parsed with name expansion switched off: `*.scss` in the loop would
|
|
40
|
+
# expand into the file names of the working directory, and the article would be picked by
|
|
41
|
+
# where the call stood. The separator is set right here — an outer one could have been
|
|
42
|
+
# redefined by whoever called us.
|
|
39
43
|
set -f
|
|
40
44
|
old_ifs="$IFS"
|
|
41
45
|
IFS=' '
|
|
@@ -49,8 +53,8 @@ rt_rule_articles() {
|
|
|
49
53
|
case "$edited" in
|
|
50
54
|
$pattern) hit=1; break ;;
|
|
51
55
|
esac
|
|
52
|
-
#
|
|
53
|
-
#
|
|
56
|
+
# A pattern without a directory is matched against the file name too: an article says
|
|
57
|
+
# "about files like these", while an edit arrives as a full path.
|
|
54
58
|
# shellcheck disable=SC2254
|
|
55
59
|
case "${edited##*/}" in
|
|
56
60
|
$pattern) hit=1; break ;;
|
|
@@ -63,24 +67,25 @@ $(rt_rule_article_marks "$rule_file")
|
|
|
63
67
|
EOF
|
|
64
68
|
}
|
|
65
69
|
|
|
66
|
-
#
|
|
67
|
-
#
|
|
68
|
-
#
|
|
70
|
+
# The signs of a rule: a line of "line number — patterns". A function of its own, because the
|
|
71
|
+
# completeness check of the texts calls the same one: a rule whose sign is written in the wrong form
|
|
72
|
+
# quietly stays without an article in the refusal, and there is nothing to notice that by.
|
|
69
73
|
rt_rule_article_marks() {
|
|
70
74
|
[ -f "$1" ] || return 0
|
|
71
75
|
grep -n 'rt-when:' "$1" 2>/dev/null \
|
|
72
76
|
| sed -e 's/^\([0-9]*\):.*rt-when:[[:space:]]*/\1 /' -e 's/[[:space:]]*-->.*$//'
|
|
73
77
|
}
|
|
74
78
|
|
|
75
|
-
#
|
|
76
|
-
#
|
|
77
|
-
#
|
|
78
|
-
#
|
|
79
|
-
#
|
|
80
|
-
#
|
|
79
|
+
# The text of the article inside which the line with the sign stands. An article begins at the
|
|
80
|
+
# nearest top-level list item above and ends before the next such item or before a line without
|
|
81
|
+
# indentation: the continuation of an article always goes with indentation.
|
|
82
|
+
# The heading of an article is its bold first phrase. The gate refusal names articles by it and does
|
|
83
|
+
# not retell them by their body: the session loads the rule next, and the body would come into the
|
|
84
|
+
# context a second time. For the rule about texts the refusal printed 4,134 characters in eleven
|
|
85
|
+
# articles, their headings — 718.
|
|
81
86
|
#
|
|
82
|
-
#
|
|
83
|
-
#
|
|
87
|
+
# The heading is no ornament: the binding of a statement to code goes by it, and it also names the
|
|
88
|
+
# article in the refusal so that it can be found in the rule by eye.
|
|
84
89
|
rt_rule_article_heads() {
|
|
85
90
|
rule_file="$1"
|
|
86
91
|
edited="$2"
|