Skip to content

feat: hooks must work from workspace project directories (multi-repo support) #45

@atlas-apex

Description

@atlas-apex

Problem

ApexStack hooks use relative paths (.claude/hooks/...) and assume the cwd is the ops repo root. When working inside workspace/<project>/, every hook fails with "No such file or directory" because the project repo doesn't have .claude/hooks/.

Additionally, several hooks check issues/PRs against the origin repo, which is wrong when operating cross-repo (e.g. creating a PR for me2resh/curios-dog from the ops repo context).

Affected hooks (all of them)

Path resolution failures (cwd = workspace//)

Every hook fails because .claude/hooks/*.sh doesn't exist in the project repo:

  • validate-branch-name.sh
  • block-git-add-all.sh
  • check-secrets.sh
  • block-main-push.sh
  • validate-commit-format.sh
  • pre-push-gate.sh
  • require-agdr-for-arch-changes.sh
  • verify-commit-refs.sh
  • validate-pr-create.sh
  • block-unreviewed-merge.sh
  • require-design-review-for-ui.sh
  • block-merge-on-red-ci.sh
  • auto-code-review.sh

Cross-repo logic failures

These hooks check issues/PRs against origin instead of the --repo target:

  • validate-pr-create.sh — checks issue exists in origin, not the --repo argument
  • verify-commit-refs.sh — checks Closes #N against origin
  • block-merge-on-red-ci.sh — can't resolve PRs in other repos
  • auto-code-review.sh — doesn't auto-trigger Rex for cross-repo PRs

Proposed fix

  1. Absolute path resolution — hooks should resolve their own location via $(dirname "$0") or by finding the ops repo root (e.g. walk up from $BASH_SOURCE to find CLAUDE.md)
  2. Cross-repo awareness — hooks that validate issues/PRs should respect the --repo flag when present in the command being validated
  3. Graceful degradation — if a hook can't determine the ops repo root, warn instead of failing silently

Impact

Currently non-blocking (hooks fail with exit code 0 in the "No such file or directory" case), but this means zero SDLC enforcement when working in workspace projects — the exact scenario the portfolio model is designed for.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions