Expand description
Install Claude Code resources from manifest dependencies.
This module provides the install command which reads dependencies from the
agpm.toml manifest file, resolves them, and installs the resource files
to the project directory. The command supports both fresh installations and
updates to existing installations with advanced parallel processing capabilities.
§Features
- Dependency Resolution: Resolves all dependencies defined in the manifest
- Transitive Dependencies: Automatically discovers and installs dependencies declared in resource files
- Lockfile Management: Generates and maintains
agpm.lockfor reproducible builds - Worktree-Based Parallel Installation: Uses Git worktrees for safe concurrent resource installation
- Multi-Phase Progress Tracking: Shows detailed progress with phase transitions and real-time updates
- Resource Validation: Validates markdown files and content during installation
- Cache Support: Advanced cache with instance-level optimizations and worktree management
- Concurrency Control: User-configurable parallelism via
--max-parallelflag - Cycle Detection: Prevents circular dependency loops in transitive dependency graphs
§Examples
Install all dependencies from manifest:
agpm installForce reinstall all dependencies:
agpm install --forceInstall without creating lockfile:
agpm install --no-lockUse frozen lockfile (CI/production):
agpm install --frozenDisable cache and clone fresh:
agpm install --no-cacheInstall only direct dependencies (skip transitive):
agpm install --no-transitivePreview installation without making changes:
agpm install --dry-run§Installation Process
- Manifest Loading: Reads
agpm.tomlto understand dependencies - Source Synchronization: Clones/fetches Git repositories for all sources
- Dependency Resolution: Resolves versions and creates dependency graph
- Transitive Discovery: Extracts dependencies from resource files (YAML/JSON metadata)
- Cycle Detection: Validates dependency graph for circular references
- Worktree Preparation: Pre-creates Git worktrees for optimal parallel access
- Parallel Resource Installation: Installs resources concurrently using isolated worktrees
- Progress Coordination: Updates multi-phase progress tracking throughout installation
- Configuration Updates: Updates hooks and MCP server configurations as needed
- Lockfile Generation: Creates or updates
agpm.lockwith checksums and metadata - Artifact Cleanup: Removes old artifacts from removed or relocated dependencies
§Error Conditions
- No manifest file found in project
- Invalid manifest syntax or structure
- Dependency resolution conflicts
- Circular dependency loops detected
- Invalid transitive dependency metadata (malformed YAML/JSON)
- Network or Git access issues
- File system permissions or disk space issues
- Invalid resource file format
§Performance
The install command is optimized for maximum performance:
- Worktree-based parallelism: Each dependency gets its own isolated Git worktree
- Instance-level caching: Optimized worktree reuse within command execution
- Configurable concurrency:
--max-parallelflag controls dependency-level parallelism - Pre-warming strategy: Creates all needed worktrees upfront for optimal parallel access
- Atomic file operations: Safe, corruption-resistant file installation
- Multi-phase progress: Real-time progress updates with phase transitions
§Optimization Tiers
The install command uses a tiered optimization strategy for repeated installations:
-
Fast Path (skip resolution): When the manifest hash matches and all dependencies are immutable (Git-based with tags/SHAs), the entire resolution phase is skipped. The lockfile is used directly as the installation plan.
- Triggered by:
manifest_hashmatch +has_mutable_deps = false+ validresource_count - Saves: Network fetches, version resolution, transitive dependency discovery
- Triggered by:
-
Ultra-Fast Path (skip checksum computation): For each resource being installed, if all content-affecting inputs match the previous lockfile entry (commit, path, patches, template vars) and the file exists, skip reading and hashing the file.
- Triggered by:
trust_lockfile_checksums = true+ all inputs match old entry - Saves: File I/O, SHA-256 computation (significant for large files)
- Triggered by:
-
Trust Mode: Within ultra-fast path, when a resource’s inputs match exactly, the previous checksum is reused without verification. This is safe because immutable Git dependencies (tags/SHAs) guarantee identical content.
§Security Considerations
Trust mode assumes:
- Upstream repositories have not been compromised (tag force-push attacks)
- The local cache (
~/.agpm/cache/) has not been tampered with
For security-sensitive environments, consider:
- Using
--no-cacheto always fetch fresh content - Modifying the manifest to force re-resolution (e.g., bumping version)
- Regularly auditing installed resources against known-good checksums
Structs§
- Install
Command - Command to install Claude Code resources from manifest dependencies.