@davidahmann/mill 0.1.5 → 0.2.1

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 (249) hide show
  1. package/README.md +141 -32
  2. package/dist/audit/repository.d.ts.map +1 -1
  3. package/dist/audit/repository.js +2 -0
  4. package/dist/audit/repository.js.map +1 -1
  5. package/dist/cli-program.d.ts.map +1 -1
  6. package/dist/cli-program.js +189 -0
  7. package/dist/cli-program.js.map +1 -1
  8. package/dist/contracts/schemas.d.ts +467 -2
  9. package/dist/contracts/schemas.d.ts.map +1 -1
  10. package/dist/contracts/schemas.js +211 -1
  11. package/dist/contracts/schemas.js.map +1 -1
  12. package/dist/index.d.ts +7 -1
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +7 -1
  15. package/dist/index.js.map +1 -1
  16. package/dist/planning/closure.d.ts +24 -0
  17. package/dist/planning/closure.d.ts.map +1 -0
  18. package/dist/planning/closure.js +68 -0
  19. package/dist/planning/closure.js.map +1 -0
  20. package/dist/planning/outcomes.d.ts +6 -0
  21. package/dist/planning/outcomes.d.ts.map +1 -0
  22. package/dist/planning/outcomes.js +36 -0
  23. package/dist/planning/outcomes.js.map +1 -0
  24. package/dist/planning/tasks.d.ts +32 -0
  25. package/dist/planning/tasks.d.ts.map +1 -0
  26. package/dist/planning/tasks.js +305 -0
  27. package/dist/planning/tasks.js.map +1 -0
  28. package/dist/repository/intelligence.d.ts +78 -0
  29. package/dist/repository/intelligence.d.ts.map +1 -0
  30. package/dist/repository/intelligence.js +537 -0
  31. package/dist/repository/intelligence.js.map +1 -0
  32. package/dist/repository/native-adoption.d.ts +36 -0
  33. package/dist/repository/native-adoption.d.ts.map +1 -0
  34. package/dist/repository/native-adoption.js +146 -0
  35. package/dist/repository/native-adoption.js.map +1 -0
  36. package/dist/repository/scan.d.ts.map +1 -1
  37. package/dist/repository/scan.js +4 -0
  38. package/dist/repository/scan.js.map +1 -1
  39. package/dist/runtime/authority-plans.d.ts +43 -0
  40. package/dist/runtime/authority-plans.d.ts.map +1 -0
  41. package/dist/runtime/authority-plans.js +173 -0
  42. package/dist/runtime/authority-plans.js.map +1 -0
  43. package/dist/runtime/codex.d.ts.map +1 -1
  44. package/dist/runtime/codex.js +24 -5
  45. package/dist/runtime/codex.js.map +1 -1
  46. package/dist/runtime/context.d.ts.map +1 -1
  47. package/dist/runtime/context.js +36 -0
  48. package/dist/runtime/context.js.map +1 -1
  49. package/dist/runtime/delivery.d.ts +8 -1
  50. package/dist/runtime/delivery.d.ts.map +1 -1
  51. package/dist/runtime/delivery.js +187 -74
  52. package/dist/runtime/delivery.js.map +1 -1
  53. package/dist/runtime/effect-boundary.d.ts +38 -0
  54. package/dist/runtime/effect-boundary.d.ts.map +1 -0
  55. package/dist/runtime/effect-boundary.js +59 -0
  56. package/dist/runtime/effect-boundary.js.map +1 -0
  57. package/dist/runtime/github.d.ts +24 -0
  58. package/dist/runtime/github.d.ts.map +1 -1
  59. package/dist/runtime/github.js +117 -2
  60. package/dist/runtime/github.js.map +1 -1
  61. package/dist/runtime/inputs.js.map +1 -1
  62. package/dist/runtime/lifecycle.d.ts +5 -0
  63. package/dist/runtime/lifecycle.d.ts.map +1 -1
  64. package/dist/runtime/lifecycle.js +60 -16
  65. package/dist/runtime/lifecycle.js.map +1 -1
  66. package/dist/runtime/merge.d.ts +73 -0
  67. package/dist/runtime/merge.d.ts.map +1 -0
  68. package/dist/runtime/merge.js +299 -0
  69. package/dist/runtime/merge.js.map +1 -0
  70. package/dist/runtime/public-metadata.d.ts +3 -0
  71. package/dist/runtime/public-metadata.d.ts.map +1 -0
  72. package/dist/runtime/public-metadata.js +15 -0
  73. package/dist/runtime/public-metadata.js.map +1 -0
  74. package/dist/runtime/repair.d.ts +12 -0
  75. package/dist/runtime/repair.d.ts.map +1 -0
  76. package/dist/runtime/repair.js +34 -0
  77. package/dist/runtime/repair.js.map +1 -0
  78. package/dist/runtime/repository.d.ts +18 -0
  79. package/dist/runtime/repository.d.ts.map +1 -1
  80. package/dist/runtime/repository.js +114 -2
  81. package/dist/runtime/repository.js.map +1 -1
  82. package/dist/runtime/state.d.ts +42 -1
  83. package/dist/runtime/state.d.ts.map +1 -1
  84. package/dist/runtime/state.js +324 -11
  85. package/dist/runtime/state.js.map +1 -1
  86. package/dist/runtime/usage.d.ts +12 -0
  87. package/dist/runtime/usage.d.ts.map +1 -0
  88. package/dist/runtime/usage.js +45 -0
  89. package/dist/runtime/usage.js.map +1 -0
  90. package/dist/runtime/verifier.d.ts.map +1 -1
  91. package/dist/runtime/verifier.js +12 -0
  92. package/dist/runtime/verifier.js.map +1 -1
  93. package/dist/runtime/worker.d.ts +1 -0
  94. package/dist/runtime/worker.d.ts.map +1 -1
  95. package/dist/runtime/worker.js.map +1 -1
  96. package/dist/version.d.ts +1 -1
  97. package/dist/version.js +1 -1
  98. package/dist/workflows/founder.d.ts.map +1 -1
  99. package/dist/workflows/founder.js +5 -0
  100. package/dist/workflows/founder.js.map +1 -1
  101. package/node_modules/typescript/LICENSE.txt +55 -0
  102. package/node_modules/typescript/README.md +50 -0
  103. package/node_modules/typescript/SECURITY.md +39 -0
  104. package/node_modules/typescript/ThirdPartyNoticeText.txt +193 -0
  105. package/node_modules/typescript/bin/tsc +2 -0
  106. package/node_modules/typescript/bin/tsserver +2 -0
  107. package/node_modules/typescript/lib/_tsc.js +134465 -0
  108. package/node_modules/typescript/lib/_tsserver.js +659 -0
  109. package/node_modules/typescript/lib/_typingsInstaller.js +222 -0
  110. package/node_modules/typescript/lib/cs/diagnosticMessages.generated.json +2129 -0
  111. package/node_modules/typescript/lib/de/diagnosticMessages.generated.json +2125 -0
  112. package/node_modules/typescript/lib/es/diagnosticMessages.generated.json +2129 -0
  113. package/node_modules/typescript/lib/fr/diagnosticMessages.generated.json +2129 -0
  114. package/node_modules/typescript/lib/it/diagnosticMessages.generated.json +2125 -0
  115. package/node_modules/typescript/lib/ja/diagnosticMessages.generated.json +2129 -0
  116. package/node_modules/typescript/lib/ko/diagnosticMessages.generated.json +2129 -0
  117. package/node_modules/typescript/lib/lib.d.ts +20 -0
  118. package/node_modules/typescript/lib/lib.decorators.d.ts +382 -0
  119. package/node_modules/typescript/lib/lib.decorators.legacy.d.ts +20 -0
  120. package/node_modules/typescript/lib/lib.dom.asynciterable.d.ts +18 -0
  121. package/node_modules/typescript/lib/lib.dom.d.ts +45125 -0
  122. package/node_modules/typescript/lib/lib.dom.iterable.d.ts +18 -0
  123. package/node_modules/typescript/lib/lib.es2015.collection.d.ts +150 -0
  124. package/node_modules/typescript/lib/lib.es2015.core.d.ts +595 -0
  125. package/node_modules/typescript/lib/lib.es2015.d.ts +26 -0
  126. package/node_modules/typescript/lib/lib.es2015.generator.d.ts +75 -0
  127. package/node_modules/typescript/lib/lib.es2015.iterable.d.ts +603 -0
  128. package/node_modules/typescript/lib/lib.es2015.promise.d.ts +79 -0
  129. package/node_modules/typescript/lib/lib.es2015.proxy.d.ts +126 -0
  130. package/node_modules/typescript/lib/lib.es2015.reflect.d.ts +142 -0
  131. package/node_modules/typescript/lib/lib.es2015.symbol.d.ts +44 -0
  132. package/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts +324 -0
  133. package/node_modules/typescript/lib/lib.es2016.array.include.d.ts +114 -0
  134. package/node_modules/typescript/lib/lib.es2016.d.ts +19 -0
  135. package/node_modules/typescript/lib/lib.es2016.full.d.ts +21 -0
  136. package/node_modules/typescript/lib/lib.es2016.intl.d.ts +29 -0
  137. package/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts +19 -0
  138. package/node_modules/typescript/lib/lib.es2017.d.ts +24 -0
  139. package/node_modules/typescript/lib/lib.es2017.date.d.ts +29 -0
  140. package/node_modules/typescript/lib/lib.es2017.full.d.ts +21 -0
  141. package/node_modules/typescript/lib/lib.es2017.intl.d.ts +42 -0
  142. package/node_modules/typescript/lib/lib.es2017.object.d.ts +47 -0
  143. package/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts +133 -0
  144. package/node_modules/typescript/lib/lib.es2017.string.d.ts +43 -0
  145. package/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts +51 -0
  146. package/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts +75 -0
  147. package/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts +51 -0
  148. package/node_modules/typescript/lib/lib.es2018.d.ts +22 -0
  149. package/node_modules/typescript/lib/lib.es2018.full.d.ts +22 -0
  150. package/node_modules/typescript/lib/lib.es2018.intl.d.ts +81 -0
  151. package/node_modules/typescript/lib/lib.es2018.promise.d.ts +28 -0
  152. package/node_modules/typescript/lib/lib.es2018.regexp.d.ts +35 -0
  153. package/node_modules/typescript/lib/lib.es2019.array.d.ts +77 -0
  154. package/node_modules/typescript/lib/lib.es2019.d.ts +22 -0
  155. package/node_modules/typescript/lib/lib.es2019.full.d.ts +22 -0
  156. package/node_modules/typescript/lib/lib.es2019.intl.d.ts +21 -0
  157. package/node_modules/typescript/lib/lib.es2019.object.d.ts +31 -0
  158. package/node_modules/typescript/lib/lib.es2019.string.d.ts +35 -0
  159. package/node_modules/typescript/lib/lib.es2019.symbol.d.ts +22 -0
  160. package/node_modules/typescript/lib/lib.es2020.bigint.d.ts +763 -0
  161. package/node_modules/typescript/lib/lib.es2020.d.ts +25 -0
  162. package/node_modules/typescript/lib/lib.es2020.date.d.ts +40 -0
  163. package/node_modules/typescript/lib/lib.es2020.full.d.ts +22 -0
  164. package/node_modules/typescript/lib/lib.es2020.intl.d.ts +472 -0
  165. package/node_modules/typescript/lib/lib.es2020.number.d.ts +26 -0
  166. package/node_modules/typescript/lib/lib.es2020.promise.d.ts +45 -0
  167. package/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts +97 -0
  168. package/node_modules/typescript/lib/lib.es2020.string.d.ts +42 -0
  169. package/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts +39 -0
  170. package/node_modules/typescript/lib/lib.es2021.d.ts +21 -0
  171. package/node_modules/typescript/lib/lib.es2021.full.d.ts +22 -0
  172. package/node_modules/typescript/lib/lib.es2021.intl.d.ts +164 -0
  173. package/node_modules/typescript/lib/lib.es2021.promise.d.ts +46 -0
  174. package/node_modules/typescript/lib/lib.es2021.string.d.ts +31 -0
  175. package/node_modules/typescript/lib/lib.es2021.weakref.d.ts +76 -0
  176. package/node_modules/typescript/lib/lib.es2022.array.d.ts +119 -0
  177. package/node_modules/typescript/lib/lib.es2022.d.ts +23 -0
  178. package/node_modules/typescript/lib/lib.es2022.error.d.ts +73 -0
  179. package/node_modules/typescript/lib/lib.es2022.full.d.ts +22 -0
  180. package/node_modules/typescript/lib/lib.es2022.intl.d.ts +143 -0
  181. package/node_modules/typescript/lib/lib.es2022.object.d.ts +24 -0
  182. package/node_modules/typescript/lib/lib.es2022.regexp.d.ts +37 -0
  183. package/node_modules/typescript/lib/lib.es2022.string.d.ts +23 -0
  184. package/node_modules/typescript/lib/lib.es2023.array.d.ts +922 -0
  185. package/node_modules/typescript/lib/lib.es2023.collection.d.ts +19 -0
  186. package/node_modules/typescript/lib/lib.es2023.d.ts +20 -0
  187. package/node_modules/typescript/lib/lib.es2023.full.d.ts +22 -0
  188. package/node_modules/typescript/lib/lib.es2023.intl.d.ts +62 -0
  189. package/node_modules/typescript/lib/lib.es2024.arraybuffer.d.ts +63 -0
  190. package/node_modules/typescript/lib/lib.es2024.collection.d.ts +27 -0
  191. package/node_modules/typescript/lib/lib.es2024.d.ts +24 -0
  192. package/node_modules/typescript/lib/lib.es2024.full.d.ts +22 -0
  193. package/node_modules/typescript/lib/lib.es2024.object.d.ts +27 -0
  194. package/node_modules/typescript/lib/lib.es2024.promise.d.ts +33 -0
  195. package/node_modules/typescript/lib/lib.es2024.regexp.d.ts +23 -0
  196. package/node_modules/typescript/lib/lib.es2024.sharedmemory.d.ts +66 -0
  197. package/node_modules/typescript/lib/lib.es2024.string.d.ts +27 -0
  198. package/node_modules/typescript/lib/lib.es2025.collection.d.ts +94 -0
  199. package/node_modules/typescript/lib/lib.es2025.d.ts +23 -0
  200. package/node_modules/typescript/lib/lib.es2025.float16.d.ts +443 -0
  201. package/node_modules/typescript/lib/lib.es2025.full.d.ts +22 -0
  202. package/node_modules/typescript/lib/lib.es2025.intl.d.ts +200 -0
  203. package/node_modules/typescript/lib/lib.es2025.iterator.d.ts +146 -0
  204. package/node_modules/typescript/lib/lib.es2025.promise.d.ts +32 -0
  205. package/node_modules/typescript/lib/lib.es2025.regexp.d.ts +30 -0
  206. package/node_modules/typescript/lib/lib.es5.d.ts +4599 -0
  207. package/node_modules/typescript/lib/lib.es6.d.ts +21 -0
  208. package/node_modules/typescript/lib/lib.esnext.array.d.ts +33 -0
  209. package/node_modules/typescript/lib/lib.esnext.collection.d.ts +47 -0
  210. package/node_modules/typescript/lib/lib.esnext.d.ts +27 -0
  211. package/node_modules/typescript/lib/lib.esnext.date.d.ts +21 -0
  212. package/node_modules/typescript/lib/lib.esnext.decorators.d.ts +26 -0
  213. package/node_modules/typescript/lib/lib.esnext.disposable.d.ts +191 -0
  214. package/node_modules/typescript/lib/lib.esnext.error.d.ts +22 -0
  215. package/node_modules/typescript/lib/lib.esnext.full.d.ts +22 -0
  216. package/node_modules/typescript/lib/lib.esnext.intl.d.ts +107 -0
  217. package/node_modules/typescript/lib/lib.esnext.sharedmemory.d.ts +23 -0
  218. package/node_modules/typescript/lib/lib.esnext.temporal.d.ts +485 -0
  219. package/node_modules/typescript/lib/lib.esnext.typedarrays.d.ts +90 -0
  220. package/node_modules/typescript/lib/lib.scripthost.d.ts +320 -0
  221. package/node_modules/typescript/lib/lib.webworker.asynciterable.d.ts +18 -0
  222. package/node_modules/typescript/lib/lib.webworker.d.ts +15606 -0
  223. package/node_modules/typescript/lib/lib.webworker.importscripts.d.ts +21 -0
  224. package/node_modules/typescript/lib/lib.webworker.iterable.d.ts +18 -0
  225. package/node_modules/typescript/lib/pl/diagnosticMessages.generated.json +2129 -0
  226. package/node_modules/typescript/lib/pt-br/diagnosticMessages.generated.json +2129 -0
  227. package/node_modules/typescript/lib/ru/diagnosticMessages.generated.json +2125 -0
  228. package/node_modules/typescript/lib/tr/diagnosticMessages.generated.json +2129 -0
  229. package/node_modules/typescript/lib/tsc.js +8 -0
  230. package/node_modules/typescript/lib/tsserver.js +8 -0
  231. package/node_modules/typescript/lib/tsserverlibrary.d.ts +17 -0
  232. package/node_modules/typescript/lib/tsserverlibrary.js +21 -0
  233. package/node_modules/typescript/lib/typesMap.json +497 -0
  234. package/node_modules/typescript/lib/typescript.d.ts +11448 -0
  235. package/node_modules/typescript/lib/typescript.js +201039 -0
  236. package/node_modules/typescript/lib/typingsInstaller.js +8 -0
  237. package/node_modules/typescript/lib/watchGuard.js +53 -0
  238. package/node_modules/typescript/lib/zh-cn/diagnosticMessages.generated.json +2129 -0
  239. package/node_modules/typescript/lib/zh-tw/diagnosticMessages.generated.json +2125 -0
  240. package/node_modules/typescript/package.json +118 -0
  241. package/package.json +7 -4
  242. package/schemas/audit-report.schema.json +1 -0
  243. package/schemas/change-request.schema.json +189 -0
  244. package/schemas/context-manifest.schema.json +50 -0
  245. package/schemas/delivery-record.schema.json +109 -0
  246. package/schemas/mill-config.schema.json +50 -2
  247. package/schemas/repository-intelligence.schema.json +200 -0
  248. package/schemas/review-result.schema.json +21 -0
  249. package/schemas/task-packet.schema.json +12 -0
@@ -0,0 +1,73 @@
1
+ import { type GitHubAdapter } from "./github.js";
2
+ interface MergeInput {
3
+ root: string;
4
+ taskPath: string;
5
+ runId: string;
6
+ adapter?: GitHubAdapter;
7
+ }
8
+ export declare function planMerge(input: MergeInput & {
9
+ method: "merge" | "squash";
10
+ }): Promise<{
11
+ plan: {
12
+ schemaVersion: "1";
13
+ repositoryNodeId: string;
14
+ pullRequestNumber: number;
15
+ pullRequestNodeId: string;
16
+ headCommit: string;
17
+ baseCommit: string;
18
+ candidateTree: string;
19
+ actorLogin: string;
20
+ actorId: number;
21
+ policyDigest: string;
22
+ method: "merge" | "squash";
23
+ markReady: boolean;
24
+ expiresAt: string;
25
+ };
26
+ digest: string;
27
+ state: "planned";
28
+ }>;
29
+ export declare function applyMerge(input: MergeInput & {
30
+ approvalDigest: string;
31
+ attended: boolean;
32
+ }): Promise<{
33
+ plan: {
34
+ schemaVersion: "1";
35
+ repositoryNodeId: string;
36
+ pullRequestNumber: number;
37
+ pullRequestNodeId: string;
38
+ headCommit: string;
39
+ baseCommit: string;
40
+ candidateTree: string;
41
+ actorLogin: string;
42
+ actorId: number;
43
+ policyDigest: string;
44
+ method: "merge" | "squash";
45
+ markReady: boolean;
46
+ expiresAt: string;
47
+ };
48
+ digest: string;
49
+ state: "effect_unknown" | "planned" | "merged" | "ready_started" | "ready_verified" | "merge_started";
50
+ approvalSource?: "attended_operator" | undefined;
51
+ }>;
52
+ export declare function reconcileMerge(input: MergeInput): Promise<{
53
+ plan: {
54
+ schemaVersion: "1";
55
+ repositoryNodeId: string;
56
+ pullRequestNumber: number;
57
+ pullRequestNodeId: string;
58
+ headCommit: string;
59
+ baseCommit: string;
60
+ candidateTree: string;
61
+ actorLogin: string;
62
+ actorId: number;
63
+ policyDigest: string;
64
+ method: "merge" | "squash";
65
+ markReady: boolean;
66
+ expiresAt: string;
67
+ };
68
+ digest: string;
69
+ state: "effect_unknown" | "planned" | "merged" | "ready_started" | "ready_verified" | "merge_started";
70
+ approvalSource?: "attended_operator" | undefined;
71
+ }>;
72
+ export {};
73
+ //# sourceMappingURL=merge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"merge.d.ts","sourceRoot":"","sources":["../../src/runtime/merge.ts"],"names":[],"mappings":"AAgBA,OAAO,EAEL,KAAK,aAAa,EAGnB,MAAM,aAAa,CAAC;AAYrB,UAAU,UAAU;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,aAAa,CAAC;CACzB;AA4PD,wBAAsB,SAAS,CAC7B,KAAK,EAAE,UAAU,GAAG;IAAE,MAAM,EAAE,OAAO,GAAG,QAAQ,CAAA;CAAE;;;;;;;;;;;;;;;;;;GAqDnD;AAaD,wBAAsB,UAAU,CAC9B,KAAK,EAAE,UAAU,GAAG;IAAE,cAAc,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAA;CAAE;;;;;;;;;;;;;;;;;;;GAmJlE;AAED,wBAAsB,cAAc,CAAC,KAAK,EAAE,UAAU;;;;;;;;;;;;;;;;;;;GAoCrD"}
@@ -0,0 +1,299 @@
1
+ import { canonicalDigest } from "../contracts/canonical.js";
2
+ import { assessImpactManifest } from "../planning/impact.js";
3
+ import { deliveryRecordSchema, mergeApprovalPlanSchema, reviewResultSchema, validationEvidenceSchema, } from "../contracts/schemas.js";
4
+ import { ExitCode, MillError } from "../errors.js";
5
+ import { actionableFeedback, checkDecision, reviewsPassed, } from "./delivery.js";
6
+ import { createGitHubAdapter, } from "./github.js";
7
+ import { loadRuntimeInputs } from "./inputs.js";
8
+ import { assertRunBindings } from "./lifecycle.js";
9
+ import { captureReviewScope, commonGitDirectory, repositoryRemoteUrl, } from "./repository.js";
10
+ import { acquireWriterLease, StateStore } from "./state.js";
11
+ function authorityDeadline(inputs) {
12
+ return Math.min(Infinity, ...(inputs.continuity?.impact.exceptions ?? []).map((item) => Date.parse(item.expiresAt)), ...(inputs.task.schemaVersion === "2" ? inputs.task.attestations : []).map((item) => Date.parse(item.expiresAt)));
13
+ }
14
+ function assertCurrentAuthority(inputs) {
15
+ const continuity = inputs.continuity;
16
+ if (Date.now() >= authorityDeadline(inputs) ||
17
+ (continuity !== undefined &&
18
+ !assessImpactManifest({
19
+ manifest: continuity.impact,
20
+ product: continuity.product,
21
+ scenarios: continuity.scenarios,
22
+ authorityMode: "authorize",
23
+ }).approved))
24
+ throw new MillError("MERGE_AUTHORITY_EXPIRED", "Current task and impact authority must remain valid before each merge effect.", ExitCode.configuration);
25
+ }
26
+ async function withMergeContext(input, readback, action) {
27
+ const inputs = await loadRuntimeInputs(input.root, input.taskPath, readback ? "readback" : "authorize");
28
+ const store = await StateStore.open(inputs.config.repositoryId, await commonGitDirectory(input.root));
29
+ let lease;
30
+ try {
31
+ lease = await acquireWriterLease(store);
32
+ const run = store.getRun(input.runId);
33
+ if (run.deliveryJson === undefined)
34
+ throw new MillError("DELIVERY_PLAN_MISSING", "Merge requires an existing reviewed delivery.", ExitCode.configuration);
35
+ const delivery = deliveryRecordSchema.parse(JSON.parse(run.deliveryJson));
36
+ const config = inputs.config.propose;
37
+ if (config !== undefined &&
38
+ (config.owner !== delivery.target.owner ||
39
+ config.repository !== delivery.target.repository ||
40
+ config.repositoryNodeId !== delivery.target.repositoryNodeId ||
41
+ config.remoteName !== delivery.target.remoteName ||
42
+ config.baseBranch !== delivery.target.baseBranch ||
43
+ run.taskDigest !== inputs.taskDigest))
44
+ throw new MillError("MERGE_IDENTITY_MISMATCH", "Readback must use the original delivery repository and task identity.", ExitCode.configuration);
45
+ if (inputs.config.trustCeiling !== "propose" ||
46
+ config === undefined ||
47
+ (!readback && config.attendedMerge !== true))
48
+ throw new MillError("ATTENDED_MERGE_DISABLED", "The repository has not explicitly enabled attended merge.", ExitCode.configuration);
49
+ if (!readback &&
50
+ (run.status !== "awaiting_human" ||
51
+ run.cancelRequested ||
52
+ run.configDigest !== inputs.configDigest ||
53
+ run.taskDigest !== inputs.taskDigest))
54
+ throw new MillError("MERGE_NOT_READY", "Merge requires unchanged approved policy and an uncancelled human-ready run.", ExitCode.configuration);
55
+ return await action({
56
+ store,
57
+ delivery,
58
+ inputs,
59
+ config,
60
+ adapter: input.adapter ?? createGitHubAdapter(input.root),
61
+ save(value) {
62
+ delivery.mergeApproval = value;
63
+ delivery.updatedAt = new Date().toISOString();
64
+ store.setDelivery(run.id, JSON.stringify(deliveryRecordSchema.parse(delivery)), `merge.${value.state}`, { approvalDigest: value.digest });
65
+ },
66
+ });
67
+ }
68
+ finally {
69
+ try {
70
+ await lease?.release();
71
+ }
72
+ finally {
73
+ store.close();
74
+ }
75
+ }
76
+ }
77
+ async function preflight(input, context, limit) {
78
+ const { inputs, config, delivery, adapter, store } = context;
79
+ assertCurrentAuthority(inputs);
80
+ const deadlineMs = Math.min(Date.now() + config.pollTimeoutSeconds * 1000, limit ?? Infinity, authorityDeadline(inputs));
81
+ const binding = await adapter.inspect({ config, deadlineMs });
82
+ const remote = await repositoryRemoteUrl(input.root, config.remoteName);
83
+ if (binding.repositoryNodeId !== delivery.target.repositoryNodeId ||
84
+ binding.actorLogin !== delivery.target.actorLogin ||
85
+ binding.actorId !== delivery.target.actorId ||
86
+ binding.fullName !== `${config.owner}/${config.repository}` ||
87
+ binding.fork ||
88
+ binding.defaultBranch !== config.baseBranch ||
89
+ !config.allowedActors.includes(binding.actorLogin) ||
90
+ !config.allowedMergerLogins.includes(binding.actorLogin) ||
91
+ ![
92
+ binding.cloneUrl,
93
+ `git@${config.host}:${config.owner}/${config.repository}.git`,
94
+ `ssh://git@${config.host}/${config.owner}/${config.repository}.git`,
95
+ ].includes(remote))
96
+ throw new MillError("MERGE_IDENTITY_MISMATCH", "Repository, operator or merge authority no longer matches the delivery.", ExitCode.configuration);
97
+ if (config.requiredChecks.length === 0 ||
98
+ config.requiredChecks.some((name) => config.checkProducers?.[name] === undefined) ||
99
+ (await adapter.strictChecks?.({ config, deadlineMs })) !== true)
100
+ throw new MillError("MERGE_PROTECTION_REQUIRED", "Attended merge requires producer-bound checks and strict up-to-date branch protection. Mill never bypasses protection.", ExitCode.configuration);
101
+ const run = store.getRun(input.runId);
102
+ const candidate = await assertRunBindings(input.root, run, inputs);
103
+ const validation = validationEvidenceSchema.parse(JSON.parse(run.validationJson ?? "null"));
104
+ const review = reviewResultSchema.parse(JSON.parse(run.reviewJson ?? "null"));
105
+ if (!validation.passed ||
106
+ validation.candidateCommit !== candidate.commit ||
107
+ review.candidateCommit !== candidate.commit ||
108
+ review.findings.length !== 0 ||
109
+ candidate.commit !== delivery.candidateCommit ||
110
+ candidate.tree !== delivery.candidateTree)
111
+ throw new MillError("MERGE_EVIDENCE_STALE", "Merge requires exact validation and complete-diff review of the delivered candidate.", ExitCode.configuration);
112
+ if (delivery.pullRequest === null)
113
+ throw new MillError("PULL_REQUEST_MISSING", "No pull request is bound to the delivery.", ExitCode.configuration);
114
+ const observation = await adapter.observe({
115
+ config,
116
+ pullRequestNumber: delivery.pullRequest.number,
117
+ deadlineMs,
118
+ });
119
+ const pull = observation.pullRequest;
120
+ const scope = await captureReviewScope(candidate.worktree, observation.defaultBranchHead, candidate.commit);
121
+ if (review.scope?.digest !== scope.digest)
122
+ throw new MillError("MERGE_EVIDENCE_STALE", "The reviewed diff differs from GitHub's authoritative merge base.", ExitCode.configuration);
123
+ if (pull.nodeId !== delivery.pullRequest.nodeId ||
124
+ pull.number !== delivery.pullRequest.number ||
125
+ pull.headSha !== candidate.commit ||
126
+ observation.branchSha !== candidate.commit ||
127
+ pull.headRef !== delivery.branchName ||
128
+ pull.baseRef !== config.baseBranch ||
129
+ pull.state !== "open" ||
130
+ pull.merged)
131
+ throw new MillError("MERGE_IDENTITY_MISMATCH", "The open PR identity or head changed.", ExitCode.configuration);
132
+ if (checkDecision(config.requiredChecks, observation.checks, config.checkProducers, "pull_request", candidate.commit).status !== "passed" ||
133
+ !reviewsPassed(observation, config.reviewPolicy, candidate.commit) ||
134
+ actionableFeedback(observation, config.reviewPolicy, candidate.commit)
135
+ .length !== 0)
136
+ throw new MillError("MERGE_CHECKS_NOT_GREEN", "Current producer-bound checks and review must pass before any merge effect.", ExitCode.configuration);
137
+ return { config, binding, candidate, observation, deadlineMs };
138
+ }
139
+ export async function planMerge(input) {
140
+ return withMergeContext(input, false, async (context) => {
141
+ const prior = context.delivery.mergeApproval;
142
+ if (prior !== undefined &&
143
+ prior.state !== "planned" &&
144
+ prior.state !== "ready_verified")
145
+ throw new MillError("MERGE_RECONCILIATION_REQUIRED", "An attempted merge plan must be reconciled, not overwritten.", ExitCode.configuration);
146
+ const current = await preflight(input, context);
147
+ if (!current.config.allowedMergeMethods.includes(input.method === "squash" ? "linear_tree_preserving" : "merge"))
148
+ throw new MillError("MERGE_METHOD_FORBIDDEN", "The selected merge method is outside repository policy.", ExitCode.configuration);
149
+ const plan = mergeApprovalPlanSchema.parse({
150
+ schemaVersion: "1",
151
+ repositoryNodeId: current.binding.repositoryNodeId,
152
+ pullRequestNumber: current.observation.pullRequest.number,
153
+ pullRequestNodeId: current.observation.pullRequest.nodeId,
154
+ headCommit: current.candidate.commit,
155
+ baseCommit: current.observation.defaultBranchHead,
156
+ candidateTree: current.candidate.tree,
157
+ actorLogin: current.binding.actorLogin,
158
+ actorId: current.binding.actorId,
159
+ policyDigest: context.inputs.configDigest,
160
+ method: input.method,
161
+ markReady: current.observation.pullRequest.draft,
162
+ expiresAt: new Date(Math.min(Date.now() + current.config.approvalTtlSeconds * 1000, authorityDeadline(context.inputs))).toISOString(),
163
+ });
164
+ const approval = {
165
+ plan,
166
+ digest: canonicalDigest(plan),
167
+ state: "planned",
168
+ };
169
+ context.save(approval);
170
+ return approval;
171
+ });
172
+ }
173
+ function readbackMatches(observation, plan) {
174
+ return (observation.pullRequest.nodeId === plan.pullRequestNodeId &&
175
+ observation.pullRequest.number === plan.pullRequestNumber &&
176
+ observation.pullRequest.headSha === plan.headCommit);
177
+ }
178
+ export async function applyMerge(input) {
179
+ if (!input.attended)
180
+ throw new MillError("ATTENDANCE_REQUIRED", "Merge approval must be submitted at the trusted attended operator boundary.", ExitCode.configuration);
181
+ return withMergeContext(input, false, async (context) => {
182
+ let approval = context.delivery.mergeApproval;
183
+ if (approval?.state !== "planned" ||
184
+ approval.digest !== input.approvalDigest ||
185
+ canonicalDigest(approval.plan) !== input.approvalDigest ||
186
+ Date.parse(approval.plan.expiresAt) <= Date.now())
187
+ throw new MillError("MERGE_APPROVAL_INVALID", "Approval must match the unexpired, unattempted exact merge plan.", ExitCode.configuration);
188
+ const plan = approval.plan;
189
+ const effectDeadline = Math.min(Date.now() + context.config.pollTimeoutSeconds * 1000, Date.parse(plan.expiresAt), authorityDeadline(context.inputs));
190
+ const current = await preflight(input, context, effectDeadline);
191
+ if (!readbackMatches(current.observation, plan) ||
192
+ current.observation.defaultBranchHead !== plan.baseCommit ||
193
+ current.candidate.tree !== plan.candidateTree ||
194
+ current.binding.actorId !== plan.actorId ||
195
+ current.binding.actorLogin !== plan.actorLogin ||
196
+ context.inputs.configDigest !== plan.policyDigest ||
197
+ current.observation.pullRequest.draft !== plan.markReady)
198
+ throw new MillError("MERGE_PLAN_STALE", "The displayed merge plan changed; no effect was attempted.", ExitCode.configuration);
199
+ if (context.adapter.mergeExact === undefined ||
200
+ (plan.markReady && context.adapter.markReady === undefined))
201
+ throw new MillError("MERGE_ADAPTER_UNAVAILABLE", "The configured adapter does not implement attended merge.", ExitCode.unavailable);
202
+ const cancellationRequested = () => context.store.getRun(input.runId).cancelRequested;
203
+ const save = (state) => {
204
+ approval = {
205
+ plan,
206
+ digest: input.approvalDigest,
207
+ state,
208
+ approvalSource: "attended_operator",
209
+ };
210
+ context.save(approval);
211
+ };
212
+ const observe = () => context.adapter.observe({
213
+ config: current.config,
214
+ pullRequestNumber: plan.pullRequestNumber,
215
+ deadlineMs: current.deadlineMs,
216
+ });
217
+ try {
218
+ assertCurrentAuthority(context.inputs);
219
+ if (Date.now() >= effectDeadline)
220
+ throw new MillError("MERGE_APPROVAL_INVALID", "The merge approval expired during preflight.", ExitCode.configuration);
221
+ if (cancellationRequested())
222
+ throw new MillError("OPERATOR_CANCELLED", "Merge was cancelled before execution.", ExitCode.temporary);
223
+ if (plan.markReady) {
224
+ if (context.adapter.markReady === undefined)
225
+ throw new MillError("MERGE_ADAPTER_UNAVAILABLE", "The adapter cannot mark the PR ready.", ExitCode.unavailable);
226
+ save("ready_started");
227
+ await context.adapter.markReady({
228
+ config: current.config,
229
+ pullRequestNodeId: plan.pullRequestNodeId,
230
+ deadlineMs: current.deadlineMs,
231
+ cancellationRequested,
232
+ });
233
+ const ready = await observe();
234
+ if (!readbackMatches(ready, plan) || ready.pullRequest.draft)
235
+ throw new MillError("READY_READBACK_MISMATCH", "Readiness was not confirmed on the exact PR.", ExitCode.temporary);
236
+ save("ready_verified");
237
+ }
238
+ const fresh = await preflight(input, context, effectDeadline);
239
+ if (fresh.observation.defaultBranchHead !== plan.baseCommit ||
240
+ Date.now() >= effectDeadline ||
241
+ cancellationRequested())
242
+ throw new MillError("MERGE_PLAN_STALE", "Base changed or cancellation was requested before merge.", ExitCode.configuration);
243
+ assertCurrentAuthority(context.inputs);
244
+ save("merge_started");
245
+ await context.adapter.mergeExact({
246
+ config: current.config,
247
+ pullRequestNumber: plan.pullRequestNumber,
248
+ headSha: plan.headCommit,
249
+ method: plan.method,
250
+ deadlineMs: current.deadlineMs,
251
+ cancellationRequested,
252
+ });
253
+ const merged = await observe();
254
+ if (!readbackMatches(merged, plan) ||
255
+ !merged.pullRequest.merged ||
256
+ merged.pullRequest.mergedByLogin !== plan.actorLogin ||
257
+ !merged.mergeIsOnDefaultBranch ||
258
+ merged.mergeCommit?.tree !== plan.candidateTree)
259
+ throw new MillError("MERGE_READBACK_MISMATCH", "Merge requires provider-authoritative identity and exact-tree readback.", ExitCode.temporary);
260
+ save("merged");
261
+ }
262
+ catch (error) {
263
+ if (context.delivery.mergeApproval?.state === "merge_started")
264
+ save("effect_unknown");
265
+ throw error;
266
+ }
267
+ return approval;
268
+ });
269
+ }
270
+ export async function reconcileMerge(input) {
271
+ return withMergeContext(input, true, async (context) => {
272
+ const approval = context.delivery.mergeApproval;
273
+ if (approval === undefined)
274
+ throw new MillError("MERGE_PLAN_MISSING", "No merge plan has been recorded.", ExitCode.configuration);
275
+ const observed = await context.adapter.observe({
276
+ config: context.config,
277
+ pullRequestNumber: approval.plan.pullRequestNumber,
278
+ deadlineMs: Date.now() + context.config.pollTimeoutSeconds * 1000,
279
+ });
280
+ if (approval.state === "ready_started" &&
281
+ readbackMatches(observed, approval.plan) &&
282
+ !observed.pullRequest.merged &&
283
+ observed.pullRequest.state === "open" &&
284
+ !observed.pullRequest.draft) {
285
+ context.save({ ...approval, state: "ready_verified" });
286
+ return { ...approval, state: "ready_verified" };
287
+ }
288
+ if (readbackMatches(observed, approval.plan) &&
289
+ observed.pullRequest.merged &&
290
+ observed.pullRequest.mergedByLogin === approval.plan.actorLogin &&
291
+ observed.mergeIsOnDefaultBranch &&
292
+ observed.mergeCommit?.tree === approval.plan.candidateTree) {
293
+ context.save({ ...approval, state: "merged" });
294
+ return { ...approval, state: "merged" };
295
+ }
296
+ return approval;
297
+ });
298
+ }
299
+ //# sourceMappingURL=merge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"merge.js","sourceRoot":"","sources":["../../src/runtime/merge.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EACL,oBAAoB,EACpB,uBAAuB,EACvB,kBAAkB,EAClB,wBAAwB,GACzB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EACL,kBAAkB,EAClB,aAAa,EACb,aAAa,GAEd,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,mBAAmB,GAIpB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,iBAAiB,EAAsB,MAAM,aAAa,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAmB5D,SAAS,iBAAiB,CAAC,MAAqB;IAC9C,OAAO,IAAI,CAAC,GAAG,CACb,QAAQ,EACR,GAAG,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC,GAAG,C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}
@@ -0,0 +1,3 @@
1
+ /** Public summaries are not a transport for commit bodies or author identity. */
2
+ export declare function publicPullRequestTitle(message: string): string;
3
+ //# sourceMappingURL=public-metadata.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"public-metadata.d.ts","sourceRoot":"","sources":["../../src/runtime/public-metadata.ts"],"names":[],"mappings":"AAEA,iFAAiF;AACjF,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAsB9D"}
@@ -0,0 +1,15 @@
1
+ import { ExitCode, MillError } from "../errors.js";
2
+ /** Public summaries are not a transport for commit bodies or author identity. */
3
+ export function publicPullRequestTitle(message) {
4
+ const subject = (message.split(/\r?\n/u, 1)[0] ?? "").split(/\b(?:Signed-off-by|Co-authored-by|Reviewed-by):/iu, 1)[0] ?? "";
5
+ const title = subject
6
+ .replaceAll(/[A-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[A-Z0-9.-]+\.[A-Z]{2,}/giu, "[email redacted]")
7
+ .replaceAll(/\p{C}/gu, " ")
8
+ .trim()
9
+ .slice(0, 240);
10
+ if (title.length === 0) {
11
+ throw new MillError("PUBLIC_TITLE_EMPTY", "The commit must have a nonempty public subject without trailers.", ExitCode.configuration);
12
+ }
13
+ return title;
14
+ }
15
+ //# sourceMappingURL=public-metadata.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"public-metadata.js","sourceRoot":"","sources":["../../src/runtime/public-metadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEnD,iFAAiF;AACjF,MAAM,UAAU,sBAAsB,CAAC,OAAe;IACpD,MAAM,OAAO,GACX,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CACzC,mDAAmD,EACnD,CAAC,CACF,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IACb,MAAM,KAAK,GAAG,OAAO;SAClB,UAAU,CACT,yDAAyD,EACzD,kBAAkB,CACnB;SACA,UAAU,CAAC,SAAS,EAAE,GAAG,CAAC;SAC1B,IAAI,EAAE;SACN,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IACjB,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,MAAM,IAAI,SAAS,CACjB,oBAAoB,EACpB,kEAAkE,EAClE,QAAQ,CAAC,aAAa,CACvB,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { RunRecord } from "./state.js";
2
+ /** Only a completed native failure is actionable; missing infrastructure is not. */
3
+ export declare function validationRepairFindings(run: RunRecord): {
4
+ id: string;
5
+ severity: "P1";
6
+ class: "correctness";
7
+ title: string;
8
+ body: string;
9
+ file: null;
10
+ line: null;
11
+ }[] | undefined;
12
+ //# sourceMappingURL=repair.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repair.d.ts","sourceRoot":"","sources":["../../src/runtime/repair.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,oFAAoF;AACpF,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,SAAS;;;;;;;;gBAyCtD"}
@@ -0,0 +1,34 @@
1
+ import { validationEvidenceSchema } from "../contracts/schemas.js";
2
+ import { ExitCode, MillError } from "../errors.js";
3
+ /** Only a completed native failure is actionable; missing infrastructure is not. */
4
+ export function validationRepairFindings(run) {
5
+ if (run.blockCode !== "VALIDATION_FAILED" || run.validationJson === undefined)
6
+ return undefined;
7
+ let raw;
8
+ try {
9
+ raw = JSON.parse(run.validationJson);
10
+ }
11
+ catch {
12
+ raw = null;
13
+ }
14
+ const parsed = validationEvidenceSchema.safeParse(raw);
15
+ if (!parsed.success ||
16
+ parsed.data.candidateCommit !== run.candidateCommit ||
17
+ parsed.data.passed) {
18
+ throw new MillError("VALIDATION_EVIDENCE_INVALID", "Repair requires failed native evidence bound to this exact candidate.", ExitCode.configuration);
19
+ }
20
+ const failed = parsed.data.commands.filter((command) => command.required && command.status !== "passed");
21
+ if (failed.length === 0 ||
22
+ failed.some((command) => command.status !== "failed" || command.reason !== "NONZERO_EXIT"))
23
+ return undefined;
24
+ return failed.map((command) => ({
25
+ id: `validation-${command.commandId}`,
26
+ severity: "P1",
27
+ class: "correctness",
28
+ title: `Native command failed: ${command.commandId}`,
29
+ body: `Repair the candidate within its original allowed paths. Do not change tests, command controls, or authority. Command ${command.commandId} exited ${command.exitCode}; preserved output digest ${command.outputDigest}. Rerun the declared command to diagnose.`,
30
+ file: null,
31
+ line: null,
32
+ }));
33
+ }
34
+ //# sourceMappingURL=repair.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repair.js","sourceRoot":"","sources":["../../src/runtime/repair.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGnD,oFAAoF;AACpF,MAAM,UAAU,wBAAwB,CAAC,GAAc;IACrD,IAAI,GAAG,CAAC,SAAS,KAAK,mBAAmB,IAAI,GAAG,CAAC,cAAc,KAAK,SAAS;QAC3E,OAAO,SAAS,CAAC;IACnB,IAAI,GAAY,CAAC;IACjB,IAAI,CAAC;QACH,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IACvC,CAAC;IAAC,MAAM,CAAC;QACP,GAAG,GAAG,IAAI,CAAC;IACb,CAAC;IACD,MAAM,MAAM,GAAG,wBAAwB,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IACvD,IACE,CAAC,MAAM,CAAC,OAAO;QACf,MAAM,CAAC,IAAI,CAAC,eAAe,KAAK,GAAG,CAAC,eAAe;QACnD,MAAM,CAAC,IAAI,CAAC,MAAM,EAClB,CAAC;QACD,MAAM,IAAI,SAAS,CACjB,6BAA6B,EAC7B,uEAAuE,EACvE,QAAQ,CAAC,aAAa,CACvB,CAAC;IACJ,CAAC;IACD,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CACxC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,MAAM,KAAK,QAAQ,CAC7D,CAAC;IACF,IACE,MAAM,CAAC,MAAM,KAAK,CAAC;QACnB,MAAM,CAAC,IAAI,CACT,CAAC,OAAO,EAAE,EAAE,CACV,OAAO,CAAC,MAAM,KAAK,QAAQ,IAAI,OAAO,CAAC,MAAM,KAAK,cAAc,CACnE;QAED,OAAO,SAAS,CAAC;IACnB,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QAC9B,EAAE,EAAE,cAAc,OAAO,CAAC,SAAS,EAAE;QACrC,QAAQ,EAAE,IAAa;QACvB,KAAK,EAAE,aAAsB;QAC7B,KAAK,EAAE,0BAA0B,OAAO,CAAC,SAAS,EAAE;QACpD,IAAI,EAAE,wHAAwH,OAAO,CAAC,SAAS,WAAW,OAAO,CAAC,QAAQ,6BAA6B,OAAO,CAAC,YAAY,2CAA2C;QACtQ,IAAI,EAAE,IAAI;QACV,IAAI,EAAE,IAAI;KACX,CAAC,CAAC,CAAC;AACN,CAAC"}
@@ -16,6 +16,21 @@ export declare function assertGitControlState(worktree: string, expected: GitCon
16
16
  export declare function commonGitDirectory(root: string): Promise<string>;
17
17
  export declare function resolveCommit(root: string, reference: string): Promise<string>;
18
18
  export declare function readCandidateIdentity(root: string, reference?: string): Promise<CandidateIdentity>;
19
+ /** Review the complete merge-base diff, including commits prepared before a task. */
20
+ export declare function captureReviewScope(root: string, baseRef: string, candidateCommit: string): Promise<{
21
+ digest: string;
22
+ baseCommit: string;
23
+ candidateCommit: string;
24
+ candidateTree: string;
25
+ changedPaths: string[];
26
+ }>;
27
+ /**
28
+ * Reads one bounded, regular-file blob from an exact committed tree. Callers
29
+ * must still interpret the returned bytes through their own schema; this
30
+ * helper only keeps the Git read free of worktree, filter, and replacement
31
+ * ambiguity.
32
+ */
33
+ export declare function readCommittedFile(root: string, commit: string, file: string, maxOutputBytes?: number): Promise<string>;
19
34
  export declare function assertRepositoryWorktreeClean(root: string): Promise<void>;
20
35
  export declare function repositoryRemoteUrl(root: string, remoteName: string): Promise<string>;
21
36
  export declare function qualifyRepositoryForBuild(root: string, baseRef: string, sensitivePatterns?: readonly string[]): Promise<{
@@ -26,6 +41,9 @@ export declare function createCandidateWorktree(root: string, destination: strin
26
41
  export declare function deleteCandidateBranch(root: string, branch: string, expectedCommit: string): Promise<void>;
27
42
  export declare function createDetachedWorktree(root: string, destination: string, baseCommit: string): Promise<void>;
28
43
  export declare function removeCandidateWorktree(root: string, destination: string): Promise<void>;
44
+ /** Only for a journal-bound authority purge whose original clean commit is retained. */
45
+ export declare function verifyPartiallyRemovedWorktree(root: string, destination: string, commit: string, commonDirectory: string): Promise<void>;
46
+ export declare function removeVerifiedAuthorityWorktree(root: string, destination: string): Promise<void>;
29
47
  export declare function resetCandidateWorktree(worktree: string, commit: string): Promise<void>;
30
48
  export declare function assertVisibleIndexState(worktree: string): Promise<void>;
31
49
  export declare function validateAllowedPatterns(patterns: readonly string[]): void;
@@ -1 +1 @@
1
- {"version":3,"file":"repository.d.ts","sourceRoot":"","sources":["../../src/runtime/repository.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAgB9C,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,kBAAkB;IACjC,aAAa,EAAE,GAAG,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,cAAc,EAAE,MA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