mirror of
https://github.com/github/spec-kit.git
synced 2026-07-04 04:45:43 +08:00
* fix: honor template overrides for tasks-template (#2278) - Add scripts/bash/setup-tasks.sh mirroring setup-plan.sh pattern - Add scripts/powershell/setup-tasks.ps1 mirroring setup-plan.ps1 pattern - Update tasks.md frontmatter to use dedicated setup-tasks scripts - Resolve tasks template via override stack and emit path as TASKS_TEMPLATE in JSON output - Reference resolved TASKS_TEMPLATE path in generate step instead of hardcoded path * fix: remove stray EOF tokens from setup-tasks scripts * fix: improve error messages for unresolved tasks-template * test: update file inventory tests to include setup-tasks scripts * fix: use Console::Error.WriteLine instead of Write-Error in setup-tasks.ps1 * fix: write prerequisite error messages to stderr in setup-tasks.ps1 * fix: validate tasks template is a file and normalize path in setup-tasks.ps1 * fix: improve tasks-template error message to mention full override stack * test: add setup-tasks.sh to TestCopilotSkillsMode file inventory * fix: skip feature-branch validation when feature.json pins FEATURE_DIR * fix: correct override path in tasks-template error messages * test: add integration tests for setup-tasks template resolution and branch validation * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * fix: correct fixture paths and add spec.md prerequisite checks * fix: use correct .registry schema in preset priority test * fix: remove stale aaa-preset block and duplicate comment in preset priority test * fix: align preset directory names with registry IDs in priority test --------- Co-authored-by: Nimraakram22 <nimra.akram123451@gmail.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
75 lines
3.1 KiB
PowerShell
75 lines
3.1 KiB
PowerShell
#!/usr/bin/env pwsh
|
|
|
|
[CmdletBinding()]
|
|
param(
|
|
[switch]$Json,
|
|
[switch]$Help
|
|
)
|
|
|
|
$ErrorActionPreference = 'Stop'
|
|
|
|
if ($Help) {
|
|
Write-Output "Usage: setup-tasks.ps1 [-Json] [-Help]"
|
|
exit 0
|
|
}
|
|
|
|
# Source common functions
|
|
. "$PSScriptRoot/common.ps1"
|
|
|
|
# Get feature paths and validate branch
|
|
$paths = Get-FeaturePathsEnv
|
|
|
|
# If feature.json pins an existing feature directory, branch naming is not required.
|
|
if (-not (Test-FeatureJsonMatchesFeatureDir -RepoRoot $paths.REPO_ROOT -ActiveFeatureDir $paths.FEATURE_DIR)) {
|
|
if (-not (Test-FeatureBranch -Branch $paths.CURRENT_BRANCH -HasGit $paths.HAS_GIT)) {
|
|
exit 1
|
|
}
|
|
}
|
|
|
|
if (-not (Test-Path $paths.IMPL_PLAN -PathType Leaf)) {
|
|
[Console]::Error.WriteLine("ERROR: plan.md not found in $($paths.FEATURE_DIR)")
|
|
[Console]::Error.WriteLine("Run /speckit.plan first to create the implementation plan.")
|
|
exit 1
|
|
}
|
|
|
|
if (-not (Test-Path $paths.FEATURE_SPEC -PathType Leaf)) {
|
|
[Console]::Error.WriteLine("ERROR: spec.md not found in $($paths.FEATURE_DIR)")
|
|
[Console]::Error.WriteLine("Run /speckit.specify first to create the feature structure.")
|
|
exit 1
|
|
}
|
|
|
|
# Build available docs list
|
|
$docs = @()
|
|
if (Test-Path $paths.RESEARCH) { $docs += 'research.md' }
|
|
if (Test-Path $paths.DATA_MODEL) { $docs += 'data-model.md' }
|
|
if ((Test-Path $paths.CONTRACTS_DIR) -and (Get-ChildItem -Path $paths.CONTRACTS_DIR -ErrorAction SilentlyContinue | Select-Object -First 1)) {
|
|
$docs += 'contracts/'
|
|
}
|
|
if (Test-Path $paths.QUICKSTART) { $docs += 'quickstart.md' }
|
|
|
|
# Resolve tasks template through override stack
|
|
$tasksTemplate = Resolve-Template -TemplateName 'tasks-template' -RepoRoot $paths.REPO_ROOT
|
|
if (-not $tasksTemplate -or -not (Test-Path -LiteralPath $tasksTemplate -PathType Leaf)) {
|
|
$expectedCoreTemplate = Join-Path $paths.REPO_ROOT '.specify/templates/tasks-template.md'
|
|
[Console]::Error.WriteLine("ERROR: Tasks template not found for repository root: $($paths.REPO_ROOT)`nTemplate resolution order: overrides -> presets -> extensions -> core.`nExpected shared/core template location: $expectedCoreTemplate`nTo continue, verify whether 'tasks-template.md' is available in '.specify/templates/overrides/', preset templates, extension templates, or restore the shared/core templates (for example by re-running 'specify init') so that '.specify/templates/tasks-template.md' exists.")
|
|
exit 1
|
|
}
|
|
$tasksTemplate = (Resolve-Path -LiteralPath $tasksTemplate).Path
|
|
|
|
# Output results
|
|
if ($Json) {
|
|
[PSCustomObject]@{
|
|
FEATURE_DIR = $paths.FEATURE_DIR
|
|
AVAILABLE_DOCS = $docs
|
|
TASKS_TEMPLATE = $tasksTemplate
|
|
} | ConvertTo-Json -Compress
|
|
} else {
|
|
Write-Output "FEATURE_DIR: $($paths.FEATURE_DIR)"
|
|
Write-Output "TASKS_TEMPLATE: $(if ($tasksTemplate) { $tasksTemplate } else { 'not found' })"
|
|
Write-Output "AVAILABLE_DOCS:"
|
|
Test-FileExists -Path $paths.RESEARCH -Description 'research.md' | Out-Null
|
|
Test-FileExists -Path $paths.DATA_MODEL -Description 'data-model.md' | Out-Null
|
|
Test-DirHasFiles -Path $paths.CONTRACTS_DIR -Description 'contracts/' | Out-Null
|
|
Test-FileExists -Path $paths.QUICKSTART -Description 'quickstart.md' | Out-Null
|
|
}
|