@ai-ecoverse/slicc-shared-web 1.30.1 → 1.30.2

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 CHANGED
@@ -215,12 +215,12 @@ Without it, every worktree of a repo shares `.git/hooks/` with the main clone, a
215
215
 
216
216
  and the PR commits the `.githooks/` directory that the first `npm install` writes.
217
217
 
218
- - **What it does:** sets one shared, relative `core.hooksPath` of `.githooks` (`<dir>/.githooks` for a package in a subdirectory of the repo), runs `lefthook install --force` with its output pointed at this worktree's gitignored `node_modules/.git-hooks/`, and writes a shim into `.githooks/` for every hook lefthook installed that has none yet. It never overwrites an existing shim. Git resolves a relative `core.hooksPath` against the top of the worktree a commit runs in, so each worktree runs its own committed shim, and the shim runs that worktree's own `node_modules/.git-hooks/<hook>`. No `extensions.worktreeConfig`, no per-worktree config, and `core.bare` stays where it is, so worktrees of a bare repo work too. Running it again changes nothing.
218
+ - **What it does:** sets one shared, relative `core.hooksPath` of `.githooks` (`<dir>/.githooks` for a package in a subdirectory of the repo), writes a hook into this worktree's gitignored `node_modules/.git-hooks/` for every git hook in the config `lefthook dump` prints, `extends` included, and a shim into `.githooks/` for each one that has none yet. Each hook runs `lefthook run --no-auto-install <hook>` with the lefthook binary from its own `node_modules/`, found relative to the hook, so lefthook never tries to sync hooks into `core.hooksPath`. It sets no git config from the command line or the environment, so the AI git wrapper lets it run. It never overwrites an existing shim. Git resolves a relative `core.hooksPath` against the top of the worktree a commit runs in, so each worktree runs its own committed shim, and the shim runs that worktree's own `node_modules/.git-hooks/<hook>`. No `extensions.worktreeConfig`, no per-worktree config, and `core.bare` stays where it is, so worktrees of a bare repo work too. Running it again changes nothing.
219
219
  - **Hooks are never shared:** whatever another worktree installs later, removing a worktree removes only its own hooks, and a moved checkout keeps working. Lefthook's own `postinstall` refuses the custom `core.hooksPath`, writes nothing and doesn't fail the install, and git never reads `.git/hooks/` once `core.hooksPath` is set, so `allowScripts` needs no entry for lefthook.
220
220
  - **A worktree that never ran `npm install`** fails every commit with `pre-commit: run npm install`, since its shim finds no `node_modules/.git-hooks/pre-commit`.
221
221
  - **A checkout without the committed `.githooks/`** (a branch cut before the rollout PR) has no shim, so its commits run no hooks until it merges or rebases onto the rollout.
222
- - **A hook type added to `lefthook.yml` later** needs `npm install` again in each worktree, and its new shim committed: lefthook skips its own hook sync while `core.hooksPath` is set.
223
- - **Lefthook's `core.hooksPath is set locally` notice** on commits is expected. Don't follow its advice to unset `core.hooksPath`: that sends every worktree back to the shared `.git/hooks/`.
222
+ - **A hook type added to `lefthook.yml` later** needs `npm install` again in each worktree, and its new shim committed.
223
+ - **Don't unset `core.hooksPath`** when `lefthook install` suggests it: that sends every worktree back to the shared `.git/hooks/`.
224
224
  - **Clones set up by the previous version** (2.1.1, 1.29.3), which set an absolute per-worktree `core.hooksPath` into a `worktree-hooks/` directory: it unsets that in the current worktree's `config.worktree`. It leaves `extensions.worktreeConfig` and the moved `core.bare` alone.
225
225
  - **Outside a git checkout** (a packed tarball, say) it does nothing and exits 0.
226
226
 
@@ -8,16 +8,25 @@ if [ -f "$own" ]; then
8
8
  esac
9
9
  fi
10
10
  git config core.hooksPath "$(git rev-parse --show-prefix).githooks"
11
- n="${GIT_CONFIG_COUNT:-0}"
12
- (
13
- export "GIT_CONFIG_COUNT=$((n + 1))" "GIT_CONFIG_KEY_$n=core.hooksPath" "GIT_CONFIG_VALUE_$n=$(pwd -P)/node_modules/.git-hooks"
14
- lefthook install --force "$@"
15
- )
16
- mkdir -p .githooks
17
- for hook in node_modules/.git-hooks/*; do
18
- name="${hook##*/}"
19
- case "$name" in *.*) continue ;; esac
20
- if [ ! -f "$hook" ] || [ -e ".githooks/$name" ]; then continue; fi
11
+ config="$(lefthook dump)"
12
+ githooks=" applypatch-msg pre-applypatch post-applypatch pre-commit pre-merge-commit prepare-commit-msg commit-msg post-commit pre-rebase post-checkout post-merge pre-push pre-receive update proc-receive post-receive post-update reference-transaction push-to-checkout pre-auto-gc post-rewrite sendemail-validate fsmonitor-watchman p4-changelist p4-prepare-changelist p4-post-changelist p4-pre-submit post-index-change "
13
+ mkdir -p node_modules/.git-hooks .githooks
14
+ for name in $(printf '%s\n' "$config" | sed -n 's/^\([a-z][a-z0-9-]*\):.*/\1/p'); do
15
+ case "$githooks" in *" $name "*) ;; *) continue ;; esac
16
+ hook="node_modules/.git-hooks/$name"
17
+ sed "s/@HOOK@/$name/g" >"$hook" <<'HOOK'
18
+ #!/bin/sh
19
+ if [ "${LEFTHOOK_VERBOSE:-}" = 1 ] || [ "${LEFTHOOK_VERBOSE:-}" = true ]; then set -x; fi
20
+ modules="$(cd "${0%/*}/.." && pwd -P)"
21
+ os="$(uname -s | tr '[:upper:]' '[:lower:]')"
22
+ cpu="$(uname -m | sed 's/aarch64/arm64/;s/x86_64/x64/')"
23
+ lefthook="$modules/lefthook-$os-$cpu/bin/lefthook"
24
+ [ -x "$lefthook" ] || lefthook="$modules/.bin/lefthook"
25
+ [ -x "$lefthook" ] || { echo "@HOOK@: run npm install" >&2; exit 1; }
26
+ exec "$lefthook" run --no-auto-install "@HOOK@" "$@"
27
+ HOOK
28
+ chmod +x "$hook"
29
+ [ ! -e ".githooks/$name" ] || continue
21
30
  cat >".githooks/$name" <<'SHIM'
22
31
  #!/bin/sh
23
32
  hook="${0%/*}/../node_modules/.git-hooks/${0##*/}"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-ecoverse/slicc-shared-web",
3
- "version": "1.30.1",
3
+ "version": "1.30.2",
4
4
  "description": "Shared Renovate, Biome, TypeScript, lefthook and GitHub Actions configuration, plus the CDP integration-test harness, for SLICC's web repos",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",