From 08547ccaad69597cf999742911eecab483836f9c Mon Sep 17 00:00:00 2001 From: waldekmastykarz Date: Sat, 7 Feb 2026 11:47:52 +0100 Subject: [PATCH] Add IsStdioMode property and update plugin URL validation logic. Closes #1519 --- DevProxy/Commands/DevProxyConfigOptions.cs | 1 + DevProxy/Plugins/PluginServiceExtensions.cs | 20 ++++++++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/DevProxy/Commands/DevProxyConfigOptions.cs b/DevProxy/Commands/DevProxyConfigOptions.cs index 7b0264b3..a12577cb 100644 --- a/DevProxy/Commands/DevProxyConfigOptions.cs +++ b/DevProxy/Commands/DevProxyConfigOptions.cs @@ -20,6 +20,7 @@ public string? ConfigFile public int? ApiPort => _parseResult?.GetValueOrDefault(DevProxyCommand.ApiPortOptionName); public bool Discover => _parseResult?.GetValueOrDefault(DevProxyCommand.DiscoverOptionName) ?? false; public string? IPAddress => _parseResult?.GetValueOrDefault(DevProxyCommand.IpAddressOptionName); + public bool IsStdioMode => _parseResult?.CommandResult.Command.Name == "stdio"; public LogLevel? LogLevel => _parseResult?.GetValueOrDefault(DevProxyCommand.LogLevelOptionName); public List? UrlsToWatch diff --git a/DevProxy/Plugins/PluginServiceExtensions.cs b/DevProxy/Plugins/PluginServiceExtensions.cs index 44feb824..12afa104 100644 --- a/DevProxy/Plugins/PluginServiceExtensions.cs +++ b/DevProxy/Plugins/PluginServiceExtensions.cs @@ -125,7 +125,8 @@ public static IServiceCollection AddPlugins( assembly, configuration, services, - logger); + logger, + options.IsStdioMode); } catch (Exception ex) { @@ -149,14 +150,9 @@ private static void RegisterPlugin( Assembly assembly, IConfiguration configuration, IServiceCollection services, - ILogger logger) + ILogger logger, + bool isStdioMode) { - if (urlsToWatch.Count == 0) - { - logger.LogError("Plugin {PluginName} must have at least one URL to watch. Please add a URL to watch in the configuration file or use the --urls-to-watch option.", pluginRef.Name); - return; - } - var pluginType = assembly.GetTypes() .FirstOrDefault(t => t.Name == pluginRef.Name && typeof(IPlugin).IsAssignableFrom(t)); if (pluginType is null) @@ -165,6 +161,14 @@ private static void RegisterPlugin( return; } + // In stdio mode, plugins don't need URLs to watch because they + // communicate through STDIO (JSON-RPC) rather than HTTP + if (urlsToWatch.Count == 0 && !isStdioMode) + { + logger.LogError("Plugin {PluginName} must have at least one URL to watch. Please add a URL to watch in the configuration file or use the --urls-to-watch option.", pluginRef.Name); + return; + } + var isConfigurable = IsConfigurablePlugin(pluginType, out var configType); if (!isConfigurable || configType is null)