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
50 changes: 50 additions & 0 deletions .claude/CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# CLAUDE.md

Wren Engine (OSS) — open-source semantic SQL engine for MCP clients and AI agents. Translates queries through MDL (Modeling Definition Language) against 22+ data sources, powered by Apache DataFusion (Canner fork).

## Repository Structure

- **wren-core/** — Rust semantic engine: MDL analysis, query planning, DataFusion integration
- **wren-core-base/** — Shared Rust crate: manifest types (`Model`, `Column`, `Metric`, `Relationship`, `View`)
- **wren-core-py/** — PyO3 Python bindings for wren-core, built with Maturin
- **ibis-server/** — FastAPI REST server: query execution, validation, 22 connector backends
- **mcp-server/** — MCP server exposing Wren Engine to AI agents
- **skills/** — User-facing MCP skills (wren-sql, wren-quickstart, etc.)

Supporting: `wren-core-legacy/` (Java fallback for v2), `mock-web-server/`, `benchmark/`, `example/`

## Build Quick Reference

| Module | Install | Test | Format / Lint |
|--------|---------|------|---------------|
| wren-core | — | `cargo test --lib --tests --bins` | `cargo fmt --all` / `cargo clippy` |
| wren-core-py | `just install` | `just test` | `just format` |
| ibis-server | `just install` | `just test <MARKER>` | `just format` / `just lint` |
| mcp-server | `uv sync` | — | — |

> Detailed commands, env vars, and test markers → see each module's README

## Architecture: Query Flow

```
SQL Query → ibis-server (FastAPI v3 router)
→ MDL Processing (manifest cache, validation)
→ wren-core-py (PyO3 FFI)
→ wren-core (Rust: MDL analysis → logical plan → optimization)
→ DataFusion (query planning)
→ Connector (Ibis/sqlglot → dialect SQL)
→ Native execution (Postgres, BigQuery, etc.)
```
Comment on lines +29 to +37
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Specify language for the fenced code block.

The architecture diagram code block should specify a language identifier for proper rendering and syntax highlighting. Consider using text or mermaid depending on the intended format.

📝 Proposed fix to add language specification
-```
+```text
 SQL Query → ibis-server (FastAPI v3 router)
   → MDL Processing (manifest cache, validation)
   → wren-core-py (PyO3 FFI)

Based on learnings: As per coding guidelines, markdownlint requires fenced code blocks to have a language specified.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
```
SQL Query → ibis-server (FastAPI v3 router)
→ MDL Processing (manifest cache, validation)
→ wren-core-py (PyO3 FFI)
→ wren-core (Rust: MDL analysis → logical plan → optimization)
→ DataFusion (query planning)
→ Connector (Ibis/sqlglot → dialect SQL)
→ Native execution (Postgres, BigQuery, etc.)
```
🧰 Tools
🪛 markdownlint-cli2 (0.21.0)

[warning] 29-29: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.claude/CLAUDE.md around lines 29 - 37, The fenced code block containing the
architecture diagram in the .claude/CLAUDE.md file lacks a language identifier;
update the opening fence from ``` to include a language (for example ```text or
```mermaid) so markdownlint and renderers apply proper syntax highlighting —
locate the architecture diagram block (the lines starting with "SQL Query →
ibis-server...") and change the fence accordingly.


Fallback: if wren-core (v3) fails, ibis-server retries via wren-core-legacy (Java, v2).

Key files: `ibis-server/app/routers/v3/connector.py`, `wren-core/core/src/logical_plan/analyze/`

## Conventions

- **Commits**: Conventional commits — `feat:`, `fix:`, `chore:`, `refactor:`, `test:`, `docs:`, `perf:`, `deps:`
- **Releases**: Automated via release-please
- **Rust**: `cargo fmt`, `clippy -D warnings`, `taplo fmt` for TOML
- **Python**: `ruff` (line-length 88, Python 3.11 target), Poetry for deps
- **Snapshot tests**: wren-core uses `insta`
- **CI**: Rust CI on `wren-core/**`; ibis CI on all PRs; core-py CI on `wren-core-py/**` or `wren-core/**`
24 changes: 24 additions & 0 deletions .claude/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"permissions": {
"allow": [
"Bash(cd wren-core && cargo fmt:*)",
"Bash(cd wren-core && cargo check:*)",
"Bash(cd wren-core && cargo clippy:*)",
"Bash(cd wren-core && RUST_MIN_STACK=8388608 cargo test:*)",
"Bash(cd wren-core-py && just:*)",
"Bash(cd ibis-server && just:*)",
"Bash(cd ibis-server && poetry run ruff:*)",
"Bash(taplo fmt:*)",
"Bash(taplo format:*)",
"Bash(git status:*)",
"Bash(git diff:*)",
"Bash(git log:*)",
"Bash(git branch:*)",
"Bash(gh pr:*)",
"Bash(gh run:*)",
"Bash(gh api:*)",
"Bash(ls:*)",
"Bash(wc:*)"
]
}
}