Skip to content

Commit 14da893

Browse files
WOLIKIMCHENGroot
andauthored
fix(copilot): resolve active spec template (#2765)
Co-authored-by: root <kinsonnee@gmail.com>
1 parent 39925ac commit 14da893

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

templates/commands/specify.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ Given that feature description, do this:
9191
9292
**Create the directory and spec file**:
9393
- `mkdir -p SPECIFY_FEATURE_DIRECTORY`
94-
- Copy `templates/spec-template.md` to `SPECIFY_FEATURE_DIRECTORY/spec.md` as the starting point
94+
- Resolve the active `spec-template` through the Spec Kit preset/template resolution stack (equivalent to `specify preset resolve spec-template`)
95+
- Copy the resolved `spec-template` file to `SPECIFY_FEATURE_DIRECTORY/spec.md` as the starting point
9596
- Set `SPEC_FILE` to `SPECIFY_FEATURE_DIRECTORY/spec.md`
9697
- Persist the resolved path to `.specify/feature.json`:
9798
```json
@@ -107,7 +108,7 @@ Given that feature description, do this:
107108
- The spec directory name and the git branch name are independent — they may be the same but that is the user's choice
108109
- The spec directory and file are always created by this command, never by the hook
109110
110-
4. Load `templates/spec-template.md` to understand required sections.
111+
4. Load the resolved active `spec-template` file to understand required sections.
111112
112113
5. **IF EXISTS**: Load `/memory/constitution.md` for project principles and governance constraints.
113114

tests/integrations/test_integration_copilot.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,21 @@ def test_templates_are_processed(self, tmp_path):
147147
assert "__SPECKIT_COMMAND_" not in content, f"{agent_file.name} has unprocessed __SPECKIT_COMMAND_*__"
148148
assert "\nscripts:\n" not in content
149149

150+
def test_specify_agent_resolves_active_spec_template(self, tmp_path):
151+
"""Generated specify agent must not hardcode the core spec template."""
152+
from specify_cli.integrations.copilot import CopilotIntegration
153+
copilot = CopilotIntegration()
154+
m = IntegrationManifest("copilot", tmp_path)
155+
copilot.setup(tmp_path, m)
156+
157+
specify_file = tmp_path / ".github" / "agents" / "speckit.specify.agent.md"
158+
content = specify_file.read_text(encoding="utf-8")
159+
160+
assert "specify preset resolve spec-template" in content
161+
assert "resolved active `spec-template`" in content
162+
assert "Copy `.specify/templates/spec-template.md`" not in content
163+
assert "Load `.specify/templates/spec-template.md`" not in content
164+
150165
def test_plan_references_correct_context_file(self, tmp_path):
151166
"""The generated plan command must reference copilot's context file."""
152167
from specify_cli.integrations.copilot import CopilotIntegration

0 commit comments

Comments
 (0)