get_flatten_behavior

Function get_flatten_behavior 

Source
pub fn get_flatten_behavior(
    manifest: &Manifest,
    dep: &ResourceDependency,
    artifact_type: &str,
    resource_type: ResourceType,
) -> bool
Expand description

Determines the flatten behavior for a resource installation.

Flatten behavior controls whether directory structure from the source repository is preserved in the installation path. The decision is made by checking:

  1. Explicit flatten setting on the dependency (highest priority)
  2. Tool configuration default for this resource type
  3. Global default (false)

§Arguments

  • manifest - The project manifest containing tool configurations
  • dep - The resource dependency specification
  • artifact_type - The tool name (e.g., “claude-code”, “opencode”)
  • resource_type - The resource type (Agent, Command, etc.)

§Returns

true if directory structure should be flattened, false if it should be preserved.

§Examples

use agpm_cli::core::ResourceType;
use agpm_cli::manifest::Manifest;
use agpm_cli::resolver::path_resolver::get_flatten_behavior;

let manifest = Manifest::new();
let flatten = get_flatten_behavior(&manifest, &dep, "claude-code", ResourceType::Agent);