fix(install): resolve git hooks dir via git plumbing, fix stale plugin manifests #72

Merged
Defame1297 merged 2 commits from fix/plugin-manifest-and-worktree-hooks into main 2026-07-05 12:59:19 +00:00
Collaborator

Why

Unrelated pushes (the #68/#70 and #69/#71 fix branches from the same session) were failing main's own pre-push hooks for reasons that had nothing to do with their changes:

  1. scripts/install.sh hardcoded $REPO_ROOT/.git/hooks/, which breaks under any git worktree checkout — .git there is a file (a gitlink), not a directory. This blocks every worktree-based agent from installing hooks or pushing cleanly, which is exactly what surfaced this.
  2. plugins/bin/plugin.json, plugins/core/plugin.json, plugins/gitea/plugin.json reference agents/skills directories that don't exist on main yet, failing scripts/check-manifests.sh for any push, regardless of what's being changed. (gitea's real content already exists on the in-flight refactor/6-gitea-deep-modules branch, pending merge — this PR just makes main internally consistent in the meantime; bin and core are unrelated, standalone drift.)

What changed

  • scripts/install.sh: resolve the git hooks directory via git rev-parse --git-path hooks, unsetting inherited GIT_DIR/GIT_WORK_TREE first (git sets these for hook child processes, which otherwise hijacks -C-based repo discovery) and normalizing to an absolute path (git returns it relative-to-queried-root for plain checkouts, absolute for worktrees).
  • plugins/bin/plugin.json, plugins/core/plugin.json, plugins/gitea/plugin.json: drop agents/skills fields pointing at directories that don't currently exist.
  • tests/test-git-hooks-install.sh: added a regression case simulating the inherited-GIT_DIR hook scenario, and isolated the test's own fixture (git init) from ambient GIT_* env vars — the test previously silently re-targeted the real worktree gitdir instead of its temp fixture when run inside a hook, masking the bug it was meant to test.

Verification

Full suite (bash tests/run-tests.sh) and scripts/check-manifests.sh pass, including under the exact GIT_DIR/GIT_EXEC_PATH/etc. environment captured from a real pre-push hook invocation in a worktree.

Not merging this myself — flagging for review since it touches shared install/hook infrastructure.

## Why Unrelated pushes (the #68/#70 and #69/#71 fix branches from the same session) were failing `main`'s own pre-push hooks for reasons that had nothing to do with their changes: 1. **`scripts/install.sh` hardcoded `$REPO_ROOT/.git/hooks/`**, which breaks under any git worktree checkout — `.git` there is a file (a gitlink), not a directory. This blocks every worktree-based agent from installing hooks or pushing cleanly, which is exactly what surfaced this. 2. **`plugins/bin/plugin.json`, `plugins/core/plugin.json`, `plugins/gitea/plugin.json`** reference `agents`/`skills` directories that don't exist on `main` yet, failing `scripts/check-manifests.sh` for any push, regardless of what's being changed. (`gitea`'s real content already exists on the in-flight `refactor/6-gitea-deep-modules` branch, pending merge — this PR just makes `main` internally consistent in the meantime; `bin` and `core` are unrelated, standalone drift.) ## What changed - `scripts/install.sh`: resolve the git hooks directory via `git rev-parse --git-path hooks`, unsetting inherited `GIT_DIR`/`GIT_WORK_TREE` first (git sets these for hook child processes, which otherwise hijacks `-C`-based repo discovery) and normalizing to an absolute path (git returns it relative-to-queried-root for plain checkouts, absolute for worktrees). - `plugins/bin/plugin.json`, `plugins/core/plugin.json`, `plugins/gitea/plugin.json`: drop `agents`/`skills` fields pointing at directories that don't currently exist. - `tests/test-git-hooks-install.sh`: added a regression case simulating the inherited-`GIT_DIR` hook scenario, and isolated the test's own fixture (`git init`) from ambient `GIT_*` env vars — the test previously silently re-targeted the *real* worktree gitdir instead of its temp fixture when run inside a hook, masking the bug it was meant to test. ## Verification Full suite (`bash tests/run-tests.sh`) and `scripts/check-manifests.sh` pass, including under the exact `GIT_DIR`/`GIT_EXEC_PATH`/etc. environment captured from a real `pre-push` hook invocation in a worktree. Not merging this myself — flagging for review since it touches shared install/hook infrastructure.
Claude added 2 commits 2026-07-05 12:53:56 +00:00
scripts/install.sh hardcoded $REPO_ROOT/.git/hooks, which breaks under any
git worktree checkout (.git is a file there, not a directory) — this is
what blocks every worktree-based agent from pushing cleanly. Resolve the
hooks directory via `git rev-parse --git-path hooks` instead, normalizing
to an absolute path since git returns it relative to the queried repo root
for plain checkouts but absolute for worktrees.

Also drops `agents`/`skills` fields from plugins/bin, plugins/core, and
plugins/gitea plugin.json where the referenced directories don't exist on
main yet (bin never had an agents/ dir; core and gitea's real skill/agent
content is still pending merge from an in-flight branch) — these were
failing scripts/check-manifests.sh and blocking pushes for unrelated work.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FNJWdVvdgvZCHi1hZGqgVQ
The test's own `git -C "$TEMP_REPO" init` silently re-targets an inherited
GIT_DIR instead of creating a repo in the temp dir when this test itself
runs inside a git hook (e.g. pre-push sets GIT_DIR to the invoking repo's
gitdir). Unset all GIT_* vars at the top of the script so the temp repo
fixture is actually isolated regardless of the calling context.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FNJWdVvdgvZCHi1hZGqgVQ
Defame1297 approved these changes 2026-07-05 12:59:09 +00:00
Defame1297 merged commit 8b9989e200 into main 2026-07-05 12:59:19 +00:00
Defame1297 deleted branch fix/plugin-manifest-and-worktree-hooks 2026-07-05 12:59:19 +00:00
Sign in to join this conversation.