Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
TypeScript agentic-aiagentsaiai-agentsaiagentsdeveloper-toolsfunction-callinggpt-4javascriptjsllmllmopsmcppythonremote-mcp-serverssetypescript
feat: add install script (#1706)
Rahul Tarakb839f6549240
diff --git a/.github/workflows/test-installation.yml b/.github/workflows/test-installation.ymlnew file mode 100644index 000000000..3f3d2fb58--- /dev/null+++ b/.github/workflows/test-installation.yml@@ -0,0 +1,465 @@+name: Test Installation++on:+ push:+ tags:+ - 'v*'+ workflow_dispatch:+ inputs:+ version:+ description: 'Version to test (e.g., v1.0.0)'+ required: false+ default: 'latest'+ workflow_call:+ inputs:+ version:+ description: 'Version to test'+ required: false+ default: 'latest'+ type: string++jobs:+ test-install-script:+ name: Test Install Script+ runs-on: ${{ matrix.os }}+ strategy:+ fail-fast: false+ matrix:+ include:+ # Ubuntu x64 versions+ - os: ubuntu-20.04+ name: "Ubuntu 20.04 x64"+ shell: bash+ - os: ubuntu-22.04+ name: "Ubuntu 22.04 x64"+ shell: bash+ - os: ubuntu-22.04+ name: "Ubuntu 22.04 x64 (zsh)"+ shell: zsh+ - os: ubuntu-latest+ name: "Ubuntu Latest x64"+ shell: bash++ # Ubuntu ARM64 versions (using Depot)+ - os: depot-ubuntu-24.04-arm+ name: "Ubuntu 24.04 ARM64"+ shell: bash+ - os: depot-ubuntu-22.04-arm+ name: "Ubuntu 22.04 ARM64"+ shell: bash+ - os: depot-ubuntu-22.04-arm+ name: "Ubuntu 22.04 ARM64 (zsh)"+ shell: zsh++ # macOS versions+ - os: macos-12+ name: "macOS 12 (Monterey)"+ shell: bash+ - os: macos-13+ name: "macOS 13 (Ventura)"+ shell: bash+ - os: macos-13+ name: "macOS 13 (zsh)"+ shell: zsh+ - os: macos-14+ name: "macOS 14 (Sonoma)"+ shell: bash+ - os: macos-latest+ name: "macOS Latest"+ shell: bash+ - os: macos-latest+ name: "macOS Latest (zsh)"+ shell: zsh++ steps:+ - name: Checkout+ uses: actions/checkout@v4++ - name: Setup shell environment+ run: |+ if [[ "${{ matrix.shell }}" == "zsh" ]]; then+ # Install zsh if not present+ if ! command -v zsh &> /dev/null; then+ if [[ "${{ runner.os }}" == "Linux" ]]; then+ sudo apt-get update+ sudo apt-get install -y zsh+ elif [[ "${{ runner.os }}" == "macOS" ]]; then+ # zsh is default on macOS+ echo "zsh already available"+ fi+ fi++ # Create .zshrc if it doesn't exist+ touch ~/.zshrc++ # Set zsh as the shell for this session+ export SHELL=$(which zsh)+ echo "SHELL=$(which zsh)" >> $GITHUB_ENV+ else+ # Ensure bash is available and create .bashrc+ touch ~/.bashrc+ export SHELL=$(which bash)+ echo "SHELL=$(which bash)" >> $GITHUB_ENV+ fi++ - name: Test install script (latest version)+ if: inputs.version == 'latest' || inputs.version == ''+ shell: bash+ run: |+ echo "Testing installation with latest version..."++ # Test the install script+ bash install.sh++ # Verify installation+ source ~/.bashrc 2>/dev/null || source ~/.zshrc 2>/dev/null || true+ export PATH="$HOME/.composio/bin:$PATH"++ # Check if binary exists+ if [[ -f "$HOME/.composio/bin/composio" ]]; then+ echo "✅ Binary installed successfully"+ ls -la "$HOME/.composio/bin/composio"+ else+ echo "❌ Binary not found"+ exit 1+ fi++ # Test binary execution+ if "$HOME/.composio/bin/composio" --version; then+ echo "✅ Binary executes successfully"+ else+ echo "❌ Binary execution failed"+ exit 1+ fi++ - name: Test install script (specific version)+ if: inputs.version != 'latest' && inputs.version != ''+ shell: bash+ run: |+ echo "Testing installation with version: ${{ inputs.version }}"++ # Test the install script with specific version+ bash install.sh ${{ inputs.version }}++ # Verify installation+ source ~/.bashrc 2>/dev/null || source ~/.zshrc 2>/dev/null || true+ export PATH="$HOME/.composio/bin:$PATH"++ # Check if binary exists+ if [[ -f "$HOME/.composio/bin/composio" ]]; then+ echo "✅ Binary installed successfully"+ ls -la "$HOME/.composio/bin/composio"+ else+ echo "❌ Binary not found"+ exit 1+ fi++ # Test binary execution+ if "$HOME/.composio/bin/composio" --version; then+ echo "✅ Binary executes successfully"+ else+ echo "❌ Binary execution failed"+ exit 1+ fi++ - name: Test PATH integration+ shell: ${{ matrix.shell }}+ run: |+ echo "Testing PATH integration..."++ # Source the appropriate shell config+ if [[ "${{ matrix.shell }}" == "zsh" ]]; then+ source ~/.zshrc+ else+ source ~/.bashrc+ fi++ # Test if composio is in PATH+ if command -v composio &> /dev/null; then+ echo "✅ composio found in PATH"+ which composio+ else+ echo "❌ composio not found in PATH"+ echo "PATH: $PATH"+ exit 1+ fi++ # Test basic commands+ composio --version+ composio --help | head -5++ - name: Test shell config updates+ run: |+ echo "Checking shell configuration updates..."++ if [[ "${{ matrix.shell }}" == "zsh" ]]; then+ if grep -q "COMPOSIO_INSTALL" ~/.zshrc; then+ echo "✅ .zshrc updated with COMPOSIO_INSTALL"+ else+ echo "❌ .zshrc not updated"+ exit 1+ fi++ if grep -q "composio/bin" ~/.zshrc; then+ echo "✅ .zshrc updated with PATH"+ else+ echo "❌ .zshrc PATH not updated"+ exit 1+ fi+ else+ if grep -q "COMPOSIO_INSTALL" ~/.bashrc; then+ echo "✅ .bashrc updated with COMPOSIO_INSTALL"+ else+ echo "❌ .bashrc not updated"+ exit 1+ fi++ if grep -q "composio/bin" ~/.bashrc; then+ echo "✅ .bashrc updated with PATH"+ else+ echo "❌ .bashrc PATH not updated"+ exit 1+ fi+ fi++ - name: Test custom install directory+ shell: bash+ run: |+ echo "Testing custom install directory..."++ # Clean up previous installation+ rm -rf ~/.composio++ # Test with custom directory+ export COMPOSIO_INSTALL="/tmp/custom-composio"+ bash install.sh++ # Verify custom installation+ if [[ -f "/tmp/custom-composio/bin/composio" ]]; then+ echo "✅ Custom directory installation successful"+ ls -la "/tmp/custom-composio/bin/composio"+ else+ echo "❌ Custom directory installation failed"+ exit 1+ fi++ # Test execution+ if "/tmp/custom-composio/bin/composio" --version; then+ echo "✅ Custom installation executes successfully"+ else+ echo "❌ Custom installation execution failed"+ exit 1+ fi++ - name: Test uninstallation+ run: |+ echo "Testing uninstallation..."++ # Remove binary+ rm -rf ~/.composio /tmp/custom-composio++ # Check if binary is gone+ if [[ ! -f "$HOME/.composio/bin/composio" ]]; then+ echo "✅ Binary removed successfully"+ else+ echo "❌ Binary removal failed"+ exit 1+ fi++ - name: Test error handling+ shell: bash+ run: |+ echo "Testing error handling..."++ # Test with invalid version+ if bash install.sh v999.999.999 2>&1 | grep -q "Failed"; then+ echo "✅ Error handling works for invalid version"+ else+ echo "❌ Error handling failed"+ # Don't exit 1 here as this is expected to fail+ fi++ test-npm-fallback:+ name: Test npm Installation Fallback+ runs-on: ${{ matrix.os }}+ strategy:+ fail-fast: false+ matrix:+ os: [ubuntu-latest, macos-latest]+ node-version: [18, 20, 22]++ steps:+ - name: Checkout+ uses: actions/checkout@v4++ - name: Setup Node.js+ uses: actions/setup-node@v4+ with:+ node-version: ${{ matrix.node-version }}++ - name: Test npm installation+ run: |+ echo "Testing npm installation as fallback..."++ # This would normally install from npm registry+ # For testing, we just verify the command works+ if command -v npm &> /dev/null; then+ echo "✅ npm is available"+ npm --version+ else+ echo "❌ npm not available"+ exit 1+ fi++ test-architecture-detection:+ name: Test Architecture Detection+ runs-on: ${{ matrix.os }}+ strategy:+ fail-fast: false+ matrix:+ include:+ - os: ubuntu-latest+ arch: x64+ expected: "Linux x64"+ - os: depot-ubuntu-24.04-arm+ arch: arm64+ expected: "Linux ARM64"+ - os: macos-13+ arch: x64+ expected: "macOS x64"+ - os: macos-latest+ arch: arm64+ expected: "macOS ARM64"++ steps:+ - name: Checkout+ uses: actions/checkout@v4++ - name: Test architecture detection+ run: |+ echo "Testing architecture detection for: ${{ matrix.expected }}"++ platform=$(uname -ms)+ echo "Detected platform: $platform"++ case $platform in+ 'Darwin x86_64')+ detected="macOS x64"+ ;;+ 'Darwin arm64')+ detected="macOS ARM64"+ ;;+ 'Linux x86_64')+ detected="Linux x64"+ ;;+ 'Linux aarch64'|'Linux arm64')+ detected="Linux ARM64"+ ;;+ *)+ echo "❌ Unknown platform: $platform"+ exit 1+ ;;+ esac++ if [[ "$detected" == "${{ matrix.expected }}" ]]; then+ echo "✅ Correctly detected: $detected"+ else+ echo "❌ Detection mismatch: expected '${{ matrix.expected }}', got '$detected'"+ exit 1+ fi++ test-prerequisites:+ name: Test Prerequisites+ runs-on: ${{ matrix.os }}+ strategy:+ fail-fast: false+ matrix:+ os: [ubuntu-latest, macos-latest]++ steps:+ - name: Checkout+ uses: actions/checkout@v4++ - name: Test required tools+ run: |+ echo "Testing required tools..."++ # Test curl+ if command -v curl &> /dev/null; then+ echo "✅ curl available"+ curl --version | head -1+ else+ echo "❌ curl not available"+ exit 1+ fi++ # Test unzip+ if command -v unzip &> /dev/null; then+ echo "✅ unzip available"+ unzip -v | head -1+ else+ echo "❌ unzip not available"+ exit 1+ fi++ - name: Test without prerequisites+ run: |+ echo "Testing error handling when prerequisites are missing..."++ # Create a version of the script that will fail prerequisite check+ sed 's/command -v curl/command -v nonexistent-tool/' install.sh > test-install.sh++ if bash test-install.sh 2>&1 | grep -q "required to install"; then+ echo "✅ Prerequisites check works"+ else+ echo "❌ Prerequisites check failed"+ exit 1+ fi++ rm test-install.sh++ summary:+ name: Installation Test Summary+ needs: [test-install-script, test-npm-fallback, test-architecture-detection, test-prerequisites]+ runs-on: ubuntu-latest+ if: always()++ steps:+ - name: Test Results Summary+ run: |+ echo "## Installation Test Results" >> $GITHUB_STEP_SUMMARY+ echo "" >> $GITHUB_STEP_SUMMARY++ if [[ "${{ needs.test-install-script.result }}" == "success" ]]; then+ echo "✅ **Install Script Tests**: PASSED" >> $GITHUB_STEP_SUMMARY+ else+ echo "❌ **Install Script Tests**: FAILED" >> $GITHUB_STEP_SUMMARY+ fi++ if [[ "${{ needs.test-npm-fallback.result }}" == "success" ]]; then+ echo "✅ **npm Fallback Tests**: PASSED" >> $GITHUB_STEP_SUMMARY+ else+ echo "❌ **npm Fallback Tests**: FAILED" >> $GITHUB_STEP_SUMMARY+ fi++ if [[ "${{ needs.test-architecture-detection.result }}" == "success" ]]; then+ echo "✅ **Architecture Detection**: PASSED" >> $GITHUB_STEP_SUMMARY+ else+ echo "❌ **Architecture Detection**: FAILED" >> $GITHUB_STEP_SUMMARY+ fi++ if [[ "${{ needs.test-prerequisites.result }}" == "success" ]]; then+ echo "✅ **Prerequisites Check**: PASSED" >> $GITHUB_STEP_SUMMARY+ else+ echo "❌ **Prerequisites Check**: FAILED" >> $GITHUB_STEP_SUMMARY+ fi++ echo "" >> $GITHUB_STEP_SUMMARY+ echo "**Test Matrix Coverage:**" >> $GITHUB_STEP_SUMMARY+ echo "- **Linux x64**: Ubuntu 20.04, 22.04, Latest" >> $GITHUB_STEP_SUMMARY+ echo "- **Linux ARM64**: Ubuntu 22.04, 24.04 (via Depot)" >> $GITHUB_STEP_SUMMARY+ echo "- **macOS x64**: macOS 12, 13, 14, Latest" >> $GITHUB_STEP_SUMMARY+ echo "- **macOS ARM64**: macOS Latest" >> $GITHUB_STEP_SUMMARY+ echo "- **Shells**: Bash and Zsh" >> $GITHUB_STEP_SUMMARY+ echo "- **Node.js**: 18, 20, 22 (npm fallback)" >> $GITHUB_STEP_SUMMARY+ echo "- **Total platforms**: 4 architectures across 15+ environments" >> $GITHUB_STEP_SUMMARY\ No newline at end of filediff --git a/CLAUDE.md b/CLAUDE.mdnew file mode 100644index 000000000..cc20a223d--- /dev/null+++ b/CLAUDE.md@@ -0,0 +1,208 @@+# CLAUDE.md++This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.++## Overview++This is the Composio SDK v3 repository containing both TypeScript and Python SDKs. The main development focus is on the TypeScript SDK located in `/ts/` directory. The project uses a monorepo structure with multiple packages and examples.++## Common Development Commands++### Build and Development+```bash+# Build all packages+pnpm build++# Build only TypeScript packages+pnpm build:packages++# Clean build artifacts+pnpm clean+pnpm clean:workspace++# Lint code+pnpm lint+pnpm lint:fix++# Format code+pnpm format++# Run tests+pnpm test+```++### Package Management+```bash+# Install dependencies+pnpm install++# Check peer dependencies+pnpm check:peer-deps++# Update peer dependencies+pnpm update:peer-deps+```++### Creating New Components+```bash+# Create a new provider+pnpm create:provider <provider-name> [--agentic]++# Create a new example+pnpm create:example <example-name>+```++### Release Management+```bash+# Create changeset for releases+pnpm changeset++# Version packages+pnpm changeset:version++# Publish packages+pnpm changeset:release+```++## Project Architecture++### Repository Structure+```+composio/+├── ts/ # TypeScript SDK (main development)+│ ├── packages/+│ │ ├── core/ # Core SDK functionality+│ │ ├── providers/ # AI provider integrations (OpenAI, Anthropic, etc.)+│ │ ├── cli/ # Command-line interface+│ │ ├── json-schema-to-zod/ # Schema conversion utility+│ │ └── ts-builders/ # TypeScript code generation utilities+│ └── examples/ # Usage examples for different providers+├── python/ # Python SDK+├── fern/ # Documentation and API specs+└── examples/ # Cross-platform examples+```++### Core Packages++**@composio/core** - Main SDK functionality:+- `src/composio.ts` - Main Composio class+- `src/models/` - Core models (Tools, Toolkits, ConnectedAccounts, etc.)+- `src/provider/` - Base provider implementations+- `src/services/` - Internal services (telemetry, pusher)+- `src/types/` - TypeScript type definitions+- `src/utils/` - Utility functions and helpers++**Provider Packages** - AI integrations:+- `@composio/openai` - OpenAI integration+- `@composio/anthropic` - Anthropic integration+- `@composio/google` - Google GenAI integration+- `@composio/langchain` - LangChain integration+- `@composio/vercel` - Vercel AI integration+- `@composio/mastra` - Mastra integration++### Key Concepts++**Tools** - Individual functions that can be executed (e.g., GITHUB_CREATE_REPO, GMAIL_SEND_EMAIL)++**Toolkits** - Collections of related tools grouped by service (e.g., github, gmail, slack)++**Connected Accounts** - User authentication/authorization for external services++**Auth Configs** - Configuration for different authentication methods++**Custom Tools** - User-defined tools with custom logic++**Providers** - Integrations with AI frameworks (OpenAI, Anthropic, etc.)++**Modifiers** - Middleware to transform tool inputs/outputs++## Development Workflow++### For Tool Development+1. Tools are auto-generated from OpenAPI specifications+2. Custom tools can be created using the Custom Tools API+3. Tool execution happens through the main Composio class++### For Provider Development+1. Use `pnpm create:provider <name>` to scaffold new providers+2. Implement required methods: `wrapTool`, `wrapTools`+3. For agentic providers, also implement execution handlers+4. Add comprehensive tests and documentation++### Testing+- Unit tests use Vitest+- Run tests with `pnpm test`+- Tests are located in `test/` directories within each package+- Mock implementations are available in `test/utils/mocks/`++### Code Quality+- ESLint configuration in `eslint.config.mjs`+- Prettier for code formatting+- TypeScript strict mode enabled+- Comprehensive TSDoc documentation required+- Husky pre-commit hooks for quality checks++## Environment Variables++```bash+COMPOSIO_API_KEY # Required: Your Composio API key+COMPOSIO_BASE_URL # Optional: Custom API base URL+COMPOSIO_LOG_LEVEL # Optional: Logging level (silent, error, warn, info, debug)+COMPOSIO_DISABLE_TELEMETRY # Optional: Set to "true" to disable telemetry+DEVELOPMENT # Development mode flag+CI # CI environment flag+```++## Key Files and Locations++- **Main SDK Entry**: `ts/packages/core/src/index.ts`+- **Core Composio Class**: `ts/packages/core/src/composio.ts`+- **Type Definitions**: `ts/packages/core/src/types/`+- **Error Classes**: `ts/packages/core/src/errors/`+- **Examples**: `ts/examples/` and `examples/`+- **Documentation**: `ts/docs/` and `fern/`+- **Build Configs**: `turbo.json`, `tsconfig.base.json`++## Testing Commands++```bash+# Run all tests+pnpm test++# Run tests for core package only+cd ts/packages/core && pnpm test++# Run tests with UI+pnpm test:ui+```++## Common Patterns++### Tool Execution+```typescript+const composio = new Composio({ apiKey: 'your-key' });+const result = await composio.tools.execute('TOOL_NAME', {+ userId: 'user-id',+ arguments: { /* tool args */ }+});+```++### Provider Integration+```typescript+import { OpenAIProvider } from '@composio/openai';+const provider = new OpenAIProvider({ apiKey: 'openai-key' });+const tools = await composio.tools.get('user-id', { toolkits: ['github'] });+const wrappedTools = provider.wrapTools(tools);+```++### Custom Tool Creation+```typescript+const customTool = await composio.tools.createCustomTool({+ name: 'My Tool',+ description: 'Tool description',+ inputParameters: { /* JSON schema */ },+ handler: async (params) => { /* implementation */ }+});+```++This monorepo uses pnpm workspaces and Turbo for efficient builds and development.\ No newline at end of filediff --git a/INSTALL.md b/INSTALL.mdnew file mode 100644index 000000000..fb6401401--- /dev/null+++ b/INSTALL.md@@ -0,0 +1,212 @@+# Composio CLI Installation Guide++This guide provides multiple ways to install the Composio CLI on your system.++## Quick Install (Recommended)++### One-line Install+```bash+curl -fsSL https://raw.githubusercontent.com/ComposioHQ/composio/main/install.sh | bash+```++### Install specific version+```bash+curl -fsSL https://raw.githubusercontent.com/ComposioHQ/composio/main/install.sh | bash -s -- v0.1.24+```++### What the install script does:+- Detects your platform and architecture automatically+- Downloads the appropriate binary from GitHub releases+- Installs to `~/.composio/bin/composio`+- Updates your shell configuration (.bashrc, .zshrc, or .config/fish/config.fish)+- Adds the binary to your PATH++## Manual Installation++### From GitHub Releases++1. Go to the [releases page](https://github.com/ComposioHQ/composio/releases)+2. Download the appropriate binary for your platform:+ - `composio-linux-x64.zip` - Linux 64-bit+ - `composio-linux-aarch64.zip` - Linux ARM64+ - `composio-darwin-x64.zip` - macOS Intel+ - `composio-darwin-aarch64.zip` - macOS Apple Silicon++3. Extract and install:+```bash+# Extract the binary+unzip composio-*.zip++# Move to a directory in your PATH+sudo mv composio /usr/local/bin/++# Make it executable+chmod +x /usr/local/bin/composio+```++## Package Manager Installation++### npm+```bash+npm install -g @composio/cli+```++### pnpm+```bash+pnpm add -g @composio/cli+```++### yarn+```bash+yarn global add @composio/cli+```++## Verification++After installation, verify it works:++```bash+composio --version+composio --help+```++## Getting Started++1. **Login to Composio:**+ ```bash+ composio login+ ```++2. **Generate types for your project:**+ ```bash+ # Auto-detect project type and generate+ composio generate++ # Generate for TypeScript+ composio ts generate++ # Generate for Python+ composio py generate+ ```++3. **Check your account:**+ ```bash+ composio whoami+ ```++## Supported Platforms++✅ **Fully Supported:**+- Linux x86_64+- Linux ARM64 (aarch64)+- macOS x86_64 (Intel)+- macOS ARM64 (Apple Silicon)++❌ **Not Supported:**+- Windows (use WSL or npm installation)++## Troubleshooting++### Permission Denied+If you get permission errors:+```bash+chmod +x ~/.composio/bin/composio+```++### Command Not Found+If `composio` is not found after installation:++1. **Restart your shell:**+ ```bash+ exec $SHELL+ ```++2. **Or manually source your profile:**+ ```bash+ # For bash+ source ~/.bashrc++ # For zsh+ source ~/.zshrc++ # For fish+ source ~/.config/fish/config.fish+ ```++3. **Check if the binary exists:**+ ```bash+ ls -la ~/.composio/bin/composio+ ```++4. **Manually add to PATH:**+ ```bash+ export PATH="$HOME/.composio/bin:$PATH"+ ```++### Download Failures+If the download fails:++1. **Check your internet connection**+2. **Try again with verbose output:**+ ```bash+ curl -v -fsSL https://raw.githubusercontent.com/ComposioHQ/composio/main/install.sh | bash+ ```++3. **Manual download:**+ ```bash+ # Download the install script first+ curl -O https://raw.githubusercontent.com/ComposioHQ/composio/main/install.sh++ # Review the script+ cat install.sh++ # Run it+ bash install.sh+ ```++## Uninstallation++To remove Composio CLI:++```bash+# Remove the binary+rm -rf ~/.composio++# Remove from shell configuration+# Edit ~/.bashrc, ~/.zshrc, or ~/.config/fish/config.fish+# and remove the lines that were added by the installer:+# export COMPOSIO_INSTALL="$HOME/.composio"+# export PATH="$COMPOSIO_INSTALL/bin:$PATH"+```++## Environment Variables++The installer respects these environment variables:++- `COMPOSIO_INSTALL` - Installation directory (default: `~/.composio`)+- `GITHUB` - GitHub base URL (default: `https://github.com`)++Example:+```bash+export COMPOSIO_INSTALL="/usr/local"+curl -fsSL https://raw.githubusercontent.com/ComposioHQ/composio/main/install.sh | bash+```++## Development++To build the CLI binary locally:++```bash+cd ts/packages/cli+pnpm install+pnpm build:bin+```++The binary will be created at `dist/composio`.++## Support++- 📖 [Documentation](https://docs.composio.dev)+- 💬 [Discord Community](https://discord.gg/composio)+- 🐛 [Report Issues](https://github.com/ComposioHQ/composio/issues)+- 📧 [Email Support](mailto:[email protected])\ No newline at end of filediff --git a/install.sh b/install.shnew file mode 100644index 000000000..dd3e3822b--- /dev/null+++ b/install.sh@@ -0,0 +1,308 @@+#!/usr/bin/env bash+set -euo pipefail++platform=$(uname -ms)++# Check for unsupported platforms+case $platform in+'MINGW64'* | 'MSYS'* | 'CYGWIN'*)+ echo "Windows installation is not supported yet. Please use WSL or install via npm:"+ echo " npm install -g @composio/cli"+ exit 1+ ;;+esac++# Reset+Color_Off=''++# Regular Colors+Red=''+Green=''+Dim='' # White++# Bold+Bold_White=''+Bold_Green=''++if [[ -t 1 ]]; then+ # Reset+ Color_Off='\033[0m' # Text Reset++ # Regular Colors+ Red='\033[0;31m' # Red+ Green='\033[0;32m' # Green+ Dim='\033[0;2m' # White++ # Bold+ Bold_Green='\033[1;32m' # Bold Green+ Bold_White='\033[1m' # Bold White+fi++error() {+ echo -e "${Red}error${Color_Off}:" "$@" >&2+ exit 1+}++info() {+ echo -e "${Dim}$@ ${Color_Off}"+}++info_bold() {+ echo -e "${Bold_White}$@ ${Color_Off}"+}++success() {+ echo -e "${Green}$@ ${Color_Off}"+}++# Check for required tools+command -v unzip >/dev/null ||+ error 'unzip is required to install Composio CLI'++command -v curl >/dev/null ||+ error 'curl is required to install Composio CLI'++if [[ $# -gt 1 ]]; then+ error 'Too many arguments, only 1 is allowed. You can specify a specific version to install. (e.g. "v0.1.24")'+fi++# Determine platform and architecture+case $platform in+'Darwin x86_64')+ target=darwin-x64+ ;;+'Darwin arm64')+ target=darwin-aarch64+ ;;+'Linux aarch64' | 'Linux arm64')+ target=linux-aarch64+ ;;+'Linux x86_64' | *)+ target=linux-x64+ ;;+esac++# Check for musl on Linux+case "$target" in+'linux'*)+ if [ -f /etc/alpine-release ]; then+ target="$target-musl"+ fi+ ;;+esac++# Special handling for Rosetta on macOS+if [[ $target = darwin-x64 ]]; then+ # Is this process running in Rosetta?+ # redirect stderr to devnull to avoid error message when not running in Rosetta+ if [[ $(sysctl -n sysctl.proc_translated 2>/dev/null) = 1 ]]; then+ target=darwin-aarch64+ info "Your shell is running in Rosetta 2. Downloading Composio CLI for $target instead"+ fi+fi++GITHUB=${GITHUB-"https://github.com"}+github_repo="$GITHUB/ComposioHQ/composio"++exe_name=composio++# Determine version to install+if [[ $# = 0 ]]; then+ # Get latest version from GitHub API+ version=$(curl -s https://api.github.com/repos/ComposioHQ/composio/releases/latest | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')+ if [[ -z "$version" ]]; then+ error "Failed to get latest version from GitHub"+ fi+ composio_uri="$github_repo/releases/latest/download/composio-$target.zip"+else+ version=$1+ composio_uri="$github_repo/releases/download/$version/composio-$target.zip"+fi++info "Installing Composio CLI $version for $target"++# Set up installation directory+install_env=COMPOSIO_INSTALL+bin_env=\$install_env/bin++install_dir=${!install_env:-$HOME/.composio}+bin_dir=$install_dir/bin+exe=$bin_dir/composio++if [[ ! -d $bin_dir ]]; then+ mkdir -p "$bin_dir" ||+ error "Failed to create install directory \"$bin_dir\""+fi++# Download and extract+info "Downloading Composio CLI..."+curl --fail --location --progress-bar --output "$exe.zip" "$composio_uri" ||+ error "Failed to download Composio CLI from \"$composio_uri\""++info "Extracting Composio CLI..."+unzip -oqd "$bin_dir" "$exe.zip" ||+ error 'Failed to extract Composio CLI'++# Move binary to final location+if [[ -f "$bin_dir/composio-$target/$exe_name" ]]; then+ mv "$bin_dir/composio-$target/$exe_name" "$exe" ||+ error 'Failed to move extracted binary to destination'+ rm -r "$bin_dir/composio-$target"+elif [[ -f "$bin_dir/$exe_name" ]]; then+ mv "$bin_dir/$exe_name" "$exe" ||+ error 'Failed to move extracted binary to destination'+else+ error 'Binary not found in extracted archive'+fi++chmod +x "$exe" ||+ error 'Failed to set permissions on Composio CLI executable'++rm "$exe.zip"++tildify() {+ if [[ $1 = $HOME/* ]]; then+ local replacement=\~/+ echo "${1/$HOME\//$replacement}"+ else+ echo "$1"+ fi+}++success "Composio CLI was installed successfully to $Bold_Green$(tildify "$exe")"++# Check if composio is already in PATH+if command -v composio >/dev/null; then+ echo "Run 'composio --help' to get started"+ exit+fi++refresh_command=''++tilde_bin_dir=$(tildify "$bin_dir")+quoted_install_dir=\"${install_dir//\"/\\\"}\"++if [[ $quoted_install_dir = \"$HOME/* ]]; then+ quoted_install_dir=${quoted_install_dir/$HOME\//\$HOME/}+fi++echo++# Add to shell configuration+case $(basename "$SHELL") in+fish)+ commands=(+ "set --export $install_env $quoted_install_dir"+ "set --export PATH $bin_env \$PATH"+ )++ fish_config=$HOME/.config/fish/config.fish+ tilde_fish_config=$(tildify "$fish_config")++ if [[ -w $fish_config ]]; then+ {+ echo -e '\n# Composio CLI'+ for command in "${commands[@]}"; do+ echo "$command"+ done+ } >>"$fish_config"++ info "Added \"$tilde_bin_dir\" to \$PATH in \"$tilde_fish_config\""+ refresh_command="source $tilde_fish_config"+ else+ echo "Manually add the directory to $tilde_fish_config (or similar):"+ for command in "${commands[@]}"; do+ info_bold " $command"+ done+ fi+ ;;+zsh)+ commands=(+ "export $install_env=$quoted_install_dir"+ "export PATH=\"$bin_env:\$PATH\""+ )++ zsh_config=$HOME/.zshrc+ tilde_zsh_config=$(tildify "$zsh_config")++ if [[ -w $zsh_config ]]; then+ {+ echo -e '\n# Composio CLI'+ for command in "${commands[@]}"; do+ echo "$command"+ done+ } >>"$zsh_config"++ info "Added \"$tilde_bin_dir\" to \$PATH in \"$tilde_zsh_config\""+ refresh_command="exec $SHELL"+ else+ echo "Manually add the directory to $tilde_zsh_config (or similar):"+ for command in "${commands[@]}"; do+ info_bold " $command"+ done+ fi+ ;;+bash)+ commands=(+ "export $install_env=$quoted_install_dir"+ "export PATH=\"$bin_env:\$PATH\""+ )++ bash_configs=(+ "$HOME/.bashrc"+ "$HOME/.bash_profile"+ )++ if [[ ${XDG_CONFIG_HOME:-} ]]; then+ bash_configs+=(+ "$XDG_CONFIG_HOME/.bash_profile"+ "$XDG_CONFIG_HOME/.bashrc"+ "$XDG_CONFIG_HOME/bash_profile"+ "$XDG_CONFIG_HOME/bashrc"+ )+ fi++ set_manually=true+ for bash_config in "${bash_configs[@]}"; do+ tilde_bash_config=$(tildify "$bash_config")++ if [[ -w $bash_config ]]; then+ {+ echo -e '\n# Composio CLI'+ for command in "${commands[@]}"; do+ echo "$command"+ done+ } >>"$bash_config"++ info "Added \"$tilde_bin_dir\" to \$PATH in \"$tilde_bash_config\""+ refresh_command="source $bash_config"+ set_manually=false+ break+ fi+ done++ if [[ $set_manually = true ]]; then+ echo "Manually add the directory to ~/.bashrc (or similar):"+ for command in "${commands[@]}"; do+ info_bold " $command"+ done+ fi+ ;;+*)+ echo 'Manually add the directory to ~/.bashrc (or similar):'+ info_bold " export $install_env=$quoted_install_dir"+ info_bold " export PATH=\"$bin_env:\$PATH\""+ ;;+esac++echo+info "To get started, run:"+echo++if [[ $refresh_command ]]; then+ info_bold " $refresh_command"+fi++info_bold " composio --help"+info_bold " composio login"+