# Get Pack Dependencies Action
# Parses pack.yaml files to identify pack and runtime dependencies

ref: core.get_pack_dependencies
label: "Get Pack Dependencies"
description: "Parse pack.yaml files to extract pack dependencies and runtime requirements"
enabled: true
runner_type: shell
entry_point: get_pack_dependencies.sh

# Parameter delivery: stdin for secure parameter passing (no env vars)
parameter_delivery: stdin
parameter_format: dotenv

# Output format: json (structured data parsing enabled)
output_format: json

# Action parameters schema (StackStorm-style with inline required/secret)
parameters:
  pack_paths:
    type: array
    description: "List of pack directory paths to analyze"
    items:
      type: string
    minItems: 1
    required: true
  skip_validation:
    type: boolean
    description: "Skip validation of pack.yaml schema"
    default: false
  api_url:
    type: string
    description: "Attune API URL for checking installed packs"
    default: "http://localhost:8080"

# Output schema: describes the JSON structure written to stdout
# Note: stdout/stderr/exit_code are captured automatically by the execution system
output_schema:
  dependencies:
    type: array
    description: "List of pack dependencies that need to be installed"
    items:
      type: object
      properties:
        pack_ref:
          type: string
          description: "Pack reference (e.g., 'core', 'slack')"
        version_spec:
          type: string
          description: "Version specification (e.g., '>=1.0.0', '^2.1.0')"
        required_by:
          type: string
          description: "Pack that requires this dependency"
        already_installed:
          type: boolean
          description: "Whether this dependency is already installed"
  runtime_requirements:
    type: object
    description: "Runtime environment requirements by pack"
    additionalProperties:
      type: object
      properties:
        pack_ref:
          type: string
          description: "Pack reference"
        python:
          type: object
          description: "Python runtime requirements"
          properties:
            version:
              type: string
              description: "Python version requirement"
            requirements_file:
              type: string
              description: "Path to requirements.txt"
        nodejs:
          type: object
          description: "Node.js runtime requirements"
          properties:
            version:
              type: string
              description: "Node.js version requirement"
            package_file:
              type: string
              description: "Path to package.json"
  missing_dependencies:
    type: array
    description: "Pack dependencies that are not yet installed"
    items:
      type: object
      properties:
        pack_ref:
          type: string
          description: "Pack reference"
        version_spec:
          type: string
          description: "Version specification"
        required_by:
          type: string
          description: "Pack that requires this dependency"
  analyzed_packs:
    type: array
    description: "List of packs that were analyzed"
    items:
      type: object
      properties:
        pack_ref:
          type: string
          description: "Pack reference"
        pack_path:
          type: string
          description: "Path to pack directory"
        has_dependencies:
          type: boolean
          description: "Whether pack has dependencies"
        dependency_count:
          type: integer
          description: "Number of dependencies"
  errors:
    type: array
    description: "Errors encountered during analysis"
    items:
      type: object
      properties:
        pack_path:
          type: string
          description: "Pack path where error occurred"
        error:
          type: string
          description: "Error message"

# Tags for categorization
tags:
  - pack
  - dependencies
  - validation
  - installation
