pub fn find_bean_file(beans_dir: &Path, id: &str) -> Result<PathBuf>Expand description
Find a bean file by ID, supporting both new and legacy naming conventions.
Searches for bean files in this order:
- New format:
{id}-{slug}.md(e.g., “1-my-task.md”, “11.1-refactor-parser.md”) - Legacy format:
{id}.yaml(e.g., “1.yaml”, “11.1.yaml”)
Returns the full path if found.
§Examples
find_bean_file(beans_dir, "1")→.beans/1-my-task.mdor.beans/1.yamlfind_bean_file(beans_dir, "11.1")→.beans/11.1-refactor-parser.mdor.beans/11.1.yaml
§Arguments
beans_dir- Path to the.beans/directoryid- The bean ID to find (e.g., “1”, “11.1”, “3.2.1”)
§Errors
- If the ID is invalid (empty, contains path traversal, etc.)
- If no bean file is found for the given ID
- If glob pattern matching fails