@leitwerk-dev/coding 0.1.2 → 0.1.3
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/dist/actions.d.ts +18 -0
- package/dist/actions.d.ts.map +1 -0
- package/dist/actions.js +45 -0
- package/dist/actions.js.map +1 -0
- package/dist/auto-work-branch.d.ts +10 -11
- package/dist/auto-work-branch.d.ts.map +1 -0
- package/dist/auto-work-branch.js +90 -90
- package/dist/auto-work-branch.js.map +1 -1
- package/dist/finalization-git.d.ts +9 -11
- package/dist/finalization-git.d.ts.map +1 -0
- package/dist/finalization-git.js +532 -11
- package/dist/finalization-git.js.map +1 -1
- package/dist/index.d.ts +7 -61
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -785
- package/dist/index.js.map +1 -1
- package/dist/repository-change-launch.d.ts +15 -17
- package/dist/repository-change-launch.d.ts.map +1 -0
- package/dist/repository-change-launch.js +182 -17
- package/dist/repository-change-launch.js.map +1 -1
- package/dist/repository-change-process.d.ts +38 -0
- package/dist/repository-change-process.d.ts.map +1 -0
- package/dist/repository-change-process.js +751 -0
- package/dist/repository-change-process.js.map +1 -0
- package/dist/repository-change-state.d.ts +8 -10
- package/dist/repository-change-state.d.ts.map +1 -0
- package/dist/repository-change-state.js +50 -12
- package/dist/repository-change-state.js.map +1 -1
- package/dist/turns/generate-commit-message.d.ts +4 -6
- package/dist/turns/generate-commit-message.d.ts.map +1 -0
- package/dist/turns/generate-commit-message.js +38 -9
- package/dist/turns/generate-commit-message.js.map +1 -1
- package/dist/turns/generate-plan.d.ts +3 -5
- package/dist/turns/generate-plan.d.ts.map +1 -0
- package/dist/turns/generate-plan.js +19 -7
- package/dist/turns/generate-plan.js.map +1 -1
- package/dist/turns/implement.d.ts +3 -5
- package/dist/turns/implement.d.ts.map +1 -0
- package/dist/turns/implement.js +17 -7
- package/dist/turns/implement.js.map +1 -1
- package/dist/turns/resolve-merge-conflict.d.ts +3 -5
- package/dist/turns/resolve-merge-conflict.d.ts.map +1 -0
- package/dist/turns/resolve-merge-conflict.js +21 -7
- package/dist/turns/resolve-merge-conflict.js.map +1 -1
- package/dist/turns/review-implementation.d.ts +4 -7
- package/dist/turns/review-implementation.d.ts.map +1 -0
- package/dist/turns/review-implementation.js +27 -9
- package/dist/turns/review-implementation.js.map +1 -1
- package/dist/turns/review-plan.d.ts +4 -7
- package/dist/turns/review-plan.d.ts.map +1 -0
- package/dist/turns/review-plan.js +21 -9
- package/dist/turns/review-plan.js.map +1 -1
- package/dist/turns/simplify-implementation.d.ts +3 -5
- package/dist/turns/simplify-implementation.d.ts.map +1 -0
- package/dist/turns/simplify-implementation.js +7 -7
- package/dist/turns/simplify-implementation.js.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { FormDefinition } from "@leitwerk-dev/process-sdk";
|
|
2
|
+
export declare const codingActionIds: {
|
|
3
|
+
readonly approvePlan: "approve_plan";
|
|
4
|
+
readonly requestRevision: "request_revision";
|
|
5
|
+
readonly runReview: "run_review";
|
|
6
|
+
readonly simplify: "simplify";
|
|
7
|
+
readonly acceptReview: "accept_review";
|
|
8
|
+
readonly requestReviewChanges: "request_review_changes";
|
|
9
|
+
readonly dismissReview: "dismiss_review";
|
|
10
|
+
readonly finalizeChange: "finalize_change";
|
|
11
|
+
};
|
|
12
|
+
export declare const requestRevisionForm: FormDefinition;
|
|
13
|
+
export declare const requestReviewChangesForm: FormDefinition;
|
|
14
|
+
export declare const acceptReviewForm: FormDefinition;
|
|
15
|
+
export declare function createFinalizeChangeForm(copy: {
|
|
16
|
+
title: string;
|
|
17
|
+
}): FormDefinition;
|
|
18
|
+
//# sourceMappingURL=actions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAEhE,eAAO,MAAM,eAAe;;;;;;;;;CASlB,CAAC;AAaX,eAAO,MAAM,mBAAmB,gBAK/B,CAAC;AACF,eAAO,MAAM,wBAAwB,gBAKpC,CAAC;AACF,eAAO,MAAM,gBAAgB,EAAE,cAc9B,CAAC;AAEF,wBAAgB,wBAAwB,CAAC,IAAI,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,cAAc,CAOhF"}
|
package/dist/actions.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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,18 +1,17 @@
|
|
|
1
|
-
interface ResolveBaseBranchShaInput {
|
|
1
|
+
export interface ResolveBaseBranchShaInput {
|
|
2
2
|
repoLocator: string;
|
|
3
3
|
baseBranch: string;
|
|
4
4
|
timeoutMs?: number;
|
|
5
5
|
}
|
|
6
|
-
declare function slugifyBranchSourceForBranch(sourceText: string): string;
|
|
6
|
+
export declare function slugifyBranchSourceForBranch(sourceText: string): string;
|
|
7
7
|
/** @deprecated Use slugifyBranchSourceForBranch. */
|
|
8
|
-
declare const slugifyPromptForBranch: typeof slugifyBranchSourceForBranch;
|
|
8
|
+
export declare const slugifyPromptForBranch: typeof slugifyBranchSourceForBranch;
|
|
9
9
|
/** @deprecated Use slugifyBranchSourceForBranch. */
|
|
10
|
-
declare const slugifyTitleForBranch: typeof slugifyBranchSourceForBranch;
|
|
11
|
-
declare function generateAutoWorkBranchRandomHex(): string;
|
|
12
|
-
declare function buildAutoWorkBranch(sourceText: string, baseBranchSha: string, randomHex?: string): string;
|
|
10
|
+
export declare const slugifyTitleForBranch: typeof slugifyBranchSourceForBranch;
|
|
11
|
+
export declare function generateAutoWorkBranchRandomHex(): string;
|
|
12
|
+
export declare function buildAutoWorkBranch(sourceText: string, baseBranchSha: string, randomHex?: string): string;
|
|
13
13
|
/** Builds the same safe branch shape when authenticated remote SHA lookup must wait for a worker. */
|
|
14
|
-
declare function gitShaLikeDigestFromSeed(seed: string): string;
|
|
15
|
-
declare function buildAutoWorkBranchFromSeed(sourceText: string, seed: string, randomHex?: string): string;
|
|
16
|
-
declare function resolveBaseBranchSha(input: ResolveBaseBranchShaInput): Promise<string>;
|
|
17
|
-
|
|
18
|
-
export { type ResolveBaseBranchShaInput, buildAutoWorkBranch, buildAutoWorkBranchFromSeed, generateAutoWorkBranchRandomHex, gitShaLikeDigestFromSeed, resolveBaseBranchSha, slugifyBranchSourceForBranch, slugifyPromptForBranch, slugifyTitleForBranch };
|
|
14
|
+
export declare function gitShaLikeDigestFromSeed(seed: string): string;
|
|
15
|
+
export declare function buildAutoWorkBranchFromSeed(sourceText: string, seed: string, randomHex?: string): string;
|
|
16
|
+
export declare function resolveBaseBranchSha(input: ResolveBaseBranchShaInput): Promise<string>;
|
|
17
|
+
//# sourceMappingURL=auto-work-branch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auto-work-branch.d.ts","sourceRoot":"","sources":["../src/auto-work-branch.ts"],"names":[],"mappings":"AAcA,MAAM,WAAW,yBAAyB;IACzC,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAoBD,wBAAgB,4BAA4B,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAKvE;AAED,oDAAoD;AACpD,eAAO,MAAM,sBAAsB,qCAA+B,CAAC;AACnE,oDAAoD;AACpD,eAAO,MAAM,qBAAqB,qCAA+B,CAAC;AAUlE,wBAAgB,+BAA+B,IAAI,MAAM,CAExD;AAYD,wBAAgB,mBAAmB,CAClC,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,MAAM,EACrB,SAAS,SAAoC,GAC3C,MAAM,CAKR;AAED,qGAAqG;AACrG,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE7D;AAED,wBAAgB,2BAA2B,CAC1C,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,EACZ,SAAS,SAAoC,GAC3C,MAAM,CAER;AAcD,wBAAsB,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,GAAG,OAAO,CAAC,MAAM,CAAC,CAoC5F"}
|
package/dist/auto-work-branch.js
CHANGED
|
@@ -1,112 +1,112 @@
|
|
|
1
|
-
import "
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import { execFile } from "child_process";
|
|
5
|
-
import { createHash, randomBytes } from "crypto";
|
|
6
|
-
import { promisify } from "util";
|
|
1
|
+
import { execFile } from "node:child_process";
|
|
2
|
+
import { createHash, randomBytes } from "node:crypto";
|
|
3
|
+
import { promisify } from "node:util";
|
|
7
4
|
import { trimToNull } from "@leitwerk-dev/domain";
|
|
8
5
|
import { sanitizeWorkerSubprocessEnv } from "@leitwerk-dev/process-sdk";
|
|
9
6
|
import { resolveGitBinary } from "@leitwerk-dev/process-sdk/git-binary";
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
const DEFAULT_BASE_SHA_SUFFIX_LENGTH = 12;
|
|
8
|
+
const DEFAULT_MAX_BRANCH_SLUG_LENGTH = 48;
|
|
9
|
+
const DEFAULT_PROMPT_WORD_COUNT = 5;
|
|
10
|
+
const AUTO_BRANCH_RANDOM_HEX_LENGTH = 3;
|
|
11
|
+
const DEFAULT_GIT_TIMEOUT_MS = 15_000;
|
|
12
|
+
const execFileAsync = promisify(execFile);
|
|
16
13
|
function truncateSlugAtSeparator(value, maxLength) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
if (value.length <= maxLength) {
|
|
15
|
+
return value;
|
|
16
|
+
}
|
|
17
|
+
return value.slice(0, maxLength).replace(/-+$/g, "");
|
|
21
18
|
}
|
|
22
19
|
function normalizedBranchWords(value) {
|
|
23
|
-
|
|
20
|
+
return (value
|
|
21
|
+
.normalize("NFKD")
|
|
22
|
+
.replace(/[\u0300-\u036f]/g, "")
|
|
23
|
+
.toLowerCase()
|
|
24
|
+
.replace(/[’']/g, "")
|
|
25
|
+
.match(/[a-z0-9]+/g) ?? []);
|
|
24
26
|
}
|
|
25
|
-
function slugifyBranchSourceForBranch(sourceText) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
export function slugifyBranchSourceForBranch(sourceText) {
|
|
28
|
+
const words = normalizedBranchWords(sourceText).slice(0, DEFAULT_PROMPT_WORD_COUNT);
|
|
29
|
+
const normalized = words.join("-");
|
|
30
|
+
const slug = truncateSlugAtSeparator(normalized, DEFAULT_MAX_BRANCH_SLUG_LENGTH);
|
|
31
|
+
return slug || "change";
|
|
30
32
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
/** @deprecated Use slugifyBranchSourceForBranch. */
|
|
34
|
+
export const slugifyPromptForBranch = slugifyBranchSourceForBranch;
|
|
35
|
+
/** @deprecated Use slugifyBranchSourceForBranch. */
|
|
36
|
+
export const slugifyTitleForBranch = slugifyBranchSourceForBranch;
|
|
33
37
|
function normalizeSha(value) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
const sha = value.trim().toLowerCase();
|
|
39
|
+
if (!/^[0-9a-f]{7,64}$/.test(sha)) {
|
|
40
|
+
throw new Error(`Expected a git object sha, got '${value}'`);
|
|
41
|
+
}
|
|
42
|
+
return sha;
|
|
39
43
|
}
|
|
40
|
-
function generateAutoWorkBranchRandomHex() {
|
|
41
|
-
|
|
44
|
+
export function generateAutoWorkBranchRandomHex() {
|
|
45
|
+
return randomBytes(2).toString("hex").slice(0, AUTO_BRANCH_RANDOM_HEX_LENGTH);
|
|
42
46
|
}
|
|
43
47
|
function normalizeRandomHex(value) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
return normalized;
|
|
48
|
+
const normalized = value.trim().toLowerCase();
|
|
49
|
+
if (!new RegExp(`^[0-9a-f]{${AUTO_BRANCH_RANDOM_HEX_LENGTH}}$`).test(normalized)) {
|
|
50
|
+
throw new Error(`Expected ${AUTO_BRANCH_RANDOM_HEX_LENGTH} random hex characters, got '${value}'`);
|
|
51
|
+
}
|
|
52
|
+
return normalized;
|
|
51
53
|
}
|
|
52
|
-
function buildAutoWorkBranch(sourceText, baseBranchSha, randomHex = generateAutoWorkBranchRandomHex()) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
export function buildAutoWorkBranch(sourceText, baseBranchSha, randomHex = generateAutoWorkBranchRandomHex()) {
|
|
55
|
+
const slug = slugifyBranchSourceForBranch(sourceText);
|
|
56
|
+
const suffix = normalizeRandomHex(randomHex);
|
|
57
|
+
const sha = normalizeSha(baseBranchSha);
|
|
58
|
+
return `${slug}-${suffix}-${sha.slice(0, DEFAULT_BASE_SHA_SUFFIX_LENGTH)}`;
|
|
57
59
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
+
/** Builds the same safe branch shape when authenticated remote SHA lookup must wait for a worker. */
|
|
61
|
+
export function gitShaLikeDigestFromSeed(seed) {
|
|
62
|
+
return createHash("sha256").update(seed).digest("hex");
|
|
60
63
|
}
|
|
61
|
-
function buildAutoWorkBranchFromSeed(sourceText, seed, randomHex = generateAutoWorkBranchRandomHex()) {
|
|
62
|
-
|
|
64
|
+
export function buildAutoWorkBranchFromSeed(sourceText, seed, randomHex = generateAutoWorkBranchRandomHex()) {
|
|
65
|
+
return buildAutoWorkBranch(sourceText, gitShaLikeDigestFromSeed(seed), randomHex);
|
|
63
66
|
}
|
|
64
67
|
function baseBranchRef(baseBranch) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
const trimmed = trimToNull(baseBranch);
|
|
69
|
+
if (!trimmed) {
|
|
70
|
+
throw new Error("baseBranch is required to resolve an automatic work branch");
|
|
71
|
+
}
|
|
72
|
+
return trimmed.startsWith("refs/heads/") ? trimmed : `refs/heads/${trimmed}`;
|
|
70
73
|
}
|
|
71
74
|
function outputToString(value) {
|
|
72
|
-
|
|
75
|
+
return typeof value === "string" ? value : Buffer.isBuffer(value) ? value.toString("utf8") : "";
|
|
73
76
|
}
|
|
74
|
-
async function resolveBaseBranchSha(input) {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
77
|
+
export async function resolveBaseBranchSha(input) {
|
|
78
|
+
const repoLocator = trimToNull(input.repoLocator);
|
|
79
|
+
if (!repoLocator) {
|
|
80
|
+
throw new Error("repoLocator is required to resolve an automatic work branch");
|
|
81
|
+
}
|
|
82
|
+
const ref = baseBranchRef(input.baseBranch);
|
|
83
|
+
let stdout = "";
|
|
84
|
+
try {
|
|
85
|
+
const result = await execFileAsync(resolveGitBinary(), ["ls-remote", repoLocator, ref], {
|
|
86
|
+
encoding: "utf8",
|
|
87
|
+
env: sanitizeWorkerSubprocessEnv(process.env, { GIT_TERMINAL_PROMPT: "0" }),
|
|
88
|
+
timeout: input.timeoutMs ?? DEFAULT_GIT_TIMEOUT_MS,
|
|
89
|
+
});
|
|
90
|
+
stdout = outputToString(result.stdout);
|
|
91
|
+
}
|
|
92
|
+
catch (error) {
|
|
93
|
+
const errorOutput = error;
|
|
94
|
+
const message = trimToNull(outputToString(errorOutput.stderr)) ??
|
|
95
|
+
trimToNull(outputToString(errorOutput.stdout)) ??
|
|
96
|
+
errorOutput.message ??
|
|
97
|
+
"unknown git error";
|
|
98
|
+
throw new Error(`Failed to resolve '${ref}' from '${repoLocator}': ${message}`);
|
|
99
|
+
}
|
|
100
|
+
const match = stdout
|
|
101
|
+
.split(/\r?\n/)
|
|
102
|
+
.map((line) => line.trim())
|
|
103
|
+
.filter(Boolean)
|
|
104
|
+
.map((line) => line.split(/\s+/))
|
|
105
|
+
.find((parts) => parts[1] === ref);
|
|
106
|
+
const sha = match?.[0];
|
|
107
|
+
if (!sha) {
|
|
108
|
+
throw new Error(`Repository '${repoLocator}' does not expose base branch '${input.baseBranch}'`);
|
|
109
|
+
}
|
|
110
|
+
return normalizeSha(sha);
|
|
101
111
|
}
|
|
102
|
-
export {
|
|
103
|
-
buildAutoWorkBranch,
|
|
104
|
-
buildAutoWorkBranchFromSeed,
|
|
105
|
-
generateAutoWorkBranchRandomHex,
|
|
106
|
-
gitShaLikeDigestFromSeed,
|
|
107
|
-
resolveBaseBranchSha,
|
|
108
|
-
slugifyBranchSourceForBranch,
|
|
109
|
-
slugifyPromptForBranch,
|
|
110
|
-
slugifyTitleForBranch
|
|
111
|
-
};
|
|
112
112
|
//# sourceMappingURL=auto-work-branch.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"auto-work-branch.js","sourceRoot":"","sources":["../src/auto-work-branch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAExE,M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|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { WorkerErrorClass } from
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
type
|
|
5
|
-
type DeterministicFinalizationResult = {
|
|
1
|
+
import { type WorkerErrorClass } from "@leitwerk-dev/domain";
|
|
2
|
+
import { type FlowAutomaticRunContext, type StructuralProcessState } from "@leitwerk-dev/process-sdk";
|
|
3
|
+
export type DeterministicFinalizationMergeMode = "noop" | "fast_forward" | "merge_commit";
|
|
4
|
+
export type DeterministicFinalizationResult = {
|
|
6
5
|
outcome: "merge_conflict";
|
|
7
6
|
params: {
|
|
8
7
|
headSha: string;
|
|
@@ -19,18 +18,17 @@ type DeterministicFinalizationResult = {
|
|
|
19
18
|
};
|
|
20
19
|
markdown: string;
|
|
21
20
|
};
|
|
22
|
-
declare class DeterministicGitError extends Error {
|
|
21
|
+
export declare class DeterministicGitError extends Error {
|
|
23
22
|
readonly errorClass: WorkerErrorClass;
|
|
24
23
|
constructor(message: string);
|
|
25
24
|
}
|
|
26
|
-
interface RepositoryChangeFinalizationContextState extends StructuralProcessState {
|
|
25
|
+
export interface RepositoryChangeFinalizationContextState extends StructuralProcessState {
|
|
27
26
|
finalization: {
|
|
28
27
|
expectedPostConflictHeadSha: string | null;
|
|
29
28
|
usedConflictResolution: boolean;
|
|
30
29
|
generatedCommitMessage: string | null;
|
|
31
30
|
};
|
|
32
31
|
}
|
|
33
|
-
declare function runDeterministicFinalization<TParams, TState extends RepositoryChangeFinalizationContextState>(ctx: FlowAutomaticRunContext<TParams, TState>): DeterministicFinalizationResult;
|
|
34
|
-
declare function readMergeMessage(repoPath: string): string | null;
|
|
35
|
-
|
|
36
|
-
export { type DeterministicFinalizationMergeMode, type DeterministicFinalizationResult, DeterministicGitError, type RepositoryChangeFinalizationContextState, readMergeMessage, runDeterministicFinalization };
|
|
32
|
+
export declare function runDeterministicFinalization<TParams, TState extends RepositoryChangeFinalizationContextState>(ctx: FlowAutomaticRunContext<TParams, TState>): DeterministicFinalizationResult;
|
|
33
|
+
export declare function readMergeMessage(repoPath: string): string | null;
|
|
34
|
+
//# sourceMappingURL=finalization-git.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"finalization-git.d.ts","sourceRoot":"","sources":["../src/finalization-git.ts"],"names":[],"mappings":"AAKA,OAAO,EAAqC,KAAK,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAChG,OAAO,EACN,KAAK,uBAAuB,EAG5B,KAAK,sBAAsB,EAC3B,MAAM,2BAA2B,CAAC;AAGnC,MAAM,MAAM,kCAAkC,GAAG,MAAM,GAAG,cAAc,GAAG,cAAc,CAAC;AAY1F,MAAM,MAAM,+BAA+B,GACxC;IACA,OAAO,EAAE,gBAAgB,CAAC;IAC1B,MAAM,EAAE;QACP,OAAO,EAAE,MAAM,CAAC;QAChB,eAAe,EAAE,MAAM,EAAE,CAAC;QAC1B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;KAC9B,CAAC;CACD,GACD;IACA,OAAO,EAAE,WAAW,CAAC;IACrB,MAAM,EAAE;QACP,OAAO,EAAE,MAAM,CAAC;QAChB,SAAS,EAAE,kCAAkC,CAAC;QAC9C,UAAU,EAAE,MAAM,CAAC;QACnB,sBAAsB,EAAE,OAAO,CAAC;KAChC,CAAC;IACF,QAAQ,EAAE,MAAM,CAAC;CAChB,CAAC;AAEL,qBAAa,qBAAsB,SAAQ,KAAK;IAC/C,QAAQ,CAAC,UAAU,EAAE,gBAAgB,CAAe;gBAExC,OAAO,EAAE,MAAM;CAI3B;AAkiBD,MAAM,WAAW,wCAAyC,SAAQ,sBAAsB;IACvF,YAAY,EAAE;QACb,2BAA2B,EAAE,MAAM,GAAG,IAAI,CAAC;QAC3C,sBAAsB,EAAE,OAAO,CAAC;QAChC,sBAAsB,EAAE,MAAM,GAAG,IAAI,CAAC;KACtC,CAAC;CACF;AAED,wBAAgB,4BAA4B,CAC3C,OAAO,EACP,MAAM,SAAS,wCAAwC,EACtD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