@leitwerk-dev/coding 0.5.11 → 0.5.12
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 +1 -0
- package/dist/{chunk-JL53OV5M.js → chunk-5M3DTAVU.js} +25 -9
- package/dist/chunk-5M3DTAVU.js.map +1 -0
- package/dist/{chunk-E3DB4TIZ.js → chunk-DVQWH5SN.js} +22 -2
- package/dist/chunk-DVQWH5SN.js.map +1 -0
- package/dist/{chunk-VG6XF3OK.js → chunk-GIWVCTYT.js} +20 -14
- package/dist/chunk-GIWVCTYT.js.map +1 -0
- package/dist/finalization-git-internal.d.ts +2 -0
- package/dist/finalization-git-internal.d.ts.map +1 -1
- package/dist/finalization-git.js +2 -2
- package/dist/index.js +2 -2
- package/dist/{repository-change-launch-internal-CP2jJJCR.d.ts → repository-change-launch-internal-D_QWCQAN.d.ts} +1 -1
- package/dist/{repository-change-process-DbcnkzLw.d.ts → repository-change-process-Dc-jsbCL.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 +4 -0
- package/dist/repository-change-publication.d.ts.map +1 -1
- package/dist/repository-change-publication.js +41 -33
- package/dist/repository-change-publication.js.map +1 -1
- package/dist/repository-reconciliation.d.ts +15 -13
- package/dist/repository-reconciliation.d.ts.map +1 -1
- package/dist/submodule-staging.d.ts +11 -0
- package/dist/submodule-staging.d.ts.map +1 -0
- package/package.json +5 -5
- package/src/finalization-git-internal.ts +19 -17
- package/src/repository-change-process.ts +24 -6
- package/src/repository-change-publication.ts +41 -33
- package/src/repository-reconciliation.ts +17 -27
- package/src/submodule-staging.ts +27 -0
- package/dist/chunk-E3DB4TIZ.js.map +0 -1
- package/dist/chunk-JL53OV5M.js.map +0 -1
- package/dist/chunk-VG6XF3OK.js.map +0 -1
package/README.md
CHANGED
|
@@ -59,6 +59,7 @@ the existing process flow.
|
|
|
59
59
|
`createRepositoryChangePublication()` builds shared delivery, feedback, CI/rebase
|
|
60
60
|
repair, and operator turns for Forgejo, GitHub, and GitLab. Adapters supply provider
|
|
61
61
|
operations, evidence sources, repair tools/prompts, and pinned identities.
|
|
62
|
+
Set `prepareSubmodules` on the adapter to enable checkout preparation and staging protection.
|
|
62
63
|
`sourceCancelled`, `reconcileAll`, and `reconcileTerminal` receive
|
|
63
64
|
`PublicationReconciliationContext`: process, projects, params, state, and integration
|
|
64
65
|
calls, without worker filesystem access. Cursors and receipts remain namespaced;
|
|
@@ -12,12 +12,14 @@ import {
|
|
|
12
12
|
buildStreamlinedSimplificationPrompt
|
|
13
13
|
} from "./chunk-SKGB4CZS.js";
|
|
14
14
|
import {
|
|
15
|
+
assertSafeSubmoduleStaging,
|
|
16
|
+
prepareSubmodules,
|
|
15
17
|
readPublicationReceipt,
|
|
16
18
|
readRepositoryBinding,
|
|
17
19
|
repositoryBindingMatches,
|
|
18
20
|
repositoryRecord,
|
|
19
21
|
savePublicationReceipt
|
|
20
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-DVQWH5SN.js";
|
|
21
23
|
import {
|
|
22
24
|
codingPurposes,
|
|
23
25
|
prepareRepositoryCommitMessageEvidence
|
|
@@ -308,6 +310,7 @@ function reconcile(input, preparing) {
|
|
|
308
310
|
}
|
|
309
311
|
if (git(["diff", "--name-only", "--diff-filter=U"]))
|
|
310
312
|
throw new Error("Unresolved local conflicts must be repaired before reconciliation");
|
|
313
|
+
if (input.protectSubmodules) assertSafeSubmoduleStaging(git);
|
|
311
314
|
if (git(["submodule", "foreach", "--quiet", "git status --porcelain"]))
|
|
312
315
|
throw new Error("Commit or preserve dirty submodule work before reconciliation");
|
|
313
316
|
if (ancestor(git, head, remote)) record.baseline = head;
|
|
@@ -731,22 +734,34 @@ function createRepositoryChangeProcess(config) {
|
|
|
731
734
|
})
|
|
732
735
|
).publish("plan");
|
|
733
736
|
const refreshTarget = config.workflow?.refreshTargetBeforeImplementation;
|
|
734
|
-
const
|
|
735
|
-
|
|
737
|
+
const prepareDependencies = config.publication.prepareSubmodules;
|
|
738
|
+
const implement = flow.llm("implement").description("Implement").waitFor(({ state }) => !!state.productRefs.plan).executionPurpose(codingPurposes.implementation).tools(...tools).freshSeededPrimary().startFromRoot().consume("plan").prepare(async (ctx) => {
|
|
739
|
+
const submoduleWarnings = [];
|
|
740
|
+
for (const repo of ctx.repo.all()) {
|
|
736
741
|
const identity = asUnknownRecord(
|
|
737
742
|
ctx.projects.find((p) => p.key === repo.key)?.metadata?.["leitwerk.gitIdentity"]
|
|
738
743
|
);
|
|
739
|
-
|
|
744
|
+
const result = prepareInitialRepository({
|
|
740
745
|
projectKey: repo.key,
|
|
741
746
|
repoPath: repo.fsPath,
|
|
742
747
|
workBranch: repo.workBranch,
|
|
743
748
|
baseBranch: refreshTarget ? repo.baseBranch : void 0,
|
|
749
|
+
protectSubmodules: prepareDependencies,
|
|
744
750
|
gitIdentity: typeof identity?.name === "string" && typeof identity.email === "string" ? { name: identity.name, email: identity.email } : void 0
|
|
745
751
|
});
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
752
|
+
if (prepareDependencies && result.status !== "conflicts") {
|
|
753
|
+
const warning = await prepareSubmodules(repo, ctx);
|
|
754
|
+
if (warning) submoduleWarnings.push(warning);
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
return { submoduleWarnings };
|
|
758
|
+
}).buildPrompt(
|
|
759
|
+
(ctx) => [
|
|
760
|
+
buildImplementPrompt(ctx, refreshTarget),
|
|
761
|
+
reconciliationPrompt,
|
|
762
|
+
...ctx.prepared?.submoduleWarnings ?? []
|
|
763
|
+
].join("\n\n")
|
|
764
|
+
).outcomeTool(
|
|
750
765
|
"implementation_ready",
|
|
751
766
|
(tool) => tool.description("Implementation and checks are complete; continue to delivery").routeByState(
|
|
752
767
|
{
|
|
@@ -803,6 +818,7 @@ ${ctx.input["simplification-plan"]}`
|
|
|
803
818
|
"generate_commit_message",
|
|
804
819
|
...config.publication.happyPath ?? [config.publication.entryTurnId]
|
|
805
820
|
).piConfig(config.workflow?.multiRepository ? {} : { sessionCwdTemplate: "{{{projectKey}}}" }).codecs({ params: config.paramsCodec, state: repositoryChangeStateCodec }).initialState(() => repositoryChangeStateCodec.parse({})).turn(generatePlan).turn({ id: "plan_decision", definition: planDecision }).turn(implement).turn(simplify).turn(applySimplification).turn(generateCommitMessage).use(config.publication.fragment);
|
|
821
|
+
if (prepareDependencies) builder.runtime({ repositorySubmodules: "best_effort" });
|
|
806
822
|
if (config.repositoryCredentials) builder.repositoryCredentials(config.repositoryCredentials);
|
|
807
823
|
if (config.launcher) builder.launcher(config.launcher);
|
|
808
824
|
return {
|
|
@@ -824,4 +840,4 @@ export {
|
|
|
824
840
|
reconciliationPrompt,
|
|
825
841
|
createRepositoryChangeProcess
|
|
826
842
|
};
|
|
827
|
-
//# sourceMappingURL=chunk-
|
|
843
|
+
//# sourceMappingURL=chunk-5M3DTAVU.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/actions.ts","../src/repository-reconciliation.ts","../src/repository-change-process.ts","../src/repository-change-state-internal.ts"],"sourcesContent":["import type { FormDefinition } from \"@leitwerk-dev/process-sdk\";\n\n/** @public */\nexport const codingActionIds = {\n\t/** @public */\n\tapprovePlan: \"approve_plan\",\n\t/** @internal */\n\trequestRevision: \"request_revision\",\n\t/** @internal */\n\trunReview: \"run_review\",\n\t/** @internal */\n\tsimplify: \"simplify\",\n\t/** @internal */\n\tacceptReview: \"accept_review\",\n\t/** @internal */\n\trequestReviewChanges: \"request_review_changes\",\n\t/** @internal */\n\tdismissReview: \"dismiss_review\",\n\t/** @public */\n\tfinalizeChange: \"finalize_change\",\n} as const;\n\nfunction notesForm(id: string, title: string, label: string, description: string): FormDefinition {\n\treturn {\n\t\tid,\n\t\ttitle,\n\t\tfields: [\n\t\t\t{ id: \"message\", label, kind: \"textarea\", primaryPrompt: true, required: true, description },\n\t\t],\n\t\tsubmitLabel: title,\n\t};\n}\n\n/** @internal */\nexport const requestRevisionForm = notesForm(\n\tcodingActionIds.requestRevision,\n\t\"Request revision\",\n\t\"Revision notes\",\n\t\"Instructions for the next implementation pass.\",\n);\n/** @internal */\nexport const requestReviewChangesForm = notesForm(\n\tcodingActionIds.requestReviewChanges,\n\t\"Request review changes\",\n\t\"Review notes\",\n\t\"Instructions for the next review pass.\",\n);\n/** @internal */\nexport const acceptReviewForm: FormDefinition = {\n\tid: codingActionIds.acceptReview,\n\ttitle: \"Accept review\",\n\tfields: [\n\t\t{\n\t\t\tid: \"message\",\n\t\t\tlabel: \"Review adjustment\",\n\t\t\tkind: \"textarea\",\n\t\t\tprimaryPrompt: true,\n\t\t\tdescription:\n\t\t\t\t\"Optional instructions to apply with the accepted review, such as dropping one finding.\",\n\t\t},\n\t],\n\tsubmitLabel: \"Accept review\",\n};\n","import { execFileSync } from \"node:child_process\";\nimport { randomUUID } from \"node:crypto\";\nimport { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from \"node:fs\";\nimport { hostname } from \"node:os\";\nimport { join } from \"node:path\";\nimport { repositoryGitArgs, repositoryGitSubprocessEnv } from \"@leitwerk-dev/process-sdk\";\nimport { resolveGitBinary } from \"@leitwerk-dev/process-sdk/git-binary\";\nimport type { GitIdentity } from \"./finalization-git.js\";\nimport {\n\ttype RepositoryBinding,\n\treadPublicationReceipt,\n\treadRepositoryBinding,\n\trepositoryBindingMatches,\n\tsavePublicationReceipt,\n} from \"./repository-publication-receipt.js\";\nimport { repositoryRecord } from \"./repository-record.js\";\nimport { assertSafeSubmoduleStaging } from \"./submodule-staging.js\";\n\ntype RepositoryLocation = { projectKey: string; repoPath: string };\ntype WorkBranch = RepositoryLocation & { workBranch: string };\ntype ReconciliationInput = WorkBranch & {\n\t/** Last remote baseline, not the latest observation. */\n\tbaselineSha?: string;\n\tbaseBranch?: string;\n\tprotectSubmodules?: boolean;\n\t/** Trusted project identity for replaying unpublished commits. */\n\tgitIdentity?: GitIdentity;\n};\n\n/** @internal */\nexport interface ReconciliationResult {\n\tstatus: \"unchanged\" | \"reconciled\" | \"conflicts\";\n\tremoteHead: string | null;\n\theadSha: string;\n}\n\ninterface RecordState extends RepositoryBinding {\n\tbaseline: string;\n\tremoteSeen?: boolean;\n\tprotectedIgnored?: string[];\n\tpublicationReceiptSha?: string;\n\tjoinParent?: string;\n\tjoinIdentity?: GitIdentity;\n\tsourceIntegration?: { previous: string; replacement: string };\n\toperation?: {\n\t\tid: string;\n\t\thead: string;\n\t\tindex: string;\n\t\twork: string;\n\t\tremote: string;\n\t\ttargetBranch?: string;\n\t\tphase: \"captured\" | \"rebasing\" | \"restoring\";\n\t\tresultHead?: string;\n\t\tresultIndex?: string;\n\t\tidentity?: GitIdentity;\n\t};\n}\n\nfunction repository(input: RepositoryLocation) {\n\tfunction git(args: string[], extra: NodeJS.ProcessEnv = {}): string {\n\t\tconst output = execFileSync(resolveGitBinary(), repositoryGitArgs(args), {\n\t\t\tcwd: input.repoPath,\n\t\t\tencoding: \"utf8\",\n\t\t\tenv: repositoryGitSubprocessEnv(input.projectKey, {\n\t\t\t\tGIT_TERMINAL_PROMPT: \"0\",\n\t\t\t\tGIT_EDITOR: \"true\",\n\t\t\t\tGIT_SEQUENCE_EDITOR: \"true\",\n\t\t\t\t...extra,\n\t\t\t}),\n\t\t\tstdio: [\"ignore\", \"pipe\", \"pipe\"],\n\t\t\tmaxBuffer: 16 * 1024 * 1024,\n\t\t});\n\t\treturn output.endsWith(\"\\0\") ? output : output.replace(/\\r?\\n$/, \"\");\n\t}\n\tconst directory = git([\"rev-parse\", \"--absolute-git-dir\"]);\n\tif (\n\t\tgit([\"remote\", \"get-url\", \"--push\", \"--all\", \"origin\"]) !== git([\"remote\", \"get-url\", \"origin\"])\n\t)\n\t\tthrow new Error(\n\t\t\t\"Repository reconciliation binding changed: fetch and push endpoints must match\",\n\t\t);\n\tconst { read, save } = repositoryRecord<RecordState>(directory, \"reconciliation\");\n\tconst binding = (branch: string) => readRepositoryBinding((...args) => git(args), branch);\n\treturn { git, directory, read, save, binding };\n}\n\nfunction integrationIdentityEnv(identity: GitIdentity | undefined): NodeJS.ProcessEnv {\n\tif (\n\t\t!identity?.name.trim() ||\n\t\t!identity.email.trim() ||\n\t\t/[\\r\\n\\0]/.test(identity.name + identity.email)\n\t)\n\t\tthrow new Error(\n\t\t\t\"A trusted Git identity is required for source integration; local work was retained\",\n\t\t);\n\treturn {\n\t\tGIT_AUTHOR_NAME: identity.name,\n\t\tGIT_AUTHOR_EMAIL: identity.email,\n\t\tGIT_COMMITTER_NAME: identity.name,\n\t\tGIT_COMMITTER_EMAIL: identity.email,\n\t};\n}\n\nfunction ignoredPaths(git: ReturnType<typeof repository>[\"git\"]): string[] {\n\treturn git([\n\t\t\"ls-files\",\n\t\t\"--others\",\n\t\t\"--ignored\",\n\t\t\"--exclude-standard\",\n\t\t\"--directory\",\n\t\t\"--no-empty-directory\",\n\t\t\"-z\",\n\t])\n\t\t.split(\"\\0\")\n\t\t.filter(Boolean)\n\t\t.map((file) => file.replace(/\\/$/, \"\"));\n}\n\nfunction assertIgnoredProtection(\n\tgit: ReturnType<typeof repository>[\"git\"],\n\tprotectedPaths: string[] = [],\n): void {\n\tif (!protectedPaths.length) return;\n\tconst visible = git([\"ls-files\", \"--cached\", \"--others\", \"--exclude-standard\", \"-z\"]).split(\"\\0\");\n\tif (\n\t\tprotectedPaths.some((ignored) =>\n\t\t\tvisible.some((file) => file === ignored || file.startsWith(`${ignored}/`)),\n\t\t)\n\t)\n\t\tthrow new Error(\n\t\t\t\"Previously ignored local files became publishable; review ignore rules before continuing. Local files were retained\",\n\t\t);\n}\n\nfunction ignoredPathsCollide(\n\tgit: ReturnType<typeof repository>[\"git\"],\n\tignored: string[],\n\ttarget: string,\n\treplayRange: string,\n): boolean {\n\tconst paths = [\n\t\t...git([\"ls-tree\", \"-r\", \"--name-only\", \"-z\", target]).split(\"\\0\"),\n\t\t...git([\"log\", \"--format=\", \"--full-history\", \"-m\", \"--name-only\", \"-z\", replayRange]).split(\n\t\t\t\"\\0\",\n\t\t),\n\t];\n\treturn ignored.some((file) =>\n\t\tpaths.some((p) => p === file || p.startsWith(`${file}/`) || file.startsWith(`${p}/`)),\n\t);\n}\n\nfunction ancestor(git: ReturnType<typeof repository>[\"git\"], a: string, b: string): boolean {\n\ttry {\n\t\tgit([\"merge-base\", \"--is-ancestor\", a, b]);\n\t\treturn true;\n\t} catch (error) {\n\t\tif ((error as { status?: number }).status === 1) return false;\n\t\tthrow error;\n\t}\n}\n\nfunction withLock<T>(directory: string, run: () => T): T {\n\tconst lock = join(directory, \"leitwerk-reconciliation.lock\");\n\ttry {\n\t\tmkdirSync(lock);\n\t} catch (error) {\n\t\tif ((error as NodeJS.ErrnoException).code !== \"EEXIST\") throw error;\n\t\t// Never steal a lock from another node or a living process.\n\t\tconst owner = JSON.parse(readFileSync(join(lock, \"owner.json\"), \"utf8\"));\n\t\tif (owner.host !== hostname())\n\t\t\tthrow new Error(\"Repository reconciliation is owned by another worker\");\n\t\ttry {\n\t\t\tprocess.kill(owner.pid, 0);\n\t\t} catch (failure) {\n\t\t\tif ((failure as NodeJS.ErrnoException).code !== \"ESRCH\") throw failure;\n\t\t\trmSync(lock, { recursive: true });\n\t\t\treturn withLock(directory, run);\n\t\t}\n\t\tthrow new Error(\"Repository reconciliation is already running\");\n\t}\n\ttry {\n\t\twriteFileSync(\n\t\t\tjoin(lock, \"owner.json\"),\n\t\t\tJSON.stringify({ host: hostname(), pid: process.pid }),\n\t\t\t{ mode: 0o600 },\n\t\t);\n\t\treturn run();\n\t} finally {\n\t\trmSync(lock, { recursive: true });\n\t}\n}\n\n/**\n * Reconcile unpublished work onto the fetched source or target branch. Checkpoint commits\n * retain the index and working tree separately, including non-ignored untracked files.\n * They are retained under private refs and removed from HEAD before publication.\n * A conflicted rebase is deliberately left in place for the existing adjustment turn.\n */\nfunction reconcile(input: ReconciliationInput, preparing: boolean): ReconciliationResult {\n\tconst { git, directory, read, save, binding: readBinding } = repository(input);\n\treturn withLock(directory, () => {\n\t\tgit([\"check-ref-format\", `refs/heads/${input.workBranch}`]);\n\t\tconst binding = readBinding(input.workBranch);\n\t\tlet record = read();\n\t\tif (!repositoryBindingMatches(record, binding))\n\t\t\tthrow new Error(\"Repository reconciliation binding changed\");\n\t\tconst receipt = readPublicationReceipt(directory);\n\t\tif (!repositoryBindingMatches(receipt, binding))\n\t\t\tthrow new Error(\"Repository publication receipt binding changed\");\n\t\tconst sourceExists = git([\"ls-remote\", \"--heads\", \"origin\", `refs/heads/${input.workBranch}`]);\n\t\tconst unpublished =\n\t\t\t!sourceExists &&\n\t\t\t!input.baselineSha &&\n\t\t\t!record?.remoteSeen &&\n\t\t\t(!receipt || (receipt.status === \"rejected\" && receipt.expectedHead === null));\n\t\tconst target = unpublished ? input.baseBranch : undefined;\n\t\tif (!sourceExists && (!unpublished || (record?.operation && !target)))\n\t\t\tthrow new Error(\n\t\t\t\t\"Remote source branch is missing or its publication is uncertain; local work was retained and the branch will not be recreated automatically\",\n\t\t\t);\n\t\tif (record?.operation && record.operation.targetBranch !== target)\n\t\t\tthrow new Error(\"Repository reconciliation target changed; local work was retained\");\n\t\tassertIgnoredProtection(git, record?.protectedIgnored);\n\t\tif (target) git([\"check-ref-format\", `refs/heads/${target}`]);\n\t\tconst captureBaseline = !record && (preparing || target);\n\t\tconst capturedHead = captureBaseline ? git([\"rev-parse\", \"HEAD\"]) : undefined;\n\t\tconst capturedIgnored = captureBaseline ? ignoredPaths(git) : undefined;\n\t\tif (capturedHead && capturedIgnored) {\n\t\t\tconst baseline = target\n\t\t\t\t? git([\"merge-base\", capturedHead, `refs/remotes/origin/${target}`])\n\t\t\t\t: capturedHead;\n\t\t\trecord = { ...binding, baseline, protectedIgnored: capturedIgnored };\n\t\t\tsave(record);\n\t\t}\n\t\tif (unpublished && !target) {\n\t\t\tconst headSha = capturedHead ?? git([\"rev-parse\", \"HEAD\"]);\n\t\t\treturn { status: \"unchanged\", remoteHead: null, headSha };\n\t\t}\n\t\tif (record?.sourceIntegration) {\n\t\t\tif (git([\"branch\", \"--show-current\"]) !== input.workBranch)\n\t\t\t\tthrow new Error(\"Source integration checkout branch changed; local work was retained\");\n\t\t\tconst { previous, replacement } = record.sourceIntegration;\n\t\t\tconst current = git([\"rev-parse\", \"HEAD\"]);\n\t\t\tif (current === previous)\n\t\t\t\tgit([\"update-ref\", `refs/heads/${input.workBranch}`, replacement, previous]);\n\t\t\telse if (current !== replacement)\n\t\t\t\tthrow new Error(\"Checkout changed during source integration; recovery refs were retained\");\n\t\t\tdelete record.sourceIntegration;\n\t\t\tsave(record);\n\t\t}\n\t\tconst rebaseActive = () =>\n\t\t\t[\"rebase-merge\", \"rebase-apply\"].some((name) => existsSync(join(directory, name)));\n\t\tif (rebaseActive() && !record?.operation)\n\t\t\tthrow new Error(\"An unrelated rebase is already in progress; local work was retained\");\n\t\tif (\n\t\t\texistsSync(join(directory, \"MERGE_HEAD\")) ||\n\t\t\texistsSync(join(directory, \"CHERRY_PICK_HEAD\"))\n\t\t)\n\t\t\tthrow new Error(\"An unrelated Git operation is in progress; local work was retained\");\n\t\tif (!rebaseActive() && git([\"branch\", \"--show-current\"]) !== input.workBranch)\n\t\t\tthrow new Error(`Expected checkout on '${input.workBranch}'; local work was retained`);\n\n\t\tif (!record?.operation) {\n\t\t\tconst ignored = capturedIgnored ?? ignoredPaths(git);\n\t\t\tconst head = capturedHead ?? git([\"rev-parse\", \"HEAD\"]);\n\t\t\tlet baseline =\n\t\t\t\trecord?.baseline ??\n\t\t\t\tinput.baselineSha ??\n\t\t\t\treceipt?.expectedHead ??\n\t\t\t\t(receipt?.status === \"attempting\" ? receipt.candidate : undefined);\n\t\t\tconst cleanOnly = target && preparing;\n\t\t\tif (cleanOnly && (head !== baseline || git([\"status\", \"--porcelain\"])))\n\t\t\t\treturn { status: \"unchanged\", remoteHead: null, headSha: head };\n\t\t\t// A source lease comes from the explicit fetch, not a remote-tracking ref.\n\t\t\tconst ref = target ? `refs/remotes/origin/${target}` : \"refs/leitwerk/reconcile-remote\";\n\t\t\tgit([\n\t\t\t\t\"fetch\",\n\t\t\t\t\"--no-tags\",\n\t\t\t\t...(target ? [\"--refmap=\"] : []),\n\t\t\t\t\"origin\",\n\t\t\t\t`+refs/heads/${target ?? input.workBranch}:${ref}`,\n\t\t\t]);\n\t\t\tconst remote = git([\"rev-parse\", ref]);\n\t\t\tif (!target) {\n\t\t\t\tif (receipt?.status === \"attempting\") {\n\t\t\t\t\tif (!ancestor(git, receipt.candidate, remote))\n\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t\"Prior publication outcome is uncertain; local work was retained for operator reconciliation\",\n\t\t\t\t\t\t);\n\t\t\t\t\treceipt.status = \"accepted\";\n\t\t\t\t\tsavePublicationReceipt(directory, receipt);\n\t\t\t\t}\n\t\t\t\tif (receipt?.status === \"accepted\" && record?.publicationReceiptSha !== receipt.candidate)\n\t\t\t\t\tbaseline = receipt.candidate;\n\t\t\t}\n\t\t\tif (!baseline)\n\t\t\t\tthrow new Error(\"Cannot establish the retained work baseline; local work was retained\");\n\t\t\tgit([\"cat-file\", \"-e\", `${baseline}^{commit}`]);\n\t\t\tif (target && !ancestor(git, baseline, remote))\n\t\t\t\tthrow new Error(\"The target branch was rewritten; local work was retained\");\n\t\t\tif (!ancestor(git, baseline, head))\n\t\t\t\tthrow new Error(\n\t\t\t\t\t\"Cannot establish unpublished work from the retained baseline; local work was retained\",\n\t\t\t\t);\n\t\t\trecord = {\n\t\t\t\t...record,\n\t\t\t\t...binding,\n\t\t\t\tbaseline,\n\t\t\t\tremoteSeen: !target,\n\t\t\t\tprotectedIgnored: [...new Set([...(record?.protectedIgnored ?? []), ...ignored])],\n\t\t\t\tpublicationReceiptSha:\n\t\t\t\t\treceipt?.status === \"accepted\" ? receipt.candidate : record?.publicationReceiptSha,\n\t\t\t};\n\t\t\tconst upToDate = target\n\t\t\t\t? ancestor(git, remote, head)\n\t\t\t\t: remote === baseline || remote === head;\n\t\t\tif (\n\t\t\t\t(!upToDate || record.joinParent) &&\n\t\t\t\tignoredPathsCollide(git, ignored, remote, `${baseline}..${head}`)\n\t\t\t)\n\t\t\t\tthrow new Error(\"Remote changes collide with ignored files; local files were retained\");\n\t\t\tif ((upToDate && !record.joinParent) || cleanOnly) {\n\t\t\t\tif (!upToDate) git([\"merge\", \"--ff-only\", \"--no-overwrite-ignore\", remote]);\n\t\t\t\trecord.baseline = remote;\n\t\t\t\tsave(record);\n\t\t\t\tif (!upToDate) assertIgnoredProtection(git, record.protectedIgnored);\n\t\t\t\treturn {\n\t\t\t\t\tstatus: upToDate ? \"unchanged\" : \"reconciled\",\n\t\t\t\t\tremoteHead: target ? null : remote,\n\t\t\t\t\theadSha: upToDate ? head : remote,\n\t\t\t\t};\n\t\t\t}\n\t\t\tif (git([\"diff\", \"--name-only\", \"--diff-filter=U\"]))\n\t\t\t\tthrow new Error(\"Unresolved local conflicts must be repaired before reconciliation\");\n\t\t\tif (input.protectSubmodules) assertSafeSubmoduleStaging(git);\n\t\t\t// Dirty submodule work cannot be represented by the parent's tree checkpoint.\n\t\t\tif (git([\"submodule\", \"foreach\", \"--quiet\", \"git status --porcelain\"]))\n\t\t\t\tthrow new Error(\"Commit or preserve dirty submodule work before reconciliation\");\n\t\t\t// A verified remote descendant already contains these local commits, including\n\t\t\t// publication that succeeded before its receipt reached the server.\n\t\t\tif (ancestor(git, head, remote)) record.baseline = head;\n\t\t\tconst id = randomUUID();\n\t\t\tconst temporaryIndex = join(directory, `leitwerk-index-${id}`);\n\t\t\tconst identity = {\n\t\t\t\tGIT_AUTHOR_NAME: \"Leitwerk checkpoint\",\n\t\t\t\tGIT_AUTHOR_EMAIL: \"checkpoint@leitwerk.invalid\",\n\t\t\t\tGIT_COMMITTER_NAME: \"Leitwerk checkpoint\",\n\t\t\t\tGIT_COMMITTER_EMAIL: \"checkpoint@leitwerk.invalid\",\n\t\t\t};\n\t\t\ttry {\n\t\t\t\tconst stagedTree = git([\"write-tree\"]);\n\t\t\t\tconst index = git(\n\t\t\t\t\t[\"commit-tree\", stagedTree, \"-p\", head, \"-m\", `Leitwerk index checkpoint ${id}`],\n\t\t\t\t\tidentity,\n\t\t\t\t);\n\t\t\t\tgit([\"read-tree\", stagedTree], { GIT_INDEX_FILE: temporaryIndex });\n\t\t\t\tgit([\"add\", \"--all\"], { GIT_INDEX_FILE: temporaryIndex });\n\t\t\t\tconst workTree = git([\"write-tree\"], { GIT_INDEX_FILE: temporaryIndex });\n\t\t\t\tconst work = git(\n\t\t\t\t\t[\"commit-tree\", workTree, \"-p\", index, \"-m\", `Leitwerk worktree checkpoint ${id}`],\n\t\t\t\t\tidentity,\n\t\t\t\t);\n\t\t\t\t// Reachability and journal precede every change to the checkout.\n\t\t\t\tgit([\"update-ref\", `refs/leitwerk/checkpoints/${id}`, work]);\n\t\t\t\tconst replayIdentity = record.joinIdentity ?? input.gitIdentity;\n\t\t\t\tif (replayIdentity || record.baseline !== head) integrationIdentityEnv(replayIdentity);\n\t\t\t\trecord.operation = {\n\t\t\t\t\tid,\n\t\t\t\t\thead,\n\t\t\t\t\tindex,\n\t\t\t\t\twork,\n\t\t\t\t\tremote,\n\t\t\t\t\ttargetBranch: target,\n\t\t\t\t\tphase: \"captured\",\n\t\t\t\t\tidentity: replayIdentity,\n\t\t\t\t};\n\t\t\t\tsave(record);\n\t\t\t} finally {\n\t\t\t\trmSync(temporaryIndex, { force: true });\n\t\t\t}\n\t\t}\n\t\tconst operation = record.operation;\n\t\tif (!operation) throw new Error(\"Missing reconciliation checkpoint\");\n\t\tif (operation.phase === \"captured\") {\n\t\t\tif (operation.identity || record.baseline !== operation.head)\n\t\t\t\tintegrationIdentityEnv(operation.identity);\n\t\t\tconst current = git([\"rev-parse\", \"HEAD\"]);\n\t\t\tconst indexTree = git([\"write-tree\"]);\n\t\t\tif (\n\t\t\t\t![operation.head, operation.work].includes(current) ||\n\t\t\t\t![\n\t\t\t\t\tgit([\"rev-parse\", `${operation.index}^{tree}`]),\n\t\t\t\t\tgit([\"rev-parse\", `${operation.work}^{tree}`]),\n\t\t\t\t].includes(indexTree)\n\t\t\t)\n\t\t\t\tthrow new Error(\n\t\t\t\t\t\"Checkout changed after its checkpoint; new local work and recovery refs were retained\",\n\t\t\t\t);\n\t\t\t// read-tree changes only the index; the worktree already has this exact tree.\n\t\t\tgit([\"read-tree\", operation.work]);\n\t\t\tif (current !== operation.work)\n\t\t\t\tgit([\"update-ref\", `refs/heads/${input.workBranch}`, operation.work, operation.head]);\n\t\t\toperation.phase = \"rebasing\";\n\t\t\tsave(record);\n\t\t}\n\t\tif (operation.phase === \"rebasing\") {\n\t\t\tconst conflicts = (): ReconciliationResult => ({\n\t\t\t\tstatus: \"conflicts\",\n\t\t\t\tremoteHead: target ? null : operation.remote,\n\t\t\t\theadSha: git([\"rev-parse\", \"HEAD\"]),\n\t\t\t});\n\t\t\tif (rebaseActive()) return conflicts();\n\t\t\t// Retry after Git completed the rebase but before the result was journaled.\n\t\t\tif (git([\"rev-parse\", \"HEAD\"]) === operation.work) {\n\t\t\t\ttry {\n\t\t\t\t\tgit(\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\"-c\",\n\t\t\t\t\t\t\t\"commit.gpgSign=false\",\n\t\t\t\t\t\t\t\"rebase\",\n\t\t\t\t\t\t\t\"--rebase-merges\",\n\t\t\t\t\t\t\t\"--reapply-cherry-picks\",\n\t\t\t\t\t\t\t\"--empty=keep\",\n\t\t\t\t\t\t\t\"--onto\",\n\t\t\t\t\t\t\toperation.remote,\n\t\t\t\t\t\t\trecord.baseline,\n\t\t\t\t\t\t],\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tGIT_COMMITTER_NAME: operation.identity?.name ?? \"Leitwerk checkpoint\",\n\t\t\t\t\t\t\tGIT_COMMITTER_EMAIL: operation.identity?.email ?? \"checkpoint@leitwerk.invalid\",\n\t\t\t\t\t\t},\n\t\t\t\t\t);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tif (!rebaseActive()) throw error;\n\t\t\t\t\treturn conflicts();\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (\n\t\t\t\tgit([\"log\", \"-1\", \"--format=%s\"]) !== `Leitwerk worktree checkpoint ${operation.id}` ||\n\t\t\t\tgit([\"log\", \"-1\", \"--format=%s\", \"HEAD^\"]) !== `Leitwerk index checkpoint ${operation.id}`\n\t\t\t)\n\t\t\t\tthrow new Error(\n\t\t\t\t\t\"Reconciliation checkpoint commits were changed or skipped; recovery refs were retained\",\n\t\t\t\t);\n\t\t\toperation.resultHead = git([\"rev-parse\", \"HEAD~2\"]);\n\t\t\toperation.resultIndex = git([\"rev-parse\", \"HEAD~1^{tree}\"]);\n\t\t\t// Preserve the integrated working tree/index before removing checkpoint commits.\n\t\t\tgit([\"update-ref\", `refs/leitwerk/reconciled/${operation.id}`, git([\"rev-parse\", \"HEAD\"])]);\n\t\t\toperation.phase = \"restoring\";\n\t\t\tsave(record);\n\t\t}\n\t\tif (!operation.resultHead || !operation.resultIndex)\n\t\t\tthrow new Error(\"Incomplete reconciliation result\");\n\t\tif (record.joinParent && !ancestor(git, record.joinParent, operation.resultHead)) {\n\t\t\t// The net repair was replayed against the current source. Retain the target\n\t\t\t// ancestry without re-merging (and thereby losing the replayed resolution).\n\t\t\toperation.resultHead = git(\n\t\t\t\t[\n\t\t\t\t\t\"commit-tree\",\n\t\t\t\t\tgit([\"rev-parse\", `${operation.resultHead}^{tree}`]),\n\t\t\t\t\t\"-p\",\n\t\t\t\t\toperation.resultHead,\n\t\t\t\t\t\"-p\",\n\t\t\t\t\trecord.joinParent,\n\t\t\t\t\t\"-m\",\n\t\t\t\t\t\"Integrate target branch with concurrent source changes\",\n\t\t\t\t],\n\t\t\t\tintegrationIdentityEnv(record.joinIdentity),\n\t\t\t);\n\t\t\tgit([\n\t\t\t\t\"update-ref\",\n\t\t\t\t`refs/leitwerk/target-integrations/${operation.id}`,\n\t\t\t\toperation.resultHead,\n\t\t\t]);\n\t\t\tsave(record);\n\t\t}\n\t\tconst integrated = git([\"rev-parse\", `refs/leitwerk/reconciled/${operation.id}`]);\n\t\tconst currentHead = git([\"rev-parse\", \"HEAD\"]);\n\t\tconst currentIndex = git([\"write-tree\"]);\n\t\tif (\n\t\t\t![operation.resultHead, integrated].includes(currentHead) ||\n\t\t\t![operation.resultIndex, git([\"rev-parse\", `${integrated}^{tree}`])].includes(currentIndex)\n\t\t)\n\t\t\tthrow new Error(\n\t\t\t\t\"Checkout changed during interrupted restoration; local work and recovery refs were retained\",\n\t\t\t);\n\t\tgit([\"update-ref\", `refs/heads/${input.workBranch}`, operation.resultHead, currentHead]);\n\t\tgit([\"read-tree\", operation.resultIndex]);\n\t\trecord.baseline = operation.remote;\n\t\tdelete record.operation;\n\t\tdelete record.joinParent;\n\t\tdelete record.joinIdentity;\n\t\tsave(record);\n\t\tassertIgnoredProtection(git, record.protectedIgnored);\n\t\treturn {\n\t\t\tstatus: \"reconciled\",\n\t\t\tremoteHead: target ? null : operation.remote,\n\t\t\theadSha: operation.resultHead,\n\t\t};\n\t});\n}\n\n/** Reject ignored-file collisions before a target checkout/rebase can overwrite them. @internal */\nexport function assertReconciliationTargetSafe(input: RepositoryLocation, targetSha: string): void {\n\tconst { git, read } = repository(input);\n\tassertIgnoredProtection(git, read()?.protectedIgnored);\n\tif (ignoredPathsCollide(git, ignoredPaths(git), targetSha, `${targetSha}..HEAD`))\n\t\tthrow new Error(\"Target changes collide with ignored files; local files were retained\");\n}\n\n/** Preserve a target rebase as a net local delta when its source lease changes. @internal */\nexport function retainConcurrentRebase(\n\tinput: WorkBranch & {\n\t\tbaselineSha: string;\n\t\trebasedHead: string;\n\t\ttargetBase: string;\n\t\tgitIdentity: GitIdentity;\n\t},\n): void {\n\tconst { git, directory, read, save, binding: readBinding } = repository(input);\n\twithLock(directory, () => {\n\t\tconst old = read();\n\t\tif (old?.operation || old?.sourceIntegration)\n\t\t\tthrow new Error(\"Source reconciliation is already in progress\");\n\t\tif (\n\t\t\tgit([\"branch\", \"--show-current\"]) !== input.workBranch ||\n\t\t\tgit([\"rev-parse\", \"HEAD\"]) !== input.rebasedHead ||\n\t\t\tgit([\"status\", \"--porcelain\"])\n\t\t)\n\t\t\tthrow new Error(\n\t\t\t\t\"Target rebase changed before source reconciliation; local work was retained\",\n\t\t\t);\n\t\tconst binding = readBinding(input.workBranch);\n\t\tif (!repositoryBindingMatches(old, binding))\n\t\t\tthrow new Error(\"Repository reconciliation binding changed\");\n\t\tconst identity = integrationIdentityEnv(input.gitIdentity);\n\t\tconst id = randomUUID();\n\t\tgit([\"update-ref\", `refs/leitwerk/target-repairs/${id}`, input.rebasedHead]);\n\t\tconst replacement = git(\n\t\t\t[\n\t\t\t\t\"commit-tree\",\n\t\t\t\tgit([\"rev-parse\", `${input.rebasedHead}^{tree}`]),\n\t\t\t\t\"-p\",\n\t\t\t\tinput.baselineSha,\n\t\t\t\t\"-m\",\n\t\t\t\t\"Reconcile target-branch repair\",\n\t\t\t],\n\t\t\tidentity,\n\t\t);\n\t\tgit([\"update-ref\", `refs/leitwerk/target-deltas/${id}`, replacement]);\n\t\t// The original source tree is the merge baseline, not the old target branch.\n\t\t// This preserves developer deletions as well as the agent's conflict resolution.\n\t\tsave({\n\t\t\t...binding,\n\t\t\tbaseline: input.baselineSha,\n\t\t\tremoteSeen: true,\n\t\t\tjoinParent: input.targetBase,\n\t\t\tjoinIdentity: input.gitIdentity,\n\t\t\tprotectedIgnored: old?.protectedIgnored,\n\t\t\tpublicationReceiptSha: old?.publicationReceiptSha,\n\t\t\tsourceIntegration: { previous: input.rebasedHead, replacement },\n\t\t});\n\t});\n}\n\n/** @internal */\nexport function repositoryWorktreeIsDirty(input: RepositoryLocation): boolean {\n\treturn Boolean(repository(input).git([\"status\", \"--porcelain\"]));\n}\n\n/** Capture the baseline before the first implementation, including an unpublished branch. @internal */\nexport function prepareInitialRepository(\n\tinput: Omit<ReconciliationInput, \"baselineSha\">,\n): ReconciliationResult {\n\treturn reconcile(input, true);\n}\n\n/** Missing branches are allowed only before first publication. @internal */\nexport function reconcilePublicationRepository(input: ReconciliationInput): ReconciliationResult {\n\treturn reconcile(input, false);\n}\n\n/** Record only a remotely verified publication, including recovery after a lost reply. @internal */\nexport function recordRepositoryPublication(input: WorkBranch, headSha: string): void {\n\tconst { directory, read, save, binding: readBinding } = repository(input);\n\twithLock(directory, () => {\n\t\tconst old = read();\n\t\tif (old?.operation) throw new Error(\"Cannot acknowledge publication during reconciliation\");\n\t\tconst binding = readBinding(input.workBranch);\n\t\tif (!repositoryBindingMatches(old, binding))\n\t\t\tthrow new Error(\"Repository reconciliation binding changed\");\n\t\tsave({\n\t\t\t...binding,\n\t\t\tbaseline: headSha,\n\t\t\tpublicationReceiptSha: headSha,\n\t\t\tremoteSeen: true,\n\t\t\tprotectedIgnored: old?.protectedIgnored,\n\t\t});\n\t});\n}\n\n/** @internal */\nexport const reconciliationPrompt = `Repository synchronization preserves the current remote source branch and unpublished local work. If preparation left a rebase in progress, inspect git status and .git/leitwerk-reconciliation.json. Resolve conflicts preserving both intended changes and the original authors/sign-offs, then git add and GIT_EDITOR=true git rebase --continue until complete. Use the captured operation.identity for the committer when continuing, if present. Do not skip commits, remove the two Leitwerk checkpoint commits, reset, abort, or push. Checkpoint commits will be removed automatically by delivery; do not amend them. After resolving, finish with the turn's required success outcome so delivery can restore the ordinary checkout and request validation. If blocked, use cannot_repair when available or abort_turn otherwise, and retain the checkout. When no rebase is active, perform the requested adjustment and validate the combined result against the current repository instructions before the required success outcome. Never publish without validation after reconciliation.`;\n","import { asUnknownRecord, trimString as normalizeMessage } from \"@leitwerk-dev/domain\";\nimport {\n\ttype Codec,\n\ttype ExternalActionSource,\n\ttype FlowFragmentBuilder,\n\ttype FormDefinition,\n\tflow,\n\thumanTurn,\n\ttype ProcessLauncherDefinition,\n\ttype RepositoryCredentialProject,\n\ttype RepositoryCredentialRequirement,\n\trevisionAction,\n} from \"@leitwerk-dev/process-sdk\";\nimport { codingActionIds, requestRevisionForm } from \"./actions.js\";\nimport {\n\ttype RepositoryChangeState,\n\trepositoryChangeStateCodec,\n} from \"./repository-change-state-internal.js\";\nimport { prepareInitialRepository, reconciliationPrompt } from \"./repository-reconciliation.js\";\nimport { codingPurposes } from \"./settings.js\";\nimport { prepareSubmodules } from \"./submodule-staging.js\";\nimport { prepareRepositoryCommitMessageEvidence } from \"./turns/commit-message-evidence.js\";\nimport {\n\tbuildRepositoryCommitMessagesPrompt,\n\tparseRepositoryCommitMessages,\n} from \"./turns/generate-commit-message.js\";\nimport { buildGeneratePlanPrompt } from \"./turns/generate-plan.js\";\nimport { buildImplementPrompt } from \"./turns/implement.js\";\nimport { buildStreamlinedSimplificationPrompt } from \"./turns/simplify-implementation.js\";\n\n/** @public */\nexport type RepositoryChangeParams = object;\n\n/** Server-side policies evaluated at the route boundary. @public */\nexport interface RepositoryChangeWorkflow<TParams> {\n\t/** @deprecated All repository changes use the streamlined graph. @public */\n\tvariant?: \"streamlined\";\n\t/** @public */\n\tmultiRepository?: boolean;\n\t/** Refresh a clean, unpublished checkout against its target before implementation. @public */\n\trefreshTargetBeforeImplementation?: boolean;\n\t/** @public */\n\tplanDecision?(params: TParams): Promise<{\n\t\t/** @internal */\n\t\tskip: boolean;\n\t\t/** @internal */\n\t\treason: string;\n\t}>;\n\t/** @public */\n\tsimplification?(params: TParams): Promise<{\n\t\t/** @internal */\n\t\tskip: boolean;\n\t\t/** @internal */\n\t\treason: string;\n\t}>;\n\t/** Must recheck the current revision and source before firing. @public */\n\tplanBypassSource?: ExternalActionSource<TParams, RepositoryChangeState, unknown>;\n}\n\n/** @public */\nexport interface RepositoryChangeProcessConfig<TParams extends RepositoryChangeParams> {\n\t/** @public */\n\tprocessId: string;\n\t/** @public */\n\tdisplayName: string;\n\t/** @public */\n\tworkflow?: RepositoryChangeWorkflow<TParams>;\n\t/** @public */\n\tparamsCodec: Codec<TParams>;\n\t/** @public */\n\tlauncher?: ProcessLauncherDefinition<TParams>;\n\t/** @deprecated Publication follows implementation automatically. @public */\n\tfinalizeLabel?: string;\n\t/** @deprecated Publication follows implementation automatically. @public */\n\tfinalizeForm?: FormDefinition;\n\t/** @public */\n\trepositoryCredentials?(input: {\n\t\t/** @public */\n\t\tparams: TParams;\n\t\t/** @internal */\n\t\tprojects: readonly RepositoryCredentialProject[];\n\t}): readonly RepositoryCredentialRequirement[];\n\t/** @public */\n\tpublication: {\n\t\t/** @public */\n\t\tentryTurnId: string;\n\t\t/** @public */\n\t\tfragment: FlowFragmentBuilder<TParams, RepositoryChangeState>;\n\t\t/** @public */\n\t\thappyPath?: readonly string[];\n\t\t/** @internal */\n\t\tprepareSubmodules?: boolean;\n\t};\n}\n\n/** @public */\nexport function createRepositoryChangeProcess<TParams extends RepositoryChangeParams>(\n\tconfig: RepositoryChangeProcessConfig<TParams>,\n) {\n\tconst tools = [\"read\", \"bash\", \"edit\", \"write\"] as const;\n\tconst planDecision = humanTurn<TParams, RepositoryChangeState>({\n\t\tdescription: \"Review Plan\",\n\t\treviewSemanticRef: \"plan\",\n\t\tnotesFields: [\n\t\t\t{\n\t\t\t\tid: \"message\",\n\t\t\t\tlabel: \"Revision notes\",\n\t\t\t\tplaceholder: \"Describe what the next plan revision should improve\",\n\t\t\t\trequired: true,\n\t\t\t},\n\t\t],\n\t\tcommentary: \"Approve this plan or request a revision with comments.\",\n\t\tactions: {\n\t\t\t[codingActionIds.approvePlan]: {\n\t\t\t\tlabel: \"Approve plan\",\n\t\t\t\tdescription: \"Accept the current plan and continue into implementation.\",\n\t\t\t\tacceptanceState: \"accepted\",\n\t\t\t\tto: \"implement\",\n\t\t\t\teffect: ({ ctx }) => {\n\t\t\t\t\tif (!ctx.state.semanticEntryRefs.plan?.turnRecordId?.trim())\n\t\t\t\t\t\tthrow new Error(\"No plan is available for approval\");\n\t\t\t\t\treturn {\n\t\t\t\t\t\temit: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: \"plan_approved\",\n\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\texternalId: ctx.process.externalId,\n\t\t\t\t\t\t\t\t\tplanRevision: ctx.process.planRevision,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t};\n\t\t\t\t},\n\t\t\t},\n\t\t\t[codingActionIds.requestRevision]: revisionAction({\n\t\t\t\tlabel: \"Request revision\",\n\t\t\t\tdescription: \"Send the plan back for another draft revision.\",\n\t\t\t\tacceptanceState: \"requires_changes\",\n\t\t\t\tform: requestRevisionForm,\n\t\t\t\tschedulable: true,\n\t\t\t\tto: \"generate_plan\",\n\t\t\t\tqueueTarget: { semanticRef: \"currentPrimaryPathLeaf\" },\n\t\t\t\teffect: ({ input }) => ({\n\t\t\t\t\temit: [\n\t\t\t\t\t\t{ type: \"plan_revision_requested\", data: { message: normalizeMessage(input.message) } },\n\t\t\t\t\t],\n\t\t\t\t}),\n\t\t\t}),\n\t\t},\n\t});\n\tif (config.workflow?.planBypassSource)\n\t\tplanDecision.externalActions = {\n\t\t\tbypass_plan: {\n\t\t\t\tid: \"bypass_plan\",\n\t\t\t\tlabel: \"Skip plan approval\",\n\t\t\t\tsource: config.workflow.planBypassSource,\n\t\t\t\tto: \"implement\",\n\t\t\t\teffect: ({ state, process, event }) => {\n\t\t\t\t\tif ((event as { planRevision?: number }).planRevision !== process.planRevision)\n\t\t\t\t\t\tthrow new Error(\"Stale plan bypass event\");\n\t\t\t\t\treturn {\n\t\t\t\t\t\tstate: {\n\t\t\t\t\t\t\t...state,\n\t\t\t\t\t\t\trouting: {\n\t\t\t\t\t\t\t\t...state.routing,\n\t\t\t\t\t\t\t\tplan: { planRevision: process.planRevision, skip: true, reason: \"Jira label\" },\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\temit: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: \"plan_approved\" as const,\n\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\tplanRevision: process.planRevision,\n\t\t\t\t\t\t\t\t\tactor: \"system\",\n\t\t\t\t\t\t\t\t\tbypassed: true,\n\t\t\t\t\t\t\t\t\treason: \"Jira label\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t};\n\t\t\t\t},\n\t\t\t},\n\t\t};\n\n\tconst generatePlan = flow\n\t\t.llm<TParams, RepositoryChangeState>(\"generate_plan\")\n\t\t.description(\"Plan\")\n\t\t.executionPurpose(codingPurposes.planning)\n\t\t.tools(\"read\", \"bash\")\n\t\t.askQuestions()\n\t\t.freshPrimary()\n\t\t.buildPrompt(buildGeneratePlanPrompt)\n\t\t.outcomeTool(\"plan_saved\", (tool) =>\n\t\t\ttool\n\t\t\t\t.description(\n\t\t\t\t\t\"Save a finished, implementable plan after resolving design-critical questions. Required investigation and access must be complete. If blocked, use abort_turn. Use ask_questions for operator decisions when available; otherwise decide within the requested scope and document assumptions.\",\n\t\t\t\t)\n\t\t\t\t.requiredString(\"summary\", \"One concise sentence summarizing the proposed plan\")\n\t\t\t\t.requiredStringArray(\n\t\t\t\t\t\"acceptanceCriteria\",\n\t\t\t\t\t\"Requested outcomes for the repository change, without expanding scope\",\n\t\t\t\t)\n\t\t\t\t.routeByState(\n\t\t\t\t\t{\n\t\t\t\t\t\tapproval: {\n\t\t\t\t\t\t\tto: \"plan_decision\",\n\t\t\t\t\t\t\tlabel: \"Approval required\",\n\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t\"When the process policy requires an operator to approve the saved plan.\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\tbypass: {\n\t\t\t\t\t\t\tto: \"implement\",\n\t\t\t\t\t\t\tlabel: \"Skip plan approval\",\n\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t\"When the process policy skips plan approval, for example through the Skip plan approval launcher option.\",\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\t({ ctx }) => (ctx.state.routing?.plan?.skip ? \"bypass\" : \"approval\"),\n\t\t\t\t)\n\t\t\t\t.effect(async ({ ctx, event }) => {\n\t\t\t\t\tconst planRevision = ctx.process.planRevision + 1;\n\t\t\t\t\tconst policy = (await config.workflow\n\t\t\t\t\t\t?.planDecision?.(ctx.params)\n\t\t\t\t\t\t.catch(() => ({ skip: false, reason: \"Source unavailable; approval required\" }))) ?? {\n\t\t\t\t\t\tskip: false,\n\t\t\t\t\t\treason: \"Human approval required\",\n\t\t\t\t\t};\n\t\t\t\t\tconst summary = normalizeMessage(event.params.summary);\n\t\t\t\t\tconst acceptanceCriteria = Array.isArray(event.params.acceptanceCriteria)\n\t\t\t\t\t\t? event.params.acceptanceCriteria.filter(\n\t\t\t\t\t\t\t\t(entry): entry is string => typeof entry === \"string\" && entry.trim() !== \"\",\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t: [];\n\t\t\t\t\treturn {\n\t\t\t\t\t\tstate: {\n\t\t\t\t\t\t\t...ctx.state,\n\t\t\t\t\t\t\trouting: { ...ctx.state.routing, plan: { ...policy, planRevision } },\n\t\t\t\t\t\t},\n\t\t\t\t\t\tprocessPatch: { planRevision },\n\t\t\t\t\t\tbroadcasts: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: \"plan.updated\",\n\t\t\t\t\t\t\t\tpayload: {\n\t\t\t\t\t\t\t\t\tplanRevision,\n\t\t\t\t\t\t\t\t\treviewState: policy.skip ? \"accepted\" : \"awaiting_approval\",\n\t\t\t\t\t\t\t\t\tapproved: policy.skip,\n\t\t\t\t\t\t\t\t\tsummary,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t\temit: [\n\t\t\t\t\t\t\t...(policy.skip\n\t\t\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\ttype: \"plan_approved\" as const,\n\t\t\t\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\t\t\t\tplanRevision,\n\t\t\t\t\t\t\t\t\t\t\t\tactor: \"system\",\n\t\t\t\t\t\t\t\t\t\t\t\tbypassed: true,\n\t\t\t\t\t\t\t\t\t\t\t\treason: policy.reason,\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t: []),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: \"plan_saved\",\n\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\tplanRevision,\n\t\t\t\t\t\t\t\t\tsummary,\n\t\t\t\t\t\t\t\t\tplanMarkdown: ctx.output?.content ?? \"\",\n\t\t\t\t\t\t\t\t\tacceptanceCriteria,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t};\n\t\t\t\t}),\n\t\t)\n\t\t.publish(\"plan\");\n\tconst refreshTarget = config.workflow?.refreshTargetBeforeImplementation;\n\tconst prepareDependencies = config.publication.prepareSubmodules;\n\tconst implement = flow\n\t\t.llm<TParams, RepositoryChangeState>(\"implement\")\n\t\t.description(\"Implement\")\n\t\t.waitFor(({ state }) => !!state.productRefs.plan)\n\t\t.executionPurpose(codingPurposes.implementation)\n\t\t.tools(...tools)\n\t\t.freshSeededPrimary()\n\t\t.startFromRoot()\n\t\t.consume(\"plan\")\n\t\t.prepare(async (ctx) => {\n\t\t\tconst submoduleWarnings: string[] = [];\n\t\t\tfor (const repo of ctx.repo.all()) {\n\t\t\t\tconst identity = asUnknownRecord(\n\t\t\t\t\tctx.projects.find((p) => p.key === repo.key)?.metadata?.[\"leitwerk.gitIdentity\"],\n\t\t\t\t);\n\t\t\t\tconst result = prepareInitialRepository({\n\t\t\t\t\tprojectKey: repo.key,\n\t\t\t\t\trepoPath: repo.fsPath,\n\t\t\t\t\tworkBranch: repo.workBranch,\n\t\t\t\t\tbaseBranch: refreshTarget ? repo.baseBranch : undefined,\n\t\t\t\t\tprotectSubmodules: prepareDependencies,\n\t\t\t\t\tgitIdentity:\n\t\t\t\t\t\ttypeof identity?.name === \"string\" && typeof identity.email === \"string\"\n\t\t\t\t\t\t\t? { name: identity.name, email: identity.email }\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t});\n\t\t\t\tif (prepareDependencies && result.status !== \"conflicts\") {\n\t\t\t\t\tconst warning = await prepareSubmodules(repo, ctx);\n\t\t\t\t\tif (warning) submoduleWarnings.push(warning);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn { submoduleWarnings };\n\t\t})\n\t\t.buildPrompt((ctx) =>\n\t\t\t[\n\t\t\t\tbuildImplementPrompt(ctx, refreshTarget),\n\t\t\t\treconciliationPrompt,\n\t\t\t\t...(ctx.prepared?.submoduleWarnings ?? []),\n\t\t\t].join(\"\\n\\n\"),\n\t\t)\n\t\t.outcomeTool(\"implementation_ready\", (tool) =>\n\t\t\ttool\n\t\t\t\t.description(\"Implementation and checks are complete; continue to delivery\")\n\t\t\t\t.routeByState(\n\t\t\t\t\t{\n\t\t\t\t\t\tsimplify: {\n\t\t\t\t\t\t\tto: \"simplify_implementation\",\n\t\t\t\t\t\t\tlabel: \"Simplification enabled\",\n\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t\"When the process policy enables simplification. This is the default unless a launcher option or source policy skips it.\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\tskip: {\n\t\t\t\t\t\t\tto: \"generate_commit_message\",\n\t\t\t\t\t\t\tlabel: \"Skip simplification\",\n\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t\"When simplification is skipped, for example through the Skip simplification launcher option or the leitwerk-skip-simplification source label.\",\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\t({ ctx }) => (ctx.state.routing?.simplification?.skip ? \"skip\" : \"simplify\"),\n\t\t\t\t)\n\t\t\t\t.effect(async ({ ctx }) => ({\n\t\t\t\t\tstate: {\n\t\t\t\t\t\t...ctx.state,\n\t\t\t\t\t\trouting: {\n\t\t\t\t\t\t\t...ctx.state.routing,\n\t\t\t\t\t\t\tsimplification: ctx.state.routing?.simplification ??\n\t\t\t\t\t\t\t\t(await config.workflow?.simplification?.(ctx.params)) ?? {\n\t\t\t\t\t\t\t\t\tskip: false,\n\t\t\t\t\t\t\t\t\treason: \"Simplification enabled by default\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t})),\n\t\t)\n\t\t.publish(\"implementation-summary\");\n\tconst simplify = flow\n\t\t.llm<TParams, RepositoryChangeState>(\"simplify_implementation\")\n\t\t.description(\"Simplify\")\n\t\t.executionPurpose(codingPurposes.review)\n\t\t.tools(\"read\", \"bash\")\n\t\t.rootBranchReview()\n\t\t.startFromProductBranch(\"simplification-plan\")\n\t\t.buildPrompt(buildStreamlinedSimplificationPrompt)\n\t\t.publish(\"simplification-plan\")\n\t\t.to(\"apply_simplification\");\n\tconst applySimplification = flow\n\t\t.llm<TParams, RepositoryChangeState>(\"apply_simplification\")\n\t\t.description(\"Apply simplification\")\n\t\t.executionPurpose(codingPurposes.implementation)\n\t\t.tools(...tools)\n\t\t.freshSeededPrimary()\n\t\t.consume(\"plan\")\n\t\t.consume(\"simplification-plan\")\n\t\t.buildPrompt(\n\t\t\t(\n\t\t\t\tctx,\n\t\t\t) => `Apply justified simplifications to each repository, preserving the accepted plan and behavior. Rerun the required checks. Empty findings require no edits. Leave changes uncommitted for delivery.\n\nAccepted plan:\n${ctx.input.plan}\n\nFindings by repository:\n${ctx.input[\"simplification-plan\"]}`,\n\t\t)\n\t\t.publish(\"implementation-summary\")\n\t\t.to(\"generate_commit_message\");\n\tconst generateCommitMessage = flow\n\t\t.llm<TParams, RepositoryChangeState>(\"generate_commit_message\")\n\t\t.description(\"Write Commit Message\")\n\t\t.executionPurpose(codingPurposes.implementation)\n\t\t.tools(\"read\", \"grep\", \"find\", \"ls\")\n\t\t.rootBranchReview()\n\t\t.startFromRoot()\n\t\t.consume(\"plan\")\n\t\t.consume(\"implementation-summary\")\n\t\t.prepare(prepareRepositoryCommitMessageEvidence)\n\t\t.buildPrompt(buildRepositoryCommitMessagesPrompt)\n\t\t.publish(\"commit-message\")\n\t\t.to(config.publication.entryTurnId)\n\t\t.state(({ ctx }) => ({\n\t\t\t...ctx.state,\n\t\t\tfinalization: {\n\t\t\t\t...ctx.state.finalization,\n\t\t\t\tcommitMessages: parseRepositoryCommitMessages(\n\t\t\t\t\tctx.output?.content,\n\t\t\t\t\tctx.projects.map((p) => p.key),\n\t\t\t\t),\n\t\t\t},\n\t\t}));\n\tconst builder = flow\n\t\t.process<TParams, RepositoryChangeState>(config.processId)\n\t\t.displayName(config.displayName)\n\t\t.entry(\"generate_plan\")\n\t\t.happyPath(\n\t\t\t\"generate_plan\",\n\t\t\t\"implement\",\n\t\t\t\"simplify_implementation\",\n\t\t\t\"apply_simplification\",\n\t\t\t\"generate_commit_message\",\n\t\t\t...(config.publication.happyPath ?? [config.publication.entryTurnId]),\n\t\t)\n\t\t.piConfig(config.workflow?.multiRepository ? {} : { sessionCwdTemplate: \"{{{projectKey}}}\" })\n\t\t.codecs({ params: config.paramsCodec, state: repositoryChangeStateCodec })\n\t\t.initialState(() => repositoryChangeStateCodec.parse({}))\n\t\t.turn(generatePlan)\n\t\t.turn({ id: \"plan_decision\", definition: planDecision })\n\t\t.turn(implement)\n\t\t.turn(simplify)\n\t\t.turn(applySimplification)\n\t\t.turn(generateCommitMessage)\n\t\t.use(config.publication.fragment);\n\tif (prepareDependencies) builder.runtime({ repositorySubmodules: \"best_effort\" });\n\tif (config.repositoryCredentials) builder.repositoryCredentials(config.repositoryCredentials);\n\tif (config.launcher) builder.launcher(config.launcher);\n\treturn {\n\t\t/** @public */\n\t\tprocess: builder.define(),\n\t};\n}\n","import type { Codec, StructuralProcessState } from \"@leitwerk-dev/process-sdk\";\nimport { parseStructuralProcessState } from \"@leitwerk-dev/process-sdk\";\n\n/** @public */\nexport interface RepositoryChangeFinalizationState {\n\t/** @public */\n\tgeneratedCommitMessage: string | null;\n\t/** Messages keyed by process project key. @public */\n\tcommitMessages?: Record<string, string>;\n}\n\n/** @public */\nexport interface RepositoryChangeState extends StructuralProcessState {\n\t/** @public */\n\tfinalization: RepositoryChangeFinalizationState;\n\t/** Completed routing decisions survive recovery. @public */\n\trouting?: {\n\t\t/** @public */\n\t\tplan?: {\n\t\t\t/** @internal */\n\t\t\tplanRevision: number;\n\t\t\t/** @internal */ skip: boolean;\n\t\t\t/** @internal */ reason: string;\n\t\t};\n\n\t\t/** @public */\n\t\tsimplification?: {\n\t\t\t/** @internal */\n\t\t\tskip: boolean;\n\t\t\t/** @internal */ reason: string;\n\t\t};\n\t};\n\t/** Namespaced state owned by a caller-supplied publication workflow. */\n\n\t/** @public */\n\textensionState?: Record<string, unknown>;\n}\n\nfunction toRecord(value: unknown): Record<string, unknown> {\n\treturn typeof value === \"object\" && value !== null ? (value as Record<string, unknown>) : {};\n}\n\nfunction parseFinalizationState(value: unknown): RepositoryChangeFinalizationState {\n\tconst record = toRecord(value);\n\treturn {\n\t\tgeneratedCommitMessage:\n\t\t\ttypeof record.generatedCommitMessage === \"string\" ? record.generatedCommitMessage : null,\n\t\t...(record.commitMessages\n\t\t\t? {\n\t\t\t\t\tcommitMessages: Object.fromEntries(\n\t\t\t\t\t\tObject.entries(toRecord(record.commitMessages)).filter(\n\t\t\t\t\t\t\t(entry): entry is [string, string] => typeof entry[1] === \"string\",\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t}\n\t\t\t: {}),\n\t};\n}\n\n/** @internal */\nexport const repositoryChangeStateCodec: Codec<RepositoryChangeState> = {\n\tparse(value) {\n\t\tconst record = toRecord(value);\n\t\treturn {\n\t\t\t...parseStructuralProcessState(record),\n\t\t\tfinalization: parseFinalizationState(record.finalization),\n\t\t\textensionState: toRecord(record.extensionState),\n\t\t\trouting: toRecord(record.routing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AG;AAAA,MAC9B;AAAA,IACD;AAAA,EACD,EAAE;AACH,QAAM,UAAU,KACd,QAAwC,OAAO,SAAS,EACxD,YAAY,OAAO,WAAW,EAC9B,MAAM,eAAe,EACrB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAI,OAAO,YAAY,aAAa,CAAC,OAAO,YAAY,WAAW;AAAA,EACpE,EACC,SAAS,OAAO,UAAU,kBAAkB,CAAC,IAAI,EAAE,oBAAoB,mBAAmB,CAAC,EAC3F,OAAO,EAAE,QAAQ,OAAO,aAAa,OAAO,2BAA2B,CAAC,EACxE,aAAa,MAAM,2BAA2B,MAAM,CAAC,CAAC,CAAC,EACvD,KAAK,YAAY,EACjB,KAAK,EAAE,IAAI,iBAAiB,YAAY,aAAa,CAAC,EACtD,KAAK,SAAS,EACd,KAAK,QAAQ,EACb,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,IAAI,OAAO,YAAY,QAAQ;AACjC,MAAI,oBAAqB,SAAQ,QAAQ,EAAE,sBAAsB,cAAc,CAAC;AAChF,MAAI,OAAO,sBAAuB,SAAQ,sBAAsB,OAAO,qBAAqB;AAC5F,MAAI,OAAO,SAAU,SAAQ,SAAS,OAAO,QAAQ;AACrD,SAAO;AAAA;AAAA,IAEN,SAAS,QAAQ,OAAO;AAAA,EACzB;AACD;","names":["process"]}
|
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
// src/submodule-staging.ts
|
|
2
|
+
import { prepareRepositorySubmodules } from "@leitwerk-dev/process-sdk";
|
|
3
|
+
async function prepareSubmodules(repo, ctx) {
|
|
4
|
+
const message = await prepareRepositorySubmodules(repo.key, repo.fsPath);
|
|
5
|
+
if (message) ctx.reportDiagnostic({ level: "warn", code: "repository.submodules", message });
|
|
6
|
+
return message;
|
|
7
|
+
}
|
|
8
|
+
function assertSafeSubmoduleStaging(git) {
|
|
9
|
+
const unstaged = git(["diff", "--raw", "--no-renames", "--ignore-submodules=dirty", "-z"]);
|
|
10
|
+
const changesGitlink = /(?:^|\0):(?:160000 \d{6}|\d{6} 160000) /.test(unstaged);
|
|
11
|
+
const untracked = git(["ls-files", "--others", "--exclude-standard", "-z"]);
|
|
12
|
+
const embeddedCheckout = untracked.split("\0").some((entry) => entry.endsWith("/"));
|
|
13
|
+
if (changesGitlink || embeddedCheckout)
|
|
14
|
+
throw new Error(
|
|
15
|
+
"Cannot automatically stage an out-of-sync or untracked submodule. Restore the checkout or explicitly stage the intended Git link change."
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
|
|
1
19
|
// src/repository-record.ts
|
|
2
20
|
import { existsSync, readFileSync, renameSync, writeFileSync } from "fs";
|
|
3
21
|
import { join } from "path";
|
|
@@ -44,6 +62,8 @@ export {
|
|
|
44
62
|
repositoryBindingMatches,
|
|
45
63
|
readPublicationReceipt,
|
|
46
64
|
savePublicationReceipt,
|
|
47
|
-
pushWasRejected
|
|
65
|
+
pushWasRejected,
|
|
66
|
+
prepareSubmodules,
|
|
67
|
+
assertSafeSubmoduleStaging
|
|
48
68
|
};
|
|
49
|
-
//# sourceMappingURL=chunk-
|
|
69
|
+
//# sourceMappingURL=chunk-DVQWH5SN.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/submodule-staging.ts","../src/repository-record.ts","../src/repository-publication-receipt.ts"],"sourcesContent":["import { prepareRepositorySubmodules, type TurnDiagnosticReport } from \"@leitwerk-dev/process-sdk\";\n\n/** @internal */\nexport async function prepareSubmodules(\n\trepo: { key: string; fsPath: string },\n\tctx: { reportDiagnostic(report: TurnDiagnosticReport): void },\n) {\n\tconst message = await prepareRepositorySubmodules(repo.key, repo.fsPath);\n\tif (message) ctx.reportDiagnostic({ level: \"warn\", code: \"repository.submodules\", message });\n\treturn message;\n}\n\n// A failed refresh can leave a retained submodule at its previous commit. Do\n// not let a parent-wide git add turn that checkout into a pointer change.\n/** @internal */\nexport function assertSafeSubmoduleStaging(git: (args: string[]) => string): void {\n\tconst unstaged = git([\"diff\", \"--raw\", \"--no-renames\", \"--ignore-submodules=dirty\", \"-z\"]);\n\tconst changesGitlink = /(?:^|\\0):(?:160000 \\d{6}|\\d{6} 160000) /.test(unstaged);\n\tconst untracked = git([\"ls-files\", \"--others\", \"--exclude-standard\", \"-z\"]);\n\t// git ls-files reports an embedded worktree as a path ending in slash,\n\t// unlike ordinary untracked files.\n\tconst embeddedCheckout = untracked.split(\"\\0\").some((entry) => entry.endsWith(\"/\"));\n\tif (changesGitlink || embeddedCheckout)\n\t\tthrow new Error(\n\t\t\t\"Cannot automatically stage an out-of-sync or untracked submodule. Restore the checkout or explicitly stage the intended Git link change.\",\n\t\t);\n}\n","import { existsSync, readFileSync, renameSync, writeFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\n\n/** Repository-local JSON with atomic replacement. Callers own validation and locking. @internal */\nexport function repositoryRecord<T>(gitDirectory: string, name: string) {\n\tconst file = join(gitDirectory, `leitwerk-${name}.json`);\n\treturn {\n\t\tread: (): T | null => (existsSync(file) ? JSON.parse(readFileSync(file, \"utf8\")) : null),\n\t\tsave: (record: T): void => {\n\t\t\twriteFileSync(`${file}.tmp`, JSON.stringify(record), { mode: 0o600 });\n\t\t\trenameSync(`${file}.tmp`, file);\n\t\t},\n\t};\n}\n","import { existsSync, readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { repositoryRecord } from \"./repository-record.js\";\n\n/** @internal */\nexport interface RepositoryBinding {\n\tbranch: string;\n\torigin: string;\n\tpushOrigin: string;\n}\n\n/** @internal */\nexport function readRepositoryBinding(\n\tgit: (...args: string[]) => string,\n\tbranch: string,\n): RepositoryBinding {\n\treturn {\n\t\tbranch,\n\t\torigin: git(\"remote\", \"get-url\", \"origin\"),\n\t\tpushOrigin: git(\"remote\", \"get-url\", \"--push\", \"--all\", \"origin\"),\n\t};\n}\n\n/** @internal */\nexport function repositoryBindingMatches(\n\trecord: RepositoryBinding | null,\n\tbinding: RepositoryBinding,\n): boolean {\n\treturn (\n\t\t!record ||\n\t\t(record.branch === binding.branch &&\n\t\t\trecord.origin === binding.origin &&\n\t\t\trecord.pushOrigin === binding.pushOrigin)\n\t);\n}\n\n/** A local write-ahead receipt, not a replacement for the server-owned process state. @internal */\nexport interface RepositoryPublicationReceipt extends RepositoryBinding {\n\texpectedHead: string | null;\n\tcandidate: string;\n\tstatus: \"attempting\" | \"accepted\" | \"rejected\";\n}\n\n/** @internal */\nexport function readPublicationReceipt(gitDirectory: string): RepositoryPublicationReceipt | null {\n\tconst file = join(gitDirectory, \"leitwerk-publication.json\");\n\tif (!existsSync(file)) return null;\n\tconst value = JSON.parse(readFileSync(file, \"utf8\"));\n\tif (\n\t\t!value ||\n\t\ttypeof value.branch !== \"string\" ||\n\t\ttypeof value.origin !== \"string\" ||\n\t\ttypeof value.pushOrigin !== \"string\" ||\n\t\t![\"attempting\", \"accepted\", \"rejected\"].includes(value.status) ||\n\t\t!/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/.test(value.candidate) ||\n\t\t!(value.expectedHead === null || /^(?:[a-f0-9]{40}|[a-f0-9]{64})$/.test(value.expectedHead))\n\t)\n\t\tthrow new Error(\"Invalid repository publication receipt; local work was retained\");\n\treturn value;\n}\n\n/** Persist intent before sending and acceptance before checking for subsequent remote movement. @internal */\nexport const savePublicationReceipt = (\n\tgitDirectory: string,\n\treceipt: RepositoryPublicationReceipt,\n) => repositoryRecord(gitDirectory, \"publication\").save(receipt);\n\n/** Porcelain rejection is proof of no write; transport failures are not. @internal */\nexport function pushWasRejected(porcelain: string): boolean {\n\treturn porcelain.split(\"\\n\").some((line) => /^!\\t[^\\t]+\\t\\[(?:remote )?rejected\\]/.test(line));\n}\n"],"mappings":";AAAA,SAAS,mCAA8D;AAGvE,eAAsB,kBACrB,MACA,KACC;AACD,QAAM,UAAU,MAAM,4BAA4B,KAAK,KAAK,KAAK,MAAM;AACvE,MAAI,QAAS,KAAI,iBAAiB,EAAE,OAAO,QAAQ,M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,MAAK,cAAc,2BAA2B;AAC3D,MAAI,CAACC,YAAW,IAAI,EAAG,QAAO;AAC9B,QAAM,QAAQ,KAAK,MAAMC,cAAa,MAAM,MAAM,CAAC;AACnD,MACC,CAAC,SACD,OAAO,MAAM,WAAW,YACxB,OAAO,MAAM,WAAW,YACxB,OAAO,MAAM,eAAe,YAC5B,CAAC,CAAC,cAAc,YAAY,UAAU,EAAE,SAAS,MAAM,MAAM,KAC7D,CAAC,kCAAkC,KAAK,MAAM,SAAS,KACvD,EAAE,MAAM,iBAAiB,QAAQ,kCAAkC,KAAK,MAAM,YAAY;AAE1F,UAAM,IAAI,MAAM,iEAAiE;AAClF,SAAO;AACR;AAGO,IAAM,yBAAyB,CACrC,cACA,YACI,iBAAiB,cAAc,aAAa,EAAE,KAAK,OAAO;AAGxD,SAAS,gBAAgB,WAA4B;AAC3D,SAAO,UAAU,MAAM,IAAI,EAAE,KAAK,CAAC,SAAS,uCAAuC,KAAK,IAAI,CAAC;AAC9F;","names":["existsSync","readFileSync","join","join","existsSync","readFileSync"]}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
|
+
assertSafeSubmoduleStaging,
|
|
2
3
|
pushWasRejected,
|
|
3
4
|
readPublicationReceipt,
|
|
4
5
|
readRepositoryBinding,
|
|
5
6
|
repositoryBindingMatches,
|
|
6
7
|
savePublicationReceipt
|
|
7
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-DVQWH5SN.js";
|
|
8
9
|
|
|
9
10
|
// src/finalization-git-internal.ts
|
|
10
11
|
import { execFileSync } from "child_process";
|
|
@@ -83,9 +84,7 @@ function repositoryGit(projectKey, repoPath) {
|
|
|
83
84
|
const result = runGit(args);
|
|
84
85
|
return result.ok ? trimToNull(result.stdout) : null;
|
|
85
86
|
}
|
|
86
|
-
|
|
87
|
-
return (gitOrNull("status", "--porcelain") ?? "").split(/\r?\n/).map((line) => line.replace(/\s+$/, "")).filter(Boolean).map((line) => line.slice(2).trim()).filter(Boolean);
|
|
88
|
-
}
|
|
87
|
+
const workingTreeStatus = () => git("status", "--porcelain", "--ignore-submodules=dirty");
|
|
89
88
|
function conflictedFiles() {
|
|
90
89
|
return (gitOrNull("diff", "--name-only", "--diff-filter=U") ?? "").split(/\r?\n/).map((line) => line.trim()).filter(Boolean);
|
|
91
90
|
}
|
|
@@ -99,14 +98,14 @@ function repositoryGit(projectKey, repoPath) {
|
|
|
99
98
|
}
|
|
100
99
|
}
|
|
101
100
|
function commitIfDirty(commitMessage, identity) {
|
|
102
|
-
if (workingTreeStatus()
|
|
101
|
+
if (!workingTreeStatus()) return git("rev-parse", "HEAD");
|
|
103
102
|
assertGitIdentity(identity);
|
|
104
103
|
checkedGit(["add", "--all"], "Failed to stage the completed change");
|
|
105
104
|
checkedGit(["commit", "--no-gpg-sign", "-m", commitMessage], "Commit failed", identity);
|
|
106
105
|
const remaining = workingTreeStatus();
|
|
107
|
-
if (remaining
|
|
108
|
-
throw new DeterministicGitError(`Commit left uncommitted changes:
|
|
109
|
-
|
|
106
|
+
if (remaining)
|
|
107
|
+
throw new DeterministicGitError(`Commit left uncommitted changes:
|
|
108
|
+
${remaining}`);
|
|
110
109
|
return git("rev-parse", "HEAD");
|
|
111
110
|
}
|
|
112
111
|
function pushAndVerify(branch, expectedHeadSha, expectedRemoteHead) {
|
|
@@ -168,13 +167,19 @@ function repositoryGit(projectKey, repoPath) {
|
|
|
168
167
|
if (remoteHead !== expectedHeadSha) throw new RemoteBranchChangedError();
|
|
169
168
|
return pushTarget;
|
|
170
169
|
}
|
|
171
|
-
return {
|
|
170
|
+
return {
|
|
171
|
+
runGit,
|
|
172
|
+
git,
|
|
173
|
+
workingTreeStatus,
|
|
174
|
+
conflictedFiles,
|
|
175
|
+
mergeInProgress,
|
|
176
|
+
commitIfDirty,
|
|
177
|
+
pushAndVerify
|
|
178
|
+
};
|
|
172
179
|
}
|
|
173
180
|
function repositoryHasChanges(repoPath, baseBranch, projectKey = "repo") {
|
|
174
|
-
const { git } = repositoryGit(projectKey, repoPath);
|
|
175
|
-
return Boolean(
|
|
176
|
-
git("status", "--porcelain") || git("diff", "--name-only", `origin/${baseBranch}...HEAD`)
|
|
177
|
-
);
|
|
181
|
+
const { git, workingTreeStatus } = repositoryGit(projectKey, repoPath);
|
|
182
|
+
return Boolean(workingTreeStatus() || git("diff", "--name-only", `origin/${baseBranch}...HEAD`));
|
|
178
183
|
}
|
|
179
184
|
function commitAndPushWorkBranch(input) {
|
|
180
185
|
const repoPath = path.resolve(input.repoPath);
|
|
@@ -199,6 +204,7 @@ function commitAndPushWorkBranch(input) {
|
|
|
199
204
|
`Cannot publish a work branch with unresolved conflicts: ${conflicts.join(", ") || "merge in progress"}`
|
|
200
205
|
);
|
|
201
206
|
}
|
|
207
|
+
if (input.protectSubmodules) assertSafeSubmoduleStaging((args) => git(...args));
|
|
202
208
|
const headSha = commitIfDirty(input.commitMessage, input.gitIdentity);
|
|
203
209
|
return {
|
|
204
210
|
/** @public */
|
|
@@ -213,4 +219,4 @@ export {
|
|
|
213
219
|
repositoryHasChanges,
|
|
214
220
|
commitAndPushWorkBranch
|
|
215
221
|
};
|
|
216
|
-
//# sourceMappingURL=chunk-
|
|
222
|
+
//# sourceMappingURL=chunk-GIWVCTYT.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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\";\nimport { assertSafeSubmoduleStaging } from \"./submodule-staging.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\tconst workingTreeStatus = () => git(\"status\", \"--porcelain\", \"--ignore-submodules=dirty\");\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()) return git(\"rev-parse\", \"HEAD\");\n\t\tassertGitIdentity(identity);\n\t\tcheckedGit([\"add\", \"--all\"], \"Failed to stage the completed change\");\n\t\tcheckedGit([\"commit\", \"--no-gpg-sign\", \"-m\", commitMessage], \"Commit failed\", identity);\n\t\tconst remaining = workingTreeStatus();\n\t\tif (remaining)\n\t\t\tthrow new DeterministicGitError(`Commit left uncommitted changes:\\n${remaining}`);\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 {\n\t\trunGit,\n\t\tgit,\n\t\tworkingTreeStatus,\n\t\tconflictedFiles,\n\t\tmergeInProgress,\n\t\tcommitIfDirty,\n\t\tpushAndVerify,\n\t};\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, workingTreeStatus } = repositoryGit(projectKey, repoPath);\n\treturn Boolean(workingTreeStatus() || git(\"diff\", \"--name-only\", `origin/${baseBranch}...HEAD`));\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\t/** Require explicit staging of submodule Git link changes. @internal */\n\tprotectSubmodules?: boolean;\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\tif (input.protectSubmodules) assertSafeSubmoduleStaging((args) => git(...args));\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;AAoB1B,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,SAAS,WAAW,KAAK,IAAI,KAAK,WAAW,KAAK,KAAK,GAAG;AACvE,UAAM,IAAI,sBAAsB,8CAA8C;AAAA,EAC/E;AACA,SAAO,CAAC,MAAM,aAAa,IAAI,IAAI,MAAM,cAAc,KAAK,EAAE;AAC/D;AAEA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AG,IAAI,CAAC;AAC9E,QAAM,UAAU,cAAc,MAAM,eAAe,MAAM,WAAW;AACpE,SAAO;AAAA;AAAA,IAEN;AAAA;AAAA,IAEA,YAAY,cAAc,MAAM,YAAY,SAAS,MAAM,kBAAkB;AAAA,EAC9E;AACD;","names":[]}
|
|
@@ -33,6 +33,8 @@ export declare function commitAndPushWorkBranch(input: {
|
|
|
33
33
|
gitIdentity: GitIdentity;
|
|
34
34
|
/** Captured remote head; null requires branch creation. @internal */
|
|
35
35
|
expectedRemoteHead?: string | null;
|
|
36
|
+
/** Require explicit staging of submodule Git link changes. @internal */
|
|
37
|
+
protectSubmodules?: boolean;
|
|
36
38
|
}): {
|
|
37
39
|
/** @public */
|
|
38
40
|
headSha: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"finalization-git-internal.d.ts","sourceRoot":"","sources":["../src/finalization-git-internal.ts"],"names":[],"mappings":"AAGA,OAAO,EAAc,KAAK,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"finalization-git-internal.d.ts","sourceRoot":"","sources":["../src/finalization-git-internal.ts"],"names":[],"mappings":"AAGA,OAAO,EAAc,KAAK,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAazE,cAAc;AACd,MAAM,WAAW,WAAW;IAC3B,cAAc;IACd,IAAI,EAAE,MAAM,CAAC;IACb,cAAc;IACd,KAAK,EAAE,MAAM,CAAC;CACd;AAED,gBAAgB;AAChB,qBAAa,qBAAsB,SAAQ,KAAK;IAC/C,gBAAgB;IAChB,QAAQ,CAAC,UAAU,EAAE,gBAAgB,CAAe;IAEpD,gBAAgB;gBACJ,OAAO,EAAE,MAAM;CAI3B;AAED,gBAAgB;AAChB,qBAAa,wBAAyB,SAAQ,qBAAqB;;CAIlE;AA4LD,8FAA8F;AAC9F,wBAAgB,oBAAoB,CACnC,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,UAAU,SAAS,GACjB,OAAO,CAGT;AAED,sFAAsF;AACtF,cAAc;AACd,wBAAgB,uBAAuB,CAAC,KAAK,EAAE;IAC9C,cAAc,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IACnC,cAAc;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc;IACd,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc;IACd,WAAW,EAAE,WAAW,CAAC;IACzB,qEAAqE;IACrE,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,wEAAwE;IACxE,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC5B;IA2BC,cAAc;;IAEd,gBAAgB;;EAGjB"}
|
package/dist/finalization-git.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -4,12 +4,12 @@ import {
|
|
|
4
4
|
createRepositoryChangeProcess,
|
|
5
5
|
requestReviewChangesForm,
|
|
6
6
|
requestRevisionForm
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-5M3DTAVU.js";
|
|
8
8
|
import "./chunk-DNG7D77K.js";
|
|
9
9
|
import "./chunk-ABQH2WZT.js";
|
|
10
10
|
import "./chunk-PISZZXK4.js";
|
|
11
11
|
import "./chunk-SKGB4CZS.js";
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-DVQWH5SN.js";
|
|
13
13
|
import {
|
|
14
14
|
codingPurposes,
|
|
15
15
|
codingSettings
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Codec, FormDefinition, ProcessLaunchConfig } from '@leitwerk-dev/process-sdk';
|
|
2
|
-
import { R as RepositoryChangeWorkflow } from './repository-change-process-
|
|
2
|
+
import { R as RepositoryChangeWorkflow } from './repository-change-process-Dc-jsbCL.js';
|
|
3
3
|
|
|
4
4
|
/** @public */
|
|
5
5
|
interface RepositoryChangeOptions {
|
package/dist/{repository-change-process-DbcnkzLw.d.ts → repository-change-process-Dc-jsbCL.d.ts}
RENAMED
|
@@ -60,6 +60,8 @@ interface RepositoryChangeProcessConfig<TParams extends RepositoryChangeParams>
|
|
|
60
60
|
fragment: FlowFragmentBuilder<TParams, RepositoryChangeState>;
|
|
61
61
|
/** @public */
|
|
62
62
|
happyPath?: readonly string[];
|
|
63
|
+
/** @internal */
|
|
64
|
+
prepareSubmodules?: boolean;
|
|
63
65
|
};
|
|
64
66
|
}
|
|
65
67
|
/** @public */
|
|
@@ -58,6 +58,8 @@ export interface RepositoryChangeProcessConfig<TParams extends RepositoryChangeP
|
|
|
58
58
|
fragment: FlowFragmentBuilder<TParams, RepositoryChangeState>;
|
|
59
59
|
/** @public */
|
|
60
60
|
happyPath?: readonly string[];
|
|
61
|
+
/** @internal */
|
|
62
|
+
prepareSubmodules?: boolean;
|
|
61
63
|
};
|
|
62
64
|
}
|
|
63
65
|
/** @public */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repository-change-process.d.ts","sourceRoot":"","sources":["../src/repository-change-process.ts"],"names":[],"mappings":"AACA,OAAO,EACN,KAAK,KAAK,EACV,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,cAAc,EAGnB,KAAK,yBAAyB,EAC9B,KAAK,2BAA2B,EAChC,KAAK,+BAA+B,EAEpC,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACN,KAAK,qBAAqB,EAE1B,MAAM,uCAAuC,CAAC;
|
|
1
|
+
{"version":3,"file":"repository-change-process.d.ts","sourceRoot":"","sources":["../src/repository-change-process.ts"],"names":[],"mappings":"AACA,OAAO,EACN,KAAK,KAAK,EACV,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,cAAc,EAGnB,KAAK,yBAAyB,EAC9B,KAAK,2BAA2B,EAChC,KAAK,+BAA+B,EAEpC,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACN,KAAK,qBAAqB,EAE1B,MAAM,uCAAuC,CAAC;AAa/C,cAAc;AACd,MAAM,MAAM,sB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ChB,gBAAgB;QAChB,QAAQ,EAAE,SAAS,2BAA2B,EAAE,CAAC;KACjD,GAAG,SAAS,+BAA+B,EAAE,CAAC;IAC/C,cAAc;IACd,WAAW,EAAE;QACZ,cAAc;QACd,WAAW,EAAE,MAAM,CAAC;QACpB,cAAc;QACd,QAAQ,EAAE,mBAAmB,CAAC,OAAO,EAAE,qBAAqB,CAAC,CAAC;QAC9D,cAAc;QACd,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;QAC9B,gBAAgB;QAChB,iBAAiB,CAAC,EAAE,OAAO,CAAC;KAC5B,CAAC;CACF;AAED,cAAc;AACd,wBAAgB,6BAA6B,CAAC,OAAO,SAAS,sBAAsB,EACnF,MAAM,EAAE,6BAA6B,CAAC,OAAO,CAAC;IAkV7C,cAAc;;EAGf"}
|
|
@@ -113,6 +113,8 @@ export interface RepositoryChangePublicationAdapter<P> {
|
|
|
113
113
|
};
|
|
114
114
|
/** @public */
|
|
115
115
|
namespace: string;
|
|
116
|
+
/** Prepare pinned submodules after revision reconciliation. @public */
|
|
117
|
+
prepareSubmodules?: boolean;
|
|
116
118
|
/** Reconcile a single-repository no-change outcome. @public */
|
|
117
119
|
unchanged?(ctx: PublicationContext<P>): Promise<void>;
|
|
118
120
|
/** Optional coordinated repositories; each retains independent publication state. @public */
|
|
@@ -294,5 +296,7 @@ export declare function createRepositoryChangePublication<P>(adapter: Repository
|
|
|
294
296
|
fragment: import("@leitwerk-dev/process-sdk").FlowFragmentBuilder<P, RepositoryChangeState>;
|
|
295
297
|
/** @public */
|
|
296
298
|
happyPath: string[];
|
|
299
|
+
/** @internal */
|
|
300
|
+
prepareSubmodules: boolean | undefined;
|
|
297
301
|
};
|
|
298
302
|
//# sourceMappingURL=repository-change-publication.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repository-change-publication.d.ts","sourceRoot":"","sources":["../src/repository-change-publication.ts"],"names":[],"mappings":"AACA,OAAO,EAEN,KAAK,0BAA0B,EAC/B,KAAK,oBAAoB,EACzB,KAAK,uBAAuB,EAE5B,KAAK,kBAAkB,EACvB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAEN,KAAK,WAAW,EAEhB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAO1E,OAAO,EAAE,KAAK,gBAAgB,EAAiC,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"repository-change-publication.d.ts","sourceRoot":"","sources":["../src/repository-change-publication.ts"],"names":[],"mappings":"AACA,OAAO,EAEN,KAAK,0BAA0B,EAC/B,KAAK,oBAAoB,EACzB,KAAK,uBAAuB,EAE5B,KAAK,kBAAkB,EACvB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAEN,KAAK,WAAW,EAEhB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAO1E,OAAO,EAAE,KAAK,gBAAgB,EAAiC,MAAM,8BAA8B,CAAC;AAYpG,OAAO,EACN,8BAA8B,EAC9B,8BAA8B,EAC9B,6BAA6B,GAC7B,MAAM,wCAAwC,CAAC;AAEhD,cAAc;AACd,MAAM,WAAW,kBAAkB;IAClC,cAAc;IACd,MAAM,EAAE,MAAM,CAAC;IAEf,cAAc;IACd,QAAQ,EAAE,MAAM,CAAC;IAEjB,cAAc;IACd,MAAM,EAAE,OAAO,CAAC;IAEhB,cAAc;IACd,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACjC;AAED,cAAc;AACd,MAAM,WAAW,mBAAmB;IACnC,cAAc;IACd,MAAM,EAAE,MAAM,CAAC;IAEf,cAAc;IACd,MAAM,EAAE,MAAM,CAAC;IAEf,cAAc;IACd,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACvB;AAED,cAAc;AACd,MAAM,WAAW,iBAAiB;IACjC,cAAc;IACd,KAAK,EAAE,MAAM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