mirror of
https://github.com/github/spec-kit.git
synced 2026-03-24 14:23:09 +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
@@ -146,20 +146,37 @@ if (-not $fallbackRoot) {
|
||||
}
|
||||
|
||||
# Load common functions (includes Resolve-Template).
|
||||
# Try the core scripts directory first (standard layout), then fall back
|
||||
# to the extension's sibling copy.
|
||||
# Search locations in priority order:
|
||||
# 1. common.ps1 next to this script (source checkout layout)
|
||||
# 2. .specify/scripts/powershell/common.ps1 under the project root (installed project)
|
||||
# 3. scripts/powershell/common.ps1 under the project root (source checkout fallback)
|
||||
# 4. git-common.ps1 next to this script (minimal fallback)
|
||||
$commonLoaded = $false
|
||||
|
||||
if (Test-Path "$PSScriptRoot/common.ps1") {
|
||||
. "$PSScriptRoot/common.ps1"
|
||||
$commonLoaded = $true
|
||||
} 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"
|
||||
$coreCommonCandidates = @()
|
||||
|
||||
if ($fallbackRoot) {
|
||||
$coreCommonCandidates += (Join-Path $fallbackRoot ".specify/scripts/powershell/common.ps1")
|
||||
$coreCommonCandidates += (Join-Path $fallbackRoot "scripts/powershell/common.ps1")
|
||||
}
|
||||
|
||||
$coreCommonCandidates += "$PSScriptRoot/git-common.ps1"
|
||||
|
||||
foreach ($candidate in $coreCommonCandidates) {
|
||||
if ($candidate -and (Test-Path $candidate)) {
|
||||
. $candidate
|
||||
$commonLoaded = $true
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (-not $commonLoaded) {
|
||||
throw "Unable to locate common script file. Please ensure the Specify core scripts are installed."
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user