@codyswann/lisa 8.1.0 → 8.2.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.
Files changed (237) hide show
  1. package/all/copy-overwrite/scripts/lib/npm-update-bun.mjs +8 -3
  2. package/all/copy-overwrite/scripts/lib/npm-update-cache-seed.mjs +145 -0
  3. package/all/copy-overwrite/scripts/lib/npm-update-helper-inventory.mjs +1 -0
  4. package/all/copy-overwrite/scripts/lib/npm-update-prepare.mjs +34 -6
  5. package/all/copy-overwrite/scripts/npm-updater-helper-graph.json +14 -3
  6. package/dist/core/lisa-owned-hash-ledger.json +24 -2
  7. package/dist/core/nightly-e2e-guard-behavior-certificate.js +2 -2
  8. package/dist/core/upstream-evidence-manifest.json +158 -17
  9. package/package.json +4 -4
  10. package/plugins/lisa/.claude-plugin/plugin.json +1 -1
  11. package/plugins/lisa/.codex-plugin/plugin.json +1 -1
  12. package/plugins/lisa/.codex-plugin/scripts/queue-contract-resolution.mjs +583 -0
  13. package/plugins/lisa/.codex-plugin/scripts/ready-queue-order.mjs +99 -25
  14. package/plugins/lisa/.codex-plugin/scripts/stale-blocker-comment.mjs +185 -0
  15. package/plugins/lisa/.codex-plugin/scripts/stale-blocker-confirm.mjs +130 -0
  16. package/plugins/lisa/.codex-plugin/scripts/stale-blocker-edges.mjs +466 -0
  17. package/plugins/lisa/.codex-plugin/scripts/stale-blocker-pending.mjs +257 -0
  18. package/plugins/lisa/.codex-plugin/scripts/stale-blocker-restore.mjs +180 -0
  19. package/plugins/lisa/.codex-plugin/scripts/stale-blocker-summary.mjs +222 -0
  20. package/plugins/lisa/.codex-plugin/scripts/stale-blocker-sweep.mjs +394 -0
  21. package/plugins/lisa/.codex-plugin/scripts/stale-blocker-verify.mjs +193 -0
  22. package/plugins/lisa/.codex-plugin/skills/lisa-atlassian-access/SKILL.md +1 -0
  23. package/plugins/lisa/.codex-plugin/skills/lisa-github-build-intake/SKILL.md +2 -7
  24. package/plugins/lisa/.codex-plugin/skills/lisa-jira-build-intake/SKILL.md +2 -0
  25. package/plugins/lisa/.codex-plugin/skills/lisa-linear-access/SKILL.md +44 -0
  26. package/plugins/lisa/.codex-plugin/skills/lisa-linear-build-intake/SKILL.md +2 -0
  27. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/SKILL.md +127 -2
  28. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/cli-queue.mjs +90 -20
  29. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/cli-stale-links-results.mjs +254 -0
  30. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/cli-stale-links.mjs +243 -0
  31. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/cli-usage.mjs +60 -0
  32. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/queue-github.mjs +68 -8
  33. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/session-manager.mjs +49 -0
  34. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/stale-links-github.mjs +196 -0
  35. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/stale-links-state.mjs +173 -0
  36. package/plugins/lisa/scripts/ready-queue-order.mjs +99 -25
  37. package/plugins/lisa/scripts/stale-blocker-comment.mjs +185 -0
  38. package/plugins/lisa/scripts/stale-blocker-confirm.mjs +130 -0
  39. package/plugins/lisa/scripts/stale-blocker-edges.mjs +466 -0
  40. package/plugins/lisa/scripts/stale-blocker-pending.mjs +257 -0
  41. package/plugins/lisa/scripts/stale-blocker-restore.mjs +180 -0
  42. package/plugins/lisa/scripts/stale-blocker-summary.mjs +222 -0
  43. package/plugins/lisa/scripts/stale-blocker-sweep.mjs +394 -0
  44. package/plugins/lisa/scripts/stale-blocker-verify.mjs +193 -0
  45. package/plugins/lisa/skills/lisa-atlassian-access/SKILL.md +1 -0
  46. package/plugins/lisa/skills/lisa-github-build-intake/SKILL.md +2 -7
  47. package/plugins/lisa/skills/lisa-jira-build-intake/SKILL.md +2 -0
  48. package/plugins/lisa/skills/lisa-linear-access/SKILL.md +44 -0
  49. package/plugins/lisa/skills/lisa-linear-build-intake/SKILL.md +2 -0
  50. package/plugins/lisa/skills/lisa-session-manager/SKILL.md +127 -2
  51. package/plugins/lisa/skills/lisa-session-manager/scripts/cli-queue.mjs +90 -20
  52. package/plugins/lisa/skills/lisa-session-manager/scripts/cli-stale-links-results.mjs +254 -0
  53. package/plugins/lisa/skills/lisa-session-manager/scripts/cli-stale-links.mjs +243 -0
  54. package/plugins/lisa/skills/lisa-session-manager/scripts/cli-usage.mjs +60 -0
  55. package/plugins/lisa/skills/lisa-session-manager/scripts/queue-github.mjs +68 -8
  56. package/plugins/lisa/skills/lisa-session-manager/scripts/session-manager.mjs +49 -0
  57. package/plugins/lisa/skills/lisa-session-manager/scripts/stale-links-github.mjs +196 -0
  58. package/plugins/lisa/skills/lisa-session-manager/scripts/stale-links-state.mjs +173 -0
  59. package/plugins/lisa-agy/plugin.json +1 -1
  60. package/plugins/lisa-agy/scripts/ready-queue-order.mjs +99 -25
  61. package/plugins/lisa-agy/scripts/stale-blocker-comment.mjs +185 -0
  62. package/plugins/lisa-agy/scripts/stale-blocker-confirm.mjs +130 -0
  63. package/plugins/lisa-agy/scripts/stale-blocker-edges.mjs +466 -0
  64. package/plugins/lisa-agy/scripts/stale-blocker-pending.mjs +257 -0
  65. package/plugins/lisa-agy/scripts/stale-blocker-restore.mjs +180 -0
  66. package/plugins/lisa-agy/scripts/stale-blocker-summary.mjs +222 -0
  67. package/plugins/lisa-agy/scripts/stale-blocker-sweep.mjs +394 -0
  68. package/plugins/lisa-agy/scripts/stale-blocker-verify.mjs +193 -0
  69. package/plugins/lisa-agy/skills/lisa-atlassian-access/SKILL.md +1 -0
  70. package/plugins/lisa-agy/skills/lisa-github-build-intake/SKILL.md +2 -7
  71. package/plugins/lisa-agy/skills/lisa-jira-build-intake/SKILL.md +2 -0
  72. package/plugins/lisa-agy/skills/lisa-linear-access/SKILL.md +44 -0
  73. package/plugins/lisa-agy/skills/lisa-linear-build-intake/SKILL.md +2 -0
  74. package/plugins/lisa-agy/skills/lisa-session-manager/SKILL.md +127 -2
  75. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/cli-queue.mjs +90 -20
  76. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/cli-stale-links-results.mjs +254 -0
  77. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/cli-stale-links.mjs +243 -0
  78. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/cli-usage.mjs +60 -0
  79. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/queue-github.mjs +68 -8
  80. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/session-manager.mjs +49 -0
  81. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/stale-links-github.mjs +196 -0
  82. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/stale-links-state.mjs +173 -0
  83. package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
  84. package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
  85. package/plugins/lisa-cdk-agy/plugin.json +1 -1
  86. package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
  87. package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
  88. package/plugins/lisa-cdk-devin/.claude-plugin/plugin.json +1 -1
  89. package/plugins/lisa-cdk-devin/.devin-plugin/plugin.json +1 -1
  90. package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
  91. package/plugins/lisa-copilot/scripts/ready-queue-order.mjs +99 -25
  92. package/plugins/lisa-copilot/scripts/stale-blocker-comment.mjs +185 -0
  93. package/plugins/lisa-copilot/scripts/stale-blocker-confirm.mjs +130 -0
  94. package/plugins/lisa-copilot/scripts/stale-blocker-edges.mjs +466 -0
  95. package/plugins/lisa-copilot/scripts/stale-blocker-pending.mjs +257 -0
  96. package/plugins/lisa-copilot/scripts/stale-blocker-restore.mjs +180 -0
  97. package/plugins/lisa-copilot/scripts/stale-blocker-summary.mjs +222 -0
  98. package/plugins/lisa-copilot/scripts/stale-blocker-sweep.mjs +394 -0
  99. package/plugins/lisa-copilot/scripts/stale-blocker-verify.mjs +193 -0
  100. package/plugins/lisa-copilot/skills/lisa-atlassian-access/SKILL.md +1 -0
  101. package/plugins/lisa-copilot/skills/lisa-github-build-intake/SKILL.md +2 -7
  102. package/plugins/lisa-copilot/skills/lisa-jira-build-intake/SKILL.md +2 -0
  103. package/plugins/lisa-copilot/skills/lisa-linear-access/SKILL.md +44 -0
  104. package/plugins/lisa-copilot/skills/lisa-linear-build-intake/SKILL.md +2 -0
  105. package/plugins/lisa-copilot/skills/lisa-session-manager/SKILL.md +127 -2
  106. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/cli-queue.mjs +90 -20
  107. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/cli-stale-links-results.mjs +254 -0
  108. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/cli-stale-links.mjs +243 -0
  109. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/cli-usage.mjs +60 -0
  110. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/queue-github.mjs +68 -8
  111. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/session-manager.mjs +49 -0
  112. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/stale-links-github.mjs +196 -0
  113. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/stale-links-state.mjs +173 -0
  114. package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
  115. package/plugins/lisa-cursor/scripts/ready-queue-order.mjs +99 -25
  116. package/plugins/lisa-cursor/scripts/stale-blocker-comment.mjs +185 -0
  117. package/plugins/lisa-cursor/scripts/stale-blocker-confirm.mjs +130 -0
  118. package/plugins/lisa-cursor/scripts/stale-blocker-edges.mjs +466 -0
  119. package/plugins/lisa-cursor/scripts/stale-blocker-pending.mjs +257 -0
  120. package/plugins/lisa-cursor/scripts/stale-blocker-restore.mjs +180 -0
  121. package/plugins/lisa-cursor/scripts/stale-blocker-summary.mjs +222 -0
  122. package/plugins/lisa-cursor/scripts/stale-blocker-sweep.mjs +394 -0
  123. package/plugins/lisa-cursor/scripts/stale-blocker-verify.mjs +193 -0
  124. package/plugins/lisa-cursor/skills/lisa-atlassian-access/SKILL.md +1 -0
  125. package/plugins/lisa-cursor/skills/lisa-github-build-intake/SKILL.md +2 -7
  126. package/plugins/lisa-cursor/skills/lisa-jira-build-intake/SKILL.md +2 -0
  127. package/plugins/lisa-cursor/skills/lisa-linear-access/SKILL.md +44 -0
  128. package/plugins/lisa-cursor/skills/lisa-linear-build-intake/SKILL.md +2 -0
  129. package/plugins/lisa-cursor/skills/lisa-session-manager/SKILL.md +127 -2
  130. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/cli-queue.mjs +90 -20
  131. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/cli-stale-links-results.mjs +254 -0
  132. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/cli-stale-links.mjs +243 -0
  133. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/cli-usage.mjs +60 -0
  134. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/queue-github.mjs +68 -8
  135. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/session-manager.mjs +49 -0
  136. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/stale-links-github.mjs +196 -0
  137. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/stale-links-state.mjs +173 -0
  138. package/plugins/lisa-devin/.claude-plugin/plugin.json +1 -1
  139. package/plugins/lisa-devin/.devin-plugin/plugin.json +1 -1
  140. package/plugins/lisa-devin/scripts/ready-queue-order.mjs +99 -25
  141. package/plugins/lisa-devin/scripts/stale-blocker-comment.mjs +185 -0
  142. package/plugins/lisa-devin/scripts/stale-blocker-confirm.mjs +130 -0
  143. package/plugins/lisa-devin/scripts/stale-blocker-edges.mjs +466 -0
  144. package/plugins/lisa-devin/scripts/stale-blocker-pending.mjs +257 -0
  145. package/plugins/lisa-devin/scripts/stale-blocker-restore.mjs +180 -0
  146. package/plugins/lisa-devin/scripts/stale-blocker-summary.mjs +222 -0
  147. package/plugins/lisa-devin/scripts/stale-blocker-sweep.mjs +394 -0
  148. package/plugins/lisa-devin/scripts/stale-blocker-verify.mjs +193 -0
  149. package/plugins/lisa-devin/skills/lisa-atlassian-access/SKILL.md +1 -0
  150. package/plugins/lisa-devin/skills/lisa-github-build-intake/SKILL.md +2 -7
  151. package/plugins/lisa-devin/skills/lisa-jira-build-intake/SKILL.md +2 -0
  152. package/plugins/lisa-devin/skills/lisa-linear-access/SKILL.md +44 -0
  153. package/plugins/lisa-devin/skills/lisa-linear-build-intake/SKILL.md +2 -0
  154. package/plugins/lisa-devin/skills/lisa-session-manager/SKILL.md +127 -2
  155. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/cli-queue.mjs +90 -20
  156. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/cli-stale-links-results.mjs +254 -0
  157. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/cli-stale-links.mjs +243 -0
  158. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/cli-usage.mjs +60 -0
  159. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/queue-github.mjs +68 -8
  160. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/session-manager.mjs +49 -0
  161. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/stale-links-github.mjs +196 -0
  162. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/stale-links-state.mjs +173 -0
  163. package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
  164. package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
  165. package/plugins/lisa-expo-agy/plugin.json +1 -1
  166. package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
  167. package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
  168. package/plugins/lisa-expo-devin/.claude-plugin/plugin.json +1 -1
  169. package/plugins/lisa-expo-devin/.devin-plugin/plugin.json +1 -1
  170. package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
  171. package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
  172. package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
  173. package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
  174. package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
  175. package/plugins/lisa-harper-fabric-devin/.claude-plugin/plugin.json +1 -1
  176. package/plugins/lisa-harper-fabric-devin/.devin-plugin/plugin.json +1 -1
  177. package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
  178. package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
  179. package/plugins/lisa-nestjs-agy/plugin.json +1 -1
  180. package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
  181. package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
  182. package/plugins/lisa-nestjs-devin/.claude-plugin/plugin.json +1 -1
  183. package/plugins/lisa-nestjs-devin/.devin-plugin/plugin.json +1 -1
  184. package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
  185. package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
  186. package/plugins/lisa-phaser-agy/plugin.json +1 -1
  187. package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
  188. package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
  189. package/plugins/lisa-phaser-devin/.claude-plugin/plugin.json +1 -1
  190. package/plugins/lisa-phaser-devin/.devin-plugin/plugin.json +1 -1
  191. package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
  192. package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
  193. package/plugins/lisa-rails-agy/plugin.json +1 -1
  194. package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
  195. package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
  196. package/plugins/lisa-rails-devin/.claude-plugin/plugin.json +1 -1
  197. package/plugins/lisa-rails-devin/.devin-plugin/plugin.json +1 -1
  198. package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
  199. package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
  200. package/plugins/lisa-typescript-agy/plugin.json +1 -1
  201. package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
  202. package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
  203. package/plugins/lisa-typescript-devin/.claude-plugin/plugin.json +1 -1
  204. package/plugins/lisa-typescript-devin/.devin-plugin/plugin.json +1 -1
  205. package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
  206. package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
  207. package/plugins/lisa-wiki-agy/plugin.json +1 -1
  208. package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
  209. package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
  210. package/plugins/lisa-wiki-devin/.claude-plugin/plugin.json +1 -1
  211. package/plugins/lisa-wiki-devin/.devin-plugin/plugin.json +1 -1
  212. package/plugins/src/base/scripts/ready-queue-order.mjs +99 -25
  213. package/plugins/src/base/scripts/stale-blocker-comment.mjs +185 -0
  214. package/plugins/src/base/scripts/stale-blocker-confirm.mjs +130 -0
  215. package/plugins/src/base/scripts/stale-blocker-edges.mjs +466 -0
  216. package/plugins/src/base/scripts/stale-blocker-pending.mjs +257 -0
  217. package/plugins/src/base/scripts/stale-blocker-restore.mjs +180 -0
  218. package/plugins/src/base/scripts/stale-blocker-summary.mjs +222 -0
  219. package/plugins/src/base/scripts/stale-blocker-sweep.mjs +394 -0
  220. package/plugins/src/base/scripts/stale-blocker-verify.mjs +193 -0
  221. package/plugins/src/base/skills/lisa-atlassian-access/SKILL.md +1 -0
  222. package/plugins/src/base/skills/lisa-github-build-intake/SKILL.md +2 -7
  223. package/plugins/src/base/skills/lisa-jira-build-intake/SKILL.md +2 -0
  224. package/plugins/src/base/skills/lisa-linear-access/SKILL.md +44 -0
  225. package/plugins/src/base/skills/lisa-linear-build-intake/SKILL.md +2 -0
  226. package/plugins/src/base/skills/lisa-session-manager/SKILL.md +127 -2
  227. package/plugins/src/base/skills/lisa-session-manager/scripts/cli-queue.mjs +90 -20
  228. package/plugins/src/base/skills/lisa-session-manager/scripts/cli-stale-links-results.mjs +254 -0
  229. package/plugins/src/base/skills/lisa-session-manager/scripts/cli-stale-links.mjs +243 -0
  230. package/plugins/src/base/skills/lisa-session-manager/scripts/cli-usage.mjs +60 -0
  231. package/plugins/src/base/skills/lisa-session-manager/scripts/queue-github.mjs +68 -8
  232. package/plugins/src/base/skills/lisa-session-manager/scripts/session-manager.mjs +49 -0
  233. package/plugins/src/base/skills/lisa-session-manager/scripts/stale-links-github.mjs +196 -0
  234. package/plugins/src/base/skills/lisa-session-manager/scripts/stale-links-state.mjs +173 -0
  235. package/scripts/record-npm-update-dual-lock-seed.mjs +203 -0
  236. package/scripts/two-channel-couplings.json +1 -1
  237. package/typescript/copy-overwrite/.prettierignore +1 -0
@@ -0,0 +1,130 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Re-check one planned stale-link clean-up against a fresh read, right before
4
+ * the writes (CodySwannGT/lisa#5065).
5
+ *
6
+ * A plan is a snapshot. Between planning and writing, a blocker can be
7
+ * reopened (its link is real again and must stay), a person can edit the
8
+ * item's body (a precomputed body would overwrite that edit), or the item can
9
+ * move to the blocked role (the Blocked sweep owns it then). So the writer
10
+ * re-reads the item AND each of its blockers, and this module rebuilds the
11
+ * plan from that fresh read:
12
+ *
13
+ * - only links the original plan removes, and that are still stale now, are
14
+ * removed; the rest are reported in `skipped` with the reason;
15
+ * - the GitHub body is rebuilt by `removeBlockedByRefs` on the FRESH body, so
16
+ * a concurrent edit is kept;
17
+ * - the comment describes the fresh state.
18
+ *
19
+ * A link that became stale only after the plan is left for the next cycle's
20
+ * plan, so a confirmation never widens what a plan does.
21
+ * @module stale-blocker-confirm
22
+ */
23
+
24
+ import {
25
+ itemPlan,
26
+ itemRoles,
27
+ normalizeStaleLinkItem,
28
+ edgeIdentity,
29
+ sortEdges,
30
+ } from "./stale-blocker-sweep.mjs";
31
+
32
+ /**
33
+ * Why a planned removal is no longer made.
34
+ * @param {string} blockerRef
35
+ * @param {ReturnType<typeof sortEdges>} sorted
36
+ * @returns {"blocker-not-resolved" | "link-changed" | "link-already-gone"}
37
+ */
38
+ function skipReason(blockerRef, sorted) {
39
+ // Still stale, but not the relationship the plan named (a new native
40
+ // dependency in place of a planned body ref, say): left for the next plan.
41
+ if (sorted.stale.some(edge => edge.blockerRef === blockerRef)) {
42
+ return "link-changed";
43
+ }
44
+ const present = [
45
+ ...sorted.real,
46
+ ...sorted.crossProject,
47
+ ...sorted.inaccessible,
48
+ ...sorted.keptByPerson,
49
+ // Moved back to an intermediate done rung: not finished, link kept.
50
+ ...sorted.landed,
51
+ ].some(edge => edge.blockerRef === blockerRef);
52
+ return present ? "blocker-not-resolved" : "link-already-gone";
53
+ }
54
+
55
+ /**
56
+ * Why the whole item is left alone now, or "" when it is not.
57
+ * @param {ReturnType<typeof normalizeStaleLinkItem>} item
58
+ * @param {{ inBlocked: boolean }} roles
59
+ * @returns {"" | "item-closed" | "status-unknown" | "blocked-role"}
60
+ */
61
+ function holdReason(item, roles) {
62
+ // The sweep is scoped to open items: one closed since the plan is not
63
+ // edited.
64
+ if (item.closed) return "item-closed";
65
+ if (!item.statusKnown) return "status-unknown";
66
+ return roles.inBlocked ? "blocked-role" : "";
67
+ }
68
+
69
+ /**
70
+ * Rebuild one item's plan from a fresh read of the item and its blockers.
71
+ * @param {{
72
+ * tracker: "github" | "jira" | "linear",
73
+ * plan: { ref: string, removed: readonly string[], edges?: readonly string[] },
74
+ * fresh: Record<string, any>,
75
+ * doneRoles: readonly string[],
76
+ * landedRoles?: readonly string[],
77
+ * roles: { ready?: string, blocked?: string },
78
+ * poster?: "session-manager" | "build-intake",
79
+ * posterName?: string,
80
+ * }} input - `fresh` is the raw item in the same shape the plan read it
81
+ * @returns {{ plan: import("./stale-blocker-sweep.mjs").StaleLinkPlan | null, skipped: { blocker: string, reason: string }[] }}
82
+ */
83
+ export function confirmStaleLinkPlan(input) {
84
+ const item = normalizeStaleLinkItem(input.tracker, input.fresh);
85
+ if (item.ref !== input.plan.ref) {
86
+ throw new Error(
87
+ `The fresh read is ${item.ref}, but the plan is for ${input.plan.ref}.`
88
+ );
89
+ }
90
+ if (!item.relationsRead) {
91
+ // probe-direction: fail-closed — a read with no relation list cannot say
92
+ // which links are still there, so nothing is confirmed from it.
93
+ throw new Error(
94
+ `The fresh read of ${item.ref} has no blocker relation list; read it with its links.`
95
+ );
96
+ }
97
+ const planned = new Set(input.plan.removed);
98
+ const roles = itemRoles(item, input.roles);
99
+ const hold = holdReason(item, roles);
100
+ if (hold) {
101
+ return {
102
+ plan: null,
103
+ skipped: [...planned].map(blocker => ({ blocker, reason: hold })),
104
+ };
105
+ }
106
+ const sorted = sortEdges(item, input.doneRoles, input.landedRoles);
107
+ // Only the planned relationships: a link added since the plan, even to the
108
+ // same blocker (a native dependency beside a planned body ref), was never
109
+ // authorized and stays.
110
+ const identities = new Set(input.plan.edges ?? []);
111
+ const stale = sorted.stale.filter(
112
+ edge => planned.has(edge.blockerRef) && identities.has(edgeIdentity(edge))
113
+ );
114
+ const kept = new Set(stale.map(edge => edge.blockerRef));
115
+ const skipped = [...planned]
116
+ .filter(blocker => !kept.has(blocker))
117
+ .map(blocker => ({ blocker, reason: skipReason(blocker, sorted) }));
118
+ if (stale.length === 0) return { plan: null, skipped };
119
+ return {
120
+ plan: itemPlan({
121
+ tracker: input.tracker,
122
+ item,
123
+ sorted: { ...sorted, stale },
124
+ ready: roles.ready,
125
+ poster: input.poster,
126
+ posterName: input.posterName,
127
+ }),
128
+ skipped,
129
+ };
130
+ }
@@ -0,0 +1,466 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Is a "blocked by" edge still a real blocker? One answer for every tracker.
4
+ *
5
+ * ## The failure this answers (CodySwannGT/lisa#5065)
6
+ *
7
+ * In a host project every ticket in the queue showed as waiting on another
8
+ * ticket. 70 "blocked by" links across 40 open tickets pointed at tickets that
9
+ * were already finished; only 29 tickets had a real blocker. The links were
10
+ * true once and nobody removed them when the blocker finished, so the operator
11
+ * could not see which items were really stuck, and work stayed out of the
12
+ * factory until a person asked an agent to clean up.
13
+ *
14
+ * ## The rule
15
+ *
16
+ * A blocker is RESOLVED when it is closed in its tracker (GitHub `closed`,
17
+ * Jira status category `done`, Linear state type `completed` or `canceled`)
18
+ * or when it sits in the project's configured terminal done role
19
+ * (`.lisa.config.json`, resolved through `resolveBuildLifecycleRoles`: the
20
+ * `production` rung of an env-keyed `done` map, or the `done` value itself).
21
+ * Names are never hardcoded: a promotion workflow can type its done state
22
+ * `started`, so the configured name is what says "finished" there.
23
+ *
24
+ * A blocker in any OTHER configured done role (an intermediate rung of the
25
+ * env-aware `done` map, such as `status:on-dev` or `On Stg`) is LANDED: its
26
+ * code has merged to a non-production environment, and dependents are meant
27
+ * to proceed, so it holds nothing. Its link is not stale, though: the
28
+ * blocker is not finished, so the sweep never deletes that link
29
+ * ({@link REMOVABLE}). "Holds the item" and "safe to delete" are separate
30
+ * questions with separate answers.
31
+ *
32
+ * A blocker that was CANCELLED (GitHub `not_planned` / `duplicate`, Linear
33
+ * `canceled`) is resolved too: build intake already ignores it, the item can
34
+ * never be unblocked by it, and the operator comment says it was cancelled.
35
+ * Jira cannot tell "won't do" from "done" without naming a resolution, so a
36
+ * done-category Jira blocker reads as closed.
37
+ *
38
+ * An unreadable blocker is INACCESSIBLE: it is reported and never resolved.
39
+ *
40
+ * This module only judges. `stale-blocker-sweep.mjs` plans the removals and
41
+ * the operator comment; the vendor access layers perform them. It is plain
42
+ * Node with no runtime-specific imports, so any agent can run it.
43
+ * @module stale-blocker-edges
44
+ */
45
+
46
+ import { resolveBuildLifecycleRoles } from "./queue-contract-resolution.mjs";
47
+
48
+ /** Every verdict {@link blockerResolution} can return. */
49
+ export const RESOLUTIONS = Object.freeze([
50
+ "done",
51
+ "landed",
52
+ "closed",
53
+ "cancelled",
54
+ "open",
55
+ "inaccessible",
56
+ ]);
57
+
58
+ /** Verdicts that mean the blocker can no longer hold anything up. */
59
+ const RESOLVED = new Set(["done", "landed", "closed", "cancelled"]);
60
+
61
+ /** Verdicts whose link the sweep may delete: the blocker is finished. */
62
+ const REMOVABLE = new Set(["done", "closed", "cancelled"]);
63
+
64
+ /** GitHub closure reasons for work that will not be built. */
65
+ const GITHUB_CANCELLED_REASONS = new Set(["not_planned", "duplicate"]);
66
+
67
+ /** Jira link types whose inward side reads "this item is blocked by". */
68
+ const JIRA_BLOCKED_BY = /blocked by/i;
69
+
70
+ /** A `Blocked by` line as `lisa-github-write-issue` writes it. */
71
+ const BLOCKED_BY_LINE = /^(\s*(?:[-*]\s+)?blocked by:?\s+)(.+?)\s*$/i;
72
+
73
+ /**
74
+ * What separates refs on a `Blocked by` line: a comma, or the word "and"
75
+ * with whitespace on both sides, so an `and` inside a repository name
76
+ * (`org/and#10`) is never a separator.
77
+ */
78
+ const REF_SEPARATOR = /\s*,\s*|\s+and\s+/i;
79
+
80
+ /** One GitHub issue reference inside a `Blocked by` line. */
81
+ const GITHUB_REF =
82
+ /^(?:https:\/\/github\.com\/([\w.-]+\/[\w.-]+)\/issues\/(\d+)|(?:([\w.-]+\/[\w.-]+))?#(\d+))$/i;
83
+
84
+ /**
85
+ * @param {unknown} value
86
+ * @returns {string}
87
+ */
88
+ const text = value => (typeof value === "string" ? value : "");
89
+
90
+ /**
91
+ * @param {unknown} list
92
+ * @returns {any[]}
93
+ */
94
+ const nodesOf = list => {
95
+ if (Array.isArray(list)) return list;
96
+ return Array.isArray(list?.nodes) ? list.nodes : [];
97
+ };
98
+
99
+ /**
100
+ * Label or state names as lower-case strings.
101
+ * @param {unknown} list
102
+ * @returns {string[]}
103
+ */
104
+ const namesOf = list =>
105
+ nodesOf(list)
106
+ .map(entry => (typeof entry === "string" ? entry : text(entry?.name)))
107
+ .filter(Boolean)
108
+ .map(name => name.toLowerCase());
109
+
110
+ /**
111
+ * The project's terminal done role names for one tracker.
112
+ *
113
+ * Each rung resolves on its own, local before committed before the built-in
114
+ * default, exactly as `resolveRole` resolves one environment: a local map
115
+ * that overrides only `dev` never hides the committed `production` rung. A
116
+ * plain string is a single, non-staged done role, so it stands for the
117
+ * `production` rung. The terminal role is the `production` rung, else the
118
+ * last rung: an intermediate rung (`status:on-dev`) has not finished, so it
119
+ * never counts.
120
+ * @param {{ tracker: string, global?: object, local?: object }} input
121
+ * @returns {string[]} Lower-case names
122
+ */
123
+ export function terminalDoneRoles(input) {
124
+ const rungs = Object.entries(mergedDoneRungs(input));
125
+ if (rungs.length === 0) return [];
126
+ const production = rungs.find(([key]) => key === "production");
127
+ return [(production ?? rungs[rungs.length - 1])[1].toLowerCase()];
128
+ }
129
+
130
+ /**
131
+ * Every configured done role that is NOT terminal: the intermediate rungs of
132
+ * the env-aware `done` map (`status:on-dev`, `On Stg`), resolved per rung
133
+ * exactly as {@link terminalDoneRoles} resolves them. A blocker in one of
134
+ * these holds nothing, but its link is never deleted.
135
+ * @param {{ tracker: string, global?: object, local?: object }} input
136
+ * @returns {string[]} Lower-case names
137
+ */
138
+ export function landedDoneRoles(input) {
139
+ const terminal = new Set(terminalDoneRoles(input));
140
+ return [
141
+ ...new Set(
142
+ Object.values(mergedDoneRungs(input)).map(name => name.toLowerCase())
143
+ ),
144
+ ].filter(name => !terminal.has(name));
145
+ }
146
+
147
+ /**
148
+ * The `done` rungs, each resolved local, then committed, then built-in.
149
+ * @param {{ tracker: string, global?: object, local?: object }} input
150
+ * @returns {Record<string, string>}
151
+ */
152
+ function mergedDoneRungs({ tracker, global, local }) {
153
+ // The built-in defaults come from the one resolver every surface shares;
154
+ // it is asked with an empty config so a project's other roles can never
155
+ // make this read fail.
156
+ return {
157
+ ...doneRungs(resolveBuildLifecycleRoles({}, tracker).roles.done),
158
+ ...doneRungs(rawDone(global ?? {}, tracker)),
159
+ ...doneRungs(rawDone(local ?? {}, tracker)),
160
+ };
161
+ }
162
+
163
+ /**
164
+ * One config's `done` value as its non-empty rungs.
165
+ * @param {unknown} done - A string, an env-keyed map, or nothing
166
+ * @returns {Record<string, string>}
167
+ */
168
+ function doneRungs(done) {
169
+ if (typeof done === "string") return done ? { production: done } : {};
170
+ if (!done || typeof done !== "object") return {};
171
+ return Object.fromEntries(
172
+ Object.entries(done).filter(
173
+ ([, value]) => typeof value === "string" && value
174
+ )
175
+ );
176
+ }
177
+
178
+ /**
179
+ * The `done` value one config sets for a tracker, or undefined.
180
+ * @param {Record<string, any>} config
181
+ * @param {string} tracker
182
+ * @returns {unknown}
183
+ */
184
+ function rawDone(config, tracker) {
185
+ if (tracker === "github") return config.github?.labels?.build?.done;
186
+ return config[tracker]?.workflow?.done;
187
+ }
188
+
189
+ /**
190
+ * Judge one normalized edge's blocker.
191
+ *
192
+ * The configured done names belong to the project that configures them, so a
193
+ * name match counts only for a blocker in that project (`scope`). A blocker
194
+ * in another Jira project or Linear team that happens to have a status of the
195
+ * same name is finished only when its own tracker says so (closed, done
196
+ * category, completed). With no scope, a name match counts anywhere.
197
+ * @param {{ accessible?: boolean, closed?: boolean, cancelled?: boolean, names?: readonly string[], project?: string }} edge
198
+ * @param {readonly string[]} doneRoles - From {@link terminalDoneRoles}
199
+ * @param {string} [scope] - The project or team that declares `doneRoles`
200
+ * @param {readonly string[]} [landedRoles] - From {@link landedDoneRoles}
201
+ * @returns {"done"|"landed"|"closed"|"cancelled"|"open"|"inaccessible"} Verdict
202
+ */
203
+ export function blockerResolution(edge, doneRoles, scope, landedRoles = []) {
204
+ if (!edge || edge.accessible === false) return "inaccessible";
205
+ if (edge.cancelled === true) return "cancelled";
206
+ const inScope =
207
+ !scope || text(edge.project).toLowerCase() === scope.toLowerCase();
208
+ const done = new Set(doneRoles.map(name => name.toLowerCase()));
209
+ if (
210
+ inScope &&
211
+ (edge.names ?? []).some(name => done.has(name.toLowerCase()))
212
+ ) {
213
+ return "done";
214
+ }
215
+ if (edge.closed === true) return "closed";
216
+ const landed = new Set(landedRoles.map(name => name.toLowerCase()));
217
+ return inScope && (edge.names ?? []).some(name => landed.has(name))
218
+ ? "landed"
219
+ : "open";
220
+ }
221
+
222
+ /**
223
+ * Whether a verdict means the blocker can no longer hold anything up.
224
+ * @param {string} verdict
225
+ * @returns {boolean}
226
+ */
227
+ export const isResolved = verdict => RESOLVED.has(verdict);
228
+
229
+ /**
230
+ * Whether a verdict means the blocker is finished, so its link may go.
231
+ * @param {string} verdict
232
+ * @returns {boolean}
233
+ */
234
+ export const isRemovable = verdict => REMOVABLE.has(verdict);
235
+
236
+ /**
237
+ * How many edges still hold their item up: open, or unreadable (an unread
238
+ * blocker is never assumed finished).
239
+ * @param {readonly object[]} edges - Normalized edges
240
+ * @param {readonly string[]} doneRoles - From {@link terminalDoneRoles}
241
+ * @param {string} [scope] - The project or team that declares `doneRoles`
242
+ * @param {readonly string[]} [landedRoles] - From {@link landedDoneRoles}
243
+ * @returns {number}
244
+ */
245
+ export const countUnresolvedBlockers = (edges, doneRoles, scope, landedRoles) =>
246
+ edges.filter(
247
+ edge => !isResolved(blockerResolution(edge, doneRoles, scope, landedRoles))
248
+ ).length;
249
+
250
+ /**
251
+ * The project key of a Jira or Linear key (`ABC-12` → `ABC`).
252
+ * @param {string} key
253
+ * @returns {string}
254
+ */
255
+ const keyProject = key => text(key).split("-")[0].toUpperCase();
256
+
257
+ /**
258
+ * "Blocked by" edges of one raw Jira issue (`issuelinks`, inward side).
259
+ * @param {Record<string, any>} issue - Issue with `key` and `fields`
260
+ * @returns {object[]} Normalized edges
261
+ */
262
+ export function jiraBlockerEdges(issue) {
263
+ return nodesOf(issue?.fields?.issuelinks)
264
+ .filter(
265
+ link => link?.inwardIssue && JIRA_BLOCKED_BY.test(text(link.type?.inward))
266
+ )
267
+ .map(link => {
268
+ const status = link.inwardIssue.fields?.status;
269
+ return {
270
+ blockerRef: text(link.inwardIssue.key),
271
+ project: keyProject(link.inwardIssue.key),
272
+ source: "jira-link",
273
+ actionId: text(link.id),
274
+ // The link type's name, so a link removed in error can be recreated.
275
+ linkType: text(link.type?.name) || "Blocks",
276
+ accessible: Boolean(status),
277
+ closed: status?.statusCategory?.key === "done",
278
+ cancelled: false,
279
+ names: namesOf([status]),
280
+ };
281
+ });
282
+ }
283
+
284
+ /**
285
+ * "Blocked by" edges of one raw Linear issue. Linear has no blocked-by
286
+ * relation type: B blocked by A is A's `blocks` relation, read from B as an
287
+ * inverse relation.
288
+ * @param {Record<string, any>} issue - Issue node
289
+ * @returns {object[]} Normalized edges
290
+ */
291
+ export function linearBlockerEdges(issue) {
292
+ return nodesOf(issue?.inverseRelations)
293
+ .filter(relation => relation?.type === "blocks")
294
+ .map(relation => {
295
+ const state = relation.issue?.state;
296
+ const ref = text(relation.issue?.identifier);
297
+ return {
298
+ blockerRef: ref,
299
+ project:
300
+ text(relation.issue?.team?.key).toUpperCase() || keyProject(ref),
301
+ source: "linear-relation",
302
+ actionId: text(relation.id),
303
+ accessible: Boolean(state?.type),
304
+ closed: state?.type === "completed" || state?.type === "canceled",
305
+ cancelled: state?.type === "canceled",
306
+ names: namesOf([state]),
307
+ };
308
+ });
309
+ }
310
+
311
+ /**
312
+ * Canonical `owner/repo#n` for one reference token, or null.
313
+ * @param {string} token - `#12`, `owner/repo#12` or an issue URL
314
+ * @param {string} repo - The item's own `owner/repo`
315
+ * @returns {string | null}
316
+ */
317
+ export function canonicalGithubRef(token, repo) {
318
+ const match = GITHUB_REF.exec(token.trim());
319
+ if (!match) return null;
320
+ const owner = match[1] ?? match[3] ?? repo;
321
+ return `${owner.toLowerCase()}#${match[2] ?? match[4]}`;
322
+ }
323
+
324
+ /**
325
+ * Every blocker the body's `Blocked by` lines name, canonicalized.
326
+ * @param {string} body
327
+ * @param {string} repo - The item's own `owner/repo`
328
+ * @returns {string[]} Unique refs, in body order
329
+ */
330
+ export function parseBlockedByRefs(body, repo) {
331
+ const lines = text(body).split("\n");
332
+ const fenced = fencedLines(lines);
333
+ const refs = lines.flatMap((line, index) => {
334
+ const match = fenced[index] ? null : BLOCKED_BY_LINE.exec(line);
335
+ if (!match) return [];
336
+ return match[2]
337
+ .split(REF_SEPARATOR)
338
+ .map(token => canonicalGithubRef(token, repo))
339
+ .filter(Boolean);
340
+ });
341
+ return [...new Set(refs)];
342
+ }
343
+
344
+ /**
345
+ * The body with the given refs removed from its `Blocked by` lines. A line
346
+ * left with no ref is dropped; every other line is untouched.
347
+ * @param {string} body
348
+ * @param {readonly string[]} refs - Canonical refs to remove
349
+ * @param {string} repo - The item's own `owner/repo`
350
+ * @returns {string}
351
+ */
352
+ export function removeBlockedByRefs(body, refs, repo) {
353
+ const drop = new Set(refs);
354
+ const lines = text(body).split("\n");
355
+ const fenced = fencedLines(lines);
356
+ return lines
357
+ .flatMap((line, index) => {
358
+ const match = fenced[index] ? null : BLOCKED_BY_LINE.exec(line);
359
+ if (!match) return [line];
360
+ const tokens = match[2].split(REF_SEPARATOR);
361
+ const kept = tokens.filter(
362
+ token => !drop.has(canonicalGithubRef(token, repo) ?? "")
363
+ );
364
+ if (kept.length === tokens.length) return [line];
365
+ return kept.length === 0 ? [] : [`${match[1]}${kept.join(", ")}`];
366
+ })
367
+ .join("\n");
368
+ }
369
+
370
+ /** A Markdown code-fence line: three or more backticks or tildes. */
371
+ const FENCE = /^ {0,3}(`{3,}|~{3,})/;
372
+
373
+ /**
374
+ * Which lines sit inside a Markdown code fence (the fence lines included).
375
+ * Text in a fence is literal, so a `Blocked by` example there is neither a
376
+ * blocker nor something the sweep may edit. A fence closes on a line of the
377
+ * same character at least as long; an unclosed fence runs to the end, as
378
+ * GitHub renders it.
379
+ * @param {readonly string[]} lines
380
+ * @returns {boolean[]}
381
+ */
382
+ function fencedLines(lines) {
383
+ let open = "";
384
+ return lines.map(line => {
385
+ const fence = FENCE.exec(line)?.[1] ?? "";
386
+ if (open === "") {
387
+ if (fence !== "") open = fence;
388
+ return fence !== "";
389
+ }
390
+ if (fence[0] === open[0] && fence.length >= open.length) open = "";
391
+ return true;
392
+ });
393
+ }
394
+
395
+ /**
396
+ * One GitHub blocker as an edge. `blocker` is the REST issue, or null when it
397
+ * could not be read.
398
+ * @param {string} ref - Canonical blocker ref
399
+ * @param {Record<string, any> | null | undefined} blocker
400
+ * @param {string} source - `github-native` or `github-body`
401
+ * @returns {object} Normalized edge
402
+ */
403
+ function githubEdge(ref, blocker, source) {
404
+ const state = text(blocker?.state).toLowerCase();
405
+ return {
406
+ blockerRef: ref,
407
+ project: ref.split("#")[0],
408
+ source,
409
+ actionId: blocker?.id === undefined ? "" : String(blocker.id),
410
+ accessible: state === "open" || state === "closed",
411
+ closed: state === "closed",
412
+ cancelled:
413
+ state === "closed" &&
414
+ GITHUB_CANCELLED_REASONS.has(text(blocker?.state_reason).toLowerCase()),
415
+ names: namesOf(blocker?.labels),
416
+ };
417
+ }
418
+
419
+ /** Placeholder repo for a native blocker whose repository is not named. */
420
+ export const UNKNOWN_REPO = "unknown-repo";
421
+
422
+ /**
423
+ * The `owner/repo` a native blocker lives in. The dependencies API returns
424
+ * both `repository.full_name` and `repository_url`; either is read, as
425
+ * `normalizeGithubIssue` reads `repository_url`. A blocker that names
426
+ * neither is never assumed to be local: it gets {@link UNKNOWN_REPO}, which
427
+ * matches no item's repo, so the sweep treats it as cross-project and leaves
428
+ * it alone.
429
+ * @param {Record<string, any>} blocker - REST issue
430
+ * @returns {string}
431
+ */
432
+ function blockerRepo(blocker) {
433
+ const named =
434
+ text(blocker?.repository?.full_name) ||
435
+ text(blocker?.repository_url).split("/repos/")[1] ||
436
+ "";
437
+ return named || UNKNOWN_REPO;
438
+ }
439
+
440
+ /**
441
+ * "Blocked by" edges of one GitHub issue: native dependencies
442
+ * (`nativeBlockers`, the REST `dependencies/blocked_by` list) and the body
443
+ * convention (`bodyBlockers`, each named ref's REST issue or null).
444
+ * @param {{ repo: string, body?: string, nativeBlockers?: object[], bodyBlockers?: Record<string, object | null> }} issue
445
+ * @returns {object[]} Normalized edges
446
+ */
447
+ export function githubBlockerEdges(issue) {
448
+ const repo = text(issue?.repo).toLowerCase();
449
+ const native = nodesOf(issue?.nativeBlockers).map(blocker => {
450
+ const owner = blockerRepo(blocker);
451
+ return githubEdge(
452
+ `${owner.toLowerCase()}#${blocker.number}`,
453
+ blocker,
454
+ "github-native"
455
+ );
456
+ });
457
+ const found = issue?.bodyBlockers ?? {};
458
+ const body = parseBlockedByRefs(issue?.body, repo).map(ref =>
459
+ githubEdge(
460
+ ref,
461
+ Object.hasOwn(found, ref) ? found[ref] : null,
462
+ "github-body"
463
+ )
464
+ );
465
+ return [...native, ...body];
466
+ }