- Added component management.

This commit is contained in:
Rodrigo Rodriguez (Pragmatismo) 2025-10-18 09:26:48 -03:00
parent 2a6c5c21ed
commit 79ac6df738
6 changed files with 1303 additions and 6 deletions

1
.gitignore vendored
View file

@ -3,3 +3,4 @@ target
*.env *.env
work work
*.out *.out
bin

View file

@ -11,7 +11,7 @@ ADD Manual: Claude/DeepSeek -> DeepSeek
cargo install cargo-audit cargo install cargo-audit
cargo install cargo-edit cargo install cargo-edit
apt install -y libpq-dev
apt install -y valkey-cli apt install -y valkey-cli
## Cache ## Cache

View file

@ -1,14 +1,13 @@
MOST IMPORTANT CODE GENERATION RULES: MOST IMPORTANT CODE GENERATION RULES:
- No placeholders, never comment/uncomment code, no explanations, no filler text. - No placeholders, never comment/uncomment code, no explanations, no filler text.
- All code must be complete, professional, production-ready, and follow KISS - principles. - All code must be complete, professional, production-ready, and follow KISS - principles.
- NEVER return placeholders of any kind, neither commented code, only REAL PRODUCTION GRADE code. - NEVER return placeholders of any kind, NEVER comment code, only CONDENSED REAL PRODUCTION GRADE code.
- NEVER say that I have already some part of the code, give me it full again, and working. - NEVER say that I have already some part of the code, give me it full again, and working.
- Always increment logging with (all-in-one-line) info!, debug!, trace! to give birth to the console. - Always increment logging with (all-in-one-line) info!, debug!, trace! to give birth to the console.
- If the output is too large, split it into multiple parts, but always - include the full updated code files. - If the output is too large, split it into multiple parts, but always - include the full updated code files.
- Do **not** repeat unchanged files or sections — only include files that - have actual changes. - Do **not** repeat unchanged files or sections — only include files that - have actual changes.
- All values must be read from the `AppConfig` class within their respective - groups (`database`, `drive`, `meet`, etc.); never use hardcoded or magic - values. - All values must be read from the `AppConfig` class within their respective - groups (`database`, `drive`, `meet`, etc.); never use hardcoded or magic - values.
- Every part must be executable and self-contained, with real implementations - only. - Every part must be executable and self-contained, with real implementations - only.
- Only generated production ready enterprise grade VERY condensed no commented code.
- DO NOT WRITE ANY ERROR HANDLING CODE LET IT CRASH. - DO NOT WRITE ANY ERROR HANDLING CODE LET IT CRASH.
- Never generate two ore more trace mensages that are equal! - Never generate two ore more trace mensages that are equal!
- Return *only the modified* files as a single `.sh` script using `cat`, so the code can be restored directly. - Return *only the modified* files as a single `.sh` script using `cat`, so the code can be restored directly.

View file

@ -0,0 +1 @@
find . -maxdepth 1 -type f -exec echo -e "\n=== {} ===\n" \; -exec cat {} \; | xclip -selection clipboard

View file

@ -19,6 +19,7 @@ mod file;
mod llm; mod llm;
mod llm_legacy; mod llm_legacy;
mod org; mod org;
mod package_manager;
mod session; mod session;
mod shared; mod shared;
mod tools; mod tools;
@ -44,6 +45,44 @@ use crate::whatsapp::WhatsAppAdapter;
#[actix_web::main] #[actix_web::main]
async fn main() -> std::io::Result<()> { async fn main() -> std::io::Result<()> {
// ----------------------------------------------------------------------
// CLI handling - must be first to intercept package manager commands
// ----------------------------------------------------------------------
let args: Vec<String> = std::env::args().collect();
// Check if a CLI command was provided (anything beyond just the program name)
if args.len() > 1 {
let command = &args[1];
// Check if it's a recognized CLI command
match command.as_str() {
"install" | "remove" | "list" | "status" | "--help" | "-h" => {
// Run the CLI and exit (don't start the server)
match package_manager::cli::run() {
Ok(_) => return Ok(()),
Err(e) => {
eprintln!("CLI error: {}", e);
return Err(std::io::Error::new(
std::io::ErrorKind::Other,
format!("CLI command failed: {}", e),
));
}
}
}
_ => {
// Unknown command - print error and exit
eprintln!("Unknown command: {}", command);
eprintln!("Run 'botserver --help' for usage information");
return Err(std::io::Error::new(
std::io::ErrorKind::InvalidInput,
format!("Unknown command: {}", command),
));
}
}
}
// No CLI commands - proceed with normal server startup
// ----------------------------------------------------------------------
// Load environment variables from a .env file, if present. // Load environment variables from a .env file, if present.
dotenv().ok(); dotenv().ok();
let llama_url = let llama_url =
@ -56,9 +95,6 @@ async fn main() -> std::io::Result<()> {
let cfg = AppConfig::from_env(); let cfg = AppConfig::from_env();
let config = std::sync::Arc::new(cfg.clone()); let config = std::sync::Arc::new(cfg.clone());
// ----------------------------------------------------------------------
// Database connections
// ----------------------------------------------------------------------
let db_pool = match diesel::Connection::establish(&cfg.database_url()) { let db_pool = match diesel::Connection::establish(&cfg.database_url()) {
Ok(conn) => { Ok(conn) => {
info!("Connected to main database successfully"); info!("Connected to main database successfully");

1260
src/package_manager/mod.rs Normal file

File diff suppressed because it is too large Load diff