Skip to content

Copy core command templates into .specify/templates/commands on init - #4506

Closed
gyanu2507 wants to merge 1 commit into
github:mainfrom
gyanu2507:fix/3086-copy-command-templates
Closed

Copy core command templates into .specify/templates/commands on init#4506
gyanu2507 wants to merge 1 commit into
github:mainfrom
gyanu2507:fix/3086-copy-command-templates

Conversation

@gyanu2507

@gyanu2507 gyanu2507 commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Description

specify init copied only top-level files from templates/, so .specify/templates/commands/ never existed after install. Wrap presets then had no core base layer and registered_commands stayed empty.

The wheel maps templates/commands to core_pack/commands, which that file loop could not see. install_shared_infra and refresh_shared_templates now copy that tree with the same overwrite and manifest policy as the other shared templates.

Testing

  • Ran existing tests with uv sync && uv run pytest
  • uv run pytest tests/test_shared_infra_commands.py tests/test_shared_infra_gitignore.py tests/test_command_template_py_scripts.py

AI Disclosure

  • I did use AI assistance (describe below)

LLM-assisted implementation. I chose the issue, wrote the tests, and ran them locally.

Fixes #3086

specify init only copied top-level template files, so wrap presets had
no core base layer after a fresh install. The wheel maps commands to
core_pack/commands, which that loop could not see.

Fixes github#3086
@gyanu2507
gyanu2507 requested a review from mnriem as a code owner September 10, 2026 11:50
@mnriem

mnriem commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator

Thanks @gyanu2507 — clean, well-tested, focused change, and the disclosure is exactly right. But I think this may be fixing a problem that isn't actually present on current main, so I want to check the premise before we add this.

The wrap resolver doesn't require .specify/templates/commands/. In PresetResolver (presets/__init__.py, the core-resolution path), .specify/templates/commands/ is only an optional Priority 4 override; Priority 5 falls back to the bundled core_pack/commands (wheel) or templates/commands (source checkout), and the comment there notes it "must always be checked so that strategy:wrap presets can locate {CORE_TEMPLATE}." So a wrap preset should resolve its {CORE_TEMPLATE} base from core_pack/commands even when .specify/templates/commands/ is absent — which is the same tree you note the wheel maps templates/commands onto.

Copying the tree into .specify/templates/commands/ makes it a tracked, overwrite-managed override that shadows that canonical core_pack source, which is drift surface I'd rather not add unless there's a real gap.

Could you share a concrete reproduction on current main — a wrap command override that fails to resolve its core base without .specify/templates/commands/ present? If the Priority-5 fallback isn't firing in some install layout, that's the actual bug to fix (in the resolver), and I'll prioritize it. If it resolves fine, then #3086 is already addressed by that fallback and we can close both out.

@mnriem mnriem added triage-can-wait Verdict: valid and in-scope but deprioritized; held behind the evidence gate author-needs-info Missing detail needed to assess — supply requested info labels Sep 10, 2026
@gyanu2507

Copy link
Copy Markdown
Contributor Author

You're right. I re-checked wrap on current main with an empty .specify/templates/commands/.

collect_all_layers("speckit.implement", "command") still gets a Priority 5 base: core (bundled) pointing at commands/implement.md. Same for resolve(). That's already pinned in test_collect_all_layers_finds_bundled_core_without_specify_commands and test_resolve_command_falls_back_to_bundled_core.

Copying the tree into .specify/templates/commands/ would only add an overwrite-managed shadow of core_pack. Closing this PR. #3086 looks addressed by that fallback.

@gyanu2507 gyanu2507 closed this Sep 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author-needs-info Missing detail needed to assess — supply requested info triage-can-wait Verdict: valid and in-scope but deprioritized; held behind the evidence gate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

specify init does not copy templates/commands/ to .specify/templates/commands/ — wrap composition strategy fails

2 participants