@aviaratech/ai-delivery 0.3.39 → 0.3.41

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 (41) hide show
  1. package/CONTRIBUTING.md +2 -0
  2. package/README.md +1 -1
  3. package/dist/cli.js +9 -0
  4. package/dist/cli.js.map +2 -2
  5. package/dist/dispatch.js +7 -0
  6. package/dist/dispatch.js.map +2 -2
  7. package/dist/fixtures/inertTarget.d.ts +33 -0
  8. package/dist/fixtures/inertTarget.js +42 -0
  9. package/dist/fixtures/inertTarget.js.map +2 -2
  10. package/dist/github/commandIdentityPolicy.js +1 -0
  11. package/dist/github/commandIdentityPolicy.js.map +2 -2
  12. package/dist/github/projectNumbers.d.ts +30 -0
  13. package/dist/github/projectNumbers.js +87 -0
  14. package/dist/github/projectNumbers.js.map +7 -0
  15. package/dist/issue.d.ts +4 -1
  16. package/dist/issue.js +50 -4
  17. package/dist/issue.js.map +2 -2
  18. package/dist/issueWriteRecovery.test.js +35 -0
  19. package/dist/issueWriteRecovery.test.js.map +2 -2
  20. package/dist/mcp/tools.d.ts +13 -0
  21. package/dist/mcp/tools.js +14 -1
  22. package/dist/mcp/tools.js.map +2 -2
  23. package/dist/milestone.d.ts +20 -0
  24. package/dist/milestone.js +41 -0
  25. package/dist/milestone.js.map +7 -0
  26. package/dist/milestone.test.d.ts +1 -0
  27. package/dist/milestone.test.js +101 -0
  28. package/dist/milestone.test.js.map +7 -0
  29. package/dist/projectNumbers.test.d.ts +1 -0
  30. package/dist/projectNumbers.test.js +114 -0
  31. package/dist/projectNumbers.test.js.map +7 -0
  32. package/dist/releaseSmoke.test.d.ts +1 -0
  33. package/dist/releaseSmoke.test.js +73 -0
  34. package/dist/releaseSmoke.test.js.map +7 -0
  35. package/dist/targetRepositoryExecution.test.js +6 -0
  36. package/dist/targetRepositoryExecution.test.js.map +2 -2
  37. package/package.json +1 -1
  38. package/plugins/ai-delivery/.claude-plugin/plugin.json +2 -2
  39. package/plugins/ai-delivery/plugin.json +1 -1
  40. package/plugins/ai-delivery/runtime/dist/cli.js +106 -93
  41. package/plugins/ai-delivery/runtime/package.json +1 -1
package/CONTRIBUTING.md CHANGED
@@ -28,3 +28,5 @@ Choose files deliberately. Add `--build-plugin` only when selected contracts req
28
28
  Existing [GitHub CI](.github/workflows/ci.yml) runs `npm run checks`. Merge requires current independent review and green required `checks`/`secrets` on the candidate and current base; local results cannot replace them. Inspect retained results and prove owned quiescence before retrying uncertain operations.
29
29
 
30
30
  Fast/focused success never qualifies a package. [Qualification](scripts/current-qualification.mjs) and [publication](.github/workflows/release.yml) are separate, explicitly authorized stages. Publication consumes independently accepted source/version/archive and the original successful artifact. Preserve confidentiality, archive, cleanup and host-policy gates; never substitute later reruns or silently replace accepted archives. Any packaged-file edit, including this guide, changes the candidate and requires independent qualification before release.
31
+
32
+ Before every publish, run `npm run build && node scripts/release-smoke.mjs` with the GitHub login you publish from. It creates a throwaway `--draft` issue in aviaratech/ai-delivery through the packed CLI, reads it back and closes it, then prints one `PASS` or `FAIL` line and exits non-zero on failure. Pass `--identity <name>` if you normally do. Publication does not proceed on a `FAIL`; close any issue it names by hand. CI does not run it: the Actions token cannot read the organization Project every command loads first (0.3.39 shipped with `issue_create` broken).
package/README.md CHANGED
@@ -111,4 +111,4 @@ Release still requires the exact mandatory archive inventory, complete release/c
111
111
 
112
112
  Release is manual, main-only and uses npm trusted publishing. A packaged README edit changes the release candidate: retain accepted archives and independently qualify the new exact source/archive before dispatching.
113
113
 
114
- Source version **0.3.39** and green PR checks do not establish its qualification; see [#199](https://github.com/aviaratech/ai-delivery/issues/199). Wrappers and workflow definitions do not prove [#200](https://github.com/aviaratech/ai-delivery/issues/200)'s **under-60-second regular checks / under-five-minute qualification** targets. Functional removals and remaining documentation obligations stay with [#201](https://github.com/aviaratech/ai-delivery/issues/201).
114
+ Source version **0.3.41** and green PR checks do not establish its qualification; see [#199](https://github.com/aviaratech/ai-delivery/issues/199). Wrappers and workflow definitions do not prove [#200](https://github.com/aviaratech/ai-delivery/issues/200)'s **under-60-second regular checks / under-five-minute qualification** targets. Functional removals and remaining documentation obligations stay with [#201](https://github.com/aviaratech/ai-delivery/issues/201).
package/dist/cli.js CHANGED
@@ -21,6 +21,7 @@ import { PACKAGE_VERSION } from "./version.js";
21
21
  import { managePlugin } from "./pluginInstaller.js";
22
22
  import { IssueWriteSchema, IssueStatusPatch, IssueDeferralPatch, ProjectStatusPatch } from "./issueContract.js";
23
23
  import { NativeIssueDateFields } from "./github/nativeIssueMetadata.js";
24
+ import { ProjectTradeFields } from "./github/projectNumbers.js";
24
25
  import { DeliveryError } from "./errors.js";
25
26
  const program = new Command();
26
27
  program.name("ai-delivery").description("Generic GitHub issue and pull request delivery").version(PACKAGE_VERSION).option("--identity <name>", "Configured author or reviewer identity").option("--personal-auth", "Explicit legacy personal-token author override").option("--json", "Print JSON output").option("--verbose", "Include full bodies, diffs and routing with --json").option("--repo <owner/name>", "GitHub repository owner/name; works from any directory").option("--repo-root <path>", "Launch directory or explicit clone for local operations", process.cwd());
@@ -63,6 +64,7 @@ function fields(file, overrides, update = false) {
63
64
  return {
64
65
  ...IssueWriteSchema.extend({
65
66
  ...NativeIssueDateFields,
67
+ ...update ? ProjectTradeFields : {},
66
68
  ...IssueDeferralPatch,
67
69
  status: IssueStatusPatch.optional(),
68
70
  ...update ? { projectStatus: ProjectStatusPatch.optional() } : {},
@@ -239,6 +241,13 @@ program.command("batch:update").description("Plan or apply 1\u201350 current-rep
239
241
  dryRun: o.dryRun === true
240
242
  })
241
243
  );
244
+ program.command("milestone:create").description("Create a repository milestone with an optional due date and description").requiredOption("--title <title>").option("--due-on <date>", "ISO date, YYYY-MM-DD").option("--description <text>").action(
245
+ async (o) => run("milestone_create", {
246
+ title: o.title,
247
+ ...o.dueOn === void 0 ? {} : { dueOn: o.dueOn },
248
+ ...o.description === void 0 ? {} : { description: o.description }
249
+ })
250
+ );
242
251
  program.command("info").requiredOption("--issue <number>").action(async (o) => run("issue_info", { issueNumber: int(o.issue) }));
243
252
  program.command("ready:check").requiredOption("--issue <number>").action(async (o) => run("issue_ready_check", { issueNumber: int(o.issue) }));
244
253
  program.command("pr:create").description("Create or reuse an issue-closing PR from a pushed --head, from any directory.").requiredOption("--issue <number>").option("--pr <number>", "Exact existing PR selector; never creates a replacement").option("--non-closing", "Open a draft PR that references the issue and leaves it open").option("--expected-head <sha>", "Refuse unless the pushed head is this SHA").option("--title <title>").option("--body-file <path>").option("--head <branch>", "Pushed remote head; no ai-delivery branch or worktree setup required").option("--base <branch>", "Repository default branch (inferred when omitted)").option("--ready", "Publish ready, or promote the author-owned PR selected by --head").option("--dry-run").action(
package/dist/cli.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/cli.ts"],
4
- "sourcesContent": ["#!/usr/bin/env node\nimport { closeSync, constants, fstatSync, openSync, readFileSync, readSync } from 'node:fs';\nimport { createHash } from 'node:crypto';\nimport { createDeliveryGitHubClients } from './github/client.js';\nimport { appCredentialSource, loadDeliverySettings } from './config/deliveryConfig.js';\nimport { Command } from 'commander';\nimport { z } from 'zod';\n\nimport { printCommandError, printCommandResult } from './cliResult.js';\nimport { contextFor, executeTool, type ExecutionContext } from './dispatch.js';\nimport { listPrs, preflightReviewRoute, prChecks, submitFormalReview } from './pr.js';\nimport {\n assertReviewVerdictTarget,\n buildReviewArtifact,\n parseReviewVerdict,\n readGitHubReviewBase,\n ReviewSubmissionError,\n validateReviewTarget,\n} from './review.js';\nimport { serveAiDeliveryMcp } from './mcp/index.js';\nimport type { AiDeliveryMcpToolName } from './mcp/tools.js';\nimport { PACKAGE_VERSION } from './version.js';\nimport { managePlugin } from './pluginInstaller.js';\nimport { IssueWriteSchema, IssueStatusPatch, IssueDeferralPatch, ProjectStatusPatch } from './issueContract.js';\nimport { NativeIssueDateFields } from './github/nativeIssueMetadata.js';\nimport { DeliveryError } from './errors.js';\n\nconst program = new Command();\nprogram\n .name('ai-delivery')\n .description('Generic GitHub issue and pull request delivery')\n .version(PACKAGE_VERSION)\n .option('--identity <name>', 'Configured author or reviewer identity')\n .option('--personal-auth', 'Explicit legacy personal-token author override')\n .option('--json', 'Print JSON output')\n .option('--verbose', 'Include full bodies, diffs and routing with --json')\n .option('--repo <owner/name>', 'GitHub repository owner/name; works from any directory')\n .option('--repo-root <path>', 'Launch directory or explicit clone for local operations', process.cwd());\n\n// Only the plugin command group owns a local --version input. Skip global option\n// values when selecting its parser so an unrelated argument named plugin has no effect.\nfor (let index = 2; index < process.argv.length; index++) {\n const argument = process.argv[index]!;\n const option = program.options.find((value) => value.long === argument.split('=')[0] || value.short === argument);\n if (option) {\n if (option.required && !argument.includes('=')) index++;\n continue;\n }\n if (argument === 'plugin') program.enablePositionalOptions();\n break;\n}\n\nfunction execution(): ExecutionContext {\n const options = program.opts<{\n identity?: string;\n personalAuth?: boolean;\n repo?: string;\n repoRoot: string;\n verbose?: boolean;\n }>();\n const identity = (options.identity ?? process.env.AI_DELIVERY_IDENTITY)?.trim() || undefined;\n return {\n repoRoot: options.repoRoot,\n ...(options.verbose === true ? { verbose: true } : {}),\n ...(identity === undefined ? {} : { identity }),\n personalAuth: options.personalAuth === true,\n ...(options.repo === undefined ? {} : { repo: options.repo }),\n };\n}\nfunction int(value: string | undefined): number | undefined {\n return value === undefined ? undefined : Number(value);\n}\nfunction list(value: string | undefined): string[] | undefined {\n return value === undefined\n ? undefined\n : value\n .split(',')\n .map((part) => part.trim())\n .filter(Boolean);\n}\nfunction ints(value: string | undefined): number[] | undefined {\n return list(value)?.map(Number);\n}\nfunction body(value: string | undefined, file: string | undefined): string | undefined {\n if (value !== undefined && file !== undefined) throw new Error('Pass either --body or --body-file.');\n return file === undefined ? value : readFileSync(file, 'utf8');\n}\nfunction fields(file: string | undefined, overrides: Record<string, unknown>, update = false): Record<string, unknown> {\n const value: unknown = file === undefined ? {} : JSON.parse(readFileSync(file, 'utf8'));\n return {\n ...IssueWriteSchema.extend({\n ...NativeIssueDateFields,\n ...IssueDeferralPatch,\n status: IssueStatusPatch.optional(),\n ...(update ? { projectStatus: ProjectStatusPatch.optional() } : {}),\n preserveHistory: z.boolean().optional(),\n }).parse(value),\n ...Object.fromEntries(Object.entries(overrides).filter(([, item]) => item !== undefined)),\n };\n}\nfunction run(name: AiDeliveryMcpToolName, input: Record<string, unknown>): Promise<void> {\n const options = program.opts<{ json?: boolean; verbose?: boolean }>();\n return executeTool(name, input, execution()).then((value) =>\n printCommandResult(name, value, options.json === true && options.verbose === true),\n );\n}\nfunction print(value: unknown): void {\n process.stdout.write(`${JSON.stringify(value, null, 2)}\\n`);\n}\n\nconst plugin = program.command('plugin').description('Manage the ai-delivery native plugin');\nfor (const action of ['install', 'doctor', 'preview', 'update', 'rollback', 'remove'] as const) {\n const command = plugin\n .command(action)\n .requiredOption('--host <host>', 'Native host: codex or claude-code')\n .option('--scope <scope>', 'Native scope: user, project, or local; Codex supports user', 'user')\n .option('--dry-run', 'Describe the selected target without changing files or contacting native tools')\n .option('--json', 'Print the result as JSON');\n if (action === 'install' || action === 'update')\n command.requiredOption('--version <version>', 'Explicit published package version');\n if (action === 'doctor')\n command.option('--check-auth', 'Read configured role identities and repository access; requires explicit --repo');\n command.action(\n async (options: {\n host: string;\n scope: string;\n version?: string;\n dryRun?: boolean;\n json?: boolean;\n checkAuth?: boolean;\n }) => {\n const result = await managePlugin({\n action,\n host: options.host,\n scope: options.scope,\n ...(options.version === undefined ? {} : { version: options.version }),\n dryRun: options.dryRun === true,\n checkAuth: options.checkAuth === true,\n ...(options.checkAuth && execution().repo ? { repo: execution().repo } : {}),\n repoRoot: execution().repoRoot,\n });\n if (options.json) {\n print(result);\n return;\n }\n process.stdout.write(\n `${result.dryRun ? 'Dry run: ' : ''}${result.host} ${result.scope}: ${action}; version ${result.version ?? 'none'}; installed ${result.installed}; changed ${result.changed}\\n`,\n );\n if (result.mcp)\n process.stdout.write(\n `Bundled MCP startup: ${result.mcp.startup}${result.mcp.error ? ` (${result.mcp.error})` : ''}\\n`,\n );\n if (result.diagnostics) {\n process.stdout.write(\n `Registration observations: ${result.diagnostics.registrations.length}; completeness ${result.diagnostics.completeness}; migration ${result.diagnostics.migration}; planned changes ${result.diagnostics.plannedChanges.length}\\n`,\n );\n for (const entry of result.diagnostics.registrations)\n process.stdout.write(\n `${entry.kind} ${entry.scope}: ownership ${entry.ownership}; source ${entry.source}; version ${entry.version ?? 'unknown'}\\n`,\n );\n process.stdout.write(`Unverified conditions: ${result.diagnostics.findings.join(', ')}\\n`);\n }\n if (result.activation)\n process.stdout.write(\n `Native session loaded version: unverified. Installed observation: ${result.activation.installedVersion ?? 'unknown'}; separate startup: ${result.activation.startupVersion ?? 'not checked'}. Use the host's surface-specific activation guidance.\\n`,\n );\n if (result.recoveryRequired)\n process.stdout.write('Resume the interrupted original plugin command to recover this target.\\n');\n if (result.authProbe)\n process.stdout.write(\n `Selected-runtime CLI auth probe: ${result.authProbe.outcome}; settings ${result.authProbe.settings}; process references ${result.authProbe.processReferences.status}; authentication ${result.authProbe.authentication.status}; repository access ${result.authProbe.repositoryAccess.status}${result.authProbe.reason ? ` (${result.authProbe.reason})` : ''}\\nNative GUI credential propagation and counted exact-head approval remain unverified.\\n`,\n );\n },\n );\n}\n\nprogram\n .command('create')\n .requiredOption('--title <title>')\n .option('--fields-file <path>', 'UTF-8 JSON typed fields; explicit CLI fields take precedence')\n .option('--epic', 'Create an active unsized parent issue')\n .option('--op-id <id>', 'Stable identity for retrying the same create')\n .option('--draft', 'Explicitly write an incomplete parked draft')\n .option('--body <markdown>')\n .option('--body-file <path>')\n .option('--type <type>')\n .option('--points <number>')\n .option('--priority <priority>')\n .option('--labels <labels>')\n .option('--blocked-by <numbers>')\n .option('--blocks <numbers>', 'Add this issue as a blocker of these dependents')\n .option('--override-reason <reason>', 'Required explanation when adding a blocker to active work')\n .option('--milestone <number>')\n .option('--parent <number>')\n .action(async (o: Record<string, string> & { draft?: boolean; epic?: boolean }) =>\n run(\n 'issue_create',\n fields(o.fieldsFile, {\n title: o.title,\n epic: o.epic,\n opId: o.opId,\n body: body(o.body, o.bodyFile),\n issueType: o.type,\n points: int(o.points),\n priority: o.priority,\n labels: list(o.labels),\n blockedBy: ints(o.blockedBy),\n blocks: ints(o.blocks),\n overrideReason: o.overrideReason,\n milestone: int(o.milestone),\n parentIssueNumber: int(o.parent),\n ...(o.draft === true ? { draft: true } : {}),\n }),\n ),\n );\n\nprogram\n .command('start')\n .option('--issue <number>')\n .option('--request <text>')\n .option('--request-id <id>', 'Stable retry identity for a new issue start')\n .option('--title <title>')\n .option('--body <markdown>')\n .option('--body-file <path>')\n .option('--type <type>')\n .option('--points <number>')\n .option('--priority <priority>')\n .option('--labels <labels>')\n .option('--blocked-by <numbers>')\n .option('--blocks <numbers>', 'Add this issue as a blocker of these dependents')\n .option('--override-reason <reason>', 'Capacity override reason, or explanation when adding a blocker to active work')\n .option('--milestone <number>')\n .option('--parent <number>')\n .option('--branch <branch>')\n .option('--resume-created')\n .action(async (o: Record<string, string | boolean>) =>\n run('issue_start', {\n issueNumber: int(o.issue as string),\n request: o.request,\n requestId: o.requestId,\n title: o.title,\n body: body(o.body as string, o.bodyFile as string),\n issueType: o.type,\n points: int(o.points as string),\n priority: o.priority,\n labels: list(o.labels as string),\n blockedBy: ints(o.blockedBy as string),\n blocks: ints(o.blocks as string),\n overrideReason: o.overrideReason,\n milestone: int(o.milestone as string),\n parentIssueNumber: int(o.parent as string),\n branch: o.branch,\n resumeCreated: o.resumeCreated === true,\n }),\n );\n\nfor (const name of ['list', 'search'] as const) {\n program\n .command(name)\n .option('--query <text>', 'Literal text to search in the selected repository')\n .option('--state <state>')\n .option('--labels <labels>')\n .option('--parent <number>')\n .option('--type <type>')\n .option('--project-status <status>')\n .option('--updated-since <timestamp>')\n .option('--page <number>')\n .option('--per-page <number>')\n .action(async (o: Record<string, string>) =>\n run(name === 'list' ? 'issue_list' : 'issue_search', {\n query: o.query,\n state: o.state,\n labels: list(o.labels),\n parentIssueNumber: int(o.parent),\n issueType: o.type,\n projectStatus: o.projectStatus,\n updatedSince: o.updatedSince,\n page: int(o.page),\n perPage: int(o.perPage),\n }),\n );\n}\n\nprogram\n .command('update')\n .requiredOption('--issue <number>')\n .option('--fields-file <path>', 'UTF-8 JSON typed issue field patch')\n .option('--draft', 'Explicitly write an incomplete parked draft')\n .option('--title <title>')\n .option('--body <markdown>')\n .option('--body-file <path>')\n .option('--type <type>')\n .option('--points <number>')\n .option('--priority <priority>')\n .option('--labels <labels>')\n .option('--blocked-by <numbers>')\n .option('--blocks <numbers>', 'Add this issue as a blocker of these dependents')\n .option('--override-reason <reason>', 'Required explanation when adding a blocker to active work')\n .option('--milestone <number>')\n .option('--parent <number>')\n .option('--state <state>')\n .option('--project-status <status>', 'Set Todo, In Progress, Blocked or Done with a public reason')\n .option('--project-status-reason <reason>', 'Required public reason for an explicit Project Status')\n .option('--preserve-history', 'Preserve the previous title and body before a rewrite')\n .option('--close-reason <reason>')\n .option('--superseded-by <number>')\n .option('--park', 'Park execution while retaining the issue worktree')\n .option('--defer', 'Defer until an explicit undefer')\n .option('--defer-until <date>', 'Record an ISO date condition without automatic undeferral')\n .option('--defer-trigger <text>', 'Record the condition for reconsidering deferred work')\n .option('--undefer', 'Explicitly clear deferral; draft and park remain unchanged')\n .action(\n async (\n o: Record<string, string> & {\n park?: boolean;\n preserveHistory?: boolean;\n draft?: boolean;\n defer?: boolean;\n undefer?: boolean;\n },\n ) =>\n run(\n 'issue_update',\n fields(\n o.fieldsFile,\n {\n issueNumber: int(o.issue),\n title: o.title,\n ...(o.draft === true ? { draft: true } : {}),\n body: body(o.body, o.bodyFile),\n issueType: o.type,\n points: int(o.points),\n priority: o.priority,\n labels: list(o.labels),\n blockedBy: ints(o.blockedBy),\n blocks: ints(o.blocks),\n overrideReason: o.overrideReason,\n milestone: int(o.milestone),\n parentIssueNumber: int(o.parent),\n state: o.state,\n projectStatus:\n o.projectStatus === undefined && o.projectStatusReason === undefined\n ? undefined\n : ProjectStatusPatch.parse({ status: o.projectStatus, reason: o.projectStatusReason }),\n preserveHistory: o.preserveHistory === true ? true : undefined,\n closeReason: o.closeReason,\n supersededBy: int(o.supersededBy),\n park: o.park === true ? true : undefined,\n defer:\n o.defer === true || o.deferUntil !== undefined || o.deferTrigger !== undefined\n ? {\n ...(o.deferUntil === undefined ? {} : { until: o.deferUntil }),\n ...(o.deferTrigger === undefined ? {} : { trigger: o.deferTrigger }),\n }\n : undefined,\n undefer: o.undefer === true ? true : undefined,\n },\n true,\n ),\n ),\n );\n\nprogram\n .command('batch:update')\n .description('Plan or apply 1\u201350 current-repository issue updates with ordered readback')\n .requiredOption('--items-file <path>', 'UTF-8 JSON array of complete issue_update inputs')\n .option('--dry-run', 'Return plans and readback without any native writes')\n .action(async (o: { itemsFile: string; dryRun?: boolean }) =>\n run('issue_batch_update', {\n items: JSON.parse(readFileSync(o.itemsFile, 'utf8')) as unknown,\n dryRun: o.dryRun === true,\n }),\n );\n\nprogram\n .command('info')\n .requiredOption('--issue <number>')\n .action(async (o: { issue: string }) => run('issue_info', { issueNumber: int(o.issue) }));\nprogram\n .command('ready:check')\n .requiredOption('--issue <number>')\n .action(async (o: { issue: string }) => run('issue_ready_check', { issueNumber: int(o.issue) }));\nprogram\n .command('pr:create')\n .description('Create or reuse an issue-closing PR from a pushed --head, from any directory.')\n .requiredOption('--issue <number>')\n .option('--pr <number>', 'Exact existing PR selector; never creates a replacement')\n .option('--non-closing', 'Open a draft PR that references the issue and leaves it open')\n .option('--expected-head <sha>', 'Refuse unless the pushed head is this SHA')\n .option('--title <title>')\n .option('--body-file <path>')\n .option('--head <branch>', 'Pushed remote head; no ai-delivery branch or worktree setup required')\n .option('--base <branch>', 'Repository default branch (inferred when omitted)')\n .option('--ready', 'Publish ready, or promote the author-owned PR selected by --head')\n .option('--dry-run')\n .action(\n async (o: {\n issue: string;\n pr?: string;\n nonClosing?: boolean;\n expectedHead?: string;\n title?: string;\n bodyFile?: string;\n head?: string;\n base?: string;\n ready?: boolean;\n dryRun?: boolean;\n }) =>\n run('issue_pr_create', {\n issueNumber: int(o.issue),\n prNumber: int(o.pr),\n nonClosing: o.nonClosing,\n expectedHeadSha: o.expectedHead,\n title: o.title,\n body: body(undefined, o.bodyFile),\n headBranch: o.head,\n base: o.base,\n draft: o.ready !== true,\n dryRun: o.dryRun === true,\n }),\n );\nprogram\n .command('pr:info')\n .description('Inspect an exact PR; combine --issue and --pr to verify its native closing-issue association.')\n .option('--non-closing', 'Verify an exact native non-closing PR-to-issue reference')\n .option('--issue <number>', 'Issue to verify; issue-only lookup requires a GitHub-linked branch')\n .option('--pr <number>', 'Exact PR number; include --issue after issue branch links are replaced on publication')\n .action(async (o: { issue?: string; pr?: string; nonClosing?: boolean }) =>\n run('issue_pr_info', { issueNumber: int(o.issue), prNumber: int(o.pr), nonClosing: o.nonClosing }),\n );\nprogram\n .command('pr:list')\n .option('--state <state>', 'open, closed or all', 'open')\n .action(async (o: { state: string }) => {\n if (!['open', 'closed', 'all'].includes(o.state)) throw new Error('Invalid PR state.');\n const context = await contextFor(execution(), 'pr:list');\n print(await listPrs(context, o.state as 'open' | 'closed' | 'all'));\n });\nprogram\n .command('pr:checks')\n .requiredOption('--pr <number>')\n .action(async (o: { pr: string }) => {\n const context = await contextFor(execution(), 'pr:checks');\n print(await prChecks(context, Number(o.pr)));\n });\nprogram\n .command('pr:review')\n .requiredOption('--issue <number>')\n .requiredOption('--pr <number>')\n .requiredOption('--artifact <path>', 'Path to a UTF-8 JSON review artifact file (not inline JSON)')\n .option('--non-closing', 'Retain the referenced issue OPEN; finish refuses this mode')\n .option('--dry-run')\n .action(async (o: { issue: string; pr: string; artifact: string; dryRun?: boolean; nonClosing?: boolean }) =>\n run('issue_pr_review', {\n issueNumber: int(o.issue),\n prNumber: int(o.pr),\n artifact: readFileSync(o.artifact, 'utf8'),\n dryRun: o.dryRun === true,\n nonClosing: o.nonClosing,\n }),\n );\nprogram\n .command('review')\n .argument('<action>', 'submit or doctor')\n .description('Submit an independent verdict or check its configured App')\n .option('--pr <number>', 'Required for submit')\n .option('--head <sha>', 'Required exact head for submit')\n .option('--identity <name>', 'Required configured reviewer profile')\n .option('--verdict <path>', 'Required for submit: UTF-8 JSON verdict, at most 64 KiB')\n .action(async (action: string, o: { pr?: string; head?: string; identity?: string; verdict?: string }) => {\n if (!['submit', 'doctor'].includes(action)) throw new DeliveryError('review action must be submit or doctor.');\n const identity = o.identity ?? execution().identity ?? '';\n const settings = await loadDeliverySettings(undefined, { reviewerIdentity: identity, prepareEnvironment: true });\n const profile = settings.roles.reviewer;\n if (!('appId' in profile))\n throw new DeliveryError('identity: Select a reviewer profile with explicit App/provider binding.');\n if (action === 'doctor') {\n if (o.pr !== undefined || o.head !== undefined || o.verdict !== undefined)\n throw new DeliveryError('review doctor does not accept submission inputs.');\n const clients = await createDeliveryGitHubClients({\n config: settings,\n identity,\n role: 'reviewer',\n env: settings.environment!,\n });\n const actorLogin = await clients.appActorLogin!();\n printCommandResult('review:doctor', {\n status: 'authenticated',\n identity,\n provider: profile.provider,\n appId: profile.appId,\n installationId: profile.installationId,\n actorLogin,\n source: appCredentialSource(profile).type,\n });\n return;\n }\n if (o.pr === undefined || o.head === undefined || o.verdict === undefined)\n throw new DeliveryError('review submit requires --pr, --head and --verdict.');\n const fd = openSync(o.verdict, constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_NONBLOCK);\n let raw: string;\n let verdictFileSha256: string;\n try {\n if (!fstatSync(fd).isFile()) throw new DeliveryError('verdict: Expected a regular file.');\n const bytes = Buffer.alloc(64 * 1024 + 1);\n let size = 0;\n while (size < bytes.length) {\n const count = readSync(fd, bytes, size, bytes.length - size, null);\n if (count === 0) break;\n size += count;\n }\n if (size > 64 * 1024) throw new DeliveryError('verdict: File exceeds 64 KiB.');\n const content = bytes.subarray(0, size);\n raw = content.toString('utf8');\n if (!Buffer.from(raw, 'utf8').equals(content)) throw new DeliveryError('verdict: Expected valid UTF-8.');\n verdictFileSha256 = `sha256:${createHash('sha256').update(content).digest('hex')}`;\n } finally {\n closeSync(fd);\n }\n const verdict = parseReviewVerdict(raw);\n assertReviewVerdictTarget(verdict, profile.provider, o.head);\n const prNumber = z.number().int().positive().parse(Number(o.pr));\n const authorContext = await contextFor(\n { ...execution(), settings, identity, reviewSubmission: true },\n 'pr:info',\n 'author',\n );\n const reviewBase = await readGitHubReviewBase(authorContext, prNumber, o.head);\n const artifact = buildReviewArtifact({\n verdict,\n verdictFileSha256,\n identity,\n provider: profile.provider,\n expectedHead: o.head,\n prNumber,\n authorIdentity: settings.roles.author.identity,\n reviewBase,\n });\n await validateReviewTarget(authorContext, artifact, prNumber);\n const clients = await createDeliveryGitHubClients({\n config: authorContext.config,\n identity,\n role: 'reviewer',\n selectedAuthor: authorContext.clients,\n ...(authorContext.credentialEnvironment === undefined ? {} : { env: authorContext.credentialEnvironment }),\n });\n const context = { ...authorContext, clients };\n try {\n printCommandResult(\n 'review:submit',\n await submitFormalReview(context, {\n artifact: JSON.stringify(artifact),\n issueNumber: verdict.issueNumber,\n prNumber,\n ...(verdict.nonClosing === undefined ? {} : { nonClosing: verdict.nonClosing }),\n }),\n );\n } catch (error) {\n if (!(error instanceof ReviewSubmissionError)) throw error;\n process.stdout.write(\n `${JSON.stringify({ status: 'submission-unverified', submission: error.submission, nextAction: error.message })}\\n`,\n );\n process.exitCode = 1;\n }\n });\n\nprogram\n .command('config:resolve')\n .description('Read the effective GitHub destination and admission digest')\n .action(async () => {\n const context = await contextFor(execution(), 'config:resolve');\n print({\n configDigest: context.configuration?.configDigest,\n routing: context.configuration?.routing,\n reviewRoute: await preflightReviewRoute(context, undefined, undefined, 'development'),\n });\n });\nprogram.command('mcp:serve').action(async () => serveAiDeliveryMcp(execution()));\n\nprogram.parseAsync(process.argv).catch((error: unknown) => {\n const options = program.opts<{ json?: boolean; verbose?: boolean }>();\n printCommandError(error, options.json === true && options.verbose === true);\n});\n"],
5
- "mappings": ";AACA,SAAS,WAAW,WAAW,WAAW,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M,QAAQ,CAAC,CAAC;AAAA;AAAA,IACjH;AACA,YAAQ,WAAW;AAAA,EACrB;AACF,CAAC;AAEH,QACG,QAAQ,gBAAgB,EACxB,YAAY,4DAA4D,EACxE,OAAO,YAAY;AAClB,QAAM,UAAU,MAAM,WAAW,UAAU,GAAG,gBAAgB;AAC9D,QAAM;AAAA,IACJ,cAAc,QAAQ,eAAe;AAAA,IACrC,SAAS,QAAQ,eAAe;AAAA,IAChC,aAAa,MAAM,qBAAqB,SAAS,QAAW,QAAW,aAAa;AAAA,EACtF,CAAC;AACH,CAAC;AACH,QAAQ,QAAQ,WAAW,EAAE,OAAO,YAAY,mBAAmB,UAAU,CAAC,CAAC;AAE/E,QAAQ,WAAW,QAAQ,IAAI,EAAE,MAAM,CAAC,UAAmB;AACzD,QAAM,UAAU,QAAQ,KAA4C;AACpE,oBAAkB,OAAO,QAAQ,SAAS,QAAQ,QAAQ,YAAY,IAAI;AAC5E,CAAC;",
4
+ "sourcesContent": ["#!/usr/bin/env node\nimport { closeSync, constants, fstatSync, openSync, readFileSync, readSync } from 'node:fs';\nimport { createHash } from 'node:crypto';\nimport { createDeliveryGitHubClients } from './github/client.js';\nimport { appCredentialSource, loadDeliverySettings } from './config/deliveryConfig.js';\nimport { Command } from 'commander';\nimport { z } from 'zod';\n\nimport { printCommandError, printCommandResult } from './cliResult.js';\nimport { contextFor, executeTool, type ExecutionContext } from './dispatch.js';\nimport { listPrs, preflightReviewRoute, prChecks, submitFormalReview } from './pr.js';\nimport {\n assertReviewVerdictTarget,\n buildReviewArtifact,\n parseReviewVerdict,\n readGitHubReviewBase,\n ReviewSubmissionError,\n validateReviewTarget,\n} from './review.js';\nimport { serveAiDeliveryMcp } from './mcp/index.js';\nimport type { AiDeliveryMcpToolName } from './mcp/tools.js';\nimport { PACKAGE_VERSION } from './version.js';\nimport { managePlugin } from './pluginInstaller.js';\nimport { IssueWriteSchema, IssueStatusPatch, IssueDeferralPatch, ProjectStatusPatch } from './issueContract.js';\nimport { NativeIssueDateFields } from './github/nativeIssueMetadata.js';\nimport { ProjectTradeFields } from './github/projectNumbers.js';\nimport { DeliveryError } from './errors.js';\n\nconst program = new Command();\nprogram\n .name('ai-delivery')\n .description('Generic GitHub issue and pull request delivery')\n .version(PACKAGE_VERSION)\n .option('--identity <name>', 'Configured author or reviewer identity')\n .option('--personal-auth', 'Explicit legacy personal-token author override')\n .option('--json', 'Print JSON output')\n .option('--verbose', 'Include full bodies, diffs and routing with --json')\n .option('--repo <owner/name>', 'GitHub repository owner/name; works from any directory')\n .option('--repo-root <path>', 'Launch directory or explicit clone for local operations', process.cwd());\n\n// Only the plugin command group owns a local --version input. Skip global option\n// values when selecting its parser so an unrelated argument named plugin has no effect.\nfor (let index = 2; index < process.argv.length; index++) {\n const argument = process.argv[index]!;\n const option = program.options.find((value) => value.long === argument.split('=')[0] || value.short === argument);\n if (option) {\n if (option.required && !argument.includes('=')) index++;\n continue;\n }\n if (argument === 'plugin') program.enablePositionalOptions();\n break;\n}\n\nfunction execution(): ExecutionContext {\n const options = program.opts<{\n identity?: string;\n personalAuth?: boolean;\n repo?: string;\n repoRoot: string;\n verbose?: boolean;\n }>();\n const identity = (options.identity ?? process.env.AI_DELIVERY_IDENTITY)?.trim() || undefined;\n return {\n repoRoot: options.repoRoot,\n ...(options.verbose === true ? { verbose: true } : {}),\n ...(identity === undefined ? {} : { identity }),\n personalAuth: options.personalAuth === true,\n ...(options.repo === undefined ? {} : { repo: options.repo }),\n };\n}\nfunction int(value: string | undefined): number | undefined {\n return value === undefined ? undefined : Number(value);\n}\nfunction list(value: string | undefined): string[] | undefined {\n return value === undefined\n ? undefined\n : value\n .split(',')\n .map((part) => part.trim())\n .filter(Boolean);\n}\nfunction ints(value: string | undefined): number[] | undefined {\n return list(value)?.map(Number);\n}\nfunction body(value: string | undefined, file: string | undefined): string | undefined {\n if (value !== undefined && file !== undefined) throw new Error('Pass either --body or --body-file.');\n return file === undefined ? value : readFileSync(file, 'utf8');\n}\nfunction fields(file: string | undefined, overrides: Record<string, unknown>, update = false): Record<string, unknown> {\n const value: unknown = file === undefined ? {} : JSON.parse(readFileSync(file, 'utf8'));\n return {\n ...IssueWriteSchema.extend({\n ...NativeIssueDateFields,\n ...(update ? ProjectTradeFields : {}),\n ...IssueDeferralPatch,\n status: IssueStatusPatch.optional(),\n ...(update ? { projectStatus: ProjectStatusPatch.optional() } : {}),\n preserveHistory: z.boolean().optional(),\n }).parse(value),\n ...Object.fromEntries(Object.entries(overrides).filter(([, item]) => item !== undefined)),\n };\n}\nfunction run(name: AiDeliveryMcpToolName, input: Record<string, unknown>): Promise<void> {\n const options = program.opts<{ json?: boolean; verbose?: boolean }>();\n return executeTool(name, input, execution()).then((value) =>\n printCommandResult(name, value, options.json === true && options.verbose === true),\n );\n}\nfunction print(value: unknown): void {\n process.stdout.write(`${JSON.stringify(value, null, 2)}\\n`);\n}\n\nconst plugin = program.command('plugin').description('Manage the ai-delivery native plugin');\nfor (const action of ['install', 'doctor', 'preview', 'update', 'rollback', 'remove'] as const) {\n const command = plugin\n .command(action)\n .requiredOption('--host <host>', 'Native host: codex or claude-code')\n .option('--scope <scope>', 'Native scope: user, project, or local; Codex supports user', 'user')\n .option('--dry-run', 'Describe the selected target without changing files or contacting native tools')\n .option('--json', 'Print the result as JSON');\n if (action === 'install' || action === 'update')\n command.requiredOption('--version <version>', 'Explicit published package version');\n if (action === 'doctor')\n command.option('--check-auth', 'Read configured role identities and repository access; requires explicit --repo');\n command.action(\n async (options: {\n host: string;\n scope: string;\n version?: string;\n dryRun?: boolean;\n json?: boolean;\n checkAuth?: boolean;\n }) => {\n const result = await managePlugin({\n action,\n host: options.host,\n scope: options.scope,\n ...(options.version === undefined ? {} : { version: options.version }),\n dryRun: options.dryRun === true,\n checkAuth: options.checkAuth === true,\n ...(options.checkAuth && execution().repo ? { repo: execution().repo } : {}),\n repoRoot: execution().repoRoot,\n });\n if (options.json) {\n print(result);\n return;\n }\n process.stdout.write(\n `${result.dryRun ? 'Dry run: ' : ''}${result.host} ${result.scope}: ${action}; version ${result.version ?? 'none'}; installed ${result.installed}; changed ${result.changed}\\n`,\n );\n if (result.mcp)\n process.stdout.write(\n `Bundled MCP startup: ${result.mcp.startup}${result.mcp.error ? ` (${result.mcp.error})` : ''}\\n`,\n );\n if (result.diagnostics) {\n process.stdout.write(\n `Registration observations: ${result.diagnostics.registrations.length}; completeness ${result.diagnostics.completeness}; migration ${result.diagnostics.migration}; planned changes ${result.diagnostics.plannedChanges.length}\\n`,\n );\n for (const entry of result.diagnostics.registrations)\n process.stdout.write(\n `${entry.kind} ${entry.scope}: ownership ${entry.ownership}; source ${entry.source}; version ${entry.version ?? 'unknown'}\\n`,\n );\n process.stdout.write(`Unverified conditions: ${result.diagnostics.findings.join(', ')}\\n`);\n }\n if (result.activation)\n process.stdout.write(\n `Native session loaded version: unverified. Installed observation: ${result.activation.installedVersion ?? 'unknown'}; separate startup: ${result.activation.startupVersion ?? 'not checked'}. Use the host's surface-specific activation guidance.\\n`,\n );\n if (result.recoveryRequired)\n process.stdout.write('Resume the interrupted original plugin command to recover this target.\\n');\n if (result.authProbe)\n process.stdout.write(\n `Selected-runtime CLI auth probe: ${result.authProbe.outcome}; settings ${result.authProbe.settings}; process references ${result.authProbe.processReferences.status}; authentication ${result.authProbe.authentication.status}; repository access ${result.authProbe.repositoryAccess.status}${result.authProbe.reason ? ` (${result.authProbe.reason})` : ''}\\nNative GUI credential propagation and counted exact-head approval remain unverified.\\n`,\n );\n },\n );\n}\n\nprogram\n .command('create')\n .requiredOption('--title <title>')\n .option('--fields-file <path>', 'UTF-8 JSON typed fields; explicit CLI fields take precedence')\n .option('--epic', 'Create an active unsized parent issue')\n .option('--op-id <id>', 'Stable identity for retrying the same create')\n .option('--draft', 'Explicitly write an incomplete parked draft')\n .option('--body <markdown>')\n .option('--body-file <path>')\n .option('--type <type>')\n .option('--points <number>')\n .option('--priority <priority>')\n .option('--labels <labels>')\n .option('--blocked-by <numbers>')\n .option('--blocks <numbers>', 'Add this issue as a blocker of these dependents')\n .option('--override-reason <reason>', 'Required explanation when adding a blocker to active work')\n .option('--milestone <number>')\n .option('--parent <number>')\n .action(async (o: Record<string, string> & { draft?: boolean; epic?: boolean }) =>\n run(\n 'issue_create',\n fields(o.fieldsFile, {\n title: o.title,\n epic: o.epic,\n opId: o.opId,\n body: body(o.body, o.bodyFile),\n issueType: o.type,\n points: int(o.points),\n priority: o.priority,\n labels: list(o.labels),\n blockedBy: ints(o.blockedBy),\n blocks: ints(o.blocks),\n overrideReason: o.overrideReason,\n milestone: int(o.milestone),\n parentIssueNumber: int(o.parent),\n ...(o.draft === true ? { draft: true } : {}),\n }),\n ),\n );\n\nprogram\n .command('start')\n .option('--issue <number>')\n .option('--request <text>')\n .option('--request-id <id>', 'Stable retry identity for a new issue start')\n .option('--title <title>')\n .option('--body <markdown>')\n .option('--body-file <path>')\n .option('--type <type>')\n .option('--points <number>')\n .option('--priority <priority>')\n .option('--labels <labels>')\n .option('--blocked-by <numbers>')\n .option('--blocks <numbers>', 'Add this issue as a blocker of these dependents')\n .option('--override-reason <reason>', 'Capacity override reason, or explanation when adding a blocker to active work')\n .option('--milestone <number>')\n .option('--parent <number>')\n .option('--branch <branch>')\n .option('--resume-created')\n .action(async (o: Record<string, string | boolean>) =>\n run('issue_start', {\n issueNumber: int(o.issue as string),\n request: o.request,\n requestId: o.requestId,\n title: o.title,\n body: body(o.body as string, o.bodyFile as string),\n issueType: o.type,\n points: int(o.points as string),\n priority: o.priority,\n labels: list(o.labels as string),\n blockedBy: ints(o.blockedBy as string),\n blocks: ints(o.blocks as string),\n overrideReason: o.overrideReason,\n milestone: int(o.milestone as string),\n parentIssueNumber: int(o.parent as string),\n branch: o.branch,\n resumeCreated: o.resumeCreated === true,\n }),\n );\n\nfor (const name of ['list', 'search'] as const) {\n program\n .command(name)\n .option('--query <text>', 'Literal text to search in the selected repository')\n .option('--state <state>')\n .option('--labels <labels>')\n .option('--parent <number>')\n .option('--type <type>')\n .option('--project-status <status>')\n .option('--updated-since <timestamp>')\n .option('--page <number>')\n .option('--per-page <number>')\n .action(async (o: Record<string, string>) =>\n run(name === 'list' ? 'issue_list' : 'issue_search', {\n query: o.query,\n state: o.state,\n labels: list(o.labels),\n parentIssueNumber: int(o.parent),\n issueType: o.type,\n projectStatus: o.projectStatus,\n updatedSince: o.updatedSince,\n page: int(o.page),\n perPage: int(o.perPage),\n }),\n );\n}\n\nprogram\n .command('update')\n .requiredOption('--issue <number>')\n .option('--fields-file <path>', 'UTF-8 JSON typed issue field patch')\n .option('--draft', 'Explicitly write an incomplete parked draft')\n .option('--title <title>')\n .option('--body <markdown>')\n .option('--body-file <path>')\n .option('--type <type>')\n .option('--points <number>')\n .option('--priority <priority>')\n .option('--labels <labels>')\n .option('--blocked-by <numbers>')\n .option('--blocks <numbers>', 'Add this issue as a blocker of these dependents')\n .option('--override-reason <reason>', 'Required explanation when adding a blocker to active work')\n .option('--milestone <number>')\n .option('--parent <number>')\n .option('--state <state>')\n .option('--project-status <status>', 'Set Todo, In Progress, Blocked or Done with a public reason')\n .option('--project-status-reason <reason>', 'Required public reason for an explicit Project Status')\n .option('--preserve-history', 'Preserve the previous title and body before a rewrite')\n .option('--close-reason <reason>')\n .option('--superseded-by <number>')\n .option('--park', 'Park execution while retaining the issue worktree')\n .option('--defer', 'Defer until an explicit undefer')\n .option('--defer-until <date>', 'Record an ISO date condition without automatic undeferral')\n .option('--defer-trigger <text>', 'Record the condition for reconsidering deferred work')\n .option('--undefer', 'Explicitly clear deferral; draft and park remain unchanged')\n .action(\n async (\n o: Record<string, string> & {\n park?: boolean;\n preserveHistory?: boolean;\n draft?: boolean;\n defer?: boolean;\n undefer?: boolean;\n },\n ) =>\n run(\n 'issue_update',\n fields(\n o.fieldsFile,\n {\n issueNumber: int(o.issue),\n title: o.title,\n ...(o.draft === true ? { draft: true } : {}),\n body: body(o.body, o.bodyFile),\n issueType: o.type,\n points: int(o.points),\n priority: o.priority,\n labels: list(o.labels),\n blockedBy: ints(o.blockedBy),\n blocks: ints(o.blocks),\n overrideReason: o.overrideReason,\n milestone: int(o.milestone),\n parentIssueNumber: int(o.parent),\n state: o.state,\n projectStatus:\n o.projectStatus === undefined && o.projectStatusReason === undefined\n ? undefined\n : ProjectStatusPatch.parse({ status: o.projectStatus, reason: o.projectStatusReason }),\n preserveHistory: o.preserveHistory === true ? true : undefined,\n closeReason: o.closeReason,\n supersededBy: int(o.supersededBy),\n park: o.park === true ? true : undefined,\n defer:\n o.defer === true || o.deferUntil !== undefined || o.deferTrigger !== undefined\n ? {\n ...(o.deferUntil === undefined ? {} : { until: o.deferUntil }),\n ...(o.deferTrigger === undefined ? {} : { trigger: o.deferTrigger }),\n }\n : undefined,\n undefer: o.undefer === true ? true : undefined,\n },\n true,\n ),\n ),\n );\n\nprogram\n .command('batch:update')\n .description('Plan or apply 1\u201350 current-repository issue updates with ordered readback')\n .requiredOption('--items-file <path>', 'UTF-8 JSON array of complete issue_update inputs')\n .option('--dry-run', 'Return plans and readback without any native writes')\n .action(async (o: { itemsFile: string; dryRun?: boolean }) =>\n run('issue_batch_update', {\n items: JSON.parse(readFileSync(o.itemsFile, 'utf8')) as unknown,\n dryRun: o.dryRun === true,\n }),\n );\n\nprogram\n .command('milestone:create')\n .description('Create a repository milestone with an optional due date and description')\n .requiredOption('--title <title>')\n .option('--due-on <date>', 'ISO date, YYYY-MM-DD')\n .option('--description <text>')\n .action(async (o: { title: string; dueOn?: string; description?: string }) =>\n run('milestone_create', {\n title: o.title,\n ...(o.dueOn === undefined ? {} : { dueOn: o.dueOn }),\n ...(o.description === undefined ? {} : { description: o.description }),\n }),\n );\n\nprogram\n .command('info')\n .requiredOption('--issue <number>')\n .action(async (o: { issue: string }) => run('issue_info', { issueNumber: int(o.issue) }));\nprogram\n .command('ready:check')\n .requiredOption('--issue <number>')\n .action(async (o: { issue: string }) => run('issue_ready_check', { issueNumber: int(o.issue) }));\nprogram\n .command('pr:create')\n .description('Create or reuse an issue-closing PR from a pushed --head, from any directory.')\n .requiredOption('--issue <number>')\n .option('--pr <number>', 'Exact existing PR selector; never creates a replacement')\n .option('--non-closing', 'Open a draft PR that references the issue and leaves it open')\n .option('--expected-head <sha>', 'Refuse unless the pushed head is this SHA')\n .option('--title <title>')\n .option('--body-file <path>')\n .option('--head <branch>', 'Pushed remote head; no ai-delivery branch or worktree setup required')\n .option('--base <branch>', 'Repository default branch (inferred when omitted)')\n .option('--ready', 'Publish ready, or promote the author-owned PR selected by --head')\n .option('--dry-run')\n .action(\n async (o: {\n issue: string;\n pr?: string;\n nonClosing?: boolean;\n expectedHead?: string;\n title?: string;\n bodyFile?: string;\n head?: string;\n base?: string;\n ready?: boolean;\n dryRun?: boolean;\n }) =>\n run('issue_pr_create', {\n issueNumber: int(o.issue),\n prNumber: int(o.pr),\n nonClosing: o.nonClosing,\n expectedHeadSha: o.expectedHead,\n title: o.title,\n body: body(undefined, o.bodyFile),\n headBranch: o.head,\n base: o.base,\n draft: o.ready !== true,\n dryRun: o.dryRun === true,\n }),\n );\nprogram\n .command('pr:info')\n .description('Inspect an exact PR; combine --issue and --pr to verify its native closing-issue association.')\n .option('--non-closing', 'Verify an exact native non-closing PR-to-issue reference')\n .option('--issue <number>', 'Issue to verify; issue-only lookup requires a GitHub-linked branch')\n .option('--pr <number>', 'Exact PR number; include --issue after issue branch links are replaced on publication')\n .action(async (o: { issue?: string; pr?: string; nonClosing?: boolean }) =>\n run('issue_pr_info', { issueNumber: int(o.issue), prNumber: int(o.pr), nonClosing: o.nonClosing }),\n );\nprogram\n .command('pr:list')\n .option('--state <state>', 'open, closed or all', 'open')\n .action(async (o: { state: string }) => {\n if (!['open', 'closed', 'all'].includes(o.state)) throw new Error('Invalid PR state.');\n const context = await contextFor(execution(), 'pr:list');\n print(await listPrs(context, o.state as 'open' | 'closed' | 'all'));\n });\nprogram\n .command('pr:checks')\n .requiredOption('--pr <number>')\n .action(async (o: { pr: string }) => {\n const context = await contextFor(execution(), 'pr:checks');\n print(await prChecks(context, Number(o.pr)));\n });\nprogram\n .command('pr:review')\n .requiredOption('--issue <number>')\n .requiredOption('--pr <number>')\n .requiredOption('--artifact <path>', 'Path to a UTF-8 JSON review artifact file (not inline JSON)')\n .option('--non-closing', 'Retain the referenced issue OPEN; finish refuses this mode')\n .option('--dry-run')\n .action(async (o: { issue: string; pr: string; artifact: string; dryRun?: boolean; nonClosing?: boolean }) =>\n run('issue_pr_review', {\n issueNumber: int(o.issue),\n prNumber: int(o.pr),\n artifact: readFileSync(o.artifact, 'utf8'),\n dryRun: o.dryRun === true,\n nonClosing: o.nonClosing,\n }),\n );\nprogram\n .command('review')\n .argument('<action>', 'submit or doctor')\n .description('Submit an independent verdict or check its configured App')\n .option('--pr <number>', 'Required for submit')\n .option('--head <sha>', 'Required exact head for submit')\n .option('--identity <name>', 'Required configured reviewer profile')\n .option('--verdict <path>', 'Required for submit: UTF-8 JSON verdict, at most 64 KiB')\n .action(async (action: string, o: { pr?: string; head?: string; identity?: string; verdict?: string }) => {\n if (!['submit', 'doctor'].includes(action)) throw new DeliveryError('review action must be submit or doctor.');\n const identity = o.identity ?? execution().identity ?? '';\n const settings = await loadDeliverySettings(undefined, { reviewerIdentity: identity, prepareEnvironment: true });\n const profile = settings.roles.reviewer;\n if (!('appId' in profile))\n throw new DeliveryError('identity: Select a reviewer profile with explicit App/provider binding.');\n if (action === 'doctor') {\n if (o.pr !== undefined || o.head !== undefined || o.verdict !== undefined)\n throw new DeliveryError('review doctor does not accept submission inputs.');\n const clients = await createDeliveryGitHubClients({\n config: settings,\n identity,\n role: 'reviewer',\n env: settings.environment!,\n });\n const actorLogin = await clients.appActorLogin!();\n printCommandResult('review:doctor', {\n status: 'authenticated',\n identity,\n provider: profile.provider,\n appId: profile.appId,\n installationId: profile.installationId,\n actorLogin,\n source: appCredentialSource(profile).type,\n });\n return;\n }\n if (o.pr === undefined || o.head === undefined || o.verdict === undefined)\n throw new DeliveryError('review submit requires --pr, --head and --verdict.');\n const fd = openSync(o.verdict, constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_NONBLOCK);\n let raw: string;\n let verdictFileSha256: string;\n try {\n if (!fstatSync(fd).isFile()) throw new DeliveryError('verdict: Expected a regular file.');\n const bytes = Buffer.alloc(64 * 1024 + 1);\n let size = 0;\n while (size < bytes.length) {\n const count = readSync(fd, bytes, size, bytes.length - size, null);\n if (count === 0) break;\n size += count;\n }\n if (size > 64 * 1024) throw new DeliveryError('verdict: File exceeds 64 KiB.');\n const content = bytes.subarray(0, size);\n raw = content.toString('utf8');\n if (!Buffer.from(raw, 'utf8').equals(content)) throw new DeliveryError('verdict: Expected valid UTF-8.');\n verdictFileSha256 = `sha256:${createHash('sha256').update(content).digest('hex')}`;\n } finally {\n closeSync(fd);\n }\n const verdict = parseReviewVerdict(raw);\n assertReviewVerdictTarget(verdict, profile.provider, o.head);\n const prNumber = z.number().int().positive().parse(Number(o.pr));\n const authorContext = await contextFor(\n { ...execution(), settings, identity, reviewSubmission: true },\n 'pr:info',\n 'author',\n );\n const reviewBase = await readGitHubReviewBase(authorContext, prNumber, o.head);\n const artifact = buildReviewArtifact({\n verdict,\n verdictFileSha256,\n identity,\n provider: profile.provider,\n expectedHead: o.head,\n prNumber,\n authorIdentity: settings.roles.author.identity,\n reviewBase,\n });\n await validateReviewTarget(authorContext, artifact, prNumber);\n const clients = await createDeliveryGitHubClients({\n config: authorContext.config,\n identity,\n role: 'reviewer',\n selectedAuthor: authorContext.clients,\n ...(authorContext.credentialEnvironment === undefined ? {} : { env: authorContext.credentialEnvironment }),\n });\n const context = { ...authorContext, clients };\n try {\n printCommandResult(\n 'review:submit',\n await submitFormalReview(context, {\n artifact: JSON.stringify(artifact),\n issueNumber: verdict.issueNumber,\n prNumber,\n ...(verdict.nonClosing === undefined ? {} : { nonClosing: verdict.nonClosing }),\n }),\n );\n } catch (error) {\n if (!(error instanceof ReviewSubmissionError)) throw error;\n process.stdout.write(\n `${JSON.stringify({ status: 'submission-unverified', submission: error.submission, nextAction: error.message })}\\n`,\n );\n process.exitCode = 1;\n }\n });\n\nprogram\n .command('config:resolve')\n .description('Read the effective GitHub destination and admission digest')\n .action(async () => {\n const context = await contextFor(execution(), 'config:resolve');\n print({\n configDigest: context.configuration?.configDigest,\n routing: context.configuration?.routing,\n reviewRoute: await preflightReviewRoute(context, undefined, undefined, 'development'),\n });\n });\nprogram.command('mcp:serve').action(async () => serveAiDeliveryMcp(execution()));\n\nprogram.parseAsync(process.argv).catch((error: unknown) => {\n const options = program.opts<{ json?: boolean; verbose?: boolean }>();\n printCommandError(error, options.json === true && options.verbose === true);\n});\n"],
5
+ "mappings": ";AACA,SAAS,WAAW,WAAW,WAAW,UAAU,cAAc,gBAAgB;AAClF,SAAS,kBAAkB;AAC3B,SAAS,mCAAmC;AAC5C,SAAS,qBAAqB,4BAA4B;AAC1D,SAAS,eAAe;AACxB,SAAS,SAAS;AAElB,SAAS,mBAAmB,0BAA0B;AACtD,SAAS,YAAY,mBAA0C;AAC/D,SAAS,SAAS,sBAAsB,UAAU,0BAA0B;AAC5E;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,0BAA0B;AAEnC,SAAS,uBAAuB;AAChC,SAAS,oBAAoB;AAC7B,SAAS,kBAAkB,kBAAkB,oBAAoB,0BAA0B;AAC3F,SAAS,6BAA6B;AACtC,SAAS,0BAA0B;AACnC,SAAS,qBAAqB;AAE9B,MAAM,UAAU,IAAI,QAAQ;AAC5B,QACG,KAAK,aAAa,EAClB,YAAY,gDAAgD,EAC5D,QAAQ,eAAe,EACvB,OAAO,qBAAqB,wCAAwC,EACpE,OAAO,mBAAmB,gDAAgD,EAC1E,OAAO,UAAU,mBAAmB,EACpC,OAAO,aAAa,oDAAoD,EACxE,OAAO,uBAAuB,wDAAwD,EACtF,OAAO,sBAAsB,2DAA2D,QAAQ,IAAI,CAAC;AAIxG,SAAS,QAAQ,GAAG,QAAQ,QAAQ,KAAK,QAAQ,SAAS;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,CAAC,CAAC;AAE/E,QAAQ,WAAW,QAAQ,IAAI,EAAE,MAAM,CAAC,UAAmB;AACzD,QAAM,UAAU,QAAQ,KAA4C;AACpE,oBAAkB,OAAO,QAAQ,SAAS,QAAQ,QAAQ,YAAY,IAAI;AAC5E,CAAC;",
6
6
  "names": ["clients"]
7
7
  }
package/dist/dispatch.js CHANGED
@@ -2,6 +2,7 @@ import { issueView, prView } from "./readView.js";
2
2
  import { loadDeliverySettings } from "./config/deliveryConfig.js";
3
3
  import { DeliveryError } from "./errors.js";
4
4
  import { digestValue } from "./delivery/common.js";
5
+ import { createMilestone } from "./milestone.js";
5
6
  import { evaluateCommandIdentityPolicy } from "./github/commandIdentityPolicy.js";
6
7
  import {
7
8
  CreatedTrackingIssueError,
@@ -266,6 +267,12 @@ async function executeTool(name, raw, execution) {
266
267
  draft: input.draft !== false,
267
268
  dryRun: input.dryRun === true
268
269
  });
270
+ case "milestone_create":
271
+ return createMilestone(context, {
272
+ title: requireString(input, "title"),
273
+ ...input.description === void 0 ? {} : { description: requireString(input, "description") },
274
+ ...input.dueOn === void 0 ? {} : { dueOn: requireString(input, "dueOn") }
275
+ });
269
276
  case "issue_pr_info":
270
277
  return prView(context, input);
271
278
  case "issue_pr_review":
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/dispatch.ts"],
4
- "sourcesContent": ["import { issueView, prView } from './readView.js';\nimport { loadDeliverySettings, type LoadedDeliverySettings } from './config/deliveryConfig.js';\nimport { DeliveryError } from './errors.js';\nimport { digestValue } from './delivery/common.js';\nimport { evaluateCommandIdentityPolicy } from './github/commandIdentityPolicy.js';\nimport {\n CreatedTrackingIssueError,\n createIssue,\n canonicalIssueBody,\n commentIssue,\n listIssues,\n journalIssueStart,\n loadDeliveryContext,\n readyCheck,\n resumeCreatedIssue,\n startIssueBranch,\n startIssueProject,\n assertIssueStartCapacity,\n updateIssue,\n batchUpdateIssues,\n type BatchUpdateIssueInput,\n type CreateIssueInput,\n type ListIssuesInput,\n type UpdateIssueInput,\n} from './issue.js';\nimport type { JournalInput } from './issueJournal.js';\nimport { publishPr, submitFormalReview } from './pr.js';\nimport { getAiDeliveryMcpTool, type AiDeliveryMcpToolName } from './mcp/tools.js';\nimport { IssueValidationError } from './issueContract.js';\n\nexport interface ExecutionContext {\n settings?: LoadedDeliverySettings;\n reviewSubmission?: boolean;\n identity?: string;\n personalAuth?: boolean;\n repo?: string;\n repoRoot: string;\n runtimeEntryPath?: string;\n signal?: AbortSignal;\n /** Presentation only: lets issue_info skip the per-child rollup unless the caller asked for the full readback. */\n verbose?: boolean;\n}\nfunction requiredNumber(input: Record<string, unknown>, key: string): number {\n const value = input[key];\n if (typeof value !== 'number' || !Number.isSafeInteger(value) || value <= 0)\n throw new DeliveryError(`${key} must be positive.`);\n return value;\n}\nfunction optionalString(input: Record<string, unknown>, key: string): string | undefined {\n return typeof input[key] === 'string' ? input[key] : undefined;\n}\nfunction requireString(input: Record<string, unknown>, key: string): string {\n const value = optionalString(input, key);\n if (!value?.trim()) throw new DeliveryError(`${key} is required.`);\n return value;\n}\n/** Preserve every accepted tracking field when completing a partially created issue. */\nexport function resumedIssueUpdate(input: Record<string, unknown>): UpdateIssueInput {\n const {\n issueNumber,\n request: _request,\n requestId: _requestId,\n repo: _repo,\n resumeCreated: _resume,\n branch: _branch,\n ...fields\n } = input;\n return { ...fields, issueNumber: requiredNumber({ issueNumber }, 'issueNumber') } as UpdateIssueInput;\n}\nexport async function contextFor(\n input: ExecutionContext,\n commandName: string,\n role: 'author' | 'reviewer' = 'author',\n readPageLimit?: number,\n requireWritableProject?: boolean,\n) {\n const settings =\n input.settings ??\n (await loadDeliverySettings(\n undefined,\n input.reviewSubmission === true\n ? { reviewerIdentity: input.identity ?? '', prepareEnvironment: true }\n : undefined,\n ));\n if (input.reviewSubmission === true && role === 'author' && settings.roles.author.authSource !== 'personal')\n throw new DeliveryError(\n 'review submit requires the configured personal author for pre-key reads; another App key will not be loaded.',\n );\n const identity =\n input.reviewSubmission === true && role === 'author'\n ? settings.roles.author.identity\n : (input.identity ?? settings.roles[role].identity);\n const policy = evaluateCommandIdentityPolicy({\n commandName,\n deliveryConfig: settings,\n identity,\n ...(input.personalAuth === undefined ? {} : { personalAuth: input.personalAuth }),\n });\n if (policy.error) throw new DeliveryError(policy.error);\n return loadDeliveryContext({\n settings,\n ...(settings.environment === undefined ? {} : { env: settings.environment }),\n identity,\n repoRoot: input.repoRoot,\n role,\n ...(input.repo === undefined ? {} : { repository: input.repo }),\n ...(input.personalAuth === undefined ? {} : { personalAuth: input.personalAuth }),\n ...(input.signal === undefined ? {} : { signal: input.signal }),\n ...(readPageLimit === undefined ? {} : { readPageLimit }),\n ...(requireWritableProject === undefined ? {} : { requireWritableProject }),\n });\n}\n/** GitHub owns branch linkage; hosts own worktree preparation. */\nexport async function startTrackedIssue(\n context: Awaited<ReturnType<typeof loadDeliveryContext>>,\n input: Record<string, unknown>,\n) {\n let number = input.issueNumber === undefined ? undefined : requiredNumber(input, 'issueNumber');\n let created: { number: number; title: string; url: string } | undefined;\n let createdBody: string | undefined;\n let branch: Awaited<ReturnType<typeof startIssueBranch>> | undefined;\n let branchAttempted = false;\n let phase = 'branch-or-journal';\n const registration = (phase: string, error: unknown) => ({\n status: 'created-not-started' as const,\n repository: context.config.repository,\n createdIssue: created,\n failure: { phase, message: error instanceof Error ? error.message : String(error) },\n safeResume: {\n tool: 'issue_start',\n arguments: {\n // Replay tracking only when that phase is incomplete; later recovery preserves native edits/parking.\n ...(phase === 'tracking'\n ? { ...input, ...(createdBody === undefined ? {} : { body: createdBody }), resumeCreated: true }\n : {}),\n repo: context.config.repository,\n issueNumber: number,\n ...(input.overrideReason === undefined ? {} : { overrideReason: input.overrideReason }),\n ...((branch?.branch ?? optionalString(input, 'branch')) === undefined\n ? {}\n : { branch: branch?.branch ?? optionalString(input, 'branch') }),\n },\n },\n });\n if (number === undefined) {\n const title = optionalString(input, 'title') ?? requireString(input, 'request');\n const tracking = {\n ...input,\n title,\n body: optionalString(input, 'body') ?? optionalString(input, 'request') ?? title,\n } as unknown as CreateIssueInput;\n tracking.body = canonicalIssueBody(tracking);\n const intent = digestValue(\n Object.fromEntries(\n Object.entries({\n title,\n body: tracking.body,\n issueType: tracking.issueType,\n points: tracking.points,\n priority: tracking.priority,\n labels: tracking.labels,\n blockedBy: tracking.blockedBy,\n blocks: tracking.blocks,\n overrideReason: tracking.overrideReason,\n parentIssueNumber: tracking.parentIssueNumber,\n milestone: tracking.milestone,\n branch: input.branch,\n }).filter(([, value]) => value !== undefined),\n ),\n );\n const requestKey = optionalString(input, 'requestId') ?? intent;\n const marker = `<!-- ai-delivery-start: ${digestValue({ repository: context.config.repository.toLowerCase(), requestKey })} -->`;\n tracking.body = `${tracking.body}\\n\\n<!-- ai-delivery-start-intent: ${intent} -->\\n${marker}`;\n createdBody = tracking.body;\n let completed = false;\n const matches: Awaited<ReturnType<typeof context.clients.rest.issues.listForRepo>>['data'] = [];\n for (let page = 1; page <= 20; page++) {\n const batch = (\n await context.clients.rest.issues.listForRepo({ ...context.repo, state: 'all', page, per_page: 100 })\n ).data;\n matches.push(...batch.filter((value) => !('pull_request' in value) && value.body?.includes(marker)));\n if (batch.length < 100) {\n completed = true;\n break;\n }\n }\n if (!completed)\n throw new DeliveryError(\n 'Issue-start retry search exceeds the bounded readback window; select a known issue number.',\n );\n if (matches.length > 1) throw new DeliveryError('Conflicting issues claim the same start request.');\n const prior = matches[0];\n if (\n prior &&\n (prior.title !== title ||\n canonicalIssueBody({ title: prior.title, body: prior.body ?? '' }) !== tracking.body ||\n prior.state !== 'open')\n )\n throw new DeliveryError('Prior issue-start request conflicts with the requested intent or state.');\n try {\n if (prior) {\n createdBody = prior.body ?? '';\n created = { number: prior.number, title: prior.title, url: prior.html_url };\n number = prior.number;\n await resumeCreatedIssue(context, { ...tracking, issueNumber: number });\n } else {\n const result = await createIssue(context, tracking);\n created = result.created;\n createdBody = result.body;\n number = created.number;\n }\n } catch (error) {\n if (error instanceof CreatedTrackingIssueError) {\n created = error.created;\n number = created.number;\n } else if (!created) throw error;\n return registration('tracking', error);\n }\n } else if (input.resumeCreated === true) {\n const issue = (await context.clients.rest.issues.get({ ...context.repo, issue_number: number })).data;\n if (issue.number !== number || 'pull_request' in issue)\n throw new DeliveryError('Known-created issue readback disagrees.');\n created = { number, title: issue.title, url: issue.html_url };\n try {\n await resumeCreatedIssue(context, resumedIssueUpdate(input));\n } catch (error) {\n return registration('tracking', error);\n }\n }\n try {\n const readiness = await readyCheck(context, number);\n if (!readiness.ready) throw new IssueValidationError(readiness.failures);\n await assertIssueStartCapacity(context, number, optionalString(input, 'overrideReason'));\n branchAttempted = true;\n branch = await startIssueBranch(context, number, optionalString(input, 'branch'));\n phase = 'project-status';\n await startIssueProject(context, number, optionalString(input, 'overrideReason'));\n phase = 'journal';\n await journalIssueStart(context, number);\n return {\n issueNumber: number,\n repository: context.config.repository,\n branch: branch.branch,\n headSha: branch.headSha,\n reused: branch.reused,\n };\n } catch (error) {\n if (created) return registration(phase, error);\n if (!branchAttempted) throw error;\n return {\n status: 'start-incomplete' as const,\n issueNumber: number,\n repository: context.config.repository,\n failure: { phase, message: error instanceof Error ? error.message : String(error) },\n safeResume: {\n tool: 'issue_start',\n arguments: {\n repo: context.config.repository,\n issueNumber: number,\n ...(input.overrideReason === undefined ? {} : { overrideReason: input.overrideReason }),\n ...((branch?.branch ?? optionalString(input, 'branch')) === undefined\n ? {}\n : { branch: branch?.branch ?? optionalString(input, 'branch') }),\n },\n },\n };\n }\n}\n\nexport async function executeTool(\n name: AiDeliveryMcpToolName,\n raw: unknown,\n execution: ExecutionContext,\n): Promise<unknown> {\n const definition = getAiDeliveryMcpTool(name);\n if (!definition) throw new DeliveryError(`Unknown ai-delivery tool ${name}.`);\n const { repo: selected, verbose: _verbose, ...input } = definition.inputSchema.parse(raw) as Record<string, unknown>;\n if (selected !== undefined && execution.repo !== undefined && selected !== execution.repo)\n throw new DeliveryError('Tool and execution repository selectors disagree.');\n // Ready diagnostics need no repository checkout, configuration or credential lookup.\n if (name === 'issue_create') canonicalIssueBody(input as unknown as CreateIssueInput);\n const repo = typeof selected === 'string' ? selected : execution.repo;\n const selectedExecution = { ...execution, ...(repo === undefined ? {} : { repo }) };\n const requestedIdentity = name === 'issue_pr_review' ? optionalString(input, 'identity') : undefined;\n const context = await contextFor(\n { ...selectedExecution, ...(requestedIdentity === undefined ? {} : { identity: requestedIdentity }) },\n definition.commandName,\n name === 'issue_pr_review' ? 'reviewer' : 'author',\n );\n switch (name) {\n case 'issue_comment':\n return commentIssue(context, input as JournalInput);\n case 'issue_create':\n return createIssue(context, input as unknown as CreateIssueInput);\n case 'issue_start':\n return startTrackedIssue(context, input);\n case 'issue_batch_update':\n return batchUpdateIssues(context, input as unknown as BatchUpdateIssueInput, selectedExecution.signal);\n case 'issue_update':\n return updateIssue(context, input as unknown as UpdateIssueInput);\n case 'issue_list':\n case 'issue_search':\n return listIssues(context, input as ListIssuesInput);\n case 'issue_info':\n return issueView(context, requiredNumber(input, 'issueNumber'), { verbose: execution.verbose === true });\n case 'issue_ready_check':\n return readyCheck(context, requiredNumber(input, 'issueNumber'));\n case 'issue_pr_create':\n return publishPr(context, {\n ...(input.prNumber === undefined ? {} : { prNumber: requiredNumber(input, 'prNumber') }),\n issueNumber: requiredNumber(input, 'issueNumber'),\n ...(input.nonClosing === undefined ? {} : { nonClosing: input.nonClosing === true }),\n ...(input.expectedHeadSha === undefined ? {} : { expectedHeadSha: requireString(input, 'expectedHeadSha') }),\n ...(input.body === undefined ? {} : { body: requireString(input, 'body') }),\n ...(input.title === undefined ? {} : { title: requireString(input, 'title') }),\n ...(input.head === undefined && input.headBranch === undefined\n ? {}\n : { headBranch: requireString(input, input.head === undefined ? 'headBranch' : 'head') }),\n ...(input.base === undefined ? {} : { baseBranch: requireString(input, 'base') }),\n draft: input.draft !== false,\n dryRun: input.dryRun === true,\n });\n case 'issue_pr_info':\n return prView(context, input as { issueNumber?: number; prNumber?: number; nonClosing?: boolean });\n case 'issue_pr_review':\n return submitFormalReview(context, {\n artifact: requireString(input, 'artifact'),\n issueNumber: requiredNumber(input, 'issueNumber'),\n ...(input.nonClosing === undefined ? {} : { nonClosing: input.nonClosing === true }),\n prNumber: requiredNumber(input, 'prNumber'),\n dryRun: input.dryRun === true,\n });\n }\n}\n"],
5
- "mappings": "AAAA,SAAS,WAAW,cAAc;AAClC,SAAS,4BAAyD;AAClE,SAAS,qBAAqB;AAC9B,SAAS,mBAAmB;AAC5B,SAAS,qCAAqC;AAC9C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAKK;AAEP,SAAS,WAAW,0BAA0B;AAC9C,SAAS,4BAAwD;AACjE,SAAS,4BAA4B;AAcrC,SAAS,eAAe,OAAgC,KAAqB;AAC3E,QAAM,QAAQ,MAAM,GAAG;AACvB,MAAI,OAAO,UAAU,YAAY,CAAC,OAAO,cAAc,KAAK,KAAK,SAAS;AACxE,UAAM,IAAI,cAAc,GAAG,GAAG,oBAAoB;AACpD,SAAO;AACT;AACA,SAAS,eAAe,OAAgC,KAAiC;AACvF,SAAO,OAAO,MAAM,GAAG,MAAM,WAAW,MAAM,GAAG,IAAI;AACvD;AACA,SAAS,cAAc,OAAgC,KAAqB;AAC1E,QAAM,QAAQ,eAAe,OAAO,GAAG;AACvC,MAAI,CAAC,OAAO,KAAK,EAAG,OAAM,IAAI,cAAc,GAAG,GAAG,eAAe;AACjE,SAAO;AACT;AAEO,SAAS,mBAAmB,OAAkD;AACnF,QAAM;AAAA,IACJ;AAAA,IACA,SAAS;AAAA,IACT,WAAW;AAAA,IACX,MAAM;AAAA,IACN,eAAe;AAAA,IACf,QAAQ;AAAA,IACR,GAAG;AAAA,EACL,IAAI;AACJ,SAAO,EAAE,GAAG,QAAQ,aAAa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,OAAO,OAAO,EAAE;AAAA,QAC5E,GAAI,MAAM,SAAS,UAAa,MAAM,eAAe,SACjD,CAAC,IACD,EAAE,YAAY,cAAc,OAAO,MAAM,SAAS,SAAY,eAAe,MAAM,EAAE;AAAA,QACzF,GAAI,MAAM,SAAS,SAAY,CAAC,IAAI,EAAE,YAAY,cAAc,OAAO,MAAM,EAAE;AAAA,QAC/E,OAAO,MAAM,UAAU;AAAA,QACvB,QAAQ,MAAM,WAAW;AAAA,MAC3B,CAAC;AAAA,IACH,KAAK;AACH,aAAO,OAAO,SAAS,KAA0E;AAAA,IACnG,KAAK;AACH,aAAO,mBAAmB,SAAS;AAAA,QACjC,UAAU,cAAc,OAAO,UAAU;AAAA,QACzC,aAAa,eAAe,OAAO,aAAa;AAAA,QAChD,GAAI,MAAM,eAAe,SAAY,CAAC,IAAI,EAAE,YAAY,MAAM,eAAe,KAAK;AAAA,QAClF,UAAU,eAAe,OAAO,UAAU;AAAA,QAC1C,QAAQ,MAAM,WAAW;AAAA,MAC3B,CAAC;AAAA,EACL;AACF;",
4
+ "sourcesContent": ["import { issueView, prView } from './readView.js';\nimport { loadDeliverySettings, type LoadedDeliverySettings } from './config/deliveryConfig.js';\nimport { DeliveryError } from './errors.js';\nimport { digestValue } from './delivery/common.js';\nimport { createMilestone } from './milestone.js';\nimport { evaluateCommandIdentityPolicy } from './github/commandIdentityPolicy.js';\nimport {\n CreatedTrackingIssueError,\n createIssue,\n canonicalIssueBody,\n commentIssue,\n listIssues,\n journalIssueStart,\n loadDeliveryContext,\n readyCheck,\n resumeCreatedIssue,\n startIssueBranch,\n startIssueProject,\n assertIssueStartCapacity,\n updateIssue,\n batchUpdateIssues,\n type BatchUpdateIssueInput,\n type CreateIssueInput,\n type ListIssuesInput,\n type UpdateIssueInput,\n} from './issue.js';\nimport type { JournalInput } from './issueJournal.js';\nimport { publishPr, submitFormalReview } from './pr.js';\nimport { getAiDeliveryMcpTool, type AiDeliveryMcpToolName } from './mcp/tools.js';\nimport { IssueValidationError } from './issueContract.js';\n\nexport interface ExecutionContext {\n settings?: LoadedDeliverySettings;\n reviewSubmission?: boolean;\n identity?: string;\n personalAuth?: boolean;\n repo?: string;\n repoRoot: string;\n runtimeEntryPath?: string;\n signal?: AbortSignal;\n /** Presentation only: lets issue_info skip the per-child rollup unless the caller asked for the full readback. */\n verbose?: boolean;\n}\nfunction requiredNumber(input: Record<string, unknown>, key: string): number {\n const value = input[key];\n if (typeof value !== 'number' || !Number.isSafeInteger(value) || value <= 0)\n throw new DeliveryError(`${key} must be positive.`);\n return value;\n}\nfunction optionalString(input: Record<string, unknown>, key: string): string | undefined {\n return typeof input[key] === 'string' ? input[key] : undefined;\n}\nfunction requireString(input: Record<string, unknown>, key: string): string {\n const value = optionalString(input, key);\n if (!value?.trim()) throw new DeliveryError(`${key} is required.`);\n return value;\n}\n/** Preserve every accepted tracking field when completing a partially created issue. */\nexport function resumedIssueUpdate(input: Record<string, unknown>): UpdateIssueInput {\n const {\n issueNumber,\n request: _request,\n requestId: _requestId,\n repo: _repo,\n resumeCreated: _resume,\n branch: _branch,\n ...fields\n } = input;\n return { ...fields, issueNumber: requiredNumber({ issueNumber }, 'issueNumber') } as UpdateIssueInput;\n}\nexport async function contextFor(\n input: ExecutionContext,\n commandName: string,\n role: 'author' | 'reviewer' = 'author',\n readPageLimit?: number,\n requireWritableProject?: boolean,\n) {\n const settings =\n input.settings ??\n (await loadDeliverySettings(\n undefined,\n input.reviewSubmission === true\n ? { reviewerIdentity: input.identity ?? '', prepareEnvironment: true }\n : undefined,\n ));\n if (input.reviewSubmission === true && role === 'author' && settings.roles.author.authSource !== 'personal')\n throw new DeliveryError(\n 'review submit requires the configured personal author for pre-key reads; another App key will not be loaded.',\n );\n const identity =\n input.reviewSubmission === true && role === 'author'\n ? settings.roles.author.identity\n : (input.identity ?? settings.roles[role].identity);\n const policy = evaluateCommandIdentityPolicy({\n commandName,\n deliveryConfig: settings,\n identity,\n ...(input.personalAuth === undefined ? {} : { personalAuth: input.personalAuth }),\n });\n if (policy.error) throw new DeliveryError(policy.error);\n return loadDeliveryContext({\n settings,\n ...(settings.environment === undefined ? {} : { env: settings.environment }),\n identity,\n repoRoot: input.repoRoot,\n role,\n ...(input.repo === undefined ? {} : { repository: input.repo }),\n ...(input.personalAuth === undefined ? {} : { personalAuth: input.personalAuth }),\n ...(input.signal === undefined ? {} : { signal: input.signal }),\n ...(readPageLimit === undefined ? {} : { readPageLimit }),\n ...(requireWritableProject === undefined ? {} : { requireWritableProject }),\n });\n}\n/** GitHub owns branch linkage; hosts own worktree preparation. */\nexport async function startTrackedIssue(\n context: Awaited<ReturnType<typeof loadDeliveryContext>>,\n input: Record<string, unknown>,\n) {\n let number = input.issueNumber === undefined ? undefined : requiredNumber(input, 'issueNumber');\n let created: { number: number; title: string; url: string } | undefined;\n let createdBody: string | undefined;\n let branch: Awaited<ReturnType<typeof startIssueBranch>> | undefined;\n let branchAttempted = false;\n let phase = 'branch-or-journal';\n const registration = (phase: string, error: unknown) => ({\n status: 'created-not-started' as const,\n repository: context.config.repository,\n createdIssue: created,\n failure: { phase, message: error instanceof Error ? error.message : String(error) },\n safeResume: {\n tool: 'issue_start',\n arguments: {\n // Replay tracking only when that phase is incomplete; later recovery preserves native edits/parking.\n ...(phase === 'tracking'\n ? { ...input, ...(createdBody === undefined ? {} : { body: createdBody }), resumeCreated: true }\n : {}),\n repo: context.config.repository,\n issueNumber: number,\n ...(input.overrideReason === undefined ? {} : { overrideReason: input.overrideReason }),\n ...((branch?.branch ?? optionalString(input, 'branch')) === undefined\n ? {}\n : { branch: branch?.branch ?? optionalString(input, 'branch') }),\n },\n },\n });\n if (number === undefined) {\n const title = optionalString(input, 'title') ?? requireString(input, 'request');\n const tracking = {\n ...input,\n title,\n body: optionalString(input, 'body') ?? optionalString(input, 'request') ?? title,\n } as unknown as CreateIssueInput;\n tracking.body = canonicalIssueBody(tracking);\n const intent = digestValue(\n Object.fromEntries(\n Object.entries({\n title,\n body: tracking.body,\n issueType: tracking.issueType,\n points: tracking.points,\n priority: tracking.priority,\n labels: tracking.labels,\n blockedBy: tracking.blockedBy,\n blocks: tracking.blocks,\n overrideReason: tracking.overrideReason,\n parentIssueNumber: tracking.parentIssueNumber,\n milestone: tracking.milestone,\n branch: input.branch,\n }).filter(([, value]) => value !== undefined),\n ),\n );\n const requestKey = optionalString(input, 'requestId') ?? intent;\n const marker = `<!-- ai-delivery-start: ${digestValue({ repository: context.config.repository.toLowerCase(), requestKey })} -->`;\n tracking.body = `${tracking.body}\\n\\n<!-- ai-delivery-start-intent: ${intent} -->\\n${marker}`;\n createdBody = tracking.body;\n let completed = false;\n const matches: Awaited<ReturnType<typeof context.clients.rest.issues.listForRepo>>['data'] = [];\n for (let page = 1; page <= 20; page++) {\n const batch = (\n await context.clients.rest.issues.listForRepo({ ...context.repo, state: 'all', page, per_page: 100 })\n ).data;\n matches.push(...batch.filter((value) => !('pull_request' in value) && value.body?.includes(marker)));\n if (batch.length < 100) {\n completed = true;\n break;\n }\n }\n if (!completed)\n throw new DeliveryError(\n 'Issue-start retry search exceeds the bounded readback window; select a known issue number.',\n );\n if (matches.length > 1) throw new DeliveryError('Conflicting issues claim the same start request.');\n const prior = matches[0];\n if (\n prior &&\n (prior.title !== title ||\n canonicalIssueBody({ title: prior.title, body: prior.body ?? '' }) !== tracking.body ||\n prior.state !== 'open')\n )\n throw new DeliveryError('Prior issue-start request conflicts with the requested intent or state.');\n try {\n if (prior) {\n createdBody = prior.body ?? '';\n created = { number: prior.number, title: prior.title, url: prior.html_url };\n number = prior.number;\n await resumeCreatedIssue(context, { ...tracking, issueNumber: number });\n } else {\n const result = await createIssue(context, tracking);\n created = result.created;\n createdBody = result.body;\n number = created.number;\n }\n } catch (error) {\n if (error instanceof CreatedTrackingIssueError) {\n created = error.created;\n number = created.number;\n } else if (!created) throw error;\n return registration('tracking', error);\n }\n } else if (input.resumeCreated === true) {\n const issue = (await context.clients.rest.issues.get({ ...context.repo, issue_number: number })).data;\n if (issue.number !== number || 'pull_request' in issue)\n throw new DeliveryError('Known-created issue readback disagrees.');\n created = { number, title: issue.title, url: issue.html_url };\n try {\n await resumeCreatedIssue(context, resumedIssueUpdate(input));\n } catch (error) {\n return registration('tracking', error);\n }\n }\n try {\n const readiness = await readyCheck(context, number);\n if (!readiness.ready) throw new IssueValidationError(readiness.failures);\n await assertIssueStartCapacity(context, number, optionalString(input, 'overrideReason'));\n branchAttempted = true;\n branch = await startIssueBranch(context, number, optionalString(input, 'branch'));\n phase = 'project-status';\n await startIssueProject(context, number, optionalString(input, 'overrideReason'));\n phase = 'journal';\n await journalIssueStart(context, number);\n return {\n issueNumber: number,\n repository: context.config.repository,\n branch: branch.branch,\n headSha: branch.headSha,\n reused: branch.reused,\n };\n } catch (error) {\n if (created) return registration(phase, error);\n if (!branchAttempted) throw error;\n return {\n status: 'start-incomplete' as const,\n issueNumber: number,\n repository: context.config.repository,\n failure: { phase, message: error instanceof Error ? error.message : String(error) },\n safeResume: {\n tool: 'issue_start',\n arguments: {\n repo: context.config.repository,\n issueNumber: number,\n ...(input.overrideReason === undefined ? {} : { overrideReason: input.overrideReason }),\n ...((branch?.branch ?? optionalString(input, 'branch')) === undefined\n ? {}\n : { branch: branch?.branch ?? optionalString(input, 'branch') }),\n },\n },\n };\n }\n}\n\nexport async function executeTool(\n name: AiDeliveryMcpToolName,\n raw: unknown,\n execution: ExecutionContext,\n): Promise<unknown> {\n const definition = getAiDeliveryMcpTool(name);\n if (!definition) throw new DeliveryError(`Unknown ai-delivery tool ${name}.`);\n const { repo: selected, verbose: _verbose, ...input } = definition.inputSchema.parse(raw) as Record<string, unknown>;\n if (selected !== undefined && execution.repo !== undefined && selected !== execution.repo)\n throw new DeliveryError('Tool and execution repository selectors disagree.');\n // Ready diagnostics need no repository checkout, configuration or credential lookup.\n if (name === 'issue_create') canonicalIssueBody(input as unknown as CreateIssueInput);\n const repo = typeof selected === 'string' ? selected : execution.repo;\n const selectedExecution = { ...execution, ...(repo === undefined ? {} : { repo }) };\n const requestedIdentity = name === 'issue_pr_review' ? optionalString(input, 'identity') : undefined;\n const context = await contextFor(\n { ...selectedExecution, ...(requestedIdentity === undefined ? {} : { identity: requestedIdentity }) },\n definition.commandName,\n name === 'issue_pr_review' ? 'reviewer' : 'author',\n );\n switch (name) {\n case 'issue_comment':\n return commentIssue(context, input as JournalInput);\n case 'issue_create':\n return createIssue(context, input as unknown as CreateIssueInput);\n case 'issue_start':\n return startTrackedIssue(context, input);\n case 'issue_batch_update':\n return batchUpdateIssues(context, input as unknown as BatchUpdateIssueInput, selectedExecution.signal);\n case 'issue_update':\n return updateIssue(context, input as unknown as UpdateIssueInput);\n case 'issue_list':\n case 'issue_search':\n return listIssues(context, input as ListIssuesInput);\n case 'issue_info':\n return issueView(context, requiredNumber(input, 'issueNumber'), { verbose: execution.verbose === true });\n case 'issue_ready_check':\n return readyCheck(context, requiredNumber(input, 'issueNumber'));\n case 'issue_pr_create':\n return publishPr(context, {\n ...(input.prNumber === undefined ? {} : { prNumber: requiredNumber(input, 'prNumber') }),\n issueNumber: requiredNumber(input, 'issueNumber'),\n ...(input.nonClosing === undefined ? {} : { nonClosing: input.nonClosing === true }),\n ...(input.expectedHeadSha === undefined ? {} : { expectedHeadSha: requireString(input, 'expectedHeadSha') }),\n ...(input.body === undefined ? {} : { body: requireString(input, 'body') }),\n ...(input.title === undefined ? {} : { title: requireString(input, 'title') }),\n ...(input.head === undefined && input.headBranch === undefined\n ? {}\n : { headBranch: requireString(input, input.head === undefined ? 'headBranch' : 'head') }),\n ...(input.base === undefined ? {} : { baseBranch: requireString(input, 'base') }),\n draft: input.draft !== false,\n dryRun: input.dryRun === true,\n });\n case 'milestone_create':\n return createMilestone(context, {\n title: requireString(input, 'title'),\n ...(input.description === undefined ? {} : { description: requireString(input, 'description') }),\n ...(input.dueOn === undefined ? {} : { dueOn: requireString(input, 'dueOn') }),\n });\n case 'issue_pr_info':\n return prView(context, input as { issueNumber?: number; prNumber?: number; nonClosing?: boolean });\n case 'issue_pr_review':\n return submitFormalReview(context, {\n artifact: requireString(input, 'artifact'),\n issueNumber: requiredNumber(input, 'issueNumber'),\n ...(input.nonClosing === undefined ? {} : { nonClosing: input.nonClosing === true }),\n prNumber: requiredNumber(input, 'prNumber'),\n dryRun: input.dryRun === true,\n });\n }\n}\n"],
5
+ "mappings": "AAAA,SAAS,WAAW,cAAc;AAClC,SAAS,4BAAyD;AAClE,SAAS,qBAAqB;AAC9B,SAAS,mBAAmB;AAC5B,SAAS,uBAAuB;AAChC,SAAS,qCAAqC;AAC9C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAKK;AAEP,SAAS,WAAW,0BAA0B;AAC9C,SAAS,4BAAwD;AACjE,SAAS,4BAA4B;AAcrC,SAAS,eAAe,OAAgC,KAAqB;AAC3E,QAAM,QAAQ,MAAM,GAAG;AACvB,MAAI,OAAO,UAAU,YAAY,CAAC,OAAO,cAAc,KAAK,KAAK,SAAS;AACxE,UAAM,IAAI,cAAc,GAAG,GAAG,oBAAoB;AACpD,SAAO;AACT;AACA,SAAS,eAAe,OAAgC,KAAiC;AACvF,SAAO,OAAO,MAAM,GAAG,MAAM,WAAW,MAAM,GAAG,IAAI;AACvD;AACA,SAAS,cAAc,OAAgC,KAAqB;AAC1E,QAAM,QAAQ,eAAe,OAAO,GAAG;AACvC,MAAI,CAAC,OAAO,KAAK,EAAG,OAAM,IAAI,cAAc,GAAG,GAAG,eAAe;AACjE,SAAO;AACT;AAEO,SAAS,mBAAmB,OAAkD;AACnF,QAAM;AAAA,IACJ;AAAA,IACA,SAAS;AAAA,IACT,WAAW;AAAA,IACX,MAAM;AAAA,IACN,eAAe;AAAA,IACf,QAAQ;AAAA,IACR,GAAG;AAAA,EACL,IAAI;AACJ,SAAO,EAAE,GAAG,QAAQ,aAAa,e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AAO,OAAO,EAAE;AAAA,QAC5E,GAAI,MAAM,SAAS,UAAa,MAAM,eAAe,SACjD,CAAC,IACD,EAAE,YAAY,cAAc,OAAO,MAAM,SAAS,SAAY,eAAe,MAAM,EAAE;AAAA,QACzF,GAAI,MAAM,SAAS,SAAY,CAAC,IAAI,EAAE,YAAY,cAAc,OAAO,MAAM,EAAE;AAAA,QAC/E,OAAO,MAAM,UAAU;AAAA,QACvB,QAAQ,MAAM,WAAW;AAAA,MAC3B,CAAC;AAAA,IACH,KAAK;AACH,aAAO,gBAAgB,SAAS;AAAA,QAC9B,OAAO,cAAc,OAAO,OAAO;AAAA,QACnC,GAAI,MAAM,gBAAgB,SAAY,CAAC,IAAI,EAAE,aAAa,cAAc,OAAO,aAAa,EAAE;AAAA,QAC9F,GAAI,MAAM,UAAU,SAAY,CAAC,IAAI,EAAE,OAAO,cAAc,OAAO,OAAO,EAAE;AAAA,MAC9E,CAAC;AAAA,IACH,KAAK;AACH,aAAO,OAAO,SAAS,KAA0E;AAAA,IACnG,KAAK;AACH,aAAO,mBAAmB,SAAS;AAAA,QACjC,UAAU,cAAc,OAAO,UAAU;AAAA,QACzC,aAAa,eAAe,OAAO,aAAa;AAAA,QAChD,GAAI,MAAM,eAAe,SAAY,CAAC,IAAI,EAAE,YAAY,MAAM,eAAe,KAAK;AAAA,QAClF,UAAU,eAAe,OAAO,UAAU;AAAA,QAC1C,QAAQ,MAAM,WAAW;AAAA,MAC3B,CAAC;AAAA,EACL;AACF;",
6
6
  "names": ["phase"]
7
7
  }
@@ -289,6 +289,39 @@ export declare function inertTarget(signal?: AbortSignal, registerDisposal?: (cl
289
289
  listLabelsForRepo: () => Promise<{
290
290
  data: never[];
291
291
  }>;
292
+ listMilestones: (input: unknown) => Promise<{
293
+ data: {
294
+ description: string | null;
295
+ due_on: string | null;
296
+ html_url: string;
297
+ number: number;
298
+ title: string;
299
+ }[];
300
+ }>;
301
+ createMilestone: (input: {
302
+ description?: string;
303
+ due_on?: string;
304
+ title: string;
305
+ }) => Promise<{
306
+ data: {
307
+ description: string | null;
308
+ due_on: string | null;
309
+ html_url: string;
310
+ number: number;
311
+ title: string;
312
+ };
313
+ }>;
314
+ getMilestone: (input: {
315
+ milestone_number: number;
316
+ }) => Promise<{
317
+ data: {
318
+ description: string | null;
319
+ due_on: string | null;
320
+ html_url: string;
321
+ number: number;
322
+ title: string;
323
+ };
324
+ }>;
292
325
  listSubIssues: (input: unknown) => Promise<{
293
326
  data: never[];
294
327
  }>;
@@ -213,7 +213,9 @@ printf 'repository hook executed' > '${sentinel.replaceAll("'", "'\\''")}'
213
213
  body: reviewBody,
214
214
  html_url: "https://github.com/example/widget/pull/23#pullrequestreview-99"
215
215
  };
216
+ const tradeNumbers = /* @__PURE__ */ new Map();
216
217
  const reviews = [review];
218
+ const milestones = [];
217
219
  const comments = [];
218
220
  let nextCommentId = 101;
219
221
  const addComment = (id, body, app = false, number = 17) => {
@@ -395,6 +397,26 @@ printf 'repository hook executed' > '${sentinel.replaceAll("'", "'\\''")}'
395
397
  return { data: input.page === 2 ? [issue(18)] : input.page === 3 ? [] : [issue()] };
396
398
  },
397
399
  listLabelsForRepo: async () => ({ data: [] }),
400
+ listMilestones: async (input) => {
401
+ record("issues.listMilestones", input);
402
+ return { data: milestones };
403
+ },
404
+ createMilestone: async (input) => {
405
+ record("issues.createMilestone", input);
406
+ const milestone = {
407
+ description: input.description ?? null,
408
+ due_on: input.due_on ?? null,
409
+ html_url: "https://github.com/example/widget/milestone/1",
410
+ number: milestones.length + 1,
411
+ title: input.title
412
+ };
413
+ milestones.push(milestone);
414
+ return { data: milestone };
415
+ },
416
+ getMilestone: async (input) => {
417
+ record("issues.getMilestone", input);
418
+ return { data: milestones.find((milestone) => milestone.number === input.milestone_number) };
419
+ },
398
420
  listSubIssues: async (input) => {
399
421
  record("issues.listSubIssues", input);
400
422
  return { data: [] };
@@ -496,6 +518,26 @@ printf 'repository hook executed' > '${sentinel.replaceAll("'", "'\\''")}'
496
518
  return { updateProjectV2ItemFieldValue: { projectV2Item: { id: "ITEM17" } } };
497
519
  }
498
520
  if (query.includes("ProjectDeliveryItemReadback")) return { node: item() };
521
+ if (query.includes("ProjectNumberFields"))
522
+ return {
523
+ node: {
524
+ fields: {
525
+ nodes: [
526
+ { id: "F_EXPECTED", name: "Expected trades/day", dataType: "NUMBER" },
527
+ { id: "F_MEASURED", name: "Measured trades/day", dataType: "NUMBER" }
528
+ ]
529
+ }
530
+ }
531
+ };
532
+ if (query.includes("SetProjectNumber") || query.includes("ClearProjectNumber")) {
533
+ if (query.includes("SetProjectNumber")) tradeNumbers.set(String(variables.fieldId), Number(variables.value));
534
+ else tradeNumbers.delete(String(variables.fieldId));
535
+ return {};
536
+ }
537
+ if (query.includes("ProjectNumberReadback")) {
538
+ const number = (id) => tradeNumbers.has(id) ? { number: tradeNumbers.get(id) } : null;
539
+ return { node: { expectedTradesPerDay: number("F_EXPECTED"), measuredTradesPerDay: number("F_MEASURED") } };
540
+ }
499
541
  if (query.includes("DeliveryStartBranch")) {
500
542
  state.linked = true;
501
543
  return { createLinkedBranch: { linkedBranch: { ref: { name: "issue/17", target: { oid: head } } } } };