From 086421daf148d38833dab1e3365e4a988e24dc4a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 23 Mar 2026 21:30:29 +0000 Subject: [PATCH] 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 --- .../git/scripts/bash/create-new-feature.sh | 16 +++++++++++++++- .../scripts/powershell/create-new-feature.ps1 | 18 ++++++++++++++++-- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/extensions/git/scripts/bash/create-new-feature.sh b/extensions/git/scripts/bash/create-new-feature.sh index 0df4adc3..b2d06564 100644 --- a/extensions/git/scripts/bash/create-new-feature.sh +++ b/extensions/git/scripts/bash/create-new-feature.sh @@ -175,7 +175,21 @@ clean_branch_name() { # to searching for repository markers so the workflow still functions in repositories that # were initialised with --no-git. SCRIPT_DIR="$(CDPATH="" cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -source "$SCRIPT_DIR/common.sh" + +# Source common.sh: try the core scripts directory first (standard layout), +# then fall back to the extension's sibling copy. +if [ -f "$SCRIPT_DIR/common.sh" ]; then + source "$SCRIPT_DIR/common.sh" +else + # When running from an extension install (.specify/extensions/git/scripts/bash/), + # resolve common.sh from the project's core scripts directory. + _ext_repo_root="$(cd "$SCRIPT_DIR/../../../../.." 2>/dev/null && pwd)" + if [ -f "$_ext_repo_root/scripts/bash/common.sh" ]; then + source "$_ext_repo_root/scripts/bash/common.sh" + elif [ -f "$SCRIPT_DIR/git-common.sh" ]; then + source "$SCRIPT_DIR/git-common.sh" + fi +fi if git rev-parse --show-toplevel >/dev/null 2>&1; then REPO_ROOT=$(git rev-parse --show-toplevel) diff --git a/extensions/git/scripts/powershell/create-new-feature.ps1 b/extensions/git/scripts/powershell/create-new-feature.ps1 index 473c925b..76831d3a 100644 --- a/extensions/git/scripts/powershell/create-new-feature.ps1 +++ b/extensions/git/scripts/powershell/create-new-feature.ps1 @@ -145,8 +145,22 @@ if (-not $fallbackRoot) { exit 1 } -# Load common functions (includes Resolve-Template) -. "$PSScriptRoot/common.ps1" +# Load common functions (includes Resolve-Template). +# Try the core scripts directory first (standard layout), then fall back +# to the extension's sibling copy. +if (Test-Path "$PSScriptRoot/common.ps1") { + . "$PSScriptRoot/common.ps1" +} else { + # When running from an extension install (.specify/extensions/git/scripts/powershell/), + # resolve common.ps1 from the project's core scripts directory. + $extRepoRoot = (Resolve-Path (Join-Path $PSScriptRoot "../../../../..") -ErrorAction SilentlyContinue) + $coreCommon = if ($extRepoRoot) { Join-Path $extRepoRoot "scripts/powershell/common.ps1" } else { "" } + if ($coreCommon -and (Test-Path $coreCommon)) { + . $coreCommon + } elseif (Test-Path "$PSScriptRoot/git-common.ps1") { + . "$PSScriptRoot/git-common.ps1" + } +} try { $repoRoot = git rev-parse --show-toplevel 2>$null