|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Build Commands |
| 6 | + |
| 7 | +### Backend (Java/Maven) |
| 8 | + |
| 9 | +```bash |
| 10 | +# Clean build (skip tests) |
| 11 | +mvn clean package -DskipTests -Dspotless.skip=true |
| 12 | + |
| 13 | +# Run all tests |
| 14 | +mvn test |
| 15 | + |
| 16 | +# Run single test class |
| 17 | +mvn test -Dtest=ClassName |
| 18 | + |
| 19 | +# Full CI build |
| 20 | +mvn -B package --file pom.xml |
| 21 | +``` |
| 22 | + |
| 23 | +**Requirements:** Java 21, Maven |
| 24 | + |
| 25 | +### Frontend (pnpm/React) |
| 26 | + |
| 27 | +```bash |
| 28 | +cd webapp |
| 29 | + |
| 30 | +# Install dependencies |
| 31 | +pnpm install |
| 32 | + |
| 33 | +# Start dev server (port 9000) |
| 34 | +pnpm dev |
| 35 | + |
| 36 | +# Production build |
| 37 | +pnpm build |
| 38 | + |
| 39 | +# Run tests |
| 40 | +pnpm test |
| 41 | +``` |
| 42 | + |
| 43 | +**Requirements:** Node.js >=16, pnpm 9.12.3+ |
| 44 | + |
| 45 | +### Quick Start |
| 46 | + |
| 47 | +```bash |
| 48 | +# Build full release |
| 49 | +./assembly/bin/supersonic-build.sh standalone |
| 50 | + |
| 51 | +# Start service |
| 52 | +./assembly/bin/supersonic-daemon.sh start |
| 53 | + |
| 54 | +# Stop service |
| 55 | +./assembly/bin/supersonic-daemon.sh stop |
| 56 | +``` |
| 57 | + |
| 58 | +Visit http://localhost:9080 after startup. |
| 59 | + |
| 60 | +## Architecture Overview |
| 61 | + |
| 62 | +SuperSonic unifies **Chat BI** (LLM-powered) and **Headless BI** (semantic layer) paradigms. |
| 63 | + |
| 64 | +### Core Modules |
| 65 | + |
| 66 | +``` |
| 67 | +supersonic/ |
| 68 | +├── auth/ # Authentication & authorization (SPI-based) |
| 69 | +├── chat/ # Chat BI module - LLM-powered Q&A interface |
| 70 | +├── common/ # Shared utilities |
| 71 | +├── headless/ # Headless BI - semantic layer with open API |
| 72 | +├── launchers/ # Application entry points |
| 73 | +│ ├── standalone/ # Combined Chat + Headless (default) |
| 74 | +│ ├── chat/ # Chat-only service |
| 75 | +│ └── headless/ # Headless-only service |
| 76 | +└── webapp/ # Frontend React app (UmiJS 4 + Ant Design) |
| 77 | +``` |
| 78 | + |
| 79 | +### Data Flow |
| 80 | + |
| 81 | +1. **Knowledge Base**: Extracts schema from semantic models, builds dictionary/index for schema mapping |
| 82 | +2. **Schema Mapper**: Identifies metrics/dimensions/entities/values in user queries |
| 83 | +3. **Semantic Parser**: Generates S2SQL (semantic SQL) using rule-based and LLM-based parsers |
| 84 | +4. **Semantic Corrector**: Validates and corrects semantic queries |
| 85 | +5. **Semantic Translator**: Converts S2SQL to executable SQL |
| 86 | + |
| 87 | +### Key Entry Points |
| 88 | + |
| 89 | +- `StandaloneLauncher.java` - Combined service with `scanBasePackages: ["com.tencent.supersonic", "dev.langchain4j"]` |
| 90 | +- `ChatLauncher.java` - Chat BI only |
| 91 | +- `HeadlessLauncher.java` - Headless BI only |
| 92 | + |
| 93 | +## Key Technologies |
| 94 | + |
| 95 | +**Backend:** Spring Boot 3.3.9, MyBatis-Plus 3.5.10.1, LangChain4j 0.36.2, JSqlParser 4.9, Calcite 1.38.0 |
| 96 | + |
| 97 | +**Frontend:** React 18, UmiJS 4, Ant Design 5.17.4, ECharts 5.0.2, AntV G6/X6 |
| 98 | + |
| 99 | +**Databases:** MySQL, PostgreSQL (with pgvector), H2, ClickHouse, StarRocks, Presto, Trino, DuckDB |
| 100 | + |
| 101 | +## Testing |
| 102 | + |
| 103 | +**Java tests:** JUnit 5, Mockito. Located in `src/test/java/` of each module. |
| 104 | + |
| 105 | +**Frontend tests:** Jest with Puppeteer environment in `webapp/packages/supersonic-fe/` |
| 106 | + |
| 107 | +**Evaluation scripts:** Python scripts in `evaluation/` directory for Text2SQL accuracy testing. |
| 108 | + |
| 109 | +## Related Documentation |
| 110 | + |
| 111 | +- [README.md](README.md) - English documentation |
| 112 | +- [README_CN.md](README_CN.md) - Chinese documentation |
| 113 | +- [Evaluation Guide](evaluation/README.md) - Text2SQL evaluation process |
0 commit comments