pub async fn install_resource_with_progress(
entry: &LockedResource,
resource_dir: &str,
context: &InstallContext<'_>,
pb: &ProgressBar,
) -> Result<(bool, String, AppliedPatches)>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, InstallContext};
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: Some("claude-code".to_string()),
manifest_alias: None,
applied_patches: std::collections::HashMap::new(),
install: None,
};
let context = InstallContext::new(Path::new("."), &cache, false, false, None, None, None, None, None, None);
let (installed, checksum, _patches) = install_resource_with_progress(
&entry,
"agents",
&context,
&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