checkwright 0.0.1 → 0.18.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 +260 -4
- package/bin/checkwright.sh +53 -0
- package/lib/common/lock.sh +28 -0
- package/lib/common/profile.sh +58 -0
- package/lib/common/recipe.sh +93 -0
- package/lib/doctor.sh +90 -0
- package/lib/init.sh +289 -0
- package/package.json +15 -3
- package/payload/canon-kit/README.md +79 -0
- package/payload/canon-kit/SPEC.md +1410 -0
- package/payload/canon-kit/checks/check-amendment-queue.sh +116 -0
- package/payload/canon-kit/checks/check-comment-tier.sh +211 -0
- package/payload/canon-kit/checks/check-deprecation-task.sh +90 -0
- package/payload/canon-kit/checks/check-docs-cmd.sh +153 -0
- package/payload/canon-kit/checks/check-docs-link-convention.sh +71 -0
- package/payload/canon-kit/checks/check-install-claim.sh +146 -0
- package/payload/canon-kit/checks/check-knob-citation.sh +117 -0
- package/payload/canon-kit/checks/check-knob-default-coupling.sh +239 -0
- package/payload/canon-kit/checks/check-manifest-count.sh +46 -0
- package/payload/canon-kit/checks/check-manifest-temporal.sh +83 -0
- package/payload/canon-kit/checks/check-md-refs.sh +115 -0
- package/payload/canon-kit/checks/check-prose-enum.sh +115 -0
- package/payload/canon-kit/checks/check-prose-tells.sh +207 -0
- package/payload/canon-kit/checks/check-spec-derivable-section.sh +69 -0
- package/payload/canon-kit/checks/check-spec-dod-singleton.sh +45 -0
- package/payload/canon-kit/checks/check-spec-embedded-source.sh +133 -0
- package/payload/canon-kit/checks/check-spec-fence-balance.sh +42 -0
- package/payload/canon-kit/checks/check-spec-pointer.sh +176 -0
- package/payload/canon-kit/checks/check-surface-duplication.sh +105 -0
- package/payload/canon-kit/checks/check-todo-task-liveness.sh +80 -0
- package/payload/canon-kit/checks/check-tracking-claim.sh +136 -0
- package/payload/canon-kit/gate-tests/check-amendment-queue/bad/SPEC-tidy.md +5 -0
- package/payload/canon-kit/gate-tests/check-amendment-queue/bad/TASK-QUEUE.md +15 -0
- package/payload/canon-kit/gate-tests/check-amendment-queue/bad/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-amendment-queue/good/SPEC-widget.md +6 -0
- package/payload/canon-kit/gate-tests/check-amendment-queue/good/TASK-QUEUE.md +15 -0
- package/payload/canon-kit/gate-tests/check-amendment-queue/good/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-comment-tier/bad/bad.sh +25 -0
- package/payload/canon-kit/gate-tests/check-comment-tier/bad/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-comment-tier/good/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-comment-tier/good/good.sh +32 -0
- package/payload/canon-kit/gate-tests/check-comment-tier.test.sh +146 -0
- package/payload/canon-kit/gate-tests/check-deprecation-task/bad/TASK-QUEUE.md +19 -0
- package/payload/canon-kit/gate-tests/check-deprecation-task/bad/bad.sh +6 -0
- package/payload/canon-kit/gate-tests/check-deprecation-task/bad/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-deprecation-task/bad/scripts/canon-config.sh +5 -0
- package/payload/canon-kit/gate-tests/check-deprecation-task/good/TASK-QUEUE.md +21 -0
- package/payload/canon-kit/gate-tests/check-deprecation-task/good/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-deprecation-task/good/good.sh +5 -0
- package/payload/canon-kit/gate-tests/check-deprecation-task/good/scripts/canon-config.sh +5 -0
- package/payload/canon-kit/gate-tests/check-deprecation-task.test.sh +98 -0
- package/payload/canon-kit/gate-tests/check-docs-cmd/bad/args +1 -0
- package/payload/canon-kit/gate-tests/check-docs-cmd/bad/doc.md +9 -0
- package/payload/canon-kit/gate-tests/check-docs-cmd/bad/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-docs-cmd/good/args +1 -0
- package/payload/canon-kit/gate-tests/check-docs-cmd/good/bin/tool.sh +3 -0
- package/payload/canon-kit/gate-tests/check-docs-cmd/good/doc.md +18 -0
- package/payload/canon-kit/gate-tests/check-docs-cmd/good/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-docs-link-convention/bad/args +4 -0
- package/payload/canon-kit/gate-tests/check-docs-link-convention/bad/docs/demokit/index.md +5 -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/bad/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-docs-link-convention/good/args +4 -0
- package/payload/canon-kit/gate-tests/check-docs-link-convention/good/docs/demokit/index.md +6 -0
- package/payload/canon-kit/gate-tests/check-docs-link-convention/good/docs/index.md +3 -0
- package/payload/canon-kit/gate-tests/check-docs-link-convention/good/docs/methodology.md +3 -0
- package/payload/canon-kit/gate-tests/check-docs-link-convention/good/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-install-claim/bad/README.md +12 -0
- package/payload/canon-kit/gate-tests/check-install-claim/bad/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-install-claim/bad/install.md +24 -0
- package/payload/canon-kit/gate-tests/check-install-claim/bad/posts/note.md +7 -0
- package/payload/canon-kit/gate-tests/check-install-claim/bad/scripts/canon-config.sh +10 -0
- package/payload/canon-kit/gate-tests/check-install-claim/bad/scripts/install-transports.sh +7 -0
- package/payload/canon-kit/gate-tests/check-install-claim/good/README.md +12 -0
- package/payload/canon-kit/gate-tests/check-install-claim/good/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-install-claim/good/install.md +24 -0
- package/payload/canon-kit/gate-tests/check-install-claim/good/posts/note.md +7 -0
- package/payload/canon-kit/gate-tests/check-install-claim/good/scripts/canon-config.sh +10 -0
- package/payload/canon-kit/gate-tests/check-install-claim/good/scripts/install-transports.sh +7 -0
- package/payload/canon-kit/gate-tests/check-knob-citation/bad/SPEC.md +10 -0
- package/payload/canon-kit/gate-tests/check-knob-citation/bad/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-knob-citation/good/SPEC.md +19 -0
- package/payload/canon-kit/gate-tests/check-knob-citation/good/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-knob-citation.test.sh +71 -0
- package/payload/canon-kit/gate-tests/check-knob-default-coupling/bad/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-knob-default-coupling/bad/scripts/gate-sdk-config.sh +4 -0
- package/payload/canon-kit/gate-tests/check-knob-default-coupling/bad/widget-kit/SPEC.md +4 -0
- package/payload/canon-kit/gate-tests/check-knob-default-coupling/bad/widget-kit/lib/widget-cli.sh +3 -0
- package/payload/canon-kit/gate-tests/check-knob-default-coupling/bad/widget-kit/lib/widget.sh +5 -0
- package/payload/canon-kit/gate-tests/check-knob-default-coupling/good/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-knob-default-coupling/good/scripts/gate-sdk-config.sh +5 -0
- package/payload/canon-kit/gate-tests/check-knob-default-coupling/good/widget-kit/SPEC.md +7 -0
- package/payload/canon-kit/gate-tests/check-knob-default-coupling/good/widget-kit/lib/widget-cli.sh +3 -0
- package/payload/canon-kit/gate-tests/check-knob-default-coupling/good/widget-kit/lib/widget.sh +5 -0
- package/payload/canon-kit/gate-tests/check-knob-default-coupling.test.sh +73 -0
- package/payload/canon-kit/gate-tests/check-manifest-count/bad/SPEC.md +15 -0
- package/payload/canon-kit/gate-tests/check-manifest-count/bad/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-manifest-count/good/SPEC.md +37 -0
- package/payload/canon-kit/gate-tests/check-manifest-count/good/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-manifest-count.test.sh +104 -0
- package/payload/canon-kit/gate-tests/check-manifest-temporal/bad/SPEC.md +6 -0
- package/payload/canon-kit/gate-tests/check-manifest-temporal/bad/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-manifest-temporal/good/SPEC.md +17 -0
- package/payload/canon-kit/gate-tests/check-manifest-temporal/good/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-md-refs/bad/args +1 -0
- package/payload/canon-kit/gate-tests/check-md-refs/bad/doc.md +3 -0
- package/payload/canon-kit/gate-tests/check-md-refs/bad/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-md-refs/good/args +1 -0
- package/payload/canon-kit/gate-tests/check-md-refs/good/doc.md +3 -0
- package/payload/canon-kit/gate-tests/check-md-refs/good/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-md-refs/good/target.md +1 -0
- package/payload/canon-kit/gate-tests/check-md-refs.test.sh +82 -0
- package/payload/canon-kit/gate-tests/check-prose-enum/bad/SPEC.md +4 -0
- package/payload/canon-kit/gate-tests/check-prose-enum/bad/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-prose-enum/bad/scripts/canon-config.sh +4 -0
- package/payload/canon-kit/gate-tests/check-prose-enum/good/SPEC.md +16 -0
- package/payload/canon-kit/gate-tests/check-prose-enum/good/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-prose-enum/good/scripts/canon-config.sh +4 -0
- package/payload/canon-kit/gate-tests/check-prose-enum.test.sh +127 -0
- package/payload/canon-kit/gate-tests/check-prose-tells/bad/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-prose-tells/bad/prose.md +15 -0
- package/payload/canon-kit/gate-tests/check-prose-tells/bad/scripts/canon-config.sh +8 -0
- package/payload/canon-kit/gate-tests/check-prose-tells/good/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-prose-tells/good/prose.md +21 -0
- package/payload/canon-kit/gate-tests/check-prose-tells/good/scripts/canon-config.sh +8 -0
- package/payload/canon-kit/gate-tests/check-spec-derivable-section/bad/SPEC.md +20 -0
- package/payload/canon-kit/gate-tests/check-spec-derivable-section/bad/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-spec-derivable-section/good/SPEC.md +13 -0
- package/payload/canon-kit/gate-tests/check-spec-derivable-section/good/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-spec-dod-singleton/bad/SPEC.md +15 -0
- package/payload/canon-kit/gate-tests/check-spec-dod-singleton/bad/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-spec-dod-singleton/good/SPEC.md +13 -0
- package/payload/canon-kit/gate-tests/check-spec-dod-singleton/good/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-spec-dod-singleton.test.sh +63 -0
- package/payload/canon-kit/gate-tests/check-spec-embedded-source/bad/SPEC.md +16 -0
- package/payload/canon-kit/gate-tests/check-spec-embedded-source/bad/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-spec-embedded-source/bad/widget.sh +9 -0
- package/payload/canon-kit/gate-tests/check-spec-embedded-source/good/SPEC.md +19 -0
- package/payload/canon-kit/gate-tests/check-spec-embedded-source/good/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-spec-embedded-source/good/widget.sh +9 -0
- package/payload/canon-kit/gate-tests/check-spec-fence-balance/bad/args +1 -0
- package/payload/canon-kit/gate-tests/check-spec-fence-balance/bad/doc.md +8 -0
- package/payload/canon-kit/gate-tests/check-spec-fence-balance/bad/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-spec-fence-balance/good/args +1 -0
- package/payload/canon-kit/gate-tests/check-spec-fence-balance/good/doc.md +9 -0
- package/payload/canon-kit/gate-tests/check-spec-fence-balance/good/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-spec-pointer/bad/README.md +4 -0
- package/payload/canon-kit/gate-tests/check-spec-pointer/bad/SPEC-target.md +6 -0
- package/payload/canon-kit/gate-tests/check-spec-pointer/bad/SPEC-widget.md +5 -0
- package/payload/canon-kit/gate-tests/check-spec-pointer/bad/cand-tmpl.md +5 -0
- package/payload/canon-kit/gate-tests/check-spec-pointer/bad/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-spec-pointer/bad/scripts/canon-config.sh +5 -0
- package/payload/canon-kit/gate-tests/check-spec-pointer/bad/widget.sh +5 -0
- package/payload/canon-kit/gate-tests/check-spec-pointer/good/README.md +4 -0
- package/payload/canon-kit/gate-tests/check-spec-pointer/good/SPEC-target.md +6 -0
- package/payload/canon-kit/gate-tests/check-spec-pointer/good/SPEC-widget.md +5 -0
- package/payload/canon-kit/gate-tests/check-spec-pointer/good/cand-tmpl.md +7 -0
- package/payload/canon-kit/gate-tests/check-spec-pointer/good/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-spec-pointer/good/scripts/canon-config.sh +5 -0
- package/payload/canon-kit/gate-tests/check-spec-pointer/good/widget.sh +6 -0
- package/payload/canon-kit/gate-tests/check-surface-duplication/bad/GLOSSARY.md +11 -0
- package/payload/canon-kit/gate-tests/check-surface-duplication/bad/VISION.md +6 -0
- package/payload/canon-kit/gate-tests/check-surface-duplication/bad/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-surface-duplication/good/GLOSSARY.md +11 -0
- package/payload/canon-kit/gate-tests/check-surface-duplication/good/VISION.md +6 -0
- package/payload/canon-kit/gate-tests/check-surface-duplication/good/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-todo-task-liveness/bad/TASK-QUEUE.md +19 -0
- package/payload/canon-kit/gate-tests/check-todo-task-liveness/bad/bad.sh +5 -0
- package/payload/canon-kit/gate-tests/check-todo-task-liveness/bad/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-todo-task-liveness/good/TASK-QUEUE.md +23 -0
- package/payload/canon-kit/gate-tests/check-todo-task-liveness/good/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-todo-task-liveness/good/good.sh +5 -0
- package/payload/canon-kit/gate-tests/check-tracking-claim/bad/README.md +4 -0
- package/payload/canon-kit/gate-tests/check-tracking-claim/bad/args +1 -0
- package/payload/canon-kit/gate-tests/check-tracking-claim/bad/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-tracking-claim/bad/kept.txt +1 -0
- package/payload/canon-kit/gate-tests/check-tracking-claim/good/README.md +7 -0
- package/payload/canon-kit/gate-tests/check-tracking-claim/good/args +1 -0
- package/payload/canon-kit/gate-tests/check-tracking-claim/good/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-tracking-claim/good/kept.txt +1 -0
- package/payload/canon-kit/gate-tests/check-tracking-claim/good/roster.list +1 -0
- package/payload/canon-kit/gate-tests/check-tracking-claim.test.sh +86 -0
- package/payload/canon-kit/lib/spec.sh +505 -0
- package/payload/canon-kit/smoke/install.sh +36 -0
- package/payload/canon-kit/smoke/violation.sh +22 -0
- package/payload/canon-kit/templates/SPEC-amendment.md +55 -0
- package/payload/canon-kit/templates/canon-config.sh +2 -0
- package/payload/context-kit/README.md +82 -0
- package/payload/context-kit/SPEC.md +790 -0
- package/payload/context-kit/bin/always-loaded.sh +86 -0
- package/payload/context-kit/bin/env-probe.sh +144 -0
- package/payload/context-kit/bin/footprint.sh +144 -0
- package/payload/context-kit/bin/md-index.sh +80 -0
- package/payload/context-kit/bin/md-section.sh +63 -0
- package/payload/context-kit/bin/pub-index.sh +90 -0
- package/payload/context-kit/bin/run-index-tests.sh +91 -0
- package/payload/context-kit/checks/check-brevity.sh +123 -0
- package/payload/context-kit/checks/check-footprint-fresh.sh +38 -0
- package/payload/context-kit/checks/check-memory-off.sh +112 -0
- package/payload/context-kit/checks/check-settings-pins.sh +110 -0
- package/payload/context-kit/gate-tests/check-brevity/bad/CLAUDE.md +14 -0
- package/payload/context-kit/gate-tests/check-brevity/bad/args +2 -0
- package/payload/context-kit/gate-tests/check-brevity/bad/expect.txt +1 -0
- package/payload/context-kit/gate-tests/check-brevity/good/CLAUDE.md +20 -0
- package/payload/context-kit/gate-tests/check-brevity/good/args +2 -0
- package/payload/context-kit/gate-tests/check-brevity/good/expect.txt +1 -0
- package/payload/context-kit/gate-tests/check-brevity.test.sh +89 -0
- package/payload/context-kit/gate-tests/check-footprint-fresh/bad/args +4 -0
- package/payload/context-kit/gate-tests/check-footprint-fresh/bad/emit.txt +12 -0
- package/payload/context-kit/gate-tests/check-footprint-fresh/bad/expect.txt +1 -0
- package/payload/context-kit/gate-tests/check-footprint-fresh/bad/projection.txt +11 -0
- package/payload/context-kit/gate-tests/check-footprint-fresh/good/args +4 -0
- package/payload/context-kit/gate-tests/check-footprint-fresh/good/emit.txt +12 -0
- package/payload/context-kit/gate-tests/check-footprint-fresh/good/expect.txt +1 -0
- package/payload/context-kit/gate-tests/check-footprint-fresh/good/projection.txt +12 -0
- package/payload/context-kit/gate-tests/check-memory-off/bad/args +1 -0
- package/payload/context-kit/gate-tests/check-memory-off/bad/expect.txt +1 -0
- package/payload/context-kit/gate-tests/check-memory-off/bad/memory/example-fact.md +6 -0
- package/payload/context-kit/gate-tests/check-memory-off/good/args +1 -0
- package/payload/context-kit/gate-tests/check-memory-off/good/expect.txt +1 -0
- package/payload/context-kit/gate-tests/check-memory-off/good/memory/.gitkeep +0 -0
- package/payload/context-kit/gate-tests/check-memory-off.test.sh +54 -0
- package/payload/context-kit/gate-tests/check-settings-pins/bad/args +1 -0
- package/payload/context-kit/gate-tests/check-settings-pins/bad/expect.txt +1 -0
- package/payload/context-kit/gate-tests/check-settings-pins/bad/settings-pins.conf +3 -0
- package/payload/context-kit/gate-tests/check-settings-pins/bad/settings.json +6 -0
- package/payload/context-kit/gate-tests/check-settings-pins/good/args +1 -0
- package/payload/context-kit/gate-tests/check-settings-pins/good/expect.txt +1 -0
- package/payload/context-kit/gate-tests/check-settings-pins/good/settings-pins.conf +3 -0
- package/payload/context-kit/gate-tests/check-settings-pins/good/settings.json +6 -0
- package/payload/context-kit/index-tests/corpus/baseline.txt +2 -0
- package/payload/context-kit/index-tests/corpus/hook-sample.txt +4 -0
- package/payload/context-kit/index-tests/corpus/sample.md +23 -0
- package/payload/context-kit/index-tests/corpus/sample.rs +24 -0
- package/payload/context-kit/index-tests/corpus/sample.ts +34 -0
- package/payload/context-kit/index-tests/corpus/surface.md +6 -0
- package/payload/context-kit/index-tests/expected/always-loaded.txt +1 -0
- package/payload/context-kit/index-tests/expected/md-index.txt +6 -0
- package/payload/context-kit/index-tests/expected/md-section.txt +6 -0
- package/payload/context-kit/index-tests/expected/pub-index-shadow.txt +2 -0
- package/payload/context-kit/index-tests/expected/pub-index-ts.txt +12 -0
- package/payload/context-kit/index-tests/expected/pub-index.txt +10 -0
- package/payload/context-kit/index-tests/expected/toolfloor.txt +14 -0
- package/payload/context-kit/index-tests/toolfloor-cases.sh +29 -0
- package/payload/context-kit/lib/pub-lang/rust.sh +26 -0
- package/payload/context-kit/lib/pub-lang/ts.sh +32 -0
- package/payload/context-kit/lib/toolfloor.sh +47 -0
- package/payload/context-kit/smoke/agents-md.sh +116 -0
- package/payload/context-kit/smoke/install.sh +60 -0
- package/payload/context-kit/smoke/violation.sh +21 -0
- package/payload/context-kit/templates/close-brevity.md +30 -0
- package/payload/context-kit/templates/context-config.sh +2 -0
- package/payload/context-kit/templates/session-context.sh +133 -0
- package/payload/context-kit/templates/settings-sessionstart.json +12 -0
- package/payload/delegation-kit/README.md +87 -0
- package/payload/delegation-kit/SPEC.md +792 -0
- package/payload/delegation-kit/bin/run-budget-guard-tests.sh +88 -0
- package/payload/delegation-kit/bin/run-trend-tests.sh +63 -0
- package/payload/delegation-kit/bin/run-usage-tests.sh +226 -0
- package/payload/delegation-kit/bin/usage-trend.sh +120 -0
- package/payload/delegation-kit/bin/usage-verdict.sh +144 -0
- package/payload/delegation-kit/checks/check-gate-tamper.sh +139 -0
- package/payload/delegation-kit/checks/check-rule-citation.sh +76 -0
- package/payload/delegation-kit/gate-tests/check-gate-tamper/bad/args +1 -0
- package/payload/delegation-kit/gate-tests/check-gate-tamper/bad/expect.txt +1 -0
- package/payload/delegation-kit/gate-tests/check-gate-tamper/bad/staged-files +5 -0
- package/payload/delegation-kit/gate-tests/check-gate-tamper/good/added-exemptions +2 -0
- package/payload/delegation-kit/gate-tests/check-gate-tamper/good/args +1 -0
- package/payload/delegation-kit/gate-tests/check-gate-tamper/good/expect.txt +1 -0
- package/payload/delegation-kit/gate-tests/check-gate-tamper/good/staged-files +5 -0
- package/payload/delegation-kit/gate-tests/check-rule-citation/bad/args +1 -0
- package/payload/delegation-kit/gate-tests/check-rule-citation/bad/expect.txt +1 -0
- package/payload/delegation-kit/gate-tests/check-rule-citation/bad/spec.md +9 -0
- package/payload/delegation-kit/gate-tests/check-rule-citation/bad/tmpl.md +4 -0
- package/payload/delegation-kit/gate-tests/check-rule-citation/good/args +1 -0
- package/payload/delegation-kit/gate-tests/check-rule-citation/good/expect.txt +1 -0
- package/payload/delegation-kit/gate-tests/check-rule-citation/good/spec.md +20 -0
- package/payload/delegation-kit/gate-tests/check-rule-citation/good/tmpl.md +5 -0
- package/payload/delegation-kit/lib/delegation.sh +81 -0
- package/payload/delegation-kit/smoke/install.sh +61 -0
- package/payload/delegation-kit/smoke/violation.sh +16 -0
- package/payload/delegation-kit/templates/agent-budget-guard.sh +18 -0
- package/payload/delegation-kit/templates/agent-execution.md +136 -0
- package/payload/delegation-kit/templates/delegation-config.sh +2 -0
- package/payload/delegation-kit/templates/dispatch-checklists.md +60 -0
- package/payload/delegation-kit/templates/statusline-usage.sh +79 -0
- package/payload/delegation-kit/templates/usage-poller.sh +67 -0
- package/payload/delegation-kit/usage-tests/budget-guard-cases.tsv +20 -0
- package/payload/delegation-kit/usage-tests/cases.tsv +44 -0
- package/payload/delegation-kit/usage-tests/trend-history.log +20 -0
- package/payload/doctrine-kit/DOCTRINE.md +386 -0
- package/payload/doctrine-kit/README.md +70 -0
- package/payload/doctrine-kit/SPEC.md +233 -0
- package/payload/doctrine-kit/bin/install-doctrine.sh +44 -0
- package/payload/doctrine-kit/bin/stage-rules.sh +51 -0
- package/payload/doctrine-kit/checks/check-doctrine-registration.sh +216 -0
- package/payload/doctrine-kit/gate-tests/check-doctrine-registration/bad/AGENT.md +14 -0
- package/payload/doctrine-kit/gate-tests/check-doctrine-registration/bad/DOCTRINE.md +12 -0
- package/payload/doctrine-kit/gate-tests/check-doctrine-registration/bad/args +1 -0
- package/payload/doctrine-kit/gate-tests/check-doctrine-registration/bad/expect.txt +1 -0
- package/payload/doctrine-kit/gate-tests/check-doctrine-registration/good/AGENT.md +15 -0
- package/payload/doctrine-kit/gate-tests/check-doctrine-registration/good/DOCTRINE.md +12 -0
- package/payload/doctrine-kit/gate-tests/check-doctrine-registration/good/args +1 -0
- package/payload/doctrine-kit/gate-tests/check-doctrine-registration/good/expect.txt +1 -0
- package/payload/doctrine-kit/gate-tests/check-doctrine-registration.test.sh +208 -0
- package/payload/doctrine-kit/lib/doctrine.sh +29 -0
- package/payload/doctrine-kit/smoke/install.sh +24 -0
- package/payload/doctrine-kit/smoke/violation.sh +13 -0
- package/payload/drift-kit/README.md +115 -0
- package/payload/drift-kit/SPEC.md +881 -0
- package/payload/drift-kit/bin/drift-report.sh +155 -0
- package/payload/drift-kit/bin/kfric.sh +42 -0
- package/payload/drift-kit/bin/overhead-meter.sh +106 -0
- package/payload/drift-kit/bin/stage-economics.sh +311 -0
- package/payload/drift-kit/bin/trajectory.sh +242 -0
- package/payload/drift-kit/kpis/kpi-always-loaded.sh +39 -0
- package/payload/drift-kit/kpis/kpi-amendment-age.sh +33 -0
- package/payload/drift-kit/kpis/kpi-deferred-age.sh +46 -0
- package/payload/drift-kit/kpis/kpi-gate-backlog.sh +52 -0
- package/payload/drift-kit/kpis/kpi-gate-runtime.sh +31 -0
- package/payload/drift-kit/kpis/kpi-knowledge-friction.sh +21 -0
- package/payload/drift-kit/kpis/kpi-overhead.sh +44 -0
- package/payload/drift-kit/kpis/kpi-price-table-age.sh +68 -0
- package/payload/drift-kit/kpis/kpi-prompt-friction.sh +38 -0
- package/payload/drift-kit/kpis/kpi-queue-net-delta.sh +74 -0
- package/payload/drift-kit/kpis/kpi-settings-local.sh +21 -0
- package/payload/drift-kit/kpis/kpi-task-split.sh +43 -0
- package/payload/drift-kit/smoke/install.sh +348 -0
- package/payload/drift-kit/smoke/overhead-fixture.jsonl +4 -0
- package/payload/drift-kit/templates/close-knowledge.md +24 -0
- package/payload/drift-kit/templates/drift-config.sh +2 -0
- package/payload/drift-kit/templates/economics.md +45 -0
- package/payload/drift-kit/templates/kpi-deprecated-surface.sh +32 -0
- package/payload/drift-kit/templates/kpis.list +22 -0
- package/payload/drift-kit/templates/price-table.tsv +21 -0
- package/payload/evidence-kit/README.md +59 -0
- package/payload/evidence-kit/SPEC.md +261 -0
- package/payload/evidence-kit/bin/diff-baseline.sh +34 -0
- package/payload/evidence-kit/bin/run-validate.sh +82 -0
- package/payload/evidence-kit/checks/check-evidence-baseline.sh +103 -0
- package/payload/evidence-kit/checks/check-evidence-manifest.sh +104 -0
- package/payload/evidence-kit/gate-tests/check-evidence-baseline/bad/TASK-QUEUE.md +3 -0
- package/payload/evidence-kit/gate-tests/check-evidence-baseline/bad/args +2 -0
- package/payload/evidence-kit/gate-tests/check-evidence-baseline/bad/expect.txt +1 -0
- package/payload/evidence-kit/gate-tests/check-evidence-baseline/bad/validate-baseline.txt +3 -0
- package/payload/evidence-kit/gate-tests/check-evidence-baseline/good/TASK-QUEUE.md +3 -0
- package/payload/evidence-kit/gate-tests/check-evidence-baseline/good/args +2 -0
- package/payload/evidence-kit/gate-tests/check-evidence-baseline/good/expect.txt +1 -0
- package/payload/evidence-kit/gate-tests/check-evidence-baseline/good/validate-baseline.txt +3 -0
- package/payload/evidence-kit/gate-tests/check-evidence-baseline.test.sh +84 -0
- package/payload/evidence-kit/gate-tests/check-evidence-manifest/bad/TASK-QUEUE.md +1 -0
- package/payload/evidence-kit/gate-tests/check-evidence-manifest/bad/WORKFLOW-STATE.txt +3 -0
- package/payload/evidence-kit/gate-tests/check-evidence-manifest/bad/args +3 -0
- package/payload/evidence-kit/gate-tests/check-evidence-manifest/bad/expect.txt +1 -0
- package/payload/evidence-kit/gate-tests/check-evidence-manifest/bad/validate-evidence.txt +2 -0
- package/payload/evidence-kit/gate-tests/check-evidence-manifest/good/TASK-QUEUE.md +1 -0
- package/payload/evidence-kit/gate-tests/check-evidence-manifest/good/WORKFLOW-STATE.txt +3 -0
- package/payload/evidence-kit/gate-tests/check-evidence-manifest/good/args +3 -0
- package/payload/evidence-kit/gate-tests/check-evidence-manifest/good/expect.txt +1 -0
- package/payload/evidence-kit/gate-tests/check-evidence-manifest/good/validate-evidence.txt +2 -0
- package/payload/evidence-kit/gate-tests/check-evidence-manifest.test.sh +107 -0
- package/payload/evidence-kit/gate-tests/evidence-lib.test.sh +82 -0
- package/payload/evidence-kit/lib/evidence.sh +173 -0
- package/payload/evidence-kit/smoke/install.sh +45 -0
- package/payload/evidence-kit/smoke/violation.sh +8 -0
- package/payload/evidence-kit/templates/evidence-config.sh +2 -0
- package/payload/gate-sdk/README.md +124 -0
- package/payload/gate-sdk/SPEC.md +1876 -0
- package/payload/gate-sdk/bin/enforcement-map.sh +272 -0
- package/payload/gate-sdk/bin/gen-pre-commit.sh +267 -0
- package/payload/gate-sdk/bin/install-hooks.sh +48 -0
- package/payload/gate-sdk/bin/run-consumer-smoke.sh +112 -0
- package/payload/gate-sdk/bin/run-gate-tests.sh +128 -0
- package/payload/gate-sdk/bin/run-gates.sh +147 -0
- package/payload/gate-sdk/bin/upgrade-smoke.sh +163 -0
- package/payload/gate-sdk/checks/check-action-pinning.sh +55 -0
- package/payload/gate-sdk/checks/check-action-run-shell.sh +219 -0
- package/payload/gate-sdk/checks/check-assertion-strength.sh +134 -0
- package/payload/gate-sdk/checks/check-commit-msg.sh +50 -0
- package/payload/gate-sdk/checks/check-commit-subject.sh +43 -0
- package/payload/gate-sdk/checks/check-core-files.sh +52 -0
- package/payload/gate-sdk/checks/check-enforcement-fresh.sh +37 -0
- package/payload/gate-sdk/checks/check-exec-bit.sh +76 -0
- package/payload/gate-sdk/checks/check-gate-assertions.sh +123 -0
- package/payload/gate-sdk/checks/check-gate-exemption-tasks.sh +106 -0
- package/payload/gate-sdk/checks/check-gate-fail-closed.sh +84 -0
- package/payload/gate-sdk/checks/check-gate-fixture-coverage.sh +92 -0
- package/payload/gate-sdk/checks/check-gate-output.sh +65 -0
- package/payload/gate-sdk/checks/check-graph.sh +632 -0
- package/payload/gate-sdk/checks/check-hook-exec-bit.sh +45 -0
- package/payload/gate-sdk/checks/check-identity.sh +134 -0
- package/payload/gate-sdk/checks/check-kit-enum.sh +94 -0
- package/payload/gate-sdk/checks/check-kit-registration.sh +68 -0
- package/payload/gate-sdk/checks/check-readme-roster.sh +102 -0
- package/payload/gate-sdk/checks/check-reads-couples.sh +148 -0
- package/payload/gate-sdk/checks/check-root-tiering.sh +66 -0
- package/payload/gate-sdk/checks/check-shellcheck.sh +55 -0
- package/payload/gate-sdk/checks/check-smoke-entry-guard.sh +53 -0
- package/payload/gate-sdk/checks/check-template-copy-parity.sh +126 -0
- package/payload/gate-sdk/checks/check-test-hermetic.sh +119 -0
- package/payload/gate-sdk/checks/check-tree-terms.sh +61 -0
- package/payload/gate-sdk/checks/check-workflow-tiering.sh +84 -0
- package/payload/gate-sdk/gate-tests/check-action-pinning/bad/args +1 -0
- package/payload/gate-sdk/gate-tests/check-action-pinning/bad/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-action-pinning/bad/tree/mutable.yml +11 -0
- package/payload/gate-sdk/gate-tests/check-action-pinning/bad/tree/nested/pinned.yml +5 -0
- package/payload/gate-sdk/gate-tests/check-action-pinning/good/args +1 -0
- package/payload/gate-sdk/gate-tests/check-action-pinning/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-action-pinning/good/tree/nested/deep.yml +5 -0
- package/payload/gate-sdk/gate-tests/check-action-pinning/good/tree/no-refs.yaml +8 -0
- package/payload/gate-sdk/gate-tests/check-action-pinning/good/tree/pinned.yml +10 -0
- package/payload/gate-sdk/gate-tests/check-action-run-shell/bad/args +3 -0
- package/payload/gate-sdk/gate-tests/check-action-run-shell/bad/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-action-run-shell/bad/tree/workflows/ci.yml +15 -0
- package/payload/gate-sdk/gate-tests/check-action-run-shell/good/args +3 -0
- package/payload/gate-sdk/gate-tests/check-action-run-shell/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-action-run-shell/good/tree/action.yml +14 -0
- package/payload/gate-sdk/gate-tests/check-action-run-shell/good/tree/not-actions.yml +16 -0
- package/payload/gate-sdk/gate-tests/check-action-run-shell/good/tree/workflows/ci.yml +106 -0
- package/payload/gate-sdk/gate-tests/check-action-run-shell.test.sh +88 -0
- package/payload/gate-sdk/gate-tests/check-assertion-strength/bad/args +3 -0
- package/payload/gate-sdk/gate-tests/check-assertion-strength/bad/bin/verdict.sh +5 -0
- package/payload/gate-sdk/gate-tests/check-assertion-strength/bad/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-assertion-strength/bad/smoke/install.sh +11 -0
- package/payload/gate-sdk/gate-tests/check-assertion-strength/good/args +3 -0
- package/payload/gate-sdk/gate-tests/check-assertion-strength/good/bin/verdict.sh +5 -0
- package/payload/gate-sdk/gate-tests/check-assertion-strength/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-assertion-strength/good/smoke/install.sh +16 -0
- package/payload/gate-sdk/gate-tests/check-commit-msg/bad/args +2 -0
- package/payload/gate-sdk/gate-tests/check-commit-msg/bad/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-commit-msg/bad/msg.txt +5 -0
- package/payload/gate-sdk/gate-tests/check-commit-msg/bad/patterns.list +5 -0
- package/payload/gate-sdk/gate-tests/check-commit-msg/good/args +2 -0
- package/payload/gate-sdk/gate-tests/check-commit-msg/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-commit-msg/good/msg.txt +5 -0
- package/payload/gate-sdk/gate-tests/check-commit-msg/good/patterns.list +5 -0
- package/payload/gate-sdk/gate-tests/check-commit-subject/bad/args +2 -0
- package/payload/gate-sdk/gate-tests/check-commit-subject/bad/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-commit-subject/bad/msg.txt +4 -0
- package/payload/gate-sdk/gate-tests/check-commit-subject/good/args +2 -0
- package/payload/gate-sdk/gate-tests/check-commit-subject/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-commit-subject/good/msg.txt +5 -0
- package/payload/gate-sdk/gate-tests/check-commit-subject.test.sh +73 -0
- package/payload/gate-sdk/gate-tests/check-core-files/bad/args +1 -0
- package/payload/gate-sdk/gate-tests/check-core-files/bad/core-files.list +3 -0
- package/payload/gate-sdk/gate-tests/check-core-files/bad/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-core-files/bad/present.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-core-files/good/args +1 -0
- package/payload/gate-sdk/gate-tests/check-core-files/good/core-files.list +5 -0
- package/payload/gate-sdk/gate-tests/check-core-files/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-core-files/good/nested/also-present.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-core-files/good/present.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-enforcement-fresh/bad/args +4 -0
- package/payload/gate-sdk/gate-tests/check-enforcement-fresh/bad/emit.txt +14 -0
- package/payload/gate-sdk/gate-tests/check-enforcement-fresh/bad/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-enforcement-fresh/bad/projection.txt +7 -0
- package/payload/gate-sdk/gate-tests/check-enforcement-fresh/good/args +4 -0
- package/payload/gate-sdk/gate-tests/check-enforcement-fresh/good/emit.txt +14 -0
- package/payload/gate-sdk/gate-tests/check-enforcement-fresh/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-enforcement-fresh/good/projection.txt +14 -0
- package/payload/gate-sdk/gate-tests/check-exec-bit/bad/args +1 -0
- package/payload/gate-sdk/gate-tests/check-exec-bit/bad/dump.txt +7 -0
- package/payload/gate-sdk/gate-tests/check-exec-bit/bad/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-exec-bit/good/args +1 -0
- package/payload/gate-sdk/gate-tests/check-exec-bit/good/dump.txt +7 -0
- package/payload/gate-sdk/gate-tests/check-exec-bit/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-exec-bit.test.sh +46 -0
- package/payload/gate-sdk/gate-tests/check-gate-assertions/bad/args +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-assertions/bad/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-assertions/bad/scripts/SPEC.md +13 -0
- package/payload/gate-sdk/gate-tests/check-gate-assertions/bad/scripts/check-baz.sh +13 -0
- package/payload/gate-sdk/gate-tests/check-gate-assertions/bad/scripts/check-foo.sh +10 -0
- package/payload/gate-sdk/gate-tests/check-gate-assertions/good/args +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-assertions/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-assertions/good/scripts/SPEC.md +20 -0
- package/payload/gate-sdk/gate-tests/check-gate-assertions/good/scripts/check-baz.sh +12 -0
- package/payload/gate-sdk/gate-tests/check-gate-assertions/good/scripts/check-foo.sh +9 -0
- package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/TASK-QUEUE.md +9 -0
- package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/args +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/gates/check-sample.sh +11 -0
- package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/good/TASK-QUEUE.md +9 -0
- package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/good/args +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/good/gates/check-sample.sh +11 -0
- package/payload/gate-sdk/gate-tests/check-gate-fail-closed/bad/args +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-fail-closed/bad/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-fail-closed/bad/gates/check-sample.sh +8 -0
- package/payload/gate-sdk/gate-tests/check-gate-fail-closed/good/args +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-fail-closed/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-fail-closed/good/gates/check-sample.sh +8 -0
- package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/bad/args +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/bad/check-gamma.sh +4 -0
- package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/bad/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/bad/gate-tests/check-alpha/bad/.keep +0 -0
- package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/bad/gate-tests/check-alpha/good/.keep +0 -0
- package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/bad/gates.list +4 -0
- package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/good/args +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/good/check-beta.sh +5 -0
- package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/good/gate-tests/check-alpha/bad/.keep +0 -0
- package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/good/gate-tests/check-alpha/good/.keep +0 -0
- package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/good/gates.list +5 -0
- package/payload/gate-sdk/gate-tests/check-gate-output/bad/args +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-output/bad/check-sample.sh +4 -0
- package/payload/gate-sdk/gate-tests/check-gate-output/bad/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-output/bad/gates.list +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-output/good/args +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-output/good/check-sample.sh +9 -0
- package/payload/gate-sdk/gate-tests/check-gate-output/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-output/good/gates.list +3 -0
- package/payload/gate-sdk/gate-tests/check-graph/bad/SPEC-example-gate.md +12 -0
- package/payload/gate-sdk/gate-tests/check-graph/bad/args +1 -0
- package/payload/gate-sdk/gate-tests/check-graph/bad/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-graph/good/SPEC-example-gate.md +20 -0
- package/payload/gate-sdk/gate-tests/check-graph/good/args +3 -0
- package/payload/gate-sdk/gate-tests/check-graph/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-graph-cap.test.sh +51 -0
- package/payload/gate-sdk/gate-tests/check-graph-refs.test.sh +55 -0
- package/payload/gate-sdk/gate-tests/check-graph-theme.test.sh +63 -0
- package/payload/gate-sdk/gate-tests/check-hook-exec-bit/bad/args +1 -0
- package/payload/gate-sdk/gate-tests/check-hook-exec-bit/bad/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-hook-exec-bit/bad/hooks/pre-commit +2 -0
- package/payload/gate-sdk/gate-tests/check-hook-exec-bit/good/args +1 -0
- package/payload/gate-sdk/gate-tests/check-hook-exec-bit/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-hook-exec-bit/good/hooks/pre-commit +2 -0
- package/payload/gate-sdk/gate-tests/check-identity/bad/args +1 -0
- package/payload/gate-sdk/gate-tests/check-identity/bad/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-identity/bad/git-config-email +1 -0
- package/payload/gate-sdk/gate-tests/check-identity/bad/git-remotes +2 -0
- package/payload/gate-sdk/gate-tests/check-identity/bad/identity.conf +4 -0
- package/payload/gate-sdk/gate-tests/check-identity/good/args +1 -0
- package/payload/gate-sdk/gate-tests/check-identity/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-identity/good/git-config-email +1 -0
- package/payload/gate-sdk/gate-tests/check-identity/good/git-remotes +3 -0
- package/payload/gate-sdk/gate-tests/check-identity/good/identity.conf +5 -0
- package/payload/gate-sdk/gate-tests/check-kit-enum/bad/args +1 -0
- package/payload/gate-sdk/gate-tests/check-kit-enum/bad/check-sample.sh +5 -0
- package/payload/gate-sdk/gate-tests/check-kit-enum/bad/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-kit-enum/bad/gates.list +4 -0
- package/payload/gate-sdk/gate-tests/check-kit-enum/good/args +1 -0
- package/payload/gate-sdk/gate-tests/check-kit-enum/good/check-sample.sh +5 -0
- package/payload/gate-sdk/gate-tests/check-kit-enum/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-kit-enum/good/gates.list +3 -0
- package/payload/gate-sdk/gate-tests/check-kit-registration/bad/args +4 -0
- package/payload/gate-sdk/gate-tests/check-kit-registration/bad/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-kit-registration/bad/registry-doc.md +20 -0
- package/payload/gate-sdk/gate-tests/check-kit-registration/good/args +5 -0
- package/payload/gate-sdk/gate-tests/check-kit-registration/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-kit-registration.test.sh +75 -0
- package/payload/gate-sdk/gate-tests/check-readme-roster/bad/alpha-kit/README.md +14 -0
- package/payload/gate-sdk/gate-tests/check-readme-roster/bad/alpha-kit/checks/check-alpha-one.sh +3 -0
- package/payload/gate-sdk/gate-tests/check-readme-roster/bad/alpha-kit/checks/check-alpha-two.sh +3 -0
- package/payload/gate-sdk/gate-tests/check-readme-roster/bad/args +4 -0
- package/payload/gate-sdk/gate-tests/check-readme-roster/bad/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-readme-roster/bad/gamma-kit/README.md +5 -0
- package/payload/gate-sdk/gate-tests/check-readme-roster/bad/gamma-kit/checks/check-gamma-one.sh +3 -0
- package/payload/gate-sdk/gate-tests/check-readme-roster/bad/scripts/gate-sdk-config.sh +5 -0
- package/payload/gate-sdk/gate-tests/check-readme-roster/good/alpha-kit/README.md +16 -0
- package/payload/gate-sdk/gate-tests/check-readme-roster/good/alpha-kit/checks/check-alpha-one.sh +3 -0
- package/payload/gate-sdk/gate-tests/check-readme-roster/good/alpha-kit/checks/check-alpha-two.sh +3 -0
- package/payload/gate-sdk/gate-tests/check-readme-roster/good/args +6 -0
- package/payload/gate-sdk/gate-tests/check-readme-roster/good/beta-kit/smoke/install.sh +3 -0
- package/payload/gate-sdk/gate-tests/check-readme-roster/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-readme-roster/good/scripts/gate-sdk-config.sh +5 -0
- package/payload/gate-sdk/gate-tests/check-reads-couples/bad/args +2 -0
- package/payload/gate-sdk/gate-tests/check-reads-couples/bad/corpus/sub/deep.md +1 -0
- package/payload/gate-sdk/gate-tests/check-reads-couples/bad/corpus/top.md +1 -0
- package/payload/gate-sdk/gate-tests/check-reads-couples/bad/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-reads-couples/bad/sandbox-gate.sh +6 -0
- package/payload/gate-sdk/gate-tests/check-reads-couples/good/args +3 -0
- package/payload/gate-sdk/gate-tests/check-reads-couples/good/corpus/sub/deep.md +1 -0
- package/payload/gate-sdk/gate-tests/check-reads-couples/good/corpus/top.md +1 -0
- package/payload/gate-sdk/gate-tests/check-reads-couples/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-reads-couples/good/sandbox-gate.sh +8 -0
- package/payload/gate-sdk/gate-tests/check-root-tiering/bad/allow.list +1 -0
- package/payload/gate-sdk/gate-tests/check-root-tiering/bad/args +1 -0
- package/payload/gate-sdk/gate-tests/check-root-tiering/bad/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-root-tiering/bad/root/README.md +1 -0
- package/payload/gate-sdk/gate-tests/check-root-tiering/bad/root/stray.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-root-tiering/good/allow.list +3 -0
- package/payload/gate-sdk/gate-tests/check-root-tiering/good/args +1 -0
- package/payload/gate-sdk/gate-tests/check-root-tiering/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-root-tiering/good/root/LICENSE +1 -0
- package/payload/gate-sdk/gate-tests/check-root-tiering/good/root/README.md +1 -0
- package/payload/gate-sdk/gate-tests/check-root-tiering/good/root/somedir/keep.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-shellcheck/bad/args +1 -0
- package/payload/gate-sdk/gate-tests/check-shellcheck/bad/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-shellcheck/bad/warn.sh +5 -0
- package/payload/gate-sdk/gate-tests/check-shellcheck/good/args +1 -0
- package/payload/gate-sdk/gate-tests/check-shellcheck/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-shellcheck/good/ok.sh +4 -0
- package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/bad/alpha-kit/smoke/install.sh +4 -0
- package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/bad/alpha-kit/smoke/violation.sh +7 -0
- package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/bad/args +4 -0
- package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/bad/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/bad/scripts/gate-sdk-config.sh +5 -0
- package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/good/alpha-kit/smoke/install.sh +4 -0
- package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/good/alpha-kit/smoke/violation.sh +4 -0
- package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/good/args +6 -0
- package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/good/beta-kit/smoke/install.sh +4 -0
- package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/good/scripts/gate-sdk-config.sh +5 -0
- package/payload/gate-sdk/gate-tests/check-template-copy-parity/bad/args +9 -0
- package/payload/gate-sdk/gate-tests/check-template-copy-parity/bad/delegation-kit/templates/agent-budget-guard.sh +16 -0
- package/payload/gate-sdk/gate-tests/check-template-copy-parity/bad/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-template-copy-parity/bad/scripts/agent-budget-guard.sh +17 -0
- package/payload/gate-sdk/gate-tests/check-template-copy-parity/good/args +8 -0
- package/payload/gate-sdk/gate-tests/check-template-copy-parity/good/delegation-kit/templates/agent-budget-guard.sh +16 -0
- package/payload/gate-sdk/gate-tests/check-template-copy-parity/good/delegation-kit/templates/delegation-config.sh +3 -0
- package/payload/gate-sdk/gate-tests/check-template-copy-parity/good/delegation-kit/templates/usage-poller.sh +6 -0
- package/payload/gate-sdk/gate-tests/check-template-copy-parity/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-template-copy-parity/good/scripts/agent-budget-guard.sh +16 -0
- package/payload/gate-sdk/gate-tests/check-template-copy-parity/good/scripts/delegation-config.sh +4 -0
- package/payload/gate-sdk/gate-tests/check-test-hermetic/bad/args +3 -0
- package/payload/gate-sdk/gate-tests/check-test-hermetic/bad/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-test-hermetic/bad/leaky.test.sh +5 -0
- package/payload/gate-sdk/gate-tests/check-test-hermetic/good/args +3 -0
- package/payload/gate-sdk/gate-tests/check-test-hermetic/good/exempt.test.sh +4 -0
- package/payload/gate-sdk/gate-tests/check-test-hermetic/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-test-hermetic/good/sourced.test.sh +5 -0
- package/payload/gate-sdk/gate-tests/check-test-hermetic-smoke.test.sh +84 -0
- package/payload/gate-sdk/gate-tests/check-tree-terms/bad/args +2 -0
- package/payload/gate-sdk/gate-tests/check-tree-terms/bad/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-tree-terms/bad/patterns.list +3 -0
- package/payload/gate-sdk/gate-tests/check-tree-terms/bad/tree/leak.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-tree-terms/good/args +2 -0
- package/payload/gate-sdk/gate-tests/check-tree-terms/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-tree-terms/good/patterns.list +3 -0
- package/payload/gate-sdk/gate-tests/check-tree-terms/good/tree/clean.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-workflow-tiering/bad/.workflow/payload.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-workflow-tiering/bad/.workflow/projection.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-workflow-tiering/bad/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-workflow-tiering/good/.workflow/projection.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-workflow-tiering/good/.workflow/wire.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-workflow-tiering/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/enforcement-map.test.sh +87 -0
- package/payload/gate-sdk/gate-tests/lib-gate.test.sh +78 -0
- package/payload/gate-sdk/gate-tests/run-for-path.test.sh +77 -0
- package/payload/gate-sdk/lib/consumer-smoke.sh +32 -0
- package/payload/gate-sdk/lib/gate.sh +216 -0
- package/payload/gate-sdk/lib/inject.sh +35 -0
- package/payload/gate-sdk/lib/test-hermetic.sh +11 -0
- package/payload/gate-sdk/smoke/install.sh +84 -0
- package/payload/gate-sdk/smoke/violation.sh +13 -0
- package/payload/gate-sdk/templates/check-skeleton.sh +23 -0
- package/payload/gate-sdk/templates/gates-workflow.yml +55 -0
- package/payload/gate-sdk/templates/msg-patterns.list +21 -0
- package/payload/guard-kit/README.md +65 -0
- package/payload/guard-kit/SPEC.md +590 -0
- package/payload/guard-kit/bin/compare-settings-allow.sh +58 -0
- package/payload/guard-kit/bin/run-guard-tests.sh +86 -0
- package/payload/guard-kit/bin/scan-prompts.sh +166 -0
- package/payload/guard-kit/bin/scratch-run.sh +34 -0
- package/payload/guard-kit/gate-tests/scan-prompts.test.sh +70 -0
- package/payload/guard-kit/gate-tests/scratch-run.test.sh +62 -0
- package/payload/guard-kit/guard-tests/cases.tsv +117 -0
- package/payload/guard-kit/guard-tests/escalation-cases.tsv +13 -0
- package/payload/guard-kit/lib/guard.sh +448 -0
- package/payload/guard-kit/smoke/install.sh +26 -0
- package/payload/guard-kit/templates/bash-guard.sh +18 -0
- package/payload/guard-kit/templates/close-triage.md +31 -0
- package/payload/guard-kit/templates/escalation-guard.sh +27 -0
- package/payload/guard-kit/templates/guard-config.sh +2 -0
- package/payload/guard-kit/templates/settings-hooks.json +19 -0
- package/payload/guard-kit/templates/wakeup-guard.sh +20 -0
- package/payload/lifecycle-kit/README.md +106 -0
- package/payload/lifecycle-kit/SPEC.md +1492 -0
- package/payload/lifecycle-kit/bin/close-surfaces.sh +94 -0
- package/payload/lifecycle-kit/bin/enter-stage.sh +215 -0
- package/payload/lifecycle-kit/bin/file-gap.sh +43 -0
- package/payload/lifecycle-kit/bin/install-lifecycle.sh +36 -0
- package/payload/lifecycle-kit/bin/session-id.sh +75 -0
- package/payload/lifecycle-kit/checks/check-close-surfaces.sh +63 -0
- package/payload/lifecycle-kit/checks/check-lesson-disposition.sh +98 -0
- package/payload/lifecycle-kit/checks/check-lifecycle-registration.sh +54 -0
- package/payload/lifecycle-kit/checks/check-merge-attrs.sh +69 -0
- package/payload/lifecycle-kit/checks/check-shim-restatement.sh +97 -0
- package/payload/lifecycle-kit/checks/check-skill-binding.sh +59 -0
- package/payload/lifecycle-kit/checks/check-stage-entry.sh +197 -0
- package/payload/lifecycle-kit/checks/check-stage-evidence.sh +81 -0
- package/payload/lifecycle-kit/checks/check-stage-skill-coverage.sh +47 -0
- package/payload/lifecycle-kit/gate-tests/boundary-scratch-wipe.test.sh +96 -0
- package/payload/lifecycle-kit/gate-tests/check-close-surfaces/bad/args +1 -0
- package/payload/lifecycle-kit/gate-tests/check-close-surfaces/bad/expect.txt +1 -0
- package/payload/lifecycle-kit/gate-tests/check-close-surfaces/bad/owners/inbox.md +5 -0
- package/payload/lifecycle-kit/gate-tests/check-close-surfaces/bad/scripts/lifecycle-config.sh +4 -0
- package/payload/lifecycle-kit/gate-tests/check-close-surfaces/good/args +1 -0
- package/payload/lifecycle-kit/gate-tests/check-close-surfaces/good/expect.txt +1 -0
- package/payload/lifecycle-kit/gate-tests/check-close-surfaces/good/owners/inbox.md +5 -0
- package/payload/lifecycle-kit/gate-tests/check-close-surfaces/good/scripts/lifecycle-config.sh +4 -0
- package/payload/lifecycle-kit/gate-tests/check-close-surfaces.test.sh +66 -0
- package/payload/lifecycle-kit/gate-tests/check-lesson-disposition/bad/args +2 -0
- package/payload/lifecycle-kit/gate-tests/check-lesson-disposition/bad/evidence.txt +2 -0
- package/payload/lifecycle-kit/gate-tests/check-lesson-disposition/bad/expect.txt +1 -0
- package/payload/lifecycle-kit/gate-tests/check-lesson-disposition/bad/queue-head.md +8 -0
- package/payload/lifecycle-kit/gate-tests/check-lesson-disposition/bad/queue-work.md +5 -0
- package/payload/lifecycle-kit/gate-tests/check-lesson-disposition/good/args +2 -0
- package/payload/lifecycle-kit/gate-tests/check-lesson-disposition/good/evidence.txt +3 -0
- package/payload/lifecycle-kit/gate-tests/check-lesson-disposition/good/expect.txt +1 -0
- package/payload/lifecycle-kit/gate-tests/check-lesson-disposition/good/queue-head.md +8 -0
- package/payload/lifecycle-kit/gate-tests/check-lesson-disposition/good/queue-work.md +5 -0
- package/payload/lifecycle-kit/gate-tests/check-lesson-disposition.test.sh +56 -0
- package/payload/lifecycle-kit/gate-tests/check-lifecycle-registration/bad/AGENT.md +11 -0
- package/payload/lifecycle-kit/gate-tests/check-lifecycle-registration/bad/args +1 -0
- package/payload/lifecycle-kit/gate-tests/check-lifecycle-registration/bad/expect.txt +1 -0
- package/payload/lifecycle-kit/gate-tests/check-lifecycle-registration/good/AGENT.md +11 -0
- package/payload/lifecycle-kit/gate-tests/check-lifecycle-registration/good/args +1 -0
- package/payload/lifecycle-kit/gate-tests/check-lifecycle-registration/good/expect.txt +1 -0
- package/payload/lifecycle-kit/gate-tests/check-lifecycle-registration.test.sh +59 -0
- package/payload/lifecycle-kit/gate-tests/check-merge-attrs/bad/.gitattributes +6 -0
- package/payload/lifecycle-kit/gate-tests/check-merge-attrs/bad/expect.txt +1 -0
- package/payload/lifecycle-kit/gate-tests/check-merge-attrs/good/.gitattributes +5 -0
- package/payload/lifecycle-kit/gate-tests/check-merge-attrs/good/expect.txt +1 -0
- package/payload/lifecycle-kit/gate-tests/check-merge-attrs.test.sh +113 -0
- package/payload/lifecycle-kit/gate-tests/check-shim-restatement/bad/args +2 -0
- package/payload/lifecycle-kit/gate-tests/check-shim-restatement/bad/commands/build.md +6 -0
- package/payload/lifecycle-kit/gate-tests/check-shim-restatement/bad/corpus.md +4 -0
- package/payload/lifecycle-kit/gate-tests/check-shim-restatement/bad/expect.txt +1 -0
- package/payload/lifecycle-kit/gate-tests/check-shim-restatement/good/args +2 -0
- package/payload/lifecycle-kit/gate-tests/check-shim-restatement/good/commands/build.md +5 -0
- package/payload/lifecycle-kit/gate-tests/check-shim-restatement/good/corpus.md +4 -0
- package/payload/lifecycle-kit/gate-tests/check-shim-restatement/good/expect.txt +1 -0
- package/payload/lifecycle-kit/gate-tests/check-shim-restatement.test.sh +80 -0
- package/payload/lifecycle-kit/gate-tests/check-skill-binding/bad/args +1 -0
- package/payload/lifecycle-kit/gate-tests/check-skill-binding/bad/commands/build.md +5 -0
- package/payload/lifecycle-kit/gate-tests/check-skill-binding/bad/expect.txt +1 -0
- package/payload/lifecycle-kit/gate-tests/check-skill-binding/bad/templates/build.md +7 -0
- package/payload/lifecycle-kit/gate-tests/check-skill-binding/good/args +1 -0
- package/payload/lifecycle-kit/gate-tests/check-skill-binding/good/commands/build.md +7 -0
- package/payload/lifecycle-kit/gate-tests/check-skill-binding/good/expect.txt +1 -0
- package/payload/lifecycle-kit/gate-tests/check-skill-binding/good/templates/build.md +7 -0
- package/payload/lifecycle-kit/gate-tests/check-skill-binding.test.sh +84 -0
- package/payload/lifecycle-kit/gate-tests/check-stage-entry/bad/.workflow/WORKFLOW-STATE.txt +7 -0
- package/payload/lifecycle-kit/gate-tests/check-stage-entry/bad/TASK-QUEUE.md +13 -0
- package/payload/lifecycle-kit/gate-tests/check-stage-entry/bad/expect.txt +1 -0
- package/payload/lifecycle-kit/gate-tests/check-stage-entry/good/.workflow/WORKFLOW-STATE.txt +7 -0
- package/payload/lifecycle-kit/gate-tests/check-stage-entry/good/TASK-QUEUE.md +13 -0
- package/payload/lifecycle-kit/gate-tests/check-stage-entry/good/expect.txt +1 -0
- package/payload/lifecycle-kit/gate-tests/check-stage-entry.test.sh +251 -0
- package/payload/lifecycle-kit/gate-tests/check-stage-evidence/bad/.workflow/WORKFLOW-STATE.txt +6 -0
- package/payload/lifecycle-kit/gate-tests/check-stage-evidence/bad/TASK-QUEUE.md +13 -0
- package/payload/lifecycle-kit/gate-tests/check-stage-evidence/bad/expect.txt +1 -0
- package/payload/lifecycle-kit/gate-tests/check-stage-evidence/good/.workflow/WORKFLOW-STATE.txt +6 -0
- package/payload/lifecycle-kit/gate-tests/check-stage-evidence/good/TASK-QUEUE.md +13 -0
- package/payload/lifecycle-kit/gate-tests/check-stage-evidence/good/expect.txt +1 -0
- package/payload/lifecycle-kit/gate-tests/check-stage-evidence.test.sh +115 -0
- package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/bad/args +1 -0
- package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/bad/commands/align.md +2 -0
- package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/bad/commands/build.md +2 -0
- package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/bad/commands/scope.md +2 -0
- package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/bad/commands/validate.md +2 -0
- package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/bad/expect.txt +1 -0
- package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/good/args +1 -0
- package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/good/commands/align.md +2 -0
- package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/good/commands/build.md +2 -0
- package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/good/commands/close.md +2 -0
- package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/good/commands/scope.md +2 -0
- package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/good/commands/validate.md +2 -0
- package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/good/expect.txt +1 -0
- package/payload/lifecycle-kit/lib/stages.sh +179 -0
- package/payload/lifecycle-kit/smoke/install.sh +341 -0
- package/payload/lifecycle-kit/smoke/violation.sh +8 -0
- package/payload/lifecycle-kit/templates/lead.md +271 -0
- package/payload/lifecycle-kit/templates/lifecycle-config.sh +2 -0
- package/payload/lifecycle-kit/templates/release-sweep.md +39 -0
- package/payload/lifecycle-kit/templates/stages/align.md +65 -0
- package/payload/lifecycle-kit/templates/stages/build.md +78 -0
- package/payload/lifecycle-kit/templates/stages/close.md +122 -0
- package/payload/lifecycle-kit/templates/stages/scope.md +112 -0
- package/payload/lifecycle-kit/templates/stages/spec.md +91 -0
- package/payload/lifecycle-kit/templates/stages/validate.md +54 -0
- package/payload/lifecycle-kit/templates/upgrade.md +41 -0
- package/payload/queue-kit/README.md +78 -0
- package/payload/queue-kit/SPEC.md +797 -0
- package/payload/queue-kit/bin/lesson-sink.sh +28 -0
- package/payload/queue-kit/bin/queue-index.sh +182 -0
- package/payload/queue-kit/bin/roadmap.sh +76 -0
- package/payload/queue-kit/checks/check-queue-entry-budget.sh +104 -0
- package/payload/queue-kit/checks/check-queue-hygiene.sh +81 -0
- package/payload/queue-kit/checks/check-queue-prose-precondition.sh +63 -0
- package/payload/queue-kit/checks/check-queue-sections.sh +44 -0
- package/payload/queue-kit/checks/check-queue-slug-liveness.sh +63 -0
- package/payload/queue-kit/checks/check-queue-wrap.sh +56 -0
- package/payload/queue-kit/checks/check-roadmap-fresh.sh +110 -0
- package/payload/queue-kit/checks/check-tag-lead-line.sh +70 -0
- package/payload/queue-kit/checks/check-task-conservation.sh +50 -0
- package/payload/queue-kit/checks/check-task-names.sh +128 -0
- package/payload/queue-kit/gate-tests/check-queue-entry-budget/bad/TASK-QUEUE.md +33 -0
- package/payload/queue-kit/gate-tests/check-queue-entry-budget/bad/expect.txt +4 -0
- package/payload/queue-kit/gate-tests/check-queue-entry-budget/bad/scripts/queue-config.sh +6 -0
- package/payload/queue-kit/gate-tests/check-queue-entry-budget/good/TASK-QUEUE.md +35 -0
- package/payload/queue-kit/gate-tests/check-queue-entry-budget/good/scripts/queue-config.sh +6 -0
- package/payload/queue-kit/gate-tests/check-queue-hygiene/bad/TASK-QUEUE.md +17 -0
- package/payload/queue-kit/gate-tests/check-queue-hygiene/bad/expect.txt +1 -0
- package/payload/queue-kit/gate-tests/check-queue-hygiene/good/TASK-QUEUE.md +25 -0
- package/payload/queue-kit/gate-tests/check-queue-hygiene/good/expect.txt +1 -0
- package/payload/queue-kit/gate-tests/check-queue-prose-precondition/bad/TASK-QUEUE.md +15 -0
- package/payload/queue-kit/gate-tests/check-queue-prose-precondition/bad/expect.txt +1 -0
- package/payload/queue-kit/gate-tests/check-queue-prose-precondition/good/TASK-QUEUE.md +25 -0
- package/payload/queue-kit/gate-tests/check-queue-prose-precondition/good/expect.txt +1 -0
- package/payload/queue-kit/gate-tests/check-queue-sections/bad/TASK-QUEUE.md +13 -0
- package/payload/queue-kit/gate-tests/check-queue-sections/bad/expect.txt +1 -0
- package/payload/queue-kit/gate-tests/check-queue-sections/good/TASK-QUEUE.md +15 -0
- package/payload/queue-kit/gate-tests/check-queue-sections/good/expect.txt +1 -0
- package/payload/queue-kit/gate-tests/check-queue-slug-liveness/bad/TASK-QUEUE.md +17 -0
- package/payload/queue-kit/gate-tests/check-queue-slug-liveness/bad/docs/page.md +4 -0
- package/payload/queue-kit/gate-tests/check-queue-slug-liveness/bad/expect.txt +1 -0
- package/payload/queue-kit/gate-tests/check-queue-slug-liveness/bad/scripts/queue-config.sh +3 -0
- package/payload/queue-kit/gate-tests/check-queue-slug-liveness/good/TASK-QUEUE.md +19 -0
- package/payload/queue-kit/gate-tests/check-queue-slug-liveness/good/docs/page.md +5 -0
- package/payload/queue-kit/gate-tests/check-queue-slug-liveness/good/expect.txt +1 -0
- package/payload/queue-kit/gate-tests/check-queue-slug-liveness/good/scripts/queue-config.sh +3 -0
- package/payload/queue-kit/gate-tests/check-queue-wrap/bad/TASK-QUEUE.md +15 -0
- package/payload/queue-kit/gate-tests/check-queue-wrap/bad/expect.txt +1 -0
- package/payload/queue-kit/gate-tests/check-queue-wrap/good/TASK-QUEUE.md +25 -0
- package/payload/queue-kit/gate-tests/check-queue-wrap/good/expect.txt +1 -0
- package/payload/queue-kit/gate-tests/check-roadmap-fresh/bad/TASK-QUEUE.md +24 -0
- package/payload/queue-kit/gate-tests/check-roadmap-fresh/bad/args +5 -0
- package/payload/queue-kit/gate-tests/check-roadmap-fresh/bad/emit.txt +8 -0
- package/payload/queue-kit/gate-tests/check-roadmap-fresh/bad/expect.txt +1 -0
- package/payload/queue-kit/gate-tests/check-roadmap-fresh/bad/projection.txt +16 -0
- package/payload/queue-kit/gate-tests/check-roadmap-fresh/bad/scripts/queue-config.sh +6 -0
- package/payload/queue-kit/gate-tests/check-roadmap-fresh/good/TASK-QUEUE.md +22 -0
- package/payload/queue-kit/gate-tests/check-roadmap-fresh/good/args +5 -0
- package/payload/queue-kit/gate-tests/check-roadmap-fresh/good/emit.txt +7 -0
- package/payload/queue-kit/gate-tests/check-roadmap-fresh/good/expect.txt +1 -0
- package/payload/queue-kit/gate-tests/check-roadmap-fresh/good/projection.txt +16 -0
- package/payload/queue-kit/gate-tests/check-roadmap-fresh/good/scripts/queue-config.sh +6 -0
- package/payload/queue-kit/gate-tests/check-tag-lead-line/bad/TASK-QUEUE.md +25 -0
- package/payload/queue-kit/gate-tests/check-tag-lead-line/bad/expect.txt +2 -0
- package/payload/queue-kit/gate-tests/check-tag-lead-line/good/TASK-QUEUE.md +30 -0
- package/payload/queue-kit/gate-tests/check-tag-lead-line/good/expect.txt +1 -0
- package/payload/queue-kit/gate-tests/check-task-names/bad/TASK-QUEUE.md +18 -0
- package/payload/queue-kit/gate-tests/check-task-names/bad/expect.txt +1 -0
- package/payload/queue-kit/gate-tests/check-task-names/good/TASK-QUEUE.md +25 -0
- package/payload/queue-kit/gate-tests/check-task-names/good/expect.txt +1 -0
- package/payload/queue-kit/gate-tests/queue-index.test.sh +159 -0
- package/payload/queue-kit/gate-tests/roadmap.test.sh +197 -0
- package/payload/queue-kit/lib/queue.sh +193 -0
- package/payload/queue-kit/smoke/install.sh +22 -0
- package/payload/queue-kit/smoke/violation.sh +8 -0
- package/payload/queue-kit/templates/TASK-QUEUE.md +43 -0
- package/payload/queue-kit/templates/queue-config.sh +2 -0
- package/payload/site-kit/README.md +61 -0
- package/payload/site-kit/SPEC.md +269 -0
- package/payload/site-kit/checks/check-docs-cname-parity.sh +80 -0
- package/payload/site-kit/checks/check-docs-render-fidelity.sh +167 -0
- package/payload/site-kit/gate-tests/check-docs-cname-parity/bad/args +4 -0
- package/payload/site-kit/gate-tests/check-docs-cname-parity/bad/expect.txt +1 -0
- package/payload/site-kit/gate-tests/check-docs-cname-parity/bad/site-config.sh +7 -0
- package/payload/site-kit/gate-tests/check-docs-cname-parity/bad/tree/CNAME +1 -0
- package/payload/site-kit/gate-tests/check-docs-cname-parity/bad/tree/README.md +5 -0
- package/payload/site-kit/gate-tests/check-docs-cname-parity/good/args +5 -0
- package/payload/site-kit/gate-tests/check-docs-cname-parity/good/expect.txt +1 -0
- package/payload/site-kit/gate-tests/check-docs-cname-parity/good/site-config.sh +7 -0
- package/payload/site-kit/gate-tests/check-docs-cname-parity/good/tree/CNAME +1 -0
- package/payload/site-kit/gate-tests/check-docs-cname-parity/good/tree/docs/posts/2026-01-01-legacy.md +4 -0
- package/payload/site-kit/gate-tests/check-docs-cname-parity/good/tree/index.md +4 -0
- package/payload/site-kit/gate-tests/check-docs-cname-parity/good/tree/pkg/gate-tests/fixture.md +5 -0
- package/payload/site-kit/gate-tests/check-docs-render-fidelity/bad/args +8 -0
- package/payload/site-kit/gate-tests/check-docs-render-fidelity/bad/expect.txt +1 -0
- package/payload/site-kit/gate-tests/check-docs-render-fidelity/bad/tree/docs/install.md +38 -0
- package/payload/site-kit/gate-tests/check-docs-render-fidelity/good/args +6 -0
- package/payload/site-kit/gate-tests/check-docs-render-fidelity/good/expect.txt +1 -0
- package/payload/site-kit/gate-tests/check-docs-render-fidelity/good/tree/docs/install.md +35 -0
- package/payload/site-kit/gate-tests/check-docs-render-fidelity-foreign.test.sh +87 -0
- package/payload/site-kit/gate-tests/check-docs-render-fidelity-span.test.sh +80 -0
- package/payload/site-kit/gate-tests/check-docs-render-fidelity-table.test.sh +90 -0
- package/payload/site-kit/lib/site.sh +29 -0
- package/payload/site-kit/smoke/install.sh +26 -0
- package/payload/site-kit/smoke/violation.sh +20 -0
- package/payload/site-kit/templates/site-health.yml +164 -0
- package/profiles.list +53 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# spec: delegation-kit/SPEC.md §Testing — decision-table runner for the Agent budget guard
|
|
3
|
+
#
|
|
4
|
+
# usage: run-budget-guard-tests.sh [cases.tsv]
|
|
5
|
+
set -uo pipefail
|
|
6
|
+
|
|
7
|
+
KIT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
8
|
+
GUARD="$KIT/templates/agent-budget-guard.sh"
|
|
9
|
+
LIB="$KIT/../guard-kit/lib/guard.sh"
|
|
10
|
+
VERDICT="$KIT/bin/usage-verdict.sh"
|
|
11
|
+
CASES="${1:-$KIT/usage-tests/budget-guard-cases.tsv}"
|
|
12
|
+
|
|
13
|
+
for f in "$GUARD" "$LIB" "$VERDICT" "$CASES"; do
|
|
14
|
+
[[ -f "$f" ]] || { echo "run-budget-guard-tests: missing $f" >&2; exit 2; }
|
|
15
|
+
done
|
|
16
|
+
command -v jq >/dev/null 2>&1 || { echo "run-budget-guard-tests: jq not found on PATH" >&2; exit 2; }
|
|
17
|
+
|
|
18
|
+
# spec: delegation-kit/SPEC.md §Testing — the table encodes the kit defaults, so strip ambient DELEGATION_KIT_* at every guard invocation; the poison export proves the strip each run (a leak turns every advise case into block)
|
|
19
|
+
export DELEGATION_KIT_PAUSE_PCT=0
|
|
20
|
+
DK_UNSET=()
|
|
21
|
+
while IFS= read -r name; do DK_UNSET+=(-u "$name"); done < <(env | grep -o '^DELEGATION_KIT_[A-Za-z0-9_]*')
|
|
22
|
+
|
|
23
|
+
SANDBOX="$(mktemp -d)"
|
|
24
|
+
trap 'rm -rf "$SANDBOX"' EXIT
|
|
25
|
+
USAGE="$SANDBOX/usage.txt"
|
|
26
|
+
CRED="$SANDBOX/.credentials.json"
|
|
27
|
+
ERR="$SANDBOX/err"
|
|
28
|
+
JSON='{"tool_name":"Agent","tool_input":{"prompt":"audit"}}'
|
|
29
|
+
|
|
30
|
+
classify() {
|
|
31
|
+
local rc="$1" out="$2"
|
|
32
|
+
if [[ "$rc" -eq 2 ]]; then echo block; return; fi
|
|
33
|
+
if [[ "$rc" -ne 0 ]]; then echo "exit$rc"; return; fi
|
|
34
|
+
if grep -q '"additionalContext"' <<<"$out"; then echo advise; return; fi
|
|
35
|
+
echo unknown
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
fails=0
|
|
39
|
+
ran=0
|
|
40
|
+
now="$(date +%s)"
|
|
41
|
+
|
|
42
|
+
while IFS=$'\t' read -r want pct age_off reset_off cred_age desc; do
|
|
43
|
+
[[ -z "${want// }" ]] && continue
|
|
44
|
+
[[ "$want" == \#* ]] && continue
|
|
45
|
+
|
|
46
|
+
rm -f "$USAGE" "$CRED"
|
|
47
|
+
if [[ "$pct" != "UNREADABLE" ]]; then
|
|
48
|
+
{
|
|
49
|
+
printf 'five_hour_used_pct=%s\n' "$pct"
|
|
50
|
+
printf 'five_hour_resets_at=%s\n' "$(( now + reset_off ))"
|
|
51
|
+
printf 'updated_at=%s\n' "$(( now - age_off ))"
|
|
52
|
+
} > "$USAGE"
|
|
53
|
+
fi
|
|
54
|
+
if [[ "$cred_age" != "-" ]]; then
|
|
55
|
+
: > "$CRED"
|
|
56
|
+
touch -d "@$(( now - cred_age ))" "$CRED"
|
|
57
|
+
fi
|
|
58
|
+
|
|
59
|
+
out="$( cd "$SANDBOX" && printf '%s' "$JSON" \
|
|
60
|
+
| env "${DK_UNSET[@]}" GUARD_KIT_LIB="$LIB" DELEGATION_KIT_VERDICT_BIN="$VERDICT" \
|
|
61
|
+
DELEGATION_KIT_USAGE_FILE="$USAGE" DELEGATION_KIT_CRED_FILE="$CRED" \
|
|
62
|
+
bash "$GUARD" 2>"$ERR" )"
|
|
63
|
+
rc=$?
|
|
64
|
+
err="$(cat "$ERR")"
|
|
65
|
+
got="$(classify "$rc" "$out")"
|
|
66
|
+
ran=$((ran + 1))
|
|
67
|
+
|
|
68
|
+
if [[ "$got" != "$want" ]]; then
|
|
69
|
+
echo " FAIL [$desc]: want '$want', got '$got' (rc=$rc) -- out=$out err=$err"
|
|
70
|
+
fails=$((fails + 1))
|
|
71
|
+
continue
|
|
72
|
+
fi
|
|
73
|
+
case "$want" in
|
|
74
|
+
block) grep -qF -- '->' <<<"$err" || { echo " FAIL [$desc]: block carries no live verdict text -- $err"; fails=$((fails + 1)); } ;;
|
|
75
|
+
advise) grep -qF -- '->' <<<"$out" || { echo " FAIL [$desc]: advise carries no live verdict text -- $out"; fails=$((fails + 1)); } ;;
|
|
76
|
+
esac
|
|
77
|
+
done < "$CASES"
|
|
78
|
+
|
|
79
|
+
if [[ "$ran" -eq 0 ]]; then
|
|
80
|
+
echo "run-budget-guard-tests: no cases parsed from $CASES" >&2
|
|
81
|
+
exit 2
|
|
82
|
+
fi
|
|
83
|
+
if [[ "$fails" -gt 0 ]]; then
|
|
84
|
+
echo "run-budget-guard-tests: $fails/$ran case(s) failed"
|
|
85
|
+
exit 1
|
|
86
|
+
fi
|
|
87
|
+
echo "run-budget-guard-tests: ok ($ran cases across the block/advise routing)"
|
|
88
|
+
exit 0
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# spec: delegation-kit/SPEC.md §Testing — assertion runner for usage-trend over a fixture history
|
|
3
|
+
#
|
|
4
|
+
# usage: run-trend-tests.sh [history-fixture]
|
|
5
|
+
set -uo pipefail
|
|
6
|
+
|
|
7
|
+
KIT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
8
|
+
TREND="$KIT/bin/usage-trend.sh"
|
|
9
|
+
HIST="${1:-$KIT/usage-tests/trend-history.log}"
|
|
10
|
+
|
|
11
|
+
[[ -x "$TREND" ]] || { echo "run-trend-tests: missing or non-executable $TREND" >&2; exit 2; }
|
|
12
|
+
[[ -f "$HIST" ]] || { echo "run-trend-tests: history fixture not found: $HIST" >&2; exit 2; }
|
|
13
|
+
|
|
14
|
+
# spec: delegation-kit/SPEC.md §Testing — strip ambient DELEGATION_KIT_* at every reporter invocation; the poison export proves the strip each run (a leak turns the unset-knob case green)
|
|
15
|
+
export DELEGATION_KIT_USAGE_HISTORY="$HIST"
|
|
16
|
+
DK_UNSET=()
|
|
17
|
+
while IFS= read -r name; do DK_UNSET+=(-u "$name"); done < <(env | grep -o '^DELEGATION_KIT_[A-Za-z0-9_]*')
|
|
18
|
+
|
|
19
|
+
SANDBOX="$(mktemp -d)"
|
|
20
|
+
trap 'rm -rf "$SANDBOX"' EXIT
|
|
21
|
+
|
|
22
|
+
fails=0
|
|
23
|
+
assert_has() { # <label> <needle> <<< haystack
|
|
24
|
+
local label="$1" needle="$2" hay; hay="$(cat)"
|
|
25
|
+
grep -qF -- "$needle" <<<"$hay" || { echo " FAIL [$label]: output missing '$needle'"; fails=$((fails + 1)); }
|
|
26
|
+
}
|
|
27
|
+
assert_count() { # <label> <pattern> <want> <<< haystack
|
|
28
|
+
local label="$1" pat="$2" want="$3" got; got="$(grep -cE -- "$pat" || true)"
|
|
29
|
+
[[ "$got" -eq "$want" ]] || { echo " FAIL [$label]: want $want match(es) of /$pat/, got $got"; fails=$((fails + 1)); }
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
# spec: delegation-kit/SPEC.md §Testing — hermetic sandbox run, fixture as the positional arg
|
|
33
|
+
out="$( cd "$SANDBOX" && env "${DK_UNSET[@]}" bash "$TREND" "$HIST" )"; rc=$?
|
|
34
|
+
[[ "$rc" -eq 0 ]] || { echo " FAIL [exit]: want 0, got $rc"; fails=$((fails + 1)); }
|
|
35
|
+
|
|
36
|
+
assert_has "per-account grouping: acctA heads its own block" "account acctA" <<<"$out"
|
|
37
|
+
assert_has "per-account grouping: acctB heads its own block" "account acctB" <<<"$out"
|
|
38
|
+
|
|
39
|
+
assert_count "5h segments: 3 acctA reset-boundary windows + 2 acctB login-split" '^ \[5h\]' 5 <<<"$out"
|
|
40
|
+
assert_count "7d segments: 1 reunited acctA week + 2 acctB login-split" '^ \[7d\]' 3 <<<"$out"
|
|
41
|
+
|
|
42
|
+
assert_has "spike-then-correction excluded, not averaged: 90->40 pair dropped, ends stay 10->25" "reset@20000 tier=pro: 10.0%->25.0%" <<<"$out"
|
|
43
|
+
assert_has "spike-then-correction: the pair is flagged suspect" "2 suspect" <<<"$out"
|
|
44
|
+
|
|
45
|
+
assert_has "weekly reunion across the switch-back: one acctA week spanning" "[7d] reset@600000 tier=pro: 30.0%->70.0%" <<<"$out"
|
|
46
|
+
assert_has "weekly reunion: all 7 acctA samples in one segment" "7 sample(s)" <<<"$out"
|
|
47
|
+
|
|
48
|
+
assert_has "token delta on the weekly report" "tokens: +1200 in / +410 out" <<<"$out"
|
|
49
|
+
assert_has "weekly headroom on the report" "weekly headroom:" <<<"$out"
|
|
50
|
+
|
|
51
|
+
assert_has "PAUSE onset annotated where the pause first landed" "first PAUSE onset at epoch 33600" <<<"$out"
|
|
52
|
+
|
|
53
|
+
( cd "$SANDBOX" && env "${DK_UNSET[@]}" bash "$TREND" ) >/dev/null 2>&1 && { echo " FAIL [unset knob]: want exit 2"; fails=$((fails + 1)); }
|
|
54
|
+
rc=$?; [[ "$rc" -eq 2 ]] || { echo " FAIL [unset knob]: want exit 2, got $rc"; fails=$((fails + 1)); }
|
|
55
|
+
( cd "$SANDBOX" && env "${DK_UNSET[@]}" bash "$TREND" "$SANDBOX/nope.log" ) >/dev/null 2>&1 && { echo " FAIL [missing history]: want exit 2"; fails=$((fails + 1)); }
|
|
56
|
+
rc=$?; [[ "$rc" -eq 2 ]] || { echo " FAIL [missing history]: want exit 2, got $rc"; fails=$((fails + 1)); }
|
|
57
|
+
|
|
58
|
+
if [[ "$fails" -gt 0 ]]; then
|
|
59
|
+
echo "run-trend-tests: $fails assertion(s) failed"
|
|
60
|
+
exit 1
|
|
61
|
+
fi
|
|
62
|
+
echo "run-trend-tests: ok (segmentation across reset/login/account boundaries, weekly reunion, spike flagging, and fail-closed knobs)"
|
|
63
|
+
exit 0
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# spec: delegation-kit/SPEC.md §Testing — decision-table runner for usage-verdict
|
|
3
|
+
#
|
|
4
|
+
# usage: run-usage-tests.sh [cases.tsv]
|
|
5
|
+
set -uo pipefail
|
|
6
|
+
|
|
7
|
+
KIT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
8
|
+
GATE="$KIT/bin/usage-verdict.sh"
|
|
9
|
+
CASES="${1:-$KIT/usage-tests/cases.tsv}"
|
|
10
|
+
|
|
11
|
+
[[ -x "$GATE" ]] || { echo "run-usage-tests: missing or non-executable $GATE" >&2; exit 2; }
|
|
12
|
+
[[ -f "$CASES" ]] || { echo "run-usage-tests: cases file not found: $CASES" >&2; exit 2; }
|
|
13
|
+
|
|
14
|
+
# spec: delegation-kit/SPEC.md §Testing — the table encodes the kit defaults, so strip ambient DELEGATION_KIT_* at every gate invocation; the poison export proves the strip each run (a leak fails the table loudly)
|
|
15
|
+
export DELEGATION_KIT_PAUSE_PCT=0
|
|
16
|
+
DK_UNSET=()
|
|
17
|
+
while IFS= read -r name; do DK_UNSET+=(-u "$name"); done < <(env | grep -o '^DELEGATION_KIT_[A-Za-z0-9_]*')
|
|
18
|
+
|
|
19
|
+
SANDBOX="$(mktemp -d)"
|
|
20
|
+
trap 'rm -rf "$SANDBOX"' EXIT
|
|
21
|
+
USAGE="$SANDBOX/usage.txt"
|
|
22
|
+
CRED="$SANDBOX/.credentials.json"
|
|
23
|
+
HIST="$SANDBOX/history.log"
|
|
24
|
+
|
|
25
|
+
fails=0
|
|
26
|
+
ran=0
|
|
27
|
+
now="$(date +%s)"
|
|
28
|
+
|
|
29
|
+
while IFS=$'\t' read -r verdict want pct age_off reset_off cred_age pct_7d reset7d_off append axis desc; do
|
|
30
|
+
[[ -z "${verdict// }" ]] && continue
|
|
31
|
+
[[ "$verdict" == \#* ]] && continue
|
|
32
|
+
|
|
33
|
+
{
|
|
34
|
+
printf 'five_hour_used_pct=%s\n' "$pct"
|
|
35
|
+
printf 'five_hour_resets_at=%s\n' "$(( now + reset_off ))"
|
|
36
|
+
printf 'updated_at=%s\n' "$(( now - age_off ))"
|
|
37
|
+
if [[ "$pct_7d" != "-" ]]; then
|
|
38
|
+
printf 'seven_day_used_pct=%s\n' "$pct_7d"
|
|
39
|
+
printf 'seven_day_resets_at=%s\n' "$(( now + reset7d_off ))"
|
|
40
|
+
fi
|
|
41
|
+
} > "$USAGE"
|
|
42
|
+
|
|
43
|
+
rm -f "$CRED"
|
|
44
|
+
if [[ "$cred_age" != "-" ]]; then
|
|
45
|
+
: > "$CRED"
|
|
46
|
+
touch -d "@$(( now - cred_age ))" "$CRED"
|
|
47
|
+
fi
|
|
48
|
+
|
|
49
|
+
rm -f "$HIST"
|
|
50
|
+
out="$( cd "$SANDBOX" && env "${DK_UNSET[@]}" DELEGATION_KIT_USAGE_HISTORY="$HIST" bash "$GATE" "$USAGE" "$CRED" 2>&1 )"; rc=$?
|
|
51
|
+
ran=$((ran + 1))
|
|
52
|
+
|
|
53
|
+
if [[ "$rc" -ne "$want" ]]; then
|
|
54
|
+
echo " FAIL [$desc]: want exit $want, got $rc -- $out"
|
|
55
|
+
fails=$((fails + 1)); continue
|
|
56
|
+
fi
|
|
57
|
+
if ! grep -qF -- "-> $verdict" <<<"$out"; then
|
|
58
|
+
echo " FAIL [$desc]: output missing verdict '-> $verdict': $out"
|
|
59
|
+
fails=$((fails + 1)); continue
|
|
60
|
+
fi
|
|
61
|
+
if ! grep -qF -- "width=2 " <<<"$out"; then
|
|
62
|
+
echo " FAIL [$desc]: verdict line dropped the fan-width field (default 2): $out"
|
|
63
|
+
fails=$((fails + 1)); continue
|
|
64
|
+
fi
|
|
65
|
+
if [[ "$axis" != "-" ]]; then
|
|
66
|
+
case "$axis" in
|
|
67
|
+
5h) grep -qF -- "5h window" <<<"$out" || { echo " FAIL [$desc]: PAUSE did not name the 5h axis: $out"; fails=$((fails + 1)); continue; } ;;
|
|
68
|
+
7d) grep -qF -- "7-day window" <<<"$out" || { echo " FAIL [$desc]: PAUSE did not name the 7-day axis: $out"; fails=$((fails + 1)); continue; } ;;
|
|
69
|
+
esac
|
|
70
|
+
fi
|
|
71
|
+
|
|
72
|
+
got_lines=0
|
|
73
|
+
[[ -f "$HIST" ]] && got_lines="$(grep -c '' "$HIST")"
|
|
74
|
+
if [[ "$got_lines" -ne "$append" ]]; then
|
|
75
|
+
echo " FAIL [$desc]: want $append appended sample(s), got $got_lines"
|
|
76
|
+
fails=$((fails + 1)); continue
|
|
77
|
+
fi
|
|
78
|
+
if [[ "$append" -eq 1 ]]; then
|
|
79
|
+
if [[ "$pct_7d" != "-" ]]; then
|
|
80
|
+
grep -qF -- "pct_7d=" "$HIST" || { echo " FAIL [$desc]: sample line dropped the passed-through pct_7d: $(cat "$HIST")"; fails=$((fails + 1)); continue; }
|
|
81
|
+
else
|
|
82
|
+
grep -qF -- "pct_7d=" "$HIST" && { echo " FAIL [$desc]: sample line invented a pct_7d from a three-line snapshot: $(cat "$HIST")"; fails=$((fails + 1)); continue; }
|
|
83
|
+
fi
|
|
84
|
+
fi
|
|
85
|
+
done < "$CASES"
|
|
86
|
+
|
|
87
|
+
# spec: delegation-kit/SPEC.md §usage-verdict — the width field tracks DELEGATION_KIT_FAN_WIDTH, not a literal
|
|
88
|
+
{
|
|
89
|
+
printf 'five_hour_used_pct=40\n'
|
|
90
|
+
printf 'five_hour_resets_at=%s\n' "$(( now + 3600 ))"
|
|
91
|
+
printf 'updated_at=%s\n' "$now"
|
|
92
|
+
} > "$USAGE"
|
|
93
|
+
rm -f "$CRED"
|
|
94
|
+
wout="$( cd "$SANDBOX" && env "${DK_UNSET[@]}" DELEGATION_KIT_FAN_WIDTH=7 bash "$GATE" "$USAGE" "$CRED" 2>&1 )"
|
|
95
|
+
ran=$((ran + 1))
|
|
96
|
+
if ! grep -qF -- "width=7 " <<<"$wout"; then
|
|
97
|
+
echo " FAIL [fan-width knob override]: width field did not track DELEGATION_KIT_FAN_WIDTH=7: $wout"
|
|
98
|
+
fails=$((fails + 1))
|
|
99
|
+
fi
|
|
100
|
+
|
|
101
|
+
# spec: delegation-kit/SPEC.md §usage-verdict — demand-driven refresh: armed/fail-soft/short-circuit, each proved through a stub REFRESH_CMD (a real poll would need the network)
|
|
102
|
+
STUB="$SANDBOX/refresh-stub.sh"
|
|
103
|
+
STAMP="$SANDBOX/refresh-ran"
|
|
104
|
+
|
|
105
|
+
seed_snapshot() {
|
|
106
|
+
{
|
|
107
|
+
printf 'five_hour_used_pct=%s\n' "$1"
|
|
108
|
+
printf 'five_hour_resets_at=%s\n' "$(( now + 3600 ))"
|
|
109
|
+
printf 'updated_at=%s\n' "$(( now - $2 ))"
|
|
110
|
+
} > "$USAGE"
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
rm -f "$CRED"
|
|
114
|
+
|
|
115
|
+
cat > "$STUB" <<STUBEOF
|
|
116
|
+
#!/usr/bin/env bash
|
|
117
|
+
touch "$STAMP"
|
|
118
|
+
{
|
|
119
|
+
printf 'five_hour_used_pct=95\n'
|
|
120
|
+
printf 'five_hour_resets_at=$(( now + 3600 ))\n'
|
|
121
|
+
printf 'updated_at=$now\n'
|
|
122
|
+
} > "$USAGE.tmp" && mv "$USAGE.tmp" "$USAGE"
|
|
123
|
+
STUBEOF
|
|
124
|
+
|
|
125
|
+
seed_snapshot 40 1200
|
|
126
|
+
rm -f "$STAMP"
|
|
127
|
+
rout="$( cd "$SANDBOX" && env "${DK_UNSET[@]}" DELEGATION_KIT_REFRESH_CMD="bash $STUB" bash "$GATE" "$USAGE" "$CRED" 2>&1 )"
|
|
128
|
+
ran=$((ran + 1))
|
|
129
|
+
if [[ ! -f "$STAMP" ]]; then
|
|
130
|
+
echo " FAIL [refresh-armed-stale]: a stale snapshot did not invoke DELEGATION_KIT_REFRESH_CMD"
|
|
131
|
+
fails=$((fails + 1))
|
|
132
|
+
elif ! grep -qF -- "used=95%" <<<"$rout"; then
|
|
133
|
+
echo " FAIL [refresh-armed-stale]: verdict read the cached pct, not the refreshed one: $rout"
|
|
134
|
+
fails=$((fails + 1))
|
|
135
|
+
fi
|
|
136
|
+
|
|
137
|
+
cat > "$STUB" <<'STUBEOF'
|
|
138
|
+
#!/usr/bin/env bash
|
|
139
|
+
echo "usage-poller: fetch failed" >&2
|
|
140
|
+
exit 1
|
|
141
|
+
STUBEOF
|
|
142
|
+
|
|
143
|
+
seed_snapshot 40 1200
|
|
144
|
+
before="$(cat "$USAGE")"
|
|
145
|
+
fout="$( cd "$SANDBOX" && env "${DK_UNSET[@]}" DELEGATION_KIT_REFRESH_CMD="bash $STUB" bash "$GATE" "$USAGE" "$CRED" 2>&1 )"; frc=$?
|
|
146
|
+
ran=$((ran + 1))
|
|
147
|
+
if [[ "$(cat "$USAGE")" != "$before" ]]; then
|
|
148
|
+
echo " FAIL [refresh-fail-soft]: a failed refresh mutated the snapshot"
|
|
149
|
+
fails=$((fails + 1))
|
|
150
|
+
elif [[ "$frc" -ne 2 ]] || ! grep -qF -- "-> STALE" <<<"$fout"; then
|
|
151
|
+
echo " FAIL [refresh-fail-soft]: want the cached snapshot judged STALE by the existing staleness machinery, got exit $frc -- $fout"
|
|
152
|
+
fails=$((fails + 1))
|
|
153
|
+
elif grep -qF -- "fetch failed" <<<"$fout"; then
|
|
154
|
+
echo " FAIL [refresh-fail-soft]: refresh diagnostics leaked into the verdict output (callers relay this line verbatim): $fout"
|
|
155
|
+
fails=$((fails + 1))
|
|
156
|
+
fi
|
|
157
|
+
|
|
158
|
+
cat > "$STUB" <<STUBEOF
|
|
159
|
+
#!/usr/bin/env bash
|
|
160
|
+
touch "$STAMP"
|
|
161
|
+
STUBEOF
|
|
162
|
+
|
|
163
|
+
seed_snapshot 40 0
|
|
164
|
+
rm -f "$STAMP"
|
|
165
|
+
sout="$( cd "$SANDBOX" && env "${DK_UNSET[@]}" DELEGATION_KIT_REFRESH_CMD="bash $STUB" bash "$GATE" "$USAGE" "$CRED" 2>&1 )"
|
|
166
|
+
ran=$((ran + 1))
|
|
167
|
+
if [[ -f "$STAMP" ]]; then
|
|
168
|
+
echo " FAIL [refresh-skip-fresh]: a snapshot under REFRESH_MIN_AGE (default 60s) still invoked the refresh — the render path would hammer the source: $sout"
|
|
169
|
+
fails=$((fails + 1))
|
|
170
|
+
fi
|
|
171
|
+
|
|
172
|
+
# spec: delegation-kit/SPEC.md §usage-verdict — the roll witnesses need a pre-seeded history tail the table's columns cannot express, so they are asserted beside it: both witnesses disarm the login reroute, either alone does not, and an unusable tail falls open to it
|
|
173
|
+
roll_case() {
|
|
174
|
+
local desc="$1" tail_line="$2" want_rc="$3" want_verdict="$4"
|
|
175
|
+
{
|
|
176
|
+
printf 'five_hour_used_pct=3\n'
|
|
177
|
+
printf 'five_hour_resets_at=%s\n' "$(( now + 18000 ))"
|
|
178
|
+
printf 'updated_at=%s\n' "$now"
|
|
179
|
+
} > "$USAGE"
|
|
180
|
+
: > "$CRED"
|
|
181
|
+
touch -d "@$(( now - 60 ))" "$CRED"
|
|
182
|
+
rm -f "$HIST"
|
|
183
|
+
[[ -n "$tail_line" ]] && printf '%s\n' "$tail_line" > "$HIST"
|
|
184
|
+
local out rc
|
|
185
|
+
out="$( cd "$SANDBOX" && env "${DK_UNSET[@]}" DELEGATION_KIT_USAGE_HISTORY="$HIST" bash "$GATE" "$USAGE" "$CRED" 2>&1 )"; rc=$?
|
|
186
|
+
ran=$((ran + 1))
|
|
187
|
+
if [[ "$rc" -ne "$want_rc" ]] || ! grep -qF -- "-> $want_verdict" <<<"$out"; then
|
|
188
|
+
echo " FAIL [$desc]: want exit $want_rc and '-> $want_verdict', got exit $rc -- $out"
|
|
189
|
+
fails=$((fails + 1))
|
|
190
|
+
fi
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
prev_boundary_crossed=$(( now - 3600 ))
|
|
194
|
+
|
|
195
|
+
roll_case "roll-witnesses-disarm-reroute" \
|
|
196
|
+
"updated_at=$(( now - 7200 )) pct=86.0 resets_at=${prev_boundary_crossed} verdict=PAUSE login_at=0" \
|
|
197
|
+
0 OK
|
|
198
|
+
roll_case "roll-witness-boundary-unmoved" \
|
|
199
|
+
"updated_at=$(( now - 60 )) pct=86.0 resets_at=$(( now + 18000 )) verdict=PAUSE login_at=0" \
|
|
200
|
+
2 STALE
|
|
201
|
+
roll_case "roll-witness-uncrossed-boundary" \
|
|
202
|
+
"updated_at=$(( now - 60 )) pct=86.0 resets_at=$(( now + 900 )) verdict=PAUSE login_at=0" \
|
|
203
|
+
2 STALE
|
|
204
|
+
roll_case "roll-witness-malformed-tail" \
|
|
205
|
+
"updated_at=$(( now - 7200 )) pct=86.0 resets_at=notanepoch verdict=PAUSE login_at=0" \
|
|
206
|
+
2 STALE
|
|
207
|
+
roll_case "roll-witness-absent-history" "" 2 STALE
|
|
208
|
+
|
|
209
|
+
# spec: delegation-kit/SPEC.md §usage-verdict — the witness reads the *previous* sample, never the one this run appends: a first-ever sample cannot disarm its own reroute
|
|
210
|
+
rm -f "$HIST"
|
|
211
|
+
roll_case "roll-witness-not-self-witnessing" "" 2 STALE
|
|
212
|
+
[[ "$(grep -c '' "$HIST" 2>/dev/null || echo 0)" -eq 1 ]] || {
|
|
213
|
+
echo " FAIL [roll-witness-not-self-witnessing]: the run did not leave exactly its own sample behind"
|
|
214
|
+
fails=$((fails + 1))
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
if [[ "$ran" -eq 0 ]]; then
|
|
218
|
+
echo "run-usage-tests: no cases parsed from $CASES" >&2
|
|
219
|
+
exit 2
|
|
220
|
+
fi
|
|
221
|
+
if [[ "$fails" -gt 0 ]]; then
|
|
222
|
+
echo "run-usage-tests: $fails/$ran case(s) failed"
|
|
223
|
+
exit 1
|
|
224
|
+
fi
|
|
225
|
+
echo "run-usage-tests: ok ($ran cases across the OK/PAUSE/STALE/RESET-OK verdict table, both pause axes and their at-or-over boundaries, the login reroute in both directions (it suppresses an OK, never a PAUSE), the fan-width field, the roll witnesses that disarm it, the demand-driven refresh (armed/fail-soft/short-circuit), and the sample-append discipline)"
|
|
226
|
+
exit 0
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# spec: delegation-kit/SPEC.md §Trend reporter — footprint evolution from the usage-history log
|
|
3
|
+
# usage: usage-trend.sh [history-file] ($1 overrides the configured path, for test injection)
|
|
4
|
+
# exit: 0 report emitted, 2 knob unset or history missing/unreadable (never 1 — it renders no verdict; usage-verdict stays the sole pause authority)
|
|
5
|
+
set -uo pipefail
|
|
6
|
+
|
|
7
|
+
KIT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
8
|
+
# shellcheck source=../lib/delegation.sh
|
|
9
|
+
source "$KIT/lib/delegation.sh"
|
|
10
|
+
|
|
11
|
+
HISTORY="${1:-$DELEGATION_KIT_USAGE_HISTORY}"
|
|
12
|
+
PAUSE_PCT_7D="$DELEGATION_KIT_PAUSE_PCT_7D"
|
|
13
|
+
|
|
14
|
+
if [[ -z "$HISTORY" ]]; then
|
|
15
|
+
echo "usage-trend: DELEGATION_KIT_USAGE_HISTORY unset — no history to report (enable sampling first)" >&2
|
|
16
|
+
exit 2
|
|
17
|
+
fi
|
|
18
|
+
if [[ ! -r "$HISTORY" ]]; then
|
|
19
|
+
echo "usage-trend: cannot read history $HISTORY" >&2
|
|
20
|
+
exit 2
|
|
21
|
+
fi
|
|
22
|
+
|
|
23
|
+
# spec: delegation-kit/SPEC.md §Trend reporter — one axis record per sample (5h always, weekly when both seven_day keys ride), sorted into segments downstream
|
|
24
|
+
records="$(awk '
|
|
25
|
+
/^[[:space:]]*$/ { next }
|
|
26
|
+
{
|
|
27
|
+
delete kv
|
|
28
|
+
for (i = 1; i <= NF; i++) {
|
|
29
|
+
eq = index($i, "=")
|
|
30
|
+
if (eq > 0) kv[substr($i, 1, eq - 1)] = substr($i, eq + 1)
|
|
31
|
+
}
|
|
32
|
+
acct = ("account" in kv) ? kv["account"] : "-"
|
|
33
|
+
tier = ("tier" in kv) ? kv["tier"] : "-"
|
|
34
|
+
login = ("login_at" in kv) ? kv["login_at"] : 0
|
|
35
|
+
verdict = ("verdict" in kv) ? kv["verdict"] : "-"
|
|
36
|
+
tin = ("tokens_in" in kv) ? kv["tokens_in"] : "-"
|
|
37
|
+
tout = ("tokens_out" in kv) ? kv["tokens_out"] : "-"
|
|
38
|
+
if (("pct" in kv) && ("resets_at" in kv) && ("updated_at" in kv))
|
|
39
|
+
printf "5h\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n", acct, tier, login, kv["resets_at"], kv["updated_at"], kv["pct"], verdict, tin, tout
|
|
40
|
+
if (("pct_7d" in kv) && ("resets_7d" in kv) && ("updated_at" in kv))
|
|
41
|
+
printf "7d\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n", acct, tier, login, kv["resets_7d"], kv["updated_at"], kv["pct_7d"], verdict, tin, tout
|
|
42
|
+
}
|
|
43
|
+
' "$HISTORY" | LC_ALL=C sort -t"$(printf '\t')" -k2,2 -k1,1 -k3,3 -k4,4n -k5,5n -k6,6n)"
|
|
44
|
+
|
|
45
|
+
if [[ -z "$records" ]]; then
|
|
46
|
+
echo "usage-trend: no parseable samples in $HISTORY (0 segments)"
|
|
47
|
+
exit 0
|
|
48
|
+
fi
|
|
49
|
+
|
|
50
|
+
printf '%s\n' "$records" | awk -F'\t' -v pause7="$PAUSE_PCT_7D" '
|
|
51
|
+
function med3(a, b, c, x, y, z, t) {
|
|
52
|
+
x = a; y = b; z = c
|
|
53
|
+
if (x > y) { t = x; x = y; y = t }
|
|
54
|
+
if (y > z) { t = y; y = z; z = t }
|
|
55
|
+
if (x > y) { t = x; x = y; y = t }
|
|
56
|
+
return y
|
|
57
|
+
}
|
|
58
|
+
function flush( i, j, n, sp, runmax, susp, nsusp, fi, li, hours, rate, first, last, hdr, hh, tdelta, ratefmt) {
|
|
59
|
+
n = cnt
|
|
60
|
+
if (n == 0) return
|
|
61
|
+
for (i = 1; i <= n; i++) {
|
|
62
|
+
if (n == 1 || i == 1 || i == n) sp[i] = p[i]
|
|
63
|
+
else sp[i] = med3(p[i-1], p[i], p[i+1])
|
|
64
|
+
}
|
|
65
|
+
nsusp = 0; runmax = p[1]
|
|
66
|
+
for (i = 1; i <= n; i++) susp[i] = 0
|
|
67
|
+
for (i = 2; i <= n; i++) {
|
|
68
|
+
if (p[i] < runmax) {
|
|
69
|
+
susp[i] = 1
|
|
70
|
+
for (j = 1; j < i; j++) if (p[j] > p[i]) susp[j] = 1
|
|
71
|
+
}
|
|
72
|
+
if (p[i] > runmax) runmax = p[i]
|
|
73
|
+
}
|
|
74
|
+
fi = 0; li = 0
|
|
75
|
+
for (i = 1; i <= n; i++) if (!susp[i]) { if (fi == 0) fi = i; li = i; }
|
|
76
|
+
for (i = 1; i <= n; i++) nsusp += susp[i]
|
|
77
|
+
if (fi == 0) { fi = 1; li = n } # every sample suspect — fall back to the raw span so the segment still reports
|
|
78
|
+
first = sp[fi]; last = sp[li]
|
|
79
|
+
hours = (u[li] - u[fi]) / 3600.0
|
|
80
|
+
if (hours > 0) { rate = (last - first) / hours; ratefmt = sprintf("%+.2f%%/h", rate) }
|
|
81
|
+
else { rate = 0; ratefmt = "n/a (single reading)" }
|
|
82
|
+
|
|
83
|
+
if (seg_acct != last_acct) {
|
|
84
|
+
if (seg_acct == "-") printf "\naccount: (unstamped)\n"
|
|
85
|
+
else printf "\naccount %s\n", seg_acct
|
|
86
|
+
last_acct = seg_acct
|
|
87
|
+
}
|
|
88
|
+
printf " [%s] reset@%s tier=%s: %.1f%%->%.1f%% over %.2fh, %s, %d sample(s), %d suspect\n",
|
|
89
|
+
seg_axis, seg_reset, seg_tier, first, last, hours, ratefmt, n, nsusp
|
|
90
|
+
if (tin[li] != "-" && tin[fi] != "-") {
|
|
91
|
+
tdelta = tin[li] - tin[fi]
|
|
92
|
+
printf " tokens: +%d in / +%d out over the segment\n", tdelta, (tout[li] - tout[fi])
|
|
93
|
+
}
|
|
94
|
+
if (seg_axis == "7d") {
|
|
95
|
+
hdr = pause7 - last
|
|
96
|
+
if (rate > 0) { hh = hdr / rate; printf " weekly headroom: %.1f%% to the %s%% ceiling (~%.1fh at current rate)\n", hdr, pause7, hh }
|
|
97
|
+
else printf " weekly headroom: %.1f%% to the %s%% ceiling (rate flat/negative — no depletion trend)\n", hdr, pause7
|
|
98
|
+
}
|
|
99
|
+
if (firstpause != "") { printf " first PAUSE onset at epoch %s\n", firstpause }
|
|
100
|
+
cnt = 0; firstpause = ""
|
|
101
|
+
}
|
|
102
|
+
{
|
|
103
|
+
key = $1 "|" $2 "|" $3 "|" $4 "|" $5
|
|
104
|
+
if (NR == 1) { curkey = key }
|
|
105
|
+
if (key != curkey) { flush(); curkey = key }
|
|
106
|
+
seg_axis = $1; seg_acct = $2; seg_tier = $3; seg_login = $4; seg_reset = $5
|
|
107
|
+
cnt++
|
|
108
|
+
u[cnt] = $6; p[cnt] = $7
|
|
109
|
+
tin[cnt] = $9; tout[cnt] = $10
|
|
110
|
+
if ($8 == "PAUSE" && firstpause == "") firstpause = $6
|
|
111
|
+
}
|
|
112
|
+
BEGIN { last_acct = "\0"; cnt = 0; firstpause = "" }
|
|
113
|
+
END { flush() }
|
|
114
|
+
' | {
|
|
115
|
+
segs="$(cat)"
|
|
116
|
+
n_samples="$(printf '%s\n' "$records" | grep -c '')"
|
|
117
|
+
echo "usage-trend: $n_samples axis-record(s) across the 5h/weekly segments"
|
|
118
|
+
printf '%s\n' "$segs"
|
|
119
|
+
}
|
|
120
|
+
exit 0
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# spec: delegation-kit/SPEC.md §usage-verdict — trustworthy budget verdict from usage.txt
|
|
3
|
+
# usage: usage-verdict.sh [usage-file [credentials-file]] ($1/$2 override paths for test injection)
|
|
4
|
+
# exit: 0 OK / RESET-OK, 1 PAUSE, 2 STALE or unreadable (budget unknown, never blocks)
|
|
5
|
+
set -euo pipefail
|
|
6
|
+
|
|
7
|
+
KIT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
8
|
+
# shellcheck source=../lib/delegation.sh
|
|
9
|
+
source "$KIT/lib/delegation.sh"
|
|
10
|
+
|
|
11
|
+
USAGE_FILE="${1:-$DELEGATION_KIT_USAGE_FILE}"
|
|
12
|
+
CRED_FILE="${2:-$DELEGATION_KIT_CRED_FILE}"
|
|
13
|
+
PAUSE_PCT="$DELEGATION_KIT_PAUSE_PCT"
|
|
14
|
+
PAUSE_PCT_7D="$DELEGATION_KIT_PAUSE_PCT_7D"
|
|
15
|
+
STALE_AGE="$DELEGATION_KIT_STALE_AGE"
|
|
16
|
+
LOGIN_WINDOW="$DELEGATION_KIT_LOGIN_WINDOW"
|
|
17
|
+
HISTORY="$DELEGATION_KIT_USAGE_HISTORY"
|
|
18
|
+
WIDTH="$DELEGATION_KIT_FAN_WIDTH"
|
|
19
|
+
REFRESH_CMD="$DELEGATION_KIT_REFRESH_CMD"
|
|
20
|
+
REFRESH_MIN_AGE="$DELEGATION_KIT_REFRESH_MIN_AGE"
|
|
21
|
+
|
|
22
|
+
# spec: delegation-kit/SPEC.md §usage-verdict — demand-driven refresh: the verdict call is the trigger, short-circuited under REFRESH_MIN_AGE so the render path cannot hammer the source; fail-soft, the snapshot's own staleness judges the result
|
|
23
|
+
if [[ -n "$REFRESH_CMD" ]]; then
|
|
24
|
+
refresh=1
|
|
25
|
+
if [[ -r "$USAGE_FILE" ]]; then
|
|
26
|
+
snap_updated="$(awk -F= '$1 == "updated_at" { print $2; exit }' "$USAGE_FILE" 2>/dev/null || true)"
|
|
27
|
+
if [[ "$snap_updated" =~ ^[0-9]+$ ]] && (( $(date +%s) - snap_updated < REFRESH_MIN_AGE )); then
|
|
28
|
+
refresh=0
|
|
29
|
+
fi
|
|
30
|
+
fi
|
|
31
|
+
if (( refresh )); then
|
|
32
|
+
bash -c "$REFRESH_CMD" >/dev/null 2>&1 || true
|
|
33
|
+
fi
|
|
34
|
+
fi
|
|
35
|
+
|
|
36
|
+
if [[ ! -r "$USAGE_FILE" ]]; then
|
|
37
|
+
echo "usage-verdict: cannot read $USAGE_FILE width=${WIDTH} -> STALE (never blocks delegation — re-read or refresh before trusting the number)"
|
|
38
|
+
exit 2
|
|
39
|
+
fi
|
|
40
|
+
|
|
41
|
+
pct="" ; resets_at="" ; updated_at=""
|
|
42
|
+
pct_7d="" ; resets_7d="" ; account="" ; tier="" ; tokens_in="" ; tokens_out=""
|
|
43
|
+
while IFS='=' read -r key val; do
|
|
44
|
+
case "$key" in
|
|
45
|
+
five_hour_used_pct) pct="$val" ;;
|
|
46
|
+
five_hour_resets_at) resets_at="$val" ;;
|
|
47
|
+
updated_at) updated_at="$val" ;;
|
|
48
|
+
seven_day_used_pct) pct_7d="$val" ;;
|
|
49
|
+
seven_day_resets_at) resets_7d="$val" ;;
|
|
50
|
+
account) account="$val" ;;
|
|
51
|
+
tier) tier="$val" ;;
|
|
52
|
+
tokens_in) tokens_in="$val" ;;
|
|
53
|
+
tokens_out) tokens_out="$val" ;;
|
|
54
|
+
esac
|
|
55
|
+
done < "$USAGE_FILE"
|
|
56
|
+
|
|
57
|
+
if [[ -z "$pct" || -z "$resets_at" || -z "$updated_at" ]]; then
|
|
58
|
+
echo "usage-verdict: missing key(s) in $USAGE_FILE (pct='$pct' resets_at='$resets_at' updated_at='$updated_at') width=${WIDTH} -> STALE (never blocks delegation — re-read or refresh before trusting the number)"
|
|
59
|
+
exit 2
|
|
60
|
+
fi
|
|
61
|
+
|
|
62
|
+
if [[ ! "$pct" =~ ^[0-9]+(\.[0-9]+)?$ ]]; then
|
|
63
|
+
echo "usage-verdict: non-numeric five_hour_used_pct='$pct' in $USAGE_FILE width=${WIDTH} -> STALE (never blocks delegation — re-read or refresh before trusting the number)"
|
|
64
|
+
exit 2
|
|
65
|
+
fi
|
|
66
|
+
|
|
67
|
+
now=$(date +%s)
|
|
68
|
+
age=$(( now - updated_at ))
|
|
69
|
+
resets_in=$(( resets_at - now ))
|
|
70
|
+
|
|
71
|
+
# spec: delegation-kit/SPEC.md §usage-verdict — login_at dates the last auth event; read once for the reroute and the sample line
|
|
72
|
+
login_at=0
|
|
73
|
+
if [[ -r "$CRED_FILE" ]]; then
|
|
74
|
+
login_at=$(stat -c %Y "$CRED_FILE" 2>/dev/null || echo 0)
|
|
75
|
+
fi
|
|
76
|
+
|
|
77
|
+
# spec: delegation-kit/SPEC.md §usage-verdict — the roll witnesses: read the newest sample's boundary before any append of this run's own, so the reroute is judged against the previous reading, never against itself
|
|
78
|
+
prev_resets_at=""
|
|
79
|
+
if [[ -n "$HISTORY" && -r "$HISTORY" ]]; then
|
|
80
|
+
prev_resets_at="$(tail -n 1 "$HISTORY" 2>/dev/null | awk '{ for (i = 1; i <= NF; i++) if ($i ~ /^resets_at=/) { sub(/^resets_at=/, "", $i); print $i; exit } }' || true)"
|
|
81
|
+
fi
|
|
82
|
+
rolled=0
|
|
83
|
+
if [[ "$prev_resets_at" =~ ^[0-9]+$ ]] && (( resets_at != prev_resets_at && updated_at > prev_resets_at )); then
|
|
84
|
+
rolled=1
|
|
85
|
+
fi
|
|
86
|
+
|
|
87
|
+
# spec: delegation-kit/SPEC.md §The usage.txt contract — the sample line is the trend log's wire contract: raw values verbatim, optional keys omitted (never empty) when their source is absent
|
|
88
|
+
append_sample() {
|
|
89
|
+
local verdict="$1" line
|
|
90
|
+
[[ -n "$HISTORY" ]] || return 0
|
|
91
|
+
line="updated_at=${updated_at} pct=${pct} resets_at=${resets_at} verdict=${verdict} login_at=${login_at}"
|
|
92
|
+
[[ -n "$account" ]] && line+=" account=${account}"
|
|
93
|
+
[[ -n "$tier" ]] && line+=" tier=${tier}"
|
|
94
|
+
[[ -n "$pct_7d" && -n "$resets_7d" ]] && line+=" pct_7d=${pct_7d} resets_7d=${resets_7d}"
|
|
95
|
+
[[ -n "$tokens_in" && -n "$tokens_out" ]] && line+=" tokens_in=${tokens_in} tokens_out=${tokens_out}"
|
|
96
|
+
mkdir -p "$(dirname "$HISTORY")" 2>/dev/null || true
|
|
97
|
+
printf '%s\n' "$line" >> "$HISTORY"
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (( resets_in <= 0 )); then
|
|
101
|
+
append_sample RESET-OK
|
|
102
|
+
echo "used=${pct}% age=${age}s resets_in=${resets_in}s width=${WIDTH} -> RESET-OK (window rolled over ${resets_in#-}s ago; pct is from the dead window, re-read for the live value)"
|
|
103
|
+
exit 0
|
|
104
|
+
fi
|
|
105
|
+
|
|
106
|
+
if (( age > STALE_AGE )); then
|
|
107
|
+
append_sample STALE
|
|
108
|
+
echo "used=${pct}% age=${age}s resets_in=${resets_in}s width=${WIDTH} -> STALE (reading older than ${STALE_AGE}s; pct may lag reality; never blocks delegation — re-read or refresh before trusting the number)"
|
|
109
|
+
exit 2
|
|
110
|
+
fi
|
|
111
|
+
|
|
112
|
+
# spec: delegation-kit/SPEC.md §usage-verdict — two pause axes judged independently; the weekly axis arms only when both seven_day keys are present and its window is live
|
|
113
|
+
pause_5h=0
|
|
114
|
+
awk -v p="$pct" -v t="$PAUSE_PCT" 'BEGIN { exit !(p >= t) }' && pause_5h=1
|
|
115
|
+
|
|
116
|
+
pause_7d=0
|
|
117
|
+
if [[ -n "$pct_7d" && -n "$resets_7d" && "$pct_7d" =~ ^[0-9]+(\.[0-9]+)?$ && "$resets_7d" =~ ^-?[0-9]+$ ]]; then
|
|
118
|
+
if (( resets_7d - now > 0 )); then
|
|
119
|
+
awk -v p="$pct_7d" -v t="$PAUSE_PCT_7D" 'BEGIN { exit !(p >= t) }' && pause_7d=1
|
|
120
|
+
fi
|
|
121
|
+
fi
|
|
122
|
+
|
|
123
|
+
if (( pause_5h || pause_7d )); then
|
|
124
|
+
append_sample PAUSE
|
|
125
|
+
if (( pause_7d )); then
|
|
126
|
+
echo "used=${pct}% (7d ${pct_7d}%) age=${age}s resets_in=${resets_in}s width=${WIDTH} -> PAUSE (7-day window; at or over ${PAUSE_PCT_7D}% of the live weekly window — remediation is days, not hours)"
|
|
127
|
+
else
|
|
128
|
+
echo "used=${pct}% age=${age}s resets_in=${resets_in}s width=${WIDTH} -> PAUSE (5h window; at or over ${PAUSE_PCT}% of the live 5h window)"
|
|
129
|
+
fi
|
|
130
|
+
exit 1
|
|
131
|
+
fi
|
|
132
|
+
|
|
133
|
+
# spec: delegation-kit/SPEC.md §usage-verdict — the reroute follows the axis compares and may suppress only the non-blocking outcome: a lagging under-threshold pct still cannot print a fresh-looking OK, while an over-threshold reading inside the window still blocks
|
|
134
|
+
# spec: delegation-kit/SPEC.md §usage-verdict — and a demonstrated roll refutes the reroute's lagging-reading premise, so the witnesses disarm it: a low pct after the window turned over is the expected reading, not a suspect one
|
|
135
|
+
cred_age=$(( now - login_at ))
|
|
136
|
+
if (( login_at > 0 && cred_age >= 0 && cred_age < LOGIN_WINDOW && ! rolled )); then
|
|
137
|
+
append_sample STALE
|
|
138
|
+
echo "used=${pct}% age=${age}s resets_in=${resets_in}s width=${WIDTH} -> STALE (auth changed ${cred_age}s ago; a /login starts fresh windows the server-fed pct lags; never blocks delegation — re-read or refresh before trusting the number)"
|
|
139
|
+
exit 2
|
|
140
|
+
fi
|
|
141
|
+
|
|
142
|
+
append_sample OK
|
|
143
|
+
echo "used=${pct}% age=${age}s resets_in=${resets_in}s width=${WIDTH} -> OK"
|
|
144
|
+
exit 0
|