feat(config): add support for per-repository configuration overrides#35
Merged
m7medVision merged 4 commits intomainfrom Jan 23, 2026
Merged
feat(config): add support for per-repository configuration overrides#35m7medVision merged 4 commits intomainfrom
m7medVision merged 4 commits intomainfrom
Conversation
b7eae8b to
e6f0c39
Compare
There was a problem hiding this comment.
Pull request overview
This PR implements partial support for per-repository configuration overrides by allowing repository-level .lazycommit.prompts.yaml files to override global prompt configurations. This addresses the use case in issue #34 where users need different commit message languages for different projects.
Changes:
- Added
GetRepoRootfunction to locate git repository roots - Modified prompt configuration loading to check for and use repository-level
.lazycommit.prompts.yamlfiles - Added
Languagefield toPromptConfigstruct for per-repository language overrides - Updated documentation to explain per-repository configuration capability
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| internal/git/git.go | Adds GetRepoRoot function to find repository root using git rev-parse --show-toplevel |
| internal/config/prompts.go | Modifies initialization to check for repository-level prompts file and adds language field to config struct |
| internal/config/config.go | Removes redundant comments (cosmetic cleanup) |
| README.md | Documents per-repository configuration feature with examples and security warnings |
Comments suppressed due to low confidence (1)
internal/config/prompts.go:46
- When creating a default prompts file fails (line 39), the error is printed but the function continues execution and returns. However, if the local repository prompts file creation fails at this point, the user might expect a global config file to be created instead. Consider whether it makes sense to fall back to creating/using the global prompts file when the local file creation fails, especially since local files are meant to be overrides of global configs.
if _, err := os.Stat(promptsFile); os.IsNotExist(err) {
// Create default prompts file
defaultConfig := getDefaultPromptConfig()
if err := savePromptConfig(promptsFile, defaultConfig); err != nil {
fmt.Printf("Error creating default prompts file: %v\n", err)
fmt.Printf("Using default prompts\n")
} else {
fmt.Printf("Created default prompts config at %s\n", promptsFile)
}
promptsCfg = defaultConfig
return
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements support for per-repository configuration overrides as requested in #34.
Changes:
GetRepoRootfunction tointernal/gitto locate the git repository root.InitConfigto look for and merge.lazycommit.yamlfrom the repository root if it exists.InitPromptConfigto look for.lazycommit.prompts.yamlin the repository root and use it as an override.This allows users to define project-specific settings (like commit message language or prompt templates) without changing their global configuration.
Fixes #34