| 1 | namespace AgentForge.Abstractions; |
| 2 | |
| 3 | /// <summary>DOI slash/MCP command metadata (FORGE-ADR-0015 §3).</summary> |
| 4 | public sealed class ForgeCommandDescriptor |
| 5 | { |
| 6 | public required string Domain { get; init; } |
| 7 | |
| 8 | public required string Object { get; init; } |
| 9 | |
| 10 | public required string Intent { get; init; } |
| 11 | |
| 12 | public required string CommandId { get; init; } |
| 13 | |
| 14 | /// <summary>Web-default slash path, e.g. <c>/issue open</c>.</summary> |
| 15 | public required string Path { get; init; } |
| 16 | |
| 17 | public IReadOnlyList<string> PathAliases { get; init; } = []; |
| 18 | |
| 19 | public string? Help { get; init; } |
| 20 | |
| 21 | public string? Category { get; init; } |
| 22 | |
| 23 | /// <summary>required | optional | picker:…</summary> |
| 24 | public string ArgTail { get; init; } = "optional"; |
| 25 | |
| 26 | public IReadOnlyList<string> Surfaces { get; init; } = ["command-bar", "global"]; |
| 27 | |
| 28 | public IReadOnlyList<string> RequiredCapabilities { get; init; } = []; |
| 29 | |
| 30 | public string Tier { get; init; } = "core"; |
| 31 | |
| 32 | /// <summary>Plugin that registered this command (host merge metadata).</summary> |
| 33 | public string? PluginId { get; init; } |
| 34 | |
| 35 | public ForgeCommandBindings Bindings { get; init; } = new(); |
| 36 | } |
| 37 | |
| 38 | public sealed class ForgeCommandBindings |
| 39 | { |
| 40 | public string? Mcp { get; init; } |
| 41 | |
| 42 | public string? View { get; init; } |
| 43 | |
| 44 | public ForgeCommandRestBinding? Rest { get; init; } |
| 45 | } |
| 46 | |
| 47 | public sealed class ForgeCommandRestBinding |
| 48 | { |
| 49 | public required string Method { get; init; } |
| 50 | |
| 51 | public required string Template { get; init; } |
| 52 | } |
| 53 | |
| 54 | public sealed class ForgeCommandExecuteRequest |
| 55 | { |
| 56 | public string? Path { get; init; } |
| 57 | |
| 58 | public string? CommandId { get; init; } |
| 59 | |
| 60 | /// <summary>Natural-language / numeric tail after the slash path.</summary> |
| 61 | public string? Args { get; init; } |
| 62 | |
| 63 | public IReadOnlyDictionary<string, string>? Context { get; init; } |
| 64 | } |
| 65 | |
| 66 | public sealed class ForgeCommandExecuteResponse |
| 67 | { |
| 68 | public required string Kind { get; init; } |
| 69 | |
| 70 | public string? RedirectUrl { get; init; } |
| 71 | |
| 72 | public object? Body { get; init; } |
| 73 | |
| 74 | public string? Error { get; init; } |
| 75 | |
| 76 | public static ForgeCommandExecuteResponse Redirect(string url) => |
| 77 | new() { Kind = "redirect", RedirectUrl = url }; |
| 78 | |
| 79 | public static ForgeCommandExecuteResponse Json(object body) => |
| 80 | new() { Kind = "json", Body = body }; |
| 81 | |
| 82 | public static ForgeCommandExecuteResponse Fail(string message) => |
| 83 | new() { Kind = "error", Error = message }; |
| 84 | } |
| 85 | |