mirror of
https://github.com/github/spec-kit.git
synced 2026-07-03 12:28:06 +08:00
* fix(presets): use _repo_root() for bundled-core source-checkout fallback The tier-5 fallback in PresetResolver.resolve() and _find_bundled_core() computed the repo root as Path(__file__).parent.parent.parent. After presets.py was moved to presets/__init__.py (#2826) that chain is one level short, resolving to src/ and looking for src/templates/commands/<cmd>.md, which never exists. As a result, wrap-strategy presets found no core base layer in source/editable installs. Use the shared _repo_root() helper so both fallbacks resolve against the actual repo-root templates/ tree. Wheel installs were unaffected (core_pack path), so this only impacts source/editable checkouts. Refs #3086 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * test(presets): restore dropped def for oserror-manifest test A prior edit accidentally removed the def test_resolve_extension_command_via_manifest_skips_oserror_manifests line, orphaning its body inside the new bundled-core test. Restore the test definition so pytest collects it again. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * test(presets): move bundled-core tests into TestPresetResolver The two tier-5 fallback regression tests exercise collect_all_layers() and resolve(), not resolve_core(), so they belong in TestPresetResolver rather than TestResolveCore. Relocate them for clearer suite navigation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -2707,7 +2707,7 @@ class PresetResolver:
|
||||
# (source-checkout / editable install). This is the canonical home for
|
||||
# speckit's built-in command/template files and must always be checked
|
||||
# so that strategy:wrap presets can locate {CORE_TEMPLATE}.
|
||||
from specify_cli import _locate_core_pack # local import to avoid cycles
|
||||
from specify_cli import _locate_core_pack, _repo_root # local import to avoid cycles
|
||||
_core_pack = _locate_core_pack()
|
||||
if _core_pack is not None:
|
||||
# Wheel install path
|
||||
@@ -2727,7 +2727,7 @@ class PresetResolver:
|
||||
return candidate
|
||||
else:
|
||||
# Source-checkout / editable install: templates live at repo root
|
||||
repo_root = Path(__file__).parent.parent.parent
|
||||
repo_root = _repo_root()
|
||||
if template_type == "template":
|
||||
candidate = repo_root / "templates" / f"{template_name}.md"
|
||||
elif template_type == "command":
|
||||
@@ -3079,7 +3079,7 @@ class PresetResolver:
|
||||
``.specify/templates/`` doesn't contain the core file.
|
||||
"""
|
||||
try:
|
||||
from specify_cli import _locate_core_pack
|
||||
from specify_cli import _locate_core_pack, _repo_root
|
||||
except ImportError:
|
||||
return None
|
||||
|
||||
@@ -3102,7 +3102,7 @@ class PresetResolver:
|
||||
if c.exists():
|
||||
return c
|
||||
else:
|
||||
repo_root = Path(__file__).parent.parent.parent
|
||||
repo_root = _repo_root()
|
||||
for name in names:
|
||||
if template_type == "template":
|
||||
c = repo_root / "templates" / f"{name}.md"
|
||||
|
||||
Reference in New Issue
Block a user