@yemi33/minions 0.1.2353 → 0.1.2354

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.
@@ -85,16 +85,20 @@ const PR_ACTION_FOLLOWUPS = Object.freeze([
85
85
  { kind: 'track-auto-fix', label: 'Track for auto-fix' },
86
86
  ]);
87
87
 
88
- /** Canonical `host:slug#number` id for a record/ref, or '' when unknowable. */
88
+ /**
89
+ * Canonical `host:slug#number` id for a record/ref, or '' when unknowable.
90
+ *
91
+ * Thin wrapper over prResolve.prIdFromRef: normalizes the heterogeneous
92
+ * record shapes buildPrActionFollowups is called with — an explicit
93
+ * `record.prId`, a `record.ref` ref object, or a bare ref-shaped object
94
+ * (`{host, slug, number}`/`{id}`) — into the ref shape prIdFromRef expects,
95
+ * then delegates so the `host:slug#number` template literal has one owner.
96
+ */
89
97
  function _prIdForRecord(record) {
90
98
  if (!record) return '';
91
99
  if (record.prId) return record.prId;
92
100
  const ref = record.ref || record;
93
- if (ref && ref.id) return ref.id;
94
- if (ref && ref.host && ref.slug && (ref.number || ref.number === 0)) {
95
- return `${ref.host}:${ref.slug}#${ref.number}`;
96
- }
97
- return '';
101
+ return prResolve.prIdFromRef(ref) || '';
98
102
  }
99
103
 
100
104
  /**
@@ -364,7 +368,8 @@ function buildPrActionPrompt(action, payload) {
364
368
  number: payload && payload.number,
365
369
  id: payload && payload.prId,
366
370
  };
367
- const prId = ref.id || (ref.host && ref.slug && ref.number ? `${ref.host}:${ref.slug}#${ref.number}` : (payload && payload.slug ? `${payload.slug}#${payload.number}` : 'the pull request'));
371
+ const prId = prResolve.prIdFromRef(ref)
372
+ || (payload && payload.slug ? `${payload.slug}#${payload.number}` : 'the pull request');
368
373
  const guidance = PR_ACTION_GUIDANCE[act] || PR_ACTION_GUIDANCE.review;
369
374
 
370
375
  const sections = [