All Modules

SQL CLI

Command-Line Power Tools

All of SQL2.AI from your terminal. Script migrations, run compliance checks, generate TypeScript types, and integrate seamlessly with CI/CD pipelines.

$ npm install -g @sql2ai/cli
$ sql2ai init
$ sql2ai query "Show customers who haven't ordered in 90 days" --generate

Built for Every Workflow

Local Development

# Quick schema inspection
sql2ai schema show customers

# Generate SQL with AI
sql2ai query "Get monthly sales" --generate

# Run migrations locally
sql2ai migrate up

Inspect schemas, generate queries, and manage migrations without leaving your terminal.

CI/CD Integration

# In your pipeline
sql2ai migrate validate
sql2ai comply check --framework soc2
sql2ai codegen --lang typescript

Validate migrations, run compliance checks, and generate types in your CI/CD pipeline.

Automation

# Batch operations
for db in prod staging dev; do
  sql2ai --connection $db \
    comply check --framework hipaa
done

Script complex workflows across multiple databases with full automation.

Core Commands

Schema Operations

# View schema
sql2ai schema show
sql2ai schema show customers

# Export to different formats
sql2ai schema export --format json
sql2ai schema export --format sql

# Search across schema
sql2ai schema search "customer"

Query Operations

# Execute queries
sql2ai query "SELECT * FROM customers"
sql2ai query --file report.sql

# AI-powered generation
sql2ai query "Show top spenders" --generate

# Optimize queries
sql2ai query optimize --file slow.sql

Migration Management

# Generate new migration
sql2ai migrate new "add loyalty points"

# Apply migrations
sql2ai migrate up
sql2ai migrate up --to 20250115_001

# Rollback
sql2ai migrate down

# Preview without applying
sql2ai migrate up --dry-run

Code Generation

# Generate TypeScript types
sql2ai codegen --lang typescript

# Generate C# Dapper models
sql2ai codegen --lang csharp

# Generate API from stored procs
sql2ai codegen api --framework fastapi

# Watch mode for development
sql2ai codegen --lang typescript --watch

CI/CD Integration

Drop SQL2.AI CLI into your existing pipelines

GitHub Actions

name: Database CI
on: [push, pull_request]

jobs:
  validate:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Install SQL2AI CLI
        run: npm install -g @sql2ai/cli

      - name: Validate Migrations
        run: sql2ai migrate validate
        env:
          SQL2AI_API_KEY: ${{ secrets.SQL2AI_API_KEY }}

      - name: Run Compliance Check
        run: sql2ai comply check --framework soc2

      - name: Verify Generated Types
        run: |
          sql2ai codegen --lang typescript --output ./src/types
          git diff --exit-code src/types

Pre-commit Hook

#!/bin/bash
# .git/hooks/pre-commit

# Validate SQL files
sql2ai query validate --files "**/*.sql"

# Check for migrations
if git diff --cached --name-only | grep -q "migrations/"; then
  sql2ai migrate validate
fi

Works with Claude

SQL CLI includes an MCP server mode for seamless Claude Desktop and Claude Code integration.

# Start MCP server mode
sql2ai mcp serve

# Configure in Claude Desktop (~/.config/claude/claude_desktop_config.json)
{
  "mcpServers": {
    "sql2ai": {
      "command": "sql2ai",
      "args": ["mcp", "serve"]
    }
  }
}

Once configured, Claude can directly query your databases, generate SQL, and analyze schemas.

Installation

NPM

npm install -g @sql2ai/cli

Homebrew

brew tap sql2ai/tap
brew install sql2ai

Direct Download

curl -L sql2ai.com/install.sh | sh

Everything You Need

Multi-Database

SQL Server, PostgreSQL, MySQL

Compliance Built-in

SOC2, HIPAA, GDPR checks

Code Generation

TypeScript, C#, Python types

AI-Powered

Generate queries from text

Free for individual developers

Ready to Automate Your Database Workflow?

Install SQL CLI and bring SQL2.AI to your terminal in seconds.

No credit card required • Setup in under 5 minutes • Cancel anytime