@aviaratech/ai-delivery 0.3.42 → 0.3.44

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 (84) hide show
  1. package/README.md +2 -2
  2. package/dist/agentReadiness.test.js +27 -0
  3. package/dist/agentReadiness.test.js.map +2 -2
  4. package/dist/cli.js +2 -1
  5. package/dist/cli.js.map +2 -2
  6. package/dist/contributorChecks.test.js +4 -1
  7. package/dist/contributorChecks.test.js.map +2 -2
  8. package/dist/currentConsumer.test.js +3 -2
  9. package/dist/currentConsumer.test.js.map +2 -2
  10. package/dist/currentTrackingScenario.test.js +3 -2
  11. package/dist/currentTrackingScenario.test.js.map +2 -2
  12. package/dist/directoryIndependent.test.js +22 -3
  13. package/dist/directoryIndependent.test.js.map +3 -3
  14. package/dist/dispatch.js.map +2 -2
  15. package/dist/fixtures/builderReady.d.ts +84 -0
  16. package/dist/fixtures/builderReady.js +58 -0
  17. package/dist/fixtures/builderReady.js.map +7 -0
  18. package/dist/fixtures/inertTarget.d.ts +82 -0
  19. package/dist/fixtures/inertTarget.js +25 -15
  20. package/dist/fixtures/inertTarget.js.map +2 -2
  21. package/dist/fixtures/issue63.d.ts +99 -0
  22. package/dist/fixtures/issue63.js +21 -2
  23. package/dist/fixtures/issue63.js.map +2 -2
  24. package/dist/issue.d.ts +23 -2
  25. package/dist/issue.js +154 -28
  26. package/dist/issue.js.map +2 -2
  27. package/dist/issue63Routes.test.js +3 -3
  28. package/dist/issue63Routes.test.js.map +2 -2
  29. package/dist/issueBlockerGuard.test.js +16 -5
  30. package/dist/issueBlockerGuard.test.js.map +2 -2
  31. package/dist/issueContract.d.ts +247 -2
  32. package/dist/issueContract.js +188 -24
  33. package/dist/issueContract.js.map +2 -2
  34. package/dist/issueContract.test.d.ts +21 -0
  35. package/dist/issueContract.test.js +276 -17
  36. package/dist/issueContract.test.js.map +2 -2
  37. package/dist/issueDates.test.js +5 -6
  38. package/dist/issueDates.test.js.map +2 -2
  39. package/dist/issueInfoReadback.test.js +64 -0
  40. package/dist/issueInfoReadback.test.js.map +2 -2
  41. package/dist/issueIntake.test.js +190 -35
  42. package/dist/issueIntake.test.js.map +2 -2
  43. package/dist/issueJournal.d.ts +13 -9
  44. package/dist/issueJournal.js +14 -10
  45. package/dist/issueJournal.js.map +2 -2
  46. package/dist/issueJournal.test.js +11 -8
  47. package/dist/issueJournal.test.js.map +2 -2
  48. package/dist/issueTracking.test.js +135 -2
  49. package/dist/issueTracking.test.js.map +3 -3
  50. package/dist/issueWriteRecovery.test.js +12 -12
  51. package/dist/issueWriteRecovery.test.js.map +2 -2
  52. package/dist/mcp/index.js +10 -3
  53. package/dist/mcp/index.js.map +2 -2
  54. package/dist/mcp/tools.d.ts +186 -27
  55. package/dist/mcp/tools.js +25 -7
  56. package/dist/mcp/tools.js.map +2 -2
  57. package/dist/pluginPackaging.test.js +6 -3
  58. package/dist/pluginPackaging.test.js.map +2 -2
  59. package/dist/readView.d.ts +3 -0
  60. package/dist/readView.js +1 -1
  61. package/dist/readView.js.map +2 -2
  62. package/dist/releaseReconciliation.test.js +20 -6
  63. package/dist/releaseReconciliation.test.js.map +2 -2
  64. package/dist/releaseWorkflow.test.js +2 -2
  65. package/dist/releaseWorkflow.test.js.map +2 -2
  66. package/dist/review.d.ts +8 -0
  67. package/dist/review.js +30 -2
  68. package/dist/review.js.map +2 -2
  69. package/dist/review.test.js +64 -1
  70. package/dist/review.test.js.map +2 -2
  71. package/dist/services/agentReadinessService.d.ts +2 -1
  72. package/dist/services/agentReadinessService.js +6 -0
  73. package/dist/services/agentReadinessService.js.map +2 -2
  74. package/dist/stdoutRegression.test.js +27 -15
  75. package/dist/stdoutRegression.test.js.map +2 -2
  76. package/dist/targetRepositoryExecution.test.js +11 -3
  77. package/dist/targetRepositoryExecution.test.js.map +2 -2
  78. package/package.json +1 -1
  79. package/plugins/ai-delivery/.claude-plugin/plugin.json +2 -2
  80. package/plugins/ai-delivery/plugin.json +1 -1
  81. package/plugins/ai-delivery/runtime/dist/cli.js +156 -124
  82. package/plugins/ai-delivery/runtime/package.json +1 -1
  83. package/plugins/ai-delivery/skills/intake-create/SKILL.md +1 -11
  84. package/plugins/ai-delivery/skills/ticket-design/SKILL.md +30 -0
@@ -13,7 +13,31 @@ function issueTrackingFooter(body) {
13
13
  }
14
14
  const Text = z.string();
15
15
  const Strings = z.array(Text);
16
- const AcceptanceCriterion = z.strictObject({ behavior: Text, verifiedBy: Text });
16
+ const IssueExample = z.strictObject({
17
+ input: Text,
18
+ expected: Text,
19
+ failure: z.literal(true).optional().describe("Marks an example of what must be refused or must fail.")
20
+ });
21
+ const AcceptanceCriterion = z.strictObject({
22
+ behavior: Text,
23
+ verifiedBy: Text,
24
+ examples: z.array(IssueExample).optional().describe("Example Mapping: concrete input and expected result for this criterion, including a failure case.")
25
+ });
26
+ const FrontierReason = z.enum([
27
+ "state-machine",
28
+ "concurrency-recovery",
29
+ "risk-semantics",
30
+ "unprovable-refactor"
31
+ ]);
32
+ const BuilderTier = z.discriminatedUnion("tier", [
33
+ z.strictObject({ tier: z.literal("standard") }),
34
+ z.strictObject({ tier: z.literal("frontier"), reason: FrontierReason })
35
+ ]);
36
+ const SurfaceEntry = z.strictObject({
37
+ path: Text,
38
+ change: z.enum(["add", "edit", "delete"]),
39
+ signatures: Strings.optional()
40
+ });
17
41
  const IssueDeferral = z.strictObject({
18
42
  until: z.iso.date().optional(),
19
43
  trigger: z.string().trim().min(1).max(2e3).optional()
@@ -43,6 +67,19 @@ const IssueFields = z.strictObject({
43
67
  bug: z.strictObject({ steps: Strings, expected: Text, actual: Text, reproducibility: Text, environment: Text }).optional().describe("Ready Bug issues need non-empty steps, expected, actual, reproducibility and environment."),
44
68
  draft: z.boolean().default(false),
45
69
  deferral: IssueDeferral.optional(),
70
+ builder: BuilderTier.optional().describe(
71
+ "Builder capability: standard (any lighter builder can finish from the issue alone) or frontier with one reason."
72
+ ),
73
+ extends: Strings.optional().describe("The design decision or existing owner this change uses or extends."),
74
+ priorWork: Strings.optional().describe(
75
+ "Searches run for earlier work on this question (closed issues, issue artifacts, decision logs) and what each found, or 'none found' with the searches."
76
+ ),
77
+ decisions: Strings.optional().describe("Choices already made; the builder must not reopen them."),
78
+ surface: z.array(SurfaceEntry).optional().describe(
79
+ "The complete change set: each path, its change, and exact signatures. Tests for these paths are implied."
80
+ ),
81
+ fences: Strings.optional().describe("Nearby paths the builder must not touch, with each shared file's owner."),
82
+ proof: Strings.optional().describe("Commands or replays to run in order, focused first."),
46
83
  legacyBody: Text.optional(),
47
84
  retainLegacyBody: z.boolean().optional()
48
85
  });
@@ -94,9 +131,13 @@ const hint = (code, field, fixHint) => ({
94
131
  fixHint,
95
132
  message: fixHint
96
133
  });
134
+ function stringEntries(value, path = "") {
135
+ if (typeof value === "string") return [[path, value]];
136
+ if (value === null || typeof value !== "object") return [];
137
+ return Object.entries(value).flatMap(([key, item]) => stringEntries(item, path ? `${path}.${key}` : key));
138
+ }
97
139
  function secrets(value) {
98
- const strings = (item) => typeof item === "string" ? [item] : Array.isArray(item) ? item.flatMap(strings) : item !== null && typeof item === "object" ? Object.values(item).flatMap(strings) : [];
99
- const text = strings(value).join("\n");
140
+ const text = stringEntries(value).map(([, item]) => item).join("\n");
100
141
  return /(?:-----BEGIN (?:RSA |EC |OPENSSH )?PRIVATE KEY-----|\b(?:gh[pousr]_[A-Za-z0-9]{20,}|github_pat_[A-Za-z0-9_]{20,}|sk-(?:proj-)?[A-Za-z0-9_-]{20,}|AKIA[A-Z0-9]{16})\b|\b(?:password|secret|api[_-]?key|access[_-]?token)\s*[=:]\s*["']?(?!<|\$|redacted\b|placeholder\b)[A-Za-z0-9_+/-]{8,})/iu.test(
101
142
  text
102
143
  );
@@ -111,6 +152,7 @@ function secretRule(value, ctx) {
111
152
  });
112
153
  }
113
154
  const DraftIssue = IssueFields.superRefine(secretRule);
155
+ const SKILL_HINT = "See ai-delivery:ticket-design.";
114
156
  function readyRules(value, ctx) {
115
157
  const add = (code, field, fixHint) => ctx.addIssue({ code: "custom", path: field, message: fixHint, params: { issueCode: code } });
116
158
  if (value.draft) add("draft", ["draft"], "Resolve the draft fields and set draft to false before starting work.");
@@ -120,7 +162,8 @@ function readyRules(value, ctx) {
120
162
  value.title.trim()
121
163
  ))
122
164
  add("title.specific", ["title"], "Name the specific behavior or component that changes.");
123
- if (value.title.length > 80) add("title.length", ["title"], "Shorten the title to at most 80 characters.");
165
+ if (value.title.length > 80)
166
+ add("title.length", ["title"], `The title is ${String(value.title.length)} characters; shorten it to at most 80.`);
124
167
  if (/^\s*(?:\[\s*(?:bug|feature|task)\s*\]|(?:bug|feature|task)\s*:)/iu.test(value.title))
125
168
  add("title.prefix", ["title"], "Remove the issue-type prefix; use the native Issue Type field.");
126
169
  for (const field of ["problem", "outcome"])
@@ -157,6 +200,59 @@ function readyRules(value, ctx) {
157
200
  if (!value.bug[field].trim()) add(`bug.${field}`, ["bug", field], `Describe the bug's ${field}.`);
158
201
  }
159
202
  }
203
+ if (value.epic || value.builder === void 0) return;
204
+ if (!(value.decisions ?? []).some((item) => item.trim()))
205
+ add("decisions", ["decisions"], `Record each choice the builder must not reopen. ${SKILL_HINT}`);
206
+ const entries = value.surface ?? [];
207
+ if (!entries.length || entries.some((entry) => !entry.path.trim()))
208
+ add("surface", ["surface"], `List every path to change, each with a path and its change. ${SKILL_HINT}`);
209
+ const examples = value.acceptanceCriteria.flatMap((ac) => ac.examples ?? []);
210
+ if (!examples.length)
211
+ add("examples", ["acceptanceCriteria"], `Give each criterion examples (input and expected). ${SKILL_HINT}`);
212
+ else if (!examples.some((example) => example.failure === true))
213
+ add(
214
+ "examples.failure",
215
+ ["acceptanceCriteria"],
216
+ `Add one example marked failure: true for what must be refused or must fail. ${SKILL_HINT}`
217
+ );
218
+ if (!(value.proof ?? []).some((item) => item.trim()))
219
+ add("proof", ["proof"], `List the commands to run in order, focused first. ${SKILL_HINT}`);
220
+ }
221
+ const LOCAL_PATH = /\.local\/|\/Users\/|~\//u;
222
+ const CONTRACT_WORD_LIMIT = 400;
223
+ function readyWriteRules(issue) {
224
+ if (issue.draft) return [];
225
+ const results = [];
226
+ if (!issue.epic && !(issue.priorWork ?? []).some((item) => item.trim()))
227
+ results.push(
228
+ hint(
229
+ "priorWork",
230
+ "priorWork",
231
+ "List each search you ran for earlier work on this question and what it found, or 'none found' with the searches."
232
+ )
233
+ );
234
+ for (const [field, text] of stringEntries(issue)) {
235
+ const match = LOCAL_PATH.exec(text);
236
+ if (match)
237
+ results.push(
238
+ hint(
239
+ "local-path",
240
+ field,
241
+ `${field} cites a local path (${match[0]}); put that evidence on the issue as a comment or artifact and link it instead.`
242
+ )
243
+ );
244
+ }
245
+ const { outcome, surface, acceptanceCriteria, proof, priorWork } = issue;
246
+ const words = stringEntries({ outcome, surface, acceptanceCriteria, proof, priorWork }).flatMap(([, text]) => text.split(/\s+/u)).filter(Boolean).length;
247
+ if (words > CONTRACT_WORD_LIMIT)
248
+ results.push(
249
+ hint(
250
+ "contract-words",
251
+ "contract",
252
+ `The contract (outcome, files, acceptance, tests, prior work) is ${String(words)} words; keep it to 400 and move evidence to a comment or artifact.`
253
+ )
254
+ );
255
+ return results;
160
256
  }
161
257
  const ReadyIssue = IssueFields.extend({
162
258
  title: Text.min(10).max(80),
@@ -186,6 +282,13 @@ const IssueWriteFields = {
186
282
  openQuestions: IssueFields.shape.openQuestions.removeDefault().optional(),
187
283
  context: IssueFields.shape.context.removeDefault().optional(),
188
284
  bug: IssueFields.shape.bug,
285
+ builder: IssueFields.shape.builder,
286
+ extends: IssueFields.shape.extends,
287
+ priorWork: IssueFields.shape.priorWork,
288
+ decisions: IssueFields.shape.decisions,
289
+ surface: IssueFields.shape.surface,
290
+ fences: IssueFields.shape.fences,
291
+ proof: IssueFields.shape.proof,
189
292
  draft: IssueFields.shape.draft.removeDefault().optional(),
190
293
  retainLegacyBody: IssueFields.shape.retainLegacyBody
191
294
  };
@@ -234,10 +337,24 @@ class IssueValidationError extends DeliveryError {
234
337
  }
235
338
  failures;
236
339
  }
237
- function requireIssue(value) {
340
+ function requireIssue(value, options = {}) {
238
341
  const structural = IssueFields.safeParse(value);
239
342
  const result = validateIssue(value, !structural.success || !structural.data.draft);
240
- if (!result.issue) throw new IssueValidationError(result.failures);
343
+ const gated = options.requireBuilder === true && structural.success && !structural.data.draft;
344
+ const unbuilt = gated && !structural.data.epic && structural.data.builder === void 0;
345
+ const writeFailures = gated ? readyWriteRules(structural.data) : [];
346
+ if (!result.issue || unbuilt || writeFailures.length)
347
+ throw new IssueValidationError([
348
+ ...unbuilt ? [
349
+ hint(
350
+ "builder.missing",
351
+ "builder",
352
+ `Add builder, decisions, surface, proof and examples, or pass draft: true to capture it now. ${SKILL_HINT}`
353
+ )
354
+ ] : [],
355
+ ...result.failures,
356
+ ...writeFailures
357
+ ]);
241
358
  return result.issue;
242
359
  }
243
360
  const escapeStatus = (value) => value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replace(/[\\`*_[\]]/gu, "\\$&");
@@ -246,6 +363,7 @@ function renderIssueBody(value, status, legacyFormatting = false) {
246
363
  const item = DraftIssue.parse(value);
247
364
  if (status !== void 0) requireIssueStatus(IssueStatus, status);
248
365
  const list = (values) => values.length ? values.map((v) => `- ${v}`).join("\n") : "(none)";
366
+ const bulletSection = (title, values) => values?.length ? [`## ${title}`, list(values)] : [];
249
367
  const parts = [
250
368
  ISSUE_BODY_MARKER,
251
369
  "## Status",
@@ -259,12 +377,27 @@ function renderIssueBody(value, status, legacyFormatting = false) {
259
377
  "## Outcome",
260
378
  item.outcome,
261
379
  ...item.deferral === void 0 ? [] : ["## Deferral", `Deferred: ${JSON.stringify(item.deferral)}`],
380
+ ...item.builder === void 0 ? [] : ["## Builder", item.builder.tier === "standard" ? "standard" : `frontier: ${item.builder.reason}`],
381
+ ...bulletSection("Extends", item.extends),
382
+ ...bulletSection("Prior work", item.priorWork),
383
+ ...bulletSection("Decisions", item.decisions),
262
384
  "## Acceptance criteria",
263
385
  item.acceptanceCriteria.map(
264
- (ac) => legacyFormatting ? `- [ ] ${ac.behavior}
386
+ (ac) => (legacyFormatting ? `- [ ] ${ac.behavior}
265
387
  Verified by: ${ac.verifiedBy}` : `- [ ] ${ac.behavior.replace(/\n/gu, "\n ")}${ac.behavior.includes("\n") ? "\n" : ""}
266
- Verified by: ${ac.verifiedBy.replace(/\n/gu, "\n ")}`
388
+ Verified by: ${ac.verifiedBy.replace(/\n/gu, "\n ")}`) + (ac.examples ?? []).map(
389
+ (example) => `
390
+ Example: ${example.input.replace(/\n/gu, "\n ")} \u2192 ${example.expected.replace(/\n/gu, "\n ")}${example.failure === true ? " (failure)" : ""}`
391
+ ).join("")
267
392
  ).join("\n"),
393
+ ...item.surface?.length ? [
394
+ "## Surface",
395
+ item.surface.map(
396
+ (entry) => [`- ${entry.change} \`${entry.path}\``, ...(entry.signatures ?? []).map((sig) => ` ${sig}`)].join("\n")
397
+ ).join("\n")
398
+ ] : [],
399
+ ...bulletSection("Fences", item.fences),
400
+ ...bulletSection("Proof", item.proof),
268
401
  "## Out of scope",
269
402
  list(item.outOfScope),
270
403
  "## Open questions",
@@ -392,28 +525,55 @@ function parseIssueBody(body, metadata) {
392
525
  if (!converted.issue) throw new IssueValidationError(converted.failures);
393
526
  return { issue: converted.issue, legacy: true };
394
527
  }
395
- function issueWarnings(issue, status, legacyFormatting = false) {
528
+ const CODE_EXTENSIONS = /\.(?:ts|tsx|js|mjs|cjs|py|go|rs|java|kt|rb|sql|sh)$/iu;
529
+ const proseWords = (issue) => [issue.problem, issue.outcome, ...issue.acceptanceCriteria.map((ac) => ac.behavior)].flatMap((text) => text.split(/\s+/u)).filter(Boolean).length;
530
+ function issueWarnings(issue) {
396
531
  const warnings = [];
532
+ const warn = (code, field, message) => {
533
+ warnings.push(hint(code, field, message));
534
+ };
397
535
  if (issue.acceptanceCriteria.length > 7)
398
- warnings.push(
399
- hint("many-criteria", "acceptanceCriteria", "Consider slicing more than seven criteria into smaller issues.")
400
- );
401
- if (!issue.acceptanceCriteria.some(
536
+ warn("many-criteria", "acceptanceCriteria", "Consider slicing more than seven criteria into smaller issues.");
537
+ if (issue.builder === void 0 && !issue.acceptanceCriteria.some(
402
538
  (ac) => /\b(?:edge|failure|fail|error|invalid|reject|refus|empty|missing|interrupt|timeout|boundary)/iu.test(ac.behavior)
403
539
  ))
404
- warnings.push(hint("edge-case", "acceptanceCriteria", "Describe an edge or failure case."));
540
+ warn("edge-case", "acceptanceCriteria", "Describe an edge or failure case.");
405
541
  if (issue.issueType?.toLowerCase() === "bug" && !issue.acceptanceCriteria.some((ac) => /regression/iu.test(ac.behavior + " " + ac.verifiedBy)))
406
- warnings.push(hint("bug.regression", "acceptanceCriteria", "Add a regression test criterion for the bug."));
407
- if (![...issue.context.files, ...issue.context.components].some((item) => item.trim()))
408
- warnings.push(hint("context", "context", "Name relevant components or files."));
409
- const proofs = [...issue.context.evidence, ...issue.acceptanceCriteria.map((ac) => ac.verifiedBy)];
410
- if (proofs.length && proofs.every((proof) => /^(?:\/|[A-Za-z]:\\|~\/)/u.test(proof.trim())))
411
- warnings.push(
412
- hint("local-evidence", "context.evidence", "Use portable evidence in addition to machine-local paths.")
542
+ warn("bug.regression", "acceptanceCriteria", "Add a regression test criterion for the bug.");
543
+ if (issue.builder === void 0 && ![...issue.context.files, ...issue.context.components].some((item) => item.trim()))
544
+ warn("context", "context", "Name relevant components or files.");
545
+ warnings.push(...readyWriteRules(issue));
546
+ if (proseWords(issue) > 300)
547
+ warn("body.length", "body", `Consider cutting the problem, outcome and criteria to 300 words. ${SKILL_HINT}`);
548
+ if (issue.draft || issue.epic) return warnings;
549
+ if (issue.builder === void 0) {
550
+ warn(
551
+ "builder.unset",
552
+ "builder",
553
+ `Set builder, decisions, surface, proof and examples when next editing. ${SKILL_HINT}`
554
+ );
555
+ return warnings;
556
+ }
557
+ if (issue.points !== void 0 && issue.points > 5)
558
+ warn("size.points", "points", `Consider splitting an issue above 5 points. ${SKILL_HINT}`);
559
+ const entries = issue.surface ?? [];
560
+ if (new Set(entries.map((entry) => entry.path.trim())).size > 6)
561
+ warn("size.surface", "surface", `Consider splitting an issue that changes more than 6 paths. ${SKILL_HINT}`);
562
+ if (issue.acceptanceCriteria.some((ac) => !ac.examples?.length))
563
+ warn("examples.ac", "acceptanceCriteria", `Give every criterion at least one example. ${SKILL_HINT}`);
564
+ const unsigned = entries.filter(
565
+ (entry) => entry.change !== "delete" && CODE_EXTENSIONS.test(entry.path.trim()) && !/\.test\.|\.spec\.|\/test/u.test(entry.path) && !entry.signatures?.some((signature) => signature.trim())
566
+ );
567
+ if (unsigned.length)
568
+ warn(
569
+ "surface.signature",
570
+ "surface",
571
+ `Add exact signatures for ${unsigned.map((entry) => entry.path).join(", ")}. ${SKILL_HINT}`
413
572
  );
414
- const body = renderIssueBody(issue, status, legacyFormatting);
415
- if (body.slice(0, body.lastIndexOf(DATA_PREFIX)).length > 4e3)
416
- warnings.push(hint("body.length", "body", "Consider reducing a readable body over 4,000 characters."));
573
+ if (!(issue.fences ?? []).some((item) => item.trim()))
574
+ warn("fences", "fences", `Name the nearby paths the builder must not touch. ${SKILL_HINT}`);
575
+ if (!(issue.extends ?? []).some((item) => item.trim()))
576
+ warn("extends", "extends", `Name the design or owner this change extends; add no parallel path. ${SKILL_HINT}`);
417
577
  return warnings;
418
578
  }
419
579
  function issueBodyDiff(before, after) {
@@ -425,14 +585,17 @@ function issueBodyDiff(before, after) {
425
585
  ].join("\n");
426
586
  }
427
587
  export {
588
+ BuilderTier,
428
589
  CreateIssueStatus,
429
590
  DraftIssue,
591
+ FrontierReason,
430
592
  ISSUE_BODY_MARKER,
431
593
  ISSUE_COMMENT_BODY_LIMIT,
432
594
  ISSUE_CONTRACT_VERSION,
433
595
  ISSUE_JSON_SCHEMAS,
434
596
  IssueDeferral,
435
597
  IssueDeferralPatch,
598
+ IssueExample,
436
599
  IssueFields,
437
600
  IssueStatusPatch,
438
601
  IssueValidationError,
@@ -440,6 +603,7 @@ export {
440
603
  IssueWriteSchema,
441
604
  ProjectStatusPatch,
442
605
  ReadyIssue,
606
+ SurfaceEntry,
443
607
  acceptedKeysError,
444
608
  issueBodyDiff,
445
609
  issueInputSchema,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/issueContract.ts"],
4
- "sourcesContent": ["import { z } from 'zod';\nimport { DeliveryError } from './errors.js';\n\nexport const ISSUE_CONTRACT_VERSION = 'ai-delivery.issue@1' as const;\nexport const ISSUE_BODY_MARKER = '<!-- ai-delivery:issue@1 -->';\nconst DATA_PREFIX = '<!-- ai-delivery:issue-data@1 ';\nconst START_FOOTER =\n /\\n\\n<!-- ai-delivery-start-intent: sha256:[a-f0-9]{64} -->\\n<!-- ai-delivery-start: sha256:[a-f0-9]{64} -->$/u;\nexport function issueStartFooter(body: string): string {\n return START_FOOTER.exec(body)?.[0] ?? '';\n}\nconst CREATE_FOOTER = /\\n\\n<!-- ai-delivery-create: sha256:[a-f0-9]{64} intent: sha256:[a-f0-9]{64} -->$/u;\nexport function issueTrackingFooter(body: string): string {\n return CREATE_FOOTER.exec(body)?.[0] ?? issueStartFooter(body);\n}\nconst Text = z.string();\nconst Strings = z.array(Text);\nconst AcceptanceCriterion = z.strictObject({ behavior: Text, verifiedBy: Text });\nexport const IssueDeferral = z.strictObject({\n until: z.iso.date().optional(),\n trigger: z.string().trim().min(1).max(2000).optional(),\n});\nexport type IssueDeferralData = z.infer<typeof IssueDeferral>;\nexport const IssueDeferralPatch = {\n defer: IssueDeferral.optional(),\n undefer: z.literal(true).optional(),\n};\n\nexport function requireDeferralPatch(value: { defer?: IssueDeferralData; undefer?: true }): void {\n const parsed = z.strictObject(IssueDeferralPatch).safeParse(value);\n if (!parsed.success || (value.defer !== undefined && value.undefer !== undefined))\n throw new DeliveryError('Choose a valid defer condition or explicit undefer, never both.');\n}\n\n/** Drafts permit incomplete requirements, but never secret-bearing public content. */\nexport const IssueFields = z.strictObject({\n title: Text.describe(\n 'Ready issues need 10\u201380 characters naming the specific change, with no \"Bug:\" or \"[Task]\" prefix.',\n ),\n issueType: Text.optional(),\n points: z\n .number()\n .int()\n .optional()\n .describe(\"Ready non-epic issues need Points 1\u20138 from the Points field's options (usually 1, 2, 3, 5 or 8).\"),\n epic: z.literal(true).optional(),\n problem: Text.default(''),\n outcome: Text.default(''),\n acceptanceCriteria: z.array(AcceptanceCriterion).default([]),\n outOfScope: Strings.default([]),\n openQuestions: Strings.default([]),\n context: z\n .strictObject({ components: Strings.default([]), files: Strings.default([]), evidence: Strings.default([]) })\n .default({ components: [], files: [], evidence: [] }),\n bug: z\n .strictObject({ steps: Strings, expected: Text, actual: Text, reproducibility: Text, environment: Text })\n .optional()\n .describe('Ready Bug issues need non-empty steps, expected, actual, reproducibility and environment.'),\n draft: z.boolean().default(false),\n deferral: IssueDeferral.optional(),\n legacyBody: Text.optional(),\n retainLegacyBody: z.boolean().optional(),\n});\n\nconst StatusText = z\n .string()\n .trim()\n .min(1)\n .refine((value) => !/[\\r\\n]/u.test(value), 'Use one status line.');\nexport const CreateIssueStatus = z.strictObject({ nextMilestone: StatusText.optional() });\nexport const IssueStatusPatch = CreateIssueStatus.extend({\n blockers: StatusText.optional(),\n latestJournal: StatusText.optional(),\n});\nexport const ISSUE_COMMENT_BODY_LIMIT = 65_536;\nexport const ProjectStatusPatch = z\n .strictObject({\n status: z.enum(['Todo', 'In Progress', 'Blocked', 'Done']),\n reason: z.string().trim().min(1),\n })\n .superRefine((value, ctx) => {\n if (`Requested Project Status: ${value.status}.\\n\\n${value.reason}`.length > ISSUE_COMMENT_BODY_LIMIT)\n ctx.addIssue({\n code: 'custom',\n path: ['reason'],\n message: 'Shorten the public reason to fit the issue comment limit.',\n });\n if (secrets(value))\n ctx.addIssue({\n code: 'custom',\n path: ['reason'],\n message: 'Remove credentials and private keys from the public reason.',\n });\n });\nexport type ProjectStatusPatchData = z.infer<typeof ProjectStatusPatch>;\n\nconst IssueStatus = z.strictObject({\n state: z.enum(['Ready', 'Draft']),\n lastUpdated: z.iso.datetime(),\n nextMilestone: StatusText,\n blockers: StatusText,\n latestJournal: StatusText,\n});\nexport type IssueStatusData = z.infer<typeof IssueStatus>;\n\nexport function requireIssueStatus<T extends z.ZodType>(schema: T, value: unknown): z.output<T> {\n const result = schema.safeParse(value);\n if (!result.success) throw new IssueValidationError(issueDiagnostics(result.error.issues));\n if (secrets(result.data))\n throw new IssueValidationError([\n hint('secrets', 'status', 'Remove credentials and private keys from public status fields.'),\n ]);\n return result.data;\n}\n\nexport interface IssueDiagnostic {\n code: string;\n field: string;\n fixHint: string;\n message: string;\n}\nconst hint = (code: string, field: string, fixHint: string): IssueDiagnostic => ({\n code,\n field,\n fixHint,\n message: fixHint,\n});\n\nfunction secrets(value: unknown): boolean {\n const strings = (item: unknown): string[] =>\n typeof item === 'string'\n ? [item]\n : Array.isArray(item)\n ? item.flatMap(strings)\n : item !== null && typeof item === 'object'\n ? Object.values(item).flatMap(strings)\n : [];\n const text = strings(value).join('\\n');\n return /(?:-----BEGIN (?:RSA |EC |OPENSSH )?PRIVATE KEY-----|\\b(?:gh[pousr]_[A-Za-z0-9]{20,}|github_pat_[A-Za-z0-9_]{20,}|sk-(?:proj-)?[A-Za-z0-9_-]{20,}|AKIA[A-Z0-9]{16})\\b|\\b(?:password|secret|api[_-]?key|access[_-]?token)\\s*[=:]\\s*[\"']?(?!<|\\$|redacted\\b|placeholder\\b)[A-Za-z0-9_+/-]{8,})/iu.test(\n text,\n );\n}\n\nfunction secretRule(value: z.output<typeof IssueFields>, ctx: z.RefinementCtx): void {\n if (secrets(value))\n ctx.addIssue({\n code: 'custom',\n path: ['body'],\n message: 'Remove credentials and private keys from public issue fields.',\n params: { issueCode: 'secrets' },\n });\n}\n\nexport const DraftIssue = IssueFields.superRefine(secretRule);\nexport type DraftIssueData = z.output<typeof DraftIssue>;\nexport type IssueFieldsInput = z.input<typeof IssueFields>;\n\nfunction readyRules(value: DraftIssueData, ctx: z.RefinementCtx): void {\n const add = (code: string, field: (string | number)[], fixHint: string): void =>\n ctx.addIssue({ code: 'custom', path: field, message: fixHint, params: { issueCode: code } });\n if (value.draft) add('draft', ['draft'], 'Resolve the draft fields and set draft to false before starting work.');\n if (!value.epic && (value.points === undefined || value.points < 1 || value.points > 8))\n add('points', ['points'], 'Choose Points from 1 through 8; split a 13-point issue into sub-issues.');\n if (\n value.title.trim().length < 10 ||\n !/[\\p{L}]/u.test(value.title) ||\n /^(?:fix|bug|task|feature|update|improve|test|issue|work)(?:\\s+(?:it|this|stuff|things|issue))?[.!]?$/iu.test(\n value.title.trim(),\n )\n )\n add('title.specific', ['title'], 'Name the specific behavior or component that changes.');\n if (value.title.length > 80) add('title.length', ['title'], 'Shorten the title to at most 80 characters.');\n if (/^\\s*(?:\\[\\s*(?:bug|feature|task)\\s*\\]|(?:bug|feature|task)\\s*:)/iu.test(value.title))\n add('title.prefix', ['title'], 'Remove the issue-type prefix; use the native Issue Type field.');\n for (const field of ['problem', 'outcome'] as const)\n if (!value[field].trim()) add(field, [field], `Describe the ${field} in concrete terms.`);\n if (!value.acceptanceCriteria.length)\n add('acceptance-criteria', ['acceptanceCriteria'], 'Add an observable behavior and how it will be verified.');\n value.acceptanceCriteria.forEach((ac, index) => {\n if (!ac.behavior.trim() || !ac.verifiedBy.trim())\n add(\n 'acceptance-criteria.fields',\n ['acceptanceCriteria', index],\n 'Provide both behavior and verifiedBy for this criterion.',\n );\n if (\n /^(?:.{1,100}\\s)?(?:works(?:\\s+(?:correctly|as expected|well|properly))?|(?:is|are)\\s+(?:done|verified|reviewed|robust|seamless|appropriate|user[- ]friendly))[\\s.!]*$/iu.test(\n ac.behavior,\n ) ||\n ac.behavior.trim().length < 12\n )\n add(\n 'acceptance-criteria.vague',\n ['acceptanceCriteria', index, 'behavior'],\n 'Replace vague wording with an observable input and result.',\n );\n });\n if (!value.outOfScope.some((item) => item.trim()))\n add('out-of-scope', ['outOfScope'], 'Name at least one explicit non-goal.');\n if (value.openQuestions.length)\n add('open-questions', ['openQuestions'], 'Resolve each open question before marking the issue Ready.');\n if (value.issueType?.toLowerCase() === 'bug') {\n if (!value.bug)\n add('bug', ['bug'], 'Include steps, expected and actual results, reproducibility, and environment.');\n else {\n if (!value.bug.steps.length || value.bug.steps.some((step) => !step.trim()))\n add('bug.steps', ['bug', 'steps'], 'Provide nonempty ordered reproduction steps.');\n for (const field of ['expected', 'actual', 'reproducibility', 'environment'] as const)\n if (!value.bug[field].trim()) add(`bug.${field}`, ['bug', field], `Describe the bug's ${field}.`);\n }\n }\n}\n\nexport const ReadyIssue = IssueFields.extend({\n title: Text.min(10).max(80),\n points: z.number().int().min(1).max(8).optional(),\n problem: Text.min(1),\n outcome: Text.min(1),\n acceptanceCriteria: z.array(AcceptanceCriterion).min(1),\n outOfScope: Strings.min(1),\n openQuestions: Strings.max(0).default([]),\n draft: z.literal(false).default(false),\n})\n .superRefine(secretRule)\n .superRefine(readyRules)\n .meta({ anyOf: [{ properties: { epic: { const: true } }, required: ['epic'] }, { required: ['points'] }] });\nexport type ReadyIssueData = z.output<typeof ReadyIssue>;\nconst ReadySemantics = IssueFields.superRefine(secretRule).superRefine(readyRules);\n/** Portable structural schemas; semantic refinements are enforced by the write/readiness boundary. */\nexport const ISSUE_JSON_SCHEMAS = {\n version: ISSUE_CONTRACT_VERSION,\n draft: z.toJSONSchema(DraftIssue),\n ready: z.toJSONSchema(ReadyIssue),\n};\n\n/** Patch fields share the canonical validators but deliberately have no defaults. */\nexport const IssueWriteFields = {\n title: IssueFields.shape.title.optional(),\n issueType: IssueFields.shape.issueType,\n points: IssueFields.shape.points,\n epic: IssueFields.shape.epic,\n problem: IssueFields.shape.problem.removeDefault().optional(),\n outcome: IssueFields.shape.outcome.removeDefault().optional(),\n acceptanceCriteria: IssueFields.shape.acceptanceCriteria.removeDefault().optional(),\n outOfScope: IssueFields.shape.outOfScope.removeDefault().optional(),\n openQuestions: IssueFields.shape.openQuestions.removeDefault().optional(),\n context: IssueFields.shape.context.removeDefault().optional(),\n bug: IssueFields.shape.bug,\n draft: IssueFields.shape.draft.removeDefault().optional(),\n retainLegacyBody: IssueFields.shape.retainLegacyBody,\n};\nexport const IssueWriteSchema = z.strictObject(IssueWriteFields);\n\n/** Keep advertised structural schemas while returning domain diagnostics before SDK error wrapping. */\nexport function issueInputSchema<T extends z.ZodObject>(schema: T): T {\n return schema.refine(() => true, {\n when: ({ issues }) => {\n // Parsed values have already lost unknown keys. Preserve the original structural failures.\n if (issues.length) throw new IssueValidationError(issueDiagnostics(issues));\n return true;\n },\n });\n}\n\n/** One refusal for unknown keys on every tool: list what is accepted, never echo the unknown key (#140). */\nexport function acceptedKeysError(issue: z.core.$ZodRawIssue): string | undefined {\n if (issue.code !== 'unrecognized_keys') return undefined;\n const shape = (issue.inst as z.ZodObject | undefined)?.shape;\n return shape === undefined ? undefined : `Unknown argument key. Accepted keys: ${Object.keys(shape).join(', ')}.`;\n}\n\nfunction issueDiagnostics(issues: readonly (z.core.$ZodIssue | z.core.$ZodRawIssue)[]): IssueDiagnostic[] {\n const seen = new Set<string>();\n return issues\n .map((issue) => {\n const field = (issue.path ?? []).map(String).join('.') || 'issue';\n const code =\n issue.code === 'custom' && typeof issue.params?.issueCode === 'string'\n ? issue.params.issueCode\n : field === 'points'\n ? 'points'\n : field === 'title'\n ? 'title.length'\n : field === 'outOfScope'\n ? 'out-of-scope'\n : field === 'openQuestions'\n ? 'open-questions'\n : field === 'acceptanceCriteria'\n ? 'acceptance-criteria'\n : field === 'draft'\n ? 'draft'\n : issue.code === 'unrecognized_keys'\n ? 'field.unknown'\n : 'field.type';\n return hint(\n code,\n field,\n code === 'points'\n ? 'Choose Points from 1 through 8; split a 13-point issue into sub-issues.'\n : issue.code === 'unrecognized_keys'\n ? (acceptedKeysError(issue as z.core.$ZodRawIssue) ?? 'Remove unrecognized fields from ' + field + '.')\n : (issue.message ??\n (issue.code === 'invalid_type'\n ? 'Provide a valid ' + issue.expected + ' value.'\n : 'Provide a value satisfying the declared issue field schema.')),\n );\n })\n .filter((issue) => {\n const key = issue.code + ':' + issue.field;\n if (seen.has(key)) return false;\n seen.add(key);\n return true;\n });\n}\n\nexport function validateIssue(value: unknown, ready = true): { issue?: DraftIssueData; failures: IssueDiagnostic[] } {\n const parsed = (ready ? ReadyIssue : DraftIssue).safeParse(value);\n if (parsed.success) return { issue: parsed.data, failures: [] };\n const semantic = ready ? ReadySemantics.safeParse(value) : undefined;\n const issues = [...(semantic?.success === false ? semantic.error.issues : []), ...parsed.error.issues];\n return { failures: issueDiagnostics(issues) };\n}\n\nexport class IssueValidationError extends DeliveryError {\n constructor(readonly failures: IssueDiagnostic[]) {\n super(JSON.stringify({ contract: ISSUE_CONTRACT_VERSION, failures }));\n }\n}\n\nexport function requireIssue(value: unknown): DraftIssueData {\n const structural = IssueFields.safeParse(value);\n const result = validateIssue(value, !structural.success || !structural.data.draft);\n if (!result.issue) throw new IssueValidationError(result.failures);\n return result.issue;\n}\n\nconst escapeStatus = (value: string): string =>\n value\n .replaceAll('&', '&amp;')\n .replaceAll('<', '&lt;')\n .replaceAll('>', '&gt;')\n .replace(/[\\\\`*_[\\]]/gu, '\\\\$&');\nconst unescapeStatus = (value: string): string =>\n value\n .replace(/\\\\([\\\\`*_[\\]])/gu, '$1')\n .replaceAll('&lt;', '<')\n .replaceAll('&gt;', '>')\n .replaceAll('&amp;', '&');\n\nexport function renderIssueBody(value: DraftIssueData, status?: IssueStatusData, legacyFormatting = false): string {\n const item = DraftIssue.parse(value);\n if (status !== undefined) requireIssueStatus(IssueStatus, status);\n const list = (values: string[]): string => (values.length ? values.map((v) => `- ${v}`).join('\\n') : '(none)');\n const parts = [\n ISSUE_BODY_MARKER,\n '## Status',\n status === undefined\n ? item.draft\n ? 'Draft \u2014 parked; not ready to work.'\n : 'Ready'\n : `- **State:** ${status.state}\\n- **Last updated:** ${status.lastUpdated} UTC\\n- **Next milestone:** ${escapeStatus(status.nextMilestone)}\\n- **Blockers:** ${escapeStatus(status.blockers)}\\n- **Latest journal:** ${escapeStatus(status.latestJournal)}`,\n '## Problem',\n item.problem,\n '## Outcome',\n item.outcome,\n ...(item.deferral === undefined ? [] : ['## Deferral', `Deferred: ${JSON.stringify(item.deferral)}`]),\n '## Acceptance criteria',\n item.acceptanceCriteria\n .map((ac) =>\n legacyFormatting\n ? `- [ ] ${ac.behavior}\\n Verified by: ${ac.verifiedBy}`\n : `- [ ] ${ac.behavior.replace(/\\n/gu, '\\n ')}${ac.behavior.includes('\\n') ? '\\n' : ''}\\n Verified by: ${ac.verifiedBy.replace(/\\n/gu, '\\n ')}`,\n )\n .join('\\n'),\n '## Out of scope',\n list(item.outOfScope),\n '## Open questions',\n list(item.openQuestions),\n '## Context',\n `Components:\\n${list(item.context.components)}\\n\\nFiles:\\n${list(item.context.files)}\\n\\nEvidence:\\n${list(item.context.evidence)}`,\n ];\n if (item.bug)\n parts.push(\n '## Bug',\n `Steps:\\n${list(item.bug.steps)}\\n\\nExpected: ${item.bug.expected}\\n\\nActual: ${item.bug.actual}\\n\\nReproducibility: ${item.bug.reproducibility}\\n\\nEnvironment: ${item.bug.environment}`,\n );\n if (item.legacyBody !== undefined && item.retainLegacyBody !== false)\n parts.push('## Preserved legacy body', item.legacyBody);\n // Escape comment delimiters without altering decoded data. Exact render equality detects human/payload divergence.\n parts.push(`${DATA_PREFIX}${JSON.stringify(item).replaceAll('<', '\\\\u003c').replaceAll('>', '\\\\u003e')} -->`);\n return parts.join('\\n\\n') + '\\n';\n}\n\nfunction section(body: string, names: string[]): string {\n const lines = body.split(/\\r?\\n/u);\n const start = lines.findIndex((line) =>\n names.includes(\n line\n .replace(/^#{1,6}\\s+/u, '')\n .trim()\n .toLowerCase(),\n ),\n );\n if (start < 0) return '';\n const end = lines.findIndex((line, index) => index > start && /^#{1,6}\\s/u.test(line));\n return lines\n .slice(start + 1, end < 0 ? undefined : end)\n .join('\\n')\n .trim();\n}\n\nconst REBUILD_HINT =\n 'The issue body was edited outside ai-delivery; send problem, outcome, acceptanceCriteria and outOfScope (plus bug for a Bug, epic for an epic, and any draft, openQuestions or context to keep) in one issue_update to rebuild it.';\n\n/** Lenient conversion retains every legacy byte, and never invents verification or bug evidence. */\nexport function parseIssueBody(\n body: string,\n metadata: { title: string; points?: number; issueType?: string },\n): { issue: DraftIssueData; legacy: boolean; status?: IssueStatusData; legacyFormatting?: boolean } {\n if (body.trimStart().startsWith(ISSUE_BODY_MARKER)) {\n const start = body.lastIndexOf(DATA_PREFIX);\n const end = body.indexOf(' -->', start);\n if (start < 0 || end < 0) throw new IssueValidationError([hint('body.canonical', 'body', REBUILD_HINT)]);\n let decoded: unknown;\n try {\n decoded = JSON.parse(body.slice(start + DATA_PREFIX.length, end));\n } catch {\n throw new IssueValidationError([hint('body.canonical', 'body', REBUILD_HINT)]);\n }\n const result = validateIssue(decoded, false);\n if (!result.issue) throw new IssueValidationError(result.failures);\n const displayed = body.slice((ISSUE_BODY_MARKER + '\\n\\n## Status\\n\\n').length, body.indexOf('\\n\\n## Problem\\n\\n'));\n let status: IssueStatusData | undefined;\n if (displayed !== 'Ready' && displayed !== 'Draft \u2014 parked; not ready to work.') {\n const match =\n /^- \\*\\*State:\\*\\* (Ready|Draft)\\n- \\*\\*Last updated:\\*\\* (\\S+) UTC\\n- \\*\\*Next milestone:\\*\\* ([^\\r\\n]+)\\n- \\*\\*Blockers:\\*\\* ([^\\r\\n]+)\\n- \\*\\*Latest journal:\\*\\* ([^\\r\\n]+)$/u.exec(\n displayed,\n );\n if (!match)\n throw new IssueValidationError([\n hint('body.canonical', 'status', 'Restore the complete unambiguous status block.'),\n ]);\n status = requireIssueStatus(IssueStatus, {\n state: match[1],\n lastUpdated: match[2],\n nextMilestone: unescapeStatus(match[3]!),\n blockers: unescapeStatus(match[4]!),\n latestJournal: unescapeStatus(match[5]!),\n });\n if (status.state !== (result.issue.draft ? 'Draft' : 'Ready'))\n throw new IssueValidationError([\n hint('body.canonical', 'status', 'Status state must agree with the typed draft field.'),\n ]);\n }\n const footer = issueTrackingFooter(body);\n const canonical = footer ? body.slice(0, -footer.length) : body;\n const legacyFormatting = renderIssueBody(result.issue, status) !== canonical;\n if (\n (legacyFormatting && renderIssueBody(result.issue, status, true) !== canonical) ||\n result.issue.title !== metadata.title\n )\n throw new IssueValidationError([hint('body.canonical', 'body', REBUILD_HINT)]);\n return {\n issue: result.issue,\n legacy: false,\n ...(status === undefined ? {} : { status }),\n ...(legacyFormatting ? { legacyFormatting: true } : {}),\n };\n }\n const verification = section(body, ['verification', 'validation', 'tests']);\n const acText = section(body, ['acceptance criteria', 'acceptance']);\n const acceptanceCriteria = acText.split(/\\n(?=\\s*[-*+]\\s+\\[[ xX]\\])/u).flatMap((block) => {\n const match = /^\\s*[-*+]\\s+\\[[ xX]\\]\\s+([\\s\\S]+)/u.exec(block);\n if (!match) return [];\n const [behavior = '', verifiedBy = verification] = match[1]!.split(/\\n\\s*(?:Verified by:|Verified by)\\s*/iu);\n return [{ behavior: behavior.trim(), verifiedBy: verifiedBy.trim() }];\n });\n const items = (s: string): string[] =>\n s\n .split(/\\r?\\n/u)\n .map((line) => line.replace(/^\\s*[-*+]\\s+/u, '').trim())\n .filter(Boolean);\n const scope = section(body, ['scope', 'context']);\n const bug =\n metadata.issueType?.toLowerCase() === 'bug'\n ? {\n steps: items(section(body, ['steps', 'steps to reproduce'])),\n expected: section(body, ['expected', 'expected results']),\n actual: section(body, ['actual', 'actual results']),\n reproducibility: section(body, ['reproducibility']),\n environment: section(body, ['environment']),\n }\n : undefined;\n const converted = validateIssue(\n {\n ...metadata,\n problem: section(body, ['problem']),\n outcome: section(body, ['outcome']),\n acceptanceCriteria,\n outOfScope: items(section(body, ['out of scope', 'non-goals'])),\n openQuestions: items(section(body, ['open questions'])),\n context: { components: [], files: scope ? [scope] : [], evidence: verification ? [verification] : [] },\n ...(bug === undefined ? {} : { bug }),\n draft: /^draft\\b/iu.test(section(body, ['status'])),\n legacyBody: body,\n },\n false,\n );\n if (!converted.issue) throw new IssueValidationError(converted.failures);\n return { issue: converted.issue, legacy: true };\n}\n\nexport function issueWarnings(\n issue: DraftIssueData,\n status?: IssueStatusData,\n legacyFormatting = false,\n): IssueDiagnostic[] {\n const warnings: IssueDiagnostic[] = [];\n if (issue.acceptanceCriteria.length > 7)\n warnings.push(\n hint('many-criteria', 'acceptanceCriteria', 'Consider slicing more than seven criteria into smaller issues.'),\n );\n if (\n !issue.acceptanceCriteria.some((ac) =>\n /\\b(?:edge|failure|fail|error|invalid|reject|refus|empty|missing|interrupt|timeout|boundary)/iu.test(ac.behavior),\n )\n )\n warnings.push(hint('edge-case', 'acceptanceCriteria', 'Describe an edge or failure case.'));\n if (\n issue.issueType?.toLowerCase() === 'bug' &&\n !issue.acceptanceCriteria.some((ac) => /regression/iu.test(ac.behavior + ' ' + ac.verifiedBy))\n )\n warnings.push(hint('bug.regression', 'acceptanceCriteria', 'Add a regression test criterion for the bug.'));\n if (![...issue.context.files, ...issue.context.components].some((item) => item.trim()))\n warnings.push(hint('context', 'context', 'Name relevant components or files.'));\n const proofs = [...issue.context.evidence, ...issue.acceptanceCriteria.map((ac) => ac.verifiedBy)];\n if (proofs.length && proofs.every((proof) => /^(?:\\/|[A-Za-z]:\\\\|~\\/)/u.test(proof.trim())))\n warnings.push(\n hint('local-evidence', 'context.evidence', 'Use portable evidence in addition to machine-local paths.'),\n );\n const body = renderIssueBody(issue, status, legacyFormatting);\n if (body.slice(0, body.lastIndexOf(DATA_PREFIX)).length > 4000)\n warnings.push(hint('body.length', 'body', 'Consider reducing a readable body over 4,000 characters.'));\n return warnings;\n}\n\nexport function issueBodyDiff(before: string, after: string): string {\n return [\n '--- prior body',\n '+++ canonical body',\n ...before.split('\\n').map((line) => '-' + line),\n ...after.split('\\n').map((line) => '+' + line),\n ].join('\\n');\n}\n"],
5
- "mappings": "AAAA,SAAS,SAAS;AAClB,SAAS,qBAAqB;AAEvB,MAAM,yBAAyB;AAC/B,MAAM,oBAAoB;AACjC,MAAM,cAAc;AACpB,MAAM,eACJ;AACK,SAAS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AS,KAAK,KAAK,eAAe,QAAQ,0DAA0D,CAAC;AACvG,SAAO;AACT;AAEO,SAAS,cAAc,QAAgB,OAAuB;AACnE,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA,GAAG,OAAO,MAAM,IAAI,EAAE,IAAI,CAAC,SAAS,MAAM,IAAI;AAAA,IAC9C,GAAG,MAAM,MAAM,IAAI,EAAE,IAAI,CAAC,SAAS,MAAM,IAAI;AAAA,EAC/C,EAAE,KAAK,IAAI;AACb;",
4
+ "sourcesContent": ["import { z } from 'zod';\nimport { DeliveryError } from './errors.js';\n\nexport const ISSUE_CONTRACT_VERSION = 'ai-delivery.issue@1' as const;\nexport const ISSUE_BODY_MARKER = '<!-- ai-delivery:issue@1 -->';\nconst DATA_PREFIX = '<!-- ai-delivery:issue-data@1 ';\nconst START_FOOTER =\n /\\n\\n<!-- ai-delivery-start-intent: sha256:[a-f0-9]{64} -->\\n<!-- ai-delivery-start: sha256:[a-f0-9]{64} -->$/u;\nexport function issueStartFooter(body: string): string {\n return START_FOOTER.exec(body)?.[0] ?? '';\n}\nconst CREATE_FOOTER = /\\n\\n<!-- ai-delivery-create: sha256:[a-f0-9]{64} intent: sha256:[a-f0-9]{64} -->$/u;\nexport function issueTrackingFooter(body: string): string {\n return CREATE_FOOTER.exec(body)?.[0] ?? issueStartFooter(body);\n}\nconst Text = z.string();\nconst Strings = z.array(Text);\nexport const IssueExample = z.strictObject({\n input: Text,\n expected: Text,\n failure: z.literal(true).optional().describe('Marks an example of what must be refused or must fail.'),\n});\nconst AcceptanceCriterion = z.strictObject({\n behavior: Text,\n verifiedBy: Text,\n examples: z\n .array(IssueExample)\n .optional()\n .describe('Example Mapping: concrete input and expected result for this criterion, including a failure case.'),\n});\nexport const FrontierReason = z.enum([\n 'state-machine',\n 'concurrency-recovery',\n 'risk-semantics',\n 'unprovable-refactor',\n]);\nexport const BuilderTier = z.discriminatedUnion('tier', [\n z.strictObject({ tier: z.literal('standard') }),\n z.strictObject({ tier: z.literal('frontier'), reason: FrontierReason }),\n]);\nexport type BuilderTierData = z.infer<typeof BuilderTier>;\nexport const SurfaceEntry = z.strictObject({\n path: Text,\n change: z.enum(['add', 'edit', 'delete']),\n signatures: Strings.optional(),\n});\nexport const IssueDeferral = z.strictObject({\n until: z.iso.date().optional(),\n trigger: z.string().trim().min(1).max(2000).optional(),\n});\nexport type IssueDeferralData = z.infer<typeof IssueDeferral>;\nexport const IssueDeferralPatch = {\n defer: IssueDeferral.optional(),\n undefer: z.literal(true).optional(),\n};\n\nexport function requireDeferralPatch(value: { defer?: IssueDeferralData; undefer?: true }): void {\n const parsed = z.strictObject(IssueDeferralPatch).safeParse(value);\n if (!parsed.success || (value.defer !== undefined && value.undefer !== undefined))\n throw new DeliveryError('Choose a valid defer condition or explicit undefer, never both.');\n}\n\n/** Drafts permit incomplete requirements, but never secret-bearing public content. */\nexport const IssueFields = z.strictObject({\n title: Text.describe(\n 'Ready issues need 10\u201380 characters naming the specific change, with no \"Bug:\" or \"[Task]\" prefix.',\n ),\n issueType: Text.optional(),\n points: z\n .number()\n .int()\n .optional()\n .describe(\"Ready non-epic issues need Points 1\u20138 from the Points field's options (usually 1, 2, 3, 5 or 8).\"),\n epic: z.literal(true).optional(),\n problem: Text.default(''),\n outcome: Text.default(''),\n acceptanceCriteria: z.array(AcceptanceCriterion).default([]),\n outOfScope: Strings.default([]),\n openQuestions: Strings.default([]),\n context: z\n .strictObject({ components: Strings.default([]), files: Strings.default([]), evidence: Strings.default([]) })\n .default({ components: [], files: [], evidence: [] }),\n bug: z\n .strictObject({ steps: Strings, expected: Text, actual: Text, reproducibility: Text, environment: Text })\n .optional()\n .describe('Ready Bug issues need non-empty steps, expected, actual, reproducibility and environment.'),\n draft: z.boolean().default(false),\n deferral: IssueDeferral.optional(),\n builder: BuilderTier.optional().describe(\n 'Builder capability: standard (any lighter builder can finish from the issue alone) or frontier with one reason.',\n ),\n extends: Strings.optional().describe('The design decision or existing owner this change uses or extends.'),\n priorWork: Strings.optional().describe(\n \"Searches run for earlier work on this question (closed issues, issue artifacts, decision logs) and what each found, or 'none found' with the searches.\",\n ),\n decisions: Strings.optional().describe('Choices already made; the builder must not reopen them.'),\n surface: z\n .array(SurfaceEntry)\n .optional()\n .describe(\n 'The complete change set: each path, its change, and exact signatures. Tests for these paths are implied.',\n ),\n fences: Strings.optional().describe(\"Nearby paths the builder must not touch, with each shared file's owner.\"),\n proof: Strings.optional().describe('Commands or replays to run in order, focused first.'),\n legacyBody: Text.optional(),\n retainLegacyBody: z.boolean().optional(),\n});\n\nconst StatusText = z\n .string()\n .trim()\n .min(1)\n .refine((value) => !/[\\r\\n]/u.test(value), 'Use one status line.');\nexport const CreateIssueStatus = z.strictObject({ nextMilestone: StatusText.optional() });\nexport const IssueStatusPatch = CreateIssueStatus.extend({\n blockers: StatusText.optional(),\n latestJournal: StatusText.optional(),\n});\nexport const ISSUE_COMMENT_BODY_LIMIT = 65_536;\nexport const ProjectStatusPatch = z\n .strictObject({\n status: z.enum(['Todo', 'In Progress', 'Blocked', 'Done']),\n reason: z.string().trim().min(1),\n })\n .superRefine((value, ctx) => {\n if (`Requested Project Status: ${value.status}.\\n\\n${value.reason}`.length > ISSUE_COMMENT_BODY_LIMIT)\n ctx.addIssue({\n code: 'custom',\n path: ['reason'],\n message: 'Shorten the public reason to fit the issue comment limit.',\n });\n if (secrets(value))\n ctx.addIssue({\n code: 'custom',\n path: ['reason'],\n message: 'Remove credentials and private keys from the public reason.',\n });\n });\nexport type ProjectStatusPatchData = z.infer<typeof ProjectStatusPatch>;\n\nconst IssueStatus = z.strictObject({\n state: z.enum(['Ready', 'Draft']),\n lastUpdated: z.iso.datetime(),\n nextMilestone: StatusText,\n blockers: StatusText,\n latestJournal: StatusText,\n});\nexport type IssueStatusData = z.infer<typeof IssueStatus>;\n\nexport function requireIssueStatus<T extends z.ZodType>(schema: T, value: unknown): z.output<T> {\n const result = schema.safeParse(value);\n if (!result.success) throw new IssueValidationError(issueDiagnostics(result.error.issues));\n if (secrets(result.data))\n throw new IssueValidationError([\n hint('secrets', 'status', 'Remove credentials and private keys from public status fields.'),\n ]);\n return result.data;\n}\n\nexport interface IssueDiagnostic {\n code: string;\n field: string;\n fixHint: string;\n message: string;\n}\nconst hint = (code: string, field: string, fixHint: string): IssueDiagnostic => ({\n code,\n field,\n fixHint,\n message: fixHint,\n});\n\n/** Every string inside value, each with its dotted field path (e.g. `context.evidence.0`). */\nfunction stringEntries(value: unknown, path = ''): [string, string][] {\n if (typeof value === 'string') return [[path, value]];\n if (value === null || typeof value !== 'object') return [];\n return Object.entries(value).flatMap(([key, item]) => stringEntries(item, path ? `${path}.${key}` : key));\n}\n\nfunction secrets(value: unknown): boolean {\n const text = stringEntries(value)\n .map(([, item]) => item)\n .join('\\n');\n return /(?:-----BEGIN (?:RSA |EC |OPENSSH )?PRIVATE KEY-----|\\b(?:gh[pousr]_[A-Za-z0-9]{20,}|github_pat_[A-Za-z0-9_]{20,}|sk-(?:proj-)?[A-Za-z0-9_-]{20,}|AKIA[A-Z0-9]{16})\\b|\\b(?:password|secret|api[_-]?key|access[_-]?token)\\s*[=:]\\s*[\"']?(?!<|\\$|redacted\\b|placeholder\\b)[A-Za-z0-9_+/-]{8,})/iu.test(\n text,\n );\n}\n\nfunction secretRule(value: z.output<typeof IssueFields>, ctx: z.RefinementCtx): void {\n if (secrets(value))\n ctx.addIssue({\n code: 'custom',\n path: ['body'],\n message: 'Remove credentials and private keys from public issue fields.',\n params: { issueCode: 'secrets' },\n });\n}\n\nexport const DraftIssue = IssueFields.superRefine(secretRule);\nexport type DraftIssueData = z.output<typeof DraftIssue>;\nexport type IssueFieldsInput = z.input<typeof IssueFields>;\n\nconst SKILL_HINT = 'See ai-delivery:ticket-design.';\n\nfunction readyRules(value: DraftIssueData, ctx: z.RefinementCtx): void {\n const add = (code: string, field: (string | number)[], fixHint: string): void =>\n ctx.addIssue({ code: 'custom', path: field, message: fixHint, params: { issueCode: code } });\n if (value.draft) add('draft', ['draft'], 'Resolve the draft fields and set draft to false before starting work.');\n if (!value.epic && (value.points === undefined || value.points < 1 || value.points > 8))\n add('points', ['points'], 'Choose Points from 1 through 8; split a 13-point issue into sub-issues.');\n if (\n value.title.trim().length < 10 ||\n !/[\\p{L}]/u.test(value.title) ||\n /^(?:fix|bug|task|feature|update|improve|test|issue|work)(?:\\s+(?:it|this|stuff|things|issue))?[.!]?$/iu.test(\n value.title.trim(),\n )\n )\n add('title.specific', ['title'], 'Name the specific behavior or component that changes.');\n if (value.title.length > 80)\n add('title.length', ['title'], `The title is ${String(value.title.length)} characters; shorten it to at most 80.`);\n if (/^\\s*(?:\\[\\s*(?:bug|feature|task)\\s*\\]|(?:bug|feature|task)\\s*:)/iu.test(value.title))\n add('title.prefix', ['title'], 'Remove the issue-type prefix; use the native Issue Type field.');\n for (const field of ['problem', 'outcome'] as const)\n if (!value[field].trim()) add(field, [field], `Describe the ${field} in concrete terms.`);\n if (!value.acceptanceCriteria.length)\n add('acceptance-criteria', ['acceptanceCriteria'], 'Add an observable behavior and how it will be verified.');\n value.acceptanceCriteria.forEach((ac, index) => {\n if (!ac.behavior.trim() || !ac.verifiedBy.trim())\n add(\n 'acceptance-criteria.fields',\n ['acceptanceCriteria', index],\n 'Provide both behavior and verifiedBy for this criterion.',\n );\n if (\n /^(?:.{1,100}\\s)?(?:works(?:\\s+(?:correctly|as expected|well|properly))?|(?:is|are)\\s+(?:done|verified|reviewed|robust|seamless|appropriate|user[- ]friendly))[\\s.!]*$/iu.test(\n ac.behavior,\n ) ||\n ac.behavior.trim().length < 12\n )\n add(\n 'acceptance-criteria.vague',\n ['acceptanceCriteria', index, 'behavior'],\n 'Replace vague wording with an observable input and result.',\n );\n });\n if (!value.outOfScope.some((item) => item.trim()))\n add('out-of-scope', ['outOfScope'], 'Name at least one explicit non-goal.');\n if (value.openQuestions.length)\n add('open-questions', ['openQuestions'], 'Resolve each open question before marking the issue Ready.');\n if (value.issueType?.toLowerCase() === 'bug') {\n if (!value.bug)\n add('bug', ['bug'], 'Include steps, expected and actual results, reproducibility, and environment.');\n else {\n if (!value.bug.steps.length || value.bug.steps.some((step) => !step.trim()))\n add('bug.steps', ['bug', 'steps'], 'Provide nonempty ordered reproduction steps.');\n for (const field of ['expected', 'actual', 'reproducibility', 'environment'] as const)\n if (!value.bug[field].trim()) add(`bug.${field}`, ['bug', field], `Describe the bug's ${field}.`);\n }\n }\n if (value.epic || value.builder === undefined) return;\n if (!(value.decisions ?? []).some((item) => item.trim()))\n add('decisions', ['decisions'], `Record each choice the builder must not reopen. ${SKILL_HINT}`);\n const entries = value.surface ?? [];\n if (!entries.length || entries.some((entry) => !entry.path.trim()))\n add('surface', ['surface'], `List every path to change, each with a path and its change. ${SKILL_HINT}`);\n const examples = value.acceptanceCriteria.flatMap((ac) => ac.examples ?? []);\n if (!examples.length)\n add('examples', ['acceptanceCriteria'], `Give each criterion examples (input and expected). ${SKILL_HINT}`);\n else if (!examples.some((example) => example.failure === true))\n add(\n 'examples.failure',\n ['acceptanceCriteria'],\n `Add one example marked failure: true for what must be refused or must fail. ${SKILL_HINT}`,\n );\n if (!(value.proof ?? []).some((item) => item.trim()))\n add('proof', ['proof'], `List the commands to run in order, focused first. ${SKILL_HINT}`);\n}\n\nconst LOCAL_PATH = /\\.local\\/|\\/Users\\/|~\\//u;\nconst CONTRACT_WORD_LIMIT = 400;\n\n/** Rules the Ready write gate refuses (create and draft-to-Ready); every other path only warns. Paul, Nov 26 (ai#5835, ai#5838). */\nfunction readyWriteRules(issue: DraftIssueData): IssueDiagnostic[] {\n if (issue.draft) return [];\n const results: IssueDiagnostic[] = [];\n if (!issue.epic && !(issue.priorWork ?? []).some((item) => item.trim()))\n results.push(\n hint(\n 'priorWork',\n 'priorWork',\n \"List each search you ran for earlier work on this question and what it found, or 'none found' with the searches.\",\n ),\n );\n for (const [field, text] of stringEntries(issue)) {\n const match = LOCAL_PATH.exec(text);\n if (match)\n results.push(\n hint(\n 'local-path',\n field,\n `${field} cites a local path (${match[0]}); put that evidence on the issue as a comment or artifact and link it instead.`,\n ),\n );\n }\n const { outcome, surface, acceptanceCriteria, proof, priorWork } = issue;\n const words = stringEntries({ outcome, surface, acceptanceCriteria, proof, priorWork })\n .flatMap(([, text]) => text.split(/\\s+/u))\n .filter(Boolean).length;\n if (words > CONTRACT_WORD_LIMIT)\n results.push(\n hint(\n 'contract-words',\n 'contract',\n `The contract (outcome, files, acceptance, tests, prior work) is ${String(words)} words; keep it to 400 and move evidence to a comment or artifact.`,\n ),\n );\n return results;\n}\n\nexport const ReadyIssue = IssueFields.extend({\n title: Text.min(10).max(80),\n points: z.number().int().min(1).max(8).optional(),\n problem: Text.min(1),\n outcome: Text.min(1),\n acceptanceCriteria: z.array(AcceptanceCriterion).min(1),\n outOfScope: Strings.min(1),\n openQuestions: Strings.max(0).default([]),\n draft: z.literal(false).default(false),\n})\n .superRefine(secretRule)\n .superRefine(readyRules)\n .meta({ anyOf: [{ properties: { epic: { const: true } }, required: ['epic'] }, { required: ['points'] }] });\nexport type ReadyIssueData = z.output<typeof ReadyIssue>;\nconst ReadySemantics = IssueFields.superRefine(secretRule).superRefine(readyRules);\n/** Portable structural schemas; semantic refinements are enforced by the write/readiness boundary. */\nexport const ISSUE_JSON_SCHEMAS = {\n version: ISSUE_CONTRACT_VERSION,\n draft: z.toJSONSchema(DraftIssue),\n ready: z.toJSONSchema(ReadyIssue),\n};\n\n/** Patch fields share the canonical validators but deliberately have no defaults. */\nexport const IssueWriteFields = {\n title: IssueFields.shape.title.optional(),\n issueType: IssueFields.shape.issueType,\n points: IssueFields.shape.points,\n epic: IssueFields.shape.epic,\n problem: IssueFields.shape.problem.removeDefault().optional(),\n outcome: IssueFields.shape.outcome.removeDefault().optional(),\n acceptanceCriteria: IssueFields.shape.acceptanceCriteria.removeDefault().optional(),\n outOfScope: IssueFields.shape.outOfScope.removeDefault().optional(),\n openQuestions: IssueFields.shape.openQuestions.removeDefault().optional(),\n context: IssueFields.shape.context.removeDefault().optional(),\n bug: IssueFields.shape.bug,\n builder: IssueFields.shape.builder,\n extends: IssueFields.shape.extends,\n priorWork: IssueFields.shape.priorWork,\n decisions: IssueFields.shape.decisions,\n surface: IssueFields.shape.surface,\n fences: IssueFields.shape.fences,\n proof: IssueFields.shape.proof,\n draft: IssueFields.shape.draft.removeDefault().optional(),\n retainLegacyBody: IssueFields.shape.retainLegacyBody,\n};\nexport const IssueWriteSchema = z.strictObject(IssueWriteFields);\n\n/** Keep advertised structural schemas while returning domain diagnostics before SDK error wrapping. */\nexport function issueInputSchema<T extends z.ZodObject>(schema: T): T {\n return schema.refine(() => true, {\n when: ({ issues }) => {\n // Parsed values have already lost unknown keys. Preserve the original structural failures.\n if (issues.length) throw new IssueValidationError(issueDiagnostics(issues));\n return true;\n },\n });\n}\n\n/** One refusal for unknown keys on every tool: list what is accepted, never echo the unknown key (#140). */\nexport function acceptedKeysError(issue: z.core.$ZodRawIssue): string | undefined {\n if (issue.code !== 'unrecognized_keys') return undefined;\n const shape = (issue.inst as z.ZodObject | undefined)?.shape;\n return shape === undefined ? undefined : `Unknown argument key. Accepted keys: ${Object.keys(shape).join(', ')}.`;\n}\n\nfunction issueDiagnostics(issues: readonly (z.core.$ZodIssue | z.core.$ZodRawIssue)[]): IssueDiagnostic[] {\n const seen = new Set<string>();\n return issues\n .map((issue) => {\n const field = (issue.path ?? []).map(String).join('.') || 'issue';\n const code =\n issue.code === 'custom' && typeof issue.params?.issueCode === 'string'\n ? issue.params.issueCode\n : field === 'points'\n ? 'points'\n : field === 'title'\n ? 'title.length'\n : field === 'outOfScope'\n ? 'out-of-scope'\n : field === 'openQuestions'\n ? 'open-questions'\n : field === 'acceptanceCriteria'\n ? 'acceptance-criteria'\n : field === 'draft'\n ? 'draft'\n : issue.code === 'unrecognized_keys'\n ? 'field.unknown'\n : 'field.type';\n return hint(\n code,\n field,\n code === 'points'\n ? 'Choose Points from 1 through 8; split a 13-point issue into sub-issues.'\n : issue.code === 'unrecognized_keys'\n ? (acceptedKeysError(issue as z.core.$ZodRawIssue) ?? 'Remove unrecognized fields from ' + field + '.')\n : (issue.message ??\n (issue.code === 'invalid_type'\n ? 'Provide a valid ' + issue.expected + ' value.'\n : 'Provide a value satisfying the declared issue field schema.')),\n );\n })\n .filter((issue) => {\n const key = issue.code + ':' + issue.field;\n if (seen.has(key)) return false;\n seen.add(key);\n return true;\n });\n}\n\nexport function validateIssue(value: unknown, ready = true): { issue?: DraftIssueData; failures: IssueDiagnostic[] } {\n const parsed = (ready ? ReadyIssue : DraftIssue).safeParse(value);\n if (parsed.success) return { issue: parsed.data, failures: [] };\n const semantic = ready ? ReadySemantics.safeParse(value) : undefined;\n const issues = [...(semantic?.success === false ? semantic.error.issues : []), ...parsed.error.issues];\n return { failures: issueDiagnostics(issues) };\n}\n\nexport class IssueValidationError extends DeliveryError {\n constructor(readonly failures: IssueDiagnostic[]) {\n super(JSON.stringify({ contract: ISSUE_CONTRACT_VERSION, failures }));\n }\n}\n\n/** `requireBuilder` is set at Ready create and draft-to-Ready; legacy content updates never set it. */\nexport function requireIssue(value: unknown, options: { requireBuilder?: true } = {}): DraftIssueData {\n const structural = IssueFields.safeParse(value);\n const result = validateIssue(value, !structural.success || !structural.data.draft);\n const gated = options.requireBuilder === true && structural.success && !structural.data.draft;\n const unbuilt = gated && !structural.data.epic && structural.data.builder === undefined;\n const writeFailures = gated ? readyWriteRules(structural.data) : [];\n if (!result.issue || unbuilt || writeFailures.length)\n throw new IssueValidationError([\n ...(unbuilt\n ? [\n hint(\n 'builder.missing',\n 'builder',\n `Add builder, decisions, surface, proof and examples, or pass draft: true to capture it now. ${SKILL_HINT}`,\n ),\n ]\n : []),\n ...result.failures,\n ...writeFailures,\n ]);\n return result.issue;\n}\n\nconst escapeStatus = (value: string): string =>\n value\n .replaceAll('&', '&amp;')\n .replaceAll('<', '&lt;')\n .replaceAll('>', '&gt;')\n .replace(/[\\\\`*_[\\]]/gu, '\\\\$&');\nconst unescapeStatus = (value: string): string =>\n value\n .replace(/\\\\([\\\\`*_[\\]])/gu, '$1')\n .replaceAll('&lt;', '<')\n .replaceAll('&gt;', '>')\n .replaceAll('&amp;', '&');\n\nexport function renderIssueBody(value: DraftIssueData, status?: IssueStatusData, legacyFormatting = false): string {\n const item = DraftIssue.parse(value);\n if (status !== undefined) requireIssueStatus(IssueStatus, status);\n const list = (values: string[]): string => (values.length ? values.map((v) => `- ${v}`).join('\\n') : '(none)');\n const bulletSection = (title: string, values: string[] | undefined): string[] =>\n values?.length ? [`## ${title}`, list(values)] : [];\n const parts = [\n ISSUE_BODY_MARKER,\n '## Status',\n status === undefined\n ? item.draft\n ? 'Draft \u2014 parked; not ready to work.'\n : 'Ready'\n : `- **State:** ${status.state}\\n- **Last updated:** ${status.lastUpdated} UTC\\n- **Next milestone:** ${escapeStatus(status.nextMilestone)}\\n- **Blockers:** ${escapeStatus(status.blockers)}\\n- **Latest journal:** ${escapeStatus(status.latestJournal)}`,\n '## Problem',\n item.problem,\n '## Outcome',\n item.outcome,\n ...(item.deferral === undefined ? [] : ['## Deferral', `Deferred: ${JSON.stringify(item.deferral)}`]),\n ...(item.builder === undefined\n ? []\n : ['## Builder', item.builder.tier === 'standard' ? 'standard' : `frontier: ${item.builder.reason}`]),\n ...bulletSection('Extends', item.extends),\n ...bulletSection('Prior work', item.priorWork),\n ...bulletSection('Decisions', item.decisions),\n '## Acceptance criteria',\n item.acceptanceCriteria\n .map(\n (ac) =>\n (legacyFormatting\n ? `- [ ] ${ac.behavior}\\n Verified by: ${ac.verifiedBy}`\n : `- [ ] ${ac.behavior.replace(/\\n/gu, '\\n ')}${ac.behavior.includes('\\n') ? '\\n' : ''}\\n Verified by: ${ac.verifiedBy.replace(/\\n/gu, '\\n ')}`) +\n (ac.examples ?? [])\n .map(\n (example) =>\n `\\n Example: ${example.input.replace(/\\n/gu, '\\n ')} \u2192 ${example.expected.replace(/\\n/gu, '\\n ')}${example.failure === true ? ' (failure)' : ''}`,\n )\n .join(''),\n )\n .join('\\n'),\n ...(item.surface?.length\n ? [\n '## Surface',\n item.surface\n .map((entry) =>\n [`- ${entry.change} \\`${entry.path}\\``, ...(entry.signatures ?? []).map((sig) => ` ${sig}`)].join('\\n'),\n )\n .join('\\n'),\n ]\n : []),\n ...bulletSection('Fences', item.fences),\n ...bulletSection('Proof', item.proof),\n '## Out of scope',\n list(item.outOfScope),\n '## Open questions',\n list(item.openQuestions),\n '## Context',\n `Components:\\n${list(item.context.components)}\\n\\nFiles:\\n${list(item.context.files)}\\n\\nEvidence:\\n${list(item.context.evidence)}`,\n ];\n if (item.bug)\n parts.push(\n '## Bug',\n `Steps:\\n${list(item.bug.steps)}\\n\\nExpected: ${item.bug.expected}\\n\\nActual: ${item.bug.actual}\\n\\nReproducibility: ${item.bug.reproducibility}\\n\\nEnvironment: ${item.bug.environment}`,\n );\n if (item.legacyBody !== undefined && item.retainLegacyBody !== false)\n parts.push('## Preserved legacy body', item.legacyBody);\n // Escape comment delimiters without altering decoded data. Exact render equality detects human/payload divergence.\n parts.push(`${DATA_PREFIX}${JSON.stringify(item).replaceAll('<', '\\\\u003c').replaceAll('>', '\\\\u003e')} -->`);\n return parts.join('\\n\\n') + '\\n';\n}\n\nfunction section(body: string, names: string[]): string {\n const lines = body.split(/\\r?\\n/u);\n const start = lines.findIndex((line) =>\n names.includes(\n line\n .replace(/^#{1,6}\\s+/u, '')\n .trim()\n .toLowerCase(),\n ),\n );\n if (start < 0) return '';\n const end = lines.findIndex((line, index) => index > start && /^#{1,6}\\s/u.test(line));\n return lines\n .slice(start + 1, end < 0 ? undefined : end)\n .join('\\n')\n .trim();\n}\n\nconst REBUILD_HINT =\n 'The issue body was edited outside ai-delivery; send problem, outcome, acceptanceCriteria and outOfScope (plus bug for a Bug, epic for an epic, and any draft, openQuestions or context to keep) in one issue_update to rebuild it.';\n\n/** Lenient conversion retains every legacy byte, and never invents verification or bug evidence. */\nexport function parseIssueBody(\n body: string,\n metadata: { title: string; points?: number; issueType?: string },\n): { issue: DraftIssueData; legacy: boolean; status?: IssueStatusData; legacyFormatting?: boolean } {\n if (body.trimStart().startsWith(ISSUE_BODY_MARKER)) {\n const start = body.lastIndexOf(DATA_PREFIX);\n const end = body.indexOf(' -->', start);\n if (start < 0 || end < 0) throw new IssueValidationError([hint('body.canonical', 'body', REBUILD_HINT)]);\n let decoded: unknown;\n try {\n decoded = JSON.parse(body.slice(start + DATA_PREFIX.length, end));\n } catch {\n throw new IssueValidationError([hint('body.canonical', 'body', REBUILD_HINT)]);\n }\n const result = validateIssue(decoded, false);\n if (!result.issue) throw new IssueValidationError(result.failures);\n const displayed = body.slice((ISSUE_BODY_MARKER + '\\n\\n## Status\\n\\n').length, body.indexOf('\\n\\n## Problem\\n\\n'));\n let status: IssueStatusData | undefined;\n if (displayed !== 'Ready' && displayed !== 'Draft \u2014 parked; not ready to work.') {\n const match =\n /^- \\*\\*State:\\*\\* (Ready|Draft)\\n- \\*\\*Last updated:\\*\\* (\\S+) UTC\\n- \\*\\*Next milestone:\\*\\* ([^\\r\\n]+)\\n- \\*\\*Blockers:\\*\\* ([^\\r\\n]+)\\n- \\*\\*Latest journal:\\*\\* ([^\\r\\n]+)$/u.exec(\n displayed,\n );\n if (!match)\n throw new IssueValidationError([\n hint('body.canonical', 'status', 'Restore the complete unambiguous status block.'),\n ]);\n status = requireIssueStatus(IssueStatus, {\n state: match[1],\n lastUpdated: match[2],\n nextMilestone: unescapeStatus(match[3]!),\n blockers: unescapeStatus(match[4]!),\n latestJournal: unescapeStatus(match[5]!),\n });\n if (status.state !== (result.issue.draft ? 'Draft' : 'Ready'))\n throw new IssueValidationError([\n hint('body.canonical', 'status', 'Status state must agree with the typed draft field.'),\n ]);\n }\n const footer = issueTrackingFooter(body);\n const canonical = footer ? body.slice(0, -footer.length) : body;\n const legacyFormatting = renderIssueBody(result.issue, status) !== canonical;\n if (\n (legacyFormatting && renderIssueBody(result.issue, status, true) !== canonical) ||\n result.issue.title !== metadata.title\n )\n throw new IssueValidationError([hint('body.canonical', 'body', REBUILD_HINT)]);\n return {\n issue: result.issue,\n legacy: false,\n ...(status === undefined ? {} : { status }),\n ...(legacyFormatting ? { legacyFormatting: true } : {}),\n };\n }\n const verification = section(body, ['verification', 'validation', 'tests']);\n const acText = section(body, ['acceptance criteria', 'acceptance']);\n const acceptanceCriteria = acText.split(/\\n(?=\\s*[-*+]\\s+\\[[ xX]\\])/u).flatMap((block) => {\n const match = /^\\s*[-*+]\\s+\\[[ xX]\\]\\s+([\\s\\S]+)/u.exec(block);\n if (!match) return [];\n const [behavior = '', verifiedBy = verification] = match[1]!.split(/\\n\\s*(?:Verified by:|Verified by)\\s*/iu);\n return [{ behavior: behavior.trim(), verifiedBy: verifiedBy.trim() }];\n });\n const items = (s: string): string[] =>\n s\n .split(/\\r?\\n/u)\n .map((line) => line.replace(/^\\s*[-*+]\\s+/u, '').trim())\n .filter(Boolean);\n const scope = section(body, ['scope', 'context']);\n const bug =\n metadata.issueType?.toLowerCase() === 'bug'\n ? {\n steps: items(section(body, ['steps', 'steps to reproduce'])),\n expected: section(body, ['expected', 'expected results']),\n actual: section(body, ['actual', 'actual results']),\n reproducibility: section(body, ['reproducibility']),\n environment: section(body, ['environment']),\n }\n : undefined;\n const converted = validateIssue(\n {\n ...metadata,\n problem: section(body, ['problem']),\n outcome: section(body, ['outcome']),\n acceptanceCriteria,\n outOfScope: items(section(body, ['out of scope', 'non-goals'])),\n openQuestions: items(section(body, ['open questions'])),\n context: { components: [], files: scope ? [scope] : [], evidence: verification ? [verification] : [] },\n ...(bug === undefined ? {} : { bug }),\n draft: /^draft\\b/iu.test(section(body, ['status'])),\n legacyBody: body,\n },\n false,\n );\n if (!converted.issue) throw new IssueValidationError(converted.failures);\n return { issue: converted.issue, legacy: true };\n}\n\nconst CODE_EXTENSIONS = /\\.(?:ts|tsx|js|mjs|cjs|py|go|rs|java|kt|rb|sql|sh)$/iu;\nconst proseWords = (issue: DraftIssueData): number =>\n [issue.problem, issue.outcome, ...issue.acceptanceCriteria.map((ac) => ac.behavior)]\n .flatMap((text) => text.split(/\\s+/u))\n .filter(Boolean).length;\n\nexport function issueWarnings(issue: DraftIssueData): IssueDiagnostic[] {\n const warnings: IssueDiagnostic[] = [];\n const warn = (code: string, field: string, message: string): void => {\n warnings.push(hint(code, field, message));\n };\n if (issue.acceptanceCriteria.length > 7)\n warn('many-criteria', 'acceptanceCriteria', 'Consider slicing more than seven criteria into smaller issues.');\n if (\n issue.builder === undefined &&\n !issue.acceptanceCriteria.some((ac) =>\n /\\b(?:edge|failure|fail|error|invalid|reject|refus|empty|missing|interrupt|timeout|boundary)/iu.test(ac.behavior),\n )\n )\n warn('edge-case', 'acceptanceCriteria', 'Describe an edge or failure case.');\n if (\n issue.issueType?.toLowerCase() === 'bug' &&\n !issue.acceptanceCriteria.some((ac) => /regression/iu.test(ac.behavior + ' ' + ac.verifiedBy))\n )\n warn('bug.regression', 'acceptanceCriteria', 'Add a regression test criterion for the bug.');\n if (issue.builder === undefined && ![...issue.context.files, ...issue.context.components].some((item) => item.trim()))\n warn('context', 'context', 'Name relevant components or files.');\n warnings.push(...readyWriteRules(issue));\n if (proseWords(issue) > 300)\n warn('body.length', 'body', `Consider cutting the problem, outcome and criteria to 300 words. ${SKILL_HINT}`);\n if (issue.draft || issue.epic) return warnings;\n if (issue.builder === undefined) {\n warn(\n 'builder.unset',\n 'builder',\n `Set builder, decisions, surface, proof and examples when next editing. ${SKILL_HINT}`,\n );\n return warnings;\n }\n if (issue.points !== undefined && issue.points > 5)\n warn('size.points', 'points', `Consider splitting an issue above 5 points. ${SKILL_HINT}`);\n const entries = issue.surface ?? [];\n if (new Set(entries.map((entry) => entry.path.trim())).size > 6)\n warn('size.surface', 'surface', `Consider splitting an issue that changes more than 6 paths. ${SKILL_HINT}`);\n if (issue.acceptanceCriteria.some((ac) => !ac.examples?.length))\n warn('examples.ac', 'acceptanceCriteria', `Give every criterion at least one example. ${SKILL_HINT}`);\n const unsigned = entries.filter(\n (entry) =>\n entry.change !== 'delete' &&\n CODE_EXTENSIONS.test(entry.path.trim()) &&\n !/\\.test\\.|\\.spec\\.|\\/test/u.test(entry.path) &&\n !entry.signatures?.some((signature) => signature.trim()),\n );\n if (unsigned.length)\n warn(\n 'surface.signature',\n 'surface',\n `Add exact signatures for ${unsigned.map((entry) => entry.path).join(', ')}. ${SKILL_HINT}`,\n );\n if (!(issue.fences ?? []).some((item) => item.trim()))\n warn('fences', 'fences', `Name the nearby paths the builder must not touch. ${SKILL_HINT}`);\n if (!(issue.extends ?? []).some((item) => item.trim()))\n warn('extends', 'extends', `Name the design or owner this change extends; add no parallel path. ${SKILL_HINT}`);\n return warnings;\n}\n\nexport function issueBodyDiff(before: string, after: string): string {\n return [\n '--- prior body',\n '+++ canonical body',\n ...before.split('\\n').map((line) => '-' + line),\n ...after.split('\\n').map((line) => '+' + line),\n ].join('\\n');\n}\n"],
5
+ "mappings": "AAAA,SAAS,SAAS;AAClB,SAAS,qBAAqB;AAEvB,MAAM,yBAAyB;AAC/B,MAAM,oBAAoB;AACjC,MAAM,cAAc;AACpB,MAAM,eACJ;AACK,SAAS,iBAAiB,MAAsB;AACrD,SAAO,aAAa,KAAK,IAAI,IAAI,CAAC,KAAK;AACzC;AACA,MAAM,gBAAgB;AACf,SAAS,oBAAoB,MAAsB;AACxD,SAAO,cAAc,KAAK,IAAI,IAAI,CAAC,KAAK,iBAAiB,IAAI;AAC/D;AACA,MAAM,OAAO,EAAE,OAAO;AACtB,MAAM,UAAU,EAAE,MAAM,IAAI;AACrB,MAAM,eAAe,EAAE,aAAa;AAAA,EACzC,OAAO;AAAA,EACP,UAAU;AAAA,EACV,SAAS,EAAE,QAAQ,IAAI,EAAE,SAAS,EAAE,SAAS,wDAAwD;AACvG,CAAC;AACD,MAAM,sBAAsB,EAAE,aAAa;AAAA,EACzC,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,UAAU,EACP,MAAM,YAAY,EAClB,SAAS,EACT,SAAS,mGAAmG;AACjH,CAAC;AACM,MAAM,iBAAiB,EAAE,KAAK;AAAA,E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UAAU,UAAU,qDAAqD,UAAU,EAAE;AAC5F,MAAI,EAAE,MAAM,WAAW,CAAC,GAAG,KAAK,CAAC,SAAS,KAAK,KAAK,CAAC;AACnD,SAAK,WAAW,WAAW,uEAAuE,UAAU,EAAE;AAChH,SAAO;AACT;AAEO,SAAS,cAAc,QAAgB,OAAuB;AACnE,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA,GAAG,OAAO,MAAM,IAAI,EAAE,IAAI,CAAC,SAAS,MAAM,IAAI;AAAA,IAC9C,GAAG,MAAM,MAAM,IAAI,EAAE,IAAI,CAAC,SAAS,MAAM,IAAI;AAAA,EAC/C,EAAE,KAAK,IAAI;AACb;",
6
6
  "names": []
7
7
  }
@@ -8,6 +8,11 @@ export declare const validIssue: () => {
8
8
  acceptanceCriteria: {
9
9
  behavior: string;
10
10
  verifiedBy: string;
11
+ examples?: {
12
+ input: string;
13
+ expected: string;
14
+ failure?: true | undefined;
15
+ }[] | undefined;
11
16
  }[];
12
17
  outOfScope: string[];
13
18
  openQuestions: string[];
@@ -28,6 +33,22 @@ export declare const validIssue: () => {
28
33
  until?: string | undefined;
29
34
  trigger?: string | undefined;
30
35
  } | undefined;
36
+ builder?: {
37
+ tier: "standard";
38
+ } | {
39
+ tier: "frontier";
40
+ reason: "concurrency-recovery" | "risk-semantics" | "state-machine" | "unprovable-refactor";
41
+ } | undefined;
42
+ extends?: string[] | undefined;
43
+ priorWork?: string[] | undefined;
44
+ decisions?: string[] | undefined;
45
+ surface?: {
46
+ path: string;
47
+ change: "add" | "delete" | "edit";
48
+ signatures?: string[] | undefined;
49
+ }[] | undefined;
50
+ fences?: string[] | undefined;
51
+ proof?: string[] | undefined;
31
52
  legacyBody?: string | undefined;
32
53
  retainLegacyBody?: boolean | undefined;
33
54
  };