diff --git a/Cargo.lock b/Cargo.lock index d9e2d9c..bcb72b2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -789,9 +789,9 @@ checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" [[package]] name = "mio" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69d83b0086dc8ecf3ce9ae2874b2d1290252e2a30720bea58a5c6639b0092873" +checksum = "a69bcab0ad47271a0234d9422b131806bf3968021e5dc9328caf2d4cd58557fc" dependencies = [ "libc", "wasi", diff --git a/PROMPT.md b/PROMPT.md new file mode 100644 index 0000000..866cf53 --- /dev/null +++ b/PROMPT.md @@ -0,0 +1,217 @@ +# BotLib Development Prompt Guide + +**Version:** 6.1.0 +**Purpose:** LLM context for BotLib shared library development + +--- + +## Project Overview + +BotLib is the shared foundation library for the General Bots workspace. It provides common types, utilities, error handling, and optional integrations that are consumed by botserver, botui, and botapp. + +### Workspace Position + +``` +botlib/ # THIS PROJECT - Shared library +botserver/ # Main server (depends on botlib) +botui/ # Web/Desktop UI (depends on botlib) +botapp/ # Desktop app (depends on botlib) +botbook/ # Documentation +``` + +### What BotLib Provides + +- **Error Types**: Common error handling with anyhow/thiserror +- **Models**: Shared data structures and types +- **HTTP Client**: Optional reqwest wrapper +- **Database**: Optional diesel integration +- **Validation**: Optional input validation +- **Branding**: Version and branding constants + +--- + +## Feature Flags + +```toml +[features] +default = [] +full = ["database", "http-client", "validation"] +database = ["dep:diesel"] +http-client = ["dep:reqwest"] +validation = ["dep:validator"] +``` + +### Usage in Dependent Crates + +```toml +# botserver/Cargo.toml +[dependencies.botlib] +path = "../botlib" +features = ["database"] + +# botui/Cargo.toml +[dependencies.botlib] +path = "../botlib" +features = ["http-client"] +``` + +--- + +## Code Generation Rules + +### CRITICAL REQUIREMENTS + +``` +- Library code must be generic and reusable +- No hardcoded values or project-specific logic +- All public APIs must be well-documented +- Feature gates for optional dependencies +- Zero warnings - clean compilation required +``` + +### Module Structure + +``` +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 +``` + +--- + +## Adding New Features + +### Adding a Shared Type + +```rust +// src/models.rs +use chrono::{DateTime, Utc}; +use serde::{Deserialize, Serialize}; +use uuid::Uuid; + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct SharedEntity { + pub id: Uuid, + pub name: String, + pub created_at: DateTime, +} +``` + +### Adding a Feature-Gated Module + +```rust +// src/lib.rs +#[cfg(feature = "my-feature")] +pub mod my_module; + +#[cfg(feature = "my-feature")] +pub use my_module::MyType; +``` + +```toml +# Cargo.toml +[features] +my-feature = ["dep:some-crate"] + +[dependencies] +some-crate = { version = "1.0", optional = true } +``` + +### Adding Error Types + +```rust +// src/error.rs +use thiserror::Error; + +#[derive(Error, Debug)] +pub enum BotLibError { + #[error("Configuration error: {0}")] + Config(String), + + #[error("HTTP error: {0}")] + Http(#[from] reqwest::Error), + + #[error("Database error: {0}")] + Database(String), +} + +pub type Result = std::result::Result; +``` + +--- + +## Re-exports Strategy + +BotLib should re-export common dependencies to ensure version consistency: + +```rust +// src/lib.rs +pub use anyhow; +pub use chrono; +pub use serde; +pub use serde_json; +pub use thiserror; +pub use uuid; + +#[cfg(feature = "database")] +pub use diesel; + +#[cfg(feature = "http-client")] +pub use reqwest; +``` + +Consumers then use: + +```rust +use botlib::uuid::Uuid; +use botlib::chrono::Utc; +``` + +--- + +## Dependencies + +| Library | Version | Purpose | Optional | +|---------|---------|---------|----------| +| anyhow | 1.0 | Error handling | No | +| thiserror | 2.0 | Error derive | No | +| log | 0.4 | Logging facade | No | +| chrono | 0.4 | Date/time | No | +| serde | 1.0 | Serialization | No | +| serde_json | 1.0 | JSON | No | +| uuid | 1.11 | UUIDs | No | +| toml | 0.8 | Config parsing | No | +| diesel | 2.1 | Database ORM | Yes | +| reqwest | 0.12 | HTTP client | Yes | +| validator | 0.18 | Validation | Yes | + +--- + +## Testing + +```bash +# Test all features +cargo test --all-features + +# Test specific feature +cargo test --features database + +# Test without optional features +cargo test +``` + +--- + +## Rules + +- Keep botlib minimal and focused +- No business logic - only utilities and types +- Feature gate all optional dependencies +- Maintain backward compatibility +- Document all public APIs +- Target zero warnings \ No newline at end of file diff --git a/VERSION.md b/VERSION.md deleted file mode 100644 index 4308c83..0000000 --- a/VERSION.md +++ /dev/null @@ -1,109 +0,0 @@ -# History - - - -## Version 0.1.6 - -* References and version updated. - -## Version 0.1.5 - -* Docs updated. - -## Version 0.1.4 - -* New fields to 100% automated development environement setup. - -## Version 0.1.3 - -- FIX: Updated dependencies versions. - -## Version 0.1.2 - -- NEW: pragmatismo-io-framework updated. - -## Version 0.1.0 - -- NEW: Migration to Bot Framework v4. - -## Version 0.0.33 - -- FIX: Updated dependencies versions. - -## Version 0.0.32 - -- FIX: Updated dependencies versions. - -## Version 0.0.31 - -- FIX: Export of Sequelize from sequelize-typescript. - -## Version 0.0.30 - -- FIX: Packages updated. -- FIX: Missing some 'use strict'. - -## Version 0.0.29 - -- FIX: Packages updated. - -## Version 0.0.28 - -- FIX: Package compiled. - -## Version 0.0.27 - -- FIX: Merged changes. - -## Version 0.0.26 - -- NEW: Support for Speech recognition/synthesis. - -## Version 0.0.25 - -- FIX: Packages updated. - -## Version 0.0.24 - -- FIX: Packages updated. - -## Version 0.0.23 - -- FIX: Trying to remove botbuilder dependency on hoek vunerability with no success, MS is promissing update it: https://github.com/Microsoft/BotBuilder/issues/4206. - -## Version 0.0.22 - -- FIX: Packages updated. - -## Version 0.0.21 - -- FIX: Whatsapp directline client improved. - -## Version 0.0.20 - -- NEW: Whatsapp directline client is now working in preview. -- NEW: Parameter whatsappServiceWebhookUrl added. - -## Version 0.0.19 - -- NEW: Parameter whatsappServiceUrl added to support other whatsapp channels. - -## Version 0.0.18 - -- FIX: Missing TS compilation. - -## Version 0.0.17 - -- NEW: The bot now has an associated mobile Whatsapp number; - -## Version 0.0.16 - -- FIX: Compilation of Typescript into JavaScript. - -## Version 0.0.15 - -- NEW: Now each .gbapp has it own set of syspackages loaded. - -## Version 0.0.14 - -- NEW: Added support for Whatsapp external service key on bot instance model.