aptu_core/lib.rs
1// SPDX-License-Identifier: Apache-2.0
2
3#![warn(missing_docs)]
4#![doc = include_str!("../README.md")]
5
6// ============================================================================
7// Authentication
8// ============================================================================
9
10pub use auth::TokenProvider;
11
12// ============================================================================
13// Error Handling
14// ============================================================================
15
16pub use error::AptuError;
17
18/// Convenience Result type for Aptu operations.
19///
20/// This is equivalent to `std::result::Result<T, AptuError>`.
21pub type Result<T> = std::result::Result<T, AptuError>;
22
23// ============================================================================
24// Configuration
25// ============================================================================
26
27pub use config::{
28 AiConfig, AppConfig, CacheConfig, GitHubConfig, TaskType, UiConfig, UserConfig, config_dir,
29 config_file_path, data_dir, load_config, prompts_dir,
30};
31
32// ============================================================================
33// Caching
34// ============================================================================
35
36pub use cache::{CacheEntry, FileCache, FileCacheImpl};
37
38// ============================================================================
39// AI Triage
40// ============================================================================
41
42pub use ai::types::{
43 IssueComment, IssueDetails, PrDetails, PrFile, PrReviewResponse, ReviewEvent, TriageResponse,
44};
45pub use ai::{AiClient, AiModel, ModelProvider, ProviderConfig, all_providers, get_provider};
46
47// ============================================================================
48// GitHub Integration
49// ============================================================================
50
51pub use github::auth::TokenSource;
52pub use github::graphql::IssueNode;
53pub use github::ratelimit::{RateLimitStatus, check_rate_limit};
54pub use octocrab::params::State;
55
56// ============================================================================
57// AI Integration
58// ============================================================================
59
60pub use ai::types::CreditsStatus;
61
62// ============================================================================
63// History Tracking
64// ============================================================================
65
66pub use history::{AiStats, Contribution, ContributionStatus, HistoryData};
67
68// ============================================================================
69// Repository Discovery
70// ============================================================================
71
72pub use repos::discovery::{DiscoveredRepo, DiscoveryFilter, search_repositories};
73pub use repos::{CuratedRepo, RepoFilter};
74
75// ============================================================================
76// Triage Detection
77// ============================================================================
78
79pub use triage::{
80 APTU_SIGNATURE, TriageStatus, check_already_triaged, render_pr_review_comment_body,
81 render_pr_review_markdown, render_triage_markdown,
82};
83
84// ============================================================================
85// Retry Logic
86// ============================================================================
87
88pub use retry::{is_retryable_anyhow, is_retryable_http, retry_backoff};
89
90// ============================================================================
91// Bulk Processing
92// ============================================================================
93
94pub use bulk::{BulkOutcome, BulkResult, process_bulk};
95
96// ============================================================================
97// Utilities
98// ============================================================================
99
100pub use utils::{
101 format_relative_time, infer_repo_from_git, is_priority_label, parse_and_format_relative_time,
102 truncate, truncate_with_suffix,
103};
104
105// ============================================================================
106// Platform-Agnostic Facade
107// ============================================================================
108
109pub use facade::{
110 add_custom_repo, analyze_issue, analyze_pr, apply_triage_labels, create_pr, discover_repos,
111 fetch_issue_for_triage, fetch_issues, fetch_pr_for_review, format_issue, label_pr,
112 list_curated_repos, list_models, list_repos, post_issue, post_pr_review, post_triage_comment,
113 remove_custom_repo, validate_model,
114};
115pub use github::issues::ApplyResult;
116pub use github::pulls::PrCreateResult;
117
118// ============================================================================
119// Security Scanning
120// ============================================================================
121
122pub use security::{
123 Confidence, Finding, FindingCache, PatternEngine, SarifReport, SecurityConfig, SecurityScanner,
124 Severity, needs_security_scan,
125};
126
127// ============================================================================
128// Modules
129// ============================================================================
130
131pub mod ai;
132#[cfg(feature = "ast-context")]
133pub mod ast_context;
134pub mod auth;
135pub mod bulk;
136pub mod cache;
137pub mod config;
138pub mod error;
139pub mod facade;
140/// Git utilities: patch application, branch management, and version gating.
141pub mod git;
142pub mod github;
143pub mod history;
144pub mod repos;
145pub mod retry;
146pub mod security;
147pub mod triage;
148pub mod utils;
149
150pub use git::patch::{PatchError, PatchStep, apply_patch_and_push};