diff --git a/README.md b/README.md index ab38c7cb3d..e0b3963cf7 100644 --- a/README.md +++ b/README.md @@ -1,93 +1,162 @@ +
+ # altimate-code -AI-powered CLI for SQL analysis, dbt integration, and data engineering. +**The AI coding agent for data teams.** + +Batteries included for SQL, dbt, and data warehouses. -[![npm version](https://img.shields.io/npm/v/altimate-code-ai)](https://www.npmjs.com/package/altimate-code-ai) -[![PyPI version](https://img.shields.io/pypi/v/altimate-engine)](https://pypi.org/project/altimate-engine/) +[![npm](https://img.shields.io/npm/v/@altimateai/altimate-code)](https://www.npmjs.com/package/@altimateai/altimate-code) +[![PyPI](https://img.shields.io/pypi/v/altimate-engine)](https://pypi.org/project/altimate-engine/) [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](./LICENSE) [![CI](https://github.com/AltimateAI/altimate-code/actions/workflows/ci.yml/badge.svg)](https://github.com/AltimateAI/altimate-code/actions/workflows/ci.yml) -## Features +
-- **SQL Analysis & Formatting** -- Parse, validate, and auto-format SQL across dialects -- **Column-Level Lineage** -- Trace data flow at the column level through complex SQL transformations -- **dbt Integration** -- Profile management, project-aware lineage, and `+` operator for upstream/downstream selection -- **Warehouse Connectivity** -- Connect to Snowflake, BigQuery, Databricks, Postgres, DuckDB, and MySQL -- **AI-Powered Code Review** -- Get intelligent suggestions on SQL quality, performance, and best practices -- **TUI Interface** -- Interactive terminal UI built with Solid.js -- **MCP Server** -- Model Context Protocol support for integration with AI assistants +--- -## Quick Install +An AI coding agent with 40+ specialized data tools, column-level lineage, dbt integration, and warehouse connectivity built in -- all available to any AI provider. + +## Install ```bash # npm -npm install -g @altimateai/altimate-code +npm i -g @altimateai/altimate-code # Homebrew -brew install altimate/tap/altimate-code +brew install AltimateAI/tap/altimate-code ``` -## Getting Started +Then run `altimate-code` to launch the interactive TUI, or `altimate-code run "your prompt"` for one-shot mode. -```bash -# Launch the interactive TUI -altimate-code +## Highlights -# Analyze a SQL file -altimate-code analyze query.sql +| Capability | Details | +|---|---| +| **SQL analysis** | 40+ tools -- lint, format, transpile, optimize, safety checks | +| **Column-level lineage** | Trace data flow through complex SQL and dbt models | +| **dbt integration** | Manifest parsing, profile management, `+` operator | +| **Warehouse connectivity** | Snowflake, BigQuery, Redshift, Databricks, Postgres, DuckDB, MySQL, SQL Server | +| **PII detection** | Classify sensitive columns, flag risky queries | +| **Query cost prediction** | Estimate execution costs before running | +| **FinOps** | Credit analysis, query history insights | +| **AI providers** | 15+ providers -- Anthropic, OpenAI, Gemini, Bedrock, and more | +| **TUI + headless** | Interactive terminal UI or `altimate-code serve` for CI/CD | +| **MCP + LSP** | Model Context Protocol and Language Server Protocol support | -# Trace column lineage -altimate-code lineage --sql "SELECT a.id, b.name FROM a JOIN b ON a.id = b.id" -``` +## Features + +### SQL Analysis (40+ tools) + +The AI has access to specialized SQL tools that go far beyond what a general coding agent can do: + +- **Lint & validate** -- Catch anti-patterns like implicit casts, NULL comparisons, unused CTEs +- **Format** -- Consistent SQL formatting across your team +- **Transpile** -- Convert between Snowflake, BigQuery, Postgres, T-SQL, MySQL, DuckDB +- **Optimize** -- Get index suggestions, query rewrites, complexity reduction +- **Safety checks** -- Detect breaking changes, SQL injection risks, schema violations +- **Test generation** -- Auto-generate SQL tests for your models +- **Equivalence checking** -- Verify two queries produce the same results + +### Column-Level Lineage + +Trace data flow at the column level through complex SQL transformations. Works standalone or with dbt manifests for project-wide lineage across models. + +### dbt Integration + +- Parse `manifest.json` and `profiles.yml` natively +- Column-level lineage across dbt models with `+` operator for upstream/downstream selection +- Execute dbt commands (compile, run, test) directly from the agent +- Profile management across environments + +### Warehouse Connectivity + +Connect directly to your data warehouse -- the AI can query schemas, run SQL, predict costs, and analyze query history: + +- Snowflake (with IAM auth) +- BigQuery (service account + ADC) +- Redshift (with IAM auth) +- Databricks +- PostgreSQL +- DuckDB +- MySQL +- SQL Server +- SSH tunneling for secure connections + +### AI Providers + +Use any model you want. altimate-code supports 15+ providers via the Vercel AI SDK: + +Anthropic, OpenAI, Google Gemini, Google Vertex AI, Amazon Bedrock, Azure OpenAI, Mistral, Groq, DeepInfra, Cerebras, Cohere, Together AI, Perplexity, xAI, OpenRouter, GitHub Copilot, GitLab + +### And more + +- Interactive TUI with Solid.js + OpenTUI +- Headless server mode (`altimate-code serve`) +- MCP server support (stdio, HTTP, SSE transports) +- LSP integration (workspace symbols, diagnostics) +- Session management (continue, fork, export/import) +- Custom agents and plugins +- GitHub integration (PR analysis, automated workflows) +- Token usage stats and cost tracking ## Architecture ``` -CLI (TypeScript / Bun) +altimate-code (TypeScript CLI) | - JSON-RPC Bridge (stdio) + JSON-RPC 2.0 (stdio) | -Python Engine (altimate-engine) +altimate-engine (Python) + SQL analysis, lineage, dbt, warehouse connections ``` -The CLI is written in TypeScript and runs on Bun. It communicates with the Python engine (`altimate-engine`) over a JSON-RPC 2.0 bridge using stdio. The Python engine handles SQL parsing, analysis, lineage computation, and warehouse interactions. +The CLI handles AI interactions, TUI, and tool orchestration. The Python engine handles SQL parsing, analysis, lineage computation, and warehouse interactions via a JSON-RPC bridge. -The Python engine **auto-bootstraps using `uv`** -- no system Python dependencies are required. On first run, the CLI downloads `uv`, creates an isolated virtual environment, and installs the engine automatically. - -## Monorepo Structure - -``` -packages/ - altimate-code/ TypeScript CLI (@altimate/cli) - altimate-engine/ Python engine (SQL analysis, lineage, warehouse) - plugin/ CLI plugin system (@altimate/cli-plugin) - sdk/js/ JavaScript SDK (@altimate/cli-sdk) - util/ Shared TypeScript utilities -``` +**Zero-dependency bootstrap**: On first run the CLI downloads [`uv`](https://github.com/astral-sh/uv), creates an isolated Python environment, and installs the engine automatically. No system Python required. ## Development -See [CONTRIBUTING.md](./CONTRIBUTING.md) for full development setup instructions. +See [CONTRIBUTING.md](./CONTRIBUTING.md) for the full setup guide. ```bash -# Install dependencies +git clone https://github.com/AltimateAI/altimate-code.git +cd altimate-code + +# TypeScript bun install +cd packages/altimate-code && bun test + +# Python engine +cd packages/altimate-engine +python -m venv .venv && source .venv/bin/activate +pip install -e ".[dev]" +pytest +``` -# Build the CLI -cd packages/altimate-code && bun run script/build.ts --single +### Monorepo structure -# Run tests -bun test +``` +packages/ + altimate-code/ TypeScript CLI + altimate-engine/ Python engine (SQL, lineage, warehouses) + plugin/ Plugin system + sdk/js/ JavaScript SDK + util/ Shared utilities ``` ## Documentation -Full documentation is available at [altimate-code.sh](https://altimate-code.sh). +Full docs at [altimate-code.sh](https://altimate-code.sh). ## Contributing -We welcome contributions! Please read our [Contributing Guide](./CONTRIBUTING.md) before submitting a pull request. +Contributions welcome! Please read the [Contributing Guide](./CONTRIBUTING.md) before opening a PR. + +## Acknowledgements + +altimate-code is a fork of [opencode](https://github.com/anomalyco/opencode), the open-source AI coding agent. We build on top of their excellent foundation to add data-team-specific capabilities. ## License -This project is licensed under the MIT License -- see the [LICENSE](./LICENSE) file for details. +MIT -- see [LICENSE](./LICENSE). diff --git a/packages/altimate-code/src/cli/cmd/uninstall.ts b/packages/altimate-code/src/cli/cmd/uninstall.ts index c44c0f3cde..5f6220ba75 100644 --- a/packages/altimate-code/src/cli/cmd/uninstall.ts +++ b/packages/altimate-code/src/cli/cmd/uninstall.ts @@ -129,10 +129,10 @@ async function showRemovalSummary(targets: RemovalTargets, method: Installation. if (method !== "curl" && method !== "unknown") { const cmds: Record = { - npm: "npm uninstall -g altimate-code-ai", - pnpm: "pnpm uninstall -g altimate-code-ai", - bun: "bun remove -g altimate-code-ai", - yarn: "yarn global remove altimate-code-ai", + npm: "npm uninstall -g @altimateai/altimate-code", + pnpm: "pnpm uninstall -g @altimateai/altimate-code", + bun: "bun remove -g @altimateai/altimate-code", + yarn: "yarn global remove @altimateai/altimate-code", brew: "brew uninstall altimate-code", choco: "choco uninstall altimate-code", scoop: "scoop uninstall altimate-code", @@ -180,10 +180,10 @@ async function executeUninstall(method: Installation.Method, targets: RemovalTar if (method !== "curl" && method !== "unknown") { const cmds: Record = { - npm: ["npm", "uninstall", "-g", "altimate-code-ai"], - pnpm: ["pnpm", "uninstall", "-g", "altimate-code-ai"], - bun: ["bun", "remove", "-g", "altimate-code-ai"], - yarn: ["yarn", "global", "remove", "altimate-code-ai"], + npm: ["npm", "uninstall", "-g", "@altimateai/altimate-code"], + pnpm: ["pnpm", "uninstall", "-g", "@altimateai/altimate-code"], + bun: ["bun", "remove", "-g", "@altimateai/altimate-code"], + yarn: ["yarn", "global", "remove", "@altimateai/altimate-code"], brew: ["brew", "uninstall", "altimate-code"], choco: ["choco", "uninstall", "altimate-code"], scoop: ["scoop", "uninstall", "altimate-code"], diff --git a/packages/altimate-code/src/installation/index.ts b/packages/altimate-code/src/installation/index.ts index 7efbf1ff28..16f8b133f2 100644 --- a/packages/altimate-code/src/installation/index.ts +++ b/packages/altimate-code/src/installation/index.ts @@ -104,7 +104,7 @@ export namespace Installation { for (const check of checks) { const output = await check.command() const installedName = - check.name === "brew" || check.name === "choco" || check.name === "scoop" ? "altimate-code" : "altimate-code-ai" + check.name === "brew" || check.name === "choco" || check.name === "scoop" ? "altimate-code" : "@altimateai/altimate-code" if (output.includes(installedName)) { return check.name } @@ -121,8 +121,8 @@ export namespace Installation { ) async function getBrewFormula() { - const tapFormula = await $`brew list --formula altimate/tap/altimate-code`.throws(false).quiet().text() - if (tapFormula.includes("altimate-code")) return "altimate/tap/altimate-code" + const tapFormula = await $`brew list --formula AltimateAI/tap/altimate-code`.throws(false).quiet().text() + if (tapFormula.includes("altimate-code")) return "AltimateAI/tap/altimate-code" const coreFormula = await $`brew list --formula altimate-code`.throws(false).quiet().text() if (coreFormula.includes("altimate-code")) return "altimate-code" return "altimate-code" @@ -138,19 +138,19 @@ export namespace Installation { }) break case "npm": - cmd = $`npm install -g altimate-code-ai@${target}` + cmd = $`npm install -g @altimateai/altimate-code@${target}` break case "pnpm": - cmd = $`pnpm install -g altimate-code-ai@${target}` + cmd = $`pnpm install -g @altimateai/altimate-code@${target}` break case "bun": - cmd = $`bun install -g altimate-code-ai@${target}` + cmd = $`bun install -g @altimateai/altimate-code@${target}` break case "brew": { const formula = await getBrewFormula() if (formula.includes("/")) { cmd = - $`brew tap altimate/tap && cd "$(brew --repo altimate/tap)" && git pull --ff-only && brew upgrade ${formula}`.env( + $`brew tap AltimateAI/tap && cd "$(brew --repo AltimateAI/tap)" && git pull --ff-only && brew upgrade ${formula}`.env( { HOMEBREW_NO_AUTO_UPDATE: "1", ...process.env, @@ -220,7 +220,7 @@ export namespace Installation { return reg.endsWith("/") ? reg.slice(0, -1) : reg }) const channel = CHANNEL - return fetch(`${registry}/altimate-code-ai/${channel}`) + return fetch(`${registry}/@altimateai/altimate-code/${channel}`) .then((res) => { if (!res.ok) throw new Error(res.statusText) return res.json()