/
kleidinc
/
brain
Обзор
Документация
Войти
/
kleidinc
/
brain
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
src/cli/mod.rs
80 строк
2 KB
Your Name
updated by tatiana code for agentic coding memory
21 мар 2026, 02:21
21 мар 2026, 02:21
f6f1fe3
Код
Авторство
О чём код?
use clap::Parser; use std::path::PathBuf; #[derive(Parser)] #[command(name = "brain")] #[command(about = "Local RAG brain for code and documentation", long_about = None)] #[command(version)] pub struct Cli { #[arg(long, help = "Index a GitHub repo (format: owner/repo)")] pub index: Option<String>, #[arg(long, default_value = "main", help = "Branch to use with --index")] pub branch: String, #[arg(long, help = "Index a local directory")] pub index_local: Option<PathBuf>, #[arg(long, help = "Index content from a URL (blog, PDF, git repo, etc.)")] pub index_url: Option<String>, #[arg(long, help = "Index URLs from a file (one URL per line)")] pub index_url_from_file: Option<PathBuf>, #[arg(long, help = "Search for similar documents")] pub search: Option<String>, #[arg(long, help = "Look up all chunks for a source (e.g. url:https://...)")] pub lookup: Option<String>, #[arg(long, help = "Query the brain with RAG (requires LLM)")] pub query: Option<String>, #[arg(long, help = "Start the HTTP server")] pub serve: bool, #[arg(long, default_value = "127.0.0.1", help = "Host for server")] pub host: String, #[arg(long, default_value_t = 8080, help = "Port for server")] pub port: u16, #[arg(long, help = "Show brain status")] pub status: bool, #[arg(long, help = "List indexed sources")] pub sources: bool, #[arg(long, help = "Delete a source")] pub delete: Option<String>, #[arg(long, help = "Check for updates to indexed sources")] pub update_check: bool, #[arg(long, help = "Run updates for sources")] pub update_run: bool, #[arg(long, help = "Show scheduler status")] pub update_status: bool, #[arg(long, help = "Show system report (statistics, health, disk usage)")] pub report: bool, #[arg(long, help = "Force update outside download window")] pub force: bool, #[arg(long, help = "Output as JSON")] pub json: bool, #[arg(short, long, default_value = "10", help = "Number of results")] pub limit: usize, } pub fn parse_github_repo(input: &str) -> Option<(String, String)> { let parts: Vec<&str> = input.splitn(2, '/').collect(); if parts.len() == 2 && !parts[0].is_empty() && !parts[1].is_empty() { Some((parts[0].to_string(), parts[1].to_string())) } else { None } }