@aviaratech/ai-delivery 0.1.0

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 (140) hide show
  1. package/CONTRIBUTING.md +47 -0
  2. package/LICENSE +21 -0
  3. package/README.md +84 -0
  4. package/dist/agent.d.ts +17 -0
  5. package/dist/agent.js +16 -0
  6. package/dist/agent.js.map +1 -0
  7. package/dist/cli.d.ts +2 -0
  8. package/dist/cli.js +314 -0
  9. package/dist/cli.js.map +1 -0
  10. package/dist/cliResult.d.ts +2 -0
  11. package/dist/cliResult.js +12 -0
  12. package/dist/cliResult.js.map +1 -0
  13. package/dist/cliResult.test.d.ts +1 -0
  14. package/dist/cliResult.test.js +30 -0
  15. package/dist/cliResult.test.js.map +1 -0
  16. package/dist/config/deliveryConfig.d.ts +113 -0
  17. package/dist/config/deliveryConfig.js +261 -0
  18. package/dist/config/deliveryConfig.js.map +1 -0
  19. package/dist/config/deliveryConfig.test.d.ts +1 -0
  20. package/dist/config/deliveryConfig.test.js +355 -0
  21. package/dist/config/deliveryConfig.test.js.map +1 -0
  22. package/dist/delivery/common.d.ts +28 -0
  23. package/dist/delivery/common.js +117 -0
  24. package/dist/delivery/common.js.map +1 -0
  25. package/dist/delivery/delivery.test.d.ts +1 -0
  26. package/dist/delivery/delivery.test.js +234 -0
  27. package/dist/delivery/delivery.test.js.map +1 -0
  28. package/dist/delivery/evidence.d.ts +92 -0
  29. package/dist/delivery/evidence.js +126 -0
  30. package/dist/delivery/evidence.js.map +1 -0
  31. package/dist/delivery/index.d.ts +8 -0
  32. package/dist/delivery/index.js +5 -0
  33. package/dist/delivery/index.js.map +1 -0
  34. package/dist/delivery/policy.d.ts +237 -0
  35. package/dist/delivery/policy.js +246 -0
  36. package/dist/delivery/policy.js.map +1 -0
  37. package/dist/delivery/stage.d.ts +125 -0
  38. package/dist/delivery/stage.js +218 -0
  39. package/dist/delivery/stage.js.map +1 -0
  40. package/dist/dispatch.d.ts +15 -0
  41. package/dist/dispatch.js +397 -0
  42. package/dist/dispatch.js.map +1 -0
  43. package/dist/errors.d.ts +4 -0
  44. package/dist/errors.js +9 -0
  45. package/dist/errors.js.map +1 -0
  46. package/dist/genericCompatibility.test.d.ts +1 -0
  47. package/dist/genericCompatibility.test.js +92 -0
  48. package/dist/genericCompatibility.test.js.map +1 -0
  49. package/dist/git.d.ts +13 -0
  50. package/dist/git.js +65 -0
  51. package/dist/git.js.map +1 -0
  52. package/dist/github/client.d.ts +34 -0
  53. package/dist/github/client.js +143 -0
  54. package/dist/github/client.js.map +1 -0
  55. package/dist/github/commandIdentityPolicy.d.ts +13 -0
  56. package/dist/github/commandIdentityPolicy.js +46 -0
  57. package/dist/github/commandIdentityPolicy.js.map +1 -0
  58. package/dist/github/nativeIssueMetadata.d.ts +78 -0
  59. package/dist/github/nativeIssueMetadata.js +249 -0
  60. package/dist/github/nativeIssueMetadata.js.map +1 -0
  61. package/dist/github/projectDelivery.d.ts +68 -0
  62. package/dist/github/projectDelivery.js +540 -0
  63. package/dist/github/projectDelivery.js.map +1 -0
  64. package/dist/github/relationships.d.ts +69 -0
  65. package/dist/github/relationships.js +395 -0
  66. package/dist/github/relationships.js.map +1 -0
  67. package/dist/github/repo.d.ts +8 -0
  68. package/dist/github/repo.js +34 -0
  69. package/dist/github/repo.js.map +1 -0
  70. package/dist/index.d.ts +2 -0
  71. package/dist/index.js +3 -0
  72. package/dist/index.js.map +1 -0
  73. package/dist/issue.d.ts +86 -0
  74. package/dist/issue.js +347 -0
  75. package/dist/issue.js.map +1 -0
  76. package/dist/lifecycle.test.d.ts +1 -0
  77. package/dist/lifecycle.test.js +1118 -0
  78. package/dist/lifecycle.test.js.map +1 -0
  79. package/dist/logger.d.ts +21 -0
  80. package/dist/logger.js +86 -0
  81. package/dist/logger.js.map +1 -0
  82. package/dist/mcp/index.d.ts +5 -0
  83. package/dist/mcp/index.js +46 -0
  84. package/dist/mcp/index.js.map +1 -0
  85. package/dist/mcp/tools.d.ts +162 -0
  86. package/dist/mcp/tools.js +154 -0
  87. package/dist/mcp/tools.js.map +1 -0
  88. package/dist/pr.d.ts +146 -0
  89. package/dist/pr.js +972 -0
  90. package/dist/pr.js.map +1 -0
  91. package/dist/pr.test.d.ts +1 -0
  92. package/dist/pr.test.js +252 -0
  93. package/dist/pr.test.js.map +1 -0
  94. package/dist/review.d.ts +104 -0
  95. package/dist/review.js +228 -0
  96. package/dist/review.js.map +1 -0
  97. package/dist/review.test.d.ts +1 -0
  98. package/dist/review.test.js +327 -0
  99. package/dist/review.test.js.map +1 -0
  100. package/dist/services/agentReadinessService.d.ts +17 -0
  101. package/dist/services/agentReadinessService.js +225 -0
  102. package/dist/services/agentReadinessService.js.map +1 -0
  103. package/dist/services/deliveryAdmission.d.ts +33 -0
  104. package/dist/services/deliveryAdmission.js +122 -0
  105. package/dist/services/deliveryAdmission.js.map +1 -0
  106. package/dist/services/deliveryRecordService.d.ts +47 -0
  107. package/dist/services/deliveryRecordService.js +199 -0
  108. package/dist/services/deliveryRecordService.js.map +1 -0
  109. package/dist/services/legacyIssueMigration.d.ts +46 -0
  110. package/dist/services/legacyIssueMigration.js +313 -0
  111. package/dist/services/legacyIssueMigration.js.map +1 -0
  112. package/dist/services/worktreeRegistry.d.ts +67 -0
  113. package/dist/services/worktreeRegistry.js +545 -0
  114. package/dist/services/worktreeRegistry.js.map +1 -0
  115. package/dist/terminalMessages.d.ts +13 -0
  116. package/dist/terminalMessages.js +43 -0
  117. package/dist/terminalMessages.js.map +1 -0
  118. package/dist/utils/atomicJson.d.ts +6 -0
  119. package/dist/utils/atomicJson.js +78 -0
  120. package/dist/utils/atomicJson.js.map +1 -0
  121. package/dist/utils/filesystem.d.ts +9 -0
  122. package/dist/utils/filesystem.js +19 -0
  123. package/dist/utils/filesystem.js.map +1 -0
  124. package/dist/utils/lockfile.d.ts +12 -0
  125. package/dist/utils/lockfile.js +78 -0
  126. package/dist/utils/lockfile.js.map +1 -0
  127. package/dist/verification.d.ts +24 -0
  128. package/dist/verification.js +227 -0
  129. package/dist/verification.js.map +1 -0
  130. package/dist/worktree.d.ts +44 -0
  131. package/dist/worktree.js +255 -0
  132. package/dist/worktree.js.map +1 -0
  133. package/package.json +82 -0
  134. package/plugins/ai-delivery/.claude-plugin/plugin.json +6 -0
  135. package/plugins/ai-delivery/.mcp.json +8 -0
  136. package/plugins/ai-delivery/README.md +5 -0
  137. package/plugins/ai-delivery/dist/mcp-launcher.js +22 -0
  138. package/plugins/ai-delivery/skills/intake-create/SKILL.md +26 -0
  139. package/plugins/ai-delivery/skills/pr-handoff/SKILL.md +28 -0
  140. package/plugins/ai-delivery/skills/worktree-lifecycle/SKILL.md +24 -0
@@ -0,0 +1,47 @@
1
+ # Contributing to ai-delivery
2
+
3
+ Use Node 24.21.0 and npm 11.19.0. Work in an isolated checkout. The package
4
+ has no access to a particular organization's GitHub Project, credentials or
5
+ delivery policy; tests use synthetic repositories and do not mutate live issues.
6
+
7
+ ```sh
8
+ npm ci
9
+ npm run checks
10
+ npm run build
11
+ npm pack --dry-run
12
+ ```
13
+
14
+ `checks` runs formatting, native type-aware lint, strict TypeScript, a compiled
15
+ build and all Vitest tests. CI runs these commands on pull requests and `main`
16
+ with a read-only GitHub token. A separate TruffleHog job scans changed Git
17
+ history without access to release credentials. Keep examples synthetic and
18
+ review `npm pack --dry-run` for every packaged file. Never commit credentials,
19
+ host configuration, receipts, logs or repository-specific policy.
20
+
21
+ The `Publish npm package` workflow is manual, runs only from `main`, and uses
22
+ the `npm-publish` environment. Before enabling it, the repository owner must:
23
+
24
+ 1. Confirm the confidentiality review covers the exact source ref and built
25
+ archive. Confirm the MIT license and the exact package repository URL.
26
+ 2. Protect `main` and the `npm-publish` environment with required reviewers,
27
+ restricted deployment branches and no self-review. Require both CI jobs.
28
+ 3. For a new npm package name, have the package owner establish it with a
29
+ separately authorized and reviewed initial version before configuring
30
+ trusted publishing. npm cannot bind a trusted publisher before the package
31
+ exists. Keep the `0.1.0` release for the protected OIDC workflow; do not add
32
+ npm credentials to Actions or substitute a token-based workflow.
33
+ 4. Register `@aviaratech/ai-delivery` with npm trusted publishing for GitHub
34
+ organization `aviaratech`, repository `ai-delivery`, workflow filename
35
+ `release.yml`, and environment name `npm-publish`. Enable direct `npm publish`
36
+ for that trusted publisher. The npm environment restriction must match the
37
+ protected GitHub environment in the workflow.
38
+ 5. Review the source head, package version, archive inventory and secret scan.
39
+ Dispatch the release workflow on `main` once. The build job checks and
40
+ packages without OIDC permission; only the approved publish job receives
41
+ `id-token: write` and publishes that archived tarball.
42
+
43
+ npm provenance is generated automatically by trusted publishing only when both
44
+ repository and package are public. A release has not occurred merely because
45
+ the workflow exists; verify npm registry readback after the protected job
46
+ finishes. A failed or ambiguous publish requires registry readback before retrying
47
+ the same version.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Aviara Tech
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,84 @@
1
+ # ai-delivery
2
+
3
+ Generic GitHub issue and pull request delivery for repositories that opt in with a source-controlled `ai-delivery.config.json` and a `RepositoryDeliveryPolicy@1` module. The package provides one `ai-delivery` CLI, one stdio MCP server, and thin plugin assets in `plugins/ai-delivery`.
4
+
5
+ The package contains no repository-specific policy, credential, model, or deployment configuration. A consuming repository owns its issue taxonomy, native Project fields, author and reviewer GitHub App credentials, delivery stages, and phase constraints. The runtime refuses a missing or untracked configuration or policy module.
6
+
7
+ ## Availability and installation
8
+
9
+ Install the versioned package from npm or a reviewed package archive. The
10
+ consuming repository must run its own configuration and runtime-admission
11
+ procedure before any lifecycle write.
12
+
13
+ ```sh
14
+ node --version # 24.21.0
15
+ npm --version # 11.19.0
16
+ npm install --save-dev @aviaratech/ai-delivery@0.1.0
17
+ npx ai-delivery --help
18
+ npx ai-delivery --repo-root /absolute/path/to/consumer --identity configured-author info --issue 17
19
+ npx ai-delivery --repo-root /absolute/path/to/consumer --identity configured-author mcp:serve
20
+ ```
21
+
22
+ `info` is a read. `verify`, PR publication, formal review submission and finish
23
+ are lifecycle writes. The CLI and MCP server enforce the same admission and
24
+ identity rules. The [plugin guide](plugins/ai-delivery/README.md) covers host
25
+ installation.
26
+
27
+ ## Configure a consuming repository
28
+
29
+ Commit `ai-delivery.config.json` at that repository's Git root. It selects the
30
+ repository, its native issue types, Project number, exact Points/Priority field
31
+ IDs and choices, four Project status names, command checks and timeouts, a
32
+ `RepositoryDeliveryPolicy@1` module, and distinct author and reviewer App role
33
+ names. Field IDs and choices must match the consuming repository's live GitHub
34
+ metadata. The parser and policy contract are exported from
35
+ `@aviaratech/ai-delivery`; `src/config/deliveryConfig.test.ts` and
36
+ `src/delivery/delivery.test.ts` contain fully synthetic examples for unrelated
37
+ repositories. Copy their shape, then substitute your own repository's native
38
+ metadata and policy. There is no built-in organization policy or stage list.
39
+
40
+ The policy module must implement `classifyExactRange` and `validateBoundary`.
41
+ It defines the repository's ordered verification stages, risk and any additional
42
+ publication or merge constraints. Its source is tracked alongside the config;
43
+ source/config/policy drift invalidates prior receipts. Run the consumer's policy
44
+ checks before making lifecycle writes. A missing or untracked module is refused.
45
+
46
+ Set each role's three configured **environment variable names** to the App ID,
47
+ installation ID and private-key file path on the host. Keep secret values and
48
+ key files out of Git and out of CLI arguments. The author App installation
49
+ requires Contents, Issues, organization Projects and Pull requests **write**
50
+ permissions. The reviewer App installation requires Contents **read** and Pull
51
+ requests **write** permissions. A consuming policy may require additional
52
+ permissions. The roles must resolve to distinct actors. Personal token use is
53
+ an explicit `--personal-auth` author-only mode;
54
+ it is never a fallback. Use a deliberately synthetic test repository for the
55
+ first end-to-end rehearsal; examples here must not be run against a live issue.
56
+
57
+ Before any CLI or MCP lifecycle write, the consuming installer must place a private `ai-delivery.runtime-admission@1` record at `<git-common-dir>/ai-delivery/runtime-admission.json`. It binds the verified source archive, repository config digest, package version, capability 1, and actual CLI, MCP launcher, and plugin manifest byte hashes and real paths. Both invocation surfaces validate the same record before writes; a missing, stale, or mismatched record refuses the operation. Installation does not create this record automatically. Reinstall or reissue the record after package, config, or launcher changes. Existing rows in the canonical `.issue-cli/worktrees.json` registry remain with their original runtime unless they have an exact immutable `ai-delivery.worktree-owner@1` witness. Do not convert old receipts into new approvals or run old and new writers for the same active issue.
58
+
59
+ `verify` classifies a clean Git base/head range, runs only the stages selected by the repository policy, and persists content-addressed private checkpoints under the Git common directory. It reuses compatible complete stages and rejects corrupt or stale inputs. The `--admit` flag explicitly admits additional resource classes. Publication creates a draft PR only after exact-head verification; a high-risk policy also requires a prepublication review artifact. Ready promotion and merge require a submitted formal review. Merge checks live blockers, checks, base/head coordinates, and the policy boundary. Repositories may require an exact base/head lease for merge.
60
+
61
+ For recovery, inspect the original issue/PR, worktree registry and exact source
62
+ head before retrying. A `created-not-started` response includes `safeResume`
63
+ arguments; use those arguments unchanged to resume the known issue. `verify`
64
+ reuses compatible stage checkpoints after interruption. If code, config, policy,
65
+ the selected stage inputs or a checkpoint changes, regenerate the affected
66
+ proof. A stopped or failed publish/finish must be read back before retrying;
67
+ never infer completion from a timed-out command. Task assignment and model
68
+ routing belong to a separate orchestrator, not this CLI.
69
+
70
+ ## Compatibility contract
71
+
72
+ The MCP input and result contract is `ai-delivery.mcp@1`, exported as `AI_DELIVERY_MCP_CONTRACT_VERSION`. It retains the 13 `issue_*` tool names. Each tool rejects unknown fields at the request boundary. `issue_create` accepts a title with optional body, Issue Type, Points, Priority, taxonomy labels, milestone, parent and blockers; it returns `{body, created: {number, title, url}}`. A linked parent is read back and cleared of Points. `issue_start({issueNumber})` always checks readiness and prepares that existing issue; `develop` gates only preparation of a newly created issue. New starts default to 2 Points. `resumeCreated` requires both `issueNumber` and `develop: true` and never creates a second issue. Immediate creation and development preflights readiness before creation and returns `ai-delivery.issue-start-registration@1` with `status: "started"` or a `created-not-started` failure and exact `safeResume` arguments. The CLI prints that recovery JSON and exits nonzero for `created-not-started`. Scratch starts derive safe names from the request or title and return the branch and worktree path. `repo` on create, start and ready check, or global CLI `--repo`, must match the repository selected by the checkout's validated config; a mismatch fails before a GitHub call.
73
+
74
+ `issue_update` returns authoritative issue readback; `issue_info` returns current native metadata, parent, blockers, Project state and registered worktree; `issue_ready_check` returns deterministic admission and reasons; `issue_develop` and `issue_worktree_create` return registered worktree rows. `issue_verify` returns classification, aggregate, manifest and publication evidence IDs. `issue_pr_create` returns the PR number, URL and bound publication evidence ID; `issue_pr_info` returns number, state, exact head/base, draft flag and URL. `issue_pr_review` returns an exact-head submitted review receipt, `issue_pr_merge` a durable merge receipt, and `issue_finish` returns the merge SHA and successful issue/cleanup readback. CLI and MCP call the same owners for these tools.
75
+
76
+ The CLI also exposes native relationship reads (`parent`, `subissues`, `blockers`), registry reads and clean registered PR/standalone cleanup (`worktrees:list`, `worktrees:status`, `worktrees:cleanup`), and PR reads and exact-head App-authorized checkout (`pr:list`, `pr:checks`, `pr:checkout`). A cleaned PR worktree can be reopened when its retained branch still matches the remote head. `migrate:legacy-issues --input-file` produces an offline `ai-delivery.legacy-issue-migration@1` plan without live writes. `metrics velocity --json` reads completed local delivery records and returns `ai-delivery.velocity-report@1` with buckets for configured Points; unknown blocker and review measurements remain null. `finish` can confirm completion after a lost response by matching the exact merge receipts, delivery record and live issue/Project state. Installing the package never migrates active runtime state automatically.
77
+
78
+ ## Contributor checks and release
79
+
80
+ Use Node 24.21.0 and npm 11.19.0. `npm ci` installs the single committed lockfile; `npm run checks` is the canonical local gate and runs Oxfmt, native Oxlint with `oxlint-tsgolint`, strict TypeScript, a compiled build, and Vitest over the emitted `dist/**/*.test.js` files. The compiled test target preserves CLI child-process and package-file assertions. `npm run build` can be run separately before packing. Tests retain the accepted 25 synthetic lifecycle, identity, receipt, recovery, cleanup, and plugin cases. See [CONTRIBUTING.md](CONTRIBUTING.md) for the local commands and release prerequisites.
81
+
82
+ The standalone lint config enables native error, promise, unsafe-value, and explicit-type checks. TypeScript uses exact optional properties, checked indexed access, explicit overrides, return/fallthrough, and unused-symbol checks. Tests and review cover the delivery behavior boundary.
83
+
84
+ Installing the package does not switch an existing consumer. Run `npm run checks`, `npm run build`, and `npm pack --dry-run` before release.
@@ -0,0 +1,17 @@
1
+ export { loadDeliveryConfig, parseDeliveryConfig, resolveDeliveryRoleCredentials } from './config/deliveryConfig.js';
2
+ export type { DeliveryConfig, DeliveryRole, LoadedDeliveryConfig } from './config/deliveryConfig.js';
3
+ export { createDeliveryGitHubClients } from './github/client.js';
4
+ export { resolveDeliveryRepo } from './github/repo.js';
5
+ export { AI_DELIVERY_MCP_CONTRACT_VERSION, AI_DELIVERY_MCP_TOOLS, createAiDeliveryMcpServer } from './mcp/index.js';
6
+ export { executeTool } from './dispatch.js';
7
+ export { evaluateAgentReadiness } from './services/agentReadinessService.js';
8
+ export { createIssue, updateIssue, issueInfo, readyCheck, developIssue, listIssueSubissues } from './issue.js';
9
+ export { prInfo, listPrs, prChecks, checkoutPr, publishPr, submitFormalReview, mergePr, finishIssue } from './pr.js';
10
+ export { preparePrWorktree, cleanupNonIssueWorktree } from './worktree.js';
11
+ export { getNativeBlockerRelationships, getNativeBlockingRelationships, replaceBlockedBy, replaceParentIssue, hasNativeSubIssues, } from './github/relationships.js';
12
+ export { normalizeLegacyIssue, planOfflineLegacyIssueMigration } from './services/legacyIssueMigration.js';
13
+ export { buildVelocityReport, getDeliveryRecords, recordMergedDelivery } from './services/deliveryRecordService.js';
14
+ export type { DeliveryRecord, VelocityReport, PointBucketStatistics } from './services/deliveryRecordService.js';
15
+ export { getIssueWorktreeStrict, listWorktreesStrict } from './services/worktreeRegistry.js';
16
+ export { prepareIssueWorktree, prepareStandaloneWorktree } from './worktree.js';
17
+ export { verifyIssue, createIssuePhaseEvidence } from './verification.js';
package/dist/agent.js ADDED
@@ -0,0 +1,16 @@
1
+ export { loadDeliveryConfig, parseDeliveryConfig, resolveDeliveryRoleCredentials } from './config/deliveryConfig.js';
2
+ export { createDeliveryGitHubClients } from './github/client.js';
3
+ export { resolveDeliveryRepo } from './github/repo.js';
4
+ export { AI_DELIVERY_MCP_CONTRACT_VERSION, AI_DELIVERY_MCP_TOOLS, createAiDeliveryMcpServer } from './mcp/index.js';
5
+ export { executeTool } from './dispatch.js';
6
+ export { evaluateAgentReadiness } from './services/agentReadinessService.js';
7
+ export { createIssue, updateIssue, issueInfo, readyCheck, developIssue, listIssueSubissues } from './issue.js';
8
+ export { prInfo, listPrs, prChecks, checkoutPr, publishPr, submitFormalReview, mergePr, finishIssue } from './pr.js';
9
+ export { preparePrWorktree, cleanupNonIssueWorktree } from './worktree.js';
10
+ export { getNativeBlockerRelationships, getNativeBlockingRelationships, replaceBlockedBy, replaceParentIssue, hasNativeSubIssues, } from './github/relationships.js';
11
+ export { normalizeLegacyIssue, planOfflineLegacyIssueMigration } from './services/legacyIssueMigration.js';
12
+ export { buildVelocityReport, getDeliveryRecords, recordMergedDelivery } from './services/deliveryRecordService.js';
13
+ export { getIssueWorktreeStrict, listWorktreesStrict } from './services/worktreeRegistry.js';
14
+ export { prepareIssueWorktree, prepareStandaloneWorktree } from './worktree.js';
15
+ export { verifyIssue, createIssuePhaseEvidence } from './verification.js';
16
+ //# sourceMappingURL=agent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent.js","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,8BAA8B,EAAE,MAAM,4BAA4B,CAAC;AAErH,OAAO,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,gCAAgC,EAAE,qBAAqB,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AACpH,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAC/G,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,kBAAkB,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACrH,OAAO,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAC3E,OAAO,EACL,6BAA6B,EAC7B,8BAA8B,EAC9B,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,oBAAoB,EAAE,+BAA+B,EAAE,MAAM,oCAAoC,CAAC;AAC3G,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAEpH,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAC7F,OAAO,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC"}
package/dist/cli.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/dist/cli.js ADDED
@@ -0,0 +1,314 @@
1
+ #!/usr/bin/env node
2
+ import { existsSync, readFileSync } from 'node:fs';
3
+ import { Command } from 'commander';
4
+ import { printCommandResult } from './cliResult.js';
5
+ import { loadDeliveryConfig } from './config/deliveryConfig.js';
6
+ import { contextFor, executeTool } from './dispatch.js';
7
+ import { git, gitExitCode, primaryGitRoot } from './git.js';
8
+ import { listIssueSubissues } from './issue.js';
9
+ import { checkoutPr, listPrs, prChecks } from './pr.js';
10
+ import { serveAiDeliveryMcp } from './mcp/index.js';
11
+ import { planOfflineLegacyIssueMigration } from './services/legacyIssueMigration.js';
12
+ import { assertDeliveryRuntimeAdmitted } from './services/deliveryAdmission.js';
13
+ import { buildVelocityReport, getDeliveryRecords } from './services/deliveryRecordService.js';
14
+ import { listWorktreesStrict } from './services/worktreeRegistry.js';
15
+ import { cleanupNonIssueWorktree } from './worktree.js';
16
+ const program = new Command();
17
+ program
18
+ .name('ai-delivery')
19
+ .description('Generic GitHub issue and pull request delivery')
20
+ .version('0.1.0')
21
+ .option('--identity <name>', 'Configured author or reviewer identity')
22
+ .option('--personal-auth', 'Explicit personal-token author mode')
23
+ .option('--repo <owner/name>', 'Repository selector; must match the configured checkout')
24
+ .option('--repo-root <path>', 'Target Git repository root', process.cwd());
25
+ function execution() {
26
+ const options = program.opts();
27
+ const identity = options.identity ?? process.env.AI_DELIVERY_IDENTITY;
28
+ return {
29
+ repoRoot: options.repoRoot,
30
+ ...(identity === undefined ? {} : { identity }),
31
+ personalAuth: options.personalAuth === true,
32
+ ...(options.repo === undefined ? {} : { repo: options.repo }),
33
+ };
34
+ }
35
+ function int(value) {
36
+ return value === undefined ? undefined : Number(value);
37
+ }
38
+ function list(value) {
39
+ return value === undefined
40
+ ? undefined
41
+ : value
42
+ .split(',')
43
+ .map((part) => part.trim())
44
+ .filter(Boolean);
45
+ }
46
+ function ints(value) {
47
+ return list(value)?.map(Number);
48
+ }
49
+ function body(value, file) {
50
+ if (value !== undefined && file !== undefined)
51
+ throw new Error('Pass either --body or --body-file.');
52
+ return file === undefined ? value : readFileSync(file, 'utf8');
53
+ }
54
+ function run(name, input) {
55
+ return executeTool(name, input, execution()).then((value) => printCommandResult(name, value));
56
+ }
57
+ function print(value) {
58
+ process.stdout.write(`${JSON.stringify(value, null, 2)}\n`);
59
+ }
60
+ program
61
+ .command('create')
62
+ .requiredOption('--title <title>')
63
+ .option('--body <markdown>')
64
+ .option('--body-file <path>')
65
+ .option('--type <type>')
66
+ .option('--points <number>')
67
+ .option('--priority <priority>')
68
+ .option('--labels <labels>')
69
+ .option('--blocked-by <numbers>')
70
+ .option('--milestone <number>')
71
+ .option('--parent <number>')
72
+ .action(async (o) => run('issue_create', {
73
+ title: o.title,
74
+ body: body(o.body, o.bodyFile),
75
+ issueType: o.type,
76
+ points: int(o.points),
77
+ priority: o.priority,
78
+ labels: list(o.labels),
79
+ blockedBy: ints(o.blockedBy),
80
+ milestone: int(o.milestone),
81
+ parentIssueNumber: int(o.parent),
82
+ }));
83
+ program
84
+ .command('start')
85
+ .option('--issue <number>')
86
+ .option('--request <text>')
87
+ .option('--title <title>')
88
+ .option('--body <markdown>')
89
+ .option('--body-file <path>')
90
+ .option('--type <type>')
91
+ .option('--points <number>')
92
+ .option('--priority <priority>')
93
+ .option('--labels <labels>')
94
+ .option('--blocked-by <numbers>')
95
+ .option('--milestone <number>')
96
+ .option('--parent <number>')
97
+ .option('--branch <branch>')
98
+ .option('--scratch')
99
+ .option('--develop')
100
+ .option('--resume-created')
101
+ .action(async (o) => run('issue_start', {
102
+ issueNumber: int(o.issue),
103
+ request: o.request,
104
+ title: o.title,
105
+ body: body(o.body, o.bodyFile),
106
+ issueType: o.type,
107
+ points: int(o.points),
108
+ priority: o.priority,
109
+ labels: list(o.labels),
110
+ blockedBy: ints(o.blockedBy),
111
+ milestone: int(o.milestone),
112
+ parentIssueNumber: int(o.parent),
113
+ branch: o.branch,
114
+ scratch: o.scratch === true,
115
+ develop: o.develop === true,
116
+ resumeCreated: o.resumeCreated === true,
117
+ }));
118
+ program
119
+ .command('update')
120
+ .requiredOption('--issue <number>')
121
+ .option('--title <title>')
122
+ .option('--body <markdown>')
123
+ .option('--body-file <path>')
124
+ .option('--type <type>')
125
+ .option('--points <number>')
126
+ .option('--priority <priority>')
127
+ .option('--labels <labels>')
128
+ .option('--blocked-by <numbers>')
129
+ .option('--milestone <number>')
130
+ .option('--parent <number>')
131
+ .option('--state <state>')
132
+ .action(async (o) => run('issue_update', {
133
+ issueNumber: int(o.issue),
134
+ title: o.title,
135
+ body: body(o.body, o.bodyFile),
136
+ issueType: o.type,
137
+ points: int(o.points),
138
+ priority: o.priority,
139
+ labels: list(o.labels),
140
+ blockedBy: ints(o.blockedBy),
141
+ milestone: int(o.milestone),
142
+ parentIssueNumber: int(o.parent),
143
+ state: o.state,
144
+ }));
145
+ program
146
+ .command('info')
147
+ .requiredOption('--issue <number>')
148
+ .option('--cached')
149
+ .action(async (o) => run('issue_info', { issueNumber: int(o.issue), cached: o.cached === true }));
150
+ program
151
+ .command('ready:check')
152
+ .requiredOption('--issue <number>')
153
+ .action(async (o) => run('issue_ready_check', { issueNumber: int(o.issue) }));
154
+ for (const field of ['parent', 'blockers']) {
155
+ program
156
+ .command(field)
157
+ .requiredOption('--issue <number>')
158
+ .action(async (o) => {
159
+ const info = (await executeTool('issue_info', { issueNumber: int(o.issue) }, execution()));
160
+ print(field === 'parent'
161
+ ? { issueNumber: int(o.issue), parentIssueNumber: info.parentIssueNumber }
162
+ : { issueNumber: int(o.issue), blockedBy: info.blockedBy });
163
+ });
164
+ }
165
+ program
166
+ .command('subissues')
167
+ .requiredOption('--issue <number>')
168
+ .action(async (o) => {
169
+ const context = await contextFor(execution(), 'subissues');
170
+ print({ issueNumber: int(o.issue), subissues: await listIssueSubissues(context, Number(o.issue)) });
171
+ });
172
+ program
173
+ .command('develop')
174
+ .requiredOption('--issue <number>')
175
+ .option('--assignee <login>')
176
+ .action(async (o) => run('issue_develop', { issueNumber: int(o.issue), assignee: o.assignee }));
177
+ program
178
+ .command('verify')
179
+ .requiredOption('--issue <number>')
180
+ .option('--admit <classes>')
181
+ .option('--prepublication-review <path>')
182
+ .action(async (o) => run('issue_verify', {
183
+ issueNumber: int(o.issue),
184
+ admit: list(o.admit),
185
+ prepublicationReview: o.prepublicationReview,
186
+ }));
187
+ program
188
+ .command('pr:create')
189
+ .requiredOption('--issue <number>')
190
+ .option('--title <title>')
191
+ .option('--body-file <path>')
192
+ .option('--ready')
193
+ .option('--dry-run')
194
+ .action(async (o) => run('issue_pr_create', {
195
+ issueNumber: int(o.issue),
196
+ title: o.title,
197
+ body: body(undefined, o.bodyFile),
198
+ draft: o.ready !== true,
199
+ dryRun: o.dryRun === true,
200
+ }));
201
+ program
202
+ .command('pr:info')
203
+ .option('--issue <number>')
204
+ .option('--pr <number>')
205
+ .action(async (o) => run('issue_pr_info', { issueNumber: int(o.issue), prNumber: int(o.pr) }));
206
+ program
207
+ .command('pr:list')
208
+ .option('--state <state>', 'open, closed or all', 'open')
209
+ .action(async (o) => {
210
+ if (!['open', 'closed', 'all'].includes(o.state))
211
+ throw new Error('Invalid PR state.');
212
+ const context = await contextFor(execution(), 'pr:list');
213
+ print(await listPrs(context, o.state));
214
+ });
215
+ program
216
+ .command('pr:checks')
217
+ .requiredOption('--pr <number>')
218
+ .action(async (o) => {
219
+ const context = await contextFor(execution(), 'pr:checks');
220
+ print(await prChecks(context, Number(o.pr)));
221
+ });
222
+ program
223
+ .command('pr:checkout')
224
+ .requiredOption('--pr <number>')
225
+ .action(async (o) => {
226
+ assertDeliveryRuntimeAdmitted(execution());
227
+ const context = await contextFor(execution(), 'pr:checkout');
228
+ print(await checkoutPr(context, Number(o.pr)));
229
+ });
230
+ program
231
+ .command('pr:review')
232
+ .requiredOption('--issue <number>')
233
+ .requiredOption('--pr <number>')
234
+ .requiredOption('--artifact <path>')
235
+ .option('--dry-run')
236
+ .action(async (o) => run('issue_pr_review', {
237
+ issueNumber: int(o.issue),
238
+ prNumber: int(o.pr),
239
+ artifact: readFileSync(o.artifact, 'utf8'),
240
+ dryRun: o.dryRun === true,
241
+ }));
242
+ for (const [command, tool] of [
243
+ ['pr:merge', 'issue_pr_merge'],
244
+ ['finish', 'issue_finish'],
245
+ ]) {
246
+ program
247
+ .command(command)
248
+ .requiredOption('--issue <number>')
249
+ .requiredOption('--pr <number>')
250
+ .option('--strategy <method>')
251
+ .option('--dry-run')
252
+ .action(async (o) => run(tool, {
253
+ issueNumber: int(o.issue),
254
+ prNumber: int(o.pr),
255
+ strategy: o.strategy,
256
+ dryRun: o.dryRun === true,
257
+ }));
258
+ }
259
+ program
260
+ .command('worktree:create')
261
+ .requiredOption('--name <name>')
262
+ .requiredOption('--branch <branch>')
263
+ .action(async (o) => run('issue_worktree_create', o));
264
+ program.command('worktrees:list').action(() => print(listWorktreesStrict(primaryGitRoot(execution().repoRoot))));
265
+ program.command('worktrees:status').action(() => {
266
+ const root = primaryGitRoot(execution().repoRoot);
267
+ print(listWorktreesStrict(root).map((row) => {
268
+ const present = existsSync(row.path) && gitExitCode(row.path, 'rev-parse', '--is-inside-work-tree') === 0;
269
+ return {
270
+ ...row,
271
+ present,
272
+ observedBranch: present ? git(row.path, 'branch', '--show-current') : null,
273
+ clean: present ? git(row.path, 'status', '--porcelain', '--untracked-files=all') === '' : null,
274
+ };
275
+ }));
276
+ });
277
+ program
278
+ .command('worktrees:cleanup')
279
+ .option('--pr <number>')
280
+ .option('--name <name>')
281
+ .action(async (o) => {
282
+ assertDeliveryRuntimeAdmitted(execution());
283
+ const context = await contextFor(execution(), 'worktrees:cleanup');
284
+ await cleanupNonIssueWorktree({
285
+ repoRoot: context.root,
286
+ ...(o.pr === undefined ? {} : { prNumber: Number(o.pr) }),
287
+ ...(o.name === undefined ? {} : { name: o.name }),
288
+ });
289
+ print({ cleaned: true, ...(o.pr === undefined ? { name: o.name } : { prNumber: Number(o.pr) }) });
290
+ });
291
+ program
292
+ .command('migrate:legacy-issues')
293
+ .requiredOption('--input-file <path>', 'Offline legacy issue inventory JSON')
294
+ .action((o) => {
295
+ const report = planOfflineLegacyIssueMigration(JSON.parse(readFileSync(o.inputFile, 'utf8')));
296
+ process.stdout.write(`${JSON.stringify(report, null, 2)}\n`);
297
+ });
298
+ program
299
+ .command('metrics')
300
+ .description('Report bounded terminal delivery metrics')
301
+ .command('velocity')
302
+ .option('--json', 'Print the canonical JSON report')
303
+ .action(() => {
304
+ const root = primaryGitRoot(execution().repoRoot);
305
+ const config = loadDeliveryConfig(root).config;
306
+ const report = buildVelocityReport(getDeliveryRecords(root), new Date(), config.native.points.values.map(Number));
307
+ process.stdout.write(`${JSON.stringify(report, null, 2)}\n`);
308
+ });
309
+ program.command('mcp:serve').action(async () => serveAiDeliveryMcp(execution()));
310
+ program.parseAsync(process.argv).catch((error) => {
311
+ process.stderr.write(`ai-delivery: ${error instanceof Error ? error.message : String(error)}\n`);
312
+ process.exitCode = 1;
313
+ });
314
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAyB,MAAM,eAAe,CAAC;AAC/E,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC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C,kBAAkB,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;AAEjF,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IAC/C,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,gBAAgB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACjG,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AACvB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ /** Keep a recoverable start failure machine-readable while signalling shell failure. */
2
+ export declare function printCommandResult(command: string, value: unknown): void;
@@ -0,0 +1,12 @@
1
+ /** Keep a recoverable start failure machine-readable while signalling shell failure. */
2
+ export function printCommandResult(command, value) {
3
+ process.stdout.write(`${JSON.stringify(value, null, 2)}\n`);
4
+ if (command === 'issue_start' &&
5
+ typeof value === 'object' &&
6
+ value !== null &&
7
+ 'status' in value &&
8
+ value.status === 'created-not-started') {
9
+ process.exitCode = 1;
10
+ }
11
+ }
12
+ //# sourceMappingURL=cliResult.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cliResult.js","sourceRoot":"","sources":["../src/cliResult.ts"],"names":[],"mappings":"AAAA,wFAAwF;AACxF,MAAM,UAAU,kBAAkB,CAAC,OAAe,EAAE,KAAc;IAChE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;IAC5D,IACE,OAAO,KAAK,aAAa;QACzB,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,QAAQ,IAAI,KAAK;QACjB,KAAK,CAAC,MAAM,KAAK,qBAAqB,EACtC,CAAC;QACD,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACvB,CAAC;AACH,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,30 @@
1
+ import assert from 'node:assert/strict';
2
+ import { spawnSync } from 'node:child_process';
3
+ import { join } from 'node:path';
4
+ import { test } from 'vitest';
5
+ import { pathToFileURL } from 'node:url';
6
+ test('CLI preserves recoverable start JSON and exits nonzero after creation failure', () => {
7
+ const helper = pathToFileURL(join(process.cwd(), 'dist', 'cliResult.js')).href;
8
+ const failure = {
9
+ schemaVersion: 'ai-delivery.issue-start-registration@1',
10
+ status: 'created-not-started',
11
+ createdIssue: { number: 17 },
12
+ };
13
+ const code = `import { printCommandResult } from ${JSON.stringify(helper)};` +
14
+ `printCommandResult('issue_start', ${JSON.stringify(failure)});`;
15
+ const result = spawnSync(process.execPath, ['--input-type=module', '-e', code], { encoding: 'utf8' });
16
+ assert.equal(result.status, 1);
17
+ assert.deepEqual(JSON.parse(result.stdout), failure);
18
+ assert.equal(result.stderr, '');
19
+ const ordinary = spawnSync(process.execPath, [
20
+ '--input-type=module',
21
+ '-e',
22
+ `import { printCommandResult } from ${JSON.stringify(helper)};` +
23
+ `printCommandResult('issue_start', {status:'started'});`,
24
+ ], { encoding: 'utf8' });
25
+ assert.equal(ordinary.status, 0);
26
+ const parsed = JSON.parse(ordinary.stdout);
27
+ assert.ok(parsed !== null && typeof parsed === 'object' && 'status' in parsed);
28
+ assert.equal(parsed.status, 'started');
29
+ });
30
+ //# sourceMappingURL=cliResult.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cliResult.test.js","sourceRoot":"","sources":["../src/cliResult.test.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,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