fix: honor template overrides for tasks-template (#2278)#2292
fix: honor template overrides for tasks-template (#2278)#2292Nimraakram22 wants to merge 6 commits intogithub:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR aims to bring the /tasks command into parity with /plan by adding template override resolution for tasks-template.md (overrides → presets → extensions → core) and updating docs accordingly.
Changes:
- Updated
templates/commands/tasks.mdto reference aTASKS_TEMPLATEplaceholder instead of a hardcoded path. - Added new setup scripts for resolving
tasks-template(bash + PowerShell) and wired PowerShell prerequisite checks to run them. - Updated preset documentation to state that the override stack applies to
tasks-template.mdas well.
Show a summary per file
| File | Description |
|---|---|
| templates/commands/tasks.md | Replaces hardcoded tasks template path with a placeholder reference. |
| scripts/powershell/setup-tasks.ps1 | Adds PowerShell template resolution and writes a resolved template file. |
| scripts/powershell/check-prerequisites.ps1 | Attempts to run setup scripts as part of prerequisite checking. |
| scripts/bash/setup-tasks.sh | Adds bash template resolution/export for tasks-template. |
| docs/reference/presets.md | Documents tasks-template as participating in the same override stack as plan-template. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 5/5 changed files
- Comments generated: 5
Suggested fix for #2278 / PR #2292The current PR introduces Since Overview
1.
|
mnriem
left a comment
There was a problem hiding this comment.
See comments authored together with Copilot above
- 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
ce75d8d to
05b1ea8
Compare
|
Hi @mnriem, thank you for the detailed feedback. I've rewritten the PR from scratch following your suggested approach: What changed:
The bash script also now fails fast with a non-zero exit and a clear error message if the template cannot be resolved, as suggested by Copilot. Please let me know if anything needs further adjustment. Thank you! |
There was a problem hiding this comment.
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 3/3 changed files
- Comments generated: 3
mnriem
left a comment
There was a problem hiding this comment.
Please address Copilot feedback
|
Thanks for the review @mnriem and Copilot. Fixed:
These were leftover artifacts from the heredoc used to write the files and would have caused a Not changed:
|
There was a problem hiding this comment.
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 3/3 changed files
- Comments generated: 2
|
Please address Copilot feedback |
|
Thanks again @mnriem and Copilot. Fixed:
|
There was a problem hiding this comment.
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 3/3 changed files
- Comments generated: 0 new
|
Please address Test & Lint errors |
|
Hi @mnriem, addressed the Test & Lint failures. The file inventory tests across 6 integration test files (
The 6 remaining failures in All 1388 previously passing tests continue to pass. |
There was a problem hiding this comment.
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comments suppressed due to low confidence (1)
templates/commands/tasks.md:79
- The PR description mentions switching to
{{TASKS_TEMPLATE}}/ exporting via env vars, but this command template currently relies on reading aTASKS_TEMPLATEfield from the JSON emitted by{SCRIPT}. Please either update the PR description (and any related docs) to match this JSON-based flow, or adjust the template to use the mechanism described, so future maintainers aren’t misled about how the template path is provided.
4. **Generate tasks.md**: Read the tasks template from TASKS_TEMPLATE (from the JSON output above) and use it as structure. If TASKS_TEMPLATE is empty, fall back to `.specify/templates/tasks-template.md`. Fill with:
- Files reviewed: 9/9 changed files
- Comments generated: 1
|
Please address Copilot feedback. If not applicable, please explain why |
|
Hi @mnriem, addressed the Copilot feedback. Fixed:
Not applicable — PR description comment: |
There was a problem hiding this comment.
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comments suppressed due to low confidence (1)
scripts/powershell/setup-tasks.ps1:37
- Same as above: this error path uses
Write-Outputfor an error condition. Please emit these lines to stderr (and ideally use a non-terminating write only when you still plan to output JSON/text successfully).
if (-not (Test-Path $paths.IMPL_PLAN -PathType Leaf)) {
Write-Output "ERROR: plan.md not found in $($paths.FEATURE_DIR)"
Write-Output "Run /speckit.plan first to create the implementation plan."
exit 1
}
- Files reviewed: 9/9 changed files
- Comments generated: 1
|
Please address Copilot feedback |
|
Hi @mnriem, addressed the Copilot feedback. Fixed:
|
There was a problem hiding this comment.
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 9/9 changed files
- Comments generated: 1
| if (-not $tasksTemplate) { | ||
| $expectedCoreTemplate = Join-Path $paths.REPO_ROOT '.specify/templates/tasks-template.md' | ||
| [Console]::Error.WriteLine("Tasks template not found for repository root: $($paths.REPO_ROOT)`nExpected shared/core template location: $expectedCoreTemplate`nTo continue, restore the shared templates (for example by re-running 'specify init') so that '.specify/templates/tasks-template.md' exists, or add a valid tasks-template override.") | ||
| exit 1 | ||
| } |
There was a problem hiding this comment.
Resolve-Template currently returns any existing path (not necessarily a file), and this script only checks whether $tasksTemplate is non-empty. To avoid accepting a directory or a stale path if Resolve-Template behavior changes, validate with Test-Path -PathType Leaf (and consider normalizing to a full path) before emitting TASKS_TEMPLATE.
| if (-not $tasksTemplate) { | |
| $expectedCoreTemplate = Join-Path $paths.REPO_ROOT '.specify/templates/tasks-template.md' | |
| [Console]::Error.WriteLine("Tasks template not found for repository root: $($paths.REPO_ROOT)`nExpected shared/core template location: $expectedCoreTemplate`nTo continue, restore the shared templates (for example by re-running 'specify init') so that '.specify/templates/tasks-template.md' exists, or add a valid tasks-template override.") | |
| exit 1 | |
| } | |
| 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("Tasks template not found for repository root: $($paths.REPO_ROOT)`nExpected shared/core template location: $expectedCoreTemplate`nTo continue, restore the shared templates (for example by re-running 'specify init') so that '.specify/templates/tasks-template.md' exists, or add a valid tasks-template override.") | |
| exit 1 | |
| } | |
| $tasksTemplate = (Resolve-Path -LiteralPath $tasksTemplate).Path |
|
Please address Copilot feedback |
This PR resolves #2278 by implementing a unified template resolution flow for the tasks command, bringing it into parity with the plan command.
Key Changes:
Removed hardcoded path in templates/commands/tasks.md in favor of {{TASKS_TEMPLATE}}.
Added setup-tasks.ps1 and setup-tasks.sh to handle the resolution priority stack (Overrides > Presets > Core).
Exported the resolved path via environment variables in the prerequisite check.
Updated docs/reference/presets.md to include tasks-template.md in the documented override stack.
Verification:
Confirmed on Windows 64-bit that local overrides in .specify/templates/overrides/tasks-template.md are correctly loaded and utilized by the AI agent.