From 2daf0e0e119448e83e179bd0b96a1d71ce875b43 Mon Sep 17 00:00:00 2001 From: "ruleofcode.dev team" Date: Sat, 8 Aug 2026 14:26:09 +0300 Subject: [PATCH] =?UTF-8?q?chore(release):=20v7.17.5=20=E2=80=94=20worktre?= =?UTF-8?q?e-aware=20git=20detectors?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps package.json and hooks/installer VERSION to 7.17.5 and regenerates the tracked .husky hooks. schemaVersion stays 2. Ships the fix already on develop: three git laws joined `.git/hooks` and `.git/config` onto the project root, which finds nothing in a linked worktree — `/.git` is a pointer file there and the real config and hooks live in the main repository. A consumer hit it in a worktree whose husky hooks had just blocked a push; the same commit scored 100/100 in the primary checkout and 90/100 in the worktree. A shared resolver now asks git for the common dir and honours core.hooksPath, so husky's `.husky` layout is found too. Verified with real `git worktree add` fixtures. Gate: eslint 0, 503 suites / 13863 tests (jest exit 0), canary green (py100/ng136/node78). Self-audit: passed 35, failed 0. --- .husky/commit-msg | 6 +++--- .husky/pre-commit | 4 ++-- .husky/pre-push | 4 ++-- CHANGELOG.md | 26 ++++++++++++++++++++++++++ package.json | 2 +- src/hooks/installer.ts | 2 +- 6 files changed, 35 insertions(+), 9 deletions(-) diff --git a/.husky/commit-msg b/.husky/commit-msg index be93a78..c676911 100644 --- a/.husky/commit-msg +++ b/.husky/commit-msg @@ -1,4 +1,4 @@ -# RuleOfCode v7.17.4 Commit Message Validation +# RuleOfCode v7.17.5 Commit Message Validation # Config-driven validation with 1 pattern(s) # husky v9+ native hook (no deprecated v8 boilerplate) @@ -28,7 +28,7 @@ fi if [ "$VALID" = false ]; then echo "❌ Invalid commit message format!" echo "" - echo "🏛️ RuleOfCode v7.17.4 Constitutional Commit Message Format:" + echo "🏛️ RuleOfCode v7.17.5 Constitutional Commit Message Format:" echo " Your message must match one of the configured patterns" echo "" echo "Types: feat, fix, docs, style, refactor, test, chore, perf, ci, build, revert" @@ -68,4 +68,4 @@ if [ "$EXEMPT" = false ]; then fi fi -echo "✅ Commit message format validated (RuleOfCode v7.17.4)" +echo "✅ Commit message format validated (RuleOfCode v7.17.5)" diff --git a/.husky/pre-commit b/.husky/pre-commit index aebc547..2749bf6 100644 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,5 +1,5 @@ -# RuleOfCode v7.17.4 Constitutional Checkpoint (husky v9+ native hook) -echo "🏛️ RuleOfCode v7.17.4 Constitutional Checkpoint with lint-staged" +# RuleOfCode v7.17.5 Constitutional Checkpoint (husky v9+ native hook) +echo "🏛️ RuleOfCode v7.17.5 Constitutional Checkpoint with lint-staged" npx lint-staged # Run constitutional audit on staged files diff --git a/.husky/pre-push b/.husky/pre-push index a66e2d2..c42c80a 100644 --- a/.husky/pre-push +++ b/.husky/pre-push @@ -1,5 +1,5 @@ -# RuleOfCode v7.17.4 Constitutional Compliance Pre-Push Hook (husky v9+ native) -echo "🏛️ RuleOfCode v7.17.4 Constitutional Checkpoint - Pre-Push Mode" +# RuleOfCode v7.17.5 Constitutional Compliance Pre-Push Hook (husky v9+ native) +echo "🏛️ RuleOfCode v7.17.5 Constitutional Checkpoint - Pre-Push Mode" echo "═════════════════════════════════════════════════════" # Run full RuleOfCode audit before push diff --git a/CHANGELOG.md b/CHANGELOG.md index 423dd3d..b9b3848 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,32 @@ All notable changes to RuleOfCode will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [7.17.5] - 2026-08-08 + +### 🐛 Fixed — three git laws were blind to linked worktrees + +In a linked worktree (`git worktree add`) `/.git` is a **file** holding `gitdir: …`, +and the shared config and hooks live in the main repository's git directory. Three laws +joined `.git/hooks` and `.git/config` onto the project root, found nothing, and reported +it as a violation: + +- **Git Hooks Standards** — "Git hooks directory missing" +- **Branch Protection Standards** — "Unable to read Git configuration" +- **Git Hook Compliance** — "Git hooks directory not found" + +A consumer hit this in a worktree whose husky hooks had **just blocked a push**: the +concern was met and the law said otherwise. The same commit scored 100/100 in the primary +checkout and 90/100 in the worktree. + +A new shared resolver asks git (`rev-parse --git-common-dir`) instead of guessing the +layout, and honours **`core.hooksPath`** — a second trap, since husky moves hooks to +`.husky`, which makes `/hooks` the default rather than the answer. A relative +`core.hooksPath` resolves against the working-tree top level, which is what git itself +does. Verified with real `git worktree add` fixtures. + +Worktrees are a standard git workflow; if you audit from one, this is the fix. No config +change needed. + ## [7.17.4] - 2026-08-07 ### 🐛 Fixed — `init` crashed instead of setting up when there is no terminal diff --git a/package.json b/package.json index 4bb127f..ddf5c90 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ruleofcode", - "version": "7.17.4", + "version": "7.17.5", "description": "Constitutional-compliance CLI — audit a codebase against a catalog of laws and get one honest pass-or-fail verdict, with git hooks. Supports TypeScript, Angular and Python.", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/src/hooks/installer.ts b/src/hooks/installer.ts index 22cef35..7f460bd 100644 --- a/src/hooks/installer.ts +++ b/src/hooks/installer.ts @@ -17,7 +17,7 @@ export interface HooksInstallOptions { } export class GitHooksInstaller { - private static readonly VERSION = '7.17.4'; + private static readonly VERSION = '7.17.5'; private static readonly PACKAGE_JSON_FILE = 'package.json'; private static readonly HUSKY_DIR = '.husky'; private static readonly PRE_COMMIT_HOOK = 'pre-commit';