Skip to content

Conversation

@dyoshikawa
Copy link
Owner

Summary

  • Add support for rulesync.local.jsonc as a local configuration file that can override settings from rulesync.jsonc
  • Local config file is automatically added to .gitignore by rulesync gitignore
  • Configuration priority: CLI options > rulesync.local.jsonc > rulesync.jsonc > defaults

Changes

  • Added RULESYNC_LOCAL_CONFIG_RELATIVE_FILE_PATH constant
  • Updated ConfigResolver to load and merge both config files
  • Added rulesync.local.jsonc to gitignore entries
  • Updated README.md with "Local Configuration" documentation section
  • Added comprehensive tests for the new functionality

Use Cases

  • Testing with different tool targets without modifying shared configuration
  • Enabling verbose output for local debugging
  • Developer-specific or machine-specific settings

Test plan

  • Run pnpm cicheck:code - all tests pass
  • Run pnpm dev gitignore - project .gitignore updated correctly
  • Manual testing: create rulesync.local.jsonc and verify it overrides rulesync.jsonc

Closes #813

🤖 Generated with Claude Code

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>
Copilot AI review requested due to automatic review settings January 26, 2026 08:07
Copy link
Contributor

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 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 .gitignore management 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.

Comment on lines +192 to +212
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);
});
Copy link

Copilot AI Jan 26, 2026

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

Copilot uses AI. Check for mistakes.
dyoshikawa and others added 2 commits January 26, 2026 01:06
…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>
@dyoshikawa dyoshikawa merged commit ea8f8d6 into main Jan 27, 2026
10 checks passed
@dyoshikawa dyoshikawa deleted the feat/support-rulesync-local-jsonc branch January 27, 2026 06:47
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.

Support rulesync.local.jsonc

1 participant