pub async fn resolve_path(&self, path: Option<PathBuf>) -> PathBuf {
        let path = path.unwrap_or(PathBuf::from("."));
        // If the path exists or this is an explicitly provided path, return it as is
        if path.exists() || path.to_string_lossy() != "forge.yaml" {
            return path.to_path_buf();
        }

        // Get the current directory as the starting point
        let mut current_dir = std::env::current_dir().unwrap_or_else(|_| PathBuf::from("."));
        let filename = path.file_name().unwrap_or_default();

        // Start searching for the config in the current directory and its parents
        loop {
            let config_path = current_dir.join(filename);
            if config_path.exists() {
                return config_path;
            }

            // Try to go up one directory
            match current_dir.parent() {
                Some(parent) if parent != current_dir => {
                    current_dir = parent.to_path_buf();
                }
                // Stop if we've reached the root directory or can't go further up
                _ => break,
            }
        }

        // If no config was found, return the original path
        path.to_path_buf()
    }
Find a forge.yaml config file by traversing parent directories.
Returns the path to the first found config file, or the original path if
none is found.
crates/forge_services/src/workflow.rs