/* ┌──────────────────────────────────────────────────────────────────┐ │ Author: Ivan Murzak (https://github.com/IvanMurzak) │ │ Repository: GitHub (https://github.com/IvanMurzak/Unity-MCP) │ │ Copyright (c) 2025 Ivan Murzak │ │ Licensed under the Apache License, Version 2.0. │ │ See the LICENSE file in the project root for more information. │ └──────────────────────────────────────────────────────────────────┘ */ #nullable enable using System.Collections.Generic; using System.Linq; namespace com.IvanMurzak.Unity.MCP.Editor.UI { /// /// Registry for all AI agent configurators. /// Provides access to configurators by agent ID or name. /// public static class AiAgentConfiguratorRegistry { private static readonly List _configurators = new AiAgentConfigurator[] { new ClaudeCodeConfigurator(), new ClaudeDesktopConfigurator(), new VisualStudioCodeCopilotConfigurator(), new VisualStudioCopilotConfigurator(), new RiderConfigurator(), new CursorConfigurator(), new GitHubCopilotCliConfigurator(), new GeminiConfigurator(), new AntigravityConfigurator(), new ClineConfigurator(), new OpenCodeConfigurator(), new CodexConfigurator(), new KiloCodeConfigurator(), new UnityAiConfigurator(), new ZooCodeConfigurator(), } .OrderBy(c => c.AgentName) .Append(new CustomConfigurator()) // Ensure CustomConfigurator is always last .ToList(); /// /// Gets all registered configurators. /// public static IReadOnlyList All => _configurators; /// /// Gets all agent names for use in dropdown. /// public static List GetAgentNames() => _configurators.Select(c => c.AgentName).ToList(); /// /// Gets all agent IDs. /// public static List GetAgentIds() => _configurators.Select(c => c.AgentId).ToList(); /// /// Gets a configurator by its agent ID. /// /// The agent ID to search for. /// The configurator if found, null otherwise. public static AiAgentConfigurator? GetByAgentId(string? agentId) { if (string.IsNullOrEmpty(agentId)) return null; return _configurators.FirstOrDefault(c => c.AgentId == agentId); } /// /// Gets a configurator by its agent name. /// /// The agent name to search for. /// The configurator if found, null otherwise. public static AiAgentConfigurator? GetByAgentName(string? agentName) { if (string.IsNullOrEmpty(agentName)) return null; return _configurators.FirstOrDefault(c => c.AgentName == agentName); } /// /// Gets the index of a configurator by its agent ID. /// /// The agent ID to search for. /// The index if found, -1 otherwise. public static int GetIndexByAgentId(string? agentId) { if (string.IsNullOrEmpty(agentId)) return -1; for (int i = 0; i < _configurators.Count; i++) { if (_configurators[i].AgentId == agentId) return i; } return -1; } /// /// Gets the index of a configurator by its agent name. /// /// The agent name to search for. /// The index if found, -1 otherwise. public static int GetIndexByAgentName(string? agentName) { if (string.IsNullOrEmpty(agentName)) return -1; for (int i = 0; i < _configurators.Count; i++) { if (_configurators[i].AgentName == agentName) return i; } return -1; } } }