pub async fn install_resource_with_progress(
entry: &LockedResource,
project_dir: &Path,
resource_dir: &str,
cache: &Cache,
force_refresh: bool,
pb: &ProgressBar,
) -> Result<(bool, String)>Expand description
Install a single resource with progress bar updates for user feedback.
This function wraps install_resource with progress bar integration to provide
real-time feedback during resource installation. It updates the progress bar
message before delegating to the core installation logic.
§Arguments
entry- The locked resource containing installation metadataproject_dir- Root project directory for installation targetresource_dir- Subdirectory name for this resource type (e.g., “agents”)cache- Cache instance for Git repository and worktree managementforce_refresh- Whether to force refresh of cached repositoriespb- Progress bar to update with installation status
§Returns
Returns a tuple of:
bool: Whether the resource was actually installed (truefor new/updated,falsefor unchanged)String: SHA-256 checksum of the installed content
§Progress Integration
The function automatically sets the progress bar message to indicate which resource is currently being installed. This provides users with real-time feedback about installation progress.
§Examples
use agpm_cli::installer::install_resource_with_progress;
use agpm_cli::lockfile::LockedResource;
use agpm_cli::cache::Cache;
use agpm_cli::core::ResourceType;
use agpm_cli::utils::progress::ProgressBar;
use std::path::Path;
let cache = Cache::new()?;
let pb = ProgressBar::new(1);
let entry = LockedResource {
name: "example-agent".to_string(),
source: Some("community".to_string()),
url: Some("https://github.com/example/repo.git".to_string()),
path: "agents/example.md".to_string(),
version: Some("v1.0.0".to_string()),
resolved_commit: Some("abc123".to_string()),
checksum: "sha256:...".to_string(),
installed_at: ".claude/agents/example.md".to_string(),
dependencies: vec![],
resource_type: ResourceType::Agent,
tool: "claude-code".to_string(),
};
let (installed, checksum) = install_resource_with_progress(
&entry,
Path::new("."),
"agents",
&cache,
false,
&pb
).await?;
pb.inc(1);§Errors
Returns the same errors as install_resource, including:
- Repository access failures
- File system operation errors
- Invalid markdown content
- Git worktree creation failures