pub mod db;
pub mod edit_check;
pub mod formatters;
pub mod models;
pub mod ops;
pub mod queries;
pub mod reference_report;
pub mod slicer;
pub mod sync;
pub mod telemetry;
pub mod test_commands;
pub mod text_scan;
pub mod watcher;
pub mod workspace;
pub use db::{
Connection, DbError, ensure_fts_index, ensure_fts_index_path, open_read_only, open_read_write,
};
pub use edit_check::{
BaseRequest, BaseSource, BlockedSite, EditCheck, EditCheckError, EditLimits, EditSite,
PendingCheck, SessionLock, SessionState, ShapeChange, any_site_edited, head_commit,
is_session_id, latest_session_base, lock_session, mark_sites, prune_sessions, read_session,
record_session_base, write_session,
};
pub use formatters::{
STOP_SITES_LISTED, format_blast_radius, format_context_slice, format_context_slices,
format_edit_check, format_fact_categories, format_file_skeleton, format_find_symbol_results,
format_import_summary, format_no_facts, format_reference_report, format_references,
format_search_results, format_stop_reason, format_structural_facts, format_symbol_bodies,
format_symbol_body, no_facts_heading, stop_sites,
};
pub use models::{
BlastRadiusResult, CallingTest, ConstructionSite, ContextSlice, FileFact, ImpactedSymbol,
LabeledSite, LiteralFact, OverrideRow, ReferenceCounts, ReferenceReport, ReferenceSite,
ReferenceTarget, Registration, SearchExplain, SiteLabel, StructuralFact, Symbol,
SymbolSearchResult, TestTarget, TextOnlyLines, TextScanSummary, TypeFact, VariantUse,
};
pub use ops::{
OpError, SymbolLookup, SymbolSelector, blast_radius_op, blast_radius_selected_op,
codebase_outline_op, edit_check_op, edit_check_session_diff, edit_check_session_op,
edit_check_with, file_skeleton_op, get_context_slice_op, get_context_slice_selected_op,
get_context_slices_selected_op, get_symbol_bodies_selected_op, get_symbol_body_op,
get_symbol_body_selected_op, lookup_symbols_op, render_symbol_lookup, resolve_symbol_op,
};
pub use queries::{
QueryError, compute_blast_radius, compute_blast_radius_scoped,
compute_blast_radius_scoped_with_ids, count_file_symbols, file_sizes_for_paths,
find_callee_signatures, find_literals, find_literals_scoped, find_references,
find_references_ext, find_references_for_symbol, find_references_for_symbol_ext,
find_references_scoped, find_related_tests, find_structural_facts,
find_structural_facts_scoped, find_type_facts, fts_search_symbols_explained,
fts_search_symbols_scoped, get_file, get_symbol_by_id, get_symbol_by_name,
get_symbol_by_name_exact, get_symbol_overloads, import_sites, is_category_alias, is_test_path,
list_structural_fact_categories, list_structural_fact_categories_scoped, load_file_symbols,
load_scoped_outline_symbols, normalize_kind, qualify_members, sanitize_fts5_query,
search_symbols, search_symbols_scoped, suggest_file_paths, suggest_symbol_names,
workspace_name,
};
pub use reference_report::{reference_report, reference_report_for_edit, select_reference_target};
pub use slicer::{SliceError, slice_symbol, slice_symbol_body};
pub use sync::{
PINNED_JULIE_VERSION, ReconcileReport, SyncError, create_index, delete_file, ensure_fresh_file,
ensure_index_matches_extractor, find_julie_extract_binary, index_written_by_other_extractor,
installed_extractor_version, reconcile_offline_edits, scan_workspace, update_file,
};
pub use telemetry::{
BugReportBundle, IndexFacts, TelemetryErrorRecord, TelemetryFilter, TelemetrySummary,
TimeWindow, ToolInvocation, ToolStat, format_telemetry_summary, generate_bug_report,
get_global_telemetry_dir, get_telemetry_summary, open_global_telemetry_db, open_telemetry_db,
record_hook_check, record_hook_followed, record_tool_call, record_tool_call_conn,
};
pub use text_scan::{WordHits, scan_word};
pub use watcher::{WatcherError, WatcherHandle, start_watcher};
pub use workspace::{
Workspace, WorkspaceError, is_hard_excluded, is_project_root, normalize_path, parse_file_uri,
strip_prefix_lossy, to_forward_slash,
};
pub fn safe_tempdir() -> tempfile::TempDir {
if let Ok(target_tmp) = std::env::var("CARGO_TARGET_TMPDIR") {
let path = std::path::PathBuf::from(&target_tmp);
if (path.exists() || std::fs::create_dir_all(&path).is_ok())
&& let Ok(dir) = tempfile::TempDir::new_in(&path)
{
return dir;
}
}
if let Ok(tmp) = std::env::var("TMPDIR") {
let path = std::path::PathBuf::from(tmp);
if (path.exists() || std::fs::create_dir_all(&path).is_ok())
&& let Ok(dir) = tempfile::TempDir::new_in(&path)
{
return dir;
}
}
let mut search_dirs = Vec::new();
if let Ok(manifest_dir) = std::env::var("CARGO_MANIFEST_DIR") {
search_dirs.push(std::path::PathBuf::from(manifest_dir));
}
if let Ok(cwd) = std::env::current_dir() {
search_dirs.push(cwd);
}
for base in search_dirs {
let mut cur = base;
loop {
let candidate = cur.join("target/tmp");
if (cur.join("Cargo.toml").exists() || cur.join(".git").exists())
&& (candidate.exists() || std::fs::create_dir_all(&candidate).is_ok())
&& let Ok(dir) = tempfile::TempDir::new_in(&candidate)
{
return dir;
}
if !cur.pop() {
break;
}
}
}
tempfile::tempdir().expect("failed to create temporary directory")
}