- Added component management.
This commit is contained in:
parent
2a6c5c21ed
commit
79ac6df738
6 changed files with 1303 additions and 6 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -3,3 +3,4 @@ target
|
|||
*.env
|
||||
work
|
||||
*.out
|
||||
bin
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ ADD Manual: Claude/DeepSeek -> DeepSeek
|
|||
|
||||
cargo install cargo-audit
|
||||
cargo install cargo-edit
|
||||
|
||||
apt install -y libpq-dev
|
||||
apt install -y valkey-cli
|
||||
|
||||
## Cache
|
||||
|
|
|
|||
|
|
@ -1,14 +1,13 @@
|
|||
MOST IMPORTANT CODE GENERATION RULES:
|
||||
- No placeholders, never comment/uncomment code, no explanations, no filler text.
|
||||
- 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.
|
||||
- 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.
|
||||
- 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.
|
||||
- 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.
|
||||
- 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.
|
||||
|
|
|
|||
1
scripts/utils/copy-all-files-content.sh
Normal file
1
scripts/utils/copy-all-files-content.sh
Normal file
|
|
@ -0,0 +1 @@
|
|||
find . -maxdepth 1 -type f -exec echo -e "\n=== {} ===\n" \; -exec cat {} \; | xclip -selection clipboard
|
||||
42
src/main.rs
42
src/main.rs
|
|
@ -19,6 +19,7 @@ mod file;
|
|||
mod llm;
|
||||
mod llm_legacy;
|
||||
mod org;
|
||||
mod package_manager;
|
||||
mod session;
|
||||
mod shared;
|
||||
mod tools;
|
||||
|
|
@ -44,6 +45,44 @@ use crate::whatsapp::WhatsAppAdapter;
|
|||
|
||||
#[actix_web::main]
|
||||
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.
|
||||
dotenv().ok();
|
||||
let llama_url =
|
||||
|
|
@ -56,9 +95,6 @@ async fn main() -> std::io::Result<()> {
|
|||
let cfg = AppConfig::from_env();
|
||||
let config = std::sync::Arc::new(cfg.clone());
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Database connections
|
||||
// ----------------------------------------------------------------------
|
||||
let db_pool = match diesel::Connection::establish(&cfg.database_url()) {
|
||||
Ok(conn) => {
|
||||
info!("Connected to main database successfully");
|
||||
|
|
|
|||
1260
src/package_manager/mod.rs
Normal file
1260
src/package_manager/mod.rs
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue