Repository navigation
fix(templates): start spec.md from the composed spec-template - #5187
Merged
Merged
Conversation
The specify command told the agent to copy "the resolved spec-template file" to spec.md. When a preset contributes spec-template with an append, prepend or wrap strategy, no single file holds the composed template, so the preset layers were dropped from new specs. Run resolve-template for spec-template, as the constitution command does, and write TEMPLATE_CONTENT to spec.md. Fixes github#5177
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
There are no active review issues for the change to initialize spec.md from composed template content.
No open issues 🎉
What changed in this PR
Fixes #5177 by making /speckit.specify initialize spec.md from composed template content, preserving preset layers rather than copying a single contributing file.
Changes:
- Adds Bash, PowerShell, and Python template-resolver commands.
- Requires writing
TEMPLATE_CONTENTtospec.mdand stopping on resolution errors. - Adds regression assertions and updates Copilot integration checks for the rendered instructions.
| File | Description |
|---|---|
tests/test_presets.py |
Adds assertions requiring composed content and rejecting the old file-copy instruction. |
tests/integrations/test_integration_copilot.py |
Checks resolver rendering and composed-content instructions in the generated agent. |
templates/commands/specify.md |
Resolves and uses composed template content for spec creation and required sections. |
Review effort: Balanced (auto)
Collaborator
|
Thank you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
/speckit.specifytold the agent to resolvespec-templateand then copy "the resolvedspec-templatefile" tospec.md. When a preset providesspec-templatewithappend,prependorwrap, no single file holds the composed template, so those layers silently drop out of new specs./speckit.plan,/speckit.tasks,/speckit.checklistand/speckit.constitutionalready consume composed content.This gives
specify.mdthe samescripts:frontmatter asconstitution.md(resolve-templateforspec-template, in the sh, ps and py variants) and changes the prose to:{SCRIPT}and parseTEMPLATE_CONTENTbefore creating the directory, and stop on a resolution error rather than fall back to one layerTEMPLATE_CONTENTtoSPECIFY_FEATURE_DIRECTORY/spec.mdTEMPLATE_CONTENT(not a template file) for the required sections in step 4Tests:
tests/test_presets.py: newtest_core_specify_command_writes_composed_spec_template, next to the constitution and checklist assertions. It fails onmainand passes with the change.tests/integrations/test_integration_copilot.py:test_specify_agent_resolves_active_spec_templateasserted the old wording (specify preset resolve spec-template). It now checks that the generated agent runs the resolver and writesTEMPLATE_CONTENT, and keeps the negative checks against hardcoding the core template.Only the core template carried the copy instruction. The bundled presets'
speckit.specify.mdoverrides do not reference a resolved file. #4883 also editsspecify.md, but only the hook sections, so the two diffs do not overlap.Fixes #5177
Testing
uv run specify --helpuv sync && uv run pytestRun inside the project venv with
PATH="$PWD/.venv/bin:$PATH" .venv/bin/python -m pytest -n 2 -q:uvx ruff@0.15.0 check src testsandgit diff --checkare clean.Sample project (
specify init --integration claude --script shfrom this branch, then the issue'sappendpreset installed withspecify preset add --dev):So "copy the resolved file" gets either the addendum alone or, as the reporter saw, the core template alone. Following the new step (run the resolver, write
TEMPLATE_CONTENTtospec.md) gives the composed template:I followed the changed step by hand in the sample project. I did not run a full
/speckit.specifysession in a separate agent.AI Disclosure
AI disclosure: Implemented with Claude Code (Claude Opus 5.5, autonomous mode, default reasoning effort); code and test generation and this description.