pub fn find_unit_file(mana_dir: &Path, id: &str) -> Result<PathBuf, Error>Expand description
Find a unit file by ID, supporting both new and legacy naming conventions.
Searches for unit 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_unit_file(mana_dir, "1")→.mana/1-my-task.mdor.mana/1.yamlfind_unit_file(mana_dir, "11.1")→.mana/11.1-refactor-parser.mdor.mana/11.1.yaml
§Arguments
mana_dir- Path to the.mana/directoryid- The unit ID to find (e.g., “1”, “11.1”, “3.2.1”)
§Errors
- If the ID is invalid (empty, contains path traversal, etc.)
- If no unit file is found for the given ID
- If glob pattern matching fails