hindsight_copilot/lib.rs
1// Copyright (c) 2026 - present Nicholas D. Crosbie
2// SPDX-License-Identifier: MIT
3
4//! hindsight-copilot: GitHub Copilot log processing for hindsight-mcp
5//!
6//! This library crate provides functionality to parse and process GitHub Copilot
7//! logs and chat sessions for consumption by the hindsight-mcp server.
8
9#![warn(missing_docs)]
10
11//! ## Log Locations
12//!
13//! VS Code stores Copilot chat history in local SQLite databases and JSON files:
14//! - **macOS:** `~/Library/Application Support/Code/User/workspaceStorage/<workspace-id>/chatSessions/`
15//! - **Windows:** `%APPDATA%\Code\User\workspaceStorage\<workspace-id>\chatSessions\`
16//! - **Linux:** `~/.config/Code/User/workspaceStorage/<workspace-id>/chatSessions/`
17//!
18//! ## Log Format
19//!
20//! Copilot logs follow JSON Stream / LSP Trace format when log level is set to `Trace`.
21//!
22//! ## Session Discovery
23//!
24//! Use [`SessionDiscovery`] to find chat sessions across all workspaces:
25//!
26//! ```rust,no_run
27//! use hindsight_copilot::session::{SessionDiscovery, parse_session_file};
28//!
29//! let discovery = SessionDiscovery::new().expect("find storage");
30//! for session in discovery.discover_sessions().expect("enumerate") {
31//! let parsed = parse_session_file(&session.path, &session.workspace_storage_id);
32//! println!("{:?}", parsed);
33//! }
34//! ```
35
36pub mod error;
37pub mod lsp;
38pub mod parser;
39pub mod session;
40
41pub use error::CopilotError;
42
43// Re-export session discovery types at crate level for convenience
44pub use session::{
45 ChatMessage, ChatSession, DiscoveredSession, MessageRole, SessionDiscovery, Variable,
46 WorkspaceInfo, default_chat_sessions_dir, parse_session_file, parse_session_json,
47};
48
49/// Re-export commonly used types
50pub mod prelude {
51 pub use crate::error::CopilotError;
52 pub use crate::session::{
53 ChatMessage, ChatSession, DiscoveredSession, MessageRole, SessionDiscovery, Variable,
54 WorkspaceInfo,
55 };
56}