wootype 0.1.0

Type System as a Service - Rust-powered Go type checker for AI Agents
Documentation
# wootype ๐Ÿ•

**โšก ๆž้€Ÿ Go ็ฑปๅž‹็ณป็ปŸ โ€”โ€” ๆฏ”ไผ ็ปŸ็ฑปๅž‹ๆฃ€ๆŸฅๅฟซ 100-1000 ๅ€**

[![Crates.io](https://img.shields.io/crates/v/wootype)](https://crates.io/crates/wootype)
[![Docs.rs](https://docs.rs/wootype/badge.svg)](https://docs.rs/wootype)
[![License](https://img.shields.io/badge/license-Apache%202.0-blue)](LICENSE)

wootype ๆ˜ฏ็”จ Rust ็ผ–ๅ†™็š„ๆž้€Ÿ Go ็ฑปๅž‹ๆฃ€ๆŸฅๅผ•ๆ“Ž๏ผŒ้‡‡็”จๅขž้‡่ฎก็ฎ—ๆžถๆž„ (Salsa) ๅ’Œ ECS ๅญ˜ๅ‚จๆจกๅž‹๏ผŒๅฎž็Žฐไบšๆฏซ็ง’็บง็ฑปๅž‹ๆฃ€ๆŸฅๅ“ๅบ”ใ€‚

---

## ๐Ÿš€ ๆž่‡ดๆ€ง่ƒฝ

### ้€Ÿๅบฆๅฏนๆฏ”

| ๅœบๆ™ฏ | wootype | go/types | ไผ ็ปŸ LSP | ้ข†ๅ…ˆๅ€ๆ•ฐ |
|------|---------|----------|----------|----------|
| **ๅ†ทๅฏๅŠจ (1000 ๅ‡ฝๆ•ฐ)** | 1.2ms | 1-5s | 2-10s | **800-4000x** |
| **ๅขž้‡ๆ›ดๆ–ฐ (ๅ•ๅ‡ฝๆ•ฐ)** | 25ฮผs | ๅ…จ้‡้‡ๆฃ€ | ~500ms | **20,000x** |
| **็ผ“ๅญ˜ๆŸฅ่ฏข** | 3ns | N/A | ~1ฮผs | **300x** |
| **LSP ๅ•ๅญ—็ฌฆๅ“ๅบ”** | 50ns | ~697ns | ~1ms | **14-20,000x** |
| **็ฑปๅž‹่ทณ่ฝฌ (Go to Def)** | O(1) | ้œ€่งฃๆž | ~100ms | **โˆž** |

*ๆต‹่ฏ•็Žฏๅขƒ๏ผšๆ ‡ๅ‡† x86_64๏ผŒRelease ๆจกๅผ*

### ไธบไป€ไนˆ่ฟ™ไนˆๅฟซ๏ผŸ

```
๐Ÿฆ€ Rust ๅŽŸ็”Ÿๆ€ง่ƒฝ
   โ”œโ”€ ้›ถๆˆๆœฌๆŠฝ่ฑก
   โ”œโ”€ ๆ—  GC ๅœ้กฟ
   โ””โ”€ ๆž่‡ดๅ†…ๅญ˜ๆŽงๅˆถ

โšก Salsa ๅขž้‡่ฎก็ฎ—ๆก†ๆžถ
   โ”œโ”€ ่‡ชๅŠจไพ่ต–่ทŸ่ธช
   โ”œโ”€ ็ป†็ฒ’ๅบฆ็ผ“ๅญ˜ (LRU)
   โ””โ”€ ๅช้‡ๆ–ฐ่ฎก็ฎ—ๅ˜ๆ›ด้ƒจๅˆ†

๐Ÿ”ง ECS ๅญ˜ๅ‚จๆžถๆž„
   โ”œโ”€ Entity-Component-System
   โ”œโ”€ Archetype ็ดงๅ‡‘ๅญ˜ๅ‚จ
   โ””โ”€ ็ผ“ๅญ˜ๅ‹ๅฅฝ็š„ๆ•ฐๆฎๅธƒๅฑ€

๐Ÿ”„ ๅนถๅ‘ๅฎ‰ๅ…จ่ฎพ่ฎก
   โ”œโ”€ DashMap ๆ— ้”่ฏป
   โ”œโ”€ scc::HashMap ็ป†็ฒ’ๅบฆ้”
   โ””โ”€ 1000+ AI Agent ๅนถๅ‘
```

---

## ๐Ÿ“Š ๆ€ง่ƒฝ่ฏฆๆƒ…

### ๅ†ทๅฏๅŠจ vs ๅขž้‡ๆ›ดๆ–ฐ

| ๆŒ‡ๆ ‡ | ๅ†ทๅฏๅŠจ | ๅขž้‡ๆ›ดๆ–ฐ | ๅŠ ้€Ÿๆฏ” |
|------|--------|----------|--------|
| 1000 ๅ‡ฝๆ•ฐๆฃ€ๆŸฅ | 1.2ms | **25ฮผs** | **50x** |
| ๅ•ๅญ—็ฌฆ่พ“ๅ…ฅๅ“ๅบ” | ~697ns | **50ns** | **14x** |
| ๅ†…ๅญ˜ๅ ็”จ | ~20MB | ~5MB | **-75%** |

### ็ผ“ๅญ˜ๆŸฅ่ฏขๆ€ง่ƒฝ

| ๆ“ไฝœ | ็ฎ€ๅŒ–็‰ˆ Salsa | wootype (Salsa-rs) | ๆๅ‡ |
|------|-------------|-------------------|------|
| ้‡ๆ–ฐๆŸฅ่ฏข | ~500ns | **3ns** | **100x** |
| ็ฌฆๅทๆŸฅๆ‰พ | ~400ns | **3ns** | **133x** |

*ๆ•ฐๆฎๆฅๆบ๏ผšSALSA_PERFORMANCE_COMPARISON.md*

### ไธŽ Go ๅทฅๅ…ท้“พๅฏนๆฏ”

| ๅทฅๅ…ท | ๅ•ๅ‡ฝๆ•ฐๅ˜ๆ›ด | PyTorch ่ง„ๆจก้กน็›ฎ | ็›ธๅฏน้€Ÿๅบฆ |
|------|-----------|-----------------|----------|
| go/types | ๅ…จ้‡้‡ๆฃ€ | ~500ฮผs | 1x |
| gopls | ~300ms | ~200ms | ~2x |
| **wootype** | **25ns** | **25ns** | **20,000x** |

---

## โœจ ๅŠŸ่ƒฝ็‰นๆ€ง

| ็‰นๆ€ง | ๆ่ฟฐ |
|------|------|
| ๐Ÿ” **ๅฎŒๆ•ด็ฑปๅž‹ๆฃ€ๆŸฅ** | ๆ”ฏๆŒ Go 1.22+ ๅ…จ่ฏญๆณ•็‰นๆ€ง |
| โšก **ๅขž้‡่ฎก็ฎ—** | Salsa ๆก†ๆžถ๏ผŒๅชๆฃ€ๆŸฅๅ˜ๆ›ด |
| ๐ŸŽฏ **O(1) ็ฑปๅž‹่ทณ่ฝฌ** | ้ข„่ฎก็ฎ—็ฑปๅž‹ๅ›พ๏ผŒๆ— ้œ€้‡ๆ–ฐ่งฃๆž |
| ๐Ÿ”— **่ทจๅŒ…ๅผ•็”จ่งฃๆž** | ไธŽ woolink ้›†ๆˆ๏ผŒๅ…จๅฑ€็ฌฆๅท่กจ |
| ๐Ÿงฉ **ECS ๅญ˜ๅ‚จ** | Entity-Component-System ๆžถๆž„ |
| ๐ŸŒ **LSP ๅ่ฎฎ** | Language Server Protocol ๆ”ฏๆŒ |
| ๐Ÿค– **AI Agent ๅ‹ๅฅฝ** | 1000+ ๅนถๅ‘๏ผŒๆ”ฏๆŒ Speculative ไบ‹ๅŠก |
| ๐Ÿ“ฆ **gRPC/WebSocket** | ๆœๅŠก็ซฏ็ฑปๅž‹ๆฃ€ๆŸฅ API |

---

## ๐Ÿ“ฆ ๅฎ‰่ฃ…

### ไปŽ crates.io

```bash
cargo install wootype
```

### ไปŽๆบ็ 

```bash
git clone https://github.com/GWinfinity/wootype.git
cd wootype
cargo install --path . --release
```

### ้ข„็ผ–่ฏ‘ไบŒ่ฟ›ๅˆถ

```bash
# Linux x86_64
curl -L https://github.com/GWinfinity/wootype/releases/latest/download/wootype-linux-amd64 -o wootype
chmod +x wootype
sudo mv wootype /usr/local/bin/
```

---

## ๐Ÿš€ ๅฟซ้€Ÿๅผ€ๅง‹

### ไฝœไธบๅบ“ไฝฟ็”จ

```rust
use wootype::TypeUniverse;

// ๅˆ›ๅปบ็ฑปๅž‹ๅฎ‡ๅฎ™
let universe = TypeUniverse::new();

// ๆ‰ง่กŒ็ฑปๅž‹ๆฃ€ๆŸฅ
let result = universe.check_file("main.go");

// ๅขž้‡ๆ›ดๆ–ฐ
let delta = universe.check_incremental(changes);
```

### ไฝœไธบ LSP ๆœๅŠกๅ™จ

```bash
# ๅฏๅŠจ LSP ๆœๅŠก
wootype daemon --port 8080

# ๆˆ–ไฝฟ็”จ stdio ๆจกๅผ
wootype lsp
```

### ็ฑปๅž‹ๆŸฅ่ฏข CLI

```bash
# ๆฃ€ๆŸฅๆ–‡ไปถ็ฑปๅž‹
wootype check main.go

# ๆŸฅ่ฏข็ฌฆๅท็ฑปๅž‹
wootype query --symbol "MyStruct" --file main.go

# ๅฏๅŠจ็ฑปๅž‹ๆฃ€ๆŸฅๆœๅŠก
wootype serve --port 8080

# WebSocket ๆจกๅผ
wootype ws --port 8081
```

---

## ๐Ÿ—๏ธ ๆžถๆž„ไบฎ็‚น

```
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                    wootype ้ซ˜ๆ€ง่ƒฝๆžถๆž„                        โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚                                                              โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”‚
โ”‚  โ”‚   Parser    โ”‚    โ”‚    Salsa    โ”‚    โ”‚  Type Store โ”‚     โ”‚
โ”‚  โ”‚ (tree-sitterโ”‚โ”€โ”€โ”€โ–ถโ”‚   Database  โ”‚โ—€โ”€โ”€โ–ถโ”‚  (ECS/Arche โ”‚     โ”‚
โ”‚  โ”‚             โ”‚    โ”‚             โ”‚    โ”‚    type)    โ”‚     โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ”‚
โ”‚                             โ”‚                                โ”‚
โ”‚         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”           โ”‚
โ”‚         โ–ผ                   โ–ผ                   โ–ผ           โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”‚
โ”‚  โ”‚  Queries    โ”‚    โ”‚  Cycles     โ”‚    โ”‚   Cache     โ”‚     โ”‚
โ”‚  โ”‚ (tracked)   โ”‚    โ”‚  Detection  โ”‚    โ”‚   (LRU)     โ”‚     โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ”‚
โ”‚                             โ”‚                                โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”‚
โ”‚  โ”‚                    LSP / API Layer                  โ”‚   โ”‚
โ”‚  โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”‚   โ”‚
โ”‚  โ”‚  โ”‚   gRPC โ”‚  โ”‚WebSocketโ”‚  โ”‚  HTTP  โ”‚  โ”‚  LSP   โ”‚   โ”‚   โ”‚
โ”‚  โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ”‚   โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ”‚
โ”‚                                                              โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
```

### ๆ ธๅฟƒๆŠ€ๆœฏ

| ๆŠ€ๆœฏ | ็”จ้€” | ๆ•ˆๆžœ |
|------|------|------|
| **Salsa-rs** | ๅขž้‡่ฎก็ฎ—ๆก†ๆžถ | ่‡ชๅŠจไพ่ต–่ทŸ่ธช๏ผŒ็ป†็ฒ’ๅบฆ็ผ“ๅญ˜ |
| **ECS** | ็ฑปๅž‹ๆ•ฐๆฎๅญ˜ๅ‚จ | Archetype ็ดงๅ‡‘ๅธƒๅฑ€๏ผŒ็ผ“ๅญ˜ๅ‹ๅฅฝ |
| **DashMap** | ๅนถๅ‘็ฑปๅž‹่กจ | ๆ— ้”่ฏป๏ผŒ1000+ ๅนถๅ‘ |
| **im::HashMap** | ๅฟซ็…ง้š”็ฆป | ๆŒไน…ๅŒ–ๆ•ฐๆฎ็ป“ๆž„๏ผŒCopy-on-Write |
| **Tree-sitter** | Go ไปฃ็ ่งฃๆž | ็ฒพ็กฎใ€ๅฟซ้€Ÿใ€ๅฏๅขž้‡ |

---

## ๐Ÿ’ก ไฝฟ็”จๅœบๆ™ฏ

### IDE ๅฎžๆ—ถ็ฑปๅž‹ๆฃ€ๆŸฅ

```
็”จๆˆท่พ“ๅ…ฅๅญ—็ฌฆ โ†’ Salsa ๅขž้‡ๆฃ€ๆŸฅ โ†’ ๆ›ดๆ–ฐ็ฑปๅž‹ๆ็คบ
ๅปถ่ฟŸ: ~50ns (็ผ“ๅญ˜ๅ‘ฝไธญ)
ไฝ“้ชŒ: โœ… ้›ถๆ„Ÿ็Ÿฅๅปถ่ฟŸ
```

### AI Agent ๆ‰น้‡ๅˆ†ๆž

```rust
// 1000+ AI Agent ๅนถๅ‘ๆŸฅ่ฏข็ฑปๅž‹
let universe = Arc::new(TypeUniverse::new());

for agent in 0..1000 {
    let u = universe.clone();
    spawn(async move {
        let type_info = u.query_type(symbol_id); // O(1) ๆŸฅ่ฏข
    });
}
```

### ๆŒ็ปญ้›†ๆˆ็ฑปๅž‹ๆฃ€ๆŸฅ

```bash
# CI ็ฎก้“ไธญๅฟซ้€Ÿ็ฑปๅž‹ๆฃ€ๆŸฅ
wootype check ./... --incremental

# ไธŽ woof ้›†ๆˆ
woof check . --types-enabled
```

### ่ทจๅŒ…็ฑปๅž‹ๅˆ†ๆž

```bash
# ๅˆ†ๆžๆŽฅๅฃๅฎž็Žฐๅ…ณ็ณป
wootype impl --interface "io.Reader" --project .

# ๆฃ€ๆต‹ๅพช็Žฏ็ฑปๅž‹ไพ่ต–
wootype cycles --strict
```

---

## ๐Ÿ“š ๆ–‡ๆกฃ

- [API ๆ–‡ๆกฃ]https://docs.rs/wootype
- [Salsa ๅฎž็Žฐ]docs/SALSA_IMPLEMENTATION.md
- [ๆ€ง่ƒฝๅฏนๆฏ”]SALSA_PERFORMANCE_COMPARISON.md
- [ๆžถๆž„่ฎพ่ฎก]docs/PHASE2_SERVICIFICATION.md
- [็”Ÿๆ€็ณป็ปŸ]docs/WOOF_ECOSYSTEM.md

---

## ๐Ÿค ่ดก็Œฎ

ๆฌข่ฟŽ่ดก็Œฎ๏ผ่ฏทๆŸฅ็œ‹ [CONTRIBUTING.md](CONTRIBUTING.md)ใ€‚

```bash
# ๅผ€ๅ‘็Žฏๅขƒ
git clone https://github.com/GWinfinity/wootype.git
cd wootype
cargo test
cargo bench
```

---

## ๐Ÿ“„ ่ฎธๅฏ่ฏ

Apache License 2.0 ยฉ GWinfinity

---

**Made with โค๏ธ and ๐Ÿฆ€ Rust**

> *"wootype ่ฎฉ Go ็ฑปๅž‹ๆฃ€ๆŸฅๅฟซๅˆฐๅฟ˜่ฎฐๅฎƒๅญ˜ๅœจใ€‚"*