Skip to content

webfetch-nudge: adopt shared hooks/lib/project-root.sh for monorepo detection #40

@halindrome

Description

@halindrome

Per QA round 1 (PR #36, finding #7): hooks/global/webfetch-nudge.sh re-implements project-root detection (git rev-parse --show-toplevel + md5 hashing) instead of sourcing the shared hooks/lib/project-root.sh library that hooks/project/ctx-execute-enforcer.sh uses.

Consequences:

  • In a monorepo submodule, the hook resolves to the submodule root rather than the outermost project root. A context-mode entry registered in the outermost .mcp.json may be missed (though the CLAUDE_CONFIG_DIR / global-settings fallback usually catches this).
  • Cache key for /tmp/ctx-webfetch-avail-<hash> diverges between the webfetch-nudge hook and the ctx-execute-enforcer hook when run against the same monorepo submodule.

Fix options:

  1. Source hooks/lib/project-root.sh and use the shared PROJECT_ROOT / PROJECT_HASH variables.
  2. Explicitly document that webfetch-nudge uses event-cwd-first detection intentionally (and accept the monorepo caveat).

Context: #36 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions