@aviaratech/ai-delivery 0.3.44 → 0.3.45

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.
@@ -102,6 +102,8 @@ export declare const IssueFields: z.ZodObject<{
102
102
  extends: z.ZodOptional<z.ZodArray<z.ZodString>>;
103
103
  priorWork: z.ZodOptional<z.ZodArray<z.ZodString>>;
104
104
  decisions: z.ZodOptional<z.ZodArray<z.ZodString>>;
105
+ moneyPath: z.ZodOptional<z.ZodBoolean>;
106
+ ownerOk: z.ZodOptional<z.ZodArray<z.ZodString>>;
105
107
  surface: z.ZodOptional<z.ZodArray<z.ZodObject<{
106
108
  path: z.ZodString;
107
109
  change: z.ZodEnum<{
@@ -202,6 +204,8 @@ export declare const DraftIssue: z.ZodObject<{
202
204
  extends: z.ZodOptional<z.ZodArray<z.ZodString>>;
203
205
  priorWork: z.ZodOptional<z.ZodArray<z.ZodString>>;
204
206
  decisions: z.ZodOptional<z.ZodArray<z.ZodString>>;
207
+ moneyPath: z.ZodOptional<z.ZodBoolean>;
208
+ ownerOk: z.ZodOptional<z.ZodArray<z.ZodString>>;
205
209
  surface: z.ZodOptional<z.ZodArray<z.ZodObject<{
206
210
  path: z.ZodString;
207
211
  change: z.ZodEnum<{
@@ -218,6 +222,8 @@ export declare const DraftIssue: z.ZodObject<{
218
222
  }, z.core.$strict>;
219
223
  export type DraftIssueData = z.output<typeof DraftIssue>;
220
224
  export type IssueFieldsInput = z.input<typeof IssueFields>;
225
+ /** Local paths an update adds to an already-Ready issue; paths it already cites only warn (#339). */
226
+ export declare function addedLocalPaths(before: DraftIssueData, after: DraftIssueData): IssueDiagnostic[];
221
227
  export declare const ReadyIssue: z.ZodObject<{
222
228
  issueType: z.ZodOptional<z.ZodString>;
223
229
  epic: z.ZodOptional<z.ZodLiteral<true>>;
@@ -251,6 +257,8 @@ export declare const ReadyIssue: z.ZodObject<{
251
257
  extends: z.ZodOptional<z.ZodArray<z.ZodString>>;
252
258
  priorWork: z.ZodOptional<z.ZodArray<z.ZodString>>;
253
259
  decisions: z.ZodOptional<z.ZodArray<z.ZodString>>;
260
+ moneyPath: z.ZodOptional<z.ZodBoolean>;
261
+ ownerOk: z.ZodOptional<z.ZodArray<z.ZodString>>;
254
262
  surface: z.ZodOptional<z.ZodArray<z.ZodObject<{
255
263
  path: z.ZodString;
256
264
  change: z.ZodEnum<{
@@ -334,6 +342,8 @@ export declare const ISSUE_JSON_SCHEMAS: {
334
342
  extends: z.ZodOptional<z.ZodArray<z.ZodString>>;
335
343
  priorWork: z.ZodOptional<z.ZodArray<z.ZodString>>;
336
344
  decisions: z.ZodOptional<z.ZodArray<z.ZodString>>;
345
+ moneyPath: z.ZodOptional<z.ZodBoolean>;
346
+ ownerOk: z.ZodOptional<z.ZodArray<z.ZodString>>;
337
347
  surface: z.ZodOptional<z.ZodArray<z.ZodObject<{
338
348
  path: z.ZodString;
339
349
  change: z.ZodEnum<{
@@ -381,6 +391,8 @@ export declare const ISSUE_JSON_SCHEMAS: {
381
391
  extends: z.ZodOptional<z.ZodArray<z.ZodString>>;
382
392
  priorWork: z.ZodOptional<z.ZodArray<z.ZodString>>;
383
393
  decisions: z.ZodOptional<z.ZodArray<z.ZodString>>;
394
+ moneyPath: z.ZodOptional<z.ZodBoolean>;
395
+ ownerOk: z.ZodOptional<z.ZodArray<z.ZodString>>;
384
396
  surface: z.ZodOptional<z.ZodArray<z.ZodObject<{
385
397
  path: z.ZodString;
386
398
  change: z.ZodEnum<{
@@ -457,6 +469,8 @@ export declare const IssueWriteFields: {
457
469
  extends: z.ZodOptional<z.ZodArray<z.ZodString>>;
458
470
  priorWork: z.ZodOptional<z.ZodArray<z.ZodString>>;
459
471
  decisions: z.ZodOptional<z.ZodArray<z.ZodString>>;
472
+ moneyPath: z.ZodOptional<z.ZodBoolean>;
473
+ ownerOk: z.ZodOptional<z.ZodArray<z.ZodString>>;
460
474
  surface: z.ZodOptional<z.ZodArray<z.ZodObject<{
461
475
  path: z.ZodString;
462
476
  change: z.ZodEnum<{
@@ -515,6 +529,8 @@ export declare const IssueWriteSchema: z.ZodObject<{
515
529
  extends: z.ZodOptional<z.ZodArray<z.ZodString>>;
516
530
  priorWork: z.ZodOptional<z.ZodArray<z.ZodString>>;
517
531
  decisions: z.ZodOptional<z.ZodArray<z.ZodString>>;
532
+ moneyPath: z.ZodOptional<z.ZodBoolean>;
533
+ ownerOk: z.ZodOptional<z.ZodArray<z.ZodString>>;
518
534
  surface: z.ZodOptional<z.ZodArray<z.ZodObject<{
519
535
  path: z.ZodString;
520
536
  change: z.ZodEnum<{
@@ -75,6 +75,8 @@ const IssueFields = z.strictObject({
75
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
76
  ),
77
77
  decisions: Strings.optional().describe("Choices already made; the builder must not reopen them."),
78
+ moneyPath: z.boolean().optional().describe("True when the change touches a path the repository's review policy gates; ownerOk is then required."),
79
+ ownerOk: Strings.optional().describe("Link to the owner's comment approving this ticket's live-effect line."),
78
80
  surface: z.array(SurfaceEntry).optional().describe(
79
81
  "The complete change set: each path, its change, and exact signatures. Tests for these paths are implied."
80
82
  ),
@@ -200,6 +202,12 @@ function readyRules(value, ctx) {
200
202
  if (!value.bug[field].trim()) add(`bug.${field}`, ["bug", field], `Describe the bug's ${field}.`);
201
203
  }
202
204
  }
205
+ if (value.moneyPath === true && !(value.ownerOk ?? []).some((item) => item.startsWith("https://")))
206
+ add(
207
+ "ownerOk",
208
+ ["ownerOk"],
209
+ "Link the owner's comment that OKs this ticket's live-effect line, or set moneyPath to false."
210
+ );
203
211
  if (value.epic || value.builder === void 0) return;
204
212
  if (!(value.decisions ?? []).some((item) => item.trim()))
205
213
  add("decisions", ["decisions"], `Record each choice the builder must not reopen. ${SKILL_HINT}`);
@@ -220,6 +228,21 @@ function readyRules(value, ctx) {
220
228
  }
221
229
  const LOCAL_PATH = /\.local\/|\/Users\/|~\//u;
222
230
  const CONTRACT_WORD_LIMIT = 400;
231
+ function localPathHint(field, match) {
232
+ return hint(
233
+ "local-path",
234
+ field,
235
+ `${field} cites a local path (${match}); put that evidence on the issue as a comment or artifact and link it instead.`
236
+ );
237
+ }
238
+ function addedLocalPaths(before, after) {
239
+ const existing = stringEntries(before).map(([, text]) => text);
240
+ return stringEntries(after).flatMap(([field, text]) => {
241
+ const added = text.split(/\s+/u).find((word) => LOCAL_PATH.test(word) && !existing.some((item) => item.includes(word)));
242
+ const match = added === void 0 ? null : LOCAL_PATH.exec(added);
243
+ return match ? [localPathHint(field, match[0])] : [];
244
+ });
245
+ }
223
246
  function readyWriteRules(issue) {
224
247
  if (issue.draft) return [];
225
248
  const results = [];
@@ -233,14 +256,7 @@ function readyWriteRules(issue) {
233
256
  );
234
257
  for (const [field, text] of stringEntries(issue)) {
235
258
  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
- );
259
+ if (match) results.push(localPathHint(field, match[0]));
244
260
  }
245
261
  const { outcome, surface, acceptanceCriteria, proof, priorWork } = issue;
246
262
  const words = stringEntries({ outcome, surface, acceptanceCriteria, proof, priorWork }).flatMap(([, text]) => text.split(/\s+/u)).filter(Boolean).length;
@@ -286,6 +302,8 @@ const IssueWriteFields = {
286
302
  extends: IssueFields.shape.extends,
287
303
  priorWork: IssueFields.shape.priorWork,
288
304
  decisions: IssueFields.shape.decisions,
305
+ moneyPath: IssueFields.shape.moneyPath,
306
+ ownerOk: IssueFields.shape.ownerOk,
289
307
  surface: IssueFields.shape.surface,
290
308
  fences: IssueFields.shape.fences,
291
309
  proof: IssueFields.shape.proof,
@@ -381,6 +399,8 @@ function renderIssueBody(value, status, legacyFormatting = false) {
381
399
  ...bulletSection("Extends", item.extends),
382
400
  ...bulletSection("Prior work", item.priorWork),
383
401
  ...bulletSection("Decisions", item.decisions),
402
+ ...item.moneyPath === true ? ["## Money path", "yes"] : [],
403
+ ...bulletSection("Owner OK", item.ownerOk),
384
404
  "## Acceptance criteria",
385
405
  item.acceptanceCriteria.map(
386
406
  (ac) => (legacyFormatting ? `- [ ] ${ac.behavior}
@@ -605,6 +625,7 @@ export {
605
625
  ReadyIssue,
606
626
  SurfaceEntry,
607
627
  acceptedKeysError,
628
+ addedLocalPaths,
608
629
  issueBodyDiff,
609
630
  issueInputSchema,
610
631
  issueStartFooter,
@@ -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);\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,CAA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AAC,SAAS,KAAK,KAAK,CAAC;AAClD,SAAK,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;",
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 moneyPath: z\n .boolean()\n .optional()\n .describe(\"True when the change touches a path the repository's review policy gates; ownerOk is then required.\"),\n ownerOk: Strings.optional().describe(\"Link to the owner's comment approving this ticket's live-effect line.\"),\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.moneyPath === true && !(value.ownerOk ?? []).some((item) => item.startsWith('https://')))\n add(\n 'ownerOk',\n ['ownerOk'],\n \"Link the owner's comment that OKs this ticket's live-effect line, or set moneyPath to false.\",\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\nfunction localPathHint(field: string, match: string): IssueDiagnostic {\n return hint(\n 'local-path',\n field,\n `${field} cites a local path (${match}); put that evidence on the issue as a comment or artifact and link it instead.`,\n );\n}\n\n/** Local paths an update adds to an already-Ready issue; paths it already cites only warn (#339). */\nexport function addedLocalPaths(before: DraftIssueData, after: DraftIssueData): IssueDiagnostic[] {\n const existing = stringEntries(before).map(([, text]) => text);\n return stringEntries(after).flatMap(([field, text]) => {\n const added = text\n .split(/\\s+/u)\n .find((word) => LOCAL_PATH.test(word) && !existing.some((item) => item.includes(word)));\n const match = added === undefined ? null : LOCAL_PATH.exec(added);\n return match ? [localPathHint(field, match[0])] : [];\n });\n}\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) results.push(localPathHint(field, match[0]));\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 moneyPath: IssueFields.shape.moneyPath,\n ownerOk: IssueFields.shape.ownerOk,\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 ...(item.moneyPath === true ? ['## Money path', 'yes'] : []),\n ...bulletSection('Owner OK', item.ownerOk),\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,EACnC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AACM,MAAM,cAAc,EAAE,mBAAmB,QAAQ;AAAA,EACtD,EAAE,aAAa,EAAE,MAAM,EAAE,QAAQ,UAAU,EAAE,CAAC;AAAA,EAC9C,EAAE,aAAa,EAAE,MAAM,EAAE,QAAQ,UAAU,GAAG,QAAQ,eAAe,CAAC;AACxE,CAAC;AAEM,MAAM,eAAe,EAAE,aAAa;AAAA,EACzC,MAAM;AAAA,EACN,QAAQ,EAAE,KAAK,CAAC,OAAO,QAAQ,QAA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AAC,EAAE,OAAO;AAC5D,SAAK,gBAAgB,WAAW,+DAA+D,UAAU,EAAE;AAC7G,MAAI,MAAM,mBAAmB,KAAK,CAAC,OAAO,CAAC,GAAG,UAAU,MAAM;AAC5D,SAAK,eAAe,sBAAsB,8CAA8C,UAAU,EAAE;AACtG,QAAM,WAAW,QAAQ;AAAA,IACvB,CAAC,UACC,MAAM,WAAW,YACjB,gBAAgB,KAAK,MAAM,KAAK,KAAK,CAAC,KACtC,CAAC,4BAA4B,KAAK,MAAM,IAAI,KAC5C,CAAC,MAAM,YAAY,KAAK,CAAC,cAAc,UAAU,KAAK,CAAC;AAAA,EAC3D;AACA,MAAI,SAAS;AACX;AAAA,MACE;AAAA,MACA;AAAA,MACA,4BAA4B,SAAS,IAAI,CAAC,UAAU,MAAM,IAAI,EAAE,KAAK,IAAI,CAAC,KAAK,UAAU;AAAA,IAC3F;AACF,MAAI,EAAE,MAAM,UAAU,CAAC,GAAG,KAAK,CAAC,SAAS,KAAK,KAAK,CAAC;AAClD,SAAK,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
  }
@@ -42,6 +42,8 @@ export declare const validIssue: () => {
42
42
  extends?: string[] | undefined;
43
43
  priorWork?: string[] | undefined;
44
44
  decisions?: string[] | undefined;
45
+ moneyPath?: boolean | undefined;
46
+ ownerOk?: string[] | undefined;
45
47
  surface?: {
46
48
  path: string;
47
49
  change: "add" | "delete" | "edit";
@@ -13,7 +13,8 @@ import {
13
13
  parseIssueBody,
14
14
  validateIssue,
15
15
  issueWarnings,
16
- IssueValidationError
16
+ IssueValidationError,
17
+ addedLocalPaths
17
18
  } from "./issueContract.js";
18
19
  import { AI_DELIVERY_MCP_TOOLS } from "./mcp/index.js";
19
20
  import { builderReady } from "./fixtures/builderReady.js";
@@ -631,6 +632,30 @@ test("Prior work round-trips after Extends", () => {
631
632
  assert.ok(body.indexOf("\n## Extends\n") < body.indexOf("\n## Prior work\n"));
632
633
  assert.deepEqual(parseIssueBody(body, { title: issue.title }).issue.priorWork, issue.priorWork);
633
634
  });
635
+ test("a moneyPath ticket is Ready only with an https Owner OK link, which round-trips", () => {
636
+ const link = "https://github.com/aviaratech/ai/issues/5842#issuecomment-1";
637
+ const ownerOkFailures = (value) => validateIssue({ ...builderReady(), ...value }).failures.filter((f) => f.code === "ownerOk");
638
+ assert.deepEqual(ownerOkFailures({ moneyPath: true, ownerOk: [link] }), []);
639
+ assert.deepEqual(ownerOkFailures({}), []);
640
+ for (const ownerOk of [void 0, ["Paul said yes"]])
641
+ assert.deepEqual(
642
+ ownerOkFailures({ moneyPath: true, ownerOk }).map((f) => f.fixHint),
643
+ ["Link the owner's comment that OKs this ticket's live-effect line, or set moneyPath to false."]
644
+ );
645
+ const issue = IssueFields.parse({ ...builderReady(), moneyPath: true, ownerOk: [link] });
646
+ const body = renderIssueBody(issue);
647
+ assert.ok(body.indexOf("\n## Decisions\n") < body.indexOf("\n## Money path\n\nyes\n\n## Owner OK\n"));
648
+ const parsed = parseIssueBody(body, { title: issue.title }).issue;
649
+ assert.deepEqual([parsed.moneyPath, parsed.ownerOk], [true, [link]]);
650
+ });
651
+ test("addedLocalPaths names only paths no current string already holds, legacy body included", () => {
652
+ const before = IssueFields.parse({ ...builderReady(), legacyBody: "old notes in .local/operator/x" });
653
+ assert.deepEqual(addedLocalPaths(before, { ...before, outcome: "see .local/operator/x" }), []);
654
+ assert.deepEqual(
655
+ addedLocalPaths(before, { ...before, proof: ["run ~/run.sh"] }).map((f) => [f.code, f.field]),
656
+ [["local-path", "proof.0"]]
657
+ );
658
+ });
634
659
  export {
635
660
  validIssue
636
661
  };