githits 0.3.2 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  version
3
- } from "./shared/chunk-w5kw8sef.js";
3
+ } from "./shared/chunk-fqzth5mv.js";
4
4
  export {
5
5
  version
6
6
  };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  __require,
3
3
  version
4
- } from "./chunk-w5kw8sef.js";
4
+ } from "./chunk-fqzth5mv.js";
5
5
 
6
6
  // src/services/app-config-paths.ts
7
7
  var APP_DIR = "githits";
@@ -169,12 +169,15 @@ class AuthServiceImpl {
169
169
  return url.toString();
170
170
  }
171
171
  startCallbackServer(port, expectedState) {
172
- return new Promise((resolve, reject) => {
173
- let callbackHandled = false;
174
- let resolved = false;
175
- let closeTimer;
176
- const server = createServer((req, res) => {
177
- const url = new URL(req.url ?? "", `http://127.0.0.1:${port}`);
172
+ let closeTimer;
173
+ const server = createServer();
174
+ let callbackHandled = false;
175
+ let resolved = false;
176
+ const result = new Promise((resolve) => {
177
+ server.on("request", (req, res) => {
178
+ const address = server.address();
179
+ const actualPort = typeof address === "object" && address !== null ? address.port : port;
180
+ const url = new URL(req.url ?? "", `http://127.0.0.1:${actualPort}`);
178
181
  if (url.pathname === "/favicon.ico") {
179
182
  res.writeHead(204);
180
183
  res.end();
@@ -209,9 +212,23 @@ class AuthServiceImpl {
209
212
  clearTimeout(closeTimer);
210
213
  closeTimer = setTimeout(() => closeServer(server), 1500);
211
214
  });
212
- server.listen(port, "127.0.0.1");
213
- server.on("error", (err) => {
215
+ });
216
+ return new Promise((resolve, reject) => {
217
+ const onError = (err) => {
214
218
  reject(new Error(`Failed to start callback server: ${err.message}`));
219
+ };
220
+ server.once("error", onError);
221
+ server.listen(port, "127.0.0.1", () => {
222
+ server.off("error", onError);
223
+ server.on("error", () => {});
224
+ resolve({
225
+ result,
226
+ close: async () => {
227
+ if (closeTimer)
228
+ clearTimeout(closeTimer);
229
+ await closeServer(server);
230
+ }
231
+ });
215
232
  });
216
233
  });
217
234
  }
@@ -278,43 +295,121 @@ function parseRefreshTokenResponse(data) {
278
295
  }
279
296
  function successHtml(title = "Authentication successful") {
280
297
  return `<!DOCTYPE html>
281
- <html><head><title>GitHits CLI</title>
298
+ <html><head>
299
+ <title>GitHits CLI</title>
300
+ <meta charset="utf-8">
301
+ <link rel="preconnect" href="https://fonts.googleapis.com">
302
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
303
+ <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&family=Lexend:wght@600&display=swap" rel="stylesheet">
282
304
  <style>
305
+ *, *::before, *::after { box-sizing: border-box; }
283
306
  body {
284
- font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
307
+ margin: 0;
308
+ min-height: 100vh;
309
+ width: 100%;
310
+ padding: 16px;
311
+ background: #21262d;
312
+ color: #ffffff;
313
+ font-family: 'Inter', sans-serif;
285
314
  display: flex;
315
+ align-items: center;
286
316
  justify-content: center;
317
+ }
318
+ .content {
319
+ display: flex;
320
+ flex-direction: column;
287
321
  align-items: center;
288
- height: 100vh;
322
+ gap: 20px;
323
+ padding: 0 16px;
324
+ }
325
+ .message {
326
+ display: flex;
327
+ flex-direction: column;
328
+ align-items: center;
329
+ gap: 8px;
330
+ }
331
+ .success-icon {
332
+ width: 48px;
333
+ height: 48px;
334
+ border-radius: 50%;
335
+ border: 2px solid #57fec9;
336
+ background: transparent;
337
+ display: flex;
338
+ align-items: center;
339
+ justify-content: center;
340
+ }
341
+ .heading {
342
+ font-family: 'Lexend', sans-serif;
343
+ font-weight: 600;
344
+ font-size: 32px;
345
+ line-height: 40px;
346
+ color: #ffffff;
289
347
  margin: 0;
290
- background: radial-gradient(circle at center center, #4d3648, #3a2835, #261a22, #0d1117);
348
+ text-align: center;
349
+ text-wrap: pretty;
291
350
  }
292
- .card {
351
+ .text {
352
+ font-family: 'Inter', sans-serif;
353
+ font-weight: 400;
354
+ font-size: 16px;
355
+ line-height: 24px;
356
+ margin: 0;
293
357
  text-align: center;
294
- background: rgba(13, 17, 23, 0.75);
295
- padding: 3rem;
296
- border-radius: 16px;
297
- border: 1px solid rgba(244, 11, 166, 0.35);
298
- box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
299
- max-width: 720px;
300
- }
301
- h1 {
302
- color: #f40ba6;
303
- margin-bottom: 0.75rem;
304
- font-size: 3rem;
305
- font-weight: 700;
306
- }
307
- p {
308
- color: #f385a5;
309
- font-size: 1.1rem;
358
+ text-wrap: pretty;
359
+ }
360
+ .text-muted {
361
+ color: #abb2bf;
362
+ }
363
+ .tip {
364
+ font-family: 'Inter', sans-serif;
365
+ font-weight: 400;
366
+ font-size: 14px;
367
+ line-height: 20px;
368
+ color: #abb2bf;
310
369
  margin: 0;
370
+ text-align: center;
371
+ text-wrap: pretty;
372
+ }
373
+ .tip-label {
374
+ font-weight: 600;
375
+ color: #ffffff;
376
+ }
377
+ code {
378
+ font-family: 'Consolas', monospace;
379
+ font-size: 13px;
380
+ background: rgba(255, 255, 255, 0.08);
381
+ padding: 1px 6px;
382
+ border-radius: 4px;
383
+ color: #ffffff;
311
384
  }
312
385
  </style>
313
386
  </head>
314
387
  <body>
315
- <div class="card">
316
- <h1>${escapeHtml(title)}</h1>
317
- <p>You can close this window and return to the terminal.</p>
388
+ <div class="content">
389
+ <div class="success-icon" aria-hidden="true">
390
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" stroke="#57fec9" stroke-width="3" stroke-linecap="round" stroke-linejoin="round">
391
+ <polyline points="20 6 9 17 4 12" />
392
+ </svg>
393
+ </div>
394
+ <div class="message">
395
+ <h1 class="heading">${escapeHtml(title)}</h1>
396
+ <p class="text text-muted">You can close this window and return to the terminal.</p>
397
+ </div>
398
+
399
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 554 129.3" width="103" height="24" role="img" aria-label="GitHits">
400
+ <title>GitHits</title>
401
+ <defs>
402
+ <linearGradient id="wm-grad" x1="234.9" y1="64.7" x2="555.5" y2="64.7" gradientUnits="userSpaceOnUse">
403
+ <stop offset="0" style="stop-color: #ff4fae" />
404
+ <stop offset="1" style="stop-color: #ff872f" />
405
+ </linearGradient>
406
+ </defs>
407
+ <path d="M148.6,29.1c7.9,0,14.4-6.4,14.4-14.4S156.6.3,148.6.3s-14.4,6.4-14.4,14.4,6.4,14.4,14.4,14.4Z" fill="#ff4fae" />
408
+ <path d="M383.9,29.1c7.9,0,14.4-6.4,14.4-14.4s-6.4-14.4-14.4-14.4-14.4,6.4-14.4,14.4,6.4,14.4,14.4,14.4ZM396.4,40.8h-25v86.6h25V40.8ZM454.3,8.5h-25v32.3h-18.8v24h18.8v62.6h25v-62.6h18.8v-24h-18.8V8.5ZM553.1,92.2c-.9-2.6-2.2-4.9-4.1-6.9-2.2-2.4-5.1-4.4-8.8-6.2-3.7-1.8-8.2-3.4-13.4-4.9-4.1-1.1-7.3-2.1-9.6-3-2.4-.9-4.1-1.7-5.3-2.4-1.1-.8-1.9-1.7-2.5-2.9-.6-1.1-.9-2.3-.9-3.5s.2-2.4.7-3.4,1.2-1.9,2.2-2.6c1-.7,2.2-1.3,3.7-1.6s3.2-.5,5-.5,4.5.4,7.1,1.3c2.6.9,5.2,2.1,7.7,3.7,2.5,1.6,4.7,3.3,6.7,5.2l12.5-14.2c-2.8-2.8-6-5.2-9.6-7.3-3.7-2.1-7.7-3.7-11.9-4.8-4.3-1.1-8.7-1.7-13.2-1.7s-8.8.7-12.9,1.9c-4.1,1.3-7.7,3.1-10.8,5.5s-5.6,5.2-7.3,8.5c-1.8,3.3-2.6,7-2.6,11s.5,6.4,1.6,9.2c1,2.8,2.5,5.3,4.5,7.7,2.3,2.5,5.4,4.7,9.3,6.7s8.6,3.7,14.2,5.1c3.6,1,6.6,1.9,8.9,2.8,2.3.8,4,1.6,5.1,2.3,2,1.4,3,3.3,3,5.7s-.2,2.4-.7,3.5-1.2,2-2.2,2.7-2.2,1.3-3.5,1.7c-1.4.4-2.9.6-4.5.6-4.2,0-8.4-.8-12.5-2.5-4.2-1.6-7.9-4.3-11.2-8l-14.7,12.8c3.8,4.8,8.9,8.6,15.2,11.4,6.3,2.8,13.5,4.1,21.7,4.1s12.5-1.2,17.8-3.7,9.4-5.8,12.4-10.1c3-4.3,4.5-9.2,4.5-14.7s-.4-6-1.3-8.6h-.3ZM327.2,60.5h-50.2V6h-25v121.4h25v-42.8h50.2v42.8h25V6h-25v54.5Z" fill="url(#wm-grad)" />
409
+ <path d="M239.1,64.8v-24h-18.8V8.5h-25v32.3h-18.8v24h18.8v62.6h25v-62.6h18.8ZM161.1,40.8h-25v86.6h25V40.8ZM91.6,84.6h-26.8v-24h54s1.2,4.3,1.1,12.1c-.3,30.6-25.3,55.5-55.9,55.7h-.5C27.4,128.4-1.6,98.3,0,61.8,1.5,29.6,27.4,3.4,59.6,1.4c21-1.2,40,7.7,52.4,22.4l-17.2,17.2c-7.7-10.1-20.3-16.4-34.3-15.4-19.4,1.4-35,17.1-36.4,36.5-1.6,23,16.6,42.2,39.3,42.2s28-19.7,28-19.7h.2Z" fill="#ff4fae" />
410
+ </svg>
411
+
412
+ <p class="tip"><span class="tip-label">TIP:</span> Run <code>npx githits --help</code> to discover what else you can do.</p>
318
413
  </div>
319
414
  </body></html>`;
320
415
  }
@@ -356,44 +451,121 @@ function evaluateCallback(input) {
356
451
  function errorHtml(error, nextStep) {
357
452
  const nextStepHtml = nextStep ? `<p>${escapeHtml(nextStep)}</p>` : "";
358
453
  return `<!DOCTYPE html>
359
- <html><head><title>GitHits CLI</title>
454
+ <html><head>
455
+ <title>GitHits CLI</title>
456
+ <meta charset="utf-8">
457
+ <link rel="preconnect" href="https://fonts.googleapis.com">
458
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
459
+ <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&family=Lexend:wght@600&display=swap" rel="stylesheet">
360
460
  <style>
461
+ *, *::before, *::after { box-sizing: border-box; }
361
462
  body {
362
- font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
463
+ margin: 0;
464
+ min-height: 100vh;
465
+ width: 100%;
466
+ padding: 16px;
467
+ background: #21262d;
468
+ color: #ffffff;
469
+ font-family: 'Inter', sans-serif;
363
470
  display: flex;
471
+ align-items: center;
364
472
  justify-content: center;
473
+ }
474
+ .content {
475
+ display: flex;
476
+ flex-direction: column;
365
477
  align-items: center;
366
- height: 100vh;
478
+ gap: 20px;
479
+ padding: 0 16px;
480
+ }
481
+ .message {
482
+ display: flex;
483
+ flex-direction: column;
484
+ align-items: center;
485
+ gap: 8px;
486
+ }
487
+ .error-icon {
488
+ width: 48px;
489
+ height: 48px;
490
+ border-radius: 50%;
491
+ border: 2px solid #ff5a6a;
492
+ background: transparent;
493
+ display: flex;
494
+ align-items: center;
495
+ justify-content: center;
496
+ }
497
+ .heading {
498
+ font-family: 'Lexend', sans-serif;
499
+ font-weight: 600;
500
+ font-size: 32px;
501
+ line-height: 40px;
502
+ color: #ffffff;
367
503
  margin: 0;
368
- background: radial-gradient(circle at center center, #4d3648, #3a2835, #261a22, #0d1117);
504
+ text-align: center;
505
+ text-wrap: pretty;
369
506
  }
370
- .card {
507
+ .text {
508
+ font-family: 'Inter', sans-serif;
509
+ font-weight: 400;
510
+ font-size: 16px;
511
+ line-height: 24px;
512
+ margin: 0;
371
513
  text-align: center;
372
- background: rgba(13, 17, 23, 0.75);
373
- padding: 3rem;
374
- border-radius: 16px;
375
- border: 1px solid rgba(239, 68, 68, 0.35);
376
- box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
377
- max-width: 720px;
378
- }
379
- h1 {
380
- color: #ef4444;
381
- margin-bottom: 0.75rem;
382
- font-size: 3rem;
383
- font-weight: 700;
384
- }
385
- p {
386
- color: #f385a5;
387
- font-size: 1.1rem;
514
+ text-wrap: pretty;
515
+ }
516
+ .text-muted {
517
+ color: #abb2bf;
518
+ }
519
+ .footer-text {
520
+ font-family: 'Inter', sans-serif;
521
+ font-weight: 400;
522
+ font-size: 14px;
523
+ line-height: 20px;
524
+ color: #abb2bf;
388
525
  margin: 0;
526
+ text-align: center;
527
+ text-wrap: pretty;
528
+ }
529
+ .footer-link {
530
+ color: #ffffff;
531
+ text-decoration: underline;
532
+ text-underline-offset: 2px;
533
+ }
534
+ .footer-link:hover {
535
+ color: #abb2bf;
389
536
  }
390
537
  </style>
391
538
  </head>
392
539
  <body>
393
- <div class="card">
394
- <h1>Authentication failed</h1>
395
- <p>${escapeHtml(error)}</p>
540
+ <div class="content">
541
+ <div class="error-icon" aria-hidden="true">
542
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" stroke="#ff5a6a" stroke-width="3" stroke-linecap="round" stroke-linejoin="round">
543
+ <line x1="18" y1="6" x2="6" y2="18"/>
544
+ <line x1="6" y1="6" x2="18" y2="18"/>
545
+ </svg>
546
+ </div>
547
+
548
+ <div class="message">
549
+ <h1 class="heading">Authentication failed</h1>
550
+ <p class="text text-muted">${escapeHtml(error)}</p>
551
+ </div>
552
+
396
553
  ${nextStepHtml}
554
+
555
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 554 129.3" width="103" height="24" role="img" aria-label="GitHits">
556
+ <title>GitHits</title>
557
+ <defs>
558
+ <linearGradient id="wm-grad" x1="234.9" y1="64.7" x2="555.5" y2="64.7" gradientUnits="userSpaceOnUse">
559
+ <stop offset="0" style="stop-color: #ff4fae" />
560
+ <stop offset="1" style="stop-color: #ff872f" />
561
+ </linearGradient>
562
+ </defs>
563
+ <path d="M148.6,29.1c7.9,0,14.4-6.4,14.4-14.4S156.6.3,148.6.3s-14.4,6.4-14.4,14.4,6.4,14.4,14.4,14.4Z" fill="#ff4fae" />
564
+ <path d="M383.9,29.1c7.9,0,14.4-6.4,14.4-14.4s-6.4-14.4-14.4-14.4-14.4,6.4-14.4,14.4,6.4,14.4,14.4,14.4ZM396.4,40.8h-25v86.6h25V40.8ZM454.3,8.5h-25v32.3h-18.8v24h18.8v62.6h25v-62.6h18.8v-24h-18.8V8.5ZM553.1,92.2c-.9-2.6-2.2-4.9-4.1-6.9-2.2-2.4-5.1-4.4-8.8-6.2-3.7-1.8-8.2-3.4-13.4-4.9-4.1-1.1-7.3-2.1-9.6-3-2.4-.9-4.1-1.7-5.3-2.4-1.1-.8-1.9-1.7-2.5-2.9-.6-1.1-.9-2.3-.9-3.5s.2-2.4.7-3.4,1.2-1.9,2.2-2.6c1-.7,2.2-1.3,3.7-1.6s3.2-.5,5-.5,4.5.4,7.1,1.3c2.6.9,5.2,2.1,7.7,3.7,2.5,1.6,4.7,3.3,6.7,5.2l12.5-14.2c-2.8-2.8-6-5.2-9.6-7.3-3.7-2.1-7.7-3.7-11.9-4.8-4.3-1.1-8.7-1.7-13.2-1.7s-8.8.7-12.9,1.9c-4.1,1.3-7.7,3.1-10.8,5.5s-5.6,5.2-7.3,8.5c-1.8,3.3-2.6,7-2.6,11s.5,6.4,1.6,9.2c1,2.8,2.5,5.3,4.5,7.7,2.3,2.5,5.4,4.7,9.3,6.7s8.6,3.7,14.2,5.1c3.6,1,6.6,1.9,8.9,2.8,2.3.8,4,1.6,5.1,2.3,2,1.4,3,3.3,3,5.7s-.2,2.4-.7,3.5-1.2,2-2.2,2.7-2.2,1.3-3.5,1.7c-1.4.4-2.9.6-4.5.6-4.2,0-8.4-.8-12.5-2.5-4.2-1.6-7.9-4.3-11.2-8l-14.7,12.8c3.8,4.8,8.9,8.6,15.2,11.4,6.3,2.8,13.5,4.1,21.7,4.1s12.5-1.2,17.8-3.7,9.4-5.8,12.4-10.1c3-4.3,4.5-9.2,4.5-14.7s-.4-6-1.3-8.6h-.3ZM327.2,60.5h-50.2V6h-25v121.4h25v-42.8h50.2v42.8h25V6h-25v54.5Z" fill="url(#wm-grad)" />
565
+ <path d="M239.1,64.8v-24h-18.8V8.5h-25v32.3h-18.8v24h18.8v62.6h25v-62.6h18.8ZM161.1,40.8h-25v86.6h25V40.8ZM91.6,84.6h-26.8v-24h54s1.2,4.3,1.1,12.1c-.3,30.6-25.3,55.5-55.9,55.7h-.5C27.4,128.4-1.6,98.3,0,61.8,1.5,29.6,27.4,3.4,59.6,1.4c21-1.2,40,7.7,52.4,22.4l-17.2,17.2c-7.7-10.1-20.3-16.4-34.3-15.4-19.4,1.4-35,17.1-36.4,36.5-1.6,23,16.6,42.2,39.3,42.2s28-19.7,28-19.7h.2Z" fill="#ff4fae" />
566
+ </svg>
567
+
568
+ <p class="footer-text">Having trouble? Check our <a class="footer-link" href="https://app.githits.com/docs/" target="_blank" rel="noopener noreferrer">documentation</a> or contact <a class="footer-link" href="mailto:support@githits.com">support</a>.</p>
397
569
  </div>
398
570
  </body></html>`;
399
571
  }
@@ -402,7 +574,18 @@ function sendHtmlResponse(res, statusCode, html) {
402
574
  res.end(html);
403
575
  }
404
576
  function closeServer(server) {
405
- server.close();
577
+ return new Promise((resolve, reject) => {
578
+ if (!server.listening) {
579
+ resolve();
580
+ return;
581
+ }
582
+ server.close((error) => {
583
+ if (error)
584
+ reject(error);
585
+ else
586
+ resolve();
587
+ });
588
+ });
406
589
  }
407
590
  function escapeHtml(text) {
408
591
  return text.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
@@ -682,13 +865,11 @@ class ClientUpdateRequiredError extends Error {
682
865
  }
683
866
  }
684
867
  function isClientUpdateRequiredGraphQLError(input) {
685
- if (input.code === "CLIENT_UPDATE_REQUIRED") {
686
- return true;
687
- }
688
- const message = input.message;
689
- if (!isGraphQLSchemaMismatchMessage(message)) {
868
+ return input.code === "CLIENT_UPDATE_REQUIRED";
869
+ }
870
+ function isGraphQLSchemaMismatchError(input) {
871
+ if (!isGraphQLSchemaMismatchMessage(input.message))
690
872
  return false;
691
- }
692
873
  return !input.code || input.code === "GRAPHQL_VALIDATION_FAILED" || input.code === "BAD_USER_INPUT";
693
874
  }
694
875
  function isGraphQLSchemaMismatchMessage(message) {
@@ -1344,6 +1525,10 @@ query UnifiedSearch(
1344
1525
  id
1345
1526
  resultType
1346
1527
  targetLabel
1528
+ requestedTargetLabel
1529
+ freshTargetLabel
1530
+ servedTargetLabel
1531
+ freshness
1347
1532
  title
1348
1533
  summary
1349
1534
  score
@@ -1382,6 +1567,9 @@ query UnifiedSearch(
1382
1567
  sourceStatus {
1383
1568
  source
1384
1569
  targetLabel
1570
+ requestedTargetLabel
1571
+ freshTargetLabel
1572
+ servedTargetLabel
1385
1573
  indexingStatus
1386
1574
  codeIndexState
1387
1575
  resultCount
@@ -1403,6 +1591,32 @@ query UnifiedSearch(
1403
1591
  query
1404
1592
  queryWarnings
1405
1593
  sources
1594
+ requestedSources
1595
+ targetMode
1596
+ requestedTargets {
1597
+ registry
1598
+ name
1599
+ version
1600
+ repoUrl
1601
+ gitRef
1602
+ }
1603
+ filters {
1604
+ fileIntent
1605
+ kind
1606
+ category
1607
+ publicOnly
1608
+ pathPrefix
1609
+ }
1610
+ limit
1611
+ offset
1612
+ targets {
1613
+ requested
1614
+ resolvedRequested
1615
+ served
1616
+ freshness
1617
+ indexingRef
1618
+ requestedRefKind
1619
+ }
1406
1620
  expiresAt
1407
1621
  }
1408
1622
  }
@@ -1418,6 +1632,32 @@ query UnifiedSearchStatus($searchRef: String!, $includeResults: Boolean!) {
1418
1632
  query
1419
1633
  queryWarnings
1420
1634
  sources
1635
+ requestedSources
1636
+ targetMode
1637
+ requestedTargets {
1638
+ registry
1639
+ name
1640
+ version
1641
+ repoUrl
1642
+ gitRef
1643
+ }
1644
+ filters {
1645
+ fileIntent
1646
+ kind
1647
+ category
1648
+ publicOnly
1649
+ pathPrefix
1650
+ }
1651
+ limit
1652
+ offset
1653
+ targets {
1654
+ requested
1655
+ resolvedRequested
1656
+ served
1657
+ freshness
1658
+ indexingRef
1659
+ requestedRefKind
1660
+ }
1421
1661
  expiresAt
1422
1662
  results {
1423
1663
  query
@@ -1427,6 +1667,10 @@ query UnifiedSearchStatus($searchRef: String!, $includeResults: Boolean!) {
1427
1667
  id
1428
1668
  resultType
1429
1669
  targetLabel
1670
+ requestedTargetLabel
1671
+ freshTargetLabel
1672
+ servedTargetLabel
1673
+ freshness
1430
1674
  title
1431
1675
  summary
1432
1676
  score
@@ -1465,6 +1709,9 @@ query UnifiedSearchStatus($searchRef: String!, $includeResults: Boolean!) {
1465
1709
  sourceStatus {
1466
1710
  source
1467
1711
  targetLabel
1712
+ requestedTargetLabel
1713
+ freshTargetLabel
1714
+ servedTargetLabel
1468
1715
  indexingStatus
1469
1716
  codeIndexState
1470
1717
  resultCount
@@ -1561,6 +1808,10 @@ var unifiedSearchHitSchema = z2.object({
1561
1808
  id: z2.string(),
1562
1809
  resultType: unifiedSearchResultTypeSchema,
1563
1810
  targetLabel: z2.string(),
1811
+ requestedTargetLabel: z2.string().nullable().optional(),
1812
+ freshTargetLabel: z2.string().nullable().optional(),
1813
+ servedTargetLabel: z2.string().nullable().optional(),
1814
+ freshness: z2.string().nullable().optional(),
1564
1815
  title: z2.string().nullable().optional(),
1565
1816
  summary: z2.string().nullable().optional(),
1566
1817
  score: z2.number().nullable().optional(),
@@ -1579,6 +1830,9 @@ var unifiedSearchPageInfoSchema = z2.object({
1579
1830
  var unifiedSearchSourceStatusSchema = z2.object({
1580
1831
  source: unifiedSearchSourceSchema,
1581
1832
  targetLabel: z2.string(),
1833
+ requestedTargetLabel: z2.string().nullable().optional(),
1834
+ freshTargetLabel: z2.string().nullable().optional(),
1835
+ servedTargetLabel: z2.string().nullable().optional(),
1582
1836
  indexingStatus: z2.string().nullable().optional(),
1583
1837
  codeIndexState: z2.string().nullable().optional(),
1584
1838
  resultCount: z2.number().int().nullable().optional(),
@@ -1607,6 +1861,28 @@ var unifiedSearchSessionStatusSchema = z2.enum([
1607
1861
  "TIMEOUT",
1608
1862
  "FAILED"
1609
1863
  ]);
1864
+ var unifiedSearchFiltersSchema = z2.object({
1865
+ fileIntent: z2.string().nullable().optional(),
1866
+ kind: z2.string().nullable().optional(),
1867
+ category: z2.string().nullable().optional(),
1868
+ publicOnly: z2.boolean().nullable().optional(),
1869
+ pathPrefix: z2.string().nullable().optional()
1870
+ }).nullable().optional();
1871
+ var unifiedSearchProgressTargetSchema = z2.object({
1872
+ requested: z2.string().nullable().optional(),
1873
+ resolvedRequested: z2.string().nullable().optional(),
1874
+ served: z2.string().nullable().optional(),
1875
+ freshness: z2.string().nullable().optional(),
1876
+ indexingRef: z2.string().nullable().optional(),
1877
+ requestedRefKind: z2.string().nullable().optional()
1878
+ });
1879
+ var unifiedSearchRequestedTargetSchema = z2.object({
1880
+ registry: z2.string().nullable().optional(),
1881
+ name: z2.string().nullable().optional(),
1882
+ version: z2.string().nullable().optional(),
1883
+ repoUrl: z2.string().nullable().optional(),
1884
+ gitRef: z2.string().nullable().optional()
1885
+ });
1610
1886
  var unifiedSearchProgressSchema = z2.object({
1611
1887
  searchRef: z2.string(),
1612
1888
  status: unifiedSearchSessionStatusSchema,
@@ -1616,6 +1892,13 @@ var unifiedSearchProgressSchema = z2.object({
1616
1892
  query: z2.string(),
1617
1893
  queryWarnings: z2.array(z2.string()),
1618
1894
  sources: z2.array(unifiedSearchSourceSchema),
1895
+ requestedSources: z2.array(unifiedSearchSourceSchema).nullable().optional(),
1896
+ targetMode: z2.string().nullable().optional(),
1897
+ requestedTargets: z2.array(unifiedSearchRequestedTargetSchema).nullable().optional(),
1898
+ filters: unifiedSearchFiltersSchema,
1899
+ limit: z2.number().int().nullable().optional(),
1900
+ offset: z2.number().int().nullable().optional(),
1901
+ targets: z2.array(unifiedSearchProgressTargetSchema).nullable().optional(),
1619
1902
  expiresAt: z2.string().nullable().optional(),
1620
1903
  results: unifiedSearchResultSchema.nullable().optional()
1621
1904
  });
@@ -2116,6 +2399,15 @@ class CodeNavigationServiceImpl {
2116
2399
  if (isClientUpdateRequiredGraphQLError({ message, code })) {
2117
2400
  return new ClientUpdateRequiredError;
2118
2401
  }
2402
+ if (isGraphQLSchemaMismatchError({ message, code })) {
2403
+ const sanitized = "Backend protocol mismatch. Your CLI may be newer than the server, or the server may require a newer CLI. Run `githits update-check` to verify your installed version. Set GITHITS_DEBUG=code-nav-wire to inspect GraphQL details during local development.";
2404
+ debugLog("code-nav", {
2405
+ event: "graphql-schema-mismatch",
2406
+ code: code ?? "omitted",
2407
+ message
2408
+ });
2409
+ return new CodeNavigationBackendError(isDebugAreaEnabled("code-nav-wire") ? message : sanitized, undefined, code, retryable);
2410
+ }
2119
2411
  switch (code) {
2120
2412
  case "PACKAGE_INDEXING":
2121
2413
  return new CodeNavigationIndexingError(this.createIndexingMessage(indexingRef), indexingRef, parseAvailableVersions(extensions));
@@ -2220,6 +2512,10 @@ class CodeNavigationServiceImpl {
2220
2512
  id: entry.id,
2221
2513
  resultType: entry.resultType,
2222
2514
  targetLabel: entry.targetLabel,
2515
+ requestedTargetLabel: entry.requestedTargetLabel ?? undefined,
2516
+ freshTargetLabel: entry.freshTargetLabel ?? undefined,
2517
+ servedTargetLabel: entry.servedTargetLabel ?? undefined,
2518
+ freshness: entry.freshness ?? undefined,
2223
2519
  title: entry.title ?? undefined,
2224
2520
  summary: entry.summary ?? undefined,
2225
2521
  score: entry.score ?? undefined,
@@ -2258,6 +2554,9 @@ class CodeNavigationServiceImpl {
2258
2554
  sourceStatus: result.sourceStatus.map((entry) => ({
2259
2555
  source: entry.source,
2260
2556
  targetLabel: entry.targetLabel,
2557
+ requestedTargetLabel: entry.requestedTargetLabel ?? undefined,
2558
+ freshTargetLabel: entry.freshTargetLabel ?? undefined,
2559
+ servedTargetLabel: entry.servedTargetLabel ?? undefined,
2261
2560
  indexingStatus: entry.indexingStatus ?? undefined,
2262
2561
  codeIndexState: entry.codeIndexState ?? undefined,
2263
2562
  resultCount: entry.resultCount ?? undefined,
@@ -2281,6 +2580,26 @@ class CodeNavigationServiceImpl {
2281
2580
  query: progress.query,
2282
2581
  queryWarnings: progress.queryWarnings,
2283
2582
  sources: progress.sources,
2583
+ requestedSources: progress.requestedSources ?? undefined,
2584
+ targetMode: normaliseTargetMode(progress.targetMode),
2585
+ requestedTargets: progress.requestedTargets?.map((target) => ({
2586
+ registry: target.registry ? target.registry : undefined,
2587
+ name: target.name ?? undefined,
2588
+ version: target.version ?? undefined,
2589
+ repoUrl: target.repoUrl ?? undefined,
2590
+ gitRef: target.gitRef ?? undefined
2591
+ })),
2592
+ filters: normaliseProgressFilters(progress.filters),
2593
+ limit: progress.limit ?? undefined,
2594
+ offset: progress.offset ?? undefined,
2595
+ targets: progress.targets?.map((target) => ({
2596
+ requested: target.requested ?? undefined,
2597
+ resolvedRequested: target.resolvedRequested ?? undefined,
2598
+ served: target.served ?? undefined,
2599
+ freshness: target.freshness ?? undefined,
2600
+ indexingRef: target.indexingRef ?? undefined,
2601
+ requestedRefKind: normaliseRequestedRefKind(target.requestedRefKind)
2602
+ })),
2284
2603
  expiresAt: progress.expiresAt ?? undefined
2285
2604
  };
2286
2605
  }
@@ -2600,6 +2919,43 @@ function isAuthMessage(message) {
2600
2919
  const lower = message.toLowerCase();
2601
2920
  return lower.includes("unauthorized") || lower.includes("forbidden") || lower.includes("permission") || lower.includes("authentication");
2602
2921
  }
2922
+ function normaliseTargetMode(value) {
2923
+ if (value === "PACKAGES" || value === "REPO" || value === "MIXED") {
2924
+ return value;
2925
+ }
2926
+ return;
2927
+ }
2928
+ function normaliseRequestedRefKind(value) {
2929
+ switch (value) {
2930
+ case "OMITTED_VERSION":
2931
+ case "LATEST_VERSION":
2932
+ case "EXACT_VERSION":
2933
+ case "DEFAULT_BRANCH":
2934
+ case "HEAD":
2935
+ case "BRANCH":
2936
+ case "SHA":
2937
+ return value;
2938
+ default:
2939
+ return;
2940
+ }
2941
+ }
2942
+ function normaliseProgressFilters(filters) {
2943
+ if (!filters)
2944
+ return;
2945
+ const out = {};
2946
+ if (filters.fileIntent)
2947
+ out.fileIntent = filters.fileIntent;
2948
+ if (filters.kind)
2949
+ out.kind = filters.kind;
2950
+ if (filters.category)
2951
+ out.category = filters.category;
2952
+ if (typeof filters.publicOnly === "boolean") {
2953
+ out.publicOnly = filters.publicOnly;
2954
+ }
2955
+ if (filters.pathPrefix)
2956
+ out.pathPrefix = filters.pathPrefix;
2957
+ return Object.keys(out).length > 0 ? out : undefined;
2958
+ }
2603
2959
  function isTargetNotFoundMessage(message) {
2604
2960
  const lower = message.toLowerCase();
2605
2961
  return lower.includes("not found") || lower.includes("unknown package") || lower.includes("no such package") || lower.includes("does not exist");
@@ -4257,6 +4613,15 @@ class PackageIntelligenceServiceImpl {
4257
4613
  if (isClientUpdateRequiredGraphQLError({ message, code })) {
4258
4614
  return new ClientUpdateRequiredError;
4259
4615
  }
4616
+ if (isGraphQLSchemaMismatchError({ message, code })) {
4617
+ const sanitized = "Backend protocol mismatch. Your CLI may be newer than the server, or the server may require a newer CLI. Run `githits update-check` to verify your installed version. Set GITHITS_DEBUG=pkg-graphql to inspect GraphQL details during local development.";
4618
+ debugLog("pkg-graphql", {
4619
+ event: "graphql-schema-mismatch",
4620
+ code: code ?? "omitted",
4621
+ message
4622
+ });
4623
+ return new PackageIntelligenceBackendError(isDebugAreaEnabled("pkg-graphql") ? message : sanitized, undefined, code, retryable);
4624
+ }
4260
4625
  switch (code) {
4261
4626
  case "NOT_FOUND":
4262
4627
  case "PACKAGE_NOT_FOUND":
@@ -4659,7 +5024,7 @@ class PackageIntelligenceServiceImpl {
4659
5024
  return this.normaliseChangelogReport(data, params);
4660
5025
  }
4661
5026
  normaliseChangelogReport(data, params) {
4662
- const source = data.source && data.source.trim() ? data.source : undefined;
5027
+ const source = data.source?.trim() ? data.source : undefined;
4663
5028
  const rawEntries = data.entries ?? [];
4664
5029
  if (!source && rawEntries.length === 0) {
4665
5030
  const target = params.repoUrl ?? (params.registry && params.packageName ? `${params.registry.toLowerCase()}:${params.packageName}` : "package");