@rt-tools/agent-kit 0.23.0 → 0.26.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/README.md +8 -2
- package/assets/agents/business-analyst.md +51 -50
- 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-epics.github.mjs +75 -41
- 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 +24 -24
- package/assets/checks/board-paths.github.mjs +21 -16
- package/assets/checks/board-runs.github.mjs +45 -43
- package/assets/checks/board-titles.github.mjs +19 -17
- package/assets/checks/board.github.mjs +150 -128
- package/assets/checks/check-archive-age.mjs +23 -19
- package/assets/checks/check-board.github.mjs +179 -157
- package/assets/checks/check-descriptions.mjs +30 -29
- package/assets/checks/check-doc-paths.mjs +104 -82
- package/assets/checks/check-dupes.mjs +84 -80
- package/assets/checks/check-file-size.mjs +79 -70
- 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 +125 -33
- package/assets/checks/check-push-gate.mjs +53 -50
- package/assets/checks/check-reuse.mjs +50 -40
- package/assets/checks/check-schema-drift.mjs +87 -83
- 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/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 +174 -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/task-new.github.mjs +85 -56
- package/assets/commands/feedback.md +65 -59
- package/assets/commands/next-session.md +64 -57
- package/assets/commands/skill-curator.md +83 -79
- package/assets/defaults/gate-map.sh +115 -91
- package/assets/defaults/project.sh +228 -178
- package/assets/defaults/shell.sh +85 -65
- package/assets/defaults/turn-map.md +45 -44
- package/assets/docs/GLOSSARY.md +142 -65
- package/assets/hooks/browser-device-id.sh +12 -12
- package/assets/hooks/browser-guard-device-id.sh +46 -14
- 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 +11 -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 +46 -43
- package/assets/hooks/dispatch.sh +84 -39
- package/assets/hooks/docs-guard.sh +105 -86
- package/assets/hooks/exam-guard.sh +146 -84
- package/assets/hooks/git-guard-delivery-conflict.sh +38 -36
- package/assets/hooks/git-guard-delivery-draft.sh +85 -0
- package/assets/hooks/git-guard-delivery-folder.sh +50 -43
- package/assets/hooks/git-guard-delivery-signature.sh +88 -52
- package/assets/hooks/git-guard-delivery.sh +207 -253
- package/assets/hooks/git-guard-main.sh +65 -26
- package/assets/hooks/git-guard-push-tests.sh +133 -75
- 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 +26 -24
- package/assets/hooks/handoff-write.sh +74 -67
- package/assets/hooks/hook-input.sh +70 -50
- 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 +19 -17
- package/assets/hooks/qa-dataid-guard.sh +52 -49
- 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 +36 -34
- package/assets/hooks/rule-source-guard.sh +52 -36
- package/assets/hooks/skill-gate-layers.sh +59 -57
- package/assets/hooks/skill-gate-rearm.sh +15 -8
- package/assets/hooks/skill-gate.sh +89 -81
- package/assets/hooks/skill-loaded.sh +6 -6
- package/assets/hooks/sql-guard-parse.sh +68 -66
- package/assets/hooks/sql-guard-request.sh +48 -46
- package/assets/hooks/sql-guard-target.sh +57 -51
- package/assets/hooks/sql-guard-write.sh +84 -79
- package/assets/hooks/sql-guard.sh +52 -47
- package/assets/hooks/stand-login-guard.sh +104 -0
- 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 +256 -204
- package/assets/hooks/turn-exit-patterns.sh +53 -0
- package/assets/hooks/utf8.sh +11 -11
- package/assets/hooks/waiting-turn-guard.sh +94 -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 +115 -30
- package/assets/laws/autonomous-work.md +29 -27
- package/assets/laws/code-structure.md +31 -30
- package/assets/laws/delivery.md +148 -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 -114
- package/assets/laws/work-conduct.md +250 -250
- 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 +143 -67
- package/assets/patterns/browser-verification-stand.md +181 -128
- package/assets/patterns/component-structure-new.md +51 -42
- package/assets/patterns/dependencies-upgrade.md +55 -39
- package/assets/patterns/doc-style-human.md +93 -0
- 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 -75
- package/assets/patterns/git-workflow-commit.github.md +153 -129
- package/assets/patterns/git-workflow-commit.gitlab.md +96 -78
- 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 +99 -86
- 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 +126 -121
- package/assets/patterns/git-workflow-pr.github.md +179 -175
- package/assets/patterns/git-workflow-pr.gitlab.md +138 -131
- 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 +131 -106
- 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 +37 -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 +215 -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 +204 -192
- package/assets/patterns/testing-e2e.md +103 -92
- 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 +152 -141
- package/assets/pitfalls/doc-style.md +96 -91
- package/assets/pitfalls/git-workflow.azure.md +49 -46
- package/assets/pitfalls/git-workflow.github.md +264 -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 +75 -74
- package/assets/rules/browser-verification.md +223 -188
- 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 +209 -148
- 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 +250 -242
- 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 -137
- package/assets/rules/shared-code.md +82 -79
- package/assets/rules/spec-driven.md +272 -260
- package/assets/rules/status-report.md +55 -58
- package/assets/rules/styling-bem.md +83 -72
- package/assets/rules/task-flow.md +282 -270
- package/assets/rules/testing.md +224 -188
- package/assets/rules/turn-conduct.md +255 -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 +236 -222
- 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/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 +68 -4
- 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 +13 -4
- package/lib/enroll.js.map +1 -1
- package/lib/observations.d.ts +10 -1
- package/lib/observations.d.ts.map +1 -1
- package/lib/observations.js +1 -0
- package/lib/observations.js.map +1 -1
- package/lib/override-marks.d.ts +24 -0
- package/lib/override-marks.d.ts.map +1 -0
- package/lib/override-marks.js +98 -0
- package/lib/override-marks.js.map +1 -0
- 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 +0 -7
- package/lib/ship.d.ts.map +1 -1
- package/lib/ship.js +10 -2
- package/lib/ship.js.map +1 -1
- package/lib/shipment.d.ts.map +1 -1
- package/lib/shipment.js +7 -3
- 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.26.0.tgz +0 -0
- package/rt-tools-agent-kit-0.23.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,19 +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
|
|
|
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.
|
|
121
|
+
if [ -n "$(git -C "$root" ls-files -u -- "$candidate" 2>/dev/null)" ] \
|
|
122
|
+
|| grep -qE '^(<<<<<<< |>>>>>>> )' "$candidate" 2>/dev/null; then
|
|
123
|
+
continue
|
|
124
|
+
fi
|
|
125
|
+
|
|
110
126
|
if [ -n "$sources" ] && [ -f "$root/$sources/$resource" ]; then
|
|
111
|
-
deny "BLOCKED by rule-source-guard: «${candidate#"$root"/}»
|
|
112
|
-
"
|
|
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"
|
|
113
129
|
fi
|
|
114
130
|
|
|
115
|
-
deny "BLOCKED by rule-source-guard: «${candidate#"$root"/}»
|
|
116
|
-
"
|
|
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"
|
|
117
133
|
done <<EOF
|
|
118
134
|
$candidates
|
|
119
135
|
EOF
|
|
@@ -1,30 +1,30 @@
|
|
|
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
|
+
# The domain rule is chosen once by the file path — an edit has one subject, and there is one
|
|
5
|
+
# rule for it. There are a dozen and a half layers on top of it: access to the runtime is visible
|
|
6
|
+
# only in the text of the edit, observability comes together with the domain rather than instead
|
|
7
|
+
# of it, prose and work conduct judge the same file by a second sign. Together they do not fit
|
|
8
|
+
# into the gate map, which is read whole — so they live here.
|
|
9
9
|
#
|
|
10
|
-
#
|
|
11
|
-
#
|
|
12
|
-
#
|
|
10
|
+
# Sourced from `skill-gate.sh` in its own shell: it reads `$input`, `$target` and `$req` and
|
|
11
|
+
# appends rule names to `$req`. As a separate process the layers would return the same thing
|
|
12
|
+
# through the disk.
|
|
13
13
|
#
|
|
14
|
-
#
|
|
15
|
-
#
|
|
14
|
+
# FAIL-OPEN: nothing to parse the input with — the layer is silent. Parsing the input is side
|
|
15
|
+
# work here, and its breakage has no right to stop the edit.
|
|
16
16
|
#
|
|
17
|
-
#
|
|
18
|
-
#
|
|
19
|
-
#
|
|
17
|
+
# The layers do not know the tree's addresses: where its backend, showcase and end-to-end tests
|
|
18
|
+
# are is said by the tree itself — by the function `skill_layer_skip <rule> <target>` in its gate
|
|
19
|
+
# map. Without it a layer acts everywhere its sign matched.
|
|
20
20
|
|
|
21
|
-
#
|
|
22
|
-
#
|
|
21
|
+
# What is already named is not required a second time: a refusal listing one rule twice reads as
|
|
22
|
+
# two different requirements.
|
|
23
23
|
. "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/utf8.sh" 2>/dev/null || true
|
|
24
24
|
|
|
25
|
-
#
|
|
26
|
-
#
|
|
27
|
-
#
|
|
25
|
+
# A built tree is never code: the path to an artifact arrives from the command that runs it. The
|
|
26
|
+
# gate map already lets such a path through, and the layers must stay silent along with it —
|
|
27
|
+
# otherwise leaving the map lifts one requirement and leaves a dozen and a half others.
|
|
28
28
|
case "$target" in
|
|
29
29
|
*/node_modules/* | */dist/* | */build/* | */.nx/* | */coverage/*) return 0 ;;
|
|
30
30
|
esac
|
|
@@ -36,15 +36,16 @@ rt_layer_add() {
|
|
|
36
36
|
req="${req:+$req }$1"
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
#
|
|
40
|
-
#
|
|
39
|
+
# The tree may lift a layer from a place where the sign is lawful: a direct call to the runtime
|
|
40
|
+
# on the backend, reading the environment in the harness, creating a file in end-to-end tests.
|
|
41
41
|
rt_layer_allowed() {
|
|
42
42
|
command -v skill_layer_skip >/dev/null 2>&1 || return 0
|
|
43
43
|
skill_layer_skip "$1" "$2" && return 1
|
|
44
44
|
return 0
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
#
|
|
47
|
+
# The edit text is read once for all layers: parsing the input costs more than the signs
|
|
48
|
+
# themselves.
|
|
48
49
|
rt_layer_payload=""
|
|
49
50
|
if command -v jq >/dev/null 2>&1; then
|
|
50
51
|
rt_layer_payload="$(printf '%s' "$input" \
|
|
@@ -52,15 +53,16 @@ if command -v jq >/dev/null 2>&1; then
|
|
|
52
53
|
| map(select(. != null)) | join("\n")' 2>/dev/null)"
|
|
53
54
|
fi
|
|
54
55
|
|
|
55
|
-
#
|
|
56
|
+
# A spec checks behaviour rather than creating it: `testing` is needed there, and the behaviour
|
|
57
|
+
# layers skip it.
|
|
56
58
|
rt_layer_is_spec=1
|
|
57
59
|
case "$target" in *.spec.ts) rt_layer_is_spec=0 ;; esac
|
|
58
60
|
|
|
59
|
-
# ---
|
|
61
|
+
# --- layer by text: a call to the runtime -----------------------------------------------------
|
|
60
62
|
#
|
|
61
|
-
#
|
|
62
|
-
#
|
|
63
|
-
#
|
|
63
|
+
# The path says WHAT file it is, while a call to the global object is visible only in the
|
|
64
|
+
# content: a gate that knows the path alone lets it through silently. A value obtained by
|
|
65
|
+
# injection does not count as a sign — that is already a dependency, not a direct call.
|
|
64
66
|
if [ -n "$rt_layer_payload" ] && [ "$rt_layer_is_spec" = 1 ]; then
|
|
65
67
|
case "$target" in
|
|
66
68
|
*/main.ts|*/main.server.ts|*/server.ts|*/index.html) ;;
|
|
@@ -73,11 +75,11 @@ if [ -n "$rt_layer_payload" ] && [ "$rt_layer_is_spec" = 1 ]; then
|
|
|
73
75
|
esac
|
|
74
76
|
fi
|
|
75
77
|
|
|
76
|
-
# ---
|
|
78
|
+
# --- layer by text: observability -------------------------------------------------------------
|
|
77
79
|
#
|
|
78
|
-
#
|
|
79
|
-
#
|
|
80
|
-
#
|
|
80
|
+
# Reading an environment variable is exactly the moment a new optional capability is created.
|
|
81
|
+
# The startup digest lists them by hand, and one that forgot to add itself will not land in any
|
|
82
|
+
# of the three lists — on production it looks not switched off but non-existent.
|
|
81
83
|
if [ -n "$rt_layer_payload" ] && [ "$rt_layer_is_spec" = 1 ]; then
|
|
82
84
|
case "$target" in
|
|
83
85
|
*.ts)
|
|
@@ -88,11 +90,11 @@ if [ -n "$rt_layer_payload" ] && [ "$rt_layer_is_spec" = 1 ]; then
|
|
|
88
90
|
esac
|
|
89
91
|
fi
|
|
90
92
|
|
|
91
|
-
# ---
|
|
93
|
+
# --- layer by text: shared code ---------------------------------------------------------------
|
|
92
94
|
#
|
|
93
|
-
#
|
|
94
|
-
#
|
|
95
|
-
#
|
|
95
|
+
# A newly created numeric setting and a newly created enumeration are the moment a copy appears
|
|
96
|
+
# next to what is already shared. Each copy is sound on its own, and neither the linter nor the
|
|
97
|
+
# build sees the second one. Specs do not count: values there are local, they are fixtures.
|
|
96
98
|
if [ -n "$rt_layer_payload" ] && [ "$rt_layer_is_spec" = 1 ]; then
|
|
97
99
|
case "$target" in
|
|
98
100
|
*.ts)
|
|
@@ -104,11 +106,11 @@ if [ -n "$rt_layer_payload" ] && [ "$rt_layer_is_spec" = 1 ]; then
|
|
|
104
106
|
esac
|
|
105
107
|
fi
|
|
106
108
|
|
|
107
|
-
# ---
|
|
109
|
+
# --- layer by path: Angular classes -----------------------------------------------------------
|
|
108
110
|
#
|
|
109
|
-
#
|
|
110
|
-
#
|
|
111
|
-
#
|
|
111
|
+
# A component and a store are classes too: the signal input API, change detection and where a
|
|
112
|
+
# subscription lives are in `angular-patterns`, while as the first layer these files go to the
|
|
113
|
+
# component structure and to the language conventions, where none of that is.
|
|
112
114
|
if [ "$rt_layer_is_spec" = 1 ]; then
|
|
113
115
|
case "$target" in
|
|
114
116
|
*.component.ts|*.store.ts)
|
|
@@ -117,36 +119,36 @@ if [ "$rt_layer_is_spec" = 1 ]; then
|
|
|
117
119
|
esac
|
|
118
120
|
fi
|
|
119
121
|
|
|
120
|
-
# ---
|
|
122
|
+
# --- layer by path: prose ---------------------------------------------------------------------
|
|
121
123
|
#
|
|
122
|
-
#
|
|
123
|
-
#
|
|
124
|
-
#
|
|
124
|
+
# The spec format is held by `spec-driven`, and how to word things by `doc-style`, and it is
|
|
125
|
+
# needed not only by specs. A check's known list is the same prose: its field explains why what
|
|
126
|
+
# is listed does not count as a refusal, and the text audit reads only `.md`.
|
|
125
127
|
#
|
|
126
|
-
#
|
|
127
|
-
#
|
|
128
|
-
#
|
|
128
|
+
# The agent's own housekeeping the layer skips: the rule for it is itself, and the gate map
|
|
129
|
+
# decides about these files whole. A layer laid on top would demand a rule where the map left it
|
|
130
|
+
# unnamed on purpose.
|
|
129
131
|
case "$target" in
|
|
130
132
|
*/.claude/*) ;;
|
|
131
133
|
*.md|*-allowlist.json) rt_layer_allowed doc-style "$target" && rt_layer_add doc-style ;;
|
|
132
134
|
esac
|
|
133
135
|
|
|
134
|
-
# ---
|
|
136
|
+
# --- layer by path: work conduct --------------------------------------------------------------
|
|
135
137
|
#
|
|
136
|
-
#
|
|
137
|
-
#
|
|
138
|
-
#
|
|
138
|
+
# The task folder, the product agreement before the code and the epic plan are the first files
|
|
139
|
+
# created in work. The requirement catches on them whoever went past the order: "a new task has
|
|
140
|
+
# arrived" is not a tool, and there is nothing else to catch it with.
|
|
139
141
|
case "$target" in
|
|
140
142
|
*/docs/tasks/*|*/docs/specs/*/proposed/*|*/docs/plans/*)
|
|
141
143
|
rt_layer_allowed task-flow "$target" && rt_layer_add task-flow
|
|
142
144
|
;;
|
|
143
145
|
esac
|
|
144
146
|
|
|
145
|
-
# ---
|
|
147
|
+
# --- layer by file creation -------------------------------------------------------------------
|
|
146
148
|
#
|
|
147
|
-
#
|
|
148
|
-
#
|
|
149
|
-
#
|
|
149
|
+
# Nothing is written from scratch, and this is asked where the decision is made — at the
|
|
150
|
+
# creation of a new file: an edit of an existing one has its foundation already chosen, and
|
|
151
|
+
# demanding the rule on every line would turn it into background.
|
|
150
152
|
case "$target" in
|
|
151
153
|
*/docs/*) ;;
|
|
152
154
|
*.spec.ts|*.stories.ts) ;;
|
|
@@ -155,9 +157,9 @@ case "$target" in
|
|
|
155
157
|
;;
|
|
156
158
|
esac
|
|
157
159
|
|
|
158
|
-
#
|
|
159
|
-
#
|
|
160
|
-
#
|
|
160
|
+
# Where a newly created check goes and what shape its known list has are statements of
|
|
161
|
+
# `testing`, and they are needed exactly at the moment of creation: an existing check has both
|
|
162
|
+
# its place in the gate and the shape of its list already chosen.
|
|
161
163
|
case "$target" in
|
|
162
164
|
*/check-*.mjs|*-allowlist.json)
|
|
163
165
|
[ -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
|