refactor: Remove redundant doc comments throughout codebase
Removes module-level doc comments (//! lines) and excessive inline doc comments that were duplicating information already evident from: - Function/struct names (self-documenting code) - Type signatures (the what is clear from types) - Implementation context (the how is clear from code) Affected modules: - cli/* - Removed command descriptions duplicating clap help text - core/* - Removed module headers and obvious function docs - documents/* - Removed extractor/regenerator/truncation docs - embedding/* - Removed pipeline and chunking docs - gitlab/* - Removed client and transformer docs (kept type definitions) - ingestion/* - Removed orchestrator and ingestion docs - search/* - Removed FTS and vector search docs Philosophy: Code should be self-documenting. Comments should explain "why" (business decisions, non-obvious constraints) not "what" (which the code itself shows). This change reduces noise and maintenance burden while keeping the codebase just as understandable. Retains comments for: - Non-obvious business logic - Important safety invariants - Complex algorithm explanations - Public API boundaries where generated docs matter Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,3 @@
|
||||
//! Configuration loading and validation.
|
||||
//!
|
||||
//! Config schema mirrors the TypeScript version with serde for deserialization.
|
||||
|
||||
use serde::Deserialize;
|
||||
use std::fs;
|
||||
use std::path::Path;
|
||||
@@ -9,7 +5,6 @@ use std::path::Path;
|
||||
use super::error::{LoreError, Result};
|
||||
use super::paths::get_config_path;
|
||||
|
||||
/// GitLab connection settings.
|
||||
#[derive(Debug, Clone, Deserialize)]
|
||||
pub struct GitLabConfig {
|
||||
#[serde(rename = "baseUrl")]
|
||||
@@ -23,13 +18,11 @@ fn default_token_env_var() -> String {
|
||||
"GITLAB_TOKEN".to_string()
|
||||
}
|
||||
|
||||
/// Project to sync.
|
||||
#[derive(Debug, Clone, Deserialize)]
|
||||
pub struct ProjectConfig {
|
||||
pub path: String,
|
||||
}
|
||||
|
||||
/// Sync behavior settings.
|
||||
#[derive(Debug, Clone, Deserialize)]
|
||||
#[serde(default)]
|
||||
pub struct SyncConfig {
|
||||
@@ -77,7 +70,6 @@ impl Default for SyncConfig {
|
||||
}
|
||||
}
|
||||
|
||||
/// Storage settings.
|
||||
#[derive(Debug, Clone, Deserialize, Default)]
|
||||
#[serde(default)]
|
||||
pub struct StorageConfig {
|
||||
@@ -98,7 +90,6 @@ fn default_compress_raw_payloads() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
/// Embedding provider settings.
|
||||
#[derive(Debug, Clone, Deserialize)]
|
||||
#[serde(default)]
|
||||
pub struct EmbeddingConfig {
|
||||
@@ -120,19 +111,15 @@ impl Default for EmbeddingConfig {
|
||||
}
|
||||
}
|
||||
|
||||
/// Logging and observability settings.
|
||||
#[derive(Debug, Clone, Deserialize)]
|
||||
#[serde(default)]
|
||||
pub struct LoggingConfig {
|
||||
/// Directory for log files. Default: ~/.local/share/lore/logs/
|
||||
#[serde(rename = "logDir")]
|
||||
pub log_dir: Option<String>,
|
||||
|
||||
/// Days to retain log files. Default: 30. Set to 0 to disable file logging.
|
||||
#[serde(rename = "retentionDays", default = "default_retention_days")]
|
||||
pub retention_days: u32,
|
||||
|
||||
/// Enable JSON log files. Default: true.
|
||||
#[serde(rename = "fileLogging", default = "default_file_logging")]
|
||||
pub file_logging: bool,
|
||||
}
|
||||
@@ -155,7 +142,6 @@ impl Default for LoggingConfig {
|
||||
}
|
||||
}
|
||||
|
||||
/// Main configuration structure.
|
||||
#[derive(Debug, Clone, Deserialize)]
|
||||
pub struct Config {
|
||||
pub gitlab: GitLabConfig,
|
||||
@@ -175,7 +161,6 @@ pub struct Config {
|
||||
}
|
||||
|
||||
impl Config {
|
||||
/// Load and validate configuration from file.
|
||||
pub fn load(cli_override: Option<&str>) -> Result<Self> {
|
||||
let config_path = get_config_path(cli_override);
|
||||
|
||||
@@ -188,7 +173,6 @@ impl Config {
|
||||
Self::load_from_path(&config_path)
|
||||
}
|
||||
|
||||
/// Load configuration from a specific path.
|
||||
pub fn load_from_path(path: &Path) -> Result<Self> {
|
||||
let content = fs::read_to_string(path).map_err(|e| LoreError::ConfigInvalid {
|
||||
details: format!("Failed to read config file: {e}"),
|
||||
@@ -199,7 +183,6 @@ impl Config {
|
||||
details: format!("Invalid JSON: {e}"),
|
||||
})?;
|
||||
|
||||
// Validate required fields
|
||||
if config.projects.is_empty() {
|
||||
return Err(LoreError::ConfigInvalid {
|
||||
details: "At least one project is required".to_string(),
|
||||
@@ -214,7 +197,6 @@ impl Config {
|
||||
}
|
||||
}
|
||||
|
||||
// Validate URL format
|
||||
if url::Url::parse(&config.gitlab.base_url).is_err() {
|
||||
return Err(LoreError::ConfigInvalid {
|
||||
details: format!("Invalid GitLab URL: {}", config.gitlab.base_url),
|
||||
@@ -225,7 +207,6 @@ impl Config {
|
||||
}
|
||||
}
|
||||
|
||||
/// Minimal config for writing during init (relies on defaults when loaded).
|
||||
#[derive(Debug, serde::Serialize)]
|
||||
pub struct MinimalConfig {
|
||||
pub gitlab: MinimalGitLabConfig,
|
||||
|
||||
Reference in New Issue
Block a user