@devries-cameron20 / composio Mirror · read-only / commits / b839f6549
Fork 0

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

Mirrored from https://github.com/Camo67/composio.git

Synced Nov 22, 23:15 UTC

feat: add install script (#1706)

Rahul Tarak committed Jun 26, 2025 at 01:21 UTC b839f6549240680d42da264467d9547a6e130eed
4 files changed +1193
.github/workflows/test-installation.yml new
+465
@@ -0,0 +1,465 @@
1 +name: Test Installation
2 +
3 +on:
4 + push:
5 + tags:
6 + - 'v*'
7 + workflow_dispatch:
8 + inputs:
9 + version:
10 + description: 'Version to test (e.g., v1.0.0)'
11 + required: false
12 + default: 'latest'
13 + workflow_call:
14 + inputs:
15 + version:
16 + description: 'Version to test'
17 + required: false
18 + default: 'latest'
19 + type: string
20 +
21 +jobs:
22 + test-install-script:
23 + name: Test Install Script
24 + runs-on: ${{ matrix.os }}
25 + strategy:
26 + fail-fast: false
27 + matrix:
28 + include:
29 + # Ubuntu x64 versions
30 + - os: ubuntu-20.04
31 + name: "Ubuntu 20.04 x64"
32 + shell: bash
33 + - os: ubuntu-22.04
34 + name: "Ubuntu 22.04 x64"
35 + shell: bash
36 + - os: ubuntu-22.04
37 + name: "Ubuntu 22.04 x64 (zsh)"
38 + shell: zsh
39 + - os: ubuntu-latest
40 + name: "Ubuntu Latest x64"
41 + shell: bash
42 +
43 + # Ubuntu ARM64 versions (using Depot)
44 + - os: depot-ubuntu-24.04-arm
45 + name: "Ubuntu 24.04 ARM64"
46 + shell: bash
47 + - os: depot-ubuntu-22.04-arm
48 + name: "Ubuntu 22.04 ARM64"
49 + shell: bash
50 + - os: depot-ubuntu-22.04-arm
51 + name: "Ubuntu 22.04 ARM64 (zsh)"
52 + shell: zsh
53 +
54 + # macOS versions
55 + - os: macos-12
56 + name: "macOS 12 (Monterey)"
57 + shell: bash
58 + - os: macos-13
59 + name: "macOS 13 (Ventura)"
60 + shell: bash
61 + - os: macos-13
62 + name: "macOS 13 (zsh)"
63 + shell: zsh
64 + - os: macos-14
65 + name: "macOS 14 (Sonoma)"
66 + shell: bash
67 + - os: macos-latest
68 + name: "macOS Latest"
69 + shell: bash
70 + - os: macos-latest
71 + name: "macOS Latest (zsh)"
72 + shell: zsh
73 +
74 + steps:
75 + - name: Checkout
76 + uses: actions/checkout@v4
77 +
78 + - name: Setup shell environment
79 + run: |
80 + if [[ "${{ matrix.shell }}" == "zsh" ]]; then
81 + # Install zsh if not present
82 + if ! command -v zsh &> /dev/null; then
83 + if [[ "${{ runner.os }}" == "Linux" ]]; then
84 + sudo apt-get update
85 + sudo apt-get install -y zsh
86 + elif [[ "${{ runner.os }}" == "macOS" ]]; then
87 + # zsh is default on macOS
88 + echo "zsh already available"
89 + fi
90 + fi
91 +
92 + # Create .zshrc if it doesn't exist
93 + touch ~/.zshrc
94 +
95 + # Set zsh as the shell for this session
96 + export SHELL=$(which zsh)
97 + echo "SHELL=$(which zsh)" >> $GITHUB_ENV
98 + else
99 + # Ensure bash is available and create .bashrc
100 + touch ~/.bashrc
101 + export SHELL=$(which bash)
102 + echo "SHELL=$(which bash)" >> $GITHUB_ENV
103 + fi
104 +
105 + - name: Test install script (latest version)
106 + if: inputs.version == 'latest' || inputs.version == ''
107 + shell: bash
108 + run: |
109 + echo "Testing installation with latest version..."
110 +
111 + # Test the install script
112 + bash install.sh
113 +
114 + # Verify installation
115 + source ~/.bashrc 2>/dev/null || source ~/.zshrc 2>/dev/null || true
116 + export PATH="$HOME/.composio/bin:$PATH"
117 +
118 + # Check if binary exists
119 + if [[ -f "$HOME/.composio/bin/composio" ]]; then
120 + echo "✅ Binary installed successfully"
121 + ls -la "$HOME/.composio/bin/composio"
122 + else
123 + echo "❌ Binary not found"
124 + exit 1
125 + fi
126 +
127 + # Test binary execution
128 + if "$HOME/.composio/bin/composio" --version; then
129 + echo "✅ Binary executes successfully"
130 + else
131 + echo "❌ Binary execution failed"
132 + exit 1
133 + fi
134 +
135 + - name: Test install script (specific version)
136 + if: inputs.version != 'latest' && inputs.version != ''
137 + shell: bash
138 + run: |
139 + echo "Testing installation with version: ${{ inputs.version }}"
140 +
141 + # Test the install script with specific version
142 + bash install.sh ${{ inputs.version }}
143 +
144 + # Verify installation
145 + source ~/.bashrc 2>/dev/null || source ~/.zshrc 2>/dev/null || true
146 + export PATH="$HOME/.composio/bin:$PATH"
147 +
148 + # Check if binary exists
149 + if [[ -f "$HOME/.composio/bin/composio" ]]; then
150 + echo "✅ Binary installed successfully"
151 + ls -la "$HOME/.composio/bin/composio"
152 + else
153 + echo "❌ Binary not found"
154 + exit 1
155 + fi
156 +
157 + # Test binary execution
158 + if "$HOME/.composio/bin/composio" --version; then
159 + echo "✅ Binary executes successfully"
160 + else
161 + echo "❌ Binary execution failed"
162 + exit 1
163 + fi
164 +
165 + - name: Test PATH integration
166 + shell: ${{ matrix.shell }}
167 + run: |
168 + echo "Testing PATH integration..."
169 +
170 + # Source the appropriate shell config
171 + if [[ "${{ matrix.shell }}" == "zsh" ]]; then
172 + source ~/.zshrc
173 + else
174 + source ~/.bashrc
175 + fi
176 +
177 + # Test if composio is in PATH
178 + if command -v composio &> /dev/null; then
179 + echo "✅ composio found in PATH"
180 + which composio
181 + else
182 + echo "❌ composio not found in PATH"
183 + echo "PATH: $PATH"
184 + exit 1
185 + fi
186 +
187 + # Test basic commands
188 + composio --version
189 + composio --help | head -5
190 +
191 + - name: Test shell config updates
192 + run: |
193 + echo "Checking shell configuration updates..."
194 +
195 + if [[ "${{ matrix.shell }}" == "zsh" ]]; then
196 + if grep -q "COMPOSIO_INSTALL" ~/.zshrc; then
197 + echo "✅ .zshrc updated with COMPOSIO_INSTALL"
198 + else
199 + echo "❌ .zshrc not updated"
200 + exit 1
201 + fi
202 +
203 + if grep -q "composio/bin" ~/.zshrc; then
204 + echo "✅ .zshrc updated with PATH"
205 + else
206 + echo "❌ .zshrc PATH not updated"
207 + exit 1
208 + fi
209 + else
210 + if grep -q "COMPOSIO_INSTALL" ~/.bashrc; then
211 + echo "✅ .bashrc updated with COMPOSIO_INSTALL"
212 + else
213 + echo "❌ .bashrc not updated"
214 + exit 1
215 + fi
216 +
217 + if grep -q "composio/bin" ~/.bashrc; then
218 + echo "✅ .bashrc updated with PATH"
219 + else
220 + echo "❌ .bashrc PATH not updated"
221 + exit 1
222 + fi
223 + fi
224 +
225 + - name: Test custom install directory
226 + shell: bash
227 + run: |
228 + echo "Testing custom install directory..."
229 +
230 + # Clean up previous installation
231 + rm -rf ~/.composio
232 +
233 + # Test with custom directory
234 + export COMPOSIO_INSTALL="/tmp/custom-composio"
235 + bash install.sh
236 +
237 + # Verify custom installation
238 + if [[ -f "/tmp/custom-composio/bin/composio" ]]; then
239 + echo "✅ Custom directory installation successful"
240 + ls -la "/tmp/custom-composio/bin/composio"
241 + else
242 + echo "❌ Custom directory installation failed"
243 + exit 1
244 + fi
245 +
246 + # Test execution
247 + if "/tmp/custom-composio/bin/composio" --version; then
248 + echo "✅ Custom installation executes successfully"
249 + else
250 + echo "❌ Custom installation execution failed"
251 + exit 1
252 + fi
253 +
254 + - name: Test uninstallation
255 + run: |
256 + echo "Testing uninstallation..."
257 +
258 + # Remove binary
259 + rm -rf ~/.composio /tmp/custom-composio
260 +
261 + # Check if binary is gone
262 + if [[ ! -f "$HOME/.composio/bin/composio" ]]; then
263 + echo "✅ Binary removed successfully"
264 + else
265 + echo "❌ Binary removal failed"
266 + exit 1
267 + fi
268 +
269 + - name: Test error handling
270 + shell: bash
271 + run: |
272 + echo "Testing error handling..."
273 +
274 + # Test with invalid version
275 + if bash install.sh v999.999.999 2>&1 | grep -q "Failed"; then
276 + echo "✅ Error handling works for invalid version"
277 + else
278 + echo "❌ Error handling failed"
279 + # Don't exit 1 here as this is expected to fail
280 + fi
281 +
282 + test-npm-fallback:
283 + name: Test npm Installation Fallback
284 + runs-on: ${{ matrix.os }}
285 + strategy:
286 + fail-fast: false
287 + matrix:
288 + os: [ubuntu-latest, macos-latest]
289 + node-version: [18, 20, 22]
290 +
291 + steps:
292 + - name: Checkout
293 + uses: actions/checkout@v4
294 +
295 + - name: Setup Node.js
296 + uses: actions/setup-node@v4
297 + with:
298 + node-version: ${{ matrix.node-version }}
299 +
300 + - name: Test npm installation
301 + run: |
302 + echo "Testing npm installation as fallback..."
303 +
304 + # This would normally install from npm registry
305 + # For testing, we just verify the command works
306 + if command -v npm &> /dev/null; then
307 + echo "✅ npm is available"
308 + npm --version
309 + else
310 + echo "❌ npm not available"
311 + exit 1
312 + fi
313 +
314 + test-architecture-detection:
315 + name: Test Architecture Detection
316 + runs-on: ${{ matrix.os }}
317 + strategy:
318 + fail-fast: false
319 + matrix:
320 + include:
321 + - os: ubuntu-latest
322 + arch: x64
323 + expected: "Linux x64"
324 + - os: depot-ubuntu-24.04-arm
325 + arch: arm64
326 + expected: "Linux ARM64"
327 + - os: macos-13
328 + arch: x64
329 + expected: "macOS x64"
330 + - os: macos-latest
331 + arch: arm64
332 + expected: "macOS ARM64"
333 +
334 + steps:
335 + - name: Checkout
336 + uses: actions/checkout@v4
337 +
338 + - name: Test architecture detection
339 + run: |
340 + echo "Testing architecture detection for: ${{ matrix.expected }}"
341 +
342 + platform=$(uname -ms)
343 + echo "Detected platform: $platform"
344 +
345 + case $platform in
346 + 'Darwin x86_64')
347 + detected="macOS x64"
348 + ;;
349 + 'Darwin arm64')
350 + detected="macOS ARM64"
351 + ;;
352 + 'Linux x86_64')
353 + detected="Linux x64"
354 + ;;
355 + 'Linux aarch64'|'Linux arm64')
356 + detected="Linux ARM64"
357 + ;;
358 + *)
359 + echo "❌ Unknown platform: $platform"
360 + exit 1
361 + ;;
362 + esac
363 +
364 + if [[ "$detected" == "${{ matrix.expected }}" ]]; then
365 + echo "✅ Correctly detected: $detected"
366 + else
367 + echo "❌ Detection mismatch: expected '${{ matrix.expected }}', got '$detected'"
368 + exit 1
369 + fi
370 +
371 + test-prerequisites:
372 + name: Test Prerequisites
373 + runs-on: ${{ matrix.os }}
374 + strategy:
375 + fail-fast: false
376 + matrix:
377 + os: [ubuntu-latest, macos-latest]
378 +
379 + steps:
380 + - name: Checkout
381 + uses: actions/checkout@v4
382 +
383 + - name: Test required tools
384 + run: |
385 + echo "Testing required tools..."
386 +
387 + # Test curl
388 + if command -v curl &> /dev/null; then
389 + echo "✅ curl available"
390 + curl --version | head -1
391 + else
392 + echo "❌ curl not available"
393 + exit 1
394 + fi
395 +
396 + # Test unzip
397 + if command -v unzip &> /dev/null; then
398 + echo "✅ unzip available"
399 + unzip -v | head -1
400 + else
401 + echo "❌ unzip not available"
402 + exit 1
403 + fi
404 +
405 + - name: Test without prerequisites
406 + run: |
407 + echo "Testing error handling when prerequisites are missing..."
408 +
409 + # Create a version of the script that will fail prerequisite check
410 + sed 's/command -v curl/command -v nonexistent-tool/' install.sh > test-install.sh
411 +
412 + if bash test-install.sh 2>&1 | grep -q "required to install"; then
413 + echo "✅ Prerequisites check works"
414 + else
415 + echo "❌ Prerequisites check failed"
416 + exit 1
417 + fi
418 +
419 + rm test-install.sh
420 +
421 + summary:
422 + name: Installation Test Summary
423 + needs: [test-install-script, test-npm-fallback, test-architecture-detection, test-prerequisites]
424 + runs-on: ubuntu-latest
425 + if: always()
426 +
427 + steps:
428 + - name: Test Results Summary
429 + run: |
430 + echo "## Installation Test Results" >> $GITHUB_STEP_SUMMARY
431 + echo "" >> $GITHUB_STEP_SUMMARY
432 +
433 + if [[ "${{ needs.test-install-script.result }}" == "success" ]]; then
434 + echo "✅ **Install Script Tests**: PASSED" >> $GITHUB_STEP_SUMMARY
435 + else
436 + echo "❌ **Install Script Tests**: FAILED" >> $GITHUB_STEP_SUMMARY
437 + fi
438 +
439 + if [[ "${{ needs.test-npm-fallback.result }}" == "success" ]]; then
440 + echo "✅ **npm Fallback Tests**: PASSED" >> $GITHUB_STEP_SUMMARY
441 + else
442 + echo "❌ **npm Fallback Tests**: FAILED" >> $GITHUB_STEP_SUMMARY
443 + fi
444 +
445 + if [[ "${{ needs.test-architecture-detection.result }}" == "success" ]]; then
446 + echo "✅ **Architecture Detection**: PASSED" >> $GITHUB_STEP_SUMMARY
447 + else
448 + echo "❌ **Architecture Detection**: FAILED" >> $GITHUB_STEP_SUMMARY
449 + fi
450 +
451 + if [[ "${{ needs.test-prerequisites.result }}" == "success" ]]; then
452 + echo "✅ **Prerequisites Check**: PASSED" >> $GITHUB_STEP_SUMMARY
453 + else
454 + echo "❌ **Prerequisites Check**: FAILED" >> $GITHUB_STEP_SUMMARY
455 + fi
456 +
457 + echo "" >> $GITHUB_STEP_SUMMARY
458 + echo "**Test Matrix Coverage:**" >> $GITHUB_STEP_SUMMARY
459 + echo "- **Linux x64**: Ubuntu 20.04, 22.04, Latest" >> $GITHUB_STEP_SUMMARY
460 + echo "- **Linux ARM64**: Ubuntu 22.04, 24.04 (via Depot)" >> $GITHUB_STEP_SUMMARY
461 + echo "- **macOS x64**: macOS 12, 13, 14, Latest" >> $GITHUB_STEP_SUMMARY
462 + echo "- **macOS ARM64**: macOS Latest" >> $GITHUB_STEP_SUMMARY
463 + echo "- **Shells**: Bash and Zsh" >> $GITHUB_STEP_SUMMARY
464 + echo "- **Node.js**: 18, 20, 22 (npm fallback)" >> $GITHUB_STEP_SUMMARY
465 + echo "- **Total platforms**: 4 architectures across 15+ environments" >> $GITHUB_STEP_SUMMARY
\ No newline at end of file
CLAUDE.md new
+208
@@ -0,0 +1,208 @@
1 +# CLAUDE.md
2 +
3 +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4 +
5 +## Overview
6 +
7 +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.
8 +
9 +## Common Development Commands
10 +
11 +### Build and Development
12 +```bash
13 +# Build all packages
14 +pnpm build
15 +
16 +# Build only TypeScript packages
17 +pnpm build:packages
18 +
19 +# Clean build artifacts
20 +pnpm clean
21 +pnpm clean:workspace
22 +
23 +# Lint code
24 +pnpm lint
25 +pnpm lint:fix
26 +
27 +# Format code
28 +pnpm format
29 +
30 +# Run tests
31 +pnpm test
32 +```
33 +
34 +### Package Management
35 +```bash
36 +# Install dependencies
37 +pnpm install
38 +
39 +# Check peer dependencies
40 +pnpm check:peer-deps
41 +
42 +# Update peer dependencies
43 +pnpm update:peer-deps
44 +```
45 +
46 +### Creating New Components
47 +```bash
48 +# Create a new provider
49 +pnpm create:provider <provider-name> [--agentic]
50 +
51 +# Create a new example
52 +pnpm create:example <example-name>
53 +```
54 +
55 +### Release Management
56 +```bash
57 +# Create changeset for releases
58 +pnpm changeset
59 +
60 +# Version packages
61 +pnpm changeset:version
62 +
63 +# Publish packages
64 +pnpm changeset:release
65 +```
66 +
67 +## Project Architecture
68 +
69 +### Repository Structure
70 +```
71 +composio/
72 +├── ts/ # TypeScript SDK (main development)
73 +│ ├── packages/
74 +│ │ ├── core/ # Core SDK functionality
75 +│ │ ├── providers/ # AI provider integrations (OpenAI, Anthropic, etc.)
76 +│ │ ├── cli/ # Command-line interface
77 +│ │ ├── json-schema-to-zod/ # Schema conversion utility
78 +│ │ └── ts-builders/ # TypeScript code generation utilities
79 +│ └── examples/ # Usage examples for different providers
80 +├── python/ # Python SDK
81 +├── fern/ # Documentation and API specs
82 +└── examples/ # Cross-platform examples
83 +```
84 +
85 +### Core Packages
86 +
87 +**@composio/core** - Main SDK functionality:
88 +- `src/composio.ts` - Main Composio class
89 +- `src/models/` - Core models (Tools, Toolkits, ConnectedAccounts, etc.)
90 +- `src/provider/` - Base provider implementations
91 +- `src/services/` - Internal services (telemetry, pusher)
92 +- `src/types/` - TypeScript type definitions
93 +- `src/utils/` - Utility functions and helpers
94 +
95 +**Provider Packages** - AI integrations:
96 +- `@composio/openai` - OpenAI integration
97 +- `@composio/anthropic` - Anthropic integration
98 +- `@composio/google` - Google GenAI integration
99 +- `@composio/langchain` - LangChain integration
100 +- `@composio/vercel` - Vercel AI integration
101 +- `@composio/mastra` - Mastra integration
102 +
103 +### Key Concepts
104 +
105 +**Tools** - Individual functions that can be executed (e.g., GITHUB_CREATE_REPO, GMAIL_SEND_EMAIL)
106 +
107 +**Toolkits** - Collections of related tools grouped by service (e.g., github, gmail, slack)
108 +
109 +**Connected Accounts** - User authentication/authorization for external services
110 +
111 +**Auth Configs** - Configuration for different authentication methods
112 +
113 +**Custom Tools** - User-defined tools with custom logic
114 +
115 +**Providers** - Integrations with AI frameworks (OpenAI, Anthropic, etc.)
116 +
117 +**Modifiers** - Middleware to transform tool inputs/outputs
118 +
119 +## Development Workflow
120 +
121 +### For Tool Development
122 +1. Tools are auto-generated from OpenAPI specifications
123 +2. Custom tools can be created using the Custom Tools API
124 +3. Tool execution happens through the main Composio class
125 +
126 +### For Provider Development
127 +1. Use `pnpm create:provider <name>` to scaffold new providers
128 +2. Implement required methods: `wrapTool`, `wrapTools`
129 +3. For agentic providers, also implement execution handlers
130 +4. Add comprehensive tests and documentation
131 +
132 +### Testing
133 +- Unit tests use Vitest
134 +- Run tests with `pnpm test`
135 +- Tests are located in `test/` directories within each package
136 +- Mock implementations are available in `test/utils/mocks/`
137 +
138 +### Code Quality
139 +- ESLint configuration in `eslint.config.mjs`
140 +- Prettier for code formatting
141 +- TypeScript strict mode enabled
142 +- Comprehensive TSDoc documentation required
143 +- Husky pre-commit hooks for quality checks
144 +
145 +## Environment Variables
146 +
147 +```bash
148 +COMPOSIO_API_KEY # Required: Your Composio API key
149 +COMPOSIO_BASE_URL # Optional: Custom API base URL
150 +COMPOSIO_LOG_LEVEL # Optional: Logging level (silent, error, warn, info, debug)
151 +COMPOSIO_DISABLE_TELEMETRY # Optional: Set to "true" to disable telemetry
152 +DEVELOPMENT # Development mode flag
153 +CI # CI environment flag
154 +```
155 +
156 +## Key Files and Locations
157 +
158 +- **Main SDK Entry**: `ts/packages/core/src/index.ts`
159 +- **Core Composio Class**: `ts/packages/core/src/composio.ts`
160 +- **Type Definitions**: `ts/packages/core/src/types/`
161 +- **Error Classes**: `ts/packages/core/src/errors/`
162 +- **Examples**: `ts/examples/` and `examples/`
163 +- **Documentation**: `ts/docs/` and `fern/`
164 +- **Build Configs**: `turbo.json`, `tsconfig.base.json`
165 +
166 +## Testing Commands
167 +
168 +```bash
169 +# Run all tests
170 +pnpm test
171 +
172 +# Run tests for core package only
173 +cd ts/packages/core && pnpm test
174 +
175 +# Run tests with UI
176 +pnpm test:ui
177 +```
178 +
179 +## Common Patterns
180 +
181 +### Tool Execution
182 +```typescript
183 +const composio = new Composio({ apiKey: 'your-key' });
184 +const result = await composio.tools.execute('TOOL_NAME', {
185 + userId: 'user-id',
186 + arguments: { /* tool args */ }
187 +});
188 +```
189 +
190 +### Provider Integration
191 +```typescript
192 +import { OpenAIProvider } from '@composio/openai';
193 +const provider = new OpenAIProvider({ apiKey: 'openai-key' });
194 +const tools = await composio.tools.get('user-id', { toolkits: ['github'] });
195 +const wrappedTools = provider.wrapTools(tools);
196 +```
197 +
198 +### Custom Tool Creation
199 +```typescript
200 +const customTool = await composio.tools.createCustomTool({
201 + name: 'My Tool',
202 + description: 'Tool description',
203 + inputParameters: { /* JSON schema */ },
204 + handler: async (params) => { /* implementation */ }
205 +});
206 +```
207 +
208 +This monorepo uses pnpm workspaces and Turbo for efficient builds and development.
\ No newline at end of file
INSTALL.md new
+212
@@ -0,0 +1,212 @@
1 +# Composio CLI Installation Guide
2 +
3 +This guide provides multiple ways to install the Composio CLI on your system.
4 +
5 +## Quick Install (Recommended)
6 +
7 +### One-line Install
8 +```bash
9 +curl -fsSL https://raw.githubusercontent.com/ComposioHQ/composio/main/install.sh | bash
10 +```
11 +
12 +### Install specific version
13 +```bash
14 +curl -fsSL https://raw.githubusercontent.com/ComposioHQ/composio/main/install.sh | bash -s -- v0.1.24
15 +```
16 +
17 +### What the install script does:
18 +- Detects your platform and architecture automatically
19 +- Downloads the appropriate binary from GitHub releases
20 +- Installs to `~/.composio/bin/composio`
21 +- Updates your shell configuration (.bashrc, .zshrc, or .config/fish/config.fish)
22 +- Adds the binary to your PATH
23 +
24 +## Manual Installation
25 +
26 +### From GitHub Releases
27 +
28 +1. Go to the [releases page](https://github.com/ComposioHQ/composio/releases)
29 +2. Download the appropriate binary for your platform:
30 + - `composio-linux-x64.zip` - Linux 64-bit
31 + - `composio-linux-aarch64.zip` - Linux ARM64
32 + - `composio-darwin-x64.zip` - macOS Intel
33 + - `composio-darwin-aarch64.zip` - macOS Apple Silicon
34 +
35 +3. Extract and install:
36 +```bash
37 +# Extract the binary
38 +unzip composio-*.zip
39 +
40 +# Move to a directory in your PATH
41 +sudo mv composio /usr/local/bin/
42 +
43 +# Make it executable
44 +chmod +x /usr/local/bin/composio
45 +```
46 +
47 +## Package Manager Installation
48 +
49 +### npm
50 +```bash
51 +npm install -g @composio/cli
52 +```
53 +
54 +### pnpm
55 +```bash
56 +pnpm add -g @composio/cli
57 +```
58 +
59 +### yarn
60 +```bash
61 +yarn global add @composio/cli
62 +```
63 +
64 +## Verification
65 +
66 +After installation, verify it works:
67 +
68 +```bash
69 +composio --version
70 +composio --help
71 +```
72 +
73 +## Getting Started
74 +
75 +1. **Login to Composio:**
76 + ```bash
77 + composio login
78 + ```
79 +
80 +2. **Generate types for your project:**
81 + ```bash
82 + # Auto-detect project type and generate
83 + composio generate
84 +
85 + # Generate for TypeScript
86 + composio ts generate
87 +
88 + # Generate for Python
89 + composio py generate
90 + ```
91 +
92 +3. **Check your account:**
93 + ```bash
94 + composio whoami
95 + ```
96 +
97 +## Supported Platforms
98 +
99 +✅ **Fully Supported:**
100 +- Linux x86_64
101 +- Linux ARM64 (aarch64)
102 +- macOS x86_64 (Intel)
103 +- macOS ARM64 (Apple Silicon)
104 +
105 +❌ **Not Supported:**
106 +- Windows (use WSL or npm installation)
107 +
108 +## Troubleshooting
109 +
110 +### Permission Denied
111 +If you get permission errors:
112 +```bash
113 +chmod +x ~/.composio/bin/composio
114 +```
115 +
116 +### Command Not Found
117 +If `composio` is not found after installation:
118 +
119 +1. **Restart your shell:**
120 + ```bash
121 + exec $SHELL
122 + ```
123 +
124 +2. **Or manually source your profile:**
125 + ```bash
126 + # For bash
127 + source ~/.bashrc
128 +
129 + # For zsh
130 + source ~/.zshrc
131 +
132 + # For fish
133 + source ~/.config/fish/config.fish
134 + ```
135 +
136 +3. **Check if the binary exists:**
137 + ```bash
138 + ls -la ~/.composio/bin/composio
139 + ```
140 +
141 +4. **Manually add to PATH:**
142 + ```bash
143 + export PATH="$HOME/.composio/bin:$PATH"
144 + ```
145 +
146 +### Download Failures
147 +If the download fails:
148 +
149 +1. **Check your internet connection**
150 +2. **Try again with verbose output:**
151 + ```bash
152 + curl -v -fsSL https://raw.githubusercontent.com/ComposioHQ/composio/main/install.sh | bash
153 + ```
154 +
155 +3. **Manual download:**
156 + ```bash
157 + # Download the install script first
158 + curl -O https://raw.githubusercontent.com/ComposioHQ/composio/main/install.sh
159 +
160 + # Review the script
161 + cat install.sh
162 +
163 + # Run it
164 + bash install.sh
165 + ```
166 +
167 +## Uninstallation
168 +
169 +To remove Composio CLI:
170 +
171 +```bash
172 +# Remove the binary
173 +rm -rf ~/.composio
174 +
175 +# Remove from shell configuration
176 +# Edit ~/.bashrc, ~/.zshrc, or ~/.config/fish/config.fish
177 +# and remove the lines that were added by the installer:
178 +# export COMPOSIO_INSTALL="$HOME/.composio"
179 +# export PATH="$COMPOSIO_INSTALL/bin:$PATH"
180 +```
181 +
182 +## Environment Variables
183 +
184 +The installer respects these environment variables:
185 +
186 +- `COMPOSIO_INSTALL` - Installation directory (default: `~/.composio`)
187 +- `GITHUB` - GitHub base URL (default: `https://github.com`)
188 +
189 +Example:
190 +```bash
191 +export COMPOSIO_INSTALL="/usr/local"
192 +curl -fsSL https://raw.githubusercontent.com/ComposioHQ/composio/main/install.sh | bash
193 +```
194 +
195 +## Development
196 +
197 +To build the CLI binary locally:
198 +
199 +```bash
200 +cd ts/packages/cli
201 +pnpm install
202 +pnpm build:bin
203 +```
204 +
205 +The binary will be created at `dist/composio`.
206 +
207 +## Support
208 +
209 +- 📖 [Documentation](https://docs.composio.dev)
210 +- 💬 [Discord Community](https://discord.gg/composio)
211 +- 🐛 [Report Issues](https://github.com/ComposioHQ/composio/issues)
212 +- 📧 [Email Support](mailto:support@composio.dev)
\ No newline at end of file
install.sh new
+308
@@ -0,0 +1,308 @@
1 +#!/usr/bin/env bash
2 +set -euo pipefail
3 +
4 +platform=$(uname -ms)
5 +
6 +# Check for unsupported platforms
7 +case $platform in
8 +'MINGW64'* | 'MSYS'* | 'CYGWIN'*)
9 + echo "Windows installation is not supported yet. Please use WSL or install via npm:"
10 + echo " npm install -g @composio/cli"
11 + exit 1
12 + ;;
13 +esac
14 +
15 +# Reset
16 +Color_Off=''
17 +
18 +# Regular Colors
19 +Red=''
20 +Green=''
21 +Dim='' # White
22 +
23 +# Bold
24 +Bold_White=''
25 +Bold_Green=''
26 +
27 +if [[ -t 1 ]]; then
28 + # Reset
29 + Color_Off='\033[0m' # Text Reset
30 +
31 + # Regular Colors
32 + Red='\033[0;31m' # Red
33 + Green='\033[0;32m' # Green
34 + Dim='\033[0;2m' # White
35 +
36 + # Bold
37 + Bold_Green='\033[1;32m' # Bold Green
38 + Bold_White='\033[1m' # Bold White
39 +fi
40 +
41 +error() {
42 + echo -e "${Red}error${Color_Off}:" "$@" >&2
43 + exit 1
44 +}
45 +
46 +info() {
47 + echo -e "${Dim}$@ ${Color_Off}"
48 +}
49 +
50 +info_bold() {
51 + echo -e "${Bold_White}$@ ${Color_Off}"
52 +}
53 +
54 +success() {
55 + echo -e "${Green}$@ ${Color_Off}"
56 +}
57 +
58 +# Check for required tools
59 +command -v unzip >/dev/null ||
60 + error 'unzip is required to install Composio CLI'
61 +
62 +command -v curl >/dev/null ||
63 + error 'curl is required to install Composio CLI'
64 +
65 +if [[ $# -gt 1 ]]; then
66 + error 'Too many arguments, only 1 is allowed. You can specify a specific version to install. (e.g. "v0.1.24")'
67 +fi
68 +
69 +# Determine platform and architecture
70 +case $platform in
71 +'Darwin x86_64')
72 + target=darwin-x64
73 + ;;
74 +'Darwin arm64')
75 + target=darwin-aarch64
76 + ;;
77 +'Linux aarch64' | 'Linux arm64')
78 + target=linux-aarch64
79 + ;;
80 +'Linux x86_64' | *)
81 + target=linux-x64
82 + ;;
83 +esac
84 +
85 +# Check for musl on Linux
86 +case "$target" in
87 +'linux'*)
88 + if [ -f /etc/alpine-release ]; then
89 + target="$target-musl"
90 + fi
91 + ;;
92 +esac
93 +
94 +# Special handling for Rosetta on macOS
95 +if [[ $target = darwin-x64 ]]; then
96 + # Is this process running in Rosetta?
97 + # redirect stderr to devnull to avoid error message when not running in Rosetta
98 + if [[ $(sysctl -n sysctl.proc_translated 2>/dev/null) = 1 ]]; then
99 + target=darwin-aarch64
100 + info "Your shell is running in Rosetta 2. Downloading Composio CLI for $target instead"
101 + fi
102 +fi
103 +
104 +GITHUB=${GITHUB-"https://github.com"}
105 +github_repo="$GITHUB/ComposioHQ/composio"
106 +
107 +exe_name=composio
108 +
109 +# Determine version to install
110 +if [[ $# = 0 ]]; then
111 + # Get latest version from GitHub API
112 + version=$(curl -s https://api.github.com/repos/ComposioHQ/composio/releases/latest | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
113 + if [[ -z "$version" ]]; then
114 + error "Failed to get latest version from GitHub"
115 + fi
116 + composio_uri="$github_repo/releases/latest/download/composio-$target.zip"
117 +else
118 + version=$1
119 + composio_uri="$github_repo/releases/download/$version/composio-$target.zip"
120 +fi
121 +
122 +info "Installing Composio CLI $version for $target"
123 +
124 +# Set up installation directory
125 +install_env=COMPOSIO_INSTALL
126 +bin_env=\$install_env/bin
127 +
128 +install_dir=${!install_env:-$HOME/.composio}
129 +bin_dir=$install_dir/bin
130 +exe=$bin_dir/composio
131 +
132 +if [[ ! -d $bin_dir ]]; then
133 + mkdir -p "$bin_dir" ||
134 + error "Failed to create install directory \"$bin_dir\""
135 +fi
136 +
137 +# Download and extract
138 +info "Downloading Composio CLI..."
139 +curl --fail --location --progress-bar --output "$exe.zip" "$composio_uri" ||
140 + error "Failed to download Composio CLI from \"$composio_uri\""
141 +
142 +info "Extracting Composio CLI..."
143 +unzip -oqd "$bin_dir" "$exe.zip" ||
144 + error 'Failed to extract Composio CLI'
145 +
146 +# Move binary to final location
147 +if [[ -f "$bin_dir/composio-$target/$exe_name" ]]; then
148 + mv "$bin_dir/composio-$target/$exe_name" "$exe" ||
149 + error 'Failed to move extracted binary to destination'
150 + rm -r "$bin_dir/composio-$target"
151 +elif [[ -f "$bin_dir/$exe_name" ]]; then
152 + mv "$bin_dir/$exe_name" "$exe" ||
153 + error 'Failed to move extracted binary to destination'
154 +else
155 + error 'Binary not found in extracted archive'
156 +fi
157 +
158 +chmod +x "$exe" ||
159 + error 'Failed to set permissions on Composio CLI executable'
160 +
161 +rm "$exe.zip"
162 +
163 +tildify() {
164 + if [[ $1 = $HOME/* ]]; then
165 + local replacement=\~/
166 + echo "${1/$HOME\//$replacement}"
167 + else
168 + echo "$1"
169 + fi
170 +}
171 +
172 +success "Composio CLI was installed successfully to $Bold_Green$(tildify "$exe")"
173 +
174 +# Check if composio is already in PATH
175 +if command -v composio >/dev/null; then
176 + echo "Run 'composio --help' to get started"
177 + exit
178 +fi
179 +
180 +refresh_command=''
181 +
182 +tilde_bin_dir=$(tildify "$bin_dir")
183 +quoted_install_dir=\"${install_dir//\"/\\\"}\"
184 +
185 +if [[ $quoted_install_dir = \"$HOME/* ]]; then
186 + quoted_install_dir=${quoted_install_dir/$HOME\//\$HOME/}
187 +fi
188 +
189 +echo
190 +
191 +# Add to shell configuration
192 +case $(basename "$SHELL") in
193 +fish)
194 + commands=(
195 + "set --export $install_env $quoted_install_dir"
196 + "set --export PATH $bin_env \$PATH"
197 + )
198 +
199 + fish_config=$HOME/.config/fish/config.fish
200 + tilde_fish_config=$(tildify "$fish_config")
201 +
202 + if [[ -w $fish_config ]]; then
203 + {
204 + echo -e '\n# Composio CLI'
205 + for command in "${commands[@]}"; do
206 + echo "$command"
207 + done
208 + } >>"$fish_config"
209 +
210 + info "Added \"$tilde_bin_dir\" to \$PATH in \"$tilde_fish_config\""
211 + refresh_command="source $tilde_fish_config"
212 + else
213 + echo "Manually add the directory to $tilde_fish_config (or similar):"
214 + for command in "${commands[@]}"; do
215 + info_bold " $command"
216 + done
217 + fi
218 + ;;
219 +zsh)
220 + commands=(
221 + "export $install_env=$quoted_install_dir"
222 + "export PATH=\"$bin_env:\$PATH\""
223 + )
224 +
225 + zsh_config=$HOME/.zshrc
226 + tilde_zsh_config=$(tildify "$zsh_config")
227 +
228 + if [[ -w $zsh_config ]]; then
229 + {
230 + echo -e '\n# Composio CLI'
231 + for command in "${commands[@]}"; do
232 + echo "$command"
233 + done
234 + } >>"$zsh_config"
235 +
236 + info "Added \"$tilde_bin_dir\" to \$PATH in \"$tilde_zsh_config\""
237 + refresh_command="exec $SHELL"
238 + else
239 + echo "Manually add the directory to $tilde_zsh_config (or similar):"
240 + for command in "${commands[@]}"; do
241 + info_bold " $command"
242 + done
243 + fi
244 + ;;
245 +bash)
246 + commands=(
247 + "export $install_env=$quoted_install_dir"
248 + "export PATH=\"$bin_env:\$PATH\""
249 + )
250 +
251 + bash_configs=(
252 + "$HOME/.bashrc"
253 + "$HOME/.bash_profile"
254 + )
255 +
256 + if [[ ${XDG_CONFIG_HOME:-} ]]; then
257 + bash_configs+=(
258 + "$XDG_CONFIG_HOME/.bash_profile"
259 + "$XDG_CONFIG_HOME/.bashrc"
260 + "$XDG_CONFIG_HOME/bash_profile"
261 + "$XDG_CONFIG_HOME/bashrc"
262 + )
263 + fi
264 +
265 + set_manually=true
266 + for bash_config in "${bash_configs[@]}"; do
267 + tilde_bash_config=$(tildify "$bash_config")
268 +
269 + if [[ -w $bash_config ]]; then
270 + {
271 + echo -e '\n# Composio CLI'
272 + for command in "${commands[@]}"; do
273 + echo "$command"
274 + done
275 + } >>"$bash_config"
276 +
277 + info "Added \"$tilde_bin_dir\" to \$PATH in \"$tilde_bash_config\""
278 + refresh_command="source $bash_config"
279 + set_manually=false
280 + break
281 + fi
282 + done
283 +
284 + if [[ $set_manually = true ]]; then
285 + echo "Manually add the directory to ~/.bashrc (or similar):"
286 + for command in "${commands[@]}"; do
287 + info_bold " $command"
288 + done
289 + fi
290 + ;;
291 +*)
292 + echo 'Manually add the directory to ~/.bashrc (or similar):'
293 + info_bold " export $install_env=$quoted_install_dir"
294 + info_bold " export PATH=\"$bin_env:\$PATH\""
295 + ;;
296 +esac
297 +
298 +echo
299 +info "To get started, run:"
300 +echo
301 +
302 +if [[ $refresh_command ]]; then
303 + info_bold " $refresh_command"
304 +fi
305 +
306 +info_bold " composio --help"
307 +info_bold " composio login"
308 +