| 1 | namespace AgentForge.Abstractions; |
| 2 | |
| 3 | /// <summary>Context for domain plugin repo tab list/detail bodies (FORGE-ADR-0015 Phase B).</summary> |
| 4 | public sealed class ForgeRepoTabBodyContext |
| 5 | { |
| 6 | public required string RepoName { get; init; } |
| 7 | |
| 8 | public required string RepoId { get; init; } |
| 9 | |
| 10 | public required IServiceProvider Services { get; init; } |
| 11 | } |
| 12 | |
| 13 | public delegate string ForgeRepoTabBodyRenderer(ForgeRepoTabBodyContext context); |
| 14 | |
| 15 | public sealed class ForgeRepoTabBodyRegistry |
| 16 | { |
| 17 | private readonly Dictionary<string, ForgeRepoTabBodyRenderer> _renderers = |
| 18 | new(StringComparer.OrdinalIgnoreCase); |
| 19 | |
| 20 | public void Add(string tabId, ForgeRepoTabBodyRenderer renderer) |
| 21 | { |
| 22 | ArgumentException.ThrowIfNullOrWhiteSpace(tabId); |
| 23 | ArgumentNullException.ThrowIfNull(renderer); |
| 24 | var key = tabId.Trim(); |
| 25 | if (!_renderers.TryAdd(key, renderer)) |
| 26 | throw new InvalidOperationException($"Duplicate repo tab body '{key}'."); |
| 27 | } |
| 28 | |
| 29 | public IReadOnlyDictionary<string, ForgeRepoTabBodyRenderer> Renderers => _renderers; |
| 30 | } |
| 31 | |
| 32 | public interface IForgeRepoTabBodyCatalog |
| 33 | { |
| 34 | bool TryRender(string tabId, ForgeRepoTabBodyContext context, out string html); |
| 35 | } |
| 36 | |
View only · write via MCP/CIDE