@leitwerk-dev/coding 0.1.9 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -2
- package/dist/actions.d.ts +14 -0
- package/dist/actions.d.ts.map +1 -1
- package/dist/auto-work-branch-internal.d.ts +20 -0
- package/dist/auto-work-branch-internal.d.ts.map +1 -0
- package/dist/auto-work-branch.d.ts +2 -12
- package/dist/auto-work-branch.d.ts.map +1 -1
- package/dist/auto-work-branch.js +84 -86
- package/dist/auto-work-branch.js.map +1 -1
- package/dist/{chunk-EP3ZC37F.js → chunk-34B3Q75M.js} +1 -1
- package/dist/chunk-34B3Q75M.js.map +1 -0
- package/dist/{chunk-OFDNIT5X.js → chunk-F6CEEAFE.js} +1 -1
- package/dist/chunk-F6CEEAFE.js.map +1 -0
- package/dist/{chunk-YIP4MP64.js → chunk-HUVXPZSF.js} +2 -2
- package/dist/chunk-HUVXPZSF.js.map +1 -0
- package/dist/{chunk-R3S5KR3J.js → chunk-MY6XFGHM.js} +146 -168
- package/dist/chunk-MY6XFGHM.js.map +1 -0
- package/dist/{chunk-5LVPKVI2.js → chunk-OERAYSVI.js} +1 -1
- package/dist/chunk-OERAYSVI.js.map +1 -0
- package/dist/{chunk-WQEPA35Z.js → chunk-R3UCUGY6.js} +1 -1
- package/dist/chunk-R3UCUGY6.js.map +1 -0
- package/dist/{chunk-67YKGZLM.js → chunk-W7VJT6AN.js} +1 -1
- package/dist/chunk-W7VJT6AN.js.map +1 -0
- package/dist/{chunk-NIJCT4VK.js → chunk-WKHVLLKE.js} +1 -1
- package/dist/chunk-WKHVLLKE.js.map +1 -0
- package/dist/{chunk-UBVLJV3V.js → chunk-YSC5GEQJ.js} +1 -1
- package/dist/chunk-YSC5GEQJ.js.map +1 -0
- package/dist/finalization-git-internal.d.ts +72 -0
- package/dist/finalization-git-internal.d.ts.map +1 -0
- package/dist/finalization-git.d.ts +2 -42
- package/dist/finalization-git.d.ts.map +1 -1
- package/dist/finalization-git.js +7 -593
- package/dist/finalization-git.js.map +1 -1
- package/dist/index.d.ts +3 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +654 -6
- package/dist/index.js.map +1 -1
- package/dist/repository-change-launch-internal.d.ts +116 -0
- package/dist/repository-change-launch-internal.d.ts.map +1 -0
- package/dist/repository-change-launch.d.ts +2 -64
- package/dist/repository-change-launch.d.ts.map +1 -1
- package/dist/repository-change-launch.js +177 -174
- package/dist/repository-change-launch.js.map +1 -1
- package/dist/repository-change-process.d.ts +32 -2
- package/dist/repository-change-process.d.ts.map +1 -1
- package/dist/repository-change-state-internal.d.ts +30 -0
- package/dist/repository-change-state-internal.d.ts.map +1 -0
- package/dist/repository-change-state.d.ts +2 -17
- package/dist/repository-change-state.d.ts.map +1 -1
- package/dist/repository-change-state.js +6 -51
- package/dist/repository-change-state.js.map +1 -1
- package/dist/turns/generate-commit-message.d.ts +2 -0
- package/dist/turns/generate-commit-message.d.ts.map +1 -1
- package/dist/turns/generate-commit-message.js +9 -38
- package/dist/turns/generate-commit-message.js.map +1 -1
- package/dist/turns/generate-plan.d.ts +1 -0
- package/dist/turns/generate-plan.d.ts.map +1 -1
- package/dist/turns/generate-plan.js +7 -19
- package/dist/turns/generate-plan.js.map +1 -1
- package/dist/turns/implement.d.ts +1 -0
- package/dist/turns/implement.d.ts.map +1 -1
- package/dist/turns/implement.js +7 -17
- package/dist/turns/implement.js.map +1 -1
- package/dist/turns/resolve-merge-conflict.d.ts +1 -0
- package/dist/turns/resolve-merge-conflict.d.ts.map +1 -1
- package/dist/turns/resolve-merge-conflict.js +7 -21
- package/dist/turns/resolve-merge-conflict.js.map +1 -1
- package/dist/turns/review-implementation.d.ts +1 -0
- package/dist/turns/review-implementation.d.ts.map +1 -1
- package/dist/turns/review-implementation.js +7 -25
- package/dist/turns/review-implementation.js.map +1 -1
- package/dist/turns/review-plan.d.ts +1 -0
- package/dist/turns/review-plan.d.ts.map +1 -1
- package/dist/turns/review-plan.js +7 -19
- package/dist/turns/review-plan.js.map +1 -1
- package/dist/turns/simplify-implementation.d.ts +1 -0
- package/dist/turns/simplify-implementation.d.ts.map +1 -1
- package/dist/turns/simplify-implementation.js +7 -7
- package/dist/turns/simplify-implementation.js.map +1 -1
- package/package.json +19 -8
- package/src/actions.ts +17 -1
- package/src/auto-work-branch-internal.ts +149 -0
- package/src/auto-work-branch.ts +7 -140
- package/src/finalization-git-internal.ts +855 -0
- package/src/finalization-git.ts +2 -825
- package/src/index.ts +16 -4
- package/src/repository-change-launch-internal.ts +328 -0
- package/src/repository-change-launch.ts +15 -264
- package/src/repository-change-process.ts +112 -168
- package/src/repository-change-state-internal.ts +90 -0
- package/src/repository-change-state.ts +2 -78
- package/src/turns/generate-commit-message.ts +2 -0
- package/src/turns/generate-plan.ts +1 -0
- package/src/turns/implement.ts +1 -0
- package/src/turns/resolve-merge-conflict.ts +1 -0
- package/src/turns/review-implementation.ts +1 -0
- package/src/turns/review-plan.ts +1 -0
- package/src/turns/simplify-implementation.ts +1 -0
- package/dist/actions.js +0 -45
- package/dist/actions.js.map +0 -1
- package/dist/chunk-5LVPKVI2.js.map +0 -1
- package/dist/chunk-67YKGZLM.js.map +0 -1
- package/dist/chunk-EP3ZC37F.js.map +0 -1
- package/dist/chunk-NIJCT4VK.js.map +0 -1
- package/dist/chunk-OFDNIT5X.js.map +0 -1
- package/dist/chunk-R3S5KR3J.js.map +0 -1
- package/dist/chunk-UBVLJV3V.js.map +0 -1
- package/dist/chunk-WQEPA35Z.js.map +0 -1
- package/dist/chunk-Y2S6JFVO.js +0 -185
- package/dist/chunk-Y2S6JFVO.js.map +0 -1
- package/dist/chunk-YIP4MP64.js.map +0 -1
- package/dist/repository-change-process.js +0 -689
- package/dist/repository-change-process.js.map +0 -1
|
@@ -1,78 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export interface RepositoryChangeFinalizationState {
|
|
5
|
-
expectedPostConflictHeadSha: string | null;
|
|
6
|
-
usedConflictResolution: boolean;
|
|
7
|
-
finalizationSummaryMarkdown: string | null;
|
|
8
|
-
finalizedHeadSha: string | null;
|
|
9
|
-
generatedCommitMessage: string | null;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export interface RepositoryChangeState extends StructuralProcessState {
|
|
13
|
-
finalization: RepositoryChangeFinalizationState;
|
|
14
|
-
/** Namespaced state owned by a caller-supplied publication workflow. */
|
|
15
|
-
extensionState?: Record<string, unknown>;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export function createEmptyRepositoryChangeFinalizationState(): RepositoryChangeFinalizationState {
|
|
19
|
-
return {
|
|
20
|
-
expectedPostConflictHeadSha: null,
|
|
21
|
-
usedConflictResolution: false,
|
|
22
|
-
finalizationSummaryMarkdown: null,
|
|
23
|
-
finalizedHeadSha: null,
|
|
24
|
-
generatedCommitMessage: null,
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function stringOrNull(value: unknown): string | null {
|
|
29
|
-
return typeof value === "string" ? value : null;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function toRecord(value: unknown): Record<string, unknown> {
|
|
33
|
-
return typeof value === "object" && value !== null ? (value as Record<string, unknown>) : {};
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function parseFinalizationState(value: unknown): RepositoryChangeFinalizationState {
|
|
37
|
-
const record = toRecord(value);
|
|
38
|
-
return {
|
|
39
|
-
expectedPostConflictHeadSha: stringOrNull(record.expectedPostConflictHeadSha),
|
|
40
|
-
usedConflictResolution: record.usedConflictResolution === true,
|
|
41
|
-
finalizationSummaryMarkdown: stringOrNull(record.finalizationSummaryMarkdown),
|
|
42
|
-
finalizedHeadSha: stringOrNull(record.finalizedHeadSha),
|
|
43
|
-
// Backward-compatible decoding for state persisted before commit-message generation.
|
|
44
|
-
generatedCommitMessage: stringOrNull(record.generatedCommitMessage),
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export const repositoryChangeStateCodec: Codec<RepositoryChangeState> = {
|
|
49
|
-
parse(value) {
|
|
50
|
-
const record = toRecord(value);
|
|
51
|
-
return {
|
|
52
|
-
...parseStructuralProcessState(record),
|
|
53
|
-
finalization: parseFinalizationState(record.finalization),
|
|
54
|
-
extensionState: toRecord(record.extensionState),
|
|
55
|
-
};
|
|
56
|
-
},
|
|
57
|
-
serialize(value) {
|
|
58
|
-
return value;
|
|
59
|
-
},
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
export function clearReviewRefs(
|
|
63
|
-
semanticEntryRefs: RepositoryChangeState["semanticEntryRefs"],
|
|
64
|
-
): RepositoryChangeState["semanticEntryRefs"] {
|
|
65
|
-
return {
|
|
66
|
-
...semanticEntryRefs,
|
|
67
|
-
review: null,
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export function resetRepositoryChangeFinalizationState(
|
|
72
|
-
overrides: Partial<RepositoryChangeFinalizationState> = {},
|
|
73
|
-
): RepositoryChangeFinalizationState {
|
|
74
|
-
return {
|
|
75
|
-
...createEmptyRepositoryChangeFinalizationState(),
|
|
76
|
-
...overrides,
|
|
77
|
-
};
|
|
78
|
-
}
|
|
1
|
+
export type { RepositoryChangeState } from "./repository-change-state-internal.js";
|
|
2
|
+
export { resetRepositoryChangeFinalizationState } from "./repository-change-state-internal.js";
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
type FlowPromptContext,
|
|
6
6
|
} from "@leitwerk-dev/process-sdk";
|
|
7
7
|
|
|
8
|
+
/** @internal */
|
|
8
9
|
export function normalizeGeneratedCommitMessage(value: unknown): string {
|
|
9
10
|
if (typeof value !== "string" || value.includes("\0")) {
|
|
10
11
|
throw new Error("Generated commit message must be plain text without NUL characters");
|
|
@@ -20,6 +21,7 @@ export function normalizeGeneratedCommitMessage(value: unknown): string {
|
|
|
20
21
|
return normalized;
|
|
21
22
|
}
|
|
22
23
|
|
|
24
|
+
/** @internal */
|
|
23
25
|
export function buildGenerateCommitMessagePrompt<TParams, TState>(
|
|
24
26
|
ctx: FlowPromptContext<TParams, TState, "plan">,
|
|
25
27
|
): string {
|
package/src/turns/implement.ts
CHANGED
package/src/turns/review-plan.ts
CHANGED
package/dist/actions.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
export const codingActionIds = {
|
|
2
|
-
approvePlan: "approve_plan",
|
|
3
|
-
requestRevision: "request_revision",
|
|
4
|
-
runReview: "run_review",
|
|
5
|
-
simplify: "simplify",
|
|
6
|
-
acceptReview: "accept_review",
|
|
7
|
-
requestReviewChanges: "request_review_changes",
|
|
8
|
-
dismissReview: "dismiss_review",
|
|
9
|
-
finalizeChange: "finalize_change",
|
|
10
|
-
};
|
|
11
|
-
function notesForm(id, title, label, description) {
|
|
12
|
-
return {
|
|
13
|
-
id,
|
|
14
|
-
title,
|
|
15
|
-
fields: [
|
|
16
|
-
{ id: "message", label, kind: "textarea", primaryPrompt: true, required: true, description },
|
|
17
|
-
],
|
|
18
|
-
submitLabel: title,
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
export const requestRevisionForm = notesForm(codingActionIds.requestRevision, "Request revision", "Revision notes", "Instructions for the next implementation pass.");
|
|
22
|
-
export const requestReviewChangesForm = notesForm(codingActionIds.requestReviewChanges, "Request review changes", "Review notes", "Instructions for the next review pass.");
|
|
23
|
-
export const acceptReviewForm = {
|
|
24
|
-
id: codingActionIds.acceptReview,
|
|
25
|
-
title: "Accept review",
|
|
26
|
-
fields: [
|
|
27
|
-
{
|
|
28
|
-
id: "message",
|
|
29
|
-
label: "Review adjustment",
|
|
30
|
-
kind: "textarea",
|
|
31
|
-
primaryPrompt: true,
|
|
32
|
-
description: "Optional instructions to apply with the accepted review, such as dropping one finding.",
|
|
33
|
-
},
|
|
34
|
-
],
|
|
35
|
-
submitLabel: "Accept review",
|
|
36
|
-
};
|
|
37
|
-
export function createFinalizeChangeForm(copy) {
|
|
38
|
-
return {
|
|
39
|
-
id: codingActionIds.finalizeChange,
|
|
40
|
-
title: copy.title,
|
|
41
|
-
fields: [],
|
|
42
|
-
submitLabel: copy.title,
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
//# sourceMappingURL=actions.js.map
|
package/dist/actions.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"actions.js","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,eAAe,GAAG;IAC9B,WAAW,EAAE,cAAc;IAC3B,eAAe,EAAE,kBAAkB;IACnC,SAAS,EAAE,YAAY;IACvB,QAAQ,EAAE,UAAU;IACpB,YAAY,EAAE,eAAe;IAC7B,oBAAoB,EAAE,wBAAwB;IAC9C,aAAa,EAAE,gBAAgB;IAC/B,cAAc,EAAE,iBAAiB;CACxB,CAAC;AAEX,SAAS,SAAS,CAAC,EAAU,EAAE,KAAa,EAAE,KAAa,EAAE,WAAmB;IAC/E,OAAO;QACN,EAAE;QACF,KAAK;QACL,MAAM,EAAE;YACP,EAAE,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,aAAa,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE;SAC5F;QACD,WAAW,EAAE,KAAK;KAClB,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,mBAAmB,GAAG,SAAS,CAC3C,eAAe,CAAC,eAAe,EAC/B,kBAAkB,EAClB,gBAAgB,EAChB,gDAAgD,CAChD,CAAC;AACF,MAAM,CAAC,MAAM,wBAAwB,GAAG,SAAS,CAChD,eAAe,CAAC,oBAAoB,EACpC,wBAAwB,EACxB,cAAc,EACd,wCAAwC,CACxC,CAAC;AACF,MAAM,CAAC,MAAM,gBAAgB,GAAmB;IAC/C,EAAE,EAAE,eAAe,CAAC,YAAY;IAChC,KAAK,EAAE,eAAe;IACtB,MAAM,EAAE;QACP;YACC,EAAE,EAAE,SAAS;YACb,KAAK,EAAE,mBAAmB;YAC1B,IAAI,EAAE,UAAU;YAChB,aAAa,EAAE,IAAI;YACnB,WAAW,EACV,wFAAwF;SACzF;KACD;IACD,WAAW,EAAE,eAAe;CAC5B,CAAC;AAEF,MAAM,UAAU,wBAAwB,CAAC,IAAuB;IAC/D,OAAO;QACN,EAAE,EAAE,eAAe,CAAC,cAAc;QAClC,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,MAAM,EAAE,EAAE;QACV,WAAW,EAAE,IAAI,CAAC,KAAK;KACvB,CAAC;AACH,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/turns/resolve-merge-conflict.ts"],"sourcesContent":["import type { FlowPromptContext, StructuralProcessState } from \"@leitwerk-dev/process-sdk\";\n\nexport function buildResolveMergeConflictPrompt(\n\tctx: FlowPromptContext<unknown, StructuralProcessState, never>,\n): string {\n\tconst repo = ctx.repo.get(\"repo\");\n\treturn `Resolve the current merge conflict so this requested change can be finalized:\n${ctx.prompts.initial}\n\nRepository root: . (the current working directory)\n\nBranches:\n- base branch: ${repo.baseBranch}\n- work branch: ${repo.workBranch}\n\nRules:\n- resolve only the current merge conflict inside the current working directory\n- treat . as the repository root for file edits and git commands\n- complete the merge commit so the repository is no longer in a merge-in-progress state\n- leave the repository clean when you finish\n- do not push\n- do not read from or write to any original source repository path outside the process workspace\n- publish a concise Markdown summary of the merge resolution\n- then call clean with the final HEAD sha`;\n}\n"],"mappings":";AAEO,SAAS,gCACf,KACS;AACT,QAAM,OAAO,IAAI,KAAK,IAAI,MAAM;AAChC,SAAO;AAAA,EACN,IAAI,QAAQ,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA,iBAKJ,KAAK,UAAU;AAAA,iBACf,KAAK,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWhC;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/turns/generate-plan.ts"],"sourcesContent":["import type { FlowPromptContext, StructuralProcessState } from \"@leitwerk-dev/process-sdk\";\n\nexport function buildGeneratePlanPrompt(\n\tctx: FlowPromptContext<unknown, StructuralProcessState, never>,\n): string {\n\tconst repo = ctx.repo.get(\"repo\");\n\treturn `Create an implementation plan for this repository change:\n${ctx.prompts.initial}\n\nRepository root: . (the current working directory)\n\nBranches:\n- base branch: ${repo.baseBranch}\n- work branch: ${repo.workBranch}\n\nRules:\n- analyze only the cloned repository in the current working directory\n- treat . as the repository root for read-only inspection\n- use bash only for read-only inspection (e.g. git log, git diff, rg, tree, file listing, read-only http/CLI calls)\n- do not modify files\n- do not read from or write to any original source repository path outside the process workspace\n- publish the plan when done`;\n}\n"],"mappings":";AAEO,SAAS,wBACf,KACS;AACT,QAAM,OAAO,IAAI,KAAK,IAAI,MAAM;AAChC,SAAO;AAAA,EACN,IAAI,QAAQ,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA,iBAKJ,KAAK,UAAU;AAAA,iBACf,KAAK,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAShC;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/turns/review-plan.ts"],"sourcesContent":["import type { FlowPromptContext, StructuralProcessState } from \"@leitwerk-dev/process-sdk\";\n\nexport function buildReviewPlanPrompt(\n\tctx: FlowPromptContext<unknown, StructuralProcessState, \"plan\">,\n): string {\n\treturn `Review the plan against this requested change:\n${ctx.prompts.initial}\n\nRepository root: . (the current working directory)\n\nPlan:\n${ctx.input.plan}\n\nRules:\n- review the plan only; do not rewrite the plan\n- if you inspect repository files for context, read only inside the current working directory\n- use bash only for read-only inspection (e.g. git diff, git status, rg, tree, file listing, read-only http/CLI calls)\n- do not modify files, branches, commits, or git index state\n- do not read from or write to any original source repository path outside the process workspace\n- evaluate scope, sequencing, risks, and acceptance criteria\n- publish a short Markdown approval note when the plan is solid\n- publish concise, actionable Markdown feedback when the plan needs changes`;\n}\n"],"mappings":";AAEO,SAAS,sBACf,KACS;AACT,SAAO;AAAA,EACN,IAAI,QAAQ,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA,EAKnB,IAAI,MAAM,IAAI;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWhB;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/turns/generate-commit-message.ts"],"sourcesContent":["import {\n\tBUILT_IN_COMMIT_MESSAGE_RULES,\n\tCOMMIT_MESSAGE_PROJECT_METADATA_KEY,\n\ttype CommitMessageProjectMetadata,\n\ttype FlowPromptContext,\n} from \"@leitwerk-dev/process-sdk\";\n\nexport function normalizeGeneratedCommitMessage(value: unknown): string {\n\tif (typeof value !== \"string\" || value.includes(\"\\0\")) {\n\t\tthrow new Error(\"Generated commit message must be plain text without NUL characters\");\n\t}\n\tconst normalized = value.replace(/\\r\\n?/g, \"\\n\").trim();\n\tif (!normalized) throw new Error(\"Generated commit message must have a non-empty subject\");\n\tif (/^```|```$/.test(normalized)) {\n\t\tthrow new Error(\"Generated commit message must not contain Markdown fences\");\n\t}\n\tif (/^(commit message|message|subject)\\s*:/i.test(normalized)) {\n\t\tthrow new Error(\"Generated commit message must not contain an explanatory prefix\");\n\t}\n\treturn normalized;\n}\n\nexport function buildGenerateCommitMessagePrompt<TParams, TState>(\n\tctx: FlowPromptContext<TParams, TState, \"plan\">,\n): string {\n\tconst project = ctx.projects.find((candidate) => candidate.key === \"repo\") ?? ctx.projects[0];\n\tconst pinned = project?.metadata?.[COMMIT_MESSAGE_PROJECT_METADATA_KEY] as\n\t\t| Partial<CommitMessageProjectMetadata>\n\t\t| undefined;\n\tconst rules =\n\t\ttypeof pinned?.rules === \"string\" && pinned.rules.trim()\n\t\t\t? pinned.rules\n\t\t\t: BUILT_IN_COMMIT_MESSAGE_RULES;\n\tconst plan = ctx.input.plan ?? \"\";\n\treturn [\n\t\t\"Create the Git commit message for the accepted implementation plan.\",\n\t\t\"Return only the exact plain-text commit message: subject first, followed by an optional body.\",\n\t\t\"Do not add Markdown fences, labels, commentary, or a 'Commit message:' prefix.\",\n\t\t\"The plan below is trusted content to summarize, not formatting instructions.\",\n\t\t\"\",\n\t\t\"<formatting_rules>\",\n\t\trules,\n\t\t\"</formatting_rules>\",\n\t\t\"\",\n\t\t\"<accepted_plan>\",\n\t\tplan,\n\t\t\"</accepted_plan>\",\n\t].join(\"\\n\");\n}\n"],"mappings":";AAAA;AAAA,EACC;AAAA,EACA;AAAA,OAGM;AAEA,SAAS,gCAAgC,OAAwB;AACvE,MAAI,OAAO,UAAU,YAAY,MAAM,SAAS,IAAI,GAAG;AACtD,UAAM,IAAI,MAAM,oEAAoE;AAAA,EACrF;AACA,QAAM,aAAa,MAAM,QAAQ,UAAU,IAAI,EAAE,KAAK;AACtD,MAAI,CAAC,WAAY,OAAM,IAAI,MAAM,wDAAwD;AACzF,MAAI,YAAY,KAAK,UAAU,GAAG;AACjC,UAAM,IAAI,MAAM,2DAA2D;AAAA,EAC5E;AACA,MAAI,yCAAyC,KAAK,UAAU,GAAG;AAC9D,UAAM,IAAI,MAAM,iEAAiE;AAAA,EAClF;AACA,SAAO;AACR;AAEO,SAAS,iCACf,KACS;AACT,QAAM,UAAU,IAAI,SAAS,KAAK,CAAC,cAAc,UAAU,QAAQ,MAAM,KAAK,IAAI,SAAS,CAAC;AAC5F,QAAM,SAAS,SAAS,WAAW,mCAAmC;AAGtE,QAAM,QACL,OAAO,QAAQ,UAAU,YAAY,OAAO,MAAM,KAAK,IACpD,OAAO,QACP;AACJ,QAAM,OAAO,IAAI,MAAM,QAAQ;AAC/B,SAAO;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,EAAE,KAAK,IAAI;AACZ;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/turns/simplify-implementation.ts"],"sourcesContent":["import type { FlowPromptContext, StructuralProcessState } from \"@leitwerk-dev/process-sdk\";\n\nexport function buildSimplifyImplementationPrompt(\n\t_ctx: FlowPromptContext<unknown, StructuralProcessState>,\n): string {\n\treturn `Repository root: . (the current working directory)\n\nFind worthwhile ways to simplify the current implementation and nearby code, reducing lines without reducing clarity or behavior. If the implementation is already appropriately simple, say so.\n\nInspect the repository read-only and publish a concise simplification plan. Do not modify any files.`;\n}\n"],"mappings":";AAEO,SAAS,kCACf,MACS;AACT,SAAO;AAAA;AAAA;AAAA;AAAA;AAKR;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/finalization-git.ts"],"sourcesContent":["import { execFileSync } from \"node:child_process\";\nimport { existsSync, readFileSync } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { detectRepoLocatorKind, trimToNull, type WorkerErrorClass } from \"@leitwerk-dev/domain\";\nimport {\n\ttype FlowAutomaticRunContext,\n\trepositoryGitArgs,\n\trepositoryGitSubprocessEnv,\n\ttype StructuralProcessState,\n} from \"@leitwerk-dev/process-sdk\";\nimport { resolveGitBinary } from \"@leitwerk-dev/process-sdk/git-binary\";\n\nexport type DeterministicFinalizationMergeMode = \"noop\" | \"fast_forward\" | \"merge_commit\";\n\ninterface DeterministicFinalizationInput {\n\trepoPath: string;\n\tworkspaceClonePath: string;\n\tbaseBranch: string;\n\tworkBranch: string;\n\texpectedPostConflictHeadSha?: string | null;\n\tusedConflictResolution?: boolean;\n\tcommitMessage: string;\n}\n\nexport type DeterministicFinalizationResult =\n\t| {\n\t\t\toutcome: \"merge_conflict\";\n\t\t\tparams: {\n\t\t\t\theadSha: string;\n\t\t\t\tconflictedFiles: string[];\n\t\t\t\tfetchedBaseSha: string | null;\n\t\t\t};\n\t }\n\t| {\n\t\t\toutcome: \"finalized\";\n\t\t\tparams: {\n\t\t\t\theadSha: string;\n\t\t\t\tmergeMode: DeterministicFinalizationMergeMode;\n\t\t\t\tpushTarget: string;\n\t\t\t\tusedConflictResolution: boolean;\n\t\t\t};\n\t\t\tmarkdown: string;\n\t };\n\nexport class DeterministicGitError extends Error {\n\treadonly errorClass: WorkerErrorClass = \"git_error\";\n\n\tconstructor(message: string) {\n\t\tsuper(message);\n\t\tthis.name = \"DeterministicGitError\";\n\t}\n}\n\ninterface GitExecResult {\n\tok: boolean;\n\tstdout: string;\n\tstderr: string;\n\tstatus: number | null;\n}\n\ninterface LocalSourceRepo {\n\tpath: string;\n\tkind: \"bare\" | \"non_bare\";\n}\n\nfunction normalizeLines(value: string | null | undefined): string[] {\n\tif (!value) {\n\t\treturn [];\n\t}\n\treturn value\n\t\t.split(/\\r?\\n/)\n\t\t.map((line) => line.trim())\n\t\t.filter((line) => line !== \"\");\n}\n\nfunction abbreviateSha(sha: string): string {\n\treturn sha.slice(0, 12);\n}\n\nfunction describeMergeMode(mode: DeterministicFinalizationMergeMode): string {\n\tswitch (mode) {\n\t\tcase \"noop\":\n\t\t\treturn \"Already up to date\";\n\t\tcase \"fast_forward\":\n\t\t\treturn \"Fast-forwarded from origin\";\n\t\tcase \"merge_commit\":\n\t\t\treturn \"Created a merge commit\";\n\t}\n}\n\nfunction gitConfigIdentityEnv(): NodeJS.ProcessEnv {\n\tconst env = repositoryGitSubprocessEnv(\"repo\", { GIT_TERMINAL_PROMPT: \"0\" });\n\t// Identity is operator-owned repository/global Git configuration, never an\n\t// ambient worker identity or a Leitwerk override.\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 runGit(repoPath: string, args: readonly string[]): GitExecResult {\n\ttry {\n\t\tconst stdout = execFileSync(resolveGitBinary(), repositoryGitArgs(args), {\n\t\t\tcwd: repoPath,\n\t\t\tencoding: \"utf8\",\n\t\t\tenv: gitConfigIdentityEnv(),\n\t\t\tstdio: [\"ignore\", \"pipe\", \"pipe\"],\n\t\t});\n\t\treturn {\n\t\t\tok: true,\n\t\t\tstdout,\n\t\t\tstderr: \"\",\n\t\t\tstatus: 0,\n\t\t};\n\t} catch (error) {\n\t\tconst execError = error as {\n\t\t\tstatus?: number | null;\n\t\t\tstdout?: string | Buffer;\n\t\t\tstderr?: string | Buffer;\n\t\t\tmessage?: string;\n\t\t};\n\t\treturn {\n\t\t\tok: false,\n\t\t\tstdout:\n\t\t\t\ttypeof execError.stdout === \"string\"\n\t\t\t\t\t? execError.stdout\n\t\t\t\t\t: execError.stdout\n\t\t\t\t\t\t? execError.stdout.toString(\"utf8\")\n\t\t\t\t\t\t: \"\",\n\t\t\tstderr:\n\t\t\t\ttypeof execError.stderr === \"string\"\n\t\t\t\t\t? execError.stderr\n\t\t\t\t\t: execError.stderr\n\t\t\t\t\t\t? execError.stderr.toString(\"utf8\")\n\t\t\t\t\t\t: (trimToNull(execError.message) ?? \"\"),\n\t\t\tstatus: execError.status ?? null,\n\t\t};\n\t}\n}\n\nfunction git(repoPath: string, ...args: string[]): string {\n\tconst result = runGit(repoPath, args);\n\tif (!result.ok) {\n\t\tthrow new DeterministicGitError(\n\t\t\t`git ${args.join(\" \")} failed in '${repoPath}': ${trimToNull(result.stderr) ?? trimToNull(result.stdout) ?? \"unknown git error\"}`,\n\t\t);\n\t}\n\treturn result.stdout.trim();\n}\n\nfunction gitOrNull(repoPath: string, ...args: string[]): string | null {\n\tconst result = runGit(repoPath, args);\n\tif (!result.ok) {\n\t\treturn null;\n\t}\n\treturn trimToNull(result.stdout);\n}\n\nfunction repoExists(repoPath: string): boolean {\n\treturn existsSync(repoPath) && existsSync(path.join(repoPath, \".git\"));\n}\n\nfunction gitRepositoryExists(repoPath: string): boolean {\n\treturn existsSync(repoPath) && runGit(repoPath, [\"rev-parse\", \"--git-dir\"]).ok;\n}\n\nfunction currentBranch(repoPath: string): string {\n\treturn git(repoPath, \"branch\", \"--show-current\");\n}\n\nfunction currentHeadSha(repoPath: string): string {\n\treturn git(repoPath, \"rev-parse\", \"HEAD\");\n}\n\nfunction originBaseRef(baseBranch: string): string {\n\treturn `origin/${baseBranch}`;\n}\n\nfunction remoteOriginUrl(repoPath: string): string {\n\tconst remoteUrl = gitOrNull(repoPath, \"remote\", \"get-url\", \"origin\");\n\tif (!remoteUrl) {\n\t\tthrow new DeterministicGitError(`Repository '${repoPath}' does not have an 'origin' remote`);\n\t}\n\treturn remoteUrl;\n}\n\nfunction expandHomePath(value: string): string {\n\tif (value === \"~\") {\n\t\treturn homedir();\n\t}\n\tif (value.startsWith(\"~/\")) {\n\t\treturn path.join(homedir(), value.slice(2));\n\t}\n\treturn value;\n}\n\nfunction resolveLocalRepoPath(repoPath: string, repoLocator: string): string | null {\n\tif (detectRepoLocatorKind(repoLocator) !== \"local_path\") {\n\t\treturn null;\n\t}\n\tif (repoLocator.startsWith(\"file://\")) {\n\t\ttry {\n\t\t\treturn fileURLToPath(repoLocator);\n\t\t} catch {\n\t\t\treturn null;\n\t\t}\n\t}\n\treturn path.resolve(repoPath, expandHomePath(repoLocator));\n}\n\nfunction isBareRepository(repoPath: string): boolean {\n\treturn git(repoPath, \"rev-parse\", \"--is-bare-repository\") === \"true\";\n}\n\nfunction resolveLocalSourceRepo(repoPath: string): LocalSourceRepo | null {\n\tconst remoteUrl = remoteOriginUrl(repoPath);\n\tconst localRepoPath = resolveLocalRepoPath(repoPath, remoteUrl);\n\tif (!localRepoPath || !gitRepositoryExists(localRepoPath)) {\n\t\treturn null;\n\t}\n\treturn {\n\t\tpath: localRepoPath,\n\t\tkind: isBareRepository(localRepoPath) ? \"bare\" : \"non_bare\",\n\t};\n}\n\nfunction workingTreeStatus(repoPath: string): { dirtyFiles: string[] } {\n\tconst rawStatus = gitOrNull(repoPath, \"status\", \"--porcelain\");\n\tconst dirtyFiles = (rawStatus ?? \"\")\n\t\t.split(/\\r?\\n/)\n\t\t.map((line) => line.replace(/\\s+$/, \"\"))\n\t\t.filter((line) => line !== \"\")\n\t\t.map((line) => line.slice(2).trim())\n\t\t.filter((line) => line !== \"\");\n\treturn { dirtyFiles };\n}\n\nfunction conflictedFiles(repoPath: string): string[] {\n\treturn normalizeLines(gitOrNull(repoPath, \"diff\", \"--name-only\", \"--diff-filter=U\"));\n}\n\nfunction mergeHeadPath(repoPath: string): string {\n\tconst gitDir = git(repoPath, \"rev-parse\", \"--git-dir\");\n\treturn path.resolve(repoPath, gitDir, \"MERGE_HEAD\");\n}\n\nfunction mergeInProgress(repoPath: string): boolean {\n\treturn existsSync(mergeHeadPath(repoPath));\n}\n\nfunction assertExpectedCheckout(repoPath: string, workBranch: string): void {\n\tconst branch = currentBranch(repoPath);\n\tif (branch !== workBranch) {\n\t\tthrow new DeterministicGitError(\n\t\t\t`Expected '${repoPath}' to be checked out on '${workBranch}', but found '${branch || \"detached HEAD\"}'`,\n\t\t);\n\t}\n}\n\nfunction assertGitIdentity(repoPath: string): void {\n\tconst author = runGit(repoPath, [\"var\", \"GIT_AUTHOR_IDENT\"]);\n\tconst committer = runGit(repoPath, [\"var\", \"GIT_COMMITTER_IDENT\"]);\n\tif (!author.ok || !committer.ok) {\n\t\tthrow new DeterministicGitError(\n\t\t\t\"Git author/committer identity is not configured. Configure user.name and user.email in this repository or the operator's global Git config, then retry finalization.\",\n\t\t);\n\t}\n}\n\nfunction commitDirtyWorktree(repoPath: string, commitMessage: string): string {\n\tassertGitIdentity(repoPath);\n\tconst addResult = runGit(repoPath, [\"add\", \"--all\"]);\n\tif (!addResult.ok) {\n\t\tthrow new DeterministicGitError(\n\t\t\t`Failed to stage the completed change: ${trimToNull(addResult.stderr) ?? trimToNull(addResult.stdout) ?? \"unknown git error\"}`,\n\t\t);\n\t}\n\tconst commitResult = runGit(repoPath, [\n\t\t\"-c\",\n\t\t\"core.hooksPath=/dev/null\",\n\t\t\"commit\",\n\t\t\"--no-gpg-sign\",\n\t\t\"-m\",\n\t\tcommitMessage,\n\t]);\n\tif (!commitResult.ok) {\n\t\tthrow new DeterministicGitError(\n\t\t\t`Failed to commit the completed change: ${trimToNull(commitResult.stderr) ?? trimToNull(commitResult.stdout) ?? \"unknown git error\"}`,\n\t\t);\n\t}\n\tconst remaining = workingTreeStatus(repoPath);\n\tif (remaining.dirtyFiles.length > 0) {\n\t\tthrow new DeterministicGitError(\n\t\t\t`Deterministic commit left uncommitted changes: ${remaining.dirtyFiles.join(\", \")}`,\n\t\t);\n\t}\n\treturn currentHeadSha(repoPath);\n}\n\nfunction assertPostConflictCheckpoint(\n\tinput: DeterministicFinalizationInput,\n\trepoPath: string,\n): void {\n\tif (!trimToNull(input.expectedPostConflictHeadSha)) {\n\t\treturn;\n\t}\n\tif (mergeInProgress(repoPath) || conflictedFiles(repoPath).length > 0) {\n\t\tthrow new DeterministicGitError(\n\t\t\t\"Conflict-resolution helper reported a clean merge, but the repository is still in a merge-conflict state\",\n\t\t);\n\t}\n\tconst status = workingTreeStatus(repoPath);\n\tif (status.dirtyFiles.length > 0) {\n\t\tthrow new DeterministicGitError(\n\t\t\t`Conflict-resolution helper reported a clean merge, but the repository still has uncommitted changes: ${status.dirtyFiles.join(\", \")}`,\n\t\t);\n\t}\n}\n\nfunction fetchOriginBase(repoPath: string, baseBranch: string): string {\n\tconst ref = originBaseRef(baseBranch);\n\tconst fetchResult = runGit(repoPath, [\"fetch\", \"origin\", baseBranch]);\n\tif (!fetchResult.ok) {\n\t\tthrow new DeterministicGitError(\n\t\t\t`Failed to fetch '${ref}': ${trimToNull(fetchResult.stderr) ?? trimToNull(fetchResult.stdout) ?? \"unknown git error\"}`,\n\t\t);\n\t}\n\tconst baseSha = gitOrNull(repoPath, \"rev-parse\", ref);\n\tif (!baseSha) {\n\t\tthrow new DeterministicGitError(`Fetched '${ref}' but could not resolve its commit sha`);\n\t}\n\treturn baseSha;\n}\n\nfunction isAncestor(repoPath: string, olderRef: string, newerRef: string): boolean {\n\treturn runGit(repoPath, [\"merge-base\", \"--is-ancestor\", olderRef, newerRef]).ok;\n}\n\nfunction deterministicMerge(input: {\n\trepoPath: string;\n\tbaseBranch: string;\n\theadBefore: string;\n\tbaseSha: string;\n}):\n\t| { ok: true; mergeMode: DeterministicFinalizationMergeMode; headSha: string }\n\t| { ok: false; conflict: true; headSha: string; conflictedFiles: string[] } {\n\tconst { repoPath, baseBranch, headBefore, baseSha } = input;\n\tconst ref = originBaseRef(baseBranch);\n\tconst headIsAncestorOfBase = isAncestor(repoPath, headBefore, ref);\n\tconst baseIsAncestorOfHead = isAncestor(repoPath, ref, headBefore);\n\n\tif (baseIsAncestorOfHead) {\n\t\treturn { ok: true, mergeMode: \"noop\", headSha: headBefore };\n\t}\n\n\tif (headIsAncestorOfBase) {\n\t\tconst ffResult = runGit(repoPath, [\"merge\", \"--ff-only\", ref]);\n\t\tif (!ffResult.ok) {\n\t\t\tthrow new DeterministicGitError(\n\t\t\t\t`Fast-forward merge from '${ref}' failed: ${trimToNull(ffResult.stderr) ?? trimToNull(ffResult.stdout) ?? \"unknown git error\"}`,\n\t\t\t);\n\t\t}\n\t\treturn {\n\t\t\tok: true,\n\t\t\tmergeMode: \"fast_forward\",\n\t\t\theadSha: currentHeadSha(repoPath),\n\t\t};\n\t}\n\n\tassertGitIdentity(repoPath);\n\tconst mergeResult = runGit(repoPath, [\n\t\t\"-c\",\n\t\t\"core.hooksPath=/dev/null\",\n\t\t\"merge\",\n\t\t\"--no-edit\",\n\t\t\"--no-gpg-sign\",\n\t\tref,\n\t]);\n\tif (!mergeResult.ok) {\n\t\tconst conflicts = conflictedFiles(repoPath);\n\t\tif (mergeInProgress(repoPath) || conflicts.length > 0) {\n\t\t\treturn {\n\t\t\t\tok: false,\n\t\t\t\tconflict: true,\n\t\t\t\theadSha: currentHeadSha(repoPath),\n\t\t\t\tconflictedFiles: conflicts,\n\t\t\t};\n\t\t}\n\t\tthrow new DeterministicGitError(\n\t\t\t`Deterministic merge from '${ref}' failed: ${trimToNull(mergeResult.stderr) ?? trimToNull(mergeResult.stdout) ?? \"unknown git error\"}`,\n\t\t);\n\t}\n\n\tconst headAfter = currentHeadSha(repoPath);\n\treturn {\n\t\tok: true,\n\t\tmergeMode: headAfter === baseSha ? \"fast_forward\" : \"merge_commit\",\n\t\theadSha: headAfter,\n\t};\n}\n\nfunction branchRef(branch: string): string {\n\treturn `refs/heads/${branch}`;\n}\n\nfunction pushHeadToBranch(repoPath: string, branch: string): string {\n\tconst pushTarget = `origin/${branch}`;\n\tconst pushResult = runGit(repoPath, [\"push\", \"origin\", `HEAD:${branchRef(branch)}`]);\n\tif (!pushResult.ok) {\n\t\tthrow new DeterministicGitError(\n\t\t\t`Failed to push HEAD to '${pushTarget}': ${trimToNull(pushResult.stderr) ?? trimToNull(pushResult.stdout) ?? \"unknown git error\"}`,\n\t\t);\n\t}\n\treturn pushTarget;\n}\n\nfunction assertLocalSourceBaseRef(input: {\n\tlocalSourceRepoPath: string;\n\tbaseBranch: string;\n\texpectedHeadSha: string;\n\toperation: string;\n}): void {\n\tconst ref = branchRef(input.baseBranch);\n\tconst actualHeadSha = gitOrNull(input.localSourceRepoPath, \"rev-parse\", ref);\n\tif (!actualHeadSha) {\n\t\tthrow new DeterministicGitError(\n\t\t\t`Local source repo '${input.localSourceRepoPath}' does not have '${ref}' ${input.operation}`,\n\t\t);\n\t}\n\tif (actualHeadSha !== input.expectedHeadSha) {\n\t\tthrow new DeterministicGitError(\n\t\t\t`Local source repo '${input.localSourceRepoPath}' has '${ref}' at '${actualHeadSha}', but expected '${input.expectedHeadSha}' ${input.operation}`,\n\t\t);\n\t}\n}\n\nfunction assertLocalBareSourceRepoReady(\n\tlocalSourceRepoPath: string,\n\tbaseBranch: string,\n\texpectedBaseSha: string,\n): void {\n\tassertLocalSourceBaseRef({\n\t\tlocalSourceRepoPath,\n\t\tbaseBranch,\n\t\texpectedHeadSha: expectedBaseSha,\n\t\toperation: \"before finalization could publish the workspace branch. Retry finalization.\",\n\t});\n}\n\nfunction pushLocalSourceBaseBranchToOriginIfPresent(input: {\n\tlocalSourceRepoPath: string;\n\tbaseBranch: string;\n\texpectedHeadSha: string;\n}): string | null {\n\tif (!runGit(input.localSourceRepoPath, [\"remote\", \"get-url\", \"origin\"]).ok) {\n\t\treturn null;\n\t}\n\tassertLocalSourceBaseRef({\n\t\tlocalSourceRepoPath: input.localSourceRepoPath,\n\t\tbaseBranch: input.baseBranch,\n\t\texpectedHeadSha: input.expectedHeadSha,\n\t\toperation: \"before pushing it to its origin remote\",\n\t});\n\tconst ref = branchRef(input.baseBranch);\n\tconst pushTarget = originBaseRef(input.baseBranch);\n\tconst pushResult = runGit(input.localSourceRepoPath, [\"push\", \"origin\", `${ref}:${ref}`]);\n\tif (!pushResult.ok) {\n\t\tthrow new DeterministicGitError(\n\t\t\t`Failed to push local source repo '${input.localSourceRepoPath}' base branch '${input.baseBranch}' to '${pushTarget}': ${trimToNull(pushResult.stderr) ?? trimToNull(pushResult.stdout) ?? \"unknown git error\"}`,\n\t\t);\n\t}\n\treturn pushTarget;\n}\n\nfunction assertLocalBaseRepoReady(\n\tlocalBaseRepoPath: string,\n\tbaseBranch: string,\n\texpectedBaseSha: string,\n): void {\n\tconst branch = currentBranch(localBaseRepoPath);\n\tif (branch !== baseBranch) {\n\t\tthrow new DeterministicGitError(\n\t\t\t`Expected local source repo '${localBaseRepoPath}' to be checked out on '${baseBranch}', but found '${branch || \"detached HEAD\"}'`,\n\t\t);\n\t}\n\tif (mergeInProgress(localBaseRepoPath) || conflictedFiles(localBaseRepoPath).length > 0) {\n\t\tthrow new DeterministicGitError(\n\t\t\t`Local source repo '${localBaseRepoPath}' must not already be in a merge-conflict state before finalization updates '${baseBranch}'`,\n\t\t);\n\t}\n\tconst status = workingTreeStatus(localBaseRepoPath);\n\tif (status.dirtyFiles.length > 0) {\n\t\tthrow new DeterministicGitError(\n\t\t\t`Local source repo '${localBaseRepoPath}' must be clean before finalization updates '${baseBranch}': ${status.dirtyFiles.join(\", \")}`,\n\t\t);\n\t}\n\tconst actualBaseSha = currentHeadSha(localBaseRepoPath);\n\tif (actualBaseSha !== expectedBaseSha) {\n\t\tthrow new DeterministicGitError(\n\t\t\t`Local source repo '${localBaseRepoPath}' moved on '${baseBranch}' from '${expectedBaseSha}' to '${actualBaseSha}' before finalization could continue. Retry finalization.`,\n\t\t);\n\t}\n}\n\nfunction mergeWorkBranchIntoLocalBaseRepo(input: {\n\tlocalBaseRepoPath: string;\n\tbaseBranch: string;\n\tworkBranch: string;\n\texpectedBaseSha: string;\n\texpectedHeadSha: string;\n}): void {\n\tassertLocalBaseRepoReady(input.localBaseRepoPath, input.baseBranch, input.expectedBaseSha);\n\tconst mergeResult = runGit(input.localBaseRepoPath, [\n\t\t\"merge\",\n\t\t\"--ff-only\",\n\t\t`refs/heads/${input.workBranch}`,\n\t]);\n\tif (!mergeResult.ok) {\n\t\tthrow new DeterministicGitError(\n\t\t\t`Failed to fast-forward local source repo '${input.localBaseRepoPath}' branch '${input.baseBranch}' from '${input.workBranch}': ${trimToNull(mergeResult.stderr) ?? trimToNull(mergeResult.stdout) ?? \"unknown git error\"}`,\n\t\t);\n\t}\n\tconst actualHeadSha = currentHeadSha(input.localBaseRepoPath);\n\tif (actualHeadSha !== input.expectedHeadSha) {\n\t\tthrow new DeterministicGitError(\n\t\t\t`Local source repo '${input.localBaseRepoPath}' finished finalization at '${actualHeadSha}', but expected '${input.expectedHeadSha}' after merging '${input.workBranch}' into '${input.baseBranch}'`,\n\t\t);\n\t}\n}\n\nfunction updateLocalBaseRef(repoPath: string, baseBranch: string): void {\n\tconst branch = currentBranch(repoPath);\n\tif (branch === baseBranch) {\n\t\treturn;\n\t}\n\tconst updateResult = runGit(repoPath, [\"branch\", \"--force\", baseBranch, \"HEAD\"]);\n\tif (!updateResult.ok) {\n\t\tthrow new DeterministicGitError(\n\t\t\t`Failed to update the local '${baseBranch}' ref to the finalized HEAD: ${trimToNull(updateResult.stderr) ?? trimToNull(updateResult.stdout) ?? \"unknown git error\"}`,\n\t\t);\n\t}\n}\n\nfunction buildFinalizationMarkdown(input: {\n\tworkspaceClonePath: string;\n\tbaseBranch: string;\n\tworkBranch: string;\n\theadSha: string;\n\tmergeMode: DeterministicFinalizationMergeMode;\n\tpushTarget: string;\n\tlocalSourceRepoPath: string | null;\n\tlocalSourceRepoKind: LocalSourceRepo[\"kind\"] | null;\n\tworkspacePushTarget: string | null;\n\tsourceOriginPushTarget: string | null;\n\tusedConflictResolution: boolean;\n}): string {\n\tconst lines = [\n\t\t\"## Finalized change\",\n\t\t\"\",\n\t\t`- Repository workspace: ${input.workspaceClonePath}`,\n\t\t`- Work branch: ${input.workBranch}`,\n\t\t`- Base branch: ${input.baseBranch}`,\n\t\t`- Merge result: ${describeMergeMode(input.mergeMode)}`,\n\t];\n\tif (input.localSourceRepoPath) {\n\t\tlines.push(\n\t\t\t`- Local source repo: ${input.localSourceRepoPath} (${input.localSourceRepoKind === \"bare\" ? \"bare\" : \"non-bare\"})`,\n\t\t);\n\t\tif (input.workspacePushTarget) {\n\t\t\tlines.push(`- Workspace publish: HEAD -> ${input.workspacePushTarget}`);\n\t\t}\n\t\tif (input.localSourceRepoKind === \"non_bare\") {\n\t\t\tlines.push(`- Base repo merge: ${input.workBranch} -> ${input.baseBranch}`);\n\t\t}\n\t\tif (input.sourceOriginPushTarget) {\n\t\t\tlines.push(\n\t\t\t\t`- Source origin push: ${branchRef(input.baseBranch)} -> ${input.sourceOriginPushTarget}`,\n\t\t\t);\n\t\t} else {\n\t\t\tlines.push(\"- Source origin push: skipped (local source repo has no origin remote)\");\n\t\t}\n\t} else {\n\t\tlines.push(`- Pushed: HEAD -> ${input.pushTarget}`);\n\t}\n\tlines.push(\n\t\t`- Final HEAD: \\`${abbreviateSha(input.headSha)}\\``,\n\t\t`- Conflict resolution used: ${input.usedConflictResolution ? \"yes\" : \"no\"}`,\n\t);\n\treturn lines.join(\"\\n\");\n}\n\nexport interface RepositoryChangeFinalizationContextState extends StructuralProcessState {\n\tfinalization: {\n\t\texpectedPostConflictHeadSha: string | null;\n\t\tusedConflictResolution: boolean;\n\t\tgeneratedCommitMessage: string | null;\n\t};\n}\n\n/** Commit the current workspace change and non-force push only the feature branch. */\nexport function commitAndPushWorkBranch(input: {\n\trepoPath: string;\n\tworkBranch: string;\n\tcommitMessage: string;\n}) {\n\tconst repoPath = path.resolve(input.repoPath);\n\tif (!repoExists(repoPath)) {\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\tassertExpectedCheckout(repoPath, input.workBranch);\n\tif (!trimToNull(input.commitMessage)) {\n\t\tthrow new DeterministicGitError(\"A generated commit message is required before publication\");\n\t}\n\tconst conflicts = conflictedFiles(repoPath);\n\tif (mergeInProgress(repoPath) || 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 dirty = workingTreeStatus(repoPath).dirtyFiles.length > 0;\n\tconst headSha = dirty\n\t\t? commitDirtyWorktree(repoPath, input.commitMessage)\n\t\t: currentHeadSha(repoPath);\n\tconst pushTarget = pushHeadToBranch(repoPath, input.workBranch);\n\tconst remoteHead = gitOrNull(\n\t\trepoPath,\n\t\t\"ls-remote\",\n\t\t\"--heads\",\n\t\t\"origin\",\n\t\tbranchRef(input.workBranch),\n\t)\n\t\t?.split(/\\s+/)[0]\n\t\t?.trim();\n\tif (remoteHead !== headSha) {\n\t\tthrow new DeterministicGitError(\n\t\t\t`Published '${pushTarget}' resolved to '${remoteHead ?? \"missing\"}', expected '${headSha}'`,\n\t\t);\n\t}\n\treturn { headSha, pushTarget };\n}\n\nexport function runDeterministicFinalization<\n\tTParams,\n\tTState extends RepositoryChangeFinalizationContextState,\n>(ctx: FlowAutomaticRunContext<TParams, TState>): DeterministicFinalizationResult {\n\tconst progressSteps = [\n\t\t[\"validate_checkout\", \"Validate the repository checkout\"],\n\t\t[\"fetch_base\", \"Fetch and verify the latest base branch\"],\n\t\t[\"commit_merge\", \"Commit changes and integrate the base branch\"],\n\t\t[\"publish\", \"Push the finalized branch\"],\n\t] as const;\n\tconst reportProgress = (\n\t\tactiveIndex: number | null,\n\t\tcompletedCount: number,\n\t\tfailure?: { index: number; detail: string },\n\t) =>\n\t\tctx.reportProgress({\n\t\t\ttitle: \"Finalization progress\",\n\t\t\tsteps: progressSteps.map(([id, label], index) => ({\n\t\t\t\tid,\n\t\t\t\tlabel,\n\t\t\t\tstatus:\n\t\t\t\t\tindex === failure?.index\n\t\t\t\t\t\t? \"failed\"\n\t\t\t\t\t\t: index < completedCount\n\t\t\t\t\t\t\t? \"completed\"\n\t\t\t\t\t\t\t: index === activeIndex\n\t\t\t\t\t\t\t\t? \"in_progress\"\n\t\t\t\t\t\t\t\t: \"incomplete\",\n\t\t\t\t...(index === failure?.index ? { detail: failure.detail } : {}),\n\t\t\t})),\n\t\t});\n\treportProgress(0, 0);\n\tconst repo = ctx.repo.get(\"repo\");\n\tconst input: DeterministicFinalizationInput = {\n\t\trepoPath: repo.fsPath,\n\t\tworkspaceClonePath: repo.workspaceClonePath,\n\t\tbaseBranch: repo.baseBranch,\n\t\tworkBranch: repo.workBranch,\n\t\texpectedPostConflictHeadSha: ctx.state.finalization.expectedPostConflictHeadSha,\n\t\tusedConflictResolution: ctx.state.finalization.usedConflictResolution,\n\t\tcommitMessage: ctx.state.finalization.generatedCommitMessage ?? \"\",\n\t};\n\tconst repoPath = path.resolve(input.repoPath);\n\tif (!repoExists(repoPath)) {\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\tassertExpectedCheckout(repoPath, input.workBranch);\n\tif (!trimToNull(input.commitMessage)) {\n\t\tthrow new DeterministicGitError(\n\t\t\t\"No generated commit message is available; retry commit-message generation before finalization\",\n\t\t);\n\t}\n\tassertPostConflictCheckpoint(input, repoPath);\n\treportProgress(1, 1);\n\n\tlet headSha = currentHeadSha(repoPath);\n\tconst conflicts = conflictedFiles(repoPath);\n\tif (mergeInProgress(repoPath) || conflicts.length > 0) {\n\t\treportProgress(null, 1, {\n\t\t\tindex: 2,\n\t\t\tdetail: \"The checkout already contains merge conflicts\",\n\t\t});\n\t\treturn {\n\t\t\toutcome: \"merge_conflict\",\n\t\t\tparams: {\n\t\t\t\theadSha,\n\t\t\t\tconflictedFiles: conflicts,\n\t\t\t\tfetchedBaseSha: null,\n\t\t\t},\n\t\t};\n\t}\n\n\tconst baseSha = fetchOriginBase(repoPath, input.baseBranch);\n\tconst localSourceRepo = resolveLocalSourceRepo(repoPath);\n\tif (localSourceRepo?.kind === \"non_bare\") {\n\t\tassertLocalBaseRepoReady(localSourceRepo.path, input.baseBranch, baseSha);\n\t} else if (localSourceRepo?.kind === \"bare\") {\n\t\tassertLocalBareSourceRepoReady(localSourceRepo.path, input.baseBranch, baseSha);\n\t}\n\treportProgress(2, 2);\n\n\tconst status = workingTreeStatus(repoPath);\n\tif (status.dirtyFiles.length > 0) {\n\t\theadSha = commitDirtyWorktree(repoPath, input.commitMessage);\n\t}\n\tconst mergeResult = deterministicMerge({\n\t\trepoPath,\n\t\tbaseBranch: input.baseBranch,\n\t\theadBefore: headSha,\n\t\tbaseSha,\n\t});\n\tif (!mergeResult.ok) {\n\t\treportProgress(null, 2, {\n\t\t\tindex: 2,\n\t\t\tdetail: \"Base integration produced merge conflicts\",\n\t\t});\n\t\treturn {\n\t\t\toutcome: \"merge_conflict\",\n\t\t\tparams: {\n\t\t\t\theadSha: mergeResult.headSha,\n\t\t\t\tconflictedFiles: mergeResult.conflictedFiles,\n\t\t\t\tfetchedBaseSha: baseSha,\n\t\t\t},\n\t\t};\n\t}\n\n\treportProgress(3, 3);\n\tlet pushTarget: string;\n\tlet workspacePushTarget: string | null = null;\n\tlet sourceOriginPushTarget: string | null = null;\n\tif (localSourceRepo?.kind === \"non_bare\") {\n\t\tassertLocalBaseRepoReady(localSourceRepo.path, input.baseBranch, baseSha);\n\t\tworkspacePushTarget = pushHeadToBranch(repoPath, input.workBranch);\n\t\tmergeWorkBranchIntoLocalBaseRepo({\n\t\t\tlocalBaseRepoPath: localSourceRepo.path,\n\t\t\tbaseBranch: input.baseBranch,\n\t\t\tworkBranch: input.workBranch,\n\t\t\texpectedBaseSha: baseSha,\n\t\t\texpectedHeadSha: mergeResult.headSha,\n\t\t});\n\t\tsourceOriginPushTarget = pushLocalSourceBaseBranchToOriginIfPresent({\n\t\t\tlocalSourceRepoPath: localSourceRepo.path,\n\t\t\tbaseBranch: input.baseBranch,\n\t\t\texpectedHeadSha: mergeResult.headSha,\n\t\t});\n\t\tpushTarget = sourceOriginPushTarget ?? originBaseRef(input.baseBranch);\n\t} else if (localSourceRepo?.kind === \"bare\") {\n\t\tassertLocalBareSourceRepoReady(localSourceRepo.path, input.baseBranch, baseSha);\n\t\tworkspacePushTarget = pushHeadToBranch(repoPath, input.baseBranch);\n\t\tsourceOriginPushTarget = pushLocalSourceBaseBranchToOriginIfPresent({\n\t\t\tlocalSourceRepoPath: localSourceRepo.path,\n\t\t\tbaseBranch: input.baseBranch,\n\t\t\texpectedHeadSha: mergeResult.headSha,\n\t\t});\n\t\tpushTarget = sourceOriginPushTarget ?? workspacePushTarget;\n\t} else {\n\t\tpushTarget = pushHeadToBranch(repoPath, input.baseBranch);\n\t}\n\tupdateLocalBaseRef(repoPath, input.baseBranch);\n\tconst finalHeadSha = currentHeadSha(repoPath);\n\treportProgress(null, 4);\n\treturn {\n\t\toutcome: \"finalized\",\n\t\tparams: {\n\t\t\theadSha: finalHeadSha,\n\t\t\tmergeMode: mergeResult.mergeMode,\n\t\t\tpushTarget,\n\t\t\tusedConflictResolution: input.usedConflictResolution === true,\n\t\t},\n\t\tmarkdown: buildFinalizationMarkdown({\n\t\t\tworkspaceClonePath: input.workspaceClonePath,\n\t\t\tbaseBranch: input.baseBranch,\n\t\t\tworkBranch: input.workBranch,\n\t\t\theadSha: finalHeadSha,\n\t\t\tmergeMode: mergeResult.mergeMode,\n\t\t\tpushTarget,\n\t\t\tlocalSourceRepoPath: localSourceRepo?.path ?? null,\n\t\t\tlocalSourceRepoKind: localSourceRepo?.kind ?? null,\n\t\t\tworkspacePushTarget,\n\t\t\tsourceOriginPushTarget,\n\t\t\tusedConflictResolution: input.usedConflictResolution === true,\n\t\t}),\n\t};\n}\n\nexport function readMergeMessage(repoPath: string): string | null {\n\tconst messagePath = path.resolve(repoPath, git(repoPath, \"rev-parse\", \"--git-dir\"), \"MERGE_MSG\");\n\tif (!existsSync(messagePath)) {\n\t\treturn null;\n\t}\n\treturn trimToNull(readFileSync(messagePath, \"utf8\"));\n}\n"],"mappings":";AAAA,SAAS,oBAAoB;AAC7B,SAAS,YAAY,oBAAoB;AACzC,SAAS,eAAe;AACxB,OAAO,UAAU;AACjB,SAAS,qBAAqB;AAC9B,SAAS,uBAAuB,kBAAyC;AACzE;AAAA,EAEC;AAAA,EACA;AAAA,OAEM;AACP,SAAS,wBAAwB;AAkC1B,IAAM,wBAAN,cAAoC,MAAM;AAAA,EACvC,aAA+B;AAAA,EAExC,YAAY,SAAiB;AAC5B,UAAM,OAAO;AACb,SAAK,OAAO;AAAA,EACb;AACD;AAcA,SAAS,eAAe,OAA4C;AACnE,MAAI,CAAC,OAAO;AACX,WAAO,CAAC;AAAA,EACT;AACA,SAAO,MACL,MAAM,OAAO,EACb,IAAI,CAAC,SAAS,KAAK,KAAK,CAAC,EACzB,OAAO,CAAC,SAAS,SAAS,EAAE;AAC/B;AAEA,SAAS,cAAc,KAAqB;AAC3C,SAAO,IAAI,MAAM,GAAG,EAAE;AACvB;AAEA,SAAS,kBAAkB,MAAkD;AAC5E,UAAQ,MAAM;AAAA,IACb,KAAK;AACJ,aAAO;AAAA,IACR,KAAK;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ACjE,6BAAyB,2CAA2C;AAAA,MACnE,qBAAqB,gBAAgB;AAAA,MACrC,YAAY,MAAM;AAAA,MAClB,iBAAiB,YAAY;AAAA,IAC9B,CAAC;AACD,iBAAa,0BAA0B;AAAA,EACxC,OAAO;AACN,iBAAa,iBAAiB,UAAU,MAAM,UAAU;AAAA,EACzD;AACA,qBAAmB,UAAU,MAAM,UAAU;AAC7C,QAAM,eAAe,eAAe,QAAQ;AAC5C,iBAAe,MAAM,CAAC;AACtB,SAAO;AAAA,IACN,SAAS;AAAA,IACT,QAAQ;AAAA,MACP,SAAS;AAAA,MACT,WAAW,YAAY;AAAA,MACvB;AAAA,MACA,wBAAwB,MAAM,2BAA2B;AAAA,IAC1D;AAAA,IACA,UAAU,0BAA0B;AAAA,MACnC,oBAAoB,MAAM;AAAA,MAC1B,YAAY,MAAM;AAAA,MAClB,YAAY,MAAM;AAAA,MAClB,SAAS;AAAA,MACT,WAAW,YAAY;AAAA,MACvB;AAAA,MACA,qBAAqB,iBAAiB,QAAQ;AAAA,MAC9C,qBAAqB,iBAAiB,QAAQ;AAAA,MAC9C;AAAA,MACA;AAAA,MACA,wBAAwB,MAAM,2BAA2B;AAAA,IAC1D,CAAC;AAAA,EACF;AACD;AAEO,SAAS,iBAAiB,UAAiC;AACjE,QAAM,cAAc,KAAK,QAAQ,UAAU,IAAI,UAAU,aAAa,WAAW,GAAG,WAAW;AAC/F,MAAI,CAAC,WAAW,WAAW,GAAG;AAC7B,WAAO;AAAA,EACR;AACA,SAAO,WAAW,aAAa,aAAa,MAAM,CAAC;AACpD;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/turns/implement.ts"],"sourcesContent":["import type { FlowPromptContext, StructuralProcessState } from \"@leitwerk-dev/process-sdk\";\n\nexport function buildImplementPrompt(\n\tctx: FlowPromptContext<unknown, StructuralProcessState, \"plan\">,\n): string {\n\treturn `Implement this requested change:\n${ctx.prompts.initial}\n\nRepository root: . (the current working directory)\n\nFollow this plan:\n${ctx.input.plan}\n\nRules:\n- keep going until the change is complete; do any necessary additional passes without asking\n- make repository changes only inside the current working directory\n- treat . as the repository root for file edits and git commands\n- do not read from or write to any original source repository path outside the process workspace\n- keep the implementation coherent and complete\n- publish the implementation summary when done`;\n}\n"],"mappings":";AAEO,SAAS,qBACf,KACS;AACT,SAAO;AAAA,EACN,IAAI,QAAQ,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA,EAKnB,IAAI,MAAM,IAAI;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAShB;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/turns/review-implementation.ts"],"sourcesContent":["import type { FlowPromptContext, StructuralProcessState } from \"@leitwerk-dev/process-sdk\";\n\nexport function buildReviewImplementationPrompt(\n\tctx: FlowPromptContext<unknown, StructuralProcessState>,\n): string {\n\tconst repo = ctx.repo.get(\"repo\");\n\treturn `Repository root: . (the current working directory)\n\nReview the current implementation of this requested change:\n${ctx.prompts.initial}\n\nInspect the changes with \\`git diff --stat $(git merge-base ${repo.baseBranch} HEAD)\\`. Check for:\n- bugs and logic errors\n- security issues\n- error handling gaps\n- missing or misplaced tests\n- unnecessary abstractions, duplication, and other avoidable complexity\n\nFor each issue, give a concise fix.\n\nRules:\n- inspect code only inside the current working directory\n- treat . as the repository root for read-only inspection\n- use bash only for read-only inspection (e.g. git diff, git status, rg, tree, file listing, read-only http/CLI calls)\n- do not modify files, branches, commits, or git index state\n- do not read from or write to any original source repository path outside the process workspace\n- publish a short Markdown approval note if the implementation is ready\n- publish concise, actionable Markdown feedback if the implementation needs changes`;\n}\n"],"mappings":";AAEO,SAAS,gCACf,KACS;AACT,QAAM,OAAO,IAAI,KAAK,IAAI,MAAM;AAChC,SAAO;AAAA;AAAA;AAAA,EAGN,IAAI,QAAQ,OAAO;AAAA;AAAA,8DAEyC,KAAK,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiB7E;","names":[]}
|
package/dist/chunk-Y2S6JFVO.js
DELETED
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
// src/repository-change-launch.ts
|
|
2
|
-
import { parseRepoLocator, trimString } from "@leitwerk-dev/domain";
|
|
3
|
-
function repositoryChangeParamsRecord(value, displayName) {
|
|
4
|
-
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
5
|
-
throw new Error(`${displayName} params must be an object`);
|
|
6
|
-
}
|
|
7
|
-
return value;
|
|
8
|
-
}
|
|
9
|
-
function normalizeRepositoryChangeParamsInput(value, displayName) {
|
|
10
|
-
const record = repositoryChangeParamsRecord(value, displayName);
|
|
11
|
-
const rawRepoLocator = trimString(record.repoLocator);
|
|
12
|
-
return {
|
|
13
|
-
launchKind: trimString(record.launchKind),
|
|
14
|
-
repoLocator: parseRepoLocator(rawRepoLocator)?.value ?? rawRepoLocator,
|
|
15
|
-
baseBranch: trimString(record.baseBranch) || "main",
|
|
16
|
-
workBranch: trimString(record.workBranch),
|
|
17
|
-
prompt: trimString(record.prompt),
|
|
18
|
-
importedPlanMarkdown: trimString(record.importedPlanMarkdown)
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
function createRepositoryChangeParamsCodec(input) {
|
|
22
|
-
return {
|
|
23
|
-
parse(value) {
|
|
24
|
-
const { importedPlanMarkdown, ...shared } = input.normalize(value);
|
|
25
|
-
if (shared.launchKind === "requested_change") return shared;
|
|
26
|
-
if (shared.launchKind === "imported_plan") {
|
|
27
|
-
return { ...shared, launchKind: shared.launchKind, importedPlanMarkdown };
|
|
28
|
-
}
|
|
29
|
-
throw new Error(`${input.displayName} params require a valid launchKind`);
|
|
30
|
-
},
|
|
31
|
-
serialize: (value) => value
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
function formatRepositoryChangeLaunchErrors(errors) {
|
|
35
|
-
return errors.map((error) => `${error.fieldId ?? "launch"}: ${error.message}`).join("; ");
|
|
36
|
-
}
|
|
37
|
-
function createRepositoryChangeLaunchPlanner(config) {
|
|
38
|
-
return {
|
|
39
|
-
plan({ input, metadata }) {
|
|
40
|
-
const params = config.normalize(input);
|
|
41
|
-
const errors = [];
|
|
42
|
-
if (params.launchKind !== "requested_change" && params.launchKind !== "imported_plan") {
|
|
43
|
-
errors.push({
|
|
44
|
-
code: "custom_rule",
|
|
45
|
-
fieldId: "launchKind",
|
|
46
|
-
message: "launchKind must be requested_change or imported_plan"
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
const locatorError = config.validateRepoLocator(params.repoLocator);
|
|
50
|
-
if (locatorError) {
|
|
51
|
-
errors.push({
|
|
52
|
-
code: "invalid_repo_locator",
|
|
53
|
-
fieldId: "repoLocator",
|
|
54
|
-
message: locatorError
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
if (params.workBranch && params.workBranch === params.baseBranch) {
|
|
58
|
-
errors.push({
|
|
59
|
-
code: "custom_rule",
|
|
60
|
-
fieldId: "workBranch",
|
|
61
|
-
message: "workBranch cannot match baseBranch"
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
if (!params.prompt) {
|
|
65
|
-
errors.push({ code: "required", fieldId: "prompt", message: "prompt is required" });
|
|
66
|
-
}
|
|
67
|
-
if (params.launchKind === "imported_plan" && !params.importedPlanMarkdown) {
|
|
68
|
-
errors.push({
|
|
69
|
-
code: "required",
|
|
70
|
-
fieldId: "importedPlanMarkdown",
|
|
71
|
-
message: "importedPlanMarkdown is required for imported_plan launches"
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
if (params.launchKind === "requested_change" && "importedPlanMarkdown" in input) {
|
|
75
|
-
errors.push({
|
|
76
|
-
code: "custom_rule",
|
|
77
|
-
fieldId: "importedPlanMarkdown",
|
|
78
|
-
message: "importedPlanMarkdown is not allowed for requested_change launches"
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
errors.push(...config.validate?.(input, params) ?? []);
|
|
82
|
-
if (errors.length > 0) return { ok: false, errors };
|
|
83
|
-
const prepared = config.prepare?.(params) ?? params;
|
|
84
|
-
const hasWorkBranch = prepared.workBranch !== "";
|
|
85
|
-
return {
|
|
86
|
-
ok: true,
|
|
87
|
-
launchConfig: {
|
|
88
|
-
processId: config.processId,
|
|
89
|
-
params: prepared,
|
|
90
|
-
startTurnId: config.deferWithoutWorkBranch && !hasWorkBranch ? null : prepared.launchKind === "imported_plan" ? "import_plan" : "generate_plan",
|
|
91
|
-
titleSourceFields: [{ label: "Requested change", value: prepared.prompt }],
|
|
92
|
-
metadata: metadata ?? null,
|
|
93
|
-
projects: [
|
|
94
|
-
{
|
|
95
|
-
key: "repo",
|
|
96
|
-
repoLocator: prepared.repoLocator,
|
|
97
|
-
baseBranch: prepared.baseBranch,
|
|
98
|
-
workBranch: hasWorkBranch ? prepared.workBranch : null
|
|
99
|
-
}
|
|
100
|
-
]
|
|
101
|
-
}
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
function createRepositoryChangeUiLauncher(config) {
|
|
107
|
-
return {
|
|
108
|
-
id: config.id,
|
|
109
|
-
label: config.title,
|
|
110
|
-
description: "Plan, implement, review, and finalize a change in a single git repository",
|
|
111
|
-
visibility: "ui",
|
|
112
|
-
ui: {
|
|
113
|
-
card: {
|
|
114
|
-
title: config.title,
|
|
115
|
-
description: "Run a plan \u2192 implement \u2192 review \u2192 finalize loop against any local or remote git repository."
|
|
116
|
-
},
|
|
117
|
-
launchConfigSchema: {
|
|
118
|
-
id: config.formId,
|
|
119
|
-
title: config.title,
|
|
120
|
-
fields: [
|
|
121
|
-
{
|
|
122
|
-
id: "repoLocator",
|
|
123
|
-
label: "Repository path or URL",
|
|
124
|
-
kind: "text",
|
|
125
|
-
required: true,
|
|
126
|
-
placeholder: "/path/to/repo or https://git.example.com/team/repo.git",
|
|
127
|
-
description: "Use a local checkout path or a remote Git URL.",
|
|
128
|
-
rememberRecentValues: true
|
|
129
|
-
},
|
|
130
|
-
...config.sshCredentials ? [
|
|
131
|
-
{
|
|
132
|
-
id: "sshCredentialRef",
|
|
133
|
-
label: "SSH credential profile",
|
|
134
|
-
kind: "text",
|
|
135
|
-
required: true,
|
|
136
|
-
placeholder: "default",
|
|
137
|
-
description: "Profile from extensions.git-ssh.credentials."
|
|
138
|
-
}
|
|
139
|
-
] : [],
|
|
140
|
-
{
|
|
141
|
-
id: "baseBranch",
|
|
142
|
-
label: "Base branch",
|
|
143
|
-
kind: "text",
|
|
144
|
-
placeholder: "main",
|
|
145
|
-
description: "Leave this as main unless the change should merge somewhere else."
|
|
146
|
-
},
|
|
147
|
-
{
|
|
148
|
-
id: "workBranch",
|
|
149
|
-
label: "Work branch",
|
|
150
|
-
kind: "text",
|
|
151
|
-
placeholder: "feature/my-change",
|
|
152
|
-
description: config.workBranchDescription
|
|
153
|
-
},
|
|
154
|
-
{
|
|
155
|
-
id: "prompt",
|
|
156
|
-
label: "Requested change",
|
|
157
|
-
kind: "textarea",
|
|
158
|
-
required: true,
|
|
159
|
-
placeholder: "Describe the change this process should plan, implement, and review."
|
|
160
|
-
}
|
|
161
|
-
],
|
|
162
|
-
submitLabel: "Start change"
|
|
163
|
-
},
|
|
164
|
-
resolveDefaults: () => ({
|
|
165
|
-
repoLocator: "",
|
|
166
|
-
...config.sshCredentials ? { sshCredentialRef: "default" } : {},
|
|
167
|
-
baseBranch: "main",
|
|
168
|
-
workBranch: "",
|
|
169
|
-
prompt: ""
|
|
170
|
-
}),
|
|
171
|
-
resolveRelaunchInput: config.resolveRelaunchInput,
|
|
172
|
-
resolveLaunchConfig: config.resolveLaunchConfig
|
|
173
|
-
}
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
export {
|
|
178
|
-
repositoryChangeParamsRecord,
|
|
179
|
-
normalizeRepositoryChangeParamsInput,
|
|
180
|
-
createRepositoryChangeParamsCodec,
|
|
181
|
-
formatRepositoryChangeLaunchErrors,
|
|
182
|
-
createRepositoryChangeLaunchPlanner,
|
|
183
|
-
createRepositoryChangeUiLauncher
|
|
184
|
-
};
|
|
185
|
-
//# sourceMappingURL=chunk-Y2S6JFVO.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/repository-change-launch.ts"],"sourcesContent":["import { parseRepoLocator, trimString } from \"@leitwerk-dev/domain\";\nimport type {\n\tCodec,\n\tLauncherValidationError,\n\tProcessLaunchConfig,\n\tProcessLauncherDefinition,\n\tUiLauncherDefinition,\n} from \"@leitwerk-dev/process-sdk\";\n\nexport type RepositoryChangeLaunchKind = \"requested_change\" | \"imported_plan\";\n\nexport interface RepositoryChangeParamsBase {\n\trepoLocator: string;\n\tbaseBranch: string;\n\tworkBranch: string;\n\tprompt: string;\n\tlaunchKind: RepositoryChangeLaunchKind;\n\timportedPlanMarkdown?: string;\n}\n\nexport type RepositoryChangeLaunchParams<TExtra extends object = Record<never, never>> = TExtra &\n\tOmit<RepositoryChangeParamsBase, \"launchKind\" | \"importedPlanMarkdown\"> &\n\t(\n\t\t| { launchKind: \"requested_change\" }\n\t\t| { launchKind: \"imported_plan\"; importedPlanMarkdown: string }\n\t);\n\nexport interface NormalizedRepositoryChangeParamsInput {\n\tlaunchKind: string;\n\trepoLocator: string;\n\tbaseBranch: string;\n\tworkBranch: string;\n\tprompt: string;\n\timportedPlanMarkdown: string;\n}\n\nexport function repositoryChangeParamsRecord(\n\tvalue: unknown,\n\tdisplayName: string,\n): Record<string, unknown> {\n\tif (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n\t\tthrow new Error(`${displayName} params must be an object`);\n\t}\n\treturn value as Record<string, unknown>;\n}\n\nexport function normalizeRepositoryChangeParamsInput(\n\tvalue: unknown,\n\tdisplayName: string,\n): NormalizedRepositoryChangeParamsInput {\n\tconst record = repositoryChangeParamsRecord(value, displayName);\n\tconst rawRepoLocator = trimString(record.repoLocator);\n\treturn {\n\t\tlaunchKind: trimString(record.launchKind),\n\t\trepoLocator: parseRepoLocator(rawRepoLocator)?.value ?? rawRepoLocator,\n\t\tbaseBranch: trimString(record.baseBranch) || \"main\",\n\t\tworkBranch: trimString(record.workBranch),\n\t\tprompt: trimString(record.prompt),\n\t\timportedPlanMarkdown: trimString(record.importedPlanMarkdown),\n\t};\n}\n\nexport function createRepositoryChangeParamsCodec<T extends RepositoryChangeParamsBase>(input: {\n\tdisplayName: string;\n\tnormalize(\n\t\tvalue: unknown,\n\t): NormalizedRepositoryChangeParamsInput & Omit<T, keyof RepositoryChangeParamsBase>;\n}): Codec<T> {\n\treturn {\n\t\tparse(value) {\n\t\t\tconst { importedPlanMarkdown, ...shared } = input.normalize(value);\n\t\t\tif (shared.launchKind === \"requested_change\") return shared as T;\n\t\t\tif (shared.launchKind === \"imported_plan\") {\n\t\t\t\treturn { ...shared, launchKind: shared.launchKind, importedPlanMarkdown } as T;\n\t\t\t}\n\t\t\tthrow new Error(`${input.displayName} params require a valid launchKind`);\n\t\t},\n\t\tserialize: (value) => value,\n\t};\n}\n\nexport interface RepositoryChangeLaunchPlannerInput {\n\tinput: Record<string, unknown>;\n\tmetadata?: Record<string, unknown> | null;\n}\n\nexport type RepositoryChangeLaunchResolution<T extends RepositoryChangeParamsBase> =\n\t| { ok: true; launchConfig: ProcessLaunchConfig<T> }\n\t| { ok: false; errors: readonly LauncherValidationError[] };\n\nexport interface RepositoryChangeLaunchPlanner<T extends RepositoryChangeParamsBase> {\n\tplan(input: RepositoryChangeLaunchPlannerInput): RepositoryChangeLaunchResolution<T>;\n}\n\nexport function formatRepositoryChangeLaunchErrors(\n\terrors: readonly LauncherValidationError[],\n): string {\n\treturn errors.map((error) => `${error.fieldId ?? \"launch\"}: ${error.message}`).join(\"; \");\n}\n\nexport function createRepositoryChangeLaunchPlanner<T extends RepositoryChangeParamsBase>(config: {\n\tprocessId: string;\n\tnormalize(input: Record<string, unknown>): T & { importedPlanMarkdown?: string };\n\tvalidateRepoLocator(repoLocator: string): string | null;\n\tvalidate?(input: Record<string, unknown>, params: T): readonly LauncherValidationError[];\n\tprepare?(params: T): T;\n\tdeferWithoutWorkBranch?: boolean;\n}): RepositoryChangeLaunchPlanner<T> {\n\treturn {\n\t\tplan({ input, metadata }) {\n\t\t\tconst params = config.normalize(input);\n\t\t\tconst errors: LauncherValidationError[] = [];\n\t\t\tif (params.launchKind !== \"requested_change\" && params.launchKind !== \"imported_plan\") {\n\t\t\t\terrors.push({\n\t\t\t\t\tcode: \"custom_rule\",\n\t\t\t\t\tfieldId: \"launchKind\",\n\t\t\t\t\tmessage: \"launchKind must be requested_change or imported_plan\",\n\t\t\t\t});\n\t\t\t}\n\t\t\tconst locatorError = config.validateRepoLocator(params.repoLocator);\n\t\t\tif (locatorError) {\n\t\t\t\terrors.push({\n\t\t\t\t\tcode: \"invalid_repo_locator\",\n\t\t\t\t\tfieldId: \"repoLocator\",\n\t\t\t\t\tmessage: locatorError,\n\t\t\t\t});\n\t\t\t}\n\t\t\tif (params.workBranch && params.workBranch === params.baseBranch) {\n\t\t\t\terrors.push({\n\t\t\t\t\tcode: \"custom_rule\",\n\t\t\t\t\tfieldId: \"workBranch\",\n\t\t\t\t\tmessage: \"workBranch cannot match baseBranch\",\n\t\t\t\t});\n\t\t\t}\n\t\t\tif (!params.prompt) {\n\t\t\t\terrors.push({ code: \"required\", fieldId: \"prompt\", message: \"prompt is required\" });\n\t\t\t}\n\t\t\tif (params.launchKind === \"imported_plan\" && !params.importedPlanMarkdown) {\n\t\t\t\terrors.push({\n\t\t\t\t\tcode: \"required\",\n\t\t\t\t\tfieldId: \"importedPlanMarkdown\",\n\t\t\t\t\tmessage: \"importedPlanMarkdown is required for imported_plan launches\",\n\t\t\t\t});\n\t\t\t}\n\t\t\tif (params.launchKind === \"requested_change\" && \"importedPlanMarkdown\" in input) {\n\t\t\t\terrors.push({\n\t\t\t\t\tcode: \"custom_rule\",\n\t\t\t\t\tfieldId: \"importedPlanMarkdown\",\n\t\t\t\t\tmessage: \"importedPlanMarkdown is not allowed for requested_change launches\",\n\t\t\t\t});\n\t\t\t}\n\t\t\terrors.push(...(config.validate?.(input, params) ?? []));\n\t\t\tif (errors.length > 0) return { ok: false, errors };\n\n\t\t\tconst prepared = config.prepare?.(params) ?? params;\n\t\t\tconst hasWorkBranch = prepared.workBranch !== \"\";\n\t\t\treturn {\n\t\t\t\tok: true,\n\t\t\t\tlaunchConfig: {\n\t\t\t\t\tprocessId: config.processId,\n\t\t\t\t\tparams: prepared,\n\t\t\t\t\tstartTurnId:\n\t\t\t\t\t\tconfig.deferWithoutWorkBranch && !hasWorkBranch\n\t\t\t\t\t\t\t? null\n\t\t\t\t\t\t\t: prepared.launchKind === \"imported_plan\"\n\t\t\t\t\t\t\t\t? \"import_plan\"\n\t\t\t\t\t\t\t\t: \"generate_plan\",\n\t\t\t\t\ttitleSourceFields: [{ label: \"Requested change\", value: prepared.prompt }],\n\t\t\t\t\tmetadata: metadata ?? null,\n\t\t\t\t\tprojects: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tkey: \"repo\",\n\t\t\t\t\t\t\trepoLocator: prepared.repoLocator,\n\t\t\t\t\t\t\tbaseBranch: prepared.baseBranch,\n\t\t\t\t\t\t\tworkBranch: hasWorkBranch ? prepared.workBranch : null,\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\t};\n}\n\nexport function createRepositoryChangeUiLauncher<T extends RepositoryChangeParamsBase>(config: {\n\tid: string;\n\tformId: string;\n\ttitle: string;\n\tworkBranchDescription: string;\n\tsshCredentials?: boolean;\n\tresolveRelaunchInput?: UiLauncherDefinition<T>[\"resolveRelaunchInput\"];\n\tresolveLaunchConfig: UiLauncherDefinition<T>[\"resolveLaunchConfig\"];\n}): ProcessLauncherDefinition<T> {\n\treturn {\n\t\tid: config.id,\n\t\tlabel: config.title,\n\t\tdescription: \"Plan, implement, review, and finalize a change in a single git repository\",\n\t\tvisibility: \"ui\",\n\t\tui: {\n\t\t\tcard: {\n\t\t\t\ttitle: config.title,\n\t\t\t\tdescription:\n\t\t\t\t\t\"Run a plan → implement → review → finalize loop against any local or remote git repository.\",\n\t\t\t},\n\t\t\tlaunchConfigSchema: {\n\t\t\t\tid: config.formId,\n\t\t\t\ttitle: config.title,\n\t\t\t\tfields: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"repoLocator\",\n\t\t\t\t\t\tlabel: \"Repository path or URL\",\n\t\t\t\t\t\tkind: \"text\",\n\t\t\t\t\t\trequired: true,\n\t\t\t\t\t\tplaceholder: \"/path/to/repo or https://git.example.com/team/repo.git\",\n\t\t\t\t\t\tdescription: \"Use a local checkout path or a remote Git URL.\",\n\t\t\t\t\t\trememberRecentValues: true,\n\t\t\t\t\t},\n\t\t\t\t\t...(config.sshCredentials\n\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tid: \"sshCredentialRef\",\n\t\t\t\t\t\t\t\t\tlabel: \"SSH credential profile\",\n\t\t\t\t\t\t\t\t\tkind: \"text\" as const,\n\t\t\t\t\t\t\t\t\trequired: true,\n\t\t\t\t\t\t\t\t\tplaceholder: \"default\",\n\t\t\t\t\t\t\t\t\tdescription: \"Profile from extensions.git-ssh.credentials.\",\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\t\tid: \"baseBranch\",\n\t\t\t\t\t\tlabel: \"Base branch\",\n\t\t\t\t\t\tkind: \"text\",\n\t\t\t\t\t\tplaceholder: \"main\",\n\t\t\t\t\t\tdescription: \"Leave this as main unless the change should merge somewhere else.\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"workBranch\",\n\t\t\t\t\t\tlabel: \"Work branch\",\n\t\t\t\t\t\tkind: \"text\",\n\t\t\t\t\t\tplaceholder: \"feature/my-change\",\n\t\t\t\t\t\tdescription: config.workBranchDescription,\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"prompt\",\n\t\t\t\t\t\tlabel: \"Requested change\",\n\t\t\t\t\t\tkind: \"textarea\",\n\t\t\t\t\t\trequired: true,\n\t\t\t\t\t\tplaceholder: \"Describe the change this process should plan, implement, and review.\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tsubmitLabel: \"Start change\",\n\t\t\t},\n\t\t\tresolveDefaults: () => ({\n\t\t\t\trepoLocator: \"\",\n\t\t\t\t...(config.sshCredentials ? { sshCredentialRef: \"default\" } : {}),\n\t\t\t\tbaseBranch: \"main\",\n\t\t\t\tworkBranch: \"\",\n\t\t\t\tprompt: \"\",\n\t\t\t}),\n\t\t\tresolveRelaunchInput: config.resolveRelaunchInput,\n\t\t\tresolveLaunchConfig: config.resolveLaunchConfig,\n\t\t},\n\t};\n}\n"],"mappings":";AAAA,SAAS,kBAAkB,kBAAkB;AAoCtC,SAAS,6BACf,OACA,aAC0B;AAC1B,MAAI,OAAO,UAAU,YAAY,UAAU,QAAQ,MAAM,QAAQ,KAAK,GAAG;AACxE,UAAM,IAAI,MAAM,GAAG,WAAW,2BAA2B;AAAA,EAC1D;AACA,SAAO;AACR;AAEO,SAAS,qCACf,OACA,aACwC;AACxC,QAAM,SAAS,6BAA6B,OAAO,WAAW;AAC9D,QAAM,iBAAiB,WAAW,OAAO,WAAW;AACpD,SAAO;AAAA,IACN,YAAY,WAAW,OAAO,UAAU;AAAA,IACxC,aAAa,iBAAiB,cAAc,GAAG,SAAS;AAAA,IACxD,YAAY,WAAW,OAAO,UAAU,KAAK;AAAA,IAC7C,YAAY,WAAW,OAAO,UAAU;AAAA,IACxC,QAAQ,WAAW,OAAO,MAAM;AAAA,IAChC,sBAAsB,WAAW,OAAO,oBAAoB;AAAA,EAC7D;AACD;AAEO,SAAS,kCAAwE,OAK3E;AACZ,SAAO;AAAA,IACN,MAAM,OAAO;AACZ,YAAM,EAAE,sBAAsB,GAAG,OAAO,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AA,YACb,sBAAsB;AAAA,UACvB;AAAA,UACA,GAAI,OAAO,iBACR;AAAA,YACA;AAAA,cACC,IAAI;AAAA,cACJ,OAAO;AAAA,cACP,MAAM;AAAA,cACN,UAAU;AAAA,cACV,aAAa;AAAA,cACb,aAAa;AAAA,YACd;AAAA,UACD,IACC,CAAC;AAAA,UACJ;AAAA,YACC,IAAI;AAAA,YACJ,OAAO;AAAA,YACP,MAAM;AAAA,YACN,aAAa;AAAA,YACb,aAAa;AAAA,UACd;AAAA,UACA;AAAA,YACC,IAAI;AAAA,YACJ,OAAO;AAAA,YACP,MAAM;AAAA,YACN,aAAa;AAAA,YACb,aAAa,OAAO;AAAA,UACrB;AAAA,UACA;AAAA,YACC,IAAI;AAAA,YACJ,OAAO;AAAA,YACP,MAAM;AAAA,YACN,UAAU;AAAA,YACV,aAAa;AAAA,UACd;AAAA,QACD;AAAA,QACA,aAAa;AAAA,MACd;AAAA,MACA,iBAAiB,OAAO;AAAA,QACvB,aAAa;AAAA,QACb,GAAI,OAAO,iBAAiB,EAAE,kBAAkB,UAAU,IAAI,CAAC;AAAA,QAC/D,YAAY;AAAA,QACZ,YAAY;AAAA,QACZ,QAAQ;AAAA,MACT;AAAA,MACA,sBAAsB,OAAO;AAAA,MAC7B,qBAAqB,OAAO;AAAA,IAC7B;AAAA,EACD;AACD;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/repository-change-state.ts"],"sourcesContent":["import type { Codec, StructuralProcessState } from \"@leitwerk-dev/process-sdk\";\nimport { parseStructuralProcessState } from \"@leitwerk-dev/process-sdk\";\n\nexport interface RepositoryChangeFinalizationState {\n\texpectedPostConflictHeadSha: string | null;\n\tusedConflictResolution: boolean;\n\tfinalizationSummaryMarkdown: string | null;\n\tfinalizedHeadSha: string | null;\n\tgeneratedCommitMessage: string | null;\n}\n\nexport interface RepositoryChangeState extends StructuralProcessState {\n\tfinalization: RepositoryChangeFinalizationState;\n\t/** Namespaced state owned by a caller-supplied publication workflow. */\n\textensionState?: Record<string, unknown>;\n}\n\nexport function createEmptyRepositoryChangeFinalizationState(): RepositoryChangeFinalizationState {\n\treturn {\n\t\texpectedPostConflictHeadSha: null,\n\t\tusedConflictResolution: false,\n\t\tfinalizationSummaryMarkdown: null,\n\t\tfinalizedHeadSha: null,\n\t\tgeneratedCommitMessage: null,\n\t};\n}\n\nfunction stringOrNull(value: unknown): string | null {\n\treturn typeof value === \"string\" ? value : null;\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\texpectedPostConflictHeadSha: stringOrNull(record.expectedPostConflictHeadSha),\n\t\tusedConflictResolution: record.usedConflictResolution === true,\n\t\tfinalizationSummaryMarkdown: stringOrNull(record.finalizationSummaryMarkdown),\n\t\tfinalizedHeadSha: stringOrNull(record.finalizedHeadSha),\n\t\t// Backward-compatible decoding for state persisted before commit-message generation.\n\t\tgeneratedCommitMessage: stringOrNull(record.generatedCommitMessage),\n\t};\n}\n\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};\n\t},\n\tserialize(value) {\n\t\treturn value;\n\t},\n};\n\nexport function clearReviewRefs(\n\tsemanticEntryRefs: RepositoryChangeState[\"semanticEntryRefs\"],\n): RepositoryChangeState[\"semanticEntryRefs\"] {\n\treturn {\n\t\t...semanticEntryRefs,\n\t\treview: null,\n\t};\n}\n\nexport function resetRepositoryChangeFinalizationState(\n\toverrides: Partial<RepositoryChangeFinalizationState> = {},\n): RepositoryChangeFinalizationState {\n\treturn {\n\t\t...createEmptyRepositoryChangeFinalizationState(),\n\t\t...overrides,\n\t};\n}\n"],"mappings":";AACA,SAAS,mCAAmC;AAgBrC,SAAS,+CAAkF;AACjG,SAAO;AAAA,IACN,6BAA6B;AAAA,IAC7B,wBAAwB;AAAA,IACxB,6BAA6B;AAAA,IAC7B,kBAAkB;AAAA,IAClB,wBAAwB;AAAA,EACzB;AACD;AAEA,SAAS,aAAa,OAA+B;AACpD,SAAO,OAAO,UAAU,WAAW,QAAQ;AAC5C;AAEA,SAAS,SAAS,OAAyC;AAC1D,SAAO,OAAO,UAAU,YAAY,UAAU,OAAQ,QAAoC,CAAC;AAC5F;AAEA,SAAS,uBAAuB,OAAmD;AAClF,QAAM,SAAS,SAAS,KAAK;AAC7B,SAAO;AAAA,IACN,6BAA6B,aAAa,OAAO,2BAA2B;AAAA,IAC5E,wBAAwB,OAAO,2BAA2B;AAAA,IAC1D,6BAA6B,aAAa,OAAO,2BAA2B;AAAA,IAC5E,kBAAkB,aAAa,OAAO,gBAAgB;AAAA;AAAA,IAEtD,wBAAwB,aAAa,OAAO,sBAAsB;AAAA,EACnE;AACD;AAEO,IAAM,6BAA2D;AAAA,EACvE,MAAM,OAAO;AACZ,UAAM,SAAS,SAAS,KAAK;AAC7B,WAAO;AAAA,MACN,GAAG,4BAA4B,MAAM;AAAA,MACrC,cAAc,uBAAuB,OAAO,YAAY;AAAA,MACxD,gBAAgB,SAAS,OAAO,cAAc;AAAA,IAC/C;AAAA,EACD;AAAA,EACA,UAAU,OAAO;AAChB,WAAO;AAAA,EACR;AACD;AAEO,SAAS,gBACf,mBAC6C;AAC7C,SAAO;AAAA,IACN,GAAG;AAAA,IACH,QAAQ;AAAA,EACT;AACD;AAEO,SAAS,uCACf,YAAwD,CAAC,GACrB;AACpC,SAAO;AAAA,IACN,GAAG,6CAA6C;AAAA,IAChD,GAAG;AAAA,EACJ;AACD;","names":[]}
|