Bug Description
get-pr-context.ps1 resolves $repoRoot by navigating two levels up from the script directory, but the script lives three levels deep under the repo root (.documentation/scripts/powershell/). This causes REPO_ROOT to resolve to .documentation/ instead of the actual workspace root.
Impact
All paths derived from $repoRoot are incorrect:
| Field |
Expected |
Actual (broken) |
REPO_ROOT |
C:\myrepo |
C:\myrepo\.documentation |
CONSTITUTION_PATH |
C:\myrepo\.documentation\memory\constitution.md |
C:\myrepo\.documentation\.documentation\memory\constitution.md |
REVIEW_DIR |
C:\myrepo\.documentation\specs\pr-review |
C:\myrepo\.documentation\.documentation\specs\pr-review |
CONSTITUTION_EXISTS |
true |
false (path doesn't exist) |
This causes pr-review to report the constitution as missing even when it exists, and the review output directory is wrong.
Root Cause
Line 38 of get-pr-context.ps1:
$scriptPath = Split-Path -Parent $MyInvocation.MyCommand.Path
$repoRoot = (Resolve-Path "$scriptPath\..\..") # Only goes up 2 levels
The script is at .documentation/scripts/powershell/get-pr-context.ps1 — that's 3 levels below the repo root:
repo-root/ # level 0 (target)
.documentation/ # level 1
scripts/ # level 2
powershell/ # level 3 ($scriptPath)
get-pr-context.ps1
../.. from powershell/ lands at .documentation/ (level 1), not the repo root (level 0).
Fix
Change to three levels up:
$repoRoot = (Resolve-Path "$scriptPath\..\..\..")
Confirm that all scripts do not have this problem.
Steps to Reproduce
- Run
/speckit.pr-review on any repo with the standard .documentation/ layout
- Observe the JSON output:
REPO_ROOT points to .documentation/ and CONSTITUTION_EXISTS is false
Environment
- PowerShell 7+
- Windows (also affects macOS/Linux with forward-slash paths)
- Discovered during PR review on markhazleton/sql2csv#9
Bug Description
get-pr-context.ps1resolves$repoRootby navigating two levels up from the script directory, but the script lives three levels deep under the repo root (.documentation/scripts/powershell/). This causesREPO_ROOTto resolve to.documentation/instead of the actual workspace root.Impact
All paths derived from
$repoRootare incorrect:REPO_ROOTC:\myrepoC:\myrepo\.documentationCONSTITUTION_PATHC:\myrepo\.documentation\memory\constitution.mdC:\myrepo\.documentation\.documentation\memory\constitution.mdREVIEW_DIRC:\myrepo\.documentation\specs\pr-reviewC:\myrepo\.documentation\.documentation\specs\pr-reviewCONSTITUTION_EXISTStruefalse(path doesn't exist)This causes
pr-reviewto report the constitution as missing even when it exists, and the review output directory is wrong.Root Cause
Line 38 of
get-pr-context.ps1:The script is at
.documentation/scripts/powershell/get-pr-context.ps1— that's 3 levels below the repo root:../..frompowershell/lands at.documentation/(level 1), not the repo root (level 0).Fix
Change to three levels up:
Confirm that all scripts do not have this problem.
Steps to Reproduce
/speckit.pr-reviewon any repo with the standard.documentation/layoutREPO_ROOTpoints to.documentation/andCONSTITUTION_EXISTSisfalseEnvironment