Skip to content

feat(server): infer commit and PR title style from repo history#1112

Open
binbandit wants to merge 11 commits intopingdotgg:mainfrom
binbandit:t3code/add-commit-pr-style-guidance
Open

feat(server): infer commit and PR title style from repo history#1112
binbandit wants to merge 11 commits intopingdotgg:mainfrom
binbandit:t3code/add-commit-pr-style-guidance

Conversation

@binbandit
Copy link
Copy Markdown
Contributor

@binbandit binbandit commented Mar 15, 2026

Summary

  • infer commit message style from recent repository commit subjects instead of hard-coding conventions
  • infer pull request title style from recent repository pull request titles when available, with recent commits as fallback context
  • default generated commit and pull request titles to Conventional Commits when the repository has no usable history

Testing

  • bun fmt
  • bun lint
  • bun typecheck
  • bun run --cwd apps/server test src/git/Layers/CodexTextGeneration.test.ts src/git/Layers/GitCore.test.ts src/git/Layers/GitHubCli.test.ts src/git/Layers/GitManager.test.ts

Note

Infer commit and PR title style from repo history when generating AI content

  • Adds a new StyleGuidance module (StyleGuidance.ts) that builds style guidance strings from recent commit subjects and PR title/body examples, preferring author-scoped history over repo-wide history.
  • Adds GitCore.readRecentCommitSubjects to fetch recent commit subjects via git log, optionally filtered by author or scoped to all refs (GitCore.ts).
  • Adds GitHubCli.listRecentPullRequestExamples to fetch recent PR titles and bodies via gh pr list, optionally filtered by author (GitHubCli.ts).
  • GitManager now assembles style guidance before each commit or PR generation call and passes it through to the text generation layer (GitManager.ts).
  • Commit and PR prompts are updated to incorporate style guidance and can suppress the default PR body template when sufficient examples are available (Prompts.ts).
  • Behavioral Change: PR content generation no longer always emits the default Summary/Testing sections — when PR examples are found, those sections are omitted in favor of inferred style.

Macroscope summarized 08f7edd.


Note

Medium Risk
Moderate risk because it changes how commit messages/PR bodies are generated (new prompt inputs and conditional templates) and adds new git/gh CLI calls with timeouts/fallback paths that may behave differently across repos/remotes.

Overview
Adds style discovery for AI-generated commit messages and PR content by sampling recent commit subjects from git log and recent PR title/body examples via gh pr list, preferring author-scoped history with repo-wide fallback.

Threads this guidance through GitManager into the TextGeneration contract and both CodexTextGeneration/ClaudeTextGeneration, and updates prompt builders to embed guidance plus optionally disable the default ## Summary/## Testing PR template when real PR examples exist. Includes new StyleGuidance builder utilities and expanded tests covering history resolution, author filtering, prompt contents, and the new GitHub CLI query.

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

- add recent commit subject and PR title discovery for repo style guidance
- default generated commit and PR titles to conventional commits when history is unavailable
- cover the new prompt guidance and git/github lookups with tests
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 15, 2026

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: e0c486e8-7701-4ea7-868f-294788feafb1

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 and usage tips.

@github-actions github-actions bot added size:XL 500-999 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. labels Mar 15, 2026
Copy link
Copy Markdown
Contributor

@UtkarshUsername UtkarshUsername left a comment

Choose a reason for hiding this comment

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

I think it should be fork-aware, and check the titles of PRs made to the original repo

@binbandit
Copy link
Copy Markdown
Contributor Author

I think it should be fork-aware, and check the titles of PRs made to the original repo

I agree, but there is a different PR for that. Ill do it as part of that

@maria-rcks
Copy link
Copy Markdown
Collaborator

on this, it might be worth checking if the user has already had other prs / commtits and hand the agent that to write on the same style?

as an example i often like to write my prs without the cringy summary ask template and just say what i changed and stuff.

would love to know what other people think

@Ivorisnoob
Copy link
Copy Markdown
Contributor

on this, it might be worth checking if the user has already had other prs / commtits and hand the agent that to write on the same style?

as an example i often like to write my prs without the cringy summary ask template and just say what i changed and stuff.

would love to know what other people think

@maria-rcks
Good call, would love it if this works out

@rookmate
Copy link
Copy Markdown

rookmate commented Apr 5, 2026

Would love to see this feature go in. It's really relevant specially if the repos have commit styling validations

@Destreyf
Copy link
Copy Markdown

Destreyf commented Apr 7, 2026

This is something I am very interested in, I am unfamiliar with the codebase so I might have just missed it, but I would love to be able to customize this prompt, some of my projects use commmitlint and some use conform for my PR titles, so being able to point it at a file to reference the valid scopes would be a huge help.

…r-style-guidance

# Conflicts:
#	apps/server/src/git/Layers/CodexTextGeneration.test.ts
#	apps/server/src/git/Layers/CodexTextGeneration.ts
#	apps/server/src/git/Layers/GitCore.test.ts
#	apps/server/src/git/Layers/GitCore.ts
#	apps/server/src/git/Layers/GitManager.test.ts
#	apps/server/src/git/Services/GitCore.ts
#	apps/server/src/serverLayers.ts
@github-actions github-actions bot added size:L 100-499 changed lines (additions + deletions). and removed size:XL 500-999 changed lines (additions + deletions). labels Apr 10, 2026
@macroscopeapp
Copy link
Copy Markdown
Contributor

macroscopeapp bot commented Apr 10, 2026

Approvability

Verdict: Needs human review

This PR introduces a new feature that changes how AI generates commit messages and PR content by inferring style from repository history. It adds new git operations, a new StyleGuidance module, and propagates style guidance through multiple service layers. As a new capability affecting core product behavior, it warrants human review.

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

@github-actions github-actions bot added size:XL 500-999 changed lines (additions + deletions). and removed size:L 100-499 changed lines (additions + deletions). labels Apr 11, 2026
Copy link
Copy Markdown
Contributor

@cursor cursor bot left a comment

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 and found 2 potential issues.

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 34f62eb. Configure here.

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

Development

Successfully merging this pull request may close these issues.

7 participants