mirror of
https://github.com/github/spec-kit.git
synced 2026-03-24 22:33:08 +00:00
fix: address all PR review comments for git extension
- Fix bash common.sh sourcing: check .specify/scripts/bash/ first, then scripts/bash/, with explicit error if neither found - Fix PowerShell common.ps1 sourcing: use $fallbackRoot for reliable path resolution, with explicit error if not found - Remove undocumented branch_template and auto_fetch from extension.yml defaults and config-template.yml (scripts don't use them yet) - Remove unused ExtensionError import in _install_bundled_git_extension - Remove undocumented SPECKIT_GIT_BRANCH_NUMBERING env var from README - Fix specify.md: skip step 2 when before_specify hook already executed - Fix specify.md: add explicit FEATURE_DIR/SPEC_FILE in disabled-git path - Fix specify.md: add PowerShell path to script resolution - Add tests for git extension auto-install during specify init Co-authored-by: mnriem <15701806+mnriem@users.noreply.github.com> Agent-Logs-Url: https://github.com/github/spec-kit/sessions/008835a0-7778-40bb-bdb2-4182b22be315
This commit is contained in:
committed by
GitHub
parent
312c37be25
commit
5e49ec6936
@@ -176,21 +176,39 @@ clean_branch_name() {
|
||||
# were initialised with --no-git.
|
||||
SCRIPT_DIR="$(CDPATH="" cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
# Source common.sh: try the core scripts directory first (standard layout),
|
||||
# then fall back to the extension's sibling copy.
|
||||
# Source common.sh using the following priority:
|
||||
# 1. common.sh next to this script (source checkout layout)
|
||||
# 2. .specify/scripts/bash/common.sh under the project root (installed project)
|
||||
# 3. scripts/bash/common.sh under the project root (source checkout fallback)
|
||||
# 4. git-common.sh next to this script (minimal fallback)
|
||||
_common_loaded=false
|
||||
|
||||
if [ -f "$SCRIPT_DIR/common.sh" ]; then
|
||||
source "$SCRIPT_DIR/common.sh"
|
||||
_common_loaded=true
|
||||
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"
|
||||
# resolve to .specify/ (4 levels up), then to the project root (5 levels up).
|
||||
_dot_specify="$(cd "$SCRIPT_DIR/../../../.." 2>/dev/null && pwd)"
|
||||
_project_root="$(cd "$SCRIPT_DIR/../../../../.." 2>/dev/null && pwd)"
|
||||
|
||||
if [ -n "$_dot_specify" ] && [ -f "$_dot_specify/scripts/bash/common.sh" ]; then
|
||||
source "$_dot_specify/scripts/bash/common.sh"
|
||||
_common_loaded=true
|
||||
elif [ -n "$_project_root" ] && [ -f "$_project_root/scripts/bash/common.sh" ]; then
|
||||
source "$_project_root/scripts/bash/common.sh"
|
||||
_common_loaded=true
|
||||
elif [ -f "$SCRIPT_DIR/git-common.sh" ]; then
|
||||
source "$SCRIPT_DIR/git-common.sh"
|
||||
_common_loaded=true
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$_common_loaded" != "true" ]; then
|
||||
echo "Error: Could not locate common.sh or git-common.sh. Please ensure the Specify core scripts are installed." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if git rev-parse --show-toplevel >/dev/null 2>&1; then
|
||||
REPO_ROOT=$(git rev-parse --show-toplevel)
|
||||
HAS_GIT=true
|
||||
|
||||
Reference in New Issue
Block a user