Files
attune/docs/cli-pack-installation.md

10 KiB

CLI Pack Installation Quick Reference

This document provides quick reference commands for installing, managing, and working with packs using the Attune CLI.

Table of Contents

Installation Commands

Install Pack from Source

Install a pack from git, HTTP, or registry:

# From git repository (HTTPS)
attune pack install https://github.com/attune/pack-slack.git

# From git repository with specific ref
attune pack install https://github.com/attune/pack-slack.git --ref-spec v1.0.0

# From git repository (SSH)
attune pack install git@github.com:attune/pack-slack.git

# From HTTP archive
attune pack install https://example.com/packs/slack-1.0.0.tar.gz

# From registry (if configured)
attune pack install slack@1.0.0

# With options
attune pack install slack@1.0.0 \
  --force \
  --skip-tests \
  --skip-deps

Options:

  • --ref-spec <REF> - Git branch, tag, or commit
  • --force - Force reinstall if pack exists
  • --skip-tests - Skip running pack tests
  • --skip-deps - Skip dependency validation
  • --no-registry - Don't use registry for resolution

Register Pack from Local Path

Register a pack that's already on disk:

# Register pack from directory
attune pack register /path/to/pack

# With options
attune pack register /path/to/pack \
  --force \
  --skip-tests

Options:

  • --force - Replace existing pack
  • --skip-tests - Skip running pack tests

Using Actions Directly

The pack installation workflow consists of individual actions that can be run separately:

1. Download Packs

# Download one or more packs
attune action execute core.download_packs \
  --param packs='["https://github.com/attune/pack-slack.git"]' \
  --param destination_dir=/tmp/attune-packs \
  --wait

# Multiple packs
attune action execute core.download_packs \
  --param packs='["slack@1.0.0","aws@2.0.0"]' \
  --param destination_dir=/tmp/attune-packs \
  --param registry_url=https://registry.attune.io/index.json \
  --wait

# Get JSON output
attune action execute core.download_packs \
  --param packs='["https://github.com/attune/pack-slack.git"]' \
  --param destination_dir=/tmp/attune-packs \
  --wait --json

2. Get Pack Dependencies

# Analyze pack dependencies
attune action execute core.get_pack_dependencies \
  --param pack_paths='["/tmp/attune-packs/slack"]' \
  --wait

# With JSON output to check for missing dependencies
result=$(attune action execute core.get_pack_dependencies \
  --param pack_paths='["/tmp/attune-packs/slack"]' \
  --wait --json)

echo "$result" | jq '.result.missing_dependencies'

3. Build Pack Environments

# Build Python and Node.js environments
attune action execute core.build_pack_envs \
  --param pack_paths='["/tmp/attune-packs/slack"]' \
  --wait

# Skip Node.js environment
attune action execute core.build_pack_envs \
  --param pack_paths='["/tmp/attune-packs/slack"]' \
  --param skip_nodejs=true \
  --wait

# Force rebuild
attune action execute core.build_pack_envs \
  --param pack_paths='["/tmp/attune-packs/slack"]' \
  --param force_rebuild=true \
  --wait

4. Register Packs

# Register downloaded packs
attune action execute core.register_packs \
  --param pack_paths='["/tmp/attune-packs/slack"]' \
  --wait

# With force and skip tests
attune action execute core.register_packs \
  --param pack_paths='["/tmp/attune-packs/slack"]' \
  --param force=true \
  --param skip_tests=true \
  --wait

Using the Workflow

The core.install_packs workflow automates the entire process:

# Install pack using workflow
attune action execute core.install_packs \
  --param packs='["https://github.com/attune/pack-slack.git"]' \
  --wait

# With options
attune action execute core.install_packs \
  --param packs='["slack@1.0.0","aws@2.0.0"]' \
  --param force=true \
  --param skip_tests=true \
  --wait

# Install with specific git ref
attune action execute core.install_packs \
  --param packs='["https://github.com/attune/pack-slack.git"]' \
  --param ref_spec=v1.0.0 \
  --wait

Note: When the workflow feature is fully implemented, use:

attune workflow execute core.install_packs \
  --input packs='["slack@1.0.0"]'

Management Commands

List Packs

# List all installed packs
attune pack list

# Filter by name
attune pack list --name slack

# JSON output
attune pack list --json

Show Pack Details

# Show pack information
attune pack show slack

# JSON output
attune pack show slack --json

Update Pack Metadata

# Update pack fields
attune pack update slack \
  --label "Slack Integration" \
  --description "Enhanced Slack pack" \
  --version 1.1.0

Uninstall Pack

# Uninstall pack (with confirmation)
attune pack uninstall slack

# Force uninstall without confirmation
attune pack uninstall slack --yes

Test Pack

# Run pack tests
attune pack test slack

# Verbose output
attune pack test slack --verbose

# Detailed output
attune pack test slack --detailed

Examples

Example 1: Install Pack from Git

# Full installation process
attune pack install https://github.com/attune/pack-slack.git --ref-spec v1.0.0 --wait

# Verify installation
attune pack show slack

# List actions in pack
attune action list --pack slack

Example 2: Install Multiple Packs

# Install multiple packs from registry
attune action execute core.install_packs \
  --param packs='["slack@1.0.0","aws@2.1.0","kubernetes@3.0.0"]' \
  --wait

Example 3: Development Workflow

# Download pack for development
attune action execute core.download_packs \
  --param packs='["https://github.com/myorg/pack-custom.git"]' \
  --param destination_dir=/home/user/packs \
  --param ref_spec=main \
  --wait

# Make changes to pack...

# Register updated pack
attune pack register /home/user/packs/custom --force

Example 4: Check Dependencies Before Install

# Download pack
attune action execute core.download_packs \
  --param packs='["slack@1.0.0"]' \
  --param destination_dir=/tmp/test-pack \
  --wait

# Check dependencies
deps=$(attune action execute core.get_pack_dependencies \
  --param pack_paths='["/tmp/test-pack/slack"]' \
  --wait --json)

# Check for missing dependencies
missing=$(echo "$deps" | jq -r '.result.missing_dependencies | length')

if [[ "$missing" -gt 0 ]]; then
  echo "Missing dependencies found:"
  echo "$deps" | jq '.result.missing_dependencies'
  exit 1
fi

# Proceed with installation
attune pack register /tmp/test-pack/slack

Example 5: Scripted Installation with Error Handling

#!/bin/bash
set -e

PACK_SOURCE="https://github.com/attune/pack-slack.git"
PACK_REF="v1.0.0"
TEMP_DIR="/tmp/attune-install-$$"

echo "Installing pack from: $PACK_SOURCE"

# Download
echo "Step 1: Downloading..."
download_result=$(attune action execute core.download_packs \
  --param packs="[\"$PACK_SOURCE\"]" \
  --param destination_dir="$TEMP_DIR" \
  --param ref_spec="$PACK_REF" \
  --wait --json)

success=$(echo "$download_result" | jq -r '.result.success_count // 0')
if [[ "$success" -eq 0 ]]; then
  echo "Error: Download failed"
  echo "$download_result" | jq '.result.failed_packs'
  exit 1
fi

# Get pack path
pack_path=$(echo "$download_result" | jq -r '.result.downloaded_packs[0].pack_path')
echo "Downloaded to: $pack_path"

# Check dependencies
echo "Step 2: Checking dependencies..."
deps_result=$(attune action execute core.get_pack_dependencies \
  --param pack_paths="[\"$pack_path\"]" \
  --wait --json)

missing=$(echo "$deps_result" | jq -r '.result.missing_dependencies | length')
if [[ "$missing" -gt 0 ]]; then
  echo "Warning: Missing dependencies:"
  echo "$deps_result" | jq '.result.missing_dependencies'
fi

# Build environments
echo "Step 3: Building environments..."
attune action execute core.build_pack_envs \
  --param pack_paths="[\"$pack_path\"]" \
  --wait

# Register
echo "Step 4: Registering pack..."
attune pack register "$pack_path"

# Cleanup
rm -rf "$TEMP_DIR"

echo "Installation complete!"

Example 6: Bulk Pack Installation

#!/bin/bash
# Install multiple packs from a list

PACKS=(
  "slack@1.0.0"
  "aws@2.1.0"
  "kubernetes@3.0.0"
  "datadog@1.5.0"
)

for pack in "${PACKS[@]}"; do
  echo "Installing: $pack"
  if attune pack install "$pack" --skip-tests; then
    echo "✓ $pack installed successfully"
  else
    echo "✗ $pack installation failed"
  fi
done

Output Formats

All commands support multiple output formats:

# Default table format
attune pack list

# JSON format
attune pack list --json
attune pack list -j

# YAML format
attune pack list --yaml
attune pack list -y

Authentication

Most commands require authentication:

# Login first
attune auth login

# Or use a token
export ATTUNE_API_TOKEN="your-token-here"
attune pack list

# Or specify token in command
attune pack list --api-url http://localhost:8080

Configuration

Configure CLI settings:

# Set default API URL
attune config set api_url http://localhost:8080

# Set default profile
attune config set profile production

# View configuration
attune config show

Troubleshooting

Common Issues

Authentication errors:

# Re-login
attune auth login

# Check token
attune auth token

# Refresh token
attune auth refresh

Pack already exists:

# Use --force to replace
attune pack install slack@1.0.0 --force

Network timeouts:

# Increase timeout (via environment variable for now)
export ATTUNE_ACTION_TIMEOUT=600
attune pack install large-pack@1.0.0

Missing dependencies:

# Install dependencies first
attune pack install core@1.0.0
attune pack install dependent-pack@1.0.0

See Also