✨ feat(guard): every onboarded repository gets the shared Guard, and one without work rules its refusals alone
Slice: #485
Every onboarded repository gets the shared Guard's caller, not only work-rules ones. Alok, 2026-11-19: "Every onboarded repo should get the Guard, not just work-rules ones." This replaces #482's assumption.
What changes
onboardwrites.github/workflows/niyam-guard.ymlwhatever the features, identity alone included.callerWantedis gone. A public repository gets thepull_request_targetpolicy step whatever its features.doctorchecks the caller in every onboarded repository.- Where there is no
niyam.ymlto pin a release or name a branch, it checks the caller's shape alone:✓ … calls the shared Guard at vX, as onboard writes it. - Settings it cannot parse no longer skip the check.
- Where there is no
scripts/guard.mjs:workRulesIn(settings)readsfeaturesfrom the default branch's.github/niyam.json. Withoutwork-rules,judgegets anunjudgedlist.
How a repository without work rules is judged (Alok chose "Refusals only"; asked in the session that built this)
- Such a repository has no Work items, so no slice can name a change. Guard judges no slice there.
- It logs each change a slice would have had to name: a guard file, the scripts of
package.json, a test file deleted or left with fewer tests or more skipped. - It still refuses what no slice passes:
- a workflow job added under the name of a check the default branch's ruleset requires;
- a job that could report
niyam-guard / judgebut is not onboard's caller; - a pull request with more files than GitHub lists.
- With
work-ruleson, or with nofeatureslisted (every feature on), it judges every change as before. Afeaturesvalue it cannot read refuses (fail closed).
Needs you, Alok
- #485 is a new slice under Work item #468, filed after #468's approval. For such a slice, Guard counts its Guards: from your first unedited
Decision:comment written since it joined, on #485 or on #468 naming #485 (approvedAtinscripts/guard.mjs). This pull request's change toscripts/guard.mjspasses Guard once you write one, for exampleDecision: #485 as written.on #485. Then edit or push the pull request so Guard runs again. scripts/guard.mjsand its tests are yours in CODEOWNERS, so this pull request also waits for your review.
After release: a client onboarded at 0.7.4 without work-rules gets doctor's ✗ until onboard runs again.
Evidence
pnpm checkpasses: 2117 CLI tests and 97 script tests, 0 failures, typecheck and lint clean. Lines covered:guard.mjs100% (96.35% branches),guard-caller.ts100%,doctor.ts100%.- New and changed tests:
- onboard writes the caller with work rules off and with identity alone, and refuses a foreign one either way;
- a public repository without work rules gets the policy step;
- doctor checks the caller with work rules off, and its shape alone without
niyam.yml; - Guard, with work rules off, passes a hooks and
package.jsonscripts change with both logged and no slice or approval read; - Guard still refuses a job named after a required check;
- Guard judges slices with
work-ruleslisted (spaces trimmed) or no features listed, and fails closed on an unreadablefeatures.
🤖 Generated with Claude Code
Summary by cubic
Every onboarded repository now gets the shared Guard's caller: onboard writes .github/workflows/niyam-guard.yml whatever the features, doctor checks it everywhere, and callerWanted is gone. Where no niyam.yml pins a release, doctor checks the caller's shape alone.
In a repository without work rules, Guard judges no slice and logs each change a slice would have had to name; it still refuses what no slice passes — a job added under a required check's name, a caller that is not onboard's, a pull request with more files than GitHub lists. With work-rules on, or no features listed, it judges every change as before; a features value it cannot read, or a feature name it does not know, fails closed.
Migration