"""
hai-sh: AI-powered terminal assistant

A context-aware wrapper around bash that enables natural language
command generation and execution via LLM assistance.
"""

from hai_sh.config import (
    ConfigError,
    ConfigLoadError,
    load_config,
)
from hai_sh.context import (
    format_cwd_context,
    format_env_context,
    format_git_context,
    get_cwd_context,
    get_directory_info,
    get_env_context,
    get_git_context,
    get_safe_env_vars,
    is_sensitive_env_var,
)
from hai_sh.providers import (
    AnthropicProvider,
    BaseLLMProvider,
    OllamaProvider,
    OpenAIProvider,
    ProviderRegistry,
    get_provider,
    list_providers,
    register_provider,
)
from hai_sh.init import (
    get_config_path,
    get_hai_dir,
    init_hai_directory,
    verify_hai_directory,
)
from hai_sh.prompt import (
    build_system_prompt,
    extract_fallback_response,
    format_command_output,
    generate_with_retry,
    parse_response,
    validate_command,
    validate_response_fields,
)
from hai_sh.input_detector import (
    extract_query,
    get_prefix_variants,
    is_hai_input,
    normalize_input,
    parse_hai_input,
    validate_query,
)
from hai_sh.executor import (
    CommandExecutionError,
    CommandInterruptedError,
    CommandTimeoutError,
    ExecutionResult,
    check_command_exists,
    execute_command,
    execute_interactive,
    execute_pipeline,
    get_command_path,
    get_shell_info,
    validate_shell_syntax,
)
from hai_sh.output import (
    colorize_text,
    format_result_for_display,
    get_color_mode,
    get_visible_length,
    has_ansi_codes,
    is_tty,
    preserve_ansi_codes,
    should_use_color,
    stream_output,
    strip_ansi_codes,
    truncate_output,
)
from hai_sh.formatter import (
    format_command_prompt,
    format_confidence,
    format_conversation_layer,
    format_conversation_only,
    format_dual_layer,
    format_execution_layer,
    format_execution_only,
    format_execution_result,
    format_execution_status,
    strip_formatting,
)
from hai_sh.rate_limit import (
    RateLimiter,
    check_rate_limit,
    get_rate_limiter,
    get_remaining_calls,
    reset_rate_limit,
)
from hai_sh.redaction import (
    redact_sensitive_output,
    should_redact_output,
)
from hai_sh.privacy import (
    check_privacy_risks,
    get_privacy_recommendations,
    validate_privacy_config,
    warn_privacy_risks,
)

__version__ = "0.1.0"
__all__ = [
    "__version__",
    "get_hai_dir",
    "get_config_path",
    "init_hai_directory",
    "verify_hai_directory",
    "load_config",
    "ConfigError",
    "ConfigLoadError",
    "get_cwd_context",
    "get_directory_info",
    "format_cwd_context",
    "get_git_context",
    "format_git_context",
    "get_env_context",
    "format_env_context",
    "is_sensitive_env_var",
    "get_safe_env_vars",
    "AnthropicProvider",
    "BaseLLMProvider",
    "OllamaProvider",
    "OpenAIProvider",
    "ProviderRegistry",
    "get_provider",
    "register_provider",
    "list_providers",
    "build_system_prompt",
    "parse_response",
    "validate_command",
    "format_command_output",
    "generate_with_retry",
    "extract_fallback_response",
    "validate_response_fields",
    "is_hai_input",
    "extract_query",
    "parse_hai_input",
    "normalize_input",
    "get_prefix_variants",
    "validate_query",
    "CommandExecutionError",
    "CommandInterruptedError",
    "CommandTimeoutError",
    "ExecutionResult",
    "execute_command",
    "execute_interactive",
    "execute_pipeline",
    "check_command_exists",
    "get_command_path",
    "validate_shell_syntax",
    "get_shell_info",
    "has_ansi_codes",
    "strip_ansi_codes",
    "preserve_ansi_codes",
    "truncate_output",
    "format_result_for_display",
    "stream_output",
    "colorize_text",
    "get_visible_length",
    "is_tty",
    "should_use_color",
    "get_color_mode",
    "format_conversation_layer",
    "format_execution_layer",
    "format_command_prompt",
    "format_execution_result",
    "format_execution_status",
    "format_confidence",
    "format_dual_layer",
    "format_conversation_only",
    "format_execution_only",
    "strip_formatting",
    # Security modules
    "RateLimiter",
    "check_rate_limit",
    "get_rate_limiter",
    "get_remaining_calls",
    "reset_rate_limit",
    "redact_sensitive_output",
    "should_redact_output",
    "check_privacy_risks",
    "get_privacy_recommendations",
    "validate_privacy_config",
    "warn_privacy_risks",
]
