Skip to main content

get_current_session_id

Function get_current_session_id 

Source
pub fn get_current_session_id() -> Result<String>
Expand description

Get the session ID for the current working directory.

This function determines the appropriate session ID based on the current location:

  • If in the main repository: returns the well-known “main” session ID
  • If in a linked worktree: returns a hash-based ID from the worktree path

§Returns

  • Ok(String) - The session ID for the current directory
  • Err - If not in a git repository

§Example

use autom8::worktree::get_current_session_id;

let session_id = get_current_session_id().expect("Not in a git repo");
println!("Session ID: {}", session_id);