Skip to content

Commit f0dcf82

Browse files
committed
Update SKILL and docs
1 parent 939a801 commit f0dcf82

6 files changed

Lines changed: 727 additions & 499 deletions

File tree

AGENTS.md

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# VESPERA PROJECT KNOWLEDGE BASE
2+
3+
**Generated:** 2026-01-07
4+
**Commit:** 939a801
5+
**Branch:** main
6+
7+
## OVERVIEW
8+
9+
Vespera is a fully automated OpenAPI 3.1 engine for Axum - delivers FastAPI-like DX to Rust. Zero-config route discovery via compile-time macro scanning.
10+
11+
## STRUCTURE
12+
13+
```
14+
vespera/
15+
├── crates/
16+
│ ├── vespera/ # Public API - re-exports everything
17+
│ ├── vespera_core/ # OpenAPI types, route/schema abstractions
18+
│ └── vespera_macro/ # Proc-macros (main logic lives here)
19+
└── examples/axum-example/ # Demo app with route patterns
20+
```
21+
22+
## WHERE TO LOOK
23+
24+
| Task | Location | Notes |
25+
|------|----------|-------|
26+
| Add new macro feature | `crates/vespera_macro/src/` | Main macro in `lib.rs` |
27+
| Modify OpenAPI output | `crates/vespera_macro/src/openapi_generator.rs` | JSON generation |
28+
| Add route parser feature | `crates/vespera_macro/src/parser/` | Type extraction logic |
29+
| Change schema generation | `crates/vespera_macro/src/parser/schema.rs` | Rust→JSON Schema |
30+
| Modify route attribute | `crates/vespera_macro/src/args.rs` | `#[route]` parsing |
31+
| Add core types | `crates/vespera_core/src/` | OpenAPI spec types |
32+
| Test new features | `examples/axum-example/` | Add route, run example |
33+
34+
## KEY COMPONENTS
35+
36+
| File | Lines | Role |
37+
|------|-------|------|
38+
| `vespera_macro/src/lib.rs` | 1044 | `vespera!`, `#[route]`, `#[derive(Schema)]` |
39+
| `vespera_macro/src/parser/schema.rs` | 1527 | Rust struct → JSON Schema conversion |
40+
| `vespera_macro/src/parser/parameters.rs` | 845 | Extract path/query params from handlers |
41+
| `vespera_macro/src/openapi_generator.rs` | 808 | OpenAPI doc assembly |
42+
| `vespera_macro/src/collector.rs` | 707 | Filesystem route scanning |
43+
44+
## CONVENTIONS
45+
46+
- **Rust 2024 edition** across all crates
47+
- **Workspace dependencies**: Internal crates use `{ workspace = true }`
48+
- **Version sync**: All crates at 0.1.19
49+
- **Test frameworks**: `rstest` for unit tests, `insta` for snapshots
50+
- **No `build.rs`**: All code gen via proc-macros at compile time
51+
52+
## ANTI-PATTERNS (THIS PROJECT)
53+
54+
- **NEVER** add `build.rs` - macro handles compile-time generation
55+
- **NEVER** manually register routes - `vespera!` macro discovers them
56+
- **NEVER** write OpenAPI JSON by hand - generated from code
57+
- Route functions **MUST** be `pub async fn`
58+
59+
## ARCHITECTURE FLOW
60+
61+
```
62+
User writes: vespera!() macro at compile-time:
63+
┌──────────────┐ ┌────────────────────────────────────────┐
64+
│ src/routes/ │ ──── │ 1. Scan filesystem for .rs files │
65+
│ users.rs │ │ 2. Parse #[route] attributes │
66+
│ posts.rs │ │ 3. Extract handler signatures │
67+
└──────────────┘ │ 4. Generate Axum Router code │
68+
│ 5. Build OpenAPI spec │
69+
│ 6. Write openapi.json (optional) │
70+
│ 7. Inject Swagger/ReDoc routes │
71+
└────────────────────────────────────────┘
72+
```
73+
74+
## COMMANDS
75+
76+
```bash
77+
# Development
78+
cargo build # Build all crates
79+
cargo test --workspace # Run all tests
80+
cargo test -p vespera_macro # Test macros only
81+
82+
# Run example
83+
cd examples/axum-example
84+
cargo run # Starts server on :3000
85+
# Visit http://localhost:3000/docs for Swagger UI
86+
87+
# Check generated OpenAPI
88+
cat examples/axum-example/openapi.json
89+
```
90+
91+
## NOTES
92+
93+
- Macro performs **filesystem I/O at compile time** - may affect IDE performance
94+
- OpenAPI files are **regenerated on every build** when `openapi = "..."` specified
95+
- `CARGO_MANIFEST_DIR` env var used to locate `src/routes/` folder
96+
- Generic types in schemas require `#[derive(Schema)]` on all type params

Cargo.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)