-
Notifications
You must be signed in to change notification settings - Fork 51
feat: support rulesync.local.jsonc for local configuration #880
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Add support for a local configuration file that allows developers to override settings without modifying the shared rulesync.jsonc file. Configuration priority (highest to lowest): 1. CLI options 2. rulesync.local.jsonc 3. rulesync.jsonc 4. Default values This is useful for: - Testing with different tool targets locally - Enabling verbose output for debugging - Developer-specific or machine-specific settings Closes #813 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
There was a problem hiding this 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 adds support for rulesync.local.jsonc, a local configuration file that enables developer-specific or machine-specific settings without modifying the shared rulesync.jsonc. The local config file is automatically excluded from version control and follows a clear priority hierarchy.
Changes:
- Introduced local configuration support with proper precedence handling (CLI > local > base > defaults)
- Added automatic
.gitignoremanagement for the local config file - Provided comprehensive documentation explaining the feature and its use cases
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/constants/rulesync-paths.ts | Added constant for local config filename |
| src/config/config-resolver.ts | Implemented config loading, merging logic, and priority handling |
| src/config/config-resolver.test.ts | Added comprehensive test coverage for local config scenarios |
| src/cli/commands/gitignore.ts | Added local config file to gitignore entries |
| src/cli/commands/gitignore.test.ts | Updated test expectation to include local config |
| README.md | Added "Local Configuration" documentation section with examples |
| .gitignore | Applied gitignore changes for the local config file |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| describe("local configuration (rulesync.local.jsonc)", () => { | ||
| it("should use rulesync.local.jsonc to override rulesync.jsonc", async () => { | ||
| const baseConfigContent = JSON.stringify({ | ||
| baseDirs: ["./"], | ||
| targets: ["cursor"], | ||
| verbose: false, | ||
| }); | ||
| const localConfigContent = JSON.stringify({ | ||
| targets: ["claudecode"], | ||
| verbose: true, | ||
| }); | ||
| await writeFileContent(join(testDir, "rulesync.jsonc"), baseConfigContent); | ||
| await writeFileContent(join(testDir, "rulesync.local.jsonc"), localConfigContent); | ||
|
|
||
| const config = await ConfigResolver.resolve({ | ||
| configPath: join(testDir, "rulesync.jsonc"), | ||
| }); | ||
|
|
||
| expect(config.getTargets()).toEqual(["claudecode"]); | ||
| expect(config.getVerbose()).toBe(true); | ||
| }); |
Copilot
AI
Jan 26, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding a test case where rulesync.local.jsonc overrides a boolean value from true to false. Currently, tests verify overriding false to true (line 193-212), but not the reverse. This would ensure that the nullish coalescing operator in mergeConfigs correctly handles explicit false values and doesn't fall back to the base config's true value.
Example test case:
const baseConfigContent = JSON.stringify({
baseDirs: ["./"],
verbose: true,
delete: true,
});
const localConfigContent = JSON.stringify({
verbose: false,
delete: false,
});
// Should result in verbose: false and delete: false…section Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Improves error message clarity by showing which config file failed to load. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Summary
rulesync.local.jsoncas a local configuration file that can override settings fromrulesync.jsonc.gitignorebyrulesync gitignorerulesync.local.jsonc>rulesync.jsonc> defaultsChanges
RULESYNC_LOCAL_CONFIG_RELATIVE_FILE_PATHconstantConfigResolverto load and merge both config filesrulesync.local.jsoncto gitignore entriesUse Cases
Test plan
pnpm cicheck:code- all tests passpnpm dev gitignore- project.gitignoreupdated correctlyrulesync.local.jsoncand verify it overridesrulesync.jsoncCloses #813
🤖 Generated with Claude Code