Crate projets_indexer

Source
Expand description

§Projects Indexer

projets-indexer is a powerful command-line tool for indexing and organizing your projects with AI-powered tag generation. It helps developers maintain a clear overview of their project collection by scanning directories, detecting project types, and providing detailed statistics.

§Features

  • 🔍 Recursive directory scanning with configurable depth
  • 📊 Project status detection (active/archived) based on git history
  • 🏷️ AI-powered tag generation using Ollama
  • 📁 Smart project categorization based on directory structure
  • 🔎 Search functionality across projects, tags, and categories
  • 📈 Detailed project statistics and insights

§Usage

# Index projects with default settings
projets-indexer index

# Index projects with custom directory and output
projets-indexer index -d ~/my-projects -o my-index.json

# Search projects
projets-indexer search "machine learning"

# Show project statistics
projets-indexer stats

# Generate tags for a specific project
projets-indexer generate-tags -p ~/projects/my-project

§Modules

  • cli: Command-line interface implementation using clap
  • config: Configuration structures and handling
  • indexer: Core project indexing functionality
  • models: Data structures for projects and related entities
  • ollama: Integration with Ollama for AI-powered tag generation
  • ui: Terminal UI components and progress indicators
  • error: Error types and handling

§Examples

Basic usage of the library:

use projets_indexer::{
    config::IndexerConfig,
    indexer::ProjectIndexer,
};
use std::path::PathBuf;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Create indexer configuration
    let config = IndexerConfig::new(
        PathBuf::from("~/projects"),
        PathBuf::from("index.json"),
        true, // enable Ollama
    );

    // Initialize project indexer
    let indexer = ProjectIndexer::new(config)?;

    // Index projects with a progress callback
    let projects = indexer.index_projects(|project_name| {
        println!("Indexing: {}", project_name);
    }).await?;

    println!("Found {} projects", projects.len());
    Ok(())
}

§Re-exports

The following types are re-exported for convenience:

§Error Handling

The library uses a custom error type OllamaError and a type alias Result for consistent error handling across all modules.

§Dependencies

  • tokio: Async runtime
  • serde: Serialization/deserialization
  • walkdir: Directory traversal
  • tracing: Logging and diagnostics
  • reqwest: HTTP client for Ollama API

Re-exports§

pub use cli::Cli;
pub use cli::Commands;
pub use config::indexer_config::IndexerConfig;
pub use error::OllamaError;
pub use error::Result;
pub use indexer::project_indexer::ProjectIndexer;
pub use models::project::Project;
pub use models::project::ProjectStatus;
pub use ollama::ClientConfig;
pub use ollama::GenerateRequest;
pub use ollama::GenerateResponse;
pub use ollama::OllamaClient;

Modules§

cli
Command-line interface for the project indexer
config
error
indexer
models
ollama
Ollama API client
prelude
Common types and traits for the projects indexer.
ui
Terminal UI components