Forge
csharpdeeb25a2
1#nullable enable
2
3using CascadeIDE.Contracts.Experimental;
4using CascadeIDE.Features.Forge.Mcp;
5
6namespace CascadeIDE.Features.Forge;
7
8/// <summary>Forge vertical module — single registration site (ADR 0161 F4).</summary>
9public sealed class ForgeFeatureModule : ICascadeFeatureModule
10{
11 public static ForgeFeatureModule Instance { get; } = new();
12
13 public string Id => "forge";
14
15 /// <inheritdoc />
16 public void Register(ICapabilityRegistry registry)
17 {
18 registry.RegisterMcpHandlers(registrar =>
19 {
20 if (_pendingMcpHost is null)
21 throw new InvalidOperationException("Forge MCP host context must be bound before Register.");
22 ForgeMcpHandlers.Register(_pendingMcpHost, registrar);
23 });
24 }
25
26 private ForgeMcpHostContext? _pendingMcpHost;
27
28 /// <summary>Binds executor context; call before iterating <see cref="CascadeFeatureModules.All"/>.</summary>
29 internal void BindMcpHost(ForgeMcpHostContext context) => _pendingMcpHost = context;
30
31 /// <summary>Direct MCP registration used by spine executor (same handlers as <see cref="Register"/>).</summary>
32 internal void RegisterMcpHandlers(ForgeMcpHostContext context, IMcpHandlerRegistrar registrar) =>
33 ForgeMcpHandlers.Register(context, registrar);
34}
35
View only · write via MCP/CIDE