✨ feat: dvara runs niyam's git hooks and records gate from its pinned release

Merged
AT
18d ago
+1057-1

Slice: #296

niyam is now guarded by the released dvara it pins, never by a copy being changed (0114 spec, rule T-9; Work item #295).

What changes

  • package.json pins @veda-hq/dvara 0.5.16 exactly, as a devDependency. It resolves from the registry with an integrity hash.
  • .dvara.json turns on dvara's records and frozen gates. .dvara/records-baseline.json (tracked; the rest of .dvara/ is ignored) holds the two findings already in the tree: TruffleHog's file://$PWD in ci.yml and a .git/config mention in docs/decisions.md.
  • Tracked git hooks in .githooks/, run under the installed dvara:
    • pre-commit runs records and frozen on what is staged.
    • pre-push runs records and frozen on the branch, then scripts/released-pins.mjs. Last, for an agent session's push, it runs niyam pre-push with git's refs, as onboard's hook does. niyam onboard reads that "$cli" pre-push line as its own and leaves the file alone.
    • Both refuse, saying to run pnpm install, when the pinned dvara is not installed.
  • scripts/hooks-path.mjs (the prepare script) points core.hooksPath at .githooks from the main checkout's install only. That setting is shared by every worktree, so a worktree's install changes nothing and CI sets nothing. A hooksPath someone else set is left alone, with a note.
  • scripts/released-pins.mjs (pnpm pins, in pnpm check and pre-push) fails any @veda-hq/* pin in these cases:
    • it is not an exact version;
    • the lockfile entry is link:, file: or workspace:, or has no integrity hash, or comes from a tarball URL, a directory or git;
    • it is not installed at its version, or is linked from inside the checkout.
  • CI calls veda's shared checks, veda-hq/veda/.github/workflows/checks.yml@7c6fa9e56bb08afe56581c0e166d9700768d1a0b, with require: dvara,actionlint. That runs dvara's gates at the pinned version, and actionlint with ShellCheck 0.11.0.
  • pnpm test:scripts: tests for both scripts (100% lines and functions), and githooks.test.mjs, which runs the real hooks under git in a throwaway repo.

Checked locally: pnpm check passes. dvara records --base origin/main and dvara frozen --base origin/main pass. So does actionlint with ShellCheck 0.11.0 over every workflow, and ShellCheck over both hooks.

For Alok

  • Auto-merge: turned on at the owner's request; it merged once the checks passed.
  • Third-party packages: dvara brings mdast-util-from-markdown 2.0.3 and its tree into the lockfile, as dev-only packages.
  • One owner step after merge: add veda-checks / Checks to the main ruleset's required checks, so a dvara or actionlint refusal blocks a merge: niyam owner-step required-checks veda-hq/niyam main.
  • The hooks come on when you install: after this merges, git pull and pnpm install in your main niyam checkout turns them on. From then on, git runs .githooks/ in every worktree instead of .git/hooks/pre-push. A worktree on an older branch, with no .githooks/, then runs no pre-push hook until it merges main. The Claude Code niyam guard hook still checks its pushes.

🤖 Generated with Claude Code


Summary by cubic

Makes niyam's git hooks run under the released @veda-hq/dvara 0.5.16 it pins, never a copy being changed.

  • Adds tracked .githooks/ running dvara's records and frozen gates: pre-commit on staged changes, pre-push on the branch plus a check that every @veda-hq/* pin resolves from the registry with an integrity hash.
  • Adds scripts/released-pins.mjs (pnpm pins) failing exact-version, registry resolution, and installed-version checks; it's part of pnpm check and pre-push. pnpm check runs provenance ahead of pins, and own-provenance now covers the dvara pin, including its signature.
  • Prepares core.hooksPath from the main checkout's install only, so worktrees stay dormant and CI sets nothing.
  • CI calls veda's shared checks at a pinned commit with dvara and actionlint required.
  • Records baseline covers the two existing findings; dvara brings dev-only markdown packages into the lockfile.

Owner step after merge

  • Add veda-checks / Checks to the main ruleset's required checks so dvara or actionlint refusals block merges.