Skip to content

feat: add configurable Git writing settings#4204

Open
maria-rcks wants to merge 2 commits into
pingdotgg:mainfrom
maria-rcks:feat/git-writing-settings
Open

feat: add configurable Git writing settings#4204
maria-rcks wants to merge 2 commits into
pingdotgg:mainfrom
maria-rcks:feat/git-writing-settings

Conversation

@maria-rcks

@maria-rcks maria-rcks commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

What Changed

  • Add global Git writing preferences with three modes:
    • Repository conventions
    • Conventional Commits
    • Custom instructions
  • Add an optional dedicated Git writer model for commit messages, pull request content, and branch names.
  • Use recent repository commit subjects as examples when following repository conventions.
  • Detect GitHub pull request templates and use their structure when generating pull request descriptions.
  • Safely constrain template discovery to the repository, bound template reads, and avoid guessing when multiple templates are available.
  • Fall back to the global text-generation model when a dedicated Git writer provider is unavailable.

Why

Generated commit messages and pull request content currently use one generic style across repositories.

These settings let generated Git text follow repository conventions or explicit user instructions while still allowing a separate model to be selected for Git-writing tasks. Pull request descriptions can also follow each repository's existing template instead of always using a fixed body structure.

UI Changes

The Source Control settings page now includes a Text Generation section for:

  • Git writing style
  • Pull request template usage
  • An optional dedicated Git writer model
image

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

Closes #264
Closes #656
Closes #989


Note

Medium Risk
Touches commit/PR generation and new git-tree template reads; bounded and tested, but behavior changes affect all stacked git actions and persisted settings.

Overview
Adds server settings for how AI-generated Git text is written: textGenerationStyle (repository conventions, Conventional Commits, or custom instructions), optional follow PR templates, and an optional gitWriterModelSelection that overrides the global text-generation model for commits, PRs, and branch names.

GitManager now resolves style into a TextGenerationPolicy (including recent commit subjects for repo conventions), passes policy and detected prTemplate into text generation, and uses resolveGitWriterModelSelection for model choice. New detectPrTemplate reads templates from the committed base tree via git ls-tree/cat-file (size limits, no ambiguous multi-template guesses, symlink/path safety).

Prompt builders and all provider backends accept policy and prTemplate; PR bodies follow the repo template when present instead of fixed Summary/Testing headings.

UI: Source Control settings gain a Text generation section (style, PR templates toggle, optional Git writer model). Shared isModelSelectionProviderEnabled / resolveGitWriterModelSelection preserve the dedicated selection when its provider is disabled while falling back at runtime.

Reviewed by Cursor Bugbot for commit 4c5f401. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Add configurable Git writing style, PR template detection, and dedicated Git writer model selection

  • Adds a textGenerationStyle setting with three modes (repo_conventions, conventional_commits, custom) and a gitWriterModelSelection field to server settings, exposed in a new TextGenerationSettings.tsx section on the Source Control settings page.
  • Implements resolveStylePolicy in GitManager.ts that maps the configured style to a text generation policy, optionally including recent commit subjects as examples for repo_conventions mode.
  • Adds PrTemplateDetection.ts which reads PR templates strictly from committed Git blobs, respecting path precedence, size bounds with truncation, symlink escape protection, and ambiguity detection.
  • All text generation providers (Claude, Codex, Cursor, Grok, OpenCode) now forward policy and prTemplate fields to prompt builders, so commit and PR prompts reflect the configured style.
  • Branch name generation in ProviderCommandReactor.ts now uses the dedicated Git writer model when enabled, falling back to the global text generation model.
  • Behavioral Change: commit messages and PR descriptions will now vary based on server-configured style and repository history rather than using a fixed prompt structure.

Macroscope summarized 4c5f401.

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 7b859a25-0872-4f2e-a7fd-b76cc6650904

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:XL 500-999 changed lines (additions + deletions). labels Jul 20, 2026
Comment thread apps/server/src/git/GitManager.ts
Comment thread apps/web/src/components/settings/TextGenerationSettings.tsx
Comment thread apps/server/src/sourceControl/PrTemplateDetection.ts Outdated
@macroscopeapp

macroscopeapp Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs human review

1 blocking correctness issue found. This PR introduces a new feature with configurable Git writing settings, PR template detection, and a dedicated Git writer model option spanning multiple packages. There is also an unresolved review comment about a potential bug in provider availability validation that could cause runtime issues.

You can customize Macroscope's approvability policy. Learn more.

Comment thread apps/server/src/sourceControl/PrTemplateDetection.ts Outdated
@maria-rcks
maria-rcks force-pushed the feat/git-writing-settings branch from 90e3450 to 8cead8e Compare July 20, 2026 21:20
Comment thread apps/web/src/components/settings/TextGenerationSettings.tsx Outdated
@maria-rcks
maria-rcks force-pushed the feat/git-writing-settings branch from 8cead8e to 263976b Compare July 20, 2026 21:38
Comment thread apps/web/src/components/settings/TextGenerationSettings.tsx Outdated
@maria-rcks
maria-rcks force-pushed the feat/git-writing-settings branch from 263976b to afab9d6 Compare July 20, 2026 22:02

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit afab9d6. Configure here.

Comment thread apps/server/src/sourceControl/PrTemplateDetection.ts Outdated
Comment thread apps/web/src/components/settings/SourceControlSettings.tsx Outdated
Co-Authored-By: Claude <noreply@anthropic.com>
@maria-rcks
maria-rcks force-pushed the feat/git-writing-settings branch from afab9d6 to 4c5f401 Compare July 20, 2026 23:00
): LegacyProviderSettings | undefined =>
(settings.providers as Record<string, LegacyProviderSettings | undefined>)[provider];

export function isModelSelectionProviderEnabled(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Medium src/serverSettings.ts:25

isModelSelectionProviderEnabled returns true for any providerInstances entry whose enabled field is omitted or true, without checking whether the instance's driver is actually available. When a persisted gitWriterModelSelection references an instance whose driver is not installed in this build, this function returns true and resolveGitWriterModelSelection keeps the unavailable writer model instead of falling back to the global text-generation model — so Git text generation targets a provider that cannot run. Consider validating the instance's driver against the available driver set before treating the instance as enabled.

🤖 Copy this AI Prompt to have your agent fix this:
In file @packages/shared/src/serverSettings.ts around line 25:

`isModelSelectionProviderEnabled` returns `true` for any `providerInstances` entry whose `enabled` field is omitted or `true`, without checking whether the instance's `driver` is actually available. When a persisted `gitWriterModelSelection` references an instance whose driver is not installed in this build, this function returns `true` and `resolveGitWriterModelSelection` keeps the unavailable writer model instead of falling back to the global text-generation model — so Git text generation targets a provider that cannot run. Consider validating the instance's `driver` against the available driver set before treating the instance as enabled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL 500-999 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

1 participant