[Bug]: Test-FeatureJsonMatchesFeatureDir was missing in common.ps1 — this was a missing function that caused setup-tasks.ps1 to fail.
Bug Description
On start of /speckit.tasks in PowerShell environment, it attempts to call function
Test-FeatureJsonMatchesFeatureDir
An error is thrown and there is no such commandlet.
CoPilot eventually worked around the problem.
.\.specify\scripts\powershell\setup-tasks.ps1 -Json
C:\Code\private\app\.specify\scripts\powershell\setup-tasks.ps1 : The term
'Test-FeatureJsonMatchesFeatureDir' is not recognized as the name of a cmdlet, function, script file, or
operable program. Check the spelling of the name, or if a path was included, verify that the path is
correct and try again.
At line:1 char:1
+ .\.specify\scripts\powershell\setup-tasks.ps1 -Json
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Test-FeatureJsonMatchesFeatureDir:String) [setup-tasks.ps1]
, CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException,setup-tasks.ps1
Steps to Reproduce
1: Run /speckit.tasks
2: Errors noted for missing function Test-FeatureJsonMatchesFeatureDir
The function checks if feature.json pins an existing feature directory, and if it does, branch naming validation gets skipped.
Since the function is missing from common.ps1, this validation logic can't run.
Expected Behavior
No error should have been reported.
Actual Behavior
.\.specify\scripts\powershell\setup-tasks.ps1 -Json
C:\Code\private\app\.specify\scripts\powershell\setup-tasks.ps1 : The term
'Test-FeatureJsonMatchesFeatureDir' is not recognized as the name of a cmdlet, function, script file, or
operable program. Check the spelling of the name, or if a path was included, verify that the path is
correct and try again.
At line:1 char:1
+ .\.specify\scripts\powershell\setup-tasks.ps1 -Json
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Test-FeatureJsonMatchesFeatureDir:String) [setup-tasks.ps1]
, CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException,setup-tasks.ps1
Since the function is missing from common.ps1, this validation logic can't run.
CoPilot eventually determined what the function should have returned and worked around the problem.
Specify CLI Version
0.8.13
AI Agent
GitHub Copilot
Operating System
Windows 11 (10.0.26220)
Python Version
Python 3.12.6
Error Logs
.\.specify\scripts\powershell\setup-tasks.ps1 -Json
C:\Code\private\app\.specify\scripts\powershell\setup-tasks.ps1 : At
C:\Code\private\app\.specify\scripts\powershell\common.ps1:141 char:122
+ ... -Path $RepoRoot $pinnedRelative) -ErrorAction SilentlyContinue)?.Path
+ ~~~~~~
Unexpected token '?.Path' in expression or statement.
At C:\Code\private\app\.specify\scripts\powershell\common.ps1:142 char:102
+ ... h -LiteralPath $ActiveFeatureDir -ErrorAction SilentlyContinue)?.Path
+ ~~~~~~
Unexpected token '?.Path' in expression or statement.
At line:1 char:1
+ .\.specify\scripts\powershell\setup-tasks.ps1 -Json
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ParserError: (:) [setup-tasks.ps1], ParseException
+ FullyQualifiedErrorId : UnexpectedToken,setup-tasks.ps1
Additional Context
This speckit was in-place upgraded from a previous version ~ 1 month old
Actually, Copilot (Claude) fixed common.ps1 on the fly adding this function:
function Test-FeatureJsonMatchesFeatureDir {
param(
[Parameter(Mandatory=$true)][string]$RepoRoot,
[Parameter(Mandatory=$true)][string]$ActiveFeatureDir
)
$featureJsonPath = Join-Path $RepoRoot '.specify/feature.json'
if (-not (Test-Path $featureJsonPath -PathType Leaf)) { return $false }
try {
$data = Get-Content $featureJsonPath -Raw | ConvertFrom-Json
$pinnedRelative = $data.feature_directory
if ([string]::IsNullOrWhiteSpace($pinnedRelative)) { return $false }
$pinnedAbsolute = (Resolve-Path -LiteralPath (Join-Path $RepoRoot $pinnedRelative) -ErrorAction SilentlyContinue)?.Path
$activeAbsolute = (Resolve-Path -LiteralPath $ActiveFeatureDir -ErrorAction SilentlyContinue)?.Path
if (-not $pinnedAbsolute -or -not $activeAbsolute) { return $false }
return ($pinnedAbsolute.TrimEnd('\', '/') -eq $activeAbsolute.TrimEnd('\', '/'))
} catch {
return $false
}
}
Thanks for reporting this, @DibbsZA.
The function Test-FeatureJsonMatchesFeatureDir has been present in common.ps1 since v0.8.1, and v0.8.13 ships the correct version. However, upgrading the CLI alone (e.g., uv tool install specify-cli --force) does not update the project-local scripts in .specify/scripts/ — those are copies placed during initial setup. This means the project scripts need to be upgraded as a separate, intentional step.
Could you confirm how you performed the upgrade? Specifically, did you run specify integration upgrade after updating the CLI?
The correct upgrade sequence is:
- Upgrade the CLI —
uv tool install specify-cli --force --from git+https://github.com/github/spec-kit.git - Upgrade the project scripts —
specify integration upgrade(from within the project directory)
Step 2 is what refreshes .specify/scripts/ and the integration command files. Without it, the project retains the old scripts from whenever specify init was originally run. This separation is by design: specify integration upgrade checks for locally modified files and will not overwrite them without explicit confirmation (via --force), so you don't lose any customizations you may have made.
This issue has been automatically marked as stale because it has not had any activity for 60 days. It will be closed in 30 days if no further activity occurs.
This issue has been automatically closed after 90 days without activity. To request reconsideration, please provide updated reproduction details, the currently affected version or environment, and the present impact. Ask a maintainer to reopen this issue if it is fundamentally the same problem. If the scope or reproduction has materially changed, create a new issue, link this one, and explain what has changed.