Skip to content

Commit 53220f8

Browse files
fix: resolve core template from package bundle, not project .specify dir
1 parent 6a24268 commit 53220f8

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/specify_cli/presets.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,20 @@ def _substitute_core_template(
4848
if "{CORE_TEMPLATE}" not in body:
4949
return body
5050

51+
# Prefer the project's installed core template so project-level commands and
52+
# customisations are wrapped correctly. Fall back to the bundled core_pack or
53+
# repo templates for commands that ship with the package.
5154
core_file = project_root / ".specify" / "templates" / "commands" / f"{short_name}.md"
55+
if not core_file.exists():
56+
from specify_cli import _locate_core_pack
57+
core_pack = _locate_core_pack()
58+
if core_pack is not None:
59+
core_file = core_pack / "commands" / f"{short_name}.md"
60+
else:
61+
# Source / editable install: look relative to the package root
62+
repo_root = Path(__file__).parent.parent.parent
63+
core_file = repo_root / "templates" / "commands" / f"{short_name}.md"
64+
5265
if not core_file.exists():
5366
return body
5467

0 commit comments

Comments
 (0)