compute_regular_resource_install_path

Function compute_regular_resource_install_path 

Source
pub fn compute_regular_resource_install_path(
    manifest: &Manifest,
    dep: &ResourceDependency,
    artifact_type: &str,
    resource_type: ResourceType,
    filename: &str,
) -> Result<String>
Expand description

Computes the installation path for a regular resource (Agent, Command, Snippet, Script).

Regular resources are installed as files in tool-specific directories. This function determines the final installation path by:

  1. Getting the base artifact path from tool configuration
  2. Applying any custom target override from the dependency
  3. Computing the relative path based on flatten behavior
  4. Avoiding redundant directory prefixes

§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.)
  • filename - The meaningful path structure extracted from the source file

§Returns

The normalized installation path, or an error if the resource type is not supported by the specified tool.

§Errors

Returns an error if:

  • The resource type is not supported by the specified tool

§Examples

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

let manifest = Manifest::new();
let path = compute_regular_resource_install_path(
    &manifest,
    &dep,
    "claude-code",
    ResourceType::Agent,
    "agents/helper.md"
)?;