diff --git a/mnemion-js/package-lock.json b/mnemion-js/package-lock.json index 308ddc0..2aecf56 100644 --- a/mnemion-js/package-lock.json +++ b/mnemion-js/package-lock.json @@ -33,7 +33,7 @@ "@types/react-dom": "^19.2.0", "@vitejs/plugin-react": "^5.0.0", "ai": "^6.0.206", - "coherence-harness": "github:daniloc/coherence#v0.5.0", + "coherence-harness": "github:daniloc/coherence#v0.5.1", "concurrently": "^9.0.0", "typescript": "^6.0.3", "vite": "^8.0.16", @@ -4025,8 +4025,8 @@ } }, "node_modules/coherence-harness": { - "version": "0.5.0", - "resolved": "git+ssh://git@github.com/daniloc/coherence.git#1a164d5155d2b108a11363c1fea55ef946e65e78", + "version": "0.5.1", + "resolved": "git+ssh://git@github.com/daniloc/coherence.git#87009cd650657fededd0140865941dce06ba1b1c", "dev": true, "bin": { "coherence": "dist/cli.js" diff --git a/mnemion-js/package.json b/mnemion-js/package.json index 825218c..fcfb426 100644 --- a/mnemion-js/package.json +++ b/mnemion-js/package.json @@ -4,6 +4,7 @@ "private": true, "license": "MIT", "scripts": { + "prepare": "git config core.hooksPath mnemion-js/scripts/git-hooks || true", "build:pages": "vite build --config vite.fragment.ts", "build:web": "vite build --config vite.web.ts", "preview:render": "vite dev --config vite.preview.ts --open /render-preview.html", @@ -63,7 +64,7 @@ "@types/react-dom": "^19.2.0", "@vitejs/plugin-react": "^5.0.0", "ai": "^6.0.206", - "coherence-harness": "github:daniloc/coherence#v0.5.0", + "coherence-harness": "github:daniloc/coherence#v0.5.1", "concurrently": "^9.0.0", "typescript": "^6.0.3", "vite": "^8.0.16", diff --git a/mnemion-js/scripts/git-hooks/pre-push b/mnemion-js/scripts/git-hooks/pre-push new file mode 100755 index 0000000..c814d93 --- /dev/null +++ b/mnemion-js/scripts/git-hooks/pre-push @@ -0,0 +1,20 @@ +#!/bin/sh +# Block a push that would land STALE coherence docs. +# +# The committed docs/coherence/{graph.json,_graph.html} + AGENTS.md are derived +# from the spec tree + code; CI's `coherence:docs:check` fails if they drift. This +# hook moves that check left — to before the push leaves your machine — so the +# regenerate step is enforced by the tool, not remembered as a convention. +# +# With coherence >=0.5.1 the freshness gate ignores line numbers, so this fires +# ONLY on real structural drift (a new/removed/renamed symbol, import, component, +# claim, or boundary) committed without regenerating. Comment/line-shift edits +# pass silently. Installed via the `prepare` script (core.hooksPath); bypass a +# single push with `git push --no-verify` if you must. +cd "$(git rev-parse --show-toplevel)/mnemion-js" || exit 1 +if ! npm run --silent coherence:docs:check; then + echo "" + echo "✗ push blocked: coherence docs are stale (a structural change without a regenerate)." + echo " Fix: (cd mnemion-js && npm run coherence:docs) then commit docs/coherence/ + AGENTS.md." + exit 1 +fi