Skip to content

Commit 086421d

Browse files
Copilotmnriem
andauthored
fix: resolve common.sh/ps1 sourcing from extension scripts directory
Co-authored-by: mnriem <15701806+mnriem@users.noreply.github.com> Agent-Logs-Url: https://github.com/github/spec-kit/sessions/809a1dbf-1301-4312-b4d2-e18f9b3e8b2f
1 parent 4f83308 commit 086421d

2 files changed

Lines changed: 31 additions & 3 deletions

File tree

extensions/git/scripts/bash/create-new-feature.sh

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,21 @@ clean_branch_name() {
175175
# to searching for repository markers so the workflow still functions in repositories that
176176
# were initialised with --no-git.
177177
SCRIPT_DIR="$(CDPATH="" cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
178-
source "$SCRIPT_DIR/common.sh"
178+
179+
# Source common.sh: try the core scripts directory first (standard layout),
180+
# then fall back to the extension's sibling copy.
181+
if [ -f "$SCRIPT_DIR/common.sh" ]; then
182+
source "$SCRIPT_DIR/common.sh"
183+
else
184+
# When running from an extension install (.specify/extensions/git/scripts/bash/),
185+
# resolve common.sh from the project's core scripts directory.
186+
_ext_repo_root="$(cd "$SCRIPT_DIR/../../../../.." 2>/dev/null && pwd)"
187+
if [ -f "$_ext_repo_root/scripts/bash/common.sh" ]; then
188+
source "$_ext_repo_root/scripts/bash/common.sh"
189+
elif [ -f "$SCRIPT_DIR/git-common.sh" ]; then
190+
source "$SCRIPT_DIR/git-common.sh"
191+
fi
192+
fi
179193

180194
if git rev-parse --show-toplevel >/dev/null 2>&1; then
181195
REPO_ROOT=$(git rev-parse --show-toplevel)

extensions/git/scripts/powershell/create-new-feature.ps1

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,22 @@ if (-not $fallbackRoot) {
145145
exit 1
146146
}
147147

148-
# Load common functions (includes Resolve-Template)
149-
. "$PSScriptRoot/common.ps1"
148+
# Load common functions (includes Resolve-Template).
149+
# Try the core scripts directory first (standard layout), then fall back
150+
# to the extension's sibling copy.
151+
if (Test-Path "$PSScriptRoot/common.ps1") {
152+
. "$PSScriptRoot/common.ps1"
153+
} else {
154+
# When running from an extension install (.specify/extensions/git/scripts/powershell/),
155+
# resolve common.ps1 from the project's core scripts directory.
156+
$extRepoRoot = (Resolve-Path (Join-Path $PSScriptRoot "../../../../..") -ErrorAction SilentlyContinue)
157+
$coreCommon = if ($extRepoRoot) { Join-Path $extRepoRoot "scripts/powershell/common.ps1" } else { "" }
158+
if ($coreCommon -and (Test-Path $coreCommon)) {
159+
. $coreCommon
160+
} elseif (Test-Path "$PSScriptRoot/git-common.ps1") {
161+
. "$PSScriptRoot/git-common.ps1"
162+
}
163+
}
150164

151165
try {
152166
$repoRoot = git rev-parse --show-toplevel 2>$null

0 commit comments

Comments
 (0)