Skip to main content

Module common

Module common 

Source
Expand description

Common utility functions shared across command modules

This module provides helper functions that were previously duplicated across multiple command modules (find_cmd, query_cmd, refs_cmd, get_cmd).

Functionsยง

detect_language_from_path
Detect programming language from file path extension
detect_project_root
Detect the project root directory from the current working directory
extract_context_safe
Safely extract context lines from source bytes around a byte span
extract_symbol_content_safe
Safely extract symbol content from source bytes, handling multi-byte UTF-8 boundaries
find_repo_root
Find repository root by looking for .git directory
format_symbol_kind
Format a SymbolKind for display
magellan_dir
Get or create .magellan directory in repo root
normalize_repo_relative_path
Normalize a source file path relative to a repository root when possible.
parse_symbol_kind
Parse a string into a SymbolKind (case-insensitive)
resolve_path
Resolve a file path against an optional root directory
safe_slice
Safely extract a byte slice from source with bounds checking
safe_str_slice
Safely extract a UTF-8 string slice with bounds checking