1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
//! # RepoLens Library
//!
//! RepoLens is a comprehensive CLI tool for auditing GitHub repositories against
//! best practices, security standards, and compliance requirements.
//!
//! This crate provides the core functionality for:
//! - Scanning repositories for secrets, security issues, and configuration problems
//! - Checking compliance with open-source or enterprise standards
//! - Generating detailed audit reports in multiple formats
//! - Planning and applying remediation actions
//!
//! ## Quick Start
//!
//! ```rust,no_run
//! use repolens::{config, scanner::Scanner, rules::engine::RulesEngine};
//! use std::path::PathBuf;
//!
//! # async fn example() -> Result<(), repolens::RepoLensError> {
//! // Load configuration
//! let config = config::Config::load_or_default()?;
//!
//! // Create a scanner for the repository
//! let scanner = Scanner::new(PathBuf::from("."));
//!
//! // Create and run the rules engine
//! let engine = RulesEngine::new(config);
//! let results = engine.run(&scanner).await?;
//!
//! // Check results
//! println!("Found {} issues", results.findings().len());
//! # Ok(())
//! # }
//! ```
//!
//! ## Architecture
//!
//! The library is organized into the following modules:
//!
//! - [`config`] - Configuration loading, presets, and rule settings
//! - [`rules`] - Audit rules engine and finding categories
//! - [`scanner`] - File system and git repository scanning
//! - [`actions`] - Action planning and execution for remediation
//! - [`providers`] - External service integrations (GitHub API)
//! - [`cache`] - Audit results caching for performance
//! - [`compare`] - Report comparison and diff generation
//! - [`hooks`] - Git hooks management
//! - [`error`] - Error types and handling
//!
//! ## Presets
//!
//! RepoLens supports three built-in presets:
//!
//! - **opensource** - Standard open-source project requirements
//! - **enterprise** - Enterprise-grade security and compliance
//! - **strict** - Maximum security and documentation requirements
//!
//! ## Rule Categories
//!
//! The audit engine checks the following categories:
//!
//! | Category | Description |
//! |----------|-------------|
//! | `secrets` | Detect exposed secrets and credentials |
//! | `files` | Check for required files (README, LICENSE, etc.) |
//! | `docs` | Documentation quality checks |
//! | `security` | Security best practices |
//! | `workflows` | CI/CD and GitHub Actions checks |
//! | `quality` | Code quality standards |
//! | `dependencies` | Dependency security and licensing |
//! | `docker` | Docker configuration checks |
//! | `git` | Git configuration and history checks |
pub use RepoLensError;
// Re-export exit_codes from cli module for public API
pub use exit_codes;