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
This commit is contained in:
copilot-swe-agent[bot]
2026-03-23 21:30:29 +00:00
committed by GitHub
parent 4f83308540
commit 086421daf1
2 changed files with 31 additions and 3 deletions

View File

@@ -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)