From 4c8f1e827e172b12fa9087dce16400a9b44c373b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Jerci=C5=84ski?= Date: Mon, 6 Apr 2026 18:15:02 +0200 Subject: [PATCH 1/2] docs: update --init sample config and README for globalOverrides - Add globalOverrides example (claude, codex) to SAMPLE_CONFIG in loader.ts - Add OpenCode/Claude overlap caveat to README - Update createSampleConfig test to verify globalOverrides presence Closes #30 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- README.md | 2 ++ src/config/loader.createSampleConfig.test.ts | 3 +++ src/config/loader.ts | 4 ++++ 3 files changed, 9 insertions(+) diff --git a/README.md b/README.md index 866ba70..5efde97 100644 --- a/README.md +++ b/README.md @@ -87,6 +87,8 @@ Edit the `config.json` file to define your setup. Config must specify at least one of `global`, `globalOverrides`, or `projects`. +> **Note:** OpenCode reads `~/.config/opencode/AGENTS.md` but also loads Claude-format instructions from `~/.claude/CLAUDE.md` by default. If you use both `claude` and `opencode` globals, disable Claude prompt loading in OpenCode to avoid duplicated instructions. + ### 3\. Synchronize Rules To synchronize the rules for all configured projects, run the default command: diff --git a/src/config/loader.createSampleConfig.test.ts b/src/config/loader.createSampleConfig.test.ts index da61084..c47df3f 100644 --- a/src/config/loader.createSampleConfig.test.ts +++ b/src/config/loader.createSampleConfig.test.ts @@ -27,6 +27,9 @@ describe("createSampleConfig", () => { const content = vi.mocked(fs.writeFile).mock.calls[0]?.[1] as string; expect(content).toContain('"rulesSource"'); expect(content).toContain('"global-rules/*.md"'); + expect(content).toContain('"globalOverrides"'); + expect(content).toContain('"claude"'); + expect(content).toContain('"codex"'); expect(content).toContain('"projects"'); }); diff --git a/src/config/loader.ts b/src/config/loader.ts index f014239..57a2ae9 100644 --- a/src/config/loader.ts +++ b/src/config/loader.ts @@ -18,6 +18,10 @@ import type { Config as ConfigShape } from "./config.js"; const SAMPLE_CONFIG = { rulesSource: "/path/to/rules", global: ["global-rules/*.md"], + globalOverrides: { + claude: ["claude-specific/*.md"], + codex: ["codex-specific/*.md"], + }, projects: [ { path: "/path/to/project", From 772eed2afdcc6adccc3ce12b0655db0eb93701ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Jerci=C5=84ski?= Date: Mon, 6 Apr 2026 18:22:08 +0200 Subject: [PATCH 2/2] docs: reword OpenCode note as fallback/compatibility clarification The previous note overstated the duplication risk when configuring both claude and opencode globals. OpenCode uses ~/.claude/CLAUDE.md only as a fallback when ~/.config/opencode/AGENTS.md is absent, so no duplication occurs when both harnesses are configured. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5efde97..63e8815 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,7 @@ Edit the `config.json` file to define your setup. Config must specify at least one of `global`, `globalOverrides`, or `projects`. -> **Note:** OpenCode reads `~/.config/opencode/AGENTS.md` but also loads Claude-format instructions from `~/.claude/CLAUDE.md` by default. If you use both `claude` and `opencode` globals, disable Claude prompt loading in OpenCode to avoid duplicated instructions. +> **Note:** OpenCode reads `~/.config/opencode/AGENTS.md` for global rules and falls back to `~/.claude/CLAUDE.md` only when the OpenCode-specific file is absent. If you configure both `claude` and `opencode` globals, the OpenCode file takes precedence and no duplication occurs. ### 3\. Synchronize Rules