@aviaratech/ai-delivery 0.3.23 → 0.3.25

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 (143) hide show
  1. package/CONTRIBUTING.md +166 -16
  2. package/README.md +75 -446
  3. package/dist/agent.d.ts +5 -11
  4. package/dist/agent.js +4 -8
  5. package/dist/agent.js.map +1 -1
  6. package/dist/agentReadiness.test.d.ts +1 -0
  7. package/dist/agentReadiness.test.js +139 -0
  8. package/dist/agentReadiness.test.js.map +1 -0
  9. package/dist/cli.js +27 -111
  10. package/dist/cli.js.map +1 -1
  11. package/dist/config/deliveryConfig.d.ts +44 -55
  12. package/dist/config/deliveryConfig.js +85 -88
  13. package/dist/config/deliveryConfig.js.map +1 -1
  14. package/dist/config/deliveryConfig.test.js +13 -5
  15. package/dist/config/deliveryConfig.test.js.map +1 -1
  16. package/dist/contributorChecks.test.d.ts +1 -0
  17. package/dist/contributorChecks.test.js +1010 -0
  18. package/dist/contributorChecks.test.js.map +1 -0
  19. package/dist/currentConsumer.test.d.ts +1 -0
  20. package/dist/currentConsumer.test.js +832 -0
  21. package/dist/currentConsumer.test.js.map +1 -0
  22. package/dist/delivery/common.js +7 -2
  23. package/dist/delivery/common.js.map +1 -1
  24. package/dist/delivery/delivery.test.js +2 -3
  25. package/dist/delivery/delivery.test.js.map +1 -1
  26. package/dist/delivery/index.d.ts +0 -6
  27. package/dist/delivery/index.js +0 -3
  28. package/dist/delivery/index.js.map +1 -1
  29. package/dist/delivery/legacy.d.ts +8 -0
  30. package/dist/delivery/legacy.js +5 -0
  31. package/dist/delivery/legacy.js.map +1 -0
  32. package/dist/delivery/policy.js +2 -13
  33. package/dist/delivery/policy.js.map +1 -1
  34. package/dist/dependencyCompatibility.test.d.ts +1 -0
  35. package/dist/dependencyCompatibility.test.js +175 -0
  36. package/dist/dependencyCompatibility.test.js.map +1 -0
  37. package/dist/directoryIndependent.test.d.ts +1 -0
  38. package/dist/directoryIndependent.test.js +352 -0
  39. package/dist/directoryIndependent.test.js.map +1 -0
  40. package/dist/dispatch.d.ts +29 -3
  41. package/dist/dispatch.js +166 -457
  42. package/dist/dispatch.js.map +1 -1
  43. package/dist/genericCompatibility.test.js +0 -35
  44. package/dist/genericCompatibility.test.js.map +1 -1
  45. package/dist/git.js +10 -3
  46. package/dist/git.js.map +1 -1
  47. package/dist/gitProcess.d.ts +6 -0
  48. package/dist/gitProcess.js +56 -0
  49. package/dist/gitProcess.js.map +1 -0
  50. package/dist/github/discovery.d.ts +1 -0
  51. package/dist/github/discovery.js +1 -1
  52. package/dist/github/discovery.js.map +1 -1
  53. package/dist/github/discovery.test.js +25 -20
  54. package/dist/github/discovery.test.js.map +1 -1
  55. package/dist/github/nativeIssueMetadata.d.ts +2 -2
  56. package/dist/github/nativeIssueMetadata.js.map +1 -1
  57. package/dist/github/projectDelivery.d.ts +1 -1
  58. package/dist/github/projectDelivery.js.map +1 -1
  59. package/dist/github/repo.d.ts +7 -1
  60. package/dist/github/repo.js +58 -2
  61. package/dist/github/repo.js.map +1 -1
  62. package/dist/issue.d.ts +18 -6
  63. package/dist/issue.js +136 -319
  64. package/dist/issue.js.map +1 -1
  65. package/dist/issueJournal.d.ts +1 -1
  66. package/dist/issueJournal.test.js +88 -6
  67. package/dist/issueJournal.test.js.map +1 -1
  68. package/dist/lifecycle.test.js +40 -7371
  69. package/dist/lifecycle.test.js.map +1 -1
  70. package/dist/logger.js +4 -4
  71. package/dist/logger.js.map +1 -1
  72. package/dist/mcp/tools.d.ts +32 -42
  73. package/dist/mcp/tools.js +51 -42
  74. package/dist/mcp/tools.js.map +1 -1
  75. package/dist/pluginInstaller.d.ts +1 -1
  76. package/dist/pluginInstaller.js +8 -2
  77. package/dist/pluginInstaller.js.map +1 -1
  78. package/dist/pluginInstaller.test.js +213 -2
  79. package/dist/pluginInstaller.test.js.map +1 -1
  80. package/dist/pluginPackaging.test.js +225 -2
  81. package/dist/pluginPackaging.test.js.map +1 -1
  82. package/dist/pr.d.ts +73 -114
  83. package/dist/pr.js +837 -1085
  84. package/dist/pr.js.map +1 -1
  85. package/dist/pr.test.js +453 -236
  86. package/dist/pr.test.js.map +1 -1
  87. package/dist/prAssociation.test.d.ts +1 -0
  88. package/dist/prAssociation.test.js +1336 -0
  89. package/dist/prAssociation.test.js.map +1 -0
  90. package/dist/prDispatch.test.d.ts +1 -0
  91. package/dist/prDispatch.test.js +96 -0
  92. package/dist/prDispatch.test.js.map +1 -0
  93. package/dist/releaseReconciliation.test.d.ts +1 -0
  94. package/dist/releaseReconciliation.test.js +318 -0
  95. package/dist/releaseReconciliation.test.js.map +1 -0
  96. package/dist/releaseWorkflow.test.d.ts +1 -0
  97. package/dist/releaseWorkflow.test.js +447 -0
  98. package/dist/releaseWorkflow.test.js.map +1 -0
  99. package/dist/review.d.ts +37 -7
  100. package/dist/review.js +106 -45
  101. package/dist/review.js.map +1 -1
  102. package/dist/review.test.js +30 -71
  103. package/dist/review.test.js.map +1 -1
  104. package/dist/services/agentReadinessService.d.ts +1 -1
  105. package/dist/services/agentReadinessService.js +4 -1
  106. package/dist/services/agentReadinessService.js.map +1 -1
  107. package/dist/services/deliveryAdmission.d.ts +4 -4
  108. package/dist/services/deliveryAdmission.js.map +1 -1
  109. package/dist/setup.test.js +10 -5
  110. package/dist/setup.test.js.map +1 -1
  111. package/dist/stagedChecks.test.d.ts +1 -0
  112. package/dist/stagedChecks.test.js +228 -0
  113. package/dist/stagedChecks.test.js.map +1 -0
  114. package/dist/start.test.d.ts +1 -0
  115. package/dist/start.test.js +72 -0
  116. package/dist/start.test.js.map +1 -0
  117. package/dist/stdoutRegression.test.d.ts +1 -0
  118. package/dist/stdoutRegression.test.js +326 -0
  119. package/dist/stdoutRegression.test.js.map +1 -0
  120. package/dist/verification.d.ts +1 -27
  121. package/dist/verification.js +5 -1332
  122. package/dist/verification.js.map +1 -1
  123. package/dist/worktree.d.ts +1 -31
  124. package/dist/worktree.js +5 -200
  125. package/dist/worktree.js.map +1 -1
  126. package/dist/worktreeTransition.d.ts +1 -1
  127. package/dist/worktreeTransition.js +10 -5
  128. package/dist/worktreeTransition.js.map +1 -1
  129. package/dist/worktreeTransition.test.js +2 -3
  130. package/dist/worktreeTransition.test.js.map +1 -1
  131. package/package.json +9 -6
  132. package/plugins/ai-delivery/.claude-plugin/plugin.json +2 -2
  133. package/plugins/ai-delivery/README.md +3 -3
  134. package/plugins/ai-delivery/plugin.json +1 -1
  135. package/plugins/ai-delivery/runtime/dist/THIRD-PARTY-NOTICES.md +1 -1
  136. package/plugins/ai-delivery/runtime/dist/cli.js +50 -59
  137. package/plugins/ai-delivery/runtime/package.json +1 -1
  138. package/plugins/ai-delivery/skills/intake-create/SKILL.md +1 -1
  139. package/plugins/ai-delivery/skills/pr-handoff/SKILL.md +14 -21
  140. package/plugins/ai-delivery/skills/worktree-lifecycle/SKILL.md +12 -23
  141. package/dist/services/deliveryRecordService.d.ts +0 -47
  142. package/dist/services/deliveryRecordService.js +0 -199
  143. package/dist/services/deliveryRecordService.js.map +0 -1
package/CONTRIBUTING.md CHANGED
@@ -1,22 +1,153 @@
1
1
  # Contributing to ai-delivery
2
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.
3
+ Use an isolated checkout and controller Node **24.21.0** with npm **11.19.0**.
4
+ Node **26.2.0** is a separate public-library consumer prerequisite, not a
5
+ CLI/controller replacement. Provision with your existing runtime manager and
6
+ read back the actual executables (tool installation is a separate action):
6
7
 
7
8
  ```sh
8
- npm ci
9
+ nvm use 26.2.0
10
+ export AI_DELIVERY_NODE26_EXECUTABLE="$(node -p 'process.execPath')"
11
+ nvm use 24.21.0
12
+ node -p 'JSON.stringify({version:process.version,execPath:process.execPath})'
13
+ npm --version
14
+ "$AI_DELIVERY_NODE26_EXECUTABLE" -p 'JSON.stringify({version:process.version,execPath:process.execPath})'
15
+ npm ci --ignore-scripts --no-audit --no-fund
9
16
  npm run checks
10
- npm run build
11
- npm pack --dry-run
12
17
  ```
13
18
 
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.
19
+ The runner fails before gates for missing, wrong or inaccessible prerequisites.
20
+ It resolves existing temporary-directory aliases to their physical paths so
21
+ macOS synthetic fixtures do not mistake `/var` or `/tmp` aliases for managed
22
+ plugin symlinks; this creates no new destination or host setting.
23
+ Local and CI full entry `npm run checks` runs `scripts/current-qualification.mjs`:
24
+ the canonical six-gate producer, one actual scripts-disabled pack, then an owned,
25
+ credential-free production-only consumer installation of that exact archive.
26
+ The producer in `scripts/checks.mjs` runs formatting, native type-aware lint,
27
+ strict TypeScript, a **clean single build**, all intended compiled Vitest files
28
+ with one worker, and complete dry inventory validation. The immutable
29
+ `contributor-checks@1` snapshot records those six gates; its `fullSuccess` means
30
+ producer success. Overall `ai-delivery.current-qualification@1` requires the
31
+ exact archive, resolved production closure, installed byte/mode checks, CLI,
32
+ exports, packaged stdio MCP schemas, skills, actual Node26 library use, and owned
33
+ quiescent removal. Its `qualified: true` and exit 0 are full contributor proof.
34
+ A producer pass alone reports `artifactQualified: false`.
35
+ Source names, compiled names and actual Vitest selection must agree;
36
+ deleted/renamed tests cannot survive in stale `dist`. Actual artifact qualification
37
+ requires a clean committed source including untracked files. Results must be
38
+ outside the checkout. CI retains required jobs `checks` and `secrets` and uploads
39
+ partial/final evidence, immutable producer logs, and the actual archive.
40
+
41
+ A serial artifact handoff uses `npm run checks:producer -- --results-dir
42
+ /an/owned/new/result-directory`. It runs the producer and actual pack once,
43
+ retains `contract.json` and `checkpoint.json`, and returns exit **2** with overall
44
+ `incomplete` and the consumer omissions. Resume without rebuilding or repacking:
45
+
46
+ ```sh
47
+ npm run checks:resume -- --resume /owned/original/checkpoint.json --results-dir /owned/new/resume-results
48
+ ```
49
+
50
+ Resume revalidates clean HEAD/tree, source fingerprint, manifest/lock, all archive
51
+ bytes/modes against member SHA256s captured inside the successful producer,
52
+ immutable producer digest, six gates, counts, reviewed skips and
53
+ pack quiescence before installation and again before completion. A changed or
54
+ incomplete checkpoint fails. Consumer launch is supervised and reserves one
55
+ checkpoint-wide `consumer-attempt.json` before starting a child. It retains the
56
+ command, observed PID/birth identities, logs and owned temporary root during
57
+ execution. An unresolved attempt blocks another install even with fresh overall
58
+ results storage. After controller loss, `--reconcile-consumer` joins an already
59
+ qualified retained receipt only after every observed identity is absent; it
60
+ does not launch or kill a process. Missing launch identity, incomplete receipts,
61
+ active processes or leftover temporary contents require owner reconciliation.
62
+ A completed retained consumer is reused without installation. For an admitted
63
+ separate consumer owner, prefer the supervised resume entry. If its independently
64
+ supervised invocation retains equivalent launch and cleanup proof, invoke
65
+ `node scripts/current-consumer.mjs /owned/original/contract.json
66
+ /owned/consumer-result.json --authorize-install` once, then join its retained
67
+ result with the same resume command plus `--consumer-result
68
+ /owned/consumer-result.json`. That join performs no install, build or pack.
69
+ Without `--authorize-install` the helper returns incomplete/exit 2; it cannot
70
+ complete overall checks. Immutable receipts are referenced by SHA256 in the
71
+ overall result, never inserted back into the producer hash. Do not rerun a
72
+ successful producer or pack merely to report or join evidence. Each invocation
73
+ needs fresh owned output storage; preserve uncertain/interrupted receipts.
74
+
75
+ `npm run checks:fast` runs only format/lint/types. It reports `partial-passed`,
76
+ `fullSuccess: false` and omitted build/tests/inventory. `npm test` is a separate
77
+ development command, not full-check proof. Every check run prints its results
78
+ directory and keeps `result.json`, `result.txt`, per-command logs, toolchain/tree,
79
+ selected file/test counts, skips, start/final exit, signals and partial state.
80
+ Raw test observations survive a failing command and remain distinct from the
81
+ validated proof required for full success.
82
+ Select owned storage outside the checkout with `npm run checks -- --results-dir
83
+ /an/owned/new/result-directory`. Existing results are never overwritten by a
84
+ retry. A lost response or missing CI artifact means completion is **unknown**:
85
+ inspect the original result and PID/birth records, prove owned quiescence, then
86
+ start a fresh attempt. Abrupt process/service loss can prevent final transport.
87
+
88
+ The reviewed `SKIP_ALLOWLIST` names only two top-level skips. The setup
89
+ interruption helper requires passing recovery parents and its receipt; their
90
+ launch is distinct from its top-level skip. Absent
91
+ `AI_DELIVERY_REAL_PACKAGE_ARCHIVE` (an explicitly supplied path is forwarded
92
+ and must not silently become an absent-input skip), the historical reviewed 0.3.4 archive
93
+ qualification remains **unexecuted**. That skip, checkout-sharing consumer tests
94
+ and dry inventory are not current production-only tarball or native adoption
95
+ proof. The reviewed current-tarball consumer is joined by the maintained full entry;
96
+ its installation proof remains distinct from the producer and historical archive. Unexpected skips,
97
+ exclusions, unknown statuses, missing proof and zero tests fail full checks.
98
+
99
+ Built-in Node/V8 coverage collects executed **observed V8 ranges** in compiled
100
+ library/contributor scripts without a new dependency; it is not TypeScript
101
+ source line/branch coverage. Startup collection measures compiled library files,
102
+ `scripts/build-plugin.mjs`, and native invocations of the two runners by synthetic
103
+ Git hooks. The runners' counters measure those native fixture paths; the main
104
+ canonical controller and Vitest-transformed imports are not instrumented. Each
105
+ result explicitly lists scripts without any raw measurement as unmeasured,
106
+ with no derived floors. For measured files, review staged floors five percentage
107
+ points below their first baseline using the same Node/V8 graph before
108
+ enforcement; retain these instrumentation limits when assessing those floors.
109
+ No arbitrary global 100% threshold or metric-only tests are required.
110
+
111
+ There is no local total wall-clock deadline. Set an explicit operator-requested
112
+ per-command budget with `--command-timeout-ms <milliseconds>` (default 0,
113
+ disabled). A timeout is separate from source assertion failure. Cancellation
114
+ stops identity-checked owned descendants (including observed separate sessions),
115
+ continues discovery from those descendants after the root exits, then uses a
116
+ three-second TERM grace before identity-checked KILL and up to one second to
117
+ confirm quiescence. Unconfirmed cleanup stays explicit.
118
+ Logs are limited to 32 MiB per command and process RSS is sampled against 3 GiB,
119
+ not a hard ceiling or model-service measurement. PID/birth observation must work
120
+ before launch. CI keeps its existing 15-minute service job limit; interruption
121
+ or failed artifact transport requires reconciliation, not a blind retry.
122
+
123
+ The optional tracked hook is `scripts/pre-commit.mjs`. It copies the index into
124
+ an owned temporary directory, honoring `GIT_INDEX_FILE` (including temporary
125
+ indexes supplied by `git commit -a` and path-limited commits), computes the exact staged tree with private
126
+ objects, materializes that tree, provisions from its staged lock and invokes
127
+ its **staged** six-gate canonical producer. The snapshot hook reports actual
128
+ archive/clean-HEAD consumer omissions and `artifactQualified: false`; it does not
129
+ install or force an uncommitted index through clean-source qualification. It does not stash, write the original index or
130
+ unstaged files, or borrow checkout node_modules. It checks the source index for
131
+ drift and removes only its owned snapshot after quiescence; results survive.
132
+ Unmerged/submodule/symlink index entries fail explicitly. Opt-in installation
133
+ in your own checkout only, after inspecting and preserving any existing hook:
134
+
135
+ ```sh
136
+ # Do not run on an operator host without explicit operator approval.
137
+ hook_path="$(git rev-parse --git-path hooks/pre-commit)"
138
+ test ! -e "$hook_path"
139
+ printf '%s\n' '#!/bin/sh' 'exec node scripts/pre-commit.mjs' > "$hook_path"
140
+ chmod +x "$hook_path"
141
+ ```
142
+
143
+ The hook needs the pinned controller/npm PATH and exported actual Node26 path.
144
+ Synthetic fixtures prove partial staging, additions, deletions and lockfile
145
+ isolation without operator hook installation. Command environments are
146
+ allowlisted: credential references, NODE_PATH and ambient NODE_OPTIONS are not
147
+ forwarded. Synthetic tests do not mutate live issues. Review the complete
148
+ retained inventory; never commit credentials, host configuration, receipts,
149
+ logs or repository-specific policy. The separate TruffleHog job scans changed
150
+ Git history without release credentials.
20
151
 
21
152
  The `Publish npm package` workflow is manual, runs only from `main`, and uses
22
153
  the `npm-publish` environment. Before enabling it, the repository owner must:
@@ -45,11 +176,21 @@ the `npm-publish` environment. Before enabling it, the repository owner must:
45
176
  version, actual built archive, complete inventory and confidentiality scan.
46
177
  Dispatch the workflow on `main` with `reviewed_source_sha`, `package_version`
47
178
  and `archive_sha256` from that accepted candidate. Missing or mismatched
48
- inputs fail closed. The build job checks, scans and packages without OIDC
49
- permission; only the publish job receives `id-token: write`. It checks the
50
- downloaded archive against the accepted digest, compares an inert repack
179
+ inputs fail closed. The package job checks, scans and retains its qualified archive without OIDC
180
+ permission; only the publish job receives `id-token: write`. The package job
181
+ runs full checks once with results outside the checkout, then
182
+ `scripts/release-artifact.mjs select` validates the successful source-bound
183
+ producer/pack/consumer joins and owned cleanup before copying that exact
184
+ archive and original receipt bytes into the uploaded artifact. It performs
185
+ no subsequent build or production pack. Missing, incomplete or mismatched
186
+ receipts fail before upload. The publish job checks the portable receipt and
187
+ downloaded archive against the accepted source/version/digest, compares an inert repack
51
188
  byte for byte, and rejects observed protected-main or required-check drift
52
- before publishing through the existing trusted publisher. Inputs are passed
189
+ before passing the verified tarball path directly to `npm publish` through the
190
+ existing trusted publisher. The inert repack is a byte comparison only;
191
+ its output never becomes the upload or publication source. Receipt hashes
192
+ preserve evidence integrity; reviewed workflow source and its actual execution
193
+ remain necessary provenance. Inputs are passed
53
194
  as environment values, never interpolated into shell commands.
54
195
 
55
196
  Release dispatch remains an explicit action by the authorized delivery owner;
@@ -69,6 +210,15 @@ after publication, including a failed or ambiguous publish command, and never
69
210
  automatically retries publication. Read the registry before any explicit retry.
70
211
  Metadata presence alone does not verify a provenance signature or source identity.
71
212
 
213
+ Expected version/archive 404s, missing provenance metadata or package-index entries,
214
+ and a lagging stable `latest` tag receive paced read-only reconciliation for up to
215
+ five minutes inside the existing ten-minute publish job. Requests retain a
216
+ 30-second limit, shortened to the remaining reconciliation allowance, with bounded
217
+ response bodies and pending-state output. Conflicting evidence, a newer `latest`
218
+ tag and authentication/service errors fail immediately. Exhausted reconciliation
219
+ or an ambiguous publish result requires read-only qualification of the original
220
+ invocation; it never triggers another publication or retag.
221
+
72
222
  Any packaged-file edit, including this guide, changes the release candidate.
73
223
  Preserve previously accepted archives as evidence and independently qualify a
74
224
  new exact source/archive before dispatching; never substitute it silently.