Version: 6.2.0
Purpose: Shared library for General Bots workspace
BotLib is the foundational shared library for the General Bots workspace, providing common types, error handling, HTTP client functionality, and utilities used across all projects. It serves as the core dependency for botserver, botui, botapp, and other workspace members, ensuring consistency and reducing code duplication.
For comprehensive documentation, see docs.pragmatismo.com.br or the BotBook for detailed guides and API references.
src/
├── lib.rs # Public exports, feature gates
├── error.rs # Error types (thiserror)
├── models.rs # Shared data models
├── message_types.rs # Message type definitions
├── http_client.rs # HTTP client wrapper (feature-gated)
├── branding.rs # Version, branding constants
└── version.rs # Version information
EVERY SINGLE WARNING MUST BE FIXED. NO EXCEPTIONS.
❌ NEVER use #![allow()] or #[allow()] in source code
❌ NEVER use _ prefix for unused variables - DELETE or USE them
❌ NEVER use .unwrap() - use ? or proper error handling
❌ NEVER use .expect() - use ? or proper error handling
❌ NEVER use panic!() or unreachable!()
❌ NEVER use todo!() or unimplemented!()
❌ NEVER leave unused imports or dead code
❌ NEVER add comments - code must be self-documenting
| Library | Version | Purpose |
|---|---|---|
| anyhow | 1.0 | Error handling |
| thiserror | 2.0 | Error derive |
| chrono | 0.4 | Date/time |
| serde | 1.0 | Serialization |
| uuid | 1.11 | UUIDs |
| diesel | 2.1 | Database ORM |
| reqwest | 0.12 | HTTP client |
BotLib uses Cargo features to enable optional functionality:
[features]
default = []
http-client = ["reqwest"] # Enable HTTP client
# Add more features as needed# In dependent crate's Cargo.toml
[dependencies.botlib]
workspace = true
features = ["http-client"] # Enable HTTP client// ❌ WRONG
let value = something.unwrap();
// ✅ CORRECT
let value = something?;
let value = something.ok_or_else(|| Error::NotFound)?;impl MyStruct {
fn new() -> Self { Self { } } // ✅ Not MyStruct
}format!("Hello {name}") // ✅ Not format!("{}", name)// ❌ WRONG
impl ToString for MyType { }
// ✅ CORRECT
impl std::fmt::Display for MyType { }#[derive(PartialEq, Eq)] // ✅ Always both
struct MyStruct { }For complete documentation, guides, and API references:
- docs.pragmatismo.com.br - Full online documentation
- BotBook - Local comprehensive guide with tutorials and examples
- General Bots Repository - Main project repository
- botserver - Main API server
- botui - Web UI interface
- botapp - Desktop application
- botbook - Documentation
- ZERO WARNINGS - Every clippy warning must be fixed
- NO ALLOW IN CODE - Never use #[allow()] in source files
- NO DEAD CODE - Delete unused code
- NO UNWRAP/EXPECT - Use ? operator
- INLINE FORMAT ARGS -
format!("{name}")notformat!("{}", name) - USE SELF - In impl blocks, use Self not the type name
- DERIVE EQ - Always derive Eq with PartialEq
- DISPLAY NOT TOSTRING - Implement Display, not ToString
- Version 6.2.0 - Do not change without approval
- GIT WORKFLOW - ALWAYS push to ALL repositories (github, pragmatismo)
AGPL-3.0 - See LICENSE for details.