@link-assistant/hive-mind 1.78.12 → 2.0.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.
@@ -432,6 +432,14 @@ export class MergeQueueProcessor {
432
432
  item.status = MergeItemStatus.CHECKING_CI;
433
433
  const mergeableCheck = await checkPRMergeable(this.owner, this.repo, item.pr.number, this.verbose);
434
434
 
435
+ if (mergeableCheck.terminal) {
436
+ item.status = MergeItemStatus.FAILED;
437
+ item.error = mergeableCheck.reason || 'GitHub repository, pull request, issue, or branch is no longer accessible';
438
+ this.stats.failed++;
439
+ this.log(`Failed PR #${item.pr.number}: ${item.error}`);
440
+ return;
441
+ }
442
+
435
443
  if (!mergeableCheck.mergeable) {
436
444
  item.status = MergeItemStatus.SKIPPED;
437
445
  item.error = mergeableCheck.reason;
@@ -452,6 +460,14 @@ export class MergeQueueProcessor {
452
460
  return;
453
461
  }
454
462
 
463
+ if (ciStatus.status === 'terminal_github_entity_error') {
464
+ item.status = MergeItemStatus.FAILED;
465
+ item.error = ciStatus.error || 'GitHub repository, pull request, issue, or branch is no longer accessible';
466
+ this.stats.failed++;
467
+ this.log(`Failed PR #${item.pr.number}: ${item.error}`);
468
+ return;
469
+ }
470
+
455
471
  // Step 3: Wait for CI if pending
456
472
  if (ciStatus.status === 'pending') {
457
473
  item.status = MergeItemStatus.WAITING_CI;
@@ -1,6 +1,35 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- const defaultFetchUseMCode = async () => (await fetch('https://unpkg.com/use-m/use.js')).text();
3
+ export const USE_M_BOOTSTRAP_URL = 'https://unpkg.com/use-m/use.js';
4
+ export const USE_M_BOOTSTRAP_FALLBACK_URL = 'https://unpkg.com/use-m@8.13.8/use.js';
5
+
6
+ const isMissingUseMBundle = code => /^Not found: \/use-m@[^/]+\/use\.js\s*$/.test(code.trim());
7
+
8
+ const readBootstrapResponse = async (response, url) => {
9
+ const code = await response.text();
10
+ if (response.ok !== false && !isMissingUseMBundle(code)) return code;
11
+ throw new Error(`use-m bootstrap was not available at ${url}: ${code.slice(0, 120)}`);
12
+ };
13
+
14
+ const fetchUseMCodeFromUrl = async (url, fetcher = fetch) => readBootstrapResponse(await fetcher(url), url);
15
+
16
+ export const fetchUseMCodeFromCdn = async ({ fetcher = fetch } = {}) => {
17
+ let primaryError;
18
+ try {
19
+ return await fetchUseMCodeFromUrl(USE_M_BOOTSTRAP_URL, fetcher);
20
+ } catch (error) {
21
+ primaryError = error;
22
+ }
23
+
24
+ try {
25
+ return await fetchUseMCodeFromUrl(USE_M_BOOTSTRAP_FALLBACK_URL, fetcher);
26
+ } catch (fallbackError) {
27
+ throw new Error(`Failed to load use-m bootstrap from primary and fallback URLs: ${primaryError.message}; ${fallbackError.message}`);
28
+ }
29
+ };
30
+
31
+ const defaultFetchUseMCode = () => fetchUseMCodeFromUrl(USE_M_BOOTSTRAP_URL);
32
+ const fallbackFetchUseMCode = () => fetchUseMCodeFromUrl(USE_M_BOOTSTRAP_FALLBACK_URL);
4
33
 
5
34
  /**
6
35
  * Load the shared use-m bootstrap.
@@ -10,9 +39,14 @@ const defaultFetchUseMCode = async () => (await fetch('https://unpkg.com/use-m/u
10
39
  * @returns {Promise<Function>} The global use-m `use` function.
11
40
  */
12
41
  export const ensureUseM = async (options = {}) => {
13
- const { fetchUseMCode = defaultFetchUseMCode } = options;
42
+ const { fetchUseMCode = defaultFetchUseMCode, log = null } = options;
14
43
  if (typeof globalThis.use === 'undefined') {
15
- globalThis.use = (await eval(await fetchUseMCode())).use;
44
+ try {
45
+ globalThis.use = (await eval(await fetchUseMCode())).use;
46
+ } catch (error) {
47
+ if (typeof log === 'function') log(` use-m latest bootstrap failed (${error.message}); trying ${USE_M_BOOTSTRAP_FALLBACK_URL}`);
48
+ globalThis.use = (await eval(await fallbackFetchUseMCode())).use;
49
+ }
16
50
  }
17
51
  return globalThis.use;
18
52
  };