checkwright 0.20.0 → 0.22.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 +385 -19
- package/lib/common/digest.sh +18 -0
- package/lib/common/lock.sh +11 -0
- package/lib/common/recipe.sh +8 -11
- package/lib/doctor.sh +49 -0
- package/lib/init.sh +152 -29
- package/package.json +2 -2
- package/payload/artifact/targets.list +30 -0
- package/payload/artifact/x86_64-unknown-linux-gnu/checkwright-gates +0 -0
- package/payload/artifact/x86_64-unknown-linux-gnu/checkwright-gates.sha256 +1 -0
- package/payload/canon-kit/README.md +1 -0
- package/payload/canon-kit/SPEC.md +281 -26
- package/payload/canon-kit/checks/check-comment-tier.sh +7 -2
- package/payload/canon-kit/checks/check-docs-link-convention.sh +11 -4
- package/payload/canon-kit/checks/check-md-refs.sh +22 -9
- package/payload/canon-kit/checks/check-payload-claim.sh +133 -0
- package/payload/canon-kit/checks/check-prose-enum.sh +1 -1
- package/payload/canon-kit/checks/check-spec-pointer.sh +15 -4
- package/payload/canon-kit/gate-tests/check-comment-tier/good/good.sh +3 -0
- package/payload/canon-kit/gate-tests/check-comment-tier.test.sh +26 -3
- package/payload/canon-kit/gate-tests/check-docs-link-convention/bad/OUTSIDE.md +4 -0
- package/payload/canon-kit/gate-tests/check-docs-link-convention/bad/docs/index.md +3 -0
- package/payload/canon-kit/gate-tests/check-docs-link-convention/good/OUTSIDE.md +4 -0
- package/payload/canon-kit/gate-tests/check-docs-link-convention/good/docs/methodology.md +8 -0
- package/payload/canon-kit/gate-tests/check-docs-link-convention.test.sh +94 -0
- package/payload/canon-kit/gate-tests/check-manifest-count.test.sh +5 -3
- package/payload/canon-kit/gate-tests/check-payload-claim/bad/README.md +15 -0
- package/payload/canon-kit/gate-tests/check-payload-claim/bad/expect.txt +2 -0
- package/payload/canon-kit/gate-tests/check-payload-claim/bad/install.md +19 -0
- package/payload/canon-kit/gate-tests/check-payload-claim/bad/posts/note.md +6 -0
- package/payload/canon-kit/gate-tests/check-payload-claim/bad/scripts/canon-config.sh +8 -0
- package/payload/canon-kit/gate-tests/check-payload-claim/bad/scripts/payload-claims.sh +7 -0
- package/payload/canon-kit/gate-tests/check-payload-claim/good/README.md +15 -0
- package/payload/canon-kit/gate-tests/check-payload-claim/good/expect.txt +2 -0
- package/payload/canon-kit/gate-tests/check-payload-claim/good/install.md +20 -0
- package/payload/canon-kit/gate-tests/check-payload-claim/good/posts/note.md +6 -0
- package/payload/canon-kit/gate-tests/check-payload-claim/good/scripts/canon-config.sh +8 -0
- package/payload/canon-kit/gate-tests/check-payload-claim/good/scripts/payload-claims.sh +7 -0
- package/payload/canon-kit/gate-tests/check-prose-enum.test.sh +24 -1
- package/payload/canon-kit/gate-tests/check-spec-pointer/bad/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-spec-pointer/bad/widget.sh +1 -0
- package/payload/canon-kit/gate-tests/check-spec-pointer/good/widget.sh +1 -0
- package/payload/canon-kit/lib/spec.sh +22 -12
- package/payload/canon-kit/smoke/install.sh +20 -1
- package/payload/canon-kit/templates/SPEC-amendment.md +5 -1
- package/payload/context-kit/SPEC.md +38 -7
- package/payload/context-kit/lib/toolfloor.sh +1 -1
- package/payload/context-kit/smoke/install.sh +3 -1
- package/payload/delegation-kit/README.md +2 -1
- package/payload/delegation-kit/SPEC.md +590 -48
- package/payload/delegation-kit/bin/run-dispatch-guard-tests.sh +97 -0
- package/payload/delegation-kit/checks/check-agent-tier-explicit.sh +61 -0
- package/payload/delegation-kit/checks/check-gate-tamper.sh +1 -1
- package/payload/delegation-kit/gate-tests/check-agent-tier-explicit/bad/agents/silent.md +7 -0
- package/payload/delegation-kit/gate-tests/check-agent-tier-explicit/bad/args +1 -0
- package/payload/delegation-kit/gate-tests/check-agent-tier-explicit/bad/expect.txt +1 -0
- package/payload/delegation-kit/gate-tests/check-agent-tier-explicit/good/agents/explicit-cheap.md +7 -0
- package/payload/delegation-kit/gate-tests/check-agent-tier-explicit/good/agents/explicit-inherit.md +8 -0
- package/payload/delegation-kit/gate-tests/check-agent-tier-explicit/good/args +1 -0
- package/payload/delegation-kit/gate-tests/check-agent-tier-explicit/good/expect.txt +1 -0
- package/payload/delegation-kit/lib/delegation.sh +3 -0
- package/payload/delegation-kit/smoke/install.sh +3 -1
- package/payload/delegation-kit/templates/agent-dispatch-guard.sh +61 -0
- package/payload/delegation-kit/templates/agent-execution.md +171 -15
- package/payload/delegation-kit/templates/delegation-config.sh +4 -0
- package/payload/delegation-kit/templates/dispatch-checklists.md +1 -1
- package/payload/delegation-kit/usage-tests/dispatch-guard-cases.tsv +30 -0
- package/payload/doctrine-kit/DOCTRINE.md +27 -0
- package/payload/doctrine-kit/README.md +5 -0
- package/payload/doctrine-kit/SPEC.md +62 -3
- package/payload/doctrine-kit/bin/install-doctrine.sh +84 -4
- package/payload/doctrine-kit/smoke/install.sh +77 -1
- package/payload/drift-kit/README.md +3 -2
- package/payload/drift-kit/SPEC.md +253 -20
- package/payload/drift-kit/bin/stage-economics.sh +157 -3
- package/payload/drift-kit/kpis/kpi-incident-recurrence.sh +42 -0
- package/payload/drift-kit/smoke/install.sh +155 -1
- package/payload/drift-kit/templates/economics.md +9 -0
- package/payload/drift-kit/templates/kpis.list +6 -1
- package/payload/evidence-kit/README.md +20 -6
- package/payload/evidence-kit/SPEC.md +355 -17
- package/payload/evidence-kit/bin/run-validate.sh +51 -9
- package/payload/evidence-kit/checks/check-battery-roster.sh +86 -0
- package/payload/evidence-kit/checks/check-producer-liveness.sh +34 -0
- package/payload/evidence-kit/gate-tests/check-battery-roster/bad/args +1 -0
- package/payload/evidence-kit/gate-tests/check-battery-roster/bad/expect.txt +1 -0
- package/payload/evidence-kit/gate-tests/check-battery-roster/bad/runner.md +14 -0
- package/payload/evidence-kit/gate-tests/check-battery-roster/bad/scripts/evidence-config.sh +7 -0
- package/payload/evidence-kit/gate-tests/check-battery-roster/good/args +1 -0
- package/payload/evidence-kit/gate-tests/check-battery-roster/good/expect.txt +1 -0
- package/payload/evidence-kit/gate-tests/check-battery-roster/good/runner.md +14 -0
- package/payload/evidence-kit/gate-tests/check-battery-roster/good/scripts/evidence-config.sh +7 -0
- package/payload/evidence-kit/gate-tests/check-battery-roster.test.sh +68 -0
- package/payload/evidence-kit/gate-tests/check-producer-liveness/bad/args +1 -0
- package/payload/evidence-kit/gate-tests/check-producer-liveness/bad/expect.txt +1 -0
- package/payload/evidence-kit/gate-tests/check-producer-liveness/bad/run-validate.lock +1 -0
- package/payload/evidence-kit/gate-tests/check-producer-liveness/good/args +1 -0
- package/payload/evidence-kit/gate-tests/check-producer-liveness/good/expect.txt +2 -0
- package/payload/evidence-kit/gate-tests/check-producer-liveness/good/run-validate.lock +1 -0
- package/payload/evidence-kit/gate-tests/producer-lock.test.sh +109 -0
- package/payload/evidence-kit/lib/evidence.sh +18 -0
- package/payload/evidence-kit/smoke/install.sh +17 -3
- package/payload/gate-sdk/README.md +4 -1
- package/payload/gate-sdk/SPEC.md +1955 -79
- package/payload/gate-sdk/bin/gen-pre-commit.sh +13 -3
- package/payload/gate-sdk/bin/run-consumer-smoke.sh +121 -1
- package/payload/gate-sdk/bin/run-gate-tests.sh +40 -9
- package/payload/gate-sdk/bin/run-gates.sh +32 -3
- package/payload/gate-sdk/bin/upgrade-smoke.sh +3 -3
- package/payload/gate-sdk/checks/check-action-gh-repo.gate +2 -0
- package/payload/gate-sdk/checks/check-action-pinning.gate +2 -0
- package/payload/gate-sdk/checks/check-action-run-shell.sh +3 -1
- package/payload/gate-sdk/checks/check-core-files.sh +27 -4
- package/payload/gate-sdk/checks/check-exec-bit.sh +20 -1
- package/payload/gate-sdk/checks/check-gate-binary-fresh.sh +106 -0
- package/payload/gate-sdk/checks/check-gate-exemption-tasks.sh +6 -7
- package/payload/gate-sdk/checks/check-gate-output.sh +9 -1
- package/payload/gate-sdk/checks/check-gate-substrate-parity.sh +302 -0
- package/payload/gate-sdk/checks/check-graph.sh +7 -8
- package/payload/gate-sdk/checks/check-readme-roster.sh +5 -0
- package/payload/gate-sdk/checks/check-reads-couples.sh +73 -22
- package/payload/gate-sdk/checks/check-template-registry-parity.sh +81 -0
- package/payload/gate-sdk/checks/check-tree-terms.sh +11 -7
- package/payload/gate-sdk/gate-tests/check-action-run-shell.test.sh +16 -1
- package/payload/gate-sdk/gate-tests/check-core-files.test.sh +64 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/args +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/expect.txt +5 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/kitroot/checks/check-vendored.gate +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/scripts/check-ported.gate +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/scripts/gate-sdk-config.sh +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/scripts/gates.list +4 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/stamp.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/stub-bin +6 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/args +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/expect.txt +5 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/kitroot/checks/check-vendored.gate +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/scripts/check-ported.gate +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/scripts/gate-sdk-config.sh +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/scripts/gates.list +4 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/stamp.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/stub-bin +5 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh.test.sh +81 -0
- package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/TASK-QUEUE.md +3 -1
- package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/expect.txt +3 -1
- package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/gates/check-sample.sh +3 -1
- package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-output/bad/check-sample.sh +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-output/good/check-sample.sh +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-output/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/args +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/conservation.md +7 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/expect.txt +12 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/impl/gate.rs +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/kitroot/check-orphan.rs +3 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/publish.yml +15 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-alpha.sh +3 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-dup.gate +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-dup.sh +3 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-orphan.gate +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/gate-sdk-config.sh +6 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/gates.list +3 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/stub-bin +3 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/targets.list +3 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/args +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/conservation.md +8 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/expect.txt +7 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/impl/gate.rs +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/kitroot/check-other.rs +3 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/publish.yml +15 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/check-alpha.sh +3 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/check-ported.gate +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/gate-sdk-config.sh +6 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/gates.list +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/stub-bin +3 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/targets.list +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity.test.sh +123 -0
- package/payload/gate-sdk/gate-tests/check-reads-couples.test.sh +139 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/alpha-kit/templates/widgets.list +4 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/alpha-kit/widgets/widget-one.sh +3 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/alpha-kit/widgets/widget-two.sh +3 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/args +4 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/scripts/gate-sdk-config.sh +5 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/alpha-kit/templates/widgets.list +4 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/alpha-kit/widgets/widget-one.sh +3 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/alpha-kit/widgets/widget-two.sh +3 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/args +8 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/beta-kit/templates/rules.list +5 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/beta-kit/templates/table.tsv +4 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/scripts/gate-sdk-config.sh +5 -0
- package/payload/gate-sdk/gate-tests/lib-declaration.test.sh +4 -4
- package/payload/gate-sdk/gate-tests/lib-gate.test.sh +41 -1
- package/payload/gate-sdk/gate-tests/run-gate-tests.test.sh +144 -0
- package/payload/gate-sdk/lib/consumer-smoke.sh +26 -1
- package/payload/gate-sdk/lib/gate.sh +104 -13
- package/payload/gate-sdk/lib/inject.sh +21 -1
- package/payload/gate-sdk/smoke/install.sh +19 -1
- package/payload/guard-kit/README.md +4 -3
- package/payload/guard-kit/SPEC.md +88 -10
- package/payload/guard-kit/bin/compare-settings-allow.sh +40 -7
- package/payload/guard-kit/gate-tests/compare-settings-allow.test.sh +64 -0
- package/payload/guard-kit/lib/guard.sh +1 -0
- package/payload/guard-kit/templates/close-triage.md +35 -7
- package/payload/guard-kit/templates/guard-config.sh +3 -0
- package/payload/lifecycle-kit/README.md +1 -0
- package/payload/lifecycle-kit/SPEC.md +589 -33
- package/payload/lifecycle-kit/bin/enter-stage.sh +13 -3
- package/payload/lifecycle-kit/bin/file-gap.sh +42 -1
- package/payload/lifecycle-kit/bin/file-survey.sh +50 -0
- package/payload/lifecycle-kit/checks/check-merge-attrs.sh +1 -1
- package/payload/lifecycle-kit/checks/check-skill-binding.sh +1 -1
- package/payload/lifecycle-kit/checks/check-survey-record.sh +102 -0
- package/payload/lifecycle-kit/gate-tests/check-merge-attrs/bad/.gitattributes +1 -0
- package/payload/lifecycle-kit/gate-tests/check-merge-attrs/good/.gitattributes +1 -0
- package/payload/lifecycle-kit/gate-tests/check-merge-attrs.test.sh +1 -0
- package/payload/lifecycle-kit/gate-tests/check-survey-record/bad/args +2 -0
- package/payload/lifecycle-kit/gate-tests/check-survey-record/bad/expect.txt +4 -0
- package/payload/lifecycle-kit/gate-tests/check-survey-record/bad/record.md +18 -0
- package/payload/lifecycle-kit/gate-tests/check-survey-record/good/args +2 -0
- package/payload/lifecycle-kit/gate-tests/check-survey-record/good/expect.txt +1 -0
- package/payload/lifecycle-kit/gate-tests/check-survey-record/good/record.md +13 -0
- package/payload/lifecycle-kit/gate-tests/check-survey-record.test.sh +84 -0
- package/payload/lifecycle-kit/gate-tests/file-gap-recurrence.test.sh +94 -0
- package/payload/lifecycle-kit/gate-tests/survey-record-entry.test.sh +102 -0
- package/payload/lifecycle-kit/lib/stages.sh +8 -2
- package/payload/lifecycle-kit/smoke/install.sh +17 -1
- package/payload/lifecycle-kit/templates/consult.md +73 -0
- package/payload/lifecycle-kit/templates/lead.md +141 -10
- package/payload/lifecycle-kit/templates/stages/align.md +12 -0
- package/payload/lifecycle-kit/templates/stages/build.md +8 -0
- package/payload/lifecycle-kit/templates/stages/close.md +25 -4
- package/payload/lifecycle-kit/templates/stages/scope.md +34 -0
- package/payload/lifecycle-kit/templates/stages/spec.md +8 -0
- package/payload/lifecycle-kit/templates/stages/validate.md +8 -0
- package/payload/queue-kit/README.md +4 -1
- package/payload/queue-kit/SPEC.md +230 -6
- package/payload/queue-kit/bin/queue-edges.sh +78 -0
- package/payload/queue-kit/checks/check-queue-entry-budget.sh +5 -3
- package/payload/queue-kit/gate-tests/check-queue-hygiene/good/TASK-QUEUE.md +5 -0
- package/payload/queue-kit/gate-tests/queue-edges.test.sh +130 -0
- package/payload/queue-kit/smoke/install.sh +4 -1
- package/payload/queue-kit/templates/TASK-QUEUE.md +3 -0
- package/payload/site-kit/SPEC.md +135 -29
- package/payload/site-kit/checks/check-docs-render-fidelity.sh +100 -27
- package/payload/site-kit/gate-tests/check-docs-render-fidelity-batch.test.sh +158 -0
- package/payload/site-kit/lib/site.sh +16 -2
- package/payload/site-kit/smoke/install.sh +9 -1
- package/payload/gate-sdk/checks/check-action-gh-repo.sh +0 -321
- package/payload/gate-sdk/checks/check-action-pinning.sh +0 -55
|
@@ -67,6 +67,7 @@ gates_list_members() {
|
|
|
67
67
|
grep -Ev '^[[:space:]]*(#|$)' "$1" || true
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
+
# spec: gate-sdk/SPEC.md §lib/gate.sh — resolve a gate name to its *declaration* path: the file whose text carries the `# graph:` manifest and the `# spec:`/`# assertion` directives. Dirs are tried consumer-first and `.sh` beats `.gate` within a dir, so a consumer shadowing a ported gate with its own shell script still wins. A dir carrying both spellings for one name is ambiguous dispatch, caught by check-gate-substrate-parity assertion A rather than silently ordered here.
|
|
70
71
|
gate_resolve() {
|
|
71
72
|
local g="$1" d
|
|
72
73
|
shift
|
|
@@ -75,10 +76,84 @@ gate_resolve() {
|
|
|
75
76
|
printf '%s\n' "$d/$g.sh"
|
|
76
77
|
return 0
|
|
77
78
|
fi
|
|
79
|
+
if [[ -f "$d/$g.gate" ]]; then
|
|
80
|
+
printf '%s\n' "$d/$g.gate"
|
|
81
|
+
return 0
|
|
82
|
+
fi
|
|
83
|
+
done
|
|
84
|
+
return 1
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
# spec: gate-sdk/SPEC.md §lib/gate.sh — resolve a gate name to its *invocation argv*, the execution counterpart of gate_resolve's declaration path: one element `<dir>/<name>.sh` for a shell gate, two elements `<binary> <name>` for a `.gate`-dispatched one. Emits one argv element per line. An absent or non-executable binary when a member dispatches to it is a harness error — exit 2, never a skip and never a pass (§Fail-closed contract): a skip would let the battery silently stop running a gate whenever a build is missing.
|
|
88
|
+
gate_command() {
|
|
89
|
+
local g="$1" d bin
|
|
90
|
+
shift
|
|
91
|
+
for d in "$@"; do
|
|
92
|
+
if [[ -f "$d/$g.sh" ]]; then
|
|
93
|
+
printf '%s\n' "$d/$g.sh"
|
|
94
|
+
return 0
|
|
95
|
+
fi
|
|
96
|
+
if [[ -f "$d/$g.gate" ]]; then
|
|
97
|
+
bin="$(gate_native_bin)"
|
|
98
|
+
if [[ ! -x "$bin" ]]; then
|
|
99
|
+
printf 'gate_command: %s dispatches to the native binary, but %s is ' "$g" "$bin" >&2
|
|
100
|
+
printf 'absent or not executable — the gate could not run; treating as ' >&2
|
|
101
|
+
printf 'failure (not clean). Build it: cargo build --release --manifest-path native/Cargo.toml\n' >&2
|
|
102
|
+
exit 2
|
|
103
|
+
fi
|
|
104
|
+
printf '%s\n%s\n' "$bin" "$g"
|
|
105
|
+
return 0
|
|
106
|
+
fi
|
|
78
107
|
done
|
|
79
108
|
return 1
|
|
80
109
|
}
|
|
81
110
|
|
|
111
|
+
# spec: gate-sdk/SPEC.md §Layout and configuration — the one home of GATE_SDK_NATIVE_BIN's default, so a knob default gains readers without gaining spellings
|
|
112
|
+
gate_native_bin() {
|
|
113
|
+
printf '%s\n' "${GATE_SDK_NATIVE_BIN:-native/target/release/checkwright-gates}"
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
# spec: gate-sdk/SPEC.md §Layout and configuration — the one home of GATE_SDK_NATIVE_CRATE's default, trailing slash stripped, so its three shell readers share a spelling rather than each carrying one
|
|
117
|
+
gate_native_crate() {
|
|
118
|
+
local crate="${GATE_SDK_NATIVE_CRATE:-native}"
|
|
119
|
+
printf '%s\n' "${crate%/}"
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
# spec: gate-sdk/SPEC.md §Layout and configuration — GATE_SDK_NATIVE_TARGETS_FILE, defaulted off GATE_SDK_NATIVE_CRATE so the crate's location keeps one owner
|
|
123
|
+
gate_native_targets_file() {
|
|
124
|
+
local crate
|
|
125
|
+
crate="$(gate_native_crate)"
|
|
126
|
+
printf '%s\n' "${GATE_SDK_NATIVE_TARGETS_FILE:-$crate/targets.list}"
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
# spec: gate-sdk/SPEC.md §check-gate-binary-fresh — the tree side of the source stamp: the same three git invocations native/build.rs bakes into the binary, so the comparison stays one algorithm rather than two implementations of one. Returns 1 emitting nothing when git cannot answer, so a caller fails closed rather than comparing against an empty string.
|
|
130
|
+
gate_native_source_stamp() {
|
|
131
|
+
local crate listing hashed stamp i
|
|
132
|
+
local -a paths=() hashes=()
|
|
133
|
+
crate="$(gate_native_crate)"
|
|
134
|
+
listing="$(git -C "$crate" ls-files 2>/dev/null)" || return 1
|
|
135
|
+
[[ -n "$listing" ]] || return 1
|
|
136
|
+
mapfile -t paths <<<"$listing"
|
|
137
|
+
hashed="$(git -C "$crate" hash-object -- "${paths[@]}" 2>/dev/null)" || return 1
|
|
138
|
+
mapfile -t hashes <<<"$hashed"
|
|
139
|
+
[[ ${#hashes[@]} -eq ${#paths[@]} ]] || return 1
|
|
140
|
+
local manifest=""
|
|
141
|
+
for ((i = 0; i < ${#paths[@]}; i++)); do
|
|
142
|
+
manifest+="${hashes[i]} ${paths[i]}"$'\n'
|
|
143
|
+
done
|
|
144
|
+
stamp="$(printf '%s' "$manifest" | git -C "$crate" hash-object --stdin 2>/dev/null)" || return 1
|
|
145
|
+
[[ -n "$stamp" ]] || return 1
|
|
146
|
+
printf '%s\n' "$stamp"
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
# spec: gate-sdk/SPEC.md §lib/gate.sh — the target roster's single reader; an absent roster returns 1 and emits nothing, so a caller tells "no roster declared" from "a roster declaring nothing" rather than reading both as no targets
|
|
150
|
+
gate_native_targets() {
|
|
151
|
+
local f
|
|
152
|
+
f="$(gate_native_targets_file)"
|
|
153
|
+
[[ -f "$f" ]] || return 1
|
|
154
|
+
gates_list_members "$f"
|
|
155
|
+
}
|
|
156
|
+
|
|
82
157
|
gate_kit_roots() {
|
|
83
158
|
local d kit
|
|
84
159
|
if [[ -n "${GATE_SDK_KIT_DIRS:-}" ]]; then
|
|
@@ -122,39 +197,55 @@ gate_fixture_suites() {
|
|
|
122
197
|
done
|
|
123
198
|
}
|
|
124
199
|
|
|
125
|
-
# spec: gate-sdk/SPEC.md §lib/gate.sh —
|
|
126
|
-
|
|
200
|
+
# spec: gate-sdk/SPEC.md §lib/gate.sh — the gate_kit_roots_rel cache-fill, split out so an in-process caller (gate_expand_couples) can prime the shared _gate_kit_roots_rel_cache array and read it directly, with no stdout round-trip / process-substitution fork of its own. The kit-root set cannot change mid-process, so a cold-cache fill (the realpath-per-root fork cost) happens at most once per gate invocation.
|
|
201
|
+
_gate_kit_roots_rel_ensure_cache() {
|
|
202
|
+
[[ -n "${_gate_kit_roots_rel_cache_set:-}" ]] && return 0
|
|
127
203
|
local anchor root
|
|
128
204
|
anchor="${GATE_SDK_ROOT:-$(gate_sdk_root)}"; anchor="${anchor%/*}"
|
|
205
|
+
_gate_kit_roots_rel_cache=()
|
|
129
206
|
while IFS= read -r root; do
|
|
130
207
|
if [[ "$root" == /* ]]; then
|
|
131
|
-
realpath --relative-to="$anchor" "$root" 2>/dev/null || printf '%s
|
|
132
|
-
else
|
|
133
|
-
printf '%s\n' "$root"
|
|
208
|
+
root="$(realpath --relative-to="$anchor" "$root" 2>/dev/null || printf '%s' "$root")"
|
|
134
209
|
fi
|
|
210
|
+
_gate_kit_roots_rel_cache+=("$root")
|
|
135
211
|
done < <(gate_kit_roots)
|
|
212
|
+
_gate_kit_roots_rel_cache_set=1
|
|
136
213
|
}
|
|
137
214
|
|
|
138
|
-
# spec: gate-sdk/SPEC.md §
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
215
|
+
# spec: gate-sdk/SPEC.md §lib/gate.sh — gate_kit_roots as repo-root-relative dirs (the anchor the couples globs share); absolute roots resolve against the kits' parent, relative roots (a GATE_SDK_KIT_DIRS override) pass through
|
|
216
|
+
gate_kit_roots_rel() {
|
|
217
|
+
_gate_kit_roots_rel_ensure_cache
|
|
218
|
+
printf '%s\n' "${_gate_kit_roots_rel_cache[@]}"
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
# spec: gate-sdk/SPEC.md §check-graph — expand each kit:<glob> token in a comma-joined couples/trigger field to <kit-root>/<glob> for every gate_kit_roots_rel member; non-kit tokens pass through verbatim. Assigns into the caller's <outvar> by nameref rather than printing, so a per-manifest-line loop calls this directly (no `$(...)` fork) and the whole loop shares one _gate_kit_roots_rel_ensure_cache fill instead of paying it — and forking — once per line. gate_expand_couples below is the same expansion for a caller that still wants the stdout form.
|
|
222
|
+
gate_expand_couples_var() {
|
|
223
|
+
local -n _gate_expand_couples_out="$1"
|
|
224
|
+
local field="$2"
|
|
225
|
+
local -a parts=() out=()
|
|
226
|
+
_gate_kit_roots_rel_ensure_cache
|
|
143
227
|
IFS=',' read -ra parts <<<"$field"
|
|
144
228
|
local tok r glob
|
|
145
229
|
for tok in "${parts[@]}"; do
|
|
146
230
|
if [[ "$tok" == kit:* ]]; then
|
|
147
231
|
glob="${tok#kit:}"
|
|
148
|
-
for r in "${
|
|
232
|
+
for r in "${_gate_kit_roots_rel_cache[@]}"; do out+=("${r%/}/$glob"); done
|
|
149
233
|
else
|
|
150
234
|
out+=("$tok")
|
|
151
235
|
fi
|
|
152
236
|
done
|
|
153
237
|
local IFS=','
|
|
154
|
-
|
|
238
|
+
_gate_expand_couples_out="${out[*]}"
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
# spec: gate-sdk/SPEC.md §check-graph — the gate_expand_couples_var expansion, printed to stdout for a `$(...)` caller; gate_expand_couples_var is the in-process form a hot per-line loop should call instead.
|
|
242
|
+
gate_expand_couples() {
|
|
243
|
+
local __gate_expand_couples_result
|
|
244
|
+
gate_expand_couples_var __gate_expand_couples_result "$1"
|
|
245
|
+
printf '%s\n' "$__gate_expand_couples_result"
|
|
155
246
|
}
|
|
156
247
|
|
|
157
|
-
# spec: gate-sdk/SPEC.md §The `# graph:` manifest — read one field from a resolved gate's `# graph:` line; the shared field reader gen-pre-commit and run-gates --for selection draw the manifest through (the couples-token expansion
|
|
248
|
+
# spec: gate-sdk/SPEC.md §The `# graph:` manifest — read one field from a resolved gate's `# graph:` line; the shared field reader gen-pre-commit and run-gates --for selection draw the manifest through (the couples-token expansion is gate_expand_couples_var, the reader check-graph also shares). Emits the value, empty when the field is absent; never fails on a missing field.
|
|
158
249
|
gate_manifest_field() {
|
|
159
250
|
local src="$1" key="$2" man kv
|
|
160
251
|
man="$(grep -m1 '^# graph: ' "$src" 2>/dev/null || true)"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# shellcheck shell=bash
|
|
2
|
-
# spec: gate-sdk/SPEC.md §lib/inject.sh — the marker-bounded
|
|
2
|
+
# spec: gate-sdk/SPEC.md §lib/inject.sh — the marker-bounded placement and retrieval shared by every kit's agent-file injector; block-content generation and any preservation rule over the retrieved content stay with the caller
|
|
3
3
|
|
|
4
4
|
# spec: gate-sdk/SPEC.md §lib/inject.sh — inject_marker_block <file> <begin> <end>; inner block content on stdin. Replaces the span between an existing marker pair (inclusive) or appends a fresh block when absent; a begin marker without its end is malformed (exit 2); the file must exist (exit 2). Echoes the action taken (appended|replaced).
|
|
5
5
|
inject_marker_block() {
|
|
@@ -33,3 +33,23 @@ inject_marker_block() {
|
|
|
33
33
|
printf '%s\n' "$action"
|
|
34
34
|
)
|
|
35
35
|
}
|
|
36
|
+
|
|
37
|
+
# spec: gate-sdk/SPEC.md §lib/inject.sh — read_marker_block <file> <begin> <end>; prints the existing block's inner content (markers exclusive) on stdout, nothing (exit 0) when the marker pair is absent; a begin marker without its end is malformed (exit 2), as is a missing file. What a caller preserves out of that content is the caller's rule, never this module's.
|
|
38
|
+
read_marker_block() {
|
|
39
|
+
(
|
|
40
|
+
set -euo pipefail
|
|
41
|
+
file="$1"; begin="$2"; end="$3"
|
|
42
|
+
[[ -f "$file" ]] \
|
|
43
|
+
|| { echo "read_marker_block: target file not found: $file" >&2; exit 2; }
|
|
44
|
+
|
|
45
|
+
grep -qF -- "$begin" "$file" || exit 0
|
|
46
|
+
grep -qF -- "$end" "$file" \
|
|
47
|
+
|| { echo "read_marker_block: begin marker present but end marker missing in $file — refusing to guess the block bounds" >&2; exit 2; }
|
|
48
|
+
|
|
49
|
+
awk -v b="$begin" -v e="$end" '
|
|
50
|
+
$0 == e { inblock = 0; next }
|
|
51
|
+
inblock { print }
|
|
52
|
+
$0 == b { inblock = 1 }
|
|
53
|
+
' "$file"
|
|
54
|
+
)
|
|
55
|
+
}
|
|
@@ -15,16 +15,34 @@ check-gate-fail-closed
|
|
|
15
15
|
check-gate-fixture-coverage
|
|
16
16
|
check-gate-exemption-tasks
|
|
17
17
|
check-gate-assertions
|
|
18
|
+
check-gate-substrate-parity
|
|
18
19
|
check-graph
|
|
19
20
|
check-commit-msg
|
|
20
21
|
check-tree-terms
|
|
22
|
+
check-assertion-strength
|
|
23
|
+
check-commit-subject
|
|
24
|
+
check-core-files
|
|
25
|
+
check-exec-bit
|
|
26
|
+
check-hook-exec-bit
|
|
27
|
+
check-identity
|
|
28
|
+
check-kit-enum
|
|
29
|
+
check-readme-roster
|
|
30
|
+
check-reads-couples
|
|
31
|
+
check-smoke-entry-guard
|
|
32
|
+
check-template-copy-parity
|
|
33
|
+
check-template-registry-parity
|
|
34
|
+
check-test-hermetic
|
|
35
|
+
check-workflow-tiering
|
|
21
36
|
EOF
|
|
22
37
|
|
|
38
|
+
# smoke-unregistered: check-root-tiering — its subject is the consumer-curated root manifest GATE_SDK_ROOT_ALLOWLIST (default scripts/root-allowlist.list), which no kit install can author: the vendored root set is per-adoption and gate-sdk installs first, before that set exists
|
|
39
|
+
# spec: gate-sdk/SPEC.md §Consumer smoke — check-gate-binary-fresh is deliberately NOT registered here and deliberately carries no declaration: its subject is the crate the binary was built from, GATE_SDK_NATIVE_CRATE is kept outside every kit root by design, so the probe derives the exemption every run and a written reason would be the inversion the accounting refuses
|
|
40
|
+
|
|
23
41
|
# spec: gate-sdk/SPEC.md §Consumer smoke — ship the tracked default pattern list; the local companion is absent, exercising the fresh-clone path
|
|
24
42
|
cp "$SDK/templates/msg-patterns.list" scripts/msg-patterns.list
|
|
25
43
|
|
|
26
44
|
bash "$SDK/bin/gen-pre-commit.sh" --write >/dev/null
|
|
27
|
-
bash "$SDK/checks/check-graph.sh" --emit >
|
|
45
|
+
bash "$SDK/checks/check-graph.sh" --emit > scripts/CHECK-GRAPH.html
|
|
28
46
|
|
|
29
47
|
# spec: gate-sdk/SPEC.md §run-gates — quiet green, loud red: green is one summary line, red prints verbatim, GATE_SDK_VERBOSE restores the banner roll
|
|
30
48
|
q="$PWD/.tmp/quiet-smoke"
|
|
@@ -47,15 +47,16 @@ Vendor the kit beside [gate-sdk](../gate-sdk/), then:
|
|
|
47
47
|
|
|
48
48
|
Configuration follows the established kit pattern — override any knob in
|
|
49
49
|
`guard-config.sh` (log paths, settings paths, `GUARD_KIT_RO_SCRIPTS`,
|
|
50
|
-
`GUARD_KIT_RO_BINS`, `GUARD_KIT_SCRATCH_DIRS`);
|
|
51
|
-
layout
|
|
50
|
+
`GUARD_KIT_RO_BINS`, `GUARD_KIT_SCRATCH_DIRS`, `GUARD_KIT_BREADTH_PROBES`);
|
|
51
|
+
defaults are this repo's layout, and the probe set defaults to empty because
|
|
52
|
+
its contents are your project's vocabulary, not the kit's.
|
|
52
53
|
|
|
53
54
|
## Use
|
|
54
55
|
|
|
55
56
|
```bash
|
|
56
57
|
bash guard-kit/bin/scan-prompts.sh # rank what prompted, filtered by the allowlist
|
|
57
58
|
bash guard-kit/bin/scan-prompts.sh --count # <patterns>/<occurrences> token (drift KPI)
|
|
58
|
-
bash guard-kit/bin/compare-settings-allow.sh # local-overlay entries a committed glob already grants
|
|
59
|
+
bash guard-kit/bin/compare-settings-allow.sh # local-overlay entries a committed glob already grants, and those a probe proves too broad
|
|
59
60
|
```
|
|
60
61
|
|
|
61
62
|
## Test
|
|
@@ -32,7 +32,8 @@ conventions without depending on its registry.
|
|
|
32
32
|
local-overlay upper bound), grouped by command
|
|
33
33
|
pattern. Each recurring pattern is resolved by the **triage criterion**
|
|
34
34
|
(below); `bin/compare-settings-allow.sh` lists the local-overlay entries
|
|
35
|
-
a committed glob already grants (the
|
|
35
|
+
a committed glob already grants (the prune set) and those a declared probe
|
|
36
|
+
proves too broad (the narrowing set). Then the
|
|
36
37
|
log is cleared — its named reclaim path.
|
|
37
38
|
3. **Steady state** — friction low and justified: the committed
|
|
38
39
|
`settings.json` carries every durable pattern (reviewable, shared), the
|
|
@@ -102,10 +103,28 @@ Fail-open is the default posture. The one sanctioned fail-closed shape is a
|
|
|
102
103
|
deny-guard whose hook *matcher* already proves the tool identity (see
|
|
103
104
|
wakeup-guard): there, a logging or parse failure still denies.
|
|
104
105
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
106
|
+
**A third posture, fail-open-but-loud**, covers a deny-guard whose matcher
|
|
107
|
+
proves the tool but whose rule turns on a **payload field**. The gap is real
|
|
108
|
+
rather than a technicality: wakeup-guard's rule *is* the tool, so a parse
|
|
109
|
+
failure that denies costs nothing, while a rule needing a field cannot say
|
|
110
|
+
that — denying on a parse failure would wedge every call its matcher covers.
|
|
111
|
+
Passing silently is the opposite failure and the worse one, since it ships an
|
|
112
|
+
unenforceable claim that reports success. So the guard **allows the call and
|
|
113
|
+
emits an advisory naming the rule it could not enforce**: a degraded
|
|
114
|
+
enforcement is visible, never silently folded. One delivery constraint comes
|
|
115
|
+
with the posture and is easy to miss — `guard_advise` is itself jq-backed, so a
|
|
116
|
+
guard degrading *because* `jq` is absent cannot reach for it and must emit the
|
|
117
|
+
advisory envelope directly, or the loud half is lost in exactly the case it was
|
|
118
|
+
written for.
|
|
119
|
+
|
|
120
|
+
delegation-kit is this framework's second and third consumer, and they do not
|
|
121
|
+
cost the kit alike. `agent-budget-guard.sh` composes these primitives into a
|
|
122
|
+
`PreToolUse(Agent)` hook that blocks on a PAUSE budget verdict and advises
|
|
123
|
+
otherwise — cite-only; no guard-kit mechanism moves for it.
|
|
124
|
+
`agent-dispatch-guard.sh` shares that matcher and enforces delegation-kit's
|
|
125
|
+
dispatch-shape rules; guard-kit mechanism **does** move for that one, by
|
|
126
|
+
exactly one clause — the fail-open-but-loud posture above, which it is the
|
|
127
|
+
shipped instance of (delegation-kit/SPEC.md §The delegation model).
|
|
109
128
|
|
|
110
129
|
## Consumer rules
|
|
111
130
|
|
|
@@ -417,7 +436,39 @@ so one glob test covers both forms — the match core is `guard_allow_match`
|
|
|
417
436
|
in `lib/guard.sh`, shared with rule 14. Read-only — reports candidates, never
|
|
418
437
|
mutates (the operator prunes). It is the detector, not the policy: a
|
|
419
438
|
non-redundant local entry can still be one-off junk worth pruning by
|
|
420
|
-
judgment.
|
|
439
|
+
judgment.
|
|
440
|
+
|
|
441
|
+
The tool asks a **second question over the same two files**: which local entries
|
|
442
|
+
are *too broad*. Redundancy asks whether a committed glob already grants a local
|
|
443
|
+
entry; breadth asks whether a local glob would auto-allow a command the consumer
|
|
444
|
+
called bad. Both are one call to `guard_allow_match` — the breadth question
|
|
445
|
+
simply swaps its arguments, `guard_allow_match <probe> <local-glob>`, so there is
|
|
446
|
+
no second matching implementation and the `:*` normalization is shared. The two
|
|
447
|
+
findings are reported as distinct sets, and breadth is advisory in the same sense
|
|
448
|
+
as redundancy: the report names the local glob and the one probe that witnesses
|
|
449
|
+
its breadth, and the operator disposes — narrow the glob, or record that the
|
|
450
|
+
breadth is intended.
|
|
451
|
+
|
|
452
|
+
The probe set is consumer config (`GUARD_KIT_BREADTH_PROBES`, §Layout and
|
|
453
|
+
configuration), and it is **probes rather than a roster**: each entry is a single
|
|
454
|
+
witness whose auto-allowance would be bad, not a member of a set claimed
|
|
455
|
+
complete. A missing probe costs one witness and can never produce a false green,
|
|
456
|
+
because no completeness is claimed — and nothing here may come to claim it, since
|
|
457
|
+
a report worded as coverage would be the false-confidence proxy gate-sdk/SPEC.md
|
|
458
|
+
§When a gate earns its place refuses. With no probes declared the breadth section
|
|
459
|
+
is omitted entirely rather than printed clean, so a consumer that declared no
|
|
460
|
+
vocabulary cannot read silence as coverage.
|
|
461
|
+
|
|
462
|
+
This is the criterion's home rather than a gate, and the placement is ruled
|
|
463
|
+
rather than defaulted: the subject is a gitignored per-machine file CI cannot
|
|
464
|
+
see, and the verdict is operator-intent-dependent (a blanket grant is fine in a
|
|
465
|
+
throwaway sandbox), which is the high-false-positive shape §When a gate earns its
|
|
466
|
+
place holds back for an attested miss. What replaces the gate is a scheduled
|
|
467
|
+
reader — §The close-stage triage step — the same mechanism the redundancy
|
|
468
|
+
criterion has relied on since it shipped.
|
|
469
|
+
|
|
470
|
+
`--count` emits both bare counts on one line, redundancy first and breadth
|
|
471
|
+
second.
|
|
421
472
|
|
|
422
473
|
## wakeup-guard (template)
|
|
423
474
|
|
|
@@ -463,11 +514,20 @@ log — the advisory is transient, so nothing accrues for the close-stage triage
|
|
|
463
514
|
its close-stage skill — it fills the tooling-friction placeholder in
|
|
464
515
|
lifecycle-kit's close template. The step: run `scan-prompts`, resolve each
|
|
465
516
|
recurring pattern by the triage criterion; review and delete the wakeup
|
|
466
|
-
log if present; run `compare-settings-allow` and
|
|
467
|
-
|
|
517
|
+
log if present; run `compare-settings-allow` and take its **two**
|
|
518
|
+
dispositions — prune the listed redundant local entries, and for each entry the
|
|
519
|
+
breadth report names, either narrow the glob or record that its breadth is
|
|
520
|
+
intended — then by judgment prune the remaining one-off exact-string local
|
|
468
521
|
entries and promote recurring safe patterns to the committed settings as
|
|
469
|
-
globs; clear the friction log.
|
|
470
|
-
|
|
522
|
+
globs; clear the friction log. Two judgments the reports cannot make sit in
|
|
523
|
+
that last step. An entry naming a **script path** rather than a fixed command is
|
|
524
|
+
not content-pinned — it grants whatever the file says at run time — and its
|
|
525
|
+
sanctioned form is `bin/scratch-run.sh` (§scratch-run), whose echo is the
|
|
526
|
+
compensating control; and widening the committed set is the consumer's call,
|
|
527
|
+
since a session does not widen its own auto-allow set on its own say-so. Goal: the local set stays small, every
|
|
528
|
+
durable pattern lives in the committed, reviewable allowlist, and no local glob
|
|
529
|
+
auto-allows a command the consumer declared bad. One step, two reports, one
|
|
530
|
+
reader — no new invocation point and no new schedule.
|
|
471
531
|
|
|
472
532
|
The friction log is a capture-tier surface with no forcing function — nothing
|
|
473
533
|
refuses a close that skips it — so it declares itself advisory on the
|
|
@@ -488,6 +548,8 @@ guard-kit/
|
|
|
488
548
|
guard-tests/cases.tsv # expected-decision <TAB> command
|
|
489
549
|
guard-tests/escalation-cases.tsv # expected-decision <TAB> to <TAB> message
|
|
490
550
|
gate-tests/scratch-run.test.sh # bespoke unit test, run by gate-sdk's runner
|
|
551
|
+
gate-tests/scan-prompts.test.sh # bespoke unit test, run by gate-sdk's runner
|
|
552
|
+
gate-tests/compare-settings-allow.test.sh # bespoke unit test, run by gate-sdk's runner
|
|
491
553
|
templates/bash-guard.sh # consumer copy: generic rules on, marked
|
|
492
554
|
# consumer-rules section
|
|
493
555
|
templates/wakeup-guard.sh
|
|
@@ -520,6 +582,14 @@ repo's layout as defaults):
|
|
|
520
582
|
`${GATE_SDK_WORKFLOW_DIR:-.workflow}/wakeup-attempts.log`.
|
|
521
583
|
- `GUARD_KIT_SETTINGS` — default `.claude/settings.json`.
|
|
522
584
|
- `GUARD_KIT_SETTINGS_LOCAL` — default `.claude/settings.local.json`.
|
|
585
|
+
- `GUARD_KIT_BREADTH_PROBES` — array of permission-rule strings, each a witness
|
|
586
|
+
that a local glob is too broad (§compare-settings-allow); default empty, in
|
|
587
|
+
which case the breadth report is absent and the tool behaves exactly as it did
|
|
588
|
+
before the criterion shipped. Entries are full permission-rule strings rather
|
|
589
|
+
than bare commands, matching the settings vocabulary the tool already reads on
|
|
590
|
+
both sides, so a consumer can probe non-`Bash` rules with the same mechanism.
|
|
591
|
+
The kit ships **no** default probes: every string naming a command is the
|
|
592
|
+
consumer's vocabulary, never the kit's (CLAUDE.md §The provenance seam).
|
|
523
593
|
- `GUARD_KIT_RO_SCRIPTS` — array of globs eligible for the
|
|
524
594
|
absolute→relative rewrite (rule 4); default `("check-*.sh")`.
|
|
525
595
|
- `GUARD_KIT_RO_BINS` — read-only pipeline roster (rule 13); default the
|
|
@@ -556,6 +626,14 @@ There is no `smoke/violation.sh`: the kit registers no gates, so no
|
|
|
556
626
|
battery-reddening violation is craftable (gate-sdk/SPEC.md §Consumer smoke
|
|
557
627
|
makes that file conditional on exactly this).
|
|
558
628
|
|
|
629
|
+
`compare-settings-allow`'s breadth criterion takes the same bespoke lane for the
|
|
630
|
+
same reason, at `gate-tests/compare-settings-allow.test.sh`: a firing probe
|
|
631
|
+
(a blanket local glob reported with its witness), a non-firing one (a narrow
|
|
632
|
+
entry reporting clean), and the empty-knob silence that proves the section is
|
|
633
|
+
omitted rather than printed clean. It drives the tool through
|
|
634
|
+
`GUARD_KIT_CONFIG_FILE` pointed at a sandbox config, so the consumer's own probe
|
|
635
|
+
array cannot leak into the fixture.
|
|
636
|
+
|
|
559
637
|
A shipped `bin/` tool that is not a hook takes neither lane. `bin/scratch-run.sh`
|
|
560
638
|
(§scratch-run) is tested by a bespoke unit test at
|
|
561
639
|
`gate-tests/scratch-run.test.sh`, asserting echo-then-exec on an in-scratch
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
-
# spec: guard-kit/SPEC.md §compare-settings-allow — the
|
|
2
|
+
# spec: guard-kit/SPEC.md §compare-settings-allow — the prune-candidate set and the narrowing-candidate set
|
|
3
3
|
# usage: compare-settings-allow.sh [--count]
|
|
4
4
|
set -uo pipefail
|
|
5
5
|
|
|
@@ -18,7 +18,7 @@ case "${1:-}" in
|
|
|
18
18
|
esac
|
|
19
19
|
|
|
20
20
|
if [[ ! -f "$LOCAL" ]]; then
|
|
21
|
-
[[ "$COUNT" -eq 1 ]] && { echo "0"; exit 0; }
|
|
21
|
+
[[ "$COUNT" -eq 1 ]] && { echo "0 0"; exit 0; }
|
|
22
22
|
echo "=== settings allowlist redundancy (advisory — prune candidates) ==="
|
|
23
23
|
echo "no $LOCAL — nothing to compare"
|
|
24
24
|
exit 0
|
|
@@ -39,20 +39,53 @@ for entry in "${LOCAL_ALLOW[@]}"; do
|
|
|
39
39
|
done
|
|
40
40
|
done
|
|
41
41
|
|
|
42
|
+
# spec: guard-kit/SPEC.md §compare-settings-allow — the breadth question: guard_allow_match with the
|
|
43
|
+
# arguments swapped, asking whether a local glob would auto-allow a probe rather than whether a
|
|
44
|
+
# committed glob already grants a local entry
|
|
45
|
+
too_broad=()
|
|
46
|
+
for entry in "${LOCAL_ALLOW[@]}"; do
|
|
47
|
+
[[ -z "$entry" ]] && continue
|
|
48
|
+
for probe in "${GUARD_KIT_BREADTH_PROBES[@]}"; do
|
|
49
|
+
[[ -z "$probe" ]] && continue
|
|
50
|
+
if guard_allow_match "$probe" "$entry"; then
|
|
51
|
+
too_broad+=("$entry ⊇ $probe")
|
|
52
|
+
break
|
|
53
|
+
fi
|
|
54
|
+
done
|
|
55
|
+
done
|
|
56
|
+
|
|
42
57
|
if [[ "$COUNT" -eq 1 ]]; then
|
|
43
|
-
echo "${#redundant[@]}"
|
|
58
|
+
echo "${#redundant[@]} ${#too_broad[@]}"
|
|
44
59
|
exit 0
|
|
45
60
|
fi
|
|
46
61
|
|
|
47
62
|
echo "=== settings allowlist redundancy (advisory — prune candidates) ==="
|
|
48
63
|
if [[ ${#redundant[@]} -eq 0 ]]; then
|
|
49
64
|
echo "no redundant local entries (every $LOCAL allow entry adds coverage)"
|
|
65
|
+
else
|
|
66
|
+
echo "${#redundant[@]} local allow entr(ies) already granted by a committed glob — safe to prune from $LOCAL:"
|
|
67
|
+
echo
|
|
68
|
+
printf ' %s\n' "${redundant[@]}"
|
|
69
|
+
echo
|
|
70
|
+
echo "help: remove each listed entry from $LOCAL — the committed pattern on the"
|
|
71
|
+
echo " right already grants it (run at close, triage step 4)."
|
|
72
|
+
fi
|
|
73
|
+
|
|
74
|
+
# spec: guard-kit/SPEC.md §Layout and configuration — an empty probe set omits the section entirely
|
|
75
|
+
[[ ${#GUARD_KIT_BREADTH_PROBES[@]} -eq 0 ]] && exit 0
|
|
76
|
+
|
|
77
|
+
echo
|
|
78
|
+
echo "=== settings allowlist breadth (advisory — narrowing candidates) ==="
|
|
79
|
+
if [[ ${#too_broad[@]} -eq 0 ]]; then
|
|
80
|
+
echo "no over-broad local entries (no configured probe is auto-allowed by a $LOCAL glob)"
|
|
50
81
|
exit 0
|
|
51
82
|
fi
|
|
52
83
|
|
|
53
|
-
echo "${#
|
|
84
|
+
echo "${#too_broad[@]} local allow entr(ies) auto-allow a configured probe — candidates to narrow in $LOCAL:"
|
|
54
85
|
echo
|
|
55
|
-
printf ' %s\n' "${
|
|
86
|
+
printf ' %s\n' "${too_broad[@]}"
|
|
56
87
|
echo
|
|
57
|
-
echo "help:
|
|
58
|
-
echo "
|
|
88
|
+
echo "help: narrow each listed glob on the left, or record that the breadth is"
|
|
89
|
+
echo " intended — the probe on the right witnesses what it auto-allows."
|
|
90
|
+
echo " Probes are witnesses, not a roster: no completeness is claimed, so an"
|
|
91
|
+
echo " empty report is not a proof that every local glob is narrow enough."
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# spec: guard-kit/SPEC.md §compare-settings-allow — the breadth question is guard_allow_match with its arguments swapped, so a local glob that auto-allows a configured probe is reported with that probe as its witness; an empty probe set omits the section entirely rather than printing a clean line, which is what keeps a consumer that declared no vocabulary from reading silence as coverage
|
|
3
|
+
set -uo pipefail
|
|
4
|
+
source "$(dirname "${BASH_SOURCE[0]}")/../../gate-sdk/lib/test-hermetic.sh"
|
|
5
|
+
|
|
6
|
+
ROOT="$(git rev-parse --show-toplevel 2>/dev/null || pwd)"
|
|
7
|
+
cd "$ROOT" || exit 2
|
|
8
|
+
CMP="guard-kit/bin/compare-settings-allow.sh"
|
|
9
|
+
[[ -x "$CMP" ]] || { echo "compare-settings-allow.test: tool not found: $CMP"; exit 2; }
|
|
10
|
+
command -v jq >/dev/null 2>&1 || { echo "compare-settings-allow.test: jq not found on PATH"; exit 2; }
|
|
11
|
+
|
|
12
|
+
sb="$(mktemp -d)"
|
|
13
|
+
trap 'rm -rf "$sb"' EXIT
|
|
14
|
+
mkdir -p "$sb/.claude"
|
|
15
|
+
printf '%s\n' '{ "permissions": { "allow": ["Bash(git status)"] } }' \
|
|
16
|
+
> "$sb/.claude/settings.json"
|
|
17
|
+
|
|
18
|
+
fails=0
|
|
19
|
+
assert_has() { grep -qF -- "$2" <<<"$3" || { echo "FAIL [$1]: expected present: $2"; fails=$((fails + 1)); }; }
|
|
20
|
+
assert_absent() { grep -qF -- "$2" <<<"$3" && { echo "FAIL [$1]: expected absent: $2"; fails=$((fails + 1)); }; return 0; }
|
|
21
|
+
|
|
22
|
+
# The consumer config is a sandbox file so this repo's own probe array cannot leak in.
|
|
23
|
+
run() {
|
|
24
|
+
local overlay="$1" cfg="$2"; shift 2
|
|
25
|
+
GUARD_KIT_CONFIG_FILE="$cfg" \
|
|
26
|
+
GUARD_KIT_SETTINGS="$sb/.claude/settings.json" \
|
|
27
|
+
GUARD_KIT_SETTINGS_LOCAL="$overlay" bash "$CMP" "$@"
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
printf '%s\n' '{ "permissions": { "allow": ["Bash(git *)"] } }' > "$sb/broad.json"
|
|
31
|
+
printf '%s\n' '{ "permissions": { "allow": ["Bash(git fetch --dry-run)"] } }' > "$sb/narrow.json"
|
|
32
|
+
|
|
33
|
+
printf '%s\n' 'GUARD_KIT_BREADTH_PROBES=("Bash(git reset --hard)")' > "$sb/probes.sh"
|
|
34
|
+
printf '%s\n' '# no probes declared' > "$sb/empty.sh"
|
|
35
|
+
|
|
36
|
+
# Firing probe: the blanket glob auto-allows the destructive probe, reported with its witness.
|
|
37
|
+
firing="$(run "$sb/broad.json" "$sb/probes.sh")"
|
|
38
|
+
assert_has firing-section 'settings allowlist breadth' "$firing"
|
|
39
|
+
assert_has firing-glob 'Bash(git *)' "$firing"
|
|
40
|
+
assert_has firing-witness 'Bash(git reset --hard)' "$firing"
|
|
41
|
+
|
|
42
|
+
# Non-firing probe: a narrow local entry auto-allows nothing in the probe set.
|
|
43
|
+
nonfiring="$(run "$sb/narrow.json" "$sb/probes.sh")"
|
|
44
|
+
assert_has nonfiring-section 'settings allowlist breadth' "$nonfiring"
|
|
45
|
+
assert_has nonfiring-clean 'no over-broad local entries' "$nonfiring"
|
|
46
|
+
|
|
47
|
+
# Empty knob: the section is omitted entirely, not printed clean.
|
|
48
|
+
silent="$(run "$sb/broad.json" "$sb/empty.sh")"
|
|
49
|
+
assert_absent empty-knob-silent 'settings allowlist breadth' "$silent"
|
|
50
|
+
assert_has empty-knob-redundancy 'settings allowlist redundancy' "$silent"
|
|
51
|
+
|
|
52
|
+
# --count carries both counts: redundancy first, breadth second.
|
|
53
|
+
c_firing="$(run "$sb/broad.json" "$sb/probes.sh" --count)"
|
|
54
|
+
[[ "$c_firing" == "0 1" ]] || { echo "FAIL [count-firing]: expected '0 1', got '$c_firing'"; fails=$((fails + 1)); }
|
|
55
|
+
c_empty="$(run "$sb/broad.json" "$sb/empty.sh" --count)"
|
|
56
|
+
[[ "$c_empty" == "0 0" ]] || { echo "FAIL [count-empty]: expected '0 0', got '$c_empty'"; fails=$((fails + 1)); }
|
|
57
|
+
|
|
58
|
+
# No overlay at all: the pre-existing early path keeps the same two-field count shape.
|
|
59
|
+
c_absent="$(run "$sb/does-not-exist.json" "$sb/probes.sh" --count)"
|
|
60
|
+
[[ "$c_absent" == "0 0" ]] || { echo "FAIL [count-absent]: expected '0 0', got '$c_absent'"; fails=$((fails + 1)); }
|
|
61
|
+
|
|
62
|
+
[[ "$fails" -eq 0 ]] || { echo "compare-settings-allow.test: $fails assertion(s) failed"; exit 1; }
|
|
63
|
+
echo "compare-settings-allow.test: clean (a firing probe names its witnessing glob, a non-firing probe reports clean, an empty probe set omits the section)"
|
|
64
|
+
exit 0
|
|
@@ -23,6 +23,7 @@ unset _frik_cfg
|
|
|
23
23
|
: "${GUARD_KIT_WAKEUP_LOG:=${GATE_SDK_WORKFLOW_DIR:-.workflow}/wakeup-attempts.log}"
|
|
24
24
|
: "${GUARD_KIT_SETTINGS:=.claude/settings.json}"
|
|
25
25
|
: "${GUARD_KIT_SETTINGS_LOCAL:=.claude/settings.local.json}"
|
|
26
|
+
declare -p GUARD_KIT_BREADTH_PROBES >/dev/null 2>&1 || GUARD_KIT_BREADTH_PROBES=()
|
|
26
27
|
declare -p GUARD_KIT_RO_SCRIPTS >/dev/null 2>&1 || GUARD_KIT_RO_SCRIPTS=("check-*.sh")
|
|
27
28
|
declare -p GUARD_KIT_SCRATCH_DIRS >/dev/null 2>&1 || GUARD_KIT_SCRATCH_DIRS=(".tmp")
|
|
28
29
|
declare -p GUARD_KIT_RO_BINS >/dev/null 2>&1 || GUARD_KIT_RO_BINS=(
|
|
@@ -14,18 +14,46 @@ of lifecycle-kit's `tooling-friction triage` placeholder (close skill, step 2).
|
|
|
14
14
|
- **Habit change** (a noted convention) for a true one-off.
|
|
15
15
|
Caution: an allowlist entry can *mask* a steering opportunity — before
|
|
16
16
|
blessing a form, confirm it is the one to reinforce.
|
|
17
|
+
**Diagnose before you reach for the allowlist.** A pattern can rank high while
|
|
18
|
+
already being granted: an allowlist entry matches a *bare* command, so a call
|
|
19
|
+
that chains (`&&`, `;`), redirects, or expands breaks the match and prompts
|
|
20
|
+
anyway. Check a ranked pattern against the committed allowlist first — if it is
|
|
21
|
+
already there, the finding is (c) habit change, and adding coverage buys
|
|
22
|
+
nothing while reading as a fix.
|
|
17
23
|
3. **Review the wakeup log** if the wakeup-guard is wired: read
|
|
18
24
|
`.workflow/wakeup-attempts.log`, act on any surfaced intent, then delete it.
|
|
19
|
-
4. **Prune the local overlay.** Run
|
|
20
|
-
`bash guard-kit/bin/compare-settings-allow.sh`
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
25
|
+
4. **Prune and narrow the local overlay.** Run
|
|
26
|
+
`bash guard-kit/bin/compare-settings-allow.sh` — it reports two sets, and
|
|
27
|
+
each has its own disposition.
|
|
28
|
+
- **Redundant**: remove every listed `settings.local.json` entry (a committed
|
|
29
|
+
glob already grants it).
|
|
30
|
+
- **Too broad**: for every entry the breadth report names, either narrow the
|
|
31
|
+
glob or record that its breadth is intended. The probe printed beside it is
|
|
32
|
+
the witness — the command that glob auto-allows. An empty breadth report is
|
|
33
|
+
not a proof of narrowness: probes are witnesses, and no completeness is
|
|
34
|
+
claimed (the section is absent entirely when no probes are declared).
|
|
35
|
+
|
|
36
|
+
- **Not content-pinned**: an entry naming a *script path* rather than a fixed
|
|
37
|
+
command grants whatever that file says at run time, so its meaning changes
|
|
38
|
+
whenever the file does — and a path under the gitignored scratch dir is
|
|
39
|
+
rewritable by any session. Read the shape, not the literal: it reads as a
|
|
40
|
+
specific command until one notices the target is writable. Such a run has a
|
|
41
|
+
sanctioned form already — `bin/scratch-run.sh`, whose echo-at-execution is
|
|
42
|
+
the compensating control (§scratch-run) — so route the run through the
|
|
43
|
+
runner and remove the direct-path grant. Removing instances without applying
|
|
44
|
+
this criterion re-arms for the next one.
|
|
45
|
+
|
|
46
|
+
Then, by judgment, prune the remaining one-off exact-string local entries and
|
|
47
|
+
promote recurring safe patterns to the committed `settings.json` as globs.
|
|
48
|
+
Widening the committed set is the **consumer's** call, not the session's: an
|
|
49
|
+
agent may propose a standing grant and may prune, but it does not widen its
|
|
50
|
+
own auto-allow set on its own say-so.
|
|
24
51
|
5. **Clear the friction log** — its named reclaim path:
|
|
25
52
|
`: > .workflow/prompt-friction.log`. Run each clear as its own bare command:
|
|
26
53
|
the allowlist entry is an exact string, so compounding it (`&&`, `;`, a
|
|
27
54
|
trailing `echo`/`wc`) breaks the match and forces the very prompt this step
|
|
28
55
|
just triaged away.
|
|
29
56
|
|
|
30
|
-
Goal: the local set stays small,
|
|
31
|
-
committed, reviewable allowlist
|
|
57
|
+
Goal: the local set stays small, every durable pattern lives in the
|
|
58
|
+
committed, reviewable allowlist, and no local glob auto-allows a command you
|
|
59
|
+
declared bad.
|
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
# shellcheck shell=bash
|
|
2
2
|
# spec: guard-kit/SPEC.md §Layout and configuration — the knob table (every knob, its default, when to set it) and how to install this config; set only what you override
|
|
3
|
+
|
|
4
|
+
# spec: guard-kit/SPEC.md §compare-settings-allow — declare your own probes; the kit ships none
|
|
5
|
+
# GUARD_KIT_BREADTH_PROBES=("Bash(rm -rf /)")
|
|
@@ -41,6 +41,7 @@ Vendor the kit beside [gate-sdk](../gate-sdk/) (required), then:
|
|
|
41
41
|
check-shim-restatement
|
|
42
42
|
check-merge-attrs # multi-operator: needs the .gitattributes step (step 4)
|
|
43
43
|
check-close-surfaces
|
|
44
|
+
check-survey-record # inert until a survey is filed (bin/file-survey.sh)
|
|
44
45
|
```
|
|
45
46
|
<!-- gate-roster:end -->
|
|
46
47
|
|