Skip to main content

logicaffeine_cli/
lib.rs

1//! LOGOS CLI (`largo`)
2//!
3//! Command-line interface for the LOGOS build system and package registry.
4//!
5//! This crate provides the `largo` CLI tool for creating, building, and
6//! publishing LOGOS projects. It can be used as a library for programmatic
7//! access to the build system.
8//!
9//! # Commands
10//!
11//! | Command | Description |
12//! |---------|-------------|
13//! | `largo new` | Create a new project |
14//! | `largo init` | Initialize project in current directory |
15//! | `largo build` | Compile a LOGOS module to Rust |
16//! | `largo run` | Build and execute a module |
17//! | `largo check` | Type-check without building |
18//! | `largo verify` | Run Z3 static verification |
19//! | `largo publish` | Publish package to registry |
20//! | `largo login` | Authenticate with registry |
21//! | `largo logout` | Remove stored credentials |
22//!
23//! # Module Structure
24//!
25//! - [`cli`] - Command-line argument parsing and dispatch
26//! - [`compile`] - Re-exports from the compilation pipeline
27//! - [`project`] - Project management (manifest, build, registry)
28//!   - [`project::manifest`] - `Largo.toml` parsing
29//!   - [`project::build`][mod@project::build] - Build orchestration
30//!   - [`project::credentials`] - API token storage
31//!   - [`project::registry`] - Package registry client
32//!
33//! # Feature Flags
34//!
35//! | Feature | Description |
36//! |---------|-------------|
37//! | `verification` | Enable Z3 static verification (requires Z3 installed) |
38//!
39//! # Library Usage
40//!
41//! While `largo` is primarily a CLI tool, the library API can be used
42//! for build system integration:
43//!
44//! ```no_run
45//! use logicaffeine_cli::project::{BuildConfig, build, find_project_root};
46//! use std::env;
47//!
48//! let cwd = env::current_dir().unwrap();
49//! let root = find_project_root(&cwd).expect("Not in a LOGOS project");
50//!
51//! let result = build(BuildConfig {
52//!     project_dir: root,
53//!     release: false,
54//!     lib_mode: false,
55//!     target: None,
56//! })?;
57//!
58//! println!("Built: {}", result.binary_path.display());
59//! # Ok::<(), Box<dyn std::error::Error>>(())
60//! ```
61
62pub mod cli;
63pub mod compile;
64pub mod project;
65
66/// Re-export of the LOGOS interface types from the kernel crate.
67///
68/// Provides access to core types like `World` and `Entity` for
69/// integration with the LOGOS runtime.
70pub use logicaffeine_kernel::interface;
71
72/// Re-export of analysis utilities from the compile crate.
73///
74/// Useful for tooling that needs to analyze LOGOS source without
75/// performing a full build.
76pub use logicaffeine_compile::analysis;
77
78/// Entry point for the CLI.
79///
80/// Parses command-line arguments and executes the appropriate command.
81/// See [`cli::run_cli`] for details.
82pub use cli::run_cli;