fix(install): resolve git hooks dir via git plumbing, drop stale manifest fields

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
This commit is contained in:
2026-07-05 12:41:08 +00:00
parent 828e79535f
commit a43820725f
5 changed files with 30 additions and 11 deletions

View File

@@ -30,10 +30,16 @@ done
# Install git hooks into the current repo checkout
HOOKS_SRC="$REPO_ROOT/scripts/git-hooks"
if [[ -d "$HOOKS_SRC" ]]; then
# Unset inherited GIT_DIR/GIT_WORK_TREE — set by git when this script runs as
# a hook (e.g. pre-push), they override -C's directory-based discovery and
# would resolve against the invoking repo instead of $REPO_ROOT.
GIT_HOOKS_DIR="$(env -u GIT_DIR -u GIT_WORK_TREE git -C "$REPO_ROOT" rev-parse --git-path hooks)"
[[ "$GIT_HOOKS_DIR" = /* ]] || GIT_HOOKS_DIR="$REPO_ROOT/$GIT_HOOKS_DIR"
mkdir -p "$GIT_HOOKS_DIR"
for hook_file in "$HOOKS_SRC"/*; do
[[ -f "$hook_file" ]] || continue
hook_name="$(basename "$hook_file")"
dest_hook="$REPO_ROOT/.git/hooks/$hook_name"
dest_hook="$GIT_HOOKS_DIR/$hook_name"
cp "$hook_file" "$dest_hook"
chmod +x "$dest_hook"
done