chief-clancy 0.7.0 → 0.7.2

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 (189) hide show
  1. package/README.md +4 -1
  2. package/dist/bundle/clancy-once.js +50 -50
  3. package/package.json +5 -2
  4. package/src/roles/planner/commands/approve-plan.md +3 -0
  5. package/src/roles/planner/commands/plan.md +1 -0
  6. package/src/roles/planner/workflows/approve-plan.md +3 -1
  7. package/src/roles/planner/workflows/plan.md +5 -5
  8. package/src/roles/strategist/commands/approve-brief.md +1 -0
  9. package/src/roles/strategist/workflows/approve-brief.md +3 -1
  10. package/src/roles/strategist/workflows/brief.md +38 -20
  11. package/src/templates/.env.example.github +19 -1
  12. package/src/templates/.env.example.jira +25 -1
  13. package/src/templates/.env.example.linear +19 -1
  14. package/dist/schemas/bitbucket-pr.d.ts +0 -137
  15. package/dist/schemas/bitbucket-pr.d.ts.map +0 -1
  16. package/dist/schemas/bitbucket-pr.js +0 -75
  17. package/dist/schemas/bitbucket-pr.js.map +0 -1
  18. package/dist/schemas/env.d.ts +0 -170
  19. package/dist/schemas/env.d.ts.map +0 -1
  20. package/dist/schemas/env.js +0 -69
  21. package/dist/schemas/env.js.map +0 -1
  22. package/dist/schemas/github-issues.d.ts +0 -105
  23. package/dist/schemas/github-issues.d.ts.map +0 -1
  24. package/dist/schemas/github-issues.js +0 -54
  25. package/dist/schemas/github-issues.js.map +0 -1
  26. package/dist/schemas/gitlab-mr.d.ts +0 -73
  27. package/dist/schemas/gitlab-mr.d.ts.map +0 -1
  28. package/dist/schemas/gitlab-mr.js +0 -33
  29. package/dist/schemas/gitlab-mr.js.map +0 -1
  30. package/dist/schemas/jira.d.ts +0 -59
  31. package/dist/schemas/jira.d.ts.map +0 -1
  32. package/dist/schemas/jira.js +0 -56
  33. package/dist/schemas/jira.js.map +0 -1
  34. package/dist/schemas/linear.d.ts +0 -108
  35. package/dist/schemas/linear.d.ts.map +0 -1
  36. package/dist/schemas/linear.js +0 -84
  37. package/dist/schemas/linear.js.map +0 -1
  38. package/dist/scripts/afk/afk.d.ts +0 -21
  39. package/dist/scripts/afk/afk.d.ts.map +0 -1
  40. package/dist/scripts/afk/afk.js +0 -145
  41. package/dist/scripts/afk/afk.js.map +0 -1
  42. package/dist/scripts/afk/report/report.d.ts +0 -47
  43. package/dist/scripts/afk/report/report.d.ts.map +0 -1
  44. package/dist/scripts/afk/report/report.js +0 -194
  45. package/dist/scripts/afk/report/report.js.map +0 -1
  46. package/dist/scripts/board/github/github.d.ts +0 -104
  47. package/dist/scripts/board/github/github.d.ts.map +0 -1
  48. package/dist/scripts/board/github/github.js +0 -291
  49. package/dist/scripts/board/github/github.js.map +0 -1
  50. package/dist/scripts/board/jira/jira.d.ts +0 -139
  51. package/dist/scripts/board/jira/jira.d.ts.map +0 -1
  52. package/dist/scripts/board/jira/jira.js +0 -378
  53. package/dist/scripts/board/jira/jira.js.map +0 -1
  54. package/dist/scripts/board/linear/linear.d.ts +0 -129
  55. package/dist/scripts/board/linear/linear.d.ts.map +0 -1
  56. package/dist/scripts/board/linear/linear.js +0 -393
  57. package/dist/scripts/board/linear/linear.js.map +0 -1
  58. package/dist/scripts/once/board-ops/board-ops.d.ts +0 -26
  59. package/dist/scripts/once/board-ops/board-ops.d.ts.map +0 -1
  60. package/dist/scripts/once/board-ops/board-ops.js +0 -113
  61. package/dist/scripts/once/board-ops/board-ops.js.map +0 -1
  62. package/dist/scripts/once/cost/cost.d.ts +0 -10
  63. package/dist/scripts/once/cost/cost.d.ts.map +0 -1
  64. package/dist/scripts/once/cost/cost.js +0 -23
  65. package/dist/scripts/once/cost/cost.js.map +0 -1
  66. package/dist/scripts/once/deliver/deliver.d.ts +0 -37
  67. package/dist/scripts/once/deliver/deliver.d.ts.map +0 -1
  68. package/dist/scripts/once/deliver/deliver.js +0 -253
  69. package/dist/scripts/once/deliver/deliver.js.map +0 -1
  70. package/dist/scripts/once/fetch-ticket/fetch-ticket.d.ts +0 -22
  71. package/dist/scripts/once/fetch-ticket/fetch-ticket.d.ts.map +0 -1
  72. package/dist/scripts/once/fetch-ticket/fetch-ticket.js +0 -123
  73. package/dist/scripts/once/fetch-ticket/fetch-ticket.js.map +0 -1
  74. package/dist/scripts/once/git-token/git-token.d.ts +0 -13
  75. package/dist/scripts/once/git-token/git-token.d.ts.map +0 -1
  76. package/dist/scripts/once/git-token/git-token.js +0 -30
  77. package/dist/scripts/once/git-token/git-token.js.map +0 -1
  78. package/dist/scripts/once/lock/lock.d.ts +0 -17
  79. package/dist/scripts/once/lock/lock.d.ts.map +0 -1
  80. package/dist/scripts/once/lock/lock.js +0 -70
  81. package/dist/scripts/once/lock/lock.js.map +0 -1
  82. package/dist/scripts/once/once.d.ts +0 -12
  83. package/dist/scripts/once/once.d.ts.map +0 -1
  84. package/dist/scripts/once/once.js +0 -452
  85. package/dist/scripts/once/once.js.map +0 -1
  86. package/dist/scripts/once/pr-creation/pr-creation.d.ts +0 -11
  87. package/dist/scripts/once/pr-creation/pr-creation.d.ts.map +0 -1
  88. package/dist/scripts/once/pr-creation/pr-creation.js +0 -50
  89. package/dist/scripts/once/pr-creation/pr-creation.js.map +0 -1
  90. package/dist/scripts/once/resume/resume.d.ts +0 -24
  91. package/dist/scripts/once/resume/resume.d.ts.map +0 -1
  92. package/dist/scripts/once/resume/resume.js +0 -159
  93. package/dist/scripts/once/resume/resume.js.map +0 -1
  94. package/dist/scripts/once/rework/rework.d.ts +0 -32
  95. package/dist/scripts/once/rework/rework.d.ts.map +0 -1
  96. package/dist/scripts/once/rework/rework.js +0 -208
  97. package/dist/scripts/once/rework/rework.js.map +0 -1
  98. package/dist/scripts/once/types/types.d.ts +0 -13
  99. package/dist/scripts/once/types/types.d.ts.map +0 -1
  100. package/dist/scripts/once/types/types.js +0 -2
  101. package/dist/scripts/once/types/types.js.map +0 -1
  102. package/dist/scripts/shared/branch/branch.d.ts +0 -50
  103. package/dist/scripts/shared/branch/branch.d.ts.map +0 -1
  104. package/dist/scripts/shared/branch/branch.js +0 -61
  105. package/dist/scripts/shared/branch/branch.js.map +0 -1
  106. package/dist/scripts/shared/claude-cli/claude-cli.d.ts +0 -31
  107. package/dist/scripts/shared/claude-cli/claude-cli.d.ts.map +0 -1
  108. package/dist/scripts/shared/claude-cli/claude-cli.js +0 -60
  109. package/dist/scripts/shared/claude-cli/claude-cli.js.map +0 -1
  110. package/dist/scripts/shared/env-schema/env-schema.d.ts +0 -27
  111. package/dist/scripts/shared/env-schema/env-schema.d.ts.map +0 -1
  112. package/dist/scripts/shared/env-schema/env-schema.js +0 -47
  113. package/dist/scripts/shared/env-schema/env-schema.js.map +0 -1
  114. package/dist/scripts/shared/feasibility/feasibility.d.ts +0 -30
  115. package/dist/scripts/shared/feasibility/feasibility.d.ts.map +0 -1
  116. package/dist/scripts/shared/feasibility/feasibility.js +0 -68
  117. package/dist/scripts/shared/feasibility/feasibility.js.map +0 -1
  118. package/dist/scripts/shared/format/format.d.ts +0 -11
  119. package/dist/scripts/shared/format/format.d.ts.map +0 -1
  120. package/dist/scripts/shared/format/format.js +0 -23
  121. package/dist/scripts/shared/format/format.js.map +0 -1
  122. package/dist/scripts/shared/git-ops/git-ops.d.ts +0 -90
  123. package/dist/scripts/shared/git-ops/git-ops.d.ts.map +0 -1
  124. package/dist/scripts/shared/git-ops/git-ops.js +0 -190
  125. package/dist/scripts/shared/git-ops/git-ops.js.map +0 -1
  126. package/dist/scripts/shared/http/http.d.ts +0 -54
  127. package/dist/scripts/shared/http/http.d.ts.map +0 -1
  128. package/dist/scripts/shared/http/http.js +0 -76
  129. package/dist/scripts/shared/http/http.js.map +0 -1
  130. package/dist/scripts/shared/notify/notify.d.ts +0 -46
  131. package/dist/scripts/shared/notify/notify.d.ts.map +0 -1
  132. package/dist/scripts/shared/notify/notify.js +0 -88
  133. package/dist/scripts/shared/notify/notify.js.map +0 -1
  134. package/dist/scripts/shared/preflight/preflight.d.ts +0 -40
  135. package/dist/scripts/shared/preflight/preflight.d.ts.map +0 -1
  136. package/dist/scripts/shared/preflight/preflight.js +0 -96
  137. package/dist/scripts/shared/preflight/preflight.js.map +0 -1
  138. package/dist/scripts/shared/progress/progress.d.ts +0 -88
  139. package/dist/scripts/shared/progress/progress.d.ts.map +0 -1
  140. package/dist/scripts/shared/progress/progress.js +0 -210
  141. package/dist/scripts/shared/progress/progress.js.map +0 -1
  142. package/dist/scripts/shared/prompt/prompt.d.ts +0 -58
  143. package/dist/scripts/shared/prompt/prompt.d.ts.map +0 -1
  144. package/dist/scripts/shared/prompt/prompt.js +0 -123
  145. package/dist/scripts/shared/prompt/prompt.js.map +0 -1
  146. package/dist/scripts/shared/pull-request/bitbucket/bitbucket.d.ts +0 -82
  147. package/dist/scripts/shared/pull-request/bitbucket/bitbucket.d.ts.map +0 -1
  148. package/dist/scripts/shared/pull-request/bitbucket/bitbucket.js +0 -301
  149. package/dist/scripts/shared/pull-request/bitbucket/bitbucket.js.map +0 -1
  150. package/dist/scripts/shared/pull-request/github/github.d.ts +0 -72
  151. package/dist/scripts/shared/pull-request/github/github.d.ts.map +0 -1
  152. package/dist/scripts/shared/pull-request/github/github.js +0 -226
  153. package/dist/scripts/shared/pull-request/github/github.js.map +0 -1
  154. package/dist/scripts/shared/pull-request/gitlab/gitlab.d.ts +0 -74
  155. package/dist/scripts/shared/pull-request/gitlab/gitlab.d.ts.map +0 -1
  156. package/dist/scripts/shared/pull-request/gitlab/gitlab.js +0 -220
  157. package/dist/scripts/shared/pull-request/gitlab/gitlab.js.map +0 -1
  158. package/dist/scripts/shared/pull-request/post-pr/post-pr.d.ts +0 -31
  159. package/dist/scripts/shared/pull-request/post-pr/post-pr.d.ts.map +0 -1
  160. package/dist/scripts/shared/pull-request/post-pr/post-pr.js +0 -61
  161. package/dist/scripts/shared/pull-request/post-pr/post-pr.js.map +0 -1
  162. package/dist/scripts/shared/pull-request/pr-body/pr-body.d.ts +0 -41
  163. package/dist/scripts/shared/pull-request/pr-body/pr-body.d.ts.map +0 -1
  164. package/dist/scripts/shared/pull-request/pr-body/pr-body.js +0 -93
  165. package/dist/scripts/shared/pull-request/pr-body/pr-body.js.map +0 -1
  166. package/dist/scripts/shared/pull-request/rework-comment/rework-comment.d.ts +0 -23
  167. package/dist/scripts/shared/pull-request/rework-comment/rework-comment.d.ts.map +0 -1
  168. package/dist/scripts/shared/pull-request/rework-comment/rework-comment.js +0 -30
  169. package/dist/scripts/shared/pull-request/rework-comment/rework-comment.js.map +0 -1
  170. package/dist/scripts/shared/remote/remote.d.ts +0 -41
  171. package/dist/scripts/shared/remote/remote.d.ts.map +0 -1
  172. package/dist/scripts/shared/remote/remote.js +0 -227
  173. package/dist/scripts/shared/remote/remote.js.map +0 -1
  174. package/dist/types/board.d.ts +0 -13
  175. package/dist/types/board.d.ts.map +0 -1
  176. package/dist/types/board.js +0 -5
  177. package/dist/types/board.js.map +0 -1
  178. package/dist/types/index.d.ts +0 -4
  179. package/dist/types/index.d.ts.map +0 -1
  180. package/dist/types/index.js +0 -2
  181. package/dist/types/index.js.map +0 -1
  182. package/dist/types/remote.d.ts +0 -55
  183. package/dist/types/remote.d.ts.map +0 -1
  184. package/dist/types/remote.js +0 -5
  185. package/dist/types/remote.js.map +0 -1
  186. package/dist/utils/parse-json/parse-json.d.ts +0 -20
  187. package/dist/utils/parse-json/parse-json.d.ts.map +0 -1
  188. package/dist/utils/parse-json/parse-json.js +0 -27
  189. package/dist/utils/parse-json/parse-json.js.map +0 -1
@@ -1,72 +0,0 @@
1
- import type { PrCreationResult, PrReviewState } from '../../../../types/index.js';
2
- /**
3
- * Check the review state of an open PR for a given branch.
4
- *
5
- * Finds the open PR matching the branch, fetches inline and conversation
6
- * comments. Any inline comment (left on a specific line) triggers rework.
7
- * Conversation comments only trigger rework when prefixed with `Rework:`.
8
- *
9
- * @param token - The GitHub personal access token.
10
- * @param repo - The repository in `owner/repo` format.
11
- * @param branch - The source branch name.
12
- * @param owner - The repository owner (used for `head` filter).
13
- * @param apiBase - The API base URL (defaults to `https://api.github.com`).
14
- * @param since - ISO 8601 timestamp; only comments created after this time trigger rework.
15
- * @returns The review state, or `undefined` if no open PR or on error.
16
- */
17
- export declare function checkPrReviewState(token: string, repo: string, branch: string, owner: string, apiBase?: string, since?: string, excludeAuthor?: string): Promise<PrReviewState | undefined>;
18
- /**
19
- * Fetch feedback comments (inline + conversation) for a PR.
20
- *
21
- * Inline comments (left on specific lines) are always included — they
22
- * inherently represent change requests. Conversation comments are only
23
- * included when they start with `Rework:` (case-insensitive), with the
24
- * prefix stripped. Inline comments are prefixed with `[path]` when a
25
- * file path is available.
26
- *
27
- * @param token - The GitHub personal access token.
28
- * @param repo - The repository in `owner/repo` format.
29
- * @param prNumber - The PR number.
30
- * @param apiBase - The API base URL (defaults to `https://api.github.com`).
31
- * @param since - ISO 8601 timestamp; only comments created after this time are returned.
32
- * @returns An array of feedback descriptions, or `[]` on error.
33
- */
34
- export declare function fetchPrReviewComments(token: string, repo: string, prNumber: number, apiBase?: string, since?: string, excludeAuthor?: string): Promise<string[]>;
35
- /**
36
- * Post a comment on a GitHub PR/issue.
37
- *
38
- * Best-effort — never throws. Returns `true` on success, `false` on error.
39
- *
40
- * @param token - The GitHub personal access token.
41
- * @param repo - The repository in `owner/repo` format.
42
- * @param prNumber - The PR (issue) number.
43
- * @param body - The comment body (markdown).
44
- * @param apiBase - The API base URL (defaults to `https://api.github.com`).
45
- */
46
- export declare function postPrComment(token: string, repo: string, prNumber: number, body: string, apiBase?: string): Promise<boolean>;
47
- /**
48
- * Re-request review from specified reviewers on a GitHub PR.
49
- *
50
- * Best-effort — never throws. Returns `true` on success, `false` on error.
51
- *
52
- * @param token - The GitHub personal access token.
53
- * @param repo - The repository in `owner/repo` format.
54
- * @param prNumber - The PR number.
55
- * @param reviewers - Array of GitHub usernames to request review from.
56
- * @param apiBase - The API base URL (defaults to `https://api.github.com`).
57
- */
58
- export declare function requestReview(token: string, repo: string, prNumber: number, reviewers: string[], apiBase?: string): Promise<boolean>;
59
- /**
60
- * Create a pull request on GitHub.
61
- *
62
- * @param token - The GitHub personal access token.
63
- * @param repo - The repository in `owner/repo` format.
64
- * @param head - The source branch name.
65
- * @param base - The target branch name.
66
- * @param title - The PR title.
67
- * @param body - The PR body (markdown).
68
- * @param apiBase - The API base URL (defaults to `https://api.github.com`).
69
- * @returns A result with the PR URL and number on success, or an error message.
70
- */
71
- export declare function createPullRequest(token: string, repo: string, head: string, base: string, title: string, body: string, apiBase?: string): Promise<PrCreationResult>;
72
- //# sourceMappingURL=github.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"github.d.ts","sourceRoot":"","sources":["../../../../../src/scripts/shared/pull-request/github/github.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAQxE;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,kBAAkB,CACtC,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,OAAO,SAAa,EACpB,KAAK,CAAC,EAAE,MAAM,EACd,aAAa,CAAC,EAAE,MAAM,GACrB,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC,CAyFpC;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,qBAAqB,CACzC,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,OAAO,SAAa,EACpB,KAAK,CAAC,EAAE,MAAM,EACd,aAAa,CAAC,EAAE,MAAM,GACrB,OAAO,CAAC,MAAM,EAAE,CAAC,CAkDnB;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,aAAa,CACjC,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,OAAO,SAAa,GACnB,OAAO,CAAC,OAAO,CAAC,CAiBlB;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,aAAa,CACjC,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EAAE,EACnB,OAAO,SAAa,GACnB,OAAO,CAAC,OAAO,CAAC,CAiBlB;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,iBAAiB,CACrC,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,OAAO,SAAa,GACnB,OAAO,CAAC,gBAAgB,CAAC,CAW3B"}
@@ -1,226 +0,0 @@
1
- /**
2
- * GitHub pull request creation and review state checking.
3
- *
4
- * Uses the GitHub REST API to create pull requests, check review state,
5
- * and fetch review comments.
6
- * Supports both github.com and GitHub Enterprise (GHE).
7
- *
8
- * Auth: `Authorization: Bearer` header (personal access token with `repo` scope).
9
- */
10
- import { githubCommentsResponseSchema, githubPrCommentsSchema, githubPrListSchema, githubReviewListSchema, } from '../../../../schemas/github-issues.js';
11
- import { GITHUB_API, githubHeaders } from '../../../../scripts/shared/http/http.js';
12
- import { postPullRequest } from '../post-pr/post-pr.js';
13
- import { extractReworkContent, isReworkComment, } from '../rework-comment/rework-comment.js';
14
- /**
15
- * Check the review state of an open PR for a given branch.
16
- *
17
- * Finds the open PR matching the branch, fetches inline and conversation
18
- * comments. Any inline comment (left on a specific line) triggers rework.
19
- * Conversation comments only trigger rework when prefixed with `Rework:`.
20
- *
21
- * @param token - The GitHub personal access token.
22
- * @param repo - The repository in `owner/repo` format.
23
- * @param branch - The source branch name.
24
- * @param owner - The repository owner (used for `head` filter).
25
- * @param apiBase - The API base URL (defaults to `https://api.github.com`).
26
- * @param since - ISO 8601 timestamp; only comments created after this time trigger rework.
27
- * @returns The review state, or `undefined` if no open PR or on error.
28
- */
29
- export async function checkPrReviewState(token, repo, branch, owner, apiBase = GITHUB_API, since, excludeAuthor) {
30
- try {
31
- const headers = githubHeaders(token);
32
- const prRes = await fetch(`${apiBase}/repos/${repo}/pulls?head=${owner}:${branch}&state=open`, { headers });
33
- if (!prRes.ok)
34
- return undefined;
35
- const prs = githubPrListSchema.parse(await prRes.json());
36
- if (prs.length === 0)
37
- return undefined;
38
- const pr = prs[0];
39
- const sinceParam = since ? `&since=${since}` : '';
40
- const [inlineRes, convoRes] = await Promise.all([
41
- fetch(`${apiBase}/repos/${repo}/pulls/${pr.number}/comments?per_page=100${sinceParam}`, {
42
- headers,
43
- }),
44
- fetch(`${apiBase}/repos/${repo}/issues/${pr.number}/comments?per_page=100${sinceParam}`, {
45
- headers,
46
- }),
47
- ]);
48
- if (!inlineRes.ok || !convoRes.ok)
49
- return undefined;
50
- const rawInline = githubPrCommentsSchema.parse(await inlineRes.json());
51
- const rawConvo = githubCommentsResponseSchema.parse(await convoRes.json());
52
- const inlineComments = excludeAuthor
53
- ? rawInline.filter((c) => c.user?.login !== excludeAuthor)
54
- : rawInline;
55
- const convoComments = excludeAuthor
56
- ? rawConvo.filter((c) => c.user?.login !== excludeAuthor)
57
- : rawConvo;
58
- const hasInlineComments = inlineComments.length > 0;
59
- const hasReworkConvo = convoComments.some((c) => c.body && isReworkComment(c.body));
60
- let changesRequested = hasInlineComments || hasReworkConvo;
61
- let reviewers;
62
- // Additional signal: GitHub "Request Changes" review state
63
- if (!changesRequested) {
64
- try {
65
- const reviewsRes = await fetch(`${apiBase}/repos/${repo}/pulls/${pr.number}/reviews?per_page=100`, { headers });
66
- if (reviewsRes.ok) {
67
- const reviews = githubReviewListSchema.parse(await reviewsRes.json());
68
- // Deduplicate by user — keep latest per user
69
- const latestByUser = new Map();
70
- for (const review of reviews) {
71
- if (review.state === 'PENDING' || review.state === 'DISMISSED')
72
- continue;
73
- latestByUser.set(review.user.login, review.state);
74
- }
75
- // Check if any reviewer's latest state is CHANGES_REQUESTED
76
- const requestedChanges = [...latestByUser.entries()].filter(([, s]) => s === 'CHANGES_REQUESTED');
77
- if (requestedChanges.length > 0) {
78
- changesRequested = true;
79
- reviewers = requestedChanges.map(([login]) => login);
80
- }
81
- }
82
- }
83
- catch {
84
- // Best-effort — if review fetch fails, rely on comment detection only
85
- }
86
- }
87
- return {
88
- changesRequested,
89
- prNumber: pr.number,
90
- prUrl: pr.html_url,
91
- reviewers,
92
- };
93
- }
94
- catch {
95
- return undefined;
96
- }
97
- }
98
- /**
99
- * Fetch feedback comments (inline + conversation) for a PR.
100
- *
101
- * Inline comments (left on specific lines) are always included — they
102
- * inherently represent change requests. Conversation comments are only
103
- * included when they start with `Rework:` (case-insensitive), with the
104
- * prefix stripped. Inline comments are prefixed with `[path]` when a
105
- * file path is available.
106
- *
107
- * @param token - The GitHub personal access token.
108
- * @param repo - The repository in `owner/repo` format.
109
- * @param prNumber - The PR number.
110
- * @param apiBase - The API base URL (defaults to `https://api.github.com`).
111
- * @param since - ISO 8601 timestamp; only comments created after this time are returned.
112
- * @returns An array of feedback descriptions, or `[]` on error.
113
- */
114
- export async function fetchPrReviewComments(token, repo, prNumber, apiBase = GITHUB_API, since, excludeAuthor) {
115
- try {
116
- const headers = githubHeaders(token);
117
- const sinceParam = since ? `&since=${since}` : '';
118
- const [inlineRes, convoRes] = await Promise.all([
119
- fetch(`${apiBase}/repos/${repo}/pulls/${prNumber}/comments?per_page=100${sinceParam}`, {
120
- headers,
121
- }),
122
- fetch(`${apiBase}/repos/${repo}/issues/${prNumber}/comments?per_page=100${sinceParam}`, {
123
- headers,
124
- }),
125
- ]);
126
- if (!inlineRes.ok || !convoRes.ok)
127
- return [];
128
- const rawInline = githubPrCommentsSchema.parse(await inlineRes.json());
129
- const rawConvo = githubCommentsResponseSchema.parse(await convoRes.json());
130
- const inlineComments = excludeAuthor
131
- ? rawInline.filter((c) => c.user?.login !== excludeAuthor)
132
- : rawInline;
133
- const convoComments = excludeAuthor
134
- ? rawConvo.filter((c) => c.user?.login !== excludeAuthor)
135
- : rawConvo;
136
- const combined = [];
137
- for (const c of inlineComments) {
138
- if (!c.body)
139
- continue;
140
- const prefix = c.path ? `[${c.path}] ` : '';
141
- combined.push(`${prefix}${c.body}`);
142
- }
143
- for (const c of convoComments) {
144
- if (c.body && isReworkComment(c.body)) {
145
- combined.push(extractReworkContent(c.body));
146
- }
147
- }
148
- return combined;
149
- }
150
- catch {
151
- return [];
152
- }
153
- }
154
- /**
155
- * Post a comment on a GitHub PR/issue.
156
- *
157
- * Best-effort — never throws. Returns `true` on success, `false` on error.
158
- *
159
- * @param token - The GitHub personal access token.
160
- * @param repo - The repository in `owner/repo` format.
161
- * @param prNumber - The PR (issue) number.
162
- * @param body - The comment body (markdown).
163
- * @param apiBase - The API base URL (defaults to `https://api.github.com`).
164
- */
165
- export async function postPrComment(token, repo, prNumber, body, apiBase = GITHUB_API) {
166
- try {
167
- const res = await fetch(`${apiBase}/repos/${repo}/issues/${prNumber}/comments`, {
168
- method: 'POST',
169
- headers: {
170
- ...githubHeaders(token),
171
- 'Content-Type': 'application/json',
172
- },
173
- body: JSON.stringify({ body }),
174
- });
175
- return res.ok;
176
- }
177
- catch {
178
- return false;
179
- }
180
- }
181
- /**
182
- * Re-request review from specified reviewers on a GitHub PR.
183
- *
184
- * Best-effort — never throws. Returns `true` on success, `false` on error.
185
- *
186
- * @param token - The GitHub personal access token.
187
- * @param repo - The repository in `owner/repo` format.
188
- * @param prNumber - The PR number.
189
- * @param reviewers - Array of GitHub usernames to request review from.
190
- * @param apiBase - The API base URL (defaults to `https://api.github.com`).
191
- */
192
- export async function requestReview(token, repo, prNumber, reviewers, apiBase = GITHUB_API) {
193
- try {
194
- const res = await fetch(`${apiBase}/repos/${repo}/pulls/${prNumber}/requested_reviewers`, {
195
- method: 'POST',
196
- headers: {
197
- ...githubHeaders(token),
198
- 'Content-Type': 'application/json',
199
- },
200
- body: JSON.stringify({ reviewers }),
201
- });
202
- return res.ok;
203
- }
204
- catch {
205
- return false;
206
- }
207
- }
208
- /**
209
- * Create a pull request on GitHub.
210
- *
211
- * @param token - The GitHub personal access token.
212
- * @param repo - The repository in `owner/repo` format.
213
- * @param head - The source branch name.
214
- * @param base - The target branch name.
215
- * @param title - The PR title.
216
- * @param body - The PR body (markdown).
217
- * @param apiBase - The API base URL (defaults to `https://api.github.com`).
218
- * @returns A result with the PR URL and number on success, or an error message.
219
- */
220
- export async function createPullRequest(token, repo, head, base, title, body, apiBase = GITHUB_API) {
221
- return postPullRequest(`${apiBase}/repos/${repo}/pulls`, githubHeaders(token), { title, head, base, body }, (json) => {
222
- const data = json;
223
- return { url: data.html_url ?? '', number: data.number ?? 0 };
224
- }, (status, text) => status === 422 && text.includes('already exists'));
225
- }
226
- //# sourceMappingURL=github.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"github.js","sourceRoot":"","sources":["../../../../../src/scripts/shared/pull-request/github/github.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EACL,4BAA4B,EAC5B,sBAAsB,EACtB,kBAAkB,EAClB,sBAAsB,GACvB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAG1E,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EACL,oBAAoB,EACpB,eAAe,GAChB,MAAM,qCAAqC,CAAC;AAE7C;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,KAAa,EACb,IAAY,EACZ,MAAc,EACd,KAAa,EACb,OAAO,GAAG,UAAU,EACpB,KAAc,EACd,aAAsB;IAEtB,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;QAErC,MAAM,KAAK,GAAG,MAAM,KAAK,CACvB,GAAG,OAAO,UAAU,IAAI,eAAe,KAAK,IAAI,MAAM,aAAa,EACnE,EAAE,OAAO,EAAE,CACZ,CAAC;QACF,IAAI,CAAC,KAAK,CAAC,EAAE;YAAE,OAAO,SAAS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QAAQ,EAChC,aAAa,CAAC,KAAK,CAAC,EACpB,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,EAC3B,CAAC,IAAI,EAAE,EAAE;QACP,MAAM,IAAI,GAAG,IAA8C,CAAC;QAC5D,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC,QAAQ,IAAI,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC;IAChE,CAAC,EACD,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,MAAM,KAAK,GAAG,IAAI,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CACpE,CAAC;AACJ,CAAC"}
@@ -1,74 +0,0 @@
1
- import type { PrCreationResult, PrReviewState } from '../../../../types/index.js';
2
- /**
3
- * Create a merge request on GitLab.
4
- *
5
- * @param token - The GitLab personal access token.
6
- * @param apiBase - The API base URL (e.g. `https://gitlab.com/api/v4`).
7
- * @param projectPath - The raw project path (e.g. `group/subgroup/project`). URL-encoded internally.
8
- * @param sourceBranch - The source branch name.
9
- * @param targetBranch - The target branch name.
10
- * @param title - The MR title.
11
- * @param description - The MR body (markdown).
12
- * @returns A result with the MR URL and IID on success, or an error message.
13
- */
14
- export declare function createMergeRequest(token: string, apiBase: string, projectPath: string, sourceBranch: string, targetBranch: string, title: string, description: string): Promise<PrCreationResult>;
15
- /**
16
- * Post a note (comment) on a GitLab merge request.
17
- *
18
- * Best-effort — never throws. Returns `true` on success, `false` on error.
19
- *
20
- * @param token - The GitLab personal access token.
21
- * @param apiBase - The API base URL (e.g. `https://gitlab.com/api/v4`).
22
- * @param projectPath - The raw project path. URL-encoded internally.
23
- * @param mrIid - The MR internal ID (iid).
24
- * @param body - The note body (markdown).
25
- */
26
- export declare function postMrNote(token: string, apiBase: string, projectPath: string, mrIid: number, body: string): Promise<boolean>;
27
- /**
28
- * Resolve MR discussion threads on GitLab.
29
- *
30
- * Best-effort per discussion — failures are silently skipped.
31
- * Returns the number of successfully resolved discussions.
32
- *
33
- * @param token - The GitLab personal access token.
34
- * @param apiBase - The API base URL (e.g. `https://gitlab.com/api/v4`).
35
- * @param projectPath - The raw project path. URL-encoded internally.
36
- * @param mrIid - The MR internal ID (iid).
37
- * @param discussionIds - Array of discussion IDs to resolve.
38
- */
39
- export declare function resolveDiscussions(token: string, apiBase: string, projectPath: string, mrIid: number, discussionIds: string[]): Promise<number>;
40
- /**
41
- * Check the review state of an open MR for a given branch.
42
- *
43
- * Finds the open MR matching the source branch, fetches all discussions.
44
- * Inline notes (type `DiffNote`) always trigger rework. General conversation
45
- * notes only trigger rework when prefixed with `Rework:`.
46
- *
47
- * @param token - The GitLab personal access token.
48
- * @param apiBase - The API base URL (e.g. `https://gitlab.com/api/v4`).
49
- * @param projectPath - The raw project path (e.g. `group/subgroup/project`). URL-encoded internally.
50
- * @param branch - The source branch to look up.
51
- * @param since - ISO 8601 timestamp; only notes created after this time trigger rework.
52
- * @returns The review state if an open MR exists, otherwise `undefined`.
53
- */
54
- export declare function checkMrReviewState(token: string, apiBase: string, projectPath: string, branch: string, since?: string): Promise<PrReviewState | undefined>;
55
- /**
56
- * Fetch feedback comments from an MR's discussions.
57
- *
58
- * Inline notes (type `DiffNote`) are always included — they inherently
59
- * represent change requests. General conversation notes are only included
60
- * when they start with `Rework:` (case-insensitive), with the prefix
61
- * stripped. Inline notes are prefixed with `[new_path]` when available.
62
- *
63
- * @param token - The GitLab personal access token.
64
- * @param apiBase - The API base URL (e.g. `https://gitlab.com/api/v4`).
65
- * @param projectPath - The raw project path. URL-encoded internally.
66
- * @param mrIid - The MR internal ID (iid).
67
- * @param since - ISO 8601 timestamp; only notes created after this time are returned.
68
- * @returns An object with feedback descriptions and discussion IDs.
69
- */
70
- export declare function fetchMrReviewComments(token: string, apiBase: string, projectPath: string, mrIid: number, since?: string): Promise<{
71
- comments: string[];
72
- discussionIds: string[];
73
- }>;
74
- //# sourceMappingURL=gitlab.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"gitlab.d.ts","sourceRoot":"","sources":["../../../../../src/scripts/shared/pull-request/gitlab/gitlab.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAQxE;;;;;;;;;;;GAWG;AACH,wBAAsB,kBAAkB,CACtC,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,MAAM,EACpB,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,gBAAgB,CAAC,CAmB3B;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,UAAU,CAC9B,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,OAAO,CAAC,CAelB;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,kBAAkB,CACtC,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,MAAM,EACb,aAAa,EAAE,MAAM,EAAE,GACtB,OAAO,CAAC,MAAM,CAAC,CAwBjB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,kBAAkB,CACtC,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,MAAM,EACd,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC,CAyDpC;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,qBAAqB,CACzC,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,MAAM,EACb,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;IAAC,aAAa,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CA+C1D"}
@@ -1,220 +0,0 @@
1
- /**
2
- * GitLab merge request creation and review state checking.
3
- *
4
- * Uses the GitLab REST API v4 to create merge requests, check review state,
5
- * and fetch review comments.
6
- * Supports both gitlab.com and self-hosted instances.
7
- *
8
- * Auth: `PRIVATE-TOKEN` header (personal access token with `api` scope).
9
- */
10
- import { gitlabDiscussionsSchema, gitlabMrListSchema, } from '../../../../schemas/gitlab-mr.js';
11
- import { postPullRequest } from '../post-pr/post-pr.js';
12
- import { extractReworkContent, isReworkComment, } from '../rework-comment/rework-comment.js';
13
- /**
14
- * Create a merge request on GitLab.
15
- *
16
- * @param token - The GitLab personal access token.
17
- * @param apiBase - The API base URL (e.g. `https://gitlab.com/api/v4`).
18
- * @param projectPath - The raw project path (e.g. `group/subgroup/project`). URL-encoded internally.
19
- * @param sourceBranch - The source branch name.
20
- * @param targetBranch - The target branch name.
21
- * @param title - The MR title.
22
- * @param description - The MR body (markdown).
23
- * @returns A result with the MR URL and IID on success, or an error message.
24
- */
25
- export async function createMergeRequest(token, apiBase, projectPath, sourceBranch, targetBranch, title, description) {
26
- const encodedPath = encodeURIComponent(projectPath);
27
- return postPullRequest(`${apiBase}/projects/${encodedPath}/merge_requests`, { 'PRIVATE-TOKEN': token }, {
28
- source_branch: sourceBranch,
29
- target_branch: targetBranch,
30
- title,
31
- description,
32
- remove_source_branch: true,
33
- }, (json) => {
34
- const data = json;
35
- return { url: data.web_url ?? '', number: data.iid ?? 0 };
36
- }, (status, text) => status === 409 && text.includes('already exists'));
37
- }
38
- /**
39
- * Post a note (comment) on a GitLab merge request.
40
- *
41
- * Best-effort — never throws. Returns `true` on success, `false` on error.
42
- *
43
- * @param token - The GitLab personal access token.
44
- * @param apiBase - The API base URL (e.g. `https://gitlab.com/api/v4`).
45
- * @param projectPath - The raw project path. URL-encoded internally.
46
- * @param mrIid - The MR internal ID (iid).
47
- * @param body - The note body (markdown).
48
- */
49
- export async function postMrNote(token, apiBase, projectPath, mrIid, body) {
50
- try {
51
- const encoded = encodeURIComponent(projectPath);
52
- const res = await fetch(`${apiBase}/projects/${encoded}/merge_requests/${mrIid}/notes`, {
53
- method: 'POST',
54
- headers: { 'PRIVATE-TOKEN': token, 'Content-Type': 'application/json' },
55
- body: JSON.stringify({ body }),
56
- });
57
- return res.ok;
58
- }
59
- catch {
60
- return false;
61
- }
62
- }
63
- /**
64
- * Resolve MR discussion threads on GitLab.
65
- *
66
- * Best-effort per discussion — failures are silently skipped.
67
- * Returns the number of successfully resolved discussions.
68
- *
69
- * @param token - The GitLab personal access token.
70
- * @param apiBase - The API base URL (e.g. `https://gitlab.com/api/v4`).
71
- * @param projectPath - The raw project path. URL-encoded internally.
72
- * @param mrIid - The MR internal ID (iid).
73
- * @param discussionIds - Array of discussion IDs to resolve.
74
- */
75
- export async function resolveDiscussions(token, apiBase, projectPath, mrIid, discussionIds) {
76
- const encoded = encodeURIComponent(projectPath);
77
- let resolved = 0;
78
- for (const id of discussionIds) {
79
- try {
80
- const res = await fetch(`${apiBase}/projects/${encoded}/merge_requests/${mrIid}/discussions/${id}`, {
81
- method: 'PUT',
82
- headers: {
83
- 'PRIVATE-TOKEN': token,
84
- 'Content-Type': 'application/json',
85
- },
86
- body: JSON.stringify({ resolved: true }),
87
- });
88
- if (res.ok)
89
- resolved++;
90
- }
91
- catch {
92
- // Best-effort per discussion
93
- }
94
- }
95
- return resolved;
96
- }
97
- /**
98
- * Check the review state of an open MR for a given branch.
99
- *
100
- * Finds the open MR matching the source branch, fetches all discussions.
101
- * Inline notes (type `DiffNote`) always trigger rework. General conversation
102
- * notes only trigger rework when prefixed with `Rework:`.
103
- *
104
- * @param token - The GitLab personal access token.
105
- * @param apiBase - The API base URL (e.g. `https://gitlab.com/api/v4`).
106
- * @param projectPath - The raw project path (e.g. `group/subgroup/project`). URL-encoded internally.
107
- * @param branch - The source branch to look up.
108
- * @param since - ISO 8601 timestamp; only notes created after this time trigger rework.
109
- * @returns The review state if an open MR exists, otherwise `undefined`.
110
- */
111
- export async function checkMrReviewState(token, apiBase, projectPath, branch, since) {
112
- try {
113
- const encodedPath = encodeURIComponent(projectPath);
114
- const mrUrl = `${apiBase}/projects/${encodedPath}/merge_requests?source_branch=${branch}&state=opened`;
115
- const mrRes = await fetch(mrUrl, {
116
- headers: { 'PRIVATE-TOKEN': token },
117
- });
118
- if (!mrRes.ok)
119
- return undefined;
120
- const data = gitlabMrListSchema.parse(await mrRes.json());
121
- if (data.length === 0)
122
- return undefined;
123
- const mr = data[0];
124
- const discussionsUrl = `${apiBase}/projects/${encodedPath}/merge_requests/${mr.iid}/discussions?per_page=100`;
125
- const discussionsRes = await fetch(discussionsUrl, {
126
- headers: { 'PRIVATE-TOKEN': token },
127
- });
128
- if (!discussionsRes.ok)
129
- return undefined;
130
- const discussions = gitlabDiscussionsSchema.parse(await discussionsRes.json());
131
- let hasRework = false;
132
- for (const discussion of discussions) {
133
- for (const note of discussion.notes) {
134
- if (note.system)
135
- continue;
136
- if (since && note.created_at && note.created_at <= since)
137
- continue;
138
- if (note.type === 'DiffNote' &&
139
- note.resolvable !== false &&
140
- note.resolved !== true) {
141
- hasRework = true;
142
- break;
143
- }
144
- if (isReworkComment(note.body)) {
145
- hasRework = true;
146
- break;
147
- }
148
- }
149
- if (hasRework)
150
- break;
151
- }
152
- return {
153
- changesRequested: hasRework,
154
- prNumber: mr.iid,
155
- prUrl: mr.web_url,
156
- };
157
- }
158
- catch {
159
- return undefined;
160
- }
161
- }
162
- /**
163
- * Fetch feedback comments from an MR's discussions.
164
- *
165
- * Inline notes (type `DiffNote`) are always included — they inherently
166
- * represent change requests. General conversation notes are only included
167
- * when they start with `Rework:` (case-insensitive), with the prefix
168
- * stripped. Inline notes are prefixed with `[new_path]` when available.
169
- *
170
- * @param token - The GitLab personal access token.
171
- * @param apiBase - The API base URL (e.g. `https://gitlab.com/api/v4`).
172
- * @param projectPath - The raw project path. URL-encoded internally.
173
- * @param mrIid - The MR internal ID (iid).
174
- * @param since - ISO 8601 timestamp; only notes created after this time are returned.
175
- * @returns An object with feedback descriptions and discussion IDs.
176
- */
177
- export async function fetchMrReviewComments(token, apiBase, projectPath, mrIid, since) {
178
- try {
179
- const encodedPath = encodeURIComponent(projectPath);
180
- const url = `${apiBase}/projects/${encodedPath}/merge_requests/${mrIid}/discussions?per_page=100`;
181
- const res = await fetch(url, {
182
- headers: { 'PRIVATE-TOKEN': token },
183
- });
184
- if (!res.ok)
185
- return { comments: [], discussionIds: [] };
186
- const discussions = gitlabDiscussionsSchema.parse(await res.json());
187
- const comments = [];
188
- const discussionIds = [];
189
- for (const discussion of discussions) {
190
- let discussionHasFeedback = false;
191
- for (const note of discussion.notes) {
192
- if (note.system)
193
- continue;
194
- if (since && note.created_at && note.created_at <= since)
195
- continue;
196
- if (note.type === 'DiffNote' &&
197
- note.resolvable !== false &&
198
- note.resolved !== true) {
199
- const prefix = note.position?.new_path
200
- ? `[${note.position.new_path}] `
201
- : '';
202
- comments.push(`${prefix}${note.body}`);
203
- discussionHasFeedback = true;
204
- }
205
- else if (isReworkComment(note.body)) {
206
- comments.push(extractReworkContent(note.body));
207
- discussionHasFeedback = true;
208
- }
209
- }
210
- if (discussionHasFeedback && discussion.id) {
211
- discussionIds.push(discussion.id);
212
- }
213
- }
214
- return { comments, discussionIds };
215
- }
216
- catch {
217
- return { comments: [], discussionIds: [] };
218
- }
219
- }
220
- //# sourceMappingURL=gitlab.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"gitlab.js","sourceRoot":"","sources":["../../../../../src/scripts/shared/pull-request/gitlab/gitlab.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EACL,uBAAuB,EACvB,kBAAkB,GACnB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EACL,oBAAoB,EACpB,eAAe,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E,IACE,IAAI,CAAC,IAAI,KAAK,UAAU;oBACxB,IAAI,CAAC,UAAU,KAAK,KAAK;oBACzB,IAAI,CAAC,QAAQ,KAAK,IAAI,EACtB,CAAC;oBACD,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,EAAE,QAAQ;wBACpC,CAAC,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,IAAI;wBAChC,CAAC,CAAC,EAAE,CAAC;oBACP,QAAQ,CAAC,IAAI,CAAC,GAAG,MAAM,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;oBACvC,qBAAqB,GAAG,IAAI,CAAC;gBAC/B,CAAC;qBAAM,IAAI,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;oBACtC,QAAQ,CAAC,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;oBAC/C,qBAAqB,GAAG,IAAI,CAAC;gBAC/B,CAAC;YACH,CAAC;YAED,IAAI,qBAAqB,IAAI,UAAU,CAAC,EAAE,EAAE,CAAC;gBAC3C,aAAa,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;YACpC,CAAC;QACH,CAAC;QAED,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,CAAC;IACrC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,aAAa,EAAE,EAAE,EAAE,CAAC;IAC7C,CAAC;AACH,CAAC"}
@@ -1,31 +0,0 @@
1
- /**
2
- * Shared pull request creation utility.
3
- *
4
- * Wraps the common POST + error-handling pattern used by all three
5
- * git host PR creation functions (GitHub, GitLab, Bitbucket).
6
- */
7
- import type { PrCreationResult } from '../../../../types/index.js';
8
- /**
9
- * POST a pull request / merge request and return a typed result.
10
- *
11
- * Handles the common try/catch, response parsing, error formatting,
12
- * and "already exists" detection shared by all git host implementations.
13
- *
14
- * @param url - The API endpoint to POST to.
15
- * @param headers - HTTP headers (including auth).
16
- * @param body - The request body (JSON-serialised).
17
- * @param parseSuccess - Extract `{ url, number }` from the success response JSON.
18
- * @param isAlreadyExists - Optional check for duplicate PR detection.
19
- * @returns A typed `PrCreationResult`.
20
- */
21
- export declare function postPullRequest(url: string, headers: Record<string, string>, body: Record<string, unknown>, parseSuccess: (json: unknown) => {
22
- url: string;
23
- number: number;
24
- }, isAlreadyExists?: (status: number, text: string) => boolean): Promise<PrCreationResult>;
25
- /**
26
- * Build a Basic Auth header value from username and token.
27
- *
28
- * Used by Bitbucket Cloud which requires HTTP Basic Auth.
29
- */
30
- export declare function basicAuth(username: string, token: string): string;
31
- //# sourceMappingURL=post-pr.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"post-pr.d.ts","sourceRoot":"","sources":["../../../../../src/scripts/shared/pull-request/post-pr/post-pr.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEzD;;;;;;;;;;;;GAYG;AACH,wBAAsB,eAAe,CACnC,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC/B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,EAChE,eAAe,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,GAC1D,OAAO,CAAC,gBAAgB,CAAC,CA0C3B;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAEjE"}