Skip to content

feat(config): add support for per-repository configuration overrides#35

Merged
m7medVision merged 4 commits intomainfrom
feature/per-repo-config
Jan 23, 2026
Merged

feat(config): add support for per-repository configuration overrides#35
m7medVision merged 4 commits intomainfrom
feature/per-repo-config

Conversation

@m7medVision
Copy link
Copy Markdown
Owner

Summary

This PR implements support for per-repository configuration overrides as requested in #34.

Changes:

  • Added GetRepoRoot function to internal/git to locate the git repository root.
  • Updated InitConfig to look for and merge .lazycommit.yaml from the repository root if it exists.
  • Updated InitPromptConfig to look for .lazycommit.prompts.yaml in 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

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 GetRepoRoot function to locate git repository roots
  • Modified prompt configuration loading to check for and use repository-level .lazycommit.prompts.yaml files
  • Added Language field to PromptConfig struct 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.

Comment thread README.md Outdated
Comment thread internal/config/prompts.go
Comment thread README.md Outdated
@m7medVision m7medVision self-assigned this Jan 23, 2026
@m7medVision m7medVision marked this pull request as ready for review January 23, 2026 15:13
@m7medVision m7medVision merged commit ee2fa12 into main Jan 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Support for per-repository configuration (e.g., language/prompt)

2 participants