@leitwerk-dev/coding 0.5.6 → 0.5.7
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.
- package/README.md +13 -0
- package/dist/{chunk-B3PE6DPF.js → chunk-JL53OV5M.js} +74 -67
- package/dist/chunk-JL53OV5M.js.map +1 -0
- package/dist/{chunk-QD6FI4HR.js → chunk-PISZZXK4.js} +3 -4
- package/dist/chunk-PISZZXK4.js.map +1 -0
- package/dist/{chunk-3WJRJ3Q7.js → chunk-VG6XF3OK.js} +2 -6
- package/dist/chunk-VG6XF3OK.js.map +1 -0
- package/dist/finalization-git-internal.d.ts.map +1 -1
- package/dist/finalization-git.js +1 -1
- package/dist/index.js +2 -2
- package/dist/{repository-change-launch-internal-BudnAfL7.d.ts → repository-change-launch-internal-CP2jJJCR.d.ts} +1 -1
- package/dist/{repository-change-process-DlgF04fU.d.ts → repository-change-process-DbcnkzLw.d.ts} +2 -0
- package/dist/repository-change-process.d.ts +2 -0
- package/dist/repository-change-process.d.ts.map +1 -1
- package/dist/repository-change-publication.d.ts.map +1 -1
- package/dist/repository-change-publication.js +14 -26
- package/dist/repository-change-publication.js.map +1 -1
- package/dist/repository-reconciliation.d.ts +9 -15
- package/dist/repository-reconciliation.d.ts.map +1 -1
- package/dist/turns/implement.d.ts +1 -1
- package/dist/turns/implement.d.ts.map +1 -1
- package/dist/turns/implement.js +1 -1
- package/package.json +5 -5
- package/src/finalization-git-internal.ts +1 -5
- package/src/repository-change-process.ts +5 -1
- package/src/repository-change-publication.ts +13 -27
- package/src/repository-reconciliation.ts +97 -84
- package/src/turns/implement.ts +2 -2
- package/dist/chunk-3WJRJ3Q7.js.map +0 -1
- package/dist/chunk-B3PE6DPF.js.map +0 -1
- package/dist/chunk-QD6FI4HR.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"implement.d.ts","sourceRoot":"","sources":["../../src/turns/implement.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAE3F,gBAAgB;AAChB,wBAAgB,oBAAoB,CACnC,GAAG,EAAE,IAAI,CACR,iBAAiB,CAAC,OAAO,EAAE,sBAAsB,EAAE,MAAM,CAAC,EAC1D,SAAS,GAAG,OAAO,GAAG,MAAM,CAC5B,
|
|
1
|
+
{"version":3,"file":"implement.d.ts","sourceRoot":"","sources":["../../src/turns/implement.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAE3F,gBAAgB;AAChB,wBAAgB,oBAAoB,CACnC,GAAG,EAAE,IAAI,CACR,iBAAiB,CAAC,OAAO,EAAE,sBAAsB,EAAE,MAAM,CAAC,EAC1D,SAAS,GAAG,OAAO,GAAG,MAAM,CAC5B,EACD,YAAY,UAAQ,GAClB,MAAM,CAsBR"}
|
package/dist/turns/implement.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leitwerk-dev/coding",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.7",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/leitwerk-dev/leitwerk.git",
|
|
@@ -65,12 +65,12 @@
|
|
|
65
65
|
"build": "tsup --silent"
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"@leitwerk-dev/domain": "0.5.
|
|
69
|
-
"@leitwerk-dev/process-sdk": "0.5.
|
|
68
|
+
"@leitwerk-dev/domain": "0.5.7",
|
|
69
|
+
"@leitwerk-dev/process-sdk": "0.5.7"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
|
-
"@leitwerk-dev/extension-runtime": "0.5.
|
|
73
|
-
"@leitwerk-dev/test-support": "0.5.
|
|
72
|
+
"@leitwerk-dev/extension-runtime": "0.5.7",
|
|
73
|
+
"@leitwerk-dev/test-support": "0.5.7",
|
|
74
74
|
"tsup": "^8.5.1"
|
|
75
75
|
},
|
|
76
76
|
"license": "Apache-2.0",
|
|
@@ -150,11 +150,7 @@ function repositoryGit(projectKey: string, repoPath: string) {
|
|
|
150
150
|
if (workingTreeStatus().length === 0) return git("rev-parse", "HEAD");
|
|
151
151
|
assertGitIdentity(identity);
|
|
152
152
|
checkedGit(["add", "--all"], "Failed to stage the completed change");
|
|
153
|
-
checkedGit(
|
|
154
|
-
["-c", "core.hooksPath=/dev/null", "commit", "--no-gpg-sign", "-m", commitMessage],
|
|
155
|
-
"Failed to commit the completed change",
|
|
156
|
-
identity,
|
|
157
|
-
);
|
|
153
|
+
checkedGit(["commit", "--no-gpg-sign", "-m", commitMessage], "Commit failed", identity);
|
|
158
154
|
const remaining = workingTreeStatus();
|
|
159
155
|
if (remaining.length > 0) {
|
|
160
156
|
throw new DeterministicGitError(`Commit left uncommitted changes: ${remaining.join(", ")}`);
|
|
@@ -36,6 +36,8 @@ export interface RepositoryChangeWorkflow<TParams> {
|
|
|
36
36
|
variant?: "streamlined";
|
|
37
37
|
/** @public */
|
|
38
38
|
multiRepository?: boolean;
|
|
39
|
+
/** Refresh a clean, unpublished checkout against its target before implementation. @public */
|
|
40
|
+
refreshTargetBeforeImplementation?: boolean;
|
|
39
41
|
/** @public */
|
|
40
42
|
planDecision?(params: TParams): Promise<{
|
|
41
43
|
/** @internal */
|
|
@@ -271,6 +273,7 @@ export function createRepositoryChangeProcess<TParams extends RepositoryChangePa
|
|
|
271
273
|
}),
|
|
272
274
|
)
|
|
273
275
|
.publish("plan");
|
|
276
|
+
const refreshTarget = config.workflow?.refreshTargetBeforeImplementation;
|
|
274
277
|
const implement = flow
|
|
275
278
|
.llm<TParams, RepositoryChangeState>("implement")
|
|
276
279
|
.description("Implement")
|
|
@@ -289,6 +292,7 @@ export function createRepositoryChangeProcess<TParams extends RepositoryChangePa
|
|
|
289
292
|
projectKey: repo.key,
|
|
290
293
|
repoPath: repo.fsPath,
|
|
291
294
|
workBranch: repo.workBranch,
|
|
295
|
+
baseBranch: refreshTarget ? repo.baseBranch : undefined,
|
|
292
296
|
gitIdentity:
|
|
293
297
|
typeof identity?.name === "string" && typeof identity.email === "string"
|
|
294
298
|
? { name: identity.name, email: identity.email }
|
|
@@ -296,7 +300,7 @@ export function createRepositoryChangeProcess<TParams extends RepositoryChangePa
|
|
|
296
300
|
});
|
|
297
301
|
}),
|
|
298
302
|
}))
|
|
299
|
-
.buildPrompt((ctx) => `${buildImplementPrompt(ctx)}\n\n${reconciliationPrompt}`)
|
|
303
|
+
.buildPrompt((ctx) => `${buildImplementPrompt(ctx, refreshTarget)}\n\n${reconciliationPrompt}`)
|
|
300
304
|
.outcomeTool("implementation_ready", (tool) =>
|
|
301
305
|
tool
|
|
302
306
|
.description("Implementation and checks are complete; continue to delivery")
|
|
@@ -657,6 +657,7 @@ export function createRepositoryChangePublication<P>(
|
|
|
657
657
|
projectKey: repo.key,
|
|
658
658
|
repoPath: repo.fsPath,
|
|
659
659
|
workBranch: repo.workBranch,
|
|
660
|
+
baseBranch: repo.baseBranch,
|
|
660
661
|
baselineSha: current.workBaselineSha ?? current.headSha ?? undefined,
|
|
661
662
|
gitIdentity: await adapter.identity(ctx),
|
|
662
663
|
});
|
|
@@ -681,7 +682,6 @@ export function createRepositoryChangePublication<P>(
|
|
|
681
682
|
projectKey: repo.key,
|
|
682
683
|
repoPath: repo.fsPath,
|
|
683
684
|
workBranch: repo.workBranch,
|
|
684
|
-
baselineSha: headSha,
|
|
685
685
|
},
|
|
686
686
|
headSha,
|
|
687
687
|
);
|
|
@@ -752,7 +752,7 @@ export function createRepositoryChangePublication<P>(
|
|
|
752
752
|
current.delivery.adjustment?.origin !== "rebase"
|
|
753
753
|
) {
|
|
754
754
|
const synchronized = await reconcile(ctx, current);
|
|
755
|
-
if (synchronized.
|
|
755
|
+
if (synchronized.status !== "unchanged") return reconcileAgain();
|
|
756
756
|
// Fetch is authoritative even if the watcher has not observed a developer push yet.
|
|
757
757
|
publicationLease = synchronized.remoteHead;
|
|
758
758
|
if (current.headSha && synchronized.remoteHead && current.headSha !== synchronized.remoteHead)
|
|
@@ -1069,7 +1069,7 @@ export function createRepositoryChangePublication<P>(
|
|
|
1069
1069
|
if (asUnknownRecord(ctx.prepared)?.deferredRebase)
|
|
1070
1070
|
return `${repository}${reconciliationPrompt}\nThe source branch or retained local work must be reconciled before the target-branch repair. Resolve any source reconciliation, then use changes_ready. Delivery will restore and validate the result before reassessing current target conflicts.`;
|
|
1071
1071
|
if (current.reconciliationRequired)
|
|
1072
|
-
return `${repository}${reconciliationPrompt}\nValidate the reconciled repository, including retained local work, against the requested change and pending feedback: ${JSON.stringify(current.feedbackIds)}. Treat the current remote as authoritative; do not restore deliberately removed code simply to match an older plan. Use changes_ready after validation, even when no further edit is needed, so retained local changes are published. If blocked use cannot_repair.\nOriginal request for context: ${ctx.prompts?.initial ?? "Inspect the current repository and retained request"}`;
|
|
1072
|
+
return `${repository}${reconciliationPrompt}\nValidate the reconciled repository, including any upstream target changes and retained local work, against the requested change and pending feedback: ${JSON.stringify(current.feedbackIds)}. Treat the current remote as authoritative; do not restore deliberately removed code simply to match an older plan. Use changes_ready after validation, even when no further edit is needed, so retained local changes are published. If blocked use cannot_repair.\nOriginal request for context: ${ctx.prompts?.initial ?? "Inspect the current repository and retained request"}`;
|
|
1073
1073
|
if (repairReason(ctx.state, kind) === "rebase")
|
|
1074
1074
|
return `${rebasePrompt} Evidence: ${JSON.stringify(current.conflict)}. Call changes_ready or no_changes when verified complete, cannot_repair when blocked.`;
|
|
1075
1075
|
return `${adapter.repositories ? `Repository: ${activeKey(ctx.state)}. Apply changes only to this checkout. ` : ""}${adapter.prompt(kind, current)}\n\n${reconciliationPrompt}`;
|
|
@@ -1107,33 +1107,19 @@ export function createRepositoryChangePublication<P>(
|
|
|
1107
1107
|
// Resume Git's existing target repair; it must not be mistaken for source synchronization.
|
|
1108
1108
|
if (targetRebase && hasPreparedRebase(rebaseInput(ctx)))
|
|
1109
1109
|
return { rebase: startRebase(rebaseInput(ctx)) };
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
{
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
status: "in_progress",
|
|
1117
|
-
},
|
|
1118
|
-
],
|
|
1119
|
-
});
|
|
1110
|
+
const report = (label: string, status: "in_progress" | "completed") =>
|
|
1111
|
+
ctx.reportProgress({
|
|
1112
|
+
title: "Repository reconciliation",
|
|
1113
|
+
steps: [{ id: "reconcile_source", label, status }],
|
|
1114
|
+
});
|
|
1115
|
+
report("Reconcile remote changes and retained local work", "in_progress");
|
|
1120
1116
|
const reconciliation = await reconcile(repositoryContext(ctx), current);
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
{
|
|
1125
|
-
id: "reconcile_source",
|
|
1126
|
-
label:
|
|
1127
|
-
reconciliation.status === "conflicts"
|
|
1128
|
-
? "Resolve source reconciliation conflicts"
|
|
1129
|
-
: "Remote source reconciled",
|
|
1130
|
-
status: reconciliation.status === "conflicts" ? "in_progress" : "completed",
|
|
1131
|
-
},
|
|
1132
|
-
],
|
|
1133
|
-
});
|
|
1117
|
+
if (reconciliation.status === "conflicts")
|
|
1118
|
+
report("Resolve reconciliation conflicts", "in_progress");
|
|
1119
|
+
else report("Repository reconciled", "completed");
|
|
1134
1120
|
if (targetRebase) {
|
|
1135
1121
|
if (
|
|
1136
|
-
reconciliation.
|
|
1122
|
+
reconciliation.status !== "unchanged" ||
|
|
1137
1123
|
reconciliation.headSha !== current.conflict?.headSha ||
|
|
1138
1124
|
repositoryWorktreeIsDirty({ projectKey: project.key, repoPath: project.fsPath })
|
|
1139
1125
|
)
|
|
@@ -26,12 +26,16 @@ export interface ReconciliationInput {
|
|
|
26
26
|
gitIdentity?: GitIdentity;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
type WorkBranchInput = Omit<ReconciliationInput, "baselineSha"> & {
|
|
30
|
+
baselineSha?: string;
|
|
31
|
+
baseBranch?: string;
|
|
32
|
+
};
|
|
33
|
+
|
|
29
34
|
/** @internal */
|
|
30
35
|
export interface ReconciliationResult {
|
|
31
|
-
status: "
|
|
36
|
+
status: "unchanged" | "reconciled" | "conflicts";
|
|
32
37
|
remoteHead: string | null;
|
|
33
38
|
headSha: string;
|
|
34
|
-
changed: boolean;
|
|
35
39
|
}
|
|
36
40
|
|
|
37
41
|
interface RecordState extends RepositoryBinding {
|
|
@@ -48,6 +52,7 @@ interface RecordState extends RepositoryBinding {
|
|
|
48
52
|
index: string;
|
|
49
53
|
work: string;
|
|
50
54
|
remote: string;
|
|
55
|
+
targetBranch?: string;
|
|
51
56
|
phase: "captured" | "rebasing" | "restoring";
|
|
52
57
|
resultHead?: string;
|
|
53
58
|
resultIndex?: string;
|
|
@@ -190,13 +195,12 @@ function withLock<T>(directory: string, run: () => T): T {
|
|
|
190
195
|
}
|
|
191
196
|
|
|
192
197
|
/**
|
|
193
|
-
* Reconcile
|
|
198
|
+
* Reconcile unpublished work onto the fetched source or target branch. Checkpoint commits
|
|
194
199
|
* retain the index and working tree separately, including non-ignored untracked files.
|
|
195
200
|
* They are retained under private refs and removed from HEAD before publication.
|
|
196
201
|
* A conflicted rebase is deliberately left in place for the existing adjustment turn.
|
|
197
|
-
* @internal
|
|
198
202
|
*/
|
|
199
|
-
|
|
203
|
+
function reconcile(input: WorkBranchInput, preparing: boolean): ReconciliationResult {
|
|
200
204
|
const { git, directory, read, save, binding: readBinding } = repository(input);
|
|
201
205
|
return withLock(directory, () => {
|
|
202
206
|
git(["check-ref-format", `refs/heads/${input.workBranch}`]);
|
|
@@ -204,6 +208,38 @@ export function reconcileRepository(input: ReconciliationInput): ReconciliationR
|
|
|
204
208
|
let record = read();
|
|
205
209
|
if (!repositoryBindingMatches(record, binding))
|
|
206
210
|
throw new Error("Repository reconciliation binding changed");
|
|
211
|
+
const receipt = readPublicationReceipt(directory);
|
|
212
|
+
if (!repositoryBindingMatches(receipt, binding))
|
|
213
|
+
throw new Error("Repository publication receipt binding changed");
|
|
214
|
+
const sourceExists = git(["ls-remote", "--heads", "origin", `refs/heads/${input.workBranch}`]);
|
|
215
|
+
const unpublished =
|
|
216
|
+
!sourceExists &&
|
|
217
|
+
!input.baselineSha &&
|
|
218
|
+
!record?.remoteSeen &&
|
|
219
|
+
(!receipt || (receipt.status === "rejected" && receipt.expectedHead === null));
|
|
220
|
+
const target = unpublished ? input.baseBranch : undefined;
|
|
221
|
+
if (!sourceExists && (!unpublished || (record?.operation && !target)))
|
|
222
|
+
throw new Error(
|
|
223
|
+
"Remote source branch is missing or its publication is uncertain; local work was retained and the branch will not be recreated automatically",
|
|
224
|
+
);
|
|
225
|
+
if (record?.operation && record.operation.targetBranch !== target)
|
|
226
|
+
throw new Error("Repository reconciliation target changed; local work was retained");
|
|
227
|
+
assertIgnoredProtection(git, record?.protectedIgnored);
|
|
228
|
+
if (target) git(["check-ref-format", `refs/heads/${target}`]);
|
|
229
|
+
const captureBaseline = !record && (preparing || target);
|
|
230
|
+
const capturedHead = captureBaseline ? git(["rev-parse", "HEAD"]) : undefined;
|
|
231
|
+
const capturedIgnored = captureBaseline ? ignoredPaths(git) : undefined;
|
|
232
|
+
if (capturedHead && capturedIgnored) {
|
|
233
|
+
const baseline = target
|
|
234
|
+
? git(["merge-base", capturedHead, `refs/remotes/origin/${target}`])
|
|
235
|
+
: capturedHead;
|
|
236
|
+
record = { ...binding, baseline, protectedIgnored: capturedIgnored };
|
|
237
|
+
save(record);
|
|
238
|
+
}
|
|
239
|
+
if (unpublished && !target) {
|
|
240
|
+
const headSha = capturedHead ?? git(["rev-parse", "HEAD"]);
|
|
241
|
+
return { status: "unchanged", remoteHead: null, headSha };
|
|
242
|
+
}
|
|
207
243
|
if (record?.sourceIntegration) {
|
|
208
244
|
if (git(["branch", "--show-current"]) !== input.workBranch)
|
|
209
245
|
throw new Error("Source integration checkout branch changed; local work was retained");
|
|
@@ -229,34 +265,43 @@ export function reconcileRepository(input: ReconciliationInput): ReconciliationR
|
|
|
229
265
|
throw new Error(`Expected checkout on '${input.workBranch}'; local work was retained`);
|
|
230
266
|
|
|
231
267
|
if (!record?.operation) {
|
|
232
|
-
|
|
233
|
-
const
|
|
234
|
-
|
|
268
|
+
const ignored = capturedIgnored ?? ignoredPaths(git);
|
|
269
|
+
const head = capturedHead ?? git(["rev-parse", "HEAD"]);
|
|
270
|
+
let baseline =
|
|
271
|
+
record?.baseline ??
|
|
272
|
+
input.baselineSha ??
|
|
273
|
+
receipt?.expectedHead ??
|
|
274
|
+
(receipt?.status === "attempting" ? receipt.candidate : undefined);
|
|
275
|
+
const cleanOnly = target && preparing;
|
|
276
|
+
if (cleanOnly && (head !== baseline || git(["status", "--porcelain"])))
|
|
277
|
+
return { status: "unchanged", remoteHead: null, headSha: head };
|
|
278
|
+
// A source lease comes from the explicit fetch, not a remote-tracking ref.
|
|
279
|
+
const ref = target ? `refs/remotes/origin/${target}` : "refs/leitwerk/reconcile-remote";
|
|
235
280
|
git([
|
|
236
281
|
"fetch",
|
|
237
282
|
"--no-tags",
|
|
283
|
+
...(target ? ["--refmap="] : []),
|
|
238
284
|
"origin",
|
|
239
|
-
`+refs/heads/${input.workBranch}
|
|
285
|
+
`+refs/heads/${target ?? input.workBranch}:${ref}`,
|
|
240
286
|
]);
|
|
241
|
-
const remote = git(["rev-parse",
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
if (remote === receipt.candidate || ancestor(git, receipt.candidate, remote)) {
|
|
287
|
+
const remote = git(["rev-parse", ref]);
|
|
288
|
+
if (!target) {
|
|
289
|
+
if (receipt?.status === "attempting") {
|
|
290
|
+
if (!ancestor(git, receipt.candidate, remote))
|
|
291
|
+
throw new Error(
|
|
292
|
+
"Prior publication outcome is uncertain; local work was retained for operator reconciliation",
|
|
293
|
+
);
|
|
249
294
|
receipt.status = "accepted";
|
|
250
295
|
savePublicationReceipt(directory, receipt);
|
|
251
|
-
} else {
|
|
252
|
-
throw new Error(
|
|
253
|
-
"Prior publication outcome is uncertain; local work was retained for operator reconciliation",
|
|
254
|
-
);
|
|
255
296
|
}
|
|
297
|
+
if (receipt?.status === "accepted" && record?.publicationReceiptSha !== receipt.candidate)
|
|
298
|
+
baseline = receipt.candidate;
|
|
256
299
|
}
|
|
257
|
-
if (
|
|
258
|
-
baseline
|
|
300
|
+
if (!baseline)
|
|
301
|
+
throw new Error("Cannot establish the retained work baseline; local work was retained");
|
|
259
302
|
git(["cat-file", "-e", `${baseline}^{commit}`]);
|
|
303
|
+
if (target && !ancestor(git, baseline, remote))
|
|
304
|
+
throw new Error("The target branch was rewritten; local work was retained");
|
|
260
305
|
if (!ancestor(git, baseline, head))
|
|
261
306
|
throw new Error(
|
|
262
307
|
"Cannot establish unpublished work from the retained baseline; local work was retained",
|
|
@@ -265,23 +310,35 @@ export function reconcileRepository(input: ReconciliationInput): ReconciliationR
|
|
|
265
310
|
...record,
|
|
266
311
|
...binding,
|
|
267
312
|
baseline,
|
|
268
|
-
remoteSeen:
|
|
313
|
+
remoteSeen: !target,
|
|
269
314
|
protectedIgnored: [...new Set([...(record?.protectedIgnored ?? []), ...ignored])],
|
|
270
315
|
publicationReceiptSha:
|
|
271
316
|
receipt?.status === "accepted" ? receipt.candidate : record?.publicationReceiptSha,
|
|
272
317
|
};
|
|
273
|
-
|
|
318
|
+
const upToDate = target
|
|
319
|
+
? ancestor(git, remote, head)
|
|
320
|
+
: remote === baseline || remote === head;
|
|
321
|
+
if (
|
|
322
|
+
(!upToDate || record.joinParent) &&
|
|
323
|
+
ignoredPathsCollide(git, ignored, remote, `${baseline}..${head}`)
|
|
324
|
+
)
|
|
325
|
+
throw new Error("Remote changes collide with ignored files; local files were retained");
|
|
326
|
+
if ((upToDate && !record.joinParent) || cleanOnly) {
|
|
327
|
+
if (!upToDate) git(["merge", "--ff-only", "--no-overwrite-ignore", remote]);
|
|
274
328
|
record.baseline = remote;
|
|
275
329
|
save(record);
|
|
276
|
-
|
|
330
|
+
if (!upToDate) assertIgnoredProtection(git, record.protectedIgnored);
|
|
331
|
+
return {
|
|
332
|
+
status: upToDate ? "unchanged" : "reconciled",
|
|
333
|
+
remoteHead: target ? null : remote,
|
|
334
|
+
headSha: upToDate ? head : remote,
|
|
335
|
+
};
|
|
277
336
|
}
|
|
278
337
|
if (git(["diff", "--name-only", "--diff-filter=U"]))
|
|
279
338
|
throw new Error("Unresolved local conflicts must be repaired before reconciliation");
|
|
280
339
|
// Dirty submodule work cannot be represented by the parent's tree checkpoint.
|
|
281
340
|
if (git(["submodule", "foreach", "--quiet", "git status --porcelain"]))
|
|
282
341
|
throw new Error("Commit or preserve dirty submodule work before reconciliation");
|
|
283
|
-
if (ignoredPathsCollide(git, ignored, remote, `${record.baseline}..${head}`))
|
|
284
|
-
throw new Error("Remote changes collide with ignored files; local files were retained");
|
|
285
342
|
// A verified remote descendant already contains these local commits, including
|
|
286
343
|
// publication that succeeded before its receipt reached the server.
|
|
287
344
|
if (ancestor(git, head, remote)) record.baseline = head;
|
|
@@ -316,6 +373,7 @@ export function reconcileRepository(input: ReconciliationInput): ReconciliationR
|
|
|
316
373
|
index,
|
|
317
374
|
work,
|
|
318
375
|
remote,
|
|
376
|
+
targetBranch: target,
|
|
319
377
|
phase: "captured",
|
|
320
378
|
identity: replayIdentity,
|
|
321
379
|
};
|
|
@@ -351,9 +409,8 @@ export function reconcileRepository(input: ReconciliationInput): ReconciliationR
|
|
|
351
409
|
if (operation.phase === "rebasing") {
|
|
352
410
|
const conflicts = (): ReconciliationResult => ({
|
|
353
411
|
status: "conflicts",
|
|
354
|
-
remoteHead: operation.remote,
|
|
412
|
+
remoteHead: target ? null : operation.remote,
|
|
355
413
|
headSha: git(["rev-parse", "HEAD"]),
|
|
356
|
-
changed: true,
|
|
357
414
|
});
|
|
358
415
|
if (rebaseActive()) return conflicts();
|
|
359
416
|
// Retry after Git completed the rebase but before the result was journaled.
|
|
@@ -361,8 +418,6 @@ export function reconcileRepository(input: ReconciliationInput): ReconciliationR
|
|
|
361
418
|
try {
|
|
362
419
|
git(
|
|
363
420
|
[
|
|
364
|
-
"-c",
|
|
365
|
-
"core.hooksPath=/dev/null",
|
|
366
421
|
"-c",
|
|
367
422
|
"commit.gpgSign=false",
|
|
368
423
|
"rebase",
|
|
@@ -441,10 +496,9 @@ export function reconcileRepository(input: ReconciliationInput): ReconciliationR
|
|
|
441
496
|
save(record);
|
|
442
497
|
assertIgnoredProtection(git, record.protectedIgnored);
|
|
443
498
|
return {
|
|
444
|
-
status: "
|
|
445
|
-
remoteHead: operation.remote,
|
|
499
|
+
status: "reconciled",
|
|
500
|
+
remoteHead: target ? null : operation.remote,
|
|
446
501
|
headSha: operation.resultHead,
|
|
447
|
-
changed: true,
|
|
448
502
|
};
|
|
449
503
|
});
|
|
450
504
|
}
|
|
@@ -523,62 +577,21 @@ export function repositoryWorktreeIsDirty(
|
|
|
523
577
|
|
|
524
578
|
/** Capture the baseline before the first implementation, including an unpublished branch. @internal */
|
|
525
579
|
export function prepareInitialRepository(
|
|
526
|
-
input: Omit<
|
|
580
|
+
input: Omit<WorkBranchInput, "baselineSha">,
|
|
527
581
|
): ReconciliationResult {
|
|
528
|
-
|
|
529
|
-
withLock(directory, () => {
|
|
530
|
-
if (!read())
|
|
531
|
-
save({
|
|
532
|
-
...binding(input.workBranch),
|
|
533
|
-
baseline: git(["rev-parse", "HEAD"]),
|
|
534
|
-
protectedIgnored: ignoredPaths(git),
|
|
535
|
-
});
|
|
536
|
-
});
|
|
537
|
-
return reconcilePublicationRepository(input);
|
|
582
|
+
return reconcile(input, true);
|
|
538
583
|
}
|
|
539
584
|
|
|
540
585
|
/** Missing branches are allowed only before first publication. @internal */
|
|
541
|
-
export function reconcilePublicationRepository(
|
|
542
|
-
input
|
|
543
|
-
): ReconciliationResult {
|
|
544
|
-
const { git, read, directory } = repository(input);
|
|
545
|
-
const record = read();
|
|
546
|
-
const receipt = readPublicationReceipt(directory);
|
|
547
|
-
const baselineSha =
|
|
548
|
-
record?.baseline ??
|
|
549
|
-
input.baselineSha ??
|
|
550
|
-
(receipt?.status === "accepted"
|
|
551
|
-
? receipt.candidate
|
|
552
|
-
: (receipt?.expectedHead ??
|
|
553
|
-
(receipt?.status === "attempting" ? receipt.candidate : undefined)));
|
|
554
|
-
assertIgnoredProtection(git, record?.protectedIgnored);
|
|
555
|
-
const remote = git(["ls-remote", "--heads", "origin", `refs/heads/${input.workBranch}`]).split(
|
|
556
|
-
/\s+/,
|
|
557
|
-
)[0];
|
|
558
|
-
if (
|
|
559
|
-
!remote &&
|
|
560
|
-
!input.baselineSha &&
|
|
561
|
-
!record?.remoteSeen &&
|
|
562
|
-
!record?.operation &&
|
|
563
|
-
(!receipt || (receipt.status === "rejected" && receipt.expectedHead === null))
|
|
564
|
-
)
|
|
565
|
-
return {
|
|
566
|
-
status: "ready",
|
|
567
|
-
remoteHead: null,
|
|
568
|
-
headSha: git(["rev-parse", "HEAD"]),
|
|
569
|
-
changed: false,
|
|
570
|
-
};
|
|
571
|
-
if (!remote)
|
|
572
|
-
throw new Error(
|
|
573
|
-
"Remote source branch is missing or its publication is uncertain; local work was retained and the branch will not be recreated automatically",
|
|
574
|
-
);
|
|
575
|
-
if (!baselineSha)
|
|
576
|
-
throw new Error("Cannot establish the retained work baseline; local work was retained");
|
|
577
|
-
return reconcileRepository({ ...input, baselineSha });
|
|
586
|
+
export function reconcilePublicationRepository(input: WorkBranchInput): ReconciliationResult {
|
|
587
|
+
return reconcile(input, false);
|
|
578
588
|
}
|
|
579
589
|
|
|
580
590
|
/** Record only a remotely verified publication, including recovery after a lost reply. @internal */
|
|
581
|
-
export function recordRepositoryPublication(
|
|
591
|
+
export function recordRepositoryPublication(
|
|
592
|
+
input: Omit<ReconciliationInput, "baselineSha" | "gitIdentity">,
|
|
593
|
+
headSha: string,
|
|
594
|
+
): void {
|
|
582
595
|
const { directory, read, save, binding: readBinding } = repository(input);
|
|
583
596
|
withLock(directory, () => {
|
|
584
597
|
const old = read();
|
package/src/turns/implement.ts
CHANGED
|
@@ -6,6 +6,7 @@ export function buildImplementPrompt(
|
|
|
6
6
|
FlowPromptContext<unknown, StructuralProcessState, "plan">,
|
|
7
7
|
"prompts" | "input" | "repo"
|
|
8
8
|
>,
|
|
9
|
+
checkPlanFit = false,
|
|
9
10
|
): string {
|
|
10
11
|
return `Implement this requested change:
|
|
11
12
|
${ctx.prompts.initial}
|
|
@@ -19,13 +20,12 @@ Follow this plan:
|
|
|
19
20
|
${ctx.input.plan}
|
|
20
21
|
|
|
21
22
|
Rules:
|
|
22
|
-
- keep going until the change is complete; do any necessary additional passes without asking
|
|
23
|
+
- ${checkPlanFit ? "Before editing, check the plan against the current checkout. Adapt without expanding the approved scope, or stop and explain why if the plan no longer fits. If it fits, " : ""}keep going until the change is complete; do any necessary additional passes without asking
|
|
23
24
|
- make repository changes only inside the current working directory
|
|
24
25
|
- run file edits, Git commands, and checks in the appropriate checkout
|
|
25
26
|
- follow each repository’s instructions and validate every affected repository
|
|
26
27
|
- leave changes uncommitted; delivery owns commits and pushes
|
|
27
28
|
- do not read from or write to any original source repository path outside the process workspace
|
|
28
|
-
- keep the implementation coherent and complete
|
|
29
29
|
- keep the number of changed files small
|
|
30
30
|
- when documenting, be sparse. Do not narrate the implementation or maintain a prose inventory of tests, helpers, internal environment variables, or cleanup mechanics.
|
|
31
31
|
- publish the implementation summary when done`;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/finalization-git-internal.ts"],"sourcesContent":["import { execFileSync } from \"node:child_process\";\nimport { existsSync } from \"node:fs\";\nimport path from \"node:path\";\nimport { trimToNull, type WorkerErrorClass } from \"@leitwerk-dev/domain\";\nimport { repositoryGitArgs, repositoryGitSubprocessEnv } from \"@leitwerk-dev/process-sdk\";\nimport { resolveGitBinary } from \"@leitwerk-dev/process-sdk/git-binary\";\nimport {\n\tpushWasRejected,\n\ttype RepositoryPublicationReceipt,\n\treadPublicationReceipt,\n\treadRepositoryBinding,\n\trepositoryBindingMatches,\n\tsavePublicationReceipt,\n} from \"./repository-publication-receipt.js\";\n\n/** @public */\nexport interface GitIdentity {\n\t/** @public */\n\tname: string;\n\t/** @public */\n\temail: string;\n}\n\n/** @internal */\nexport class DeterministicGitError extends Error {\n\t/** @internal */\n\treadonly errorClass: WorkerErrorClass = \"git_error\";\n\n\t/** @internal */\n\tconstructor(message: string) {\n\t\tsuper(message);\n\t\tthis.name = \"DeterministicGitError\";\n\t}\n}\n\n/** @internal */\nexport class RemoteBranchChangedError extends DeterministicGitError {\n\tconstructor() {\n\t\tsuper(\"The remote source branch changed before publication; reconcile and validate again\");\n\t}\n}\n\ninterface GitExecResult {\n\tok: boolean;\n\tstdout: string;\n\tstderr: string;\n}\n\nfunction gitConfigIdentityEnv(projectKey: string): NodeJS.ProcessEnv {\n\tconst env = repositoryGitSubprocessEnv(projectKey, { GIT_TERMINAL_PROMPT: \"0\" });\n\tfor (const key of [\n\t\t\"GIT_AUTHOR_NAME\",\n\t\t\"GIT_AUTHOR_EMAIL\",\n\t\t\"GIT_AUTHOR_DATE\",\n\t\t\"GIT_COMMITTER_NAME\",\n\t\t\"GIT_COMMITTER_EMAIL\",\n\t\t\"GIT_COMMITTER_DATE\",\n\t])\n\t\tdelete env[key];\n\treturn env;\n}\n\nfunction gitIdentityArgs(identity: GitIdentity): string[] {\n\tconst name = trimToNull(identity.name);\n\tconst email = trimToNull(identity.email);\n\tif (!name || !email || /[\\r\\n\\0]/.test(name) || /[\\r\\n\\0]/.test(email)) {\n\t\tthrow new DeterministicGitError(\"Git identity requires a valid name and email\");\n\t}\n\treturn [\"-c\", `user.name=${name}`, \"-c\", `user.email=${email}`];\n}\n\nfunction repositoryGit(projectKey: string, repoPath: string) {\n\tfunction runGit(args: readonly string[], identity?: GitIdentity): GitExecResult {\n\t\tconst trustedArgs = identity ? [...gitIdentityArgs(identity), ...args] : args;\n\t\ttry {\n\t\t\tconst stdout = execFileSync(resolveGitBinary(), repositoryGitArgs(trustedArgs), {\n\t\t\t\tcwd: repoPath,\n\t\t\t\tencoding: \"utf8\",\n\t\t\t\tenv: gitConfigIdentityEnv(projectKey),\n\t\t\t\tstdio: [\"ignore\", \"pipe\", \"pipe\"],\n\t\t\t});\n\t\t\treturn { ok: true, stdout, stderr: \"\" };\n\t\t} catch (error) {\n\t\t\tconst execError = error as {\n\t\t\t\tstdout?: string | Buffer;\n\t\t\t\tstderr?: string | Buffer;\n\t\t\t\tmessage?: string;\n\t\t\t};\n\t\t\treturn {\n\t\t\t\tok: false,\n\t\t\t\tstdout: execError.stdout?.toString() ?? \"\",\n\t\t\t\tstderr: execError.stderr?.toString() ?? trimToNull(execError.message) ?? \"\",\n\t\t\t};\n\t\t}\n\t}\n\n\tfunction checkedGit(\n\t\targs: readonly string[],\n\t\tfailureMessage: string,\n\t\tidentity?: GitIdentity,\n\t): string {\n\t\tconst result = runGit(args, identity);\n\t\tif (!result.ok) {\n\t\t\tconst detail = trimToNull(result.stderr) ?? trimToNull(result.stdout) ?? \"unknown git error\";\n\t\t\tthrow new DeterministicGitError(`${failureMessage}: ${detail}`);\n\t\t}\n\t\treturn result.stdout.trim();\n\t}\n\n\tfunction git(...args: string[]): string {\n\t\treturn checkedGit(args, `git ${args.join(\" \")} failed in '${repoPath}'`);\n\t}\n\n\tfunction gitOrNull(...args: string[]): string | null {\n\t\tconst result = runGit(args);\n\t\treturn result.ok ? trimToNull(result.stdout) : null;\n\t}\n\n\tfunction workingTreeStatus(): string[] {\n\t\treturn (gitOrNull(\"status\", \"--porcelain\") ?? \"\")\n\t\t\t.split(/\\r?\\n/)\n\t\t\t.map((line) => line.replace(/\\s+$/, \"\"))\n\t\t\t.filter(Boolean)\n\t\t\t.map((line) => line.slice(2).trim())\n\t\t\t.filter(Boolean);\n\t}\n\n\tfunction conflictedFiles(): string[] {\n\t\treturn (gitOrNull(\"diff\", \"--name-only\", \"--diff-filter=U\") ?? \"\")\n\t\t\t.split(/\\r?\\n/)\n\t\t\t.map((line) => line.trim())\n\t\t\t.filter(Boolean);\n\t}\n\n\tfunction mergeInProgress(): boolean {\n\t\tconst gitDir = git(\"rev-parse\", \"--git-dir\");\n\t\treturn existsSync(path.resolve(repoPath, gitDir, \"MERGE_HEAD\"));\n\t}\n\n\tfunction assertGitIdentity(identity: GitIdentity): void {\n\t\tif (\n\t\t\t!runGit([\"var\", \"GIT_AUTHOR_IDENT\"], identity).ok ||\n\t\t\t!runGit([\"var\", \"GIT_COMMITTER_IDENT\"], identity).ok\n\t\t) {\n\t\t\tthrow new DeterministicGitError(\"Git author/committer identity is not configured\");\n\t\t}\n\t}\n\n\tfunction commitIfDirty(commitMessage: string, identity: GitIdentity): string {\n\t\tif (workingTreeStatus().length === 0) return git(\"rev-parse\", \"HEAD\");\n\t\tassertGitIdentity(identity);\n\t\tcheckedGit([\"add\", \"--all\"], \"Failed to stage the completed change\");\n\t\tcheckedGit(\n\t\t\t[\"-c\", \"core.hooksPath=/dev/null\", \"commit\", \"--no-gpg-sign\", \"-m\", commitMessage],\n\t\t\t\"Failed to commit the completed change\",\n\t\t\tidentity,\n\t\t);\n\t\tconst remaining = workingTreeStatus();\n\t\tif (remaining.length > 0) {\n\t\t\tthrow new DeterministicGitError(`Commit left uncommitted changes: ${remaining.join(\", \")}`);\n\t\t}\n\t\treturn git(\"rev-parse\", \"HEAD\");\n\t}\n\n\tfunction pushAndVerify(\n\t\tbranch: string,\n\t\texpectedHeadSha: string,\n\t\texpectedRemoteHead?: string | null,\n\t): string {\n\t\tconst ref = `refs/heads/${branch}`;\n\t\tconst pushTarget = `origin/${branch}`;\n\t\tconst observed = git(\"ls-remote\", \"--heads\", \"origin\", ref).split(/\\s+/)[0] || null;\n\t\tconst lease = expectedRemoteHead === undefined ? observed : expectedRemoteHead;\n\t\tconst directory = git(\"rev-parse\", \"--absolute-git-dir\");\n\t\tconst binding = readRepositoryBinding(git, branch);\n\t\tif (binding.origin !== binding.pushOrigin)\n\t\t\tthrow new DeterministicGitError(\"Fetch and push endpoints must match for publication\");\n\t\tconst previous = readPublicationReceipt(directory);\n\t\tif (!repositoryBindingMatches(previous, binding))\n\t\t\tthrow new DeterministicGitError(\"Repository publication receipt binding changed\");\n\t\tconst receipt: RepositoryPublicationReceipt = {\n\t\t\t...binding,\n\t\t\texpectedHead: lease,\n\t\t\tcandidate: expectedHeadSha,\n\t\t\tstatus: \"attempting\",\n\t\t};\n\t\t// Recover a successful push whose acknowledgement was lost.\n\t\tif (observed === expectedHeadSha) {\n\t\t\tsavePublicationReceipt(directory, { ...receipt, status: \"accepted\" });\n\t\t\treturn pushTarget;\n\t\t}\n\t\tif (previous?.status === \"attempting\")\n\t\t\tthrow new DeterministicGitError(\n\t\t\t\t\"A prior publication is unresolved; retain local work and reconcile its exact candidate first\",\n\t\t\t);\n\t\tif (previous?.status === \"accepted\" && previous.candidate === expectedHeadSha)\n\t\t\tthrow new RemoteBranchChangedError();\n\t\tif (observed !== lease) throw new RemoteBranchChangedError();\n\t\tif (lease && !runGit([\"merge-base\", \"--is-ancestor\", lease, expectedHeadSha]).ok)\n\t\t\tthrow new DeterministicGitError(\n\t\t\t\t\"Ordinary publication must preserve the captured remote head\",\n\t\t\t);\n\t\tsavePublicationReceipt(directory, receipt);\n\t\tconst pushed = runGit([\n\t\t\t\"push\",\n\t\t\t\"--porcelain\",\n\t\t\t\"--no-follow-tags\",\n\t\t\t\"--recurse-submodules=no\",\n\t\t\t`--force-with-lease=${ref}:${lease ?? \"\"}`,\n\t\t\t\"origin\",\n\t\t\t`${expectedHeadSha}:${ref}`,\n\t\t]);\n\t\tif (!pushed.ok) {\n\t\t\tif (pushWasRejected(pushed.stdout))\n\t\t\t\tsavePublicationReceipt(directory, { ...receipt, status: \"rejected\" });\n\t\t\tconst latest = git(\"ls-remote\", \"--heads\", \"origin\", ref).split(/\\s+/)[0] || null;\n\t\t\tif (latest === expectedHeadSha) {\n\t\t\t\tsavePublicationReceipt(directory, { ...receipt, status: \"accepted\" });\n\t\t\t\treturn pushTarget;\n\t\t\t}\n\t\t\tif (latest !== lease) throw new RemoteBranchChangedError();\n\t\t\tthrow new DeterministicGitError(`Failed to push HEAD to '${pushTarget}': ${pushed.stderr}`);\n\t\t}\n\t\tsavePublicationReceipt(directory, { ...receipt, status: \"accepted\" });\n\t\tconst remoteHead = gitOrNull(\"ls-remote\", \"--heads\", \"origin\", ref)?.split(/\\s+/)[0]?.trim();\n\t\tif (remoteHead !== expectedHeadSha) throw new RemoteBranchChangedError();\n\t\treturn pushTarget;\n\t}\n\n\treturn { runGit, git, conflictedFiles, mergeInProgress, commitIfDirty, pushAndVerify };\n}\n\n/** Inspect staged, unstaged, untracked, and already committed unpublished changes. @public */\nexport function repositoryHasChanges(\n\trepoPath: string,\n\tbaseBranch: string,\n\tprojectKey = \"repo\",\n): boolean {\n\tconst { git } = repositoryGit(projectKey, repoPath);\n\treturn Boolean(\n\t\tgit(\"status\", \"--porcelain\") || git(\"diff\", \"--name-only\", `origin/${baseBranch}...HEAD`),\n\t);\n}\n\n/** Commit the current workspace change and non-force push only the feature branch. */\n/** @public */\nexport function commitAndPushWorkBranch(input: {\n\t/** @public */ projectKey?: string;\n\t/** @public */\n\trepoPath: string;\n\t/** @public */\n\tworkBranch: string;\n\t/** @public */\n\tcommitMessage: string;\n\t/** @public */\n\tgitIdentity: GitIdentity;\n\t/** Captured remote head; null requires branch creation. @internal */\n\texpectedRemoteHead?: string | null;\n}) {\n\tconst repoPath = path.resolve(input.repoPath);\n\tconst { runGit, git, conflictedFiles, mergeInProgress, commitIfDirty, pushAndVerify } =\n\t\trepositoryGit(input.projectKey ?? \"repo\", repoPath);\n\tif (!existsSync(repoPath) || !runGit([\"rev-parse\", \"--git-dir\"]).ok) {\n\t\tthrow new DeterministicGitError(\n\t\t\t`Repository workspace '${repoPath}' does not exist or is not a git repository`,\n\t\t);\n\t}\n\tconst branch = git(\"branch\", \"--show-current\");\n\tif (branch !== input.workBranch) {\n\t\tthrow new DeterministicGitError(\n\t\t\t`Expected '${repoPath}' to be checked out on '${input.workBranch}', but found '${branch || \"detached HEAD\"}'`,\n\t\t);\n\t}\n\tif (!trimToNull(input.commitMessage)) {\n\t\tthrow new DeterministicGitError(\"A generated commit message is required before publication\");\n\t}\n\tconst conflicts = conflictedFiles();\n\tif (mergeInProgress() || conflicts.length > 0) {\n\t\tthrow new DeterministicGitError(\n\t\t\t`Cannot publish a work branch with unresolved conflicts: ${conflicts.join(\", \") || \"merge in progress\"}`,\n\t\t);\n\t}\n\tconst headSha = commitIfDirty(input.commitMessage, input.gitIdentity);\n\treturn {\n\t\t/** @public */\n\t\theadSha,\n\t\t/** @internal */\n\t\tpushTarget: pushAndVerify(input.workBranch, headSha, input.expectedRemoteHead),\n\t};\n}\n"],"mappings":";;;;;;;;;AAAA,SAAS,oBAAoB;AAC7B,SAAS,kBAAkB;AAC3B,OAAO,UAAU;AACjB,SAAS,kBAAyC;AAClD,SAAS,mBAAmB,kCAAkC;AAC9D,SAAS,wBAAwB;AAmB1B,IAAM,wBAAN,cAAoC,MAAM;AAAA;AAAA,EAEvC,aAA+B;AAAA;AAAA,EAGxC,YAAY,SAAiB;AAC5B,UAAM,OAAO;AACb,SAAK,OAAO;AAAA,EACb;AACD;AAGO,IAAM,2BAAN,cAAuC,sBAAsB;AAAA,EACnE,cAAc;AACb,UAAM,mFAAmF;AAAA,EAC1F;AACD;AAQA,SAAS,qBAAqB,YAAuC;AACpE,QAAM,MAAM,2BAA2B,YAAY,EAAE,qBAAqB,IAAI,CAAC;AAC/E,aAAW,OAAO;AAAA,IACjB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACC,WAAO,IAAI,GAAG;AACf,SAAO;AACR;AAEA,SAAS,gBAAgB,UAAiC;AACzD,QAAM,OAAO,WAAW,SAAS,IAAI;AACrC,QAAM,QAAQ,WAAW,SAAS,KAAK;AACvC,MAAI,CAAC,QAAQ,CAAC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