Skip to content

HQ_ROOT not exported in core/scripts/run-project.sh (sibling of #12) — prd.json false-negative #21

Description

@spencerrwise

Bug

core/scripts/run-project.sh computes HQ_ROOT at the correct depth
(${SCRIPT_DIR}/../..) but does not export it. Line 78 does
exec bash "$TARGET"; the target .claude/scripts/run-project.sh then
re-derives HQ_ROOT from its own BASH_SOURCE via its overridable
default HQ_ROOT="${HQ_ROOT:-$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)}".
From .claude/scripts/, that is <root>/.claude — one level too shallow.
With no exported HQ_ROOT, the default wins and resolves wrong.

Symptom

bash scripts/run-project.sh --dry-run <project>
ERROR: prd.json not found for '<project>'. even though a valid PRD
exists, because resolve_prd_path() globs
"$HQ_ROOT"/companies/*/projects/<project>/prd.json. Only works when the
caller already has HQ_ROOT exported (masks it in interactive sessions;
breaks cold/headless callers). Verified on a real 9-story headless build:
failed at preflight until launched with HQ_ROOT="$PWD".

Relationship to #12

Sibling, not duplicate. #12 fixed the $(dirname)/.. depth in
audit-log.sh / compute-checksums.sh after the core/ consolidation.
Here the depth is already correct; the failure mode is propagation
(value right, not exported across exec). #12 said the consolidation
"missed siblings — this PR finishes the migration"; this finishes it for
run-project.sh.

Fix (one line, mechanical)

-HQ_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd)"
+export HQ_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd)"

Ready-to-merge branch (external PR creation is restricted on this repo, so
I could not open the PR directly):
spencerrwise:fix/run-project-hq-root-export — commit a272e00
(https://github.com/spencerrwise/hq-core/tree/fix/run-project-hq-root-export).
A maintainer can open the PR from that branch or cherry-pick the commit.

🤖 Reported via Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions