Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
165 changes: 117 additions & 48 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,93 +1,162 @@
<div align="center">

# 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
</div>

- **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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The internal upgrade and version check logic references the old package name altimate-code-ai, but the package is now published as @altimateai/altimate-code, which will cause upgrades to fail.
Severity: CRITICAL

Suggested Fix

Update all internal references from altimate-code-ai to @altimateai/altimate-code in the upgrade, installation detection, and version checking functions to match the new scoped package name.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: README.md#L24

Potential issue: The package name has been changed to `@altimateai/altimate-code`, and
the README and publishing workflows reflect this. However, the internal upgrade function
and version checking logic were not updated and still reference the old package name,
`altimate-code-ai`. This will cause the `altimate-code upgrade` command to fail for
users who installed the new package. The version check will also fail as it queries the
wrong npm registry path.

Did we get this right? 👍 / 👎 to inform future reviews.


# Homebrew
brew install altimate/tap/altimate-code
brew install AltimateAI/tap/altimate-code

This comment was marked as outdated.

```

## 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).
16 changes: 8 additions & 8 deletions packages/altimate-code/src/cli/cmd/uninstall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,10 @@ async function showRemovalSummary(targets: RemovalTargets, method: Installation.

if (method !== "curl" && method !== "unknown") {
const cmds: Record<string, string> = {
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",
Expand Down Expand Up @@ -180,10 +180,10 @@ async function executeUninstall(method: Installation.Method, targets: RemovalTar

if (method !== "curl" && method !== "unknown") {
const cmds: Record<string, string[]> = {
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"],
Expand Down
16 changes: 8 additions & 8 deletions packages/altimate-code/src/installation/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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"
Expand All @@ -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,
Expand Down Expand Up @@ -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()
Expand Down