@codyswann/lisa 8.3.0 → 8.5.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 (281) hide show
  1. package/all/copy-overwrite/scripts/lib/private-key-redaction.d.mts +4 -0
  2. package/all/copy-overwrite/scripts/lib/private-key-redaction.mjs +59 -0
  3. package/all/copy-overwrite/scripts/lisa-gates.mjs +1 -0
  4. package/all/copy-overwrite/scripts/lisa-hooks/block-direct-issue-create.sh +4 -1
  5. package/all/copy-overwrite/scripts/lisa-hooks/worktree-binding-guard.mjs +56 -1
  6. package/all/copy-overwrite/scripts/lisa-run-gates.mjs +17 -14
  7. package/all/copy-overwrite/scripts/npm-updater-helper-graph.json +2 -2
  8. package/cdk/package-lisa/package.lisa.json +1 -1
  9. package/dist/cli/confined-project-read.d.ts +2 -1
  10. package/dist/cli/confined-project-read.d.ts.map +1 -1
  11. package/dist/cli/confined-project-read.js +22 -5
  12. package/dist/cli/confined-project-read.js.map +1 -1
  13. package/dist/cli/gh-cli.d.ts +2 -1
  14. package/dist/cli/gh-cli.d.ts.map +1 -1
  15. package/dist/cli/gh-cli.js +5 -3
  16. package/dist/cli/gh-cli.js.map +1 -1
  17. package/dist/cli/github-read-issue-cmd.d.ts +62 -0
  18. package/dist/cli/github-read-issue-cmd.d.ts.map +1 -0
  19. package/dist/cli/github-read-issue-cmd.js +121 -0
  20. package/dist/cli/github-read-issue-cmd.js.map +1 -0
  21. package/dist/cli/github-reader-relationships.d.ts +41 -0
  22. package/dist/cli/github-reader-relationships.d.ts.map +1 -0
  23. package/dist/cli/github-reader-relationships.js +218 -0
  24. package/dist/cli/github-reader-relationships.js.map +1 -0
  25. package/dist/cli/github-reader-target.d.ts +24 -0
  26. package/dist/cli/github-reader-target.d.ts.map +1 -0
  27. package/dist/cli/github-reader-target.js +95 -0
  28. package/dist/cli/github-reader-target.js.map +1 -0
  29. package/dist/cli/github-reader-wire.d.ts +72 -0
  30. package/dist/cli/github-reader-wire.d.ts.map +1 -0
  31. package/dist/cli/github-reader-wire.js +125 -0
  32. package/dist/cli/github-reader-wire.js.map +1 -0
  33. package/dist/cli/index.d.ts.map +1 -1
  34. package/dist/cli/index.js +2 -2
  35. package/dist/cli/index.js.map +1 -1
  36. package/dist/controls/carrier-edits.d.ts +1 -1
  37. package/dist/controls/carrier-edits.d.ts.map +1 -1
  38. package/dist/controls/carrier-edits.js +13 -3
  39. package/dist/controls/carrier-edits.js.map +1 -1
  40. package/dist/controls/carriers.d.ts.map +1 -1
  41. package/dist/controls/carriers.js +7 -2
  42. package/dist/controls/carriers.js.map +1 -1
  43. package/dist/controls/checks-binding.d.ts.map +1 -1
  44. package/dist/controls/checks-binding.js +13 -7
  45. package/dist/controls/checks-binding.js.map +1 -1
  46. package/dist/controls/commands/attest-before-enforce.d.ts.map +1 -1
  47. package/dist/controls/commands/attest-before-enforce.js +4 -5
  48. package/dist/controls/commands/attest-before-enforce.js.map +1 -1
  49. package/dist/controls/commands/attest-workspace.d.ts.map +1 -1
  50. package/dist/controls/commands/attest-workspace.js +3 -1
  51. package/dist/controls/commands/attest-workspace.js.map +1 -1
  52. package/dist/controls/commands/declaration-check.d.ts.map +1 -1
  53. package/dist/controls/commands/declaration-check.js +7 -4
  54. package/dist/controls/commands/declaration-check.js.map +1 -1
  55. package/dist/controls/commands/proof-check.js +1 -1
  56. package/dist/controls/commands/proof-check.js.map +1 -1
  57. package/dist/controls/commands/seed.d.ts +1 -9
  58. package/dist/controls/commands/seed.d.ts.map +1 -1
  59. package/dist/controls/commands/seed.js +72 -65
  60. package/dist/controls/commands/seed.js.map +1 -1
  61. package/dist/controls/configure-road.d.ts +2 -0
  62. package/dist/controls/configure-road.d.ts.map +1 -1
  63. package/dist/controls/configure-road.js +18 -14
  64. package/dist/controls/configure-road.js.map +1 -1
  65. package/dist/controls/enforce-entry-outcome.d.ts +2 -1
  66. package/dist/controls/enforce-entry-outcome.d.ts.map +1 -1
  67. package/dist/controls/enforce-entry-outcome.js +17 -15
  68. package/dist/controls/enforce-entry-outcome.js.map +1 -1
  69. package/dist/controls/enforce-points.d.ts +2 -0
  70. package/dist/controls/enforce-points.d.ts.map +1 -1
  71. package/dist/controls/enforce-points.js +4 -1
  72. package/dist/controls/enforce-points.js.map +1 -1
  73. package/dist/controls/enforce-report.d.ts.map +1 -1
  74. package/dist/controls/enforce-report.js +6 -1
  75. package/dist/controls/enforce-report.js.map +1 -1
  76. package/dist/controls/evidence-redact.d.ts.map +1 -1
  77. package/dist/controls/evidence-redact.js +11 -6
  78. package/dist/controls/evidence-redact.js.map +1 -1
  79. package/dist/controls/gates-declaration.d.ts.map +1 -1
  80. package/dist/controls/gates-declaration.js +6 -1
  81. package/dist/controls/gates-declaration.js.map +1 -1
  82. package/dist/controls/proof-copy-preparation.d.ts +33 -0
  83. package/dist/controls/proof-copy-preparation.d.ts.map +1 -0
  84. package/dist/controls/proof-copy-preparation.js +159 -0
  85. package/dist/controls/proof-copy-preparation.js.map +1 -0
  86. package/dist/controls/proof-copy-prepared-state.d.ts +33 -0
  87. package/dist/controls/proof-copy-prepared-state.d.ts.map +1 -0
  88. package/dist/controls/proof-copy-prepared-state.js +117 -0
  89. package/dist/controls/proof-copy-prepared-state.js.map +1 -0
  90. package/dist/controls/proof-copy-workspace.d.ts.map +1 -1
  91. package/dist/controls/proof-copy-workspace.js +17 -4
  92. package/dist/controls/proof-copy-workspace.js.map +1 -1
  93. package/dist/controls/proof-copy.d.ts +5 -0
  94. package/dist/controls/proof-copy.d.ts.map +1 -1
  95. package/dist/controls/proof-copy.js +17 -15
  96. package/dist/controls/proof-copy.js.map +1 -1
  97. package/dist/controls/proof-patch.d.ts +12 -0
  98. package/dist/controls/proof-patch.d.ts.map +1 -1
  99. package/dist/controls/proof-patch.js +28 -0
  100. package/dist/controls/proof-patch.js.map +1 -1
  101. package/dist/controls/proof-preparation-declaration.d.ts +15 -0
  102. package/dist/controls/proof-preparation-declaration.d.ts.map +1 -0
  103. package/dist/controls/proof-preparation-declaration.js +57 -0
  104. package/dist/controls/proof-preparation-declaration.js.map +1 -0
  105. package/dist/controls/proof-tools.d.ts +7 -4
  106. package/dist/controls/proof-tools.d.ts.map +1 -1
  107. package/dist/controls/proof-tools.js +1 -1
  108. package/dist/controls/proof-tools.js.map +1 -1
  109. package/dist/controls/register-drift.d.ts.map +1 -1
  110. package/dist/controls/register-drift.js +4 -3
  111. package/dist/controls/register-drift.js.map +1 -1
  112. package/dist/controls/register-evidence-rule.d.ts +2 -0
  113. package/dist/controls/register-evidence-rule.d.ts.map +1 -1
  114. package/dist/controls/register-evidence-rule.js +8 -7
  115. package/dist/controls/register-evidence-rule.js.map +1 -1
  116. package/dist/controls/register-rules.d.ts +2 -0
  117. package/dist/controls/register-rules.d.ts.map +1 -1
  118. package/dist/controls/register-rules.js.map +1 -1
  119. package/dist/controls/register-types.d.ts +2 -4
  120. package/dist/controls/register-types.d.ts.map +1 -1
  121. package/dist/controls/register-types.js.map +1 -1
  122. package/dist/controls/register.d.ts +2 -0
  123. package/dist/controls/register.d.ts.map +1 -1
  124. package/dist/controls/register.js +3 -1
  125. package/dist/controls/register.js.map +1 -1
  126. package/dist/controls/secret-scan.d.ts.map +1 -1
  127. package/dist/controls/secret-scan.js +7 -5
  128. package/dist/controls/secret-scan.js.map +1 -1
  129. package/dist/controls/secret-shapes.d.ts +7 -7
  130. package/dist/controls/secret-shapes.d.ts.map +1 -1
  131. package/dist/controls/secret-shapes.js +7 -18
  132. package/dist/controls/secret-shapes.js.map +1 -1
  133. package/dist/controls/shipped-parts.d.ts +89 -0
  134. package/dist/controls/shipped-parts.d.ts.map +1 -0
  135. package/dist/controls/shipped-parts.js +233 -0
  136. package/dist/controls/shipped-parts.js.map +1 -0
  137. package/dist/core/lisa-owned-hash-ledger.json +38 -0
  138. package/dist/core/nightly-e2e-guard-behavior-certificate.js +2 -2
  139. package/dist/core/upstream-evidence-manifest.json +90 -23
  140. package/dist/strategies/package-lisa-host-pins.d.ts +7 -12
  141. package/dist/strategies/package-lisa-host-pins.d.ts.map +1 -1
  142. package/dist/strategies/package-lisa-host-pins.js +29 -30
  143. package/dist/strategies/package-lisa-host-pins.js.map +1 -1
  144. package/dist/strategies/package-lisa-range-intersection.d.ts +8 -0
  145. package/dist/strategies/package-lisa-range-intersection.d.ts.map +1 -0
  146. package/dist/strategies/package-lisa-range-intersection.js +73 -0
  147. package/dist/strategies/package-lisa-range-intersection.js.map +1 -0
  148. package/harper-fabric/package-lisa/package.lisa.json +3 -2
  149. package/package.json +4 -4
  150. package/phaser/package-lisa/package.lisa.json +3 -2
  151. package/plugins/lisa/.claude-plugin/plugin.json +1 -1
  152. package/plugins/lisa/.codex-plugin/plugin.json +1 -1
  153. package/plugins/lisa/.codex-plugin/skills/lisa-attest/SKILL.md +12 -2
  154. package/plugins/lisa/.codex-plugin/skills/lisa-configure/SKILL.md +27 -13
  155. package/plugins/lisa/.codex-plugin/skills/lisa-github-read-issue/SKILL.md +22 -106
  156. package/plugins/lisa/.codex-plugin/skills/lisa-persist-learning/SKILL.md +37 -5
  157. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/SKILL.md +9 -10
  158. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/answer-record.mjs +24 -20
  159. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/cli-answer-record.mjs +3 -1
  160. package/plugins/lisa/hooks/block-direct-issue-create.sh +4 -1
  161. package/plugins/lisa/hooks/worktree-binding-guard.mjs +56 -1
  162. package/plugins/lisa/skills/lisa-attest/SKILL.md +12 -2
  163. package/plugins/lisa/skills/lisa-configure/SKILL.md +27 -13
  164. package/plugins/lisa/skills/lisa-github-read-issue/SKILL.md +22 -106
  165. package/plugins/lisa/skills/lisa-persist-learning/SKILL.md +37 -5
  166. package/plugins/lisa/skills/lisa-session-manager/SKILL.md +9 -10
  167. package/plugins/lisa/skills/lisa-session-manager/scripts/answer-record.mjs +24 -20
  168. package/plugins/lisa/skills/lisa-session-manager/scripts/cli-answer-record.mjs +3 -1
  169. package/plugins/lisa-agy/hooks/block-direct-issue-create.sh +4 -1
  170. package/plugins/lisa-agy/plugin.json +1 -1
  171. package/plugins/lisa-agy/skills/lisa-attest/SKILL.md +12 -2
  172. package/plugins/lisa-agy/skills/lisa-configure/SKILL.md +27 -13
  173. package/plugins/lisa-agy/skills/lisa-github-read-issue/SKILL.md +22 -106
  174. package/plugins/lisa-agy/skills/lisa-persist-learning/SKILL.md +37 -5
  175. package/plugins/lisa-agy/skills/lisa-session-manager/SKILL.md +9 -10
  176. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/answer-record.mjs +24 -20
  177. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/cli-answer-record.mjs +3 -1
  178. package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
  179. package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
  180. package/plugins/lisa-cdk-agy/plugin.json +1 -1
  181. package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
  182. package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
  183. package/plugins/lisa-cdk-devin/.claude-plugin/plugin.json +1 -1
  184. package/plugins/lisa-cdk-devin/.devin-plugin/plugin.json +1 -1
  185. package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
  186. package/plugins/lisa-copilot/hooks/block-direct-issue-create.sh +4 -1
  187. package/plugins/lisa-copilot/hooks/worktree-binding-guard.mjs +56 -1
  188. package/plugins/lisa-copilot/skills/lisa-attest/SKILL.md +12 -2
  189. package/plugins/lisa-copilot/skills/lisa-configure/SKILL.md +27 -13
  190. package/plugins/lisa-copilot/skills/lisa-github-read-issue/SKILL.md +22 -106
  191. package/plugins/lisa-copilot/skills/lisa-persist-learning/SKILL.md +37 -5
  192. package/plugins/lisa-copilot/skills/lisa-session-manager/SKILL.md +9 -10
  193. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/answer-record.mjs +24 -20
  194. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/cli-answer-record.mjs +3 -1
  195. package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
  196. package/plugins/lisa-cursor/hooks/block-direct-issue-create.sh +4 -1
  197. package/plugins/lisa-cursor/hooks/worktree-binding-guard.mjs +56 -1
  198. package/plugins/lisa-cursor/skills/lisa-attest/SKILL.md +12 -2
  199. package/plugins/lisa-cursor/skills/lisa-configure/SKILL.md +27 -13
  200. package/plugins/lisa-cursor/skills/lisa-github-read-issue/SKILL.md +22 -106
  201. package/plugins/lisa-cursor/skills/lisa-persist-learning/SKILL.md +37 -5
  202. package/plugins/lisa-cursor/skills/lisa-session-manager/SKILL.md +9 -10
  203. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/answer-record.mjs +24 -20
  204. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/cli-answer-record.mjs +3 -1
  205. package/plugins/lisa-devin/.claude-plugin/plugin.json +1 -1
  206. package/plugins/lisa-devin/.devin-plugin/plugin.json +1 -1
  207. package/plugins/lisa-devin/hooks/block-direct-issue-create.sh +4 -1
  208. package/plugins/lisa-devin/hooks/worktree-binding-guard.mjs +56 -1
  209. package/plugins/lisa-devin/skills/lisa-attest/SKILL.md +12 -2
  210. package/plugins/lisa-devin/skills/lisa-configure/SKILL.md +27 -13
  211. package/plugins/lisa-devin/skills/lisa-github-read-issue/SKILL.md +22 -106
  212. package/plugins/lisa-devin/skills/lisa-persist-learning/SKILL.md +37 -5
  213. package/plugins/lisa-devin/skills/lisa-session-manager/SKILL.md +9 -10
  214. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/answer-record.mjs +24 -20
  215. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/cli-answer-record.mjs +3 -1
  216. package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
  217. package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
  218. package/plugins/lisa-expo-agy/plugin.json +1 -1
  219. package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
  220. package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
  221. package/plugins/lisa-expo-devin/.claude-plugin/plugin.json +1 -1
  222. package/plugins/lisa-expo-devin/.devin-plugin/plugin.json +1 -1
  223. package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
  224. package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
  225. package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
  226. package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
  227. package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
  228. package/plugins/lisa-harper-fabric-devin/.claude-plugin/plugin.json +1 -1
  229. package/plugins/lisa-harper-fabric-devin/.devin-plugin/plugin.json +1 -1
  230. package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
  231. package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
  232. package/plugins/lisa-nestjs-agy/plugin.json +1 -1
  233. package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
  234. package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
  235. package/plugins/lisa-nestjs-devin/.claude-plugin/plugin.json +1 -1
  236. package/plugins/lisa-nestjs-devin/.devin-plugin/plugin.json +1 -1
  237. package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
  238. package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
  239. package/plugins/lisa-phaser-agy/plugin.json +1 -1
  240. package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
  241. package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
  242. package/plugins/lisa-phaser-devin/.claude-plugin/plugin.json +1 -1
  243. package/plugins/lisa-phaser-devin/.devin-plugin/plugin.json +1 -1
  244. package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
  245. package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
  246. package/plugins/lisa-rails-agy/plugin.json +1 -1
  247. package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
  248. package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
  249. package/plugins/lisa-rails-devin/.claude-plugin/plugin.json +1 -1
  250. package/plugins/lisa-rails-devin/.devin-plugin/plugin.json +1 -1
  251. package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
  252. package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
  253. package/plugins/lisa-typescript-agy/plugin.json +1 -1
  254. package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
  255. package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
  256. package/plugins/lisa-typescript-devin/.claude-plugin/plugin.json +1 -1
  257. package/plugins/lisa-typescript-devin/.devin-plugin/plugin.json +1 -1
  258. package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
  259. package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
  260. package/plugins/lisa-wiki-agy/plugin.json +1 -1
  261. package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
  262. package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
  263. package/plugins/lisa-wiki-devin/.claude-plugin/plugin.json +1 -1
  264. package/plugins/lisa-wiki-devin/.devin-plugin/plugin.json +1 -1
  265. package/plugins/src/base/hooks/block-direct-issue-create.sh +4 -1
  266. package/plugins/src/base/hooks/worktree-binding-guard.mjs +56 -1
  267. package/plugins/src/base/skills/lisa-attest/SKILL.md +12 -2
  268. package/plugins/src/base/skills/lisa-configure/SKILL.md +27 -13
  269. package/plugins/src/base/skills/lisa-github-read-issue/SKILL.md +22 -106
  270. package/plugins/src/base/skills/lisa-persist-learning/SKILL.md +37 -5
  271. package/plugins/src/base/skills/lisa-session-manager/SKILL.md +9 -10
  272. package/plugins/src/base/skills/lisa-session-manager/scripts/answer-record.mjs +24 -20
  273. package/plugins/src/base/skills/lisa-session-manager/scripts/cli-answer-record.mjs +3 -1
  274. package/rails/copy-overwrite/scripts/check-nightly-e2e-health.mjs +5115 -0
  275. package/scripts/check-derived-artifacts.mjs +1 -0
  276. package/scripts/generate-nightly-e2e-guard-certificate.mjs +15 -1
  277. package/scripts/lib/phrase-tests/redact.mjs +3 -8
  278. package/scripts/two-channel-couplings.json +5 -3
  279. package/typescript/copy-overwrite/.prettierignore +2 -0
  280. package/typescript/copy-overwrite/scripts/lisa-typecheck.mjs +82 -0
  281. package/typescript/package-lisa/package.lisa.json +3 -2
@@ -0,0 +1,41 @@
1
+ /** Repository-native issue relationships, label history, and linked PR reviews. */
2
+ import type { JsonObject } from "../sync/json-path.js";
3
+ import type { GitHubIssueRef } from "./github-reader-target.js";
4
+ import { type GitHubRead } from "./github-reader-wire.js";
5
+ /**
6
+ * Gather native issue relationships, history and linked PR reviews.
7
+ * @param read - Native GitHub reader.
8
+ * @param ref - Repository and issue identity.
9
+ * @returns Repository context independent of Projects service metadata.
10
+ */
11
+ export declare function readGitHubIssueRelationships(read: GitHubRead, ref: GitHubIssueRef): Promise<{
12
+ graph: {
13
+ parent: JsonObject | null;
14
+ children: JsonObject[];
15
+ warning?: never;
16
+ } | {
17
+ warning: string;
18
+ parent?: never;
19
+ children?: never;
20
+ };
21
+ timeline: {
22
+ events: JsonObject[];
23
+ warning?: never;
24
+ } | {
25
+ events: never[];
26
+ warning: string;
27
+ };
28
+ pullRequests: ({
29
+ repo: string;
30
+ metadata: JsonObject;
31
+ reviews: JsonObject[];
32
+ threads: {
33
+ comments: JsonObject[];
34
+ }[];
35
+ } | {
36
+ repo: string;
37
+ number: number;
38
+ warning: string;
39
+ })[];
40
+ }>;
41
+ //# sourceMappingURL=github-reader-relationships.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"github-reader-relationships.d.ts","sourceRoot":"","sources":["../../src/cli/github-reader-relationships.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EASL,KAAK,UAAU,EAChB,MAAM,yBAAyB,CAAC;AAiPjC;;;;;GAKG;AACH,wBAAsB,4BAA4B,CAChD,IAAI,EAAE,UAAU,EAChB,GAAG,EAAE,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BpB"}
@@ -0,0 +1,218 @@
1
+ import { connectionNodes, githubReadError, graphql, itemVariables, repositoryItem, responseObject, responseObjects, restPages, } from "./github-reader-wire.js";
2
+ const REPO_FIELDS = "number title state url repository { nameWithOwner }";
3
+ const PULL_FIELDS = `number title state merged mergedAt url repository { nameWithOwner }`;
4
+ const PAGE = "pageInfo { hasNextPage endCursor }";
5
+ const ISSUE_QUERY = "query($owner:String!,$repo:String!,$number:Int!,$endCursor:String)";
6
+ const ISSUE_ROOT = "repository(owner:$owner,name:$repo) { issue(number:$number)";
7
+ const COMMENTS = "id url body createdAt author { login }";
8
+ const REVIEW_THREAD_COMMENTS = "review thread comments";
9
+ const PULL_METADATA = "number,title,state,mergedAt,url,headRefOid,baseRefName,baseRefOid,reviewDecision,reviewRequests,statusCheckRollup";
10
+ const SUB_ISSUES = `${ISSUE_QUERY} { ${ISSUE_ROOT} {
11
+ parent { ${REPO_FIELDS} }
12
+ subIssues(first:100,after:$endCursor) {
13
+ nodes { ${REPO_FIELDS} labels(first:50) { nodes { name } } assignees(first:5) { nodes { login } } }
14
+ ${PAGE}
15
+ }
16
+ } } }`;
17
+ const CLOSING_PULLS = `${ISSUE_QUERY} { ${ISSUE_ROOT} {
18
+ closedByPullRequestsReferences(first:100,after:$endCursor) {
19
+ nodes { ${PULL_FIELDS} } ${PAGE}
20
+ }
21
+ } } }`;
22
+ const TIMELINE = `${ISSUE_QUERY} { ${ISSUE_ROOT} {
23
+ timelineItems(first:100,after:$endCursor,itemTypes:[CROSS_REFERENCED_EVENT,LABELED_EVENT,UNLABELED_EVENT]) {
24
+ nodes {
25
+ __typename
26
+ ...on CrossReferencedEvent {
27
+ createdAt actor { login } source { ...on PullRequest { ${PULL_FIELDS} } }
28
+ }
29
+ ...on LabeledEvent { createdAt actor { login } label { name } }
30
+ ...on UnlabeledEvent { createdAt actor { login } label { name } }
31
+ }
32
+ ${PAGE}
33
+ }
34
+ } } }`;
35
+ const THREADS = `${ISSUE_QUERY} { repository(owner:$owner,name:$repo) { pullRequest(number:$number) {
36
+ reviewThreads(first:100,after:$endCursor) {
37
+ nodes { id isResolved isOutdated path line originalLine comments(first:100) { totalCount nodes { ${COMMENTS} } } }
38
+ ${PAGE}
39
+ }
40
+ } } }`;
41
+ const THREAD_COMMENTS = `query($id:ID!,$endCursor:String) { node(id:$id) {
42
+ ...on PullRequestReviewThread { comments(first:100,after:$endCursor) { nodes { ${COMMENTS} } ${PAGE} } }
43
+ } }`;
44
+ /**
45
+ * Project one named connection from each paginated issue response.
46
+ * @param read - Native GitHub reader.
47
+ * @param ref - Repository and issue identity.
48
+ * @param query - Issue connection query.
49
+ * @param key - Connection field name in that query.
50
+ * @returns Validated native connection nodes.
51
+ */
52
+ async function issueConnection(read, ref, query, key) {
53
+ const pages = await graphql(read, query, itemVariables(ref), true);
54
+ return connectionNodes(pages.map(page => responseObject(repositoryItem(page, "issue")[key], key)), key);
55
+ }
56
+ /**
57
+ * Preserve native graph coverage and the older GitHub Enterprise fallback.
58
+ * @param read - Native GitHub reader.
59
+ * @param ref - Repository and issue identity.
60
+ * @returns Native parent and children or the exact unsupported-schema warning.
61
+ */
62
+ async function issueGraph(read, ref) {
63
+ try {
64
+ const pages = await graphql(read, SUB_ISSUES, itemVariables(ref), true);
65
+ const issues = pages.map(page => repositoryItem(page, "issue"));
66
+ const parent = issues[0]?.parent;
67
+ const children = connectionNodes(issues.map(issue => responseObject(issue.subIssues, "sub-issues")), "sub-issues");
68
+ return {
69
+ parent: parent === null ? null : responseObject(parent, "the parent issue"),
70
+ children,
71
+ };
72
+ }
73
+ catch (error) {
74
+ const message = githubReadError(error);
75
+ if (!/(?:Field ['"](?:parent|subIssues)['"] doesn.t exist|Cannot query field ['"](?:parent|subIssues)['"])/iu.test(message))
76
+ throw error;
77
+ return { warning: message };
78
+ }
79
+ }
80
+ /**
81
+ * Keep native label history and cross-references, with its existing advisory failure behavior.
82
+ * @param read - Native GitHub reader.
83
+ * @param ref - Repository and issue identity.
84
+ * @returns Timeline events or the exact read warning.
85
+ */
86
+ async function issueTimeline(read, ref) {
87
+ try {
88
+ return {
89
+ events: await issueConnection(read, ref, TIMELINE, "timelineItems"),
90
+ };
91
+ }
92
+ catch (error) {
93
+ return { events: [], warning: githubReadError(error) };
94
+ }
95
+ }
96
+ /**
97
+ * Match the native repository/number from the PR references and deduplicate them.
98
+ * @param references - GraphQL PR link records.
99
+ * @returns Unique native PR identities in the first seen order.
100
+ */
101
+ function linkedPulls(references) {
102
+ const pulls = references.map(({ repository, number }) => {
103
+ const name = responseObject(repository, "the linked PR repository").nameWithOwner;
104
+ const pair = typeof name === "string"
105
+ ? /^([a-z\d_-]+)\/((?!\.{1,2}$)[a-z\d_.-]+)$/iu.exec(name)
106
+ : null;
107
+ if (!pair?.[1] ||
108
+ !pair[2] ||
109
+ typeof number !== "number" ||
110
+ !Number.isSafeInteger(number) ||
111
+ number <= 0) {
112
+ throw new Error("GitHub did not return the linked PR identity");
113
+ }
114
+ const ref = { owner: pair[1], repo: pair[2], number };
115
+ return [`${ref.owner}/${ref.repo}#${number}`.toLowerCase(), ref];
116
+ });
117
+ return [...new Map(pulls).values()];
118
+ }
119
+ /**
120
+ * Read every comment when a native review thread spans multiple pages.
121
+ * @param read - Native GitHub reader.
122
+ * @param thread - Review thread returned with its first comment page.
123
+ * @returns The native thread with flattened comments.
124
+ */
125
+ async function threadComments(read, thread) {
126
+ const first = responseObject(thread.comments, REVIEW_THREAD_COMMENTS);
127
+ const nodes = responseObjects(first.nodes, REVIEW_THREAD_COMMENTS);
128
+ if (first.totalCount === nodes.length)
129
+ return { ...thread, comments: nodes };
130
+ if (typeof first.totalCount !== "number" ||
131
+ first.totalCount < nodes.length ||
132
+ typeof thread.id !== "string")
133
+ throw new Error("GitHub did not return the review thread pagination identity");
134
+ const pages = await graphql(read, THREAD_COMMENTS, { id: thread.id }, true);
135
+ const connections = pages.map(page => responseObject(responseObject(page.node, "a review thread").comments, REVIEW_THREAD_COMMENTS));
136
+ const comments = connectionNodes(connections, REVIEW_THREAD_COMMENTS);
137
+ if (comments.length !== first.totalCount)
138
+ throw new Error("GitHub review thread comments changed during pagination");
139
+ return { ...thread, comments };
140
+ }
141
+ /**
142
+ * Read linked PR revisions, review records and complete review threads.
143
+ * @param read - Native GitHub reader.
144
+ * @param ref - The linked PR repository and number.
145
+ * @returns The linked PR context.
146
+ */
147
+ async function pullContext(read, ref) {
148
+ const repo = `${ref.owner}/${ref.repo}`;
149
+ const [view, reviews, pages] = await Promise.all([
150
+ read([
151
+ "pr",
152
+ "view",
153
+ String(ref.number),
154
+ "--repo",
155
+ repo,
156
+ "--json",
157
+ PULL_METADATA,
158
+ ]),
159
+ restPages(read, `repos/${repo}/pulls/${ref.number}/reviews`),
160
+ graphql(read, THREADS, itemVariables(ref), true),
161
+ ]);
162
+ const threads = connectionNodes(pages.map(page => responseObject(repositoryItem(page, "pullRequest").reviewThreads, "review threads")), "review threads");
163
+ return {
164
+ repo,
165
+ metadata: responseObject(view, "linked PR metadata"),
166
+ reviews,
167
+ threads: await Promise.all(threads.map(async (thread) => await threadComments(read, thread))),
168
+ };
169
+ }
170
+ /**
171
+ * Keep inaccessible additional links visible without masking a primary-repository failure.
172
+ * @param read - Native GitHub reader.
173
+ * @param primary - Primary issue repository.
174
+ * @param pull - Linked pull request identity.
175
+ * @returns Link context or the native diagnostic for an inaccessible cross-repo link.
176
+ */
177
+ async function linkedPullContext(read, primary, pull) {
178
+ try {
179
+ return await pullContext(read, pull);
180
+ }
181
+ catch (error) {
182
+ const repo = `${pull.owner}/${pull.repo}`;
183
+ if (repo.toLowerCase() === `${primary.owner}/${primary.repo}`.toLowerCase())
184
+ throw error;
185
+ return { repo, number: pull.number, warning: githubReadError(error) };
186
+ }
187
+ }
188
+ /**
189
+ * Gather native issue relationships, history and linked PR reviews.
190
+ * @param read - Native GitHub reader.
191
+ * @param ref - Repository and issue identity.
192
+ * @returns Repository context independent of Projects service metadata.
193
+ */
194
+ export async function readGitHubIssueRelationships(read, ref) {
195
+ const [graph, closing, timeline] = await Promise.all([
196
+ issueGraph(read, ref),
197
+ issueConnection(read, ref, CLOSING_PULLS, "closedByPullRequestsReferences"),
198
+ issueTimeline(read, ref),
199
+ ]);
200
+ const crossReferenced = timeline.events
201
+ .filter(event => event.__typename === "CrossReferencedEvent")
202
+ .flatMap(event => {
203
+ const source = event.source;
204
+ return source === null ||
205
+ source === undefined ||
206
+ typeof source !== "object" ||
207
+ !("number" in source)
208
+ ? []
209
+ : [responseObject(source, "a cross-referenced PR")];
210
+ });
211
+ const pulls = linkedPulls([...closing, ...crossReferenced]);
212
+ const pullRequests = await pulls.reduce(async (pending, pull) => [
213
+ ...(await pending),
214
+ await linkedPullContext(read, ref, pull),
215
+ ], Promise.resolve([]));
216
+ return { graph, timeline, pullRequests };
217
+ }
218
+ //# sourceMappingURL=github-reader-relationships.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"github-reader-relationships.js","sourceRoot":"","sources":["../../src/cli/github-reader-relationships.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,eAAe,EACf,eAAe,EACf,OAAO,EACP,aAAa,EACb,cAAc,EACd,cAAc,EACd,eAAe,EACf,SAAS,GAEV,MAAM,yBAAyB,CAAC;AAEjC,MAAM,WAAW,GAAG,qDAAqD,CAAC;AAC1E,MAAM,WAAW,GAAG,qEAAqE,CAAC;AAC1F,MAAM,IAAI,GAAG,oCAAoC,CAAC;AAClD,MAAM,WAAW,GACf,oEAAoE,CAAC;AACvE,MAAM,UAAU,GACd,6DAA6D,CAAC;AAChE,MAAM,QAAQ,GAAG,wCAAwC,CAAC;AAC1D,MAAM,sBAAsB,G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,CAAC,IAAI,EAAE,GAAG,CAAC;KACzB,CAAC,CAAC;IACH,MAAM,eAAe,GAAG,QAAQ,CAAC,MAAM;SACpC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,UAAU,KAAK,sBAAsB,CAAC;SAC5D,OAAO,CAAC,KAAK,CAAC,EAAE;QACf,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;QAC5B,OAAO,MAAM,KAAK,IAAI;YACpB,MAAM,KAAK,SAAS;YACpB,OAAO,MAAM,KAAK,QAAQ;YAC1B,CAAC,CAAC,QAAQ,IAAI,MAAM,CAAC;YACrB,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,CAAC,cAAc,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAC,CAAC;IACxD,CAAC,CAAC,CAAC;IACL,MAAM,KAAK,GAAG,WAAW,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,eAAe,CAAC,CAAC,CAAC;IAC5D,MAAM,YAAY,GAAG,MAAM,KAAK,CAAC,MAAM,CAGrC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;QACvB,GAAG,CAAC,MAAM,OAAO,CAAC;QAClB,MAAM,iBAAiB,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC;KACzC,EACD,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CACpB,CAAC;IACF,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC;AAC3C,CAAC"}
@@ -0,0 +1,24 @@
1
+ /** The native repository identity for a read. */
2
+ export interface GitHubIssueRef {
3
+ readonly owner: string;
4
+ readonly repo: string;
5
+ readonly number: number;
6
+ }
7
+ /** A Project reference that has passed local configuration validation. */
8
+ export interface GitHubReaderProject {
9
+ readonly kind: "organization" | "user";
10
+ readonly login: string;
11
+ readonly number: number;
12
+ readonly required: boolean;
13
+ }
14
+ /**
15
+ * Resolve and validate the effective configuration before any provider calls.
16
+ * @param root - Current Lisa checkout.
17
+ * @param input - Issue argument from the caller.
18
+ * @returns Independent repository and optional Project identities.
19
+ */
20
+ export declare function resolveGitHubReaderTarget(root: string, input: string): Promise<{
21
+ issue: GitHubIssueRef;
22
+ project: GitHubReaderProject | undefined;
23
+ }>;
24
+ //# sourceMappingURL=github-reader-target.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"github-reader-target.d.ts","sourceRoot":"","sources":["../../src/cli/github-reader-target.ts"],"names":[],"mappings":"AAWA,iDAAiD;AACjD,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,0EAA0E;AAC1E,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,IAAI,EAAE,cAAc,GAAG,MAAM,CAAC;IACvC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;CAC5B;AA2FD;;;;;GAKG;AACH,wBAAsB,yBAAyB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;;;GAI1E"}
@@ -0,0 +1,95 @@
1
+ /** Resolve the issue and optional Project service before selecting provider reads. */
2
+ import { isJsonObject } from "../sync/json-path.js";
3
+ import { readConfinedMergedConfig } from "./confined-project-read.js";
4
+ const LOGIN = /^(?!-)[a-z\d_-]+$/iu;
5
+ const REPO = /^(?!\.{1,2}$)[a-z\d_.-]+$/iu;
6
+ const QUALIFIED = /^([a-z\d_-]+)\/([a-z\d_.-]+)#([1-9]\d*)$/iu;
7
+ const ISSUE_URL = /^https:\/\/github\.com\/([a-z\d_-]+)\/([a-z\d_.-]+)\/issues\/([1-9]\d*)\/?$/iu;
8
+ const NUMBER = /^#?([1-9]\d*)$/u;
9
+ /**
10
+ * Accept an absent setting and refuse a present value of the wrong shape.
11
+ * @param value - Effective configuration value.
12
+ * @param field - Configuration key for diagnostics.
13
+ * @returns The configuration object, or undefined when absent.
14
+ */
15
+ function optionalObject(value, field) {
16
+ if (value === undefined || isJsonObject(value))
17
+ return value;
18
+ throw new Error(`${field} must be an object`);
19
+ }
20
+ /**
21
+ * Verify names before using them in repository paths or GraphQL variables.
22
+ * @param owner - Repository owner.
23
+ * @param repo - Repository name.
24
+ * @returns The repository identity.
25
+ */
26
+ function repository(owner, repo) {
27
+ if (typeof owner !== "string" ||
28
+ !LOGIN.test(owner) ||
29
+ typeof repo !== "string" ||
30
+ !REPO.test(repo)) {
31
+ throw new Error("A GitHub repository needs a valid owner and repository name");
32
+ }
33
+ return { owner, repo };
34
+ }
35
+ /**
36
+ * Parse the approved GitHub issue argument forms.
37
+ * @param input - Issue number, qualified reference or URL.
38
+ * @param github - Effective GitHub configuration.
39
+ * @returns The selected repository and issue number.
40
+ */
41
+ function issueRef(input, github) {
42
+ const value = input.trim();
43
+ const ref = QUALIFIED.exec(value) ?? ISSUE_URL.exec(value);
44
+ const number = Number(ref?.[3] ?? NUMBER.exec(value)?.[1]);
45
+ if (!Number.isSafeInteger(number)) {
46
+ throw new Error("Use an issue number, owner/repo#number, or a GitHub issue URL");
47
+ }
48
+ return {
49
+ ...repository(ref?.[1] ?? github.org, ref?.[2] ?? github.repo),
50
+ number,
51
+ };
52
+ }
53
+ /**
54
+ * Resolve the documented ProjectV2 block and its repository namespace.
55
+ * @param github - Effective GitHub configuration.
56
+ * @returns Validated Project settings when configured.
57
+ */
58
+ function projectSettings(github) {
59
+ const projects = optionalObject(github.projects, "github.projects");
60
+ const configured = optionalObject(projects?.v2, "github.projects.v2");
61
+ if (configured === undefined)
62
+ return undefined;
63
+ const tracked = repository(github.org, github.repo);
64
+ const owner = optionalObject(configured.owner, "github.projects.v2.owner");
65
+ const { kind, slug } = owner ?? {};
66
+ const { number, required } = configured;
67
+ if (kind !== "organization" && kind !== "user") {
68
+ throw new Error("github.projects.v2.owner.kind must be organization or user");
69
+ }
70
+ if (typeof slug !== "string" ||
71
+ slug.toLowerCase() !== tracked.owner.toLowerCase()) {
72
+ throw new Error("github.projects.v2.owner.slug must match github.org");
73
+ }
74
+ if (typeof number !== "number" ||
75
+ !Number.isSafeInteger(number) ||
76
+ number <= 0) {
77
+ throw new Error("github.projects.v2.number must be a positive integer");
78
+ }
79
+ if (required !== undefined && typeof required !== "boolean") {
80
+ throw new Error("github.projects.v2.required must be true or false");
81
+ }
82
+ return { kind, login: slug, number, required: required ?? false };
83
+ }
84
+ /**
85
+ * Resolve and validate the effective configuration before any provider calls.
86
+ * @param root - Current Lisa checkout.
87
+ * @param input - Issue argument from the caller.
88
+ * @returns Independent repository and optional Project identities.
89
+ */
90
+ export async function resolveGitHubReaderTarget(root, input) {
91
+ const config = await readConfinedMergedConfig(root, true);
92
+ const github = optionalObject(config.github, "github") ?? {};
93
+ return { issue: issueRef(input, github), project: projectSettings(github) };
94
+ }
95
+ //# sourceMappingURL=github-reader-target.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"github-reader-target.js","sourceRoot":"","sources":["../../src/cli/github-reader-target.ts"],"names":[],"mappings":"AAAA,sFAAsF;AACtF,OAAO,EAAE,YAAY,EAAmB,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAEtE,MAAM,KAAK,GAAG,qBAAqB,CAAC;AACpC,MAAM,IAAI,GAAG,6BAA6B,CAAC;AAC3C,MAAM,SAAS,GAAG,4CAA4C,CAAC;AAC/D,MAAM,SAAS,GACb,+EAA+E,CAAC;AAClF,MAAM,MAAM,GAAG,iBAAiB,CAAC;AAiBjC;;;;;GAKG;AACH,SAAS,cAAc,CAAC,KAAc,EAAE,KAAa;IACnD,IAAI,KAAK,KAAK,SAAS,IAAI,YAAY,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAC7D,MAAM,IAAI,K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BAAyB,CAAC,IAAY,EAAE,KAAa;IACzE,MAAM,MAAM,GAAG,MAAM,wBAAwB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC1D,MAAM,MAAM,GAAG,cAAc,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,IAAI,EAAE,CAAC;IAC7D,OAAO,EAAE,KAAK,EAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,eAAe,CAAC,MAAM,CAAC,EAAE,CAAC;AAC9E,CAAC"}
@@ -0,0 +1,72 @@
1
+ /** Native GitHub read-only transport and response validation for the issue reader. */
2
+ import { type JsonObject } from "../sync/json-path.js";
3
+ import type { GitHubIssueRef } from "./github-reader-target.js";
4
+ /** A shell-free GitHub CLI request through the selected native session. */
5
+ export type GitHubRead = (args: readonly string[]) => Promise<unknown>;
6
+ /**
7
+ * Preserve the provider's actual complaint when it supplied one.
8
+ * @param error - Native request failure.
9
+ * @returns The provider diagnostic or the local execution error.
10
+ */
11
+ export declare function githubReadError(error: unknown): string;
12
+ /**
13
+ * Bind requests to one working directory and preserve native gh authentication.
14
+ * @param cwd - Root used for the native calls.
15
+ * @returns A JSON request with bounded output and a per-request deadline.
16
+ */
17
+ export declare function nativeGitHubRead(cwd: string): GitHubRead;
18
+ /**
19
+ * Require an object where a successful call promises one.
20
+ * @param value - Provider result or field.
21
+ * @param subject - Description for diagnostics.
22
+ * @returns A validated object.
23
+ */
24
+ export declare function responseObject(value: unknown, subject: string): JsonObject;
25
+ /**
26
+ * Require an array of records instead of silently dropping malformed entries.
27
+ * @param value - Provider result or field.
28
+ * @param subject - Description for diagnostics.
29
+ * @returns Validated records.
30
+ */
31
+ export declare function responseObjects(value: unknown, subject: string): JsonObject[];
32
+ /**
33
+ * Flatten all native REST pages for one repository resource.
34
+ * @param read - The native GitHub request function.
35
+ * @param route - A repository-scoped REST read endpoint.
36
+ * @returns Records in native page order.
37
+ */
38
+ export declare function restPages(read: GitHubRead, route: string): Promise<JsonObject[]>;
39
+ /**
40
+ * Read one GraphQL query, with explicit pagination for its one connection.
41
+ * @param read - Native GitHub JSON reader.
42
+ * @param query - Constant query from the reader.
43
+ * @param variables - Typed input bindings.
44
+ * @param paginate - Follow the query's $endCursor connection.
45
+ * @returns GraphQL data objects, in response order.
46
+ */
47
+ export declare function graphql(read: GitHubRead, query: string, variables: Readonly<Record<string, string | number>>, paginate?: boolean): Promise<JsonObject[]>;
48
+ /**
49
+ * Verify the complete sequence of a GitHub paginated connection.
50
+ * @param pages - Projected connection page objects.
51
+ * @param subject - Name shown in failures.
52
+ * @returns Nodes in native page order.
53
+ */
54
+ export declare function connectionNodes(pages: readonly JsonObject[], subject: string): JsonObject[];
55
+ /**
56
+ * Get one issue or PR response within a repository selected by native variables.
57
+ * @param page - GraphQL data page.
58
+ * @param kind - Issue or PR field.
59
+ * @returns A validated repository item.
60
+ */
61
+ export declare function repositoryItem(page: JsonObject, kind: "issue" | "pullRequest"): JsonObject;
62
+ /**
63
+ * Bind repository, owner and item number as separate native variables.
64
+ * @param ref - The selected GitHub reference.
65
+ * @returns Bindings accepted by the issue and PR queries.
66
+ */
67
+ export declare function itemVariables(ref: GitHubIssueRef): {
68
+ owner: string;
69
+ repo: string;
70
+ number: number;
71
+ };
72
+ //# sourceMappingURL=github-reader-wire.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"github-reader-wire.d.ts","sourceRoot":"","sources":["../../src/cli/github-reader-wire.ts"],"names":[],"mappings":"AAAA,sFAAsF;AACtF,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAErE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAKhE,2EAA2E;AAC3E,MAAM,MAAM,UAAU,GAAG,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;AAEvE;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAQtD;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAYxD;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,UAAU,CAG1E;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,UAAU,EAAE,CAI7E;AAED;;;;;GAKG;AACH,wBAAsB,SAAS,CAC7B,IAAI,EAAE,UAAU,EAChB,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,UAAU,EAAE,CAAC,CAKvB;AAED;;;;;;;GAOG;AACH,wBAAsB,OAAO,CAC3B,IAAI,EAAE,UAAU,EAChB,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC,EACpD,QAAQ,UAAQ,GACf,OAAO,CAAC,UAAU,EAAE,CAAC,CAkBvB;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,SAAS,UAAU,EAAE,EAC5B,OAAO,EAAE,MAAM,GACd,UAAU,EAAE,CAQd;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,OAAO,GAAG,aAAa,GAC5B,UAAU,CAKZ;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,cAAc;;;;EAEhD"}
@@ -0,0 +1,125 @@
1
+ /** Native GitHub read-only transport and response validation for the issue reader. */
2
+ import { isJsonObject } from "../sync/json-path.js";
3
+ import { runGh } from "./gh-cli.js";
4
+ const REQUEST_TIMEOUT_MS = 120_000;
5
+ const RESPONSE_BYTES = 32 * 1024 * 1024;
6
+ /**
7
+ * Preserve the provider's actual complaint when it supplied one.
8
+ * @param error - Native request failure.
9
+ * @returns The provider diagnostic or the local execution error.
10
+ */
11
+ export function githubReadError(error) {
12
+ if (isJsonObject(error) &&
13
+ typeof error.stderr === "string" &&
14
+ error.stderr.trim())
15
+ return error.stderr.trimEnd();
16
+ return error instanceof Error ? error.message : String(error);
17
+ }
18
+ /**
19
+ * Bind requests to one working directory and preserve native gh authentication.
20
+ * @param cwd - Root used for the native calls.
21
+ * @returns A JSON request with bounded output and a per-request deadline.
22
+ */
23
+ export function nativeGitHubRead(cwd) {
24
+ return async (args) => {
25
+ const output = await runGh(args, cwd, REQUEST_TIMEOUT_MS, AbortSignal.timeout(REQUEST_TIMEOUT_MS), RESPONSE_BYTES);
26
+ if (args[0] === "auth")
27
+ return undefined;
28
+ return JSON.parse(output);
29
+ };
30
+ }
31
+ /**
32
+ * Require an object where a successful call promises one.
33
+ * @param value - Provider result or field.
34
+ * @param subject - Description for diagnostics.
35
+ * @returns A validated object.
36
+ */
37
+ export function responseObject(value, subject) {
38
+ if (!isJsonObject(value))
39
+ throw new Error(`GitHub did not return ${subject}`);
40
+ return value;
41
+ }
42
+ /**
43
+ * Require an array of records instead of silently dropping malformed entries.
44
+ * @param value - Provider result or field.
45
+ * @param subject - Description for diagnostics.
46
+ * @returns Validated records.
47
+ */
48
+ export function responseObjects(value, subject) {
49
+ if (!Array.isArray(value))
50
+ throw new Error(`GitHub did not return ${subject}`);
51
+ return value.map(item => responseObject(item, subject));
52
+ }
53
+ /**
54
+ * Flatten all native REST pages for one repository resource.
55
+ * @param read - The native GitHub request function.
56
+ * @param route - A repository-scoped REST read endpoint.
57
+ * @returns Records in native page order.
58
+ */
59
+ export async function restPages(read, route) {
60
+ const pages = await read(["api", route, "--paginate", "--slurp"]);
61
+ if (!Array.isArray(pages) || pages.length === 0)
62
+ throw new Error(`GitHub did not return all pages for ${route}`);
63
+ return pages.flatMap(page => responseObjects(page, route));
64
+ }
65
+ /**
66
+ * Read one GraphQL query, with explicit pagination for its one connection.
67
+ * @param read - Native GitHub JSON reader.
68
+ * @param query - Constant query from the reader.
69
+ * @param variables - Typed input bindings.
70
+ * @param paginate - Follow the query's $endCursor connection.
71
+ * @returns GraphQL data objects, in response order.
72
+ */
73
+ export async function graphql(read, query, variables, paginate = false) {
74
+ const args = [
75
+ "api",
76
+ "graphql",
77
+ "-f",
78
+ `query=${query}`,
79
+ ...Object.entries(variables).flatMap(([name, value]) => [
80
+ typeof value === "number" ? "-F" : "-f",
81
+ `${name}=${value}`,
82
+ ]),
83
+ ...(paginate ? ["--paginate", "--slurp"] : []),
84
+ ];
85
+ const result = await read(args);
86
+ const pages = paginate
87
+ ? responseObjects(result, "GraphQL pages")
88
+ : [responseObject(result, "GraphQL response")];
89
+ if (pages.length === 0)
90
+ throw new Error("GitHub returned no GraphQL pages");
91
+ return pages.map(page => responseObject(page.data, "GraphQL data"));
92
+ }
93
+ /**
94
+ * Verify the complete sequence of a GitHub paginated connection.
95
+ * @param pages - Projected connection page objects.
96
+ * @param subject - Name shown in failures.
97
+ * @returns Nodes in native page order.
98
+ */
99
+ export function connectionNodes(pages, subject) {
100
+ return pages.flatMap((page, index) => {
101
+ const info = responseObject(page.pageInfo, `${subject} pagination`);
102
+ const hasSuccessor = index < pages.length - 1;
103
+ if (info.hasNextPage !== hasSuccessor)
104
+ throw new Error(`GitHub returned incomplete ${subject}`);
105
+ return responseObjects(page.nodes, subject);
106
+ });
107
+ }
108
+ /**
109
+ * Get one issue or PR response within a repository selected by native variables.
110
+ * @param page - GraphQL data page.
111
+ * @param kind - Issue or PR field.
112
+ * @returns A validated repository item.
113
+ */
114
+ export function repositoryItem(page, kind) {
115
+ return responseObject(responseObject(page.repository, "a repository")[kind], kind);
116
+ }
117
+ /**
118
+ * Bind repository, owner and item number as separate native variables.
119
+ * @param ref - The selected GitHub reference.
120
+ * @returns Bindings accepted by the issue and PR queries.
121
+ */
122
+ export function itemVariables(ref) {
123
+ return { owner: ref.owner, repo: ref.repo, number: ref.number };
124
+ }
125
+ //# sourceMappingURL=github-reader-wire.js.map
@@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