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