using System; namespace StellaOps.Cli.Services; /// /// Guard for operations that require network connectivity. /// Stub implementation - will be wired to actual offline mode detection. /// internal static class OfflineModeGuard { /// /// Gets whether the CLI is currently in offline mode. /// public static bool IsOffline { get; set; } /// /// Gets whether network operations are allowed. /// public static bool IsNetworkAllowed() => !IsOffline; /// /// Gets whether network operations are allowed, checking options and logging operation. /// /// CLI options (used to check offline mode setting). /// Name of the operation being checked. public static bool IsNetworkAllowed(object? options, string operationName) => !IsOffline; /// /// Throws if the CLI is in offline mode and the operation requires network. /// /// Name of the operation being guarded. /// Thrown when offline and network required. public static void ThrowIfOffline(string operationName) { if (IsOffline) { throw new InvalidOperationException( $"Operation '{operationName}' requires network connectivity but CLI is in offline mode."); } } }