sync-agents-settings 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/README.md +121 -22
  3. package/commands/report-schema.md +25 -0
  4. package/commands/sync-diff.md +5 -1
  5. package/commands/sync-doctor.md +43 -0
  6. package/commands/sync-instructions.md +6 -2
  7. package/commands/sync-reconcile.md +41 -0
  8. package/commands/sync-validate.md +42 -0
  9. package/commands/sync.md +6 -2
  10. package/dist/backup.d.ts +1 -1
  11. package/dist/backup.js +4 -1
  12. package/dist/backup.js.map +1 -1
  13. package/dist/cli.js +541 -54
  14. package/dist/cli.js.map +1 -1
  15. package/dist/diff.d.ts +6 -0
  16. package/dist/diff.js +7 -0
  17. package/dist/diff.js.map +1 -0
  18. package/dist/doctor.d.ts +23 -0
  19. package/dist/doctor.js +140 -0
  20. package/dist/doctor.js.map +1 -0
  21. package/dist/fix.d.ts +19 -0
  22. package/dist/fix.js +71 -0
  23. package/dist/fix.js.map +1 -0
  24. package/dist/instructions.d.ts +8 -1
  25. package/dist/instructions.js +370 -11
  26. package/dist/instructions.js.map +1 -1
  27. package/dist/oauth.d.ts +2 -0
  28. package/dist/oauth.js +7 -0
  29. package/dist/oauth.js.map +1 -0
  30. package/dist/paths.d.ts +4 -0
  31. package/dist/paths.js +5 -0
  32. package/dist/paths.js.map +1 -1
  33. package/dist/reconcile.d.ts +27 -0
  34. package/dist/reconcile.js +122 -0
  35. package/dist/reconcile.js.map +1 -0
  36. package/dist/report-parser.d.ts +81 -0
  37. package/dist/report-parser.js +129 -0
  38. package/dist/report-parser.js.map +1 -0
  39. package/dist/report-schema-renderer.d.ts +2 -0
  40. package/dist/report-schema-renderer.js +129 -0
  41. package/dist/report-schema-renderer.js.map +1 -0
  42. package/dist/report-schema-sync.d.ts +9 -0
  43. package/dist/report-schema-sync.js +28 -0
  44. package/dist/report-schema-sync.js.map +1 -0
  45. package/dist/report.d.ts +47 -0
  46. package/dist/report.js +55 -0
  47. package/dist/report.js.map +1 -0
  48. package/dist/types.d.ts +1 -1
  49. package/dist/validation.d.ts +18 -0
  50. package/dist/validation.js +62 -0
  51. package/dist/validation.js.map +1 -0
  52. package/dist/writers/codex.js +12 -2
  53. package/dist/writers/codex.js.map +1 -1
  54. package/dist/writers/kimi.d.ts +7 -0
  55. package/dist/writers/kimi.js +25 -0
  56. package/dist/writers/kimi.js.map +1 -0
  57. package/package.json +3 -2
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sync-agents-settings",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Sync MCP server configs and instructions from Claude Code to other AI agents (Gemini, Codex, Cursor, Kiro, OpenCode)",
5
5
  "repository": "https://github.com/Leoyang183/sync-agents-settings",
6
6
  "author": {
package/README.md CHANGED
@@ -11,13 +11,14 @@
11
11
  [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?logo=prettier)](https://prettier.io/)
12
12
  [![CI](https://github.com/Leoyang183/sync-agents-settings/actions/workflows/ci.yml/badge.svg)](https://github.com/Leoyang183/sync-agents-settings/actions/workflows/ci.yml)
13
13
 
14
- Sync MCP server configurations and instruction files (CLAUDE.md) from **Claude Code** to **Gemini CLI**, **Codex CLI**, **OpenCode**, **Kiro CLI**, and **Cursor**.
14
+ Sync MCP server configurations and instruction files (CLAUDE.md) from **Claude Code** to **Gemini CLI**, **Codex CLI**, **OpenCode**, **Kiro CLI**, **Cursor**, **Kimi CLI**, and **Aider CLI**.
15
15
 
16
16
  **README translations:** [🇹đŸ‡ŧ įšéĢ”ä¸­æ–‡](docs/i18n/README.zh-tw.md) | [đŸ‡¨đŸ‡ŗ įŽ€äŊ“中文](docs/i18n/README.zh-cn.md) | [đŸ‡¯đŸ‡ĩ æ—ĨæœŦčĒž](docs/i18n/README.ja.md) | [🇰🇷 한ęĩ­ė–´](docs/i18n/README.ko.md)
17
+ **Support matrix:** [CLI compatibility matrix](docs/compatibility-matrix.md)
17
18
 
18
19
  ## Why
19
20
 
20
- If you use Claude Code as your primary AI coding agent but also switch between other agents (Gemini CLI, Codex CLI, OpenCode, Kiro, Cursor) to take advantage of their free tiers or different models, you know the pain — every tool has its own MCP config format, and setting them up one by one is tedious. Same goes for instruction files — CLAUDE.md, GEMINI.md, AGENTS.md all need the same content but in different formats.
21
+ If you use Claude Code as your primary AI coding agent but also switch between other agents (Gemini CLI, Codex CLI, OpenCode, Kiro, Cursor, Kimi CLI) to take advantage of their free tiers or different models, you know the pain — every tool has its own MCP config format, and setting them up one by one is tedious. Same goes for instruction files — CLAUDE.md, GEMINI.md, AGENTS.md all need the same content but in different formats.
21
22
 
22
23
  This tool lets you configure MCP servers and write instructions once in Claude Code, then sync everywhere with a single command.
23
24
 
@@ -35,6 +36,10 @@ claude --plugin-dir /path/to/sync-agents-settings
35
36
  # /sync-list — list all MCP servers
36
37
  # /sync — sync MCP configs (with dry-run preview)
37
38
  # /sync-diff — compare configs between agents
39
+ # /sync-doctor — detect config drift and parse errors
40
+ # /sync-validate — validate schema and target capabilities
41
+ # /sync-reconcile — validate + detect drift + sync only missing
42
+ # /report-schema — print or write report JSON schema markdown
38
43
  # /sync-instructions — sync CLAUDE.md to other agents
39
44
  ```
40
45
 
@@ -78,13 +83,60 @@ sync-agents sync --target codex
78
83
  sync-agents sync --target opencode
79
84
  sync-agents sync --target kiro
80
85
  sync-agents sync --target cursor
86
+ sync-agents sync --target kimi
81
87
 
82
88
  # Sync to Codex project-level config
83
89
  sync-agents sync --target codex --codex-home ./my-project/.codex
84
90
 
91
+ # Sync to Kimi project-level config
92
+ sync-agents sync --target kimi --kimi-home ./my-project/.kimi
93
+
85
94
  # Compare differences
86
95
  sync-agents diff
87
96
 
97
+ # Check drift / parse errors between Claude and targets
98
+ sync-agents doctor
99
+
100
+ # Validate source schema and target capability compatibility
101
+ sync-agents validate
102
+
103
+ # One-shot safe reconcile (validate + doctor + sync missing)
104
+ sync-agents reconcile --dry-run
105
+
106
+ # CI-friendly JSON output
107
+ sync-agents reconcile --report json
108
+
109
+ # CI-friendly JSON output for drift checker
110
+ sync-agents doctor --report json
111
+
112
+ # CI-friendly JSON output for schema/capability validation
113
+ sync-agents validate --report json
114
+
115
+ # CI-friendly JSON output for sync result
116
+ sync-agents sync --report json --dry-run
117
+
118
+ # CI-friendly JSON output for instruction sync
119
+ sync-agents sync-instructions --report json --dry-run --global --target gemini
120
+
121
+ # CI-friendly JSON output for diff result
122
+ sync-agents diff --report json --target gemini codex
123
+
124
+ # Note: all --report json outputs include `schemaVersion: 1`
125
+
126
+ Report schema reference: `docs/report-schema.md`
127
+
128
+ # Regenerate report schema documentation
129
+ sync-agents report-schema --write docs/report-schema.md
130
+
131
+ # CI check: ensure report schema doc is up to date
132
+ sync-agents report-schema --check
133
+
134
+ # Auto-fix from doctor (internally runs reconcile)
135
+ sync-agents doctor --fix --dry-run
136
+
137
+ # Auto-fix after validation passes
138
+ sync-agents validate --fix --dry-run
139
+
88
140
  # Skip OAuth-only servers (e.g. Slack)
89
141
  sync-agents sync --skip-oauth
90
142
 
@@ -94,7 +146,23 @@ sync-agents sync --no-backup
94
146
  # Verbose output
95
147
  sync-agents sync -v
96
148
 
97
- # Sync instruction files (CLAUDE.md → GEMINI.md / AGENTS.md / Kiro steering / Cursor rules)
149
+ # Check only specific targets
150
+ sync-agents doctor --target gemini codex
151
+
152
+ # Check Codex project-level config drift
153
+ sync-agents doctor --target codex --codex-home ./.codex
154
+
155
+ # Validate only selected targets and ignore OAuth-only servers
156
+ sync-agents validate --target codex opencode --skip-oauth
157
+
158
+ # Validation semantics:
159
+ # - blank-only command/url values are treated as missing
160
+ # - OAuth-only servers produce manual-setup warnings without duplicate field errors
161
+
162
+ # Reconcile selected targets only
163
+ sync-agents reconcile --target gemini codex
164
+
165
+ # Sync instruction files (CLAUDE.md → GEMINI.md / AGENTS.md / Kiro steering / Cursor rules / Aider conventions)
98
166
  sync-agents sync-instructions
99
167
 
100
168
  # Sync only global instructions
@@ -104,11 +172,17 @@ sync-agents sync-instructions --global
104
172
  sync-agents sync-instructions --local
105
173
 
106
174
  # Sync to specific targets
107
- sync-agents sync-instructions --target gemini codex
175
+ sync-agents sync-instructions --target gemini codex kimi aider
108
176
 
109
177
  # Auto-overwrite without prompts (for CI)
110
178
  sync-agents sync-instructions --on-conflict overwrite
111
179
 
180
+ # Keep legacy behavior: remove standalone @import lines instead of expanding
181
+ sync-agents sync-instructions --import-mode strip
182
+
183
+ # Allow standalone @import to read files outside current project root (use with care)
184
+ sync-agents sync-instructions --allow-unsafe-imports
185
+
112
186
  # Preview instruction sync
113
187
  sync-agents sync-instructions --dry-run
114
188
  ```
@@ -134,7 +208,8 @@ pnpm test # Run tests
134
208
  ├─→ Reader ─→ UnifiedMcpServer[] ─â”ŧ─→ OpenCode Writer ─→ ~/.config/opencode/opencode.json
135
209
  ~/.claude/plugins/ ──┘ │
136
210
  ├─→ Kiro Writer ─→ ~/.kiro/settings/mcp.json
137
- └─→ Cursor Writer ─→ ~/.cursor/mcp.json
211
+ ├─→ Cursor Writer ─→ ~/.cursor/mcp.json
212
+ └─→ Kimi Writer ─→ ~/.kimi/mcp.json
138
213
  ```
139
214
 
140
215
  | Stage | Description |
@@ -145,6 +220,7 @@ pnpm test # Run tests
145
220
  | **OpenCode Writer** | JSON → JSON, `command`+`args` → merged `command` array, `env` → `environment`, `type: "local"`/`"remote"` |
146
221
  | **Kiro Writer** | Same format as Claude, `${VAR:-default}` → expanded |
147
222
  | **Cursor Writer** | Same format as Claude, `${VAR:-default}` → expanded |
223
+ | **Kimi Writer** | Same format as Claude, `${VAR:-default}` → expanded |
148
224
 
149
225
  ### Instruction Sync (`sync-instructions`)
150
226
 
@@ -153,24 +229,37 @@ Syncs CLAUDE.md instruction files to each target's native format:
153
229
  ```
154
230
  ┌─→ ~/.gemini/GEMINI.md (plain copy)
155
231
  ├─→ ~/.codex/AGENTS.md (plain copy)
156
- ~/.claude/CLAUDE.md ─→ filter @imports ──â”ŧ─→ ~/.config/opencode/AGENTS.md (plain copy)
232
+ ~/.claude/CLAUDE.md (+ ~/.claude/rules/*.md) ─→ expand @imports ──â”ŧ─→ ~/.config/opencode/AGENTS.md (plain copy)
233
+ ├─→ ~/.kimi/AGENTS.md (plain copy)
157
234
  ├─→ ~/.kiro/steering/claude-instructions.md (+ inclusion: always)
158
235
  └─→ ⚠ Cursor global not supported (SQLite)
159
236
 
160
237
  ┌─→ ./GEMINI.md (plain copy)
161
- ├─→ ./AGENTS.md (Codex + OpenCode share)
162
- ./CLAUDE.md ──────────→ filter @imports ──â”ŧ─→ .kiro/steering/claude-instructions.md (+ inclusion: always)
238
+ ├─→ ./AGENTS.md (Codex + OpenCode + Kimi share)
239
+ ./.claude/CLAUDE.md (fallback: ./CLAUDE.md) + ./.claude/rules/*.md ─→ expand @imports ──â”ŧ─→ .kiro/steering/claude-instructions.md (+ inclusion: always)
163
240
  └─→ .cursor/rules/claude-instructions.mdc (+ alwaysApply: true)
164
241
  ```
165
242
 
166
243
  | Target | Global | Local | Format Transform |
167
244
  |--------|--------|-------|------------------|
168
- | Gemini | `~/.gemini/GEMINI.md` | `./GEMINI.md` | Plain copy (filter `@import` lines) |
169
- | Codex | `~/.codex/AGENTS.md` | `./AGENTS.md` | Plain copy (filter `@import` lines) |
170
- | OpenCode | `~/.config/opencode/AGENTS.md` | `./AGENTS.md` (shared with Codex) | Plain copy (filter `@import` lines) |
245
+ | Gemini | `~/.gemini/GEMINI.md` | `./GEMINI.md` | Plain copy (expand standalone `@import` lines) |
246
+ | Codex | `~/.codex/AGENTS.md` | `./AGENTS.md` | Plain copy (expand standalone `@import` lines) |
247
+ | OpenCode | `~/.config/opencode/AGENTS.md` | `./AGENTS.md` (shared with Codex) | Plain copy (expand standalone `@import` lines) |
248
+ | Kimi | `~/.kimi/AGENTS.md` | `./AGENTS.md` (shared with Codex/OpenCode) | Plain copy (expand standalone `@import` lines) |
249
+ | Aider | `~/.aider/CONVENTIONS.md` | `.aider/CONVENTIONS.md` | Plain copy + upsert `read` entry in `.aider.conf.yml` |
171
250
  | Kiro | `~/.kiro/steering/claude-instructions.md` | `.kiro/steering/claude-instructions.md` | Add `inclusion: always` frontmatter |
172
251
  | Cursor | Not supported (SQLite) | `.cursor/rules/claude-instructions.mdc` | Add `alwaysApply: true` frontmatter |
173
252
 
253
+ Notes:
254
+ - Local source resolution prefers `./.claude/CLAUDE.md`, then falls back to `./CLAUDE.md`.
255
+ - Extra rules in `.claude/rules/**/*.md` are appended automatically (unless already included via `@import`).
256
+ - If a rule file has frontmatter `paths`, it is included only when at least one project file matches.
257
+ - `@import` handling defaults to `inline` (expand). Use `--import-mode strip` to remove standalone import lines.
258
+ - By default, standalone `@import` can only read files inside the current project root. Use `--allow-unsafe-imports` to opt out.
259
+ - Inline import expansion has guardrails (`max depth: 20`, `max files: 200`) to avoid runaway recursion.
260
+ - Aider sync also upserts `.aider.conf.yml` `read` so `CONVENTIONS.md` is loaded automatically (global/project follows the sync scope).
261
+ - Kimi CLI currently loads `AGENTS.md` from the working directory. `~/.kimi/AGENTS.md` is synced as a reusable global template.
262
+
174
263
  When a target file already exists, you'll be prompted to choose: **overwrite**, **append** (keep existing + add CLAUDE.md below), or **skip**. Use `--on-conflict overwrite|append|skip` for non-interactive mode.
175
264
 
176
265
  **Safety mechanisms:**
@@ -296,15 +385,21 @@ Writes to **`~/.cursor/mcp.json`** → `mcpServers` object.
296
385
 
297
386
  Same format as Claude Code. `${VAR:-default}` syntax in URLs is auto-expanded during sync.
298
387
 
388
+ ### Target: Kimi CLI
389
+
390
+ Writes to **`~/.kimi/mcp.json`** by default. Use `--kimi-home <path>` to sync to a custom base directory (for example, project-level `.kimi/`).
391
+
392
+ Same format as Claude Code. `${VAR:-default}` syntax in URLs is auto-expanded during sync.
393
+
299
394
  ## Transport Type Mapping
300
395
 
301
- | Claude Code | Gemini CLI | Codex CLI | OpenCode | Kiro CLI | Cursor |
302
- |------------|-----------|----------|----------|----------|--------|
303
- | `command` + `args` (stdio) | `command` + `args` | `command` + `args` | `type: "local"`, `command: [cmd, ...args]` | same as Claude | same as Claude |
304
- | `type: "http"` + `url` | `httpUrl` | `url` | `type: "remote"`, `url` | same as Claude | same as Claude |
305
- | `type: "sse"` + `url` | `url` | `url` | `type: "remote"`, `url` | same as Claude | same as Claude |
306
- | `env` | `env` | `env` | `environment` | `env` | `env` |
307
- | `oauth` | skipped | skipped | skipped | skipped | skipped |
396
+ | Claude Code | Gemini CLI | Codex CLI | OpenCode | Kiro CLI | Cursor | Kimi CLI |
397
+ |------------|-----------|----------|----------|----------|--------|----------|
398
+ | `command` + `args` (stdio) | `command` + `args` | `command` + `args` | `type: "local"`, `command: [cmd, ...args]` | same as Claude | same as Claude | same as Claude |
399
+ | `type: "http"` + `url` | `httpUrl` | `url` | `type: "remote"`, `url` | same as Claude | same as Claude | same as Claude |
400
+ | `type: "sse"` + `url` | `url` | `url` | `type: "remote"`, `url` | same as Claude | same as Claude | same as Claude |
401
+ | `env` | `env` | `env` | `environment` | `env` | `env` | `env` |
402
+ | `oauth` | skipped | skipped | skipped | skipped | skipped | skipped |
308
403
 
309
404
  ## Backup
310
405
 
@@ -325,8 +420,10 @@ Every sync automatically backs up all affected config files to `~/.sync-agents-b
325
420
  ├── .kiro/
326
421
  │ └── settings/
327
422
  │ └── mcp.json # ← ~/.kiro/settings/mcp.json
328
- └── .cursor/
329
- └── mcp.json # ← ~/.cursor/mcp.json
423
+ ├── .cursor/
424
+ │ └── mcp.json # ← ~/.cursor/mcp.json
425
+ └── .kimi/
426
+ └── mcp.json # ← ~/.kimi/mcp.json
330
427
  ```
331
428
 
332
429
  Use `--no-backup` to skip. Target directories that don't exist (CLI not installed) will be skipped with a warning, not created.
@@ -349,15 +446,18 @@ Use `--no-backup` to skip. Target directories that don't exist (CLI not installe
349
446
  | Kiro CLI (project) | `.kiro/settings/mcp.json` in project root | JSON |
350
447
  | Cursor (global) | `~/.cursor/mcp.json` | JSON |
351
448
  | Cursor (project) | `.cursor/mcp.json` in project root | JSON |
449
+ | Kimi CLI (global) | `~/.kimi/mcp.json` | JSON |
450
+ | Kimi CLI (project) | `.kimi/mcp.json` (use `--kimi-home ./.kimi`) | JSON |
352
451
 
353
452
  ### Instruction Files
354
453
 
355
454
  | Tool | Global Path | Project Path | Format |
356
455
  |------|------------|-------------|--------|
357
- | Claude Code | `~/.claude/CLAUDE.md` | `./CLAUDE.md` | Markdown |
456
+ | Claude Code | `~/.claude/CLAUDE.md` | `./.claude/CLAUDE.md` (fallback `./CLAUDE.md`) | Markdown |
358
457
  | Gemini CLI | `~/.gemini/GEMINI.md` | `./GEMINI.md` | Markdown |
359
458
  | Codex CLI | `~/.codex/AGENTS.md` | `./AGENTS.md` | Markdown |
360
459
  | OpenCode | `~/.config/opencode/AGENTS.md` | `./AGENTS.md` | Markdown |
460
+ | Kimi CLI | `~/.kimi/AGENTS.md` | `./AGENTS.md` | Markdown |
361
461
  | Kiro CLI | `~/.kiro/steering/claude-instructions.md` | `.kiro/steering/claude-instructions.md` | Markdown + frontmatter |
362
462
  | Cursor | Not supported (SQLite) | `.cursor/rules/claude-instructions.mdc` | MDC (Markdown + frontmatter) |
363
463
 
@@ -404,4 +504,3 @@ claude --plugin-dir /path/to/sync-agents-settings
404
504
  ## License
405
505
 
406
506
  MIT
407
-
@@ -0,0 +1,25 @@
1
+ ---
2
+ name: report-schema
3
+ description: Print or write markdown documentation for JSON report schema
4
+ ---
5
+
6
+ Generate report schema markdown from code metadata (`COMMAND_REQUIRED_FIELDS`) and print to stdout or write to file.
7
+
8
+ ## Usage
9
+
10
+ ```bash
11
+ # Print to stdout
12
+ npx sync-agents-settings report-schema
13
+
14
+ # Write to docs file
15
+ npx sync-agents-settings report-schema --write docs/report-schema.md
16
+
17
+ # CI check: fail if docs/report-schema.md is stale or missing
18
+ npx sync-agents-settings report-schema --check
19
+ ```
20
+
21
+ ## Notes
22
+
23
+ - Use this command after changing report payload fields or parser validation rules.
24
+ - The generated file should include the "Required Fields (Generated)" section.
25
+ - `--check` exits with code `1` when target schema file is missing or outdated.
@@ -8,7 +8,10 @@ Compare which MCP servers exist in Claude Code vs other AI agents.
8
8
  ## Arguments
9
9
 
10
10
  The user may pass target names: `/sync-diff gemini`
11
- If no targets specified, compare all targets (gemini, codex, opencode, kiro, cursor).
11
+ If no targets specified, compare all targets (gemini, codex, opencode, kiro, cursor, kimi).
12
+
13
+ Optional flags:
14
+ - `--report json` — output machine-readable JSON summary (CI-friendly)
12
15
 
13
16
  ## Execution Flow
14
17
 
@@ -21,6 +24,7 @@ If no targets specified, compare all targets (gemini, codex, opencode, kiro, cur
21
24
  - **Only in target** — servers that exist in the target but not in Claude
22
25
 
23
26
  3. If there are servers "Only in Claude", suggest: "Run `/sync` to sync these servers to the target agents."
27
+ - If `--report json` is used, return raw JSON output and avoid text post-processing.
24
28
 
25
29
  ## Error Handling
26
30
 
@@ -0,0 +1,43 @@
1
+ ---
2
+ name: sync-doctor
3
+ description: Detect MCP config drift and parse errors between Claude Code and target AI agents
4
+ ---
5
+
6
+ Check whether target MCP configs are in sync with Claude Code, without writing any files.
7
+
8
+ ## Arguments
9
+
10
+ The user may pass target names: `/sync-doctor gemini codex`
11
+ If no targets specified, check all targets (gemini, codex, opencode, kiro, cursor, kimi).
12
+
13
+ Optional flags:
14
+ - `--skip-oauth` — ignore OAuth-only servers from Claude source
15
+ - `--codex-home <path>` — check project-level Codex config (e.g. `./.codex`)
16
+ - `--kimi-home <path>` — check project-level Kimi config (e.g. `./.kimi`)
17
+ - `--fix` — if drift exists, auto-run reconcile to add missing servers
18
+ - `--dry-run` — with `--fix`, preview only
19
+ - `--no-backup` — with `--fix`, skip backup before writing
20
+ - `--report json` — emit machine-readable JSON report
21
+
22
+ ## Execution Flow
23
+
24
+ 1. Parse targets and flags from user arguments.
25
+ 2. Run:
26
+ `npx sync-agents-settings doctor --target <targets>`
27
+ Add `--skip-oauth` / `--codex-home` / `--kimi-home` when specified.
28
+ 3. Present results per target:
29
+ - `No drift` when fully in sync
30
+ - `Missing in <target>` when Claude has servers not present in target
31
+ - `Extra in <target>` when target has servers absent in Claude
32
+ - `Unavailable` if target directory is missing
33
+ - `Parse error` when target config is malformed
34
+ 4. If drift exists, suggest running `/sync` to reconcile.
35
+ - Or run `/sync-doctor --fix` to reconcile automatically.
36
+
37
+ ## Error Handling
38
+
39
+ - Exit code `1` means drift detected.
40
+ - Exit code `2` means config parse error detected.
41
+ - With `--fix`, failure reasons are specific: parse-related (`target config parse error`) or validation-related (`validation errors detected`) before exiting `2`.
42
+ - If `npx` fails: suggest `npm install -g sync-agents-settings` as fallback.
43
+ - `--report json` cannot be used with `--fix` on doctor (use `reconcile --report json` instead).
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: sync-instructions
3
- description: Sync CLAUDE.md instruction files to other AI agents (Gemini, Codex, OpenCode, Kiro, Cursor)
3
+ description: Sync CLAUDE.md instruction files to other AI agents (Gemini, Codex, OpenCode, Kiro, Cursor, Kimi)
4
4
  ---
5
5
 
6
6
  Sync CLAUDE.md instruction files from Claude Code format to other AI agent formats.
@@ -12,12 +12,14 @@ If no targets specified, sync to all targets.
12
12
 
13
13
  The user may also pass flags:
14
14
  - `--no-backup` — skip creating backup of target instruction files
15
+ - `--import-mode inline|strip` — how to handle standalone `@import` lines (`inline` = expand, `strip` = remove line)
16
+ - `--report json` — output machine-readable JSON summary (CI-friendly)
15
17
 
16
18
  ## Execution Flow
17
19
 
18
20
  1. Ask the user which scope to sync:
19
21
  - **Global** (`~/.claude/CLAUDE.md`) — syncs to agent-specific global instruction files
20
- - **Local** (`./CLAUDE.md` in current directory) — syncs to project-level instruction files
22
+ - **Local** (`./.claude/CLAUDE.md` in current directory, fallback `./CLAUDE.md`) — syncs to project-level instruction files
21
23
  - **Both** (default) — syncs both global and local
22
24
 
23
25
  2. Parse targets from user arguments. Build the dry-run command:
@@ -39,8 +41,10 @@ The user may also pass flags:
39
41
  Add `--no-backup` if the user specified it.
40
42
 
41
43
  6. Present the final results: which files were synced, appended, or skipped.
44
+ - If `--report json` is used, return raw JSON output and avoid text post-processing.
42
45
 
43
46
  ## Error Handling
44
47
 
45
48
  - If `npx` fails: suggest `npm install -g sync-agents-settings` as fallback.
46
49
  - If CLAUDE.md source file doesn't exist: the CLI will report it. Inform the user which file is missing.
50
+ - With `--report json` and non-dry-run mode, pass both `--on-conflict` and `--no-backup` to avoid interactive prompts and non-JSON logs.
@@ -0,0 +1,41 @@
1
+ ---
2
+ name: sync-reconcile
3
+ description: Validate + detect drift + sync only missing MCP servers in one safe flow
4
+ ---
5
+
6
+ Run a safe one-shot reconcile pipeline:
7
+ 1) validate schema/capability
8
+ 2) detect drift
9
+ 3) sync only missing servers
10
+
11
+ ## Arguments
12
+
13
+ The user may pass target names: `/sync-reconcile gemini codex`
14
+ If no targets are specified, reconcile all targets.
15
+
16
+ Optional flags:
17
+ - `--dry-run` — preview only, no writes
18
+ - `--no-backup` — skip backup before write
19
+ - `--skip-oauth` — ignore OAuth-only servers
20
+ - `--codex-home <path>` — custom Codex config directory
21
+ - `--kimi-home <path>` — custom Kimi config directory
22
+ - `--report json` — emit machine-readable JSON only (for CI)
23
+
24
+ ## Execution Flow
25
+
26
+ 1. Build command:
27
+ `npx sync-agents-settings reconcile --target <targets>`
28
+ Include user-provided flags.
29
+ 2. Run with `--dry-run` first if user didn't explicitly request real write.
30
+ 3. Present output:
31
+ - validation errors/warnings
32
+ - drift summary
33
+ - servers added/skipped per target
34
+ 4. If dry-run was used and output is acceptable, ask user whether to run without `--dry-run`.
35
+ 5. In automation/CI, prefer `--report json` and parse the output programmatically.
36
+
37
+ ## Error Handling
38
+
39
+ - Exit code `2`: validation error or target parse error (must fix before sync).
40
+ - Exit code `0`: reconcile finished (or no drift).
41
+ - If `npx` fails: suggest `npm install -g sync-agents-settings` as fallback.
@@ -0,0 +1,42 @@
1
+ ---
2
+ name: sync-validate
3
+ description: Validate Claude MCP schema and target capability compatibility before syncing
4
+ ---
5
+
6
+ Validate MCP server definitions from Claude Code against target agent capabilities.
7
+
8
+ ## Arguments
9
+
10
+ The user may pass target names: `/sync-validate codex opencode`
11
+ If no targets are specified, validate all targets (gemini, codex, opencode, kiro, cursor, kimi).
12
+
13
+ Optional flags:
14
+ - `--skip-oauth` — ignore OAuth-only servers from validation
15
+ - `--fix` — after validation passes, auto-run reconcile
16
+ - `--dry-run` — with `--fix`, preview only
17
+ - `--no-backup` — with `--fix`, skip backup before writing
18
+ - `--report json` — emit machine-readable JSON report
19
+
20
+ ## Execution Flow
21
+
22
+ 1. Parse targets and flags from user arguments.
23
+ 2. Run:
24
+ `npx sync-agents-settings validate --target <targets>`
25
+ Add `--skip-oauth` if requested.
26
+ 3. Present issues grouped by target:
27
+ - `error` issues: invalid schema that cannot be converted safely
28
+ - `warning` issues: lossy conversion risk or manual setup needed
29
+ - `command` / `url` with blank-only values are treated as missing and reported as `error`
30
+ - OAuth-only servers emit `OAUTH_MANUAL_SETUP_REQUIRED` warning only (no duplicate transport-field errors)
31
+ 4. If errors exist, tell the user to fix them before running `/sync`.
32
+ 5. If only warnings exist, allow user to proceed based on risk tolerance.
33
+ 6. If `--fix` is provided and no validation errors exist, run reconcile automatically.
34
+ - If no drift is found, return a noop result ("Nothing to fix") instead of reporting reconcile success.
35
+
36
+ ## Error Handling
37
+
38
+ - Exit code `2` means validation errors were found.
39
+ - Exit code `0` means no errors (warnings may still exist).
40
+ - With `--fix`, failure reasons are specific: parse-related (`target config parse error`) or validation-related (`validation errors detected`) before exiting `2`.
41
+ - If `npx` fails: suggest `npm install -g sync-agents-settings` as fallback.
42
+ - `--report json` cannot be used with `--fix` on validate (use `reconcile --report json` instead).
package/commands/sync.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: sync
3
- description: Sync MCP server configurations from Claude Code to other AI agents (Gemini, Codex, OpenCode, Kiro, Cursor)
3
+ description: Sync MCP server configurations from Claude Code to other AI agents (Gemini, Codex, OpenCode, Kiro, Cursor, Kimi)
4
4
  ---
5
5
 
6
6
  Sync MCP server settings from Claude Code to other AI coding agents.
@@ -8,11 +8,14 @@ Sync MCP server settings from Claude Code to other AI coding agents.
8
8
  ## Arguments
9
9
 
10
10
  The user may pass target names after the command: `/sync gemini codex`
11
- If no targets specified, sync to all targets (gemini, codex, opencode, kiro, cursor).
11
+ If no targets specified, sync to all targets (gemini, codex, opencode, kiro, cursor, kimi).
12
12
 
13
13
  The user may also pass flags:
14
14
  - `--skip-oauth` — skip MCP servers that require OAuth authentication
15
15
  - `--no-backup` — skip creating backup of target config files
16
+ - `--codex-home <path>` — custom Codex config directory
17
+ - `--kimi-home <path>` — custom Kimi config directory
18
+ - `--report json` — output machine-readable JSON summary (CI-friendly)
16
19
 
17
20
  ## Execution Flow
18
21
 
@@ -33,6 +36,7 @@ The user may also pass flags:
33
36
  `npx sync-agents-settings sync --target <targets>`
34
37
 
35
38
  6. Present the final results.
39
+ - If `--report json` is used, return raw JSON and avoid text post-processing.
36
40
 
37
41
  ## Error Handling
38
42
 
package/dist/backup.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  export declare function createBackup(filePaths: string[]): string;
2
- export declare function getFilesToBackup(targets: string[], codexConfigPath?: string): string[];
2
+ export declare function getFilesToBackup(targets: string[], codexConfigPath?: string, kimiConfigPath?: string): string[];
package/dist/backup.js CHANGED
@@ -23,7 +23,7 @@ export function createBackup(filePaths) {
23
23
  }
24
24
  return backupDir;
25
25
  }
26
- export function getFilesToBackup(targets, codexConfigPath) {
26
+ export function getFilesToBackup(targets, codexConfigPath, kimiConfigPath) {
27
27
  const files = [PATHS.claudeJson, PATHS.claudeSettings];
28
28
  if (targets.includes("gemini")) {
29
29
  files.push(PATHS.geminiSettings);
@@ -37,6 +37,9 @@ export function getFilesToBackup(targets, codexConfigPath) {
37
37
  if (targets.includes("kiro")) {
38
38
  files.push(PATHS.kiroMcpConfig);
39
39
  }
40
+ if (targets.includes("kimi")) {
41
+ files.push(kimiConfigPath ?? PATHS.kimiMcpConfig);
42
+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