Skip to content

Latest commit

 

History

History
2624 lines (1597 loc) · 39.8 KB

File metadata and controls

2624 lines (1597 loc) · 39.8 KB

API Documentation

Generated by DocSentinel

src/cli/commands.rs

pub function init

pub fn init(path: &Path, force: bool) -> Result<()>

Initialize DocSentinel in a repository

Lines 11-34

pub function scan

pub fn scan(
    path: &Path,
    full: bool,
    range: Option<&str>,
    uncommitted: bool,
) -> Result<Vec<DriftEvent>>

Scan the repository for drift

Lines 37-190

pub function status

pub fn status(path: &Path, _all: bool, severity: Option<&str>) -> Result<()>

Show status of drift issues

Lines 193-251

pub function fix

pub fn fix(path: &Path, issue_id: &str, content: Option<&str>, commit: bool) -> Result<()>

Apply a fix to a drift issue

Lines 254-309

pub function ignore

pub fn ignore(path: &Path, issue_id: &str, reason: Option<&str>) -> Result<()>

Ignore a drift issue

Lines 312-331

pub function hooks

pub fn hooks(path: &Path, install: bool, uninstall: bool) -> Result<()>

Install or manage git hooks

Lines 334-378

pub function print_events_json

pub fn print_events_json(events: &[DriftEvent]) -> Result<()>

Print events in JSON format

Lines 381-385

pub function print_events_text

pub fn print_events_text(events: &[DriftEvent])

Print events in text format

Lines 388-413

pub function generate

pub fn generate(
    path: &Path,
    readme: bool,
    _docs: bool,
    output: Option<&str>,
    include_private: bool,
) -> Result<()>

Generate documentation from code chunks

Lines 416-454

src/cli/mod.rs

pub struct Cli

Lines 16-31

pub enum Commands

Lines 35-68

pub enum OutputFormat

Lines 72-75

pub struct InitArgs

Lines 79-87

pub struct ScanArgs

Lines 91-111

pub struct StatusArgs

Lines 115-127

pub struct TuiArgs

Lines 131-135

pub struct FixArgs

Lines 139-154

pub struct IgnoreArgs

Lines 158-169

pub struct HooksArgs

Lines 173-185

pub struct WatchArgs

Lines 189-197

pub struct ConfigArgs

Lines 201-217

pub struct AnalyzeArgs

Lines 221-232

pub struct GenerateArgs

Lines 236-252

pub method Cli::parse_args

pub fn parse_args() -> Self

Parse command line arguments

Lines 256-258

pub function parse_args

pub fn parse_args() -> Self

Parse command line arguments

Lines 256-258

src/drift/detector.rs

pub struct DriftConfig

Lines 18-29

pub struct DriftDetector

Main drift detection engine

Lines 44-48

pub method DriftDetector::new

pub fn new() -> Self

Create a new drift detector with default configuration

Lines 52-58

pub function new

pub fn new() -> Self

Create a new drift detector with default configuration

Lines 52-58

pub method DriftDetector::with_config

pub fn with_config(config: DriftConfig) -> Self

Create with custom configuration

Lines 61-67

pub function with_config

pub fn with_config(config: DriftConfig) -> Self

Create with custom configuration

Lines 61-67

pub method DriftDetector::detect_code_drift

pub fn detect_code_drift(
        &self,
        old_chunks: &HashMap<String, CodeChunk>,
        new_chunks: &HashMap<String, CodeChunk>,
        doc_chunks: &[DocChunk],
        db: &Database,
    ) -> Result<Vec<DriftEvent>>

Detect drift for changed code chunks

Lines 70-129

pub function detect_code_drift

pub fn detect_code_drift(
        &self,
        old_chunks: &HashMap<String, CodeChunk>,
        new_chunks: &HashMap<String, CodeChunk>,
        doc_chunks: &[DocChunk],
        db: &Database,
    ) -> Result<Vec<DriftEvent>>

Detect drift for changed code chunks

Lines 70-129

pub method DriftDetector::detect_doc_drift

pub fn detect_doc_drift(
        &self,
        old_chunks: &HashMap<String, DocChunk>,
        new_chunks: &HashMap<String, DocChunk>,
        code_chunks: &[CodeChunk],
    ) -> Result<Vec<DriftEvent>>

Detect drift for changed doc chunks

Lines 132-177

pub function detect_doc_drift

pub fn detect_doc_drift(
        &self,
        old_chunks: &HashMap<String, DocChunk>,
        new_chunks: &HashMap<String, DocChunk>,
        code_chunks: &[CodeChunk],
    ) -> Result<Vec<DriftEvent>>

Detect drift for changed doc chunks

Lines 132-177

pub method DriftDetector::compute_all_similarities

pub fn compute_all_similarities(
        &self,
        code_chunks: &[CodeChunk],
        doc_chunks: &[DocChunk],
    ) -> Vec<SimilarityResult>

Get similarity results for all code-doc pairs

Lines 306-331

pub function compute_all_similarities

pub fn compute_all_similarities(
        &self,
        code_chunks: &[CodeChunk],
        doc_chunks: &[DocChunk],
    ) -> Vec<SimilarityResult>

Get similarity results for all code-doc pairs

Lines 306-331

pub method DriftDetector::find_best_matches

pub fn find_best_matches(
        &self,
        code_chunk: &CodeChunk,
        doc_chunks: &[DocChunk],
        limit: usize,
    ) -> Vec<(DocChunk, f64)>

Find the best matching doc chunks for a code chunk

Lines 334-359

pub function find_best_matches

pub fn find_best_matches(
        &self,
        code_chunk: &CodeChunk,
        doc_chunks: &[DocChunk],
        limit: usize,
    ) -> Vec<(DocChunk, f64)>

Find the best matching doc chunks for a code chunk

Lines 334-359

src/drift/embedding.rs

pub trait EmbeddingProvider

Lines 10-25

pub struct LocalEmbedding

Local embedding provider using Ollama or compatible API

Lines 28-37

pub method LocalEmbedding::new

pub fn new(endpoint: &str, model: &str) -> Self

Create a new local embedding provider

Lines 41-48

pub method LocalEmbedding::ollama

pub fn ollama(model: &str) -> Self

Create with Ollama defaults

Lines 51-53

pub function ollama

pub fn ollama(model: &str) -> Self

Create with Ollama defaults

Lines 51-53

pub method LocalEmbedding::with_dimension

pub fn with_dimension(mut self, dim: usize) -> Self

Set the embedding dimension

Lines 56-59

pub method LocalEmbedding::is_available

pub async fn is_available(&self) -> bool

Check if the embedding service is available

Lines 62-65

pub function is_available

pub async fn is_available(&self) -> bool

Check if the embedding service is available

Lines 62-65

pub struct OpenAIEmbedding

OpenAI-compatible embedding provider

Lines 133-144

pub method OpenAIEmbedding::new

pub fn new(endpoint: &str, model: &str, api_key: Option<&str>) -> Self

Create a new OpenAI-compatible embedding provider

Lines 148-156

pub function with_dimension

pub fn with_dimension(mut self, dim: usize) -> Self

Set the embedding dimension

Lines 159-162

pub method OpenAIEmbedding::with_dimension

pub fn with_dimension(mut self, dim: usize) -> Self

Set the embedding dimension

Lines 159-162

pub struct MockEmbedding

Mock embedding provider for testing

Lines 235-237

pub function new

pub fn new(dimension: usize) -> Self

Create a new mock embedding provider

Lines 241-243

pub method MockEmbedding::new

pub fn new(dimension: usize) -> Self

Create a new mock embedding provider

Lines 241-243

pub trait SyncEmbeddingProvider

Synchronous embedding trait for simpler usage

Lines 275-286

src/drift/mod.rs

pub enum DriftSeverity

Lines 20-29

pub enum DriftStatus

Lines 44-53

pub struct DriftEvent

Lines 68-87

pub method DriftEvent::new

pub fn new(
        severity: DriftSeverity,
        description: &str,
        evidence: &str,
        confidence: f64,
    ) -> Self

Create a new drift event

Lines 91-108

pub function new

pub fn new(
        severity: DriftSeverity,
        description: &str,
        evidence: &str,
        confidence: f64,
    ) -> Self

Create a new drift event

Lines 91-108

pub method DriftEvent::with_code_chunk

pub fn with_code_chunk(mut self, chunk_id: &str) -> Self

Add a related code chunk

Lines 111-114

pub function with_code_chunk

pub fn with_code_chunk(mut self, chunk_id: &str) -> Self

Add a related code chunk

Lines 111-114

pub method DriftEvent::with_doc_chunk

pub fn with_doc_chunk(mut self, chunk_id: &str) -> Self

Add a related doc chunk

Lines 117-120

pub function with_doc_chunk

pub fn with_doc_chunk(mut self, chunk_id: &str) -> Self

Add a related doc chunk

Lines 117-120

pub method DriftEvent::with_suggested_fix

pub fn with_suggested_fix(mut self, fix: &str) -> Self

Set the suggested fix

Lines 123-126

pub function with_suggested_fix

pub fn with_suggested_fix(mut self, fix: &str) -> Self

Set the suggested fix

Lines 123-126

pub struct SimilarityResult

Lines 131-140

pub method SimilarityResult::has_significant_drop

pub fn has_significant_drop(&self, threshold: f64) -> bool

Check if similarity dropped significantly

Lines 144-150

pub function has_significant_drop

pub fn has_significant_drop(&self, threshold: f64) -> bool

Check if similarity dropped significantly

Lines 144-150

pub function cosine_similarity

pub fn cosine_similarity(a: &[f32], b: &[f32]) -> f64

Compute cosine similarity between two vectors

Lines 154-172

src/drift/rules.rs

pub trait DriftRule

Trait for drift detection rules

Lines 10-29

pub struct HardDriftRules

Collection of hard drift rules

Lines 32-34

pub method HardDriftRules::new

pub fn new() -> Self

Create default hard drift rules

Lines 38-47

pub method HardDriftRules::check_code_change

pub fn check_code_change(
        &self,
        old_chunk: Option<&CodeChunk>,
        new_chunk: Option<&CodeChunk>,
        related_docs: &[&DocChunk],
    ) -> Vec<DriftEvent>

Check all rules against a code change

Lines 50-60

pub method HardDriftRules::check_doc_change

pub fn check_doc_change(
        &self,
        old_chunk: Option<&DocChunk>,
        new_chunk: Option<&DocChunk>,
        related_code: &[&CodeChunk],
    ) -> Vec<DriftEvent>

Check all rules against a doc change

Lines 63-73

pub struct SoftDriftRules

Collection of soft drift rules

Lines 83-85

pub function new

pub fn new() -> Self

Create default soft drift rules

Lines 89-93

pub method SoftDriftRules::new

pub fn new() -> Self

Create default soft drift rules

Lines 89-93

pub method SoftDriftRules::check_code_change

pub fn check_code_change(
        &self,
        old_chunk: Option<&CodeChunk>,
        new_chunk: Option<&CodeChunk>,
        related_docs: &[&DocChunk],
    ) -> Vec<DriftEvent>

Check all rules against a code change

Lines 96-106

src/extract/code.rs

pub enum Language

Lines 17-20

pub method Language::from_extension

pub fn from_extension(ext: &str) -> Option<Self>

Detect language from file extension

Lines 24-30

pub function from_extension

pub fn from_extension(ext: &str) -> Option<Self>

Detect language from file extension

Lines 24-30

pub method Language::tree_sitter_language

pub fn tree_sitter_language(&self) -> tree_sitter::Language

Get the tree-sitter language for this language

Lines 33-38

pub function tree_sitter_language

pub fn tree_sitter_language(&self) -> tree_sitter::Language

Get the tree-sitter language for this language

Lines 33-38

pub method Language::extension

pub fn extension(&self) -> &'static str

Get file extension for this language

Lines 41-46

pub function extension

pub fn extension(&self) -> &'static str

Get file extension for this language

Lines 41-46

pub struct CodeChunk

Lines 60-88

pub method CodeChunk::new

pub fn new(
        file_path: &str,
        symbol_name: &str,
        symbol_type: SymbolType,
        content: &str,
        language: Language,
        start_line: usize,
        end_line: usize,
    ) -> Self

Create a new code chunk

Lines 110-137

pub method CodeChunk::embedding_text

pub fn embedding_text(&self) -> String

Get a summary suitable for embedding

Lines 140-160

pub function embedding_text

pub fn embedding_text(&self) -> String

Get a summary suitable for embedding

Lines 140-160

pub enum SymbolType

Lines 166-176

pub struct CodeExtractor

Extracts code chunks from source files

Lines 195-198

pub function new

pub fn new() -> Result<Self>

Create a new code extractor

Lines 202-217

pub method CodeExtractor::new

pub fn new() -> Result<Self>

Create a new code extractor

Lines 202-217

pub method CodeExtractor::extract_file

pub fn extract_file(&mut self, path: &Path, content: &str) -> Result<Vec<CodeChunk>>

Extract chunks from a file

Lines 220-230

pub function extract_file

pub fn extract_file(&mut self, path: &Path, content: &str) -> Result<Vec<CodeChunk>>

Extract chunks from a file

Lines 220-230

src/extract/doc.rs

pub enum HeadingLevel

Lines 15-22

pub struct DocChunk

Lines 45-67

pub method DocChunk::new

pub fn new(
        file_path: &str,
        heading_path: Vec<String>,
        heading: &str,
        level: HeadingLevel,
        content: &str,
        start_line: usize,
        end_line: usize,
    ) -> Self

Create a new doc chunk

Lines 89-114

pub method DocChunk::embedding_text

pub fn embedding_text(&self) -> String

Get a summary suitable for embedding

Lines 117-123

pub function embedding_text

pub fn embedding_text(&self) -> String

Get a summary suitable for embedding

Lines 117-123

pub method DocChunk::full_path

pub fn full_path(&self) -> String

Get the full heading path as a string

Lines 126-128

pub function full_path

pub fn full_path(&self) -> String

Get the full heading path as a string

Lines 126-128

pub struct DocExtractor

Extracts doc chunks from Markdown files

Lines 132-135

pub function new

pub fn new() -> Self

Create a new doc extractor

Lines 139-143

pub method DocExtractor::new

pub fn new() -> Self

Create a new doc extractor

Lines 139-143

pub method DocExtractor::with_min_length

pub fn with_min_length(mut self, length: usize) -> Self

Set minimum section length

Lines 146-149

pub function with_min_length

pub fn with_min_length(mut self, length: usize) -> Self

Set minimum section length

Lines 146-149

pub method DocExtractor::extract_file

pub fn extract_file(&self, path: &Path, content: &str) -> Result<Vec<DocChunk>>

Extract chunks from a Markdown file

Lines 152-190

pub function extract_file

pub fn extract_file(&self, path: &Path, content: &str) -> Result<Vec<DocChunk>>

Extract chunks from a Markdown file

Lines 152-190

pub function extract_code_blocks

pub fn extract_code_blocks(content: &str) -> Vec<CodeBlock>

Extract code blocks from Markdown content

Lines 318-358

pub struct CodeBlock

Lines 362-367

src/extract/mod.rs

pub function content_hash

pub fn content_hash(content: &str) -> String

Compute a stable hash for content

Lines 16-20

pub trait Chunk

Common trait for all extractable chunks

Lines 23-35

src/lib.rs

pub function test_drift_detection

pub fn test_drift_detection() -> bool

This function does something completely different now

Lines 27-27

src/llm/client.rs

pub struct LlmResponse

Lines 8-13

pub struct LlmConfig

Lines 17-28

pub struct LlmClient

LLM client for generating analysis and fixes

Lines 43-46

pub method LlmClient::new

pub fn new(config: LlmConfig) -> Self

Create a new LLM client

Lines 50-55

pub method LlmClient::ollama

pub fn ollama(model: &str) -> Self

Create with Ollama defaults

Lines 58-64

pub function ollama

pub fn ollama(model: &str) -> Self

Create with Ollama defaults

Lines 58-64

pub method LlmClient::openai_compatible

pub fn openai_compatible(endpoint: &str, model: &str, api_key: Option<&str>) -> Self

Create with OpenAI-compatible endpoint

Lines 67-74

pub function openai_compatible

pub fn openai_compatible(endpoint: &str, model: &str, api_key: Option<&str>) -> Self

Create with OpenAI-compatible endpoint

Lines 67-74

pub method LlmClient::is_available

pub async fn is_available(&self) -> bool

Check if the LLM service is available

Lines 77-87

pub function is_available

pub async fn is_available(&self) -> bool

Check if the LLM service is available

Lines 77-87

pub method LlmClient::complete

pub async fn complete(&self, prompt: &str) -> Result<LlmResponse>

Generate a completion

Lines 90-96

pub method LlmClient::complete_with_retry

pub async fn complete_with_retry(
        &self,
        prompt: &str,
        max_retries: usize,
    ) -> Result<LlmResponse>

Generate completion with retry

Lines 188-212

pub function complete_with_retry

pub async fn complete_with_retry(
        &self,
        prompt: &str,
        max_retries: usize,
    ) -> Result<LlmResponse>

Generate completion with retry

Lines 188-212

pub struct MockLlmClient

Mock LLM client for testing

Lines 272-274

pub function new

pub fn new() -> Self

Create a new mock client

Lines 278-282

pub method MockLlmClient::new

pub fn new() -> Self

Create a new mock client

Lines 278-282

pub method MockLlmClient::add_response

pub fn add_response(&mut self, prompt_contains: &str, response: &str)

Add a mock response

Lines 285-288

pub function add_response

pub fn add_response(&mut self, prompt_contains: &str, response: &str)

Add a mock response

Lines 285-288

pub function complete

pub fn complete(&self, prompt: &str) -> Result<LlmResponse>

Generate a mock completion

Lines 291-306

pub method MockLlmClient::complete

pub fn complete(&self, prompt: &str) -> Result<LlmResponse>

Generate a mock completion

Lines 291-306

src/llm/mod.rs

pub struct AnalysisResult

Lines 21-30

pub struct AnalysisRequest

Lines 34-43

pub method AnalysisRequest::new

pub fn new(
        drift_event: DriftEvent,
        old_code: Option<CodeChunk>,
        new_code: Option<CodeChunk>,
        doc_chunk: DocChunk,
    ) -> Self

Create a new analysis request

Lines 47-59

pub method AnalysisRequest::to_prompt

pub fn to_prompt(&self) -> String

Generate the prompt for this request

Lines 62-116

pub function to_prompt

pub fn to_prompt(&self) -> String

Generate the prompt for this request

Lines 62-116

pub struct DriftAnalyzer

Analyzer that uses LLM for drift analysis

Lines 120-122

pub function new

pub fn new(client: LlmClient) -> Self

Create a new drift analyzer

Lines 126-128

pub method DriftAnalyzer::new

pub fn new(client: LlmClient) -> Self

Create a new drift analyzer

Lines 126-128

pub method DriftAnalyzer::analyze

pub async fn analyze(&self, request: AnalysisRequest) -> Result<AnalysisResult>

Analyze a drift event

Lines 131-140

pub function analyze

pub async fn analyze(&self, request: AnalysisRequest) -> Result<AnalysisResult>

Analyze a drift event

Lines 131-140

pub method DriftAnalyzer::analyze_batch

pub async fn analyze_batch(
        &self,
        requests: Vec<AnalysisRequest>,
    ) -> Result<Vec<AnalysisResult>>

Analyze multiple drift events

Lines 143-166

pub function analyze_batch

pub async fn analyze_batch(
        &self,
        requests: Vec<AnalysisRequest>,
    ) -> Result<Vec<AnalysisResult>>

Analyze multiple drift events

Lines 143-166

pub function generate_simple_fix

pub fn generate_simple_fix(
    _drift_event: &DriftEvent,
    old_code: Option<&CodeChunk>,
    new_code: Option<&CodeChunk>,
    doc_chunk: &DocChunk,
) -> Option<String>

Generate a fix suggestion without LLM (rule-based)

Lines 170-201

src/llm/prompts.rs

pub struct AnalysisPrompt

Prompt for analyzing drift

Lines 7-7

pub method AnalysisPrompt::generate

pub fn generate(
        drift_event: &DriftEvent,
        old_code: Option<&CodeChunk>,
        new_code: Option<&CodeChunk>,
        doc_chunk: &DocChunk,
    ) -> String

Generate a prompt for drift analysis

Lines 11-74

pub struct FixPrompt

Prompt for generating fixes

Lines 78-78

pub function generate

pub fn generate(
        drift_event: &DriftEvent,
        new_code: &CodeChunk,
        doc_chunk: &DocChunk,
    ) -> String

Generate a prompt for fix generation

Lines 82-120

pub method FixPrompt::generate

pub fn generate(
        drift_event: &DriftEvent,
        new_code: &CodeChunk,
        doc_chunk: &DocChunk,
    ) -> String

Generate a prompt for fix generation

Lines 82-120

pub function generate_simple_explanation

pub fn generate_simple_explanation(
    drift_event: &DriftEvent,
    old_code: Option<&CodeChunk>,
    new_code: Option<&CodeChunk>,
) -> String

Generate a simple explanation without LLM

Lines 189-228

src/repo/change.rs

pub struct ChangedFile

Lines 8-15

pub method ChangedFile::is_code

pub fn is_code(&self) -> bool

Check if this is a code file

Lines 19-21

pub function is_code

pub fn is_code(&self) -> bool

Check if this is a code file

Lines 19-21

pub method ChangedFile::is_documentation

pub fn is_documentation(&self) -> bool

Check if this is a documentation file

Lines 24-26

pub function is_documentation

pub fn is_documentation(&self) -> bool

Check if this is a documentation file

Lines 24-26

pub enum ChangeKind

Lines 31-40

pub struct Change

Lines 55-64

pub method Change::new

pub fn new(commit: Option<String>, files: Vec<ChangedFile>) -> Self

Create a new change set

Lines 68-75

pub function new

pub fn new(commit: Option<String>, files: Vec<ChangedFile>) -> Self

Create a new change set

Lines 68-75

pub method Change::code_files

pub fn code_files(&self) -> impl Iterator<Item = &ChangedFile>

Get all code files in this change

Lines 78-80

pub function code_files

pub fn code_files(&self) -> impl Iterator<Item = &ChangedFile>

Get all code files in this change

Lines 78-80

pub method Change::doc_files

pub fn doc_files(&self) -> impl Iterator<Item = &ChangedFile>

Get all documentation files in this change

Lines 83-85

pub function doc_files

pub fn doc_files(&self) -> impl Iterator<Item = &ChangedFile>

Get all documentation files in this change

Lines 83-85

pub method Change::has_mixed_changes

pub fn has_mixed_changes(&self) -> bool

Check if this change includes both code and documentation

Lines 88-92

pub function has_mixed_changes

pub fn has_mixed_changes(&self) -> bool

Check if this change includes both code and documentation

Lines 88-92

src/repo/config.rs

pub struct RepoConfig

Lines 9-37

pub struct LlmConfig

Lines 41-58

pub method RepoConfig::load_or_default

pub fn load_or_default(repo_root: &Path) -> Result<Self>

Load configuration from the repository or return defaults

Lines 129-141

pub function load_or_default

pub fn load_or_default(repo_root: &Path) -> Result<Self>

Load configuration from the repository or return defaults

Lines 129-141

pub method RepoConfig::save

pub fn save(&self, repo_root: &Path) -> Result<()>

Save configuration to the repository

Lines 144-155

pub function save

pub fn save(&self, repo_root: &Path) -> Result<()>

Save configuration to the repository

Lines 144-155

pub method RepoConfig::should_ignore

pub fn should_ignore(&self, path: &str) -> bool

Check if a path should be ignored

Lines 158-162

pub function should_ignore

pub fn should_ignore(&self, path: &str) -> bool

Check if a path should be ignored

Lines 158-162

pub method RepoConfig::is_doc_file

pub fn is_doc_file(&self, path: &str) -> bool

Check if a path is a documentation file

Lines 165-169

pub function is_doc_file

pub fn is_doc_file(&self, path: &str) -> bool

Check if a path is a documentation file

Lines 165-169

pub method RepoConfig::is_code_file

pub fn is_code_file(&self, path: &str) -> bool

Check if a path is a code file

Lines 172-176

pub function is_code_file

pub fn is_code_file(&self, path: &str) -> bool

Check if a path is a code file

Lines 172-176

src/repo/mod.rs

pub struct Repository

Represents a Git repository being analyzed

Lines 19-26

pub method Repository::open

pub fn open<P: AsRef<Path>>(path: P) -> Result<Self>

Open an existing repository at the given path

Lines 30-43

pub function open

pub fn open<P: AsRef<Path>>(path: P) -> Result<Self>

Open an existing repository at the given path

Lines 30-43

pub method Repository::root

pub fn root(&self) -> &Path

Get the repository root path

Lines 46-48

pub function root

pub fn root(&self) -> &Path

Get the repository root path

Lines 46-48

pub method Repository::sentinel_dir

pub fn sentinel_dir(&self) -> PathBuf

Get the path to the .docsentinel directory

Lines 51-53

pub function sentinel_dir

pub fn sentinel_dir(&self) -> PathBuf

Get the path to the .docsentinel directory

Lines 51-53

pub method Repository::init_sentinel_dir

pub fn init_sentinel_dir(&self) -> Result<PathBuf>

Initialize the .docsentinel directory if it doesn't exist

Lines 56-63

pub function init_sentinel_dir

pub fn init_sentinel_dir(&self) -> Result<PathBuf>

Initialize the .docsentinel directory if it doesn't exist

Lines 56-63

pub method Repository::head_commit

pub fn head_commit(&self) -> Result<String>

Get the current HEAD commit hash

Lines 66-72

pub function head_commit

pub fn head_commit(&self) -> Result<String>

Get the current HEAD commit hash

Lines 66-72

pub method Repository::changes_between

pub fn changes_between(&self, from: Option<&str>, to: &str) -> Result<Vec<ChangedFile>>

Get changes between two commits

Lines 75-147

pub function changes_between

pub fn changes_between(&self, from: Option<&str>, to: &str) -> Result<Vec<ChangedFile>>

Get changes between two commits

Lines 75-147

pub method Repository::uncommitted_changes

pub fn uncommitted_changes(&self) -> Result<Vec<ChangedFile>>

Get uncommitted changes in the working directory

Lines 150-191

pub function uncommitted_changes

pub fn uncommitted_changes(&self) -> Result<Vec<ChangedFile>>

Get uncommitted changes in the working directory

Lines 150-191

pub method Repository::read_file_at_commit

pub fn read_file_at_commit(&self, path: &Path, commit: &str) -> Result<Option<String>>

Read file content at a specific commit

Lines 233-263

pub function read_file_at_commit

pub fn read_file_at_commit(&self, path: &Path, commit: &str) -> Result<Option<String>>

Read file content at a specific commit

Lines 233-263

pub method Repository::read_file_current

pub fn read_file_current(&self, path: &Path) -> Result<Option<String>>

Read current file content from working directory

Lines 266-274

pub function read_file_current

pub fn read_file_current(&self, path: &Path) -> Result<Option<String>>

Read current file content from working directory

Lines 266-274

pub method Repository::config

pub fn config(&self) -> &RepoConfig

Get the repository configuration

Lines 277-279

pub function config

pub fn config(&self) -> &RepoConfig

Get the repository configuration

Lines 277-279

pub method Repository::list_files

pub fn list_files(&self, file_type: Option<FileType>) -> Result<Vec<PathBuf>>

List all files in the repository matching certain criteria

Lines 282-307

pub function list_files

pub fn list_files(&self, file_type: Option<FileType>) -> Result<Vec<PathBuf>>

List all files in the repository matching certain criteria

Lines 282-307

pub enum FileType

Lines 312-317

src/storage/mod.rs

pub struct Database

Database connection wrapper

Lines 20-22

pub method Database::open

pub fn open<P: AsRef<Path>>(path: P) -> Result<Self>

Open or create a database at the given path

Lines 26-34

pub function open

pub fn open<P: AsRef<Path>>(path: P) -> Result<Self>

Open or create a database at the given path

Lines 26-34

pub method Database::open_in_memory

pub fn open_in_memory() -> Result<Self>

Open an in-memory database (for testing)

Lines 37-44

pub function open_in_memory

pub fn open_in_memory() -> Result<Self>

Open an in-memory database (for testing)

Lines 37-44

pub method Database::get_last_scan_commit

pub fn get_last_scan_commit(&self) -> Result<Option<String>>

Get the last scanned commit hash

Lines 57-69

pub function get_last_scan_commit

pub fn get_last_scan_commit(&self) -> Result<Option<String>>

Get the last scanned commit hash

Lines 57-69

pub method Database::set_last_scan_commit

pub fn set_last_scan_commit(&self, commit: &str) -> Result<()>

Update the last scanned commit hash

Lines 72-80

pub function set_last_scan_commit

pub fn set_last_scan_commit(&self, commit: &str) -> Result<()>

Update the last scanned commit hash

Lines 72-80

pub method Database::upsert_code_chunk

pub fn upsert_code_chunk(&self, chunk: &CodeChunk) -> Result<()>

Insert or update a code chunk

Lines 85-133

pub function upsert_code_chunk

pub fn upsert_code_chunk(&self, chunk: &CodeChunk) -> Result<()>

Insert or update a code chunk

Lines 85-133

pub method Database::get_code_chunk

pub fn get_code_chunk(&self, id: &str) -> Result<Option<CodeChunk>>

Get a code chunk by ID

Lines 136-169

pub function get_code_chunk

pub fn get_code_chunk(&self, id: &str) -> Result<Option<CodeChunk>>

Get a code chunk by ID

Lines 136-169

pub method Database::get_code_chunks_for_file

pub fn get_code_chunks_for_file(&self, file_path: &str) -> Result<Vec<CodeChunk>>

Get all code chunks for a file

Lines 172-206

pub function get_code_chunks_for_file

pub fn get_code_chunks_for_file(&self, file_path: &str) -> Result<Vec<CodeChunk>>

Get all code chunks for a file

Lines 172-206

pub method Database::get_all_code_chunks_with_embeddings

pub fn get_all_code_chunks_with_embeddings(&self) -> Result<Vec<CodeChunk>>

Get all code chunks with embeddings

Lines 209-243

pub function get_all_code_chunks_with_embeddings

pub fn get_all_code_chunks_with_embeddings(&self) -> Result<Vec<CodeChunk>>

Get all code chunks with embeddings

Lines 209-243

pub method Database::get_all_code_chunks

pub fn get_all_code_chunks(&self) -> Result<Vec<CodeChunk>>

Get all code chunks

Lines 246-281

pub function get_all_code_chunks

pub fn get_all_code_chunks(&self) -> Result<Vec<CodeChunk>>

Get all code chunks

Lines 246-281

pub method Database::delete_code_chunks_for_file

pub fn delete_code_chunks_for_file(&self, file_path: &str) -> Result<usize>

Delete code chunks for a file

Lines 284-294

pub function delete_code_chunks_for_file

pub fn delete_code_chunks_for_file(&self, file_path: &str) -> Result<usize>

Delete code chunks for a file

Lines 284-294

pub method Database::upsert_doc_chunk

pub fn upsert_doc_chunk(&self, chunk: &DocChunk) -> Result<()>

Insert or update a doc chunk

Lines 299-342

pub function upsert_doc_chunk

pub fn upsert_doc_chunk(&self, chunk: &DocChunk) -> Result<()>

Insert or update a doc chunk

Lines 299-342

pub method Database::get_doc_chunk

pub fn get_doc_chunk(&self, id: &str) -> Result<Option<DocChunk>>

Get a doc chunk by ID

Lines 345-374

pub function get_doc_chunk

pub fn get_doc_chunk(&self, id: &str) -> Result<Option<DocChunk>>

Get a doc chunk by ID

Lines 345-374

pub method Database::get_doc_chunks_for_file

pub fn get_doc_chunks_for_file(&self, file_path: &str) -> Result<Vec<DocChunk>>

Get all doc chunks for a file

Lines 377-409

pub function get_doc_chunks_for_file

pub fn get_doc_chunks_for_file(&self, file_path: &str) -> Result<Vec<DocChunk>>

Get all doc chunks for a file

Lines 377-409

pub method Database::get_all_doc_chunks_with_embeddings

pub fn get_all_doc_chunks_with_embeddings(&self) -> Result<Vec<DocChunk>>

Get all doc chunks with embeddings

Lines 412-444

pub function get_all_doc_chunks_with_embeddings

pub fn get_all_doc_chunks_with_embeddings(&self) -> Result<Vec<DocChunk>>

Get all doc chunks with embeddings

Lines 412-444

pub method Database::delete_doc_chunks_for_file

pub fn delete_doc_chunks_for_file(&self, file_path: &str) -> Result<usize>

Delete doc chunks for a file

Lines 447-457

pub function delete_doc_chunks_for_file

pub fn delete_doc_chunks_for_file(&self, file_path: &str) -> Result<usize>

Delete doc chunks for a file

Lines 447-457

pub method Database::insert_drift_event

pub fn insert_drift_event(&self, event: &DriftEvent) -> Result<()>

Insert a drift event

Lines 462-490

pub function insert_drift_event

pub fn insert_drift_event(&self, event: &DriftEvent) -> Result<()>

Insert a drift event

Lines 462-490

pub method Database::get_unresolved_drift_events

pub fn get_unresolved_drift_events(&self) -> Result<Vec<DriftEvent>>

Get all unresolved drift events

Lines 493-527

pub function get_unresolved_drift_events

pub fn get_unresolved_drift_events(&self) -> Result<Vec<DriftEvent>>

Get all unresolved drift events

Lines 493-527

pub method Database::update_drift_event_status

pub fn update_drift_event_status(&self, id: &str, status: &str) -> Result<()>

Update drift event status

Lines 530-539

pub function update_drift_event_status

pub fn update_drift_event_status(&self, id: &str, status: &str) -> Result<()>

Update drift event status

Lines 530-539

pub method Database::get_drift_event

pub fn get_drift_event(&self, id: &str) -> Result<Option<DriftEvent>>

Get drift event by ID

Lines 542-572

pub function get_drift_event

pub fn get_drift_event(&self, id: &str) -> Result<Option<DriftEvent>>

Get drift event by ID

Lines 542-572

pub method Database::get_stats

pub fn get_stats(&self) -> Result<DatabaseStats>

Get database statistics

Lines 577-602

pub function get_stats

pub fn get_stats(&self) -> Result<DatabaseStats>

Get database statistics

Lines 577-602

pub struct DatabaseStats

Lines 607-612

src/tui/app.rs

pub enum View

Lines 12-23

pub struct AppState

Application state

Lines 26-41

pub struct ConfirmDialog

Confirmation dialog

Lines 58-62

pub struct App

Main TUI application

Lines 65-78

pub method App::new

pub fn new(path: &Path) -> Result<Self>

Create a new app instance

Lines 82-104

pub function new

pub fn new(path: &Path) -> Result<Self>

Create a new app instance

Lines 82-104

pub method App::handle_key

pub fn handle_key(&mut self, key: KeyEvent) -> Result<bool>

Handle a key event

Lines 107-126

pub function handle_key

pub fn handle_key(&mut self, key: KeyEvent) -> Result<bool>

Handle a key event

Lines 107-126

pub method App::selected_event

pub fn selected_event(&self) -> Option<&DriftEvent>

Get the currently selected event

Lines 338-340

pub function selected_event

pub fn selected_event(&self) -> Option<&DriftEvent>

Get the currently selected event

Lines 338-340

pub method App::severity_color

pub fn severity_color(severity: DriftSeverity) -> ratatui::style::Color

Get severity color

Lines 343-351

pub function severity_color

pub fn severity_color(severity: DriftSeverity) -> ratatui::style::Color

Get severity color

Lines 343-351

src/tui/mod.rs

pub function run

pub fn run(path: &Path) -> Result<()>

Run the TUI application

Lines 26-50

src/tui/ui.rs

pub function draw

pub fn draw(f: &mut Frame, app: &App)

Draw the UI

Lines 14-32

src/tui/widgets.rs

pub struct DiffView

A diff view widget showing side-by-side comparison

Lines 12-17

pub method DiffView<'a>::new

pub fn new(
        left_title: &'a str,
        left_content: &'a str,
        right_title: &'a str,
        right_content: &'a str,
    ) -> Self

Lines 20-32

pub struct SeverityBadge

A severity badge widget

Lines 79-81

pub method SeverityBadge::new

pub fn new(severity: crate::drift::DriftSeverity) -> Self

Lines 84-86

pub method SeverityBadge::to_span

pub fn to_span(&self) -> Span<'static>

Lines 88-105

pub function to_span

pub fn to_span(&self) -> Span<'static>

Lines 88-105

pub struct ProgressBar

A progress bar widget

Lines 109-112

pub method ProgressBar::new

pub fn new(progress: f64) -> Self

Lines 115-120

pub method ProgressBar::with_label

pub fn with_label(mut self, label: &str) -> Self

Lines 122-125

pub function with_label

pub fn with_label(mut self, label: &str) -> Self

Lines 122-125

pub struct CodeBlock

A code block widget with syntax highlighting hints

Lines 169-173

pub method CodeBlock<'a>::new

pub fn new(content: &'a str) -> Self

Lines 176-182

pub method CodeBlock<'a>::language

pub fn language(mut self, lang: &'a str) -> Self

Lines 184-187

pub function language

pub fn language(mut self, lang: &'a str) -> Self

Lines 184-187

pub method CodeBlock<'a>::line_numbers

pub fn line_numbers(mut self, show: bool) -> Self

Lines 189-192

pub function line_numbers

pub fn line_numbers(mut self, show: bool) -> Self

Lines 189-192

pub struct KeyHints

A key hint widget for showing keyboard shortcuts

Lines 235-237

pub function new

pub fn new(hints: Vec<(&'a str, &'a str)>) -> Self

Lines 240-242

pub method KeyHints<'a>::new

pub fn new(hints: Vec<(&'a str, &'a str)>) -> Self

Lines 240-242