| Crates.io | lumos-cli |
| lib.rs | lumos-cli |
| version | 0.3.0 |
| created_at | 2025-11-18 09:37:09.66378+00 |
| updated_at | 2025-12-08 23:15:00.040882+00 |
| description | Command-line interface for LUMOS |
| homepage | |
| repository | https://github.com/getlumos/lumos |
| max_upload_size | |
| id | 1938125 |
| size | 192,121 |
██╗ ██╗ ██╗███╗ ███╗ ██████╗ ███████╗ ██║ ██║ ██║████╗ ████║██╔═══██╗██╔════╝ ██║ ██║ ██║██╔████╔██║██║ ██║███████╗ ██║ ██║ ██║██║╚██╔╝██║██║ ██║╚════██║ ███████╗╚██████╔╝██║ ╚═╝ ██║╚██████╔╝███████║ ╚══════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝
Write once. Deploy Everywhere.
Illuminate your Solana development with type-safe cross-language code generation
One schema to rule them all • TypeScript ↔ Rust synchronization • Borsh serialization • Anchor integration • Zero type drift • Production-ready code generation
LUMOS is a powerful code generation framework that bridges TypeScript and Rust, eliminating the pain of maintaining duplicate type definitions across your full-stack Solana applications. Write your data structures once in LUMOS syntax, and automatically generate perfectly synchronized code for both languages with guaranteed Borsh serialization compatibility.
Stop writing the same types twice. Start building faster.
#[solana]
#[account]
struct UserAccount {
wallet: PublicKey,
balance: u64,
level: u16,
equipped_items: [PublicKey],
}
|
Rust (Anchor Program)
|
TypeScript (Frontend SDK)
|
Result: Guaranteed type safety, zero manual synchronization, instant Borsh compatibility.
Building full-stack Solana applications requires maintaining identical type definitions in two languages. This manual synchronization is error-prone, time-consuming, and a major source of bugs.
| ❌ Without LUMOS | ✅ With LUMOS |
|---|---|
|
Manual Duplication
Problems:
|
Single Source of Truth
Benefits:
Run |
| Issue | Impact | Frequency |
|---|---|---|
| Type Drift | Frontend expects u64, contract sends u128 → deserialization fails |
Every refactor |
| Field Order Mismatch | Borsh requires exact order → data corruption | Hard to debug |
| Missing Fields | Contract adds field, frontend doesn't know → crashes | Every update |
| Version Skew | Contract v2 deployed, frontend still uses v1 types → incompatible | Every deployment |
LUMOS eliminates all of these issues.
LUMOS provides a custom domain-specific language (DSL) with a powerful code generator that bridges TypeScript and Rust seamlessly.
.lumos Schema File
↓
┌──────────────┐
│ Parser │ ← syn-based Rust parser
│ (AST Gen) │
└──────┬───────┘
↓
┌──────────────┐
│ Transform │ ← AST → IR conversion
└──────┬───────┘
↓
┌──────────────┐
│ IR │ ← Language-agnostic representation
│ (Intermediate)│
└──────┬───────┘
↓
┌──────────────┬──────────────┐
↓ ↓ ↓
┌─────────┐ ┌─────────┐ ┌─────────┐
│ Rust │ │TypeScript│ │ Future │
│Generator│ │Generator │ │ (C++, │
│ │ │ │ │Python) │
└────┬────┘ └────┬────┘ └─────────┘
↓ ↓
.rs files .ts files
Context-Aware Generation
anchor_lang::prelude::*borsh::{BorshSerialize, BorshDeserialize}Intelligent Derive Management
#[account] structs → No manual derives (Anchor provides them)Type Safety Guarantee
Define your data structures once in .lumos syntax. LUMOS generates production-ready code for both Rust and TypeScript with guaranteed synchronization.
Complete type mapping ensures your Rust structs and TypeScript interfaces are always compatible. No more runtime deserialization errors.
First-class support for Anchor programs. LUMOS understands #[account] attributes and generates appropriate code without derive conflicts.
Automatic Borsh schema generation for both languages. Field order, type sizes, and serialization format guaranteed to match.
Intelligent analysis of your schemas determines the optimal imports, derives, and patterns for each target language.
IR-based design makes adding new target languages straightforward. Future support planned for C++, Python, and more.
#[attribute] annotations)# Install the CLI
cargo install lumos-cli
# Verify installation
lumos --version
# lumos-cli 0.1.0
# Or add as library dependency
cargo add lumos-core
Published Packages:
# Clone the repository
git clone https://github.com/getlumos/lumos.git
cd lumos
# Build the CLI
cargo build --release
# The binary will be available at: target/release/lumos
./target/release/lumos --help
cd packages/core
cargo test --all-features --workspace
# All 64 tests should pass ✅
# Create a new LUMOS project
lumos init my-game
# Output:
# Creating project: my-game
# Created my-game/schema.lumos
# Created my-game/lumos.toml
# Created my-game/README.md
# Finished project initialized
This creates:
schema.lumos - Example schema filelumos.toml - Configuration fileREADME.md - Quick start guideOpen schema.lumos and define your data structures:
#[solana]
#[account]
struct PlayerAccount {
wallet: PublicKey,
level: u16,
experience: u64,
equipped_items: [PublicKey],
}
#[solana]
struct MatchResult {
player: PublicKey,
opponent: Option<PublicKey>,
score: u64,
timestamp: i64,
}
# Generate Rust and TypeScript code
lumos generate schema.lumos
# Output:
# Reading schema.lumos
# Parsing schema
# Generating Rust code
# Wrote ./generated.rs
# Generating TypeScript code
# Wrote ./generated.ts
# Finished generated 2 type definitions
In your Rust program:
// Import generated types
use crate::generated::*;
// Use in your Anchor program
#[program]
pub mod my_game {
use super::*;
pub fn create_player(ctx: Context<CreatePlayer>) -> Result<()> {
let player = &mut ctx.accounts.player;
player.level = 1;
player.experience = 0;
Ok(())
}
}
In your TypeScript app:
import { PlayerAccount, PlayerAccountSchema } from './generated';
// Deserialize on-chain data
const player = PlayerAccountSchema.deserialize(buffer);
console.log(`Level: ${player.level}, XP: ${player.experience}`);
# Validate schema syntax
lumos validate schema.lumos
# Check if generated code is up-to-date
lumos check schema.lumos
# Watch for changes and auto-regenerate
lumos generate schema.lumos --watch
Update your .lumos schema, run lumos generate, and both codebases stay in sync automatically. No manual synchronization needed!
Automate schema validation and code generation in your CI/CD pipeline with the official GitHub Action:
- uses: actions/checkout@v4
- uses: getlumos/lumos-action@v1
with:
schema: 'schemas/**/*.lumos'
fail-on-drift: true # Ensure generated code is committed
Features:
Get a powerful development experience with the LUMOS Language Server (LSP):
cargo install lumos-lsp
Features:
Supported Editors:
nvim-lspconfig with lumos-lsp binarylsp-mode with lumos-lsplumos-lspLUMOS uses an Intermediate Representation (IR) architecture to decouple parsing from code generation. This enables:
┌─────────────────────────────────────────────────────────────┐
│ LUMOS Pipeline │
├─────────────────────────────────────────────────────────────┤
│ │
│ 1. PARSER (syn-based) │
│ Input: .lumos file │
│ Output: AST (Abstract Syntax Tree) │
│ ├─ Attribute parsing (#[solana], #[account]) │
│ ├─ Struct definitions │
│ ├─ Field types and annotations │
│ └─ Validation and error reporting │
│ │
│ 2. TRANSFORMER │
│ Input: AST │
│ Output: IR (Intermediate Representation) │
│ ├─ Type normalization │
│ ├─ Semantic analysis │
│ └─ Language-agnostic representation │
│ │
│ 3. CODE GENERATORS │
│ Input: IR │
│ Output: Target language code │
│ │
│ ┌────────────────────┐ ┌────────────────────┐ │
│ │ Rust Generator │ │TypeScript Generator│ │
│ ├────────────────────┤ ├────────────────────┤ │
│ │• Context detection │ │• Interface gen │ │
│ │• Import management │ │• Borsh schema │ │
│ │• Derive selection │ │• Type mapping │ │
│ │• Anchor support │ │• SDK helpers │ │
│ └────────────────────┘ └────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────┘
| Component | Responsibility | Lines of Code |
|---|---|---|
| parser.rs | Parse .lumos syntax → AST |
~200 |
| ast.rs | AST data structures | ~150 |
| transform.rs | AST → IR transformation | ~180 |
| ir.rs | Intermediate representation | ~120 |
| generators/rust.rs | Rust code generation | ~340 |
| generators/typescript.rs | TypeScript code generation | ~387 |
Why? Solana developers primarily use Rust. Familiar #[attribute] syntax reduces learning curve and feels natural.
Why? Mixed modules (some with #[account], some without) require different imports. Smart detection prevents compile errors.
Example:
#[solana]
#[account]
struct Config { ... } // Uses anchor_lang::prelude::*
#[solana]
struct Event { ... } // Uses AnchorSerialize/AnchorDeserialize
Why? Decouples parsing from generation. Adding Python support? Just write a new generator that consumes the IR.
Why? Anchor's #[account] macro already provides derives. Adding manual derives causes conflicts:
#[derive(BorshSerialize)] // ❌ CONFLICT!
#[account] // Already provides BorshSerialize
struct Foo { ... }
LUMOS includes 5 real-world example schemas covering common Solana use cases. All examples have been tested and generate valid, compilable code.
File: examples/gaming/schema.lumos
#[solana]
#[account]
struct PlayerAccount {
wallet: PublicKey,
level: u16,
experience: u64,
equipped_items: [PublicKey],
}
#[solana]
#[account]
struct GameSession {
players: [PublicKey],
start_time: i64,
active: bool,
}
#[solana]
struct MatchResult {
player: PublicKey,
opponent: Option<PublicKey>,
score: u64,
}
Use Case: On-chain game state management with player progression, sessions, and match results.
File: examples/nft-marketplace/schema.lumos
#[solana]
#[account]
struct Listing {
nft_mint: PublicKey,
seller: PublicKey,
price: u64,
active: bool,
}
#[solana]
struct PurchaseReceipt {
buyer: PublicKey,
nft_mint: PublicKey,
price: u64,
transaction_signature: Signature,
}
Use Case: NFT marketplace with listings and purchase tracking. Demonstrates Signature type mapping to String (base58).
File: examples/defi-staking/schema.lumos
#[solana]
#[account]
struct StakeAccount {
owner: PublicKey,
amount: u64,
staked_at: i64,
reward_rate: u16,
}
#[solana]
struct RewardClaim {
staker: PublicKey,
amount: u64,
claimed_at: i64,
}
Use Case: Staking protocol with reward calculations and claim tracking.
File: examples/dao-governance/schema.lumos
#[solana]
#[account]
struct Proposal {
id: u64,
proposer: PublicKey,
description: String,
votes_for: u64,
votes_against: u64,
deadline: i64,
executed: bool,
}
#[solana]
struct Vote {
voter: PublicKey,
proposal_id: u64,
vote_weight: u64,
in_favor: bool,
}
Use Case: DAO governance system with proposals and voting. Shows String type support.
File: examples/token-vesting/schema.lumos
#[solana]
#[account]
struct VestingSchedule {
beneficiary: PublicKey,
total_amount: u64,
released_amount: u64,
start_time: i64,
cliff_duration: i64,
vesting_duration: i64,
}
#[solana]
struct Release {
beneficiary: PublicKey,
amount: u64,
released_at: i64,
}
Use Case: Token vesting with time-locked releases. Demonstrates complex time-based logic.
LUMOS provides complete bidirectional type mapping between .lumos syntax, Rust, and TypeScript.
| LUMOS | Rust | TypeScript | Borsh (Rust) | Borsh (TS) |
|---|---|---|---|---|
u8 |
u8 |
number |
- | borsh.u8 |
u16 |
u16 |
number |
- | borsh.u16 |
u32 |
u32 |
number |
- | borsh.u32 |
u64 |
u64 |
number |
- | borsh.u64 |
u128 |
u128 |
bigint |
- | borsh.u128 |
i8 |
i8 |
number |
- | borsh.i8 |
i16 |
i16 |
number |
- | borsh.i16 |
i32 |
i32 |
number |
- | borsh.i32 |
i64 |
i64 |
number |
- | borsh.i64 |
i128 |
i128 |
bigint |
- | borsh.i128 |
bool |
bool |
boolean |
- | borsh.bool |
| LUMOS | Rust | TypeScript | Borsh (TS) |
|---|---|---|---|
PublicKey |
Pubkey |
PublicKey |
borsh.publicKey |
Signature |
String |
string |
borsh.string |
| LUMOS | Rust | TypeScript | Borsh (TS) |
|---|---|---|---|
String |
String |
string |
borsh.string |
[T] |
Vec<T> |
T[] |
borsh.vec(...) |
Option<T> |
Option<T> |
T | undefined |
borsh.option(...) |
#[solana]
struct Example {
id: u64, // → Rust: u64, TS: number
wallet: PublicKey, // → Rust: Pubkey, TS: PublicKey
name: String, // → Rust: String, TS: string
tags: [String], // → Rust: Vec<String>, TS: string[]
metadata: Option<String>, // → Rust: Option<String>, TS: string | undefined
large_number: u128, // → Rust: u128, TS: bigint
}
Generated TypeScript Borsh Schema:
export const ExampleBorshSchema = borsh.struct([
borsh.u64('id'),
borsh.publicKey('wallet'),
borsh.string('name'),
borsh.vec(borsh.string(), 'tags'),
borsh.option(borsh.string(), 'metadata'),
borsh.u128('large_number'),
]);
📍 Looking for our future plans? See the detailed ROADMAP.md for Phase 4+, including VSCode extension polish, community examples, and ecosystem expansion.
🔮 Curious about our long-term vision? Check out docs/VISION.md - LUMOS is evolving from a schema DSL into a full typed workflow programming language for developer automation.
Status: 🎉 100% Complete (2025-01-17)
.lumos parser using synMetrics:
Status: 🎉 100% Complete (2025-01-17)
Core CLI functionality to make LUMOS usable in real projects:
✅ File I/O System
.lumos files from disk✅ CLI Tool (lumos command)
lumos init [project] - Initialize new project with templateslumos generate <schema> - Generate Rust + TypeScript codelumos validate <schema> - Validate schema syntaxlumos check <schema> - Verify generated code is up-to-datelumos diff <schema1> <schema2> - Compare schemas and show differenceslumos generate --watch - Watch mode for auto-regenerationlumos --version - Version informationlumos --help - Comprehensive help✅ Configuration System
lumos.toml configuration file✅ Developer Experience
Metrics:
lumos CLI executableSuccess Criteria:
lumos CLI executableStatus: 🎉 100% Complete (2025-11-17)
Full support for Rust-style enums with three variant types:
Active, Paused, Finished)PlayerJoined(PublicKey, u64))Initialize { authority: PublicKey })Implementation:
✅ AST & Parser (Week 1)
✅ IR & Transform (Week 2)
✅ Code Generation (Week 3)
kind field✅ Documentation & Polish (Week 4)
Metrics:
Example:
#[solana]
enum GameInstruction {
Initialize {
authority: PublicKey,
max_players: u32,
},
UpdateScore {
player: PublicKey,
new_score: u64,
},
}
Status: 🎉 100% Complete (2025-11-18)
Professional VSCode extension for enhanced .lumos development experience:
✅ Syntax Highlighting
PublicKey, Signature)#[solana], #[account], enums✅ Code Snippets (13 snippets)
struct - Basic struct templateaccount - Solana account structenum-unit - Unit variant enumenum-tuple - Tuple variant enumenum-struct - Struct variant enumenum-mixed - Mixed variant enumpubkey, u64, string, vec, option)✅ Commands
LUMOS: Generate Code - Generate Rust + TypeScript from current fileLUMOS: Validate Schema - Validate current schema syntax✅ Auto-Generation
lumos.autoGenerateOnSave✅ Professional Branding
Metrics:
Repository: getlumos/vscode-lumos
Powerful features for complex use cases:
PDA (Program Derived Address) Helpers
#[pda] attribute supportAnchor Instruction Generation
Validation & Constraints
#[validate] attributesmin, max)Migration Tools
Success Criteria:
Multi-Language Support:
Plugin Architecture:
Advanced Solana Features:
Tooling:
| Technology | Purpose | Version |
|---|---|---|
| Rust | Core language | 1.70+ |
| syn | Rust parser | 2.0 |
| quote | Code generation | 1.0 |
| proc-macro2 | Token manipulation | 1.0 |
| serde | Serialization | 1.0 |
| serde_json | JSON support | 1.0 |
| toml | Config files | 0.8 |
| anyhow | Error handling | 1.0 |
| thiserror | Error macros | 1.0 |
| Tool | Purpose |
|---|---|
| cargo | Build system & package manager |
| cargo test | Test runner |
| rustfmt | Code formatting |
| clippy | Linting |
| tempfile | E2E test infrastructure |
[dependencies]
syn = "2.0" # Rust parser for .lumos syntax
quote = "1.0" # Quasi-quoting for code generation
proc-macro2 = "1.0" # Token stream manipulation
serde = "1.0" # Serialization framework
serde_json = "1.0" # JSON support
toml = "0.8" # TOML config parsing
anyhow = "1.0" # Flexible error handling
thiserror = "1.0" # Derive macro for error types
[dev-dependencies]
tempfile = "3.8" # Temporary file creation for E2E tests
LUMOS has comprehensive test coverage ensuring code quality and reliability.
Total Tests: 50/50 passing (100% success rate)
| Test Category | Count | Purpose |
|---|---|---|
| Unit Tests | 26 | Core functionality (parser, generators, transform) |
| Parser Integration | 5 | Real-world schema parsing |
| Rust Generator Integration | 5 | Rust code generation validation |
| TypeScript Generator Integration | 6 | TypeScript code generation validation |
| E2E Compilation | 8 | Actual Rust compilation with cargo check |
cd packages/core
# Run all tests
cargo test
# Run specific test suites
cargo test --lib # Unit tests only
cargo test --test integration_test # Parser integration
cargo test --test test_e2e # E2E compilation tests
# Run with output
cargo test -- --nocapture
# Run specific test
cargo test test_parse_gaming_example
Parser Tests:
#[solana] and #[account] attributesGenerator Tests:
#[account] handlingE2E Tests:
cargo checkrunning 50 tests
test ast::tests::test_struct_creation ... ok
test parser::tests::test_parse_basic_struct ... ok
test parser::tests::test_parse_with_attributes ... ok
test generators::rust::tests::test_context_detection ... ok
test generators::rust::tests::test_derive_selection ... ok
test generators::typescript::tests::test_interface_gen ... ok
test generators::typescript::tests::test_borsh_schema ... ok
test integration_test::test_parse_gaming_example ... ok
test integration_test::test_parse_nft_marketplace ... ok
test test_e2e::test_gaming_example_compiles ... ok
test test_e2e::test_dao_governance_compiles ... ok
test result: ok. 50 passed; 0 failed; 0 ignored; 0 measured
LUMOS is in active early development and we welcome contributions from the community!
Fork the Repository
git fork https://github.com/getlumos/lumos.git
Create a Feature Branch
git checkout -b feature/your-feature-name
Make Your Changes
rustfmt)Run Tests
cd packages/core
cargo test
cargo fmt --check
cargo clippy
Submit a Pull Request
# Clone the repository
git clone https://github.com/getlumos/lumos.git
cd lumos
# Build the project
cd packages/core
cargo build
# Run tests
cargo test
# Format code
cargo fmt
# Run linter
cargo clippy
See CONTRIBUTING.md for detailed guidelines on:
LUMOS is dual-licensed under your choice of:
This follows the same licensing model as the Rust programming language.
You may choose either license when using LUMOS in your projects.
RECTOR (@rz1989s) Senior Developer & Founder of getlumos
Built with dedication at getlumos - Empowering developers with innovative tools.
syn, quote, and amazing toolingThe Solana developer community - developers building the future of decentralized applications.
Status: ✅ Published on crates.io - Production Ready Version: 0.1.0 Released: November 18, 2025
Built with ❤️ for the Solana community
⭐ Star this repo if you find LUMOS useful!