Skip to content

Commit 4f1b63a

Browse files
Copilotmnriem
andauthored
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
1 parent 17810c8 commit 4f1b63a

File tree

5 files changed

+31
-7
lines changed

5 files changed

+31
-7
lines changed

extensions/git/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ branch_numbering: sequential
3737
## Installation
3838
3939
```bash
40-
# Install from the bundled extension
41-
specify extension add git --from extensions/git/
40+
# Install from the bundled extension directory
41+
specify extension add extensions/git --dev
4242

4343
# Or it auto-installs during specify init (migration period)
4444
```

extensions/git/scripts/bash/create-new-feature.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,15 @@ if [ "$_common_loaded" != "true" ]; then
209209
exit 1
210210
fi
211211

212+
# If only git-common.sh was loaded, verify that the required helpers
213+
# (resolve_template, json_escape) are available. These are provided by the
214+
# core common.sh; git-common.sh only supplies has_git / check_feature_branch.
215+
if ! type resolve_template >/dev/null 2>&1 || ! type json_escape >/dev/null 2>&1; then
216+
echo "Error: resolve_template/json_escape not defined. The core common.sh is required but could not be located." >&2
217+
echo "Tried: \$SCRIPT_DIR/common.sh, .specify/scripts/bash/common.sh, scripts/bash/common.sh" >&2
218+
exit 1
219+
fi
220+
212221
if git rev-parse --show-toplevel >/dev/null 2>&1; then
213222
REPO_ROOT=$(git rev-parse --show-toplevel)
214223
HAS_GIT=true

extensions/git/scripts/powershell/create-new-feature.ps1

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,14 @@ if (-not $commonLoaded) {
179179
throw "Unable to locate common script file. Please ensure the Specify core scripts are installed."
180180
}
181181

182+
# If only git-common.ps1 was loaded, verify that Resolve-Template is available.
183+
# Resolve-Template is provided by the core common.ps1; git-common.ps1 only
184+
# supplies Test-HasGit / Test-FeatureBranch.
185+
if (-not (Get-Command Resolve-Template -ErrorAction SilentlyContinue)) {
186+
throw ("Resolve-Template not defined. The core common.ps1 is required but could not be located. " +
187+
"Tried: $PSScriptRoot/common.ps1, .specify/scripts/powershell/common.ps1, scripts/powershell/common.ps1")
188+
}
189+
182190
try {
183191
$repoRoot = git rev-parse --show-toplevel 2>$null
184192
if ($LASTEXITCODE -eq 0) {

src/specify_cli/__init__.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,7 +1188,8 @@ def _install_bundled_git_extension(project_path: Path) -> bool:
11881188
Before 1.0.0, this auto-install will be removed and the extension will
11891189
become opt-in.
11901190
1191-
Returns True if the extension was installed, False otherwise.
1191+
Returns True if the extension was installed or already present,
1192+
False otherwise.
11921193
"""
11931194
ext_source = _locate_bundled_git_extension()
11941195
if ext_source is None:
@@ -1205,8 +1206,14 @@ def _install_bundled_git_extension(project_path: Path) -> bool:
12051206
speckit_ver = get_speckit_version()
12061207
manager.install_from_directory(ext_source, speckit_ver)
12071208
return True
1208-
except Exception:
1209-
# Non-fatal: branching still works via core scripts during migration
1209+
except Exception as exc:
1210+
# Non-fatal: branching still works via core scripts during migration,
1211+
# but log a warning so users can tell the auto-install did not happen.
1212+
console.print(
1213+
"[dim yellow]Warning: failed to auto-install bundled git extension; "
1214+
"branching via the git extension may be unavailable. "
1215+
f"Details: {exc}[/dim yellow]"
1216+
)
12101217
return False
12111218

12121219

templates/commands/specify.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ Given that feature description, do this:
8888
- `mkdir -p "$FEATURE_DIR"`
8989
- `touch "$SPEC_FILE"`
9090
- PowerShell:
91-
- `New-Item -ItemType Directory -Path $env:FEATURE_DIR -Force | Out-Null`
92-
- `New-Item -ItemType File -Path $env:SPEC_FILE -Force | Out-Null`
91+
- `New-Item -ItemType Directory -Path $FEATURE_DIR -Force | Out-Null`
92+
- `New-Item -ItemType File -Path $SPEC_FILE -Force | Out-Null`
9393
- Then proceed directly to step 3 using `FEATURE_DIR` and `SPEC_FILE`
9494
- If the registry file does not exist, proceed with branch creation using the default behavior (backward compatibility)
9595

0 commit comments

Comments
 (0)