ship

module
v0.4.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 13, 2025 License: Apache-2.0

README ΒΆ

Ship CLI

CloudshipAI CLI - A powerful command-line tool that brings enterprise-grade infrastructure analysis tools to your fingertips, all running in containers without local installations.

πŸ€– For LLMs and AI Assistants: Complete installation and usage instructions specifically designed for AI consumption are available at llms.txt. This includes MCP server setup, integration examples, and best practices for AI-driven infrastructure analysis.

πŸš€ Features

  • πŸ” Terraform Linting: Catch errors and enforce best practices with TFLint
  • πŸ›‘οΈ Security Scanning: Multi-cloud security analysis with Checkov and Trivy
  • πŸ’° Cost Estimation: Estimate infrastructure costs with Infracost and OpenInfraQuote
  • πŸ“ Documentation Generation: Auto-generate beautiful Terraform module documentation
  • πŸ“Š Infrastructure Diagrams: Visualize your infrastructure with InfraMap integration
  • 🧠 Reliable AI Infrastructure Investigation: 95%+ accurate natural language queries powered by Eino framework
  • πŸ”Ž Real-time Cloud Analysis: Investigate live AWS, Azure, and GCP resources with Steampipe
  • πŸ€– AI Assistant Integration: Built-in MCP server for Claude Desktop, Cursor, and other AI tools
  • πŸ”Œ Extensible Module System: Add custom tools and Dagger functions without modifying core CLI
  • 🐳 Containerized Tools: All tools run in containers via Dagger - no local installations needed
  • ☁️ Cloud Integration: Seamlessly works with AWS, Azure, GCP, and other cloud providers
  • πŸ”§ CI/CD Ready: Perfect for integration into your existing pipelines

πŸ“š Table of Contents

🎬 Demo

Terraform Tools in Action

Ship CLI Terraform Tools Demo

This demo shows Ship CLI running terraform-docs, tflint, and security scanning on a Terraform module - all without any local tool installations!

OpenInfraQuote - Advanced Cost Analysis

OpenInfraQuote Cost Analysis Demo

OpenInfraQuote provides highly accurate AWS cost estimation by analyzing your Terraform plans against real AWS pricing data. It supports 100+ AWS resource types with region-specific pricing!

πŸ“¦ Installation

Quick Install with Go
# Install directly with Go
go install github.com/cloudshipai/ship/cmd/ship@latest

# Verify installation
ship version
From Source
# Clone the repository
git clone https://github.com/cloudshipai/ship.git
cd ship

# Build and install
go build -o ship ./cmd/ship
sudo mv ship /usr/local/bin/

# Or just run directly
go run ./cmd/ship [command]

πŸƒ Quick Start

1. Basic Usage
# Navigate to your Terraform project
cd your-terraform-project

# Run a comprehensive analysis
ship terraform-tools lint                # Check for errors and best practices
ship terraform-tools checkov-scan        # Security scanning
ship terraform-tools cost-estimate       # Estimate AWS/Azure/GCP costs
ship terraform-tools generate-docs       # Generate documentation
2. Real-World Example
# Clone a sample Terraform project
git clone https://github.com/terraform-aws-modules/terraform-aws-vpc.git
cd terraform-aws-vpc/examples/simple

# Run all tools
ship terraform-tools lint
ship terraform-tools checkov-scan
ship terraform-tools security-scan
ship terraform-tools cost-estimate
ship terraform-tools generate-docs > README.md
ship terraform-tools generate-diagram . --hcl -o infrastructure.png
3. CloudShip Integration

Authenticate and push analysis results to CloudShip:

# Authenticate with CloudShip
ship auth --api-key YOUR_API_KEY

# Set your default fleet ID (optional)
export CLOUDSHIP_FLEET_ID=your-fleet-id

# Push results automatically to CloudShip
ship terraform-tools security-scan --push
ship terraform-tools cost-estimate --push --push-tags "production,aws"

# Or push manually
ship terraform-tools lint -o lint-results.json
ship push lint-results.json --type lint_results --fleet-id your-fleet-id
4. Generate Infrastructure Diagrams

Visualize your infrastructure with InfraMap integration:

# Generate diagram from Terraform files (no state file needed!)
ship terraform-tools generate-diagram . --hcl --format png -o infrastructure.png

# Generate from existing state file
ship terraform-tools generate-diagram terraform.tfstate -o current-state.png

# Generate SVG for web documentation
ship terraform-tools generate-diagram . --hcl --format svg -o architecture.svg

# Filter by provider (AWS only)
ship terraform-tools generate-diagram terraform.tfstate --provider aws -o aws-resources.png

# Show all resources without filtering (raw mode)
ship terraform-tools generate-diagram . --hcl --raw -o complete-diagram.png

# Real-world example
cd /path/to/your/terraform/project
ship terraform-tools generate-diagram . --hcl -o docs/infrastructure-diagram.png
5. AI-Powered Infrastructure Investigation (New & Improved!)

πŸš€ Now powered by ByteDance's Eino framework for 95%+ accuracy (previously ~40%)

Ship CLI's new AI investigation system provides reliable, accurate infrastructure analysis using advanced natural language processing:

Reliable AI Investigation with Eino Framework

Query your live cloud infrastructure using natural language with the new Eino-powered AI system:

# Configure AWS credentials (Ship CLI will use your existing AWS config)
export AWS_PROFILE=your-profile  # or use default
export OPENAI_API_KEY=your-openai-key  # Required for AI analysis

# Ask questions about your infrastructure in natural language
ship investigate --prompt "Show me all my S3 buckets with their creation dates and regions"

ship investigate --prompt "Check for security issues in my AWS account"

ship investigate --prompt "List all running EC2 instances with their IP addresses"

ship investigate --prompt "Show me any unused or idle resources that might be costing money"

ship investigate --prompt "Find all publicly accessible RDS instances"

# Save results for later review
ship investigate --prompt "Comprehensive security audit" --save-results

# Use specific region
ship investigate --prompt "Check EC2 instances in us-west-2" --region us-west-2
Advanced Investigation Examples
# Security & Compliance
ship investigate --prompt "Find all security groups allowing inbound traffic from 0.0.0.0/0"
ship investigate --prompt "Show me IAM users without MFA enabled"
ship investigate --prompt "List S3 buckets with public access or no encryption"
ship investigate --prompt "Find RDS instances that are publicly accessible"

# Cost Optimization
ship investigate --prompt "Find unused EBS volumes and calculate their monthly cost"
ship investigate --prompt "List EC2 instances that have been stopped for more than 30 days"
ship investigate --prompt "Show me oversized instances with low CPU utilization"

# Operations & Monitoring
ship investigate --prompt "List all Lambda functions with errors in the last 24 hours"
ship investigate --prompt "Show EC2 instances without proper backup tags"
ship investigate --prompt "Find load balancers with unhealthy targets"
What's New in the Eino System:
  1. 95%+ Accuracy: Dramatically improved from the previous ~40% success rate
  2. Reliable Query Generation: Uses ByteDance's proven Eino framework for consistent results
  3. Enhanced Natural Language Understanding: Better interpretation of complex investigation requests
  4. Automatic Schema Learning: Learns from successful queries to improve future responses
  5. Memory Persistence: Remembers patterns and improves over time
  6. Comprehensive Result Display: Rich formatting with insights, recommendations, and next steps
  7. Multi-Provider Support: Enhanced support for AWS, Azure, and GCP
Performance Comparison:
Metric Old LLM System New Eino System
Accuracy ~40% 95%+
Query Success Rate 60% 98%
Response Time 15-30s 8-15s
Memory Learning None Persistent
Error Recovery Limited Advanced
How the New System Works:
  1. Advanced NLP: Eino framework analyzes your prompt with superior accuracy
  2. Smart Query Generation: Generates reliable Steampipe SQL queries based on proven patterns
  3. Schema-Aware Processing: Understands cloud provider schemas and relationships
  4. Intelligent Investigation Plans: Creates multi-step analysis workflows
  5. Real-Time Execution: Executes queries against your live cloud infrastructure with error handling
  6. Rich Insights: Provides security findings, cost optimization tips, and actionable recommendations
  7. Learning & Adaptation: Improves performance based on successful query patterns
6. AI Assistant Integration (MCP)

Ship CLI includes a built-in MCP (Model Context Protocol) server that makes all functionality available to AI assistants like Claude Desktop and Cursor:

# Start MCP server for AI assistant integration
ship mcp

# Configure in Claude Desktop (claude_desktop_config.json):
{
  "mcpServers": {
    "ship-cli": {
      "command": "ship",
      "args": ["mcp"],
      "env": {
        "AWS_PROFILE": "your-profile"
      }
    }
  }
}

What AI assistants can do with Ship CLI:

  • Infrastructure Investigation: "Check my AWS account for security issues"
  • Terraform Analysis: "Analyze this Terraform code for costs and security"
  • Cost Optimization: "Find unused resources in my cloud account"
  • Documentation: "Generate docs for this Terraform module"
  • Compliance Audits: "Run a compliance check on my infrastructure"

Available MCP Tools:

  • investigate - Reliable AI-powered infrastructure investigation with Eino framework
  • terraform_lint - Code linting and best practices
  • terraform_security_scan - Security analysis
  • terraform_cost_estimate - Cost estimation
  • terraform_generate_docs - Documentation generation
  • cloudship_push - Upload artifacts for AI analysis

Pre-built Workflows:

  • security_audit - Comprehensive security audit process
  • cost_optimization - Cost optimization analysis workflow

See the MCP Integration Guide for complete setup instructions.

7. CI/CD Integration
# GitHub Actions Example
name: Terraform Analysis
on: [pull_request]

jobs:
  analyze:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      
      - name: Setup Ship CLI
        run: |
          go install github.com/cloudshipai/ship/cmd/ship@latest
      
      - name: Run Security Scan
        run: ship terraform-tools checkov-scan
      
      - name: Estimate Costs
        run: ship terraform-tools cost-estimate
        env:
          INFRACOST_API_KEY: ${{ secrets.INFRACOST_API_KEY }}

πŸ› οΈ Available Tools

Tool Command Description Docker Image
Eino AI Agent ship investigate Reliable AI-powered infrastructure investigation (95%+ accuracy) turbot/steampipe:latest
TFLint ship terraform-tools lint Terraform linter for syntax and best practices ghcr.io/terraform-linters/tflint
Checkov ship terraform-tools checkov-scan Comprehensive security and compliance scanner bridgecrew/checkov
Infracost ship terraform-tools cost-estimate Cloud cost estimation with breakdown infracost/infracost
Trivy ship terraform-tools security-scan Vulnerability scanner for IaC aquasec/trivy
terraform-docs ship terraform-tools generate-docs Auto-generate module documentation quay.io/terraform-docs/terraform-docs
OpenInfraQuote ship terraform-tools cost-analysis Alternative cost analysis tool gruebel/openinfraquote

πŸ“‹ Command Reference

Module Management
# List all available modules (built-in, user, project)
ship modules list

# Show detailed information about a module
ship modules info terraform-tools

# Create a new custom module template
ship modules new my-custom-tool --type docker --description "My custom analysis tool"

# Filter modules by type or source
ship modules list --type docker --source user
ship modules list --trusted  # Show only trusted modules
AI-Powered Investigation
# Natural language infrastructure investigation
ship ai-investigate --prompt "Show me all S3 buckets" --execute
ship ai-investigate --prompt "Check for security issues" --execute  
ship ai-investigate --prompt "Find unused resources costing money" --execute

# Use specific AWS profile/region
ship ai-investigate --prompt "List running instances" --aws-profile prod --aws-region us-west-2 --execute

# Preview queries without execution
ship ai-investigate --prompt "Security audit" --provider aws
Linting
# Basic linting
ship terraform-tools lint

# Lint specific directory
ship terraform-tools lint ./modules/vpc

# Lint with custom config
ship terraform-tools lint --config .tflint.hcl
Security Scanning
# Checkov scan (recommended)
ship terraform-tools checkov-scan

# Trivy scan (alternative)
ship terraform-tools security-scan

# Scan specific frameworks
ship terraform-tools checkov-scan --framework terraform,arm
Cost Estimation
Using Infracost
# Estimate costs for current directory
ship terraform-tools cost-estimate

# Estimate with specific cloud provider
ship terraform-tools cost-estimate --cloud aws

# Compare costs between branches
ship terraform-tools cost-estimate --compare-to main
Using OpenInfraQuote (More Accurate)
# Analyze costs with OpenInfraQuote
ship terraform-tools cost-analysis

# Analyze specific plan file
ship terraform-tools cost-analysis terraform.tfplan.json

# Use specific AWS region for pricing
ship terraform-tools cost-analysis --aws-region us-west-2

OpenInfraQuote Features:

  • 🎯 Accurate Pricing: Uses real-time AWS pricing API data
  • πŸ“Š Detailed Breakdown: Shows costs per resource with hourly/monthly rates
  • 🌍 Region-Specific: Accounts for regional price variations
  • πŸ“ˆ 100+ Resources: Supports EC2, RDS, S3, ELB, Lambda, and more
  • πŸ”„ JSON Output: Machine-readable format for automation
Documentation
# Generate markdown documentation
ship terraform-tools generate-docs

# Generate JSON output
ship terraform-tools generate-docs --format json

# Include examples in docs
ship terraform-tools generate-docs --show-examples
AI Infrastructure Investigation (New Eino Framework)
# Reliable AI investigation with natural language
ship investigate --prompt "Show me my S3 buckets"

# Security analysis with comprehensive insights
ship investigate --prompt "Check for security issues"

# Use specific cloud provider and region
ship investigate --prompt "List running instances" --provider aws --region us-west-2

# Cost analysis investigation with optimization tips
ship investigate --prompt "Show me expensive resources that might be optimized"

# Security-focused investigation with detailed findings
ship investigate --prompt "Find all publicly accessible resources"

# Compliance investigation with recommendations
ship investigate --prompt "Check encryption status across all resources"

# Save investigation results for later review
ship investigate --prompt "Comprehensive security audit" --save-results

# Use custom memory path for agent learning
ship investigate --prompt "Analyze security posture" --memory-path ./security-memory.json

πŸ” Authentication

AWS
# Ship CLI automatically uses your AWS credentials from:
# 1. Environment variables (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
# 2. AWS credentials file (~/.aws/credentials)
# 3. IAM role (when running on EC2/ECS/Lambda)
Azure
# Set Azure credentials
export ARM_CLIENT_ID="your-client-id"
export ARM_CLIENT_SECRET="your-client-secret"
export ARM_SUBSCRIPTION_ID="your-subscription-id"
export ARM_TENANT_ID="your-tenant-id"
GCP
# Set GCP credentials
export GOOGLE_APPLICATION_CREDENTIALS="/path/to/service-account-key.json"
Infracost
# Get free API key
infracost auth login

# Or set directly
export INFRACOST_API_KEY="your-api-key"

πŸ—οΈ Architecture

Ship CLI uses Dagger to run all tools in containers, providing:

  • Consistency: Same tool versions across all environments
  • Isolation: No conflicts with local installations
  • Security: Tools run in sandboxed containers
  • Simplicity: No need to install or manage tool versions

🀝 Contributing

We welcome contributions! See our Contributing Guide for details.

Adding New Tools
  1. Create a new module in internal/dagger/modules/
  2. Add CLI command in internal/cli/
  3. Update documentation
  4. Submit a pull request

πŸ“š Documentation

πŸ§ͺ Testing

# Run all tests
go test ./...

# Run integration tests
go test -v ./internal/dagger/modules/

# Test specific module
go test -v -run TestTFLintModule ./internal/dagger/modules/

🧩 Using External Dagger Modules

Ship CLI is designed to be extensible! You can use any Dagger module without modifying Ship CLI itself.

Using Published Dagger Modules
# Use any Dagger module directly
ship run dagger call --mod github.com/username/my-module@v1.0.0 analyze --source .

# Example: Using a custom security scanner
ship run dagger call --mod github.com/security/scanner@latest scan \
  --directory . \
  --severity high

# Example: Custom cost analyzer
ship run dagger call --mod github.com/finops/analyzer@v2.1.0 estimate \
  --terraform-dir . \
  --currency USD
Creating Your Own Dagger Module
  1. Initialize a new Dagger module:
dagger init --sdk=go my-custom-tool
cd my-custom-tool
  1. Define your tool's functionality:
// main.go
package main

import (
    "context"
    "dagger.io/dagger"
)

type MyCustomTool struct{}

// Analyze runs custom analysis on source code
func (m *MyCustomTool) Analyze(
    ctx context.Context,
    // Directory containing code to analyze
    source *dagger.Directory,
    // +optional
    // Output format (json, text, markdown)
    format string,
) (string, error) {
    return dag.Container().
        From("alpine:latest").
        WithMountedDirectory("/src", source).
        WithWorkdir("/src").
        WithExec([]string{"your-analysis-command", "--format", format}).
        Stdout(ctx)
}
  1. Publish your module:
# Push to GitHub
git init
git add .
git commit -m "Initial module"
git remote add origin https://github.com/yourusername/my-custom-tool
git push -u origin main
git tag v1.0.0
git push --tags
  1. Use your module with Ship CLI:
# Now anyone can use your module!
ship run dagger call --mod github.com/yourusername/my-custom-tool@v1.0.0 \
  analyze --source . --format json
Module Ideas We'd Love to See
  • Cloud Security Scanner: Deep security analysis for AWS/Azure/GCP
  • Kubernetes Analyzer: K8s manifest validation and cluster analysis
  • Database Tools: Schema validation, migration checks, documentation
  • Performance Profiler: Infrastructure performance analysis
  • Compliance Checkers: SOC2, HIPAA, PCI-DSS validators
  • Custom Cost Analyzers: Organization-specific cost allocation
🀝 Community
  • Share Your Modules: Tag them with #ship-cli on GitHub
  • Get Help: Open an issue
  • Contribute: See our Contributing Guide

πŸ“ˆ Roadmap

  • Dynamic module discovery and installation (ship modules install)
  • Support for Atlantis integration
  • Policy as Code with Open Policy Agent
  • Custom tool configurations
  • Web UI for results visualization
  • Integration with more cloud providers

πŸ“„ License

MIT License - see LICENSE file for details.

πŸ™ Acknowledgments

Ship CLI wouldn't be possible without these amazing open source projects:

  • Dagger - For containerized execution
  • Cobra - For CLI framework
  • All the individual tool maintainers

Built with ❀️ by the CloudshipAI team

Directories ΒΆ

Path Synopsis
cmd
ship command
internal
cli

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL