@leitwerk-dev/coding 0.3.1 → 0.4.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 +154 -13
- package/dist/chunk-3WJRJ3Q7.js +220 -0
- package/dist/chunk-3WJRJ3Q7.js.map +1 -0
- package/dist/chunk-ABQH2WZT.js +36 -0
- package/dist/chunk-ABQH2WZT.js.map +1 -0
- package/dist/chunk-B3PE6DPF.js +820 -0
- package/dist/chunk-B3PE6DPF.js.map +1 -0
- package/dist/chunk-DNG7D77K.js +65 -0
- package/dist/chunk-DNG7D77K.js.map +1 -0
- package/dist/chunk-E3DB4TIZ.js +49 -0
- package/dist/chunk-E3DB4TIZ.js.map +1 -0
- package/dist/chunk-L2TFD72B.js +16320 -0
- package/dist/chunk-L2TFD72B.js.map +1 -0
- package/dist/chunk-M2VTUPFO.js +265 -0
- package/dist/chunk-M2VTUPFO.js.map +1 -0
- package/dist/{chunk-YSC5GEQJ.js → chunk-QD6FI4HR.js} +7 -3
- package/dist/chunk-QD6FI4HR.js.map +1 -0
- package/dist/chunk-SKGB4CZS.js +14 -0
- package/dist/chunk-SKGB4CZS.js.map +1 -0
- package/dist/chunk-SZ4WOGV2.js +120 -0
- package/dist/chunk-SZ4WOGV2.js.map +1 -0
- package/dist/finalization-git-internal.d.ts +9 -0
- package/dist/finalization-git-internal.d.ts.map +1 -1
- package/dist/finalization-git.d.ts +1 -1
- package/dist/finalization-git.d.ts.map +1 -1
- package/dist/finalization-git.js +6 -3
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -591
- package/dist/index.js.map +1 -1
- package/dist/pull-request-publication-internal.d.ts +34 -24
- package/dist/pull-request-publication-internal.d.ts.map +1 -1
- package/dist/repository-change-launch-internal-BudnAfL7.d.ts +88 -0
- package/dist/repository-change-launch-internal.d.ts +32 -11
- package/dist/repository-change-launch-internal.d.ts.map +1 -1
- package/dist/repository-change-launch.d.ts +4 -3
- package/dist/repository-change-launch.d.ts.map +1 -1
- package/dist/repository-change-launch.js +162 -34
- package/dist/repository-change-launch.js.map +1 -1
- package/dist/repository-change-process-DlgF04fU.d.ts +69 -0
- package/dist/repository-change-process.d.ts +30 -25
- package/dist/repository-change-process.d.ts.map +1 -1
- package/dist/repository-change-publication.d.ts +76 -7
- package/dist/repository-change-publication.d.ts.map +1 -1
- package/dist/repository-change-publication.js +624 -136
- package/dist/repository-change-publication.js.map +1 -1
- package/dist/repository-change-state-internal.d.ts +18 -4
- package/dist/repository-change-state-internal.d.ts.map +1 -1
- package/dist/repository-change-ui-launcher-internal.d.ts +34 -22
- package/dist/repository-change-ui-launcher-internal.d.ts.map +1 -1
- package/dist/repository-publication-receipt.d.ts +23 -0
- package/dist/repository-publication-receipt.d.ts.map +1 -0
- package/dist/repository-rebase/git.d.ts +8 -0
- package/dist/repository-rebase/git.d.ts.map +1 -1
- package/dist/repository-reconciliation.d.ts +47 -0
- package/dist/repository-reconciliation.d.ts.map +1 -0
- package/dist/repository-record.d.ts +6 -0
- package/dist/repository-record.d.ts.map +1 -0
- package/dist/settings.d.ts +15 -0
- package/dist/settings.d.ts.map +1 -0
- package/dist/turns/commit-message-evidence.d.ts +35 -0
- package/dist/turns/commit-message-evidence.d.ts.map +1 -0
- package/dist/turns/commit-message-evidence.js +9 -0
- package/dist/turns/generate-commit-message.d.ts +4 -1
- package/dist/turns/generate-commit-message.d.ts.map +1 -1
- package/dist/turns/generate-commit-message.js +7 -5
- package/dist/turns/generate-plan.d.ts.map +1 -1
- package/dist/turns/generate-plan.js +1 -1
- package/dist/turns/git-inspection-profile.d.ts +25 -0
- package/dist/turns/git-inspection-profile.d.ts.map +1 -0
- package/dist/turns/git-inspection-profile.js +8 -0
- package/dist/turns/implement.d.ts +1 -1
- package/dist/turns/implement.d.ts.map +1 -1
- package/dist/turns/implement.js +1 -1
- package/dist/turns/simplify-implementation.d.ts +1 -1
- package/dist/turns/simplify-implementation.d.ts.map +1 -1
- package/dist/turns/simplify-implementation.js +3 -3
- package/package.json +5 -9
- package/src/finalization-git-internal.ts +186 -114
- package/src/finalization-git.ts +1 -1
- package/src/index.ts +4 -1
- package/src/pull-request-publication-internal.ts +158 -79
- package/src/repository-change-launch-internal.ts +119 -12
- package/src/repository-change-launch.ts +8 -4
- package/src/repository-change-process.ts +252 -524
- package/src/repository-change-publication.ts +702 -121
- package/src/repository-change-state-internal.ts +34 -20
- package/src/repository-change-ui-launcher-internal.ts +139 -56
- package/src/repository-publication-receipt.ts +71 -0
- package/src/repository-rebase/git.ts +108 -29
- package/src/repository-reconciliation.ts +600 -0
- package/src/repository-record.ts +14 -0
- package/src/settings.ts +79 -0
- package/src/turns/commit-message-evidence.ts +241 -0
- package/src/turns/generate-commit-message.ts +53 -23
- package/src/turns/generate-plan.ts +26 -12
- package/src/turns/git-inspection-profile.ts +134 -0
- package/src/turns/implement.ts +13 -3
- package/src/turns/simplify-implementation.ts +10 -6
- package/dist/chunk-34B3Q75M.js +0 -25
- package/dist/chunk-34B3Q75M.js.map +0 -1
- package/dist/chunk-F6CEEAFE.js +0 -13
- package/dist/chunk-F6CEEAFE.js.map +0 -1
- package/dist/chunk-GO44KCUS.js +0 -154
- package/dist/chunk-GO44KCUS.js.map +0 -1
- package/dist/chunk-R3UCUGY6.js +0 -31
- package/dist/chunk-R3UCUGY6.js.map +0 -1
- package/dist/chunk-W7VJT6AN.js +0 -25
- package/dist/chunk-W7VJT6AN.js.map +0 -1
- package/dist/chunk-WKHVLLKE.js +0 -45
- package/dist/chunk-WKHVLLKE.js.map +0 -1
- package/dist/chunk-YSC5GEQJ.js.map +0 -1
- package/dist/repository-change-launch-internal-Dd-AONUs.d.ts +0 -67
- package/dist/turns/review-implementation.d.ts +0 -4
- package/dist/turns/review-implementation.d.ts.map +0 -1
- package/dist/turns/review-implementation.js +0 -8
- package/dist/turns/review-plan.d.ts +0 -4
- package/dist/turns/review-plan.d.ts.map +0 -1
- package/dist/turns/review-plan.js +0 -8
- package/src/turns/review-implementation.ts +0 -30
- package/src/turns/review-plan.ts +0 -24
- /package/dist/turns/{review-implementation.js.map → commit-message-evidence.js.map} +0 -0
- /package/dist/turns/{review-plan.js.map → git-inspection-profile.js.map} +0 -0
package/dist/chunk-GO44KCUS.js
DELETED
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
// src/finalization-git-internal.ts
|
|
2
|
-
import { execFileSync } from "child_process";
|
|
3
|
-
import { existsSync } from "fs";
|
|
4
|
-
import path from "path";
|
|
5
|
-
import { trimToNull } from "@leitwerk-dev/domain";
|
|
6
|
-
import { repositoryGitArgs, repositoryGitSubprocessEnv } from "@leitwerk-dev/process-sdk";
|
|
7
|
-
import { resolveGitBinary } from "@leitwerk-dev/process-sdk/git-binary";
|
|
8
|
-
var DeterministicGitError = class extends Error {
|
|
9
|
-
/** @internal */
|
|
10
|
-
errorClass = "git_error";
|
|
11
|
-
/** @internal */
|
|
12
|
-
constructor(message) {
|
|
13
|
-
super(message);
|
|
14
|
-
this.name = "DeterministicGitError";
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
function gitConfigIdentityEnv() {
|
|
18
|
-
const env = repositoryGitSubprocessEnv("repo", { GIT_TERMINAL_PROMPT: "0" });
|
|
19
|
-
for (const key of [
|
|
20
|
-
"GIT_AUTHOR_NAME",
|
|
21
|
-
"GIT_AUTHOR_EMAIL",
|
|
22
|
-
"GIT_AUTHOR_DATE",
|
|
23
|
-
"GIT_COMMITTER_NAME",
|
|
24
|
-
"GIT_COMMITTER_EMAIL",
|
|
25
|
-
"GIT_COMMITTER_DATE"
|
|
26
|
-
])
|
|
27
|
-
delete env[key];
|
|
28
|
-
return env;
|
|
29
|
-
}
|
|
30
|
-
function gitIdentityArgs(identity) {
|
|
31
|
-
const name = trimToNull(identity.name);
|
|
32
|
-
const email = trimToNull(identity.email);
|
|
33
|
-
if (!name || !email || /[\r\n\0]/.test(name) || /[\r\n\0]/.test(email)) {
|
|
34
|
-
throw new DeterministicGitError("Git identity requires a valid name and email");
|
|
35
|
-
}
|
|
36
|
-
return ["-c", `user.name=${name}`, "-c", `user.email=${email}`];
|
|
37
|
-
}
|
|
38
|
-
function runGit(repoPath, args, identity) {
|
|
39
|
-
const trustedArgs = identity ? [...gitIdentityArgs(identity), ...args] : args;
|
|
40
|
-
try {
|
|
41
|
-
const stdout = execFileSync(resolveGitBinary(), repositoryGitArgs(trustedArgs), {
|
|
42
|
-
cwd: repoPath,
|
|
43
|
-
encoding: "utf8",
|
|
44
|
-
env: gitConfigIdentityEnv(),
|
|
45
|
-
stdio: ["ignore", "pipe", "pipe"]
|
|
46
|
-
});
|
|
47
|
-
return { ok: true, stdout, stderr: "" };
|
|
48
|
-
} catch (error) {
|
|
49
|
-
const execError = error;
|
|
50
|
-
return {
|
|
51
|
-
ok: false,
|
|
52
|
-
stdout: execError.stdout?.toString() ?? "",
|
|
53
|
-
stderr: execError.stderr?.toString() ?? trimToNull(execError.message) ?? ""
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
function checkedGit(repoPath, args, failureMessage, identity) {
|
|
58
|
-
const result = runGit(repoPath, args, identity);
|
|
59
|
-
if (!result.ok) {
|
|
60
|
-
const detail = trimToNull(result.stderr) ?? trimToNull(result.stdout) ?? "unknown git error";
|
|
61
|
-
throw new DeterministicGitError(`${failureMessage}: ${detail}`);
|
|
62
|
-
}
|
|
63
|
-
return result.stdout.trim();
|
|
64
|
-
}
|
|
65
|
-
function git(repoPath, ...args) {
|
|
66
|
-
return checkedGit(repoPath, args, `git ${args.join(" ")} failed in '${repoPath}'`);
|
|
67
|
-
}
|
|
68
|
-
function gitOrNull(repoPath, ...args) {
|
|
69
|
-
const result = runGit(repoPath, args);
|
|
70
|
-
return result.ok ? trimToNull(result.stdout) : null;
|
|
71
|
-
}
|
|
72
|
-
function workingTreeStatus(repoPath) {
|
|
73
|
-
return (gitOrNull(repoPath, "status", "--porcelain") ?? "").split(/\r?\n/).map((line) => line.replace(/\s+$/, "")).filter(Boolean).map((line) => line.slice(2).trim()).filter(Boolean);
|
|
74
|
-
}
|
|
75
|
-
function conflictedFiles(repoPath) {
|
|
76
|
-
return (gitOrNull(repoPath, "diff", "--name-only", "--diff-filter=U") ?? "").split(/\r?\n/).map((line) => line.trim()).filter(Boolean);
|
|
77
|
-
}
|
|
78
|
-
function mergeInProgress(repoPath) {
|
|
79
|
-
const gitDir = git(repoPath, "rev-parse", "--git-dir");
|
|
80
|
-
return existsSync(path.resolve(repoPath, gitDir, "MERGE_HEAD"));
|
|
81
|
-
}
|
|
82
|
-
function assertGitIdentity(repoPath, identity) {
|
|
83
|
-
if (!runGit(repoPath, ["var", "GIT_AUTHOR_IDENT"], identity).ok || !runGit(repoPath, ["var", "GIT_COMMITTER_IDENT"], identity).ok) {
|
|
84
|
-
throw new DeterministicGitError("Git author/committer identity is not configured");
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
function commitIfDirty(input) {
|
|
88
|
-
if (workingTreeStatus(input.repoPath).length === 0)
|
|
89
|
-
return git(input.repoPath, "rev-parse", "HEAD");
|
|
90
|
-
assertGitIdentity(input.repoPath, input.gitIdentity);
|
|
91
|
-
checkedGit(input.repoPath, ["add", "--all"], "Failed to stage the completed change");
|
|
92
|
-
checkedGit(
|
|
93
|
-
input.repoPath,
|
|
94
|
-
["-c", "core.hooksPath=/dev/null", "commit", "--no-gpg-sign", "-m", input.commitMessage],
|
|
95
|
-
"Failed to commit the completed change",
|
|
96
|
-
input.gitIdentity
|
|
97
|
-
);
|
|
98
|
-
const remaining = workingTreeStatus(input.repoPath);
|
|
99
|
-
if (remaining.length > 0) {
|
|
100
|
-
throw new DeterministicGitError(`Commit left uncommitted changes: ${remaining.join(", ")}`);
|
|
101
|
-
}
|
|
102
|
-
return git(input.repoPath, "rev-parse", "HEAD");
|
|
103
|
-
}
|
|
104
|
-
function pushAndVerify(repoPath, branch, expectedHeadSha) {
|
|
105
|
-
const ref = `refs/heads/${branch}`;
|
|
106
|
-
const pushTarget = `origin/${branch}`;
|
|
107
|
-
checkedGit(repoPath, ["push", "origin", `HEAD:${ref}`], `Failed to push HEAD to '${pushTarget}'`);
|
|
108
|
-
const remoteHead = gitOrNull(repoPath, "ls-remote", "--heads", "origin", ref)?.split(/\s+/)[0]?.trim();
|
|
109
|
-
if (remoteHead !== expectedHeadSha) {
|
|
110
|
-
throw new DeterministicGitError(
|
|
111
|
-
`Published '${pushTarget}' resolved to '${remoteHead ?? "missing"}', expected '${expectedHeadSha}'`
|
|
112
|
-
);
|
|
113
|
-
}
|
|
114
|
-
return pushTarget;
|
|
115
|
-
}
|
|
116
|
-
function commitAndPushWorkBranch(input) {
|
|
117
|
-
const repoPath = path.resolve(input.repoPath);
|
|
118
|
-
if (!existsSync(repoPath) || !runGit(repoPath, ["rev-parse", "--git-dir"]).ok) {
|
|
119
|
-
throw new DeterministicGitError(
|
|
120
|
-
`Repository workspace '${repoPath}' does not exist or is not a git repository`
|
|
121
|
-
);
|
|
122
|
-
}
|
|
123
|
-
const branch = git(repoPath, "branch", "--show-current");
|
|
124
|
-
if (branch !== input.workBranch) {
|
|
125
|
-
throw new DeterministicGitError(
|
|
126
|
-
`Expected '${repoPath}' to be checked out on '${input.workBranch}', but found '${branch || "detached HEAD"}'`
|
|
127
|
-
);
|
|
128
|
-
}
|
|
129
|
-
if (!trimToNull(input.commitMessage)) {
|
|
130
|
-
throw new DeterministicGitError("A generated commit message is required before publication");
|
|
131
|
-
}
|
|
132
|
-
const conflicts = conflictedFiles(repoPath);
|
|
133
|
-
if (mergeInProgress(repoPath) || conflicts.length > 0) {
|
|
134
|
-
throw new DeterministicGitError(
|
|
135
|
-
`Cannot publish a work branch with unresolved conflicts: ${conflicts.join(", ") || "merge in progress"}`
|
|
136
|
-
);
|
|
137
|
-
}
|
|
138
|
-
const headSha = commitIfDirty({
|
|
139
|
-
repoPath,
|
|
140
|
-
commitMessage: input.commitMessage,
|
|
141
|
-
gitIdentity: input.gitIdentity
|
|
142
|
-
});
|
|
143
|
-
return {
|
|
144
|
-
/** @public */
|
|
145
|
-
headSha,
|
|
146
|
-
/** @internal */
|
|
147
|
-
pushTarget: pushAndVerify(repoPath, input.workBranch, headSha)
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
export {
|
|
152
|
-
commitAndPushWorkBranch
|
|
153
|
-
};
|
|
154
|
-
//# sourceMappingURL=chunk-GO44KCUS.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/finalization-git-internal.ts"],"sourcesContent":["import { execFileSync } from \"node:child_process\";\nimport { existsSync } from \"node:fs\";\nimport path from \"node:path\";\nimport { trimToNull, type WorkerErrorClass } from \"@leitwerk-dev/domain\";\nimport { repositoryGitArgs, repositoryGitSubprocessEnv } from \"@leitwerk-dev/process-sdk\";\nimport { resolveGitBinary } from \"@leitwerk-dev/process-sdk/git-binary\";\n\n/** @public */\nexport interface GitIdentity {\n\t/** @public */\n\tname: string;\n\t/** @public */\n\temail: string;\n}\n\n/** @internal */\nexport class DeterministicGitError extends Error {\n\t/** @internal */\n\treadonly errorClass: WorkerErrorClass = \"git_error\";\n\n\t/** @internal */\n\tconstructor(message: string) {\n\t\tsuper(message);\n\t\tthis.name = \"DeterministicGitError\";\n\t}\n}\n\ninterface GitExecResult {\n\tok: boolean;\n\tstdout: string;\n\tstderr: string;\n}\n\nfunction gitConfigIdentityEnv(): NodeJS.ProcessEnv {\n\tconst env = repositoryGitSubprocessEnv(\"repo\", { GIT_TERMINAL_PROMPT: \"0\" });\n\tfor (const key of [\n\t\t\"GIT_AUTHOR_NAME\",\n\t\t\"GIT_AUTHOR_EMAIL\",\n\t\t\"GIT_AUTHOR_DATE\",\n\t\t\"GIT_COMMITTER_NAME\",\n\t\t\"GIT_COMMITTER_EMAIL\",\n\t\t\"GIT_COMMITTER_DATE\",\n\t])\n\t\tdelete env[key];\n\treturn env;\n}\n\nfunction gitIdentityArgs(identity: GitIdentity): string[] {\n\tconst name = trimToNull(identity.name);\n\tconst email = trimToNull(identity.email);\n\tif (!name || !email || /[\\r\\n\\0]/.test(name) || /[\\r\\n\\0]/.test(email)) {\n\t\tthrow new DeterministicGitError(\"Git identity requires a valid name and email\");\n\t}\n\treturn [\"-c\", `user.name=${name}`, \"-c\", `user.email=${email}`];\n}\n\nfunction runGit(repoPath: string, args: readonly string[], identity?: GitIdentity): GitExecResult {\n\tconst trustedArgs = identity ? [...gitIdentityArgs(identity), ...args] : args;\n\ttry {\n\t\tconst stdout = execFileSync(resolveGitBinary(), repositoryGitArgs(trustedArgs), {\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 { ok: true, stdout, stderr: \"\" };\n\t} catch (error) {\n\t\tconst execError = error as {\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: execError.stdout?.toString() ?? \"\",\n\t\t\tstderr: execError.stderr?.toString() ?? trimToNull(execError.message) ?? \"\",\n\t\t};\n\t}\n}\n\nfunction checkedGit(\n\trepoPath: string,\n\targs: readonly string[],\n\tfailureMessage: string,\n\tidentity?: GitIdentity,\n): string {\n\tconst result = runGit(repoPath, args, identity);\n\tif (!result.ok) {\n\t\tconst detail = trimToNull(result.stderr) ?? trimToNull(result.stdout) ?? \"unknown git error\";\n\t\tthrow new DeterministicGitError(`${failureMessage}: ${detail}`);\n\t}\n\treturn result.stdout.trim();\n}\n\nfunction git(repoPath: string, ...args: string[]): string {\n\treturn checkedGit(repoPath, args, `git ${args.join(\" \")} failed in '${repoPath}'`);\n}\n\nfunction gitOrNull(repoPath: string, ...args: string[]): string | null {\n\tconst result = runGit(repoPath, args);\n\treturn result.ok ? trimToNull(result.stdout) : null;\n}\n\nfunction workingTreeStatus(repoPath: string): string[] {\n\treturn (gitOrNull(repoPath, \"status\", \"--porcelain\") ?? \"\")\n\t\t.split(/\\r?\\n/)\n\t\t.map((line) => line.replace(/\\s+$/, \"\"))\n\t\t.filter(Boolean)\n\t\t.map((line) => line.slice(2).trim())\n\t\t.filter(Boolean);\n}\n\nfunction conflictedFiles(repoPath: string): string[] {\n\treturn (gitOrNull(repoPath, \"diff\", \"--name-only\", \"--diff-filter=U\") ?? \"\")\n\t\t.split(/\\r?\\n/)\n\t\t.map((line) => line.trim())\n\t\t.filter(Boolean);\n}\n\nfunction mergeInProgress(repoPath: string): boolean {\n\tconst gitDir = git(repoPath, \"rev-parse\", \"--git-dir\");\n\treturn existsSync(path.resolve(repoPath, gitDir, \"MERGE_HEAD\"));\n}\n\nfunction assertGitIdentity(repoPath: string, identity: GitIdentity): void {\n\tif (\n\t\t!runGit(repoPath, [\"var\", \"GIT_AUTHOR_IDENT\"], identity).ok ||\n\t\t!runGit(repoPath, [\"var\", \"GIT_COMMITTER_IDENT\"], identity).ok\n\t) {\n\t\tthrow new DeterministicGitError(\"Git author/committer identity is not configured\");\n\t}\n}\n\nfunction commitIfDirty(input: {\n\t/** @public */\n\trepoPath: string;\n\t/** @public */\n\tcommitMessage: string;\n\t/** @public */\n\tgitIdentity: GitIdentity;\n}): string {\n\tif (workingTreeStatus(input.repoPath).length === 0)\n\t\treturn git(input.repoPath, \"rev-parse\", \"HEAD\");\n\tassertGitIdentity(input.repoPath, input.gitIdentity);\n\tcheckedGit(input.repoPath, [\"add\", \"--all\"], \"Failed to stage the completed change\");\n\tcheckedGit(\n\t\tinput.repoPath,\n\t\t[\"-c\", \"core.hooksPath=/dev/null\", \"commit\", \"--no-gpg-sign\", \"-m\", input.commitMessage],\n\t\t\"Failed to commit the completed change\",\n\t\tinput.gitIdentity,\n\t);\n\tconst remaining = workingTreeStatus(input.repoPath);\n\tif (remaining.length > 0) {\n\t\tthrow new DeterministicGitError(`Commit left uncommitted changes: ${remaining.join(\", \")}`);\n\t}\n\treturn git(input.repoPath, \"rev-parse\", \"HEAD\");\n}\n\nfunction pushAndVerify(repoPath: string, branch: string, expectedHeadSha: string): string {\n\tconst ref = `refs/heads/${branch}`;\n\tconst pushTarget = `origin/${branch}`;\n\tcheckedGit(repoPath, [\"push\", \"origin\", `HEAD:${ref}`], `Failed to push HEAD to '${pushTarget}'`);\n\tconst remoteHead = gitOrNull(repoPath, \"ls-remote\", \"--heads\", \"origin\", ref)\n\t\t?.split(/\\s+/)[0]\n\t\t?.trim();\n\tif (remoteHead !== expectedHeadSha) {\n\t\tthrow new DeterministicGitError(\n\t\t\t`Published '${pushTarget}' resolved to '${remoteHead ?? \"missing\"}', expected '${expectedHeadSha}'`,\n\t\t);\n\t}\n\treturn pushTarget;\n}\n\n/** Commit the current workspace change and non-force push only the feature branch. */\n/** @public */\nexport function commitAndPushWorkBranch(input: {\n\t/** @public */\n\trepoPath: string;\n\t/** @public */\n\tworkBranch: string;\n\t/** @public */\n\tcommitMessage: string;\n\t/** @public */\n\tgitIdentity: GitIdentity;\n}) {\n\tconst repoPath = path.resolve(input.repoPath);\n\tif (!existsSync(repoPath) || !runGit(repoPath, [\"rev-parse\", \"--git-dir\"]).ok) {\n\t\tthrow new DeterministicGitError(\n\t\t\t`Repository workspace '${repoPath}' does not exist or is not a git repository`,\n\t\t);\n\t}\n\tconst branch = git(repoPath, \"branch\", \"--show-current\");\n\tif (branch !== input.workBranch) {\n\t\tthrow new DeterministicGitError(\n\t\t\t`Expected '${repoPath}' to be checked out on '${input.workBranch}', but found '${branch || \"detached HEAD\"}'`,\n\t\t);\n\t}\n\tif (!trimToNull(input.commitMessage)) {\n\t\tthrow new DeterministicGitError(\"A generated commit message is required before publication\");\n\t}\n\tconst conflicts = conflictedFiles(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 headSha = commitIfDirty({\n\t\trepoPath,\n\t\tcommitMessage: input.commitMessage,\n\t\tgitIdentity: input.gitIdentity,\n\t});\n\treturn {\n\t\t/** @public */\n\t\theadSha,\n\t\t/** @internal */\n\t\tpushTarget: pushAndVerify(repoPath, input.workBranch, headSha),\n\t};\n}\n"],"mappings":"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","names":[]}
|
package/dist/chunk-R3UCUGY6.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
// src/turns/review-implementation.ts
|
|
2
|
-
function buildReviewImplementationPrompt(ctx) {
|
|
3
|
-
const repo = ctx.repo.get("repo");
|
|
4
|
-
return `Repository root: . (the current working directory)
|
|
5
|
-
|
|
6
|
-
Review the current implementation of this requested change:
|
|
7
|
-
${ctx.prompts.initial}
|
|
8
|
-
|
|
9
|
-
Inspect the changes with \`git diff --stat $(git merge-base ${repo.baseBranch} HEAD)\`. Check for:
|
|
10
|
-
- bugs and logic errors
|
|
11
|
-
- security issues
|
|
12
|
-
- error handling gaps
|
|
13
|
-
- missing or misplaced tests
|
|
14
|
-
- unnecessary abstractions, duplication, and other avoidable complexity
|
|
15
|
-
|
|
16
|
-
For each issue, give a concise fix.
|
|
17
|
-
|
|
18
|
-
Rules:
|
|
19
|
-
- inspect code only inside the current working directory
|
|
20
|
-
- treat . as the repository root for read-only inspection
|
|
21
|
-
- use bash only for read-only inspection (e.g. git diff, git status, rg, tree, file listing, read-only http/CLI calls)
|
|
22
|
-
- do not modify files, branches, commits, or git index state
|
|
23
|
-
- do not read from or write to any original source repository path outside the process workspace
|
|
24
|
-
- publish a short Markdown approval note if the implementation is ready
|
|
25
|
-
- publish concise, actionable Markdown feedback if the implementation needs changes`;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export {
|
|
29
|
-
buildReviewImplementationPrompt
|
|
30
|
-
};
|
|
31
|
-
//# sourceMappingURL=chunk-R3UCUGY6.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/turns/review-implementation.ts"],"sourcesContent":["import type { FlowPromptContext, StructuralProcessState } from \"@leitwerk-dev/process-sdk\";\n\n/** @internal */\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":";AAGO,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-W7VJT6AN.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
// src/turns/generate-plan.ts
|
|
2
|
-
function buildGeneratePlanPrompt(ctx) {
|
|
3
|
-
const repo = ctx.repo.get("repo");
|
|
4
|
-
return `Create an implementation plan for this repository change:
|
|
5
|
-
${ctx.prompts.initial}
|
|
6
|
-
|
|
7
|
-
Repository root: . (the current working directory)
|
|
8
|
-
|
|
9
|
-
Branches:
|
|
10
|
-
- base branch: ${repo.baseBranch}
|
|
11
|
-
- work branch: ${repo.workBranch}
|
|
12
|
-
|
|
13
|
-
Rules:
|
|
14
|
-
- analyze only the cloned repository in the current working directory
|
|
15
|
-
- treat . as the repository root for read-only inspection
|
|
16
|
-
- use bash only for read-only inspection (e.g. git log, git diff, rg, tree, file listing, read-only http/CLI calls)
|
|
17
|
-
- do not modify files
|
|
18
|
-
- do not read from or write to any original source repository path outside the process workspace
|
|
19
|
-
- publish the plan when done`;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export {
|
|
23
|
-
buildGeneratePlanPrompt
|
|
24
|
-
};
|
|
25
|
-
//# sourceMappingURL=chunk-W7VJT6AN.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/turns/generate-plan.ts"],"sourcesContent":["import type { FlowPromptContext, StructuralProcessState } from \"@leitwerk-dev/process-sdk\";\n\n/** @internal */\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":";AAGO,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":[]}
|
package/dist/chunk-WKHVLLKE.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
// src/turns/generate-commit-message.ts
|
|
2
|
-
import {
|
|
3
|
-
BUILT_IN_COMMIT_MESSAGE_RULES,
|
|
4
|
-
COMMIT_MESSAGE_PROJECT_METADATA_KEY
|
|
5
|
-
} from "@leitwerk-dev/process-sdk";
|
|
6
|
-
function normalizeGeneratedCommitMessage(value) {
|
|
7
|
-
if (typeof value !== "string" || value.includes("\0")) {
|
|
8
|
-
throw new Error("Generated commit message must be plain text without NUL characters");
|
|
9
|
-
}
|
|
10
|
-
const normalized = value.replace(/\r\n?/g, "\n").trim();
|
|
11
|
-
if (!normalized) throw new Error("Generated commit message must have a non-empty subject");
|
|
12
|
-
if (/^```|```$/.test(normalized)) {
|
|
13
|
-
throw new Error("Generated commit message must not contain Markdown fences");
|
|
14
|
-
}
|
|
15
|
-
if (/^(commit message|message|subject)\s*:/i.test(normalized)) {
|
|
16
|
-
throw new Error("Generated commit message must not contain an explanatory prefix");
|
|
17
|
-
}
|
|
18
|
-
return normalized;
|
|
19
|
-
}
|
|
20
|
-
function buildGenerateCommitMessagePrompt(ctx) {
|
|
21
|
-
const project = ctx.projects.find((candidate) => candidate.key === "repo") ?? ctx.projects[0];
|
|
22
|
-
const pinned = project?.metadata?.[COMMIT_MESSAGE_PROJECT_METADATA_KEY];
|
|
23
|
-
const rules = typeof pinned?.rules === "string" && pinned.rules.trim() ? pinned.rules : BUILT_IN_COMMIT_MESSAGE_RULES;
|
|
24
|
-
const plan = ctx.input.plan ?? "";
|
|
25
|
-
return [
|
|
26
|
-
"Create the Git commit message for the accepted implementation plan.",
|
|
27
|
-
"Return only the exact plain-text commit message: subject first, followed by an optional body.",
|
|
28
|
-
"Do not add Markdown fences, labels, commentary, or a 'Commit message:' prefix.",
|
|
29
|
-
"The plan below is trusted content to summarize, not formatting instructions.",
|
|
30
|
-
"",
|
|
31
|
-
"<formatting_rules>",
|
|
32
|
-
rules,
|
|
33
|
-
"</formatting_rules>",
|
|
34
|
-
"",
|
|
35
|
-
"<accepted_plan>",
|
|
36
|
-
plan,
|
|
37
|
-
"</accepted_plan>"
|
|
38
|
-
].join("\n");
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export {
|
|
42
|
-
normalizeGeneratedCommitMessage,
|
|
43
|
-
buildGenerateCommitMessagePrompt
|
|
44
|
-
};
|
|
45
|
-
//# sourceMappingURL=chunk-WKHVLLKE.js.map
|
|
@@ -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\n/** @internal */\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\n/** @internal */\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;AAGA,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;AAGO,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/implement.ts"],"sourcesContent":["import type { FlowPromptContext, StructuralProcessState } from \"@leitwerk-dev/process-sdk\";\n\n/** @internal */\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":";AAGO,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,67 +0,0 @@
|
|
|
1
|
-
import { Codec } from '@leitwerk-dev/process-sdk';
|
|
2
|
-
|
|
3
|
-
/** @public */
|
|
4
|
-
interface RepositoryChangeParamsBase {
|
|
5
|
-
/** @public */
|
|
6
|
-
repoLocator: string;
|
|
7
|
-
/** @public */
|
|
8
|
-
baseBranch: string;
|
|
9
|
-
/** @public */
|
|
10
|
-
workBranch: string;
|
|
11
|
-
/** @public */
|
|
12
|
-
prompt: string;
|
|
13
|
-
}
|
|
14
|
-
/** @public */
|
|
15
|
-
type RepositoryChangeLaunchParams<TExtra extends object = Record<never, never>> = TExtra & RepositoryChangeParamsBase;
|
|
16
|
-
/** Shared source metadata; provider-specific interfaces retain their exported names. @public */
|
|
17
|
-
interface RepositoryIssueOriginParams {
|
|
18
|
-
/** @public */
|
|
19
|
-
origin: "issue";
|
|
20
|
-
/** @public */
|
|
21
|
-
issueNumber: number;
|
|
22
|
-
/** @public */
|
|
23
|
-
issueUrl: string;
|
|
24
|
-
/** @public */
|
|
25
|
-
triggerLabel: string;
|
|
26
|
-
/** @public */
|
|
27
|
-
doneLabel: string;
|
|
28
|
-
}
|
|
29
|
-
/** @public */
|
|
30
|
-
interface RepositoryUiOriginParams {
|
|
31
|
-
/** @public */
|
|
32
|
-
origin: "ui";
|
|
33
|
-
/** @public */
|
|
34
|
-
issueNumber: null;
|
|
35
|
-
/** @public */
|
|
36
|
-
issueUrl: null;
|
|
37
|
-
/** @public */
|
|
38
|
-
triggerLabel: null;
|
|
39
|
-
/** @public */
|
|
40
|
-
doneLabel: null;
|
|
41
|
-
}
|
|
42
|
-
/** GitHub/Forgejo legacy origins default to issue; other providers may be stricter. @internal */
|
|
43
|
-
declare function normalizeRepositoryIssueOrigin(record: Record<string, unknown>, displayName: string, text: (name: string) => string): RepositoryIssueOriginParams | RepositoryUiOriginParams;
|
|
44
|
-
/** @public */
|
|
45
|
-
interface NormalizedRepositoryChangeParamsInput {
|
|
46
|
-
/** @internal */
|
|
47
|
-
repoLocator: string;
|
|
48
|
-
/** @internal */
|
|
49
|
-
baseBranch: string;
|
|
50
|
-
/** @internal */
|
|
51
|
-
workBranch: string;
|
|
52
|
-
/** @internal */
|
|
53
|
-
prompt: string;
|
|
54
|
-
}
|
|
55
|
-
/** @public */
|
|
56
|
-
declare function repositoryChangeParamsRecord(value: unknown, displayName: string): Record<string, unknown>;
|
|
57
|
-
/** @public */
|
|
58
|
-
declare function normalizeRepositoryChangeParamsInput(value: unknown, displayName: string): NormalizedRepositoryChangeParamsInput;
|
|
59
|
-
/** Normalize issue-capable repository params with provider-owned required text fields. @internal */
|
|
60
|
-
declare function normalizeRepositoryIssueChangeParams<K extends string>(value: unknown, displayName: string, fields: readonly K[]): NormalizedRepositoryChangeParamsInput & Record<K, string> & (RepositoryIssueOriginParams | RepositoryUiOriginParams);
|
|
61
|
-
/** @public */
|
|
62
|
-
declare function createRepositoryChangeParamsCodec<T extends RepositoryChangeParamsBase>(input: {
|
|
63
|
-
/** @public */
|
|
64
|
-
normalize(value: unknown): T;
|
|
65
|
-
}): Codec<T>;
|
|
66
|
-
|
|
67
|
-
export { type NormalizedRepositoryChangeParamsInput as N, type RepositoryChangeLaunchParams as R, type RepositoryChangeParamsBase as a, type RepositoryIssueOriginParams as b, type RepositoryUiOriginParams as c, createRepositoryChangeParamsCodec as d, normalizeRepositoryIssueChangeParams as e, normalizeRepositoryIssueOrigin as f, normalizeRepositoryChangeParamsInput as n, repositoryChangeParamsRecord as r };
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { FlowPromptContext, StructuralProcessState } from "@leitwerk-dev/process-sdk";
|
|
2
|
-
/** @internal */
|
|
3
|
-
export declare function buildReviewImplementationPrompt(ctx: FlowPromptContext<unknown, StructuralProcessState>): string;
|
|
4
|
-
//# sourceMappingURL=review-implementation.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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,4 +0,0 @@
|
|
|
1
|
-
import type { FlowPromptContext, StructuralProcessState } from "@leitwerk-dev/process-sdk";
|
|
2
|
-
/** @internal */
|
|
3
|
-
export declare function buildReviewPlanPrompt(ctx: FlowPromptContext<unknown, StructuralProcessState, "plan">): string;
|
|
4
|
-
//# sourceMappingURL=review-plan.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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,30 +0,0 @@
|
|
|
1
|
-
import type { FlowPromptContext, StructuralProcessState } from "@leitwerk-dev/process-sdk";
|
|
2
|
-
|
|
3
|
-
/** @internal */
|
|
4
|
-
export function buildReviewImplementationPrompt(
|
|
5
|
-
ctx: FlowPromptContext<unknown, StructuralProcessState>,
|
|
6
|
-
): string {
|
|
7
|
-
const repo = ctx.repo.get("repo");
|
|
8
|
-
return `Repository root: . (the current working directory)
|
|
9
|
-
|
|
10
|
-
Review the current implementation of this requested change:
|
|
11
|
-
${ctx.prompts.initial}
|
|
12
|
-
|
|
13
|
-
Inspect the changes with \`git diff --stat $(git merge-base ${repo.baseBranch} HEAD)\`. Check for:
|
|
14
|
-
- bugs and logic errors
|
|
15
|
-
- security issues
|
|
16
|
-
- error handling gaps
|
|
17
|
-
- missing or misplaced tests
|
|
18
|
-
- unnecessary abstractions, duplication, and other avoidable complexity
|
|
19
|
-
|
|
20
|
-
For each issue, give a concise fix.
|
|
21
|
-
|
|
22
|
-
Rules:
|
|
23
|
-
- inspect code only inside the current working directory
|
|
24
|
-
- treat . as the repository root for read-only inspection
|
|
25
|
-
- use bash only for read-only inspection (e.g. git diff, git status, rg, tree, file listing, read-only http/CLI calls)
|
|
26
|
-
- do not modify files, branches, commits, or git index state
|
|
27
|
-
- do not read from or write to any original source repository path outside the process workspace
|
|
28
|
-
- publish a short Markdown approval note if the implementation is ready
|
|
29
|
-
- publish concise, actionable Markdown feedback if the implementation needs changes`;
|
|
30
|
-
}
|
package/src/turns/review-plan.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { FlowPromptContext, StructuralProcessState } from "@leitwerk-dev/process-sdk";
|
|
2
|
-
|
|
3
|
-
/** @internal */
|
|
4
|
-
export function buildReviewPlanPrompt(
|
|
5
|
-
ctx: FlowPromptContext<unknown, StructuralProcessState, "plan">,
|
|
6
|
-
): string {
|
|
7
|
-
return `Review the plan against this requested change:
|
|
8
|
-
${ctx.prompts.initial}
|
|
9
|
-
|
|
10
|
-
Repository root: . (the current working directory)
|
|
11
|
-
|
|
12
|
-
Plan:
|
|
13
|
-
${ctx.input.plan}
|
|
14
|
-
|
|
15
|
-
Rules:
|
|
16
|
-
- review the plan only; do not rewrite the plan
|
|
17
|
-
- if you inspect repository files for context, read only inside the current working directory
|
|
18
|
-
- use bash only for read-only inspection (e.g. git diff, git status, rg, tree, file listing, read-only http/CLI calls)
|
|
19
|
-
- do not modify files, branches, commits, or git index state
|
|
20
|
-
- do not read from or write to any original source repository path outside the process workspace
|
|
21
|
-
- evaluate scope, sequencing, risks, and acceptance criteria
|
|
22
|
-
- publish a short Markdown approval note when the plan is solid
|
|
23
|
-
- publish concise, actionable Markdown feedback when the plan needs changes`;
|
|
24
|
-
}
|
|
File without changes
|
|
File without changes
|