| 1 | using AgentForge.Abstractions; |
| 2 | using AgentForge.Plugin.MergeRequest.Endpoints; |
| 3 | using AgentForge.Services; |
| 4 | using Microsoft.Extensions.Configuration; |
| 5 | using Microsoft.Extensions.DependencyInjection; |
| 6 | namespace AgentForge.Plugin.MergeRequest; |
| 7 | |
| 8 | public sealed class MergeRequestForgePlugin : IForgePlugin |
| 9 | { |
| 10 | public string Id => "merge-request"; |
| 11 | |
| 12 | public string DisplayName => "Merge requests and CI"; |
| 13 | |
| 14 | public void ConfigureServices(IServiceCollection services, IConfiguration configuration) => |
| 15 | services.AddScoped<MergeRequestService>(); |
| 16 | |
| 17 | public void MapEndpoints(WebApplication app) |
| 18 | { |
| 19 | var api = app.MapGroup("/api/v1"); |
| 20 | api.MapMergeRequestEndpoints(); |
| 21 | ForgeMergeRequestViewEndpoints.Map(app); |
| 22 | } |
| 23 | |
| 24 | public void RegisterFeatures(ForgeFeatureRegistry registry) => |
| 25 | registry.Add("merge_requests"); |
| 26 | |
| 27 | public void RegisterMcpTools(ForgeMcpToolRegistry registry) => |
| 28 | ForgeMergeRequestMcpTools.Register(registry); |
| 29 | |
| 30 | public void RegisterCommands(ForgeCommandRegistry registry) |
| 31 | { |
| 32 | ForgeMergeRequestCommandRegistration.Register(registry); |
| 33 | ForgeHandoffCommandRegistration.Register(registry); |
| 34 | } |
| 35 | |
| 36 | public void RegisterViewContributors(ForgeViewContributorRegistry registry) => |
| 37 | ForgeMergeRequestViewRegistration.RegisterContributors(registry); |
| 38 | |
| 39 | public void RegisterRepoTabBodies(ForgeRepoTabBodyRegistry registry) => |
| 40 | ForgeMergeRequestTabBodyRegistration.Register(registry); |
| 41 | |
| 42 | public void ApplyMigrations(IForgeMigrationContext context) => |
| 43 | ForgeMergeRequestSchemaBootstrap.Apply(context); |
| 44 | } |
| 45 | |