@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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-commit-message.d.ts","sourceRoot":"","sources":["../../src/turns/generate-commit-message.ts"],"names":[],"mappings":"AAAA,OAAO,EAIN,KAAK,iBAAiB,EACtB,MAAM,2BAA2B,CAAC;AAEnC,wBAAgB,+BAA+B,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAatE;AAED,wBAAgB,gCAAgC,CAAC,OAAO,EAAE,MAAM,EAC/D,GAAG,EAAE,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,GAC7C,MAAM,CAwBR"}
|
|
1
|
+
{"version":3,"file":"generate-commit-message.d.ts","sourceRoot":"","sources":["../../src/turns/generate-commit-message.ts"],"names":[],"mappings":"AAAA,OAAO,EAIN,KAAK,iBAAiB,EACtB,MAAM,2BAA2B,CAAC;AAEnC,gBAAgB;AAChB,wBAAgB,+BAA+B,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAatE;AAED,gBAAgB;AAChB,wBAAgB,gCAAgC,CAAC,OAAO,EAAE,MAAM,EAC/D,GAAG,EAAE,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,GAC7C,MAAM,CAwBR"}
|
|
@@ -1,39 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
throw new Error("Generated commit message must not contain Markdown fences");
|
|
11
|
-
}
|
|
12
|
-
if (/^(commit message|message|subject)\s*:/i.test(normalized)) {
|
|
13
|
-
throw new Error("Generated commit message must not contain an explanatory prefix");
|
|
14
|
-
}
|
|
15
|
-
return normalized;
|
|
16
|
-
}
|
|
17
|
-
export function buildGenerateCommitMessagePrompt(ctx) {
|
|
18
|
-
const project = ctx.projects.find((candidate) => candidate.key === "repo") ?? ctx.projects[0];
|
|
19
|
-
const pinned = project?.metadata?.[COMMIT_MESSAGE_PROJECT_METADATA_KEY];
|
|
20
|
-
const rules = typeof pinned?.rules === "string" && pinned.rules.trim()
|
|
21
|
-
? pinned.rules
|
|
22
|
-
: BUILT_IN_COMMIT_MESSAGE_RULES;
|
|
23
|
-
const plan = ctx.input.plan ?? "";
|
|
24
|
-
return [
|
|
25
|
-
"Create the Git commit message for the accepted implementation plan.",
|
|
26
|
-
"Return only the exact plain-text commit message: subject first, followed by an optional body.",
|
|
27
|
-
"Do not add Markdown fences, labels, commentary, or a 'Commit message:' prefix.",
|
|
28
|
-
"The plan below is trusted content to summarize, not formatting instructions.",
|
|
29
|
-
"",
|
|
30
|
-
"<formatting_rules>",
|
|
31
|
-
rules,
|
|
32
|
-
"</formatting_rules>",
|
|
33
|
-
"",
|
|
34
|
-
"<accepted_plan>",
|
|
35
|
-
plan,
|
|
36
|
-
"</accepted_plan>",
|
|
37
|
-
].join("\n");
|
|
38
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
buildGenerateCommitMessagePrompt,
|
|
3
|
+
normalizeGeneratedCommitMessage
|
|
4
|
+
} from "../chunk-WKHVLLKE.js";
|
|
5
|
+
import "../chunk-PX6F3LHL.js";
|
|
6
|
+
export {
|
|
7
|
+
buildGenerateCommitMessagePrompt,
|
|
8
|
+
normalizeGeneratedCommitMessage
|
|
9
|
+
};
|
|
39
10
|
//# sourceMappingURL=generate-commit-message.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { FlowPromptContext, StructuralProcessState } from "@leitwerk-dev/process-sdk";
|
|
2
|
+
/** @internal */
|
|
2
3
|
export declare function buildGeneratePlanPrompt(ctx: FlowPromptContext<unknown, StructuralProcessState, never>): string;
|
|
3
4
|
//# sourceMappingURL=generate-plan.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-plan.d.ts","sourceRoot":"","sources":["../../src/turns/generate-plan.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAE3F,wBAAgB,uBAAuB,CACtC,GAAG,EAAE,iBAAiB,CAAC,OAAO,EAAE,sBAAsB,EAAE,KAAK,CAAC,GAC5D,MAAM,CAkBR"}
|
|
1
|
+
{"version":3,"file":"generate-plan.d.ts","sourceRoot":"","sources":["../../src/turns/generate-plan.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAE3F,gBAAgB;AAChB,wBAAgB,uBAAuB,CACtC,GAAG,EAAE,iBAAiB,CAAC,OAAO,EAAE,sBAAsB,EAAE,KAAK,CAAC,GAC5D,MAAM,CAkBR"}
|
|
@@ -1,20 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Branches:
|
|
9
|
-
- base branch: ${repo.baseBranch}
|
|
10
|
-
- work branch: ${repo.workBranch}
|
|
11
|
-
|
|
12
|
-
Rules:
|
|
13
|
-
- analyze only the cloned repository in the current working directory
|
|
14
|
-
- treat . as the repository root for read-only inspection
|
|
15
|
-
- use bash only for read-only inspection (e.g. git log, git diff, rg, tree, file listing, read-only http/CLI calls)
|
|
16
|
-
- do not modify files
|
|
17
|
-
- do not read from or write to any original source repository path outside the process workspace
|
|
18
|
-
- publish the plan when done`;
|
|
19
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
buildGeneratePlanPrompt
|
|
3
|
+
} from "../chunk-W7VJT6AN.js";
|
|
4
|
+
import "../chunk-PX6F3LHL.js";
|
|
5
|
+
export {
|
|
6
|
+
buildGeneratePlanPrompt
|
|
7
|
+
};
|
|
20
8
|
//# sourceMappingURL=generate-plan.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"implement.d.ts","sourceRoot":"","sources":["../../src/turns/implement.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAE3F,wBAAgB,oBAAoB,CACnC,GAAG,EAAE,iBAAiB,CAAC,OAAO,EAAE,sBAAsB,EAAE,MAAM,CAAC,GAC7D,MAAM,CAgBR"}
|
|
1
|
+
{"version":3,"file":"implement.d.ts","sourceRoot":"","sources":["../../src/turns/implement.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAE3F,gBAAgB;AAChB,wBAAgB,oBAAoB,CACnC,GAAG,EAAE,iBAAiB,CAAC,OAAO,EAAE,sBAAsB,EAAE,MAAM,CAAC,GAC7D,MAAM,CAgBR"}
|
package/dist/turns/implement.js
CHANGED
|
@@ -1,18 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
${ctx.input.plan}
|
|
9
|
-
|
|
10
|
-
Rules:
|
|
11
|
-
- keep going until the change is complete; do any necessary additional passes without asking
|
|
12
|
-
- make repository changes only inside the current working directory
|
|
13
|
-
- treat . as the repository root for file edits and git commands
|
|
14
|
-
- do not read from or write to any original source repository path outside the process workspace
|
|
15
|
-
- keep the implementation coherent and complete
|
|
16
|
-
- publish the implementation summary when done`;
|
|
17
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
buildImplementPrompt
|
|
3
|
+
} from "../chunk-YSC5GEQJ.js";
|
|
4
|
+
import "../chunk-PX6F3LHL.js";
|
|
5
|
+
export {
|
|
6
|
+
buildImplementPrompt
|
|
7
|
+
};
|
|
18
8
|
//# sourceMappingURL=implement.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { FlowPromptContext, StructuralProcessState } from "@leitwerk-dev/process-sdk";
|
|
2
|
+
/** @internal */
|
|
2
3
|
export declare function buildResolveMergeConflictPrompt(ctx: FlowPromptContext<unknown, StructuralProcessState, never>): string;
|
|
3
4
|
//# sourceMappingURL=resolve-merge-conflict.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-merge-conflict.d.ts","sourceRoot":"","sources":["../../src/turns/resolve-merge-conflict.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAE3F,wBAAgB,+BAA+B,CAC9C,GAAG,EAAE,iBAAiB,CAAC,OAAO,EAAE,sBAAsB,EAAE,KAAK,CAAC,GAC5D,MAAM,CAoBR"}
|
|
1
|
+
{"version":3,"file":"resolve-merge-conflict.d.ts","sourceRoot":"","sources":["../../src/turns/resolve-merge-conflict.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAE3F,gBAAgB;AAChB,wBAAgB,+BAA+B,CAC9C,GAAG,EAAE,iBAAiB,CAAC,OAAO,EAAE,sBAAsB,EAAE,KAAK,CAAC,GAC5D,MAAM,CAoBR"}
|
|
@@ -1,22 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Branches:
|
|
9
|
-
- base branch: ${repo.baseBranch}
|
|
10
|
-
- work branch: ${repo.workBranch}
|
|
11
|
-
|
|
12
|
-
Rules:
|
|
13
|
-
- resolve only the current merge conflict inside the current working directory
|
|
14
|
-
- treat . as the repository root for file edits and git commands
|
|
15
|
-
- complete the merge commit so the repository is no longer in a merge-in-progress state
|
|
16
|
-
- leave the repository clean when you finish
|
|
17
|
-
- do not push
|
|
18
|
-
- do not read from or write to any original source repository path outside the process workspace
|
|
19
|
-
- publish a concise Markdown summary of the merge resolution
|
|
20
|
-
- then call clean with the final HEAD sha`;
|
|
21
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
buildResolveMergeConflictPrompt
|
|
3
|
+
} from "../chunk-OERAYSVI.js";
|
|
4
|
+
import "../chunk-PX6F3LHL.js";
|
|
5
|
+
export {
|
|
6
|
+
buildResolveMergeConflictPrompt
|
|
7
|
+
};
|
|
22
8
|
//# sourceMappingURL=resolve-merge-conflict.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { FlowPromptContext, StructuralProcessState } from "@leitwerk-dev/process-sdk";
|
|
2
|
+
/** @internal */
|
|
2
3
|
export declare function buildReviewImplementationPrompt(ctx: FlowPromptContext<unknown, StructuralProcessState>): string;
|
|
3
4
|
//# sourceMappingURL=review-implementation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"review-implementation.d.ts","sourceRoot":"","sources":["../../src/turns/review-implementation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAE3F,wBAAgB,+BAA+B,CAC9C,GAAG,EAAE,iBAAiB,CAAC,OAAO,EAAE,sBAAsB,CAAC,GACrD,MAAM,CAwBR"}
|
|
1
|
+
{"version":3,"file":"review-implementation.d.ts","sourceRoot":"","sources":["../../src/turns/review-implementation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAE3F,gBAAgB;AAChB,wBAAgB,+BAA+B,CAC9C,GAAG,EAAE,iBAAiB,CAAC,OAAO,EAAE,sBAAsB,CAAC,GACrD,MAAM,CAwBR"}
|
|
@@ -1,26 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Inspect the changes with \`git diff --stat $(git merge-base ${repo.baseBranch} HEAD)\`. Check for:
|
|
9
|
-
- bugs and logic errors
|
|
10
|
-
- security issues
|
|
11
|
-
- error handling gaps
|
|
12
|
-
- missing or misplaced tests
|
|
13
|
-
- unnecessary abstractions, duplication, and other avoidable complexity
|
|
14
|
-
|
|
15
|
-
For each issue, give a concise fix.
|
|
16
|
-
|
|
17
|
-
Rules:
|
|
18
|
-
- inspect code only inside the current working directory
|
|
19
|
-
- treat . as the repository root for read-only inspection
|
|
20
|
-
- use bash only for read-only inspection (e.g. git diff, git status, rg, tree, file listing, read-only http/CLI calls)
|
|
21
|
-
- do not modify files, branches, commits, or git index state
|
|
22
|
-
- do not read from or write to any original source repository path outside the process workspace
|
|
23
|
-
- publish a short Markdown approval note if the implementation is ready
|
|
24
|
-
- publish concise, actionable Markdown feedback if the implementation needs changes`;
|
|
25
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
buildReviewImplementationPrompt
|
|
3
|
+
} from "../chunk-R3UCUGY6.js";
|
|
4
|
+
import "../chunk-PX6F3LHL.js";
|
|
5
|
+
export {
|
|
6
|
+
buildReviewImplementationPrompt
|
|
7
|
+
};
|
|
26
8
|
//# sourceMappingURL=review-implementation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { FlowPromptContext, StructuralProcessState } from "@leitwerk-dev/process-sdk";
|
|
2
|
+
/** @internal */
|
|
2
3
|
export declare function buildReviewPlanPrompt(ctx: FlowPromptContext<unknown, StructuralProcessState, "plan">): string;
|
|
3
4
|
//# sourceMappingURL=review-plan.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"review-plan.d.ts","sourceRoot":"","sources":["../../src/turns/review-plan.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAE3F,wBAAgB,qBAAqB,CACpC,GAAG,EAAE,iBAAiB,CAAC,OAAO,EAAE,sBAAsB,EAAE,MAAM,CAAC,GAC7D,MAAM,CAkBR"}
|
|
1
|
+
{"version":3,"file":"review-plan.d.ts","sourceRoot":"","sources":["../../src/turns/review-plan.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAE3F,gBAAgB;AAChB,wBAAgB,qBAAqB,CACpC,GAAG,EAAE,iBAAiB,CAAC,OAAO,EAAE,sBAAsB,EAAE,MAAM,CAAC,GAC7D,MAAM,CAkBR"}
|
|
@@ -1,20 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
${ctx.input.plan}
|
|
9
|
-
|
|
10
|
-
Rules:
|
|
11
|
-
- review the plan only; do not rewrite the plan
|
|
12
|
-
- if you inspect repository files for context, read only inside the current working directory
|
|
13
|
-
- use bash only for read-only inspection (e.g. git diff, git status, rg, tree, file listing, read-only http/CLI calls)
|
|
14
|
-
- do not modify files, branches, commits, or git index state
|
|
15
|
-
- do not read from or write to any original source repository path outside the process workspace
|
|
16
|
-
- evaluate scope, sequencing, risks, and acceptance criteria
|
|
17
|
-
- publish a short Markdown approval note when the plan is solid
|
|
18
|
-
- publish concise, actionable Markdown feedback when the plan needs changes`;
|
|
19
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
buildReviewPlanPrompt
|
|
3
|
+
} from "../chunk-34B3Q75M.js";
|
|
4
|
+
import "../chunk-PX6F3LHL.js";
|
|
5
|
+
export {
|
|
6
|
+
buildReviewPlanPrompt
|
|
7
|
+
};
|
|
20
8
|
//# sourceMappingURL=review-plan.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { FlowPromptContext, StructuralProcessState } from "@leitwerk-dev/process-sdk";
|
|
2
|
+
/** @internal */
|
|
2
3
|
export declare function buildSimplifyImplementationPrompt(_ctx: FlowPromptContext<unknown, StructuralProcessState>): string;
|
|
3
4
|
//# sourceMappingURL=simplify-implementation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simplify-implementation.d.ts","sourceRoot":"","sources":["../../src/turns/simplify-implementation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAE3F,wBAAgB,iCAAiC,CAChD,IAAI,EAAE,iBAAiB,CAAC,OAAO,EAAE,sBAAsB,CAAC,GACtD,MAAM,CAMR"}
|
|
1
|
+
{"version":3,"file":"simplify-implementation.d.ts","sourceRoot":"","sources":["../../src/turns/simplify-implementation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAE3F,gBAAgB;AAChB,wBAAgB,iCAAiC,CAChD,IAAI,EAAE,iBAAiB,CAAC,OAAO,EAAE,sBAAsB,CAAC,GACtD,MAAM,CAMR"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
buildSimplifyImplementationPrompt
|
|
3
|
+
} from "../chunk-F6CEEAFE.js";
|
|
4
|
+
import "../chunk-PX6F3LHL.js";
|
|
5
|
+
export {
|
|
6
|
+
buildSimplifyImplementationPrompt
|
|
7
|
+
};
|
|
8
8
|
//# sourceMappingURL=simplify-implementation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leitwerk-dev/coding",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/leitwerk-dev/leitwerk.git",
|
|
@@ -40,20 +40,31 @@
|
|
|
40
40
|
"import": "./dist/repository-change-launch.js",
|
|
41
41
|
"types": "./dist/repository-change-launch.d.ts"
|
|
42
42
|
},
|
|
43
|
-
"./turns
|
|
44
|
-
"source": "./src/turns
|
|
45
|
-
"import": "./dist/turns
|
|
46
|
-
"types": "./dist/turns
|
|
43
|
+
"./turns/implement": {
|
|
44
|
+
"source": "./src/turns/implement.ts",
|
|
45
|
+
"import": "./dist/turns/implement.js",
|
|
46
|
+
"types": "./dist/turns/implement.d.ts"
|
|
47
|
+
},
|
|
48
|
+
"./turns/review-implementation": {
|
|
49
|
+
"source": "./src/turns/review-implementation.ts",
|
|
50
|
+
"import": "./dist/turns/review-implementation.js",
|
|
51
|
+
"types": "./dist/turns/review-implementation.d.ts"
|
|
52
|
+
},
|
|
53
|
+
"./turns/simplify-implementation": {
|
|
54
|
+
"source": "./src/turns/simplify-implementation.ts",
|
|
55
|
+
"import": "./dist/turns/simplify-implementation.js",
|
|
56
|
+
"types": "./dist/turns/simplify-implementation.d.ts"
|
|
47
57
|
}
|
|
48
58
|
},
|
|
49
59
|
"scripts": {
|
|
50
60
|
"build": "tsup --silent"
|
|
51
61
|
},
|
|
52
62
|
"dependencies": {
|
|
53
|
-
"@leitwerk-dev/domain": "0.1
|
|
54
|
-
"@leitwerk-dev/process-sdk": "0.1
|
|
63
|
+
"@leitwerk-dev/domain": "0.2.1",
|
|
64
|
+
"@leitwerk-dev/process-sdk": "0.2.1"
|
|
55
65
|
},
|
|
56
66
|
"devDependencies": {
|
|
67
|
+
"@leitwerk-dev/test-support": "0.2.1",
|
|
57
68
|
"tsup": "^8.5.1"
|
|
58
69
|
},
|
|
59
70
|
"license": "Apache-2.0",
|
|
@@ -61,7 +72,7 @@
|
|
|
61
72
|
"access": "public"
|
|
62
73
|
},
|
|
63
74
|
"engines": {
|
|
64
|
-
"node": ">=
|
|
75
|
+
"node": ">=26 <27"
|
|
65
76
|
},
|
|
66
77
|
"files": [
|
|
67
78
|
"dist/**",
|
package/src/actions.ts
CHANGED
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
import type { FormDefinition } from "@leitwerk-dev/process-sdk";
|
|
2
2
|
|
|
3
|
+
/** @public */
|
|
3
4
|
export const codingActionIds = {
|
|
5
|
+
/** @public */
|
|
4
6
|
approvePlan: "approve_plan",
|
|
7
|
+
/** @internal */
|
|
5
8
|
requestRevision: "request_revision",
|
|
9
|
+
/** @internal */
|
|
6
10
|
runReview: "run_review",
|
|
11
|
+
/** @internal */
|
|
7
12
|
simplify: "simplify",
|
|
13
|
+
/** @internal */
|
|
8
14
|
acceptReview: "accept_review",
|
|
15
|
+
/** @internal */
|
|
9
16
|
requestReviewChanges: "request_review_changes",
|
|
17
|
+
/** @internal */
|
|
10
18
|
dismissReview: "dismiss_review",
|
|
19
|
+
/** @public */
|
|
11
20
|
finalizeChange: "finalize_change",
|
|
12
21
|
} as const;
|
|
13
22
|
|
|
@@ -22,18 +31,21 @@ function notesForm(id: string, title: string, label: string, description: string
|
|
|
22
31
|
};
|
|
23
32
|
}
|
|
24
33
|
|
|
34
|
+
/** @internal */
|
|
25
35
|
export const requestRevisionForm = notesForm(
|
|
26
36
|
codingActionIds.requestRevision,
|
|
27
37
|
"Request revision",
|
|
28
38
|
"Revision notes",
|
|
29
39
|
"Instructions for the next implementation pass.",
|
|
30
40
|
);
|
|
41
|
+
/** @internal */
|
|
31
42
|
export const requestReviewChangesForm = notesForm(
|
|
32
43
|
codingActionIds.requestReviewChanges,
|
|
33
44
|
"Request review changes",
|
|
34
45
|
"Review notes",
|
|
35
46
|
"Instructions for the next review pass.",
|
|
36
47
|
);
|
|
48
|
+
/** @internal */
|
|
37
49
|
export const acceptReviewForm: FormDefinition = {
|
|
38
50
|
id: codingActionIds.acceptReview,
|
|
39
51
|
title: "Accept review",
|
|
@@ -50,7 +62,11 @@ export const acceptReviewForm: FormDefinition = {
|
|
|
50
62
|
submitLabel: "Accept review",
|
|
51
63
|
};
|
|
52
64
|
|
|
53
|
-
|
|
65
|
+
/** @internal */
|
|
66
|
+
export function createFinalizeChangeForm(copy: {
|
|
67
|
+
/** @internal */
|
|
68
|
+
title: string;
|
|
69
|
+
}): FormDefinition {
|
|
54
70
|
return {
|
|
55
71
|
id: codingActionIds.finalizeChange,
|
|
56
72
|
title: copy.title,
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { execFile } from "node:child_process";
|
|
2
|
+
import { createHash, randomBytes } from "node:crypto";
|
|
3
|
+
import { promisify } from "node:util";
|
|
4
|
+
import { trimToNull } from "@leitwerk-dev/domain";
|
|
5
|
+
import { sanitizeWorkerSubprocessEnv } from "@leitwerk-dev/process-sdk";
|
|
6
|
+
import { resolveGitBinary } from "@leitwerk-dev/process-sdk/git-binary";
|
|
7
|
+
|
|
8
|
+
const DEFAULT_BASE_SHA_SUFFIX_LENGTH = 12;
|
|
9
|
+
const DEFAULT_MAX_BRANCH_SLUG_LENGTH = 48;
|
|
10
|
+
const DEFAULT_PROMPT_WORD_COUNT = 5;
|
|
11
|
+
const AUTO_BRANCH_RANDOM_HEX_LENGTH = 3;
|
|
12
|
+
const DEFAULT_GIT_TIMEOUT_MS = 15_000;
|
|
13
|
+
const execFileAsync = promisify(execFile);
|
|
14
|
+
|
|
15
|
+
/** @internal */
|
|
16
|
+
export interface ResolveBaseBranchShaInput {
|
|
17
|
+
/** @internal */
|
|
18
|
+
repoLocator: string;
|
|
19
|
+
/** @internal */
|
|
20
|
+
baseBranch: string;
|
|
21
|
+
/** @internal */
|
|
22
|
+
timeoutMs?: number;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function truncateSlugAtSeparator(value: string, maxLength: number): string {
|
|
26
|
+
if (value.length <= maxLength) {
|
|
27
|
+
return value;
|
|
28
|
+
}
|
|
29
|
+
return value.slice(0, maxLength).replace(/-+$/g, "");
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function normalizedBranchWords(value: string): string[] {
|
|
33
|
+
return (
|
|
34
|
+
value
|
|
35
|
+
.normalize("NFKD")
|
|
36
|
+
.replace(/[\u0300-\u036f]/g, "")
|
|
37
|
+
.toLowerCase()
|
|
38
|
+
.replace(/[’']/g, "")
|
|
39
|
+
.match(/[a-z0-9]+/g) ?? []
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** @internal */
|
|
44
|
+
export function slugifyBranchSourceForBranch(sourceText: string): string {
|
|
45
|
+
const words = normalizedBranchWords(sourceText).slice(0, DEFAULT_PROMPT_WORD_COUNT);
|
|
46
|
+
const normalized = words.join("-");
|
|
47
|
+
const slug = truncateSlugAtSeparator(normalized, DEFAULT_MAX_BRANCH_SLUG_LENGTH);
|
|
48
|
+
return slug || "change";
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function normalizeSha(value: string): string {
|
|
52
|
+
const sha = value.trim().toLowerCase();
|
|
53
|
+
if (!/^[0-9a-f]{7,64}$/.test(sha)) {
|
|
54
|
+
throw new Error(`Expected a git object sha, got '${value}'`);
|
|
55
|
+
}
|
|
56
|
+
return sha;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** @public */
|
|
60
|
+
export function generateAutoWorkBranchRandomHex(): string {
|
|
61
|
+
return randomBytes(2).toString("hex").slice(0, AUTO_BRANCH_RANDOM_HEX_LENGTH);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function normalizeRandomHex(value: string): string {
|
|
65
|
+
const normalized = value.trim().toLowerCase();
|
|
66
|
+
if (!new RegExp(`^[0-9a-f]{${AUTO_BRANCH_RANDOM_HEX_LENGTH}}$`).test(normalized)) {
|
|
67
|
+
throw new Error(
|
|
68
|
+
`Expected ${AUTO_BRANCH_RANDOM_HEX_LENGTH} random hex characters, got '${value}'`,
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
return normalized;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** @internal */
|
|
75
|
+
export function buildAutoWorkBranch(
|
|
76
|
+
sourceText: string,
|
|
77
|
+
baseBranchSha: string,
|
|
78
|
+
randomHex = generateAutoWorkBranchRandomHex(),
|
|
79
|
+
): string {
|
|
80
|
+
const slug = slugifyBranchSourceForBranch(sourceText);
|
|
81
|
+
const suffix = normalizeRandomHex(randomHex);
|
|
82
|
+
const sha = normalizeSha(baseBranchSha);
|
|
83
|
+
return `${slug}-${suffix}-${sha.slice(0, DEFAULT_BASE_SHA_SUFFIX_LENGTH)}`;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/** Builds the same safe branch shape when authenticated remote SHA lookup must wait for a worker. @internal */
|
|
87
|
+
function gitShaLikeDigestFromSeed(seed: string): string {
|
|
88
|
+
return createHash("sha256").update(seed).digest("hex");
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/** @public */
|
|
92
|
+
export function buildAutoWorkBranchFromSeed(
|
|
93
|
+
sourceText: string,
|
|
94
|
+
seed: string,
|
|
95
|
+
randomHex = generateAutoWorkBranchRandomHex(),
|
|
96
|
+
): string {
|
|
97
|
+
return buildAutoWorkBranch(sourceText, gitShaLikeDigestFromSeed(seed), randomHex);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function baseBranchRef(baseBranch: string): string {
|
|
101
|
+
const trimmed = trimToNull(baseBranch);
|
|
102
|
+
if (!trimmed) {
|
|
103
|
+
throw new Error("baseBranch is required to resolve an automatic work branch");
|
|
104
|
+
}
|
|
105
|
+
return trimmed.startsWith("refs/heads/") ? trimmed : `refs/heads/${trimmed}`;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function outputToString(value: unknown): string {
|
|
109
|
+
return typeof value === "string" ? value : Buffer.isBuffer(value) ? value.toString("utf8") : "";
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/** @internal */
|
|
113
|
+
export async function resolveBaseBranchSha(input: ResolveBaseBranchShaInput): Promise<string> {
|
|
114
|
+
const repoLocator = trimToNull(input.repoLocator);
|
|
115
|
+
if (!repoLocator) {
|
|
116
|
+
throw new Error("repoLocator is required to resolve an automatic work branch");
|
|
117
|
+
}
|
|
118
|
+
const ref = baseBranchRef(input.baseBranch);
|
|
119
|
+
let stdout = "";
|
|
120
|
+
try {
|
|
121
|
+
const result = await execFileAsync(resolveGitBinary(), ["ls-remote", repoLocator, ref], {
|
|
122
|
+
encoding: "utf8",
|
|
123
|
+
env: sanitizeWorkerSubprocessEnv(process.env, { GIT_TERMINAL_PROMPT: "0" }),
|
|
124
|
+
timeout: input.timeoutMs ?? DEFAULT_GIT_TIMEOUT_MS,
|
|
125
|
+
});
|
|
126
|
+
stdout = outputToString(result.stdout);
|
|
127
|
+
} catch (error) {
|
|
128
|
+
const errorOutput = error as { message?: string; stdout?: unknown; stderr?: unknown };
|
|
129
|
+
const message =
|
|
130
|
+
trimToNull(outputToString(errorOutput.stderr)) ??
|
|
131
|
+
trimToNull(outputToString(errorOutput.stdout)) ??
|
|
132
|
+
errorOutput.message ??
|
|
133
|
+
"unknown git error";
|
|
134
|
+
throw new Error(`Failed to resolve '${ref}' from '${repoLocator}': ${message}`);
|
|
135
|
+
}
|
|
136
|
+
const match = stdout
|
|
137
|
+
.split(/\r?\n/)
|
|
138
|
+
.map((line) => line.trim())
|
|
139
|
+
.filter(Boolean)
|
|
140
|
+
.map((line) => line.split(/\s+/))
|
|
141
|
+
.find((parts) => parts[1] === ref);
|
|
142
|
+
const sha = match?.[0];
|
|
143
|
+
if (!sha) {
|
|
144
|
+
throw new Error(
|
|
145
|
+
`Repository '${repoLocator}' does not expose base branch '${input.baseBranch}'`,
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
return normalizeSha(sha);
|
|
149
|
+
}
|