Add files using upload-large-folder tool
Browse files- projects/ui/crush/.github/CODEOWNERS +1 -0
- projects/ui/crush/.github/cla-signatures.json +556 -0
- projects/ui/crush/.github/dependabot.yml +36 -0
- projects/ui/crush/.github/entitlements.plist +8 -0
- projects/ui/crush/.github/labeler.yml +63 -0
- projects/ui/crush/.github/workflows/build.yml +11 -0
- projects/ui/crush/.github/workflows/cla.yml +36 -0
- projects/ui/crush/.github/workflows/labeler.yml +30 -0
- projects/ui/crush/.github/workflows/lint-sync.yml +14 -0
- projects/ui/crush/.github/workflows/lint.yml +12 -0
- projects/ui/crush/.github/workflows/nightly.yml +31 -0
- projects/ui/crush/.github/workflows/release.yml +35 -0
- projects/ui/crush/.github/workflows/schema-update.yml +26 -0
- projects/ui/crush/internal/ansiext/ansi.go +25 -0
- projects/ui/crush/internal/app/app.go +356 -0
- projects/ui/crush/internal/app/lsp.go +129 -0
- projects/ui/crush/internal/app/lsp_events.go +99 -0
- projects/ui/crush/internal/cmd/logs.go +212 -0
- projects/ui/crush/scripts/run-issue-labeler.sh +12 -0
- projects/ui/serena-new/test/solidlsp/zig/test_zig_basic.py +343 -0
projects/ui/crush/.github/CODEOWNERS
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
*.go @charmbracelet/everyone
|
projects/ui/crush/.github/cla-signatures.json
ADDED
|
@@ -0,0 +1,556 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
"name": "caarlos0",
|
| 5 |
+
"id": 245435,
|
| 6 |
+
"comment_id": 3133376230,
|
| 7 |
+
"created_at": "2025-07-29T17:11:51Z",
|
| 8 |
+
"repoId": 987670088,
|
| 9 |
+
"pullRequestNo": 333
|
| 10 |
+
},
|
| 11 |
+
{
|
| 12 |
+
"name": "raphamorim",
|
| 13 |
+
"id": 3630346,
|
| 14 |
+
"comment_id": 3133374793,
|
| 15 |
+
"created_at": "2025-07-29T17:11:19Z",
|
| 16 |
+
"repoId": 987670088,
|
| 17 |
+
"pullRequestNo": 230
|
| 18 |
+
},
|
| 19 |
+
{
|
| 20 |
+
"name": "raphamorim",
|
| 21 |
+
"id": 3630346,
|
| 22 |
+
"comment_id": 3133379333,
|
| 23 |
+
"created_at": "2025-07-29T17:13:00Z",
|
| 24 |
+
"repoId": 987670088,
|
| 25 |
+
"pullRequestNo": 230
|
| 26 |
+
},
|
| 27 |
+
{
|
| 28 |
+
"name": "aymanbagabas",
|
| 29 |
+
"id": 3187948,
|
| 30 |
+
"comment_id": 3133374319,
|
| 31 |
+
"created_at": "2025-07-29T17:11:08Z",
|
| 32 |
+
"repoId": 987670088,
|
| 33 |
+
"pullRequestNo": 224
|
| 34 |
+
},
|
| 35 |
+
{
|
| 36 |
+
"name": "aymanbagabas",
|
| 37 |
+
"id": 3187948,
|
| 38 |
+
"comment_id": 3133398259,
|
| 39 |
+
"created_at": "2025-07-29T17:19:30Z",
|
| 40 |
+
"repoId": 987670088,
|
| 41 |
+
"pullRequestNo": 224
|
| 42 |
+
},
|
| 43 |
+
{
|
| 44 |
+
"name": "andreynering",
|
| 45 |
+
"id": 7011819,
|
| 46 |
+
"comment_id": 3133398174,
|
| 47 |
+
"created_at": "2025-07-29T17:19:29Z",
|
| 48 |
+
"repoId": 987670088,
|
| 49 |
+
"pullRequestNo": 323
|
| 50 |
+
},
|
| 51 |
+
{
|
| 52 |
+
"name": "ras0q",
|
| 53 |
+
"id": 66677201,
|
| 54 |
+
"comment_id": 3133486409,
|
| 55 |
+
"created_at": "2025-07-29T17:51:25Z",
|
| 56 |
+
"repoId": 987670088,
|
| 57 |
+
"pullRequestNo": 335
|
| 58 |
+
},
|
| 59 |
+
{
|
| 60 |
+
"name": "meowgorithm",
|
| 61 |
+
"id": 25087,
|
| 62 |
+
"comment_id": 3134117697,
|
| 63 |
+
"created_at": "2025-07-29T21:23:05Z",
|
| 64 |
+
"repoId": 987670088,
|
| 65 |
+
"pullRequestNo": 343
|
| 66 |
+
},
|
| 67 |
+
{
|
| 68 |
+
"name": "kujtimiihoxha",
|
| 69 |
+
"id": 14311743,
|
| 70 |
+
"comment_id": 3135739620,
|
| 71 |
+
"created_at": "2025-07-30T10:35:23Z",
|
| 72 |
+
"repoId": 987670088,
|
| 73 |
+
"pullRequestNo": 352
|
| 74 |
+
},
|
| 75 |
+
{
|
| 76 |
+
"name": "rio",
|
| 77 |
+
"id": 883894,
|
| 78 |
+
"comment_id": 3136448851,
|
| 79 |
+
"created_at": "2025-07-30T13:51:45Z",
|
| 80 |
+
"repoId": 987670088,
|
| 81 |
+
"pullRequestNo": 358
|
| 82 |
+
},
|
| 83 |
+
{
|
| 84 |
+
"name": "douglarek",
|
| 85 |
+
"id": 1488134,
|
| 86 |
+
"comment_id": 3136721507,
|
| 87 |
+
"created_at": "2025-07-30T14:55:51Z",
|
| 88 |
+
"repoId": 987670088,
|
| 89 |
+
"pullRequestNo": 362
|
| 90 |
+
},
|
| 91 |
+
{
|
| 92 |
+
"name": "taigrr",
|
| 93 |
+
"id": 8261498,
|
| 94 |
+
"comment_id": 3138718122,
|
| 95 |
+
"created_at": "2025-07-31T06:31:11Z",
|
| 96 |
+
"repoId": 987670088,
|
| 97 |
+
"pullRequestNo": 391
|
| 98 |
+
},
|
| 99 |
+
{
|
| 100 |
+
"name": "fluffypony",
|
| 101 |
+
"id": 1944293,
|
| 102 |
+
"comment_id": 3139828932,
|
| 103 |
+
"created_at": "2025-07-31T12:45:05Z",
|
| 104 |
+
"repoId": 987670088,
|
| 105 |
+
"pullRequestNo": 400
|
| 106 |
+
},
|
| 107 |
+
{
|
| 108 |
+
"name": "jedisct1",
|
| 109 |
+
"id": 124872,
|
| 110 |
+
"comment_id": 3140242221,
|
| 111 |
+
"created_at": "2025-07-31T14:39:23Z",
|
| 112 |
+
"repoId": 987670088,
|
| 113 |
+
"pullRequestNo": 408
|
| 114 |
+
},
|
| 115 |
+
{
|
| 116 |
+
"name": "Djiit",
|
| 117 |
+
"id": 1169844,
|
| 118 |
+
"comment_id": 3140319096,
|
| 119 |
+
"created_at": "2025-07-31T15:01:49Z",
|
| 120 |
+
"repoId": 987670088,
|
| 121 |
+
"pullRequestNo": 409
|
| 122 |
+
},
|
| 123 |
+
{
|
| 124 |
+
"name": "steipete",
|
| 125 |
+
"id": 58493,
|
| 126 |
+
"comment_id": 3140446226,
|
| 127 |
+
"created_at": "2025-07-31T15:40:05Z",
|
| 128 |
+
"repoId": 987670088,
|
| 129 |
+
"pullRequestNo": 414
|
| 130 |
+
},
|
| 131 |
+
{
|
| 132 |
+
"name": "lmn451",
|
| 133 |
+
"id": 14910239,
|
| 134 |
+
"comment_id": 3141170246,
|
| 135 |
+
"created_at": "2025-07-31T19:54:14Z",
|
| 136 |
+
"repoId": 987670088,
|
| 137 |
+
"pullRequestNo": 429
|
| 138 |
+
},
|
| 139 |
+
{
|
| 140 |
+
"name": "petersanchez",
|
| 141 |
+
"id": 199166,
|
| 142 |
+
"comment_id": 3141358800,
|
| 143 |
+
"created_at": "2025-07-31T21:14:55Z",
|
| 144 |
+
"repoId": 987670088,
|
| 145 |
+
"pullRequestNo": 434
|
| 146 |
+
},
|
| 147 |
+
{
|
| 148 |
+
"name": "alvaro17f",
|
| 149 |
+
"id": 89421445,
|
| 150 |
+
"comment_id": 3144148093,
|
| 151 |
+
"created_at": "2025-08-01T10:50:27Z",
|
| 152 |
+
"repoId": 987670088,
|
| 153 |
+
"pullRequestNo": 451
|
| 154 |
+
},
|
| 155 |
+
{
|
| 156 |
+
"name": "bbrodriges",
|
| 157 |
+
"id": 871322,
|
| 158 |
+
"comment_id": 3144263924,
|
| 159 |
+
"created_at": "2025-08-01T11:33:11Z",
|
| 160 |
+
"repoId": 987670088,
|
| 161 |
+
"pullRequestNo": 454
|
| 162 |
+
},
|
| 163 |
+
{
|
| 164 |
+
"name": "SyedaAnshrahGillani",
|
| 165 |
+
"id": 90501474,
|
| 166 |
+
"comment_id": 3144865858,
|
| 167 |
+
"created_at": "2025-08-01T14:57:07Z",
|
| 168 |
+
"repoId": 987670088,
|
| 169 |
+
"pullRequestNo": 460
|
| 170 |
+
},
|
| 171 |
+
{
|
| 172 |
+
"name": "spachava753",
|
| 173 |
+
"id": 34797853,
|
| 174 |
+
"comment_id": 3145329017,
|
| 175 |
+
"created_at": "2025-08-01T17:49:37Z",
|
| 176 |
+
"repoId": 987670088,
|
| 177 |
+
"pullRequestNo": 469
|
| 178 |
+
},
|
| 179 |
+
{
|
| 180 |
+
"name": "tabletcorry",
|
| 181 |
+
"id": 456754,
|
| 182 |
+
"comment_id": 3145908475,
|
| 183 |
+
"created_at": "2025-08-01T22:18:28Z",
|
| 184 |
+
"repoId": 987670088,
|
| 185 |
+
"pullRequestNo": 480
|
| 186 |
+
},
|
| 187 |
+
{
|
| 188 |
+
"name": "yumosx",
|
| 189 |
+
"id": 141902143,
|
| 190 |
+
"comment_id": 3146472558,
|
| 191 |
+
"created_at": "2025-08-02T12:24:29Z",
|
| 192 |
+
"repoId": 987670088,
|
| 193 |
+
"pullRequestNo": 504
|
| 194 |
+
},
|
| 195 |
+
{
|
| 196 |
+
"name": "bold84",
|
| 197 |
+
"id": 21118257,
|
| 198 |
+
"comment_id": 3146962342,
|
| 199 |
+
"created_at": "2025-08-03T04:07:16Z",
|
| 200 |
+
"repoId": 987670088,
|
| 201 |
+
"pullRequestNo": 519
|
| 202 |
+
},
|
| 203 |
+
{
|
| 204 |
+
"name": "jooray",
|
| 205 |
+
"id": 1028688,
|
| 206 |
+
"comment_id": 3148713433,
|
| 207 |
+
"created_at": "2025-08-03T21:35:15Z",
|
| 208 |
+
"repoId": 987670088,
|
| 209 |
+
"pullRequestNo": 527
|
| 210 |
+
},
|
| 211 |
+
{
|
| 212 |
+
"name": "Ed4ward",
|
| 213 |
+
"id": 153800328,
|
| 214 |
+
"comment_id": 3150375016,
|
| 215 |
+
"created_at": "2025-08-04T12:16:16Z",
|
| 216 |
+
"repoId": 987670088,
|
| 217 |
+
"pullRequestNo": 539
|
| 218 |
+
},
|
| 219 |
+
{
|
| 220 |
+
"name": "ngnhng",
|
| 221 |
+
"id": 51743767,
|
| 222 |
+
"comment_id": 3150846779,
|
| 223 |
+
"created_at": "2025-08-04T14:01:30Z",
|
| 224 |
+
"repoId": 987670088,
|
| 225 |
+
"pullRequestNo": 546
|
| 226 |
+
},
|
| 227 |
+
{
|
| 228 |
+
"name": "zloeber",
|
| 229 |
+
"id": 4702624,
|
| 230 |
+
"comment_id": 3152513500,
|
| 231 |
+
"created_at": "2025-08-04T21:55:42Z",
|
| 232 |
+
"repoId": 987670088,
|
| 233 |
+
"pullRequestNo": 564
|
| 234 |
+
},
|
| 235 |
+
{
|
| 236 |
+
"name": "nelsenm2",
|
| 237 |
+
"id": 197524521,
|
| 238 |
+
"comment_id": 3152872109,
|
| 239 |
+
"created_at": "2025-08-05T00:24:50Z",
|
| 240 |
+
"repoId": 987670088,
|
| 241 |
+
"pullRequestNo": 569
|
| 242 |
+
},
|
| 243 |
+
{
|
| 244 |
+
"name": "mohseenrm",
|
| 245 |
+
"id": 10768371,
|
| 246 |
+
"comment_id": 3153159347,
|
| 247 |
+
"created_at": "2025-08-05T03:39:12Z",
|
| 248 |
+
"repoId": 987670088,
|
| 249 |
+
"pullRequestNo": 574
|
| 250 |
+
},
|
| 251 |
+
{
|
| 252 |
+
"name": "0xWelt",
|
| 253 |
+
"id": 49543594,
|
| 254 |
+
"comment_id": 3157331134,
|
| 255 |
+
"created_at": "2025-08-06T04:07:52Z",
|
| 256 |
+
"repoId": 987670088,
|
| 257 |
+
"pullRequestNo": 584
|
| 258 |
+
},
|
| 259 |
+
{
|
| 260 |
+
"name": "kslamph",
|
| 261 |
+
"id": 15257433,
|
| 262 |
+
"comment_id": 3157402768,
|
| 263 |
+
"created_at": "2025-08-06T04:56:35Z",
|
| 264 |
+
"repoId": 987670088,
|
| 265 |
+
"pullRequestNo": 585
|
| 266 |
+
},
|
| 267 |
+
{
|
| 268 |
+
"name": "kslamph",
|
| 269 |
+
"id": 15257433,
|
| 270 |
+
"comment_id": 3157429309,
|
| 271 |
+
"created_at": "2025-08-06T05:14:23Z",
|
| 272 |
+
"repoId": 987670088,
|
| 273 |
+
"pullRequestNo": 585
|
| 274 |
+
},
|
| 275 |
+
{
|
| 276 |
+
"name": "Sunsvea",
|
| 277 |
+
"id": 14066471,
|
| 278 |
+
"comment_id": 3159014183,
|
| 279 |
+
"created_at": "2025-08-06T10:04:39Z",
|
| 280 |
+
"repoId": 987670088,
|
| 281 |
+
"pullRequestNo": 593
|
| 282 |
+
},
|
| 283 |
+
{
|
| 284 |
+
"name": "taciturnaxolotl",
|
| 285 |
+
"id": 92754843,
|
| 286 |
+
"comment_id": 3160702345,
|
| 287 |
+
"created_at": "2025-08-06T15:48:47Z",
|
| 288 |
+
"repoId": 987670088,
|
| 289 |
+
"pullRequestNo": 606
|
| 290 |
+
},
|
| 291 |
+
{
|
| 292 |
+
"name": "bashbunni",
|
| 293 |
+
"id": 15822994,
|
| 294 |
+
"comment_id": 3160746002,
|
| 295 |
+
"created_at": "2025-08-06T16:02:06Z",
|
| 296 |
+
"repoId": 987670088,
|
| 297 |
+
"pullRequestNo": 187
|
| 298 |
+
},
|
| 299 |
+
{
|
| 300 |
+
"name": "edafonseca",
|
| 301 |
+
"id": 3027921,
|
| 302 |
+
"comment_id": 3161714270,
|
| 303 |
+
"created_at": "2025-08-06T21:41:34Z",
|
| 304 |
+
"repoId": 987670088,
|
| 305 |
+
"pullRequestNo": 618
|
| 306 |
+
},
|
| 307 |
+
{
|
| 308 |
+
"name": "smores56",
|
| 309 |
+
"id": 22140449,
|
| 310 |
+
"comment_id": 3161853491,
|
| 311 |
+
"created_at": "2025-08-06T22:51:42Z",
|
| 312 |
+
"repoId": 987670088,
|
| 313 |
+
"pullRequestNo": 620
|
| 314 |
+
},
|
| 315 |
+
{
|
| 316 |
+
"name": "danielsz",
|
| 317 |
+
"id": 859131,
|
| 318 |
+
"comment_id": 3163327861,
|
| 319 |
+
"created_at": "2025-08-07T09:39:26Z",
|
| 320 |
+
"repoId": 987670088,
|
| 321 |
+
"pullRequestNo": 628
|
| 322 |
+
},
|
| 323 |
+
{
|
| 324 |
+
"name": "pavelzw",
|
| 325 |
+
"id": 29506042,
|
| 326 |
+
"comment_id": 3164728921,
|
| 327 |
+
"created_at": "2025-08-07T15:33:23Z",
|
| 328 |
+
"repoId": 987670088,
|
| 329 |
+
"pullRequestNo": 631
|
| 330 |
+
},
|
| 331 |
+
{
|
| 332 |
+
"name": "CyrusZei",
|
| 333 |
+
"id": 5053903,
|
| 334 |
+
"comment_id": 3165875211,
|
| 335 |
+
"created_at": "2025-08-07T21:45:30Z",
|
| 336 |
+
"repoId": 987670088,
|
| 337 |
+
"pullRequestNo": 638
|
| 338 |
+
},
|
| 339 |
+
{
|
| 340 |
+
"name": "maxjustus",
|
| 341 |
+
"id": 24899,
|
| 342 |
+
"comment_id": 3166599830,
|
| 343 |
+
"created_at": "2025-08-08T05:12:37Z",
|
| 344 |
+
"repoId": 987670088,
|
| 345 |
+
"pullRequestNo": 645
|
| 346 |
+
},
|
| 347 |
+
{
|
| 348 |
+
"name": "akaytatsu",
|
| 349 |
+
"id": 2520440,
|
| 350 |
+
"comment_id": 3167400968,
|
| 351 |
+
"created_at": "2025-08-08T10:32:51Z",
|
| 352 |
+
"repoId": 987670088,
|
| 353 |
+
"pullRequestNo": 647
|
| 354 |
+
},
|
| 355 |
+
{
|
| 356 |
+
"name": "theguy000",
|
| 357 |
+
"id": 52881001,
|
| 358 |
+
"comment_id": 3167442675,
|
| 359 |
+
"created_at": "2025-08-08T10:46:15Z",
|
| 360 |
+
"repoId": 987670088,
|
| 361 |
+
"pullRequestNo": 648
|
| 362 |
+
},
|
| 363 |
+
{
|
| 364 |
+
"name": "pwnintended",
|
| 365 |
+
"id": 92651319,
|
| 366 |
+
"comment_id": 3169309904,
|
| 367 |
+
"created_at": "2025-08-08T21:08:45Z",
|
| 368 |
+
"repoId": 987670088,
|
| 369 |
+
"pullRequestNo": 668
|
| 370 |
+
},
|
| 371 |
+
{
|
| 372 |
+
"name": "tazjin",
|
| 373 |
+
"id": 1552853,
|
| 374 |
+
"comment_id": 3169412729,
|
| 375 |
+
"created_at": "2025-08-08T22:05:40Z",
|
| 376 |
+
"repoId": 987670088,
|
| 377 |
+
"pullRequestNo": 672
|
| 378 |
+
},
|
| 379 |
+
{
|
| 380 |
+
"name": "liznear",
|
| 381 |
+
"id": 160093988,
|
| 382 |
+
"comment_id": 3170486027,
|
| 383 |
+
"created_at": "2025-08-09T08:15:27Z",
|
| 384 |
+
"repoId": 987670088,
|
| 385 |
+
"pullRequestNo": 681
|
| 386 |
+
},
|
| 387 |
+
{
|
| 388 |
+
"name": "jamestrew",
|
| 389 |
+
"id": 66286082,
|
| 390 |
+
"comment_id": 3171975481,
|
| 391 |
+
"created_at": "2025-08-09T17:55:31Z",
|
| 392 |
+
"repoId": 987670088,
|
| 393 |
+
"pullRequestNo": 689
|
| 394 |
+
},
|
| 395 |
+
{
|
| 396 |
+
"name": "wwwjfy",
|
| 397 |
+
"id": 126527,
|
| 398 |
+
"comment_id": 3172676799,
|
| 399 |
+
"created_at": "2025-08-10T14:35:04Z",
|
| 400 |
+
"repoId": 987670088,
|
| 401 |
+
"pullRequestNo": 702
|
| 402 |
+
},
|
| 403 |
+
{
|
| 404 |
+
"name": "orospakr",
|
| 405 |
+
"id": 16714,
|
| 406 |
+
"comment_id": 3181859171,
|
| 407 |
+
"created_at": "2025-08-13T01:01:30Z",
|
| 408 |
+
"repoId": 987670088,
|
| 409 |
+
"pullRequestNo": 746
|
| 410 |
+
},
|
| 411 |
+
{
|
| 412 |
+
"name": "samiulsami",
|
| 413 |
+
"id": 33352407,
|
| 414 |
+
"comment_id": 3189231059,
|
| 415 |
+
"created_at": "2025-08-14T17:12:20Z",
|
| 416 |
+
"repoId": 987670088,
|
| 417 |
+
"pullRequestNo": 779
|
| 418 |
+
},
|
| 419 |
+
{
|
| 420 |
+
"name": "neomantra",
|
| 421 |
+
"id": 26842,
|
| 422 |
+
"comment_id": 3189674073,
|
| 423 |
+
"created_at": "2025-08-14T19:42:53Z",
|
| 424 |
+
"repoId": 987670088,
|
| 425 |
+
"pullRequestNo": 752
|
| 426 |
+
},
|
| 427 |
+
{
|
| 428 |
+
"name": "uri",
|
| 429 |
+
"id": 676443,
|
| 430 |
+
"comment_id": 3190313833,
|
| 431 |
+
"created_at": "2025-08-15T00:58:11Z",
|
| 432 |
+
"repoId": 987670088,
|
| 433 |
+
"pullRequestNo": 782
|
| 434 |
+
},
|
| 435 |
+
{
|
| 436 |
+
"name": "lpmitchell",
|
| 437 |
+
"id": 5081038,
|
| 438 |
+
"comment_id": 3191789654,
|
| 439 |
+
"created_at": "2025-08-15T15:23:59Z",
|
| 440 |
+
"repoId": 987670088,
|
| 441 |
+
"pullRequestNo": 790
|
| 442 |
+
},
|
| 443 |
+
{
|
| 444 |
+
"name": "marcosktsz",
|
| 445 |
+
"id": 58952492,
|
| 446 |
+
"comment_id": 3193569650,
|
| 447 |
+
"created_at": "2025-08-16T10:29:10Z",
|
| 448 |
+
"repoId": 987670088,
|
| 449 |
+
"pullRequestNo": 798
|
| 450 |
+
},
|
| 451 |
+
{
|
| 452 |
+
"name": "sainadh-d",
|
| 453 |
+
"id": 15155045,
|
| 454 |
+
"comment_id": 3193680786,
|
| 455 |
+
"created_at": "2025-08-16T13:49:03Z",
|
| 456 |
+
"repoId": 987670088,
|
| 457 |
+
"pullRequestNo": 803
|
| 458 |
+
},
|
| 459 |
+
{
|
| 460 |
+
"name": "ericcoleta",
|
| 461 |
+
"id": 42539971,
|
| 462 |
+
"comment_id": 3201263288,
|
| 463 |
+
"created_at": "2025-08-19T15:38:48Z",
|
| 464 |
+
"repoId": 987670088,
|
| 465 |
+
"pullRequestNo": 835
|
| 466 |
+
},
|
| 467 |
+
{
|
| 468 |
+
"name": "linw1995",
|
| 469 |
+
"id": 13523027,
|
| 470 |
+
"comment_id": 3209540243,
|
| 471 |
+
"created_at": "2025-08-21T08:29:20Z",
|
| 472 |
+
"repoId": 987670088,
|
| 473 |
+
"pullRequestNo": 850
|
| 474 |
+
},
|
| 475 |
+
{
|
| 476 |
+
"name": "khareyash05",
|
| 477 |
+
"id": 60147732,
|
| 478 |
+
"comment_id": 3213528951,
|
| 479 |
+
"created_at": "2025-08-22T08:26:23Z",
|
| 480 |
+
"repoId": 987670088,
|
| 481 |
+
"pullRequestNo": 860
|
| 482 |
+
},
|
| 483 |
+
{
|
| 484 |
+
"name": "mpj",
|
| 485 |
+
"id": 17815,
|
| 486 |
+
"comment_id": 3214796891,
|
| 487 |
+
"created_at": "2025-08-22T15:35:12Z",
|
| 488 |
+
"repoId": 987670088,
|
| 489 |
+
"pullRequestNo": 865
|
| 490 |
+
},
|
| 491 |
+
{
|
| 492 |
+
"name": "xPrimeTime",
|
| 493 |
+
"id": 101987372,
|
| 494 |
+
"comment_id": 3217970106,
|
| 495 |
+
"created_at": "2025-08-24T09:28:11Z",
|
| 496 |
+
"repoId": 987670088,
|
| 497 |
+
"pullRequestNo": 873
|
| 498 |
+
},
|
| 499 |
+
{
|
| 500 |
+
"name": "mercmobily",
|
| 501 |
+
"id": 2128734,
|
| 502 |
+
"comment_id": 3219992206,
|
| 503 |
+
"created_at": "2025-08-25T12:00:54Z",
|
| 504 |
+
"repoId": 987670088,
|
| 505 |
+
"pullRequestNo": 882
|
| 506 |
+
},
|
| 507 |
+
{
|
| 508 |
+
"name": "xhos",
|
| 509 |
+
"id": 60789741,
|
| 510 |
+
"comment_id": 3221119175,
|
| 511 |
+
"created_at": "2025-08-25T17:26:06Z",
|
| 512 |
+
"repoId": 987670088,
|
| 513 |
+
"pullRequestNo": 892
|
| 514 |
+
},
|
| 515 |
+
{
|
| 516 |
+
"name": "henrebotha",
|
| 517 |
+
"id": 5593874,
|
| 518 |
+
"comment_id": 3223793535,
|
| 519 |
+
"created_at": "2025-08-26T11:34:17Z",
|
| 520 |
+
"repoId": 987670088,
|
| 521 |
+
"pullRequestNo": 900
|
| 522 |
+
},
|
| 523 |
+
{
|
| 524 |
+
"name": "negz",
|
| 525 |
+
"id": 1049349,
|
| 526 |
+
"comment_id": 3232462357,
|
| 527 |
+
"created_at": "2025-08-28T08:23:46Z",
|
| 528 |
+
"repoId": 987670088,
|
| 529 |
+
"pullRequestNo": 914
|
| 530 |
+
},
|
| 531 |
+
{
|
| 532 |
+
"name": "undo76",
|
| 533 |
+
"id": 1415667,
|
| 534 |
+
"comment_id": 3235052544,
|
| 535 |
+
"created_at": "2025-08-28T21:53:00Z",
|
| 536 |
+
"repoId": 987670088,
|
| 537 |
+
"pullRequestNo": 921
|
| 538 |
+
},
|
| 539 |
+
{
|
| 540 |
+
"name": "andersonjoseph",
|
| 541 |
+
"id": 22438127,
|
| 542 |
+
"comment_id": 3237655829,
|
| 543 |
+
"created_at": "2025-08-29T16:54:00Z",
|
| 544 |
+
"repoId": 987670088,
|
| 545 |
+
"pullRequestNo": 926
|
| 546 |
+
},
|
| 547 |
+
{
|
| 548 |
+
"name": "tisDDM",
|
| 549 |
+
"id": 77615100,
|
| 550 |
+
"comment_id": 3240239275,
|
| 551 |
+
"created_at": "2025-08-31T15:58:52Z",
|
| 552 |
+
"repoId": 987670088,
|
| 553 |
+
"pullRequestNo": 944
|
| 554 |
+
}
|
| 555 |
+
]
|
| 556 |
+
}
|
projects/ui/crush/.github/dependabot.yml
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version: 2
|
| 2 |
+
|
| 3 |
+
updates:
|
| 4 |
+
- package-ecosystem: "gomod"
|
| 5 |
+
directory: "/"
|
| 6 |
+
schedule:
|
| 7 |
+
interval: "weekly"
|
| 8 |
+
day: "monday"
|
| 9 |
+
time: "05:00"
|
| 10 |
+
timezone: "America/New_York"
|
| 11 |
+
labels:
|
| 12 |
+
- "area: dependencies"
|
| 13 |
+
commit-message:
|
| 14 |
+
prefix: "chore"
|
| 15 |
+
include: "scope"
|
| 16 |
+
groups:
|
| 17 |
+
all:
|
| 18 |
+
patterns:
|
| 19 |
+
- "*"
|
| 20 |
+
|
| 21 |
+
- package-ecosystem: "github-actions"
|
| 22 |
+
directory: "/"
|
| 23 |
+
schedule:
|
| 24 |
+
interval: "weekly"
|
| 25 |
+
day: "monday"
|
| 26 |
+
time: "05:00"
|
| 27 |
+
timezone: "America/New_York"
|
| 28 |
+
labels:
|
| 29 |
+
- "area: dependencies"
|
| 30 |
+
commit-message:
|
| 31 |
+
prefix: "chore"
|
| 32 |
+
include: "scope"
|
| 33 |
+
groups:
|
| 34 |
+
all:
|
| 35 |
+
patterns:
|
| 36 |
+
- "*"
|
projects/ui/crush/.github/entitlements.plist
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
| 3 |
+
<plist version="1.0">
|
| 4 |
+
<dict>
|
| 5 |
+
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
|
| 6 |
+
<true/>
|
| 7 |
+
</dict>
|
| 8 |
+
</plist>
|
projects/ui/crush/.github/labeler.yml
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# NOTE(@andreynering): We should have a single entry per label, because if we
|
| 2 |
+
# have multiple the action would only apply the label if ALL of them match.
|
| 3 |
+
|
| 4 |
+
"area: ci":
|
| 5 |
+
- "/^ci: /i"
|
| 6 |
+
"area: diff":
|
| 7 |
+
- "/diff/i"
|
| 8 |
+
"area: docs":
|
| 9 |
+
- "/(docs|documentation|readme)/i"
|
| 10 |
+
"area: images":
|
| 11 |
+
- "/image/i"
|
| 12 |
+
"area: lsp":
|
| 13 |
+
- "/lsp/i"
|
| 14 |
+
"area: mcp":
|
| 15 |
+
- "/mcp/i"
|
| 16 |
+
"area: mouse":
|
| 17 |
+
- "/(mouse|scroll)/i"
|
| 18 |
+
"area: onboarding":
|
| 19 |
+
- "/(onboarding)/i"
|
| 20 |
+
"area: permissions":
|
| 21 |
+
- "/permission/i"
|
| 22 |
+
"area: releasing":
|
| 23 |
+
- "/(release|releasing|aur|brew|nix|npm|scoop|termux|winget)/i"
|
| 24 |
+
"area: session":
|
| 25 |
+
- "/session/i"
|
| 26 |
+
"area: shell":
|
| 27 |
+
- "/shell/i"
|
| 28 |
+
"area: themes":
|
| 29 |
+
- "/theme/i"
|
| 30 |
+
"area: tools":
|
| 31 |
+
- "/tool/i"
|
| 32 |
+
"os: android":
|
| 33 |
+
- "/(android|termux)/i"
|
| 34 |
+
"os: linux":
|
| 35 |
+
- "/(linux|fedora|debian|ubuntu)/i"
|
| 36 |
+
"os: macos":
|
| 37 |
+
- "/(macos|osx|darwin)/i"
|
| 38 |
+
"os: windows":
|
| 39 |
+
- "/(windows|win10|win11|win32|wsl|scoop|winget)/i"
|
| 40 |
+
"panic / crash":
|
| 41 |
+
- "/(panic|crash|segfault)/i"
|
| 42 |
+
"provider: anthropic claude":
|
| 43 |
+
- "/(anthropic|claude)/i"
|
| 44 |
+
"provider: aws bedrock":
|
| 45 |
+
- "/(aws|bedrock)/i"
|
| 46 |
+
"provider: google gemini":
|
| 47 |
+
- "/gemini/i"
|
| 48 |
+
"provider: google vertex":
|
| 49 |
+
- "/vertex/i"
|
| 50 |
+
"provider: kimi":
|
| 51 |
+
- "/kimi/i"
|
| 52 |
+
"provider: ollama":
|
| 53 |
+
- "/llama/i"
|
| 54 |
+
"provider: openai chatgpt":
|
| 55 |
+
- "/(openai|gpt)/i"
|
| 56 |
+
"provider: openrouter":
|
| 57 |
+
- "/openrouter/i"
|
| 58 |
+
"provider: qwen":
|
| 59 |
+
- "/qwen/i"
|
| 60 |
+
"provider: xai grok":
|
| 61 |
+
- "/(xai|x\\.ai|grok)/i"
|
| 62 |
+
"security":
|
| 63 |
+
- "/(security|vulnerability|exploit)/i"
|
projects/ui/crush/.github/workflows/build.yml
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: build
|
| 2 |
+
on: [push, pull_request]
|
| 3 |
+
|
| 4 |
+
jobs:
|
| 5 |
+
build:
|
| 6 |
+
uses: charmbracelet/meta/.github/workflows/build.yml@main
|
| 7 |
+
with:
|
| 8 |
+
go-version: ""
|
| 9 |
+
go-version-file: ./go.mod
|
| 10 |
+
secrets:
|
| 11 |
+
gh_pat: "${{ secrets.PERSONAL_ACCESS_TOKEN }}"
|
projects/ui/crush/.github/workflows/cla.yml
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: "CLA Assistant"
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
issue_comment:
|
| 5 |
+
types: [created]
|
| 6 |
+
pull_request_target:
|
| 7 |
+
types: [opened, closed, synchronize]
|
| 8 |
+
|
| 9 |
+
permissions:
|
| 10 |
+
actions: write
|
| 11 |
+
contents: write
|
| 12 |
+
pull-requests: write
|
| 13 |
+
statuses: write
|
| 14 |
+
|
| 15 |
+
jobs:
|
| 16 |
+
CLAAssistant:
|
| 17 |
+
if: github.repository == 'charmbracelet/crush'
|
| 18 |
+
runs-on: ubuntu-latest
|
| 19 |
+
steps:
|
| 20 |
+
- name: "CLA Assistant"
|
| 21 |
+
if: |
|
| 22 |
+
github.event.comment.body == 'recheck' ||
|
| 23 |
+
github.event.comment.body == 'I have read the Contributor License Agreement (CLA) and hereby sign the CLA.' ||
|
| 24 |
+
github.event_name == 'pull_request_target'
|
| 25 |
+
uses: contributor-assistant/github-action@v2.6.1
|
| 26 |
+
env:
|
| 27 |
+
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
|
| 28 |
+
with:
|
| 29 |
+
path-to-signatures: ".github/cla-signatures.json"
|
| 30 |
+
path-to-document: "https://github.com/charmbracelet/crush/blob/main/CLA.md"
|
| 31 |
+
branch: "main"
|
| 32 |
+
allowlist: charmcli,charmcrush,dependabot[bot]
|
| 33 |
+
custom-pr-sign-comment: "I have read the Contributor License Agreement (CLA) and hereby sign the CLA."
|
| 34 |
+
custom-notsigned-prcomment: "Thank you for your submission. We really appreciate it! Like many open-source projects, we ask that you sign our [Contributor License Agreement](https://github.com/charmbracelet/crush/blob/main/CLA.md) before we can accept your contribution. You can sign the CLA by just posting a Pull Request comment same as the below format."
|
| 35 |
+
lock-pullrequest-aftermerge: false
|
| 36 |
+
signed-commit-message: "chore(legal): @$contributorName has signed the CLA"
|
projects/ui/crush/.github/workflows/labeler.yml
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: labeler
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
issues:
|
| 5 |
+
types: [opened]
|
| 6 |
+
pull_request_target:
|
| 7 |
+
types: [opened]
|
| 8 |
+
workflow_dispatch:
|
| 9 |
+
inputs:
|
| 10 |
+
issue-number:
|
| 11 |
+
description: "Issue/PR #"
|
| 12 |
+
required: true
|
| 13 |
+
type: string
|
| 14 |
+
|
| 15 |
+
permissions:
|
| 16 |
+
issues: write
|
| 17 |
+
contents: read
|
| 18 |
+
|
| 19 |
+
jobs:
|
| 20 |
+
triage:
|
| 21 |
+
runs-on: ubuntu-latest
|
| 22 |
+
steps:
|
| 23 |
+
- uses: github/issue-labeler@v3.4
|
| 24 |
+
with:
|
| 25 |
+
configuration-path: .github/labeler.yml
|
| 26 |
+
enable-versioned-regex: 0
|
| 27 |
+
include-title: 1
|
| 28 |
+
include-body: 0
|
| 29 |
+
repo-token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
|
| 30 |
+
issue-number: ${{ github.event.inputs.issue-number || github.event.issue.number || github.event.pull_request.number }}
|
projects/ui/crush/.github/workflows/lint-sync.yml
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: lint-sync
|
| 2 |
+
on:
|
| 3 |
+
schedule:
|
| 4 |
+
# every Sunday at midnight
|
| 5 |
+
- cron: "0 0 * * 0"
|
| 6 |
+
workflow_dispatch: # allows manual triggering
|
| 7 |
+
|
| 8 |
+
permissions:
|
| 9 |
+
contents: write
|
| 10 |
+
pull-requests: write
|
| 11 |
+
|
| 12 |
+
jobs:
|
| 13 |
+
lint:
|
| 14 |
+
uses: charmbracelet/meta/.github/workflows/lint-sync.yml@main
|
projects/ui/crush/.github/workflows/lint.yml
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: lint
|
| 2 |
+
on:
|
| 3 |
+
push:
|
| 4 |
+
pull_request:
|
| 5 |
+
|
| 6 |
+
jobs:
|
| 7 |
+
lint:
|
| 8 |
+
uses: charmbracelet/meta/.github/workflows/lint.yml@main
|
| 9 |
+
with:
|
| 10 |
+
golangci_path: .golangci.yml
|
| 11 |
+
golangci_version: v2.4
|
| 12 |
+
timeout: 10m
|
projects/ui/crush/.github/workflows/nightly.yml
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: nightly
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
schedule:
|
| 5 |
+
- cron: "0 0 * * *" # every day at midnight
|
| 6 |
+
workflow_dispatch: # allows manual triggering
|
| 7 |
+
|
| 8 |
+
jobs:
|
| 9 |
+
check:
|
| 10 |
+
runs-on: ubuntu-latest
|
| 11 |
+
outputs:
|
| 12 |
+
should_run: ${{ steps.check.outputs.should_run }}
|
| 13 |
+
steps:
|
| 14 |
+
- uses: actions/checkout@v5
|
| 15 |
+
with:
|
| 16 |
+
fetch-depth: 1
|
| 17 |
+
- id: check
|
| 18 |
+
env:
|
| 19 |
+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
| 20 |
+
run: |
|
| 21 |
+
if gh run list --workflow nightly.yml -c $(git rev-parse HEAD) -s success | grep 'completed'; then
|
| 22 |
+
echo "should_run=false" >> $GITHUB_OUTPUT
|
| 23 |
+
else
|
| 24 |
+
echo "should_run=true" >> $GITHUB_OUTPUT
|
| 25 |
+
fi
|
| 26 |
+
nightly:
|
| 27 |
+
needs: check
|
| 28 |
+
if: needs.check.outputs.should_run == 'true'
|
| 29 |
+
uses: charmbracelet/meta/.github/workflows/nightly.yml@main
|
| 30 |
+
secrets:
|
| 31 |
+
goreleaser_key: ${{ secrets.GORELEASER_KEY }}
|
projects/ui/crush/.github/workflows/release.yml
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
|
| 2 |
+
|
| 3 |
+
name: goreleaser
|
| 4 |
+
|
| 5 |
+
on:
|
| 6 |
+
push:
|
| 7 |
+
tags:
|
| 8 |
+
- v*.*.*
|
| 9 |
+
|
| 10 |
+
concurrency:
|
| 11 |
+
group: goreleaser
|
| 12 |
+
cancel-in-progress: true
|
| 13 |
+
|
| 14 |
+
jobs:
|
| 15 |
+
goreleaser:
|
| 16 |
+
uses: charmbracelet/meta/.github/workflows/goreleaser.yml@main
|
| 17 |
+
with:
|
| 18 |
+
go_version: "1.25"
|
| 19 |
+
macos_sign_entitlements: "./.github/entitlements.plist"
|
| 20 |
+
secrets:
|
| 21 |
+
docker_username: ${{ secrets.DOCKERHUB_USERNAME }}
|
| 22 |
+
docker_token: ${{ secrets.DOCKERHUB_TOKEN }}
|
| 23 |
+
gh_pat: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
|
| 24 |
+
goreleaser_key: ${{ secrets.GORELEASER_KEY }}
|
| 25 |
+
fury_token: ${{ secrets.FURY_TOKEN }}
|
| 26 |
+
nfpm_gpg_key: ${{ secrets.NFPM_GPG_KEY }}
|
| 27 |
+
nfpm_passphrase: ${{ secrets.NFPM_PASSPHRASE }}
|
| 28 |
+
npm_token: ${{ secrets.NPM_TOKEN }}
|
| 29 |
+
snapcraft_token: ${{ secrets.SNAPCRAFT_TOKEN }}
|
| 30 |
+
aur_key: ${{ secrets.AUR_KEY }}
|
| 31 |
+
macos_sign_p12: ${{ secrets.MACOS_SIGN_P12 }}
|
| 32 |
+
macos_sign_password: ${{ secrets.MACOS_SIGN_PASSWORD }}
|
| 33 |
+
macos_notary_issuer_id: ${{ secrets.MACOS_NOTARY_ISSUER_ID }}
|
| 34 |
+
macos_notary_key_id: ${{ secrets.MACOS_NOTARY_KEY_ID }}
|
| 35 |
+
macos_notary_key: ${{ secrets.MACOS_NOTARY_KEY }}
|
projects/ui/crush/.github/workflows/schema-update.yml
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Update Schema
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
push:
|
| 5 |
+
branches: [main]
|
| 6 |
+
paths:
|
| 7 |
+
- "internal/config/**"
|
| 8 |
+
|
| 9 |
+
jobs:
|
| 10 |
+
update-schema:
|
| 11 |
+
runs-on: ubuntu-latest
|
| 12 |
+
steps:
|
| 13 |
+
- uses: actions/checkout@v5
|
| 14 |
+
with:
|
| 15 |
+
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
|
| 16 |
+
- uses: actions/setup-go@v5
|
| 17 |
+
with:
|
| 18 |
+
go-version-file: go.mod
|
| 19 |
+
- run: go run . schema > ./schema.json
|
| 20 |
+
- uses: stefanzweifel/git-auto-commit-action@778341af668090896ca464160c2def5d1d1a3eb0 # v5
|
| 21 |
+
with:
|
| 22 |
+
commit_message: "chore: auto-update generated files"
|
| 23 |
+
branch: main
|
| 24 |
+
commit_user_name: actions-user
|
| 25 |
+
commit_user_email: actions@github.com
|
| 26 |
+
commit_author: actions-user <actions@github.com>
|
projects/ui/crush/internal/ansiext/ansi.go
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
package ansiext
|
| 2 |
+
|
| 3 |
+
import (
|
| 4 |
+
"strings"
|
| 5 |
+
|
| 6 |
+
"github.com/charmbracelet/x/ansi"
|
| 7 |
+
)
|
| 8 |
+
|
| 9 |
+
// Escape replaces control characters with their Unicode Control Picture
|
| 10 |
+
// representations to ensure they are displayed correctly in the UI.
|
| 11 |
+
func Escape(content string) string {
|
| 12 |
+
var sb strings.Builder
|
| 13 |
+
sb.Grow(len(content))
|
| 14 |
+
for _, r := range content {
|
| 15 |
+
switch {
|
| 16 |
+
case r >= 0 && r <= 0x1f: // Control characters 0x00-0x1F
|
| 17 |
+
sb.WriteRune('\u2400' + r)
|
| 18 |
+
case r == ansi.DEL:
|
| 19 |
+
sb.WriteRune('\u2421')
|
| 20 |
+
default:
|
| 21 |
+
sb.WriteRune(r)
|
| 22 |
+
}
|
| 23 |
+
}
|
| 24 |
+
return sb.String()
|
| 25 |
+
}
|
projects/ui/crush/internal/app/app.go
ADDED
|
@@ -0,0 +1,356 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
package app
|
| 2 |
+
|
| 3 |
+
import (
|
| 4 |
+
"context"
|
| 5 |
+
"database/sql"
|
| 6 |
+
"errors"
|
| 7 |
+
"fmt"
|
| 8 |
+
"log/slog"
|
| 9 |
+
"maps"
|
| 10 |
+
"sync"
|
| 11 |
+
"time"
|
| 12 |
+
|
| 13 |
+
tea "github.com/charmbracelet/bubbletea/v2"
|
| 14 |
+
"github.com/charmbracelet/crush/internal/config"
|
| 15 |
+
"github.com/charmbracelet/crush/internal/csync"
|
| 16 |
+
"github.com/charmbracelet/crush/internal/db"
|
| 17 |
+
"github.com/charmbracelet/crush/internal/format"
|
| 18 |
+
"github.com/charmbracelet/crush/internal/history"
|
| 19 |
+
"github.com/charmbracelet/crush/internal/llm/agent"
|
| 20 |
+
"github.com/charmbracelet/crush/internal/log"
|
| 21 |
+
"github.com/charmbracelet/crush/internal/pubsub"
|
| 22 |
+
|
| 23 |
+
"github.com/charmbracelet/crush/internal/lsp"
|
| 24 |
+
"github.com/charmbracelet/crush/internal/message"
|
| 25 |
+
"github.com/charmbracelet/crush/internal/permission"
|
| 26 |
+
"github.com/charmbracelet/crush/internal/session"
|
| 27 |
+
)
|
| 28 |
+
|
| 29 |
+
type App struct {
|
| 30 |
+
Sessions session.Service
|
| 31 |
+
Messages message.Service
|
| 32 |
+
History history.Service
|
| 33 |
+
Permissions permission.Service
|
| 34 |
+
|
| 35 |
+
CoderAgent agent.Service
|
| 36 |
+
|
| 37 |
+
LSPClients map[string]*lsp.Client
|
| 38 |
+
|
| 39 |
+
clientsMutex sync.RWMutex
|
| 40 |
+
|
| 41 |
+
watcherCancelFuncs *csync.Slice[context.CancelFunc]
|
| 42 |
+
lspWatcherWG sync.WaitGroup
|
| 43 |
+
|
| 44 |
+
config *config.Config
|
| 45 |
+
|
| 46 |
+
serviceEventsWG *sync.WaitGroup
|
| 47 |
+
eventsCtx context.Context
|
| 48 |
+
events chan tea.Msg
|
| 49 |
+
tuiWG *sync.WaitGroup
|
| 50 |
+
|
| 51 |
+
// global context and cleanup functions
|
| 52 |
+
globalCtx context.Context
|
| 53 |
+
cleanupFuncs []func()
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
// New initializes a new applcation instance.
|
| 57 |
+
func New(ctx context.Context, conn *sql.DB, cfg *config.Config) (*App, error) {
|
| 58 |
+
q := db.New(conn)
|
| 59 |
+
sessions := session.NewService(q)
|
| 60 |
+
messages := message.NewService(q)
|
| 61 |
+
files := history.NewService(q, conn)
|
| 62 |
+
skipPermissionsRequests := cfg.Permissions != nil && cfg.Permissions.SkipRequests
|
| 63 |
+
allowedTools := []string{}
|
| 64 |
+
if cfg.Permissions != nil && cfg.Permissions.AllowedTools != nil {
|
| 65 |
+
allowedTools = cfg.Permissions.AllowedTools
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
app := &App{
|
| 69 |
+
Sessions: sessions,
|
| 70 |
+
Messages: messages,
|
| 71 |
+
History: files,
|
| 72 |
+
Permissions: permission.NewPermissionService(cfg.WorkingDir(), skipPermissionsRequests, allowedTools),
|
| 73 |
+
LSPClients: make(map[string]*lsp.Client),
|
| 74 |
+
|
| 75 |
+
globalCtx: ctx,
|
| 76 |
+
|
| 77 |
+
config: cfg,
|
| 78 |
+
|
| 79 |
+
watcherCancelFuncs: csync.NewSlice[context.CancelFunc](),
|
| 80 |
+
|
| 81 |
+
events: make(chan tea.Msg, 100),
|
| 82 |
+
serviceEventsWG: &sync.WaitGroup{},
|
| 83 |
+
tuiWG: &sync.WaitGroup{},
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
app.setupEvents()
|
| 87 |
+
|
| 88 |
+
// Initialize LSP clients in the background.
|
| 89 |
+
app.initLSPClients(ctx)
|
| 90 |
+
|
| 91 |
+
// TODO: remove the concept of agent config, most likely.
|
| 92 |
+
if cfg.IsConfigured() {
|
| 93 |
+
if err := app.InitCoderAgent(); err != nil {
|
| 94 |
+
return nil, fmt.Errorf("failed to initialize coder agent: %w", err)
|
| 95 |
+
}
|
| 96 |
+
} else {
|
| 97 |
+
slog.Warn("No agent configuration found")
|
| 98 |
+
}
|
| 99 |
+
return app, nil
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
// Config returns the application configuration.
|
| 103 |
+
func (app *App) Config() *config.Config {
|
| 104 |
+
return app.config
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
// RunNonInteractive handles the execution flow when a prompt is provided via
|
| 108 |
+
// CLI flag.
|
| 109 |
+
func (app *App) RunNonInteractive(ctx context.Context, prompt string, quiet bool) error {
|
| 110 |
+
slog.Info("Running in non-interactive mode")
|
| 111 |
+
|
| 112 |
+
ctx, cancel := context.WithCancel(ctx)
|
| 113 |
+
defer cancel()
|
| 114 |
+
|
| 115 |
+
// Start spinner if not in quiet mode.
|
| 116 |
+
var spinner *format.Spinner
|
| 117 |
+
if !quiet {
|
| 118 |
+
spinner = format.NewSpinner(ctx, cancel, "Generating")
|
| 119 |
+
spinner.Start()
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
// Helper function to stop spinner once.
|
| 123 |
+
stopSpinner := func() {
|
| 124 |
+
if !quiet && spinner != nil {
|
| 125 |
+
spinner.Stop()
|
| 126 |
+
spinner = nil
|
| 127 |
+
}
|
| 128 |
+
}
|
| 129 |
+
defer stopSpinner()
|
| 130 |
+
|
| 131 |
+
const maxPromptLengthForTitle = 100
|
| 132 |
+
titlePrefix := "Non-interactive: "
|
| 133 |
+
var titleSuffix string
|
| 134 |
+
|
| 135 |
+
if len(prompt) > maxPromptLengthForTitle {
|
| 136 |
+
titleSuffix = prompt[:maxPromptLengthForTitle] + "..."
|
| 137 |
+
} else {
|
| 138 |
+
titleSuffix = prompt
|
| 139 |
+
}
|
| 140 |
+
title := titlePrefix + titleSuffix
|
| 141 |
+
|
| 142 |
+
sess, err := app.Sessions.Create(ctx, title)
|
| 143 |
+
if err != nil {
|
| 144 |
+
return fmt.Errorf("failed to create session for non-interactive mode: %w", err)
|
| 145 |
+
}
|
| 146 |
+
slog.Info("Created session for non-interactive run", "session_id", sess.ID)
|
| 147 |
+
|
| 148 |
+
// Automatically approve all permission requests for this non-interactive session
|
| 149 |
+
app.Permissions.AutoApproveSession(sess.ID)
|
| 150 |
+
|
| 151 |
+
done, err := app.CoderAgent.Run(ctx, sess.ID, prompt)
|
| 152 |
+
if err != nil {
|
| 153 |
+
return fmt.Errorf("failed to start agent processing stream: %w", err)
|
| 154 |
+
}
|
| 155 |
+
|
| 156 |
+
messageEvents := app.Messages.Subscribe(ctx)
|
| 157 |
+
messageReadBytes := make(map[string]int)
|
| 158 |
+
|
| 159 |
+
for {
|
| 160 |
+
select {
|
| 161 |
+
case result := <-done:
|
| 162 |
+
stopSpinner()
|
| 163 |
+
|
| 164 |
+
if result.Error != nil {
|
| 165 |
+
if errors.Is(result.Error, context.Canceled) || errors.Is(result.Error, agent.ErrRequestCancelled) {
|
| 166 |
+
slog.Info("Non-interactive: agent processing cancelled", "session_id", sess.ID)
|
| 167 |
+
return nil
|
| 168 |
+
}
|
| 169 |
+
return fmt.Errorf("agent processing failed: %w", result.Error)
|
| 170 |
+
}
|
| 171 |
+
|
| 172 |
+
msgContent := result.Message.Content().String()
|
| 173 |
+
readBts := messageReadBytes[result.Message.ID]
|
| 174 |
+
|
| 175 |
+
if len(msgContent) < readBts {
|
| 176 |
+
slog.Error("Non-interactive: message content is shorter than read bytes", "message_length", len(msgContent), "read_bytes", readBts)
|
| 177 |
+
return fmt.Errorf("message content is shorter than read bytes: %d < %d", len(msgContent), readBts)
|
| 178 |
+
}
|
| 179 |
+
fmt.Println(msgContent[readBts:])
|
| 180 |
+
messageReadBytes[result.Message.ID] = len(msgContent)
|
| 181 |
+
|
| 182 |
+
slog.Info("Non-interactive: run completed", "session_id", sess.ID)
|
| 183 |
+
return nil
|
| 184 |
+
|
| 185 |
+
case event := <-messageEvents:
|
| 186 |
+
msg := event.Payload
|
| 187 |
+
if msg.SessionID == sess.ID && msg.Role == message.Assistant && len(msg.Parts) > 0 {
|
| 188 |
+
stopSpinner()
|
| 189 |
+
|
| 190 |
+
content := msg.Content().String()
|
| 191 |
+
readBytes := messageReadBytes[msg.ID]
|
| 192 |
+
|
| 193 |
+
if len(content) < readBytes {
|
| 194 |
+
slog.Error("Non-interactive: message content is shorter than read bytes", "message_length", len(content), "read_bytes", readBytes)
|
| 195 |
+
return fmt.Errorf("message content is shorter than read bytes: %d < %d", len(content), readBytes)
|
| 196 |
+
}
|
| 197 |
+
|
| 198 |
+
part := content[readBytes:]
|
| 199 |
+
fmt.Print(part)
|
| 200 |
+
messageReadBytes[msg.ID] = len(content)
|
| 201 |
+
}
|
| 202 |
+
|
| 203 |
+
case <-ctx.Done():
|
| 204 |
+
stopSpinner()
|
| 205 |
+
return ctx.Err()
|
| 206 |
+
}
|
| 207 |
+
}
|
| 208 |
+
}
|
| 209 |
+
|
| 210 |
+
func (app *App) UpdateAgentModel() error {
|
| 211 |
+
return app.CoderAgent.UpdateModel()
|
| 212 |
+
}
|
| 213 |
+
|
| 214 |
+
func (app *App) setupEvents() {
|
| 215 |
+
ctx, cancel := context.WithCancel(app.globalCtx)
|
| 216 |
+
app.eventsCtx = ctx
|
| 217 |
+
setupSubscriber(ctx, app.serviceEventsWG, "sessions", app.Sessions.Subscribe, app.events)
|
| 218 |
+
setupSubscriber(ctx, app.serviceEventsWG, "messages", app.Messages.Subscribe, app.events)
|
| 219 |
+
setupSubscriber(ctx, app.serviceEventsWG, "permissions", app.Permissions.Subscribe, app.events)
|
| 220 |
+
setupSubscriber(ctx, app.serviceEventsWG, "permissions-notifications", app.Permissions.SubscribeNotifications, app.events)
|
| 221 |
+
setupSubscriber(ctx, app.serviceEventsWG, "history", app.History.Subscribe, app.events)
|
| 222 |
+
setupSubscriber(ctx, app.serviceEventsWG, "mcp", agent.SubscribeMCPEvents, app.events)
|
| 223 |
+
setupSubscriber(ctx, app.serviceEventsWG, "lsp", SubscribeLSPEvents, app.events)
|
| 224 |
+
cleanupFunc := func() {
|
| 225 |
+
cancel()
|
| 226 |
+
app.serviceEventsWG.Wait()
|
| 227 |
+
}
|
| 228 |
+
app.cleanupFuncs = append(app.cleanupFuncs, cleanupFunc)
|
| 229 |
+
}
|
| 230 |
+
|
| 231 |
+
func setupSubscriber[T any](
|
| 232 |
+
ctx context.Context,
|
| 233 |
+
wg *sync.WaitGroup,
|
| 234 |
+
name string,
|
| 235 |
+
subscriber func(context.Context) <-chan pubsub.Event[T],
|
| 236 |
+
outputCh chan<- tea.Msg,
|
| 237 |
+
) {
|
| 238 |
+
wg.Go(func() {
|
| 239 |
+
subCh := subscriber(ctx)
|
| 240 |
+
for {
|
| 241 |
+
select {
|
| 242 |
+
case event, ok := <-subCh:
|
| 243 |
+
if !ok {
|
| 244 |
+
slog.Debug("subscription channel closed", "name", name)
|
| 245 |
+
return
|
| 246 |
+
}
|
| 247 |
+
var msg tea.Msg = event
|
| 248 |
+
select {
|
| 249 |
+
case outputCh <- msg:
|
| 250 |
+
case <-time.After(2 * time.Second):
|
| 251 |
+
slog.Warn("message dropped due to slow consumer", "name", name)
|
| 252 |
+
case <-ctx.Done():
|
| 253 |
+
slog.Debug("subscription cancelled", "name", name)
|
| 254 |
+
return
|
| 255 |
+
}
|
| 256 |
+
case <-ctx.Done():
|
| 257 |
+
slog.Debug("subscription cancelled", "name", name)
|
| 258 |
+
return
|
| 259 |
+
}
|
| 260 |
+
}
|
| 261 |
+
})
|
| 262 |
+
}
|
| 263 |
+
|
| 264 |
+
func (app *App) InitCoderAgent() error {
|
| 265 |
+
coderAgentCfg := app.config.Agents["coder"]
|
| 266 |
+
if coderAgentCfg.ID == "" {
|
| 267 |
+
return fmt.Errorf("coder agent configuration is missing")
|
| 268 |
+
}
|
| 269 |
+
var err error
|
| 270 |
+
app.CoderAgent, err = agent.NewAgent(
|
| 271 |
+
app.globalCtx,
|
| 272 |
+
coderAgentCfg,
|
| 273 |
+
app.Permissions,
|
| 274 |
+
app.Sessions,
|
| 275 |
+
app.Messages,
|
| 276 |
+
app.History,
|
| 277 |
+
app.LSPClients,
|
| 278 |
+
)
|
| 279 |
+
if err != nil {
|
| 280 |
+
slog.Error("Failed to create coder agent", "err", err)
|
| 281 |
+
return err
|
| 282 |
+
}
|
| 283 |
+
|
| 284 |
+
// Add MCP client cleanup to shutdown process
|
| 285 |
+
app.cleanupFuncs = append(app.cleanupFuncs, agent.CloseMCPClients)
|
| 286 |
+
|
| 287 |
+
setupSubscriber(app.eventsCtx, app.serviceEventsWG, "coderAgent", app.CoderAgent.Subscribe, app.events)
|
| 288 |
+
return nil
|
| 289 |
+
}
|
| 290 |
+
|
| 291 |
+
// Subscribe sends events to the TUI as tea.Msgs.
|
| 292 |
+
func (app *App) Subscribe(program *tea.Program) {
|
| 293 |
+
defer log.RecoverPanic("app.Subscribe", func() {
|
| 294 |
+
slog.Info("TUI subscription panic: attempting graceful shutdown")
|
| 295 |
+
program.Quit()
|
| 296 |
+
})
|
| 297 |
+
|
| 298 |
+
app.tuiWG.Add(1)
|
| 299 |
+
tuiCtx, tuiCancel := context.WithCancel(app.globalCtx)
|
| 300 |
+
app.cleanupFuncs = append(app.cleanupFuncs, func() {
|
| 301 |
+
slog.Debug("Cancelling TUI message handler")
|
| 302 |
+
tuiCancel()
|
| 303 |
+
app.tuiWG.Wait()
|
| 304 |
+
})
|
| 305 |
+
defer app.tuiWG.Done()
|
| 306 |
+
|
| 307 |
+
for {
|
| 308 |
+
select {
|
| 309 |
+
case <-tuiCtx.Done():
|
| 310 |
+
slog.Debug("TUI message handler shutting down")
|
| 311 |
+
return
|
| 312 |
+
case msg, ok := <-app.events:
|
| 313 |
+
if !ok {
|
| 314 |
+
slog.Debug("TUI message channel closed")
|
| 315 |
+
return
|
| 316 |
+
}
|
| 317 |
+
program.Send(msg)
|
| 318 |
+
}
|
| 319 |
+
}
|
| 320 |
+
}
|
| 321 |
+
|
| 322 |
+
// Shutdown performs a graceful shutdown of the application.
|
| 323 |
+
func (app *App) Shutdown() {
|
| 324 |
+
if app.CoderAgent != nil {
|
| 325 |
+
app.CoderAgent.CancelAll()
|
| 326 |
+
}
|
| 327 |
+
|
| 328 |
+
for cancel := range app.watcherCancelFuncs.Seq() {
|
| 329 |
+
cancel()
|
| 330 |
+
}
|
| 331 |
+
|
| 332 |
+
// Wait for all LSP watchers to finish.
|
| 333 |
+
app.lspWatcherWG.Wait()
|
| 334 |
+
|
| 335 |
+
// Get all LSP clients.
|
| 336 |
+
app.clientsMutex.RLock()
|
| 337 |
+
clients := make(map[string]*lsp.Client, len(app.LSPClients))
|
| 338 |
+
maps.Copy(clients, app.LSPClients)
|
| 339 |
+
app.clientsMutex.RUnlock()
|
| 340 |
+
|
| 341 |
+
// Shutdown all LSP clients.
|
| 342 |
+
for name, client := range clients {
|
| 343 |
+
shutdownCtx, cancel := context.WithTimeout(app.globalCtx, 5*time.Second)
|
| 344 |
+
if err := client.Shutdown(shutdownCtx); err != nil {
|
| 345 |
+
slog.Error("Failed to shutdown LSP client", "name", name, "error", err)
|
| 346 |
+
}
|
| 347 |
+
cancel()
|
| 348 |
+
}
|
| 349 |
+
|
| 350 |
+
// Call call cleanup functions.
|
| 351 |
+
for _, cleanup := range app.cleanupFuncs {
|
| 352 |
+
if cleanup != nil {
|
| 353 |
+
cleanup()
|
| 354 |
+
}
|
| 355 |
+
}
|
| 356 |
+
}
|
projects/ui/crush/internal/app/lsp.go
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
package app
|
| 2 |
+
|
| 3 |
+
import (
|
| 4 |
+
"context"
|
| 5 |
+
"log/slog"
|
| 6 |
+
"time"
|
| 7 |
+
|
| 8 |
+
"github.com/charmbracelet/crush/internal/config"
|
| 9 |
+
"github.com/charmbracelet/crush/internal/log"
|
| 10 |
+
"github.com/charmbracelet/crush/internal/lsp"
|
| 11 |
+
"github.com/charmbracelet/crush/internal/lsp/watcher"
|
| 12 |
+
)
|
| 13 |
+
|
| 14 |
+
// initLSPClients initializes LSP clients.
|
| 15 |
+
func (app *App) initLSPClients(ctx context.Context) {
|
| 16 |
+
for name, clientConfig := range app.config.LSP {
|
| 17 |
+
go app.createAndStartLSPClient(ctx, name, clientConfig)
|
| 18 |
+
}
|
| 19 |
+
slog.Info("LSP clients initialization started in background")
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
// createAndStartLSPClient creates a new LSP client, initializes it, and starts its workspace watcher
|
| 23 |
+
func (app *App) createAndStartLSPClient(ctx context.Context, name string, config config.LSPConfig) {
|
| 24 |
+
slog.Info("Creating LSP client", "name", name, "command", config.Command, "fileTypes", config.FileTypes, "args", config.Args)
|
| 25 |
+
|
| 26 |
+
// Update state to starting
|
| 27 |
+
updateLSPState(name, lsp.StateStarting, nil, nil, 0)
|
| 28 |
+
|
| 29 |
+
// Create LSP client.
|
| 30 |
+
lspClient, err := lsp.NewClient(ctx, name, config)
|
| 31 |
+
if err != nil {
|
| 32 |
+
slog.Error("Failed to create LSP client for", name, err)
|
| 33 |
+
updateLSPState(name, lsp.StateError, err, nil, 0)
|
| 34 |
+
return
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
// Set diagnostics callback
|
| 38 |
+
lspClient.SetDiagnosticsCallback(updateLSPDiagnostics)
|
| 39 |
+
|
| 40 |
+
// Increase initialization timeout as some servers take more time to start.
|
| 41 |
+
initCtx, cancel := context.WithTimeout(ctx, 30*time.Second)
|
| 42 |
+
defer cancel()
|
| 43 |
+
|
| 44 |
+
// Initialize LSP client.
|
| 45 |
+
_, err = lspClient.InitializeLSPClient(initCtx, app.config.WorkingDir())
|
| 46 |
+
if err != nil {
|
| 47 |
+
slog.Error("Initialize failed", "name", name, "error", err)
|
| 48 |
+
updateLSPState(name, lsp.StateError, err, lspClient, 0)
|
| 49 |
+
lspClient.Close()
|
| 50 |
+
return
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
// Wait for the server to be ready.
|
| 54 |
+
if err := lspClient.WaitForServerReady(initCtx); err != nil {
|
| 55 |
+
slog.Error("Server failed to become ready", "name", name, "error", err)
|
| 56 |
+
// Server never reached a ready state, but let's continue anyway, as
|
| 57 |
+
// some functionality might still work.
|
| 58 |
+
lspClient.SetServerState(lsp.StateError)
|
| 59 |
+
updateLSPState(name, lsp.StateError, err, lspClient, 0)
|
| 60 |
+
} else {
|
| 61 |
+
// Server reached a ready state scuccessfully.
|
| 62 |
+
slog.Info("LSP server is ready", "name", name)
|
| 63 |
+
lspClient.SetServerState(lsp.StateReady)
|
| 64 |
+
updateLSPState(name, lsp.StateReady, nil, lspClient, 0)
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
slog.Info("LSP client initialized", "name", name)
|
| 68 |
+
|
| 69 |
+
// Create a child context that can be canceled when the app is shutting
|
| 70 |
+
// down.
|
| 71 |
+
watchCtx, cancelFunc := context.WithCancel(ctx)
|
| 72 |
+
|
| 73 |
+
// Create the workspace watcher.
|
| 74 |
+
workspaceWatcher := watcher.NewWorkspaceWatcher(name, lspClient)
|
| 75 |
+
|
| 76 |
+
// Store the cancel function to be called during cleanup.
|
| 77 |
+
app.watcherCancelFuncs.Append(cancelFunc)
|
| 78 |
+
|
| 79 |
+
// Add to map with mutex protection before starting goroutine
|
| 80 |
+
app.clientsMutex.Lock()
|
| 81 |
+
app.LSPClients[name] = lspClient
|
| 82 |
+
app.clientsMutex.Unlock()
|
| 83 |
+
|
| 84 |
+
// Run workspace watcher.
|
| 85 |
+
app.lspWatcherWG.Add(1)
|
| 86 |
+
go app.runWorkspaceWatcher(watchCtx, name, workspaceWatcher)
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
// runWorkspaceWatcher executes the workspace watcher for an LSP client.
|
| 90 |
+
func (app *App) runWorkspaceWatcher(ctx context.Context, name string, workspaceWatcher *watcher.WorkspaceWatcher) {
|
| 91 |
+
defer app.lspWatcherWG.Done()
|
| 92 |
+
defer log.RecoverPanic("LSP-"+name, func() {
|
| 93 |
+
// Try to restart the client.
|
| 94 |
+
app.restartLSPClient(ctx, name)
|
| 95 |
+
})
|
| 96 |
+
|
| 97 |
+
workspaceWatcher.WatchWorkspace(ctx, app.config.WorkingDir())
|
| 98 |
+
slog.Info("Workspace watcher stopped", "client", name)
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
// restartLSPClient attempts to restart a crashed or failed LSP client.
|
| 102 |
+
func (app *App) restartLSPClient(ctx context.Context, name string) {
|
| 103 |
+
// Get the original configuration.
|
| 104 |
+
clientConfig, exists := app.config.LSP[name]
|
| 105 |
+
if !exists {
|
| 106 |
+
slog.Error("Cannot restart client, configuration not found", "client", name)
|
| 107 |
+
return
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
// Clean up the old client if it exists.
|
| 111 |
+
app.clientsMutex.Lock()
|
| 112 |
+
oldClient, exists := app.LSPClients[name]
|
| 113 |
+
if exists {
|
| 114 |
+
// Remove from map before potentially slow shutdown.
|
| 115 |
+
delete(app.LSPClients, name)
|
| 116 |
+
}
|
| 117 |
+
app.clientsMutex.Unlock()
|
| 118 |
+
|
| 119 |
+
if exists && oldClient != nil {
|
| 120 |
+
// Try to shut down client gracefully, but don't block on errors.
|
| 121 |
+
shutdownCtx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
| 122 |
+
_ = oldClient.Shutdown(shutdownCtx)
|
| 123 |
+
cancel()
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
+
// Create a new client using the shared function.
|
| 127 |
+
app.createAndStartLSPClient(ctx, name, clientConfig)
|
| 128 |
+
slog.Info("Successfully restarted LSP client", "client", name)
|
| 129 |
+
}
|
projects/ui/crush/internal/app/lsp_events.go
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
package app
|
| 2 |
+
|
| 3 |
+
import (
|
| 4 |
+
"context"
|
| 5 |
+
"maps"
|
| 6 |
+
"time"
|
| 7 |
+
|
| 8 |
+
"github.com/charmbracelet/crush/internal/csync"
|
| 9 |
+
"github.com/charmbracelet/crush/internal/lsp"
|
| 10 |
+
"github.com/charmbracelet/crush/internal/pubsub"
|
| 11 |
+
)
|
| 12 |
+
|
| 13 |
+
// LSPEventType represents the type of LSP event
|
| 14 |
+
type LSPEventType string
|
| 15 |
+
|
| 16 |
+
const (
|
| 17 |
+
LSPEventStateChanged LSPEventType = "state_changed"
|
| 18 |
+
LSPEventDiagnosticsChanged LSPEventType = "diagnostics_changed"
|
| 19 |
+
)
|
| 20 |
+
|
| 21 |
+
// LSPEvent represents an event in the LSP system
|
| 22 |
+
type LSPEvent struct {
|
| 23 |
+
Type LSPEventType
|
| 24 |
+
Name string
|
| 25 |
+
State lsp.ServerState
|
| 26 |
+
Error error
|
| 27 |
+
DiagnosticCount int
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
// LSPClientInfo holds information about an LSP client's state
|
| 31 |
+
type LSPClientInfo struct {
|
| 32 |
+
Name string
|
| 33 |
+
State lsp.ServerState
|
| 34 |
+
Error error
|
| 35 |
+
Client *lsp.Client
|
| 36 |
+
DiagnosticCount int
|
| 37 |
+
ConnectedAt time.Time
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
var (
|
| 41 |
+
lspStates = csync.NewMap[string, LSPClientInfo]()
|
| 42 |
+
lspBroker = pubsub.NewBroker[LSPEvent]()
|
| 43 |
+
)
|
| 44 |
+
|
| 45 |
+
// SubscribeLSPEvents returns a channel for LSP events
|
| 46 |
+
func SubscribeLSPEvents(ctx context.Context) <-chan pubsub.Event[LSPEvent] {
|
| 47 |
+
return lspBroker.Subscribe(ctx)
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
// GetLSPStates returns the current state of all LSP clients
|
| 51 |
+
func GetLSPStates() map[string]LSPClientInfo {
|
| 52 |
+
return maps.Collect(lspStates.Seq2())
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
// GetLSPState returns the state of a specific LSP client
|
| 56 |
+
func GetLSPState(name string) (LSPClientInfo, bool) {
|
| 57 |
+
return lspStates.Get(name)
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
// updateLSPState updates the state of an LSP client and publishes an event
|
| 61 |
+
func updateLSPState(name string, state lsp.ServerState, err error, client *lsp.Client, diagnosticCount int) {
|
| 62 |
+
info := LSPClientInfo{
|
| 63 |
+
Name: name,
|
| 64 |
+
State: state,
|
| 65 |
+
Error: err,
|
| 66 |
+
Client: client,
|
| 67 |
+
DiagnosticCount: diagnosticCount,
|
| 68 |
+
}
|
| 69 |
+
if state == lsp.StateReady {
|
| 70 |
+
info.ConnectedAt = time.Now()
|
| 71 |
+
}
|
| 72 |
+
lspStates.Set(name, info)
|
| 73 |
+
|
| 74 |
+
// Publish state change event
|
| 75 |
+
lspBroker.Publish(pubsub.UpdatedEvent, LSPEvent{
|
| 76 |
+
Type: LSPEventStateChanged,
|
| 77 |
+
Name: name,
|
| 78 |
+
State: state,
|
| 79 |
+
Error: err,
|
| 80 |
+
DiagnosticCount: diagnosticCount,
|
| 81 |
+
})
|
| 82 |
+
}
|
| 83 |
+
|
| 84 |
+
// updateLSPDiagnostics updates the diagnostic count for an LSP client and publishes an event
|
| 85 |
+
func updateLSPDiagnostics(name string, diagnosticCount int) {
|
| 86 |
+
if info, exists := lspStates.Get(name); exists {
|
| 87 |
+
info.DiagnosticCount = diagnosticCount
|
| 88 |
+
lspStates.Set(name, info)
|
| 89 |
+
|
| 90 |
+
// Publish diagnostics change event
|
| 91 |
+
lspBroker.Publish(pubsub.UpdatedEvent, LSPEvent{
|
| 92 |
+
Type: LSPEventDiagnosticsChanged,
|
| 93 |
+
Name: name,
|
| 94 |
+
State: info.State,
|
| 95 |
+
Error: info.Error,
|
| 96 |
+
DiagnosticCount: diagnosticCount,
|
| 97 |
+
})
|
| 98 |
+
}
|
| 99 |
+
}
|
projects/ui/crush/internal/cmd/logs.go
ADDED
|
@@ -0,0 +1,212 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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"
|
| 5 |
+
"encoding/json"
|
| 6 |
+
"fmt"
|
| 7 |
+
"io"
|
| 8 |
+
"os"
|
| 9 |
+
"path/filepath"
|
| 10 |
+
"slices"
|
| 11 |
+
"time"
|
| 12 |
+
|
| 13 |
+
"github.com/charmbracelet/crush/internal/config"
|
| 14 |
+
"github.com/charmbracelet/log/v2"
|
| 15 |
+
"github.com/nxadm/tail"
|
| 16 |
+
"github.com/spf13/cobra"
|
| 17 |
+
)
|
| 18 |
+
|
| 19 |
+
const defaultTailLines = 1000
|
| 20 |
+
|
| 21 |
+
var logsCmd = &cobra.Command{
|
| 22 |
+
Use: "logs",
|
| 23 |
+
Short: "View crush logs",
|
| 24 |
+
Long: `View the logs generated by Crush. This command allows you to see the log output for debugging and monitoring.`,
|
| 25 |
+
RunE: func(cmd *cobra.Command, args []string) error {
|
| 26 |
+
cwd, err := cmd.Flags().GetString("cwd")
|
| 27 |
+
if err != nil {
|
| 28 |
+
return fmt.Errorf("failed to get current working directory: %v", err)
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
dataDir, err := cmd.Flags().GetString("data-dir")
|
| 32 |
+
if err != nil {
|
| 33 |
+
return fmt.Errorf("failed to get data directory: %v", err)
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
follow, err := cmd.Flags().GetBool("follow")
|
| 37 |
+
if err != nil {
|
| 38 |
+
return fmt.Errorf("failed to get follow flag: %v", err)
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
tailLines, err := cmd.Flags().GetInt("tail")
|
| 42 |
+
if err != nil {
|
| 43 |
+
return fmt.Errorf("failed to get tail flag: %v", err)
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
log.SetLevel(log.DebugLevel)
|
| 47 |
+
log.SetOutput(os.Stdout)
|
| 48 |
+
|
| 49 |
+
cfg, err := config.Load(cwd, dataDir, false)
|
| 50 |
+
if err != nil {
|
| 51 |
+
return fmt.Errorf("failed to load configuration: %v", err)
|
| 52 |
+
}
|
| 53 |
+
logsFile := filepath.Join(cfg.Options.DataDirectory, "logs", "crush.log")
|
| 54 |
+
_, err = os.Stat(logsFile)
|
| 55 |
+
if os.IsNotExist(err) {
|
| 56 |
+
log.Warn("Looks like you are not in a crush project. No logs found.")
|
| 57 |
+
return nil
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
if follow {
|
| 61 |
+
return followLogs(cmd.Context(), logsFile, tailLines)
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
return showLogs(logsFile, tailLines)
|
| 65 |
+
},
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
func init() {
|
| 69 |
+
logsCmd.Flags().BoolP("follow", "f", false, "Follow log output")
|
| 70 |
+
logsCmd.Flags().IntP("tail", "t", defaultTailLines, "Show only the last N lines default: 1000 for performance")
|
| 71 |
+
rootCmd.AddCommand(logsCmd)
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
func followLogs(ctx context.Context, logsFile string, tailLines int) error {
|
| 75 |
+
t, err := tail.TailFile(logsFile, tail.Config{
|
| 76 |
+
Follow: false,
|
| 77 |
+
ReOpen: false,
|
| 78 |
+
Logger: tail.DiscardingLogger,
|
| 79 |
+
})
|
| 80 |
+
if err != nil {
|
| 81 |
+
return fmt.Errorf("failed to tail log file: %v", err)
|
| 82 |
+
}
|
| 83 |
+
|
| 84 |
+
var lines []string
|
| 85 |
+
for line := range t.Lines {
|
| 86 |
+
if line.Err != nil {
|
| 87 |
+
continue
|
| 88 |
+
}
|
| 89 |
+
lines = append(lines, line.Text)
|
| 90 |
+
if len(lines) > tailLines {
|
| 91 |
+
lines = lines[len(lines)-tailLines:]
|
| 92 |
+
}
|
| 93 |
+
}
|
| 94 |
+
t.Stop()
|
| 95 |
+
|
| 96 |
+
for _, line := range lines {
|
| 97 |
+
printLogLine(line)
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
if len(lines) == tailLines {
|
| 101 |
+
fmt.Fprintf(os.Stderr, "\nShowing last %d lines. Full logs available at: %s\n", tailLines, logsFile)
|
| 102 |
+
fmt.Fprintf(os.Stderr, "Following new log entries...\n\n")
|
| 103 |
+
}
|
| 104 |
+
|
| 105 |
+
t, err = tail.TailFile(logsFile, tail.Config{
|
| 106 |
+
Follow: true,
|
| 107 |
+
ReOpen: true,
|
| 108 |
+
Logger: tail.DiscardingLogger,
|
| 109 |
+
Location: &tail.SeekInfo{Offset: 0, Whence: io.SeekEnd},
|
| 110 |
+
})
|
| 111 |
+
if err != nil {
|
| 112 |
+
return fmt.Errorf("failed to tail log file: %v", err)
|
| 113 |
+
}
|
| 114 |
+
defer t.Stop()
|
| 115 |
+
|
| 116 |
+
for {
|
| 117 |
+
select {
|
| 118 |
+
case line := <-t.Lines:
|
| 119 |
+
if line.Err != nil {
|
| 120 |
+
continue
|
| 121 |
+
}
|
| 122 |
+
printLogLine(line.Text)
|
| 123 |
+
case <-ctx.Done():
|
| 124 |
+
return nil
|
| 125 |
+
}
|
| 126 |
+
}
|
| 127 |
+
}
|
| 128 |
+
|
| 129 |
+
func showLogs(logsFile string, tailLines int) error {
|
| 130 |
+
t, err := tail.TailFile(logsFile, tail.Config{
|
| 131 |
+
Follow: false,
|
| 132 |
+
ReOpen: false,
|
| 133 |
+
Logger: tail.DiscardingLogger,
|
| 134 |
+
MaxLineSize: 0,
|
| 135 |
+
})
|
| 136 |
+
if err != nil {
|
| 137 |
+
return fmt.Errorf("failed to tail log file: %v", err)
|
| 138 |
+
}
|
| 139 |
+
defer t.Stop()
|
| 140 |
+
|
| 141 |
+
var lines []string
|
| 142 |
+
for line := range t.Lines {
|
| 143 |
+
if line.Err != nil {
|
| 144 |
+
continue
|
| 145 |
+
}
|
| 146 |
+
lines = append(lines, line.Text)
|
| 147 |
+
if len(lines) > tailLines {
|
| 148 |
+
lines = lines[len(lines)-tailLines:]
|
| 149 |
+
}
|
| 150 |
+
}
|
| 151 |
+
|
| 152 |
+
for _, line := range lines {
|
| 153 |
+
printLogLine(line)
|
| 154 |
+
}
|
| 155 |
+
|
| 156 |
+
if len(lines) == tailLines {
|
| 157 |
+
fmt.Fprintf(os.Stderr, "\nShowing last %d lines. Full logs available at: %s\n", tailLines, logsFile)
|
| 158 |
+
}
|
| 159 |
+
|
| 160 |
+
return nil
|
| 161 |
+
}
|
| 162 |
+
|
| 163 |
+
func printLogLine(lineText string) {
|
| 164 |
+
var data map[string]any
|
| 165 |
+
if err := json.Unmarshal([]byte(lineText), &data); err != nil {
|
| 166 |
+
return
|
| 167 |
+
}
|
| 168 |
+
msg := data["msg"]
|
| 169 |
+
level := data["level"]
|
| 170 |
+
otherData := []any{}
|
| 171 |
+
keys := []string{}
|
| 172 |
+
for k := range data {
|
| 173 |
+
keys = append(keys, k)
|
| 174 |
+
}
|
| 175 |
+
slices.Sort(keys)
|
| 176 |
+
for _, k := range keys {
|
| 177 |
+
switch k {
|
| 178 |
+
case "msg", "level", "time":
|
| 179 |
+
continue
|
| 180 |
+
case "source":
|
| 181 |
+
source, ok := data[k].(map[string]any)
|
| 182 |
+
if !ok {
|
| 183 |
+
continue
|
| 184 |
+
}
|
| 185 |
+
sourceFile := fmt.Sprintf("%s:%d", source["file"], int(source["line"].(float64)))
|
| 186 |
+
otherData = append(otherData, "source", sourceFile)
|
| 187 |
+
|
| 188 |
+
default:
|
| 189 |
+
otherData = append(otherData, k, data[k])
|
| 190 |
+
}
|
| 191 |
+
}
|
| 192 |
+
log.SetTimeFunction(func(_ time.Time) time.Time {
|
| 193 |
+
// parse the timestamp from the log line if available
|
| 194 |
+
t, err := time.Parse(time.RFC3339, data["time"].(string))
|
| 195 |
+
if err != nil {
|
| 196 |
+
return time.Now() // fallback to current time if parsing fails
|
| 197 |
+
}
|
| 198 |
+
return t
|
| 199 |
+
})
|
| 200 |
+
switch level {
|
| 201 |
+
case "INFO":
|
| 202 |
+
log.Info(msg, otherData...)
|
| 203 |
+
case "DEBUG":
|
| 204 |
+
log.Debug(msg, otherData...)
|
| 205 |
+
case "ERROR":
|
| 206 |
+
log.Error(msg, otherData...)
|
| 207 |
+
case "WARN":
|
| 208 |
+
log.Warn(msg, otherData...)
|
| 209 |
+
default:
|
| 210 |
+
log.Info(msg, otherData...)
|
| 211 |
+
}
|
| 212 |
+
}
|
projects/ui/crush/scripts/run-issue-labeler.sh
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
ISSUES=$(gh issue list --state=all --limit=1000 --json "number" -t '{{range .}}{{printf "%.0f\n" .number}}{{end}}')
|
| 2 |
+
PRS=$(gh pr list --state=all --limit=1000 --json "number" -t '{{range .}}{{printf "%.0f\n" .number}}{{end}}')
|
| 3 |
+
|
| 4 |
+
for issue in $ISSUES; do
|
| 5 |
+
echo "Dispatching issue-labeler.yml for $issue"
|
| 6 |
+
gh workflow run issue-labeler.yml -f issue-number="$issue"
|
| 7 |
+
done
|
| 8 |
+
|
| 9 |
+
for pr in $PRS; do
|
| 10 |
+
echo "Dispatching issue-labeler.yml for $pr"
|
| 11 |
+
gh workflow run issue-labeler.yml -f issue-number="$pr"
|
| 12 |
+
done
|
projects/ui/serena-new/test/solidlsp/zig/test_zig_basic.py
ADDED
|
@@ -0,0 +1,343 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Basic integration tests for Zig language server functionality.
|
| 3 |
+
|
| 4 |
+
These tests validate symbol finding and navigation capabilities using the Zig Language Server (ZLS).
|
| 5 |
+
Note: ZLS requires files to be open in the editor to find cross-file references (performance optimization).
|
| 6 |
+
"""
|
| 7 |
+
|
| 8 |
+
import os
|
| 9 |
+
import sys
|
| 10 |
+
|
| 11 |
+
import pytest
|
| 12 |
+
|
| 13 |
+
from solidlsp import SolidLanguageServer
|
| 14 |
+
from solidlsp.ls_config import Language
|
| 15 |
+
from solidlsp.ls_types import SymbolKind
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
@pytest.mark.zig
|
| 19 |
+
@pytest.mark.skipif(
|
| 20 |
+
sys.platform == "win32", reason="ZLS is disabled on Windows - cross-file references don't work reliably. Reason unknown."
|
| 21 |
+
)
|
| 22 |
+
class TestZigLanguageServer:
|
| 23 |
+
"""Test Zig language server symbol finding and navigation capabilities.
|
| 24 |
+
|
| 25 |
+
NOTE: All tests are skipped on Windows as ZLS is disabled on that platform
|
| 26 |
+
due to unreliable cross-file reference functionality. Reason unknown.
|
| 27 |
+
"""
|
| 28 |
+
|
| 29 |
+
@pytest.mark.parametrize("language_server", [Language.ZIG], indirect=True)
|
| 30 |
+
def test_find_symbols_in_main(self, language_server: SolidLanguageServer) -> None:
|
| 31 |
+
"""Test finding specific symbols in main.zig."""
|
| 32 |
+
file_path = os.path.join("src", "main.zig")
|
| 33 |
+
symbols = language_server.request_document_symbols(file_path)
|
| 34 |
+
|
| 35 |
+
assert symbols is not None
|
| 36 |
+
assert len(symbols) > 0
|
| 37 |
+
|
| 38 |
+
# Extract symbol names from the returned structure
|
| 39 |
+
symbol_list = symbols[0] if isinstance(symbols, tuple) else symbols
|
| 40 |
+
symbol_names = {sym.get("name") for sym in symbol_list if isinstance(sym, dict)}
|
| 41 |
+
|
| 42 |
+
# Verify specific symbols exist
|
| 43 |
+
assert "main" in symbol_names, "main function not found"
|
| 44 |
+
assert "greeting" in symbol_names, "greeting function not found"
|
| 45 |
+
|
| 46 |
+
@pytest.mark.parametrize("language_server", [Language.ZIG], indirect=True)
|
| 47 |
+
def test_find_symbols_in_calculator(self, language_server: SolidLanguageServer) -> None:
|
| 48 |
+
"""Test finding Calculator struct and its methods."""
|
| 49 |
+
file_path = os.path.join("src", "calculator.zig")
|
| 50 |
+
symbols = language_server.request_document_symbols(file_path)
|
| 51 |
+
|
| 52 |
+
assert symbols is not None
|
| 53 |
+
assert len(symbols) > 0
|
| 54 |
+
|
| 55 |
+
symbol_list = symbols[0] if isinstance(symbols, tuple) else symbols
|
| 56 |
+
|
| 57 |
+
# Find Calculator struct
|
| 58 |
+
calculator_symbol = None
|
| 59 |
+
for sym in symbol_list:
|
| 60 |
+
if sym.get("name") == "Calculator":
|
| 61 |
+
calculator_symbol = sym
|
| 62 |
+
break
|
| 63 |
+
|
| 64 |
+
assert calculator_symbol is not None, "Calculator struct not found"
|
| 65 |
+
# ZLS may use different symbol kinds for structs (14 = Namespace, 5 = Class, 23 = Struct)
|
| 66 |
+
assert calculator_symbol.get("kind") in [
|
| 67 |
+
SymbolKind.Class,
|
| 68 |
+
SymbolKind.Struct,
|
| 69 |
+
SymbolKind.Namespace,
|
| 70 |
+
5,
|
| 71 |
+
14,
|
| 72 |
+
23,
|
| 73 |
+
], "Calculator should be a struct/class/namespace"
|
| 74 |
+
|
| 75 |
+
# Check for Calculator methods (init, add, subtract, etc.)
|
| 76 |
+
# Methods might be in children or at the same level
|
| 77 |
+
all_symbols = []
|
| 78 |
+
for sym in symbol_list:
|
| 79 |
+
all_symbols.append(sym.get("name"))
|
| 80 |
+
if "children" in sym:
|
| 81 |
+
for child in sym["children"]:
|
| 82 |
+
all_symbols.append(child.get("name"))
|
| 83 |
+
|
| 84 |
+
# Verify exact calculator methods exist
|
| 85 |
+
expected_methods = {"init", "add", "subtract", "multiply", "divide"}
|
| 86 |
+
found_methods = set(all_symbols) & expected_methods
|
| 87 |
+
assert found_methods == expected_methods, f"Expected exactly {expected_methods}, found: {found_methods}"
|
| 88 |
+
|
| 89 |
+
@pytest.mark.parametrize("language_server", [Language.ZIG], indirect=True)
|
| 90 |
+
def test_find_symbols_in_math_utils(self, language_server: SolidLanguageServer) -> None:
|
| 91 |
+
"""Test finding functions in math_utils.zig."""
|
| 92 |
+
file_path = os.path.join("src", "math_utils.zig")
|
| 93 |
+
symbols = language_server.request_document_symbols(file_path)
|
| 94 |
+
|
| 95 |
+
assert symbols is not None
|
| 96 |
+
assert len(symbols) > 0
|
| 97 |
+
|
| 98 |
+
symbol_list = symbols[0] if isinstance(symbols, tuple) else symbols
|
| 99 |
+
symbol_names = {sym.get("name") for sym in symbol_list if isinstance(sym, dict)}
|
| 100 |
+
|
| 101 |
+
# Verify math utility functions exist
|
| 102 |
+
assert "factorial" in symbol_names, "factorial function not found"
|
| 103 |
+
assert "isPrime" in symbol_names, "isPrime function not found"
|
| 104 |
+
|
| 105 |
+
@pytest.mark.parametrize("language_server", [Language.ZIG], indirect=True)
|
| 106 |
+
def test_find_references_within_file(self, language_server: SolidLanguageServer) -> None:
|
| 107 |
+
"""Test finding references within the same file."""
|
| 108 |
+
file_path = os.path.join("src", "calculator.zig")
|
| 109 |
+
symbols = language_server.request_document_symbols(file_path)
|
| 110 |
+
|
| 111 |
+
symbol_list = symbols[0] if isinstance(symbols, tuple) else symbols
|
| 112 |
+
|
| 113 |
+
# Find Calculator struct
|
| 114 |
+
calculator_symbol = None
|
| 115 |
+
for sym in symbol_list:
|
| 116 |
+
if sym.get("name") == "Calculator":
|
| 117 |
+
calculator_symbol = sym
|
| 118 |
+
break
|
| 119 |
+
|
| 120 |
+
assert calculator_symbol is not None, "Calculator struct not found"
|
| 121 |
+
|
| 122 |
+
# Find references to Calculator within the same file
|
| 123 |
+
sel_range = calculator_symbol.get("selectionRange", calculator_symbol.get("range"))
|
| 124 |
+
assert sel_range is not None, "Calculator symbol has no range information"
|
| 125 |
+
|
| 126 |
+
sel_start = sel_range["start"]
|
| 127 |
+
refs = language_server.request_references(file_path, sel_start["line"], sel_start["character"])
|
| 128 |
+
|
| 129 |
+
assert refs is not None
|
| 130 |
+
assert isinstance(refs, list)
|
| 131 |
+
# ZLS finds references within the same file
|
| 132 |
+
# Calculator is used in 4 test usages (lines 45, 51, 57, 63)
|
| 133 |
+
# Note: ZLS may not include the declaration itself as a reference
|
| 134 |
+
assert len(refs) >= 4, f"Should find at least 4 Calculator references within calculator.zig, found {len(refs)}"
|
| 135 |
+
|
| 136 |
+
# Verify we found the test usages
|
| 137 |
+
ref_lines = sorted([ref["range"]["start"]["line"] for ref in refs])
|
| 138 |
+
test_lines = [44, 50, 56, 62] # 0-indexed: tests at lines 45, 51, 57, 63
|
| 139 |
+
for line in test_lines:
|
| 140 |
+
assert line in ref_lines, f"Should find Calculator reference at line {line + 1}, found at lines {[l + 1 for l in ref_lines]}"
|
| 141 |
+
|
| 142 |
+
@pytest.mark.parametrize("language_server", [Language.ZIG], indirect=True)
|
| 143 |
+
@pytest.mark.skipif(
|
| 144 |
+
sys.platform == "win32", reason="ZLS cross-file references don't work reliably on Windows - URI path handling issues"
|
| 145 |
+
)
|
| 146 |
+
def test_cross_file_references_with_open_files(self, language_server: SolidLanguageServer) -> None:
|
| 147 |
+
"""
|
| 148 |
+
Test finding cross-file references with files open.
|
| 149 |
+
|
| 150 |
+
ZLS limitation: Cross-file references (textDocument/references) only work when
|
| 151 |
+
target files are open. This is a performance optimization in ZLS.
|
| 152 |
+
|
| 153 |
+
NOTE: Disabled on Windows as cross-file references cannot be made to work reliably
|
| 154 |
+
due to URI path handling differences between Windows and Unix systems.
|
| 155 |
+
"""
|
| 156 |
+
import time
|
| 157 |
+
|
| 158 |
+
# Open the files that contain references to enable cross-file search
|
| 159 |
+
with language_server.open_file("build.zig"):
|
| 160 |
+
with language_server.open_file(os.path.join("src", "main.zig")):
|
| 161 |
+
with language_server.open_file(os.path.join("src", "calculator.zig")):
|
| 162 |
+
# Give ZLS a moment to analyze the open files
|
| 163 |
+
time.sleep(1)
|
| 164 |
+
|
| 165 |
+
# Find Calculator struct
|
| 166 |
+
symbols = language_server.request_document_symbols(os.path.join("src", "calculator.zig"))
|
| 167 |
+
symbol_list = symbols[0] if isinstance(symbols, tuple) else symbols
|
| 168 |
+
|
| 169 |
+
calculator_symbol = None
|
| 170 |
+
for sym in symbol_list:
|
| 171 |
+
if sym.get("name") == "Calculator":
|
| 172 |
+
calculator_symbol = sym
|
| 173 |
+
break
|
| 174 |
+
|
| 175 |
+
assert calculator_symbol is not None, "Calculator struct not found"
|
| 176 |
+
|
| 177 |
+
sel_range = calculator_symbol.get("selectionRange", calculator_symbol.get("range"))
|
| 178 |
+
assert sel_range is not None, "Calculator symbol has no range information"
|
| 179 |
+
|
| 180 |
+
# Find references to Calculator
|
| 181 |
+
sel_start = sel_range["start"]
|
| 182 |
+
refs = language_server.request_references(
|
| 183 |
+
os.path.join("src", "calculator.zig"), sel_start["line"], sel_start["character"]
|
| 184 |
+
)
|
| 185 |
+
|
| 186 |
+
assert refs is not None
|
| 187 |
+
assert isinstance(refs, list)
|
| 188 |
+
|
| 189 |
+
# With files open, ZLS should find cross-file references
|
| 190 |
+
main_refs = [ref for ref in refs if "main.zig" in ref.get("uri", "")]
|
| 191 |
+
|
| 192 |
+
assert len(main_refs) >= 1, f"Should find at least 1 Calculator reference in main.zig, found {len(main_refs)}"
|
| 193 |
+
|
| 194 |
+
# Verify exact location in main.zig (line 8, 0-indexed: 7)
|
| 195 |
+
main_ref_line = main_refs[0]["range"]["start"]["line"]
|
| 196 |
+
assert (
|
| 197 |
+
main_ref_line == 7
|
| 198 |
+
), f"Calculator reference in main.zig should be at line 8 (0-indexed: 7), found at line {main_ref_line + 1}"
|
| 199 |
+
|
| 200 |
+
@pytest.mark.parametrize("language_server", [Language.ZIG], indirect=True)
|
| 201 |
+
def test_cross_file_references_within_file(self, language_server: SolidLanguageServer) -> None:
|
| 202 |
+
"""
|
| 203 |
+
Test that ZLS finds references within the same file.
|
| 204 |
+
|
| 205 |
+
Note: ZLS is designed to be lightweight and only analyzes files that are explicitly opened.
|
| 206 |
+
Cross-file references require manually opening the relevant files first.
|
| 207 |
+
"""
|
| 208 |
+
# Find references to Calculator from calculator.zig
|
| 209 |
+
file_path = os.path.join("src", "calculator.zig")
|
| 210 |
+
symbols = language_server.request_document_symbols(file_path)
|
| 211 |
+
symbol_list = symbols[0] if isinstance(symbols, tuple) else symbols
|
| 212 |
+
|
| 213 |
+
calculator_symbol = None
|
| 214 |
+
for sym in symbol_list:
|
| 215 |
+
if sym.get("name") == "Calculator":
|
| 216 |
+
calculator_symbol = sym
|
| 217 |
+
break
|
| 218 |
+
|
| 219 |
+
assert calculator_symbol is not None, "Calculator struct not found"
|
| 220 |
+
|
| 221 |
+
sel_range = calculator_symbol.get("selectionRange", calculator_symbol.get("range"))
|
| 222 |
+
assert sel_range is not None, "Calculator symbol has no range information"
|
| 223 |
+
|
| 224 |
+
sel_start = sel_range["start"]
|
| 225 |
+
refs = language_server.request_references(file_path, sel_start["line"], sel_start["character"])
|
| 226 |
+
|
| 227 |
+
assert refs is not None
|
| 228 |
+
assert isinstance(refs, list)
|
| 229 |
+
|
| 230 |
+
# ZLS finds references within the same file
|
| 231 |
+
# Calculator is used in 4 test usages (lines 45, 51, 57, 63)
|
| 232 |
+
# Note: ZLS may not include the declaration itself as a reference
|
| 233 |
+
assert len(refs) >= 4, f"Should find at least 4 Calculator references within calculator.zig, found {len(refs)}"
|
| 234 |
+
|
| 235 |
+
# Verify we found the test usages
|
| 236 |
+
ref_lines = sorted([ref["range"]["start"]["line"] for ref in refs])
|
| 237 |
+
test_lines = [44, 50, 56, 62] # 0-indexed: tests at lines 45, 51, 57, 63
|
| 238 |
+
for line in test_lines:
|
| 239 |
+
assert line in ref_lines, f"Should find Calculator reference at line {line + 1}, found at lines {[l + 1 for l in ref_lines]}"
|
| 240 |
+
|
| 241 |
+
@pytest.mark.parametrize("language_server", [Language.ZIG], indirect=True)
|
| 242 |
+
@pytest.mark.skipif(
|
| 243 |
+
sys.platform == "win32", reason="ZLS cross-file references don't work reliably on Windows - URI path handling issues"
|
| 244 |
+
)
|
| 245 |
+
def test_go_to_definition_cross_file(self, language_server: SolidLanguageServer) -> None:
|
| 246 |
+
"""
|
| 247 |
+
Test go-to-definition from main.zig to calculator.zig.
|
| 248 |
+
|
| 249 |
+
ZLS capability: Go-to-definition (textDocument/definition) works cross-file
|
| 250 |
+
WITHOUT requiring files to be open.
|
| 251 |
+
|
| 252 |
+
NOTE: Disabled on Windows as cross-file references cannot be made to work reliably
|
| 253 |
+
due to URI path handling differences between Windows and Unix systems.
|
| 254 |
+
"""
|
| 255 |
+
file_path = os.path.join("src", "main.zig")
|
| 256 |
+
|
| 257 |
+
# Line 8: const calc = calculator.Calculator.init();
|
| 258 |
+
# Test go-to-definition for Calculator
|
| 259 |
+
definitions = language_server.request_definition(file_path, 7, 25) # Position of "Calculator"
|
| 260 |
+
|
| 261 |
+
assert definitions is not None
|
| 262 |
+
assert isinstance(definitions, list)
|
| 263 |
+
assert len(definitions) > 0, "Should find definition of Calculator"
|
| 264 |
+
|
| 265 |
+
# Should point to calculator.zig
|
| 266 |
+
calc_def = definitions[0]
|
| 267 |
+
assert "calculator.zig" in calc_def.get("uri", ""), "Definition should be in calculator.zig"
|
| 268 |
+
|
| 269 |
+
@pytest.mark.parametrize("language_server", [Language.ZIG], indirect=True)
|
| 270 |
+
@pytest.mark.skipif(
|
| 271 |
+
sys.platform == "win32", reason="ZLS cross-file references don't work reliably on Windows - URI path handling issues"
|
| 272 |
+
)
|
| 273 |
+
def test_cross_file_function_usage(self, language_server: SolidLanguageServer) -> None:
|
| 274 |
+
"""Test finding usage of functions from math_utils in main.zig.
|
| 275 |
+
|
| 276 |
+
NOTE: Disabled on Windows as cross-file references cannot be made to work reliably
|
| 277 |
+
due to URI path handling differences between Windows and Unix systems.
|
| 278 |
+
"""
|
| 279 |
+
# Line 23 in main.zig: const factorial_result = math_utils.factorial(5);
|
| 280 |
+
definitions = language_server.request_definition(os.path.join("src", "main.zig"), 22, 40) # Position of "factorial"
|
| 281 |
+
|
| 282 |
+
assert definitions is not None
|
| 283 |
+
assert isinstance(definitions, list)
|
| 284 |
+
|
| 285 |
+
if len(definitions) > 0:
|
| 286 |
+
# Should find factorial definition in math_utils.zig
|
| 287 |
+
math_def = [d for d in definitions if "math_utils.zig" in d.get("uri", "")]
|
| 288 |
+
assert len(math_def) > 0, "Should find factorial definition in math_utils.zig"
|
| 289 |
+
|
| 290 |
+
@pytest.mark.parametrize("language_server", [Language.ZIG], indirect=True)
|
| 291 |
+
def test_verify_cross_file_imports(self, language_server: SolidLanguageServer) -> None:
|
| 292 |
+
"""Verify that our test files have proper cross-file imports."""
|
| 293 |
+
# Verify main.zig imports
|
| 294 |
+
main_symbols = language_server.request_document_symbols(os.path.join("src", "main.zig"))
|
| 295 |
+
assert main_symbols is not None
|
| 296 |
+
main_list = main_symbols[0] if isinstance(main_symbols, tuple) else main_symbols
|
| 297 |
+
main_names = {sym.get("name") for sym in main_list if isinstance(sym, dict)}
|
| 298 |
+
|
| 299 |
+
# main.zig should have main and greeting functions
|
| 300 |
+
assert "main" in main_names, "main function should be in main.zig"
|
| 301 |
+
assert "greeting" in main_names, "greeting function should be in main.zig"
|
| 302 |
+
|
| 303 |
+
# Verify calculator.zig exports Calculator
|
| 304 |
+
calc_symbols = language_server.request_document_symbols(os.path.join("src", "calculator.zig"))
|
| 305 |
+
assert calc_symbols is not None
|
| 306 |
+
calc_list = calc_symbols[0] if isinstance(calc_symbols, tuple) else calc_symbols
|
| 307 |
+
calc_names = {sym.get("name") for sym in calc_list if isinstance(sym, dict)}
|
| 308 |
+
assert "Calculator" in calc_names, "Calculator struct should be in calculator.zig"
|
| 309 |
+
|
| 310 |
+
# Verify math_utils.zig exports functions
|
| 311 |
+
math_symbols = language_server.request_document_symbols(os.path.join("src", "math_utils.zig"))
|
| 312 |
+
assert math_symbols is not None
|
| 313 |
+
math_list = math_symbols[0] if isinstance(math_symbols, tuple) else math_symbols
|
| 314 |
+
math_names = {sym.get("name") for sym in math_list if isinstance(sym, dict)}
|
| 315 |
+
assert "factorial" in math_names, "factorial function should be in math_utils.zig"
|
| 316 |
+
assert "isPrime" in math_names, "isPrime function should be in math_utils.zig"
|
| 317 |
+
|
| 318 |
+
@pytest.mark.parametrize("language_server", [Language.ZIG], indirect=True)
|
| 319 |
+
def test_hover_information(self, language_server: SolidLanguageServer) -> None:
|
| 320 |
+
"""Test hover information for symbols."""
|
| 321 |
+
file_path = os.path.join("src", "main.zig")
|
| 322 |
+
|
| 323 |
+
# Get hover info for the main function
|
| 324 |
+
hover_info = language_server.request_hover(file_path, 4, 8) # Position of "main" function
|
| 325 |
+
|
| 326 |
+
assert hover_info is not None, "Should provide hover information for main function"
|
| 327 |
+
|
| 328 |
+
# Hover info could be a dict with 'contents' or a string
|
| 329 |
+
if isinstance(hover_info, dict):
|
| 330 |
+
assert "contents" in hover_info or "value" in hover_info, "Hover should have contents"
|
| 331 |
+
|
| 332 |
+
@pytest.mark.parametrize("language_server", [Language.ZIG], indirect=True)
|
| 333 |
+
def test_full_symbol_tree(self, language_server: SolidLanguageServer) -> None:
|
| 334 |
+
"""Test that full symbol tree is not empty."""
|
| 335 |
+
symbols = language_server.request_full_symbol_tree()
|
| 336 |
+
|
| 337 |
+
assert symbols is not None
|
| 338 |
+
assert len(symbols) > 0, "Symbol tree should not be empty"
|
| 339 |
+
|
| 340 |
+
# The tree should have at least one root node
|
| 341 |
+
root = symbols[0]
|
| 342 |
+
assert isinstance(root, dict), "Root should be a dict"
|
| 343 |
+
assert "name" in root, "Root should have a name"
|