@aviaratech/ai-delivery 0.3.41 → 0.3.42

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 (52) hide show
  1. package/README.md +7 -1
  2. package/dist/callerErrors.test.js +11 -1
  3. package/dist/callerErrors.test.js.map +2 -2
  4. package/dist/fixtures/readView.d.ts +9 -1
  5. package/dist/fixtures/readView.js +4 -0
  6. package/dist/fixtures/readView.js.map +2 -2
  7. package/dist/issue.d.ts +0 -1
  8. package/dist/issue.js +42 -11
  9. package/dist/issue.js.map +2 -2
  10. package/dist/issueContract.d.ts +2 -0
  11. package/dist/issueContract.js +11 -9
  12. package/dist/issueContract.js.map +2 -2
  13. package/dist/issueInfoReadback.test.js +80 -7
  14. package/dist/issueInfoReadback.test.js.map +2 -2
  15. package/dist/issueIntake.test.js +30 -0
  16. package/dist/issueIntake.test.js.map +2 -2
  17. package/dist/issueJournal.js +4 -2
  18. package/dist/issueJournal.js.map +2 -2
  19. package/dist/issueJournal.test.js +22 -0
  20. package/dist/issueJournal.test.js.map +2 -2
  21. package/dist/issueTracking.test.js +4 -1
  22. package/dist/issueTracking.test.js.map +2 -2
  23. package/dist/mcp/index.js +3 -3
  24. package/dist/mcp/index.js.map +2 -2
  25. package/dist/mcp/tools.d.ts +8 -3
  26. package/dist/mcp/tools.js +134 -101
  27. package/dist/mcp/tools.js.map +2 -2
  28. package/dist/pr.d.ts +2 -0
  29. package/dist/pr.js +28 -3
  30. package/dist/pr.js.map +2 -2
  31. package/dist/pr.test.js +0 -7
  32. package/dist/pr.test.js.map +2 -2
  33. package/dist/prAssociation.test.js +82 -9
  34. package/dist/prAssociation.test.js.map +2 -2
  35. package/dist/projectNumbers.test.js +1 -1
  36. package/dist/projectNumbers.test.js.map +1 -1
  37. package/dist/readView.d.ts +31 -3
  38. package/dist/readView.js +29 -12
  39. package/dist/readView.js.map +2 -2
  40. package/dist/readView.test.js +63 -1
  41. package/dist/readView.test.js.map +2 -2
  42. package/dist/targetPolicyEntrypoints.test.js +1 -1
  43. package/dist/targetPolicyEntrypoints.test.js.map +2 -2
  44. package/dist/targetPolicyRoutes.test.js +1 -1
  45. package/dist/targetPolicyRoutes.test.js.map +2 -2
  46. package/dist/toolOutput.test.js +14 -0
  47. package/dist/toolOutput.test.js.map +2 -2
  48. package/package.json +1 -1
  49. package/plugins/ai-delivery/.claude-plugin/plugin.json +2 -2
  50. package/plugins/ai-delivery/plugin.json +1 -1
  51. package/plugins/ai-delivery/runtime/dist/cli.js +116 -116
  52. package/plugins/ai-delivery/runtime/package.json +1 -1
package/dist/mcp/tools.js CHANGED
@@ -11,7 +11,8 @@ import {
11
11
  CreateIssueStatus,
12
12
  IssueStatusPatch,
13
13
  ProjectStatusPatch,
14
- IssueDeferralPatch
14
+ IssueDeferralPatch,
15
+ acceptedKeysError
15
16
  } from "../issueContract.js";
16
17
  const Verbose = z.boolean().optional().describe("Return the full payload, including bodies, diffs and routing.");
17
18
  const Positive = z.number().int().positive();
@@ -20,31 +21,34 @@ const REPO_HELP = "GitHub owner/name. Pass the repository named by the user. An
20
21
  const Repo = z.string().regex(/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/u).optional().describe(REPO_HELP);
21
22
  const AI_DELIVERY_MCP_CONTRACT_VERSION = "ai-delivery.mcp@2";
22
23
  const IssueUpdateInput = issueInputSchema(
23
- z.strictObject({
24
- ...IssueWriteFields,
25
- ...NativeIssueDateFields,
26
- status: IssueStatusPatch.optional(),
27
- projectStatus: ProjectStatusPatch.optional(),
28
- repo: Repo,
29
- blockedBy: z.array(Positive).optional(),
30
- blocks: z.array(Positive).optional(),
31
- overrideReason: OverrideReason.optional(),
32
- body: z.string().optional(),
33
- issueNumber: Positive,
34
- issueType: IssueWriteFields.issueType,
35
- labels: Labels.optional(),
36
- milestone: Positive.nullable().optional(),
37
- parentIssueNumber: Positive.nullable().optional(),
38
- park: z.literal(true).optional(),
39
- ...IssueDeferralPatch,
40
- points: IssueWriteFields.points,
41
- priority: z.string().min(1).optional(),
42
- state: z.enum(["open", "closed"]).optional(),
43
- preserveHistory: z.boolean().optional(),
44
- closeReason: z.enum(["completed", "not_planned", "duplicate"]).optional(),
45
- supersededBy: Positive.optional(),
46
- title: IssueWriteFields.title
47
- }).superRefine((input, ctx) => {
24
+ z.strictObject(
25
+ {
26
+ ...IssueWriteFields,
27
+ ...NativeIssueDateFields,
28
+ status: IssueStatusPatch.optional(),
29
+ projectStatus: ProjectStatusPatch.optional(),
30
+ repo: Repo,
31
+ blockedBy: z.array(Positive).optional(),
32
+ blocks: z.array(Positive).optional(),
33
+ overrideReason: OverrideReason.optional(),
34
+ body: z.string().optional(),
35
+ issueNumber: Positive,
36
+ issueType: IssueWriteFields.issueType,
37
+ labels: Labels.optional(),
38
+ milestone: Positive.nullable().optional(),
39
+ parentIssueNumber: Positive.nullable().optional(),
40
+ park: z.literal(true).optional(),
41
+ ...IssueDeferralPatch,
42
+ points: IssueWriteFields.points,
43
+ priority: z.string().min(1).optional(),
44
+ state: z.enum(["open", "closed"]).optional(),
45
+ preserveHistory: z.boolean().optional(),
46
+ closeReason: z.enum(["completed", "not_planned", "duplicate"]).optional(),
47
+ supersededBy: Positive.optional(),
48
+ title: IssueWriteFields.title
49
+ },
50
+ { error: acceptedKeysError }
51
+ ).superRefine((input, ctx) => {
48
52
  if (input.defer !== void 0 && input.undefer !== void 0)
49
53
  ctx.addIssue({ code: "custom", message: "Choose defer or undefer, never both.", path: ["defer"] });
50
54
  if ((input.closeReason !== void 0 || input.supersededBy !== void 0) && input.state !== "closed")
@@ -71,15 +75,18 @@ const Tracking = {
71
75
  repo: z.string().regex(/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/u).optional().describe(REPO_HELP),
72
76
  title: z.string().trim().min(1, "Issue title is empty; enter a title.").max(256, "Issue title exceeds 256 characters; shorten the title.").describe(IssueFields.shape.title.description ?? "")
73
77
  };
74
- const NormalStart = z.strictObject({
75
- ...Tracking,
76
- title: Tracking.title.optional(),
77
- issueNumber: Positive.optional(),
78
- request: z.string().min(1).optional(),
79
- requestId: z.string().trim().min(1).max(256).optional(),
80
- resumeCreated: z.boolean().optional(),
81
- branch: z.string().min(1).optional()
82
- });
78
+ const NormalStart = z.strictObject(
79
+ {
80
+ ...Tracking,
81
+ title: Tracking.title.optional(),
82
+ issueNumber: Positive.optional(),
83
+ request: z.string().min(1).optional(),
84
+ requestId: z.string().trim().min(1).max(256).optional(),
85
+ resumeCreated: z.boolean().optional(),
86
+ branch: z.string().min(1).optional()
87
+ },
88
+ { error: acceptedKeysError }
89
+ );
83
90
  const IssueListing = {
84
91
  repo: Repo,
85
92
  verbose: Verbose,
@@ -100,7 +107,7 @@ const AI_DELIVERY_MCP_TOOLS = [
100
107
  name: "issue_comment",
101
108
  commandName: "comment",
102
109
  description: "Post a typed issue journal with authoritative comment readback. Provide the fields required by kind: start: outcome; progress: done, decisionNeeded and non-empty evidence; decision: non-empty decision and rationale; blocker: blocker and resolution; closeout: acceptance and followUps. Omit fields belonging to other kinds.",
103
- inputSchema: z.strictObject({ ...JournalInputSchema.shape, repo: Repo, verbose: Verbose }).superRefine(({ repo: _repo, verbose: _verbose, ...journal }, ctx) => {
110
+ inputSchema: z.strictObject({ ...JournalInputSchema.shape, repo: Repo, verbose: Verbose }, { error: acceptedKeysError }).superRefine(({ repo: _repo, verbose: _verbose, ...journal }, ctx) => {
104
111
  const parsed = JournalInputSchema.safeParse(journal);
105
112
  if (!parsed.success)
106
113
  for (const issue of parsed.error.issues)
@@ -113,16 +120,19 @@ const AI_DELIVERY_MCP_TOOLS = [
113
120
  description: "Create a native GitHub tracking issue with configured metadata and relationships",
114
121
  issueContract: ISSUE_JSON_SCHEMAS,
115
122
  inputSchema: issueInputSchema(
116
- z.strictObject({
117
- ...Tracking,
118
- ...NativeIssueDateFields,
119
- ...IssueWriteFields,
120
- title: IssueFields.shape.title,
121
- opId: z.string().trim().min(1).max(256).optional().describe(
122
- "Stable retry identity: repeat the same original arguments to complete a partial create without another issue."
123
- ),
124
- status: CreateIssueStatus.optional()
125
- })
123
+ z.strictObject(
124
+ {
125
+ ...Tracking,
126
+ ...NativeIssueDateFields,
127
+ ...IssueWriteFields,
128
+ title: IssueFields.shape.title,
129
+ opId: z.string().trim().min(1).max(256).optional().describe(
130
+ "Stable retry identity: repeat the same original arguments to complete a partial create without another issue."
131
+ ),
132
+ status: CreateIssueStatus.optional()
133
+ },
134
+ { error: acceptedKeysError }
135
+ )
126
136
  )
127
137
  },
128
138
  {
@@ -133,15 +143,17 @@ const AI_DELIVERY_MCP_TOOLS = [
133
143
  },
134
144
  {
135
145
  name: "issue_list",
146
+ readOnly: true,
136
147
  commandName: "list",
137
148
  description: "List repository issues with native filters, named organization fields and pagination",
138
- inputSchema: z.strictObject({ ...IssueListing, query: SearchText.optional() })
149
+ inputSchema: z.strictObject({ ...IssueListing, query: SearchText.optional() }, { error: acceptedKeysError })
139
150
  },
140
151
  {
141
152
  name: "issue_search",
153
+ readOnly: true,
142
154
  commandName: "search",
143
155
  description: "Search literal issue text in the selected repository with native filters and pagination",
144
- inputSchema: z.strictObject({ ...IssueListing, query: SearchText })
156
+ inputSchema: z.strictObject({ ...IssueListing, query: SearchText }, { error: acceptedKeysError })
145
157
  },
146
158
  {
147
159
  name: "issue_update",
@@ -154,90 +166,111 @@ const AI_DELIVERY_MCP_TOOLS = [
154
166
  commandName: "batch:update",
155
167
  description: "Plan or apply 1\u201350 issue updates in one repository, with ordered partial results and readback",
156
168
  inputSchema: issueInputSchema(
157
- z.strictObject({
158
- repo: Repo,
159
- verbose: Verbose,
160
- items: z.array(IssueUpdateInput).min(1).max(50),
161
- dryRun: z.boolean().optional()
162
- })
169
+ z.strictObject(
170
+ {
171
+ repo: Repo,
172
+ verbose: Verbose,
173
+ items: z.array(IssueUpdateInput).min(1).max(50),
174
+ dryRun: z.boolean().optional()
175
+ },
176
+ { error: acceptedKeysError }
177
+ )
163
178
  )
164
179
  },
165
180
  {
166
181
  name: "issue_info",
182
+ readOnly: true,
167
183
  commandName: "info",
168
- description: "Read live GitHub issue metadata, relationships, Project status, linked PRs (state, checks, reviews) and the latest journal in one call. Child counts by default; verbose adds the body, routing and full child progress. Pass the requested owner/name as repo; an explicit repo works outside Git without a checkout. This read does not start or update the issue.",
169
- inputSchema: z.strictObject({ issueNumber: Positive, repo: Repo, verbose: Verbose })
184
+ description: "Read live GitHub issue metadata, relationships, Project status, linked PRs (state, merge commit, checks, reviews) and the latest journal in one call. Child counts by default; verbose adds the body, every journal in full, routing and full child progress. Pass the requested owner/name as repo; an explicit repo works outside Git without a checkout. This read does not start or update the issue.",
185
+ inputSchema: z.strictObject({ issueNumber: Positive, repo: Repo, verbose: Verbose }, { error: acceptedKeysError })
170
186
  },
171
187
  {
172
188
  name: "issue_ready_check",
189
+ readOnly: true,
173
190
  commandName: "ready:check",
174
191
  description: "Evaluate deterministic readiness from live native issue state",
175
- inputSchema: z.strictObject({ issueNumber: Positive, repo: Tracking.repo, verbose: Verbose })
192
+ inputSchema: z.strictObject(
193
+ { issueNumber: Positive, repo: Tracking.repo, verbose: Verbose },
194
+ { error: acceptedKeysError }
195
+ )
176
196
  },
177
197
  {
178
198
  name: "issue_pr_create",
179
199
  commandName: "pr:create",
180
- description: "Create or reuse a PR from any directory using repo, issueNumber and a pushed head. By default it closes the issue and restores a missing closing link on reuse. nonClosing opens a draft that references the issue and leaves it open. expectedHeadSha refuses a different pushed head.",
181
- inputSchema: z.strictObject({
182
- repo: Repo,
183
- verbose: Verbose,
184
- issueNumber: Positive,
185
- prNumber: Positive.optional(),
186
- nonClosing: z.boolean().optional(),
187
- expectedHeadSha: z.string().regex(
188
- /^[a-f0-9]{40}$/u,
189
- "expectedHeadSha must be a full 40-character commit SHA; pass the pushed head or omit it."
190
- ).optional(),
191
- body: z.string().min(1, "PR body is empty; enter a body or omit it to use the default body.").optional(),
192
- draft: z.boolean().optional(),
193
- dryRun: z.boolean().optional(),
194
- title: z.string().min(1, "PR title is empty; enter a title or omit it to use the issue title.").optional(),
195
- headBranch: z.string().min(1).optional(),
196
- head: z.string().min(1).optional(),
197
- base: z.string().min(1).optional()
198
- }).refine(
200
+ description: "Create or reuse a PR from any directory using repo, issueNumber and a pushed head. By default it closes the issue and restores a missing closing link on reuse. On an existing closing PR, a new title or body edits it and draft: false marks it ready. nonClosing opens a draft that references the issue and leaves it open. expectedHeadSha refuses a different pushed head.",
201
+ inputSchema: z.strictObject(
202
+ {
203
+ repo: Repo,
204
+ verbose: Verbose,
205
+ issueNumber: Positive,
206
+ prNumber: Positive.optional(),
207
+ nonClosing: z.boolean().optional(),
208
+ expectedHeadSha: z.string().regex(
209
+ /^[a-f0-9]{40}$/u,
210
+ "expectedHeadSha must be a full 40-character commit SHA; pass the pushed head or omit it."
211
+ ).optional(),
212
+ body: z.string().min(1, "PR body is empty; enter a body or omit it to use the default body.").optional(),
213
+ draft: z.boolean().optional(),
214
+ dryRun: z.boolean().optional(),
215
+ title: z.string().min(1, "PR title is empty; enter a title or omit it to use the issue title.").optional(),
216
+ headBranch: z.string().min(1).optional(),
217
+ head: z.string().min(1).optional(),
218
+ base: z.string().min(1).optional()
219
+ },
220
+ { error: acceptedKeysError }
221
+ ).refine(
199
222
  (input) => input.head === void 0 || input.headBranch === void 0 || input.head === input.headBranch,
200
223
  "PR head selectors disagree; use the same branch for head and headBranch."
201
224
  )
202
225
  },
203
226
  {
204
227
  name: "issue_pr_info",
228
+ readOnly: true,
205
229
  commandName: "pr:info",
206
- description: "Inspect a PR by number or its GitHub-linked issue branch: state, merge state, checks, reviews and each linked issue's state, Project status and latest journal, in one call",
207
- inputSchema: z.strictObject({
208
- repo: Repo,
209
- verbose: Verbose,
210
- issueNumber: Positive.optional(),
211
- prNumber: Positive.optional(),
212
- nonClosing: z.boolean().optional()
213
- })
230
+ description: "Inspect a PR by number or its GitHub-linked issue branch: state, merge state, merge commit, checks, reviews and each linked issue's state, Project status and latest journal, in one call",
231
+ inputSchema: z.strictObject(
232
+ {
233
+ repo: Repo,
234
+ verbose: Verbose,
235
+ issueNumber: Positive.optional(),
236
+ prNumber: Positive.optional(),
237
+ nonClosing: z.boolean().optional()
238
+ },
239
+ { error: acceptedKeysError }
240
+ )
214
241
  },
215
242
  {
216
243
  name: "milestone_create",
217
244
  commandName: "milestone:create",
218
245
  description: "Create a repository milestone (title, optional ISO due date and description) with readback. Repeating the same call returns the milestone it made; a same-titled milestone with different details is refused.",
219
- inputSchema: z.strictObject({
220
- repo: Repo,
221
- verbose: Verbose,
222
- title: z.string().trim().min(1).max(256),
223
- dueOn: z.iso.date().optional(),
224
- description: z.string().max(1e4).optional()
225
- })
246
+ inputSchema: z.strictObject(
247
+ {
248
+ repo: Repo,
249
+ verbose: Verbose,
250
+ title: z.string().trim().min(1).max(256),
251
+ dueOn: z.iso.date().optional(),
252
+ description: z.string().max(1e4).optional()
253
+ },
254
+ { error: acceptedKeysError }
255
+ )
226
256
  },
227
257
  {
228
258
  name: "issue_pr_review",
229
259
  commandName: "pr:review",
230
260
  description: "Submit one existing exact-head independent review with the reviewer App role",
231
- inputSchema: z.strictObject({
232
- repo: Repo,
233
- verbose: Verbose,
234
- issueNumber: Positive,
235
- prNumber: Positive,
236
- nonClosing: z.boolean().optional(),
237
- artifact: z.string().min(1, "Review artifact is empty; provide the independent review artifact JSON."),
238
- identity: z.string().min(1).optional(),
239
- dryRun: z.boolean().optional()
240
- })
261
+ inputSchema: z.strictObject(
262
+ {
263
+ repo: Repo,
264
+ verbose: Verbose,
265
+ issueNumber: Positive,
266
+ prNumber: Positive,
267
+ nonClosing: z.boolean().optional(),
268
+ artifact: z.string().min(1, "Review artifact is empty; provide the independent review artifact JSON."),
269
+ identity: z.string().min(1).optional(),
270
+ dryRun: z.boolean().optional()
271
+ },
272
+ { error: acceptedKeysError }
273
+ )
241
274
  }
242
275
  ];
243
276
  function getAiDeliveryMcpTool(name) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/mcp/tools.ts"],
4
- "sourcesContent": ["import { z } from 'zod';\nimport { NativeIssueDateFields } from '../github/nativeIssueMetadata.js';\nimport { ProjectTradeFields } from '../github/projectNumbers.js';\nimport { OverrideReason } from '../services/blockerGuardService.js';\nimport { JournalInputSchema, JOURNAL_SCHEMA_METADATA } from '../issueJournal.js';\nimport {\n IssueFields,\n IssueWriteFields,\n ISSUE_JSON_SCHEMAS,\n issueInputSchema,\n CreateIssueStatus,\n IssueStatusPatch,\n ProjectStatusPatch,\n IssueDeferralPatch,\n} from '../issueContract.js';\n\nconst Verbose = z.boolean().optional().describe('Return the full payload, including bodies, diffs and routing.');\nconst Positive = z.number().int().positive();\nconst Labels = z.array(z.string().trim().min(1));\nconst REPO_HELP =\n 'GitHub owner/name. Pass the repository named by the user. An explicit repo avoids launch-directory Git for ordinary remote issue/PR work; retained local modes keep their own checkout requirements.';\nconst Repo = z\n .string()\n .regex(/^[A-Za-z0-9_.-]+\\/[A-Za-z0-9_.-]+$/u)\n .optional()\n .describe(REPO_HELP);\nexport const AI_DELIVERY_MCP_CONTRACT_VERSION = 'ai-delivery.mcp@2' as const;\nconst IssueUpdateInput = issueInputSchema(\n z\n .strictObject({\n ...IssueWriteFields,\n ...NativeIssueDateFields,\n status: IssueStatusPatch.optional(),\n projectStatus: ProjectStatusPatch.optional(),\n repo: Repo,\n blockedBy: z.array(Positive).optional(),\n blocks: z.array(Positive).optional(),\n overrideReason: OverrideReason.optional(),\n body: z.string().optional(),\n issueNumber: Positive,\n issueType: IssueWriteFields.issueType,\n labels: Labels.optional(),\n milestone: Positive.nullable().optional(),\n parentIssueNumber: Positive.nullable().optional(),\n park: z.literal(true).optional(),\n ...IssueDeferralPatch,\n points: IssueWriteFields.points,\n priority: z.string().min(1).optional(),\n state: z.enum(['open', 'closed']).optional(),\n preserveHistory: z.boolean().optional(),\n closeReason: z.enum(['completed', 'not_planned', 'duplicate']).optional(),\n supersededBy: Positive.optional(),\n title: IssueWriteFields.title,\n })\n .superRefine((input, ctx) => {\n if (input.defer !== undefined && input.undefer !== undefined)\n ctx.addIssue({ code: 'custom', message: 'Choose defer or undefer, never both.', path: ['defer'] });\n if ((input.closeReason !== undefined || input.supersededBy !== undefined) && input.state !== 'closed')\n ctx.addIssue({\n code: 'custom',\n path: ['state'],\n message: 'Closure details require a closed issue; set state to closed.',\n params: { issueCode: 'closure.state' },\n });\n }),\n);\n\nconst Tracking = {\n verbose: Verbose,\n blockedBy: z.array(Positive).optional(),\n blocks: z.array(Positive).optional(),\n overrideReason: OverrideReason.optional(),\n body: z.string().optional(),\n issueType: z.string().min(1).optional(),\n labels: Labels.optional(),\n milestone: Positive.optional(),\n parentIssueNumber: Positive.optional(),\n points: Positive.optional().describe(IssueFields.shape.points.description ?? ''),\n priority: z.string().min(1).optional(),\n repo: z\n .string()\n .regex(/^[A-Za-z0-9_.-]+\\/[A-Za-z0-9_.-]+$/u)\n .optional()\n .describe(REPO_HELP),\n title: z\n .string()\n .trim()\n .min(1, 'Issue title is empty; enter a title.')\n .max(256, 'Issue title exceeds 256 characters; shorten the title.')\n .describe(IssueFields.shape.title.description ?? ''),\n};\nconst NormalStart = z.strictObject({\n ...Tracking,\n title: Tracking.title.optional(),\n issueNumber: Positive.optional(),\n request: z.string().min(1).optional(),\n requestId: z.string().trim().min(1).max(256).optional(),\n resumeCreated: z.boolean().optional(),\n branch: z.string().min(1).optional(),\n});\nconst IssueListing = {\n repo: Repo,\n verbose: Verbose,\n state: z.enum(['open', 'closed', 'all']).optional(),\n labels: z\n .array(\n z\n .string()\n .min(1)\n .regex(/^[^\"\\\\\\r\\n]+$/u),\n )\n .optional(),\n parentIssueNumber: Positive.nullable().optional(),\n issueType: z.string().min(1).optional(),\n projectStatus: z.enum(['Todo', 'In Progress', 'Blocked', 'Done']).nullable().optional(),\n updatedSince: z.iso.datetime({ offset: true }).optional(),\n page: Positive.optional(),\n perPage: Positive.max(100).optional(),\n};\nconst SearchText = z\n .string()\n .trim()\n .min(1)\n .max(256)\n .regex(/^[^\"\\\\\\r\\n]+$/u);\n\nexport const AI_DELIVERY_MCP_TOOLS = [\n {\n name: 'issue_comment',\n commandName: 'comment',\n description:\n 'Post a typed issue journal with authoritative comment readback. Provide the fields required by kind: start: outcome; progress: done, decisionNeeded and non-empty evidence; decision: non-empty decision and rationale; blocker: blocker and resolution; closeout: acceptance and followUps. Omit fields belonging to other kinds.',\n inputSchema: z\n .strictObject({ ...JournalInputSchema.shape, repo: Repo, verbose: Verbose })\n .superRefine(({ repo: _repo, verbose: _verbose, ...journal }, ctx) => {\n // Repository routing belongs to the MCP envelope, not the strict journal variants.\n const parsed = JournalInputSchema.safeParse(journal);\n if (!parsed.success)\n for (const issue of parsed.error.issues)\n ctx.addIssue({ code: 'custom', path: issue.path, message: issue.message });\n })\n .meta(JOURNAL_SCHEMA_METADATA),\n },\n {\n name: 'issue_create',\n commandName: 'create',\n description: 'Create a native GitHub tracking issue with configured metadata and relationships',\n issueContract: ISSUE_JSON_SCHEMAS,\n inputSchema: issueInputSchema(\n z.strictObject({\n ...Tracking,\n ...NativeIssueDateFields,\n ...IssueWriteFields,\n title: IssueFields.shape.title,\n opId: z\n .string()\n .trim()\n .min(1)\n .max(256)\n .optional()\n .describe(\n 'Stable retry identity: repeat the same original arguments to complete a partial create without another issue.',\n ),\n status: CreateIssueStatus.optional(),\n }),\n ),\n },\n {\n name: 'issue_start',\n commandName: 'start',\n description:\n 'Start a linked issue. Prefer issueNumber of an open issue that already meets the ready contract: title, Points and, for Bug issues, the bug fields (see issue_create). A new issue from title or request cannot carry bug fields.',\n inputSchema: NormalStart,\n },\n {\n name: 'issue_list',\n commandName: 'list',\n description: 'List repository issues with native filters, named organization fields and pagination',\n inputSchema: z.strictObject({ ...IssueListing, query: SearchText.optional() }),\n },\n {\n name: 'issue_search',\n commandName: 'search',\n description: 'Search literal issue text in the selected repository with native filters and pagination',\n inputSchema: z.strictObject({ ...IssueListing, query: SearchText }),\n },\n {\n name: 'issue_update',\n commandName: 'update',\n description: 'Update native issue fields and exact relationship sets with readback',\n inputSchema: IssueUpdateInput.safeExtend({ ...ProjectTradeFields, verbose: Verbose }),\n },\n {\n name: 'issue_batch_update',\n commandName: 'batch:update',\n description: 'Plan or apply 1\u201350 issue updates in one repository, with ordered partial results and readback',\n inputSchema: issueInputSchema(\n z.strictObject({\n repo: Repo,\n verbose: Verbose,\n items: z.array(IssueUpdateInput).min(1).max(50),\n dryRun: z.boolean().optional(),\n }),\n ),\n },\n {\n name: 'issue_info',\n commandName: 'info',\n description:\n 'Read live GitHub issue metadata, relationships, Project status, linked PRs (state, checks, reviews) and the latest journal in one call. Child counts by default; verbose adds the body, routing and full child progress. Pass the requested owner/name as repo; an explicit repo works outside Git without a checkout. This read does not start or update the issue.',\n inputSchema: z.strictObject({ issueNumber: Positive, repo: Repo, verbose: Verbose }),\n },\n {\n name: 'issue_ready_check',\n commandName: 'ready:check',\n description: 'Evaluate deterministic readiness from live native issue state',\n inputSchema: z.strictObject({ issueNumber: Positive, repo: Tracking.repo, verbose: Verbose }),\n },\n {\n name: 'issue_pr_create',\n commandName: 'pr:create',\n description:\n 'Create or reuse a PR from any directory using repo, issueNumber and a pushed head. By default it closes the issue and restores a missing closing link on reuse. nonClosing opens a draft that references the issue and leaves it open. expectedHeadSha refuses a different pushed head.',\n inputSchema: z\n .strictObject({\n repo: Repo,\n verbose: Verbose,\n issueNumber: Positive,\n prNumber: Positive.optional(),\n nonClosing: z.boolean().optional(),\n expectedHeadSha: z\n .string()\n .regex(\n /^[a-f0-9]{40}$/u,\n 'expectedHeadSha must be a full 40-character commit SHA; pass the pushed head or omit it.',\n )\n .optional(),\n body: z.string().min(1, 'PR body is empty; enter a body or omit it to use the default body.').optional(),\n draft: z.boolean().optional(),\n dryRun: z.boolean().optional(),\n title: z.string().min(1, 'PR title is empty; enter a title or omit it to use the issue title.').optional(),\n headBranch: z.string().min(1).optional(),\n head: z.string().min(1).optional(),\n base: z.string().min(1).optional(),\n })\n .refine(\n (input) => input.head === undefined || input.headBranch === undefined || input.head === input.headBranch,\n 'PR head selectors disagree; use the same branch for head and headBranch.',\n ),\n },\n {\n name: 'issue_pr_info',\n commandName: 'pr:info',\n description:\n \"Inspect a PR by number or its GitHub-linked issue branch: state, merge state, checks, reviews and each linked issue's state, Project status and latest journal, in one call\",\n inputSchema: z.strictObject({\n repo: Repo,\n verbose: Verbose,\n issueNumber: Positive.optional(),\n prNumber: Positive.optional(),\n nonClosing: z.boolean().optional(),\n }),\n },\n {\n name: 'milestone_create',\n commandName: 'milestone:create',\n description:\n 'Create a repository milestone (title, optional ISO due date and description) with readback. Repeating the same call returns the milestone it made; a same-titled milestone with different details is refused.',\n inputSchema: z.strictObject({\n repo: Repo,\n verbose: Verbose,\n title: z.string().trim().min(1).max(256),\n dueOn: z.iso.date().optional(),\n description: z.string().max(10000).optional(),\n }),\n },\n {\n name: 'issue_pr_review',\n commandName: 'pr:review',\n description: 'Submit one existing exact-head independent review with the reviewer App role',\n inputSchema: z.strictObject({\n repo: Repo,\n verbose: Verbose,\n issueNumber: Positive,\n prNumber: Positive,\n nonClosing: z.boolean().optional(),\n artifact: z.string().min(1, 'Review artifact is empty; provide the independent review artifact JSON.'),\n identity: z.string().min(1).optional(),\n dryRun: z.boolean().optional(),\n }),\n },\n] as const;\n\nexport type AiDeliveryMcpToolName = (typeof AI_DELIVERY_MCP_TOOLS)[number]['name'];\n\nexport function getAiDeliveryMcpTool(name: string): (typeof AI_DELIVERY_MCP_TOOLS)[number] | null {\n return AI_DELIVERY_MCP_TOOLS.find((tool) => tool.name === name) ?? null;\n}\n"],
5
- "mappings": "AAAA,SAAS,SAAS;AAClB,SAAS,6BAA6B;AACtC,SAAS,0BAA0B;AACnC,SAAS,sBAAsB;AAC/B,SAAS,oBAAoB,+BAA+B;AAC5D;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,MAAM,UAAU,EAAE,QAAQ,EAAE,SAAS,EA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ACA;AAAA,IACE,MAAM;AAAA,IACN,aAAa;AAAA,IACb,aACE;AAAA,IACF,aAAa,EAAE,aAAa;AAAA,MAC1B,MAAM;AAAA,MACN,SAAS;AAAA,MACT,aAAa,SAAS,SAAS;AAAA,MAC/B,UAAU,SAAS,SAAS;AAAA,MAC5B,YAAY,EAAE,QAAQ,EAAE,SAAS;AAAA,IACnC,CAAC;AAAA,EACH;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,aAAa;AAAA,IACb,aACE;AAAA,IACF,aAAa,EAAE,aAAa;AAAA,MAC1B,MAAM;AAAA,MACN,SAAS;AAAA,MACT,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG;AAAA,MACvC,OAAO,EAAE,IAAI,KAAK,EAAE,SAAS;AAAA,MAC7B,aAAa,EAAE,OAAO,EAAE,IAAI,GAAK,EAAE,SAAS;AAAA,IAC9C,CAAC;AAAA,EACH;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,aAAa;AAAA,IACb,aAAa;AAAA,IACb,aAAa,EAAE,aAAa;AAAA,MAC1B,MAAM;AAAA,MACN,SAAS;AAAA,MACT,aAAa;AAAA,MACb,UAAU;AAAA,MACV,YAAY,EAAE,QAAQ,EAAE,SAAS;AAAA,MACjC,UAAU,EAAE,OAAO,EAAE,IAAI,GAAG,yEAAyE;AAAA,MACrG,UAAU,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,SAAS;AAAA,MACrC,QAAQ,EAAE,QAAQ,EAAE,SAAS;AAAA,IAC/B,CAAC;AAAA,EACH;AACF;AAIO,SAAS,qBAAqB,MAA6D;AAChG,SAAO,sBAAsB,KAAK,CAAC,SAAS,KAAK,SAAS,IAAI,KAAK;AACrE;",
4
+ "sourcesContent": ["import { z } from 'zod';\nimport { NativeIssueDateFields } from '../github/nativeIssueMetadata.js';\nimport { ProjectTradeFields } from '../github/projectNumbers.js';\nimport { OverrideReason } from '../services/blockerGuardService.js';\nimport { JournalInputSchema, JOURNAL_SCHEMA_METADATA } from '../issueJournal.js';\nimport {\n IssueFields,\n IssueWriteFields,\n ISSUE_JSON_SCHEMAS,\n issueInputSchema,\n CreateIssueStatus,\n IssueStatusPatch,\n ProjectStatusPatch,\n IssueDeferralPatch,\n acceptedKeysError,\n} from '../issueContract.js';\n\nconst Verbose = z.boolean().optional().describe('Return the full payload, including bodies, diffs and routing.');\nconst Positive = z.number().int().positive();\nconst Labels = z.array(z.string().trim().min(1));\nconst REPO_HELP =\n 'GitHub owner/name. Pass the repository named by the user. An explicit repo avoids launch-directory Git for ordinary remote issue/PR work; retained local modes keep their own checkout requirements.';\nconst Repo = z\n .string()\n .regex(/^[A-Za-z0-9_.-]+\\/[A-Za-z0-9_.-]+$/u)\n .optional()\n .describe(REPO_HELP);\nexport const AI_DELIVERY_MCP_CONTRACT_VERSION = 'ai-delivery.mcp@2' as const;\nconst IssueUpdateInput = issueInputSchema(\n z\n .strictObject(\n {\n ...IssueWriteFields,\n ...NativeIssueDateFields,\n status: IssueStatusPatch.optional(),\n projectStatus: ProjectStatusPatch.optional(),\n repo: Repo,\n blockedBy: z.array(Positive).optional(),\n blocks: z.array(Positive).optional(),\n overrideReason: OverrideReason.optional(),\n body: z.string().optional(),\n issueNumber: Positive,\n issueType: IssueWriteFields.issueType,\n labels: Labels.optional(),\n milestone: Positive.nullable().optional(),\n parentIssueNumber: Positive.nullable().optional(),\n park: z.literal(true).optional(),\n ...IssueDeferralPatch,\n points: IssueWriteFields.points,\n priority: z.string().min(1).optional(),\n state: z.enum(['open', 'closed']).optional(),\n preserveHistory: z.boolean().optional(),\n closeReason: z.enum(['completed', 'not_planned', 'duplicate']).optional(),\n supersededBy: Positive.optional(),\n title: IssueWriteFields.title,\n },\n { error: acceptedKeysError },\n )\n .superRefine((input, ctx) => {\n if (input.defer !== undefined && input.undefer !== undefined)\n ctx.addIssue({ code: 'custom', message: 'Choose defer or undefer, never both.', path: ['defer'] });\n if ((input.closeReason !== undefined || input.supersededBy !== undefined) && input.state !== 'closed')\n ctx.addIssue({\n code: 'custom',\n path: ['state'],\n message: 'Closure details require a closed issue; set state to closed.',\n params: { issueCode: 'closure.state' },\n });\n }),\n);\n\nconst Tracking = {\n verbose: Verbose,\n blockedBy: z.array(Positive).optional(),\n blocks: z.array(Positive).optional(),\n overrideReason: OverrideReason.optional(),\n body: z.string().optional(),\n issueType: z.string().min(1).optional(),\n labels: Labels.optional(),\n milestone: Positive.optional(),\n parentIssueNumber: Positive.optional(),\n points: Positive.optional().describe(IssueFields.shape.points.description ?? ''),\n priority: z.string().min(1).optional(),\n repo: z\n .string()\n .regex(/^[A-Za-z0-9_.-]+\\/[A-Za-z0-9_.-]+$/u)\n .optional()\n .describe(REPO_HELP),\n title: z\n .string()\n .trim()\n .min(1, 'Issue title is empty; enter a title.')\n .max(256, 'Issue title exceeds 256 characters; shorten the title.')\n .describe(IssueFields.shape.title.description ?? ''),\n};\nconst NormalStart = z.strictObject(\n {\n ...Tracking,\n title: Tracking.title.optional(),\n issueNumber: Positive.optional(),\n request: z.string().min(1).optional(),\n requestId: z.string().trim().min(1).max(256).optional(),\n resumeCreated: z.boolean().optional(),\n branch: z.string().min(1).optional(),\n },\n { error: acceptedKeysError },\n);\nconst IssueListing = {\n repo: Repo,\n verbose: Verbose,\n state: z.enum(['open', 'closed', 'all']).optional(),\n labels: z\n .array(\n z\n .string()\n .min(1)\n .regex(/^[^\"\\\\\\r\\n]+$/u),\n )\n .optional(),\n parentIssueNumber: Positive.nullable().optional(),\n issueType: z.string().min(1).optional(),\n projectStatus: z.enum(['Todo', 'In Progress', 'Blocked', 'Done']).nullable().optional(),\n updatedSince: z.iso.datetime({ offset: true }).optional(),\n page: Positive.optional(),\n perPage: Positive.max(100).optional(),\n};\nconst SearchText = z\n .string()\n .trim()\n .min(1)\n .max(256)\n .regex(/^[^\"\\\\\\r\\n]+$/u);\n\nexport const AI_DELIVERY_MCP_TOOLS = [\n {\n name: 'issue_comment',\n commandName: 'comment',\n description:\n 'Post a typed issue journal with authoritative comment readback. Provide the fields required by kind: start: outcome; progress: done, decisionNeeded and non-empty evidence; decision: non-empty decision and rationale; blocker: blocker and resolution; closeout: acceptance and followUps. Omit fields belonging to other kinds.',\n inputSchema: z\n .strictObject({ ...JournalInputSchema.shape, repo: Repo, verbose: Verbose }, { error: acceptedKeysError })\n .superRefine(({ repo: _repo, verbose: _verbose, ...journal }, ctx) => {\n // Repository routing belongs to the MCP envelope, not the strict journal variants.\n const parsed = JournalInputSchema.safeParse(journal);\n if (!parsed.success)\n for (const issue of parsed.error.issues)\n ctx.addIssue({ code: 'custom', path: issue.path, message: issue.message });\n })\n .meta(JOURNAL_SCHEMA_METADATA),\n },\n {\n name: 'issue_create',\n commandName: 'create',\n description: 'Create a native GitHub tracking issue with configured metadata and relationships',\n issueContract: ISSUE_JSON_SCHEMAS,\n inputSchema: issueInputSchema(\n z.strictObject(\n {\n ...Tracking,\n ...NativeIssueDateFields,\n ...IssueWriteFields,\n title: IssueFields.shape.title,\n opId: z\n .string()\n .trim()\n .min(1)\n .max(256)\n .optional()\n .describe(\n 'Stable retry identity: repeat the same original arguments to complete a partial create without another issue.',\n ),\n status: CreateIssueStatus.optional(),\n },\n { error: acceptedKeysError },\n ),\n ),\n },\n {\n name: 'issue_start',\n commandName: 'start',\n description:\n 'Start a linked issue. Prefer issueNumber of an open issue that already meets the ready contract: title, Points and, for Bug issues, the bug fields (see issue_create). A new issue from title or request cannot carry bug fields.',\n inputSchema: NormalStart,\n },\n {\n name: 'issue_list',\n readOnly: true,\n commandName: 'list',\n description: 'List repository issues with native filters, named organization fields and pagination',\n inputSchema: z.strictObject({ ...IssueListing, query: SearchText.optional() }, { error: acceptedKeysError }),\n },\n {\n name: 'issue_search',\n readOnly: true,\n commandName: 'search',\n description: 'Search literal issue text in the selected repository with native filters and pagination',\n inputSchema: z.strictObject({ ...IssueListing, query: SearchText }, { error: acceptedKeysError }),\n },\n {\n name: 'issue_update',\n commandName: 'update',\n description: 'Update native issue fields and exact relationship sets with readback',\n inputSchema: IssueUpdateInput.safeExtend({ ...ProjectTradeFields, verbose: Verbose }),\n },\n {\n name: 'issue_batch_update',\n commandName: 'batch:update',\n description: 'Plan or apply 1\u201350 issue updates in one repository, with ordered partial results and readback',\n inputSchema: issueInputSchema(\n z.strictObject(\n {\n repo: Repo,\n verbose: Verbose,\n items: z.array(IssueUpdateInput).min(1).max(50),\n dryRun: z.boolean().optional(),\n },\n { error: acceptedKeysError },\n ),\n ),\n },\n {\n name: 'issue_info',\n readOnly: true,\n commandName: 'info',\n description:\n 'Read live GitHub issue metadata, relationships, Project status, linked PRs (state, merge commit, checks, reviews) and the latest journal in one call. Child counts by default; verbose adds the body, every journal in full, routing and full child progress. Pass the requested owner/name as repo; an explicit repo works outside Git without a checkout. This read does not start or update the issue.',\n inputSchema: z.strictObject({ issueNumber: Positive, repo: Repo, verbose: Verbose }, { error: acceptedKeysError }),\n },\n {\n name: 'issue_ready_check',\n readOnly: true,\n commandName: 'ready:check',\n description: 'Evaluate deterministic readiness from live native issue state',\n inputSchema: z.strictObject(\n { issueNumber: Positive, repo: Tracking.repo, verbose: Verbose },\n { error: acceptedKeysError },\n ),\n },\n {\n name: 'issue_pr_create',\n commandName: 'pr:create',\n description:\n 'Create or reuse a PR from any directory using repo, issueNumber and a pushed head. By default it closes the issue and restores a missing closing link on reuse. On an existing closing PR, a new title or body edits it and draft: false marks it ready. nonClosing opens a draft that references the issue and leaves it open. expectedHeadSha refuses a different pushed head.',\n inputSchema: z\n .strictObject(\n {\n repo: Repo,\n verbose: Verbose,\n issueNumber: Positive,\n prNumber: Positive.optional(),\n nonClosing: z.boolean().optional(),\n expectedHeadSha: z\n .string()\n .regex(\n /^[a-f0-9]{40}$/u,\n 'expectedHeadSha must be a full 40-character commit SHA; pass the pushed head or omit it.',\n )\n .optional(),\n body: z.string().min(1, 'PR body is empty; enter a body or omit it to use the default body.').optional(),\n draft: z.boolean().optional(),\n dryRun: z.boolean().optional(),\n title: z.string().min(1, 'PR title is empty; enter a title or omit it to use the issue title.').optional(),\n headBranch: z.string().min(1).optional(),\n head: z.string().min(1).optional(),\n base: z.string().min(1).optional(),\n },\n { error: acceptedKeysError },\n )\n .refine(\n (input) => input.head === undefined || input.headBranch === undefined || input.head === input.headBranch,\n 'PR head selectors disagree; use the same branch for head and headBranch.',\n ),\n },\n {\n name: 'issue_pr_info',\n readOnly: true,\n commandName: 'pr:info',\n description:\n \"Inspect a PR by number or its GitHub-linked issue branch: state, merge state, merge commit, checks, reviews and each linked issue's state, Project status and latest journal, in one call\",\n inputSchema: z.strictObject(\n {\n repo: Repo,\n verbose: Verbose,\n issueNumber: Positive.optional(),\n prNumber: Positive.optional(),\n nonClosing: z.boolean().optional(),\n },\n { error: acceptedKeysError },\n ),\n },\n {\n name: 'milestone_create',\n commandName: 'milestone:create',\n description:\n 'Create a repository milestone (title, optional ISO due date and description) with readback. Repeating the same call returns the milestone it made; a same-titled milestone with different details is refused.',\n inputSchema: z.strictObject(\n {\n repo: Repo,\n verbose: Verbose,\n title: z.string().trim().min(1).max(256),\n dueOn: z.iso.date().optional(),\n description: z.string().max(10000).optional(),\n },\n { error: acceptedKeysError },\n ),\n },\n {\n name: 'issue_pr_review',\n commandName: 'pr:review',\n description: 'Submit one existing exact-head independent review with the reviewer App role',\n inputSchema: z.strictObject(\n {\n repo: Repo,\n verbose: Verbose,\n issueNumber: Positive,\n prNumber: Positive,\n nonClosing: z.boolean().optional(),\n artifact: z.string().min(1, 'Review artifact is empty; provide the independent review artifact JSON.'),\n identity: z.string().min(1).optional(),\n dryRun: z.boolean().optional(),\n },\n { error: acceptedKeysError },\n ),\n },\n] as const;\n\nexport type AiDeliveryMcpToolName = (typeof AI_DELIVERY_MCP_TOOLS)[number]['name'];\n\nexport function getAiDeliveryMcpTool(name: string): (typeof AI_DELIVERY_MCP_TOOLS)[number] | null {\n return AI_DELIVERY_MCP_TOOLS.find((tool) => tool.name === name) ?? null;\n}\n"],
5
+ "mappings": "AA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AE,IAAI,KAAK,EAAE,SAAS;AAAA,QAC7B,aAAa,EAAE,OAAO,EAAE,IAAI,GAAK,EAAE,SAAS;AAAA,MAC9C;AAAA,MACA,EAAE,OAAO,kBAAkB;AAAA,IAC7B;AAAA,EACF;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,aAAa;AAAA,IACb,aAAa;AAAA,IACb,aAAa,EAAE;AAAA,MACb;AAAA,QACE,MAAM;AAAA,QACN,SAAS;AAAA,QACT,aAAa;AAAA,QACb,UAAU;AAAA,QACV,YAAY,EAAE,QAAQ,EAAE,SAAS;AAAA,QACjC,UAAU,EAAE,OAAO,EAAE,IAAI,GAAG,yEAAyE;AAAA,QACrG,UAAU,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,SAAS;AAAA,QACrC,QAAQ,EAAE,QAAQ,EAAE,SAAS;AAAA,MAC/B;AAAA,MACA,EAAE,OAAO,kBAAkB;AAAA,IAC7B;AAAA,EACF;AACF;AAIO,SAAS,qBAAqB,MAA6D;AAChG,SAAO,sBAAsB,KAAK,CAAC,SAAS,KAAK,SAAS,IAAI,KAAK;AACrE;",
6
6
  "names": []
7
7
  }
package/dist/pr.d.ts CHANGED
@@ -92,6 +92,7 @@ export declare function publishPr(context: DeliveryContext, input: {
92
92
  nonClosing?: boolean;
93
93
  nonClosingVerified?: boolean;
94
94
  bodyTransition?: boolean;
95
+ edited?: ("body" | "title")[];
95
96
  headSha: string;
96
97
  headBranch: string;
97
98
  baseBranch: string;
@@ -111,6 +112,7 @@ export declare function publishPr(context: DeliveryContext, input: {
111
112
  headSha: string;
112
113
  state: string;
113
114
  closingLinkAdded?: boolean;
115
+ edited?: ("body" | "title")[];
114
116
  nonClosing?: boolean;
115
117
  nonClosingVerified?: boolean;
116
118
  referenceRemoval?: "acknowledged" | "not attempted";
package/dist/pr.js CHANGED
@@ -859,7 +859,7 @@ async function publishPr(context, input) {
859
859
  const explicit = input.prNumber === void 0 ? void 0 : await getPr(context, input.prNumber);
860
860
  const explicitPromotion = nonClosing && input.draft === false && input.headBranch !== void 0;
861
861
  const selectedMatches = explicitPromotion ? await matchingPrs(context, input.headBranch, base, "open") : void 0;
862
- const branch = explicit ? explicit.head.ref : nonClosing ? explicitPromotion && selectedMatches.length > 0 ? input.headBranch : await issueBranch(context, input.issueNumber, input.headBranch) : input.headBranch ?? await issueBranch(context, input.issueNumber);
862
+ const branch = explicit ? explicit.head.ref : input.headBranch ?? await issueBranch(context, input.issueNumber);
863
863
  if (input.headBranch !== void 0 && branch !== input.headBranch)
864
864
  throw new DeliveryError("Explicit PR and head selectors disagree.");
865
865
  validBranch(branch);
@@ -888,6 +888,9 @@ async function publishPr(context, input) {
888
888
  pr?.body
889
889
  );
890
890
  const closingRepair = !nonClosing && pr !== void 0 && !hasClosingLink(pr.body, input.issueNumber);
891
+ const titleEdit = !nonClosing && pr !== void 0 && input.title !== void 0 && pr.title !== input.title;
892
+ const bodyEdit = !nonClosing && pr !== void 0 && !closingRepair && input.body !== void 0 && pr.body !== body;
893
+ const edited = [...titleEdit ? ["title"] : [], ...bodyEdit ? ["body"] : []];
891
894
  const transition = nonClosing && pr !== void 0 && pr.body !== body;
892
895
  const referenceUpdate = transition && hasReferenceBody(context, input.issueNumber, pr?.body);
893
896
  if (transition && input.body === void 0)
@@ -895,7 +898,7 @@ async function publishPr(context, input) {
895
898
  const reconcileReference = nonClosing && !transition && input.draft !== false && (!pr || pr.draft);
896
899
  if (reconcileReference && (context.clients.role !== "author" || context.clients.authSource !== (context.config.roles.author.authSource ?? "app") || !context.clients.authenticatedAuthor))
897
900
  throw new DeliveryError("Non-closing PR creation needs the configured author credentials; run it as the author.");
898
- if (pr && (pr.head.sha !== ref.object.sha || pr.head.ref !== branch || pr.base.ref !== base || pr.state !== "open" || pr.merged || !transition && input.body !== void 0 && pr.body !== input.body && pr.body !== body || input.title !== void 0 && pr.title !== input.title))
901
+ if (pr && (pr.head.sha !== ref.object.sha || pr.head.ref !== branch || pr.base.ref !== base || pr.state !== "open" || pr.merged || nonClosing && input.title !== void 0 && pr.title !== input.title))
899
902
  throw new DeliveryError("Existing remote PR conflicts with the requested branch, intent or state.");
900
903
  const reviewRoute = nonClosing ? await nonClosingRoute(context, base) : { author: await routeAuthor(context, "publication") };
901
904
  if (pr && pr.user.login.toLowerCase() !== reviewRoute.author.actorLogin.toLowerCase())
@@ -910,6 +913,7 @@ async function publishPr(context, input) {
910
913
  let pendingTransition = transition;
911
914
  let pendingClosingRepair = closingRepair;
912
915
  let expectedBody = pr?.body;
916
+ let expectedTitle = pr?.title;
913
917
  const transitionDraft = pr?.draft;
914
918
  let promotionApplied = false;
915
919
  let removalState = "not attempted";
@@ -948,7 +952,7 @@ async function publishPr(context, input) {
948
952
  existing.number,
949
953
  nonClosing && (!pendingTransition || referenceUpdate)
950
954
  );
951
- if (current.state !== "open" || current.merged || current.node_id !== existing.node_id || current.head.sha !== ref.object.sha || current.head.ref !== branch || current.base.ref !== base || current.base.sha !== existing.base.sha || current.user.login.toLowerCase() !== reviewRoute.author.actorLogin.toLowerCase() || (transition || closingRepair) && !promotionApplied && current.draft !== transitionDraft || current.body !== expectedBody || current.title !== existing.title)
955
+ if (current.state !== "open" || current.merged || current.node_id !== existing.node_id || current.head.sha !== ref.object.sha || current.head.ref !== branch || current.base.ref !== base || current.base.sha !== existing.base.sha || current.user.login.toLowerCase() !== reviewRoute.author.actorLogin.toLowerCase() || (transition || closingRepair) && !promotionApplied && current.draft !== transitionDraft || current.body !== expectedBody || current.title !== expectedTitle)
952
956
  throw new DeliveryError("Existing PR publication head, identity, intent or author readback drifted.");
953
957
  if (reconcileReference) await readReconciliation(current);
954
958
  if (pendingClosingRepair) {
@@ -1014,6 +1018,7 @@ async function publishPr(context, input) {
1014
1018
  body,
1015
1019
  bodyTransition: pendingTransition
1016
1020
  } : {},
1021
+ ...edited.length ? { edited } : {},
1017
1022
  headSha: ref.object.sha,
1018
1023
  headBranch: branch,
1019
1024
  baseBranch: base,
@@ -1044,6 +1049,25 @@ async function publishPr(context, input) {
1044
1049
  expectedBody = body;
1045
1050
  pr = await readExisting();
1046
1051
  }
1052
+ if (edited.length) {
1053
+ pr = await readExisting();
1054
+ const number = pr.number;
1055
+ try {
1056
+ await context.clients.rest.pulls.update({
1057
+ ...context.repo,
1058
+ pull_number: number,
1059
+ ...titleEdit ? { title: input.title } : {},
1060
+ ...bodyEdit ? { body } : {}
1061
+ });
1062
+ if (titleEdit) expectedTitle = input.title;
1063
+ if (bodyEdit) expectedBody = body;
1064
+ pr = await readExisting();
1065
+ } catch (error) {
1066
+ throw new DeliveryError(
1067
+ `PR #${number} edit acknowledgement is uncertain; check it with issue_pr_info before calling again. ${error instanceof Error ? error.message : "Unknown failure"}`
1068
+ );
1069
+ }
1070
+ }
1047
1071
  if (input.draft === false && pr.draft) {
1048
1072
  pr = await readExisting();
1049
1073
  if (pr.draft) {
@@ -1146,6 +1170,7 @@ async function publishPr(context, input) {
1146
1170
  headSha: pr.head.sha,
1147
1171
  state: pr.draft ? "draft" : pr.state,
1148
1172
  ...closingRepair ? { closingLinkAdded: true } : {},
1173
+ ...edited.length ? { edited } : {},
1149
1174
  ...nonClosing ? { nonClosing: true, nonClosingVerified: true } : {},
1150
1175
  ...reconcileReference ? { referenceRemoval: removalState } : {},
1151
1176
  ...warnings.length ? { warnings } : {}