fix: address second round of review comments

1. Log warning on auto-install failure instead of silent catch
2. Fix README install command (--from → --dev)
3. Bash: fail fast if resolve_template/json_escape unavailable after git-common.sh fallback
4. PowerShell: fail fast if Resolve-Template unavailable after git-common.ps1 fallback
5. Fix PowerShell $env:FEATURE_DIR → $FEATURE_DIR in specify.md
6. Fix docstring to reflect already-installed return value

Co-authored-by: mnriem <15701806+mnriem@users.noreply.github.com>
Agent-Logs-Url: https://github.com/github/spec-kit/sessions/6bcb7cb8-c7da-49d6-8206-1187766f92e1
This commit is contained in:
copilot-swe-agent[bot]
2026-03-23 22:13:37 +00:00
committed by GitHub
parent 17810c8e85
commit 4f1b63a65a
5 changed files with 31 additions and 7 deletions

View File

@@ -37,8 +37,8 @@ branch_numbering: sequential
## Installation
```bash
# Install from the bundled extension
specify extension add git --from extensions/git/
# Install from the bundled extension directory
specify extension add extensions/git --dev
# Or it auto-installs during specify init (migration period)
```

View File

@@ -209,6 +209,15 @@ if [ "$_common_loaded" != "true" ]; then
exit 1
fi
# If only git-common.sh was loaded, verify that the required helpers
# (resolve_template, json_escape) are available. These are provided by the
# core common.sh; git-common.sh only supplies has_git / check_feature_branch.
if ! type resolve_template >/dev/null 2>&1 || ! type json_escape >/dev/null 2>&1; then
echo "Error: resolve_template/json_escape not defined. The core common.sh is required but could not be located." >&2
echo "Tried: \$SCRIPT_DIR/common.sh, .specify/scripts/bash/common.sh, scripts/bash/common.sh" >&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

View File

@@ -179,6 +179,14 @@ if (-not $commonLoaded) {
throw "Unable to locate common script file. Please ensure the Specify core scripts are installed."
}
# If only git-common.ps1 was loaded, verify that Resolve-Template is available.
# Resolve-Template is provided by the core common.ps1; git-common.ps1 only
# supplies Test-HasGit / Test-FeatureBranch.
if (-not (Get-Command Resolve-Template -ErrorAction SilentlyContinue)) {
throw ("Resolve-Template not defined. The core common.ps1 is required but could not be located. " +
"Tried: $PSScriptRoot/common.ps1, .specify/scripts/powershell/common.ps1, scripts/powershell/common.ps1")
}
try {
$repoRoot = git rev-parse --show-toplevel 2>$null
if ($LASTEXITCODE -eq 0) {

View File

@@ -1188,7 +1188,8 @@ def _install_bundled_git_extension(project_path: Path) -> bool:
Before 1.0.0, this auto-install will be removed and the extension will
become opt-in.
Returns True if the extension was installed, False otherwise.
Returns True if the extension was installed or already present,
False otherwise.
"""
ext_source = _locate_bundled_git_extension()
if ext_source is None:
@@ -1205,8 +1206,14 @@ def _install_bundled_git_extension(project_path: Path) -> bool:
speckit_ver = get_speckit_version()
manager.install_from_directory(ext_source, speckit_ver)
return True
except Exception:
# Non-fatal: branching still works via core scripts during migration
except Exception as exc:
# Non-fatal: branching still works via core scripts during migration,
# but log a warning so users can tell the auto-install did not happen.
console.print(
"[dim yellow]Warning: failed to auto-install bundled git extension; "
"branching via the git extension may be unavailable. "
f"Details: {exc}[/dim yellow]"
)
return False

View File

@@ -88,8 +88,8 @@ Given that feature description, do this:
- `mkdir -p "$FEATURE_DIR"`
- `touch "$SPEC_FILE"`
- PowerShell:
- `New-Item -ItemType Directory -Path $env:FEATURE_DIR -Force | Out-Null`
- `New-Item -ItemType File -Path $env:SPEC_FILE -Force | Out-Null`
- `New-Item -ItemType Directory -Path $FEATURE_DIR -Force | Out-Null`
- `New-Item -ItemType File -Path $SPEC_FILE -Force | Out-Null`
- Then proceed directly to step 3 using `FEATURE_DIR` and `SPEC_FILE`
- If the registry file does not exist, proceed with branch creation using the default behavior (backward compatibility)