InstallCommand

Struct InstallCommand 

Source
pub struct InstallCommand {
    pub no_lock: bool,
    pub frozen: bool,
    pub no_cache: bool,
    pub max_parallel: Option<usize>,
    pub quiet: bool,
    pub no_progress: bool,
    pub verbose: bool,
    pub no_transitive: bool,
    pub dry_run: bool,
    pub yes: bool,
}
Expand description

Command to install Claude Code resources from manifest dependencies.

This command reads the project’s agpm.toml manifest file, resolves all dependencies, and installs the resource files to the appropriate directories. It generates or updates a agpm.lock lockfile to ensure reproducible installations.

§Behavior

  1. Locates and loads the project manifest (agpm.toml)
  2. Resolves dependencies using the dependency resolver
  3. Downloads or updates Git repository sources as needed
  4. Installs resource files to target directories
  5. Generates or updates the lockfile (agpm.lock)
  6. Provides progress feedback during installation

§Examples

use agpm_cli::cli::install::InstallCommand;

// Standard installation
let cmd = InstallCommand {
    no_lock: false,
    frozen: false,
    no_cache: false,
    max_parallel: None,
    quiet: false,
    no_progress: false,
    verbose: false,
    no_transitive: false,
    dry_run: false,
    yes: false,
};

// CI/Production installation (frozen lockfile)
let cmd = InstallCommand {
    no_lock: false,
    frozen: true,
    no_cache: false,
    max_parallel: Some(2),
    quiet: false,
    no_progress: false,
    verbose: false,
    no_transitive: false,
    dry_run: false,
    yes: false,
};

Fields§

§no_lock: bool

Don’t write lockfile after installation

Prevents the command from creating or updating the agpm.lock file. This is useful for development scenarios where you don’t want to commit lockfile changes.

§frozen: bool

Verify checksums from existing lockfile

Uses the existing lockfile as-is without updating dependencies. This mode ensures reproducible installations and is recommended for CI/CD pipelines and production deployments.

§no_cache: bool

Don’t use cache, clone fresh repositories

Disables the local Git repository cache and clones repositories to temporary locations. This increases installation time but ensures completely fresh downloads.

§max_parallel: Option<usize>

Maximum number of parallel operations (default: max(MIN_PARALLELISM, PARALLELISM_CORE_MULTIPLIER × CPU cores))

Controls the level of parallelism during installation. The default value is calculated as max(MIN_PARALLELISM, PARALLELISM_CORE_MULTIPLIER × CPU cores) to provide good performance while avoiding resource exhaustion. Higher values can speed up installation of many dependencies but may strain system resources or hit API rate limits.

§Performance Impact

  • Low values (1-4): Conservative approach, slower but more reliable
  • Default values (10-16): Balanced performance for most systems
  • High values (>20): May overwhelm system resources or trigger rate limits

§Examples

  • --max-parallel 1: Sequential installation (debugging)
  • --max-parallel 4: Conservative parallel installation
  • --max-parallel 20: Aggressive parallel installation (powerful systems)
§quiet: bool

Suppress non-essential output

When enabled, only errors and essential information will be printed. Progress bars and status messages will be hidden.

§no_progress: bool

Disable progress bars (for programmatic use, not exposed as CLI arg)

§verbose: bool

Enable verbose output (for programmatic use, not exposed as CLI arg)

This flag is populated from the global –verbose flag via execute_with_config

§no_transitive: bool

Don’t resolve transitive dependencies

When enabled, only direct dependencies from the manifest will be installed. Transitive dependencies declared within resource files (via YAML frontmatter or JSON fields) will be ignored. This can be useful for faster installations when you know transitive dependencies are already satisfied or for debugging dependency issues.

§dry_run: bool

Preview installation without making changes

Shows what would be installed, including new dependencies and lockfile changes, but doesn’t modify any files. Useful for reviewing changes before applying them, especially in CI/CD pipelines to detect when dependencies would change.

When enabled:

  • Resolves all dependencies normally
  • Shows what resources would be installed
  • Shows lockfile changes (new entries, version updates)
  • Does NOT write the lockfile
  • Does NOT install any resources

Exit codes:

  • 0: No changes would be made
  • 1: Changes would be made (useful for CI checks)
§yes: bool

Automatically accept migration prompts

When set, automatically accepts migration prompts for legacy CCPM files or legacy AGPM format without requiring user interaction. Useful for CI/CD pipelines and automated scripts.

Implementations§

Source§

impl InstallCommand

Source

pub const fn new() -> Self

Creates a default InstallCommand for programmatic use.

This constructor creates an InstallCommand with standard settings:

  • Lockfile generation enabled
  • Fresh dependency resolution (not frozen)
  • Cache enabled for performance
  • Default parallelism (see --max-parallel for formula)
  • Progress output enabled
§Examples
use agpm_cli::cli::install::InstallCommand;

let cmd = InstallCommand::new();
// cmd can now be executed with execute_from_path()
Source

pub const fn new_quiet() -> Self

Creates an InstallCommand configured for quiet operation.

This constructor creates an InstallCommand with quiet mode enabled, which suppresses progress bars and non-essential output. Useful for automated scripts or CI/CD environments where minimal output is desired.

§Examples
use agpm_cli::cli::install::InstallCommand;

let cmd = InstallCommand::new_quiet();
// cmd will execute without progress bars or status messages
Source

pub async fn execute_with_manifest_path( self, manifest_path: Option<PathBuf>, ) -> Result<()>

Executes the install command with automatic manifest discovery.

This method provides convenient manifest file discovery, searching for agpm.toml in the current directory and parent directories if no specific path is provided. It’s the standard entry point for CLI usage.

§Arguments
  • manifest_path - Optional explicit path to agpm.toml. If None, the method searches for agpm.toml starting from the current directory and walking up the directory tree.
§Manifest Discovery

When manifest_path is None, the search process:

  1. Checks current directory for agpm.toml
  2. Walks up parent directories until agpm.toml is found
  3. Stops at filesystem root if no manifest found
  4. Returns an error with helpful guidance if no manifest exists
§Examples
use agpm_cli::cli::install::InstallCommand;
use std::path::PathBuf;

let cmd = InstallCommand::new();

// Auto-discover manifest in current directory or parents
cmd.execute_with_manifest_path(None).await?;

// Use specific manifest file
cmd.execute_with_manifest_path(Some(PathBuf::from("./my-project/agpm.toml"))).await?;
§Errors

Returns an error if:

  • No agpm.toml file found in search path
  • Specified manifest path doesn’t exist
  • Manifest file contains invalid TOML syntax
  • Dependencies cannot be resolved
  • Installation process fails
§Error Messages

When no manifest is found, the error includes helpful guidance:

No agpm.toml found in current directory or any parent directory.

To get started, create a agpm.toml file with your dependencies:

[sources]
official = "https://github.com/example-org/agpm-official.git"

[agents]
my-agent = { source = "official", path = "agents/my-agent.md", version = "v1.0.0" }
Source

pub async fn execute_from_path(&self, path: Option<&Path>) -> Result<()>

Trait Implementations§

Source§

impl Args for InstallCommand

Source§

fn group_id() -> Option<Id>

Report the ArgGroup::id for this set of arguments
Source§

fn augment_args<'b>(__clap_app: Command) -> Command

Append to Command so it can instantiate Self via FromArgMatches::from_arg_matches_mut Read more
Source§

fn augment_args_for_update<'b>(__clap_app: Command) -> Command

Append to Command so it can instantiate self via FromArgMatches::update_from_arg_matches_mut Read more
Source§

impl Default for InstallCommand

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl FromArgMatches for InstallCommand

Source§

fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>

Instantiate Self from ArgMatches, parsing the arguments as needed. Read more
Source§

fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches, ) -> Result<Self, Error>

Instantiate Self from ArgMatches, parsing the arguments as needed. Read more
Source§

fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches, ) -> Result<(), Error>

Assign values from ArgMatches to self.
Source§

fn update_from_arg_matches_mut( &mut self, __clap_arg_matches: &mut ArgMatches, ) -> Result<(), Error>

Assign values from ArgMatches to self.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more