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
Bug
core/scripts/run-project.shcomputesHQ_ROOTat the correct depth(
${SCRIPT_DIR}/../..) but does notexportit. Line 78 doesexec bash "$TARGET"; the target.claude/scripts/run-project.shthenre-derives
HQ_ROOTfrom its ownBASH_SOURCEvia its overridabledefault
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 PRDexists, because
resolve_prd_path()globs"$HQ_ROOT"/companies/*/projects/<project>/prd.json. Only works when thecaller already has
HQ_ROOTexported (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 inaudit-log.sh/compute-checksums.shafter thecore/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)
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— commita272e00(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