The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 13:30 UTC
fix(server): conventional commit subjects start lowercase (#36938)
Julius Marminge committed
Nov 14, 2026 at 13:29 UTC
9ab1d22d8fc0bbf491d92995f92fb6eb94efe8b0
3 files changed
+50
-8
apps/server/src/git/GitManager.test.ts
+25
@@ -3062,6 +3062,31 @@ it.layer(layerGitManagerTest)("GitManager", (it) => {
3062
}),
3063
);
3064
3065
+ it.effect("lowercases a capitalized Conventional Commits description", () =>
3066
+ Effect.gen(function* () {
3067
+ const repoDir = yield* makeTempDir("t3code-git-manager-");
3068
+ yield* initRepo(repoDir);
3069
+ const subjects = ["ci: Run E2E on pull requests", "feat(web)!: A new layout"];
3070
+ const queued = [...subjects];
3071
+
3072
+ const { manager } = yield* makeManager({
3073
+ serverSettings: { sourceControlWritingStyle: { mode: "conventional_commits" as const } },
3074
+ textGeneration: {
3075
+ generateCommitMessage: () => Effect.succeed({ subject: queued.shift() ?? "", body: "" }),
3076
+ },
3077
+ });
3078
+
3079
+ const committed: Array<string> = [];
3080
+ for (const [index] of subjects.entries()) {
3081
+ NodeFS.writeFileSync(NodePath.join(repoDir, "README.md"), `change ${index}\n`);
3082
+ yield* runStackedAction(manager, { cwd: repoDir, action: "commit" });
3083
+ committed.push((yield* runGit(repoDir, ["log", "-1", "--pretty=%s"])).stdout.trim());
3084
+ }
3085
+
3086
+ expect(committed).toEqual(["ci: run E2E on pull requests", "feat(web)!: a new layout"]);
3087
+ }),
3088
+ );
3089
+
3090
it.effect("includes CLAUDE.md for Claude writers only when it differs from AGENTS.md", () =>
3091
Effect.gen(function* () {
3092
const repoDir = yield* makeTempDir("t3code-git-manager-");
apps/server/src/git/GitManager.ts
+24
-7
@@ -532,17 +532,30 @@ function summarizeGitActionResult(
532
return { title: "Done" };
533
}
534
535
-function sanitizeCommitMessage(generated: {
536
- subject: string;
537
- body: string;
538
- branch?: string | undefined;
539
-}): {
535
+// A backstop for models that ignore the preset's lowercase instruction; acronyms and names like GitHub are left alone.
536
+const CONVENTIONAL_CAPITALIZED_DESCRIPTION =
537
+ /^([a-z]+(?:\([^)\n]*\))?!?: )([A-Z][a-z]*)(?![A-Za-z0-9])/;
538
+
539
+function sanitizeCommitMessage(
540
+ generated: {
541
+ subject: string;
542
+ body: string;
543
+ branch?: string | undefined;
544
+ },
545
+ conventionalCommits: boolean,
546
+): {
547
subject: string;
548
body: string;
549
branch?: string | undefined;
550
} {
551
const rawSubject = generated.subject.trim().split(/\r?\n/g)[0]?.trim() ?? "";
545
- const subject = rawSubject.replace(/[.]+$/g, "").trim();
552
+ const trimmedSubject = rawSubject.replace(/[.]+$/g, "").trim();
553
+ const subject = conventionalCommits
554
+ ? trimmedSubject.replace(
555
+ CONVENTIONAL_CAPITALIZED_DESCRIPTION,
556
+ (_, prefix: string, word: string) => prefix + word.toLowerCase(),
557
+ )
558
+ : trimmedSubject;
559
const safeSubject = subject.length > 0 ? subject.slice(0, 72).trimEnd() : "Update project files";
560
return {
561
subject: safeSubject,
@@ -2221,7 +2234,11 @@ export const make = Effect.gen(function* () {
2234
modelSelection: input.settings.modelSelection,
2235
projectId: input.settings.projectId,
2236
})
2224
- .pipe(Effect.map((result) => sanitizeCommitMessage(result)));
2237
+ .pipe(
2238
+ Effect.map((result) =>
2239
+ sanitizeCommitMessage(result, policy?.kind === "conventional_commits"),
2240
+ ),
2241
+ );
2242
2243
return {
2244
subject: generated.subject,
apps/server/src/textGeneration/TextGenerationPresets.ts
+1
-1
@@ -3,7 +3,7 @@ import type { TextGenerationPolicy } from "@t3tools/provider-core/server/textGen
3
export const conventionalCommitsTextGenerationPolicy: TextGenerationPolicy = {
4
kind: "conventional_commits",
5
commitInstructions:
6
- "Use Conventional Commits when generating commit subjects. Prefer the narrowest accurate type and include a scope only when it is obvious from the diff.",
6
+ "Use Conventional Commits when generating commit subjects. Prefer the narrowest accurate type and include a scope only when it is obvious from the diff. Start the description after the colon with a lowercase word, never a proper noun or acronym, because commitlint rejects a capitalized description.",
7
changeRequestInstructions:
8
"Keep the change request title concise. Do not force Conventional Commit syntax into the title unless the repository already uses it.",
9
inferRepositoryConventions: false,