Skip to content

Commit 2437d7a

Browse files
committed
fix: skip convention fallback for explicit file paths and add stem fallback to tier-5
When a preset manifest provides an explicit file path that does not exist, skip the convention-based fallback to avoid masking typos. Also add speckit.<stem> to <stem>.md fallback in tier-5 bundled/source core lookup for consistency with tier-4.
1 parent 0a562ac commit 2437d7a

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

src/specify_cli/presets.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2440,6 +2440,10 @@ def resolve(
24402440
candidate = _core_pack / "templates" / f"{template_name}.md"
24412441
elif template_type == "command":
24422442
candidate = _core_pack / "commands" / f"{template_name}.md"
2443+
if not candidate.exists():
2444+
stem = self._core_stem(template_name)
2445+
if stem:
2446+
candidate = _core_pack / "commands" / f"{stem}.md"
24432447
elif template_type == "script":
24442448
candidate = _core_pack / "scripts" / f"{template_name}{ext}"
24452449
else:
@@ -2453,6 +2457,10 @@ def resolve(
24532457
candidate = repo_root / "templates" / f"{template_name}.md"
24542458
elif template_type == "command":
24552459
candidate = repo_root / "templates" / "commands" / f"{template_name}.md"
2460+
if not candidate.exists():
2461+
stem = self._core_stem(template_name)
2462+
if stem:
2463+
candidate = repo_root / "templates" / "commands" / f"{stem}.md"
24562464
elif template_type == "script":
24572465
candidate = repo_root / "scripts" / f"{template_name}{ext}"
24582466
else:
@@ -2663,7 +2671,9 @@ def _find_in_subdirs(base_dir: Path) -> Optional[Path]:
26632671
manifest_candidate = pack_dir / manifest_file_path
26642672
if manifest_candidate.exists():
26652673
candidate = manifest_candidate
2666-
if candidate is None:
2674+
# Explicit file path that doesn't exist: skip convention
2675+
# fallback to avoid masking typos or picking up unintended files.
2676+
elif candidate is None:
26672677
candidate = _find_in_subdirs(pack_dir)
26682678
if candidate:
26692679
# Legacy fallback: if manifest doesn't explicitly declare a

0 commit comments

Comments
 (0)