-
Notifications
You must be signed in to change notification settings - Fork 226
Open
Description
Summary
The recipes tool's path resolution has two issues that cause confusing "Recipe file not found" errors:
Issue 1: Tilde (~) expansion not supported
When a path like ~/dev/my-recipes/recipe.yaml is passed to the recipes tool, it fails because tilde is not expanded.
Current code (amplifier-bundle-recipes/.../amplifier_module_tool_recipes/__init__.py:344-359):
def _resolve_path(self, path_str: str) -> Path | None:
if path_str.startswith("@"):
mention_resolver = self.coordinator.get_capability("mention_resolver")
if mention_resolver is None:
return None
return mention_resolver.resolve(path_str)
return Path(path_str) # <-- No .expanduser() callFix: Add .expanduser() to the fallback path:
return Path(path_str).expanduser()Issue 2: Bundle paths without @ prefix fail silently
When users pass bundle:path/to/recipe.yaml (without the @ prefix), it falls through to Path(path_str) which treats it as a literal path and fails.
This is confusing because:
- The bundle.md format uses
bundle:pathsyntax (no@) - The
@requirement is not immediately obvious
Options:
- Document clearly that
@is required (done in amplifier-module-stories README) - Detect colon in path and provide a helpful error message suggesting the
@prefix - Auto-detect bundle paths (if path contains
:and doesn't look like a Windows drive letter)
Reproduction
# Fails - tilde not expanded
amplifier tool invoke recipes operation=validate recipe_path="~/dev/my-bundle/recipes/test.yaml"
# Fails - missing @ prefix (confusing)
amplifier tool invoke recipes operation=validate recipe_path="my-bundle:recipes/test.yaml"
# Works
amplifier tool invoke recipes operation=validate recipe_path="@my-bundle:recipes/test.yaml"Suggested Fix
Minimal change to _resolve_path():
def _resolve_path(self, path_str: str) -> Path | None:
"""Resolve a path string, handling @mention syntax."""
if path_str.startswith("@"):
mention_resolver = self.coordinator.get_capability("mention_resolver")
if mention_resolver is None:
return None
return mention_resolver.resolve(path_str)
# Expand ~ to home directory
return Path(path_str).expanduser()Impact
This affects any user who:
- Uses
~in recipe paths (common pattern) - Forgets the
@prefix on bundle paths (easy mistake)
Both result in the same unhelpful error: "Recipe file not found: [path]"
Discovered while using amplifier-module-stories recipes
Metadata
Metadata
Assignees
Labels
No labels