Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

TextGenerationPresets.ts

27 lines1.5 KB

1import type { TextGenerationPolicy } from "@t3tools/provider-core/server/textGenerationPolicy";
2​
3export 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. 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. When the listed commits use Conventional Commits, write the title as a Conventional Commit subject too, for example 'feat(web): add a recorder', with the narrowest accurate type, a scope only when obvious, and a lowercase description. Otherwise do not force Conventional Commit syntax into the title.",
9 inferRepositoryConventions: false,
10};
11​
12export const repositoryConventionsTextGenerationPolicy: TextGenerationPolicy = {
13 kind: "repo_conventions",
14 commitInstructions:
15 "Follow the repository's established commit message style when examples are available.",
16 changeRequestInstructions:
17 "Follow the repository's established change request title and body style when examples are available.",
18 inferRepositoryConventions: true,
19};
20​
21export const customTextGenerationPolicy = (
22 overrides: Omit<Partial<TextGenerationPolicy>, "kind">,
23): TextGenerationPolicy => ({
24 kind: "custom",
25 inferRepositoryConventions: false,
26 ...overrides,
27});