@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,26 +1,28 @@
|
|
|
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, hooks/write-targets.sh, hooks/guard-note.sh
|
|
4
|
+
# Guard of the place of the edit: the rules layer is fixed where it is broken, not where it is seen.
|
|
5
5
|
#
|
|
6
|
-
#
|
|
7
|
-
#
|
|
8
|
-
#
|
|
9
|
-
#
|
|
10
|
-
#
|
|
6
|
+
# The rules layer is edited by the same executor the rules layer governs, and nothing in the tree
|
|
7
|
+
# shows the difference between "I follow a rule" and "I edit a rule": the laid-out copy lies next to
|
|
8
|
+
# ordinary files and is edited the same way. The edit reaches the disk and does not reach the place
|
|
9
|
+
# where the miss is fixed: in the tree it is visible, in the package it is absent, and a month later
|
|
10
|
+
# the layout refuses over the edited file as a whole — and the price is paid by whoever edits a
|
|
11
|
+
# neighbouring resource that day.
|
|
11
12
|
#
|
|
12
|
-
#
|
|
13
|
-
#
|
|
14
|
-
#
|
|
13
|
+
# Only `sync --check` knew about this, and it spoke at the next layout, that is, in someone else's
|
|
14
|
+
# branch and on someone else's turn. The guard speaks at the minute of the edit and names the
|
|
15
|
+
# address: the package source, if the tree holds it, otherwise the override.
|
|
15
16
|
#
|
|
16
|
-
#
|
|
17
|
-
#
|
|
18
|
-
# `.claude/rt-kit/overrides
|
|
17
|
+
# WHAT IS JUDGED. The file being edited carries the layout header: `rt-kit v<version> · <resource> ·
|
|
18
|
+
# <digest>`. The resource from it is the address: `<sources>/<resource>` in the package tree,
|
|
19
|
+
# `.claude/rt-kit/overrides/<resource>` at a consumer.
|
|
19
20
|
#
|
|
20
|
-
#
|
|
21
|
-
#
|
|
21
|
+
# FAIL-OPEN: no `jq`, broken input, a foreign tool, no file, no header in it, not a git repository —
|
|
22
|
+
# the edit is ALLOWED. A broken guard has no right to jam work.
|
|
22
23
|
|
|
23
|
-
#
|
|
24
|
+
# Its own name in the observations: the refusal is written by the shared deny tail, not by the
|
|
25
|
+
# guard itself.
|
|
24
26
|
RT_GUARD_NAME=rule-source-guard
|
|
25
27
|
|
|
26
28
|
. "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/utf8.sh" 2>/dev/null || true
|
|
@@ -49,13 +51,13 @@ deny() {
|
|
|
49
51
|
|
|
50
52
|
reason="$1 $(rt_deny_tail "$2")"
|
|
51
53
|
jq -n --arg r "$reason" '{hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:$r}}' 2>/dev/null \
|
|
52
|
-
|| printf '{"hookSpecificOutput":{"hookEventName":"PreToolUse","permissionDecision":"deny","permissionDecisionReason":"
|
|
54
|
+
|| printf '{"hookSpecificOutput":{"hookEventName":"PreToolUse","permissionDecision":"deny","permissionDecisionReason":"The guard of the place of the edit."}}\n'
|
|
53
55
|
exit 0
|
|
54
56
|
}
|
|
55
57
|
|
|
56
|
-
#
|
|
57
|
-
#
|
|
58
|
-
#
|
|
58
|
+
# The write targets are parsed by a shared helper: the exam guard needs the same sign, and once they
|
|
59
|
+
# diverged, two copies would let through different forms of writing. No file — a silent default
|
|
60
|
+
# remains, so that the guard does not break on an incomplete layout.
|
|
59
61
|
# shellcheck disable=SC1090
|
|
60
62
|
[ -f "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/write-targets.sh" ] \
|
|
61
63
|
&& . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/write-targets.sh" 2>/dev/null
|
|
@@ -70,14 +72,15 @@ case "$tool" in
|
|
|
70
72
|
Bash | mcp__webstorm__execute_terminal_command | mcp__webstorm__execute_tool)
|
|
71
73
|
cmd="$(rt_hook_cmd)"
|
|
72
74
|
[ -z "$cmd" ] && exit 0
|
|
73
|
-
#
|
|
74
|
-
#
|
|
75
|
-
#
|
|
76
|
-
#
|
|
77
|
-
#
|
|
75
|
+
# What is taken here is not the general sign of writing, but the target named in the
|
|
76
|
+
# command outright: a redirection, `tee`, an in-place edit, a copy over the top. The
|
|
77
|
+
# general sign is broad on purpose — it holds the interpreter name too — and a run of a
|
|
78
|
+
# laid-out check would read as an edit of the check itself. A refusal on reading costs
|
|
79
|
+
# more than a miss: a guard that gets in the way of reading is switched off on the very
|
|
80
|
+
# first day.
|
|
78
81
|
#
|
|
79
|
-
#
|
|
80
|
-
#
|
|
82
|
+
# Removing a copy is deliberately not included here: the layout puts a removed file back,
|
|
83
|
+
# and that is how a copy the formatter rewrote gets fixed.
|
|
81
84
|
candidates="$(printf '%s' "$cmd" | rt_write_targets)"
|
|
82
85
|
;;
|
|
83
86
|
*) exit 0 ;;
|
|
@@ -86,8 +89,8 @@ esac
|
|
|
86
89
|
|
|
87
90
|
root="${CLAUDE_PROJECT_DIR:-.}"
|
|
88
91
|
|
|
89
|
-
#
|
|
90
|
-
#
|
|
92
|
+
# The directory of package sources in this tree. Only the tree that carries the package has one; a
|
|
93
|
+
# consumer has no source at all, and has a single address for an edit — the override.
|
|
91
94
|
sources=""
|
|
92
95
|
if rt_needs rt_kit_sources_dir rule-source-guard; then
|
|
93
96
|
sources="$(rt_kit_sources_dir 2>/dev/null)"
|
|
@@ -101,30 +104,32 @@ while IFS= read -r candidate; do
|
|
|
101
104
|
esac
|
|
102
105
|
[ -f "$candidate" ] || continue
|
|
103
106
|
|
|
104
|
-
#
|
|
105
|
-
#
|
|
106
|
-
#
|
|
107
|
+
# The header stands at the beginning of the file, but not on the first line: in a script `#!`
|
|
108
|
+
# pushes it down, in a rule the title with the name and the kind of the resource does. Ten
|
|
109
|
+
# lines are enough for both, and the whole file must not be read: the guard stands on every
|
|
110
|
+
# edit.
|
|
107
111
|
resource="$(head -12 "$candidate" 2>/dev/null | sed -nE 's/.*rt-kit v[^ ]+ · ([^ ]+) · [0-9a-f]+.*/\1/p' | head -1)"
|
|
108
112
|
[ -z "$resource" ] && continue
|
|
109
113
|
|
|
110
|
-
#
|
|
111
|
-
#
|
|
112
|
-
#
|
|
113
|
-
#
|
|
114
|
-
#
|
|
115
|
-
#
|
|
114
|
+
# A file in conflict is skipped on a par with a removed one. Resolving a conflict does not
|
|
115
|
+
# change the content of the copy — the layout puts it back — while an executor refused here is
|
|
116
|
+
# left with a half-merged branch and no lawful move: there is nothing to edit in the source,
|
|
117
|
+
# and an override does not lift the conflict. There are two signs, and either is enough: an
|
|
118
|
+
# index record about an unmerged file, and merge markers in the file itself — the second is
|
|
119
|
+
# needed where the merge is led not by git but by an outside tool that leaves markers without
|
|
120
|
+
# an index record.
|
|
116
121
|
if [ -n "$(git -C "$root" ls-files -u -- "$candidate" 2>/dev/null)" ] \
|
|
117
122
|
|| grep -qE '^(<<<<<<< |>>>>>>> )' "$candidate" 2>/dev/null; then
|
|
118
123
|
continue
|
|
119
124
|
fi
|
|
120
125
|
|
|
121
126
|
if [ -n "$sources" ] && [ -f "$root/$sources/$resource" ]; then
|
|
122
|
-
deny "BLOCKED by rule-source-guard: «${candidate#"$root"/}»
|
|
123
|
-
"
|
|
127
|
+
deny "BLOCKED by rule-source-guard: «${candidate#"$root"/}» is laid out by the package, and an edit in its place is lost on the next layout — and until then the layout refuses this file whole, and the price is paid by whoever edits a neighbouring resource that day. The resource is «${resource}». Edit the source: ${sources}/${resource} — then build the package and lay it out." \
|
|
128
|
+
"an edit true only to this tree goes to the override .claude/rt-kit/overrides/${resource} — it merges by the section «## » and outlives the layout"
|
|
124
129
|
fi
|
|
125
130
|
|
|
126
|
-
deny "BLOCKED by rule-source-guard: «${candidate#"$root"/}»
|
|
127
|
-
"
|
|
131
|
+
deny "BLOCKED by rule-source-guard: «${candidate#"$root"/}» is laid out by the package @rt-tools/agent-kit, and an edit in its place is lost on the next layout. The resource is «${resource}». Edit the override: .claude/rt-kit/overrides/${resource} — it merges by the section «## » and outlives the layout." \
|
|
132
|
+
"what is true of any tree is edited in the package itself and arrives here by a new edition"
|
|
128
133
|
done <<EOF
|
|
129
134
|
$candidates
|
|
130
135
|
EOF
|
|
@@ -1,30 +1,34 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
-
#
|
|
2
|
+
# Layers of the rules gate: requirements that come ON TOP of the domain one.
|
|
3
3
|
#
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
#
|
|
7
|
-
# судят тот же файл вторым признаком. Вместе они не помещаются в карту гейта, которую читают
|
|
8
|
-
# целиком, — поэтому лежат здесь.
|
|
4
|
+
# NOT a guard: it has no `rt-hook:` declaration and hooks into no agent event. The rules gate
|
|
5
|
+
# sources it: the layers over the domain rule are a dozen and a half, and together they do not fit
|
|
6
|
+
# into a map read whole.
|
|
9
7
|
#
|
|
10
|
-
#
|
|
11
|
-
#
|
|
12
|
-
#
|
|
8
|
+
# The domain rule is chosen once by the file path — an edit has one subject, and there is one
|
|
9
|
+
# rule for it. There are a dozen and a half layers on top of it: access to the runtime is visible
|
|
10
|
+
# only in the text of the edit, observability comes together with the domain rather than instead
|
|
11
|
+
# of it, prose and work conduct judge the same file by a second sign. Together they do not fit
|
|
12
|
+
# into the gate map, which is read whole — so they live here.
|
|
13
13
|
#
|
|
14
|
-
#
|
|
15
|
-
#
|
|
14
|
+
# Sourced from `skill-gate.sh` in its own shell: it reads `$input`, `$target` and `$req` and
|
|
15
|
+
# appends rule names to `$req`. As a separate process the layers would return the same thing
|
|
16
|
+
# through the disk.
|
|
16
17
|
#
|
|
17
|
-
#
|
|
18
|
-
#
|
|
19
|
-
#
|
|
18
|
+
# FAIL-OPEN: nothing to parse the input with — the layer is silent. Parsing the input is side
|
|
19
|
+
# work here, and its breakage has no right to stop the edit.
|
|
20
|
+
#
|
|
21
|
+
# The layers do not know the tree's addresses: where its backend, showcase and end-to-end tests
|
|
22
|
+
# are is said by the tree itself — by the function `skill_layer_skip <rule> <target>` in its gate
|
|
23
|
+
# map. Without it a layer acts everywhere its sign matched.
|
|
20
24
|
|
|
21
|
-
#
|
|
22
|
-
#
|
|
25
|
+
# What is already named is not required a second time: a refusal listing one rule twice reads as
|
|
26
|
+
# two different requirements.
|
|
23
27
|
. "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/utf8.sh" 2>/dev/null || true
|
|
24
28
|
|
|
25
|
-
#
|
|
26
|
-
#
|
|
27
|
-
#
|
|
29
|
+
# A built tree is never code: the path to an artifact arrives from the command that runs it. The
|
|
30
|
+
# gate map already lets such a path through, and the layers must stay silent along with it —
|
|
31
|
+
# otherwise leaving the map lifts one requirement and leaves a dozen and a half others.
|
|
28
32
|
case "$target" in
|
|
29
33
|
*/node_modules/* | */dist/* | */build/* | */.nx/* | */coverage/*) return 0 ;;
|
|
30
34
|
esac
|
|
@@ -36,15 +40,16 @@ rt_layer_add() {
|
|
|
36
40
|
req="${req:+$req }$1"
|
|
37
41
|
}
|
|
38
42
|
|
|
39
|
-
#
|
|
40
|
-
#
|
|
43
|
+
# The tree may lift a layer from a place where the sign is lawful: a direct call to the runtime
|
|
44
|
+
# on the backend, reading the environment in the harness, creating a file in end-to-end tests.
|
|
41
45
|
rt_layer_allowed() {
|
|
42
46
|
command -v skill_layer_skip >/dev/null 2>&1 || return 0
|
|
43
47
|
skill_layer_skip "$1" "$2" && return 1
|
|
44
48
|
return 0
|
|
45
49
|
}
|
|
46
50
|
|
|
47
|
-
#
|
|
51
|
+
# The edit text is read once for all layers: parsing the input costs more than the signs
|
|
52
|
+
# themselves.
|
|
48
53
|
rt_layer_payload=""
|
|
49
54
|
if command -v jq >/dev/null 2>&1; then
|
|
50
55
|
rt_layer_payload="$(printf '%s' "$input" \
|
|
@@ -52,15 +57,16 @@ if command -v jq >/dev/null 2>&1; then
|
|
|
52
57
|
| map(select(. != null)) | join("\n")' 2>/dev/null)"
|
|
53
58
|
fi
|
|
54
59
|
|
|
55
|
-
#
|
|
60
|
+
# A spec checks behaviour rather than creating it: `testing` is needed there, and the behaviour
|
|
61
|
+
# layers skip it.
|
|
56
62
|
rt_layer_is_spec=1
|
|
57
63
|
case "$target" in *.spec.ts) rt_layer_is_spec=0 ;; esac
|
|
58
64
|
|
|
59
|
-
# ---
|
|
65
|
+
# --- layer by text: a call to the runtime -----------------------------------------------------
|
|
60
66
|
#
|
|
61
|
-
#
|
|
62
|
-
#
|
|
63
|
-
#
|
|
67
|
+
# The path says WHAT file it is, while a call to the global object is visible only in the
|
|
68
|
+
# content: a gate that knows the path alone lets it through silently. A value obtained by
|
|
69
|
+
# injection does not count as a sign — that is already a dependency, not a direct call.
|
|
64
70
|
if [ -n "$rt_layer_payload" ] && [ "$rt_layer_is_spec" = 1 ]; then
|
|
65
71
|
case "$target" in
|
|
66
72
|
*/main.ts|*/main.server.ts|*/server.ts|*/index.html) ;;
|
|
@@ -73,11 +79,11 @@ if [ -n "$rt_layer_payload" ] && [ "$rt_layer_is_spec" = 1 ]; then
|
|
|
73
79
|
esac
|
|
74
80
|
fi
|
|
75
81
|
|
|
76
|
-
# ---
|
|
82
|
+
# --- layer by text: observability -------------------------------------------------------------
|
|
77
83
|
#
|
|
78
|
-
#
|
|
79
|
-
#
|
|
80
|
-
#
|
|
84
|
+
# Reading an environment variable is exactly the moment a new optional capability is created.
|
|
85
|
+
# The startup digest lists them by hand, and one that forgot to add itself will not land in any
|
|
86
|
+
# of the three lists — on production it looks not switched off but non-existent.
|
|
81
87
|
if [ -n "$rt_layer_payload" ] && [ "$rt_layer_is_spec" = 1 ]; then
|
|
82
88
|
case "$target" in
|
|
83
89
|
*.ts)
|
|
@@ -88,11 +94,11 @@ if [ -n "$rt_layer_payload" ] && [ "$rt_layer_is_spec" = 1 ]; then
|
|
|
88
94
|
esac
|
|
89
95
|
fi
|
|
90
96
|
|
|
91
|
-
# ---
|
|
97
|
+
# --- layer by text: shared code ---------------------------------------------------------------
|
|
92
98
|
#
|
|
93
|
-
#
|
|
94
|
-
#
|
|
95
|
-
#
|
|
99
|
+
# A newly created numeric setting and a newly created enumeration are the moment a copy appears
|
|
100
|
+
# next to what is already shared. Each copy is sound on its own, and neither the linter nor the
|
|
101
|
+
# build sees the second one. Specs do not count: values there are local, they are fixtures.
|
|
96
102
|
if [ -n "$rt_layer_payload" ] && [ "$rt_layer_is_spec" = 1 ]; then
|
|
97
103
|
case "$target" in
|
|
98
104
|
*.ts)
|
|
@@ -104,11 +110,11 @@ if [ -n "$rt_layer_payload" ] && [ "$rt_layer_is_spec" = 1 ]; then
|
|
|
104
110
|
esac
|
|
105
111
|
fi
|
|
106
112
|
|
|
107
|
-
# ---
|
|
113
|
+
# --- layer by path: Angular classes -----------------------------------------------------------
|
|
108
114
|
#
|
|
109
|
-
#
|
|
110
|
-
#
|
|
111
|
-
#
|
|
115
|
+
# A component and a store are classes too: the signal input API, change detection and where a
|
|
116
|
+
# subscription lives are in `angular-patterns`, while as the first layer these files go to the
|
|
117
|
+
# component structure and to the language conventions, where none of that is.
|
|
112
118
|
if [ "$rt_layer_is_spec" = 1 ]; then
|
|
113
119
|
case "$target" in
|
|
114
120
|
*.component.ts|*.store.ts)
|
|
@@ -117,36 +123,36 @@ if [ "$rt_layer_is_spec" = 1 ]; then
|
|
|
117
123
|
esac
|
|
118
124
|
fi
|
|
119
125
|
|
|
120
|
-
# ---
|
|
126
|
+
# --- layer by path: prose ---------------------------------------------------------------------
|
|
121
127
|
#
|
|
122
|
-
#
|
|
123
|
-
#
|
|
124
|
-
#
|
|
128
|
+
# The spec format is held by `spec-driven`, and how to word things by `doc-style`, and it is
|
|
129
|
+
# needed not only by specs. A check's known list is the same prose: its field explains why what
|
|
130
|
+
# is listed does not count as a refusal, and the text audit reads only `.md`.
|
|
125
131
|
#
|
|
126
|
-
#
|
|
127
|
-
#
|
|
128
|
-
#
|
|
132
|
+
# The agent's own housekeeping the layer skips: the rule for it is itself, and the gate map
|
|
133
|
+
# decides about these files whole. A layer laid on top would demand a rule where the map left it
|
|
134
|
+
# unnamed on purpose.
|
|
129
135
|
case "$target" in
|
|
130
136
|
*/.claude/*) ;;
|
|
131
137
|
*.md|*-allowlist.json) rt_layer_allowed doc-style "$target" && rt_layer_add doc-style ;;
|
|
132
138
|
esac
|
|
133
139
|
|
|
134
|
-
# ---
|
|
140
|
+
# --- layer by path: work conduct --------------------------------------------------------------
|
|
135
141
|
#
|
|
136
|
-
#
|
|
137
|
-
#
|
|
138
|
-
#
|
|
142
|
+
# The task folder, the product agreement before the code and the epic plan are the first files
|
|
143
|
+
# created in work. The requirement catches on them whoever went past the order: "a new task has
|
|
144
|
+
# arrived" is not a tool, and there is nothing else to catch it with.
|
|
139
145
|
case "$target" in
|
|
140
146
|
*/docs/tasks/*|*/docs/specs/*/proposed/*|*/docs/plans/*)
|
|
141
147
|
rt_layer_allowed task-flow "$target" && rt_layer_add task-flow
|
|
142
148
|
;;
|
|
143
149
|
esac
|
|
144
150
|
|
|
145
|
-
# ---
|
|
151
|
+
# --- layer by file creation -------------------------------------------------------------------
|
|
146
152
|
#
|
|
147
|
-
#
|
|
148
|
-
#
|
|
149
|
-
#
|
|
153
|
+
# Nothing is written from scratch, and this is asked where the decision is made — at the
|
|
154
|
+
# creation of a new file: an edit of an existing one has its foundation already chosen, and
|
|
155
|
+
# demanding the rule on every line would turn it into background.
|
|
150
156
|
case "$target" in
|
|
151
157
|
*/docs/*) ;;
|
|
152
158
|
*.spec.ts|*.stories.ts) ;;
|
|
@@ -155,9 +161,9 @@ case "$target" in
|
|
|
155
161
|
;;
|
|
156
162
|
esac
|
|
157
163
|
|
|
158
|
-
#
|
|
159
|
-
#
|
|
160
|
-
#
|
|
164
|
+
# Where a newly created check goes and what shape its known list has are statements of
|
|
165
|
+
# `testing`, and they are needed exactly at the moment of creation: an existing check has both
|
|
166
|
+
# its place in the gate and the shape of its list already chosen.
|
|
161
167
|
case "$target" in
|
|
162
168
|
*/check-*.mjs|*-allowlist.json)
|
|
163
169
|
[ -f "$target" ] || { rt_layer_allowed testing "$target" && rt_layer_add testing; }
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
# rt-hook: SessionStart compact|clear
|
|
3
|
-
#
|
|
3
|
+
# Re-arming the gate. SessionStart(compact|clear).
|
|
4
4
|
#
|
|
5
|
-
#
|
|
6
|
-
#
|
|
7
|
-
#
|
|
8
|
-
#
|
|
5
|
+
# The gate remembers a loaded rule by the session id and from then on lets that area through
|
|
6
|
+
# silently. Context compaction and clearing take the TEXT of the rule itself out of the context but
|
|
7
|
+
# leave the session id as it was — without this hook the gate would keep letting through while the
|
|
8
|
+
# agent works from a retelling instead of the rule itself.
|
|
9
9
|
#
|
|
10
|
-
#
|
|
10
|
+
# Removing the record makes every area load its rule again.
|
|
11
11
|
#
|
|
12
|
-
#
|
|
13
|
-
# отбивает.
|
|
12
|
+
# FAIL-OPEN: any error passes. The hook removes a temporary file and refuses nothing.
|
|
14
13
|
|
|
15
14
|
. "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/utf8.sh" 2>/dev/null || true
|
|
16
15
|
. "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/hook-input.sh" 2>/dev/null || true
|
|
@@ -24,4 +23,12 @@ sid="$(printf '%s' "$input" | jq -r '.session_id // empty' 2>/dev/null)"
|
|
|
24
23
|
|
|
25
24
|
rm -f "${TMPDIR:-/tmp}/claude-skill-gate/${sid}.loaded" 2>/dev/null
|
|
26
25
|
|
|
26
|
+
# The re-arming is told to the session in words.
|
|
27
|
+
#
|
|
28
|
+
# A silent re-arming reads as breakage: the compaction summary says the rules were already loaded,
|
|
29
|
+
# the gate answers that they were not — and the session spends a turn finding out which of the two
|
|
30
|
+
# is right. A turn was spent that way four times in one session. The line removes the contradiction:
|
|
31
|
+
# the rule text is no longer in the context, which is why it is asked for again.
|
|
32
|
+
jq -n '{hookSpecificOutput:{hookEventName:"SessionStart",additionalContext:"The rules gate is armed anew: the compaction carried the text of the rules themselves out of the session, and every area will ask for its rule once more. The former loading does not count — load the rule and work on."}}' 2>/dev/null
|
|
33
|
+
|
|
27
34
|
exit 0
|