| 1 | // <auto-generated/> |
| 2 | // Source: IntentMelody/intent-catalog.toml — do not edit. |
| 3 | using System; |
| 4 | using System.Collections.Frozen; |
| 5 | using System.Collections.Generic; |
| 6 | using System.Linq; |
| 7 | |
| 8 | namespace CascadeIDE.Services; |
| 9 | |
| 10 | /// <summary>Codegen trie index: все slash <c>path</c> из intent-catalog (ADR 0150).</summary> |
| 11 | internal static class SlashRouteCatalogPathsGenerated |
| 12 | { |
| 13 | /// <summary>Канонические пути, longest-first (longest-prefix match).</summary> |
| 14 | public static readonly string[] PathsLongestFirst = |
| 15 | [ |
| 16 | "/intercom message anchors list", |
| 17 | "/intercom message select clear", |
| 18 | "/intercom attach selection", |
| 19 | "/intercom agent provision", |
| 20 | "/intercom topic list text", |
| 21 | "/intercom topic tree text", |
| 22 | "/workspace splitters-lock", |
| 23 | "/intercom message relate", |
| 24 | "/intercom message select", |
| 25 | "/instrumentation toggle", |
| 26 | "/intercom server status", |
| 27 | "/map cycle presentation", |
| 28 | "/solution explorer show", |
| 29 | "/intercom agent select", |
| 30 | "/intercom attach scope", |
| 31 | "/intercom message find", |
| 32 | "/intercom message next", |
| 33 | "/intercom message prev", |
| 34 | "/intercom server start", |
| 35 | "/intercom spine toggle", |
| 36 | "/intercom team members", |
| 37 | "/intercom topic create", |
| 38 | "/intercom topic rename", |
| 39 | "/solution new classlib", |
| 40 | "/cockpit command line", |
| 41 | "/editor layout single", |
| 42 | "/editor layout triple", |
| 43 | "/intercom anchor peek", |
| 44 | "/intercom attach file", |
| 45 | "/intercom sedm detail", |
| 46 | "/intercom server stop", |
| 47 | "/intercom team invite", |
| 48 | "/intercom topic cards", |
| 49 | "/map type controlflow", |
| 50 | "/solution new console", |
| 51 | "/correspondence show", |
| 52 | "/intercom agent list", |
| 53 | "/intercom sedm scope", |
| 54 | "/intercom spine list", |
| 55 | "/intercom spine open", |
| 56 | "/intercom spine show", |
| 57 | "/intercom spine tree", |
| 58 | "/intercom topic list", |
| 59 | "/intercom topic next", |
| 60 | "/intercom topic open", |
| 61 | "/intercom topic prev", |
| 62 | "/intercom topic tree", |
| 63 | "/solution new webapi", |
| 64 | "/editor layout dual", |
| 65 | "/editor line delete", |
| 66 | "/editor line select", |
| 67 | "/editor reveal code", |
| 68 | "/editor select code", |
| 69 | "/intercom sedm show", |
| 70 | "/intercom spine set", |
| 71 | "/intercom team seed", |
| 72 | "/git preflight-fix", |
| 73 | "/intercom overview", |
| 74 | "/repository toggle", |
| 75 | "/build structured", |
| 76 | "/diagnostics show", |
| 77 | "/ide options show", |
| 78 | "/map cycle detail", |
| 79 | "/map cycle layout", |
| 80 | "/debug step-into", |
| 81 | "/debug step-over", |
| 82 | "/map cycle level", |
| 83 | "/repository show", |
| 84 | "/debug continue", |
| 85 | "/debug step-out", |
| 86 | "/readiness show", |
| 87 | "/workspace show", |
| 88 | "/agent sandbox", |
| 89 | "/git preflight", |
| 90 | "/git submodule", |
| 91 | "/intercom show", |
| 92 | "/map type file", |
| 93 | "/output toggle", |
| 94 | "/problems show", |
| 95 | "/settings show", |
| 96 | "/solution load", |
| 97 | "/solution open", |
| 98 | "/terminal show", |
| 99 | "/test affected", |
| 100 | "/agent cancel", |
| 101 | "/agent status", |
| 102 | "/agent verify", |
| 103 | "/debug attach", |
| 104 | "/debug launch", |
| 105 | "/editor focus", |
| 106 | "/editor panel", |
| 107 | "/preview show", |
| 108 | "/related show", |
| 109 | "/solution new", |
| 110 | "/anchor peek", |
| 111 | "/editor show", |
| 112 | "/events show", |
| 113 | "/folder open", |
| 114 | "/output hide", |
| 115 | "/output show", |
| 116 | "/portal open", |
| 117 | "/agent last", |
| 118 | "/debug show", |
| 119 | "/debug stop", |
| 120 | "/format run", |
| 121 | "/git branch", |
| 122 | "/git commit", |
| 123 | "/git status", |
| 124 | "/index show", |
| 125 | "/mfd toggle", |
| 126 | "/pfd toggle", |
| 127 | "/state show", |
| 128 | "/tests show", |
| 129 | "/build run", |
| 130 | "/chat send", |
| 131 | "/chat show", |
| 132 | "/file open", |
| 133 | "/file pick", |
| 134 | "/git fetch", |
| 135 | "/build ui", |
| 136 | "/git diff", |
| 137 | "/git pull", |
| 138 | "/git push", |
| 139 | "/pfd show", |
| 140 | "/test run", |
| 141 | "/git log", |
| 142 | "/export", |
| 143 | "/search", |
| 144 | "/help", |
| 145 | "/open", |
| 146 | ]; |
| 147 | |
| 148 | private static readonly FrozenSet<string> PathSet = |
| 149 | PathsLongestFirst.ToFrozenSet(StringComparer.OrdinalIgnoreCase); |
| 150 | |
| 151 | private static readonly FrozenDictionary<string, byte> ArgTailKindByPath = |
| 152 | new Dictionary<string, byte>(StringComparer.OrdinalIgnoreCase) |
| 153 | { |
| 154 | ["/agent cancel"] = 0, |
| 155 | ["/agent last"] = 0, |
| 156 | ["/agent sandbox"] = 1, |
| 157 | ["/agent status"] = 0, |
| 158 | ["/agent verify"] = 1, |
| 159 | ["/anchor peek"] = 2, |
| 160 | ["/build run"] = 0, |
| 161 | ["/build structured"] = 0, |
| 162 | ["/build ui"] = 0, |
| 163 | ["/chat send"] = 0, |
| 164 | ["/chat show"] = 0, |
| 165 | ["/cockpit command line"] = 0, |
| 166 | ["/correspondence show"] = 0, |
| 167 | ["/debug attach"] = 0, |
| 168 | ["/debug continue"] = 0, |
| 169 | ["/debug launch"] = 0, |
| 170 | ["/debug show"] = 0, |
| 171 | ["/debug step-into"] = 0, |
| 172 | ["/debug step-out"] = 0, |
| 173 | ["/debug step-over"] = 0, |
| 174 | ["/debug stop"] = 0, |
| 175 | ["/diagnostics show"] = 0, |
| 176 | ["/editor focus"] = 0, |
| 177 | ["/editor layout dual"] = 0, |
| 178 | ["/editor layout single"] = 0, |
| 179 | ["/editor layout triple"] = 0, |
| 180 | ["/editor line delete"] = 2, |
| 181 | ["/editor line select"] = 2, |
| 182 | ["/editor panel"] = 0, |
| 183 | ["/editor reveal code"] = 2, |
| 184 | ["/editor select code"] = 2, |
| 185 | ["/editor show"] = 0, |
| 186 | ["/events show"] = 0, |
| 187 | ["/export"] = 0, |
| 188 | ["/file open"] = 2, |
| 189 | ["/file pick"] = 0, |
| 190 | ["/folder open"] = 0, |
| 191 | ["/format run"] = 0, |
| 192 | ["/git branch"] = 0, |
| 193 | ["/git commit"] = 0, |
| 194 | ["/git diff"] = 0, |
| 195 | ["/git fetch"] = 0, |
| 196 | ["/git log"] = 0, |
| 197 | ["/git preflight"] = 0, |
| 198 | ["/git preflight-fix"] = 0, |
| 199 | ["/git pull"] = 0, |
| 200 | ["/git push"] = 0, |
| 201 | ["/git status"] = 0, |
| 202 | ["/git submodule"] = 0, |
| 203 | ["/help"] = 1, |
| 204 | ["/ide options show"] = 0, |
| 205 | ["/index show"] = 0, |
| 206 | ["/instrumentation toggle"] = 0, |
| 207 | ["/intercom agent list"] = 0, |
| 208 | ["/intercom agent provision"] = 2, |
| 209 | ["/intercom agent select"] = 2, |
| 210 | ["/intercom anchor peek"] = 2, |
| 211 | ["/intercom attach file"] = 2, |
| 212 | ["/intercom attach scope"] = 0, |
| 213 | ["/intercom attach selection"] = 0, |
| 214 | ["/intercom message anchors list"] = 0, |
| 215 | ["/intercom message find"] = 2, |
| 216 | ["/intercom message next"] = 0, |
| 217 | ["/intercom message prev"] = 0, |
| 218 | ["/intercom message relate"] = 2, |
| 219 | ["/intercom message select"] = 2, |
| 220 | ["/intercom message select clear"] = 0, |
| 221 | ["/intercom overview"] = 0, |
| 222 | ["/intercom sedm detail"] = 0, |
| 223 | ["/intercom sedm scope"] = 0, |
| 224 | ["/intercom sedm show"] = 0, |
| 225 | ["/intercom server start"] = 1, |
| 226 | ["/intercom server status"] = 0, |
| 227 | ["/intercom server stop"] = 0, |
| 228 | ["/intercom show"] = 0, |
| 229 | ["/intercom spine list"] = 0, |
| 230 | ["/intercom spine open"] = 1, |
| 231 | ["/intercom spine set"] = 2, |
| 232 | ["/intercom spine show"] = 0, |
| 233 | ["/intercom spine toggle"] = 0, |
| 234 | ["/intercom spine tree"] = 0, |
| 235 | ["/intercom team invite"] = 2, |
| 236 | ["/intercom team members"] = 0, |
| 237 | ["/intercom team seed"] = 2, |
| 238 | ["/intercom topic cards"] = 0, |
| 239 | ["/intercom topic create"] = 2, |
| 240 | ["/intercom topic list"] = 0, |
| 241 | ["/intercom topic list text"] = 0, |
| 242 | ["/intercom topic next"] = 0, |
| 243 | ["/intercom topic open"] = 1, |
| 244 | ["/intercom topic prev"] = 0, |
| 245 | ["/intercom topic rename"] = 2, |
| 246 | ["/intercom topic tree"] = 0, |
| 247 | ["/intercom topic tree text"] = 0, |
| 248 | ["/map cycle detail"] = 0, |
| 249 | ["/map cycle layout"] = 0, |
| 250 | ["/map cycle level"] = 0, |
| 251 | ["/map cycle presentation"] = 0, |
| 252 | ["/map type controlflow"] = 0, |
| 253 | ["/map type file"] = 0, |
| 254 | ["/mfd toggle"] = 0, |
| 255 | ["/open"] = 0, |
| 256 | ["/output hide"] = 0, |
| 257 | ["/output show"] = 0, |
| 258 | ["/output toggle"] = 0, |
| 259 | ["/pfd show"] = 0, |
| 260 | ["/pfd toggle"] = 0, |
| 261 | ["/portal open"] = 1, |
| 262 | ["/preview show"] = 0, |
| 263 | ["/problems show"] = 0, |
| 264 | ["/readiness show"] = 0, |
| 265 | ["/related show"] = 0, |
| 266 | ["/repository show"] = 0, |
| 267 | ["/repository toggle"] = 0, |
| 268 | ["/search"] = 2, |
| 269 | ["/settings show"] = 0, |
| 270 | ["/solution explorer show"] = 0, |
| 271 | ["/solution load"] = 2, |
| 272 | ["/solution new"] = 0, |
| 273 | ["/solution new classlib"] = 0, |
| 274 | ["/solution new console"] = 0, |
| 275 | ["/solution new webapi"] = 0, |
| 276 | ["/solution open"] = 0, |
| 277 | ["/state show"] = 0, |
| 278 | ["/terminal show"] = 0, |
| 279 | ["/test affected"] = 0, |
| 280 | ["/test run"] = 0, |
| 281 | ["/tests show"] = 0, |
| 282 | ["/workspace show"] = 0, |
| 283 | ["/workspace splitters-lock"] = 0, |
| 284 | }.ToFrozenDictionary(StringComparer.OrdinalIgnoreCase); |
| 285 | |
| 286 | public static bool ContainsPath(string normalizedPath) => |
| 287 | PathSet.Contains(normalizedPath); |
| 288 | |
| 289 | public static bool TryGetArgTailKind(string normalizedPath, out SlashRouteArgTailKind kind) |
| 290 | { |
| 291 | if (ArgTailKindByPath.TryGetValue(normalizedPath, out var b)) |
| 292 | { |
| 293 | kind = (SlashRouteArgTailKind)b; |
| 294 | return true; |
| 295 | } |
| 296 | |
| 297 | kind = SlashRouteArgTailKind.None; |
| 298 | return false; |
| 299 | } |
| 300 | |
| 301 | /// <summary>Longest catalog path matching token prefix.</summary> |
| 302 | public static bool TryResolveLongestPrefix( |
| 303 | IReadOnlyList<string> tokens, |
| 304 | bool endsWithSpace, |
| 305 | out string canonicalPath, |
| 306 | out string argTail, |
| 307 | out bool isExactPath, |
| 308 | out bool endsWithSpaceAfterPath) |
| 309 | { |
| 310 | canonicalPath = ""; |
| 311 | argTail = ""; |
| 312 | isExactPath = false; |
| 313 | endsWithSpaceAfterPath = false; |
| 314 | if (tokens.Count == 0) |
| 315 | return false; |
| 316 | |
| 317 | for (var len = tokens.Count; len >= 1; len--) |
| 318 | { |
| 319 | var path = "/" + string.Join(' ', tokens.Take(len)); |
| 320 | if (!PathSet.Contains(path)) |
| 321 | continue; |
| 322 | |
| 323 | canonicalPath = path; |
| 324 | argTail = string.Join(' ', tokens.Skip(len)); |
| 325 | var hasArgTail = argTail.Length > 0; |
| 326 | isExactPath = len == tokens.Count && !endsWithSpace && !hasArgTail; |
| 327 | endsWithSpaceAfterPath = endsWithSpace && !hasArgTail && len == tokens.Count; |
| 328 | return true; |
| 329 | } |
| 330 | |
| 331 | return false; |
| 332 | } |
| 333 | } |
| 334 | |
| 335 | /// <summary>Зеркало <see cref="CascadeIDE.Features.Chat.SlashArgTailKind"/> (значения 0/1/2).</summary> |
| 336 | internal enum SlashRouteArgTailKind : byte |
| 337 | { |
| 338 | None = 0, |
| 339 | Optional = 1, |
| 340 | Required = 2, |
| 341 | } |
| 342 | |