sync-agents-settings 0.2.1 → 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 (60) hide show
  1. package/.claude-plugin/plugin.json +11 -0
  2. package/README.md +168 -23
  3. package/bin/sync-agents.cjs +0 -0
  4. package/commands/report-schema.md +25 -0
  5. package/commands/sync-diff.md +32 -0
  6. package/commands/sync-doctor.md +43 -0
  7. package/commands/sync-instructions.md +50 -0
  8. package/commands/sync-list.md +19 -0
  9. package/commands/sync-reconcile.md +41 -0
  10. package/commands/sync-validate.md +42 -0
  11. package/commands/sync.md +44 -0
  12. package/dist/backup.d.ts +1 -1
  13. package/dist/backup.js +4 -1
  14. package/dist/backup.js.map +1 -1
  15. package/dist/cli.js +542 -55
  16. package/dist/cli.js.map +1 -1
  17. package/dist/diff.d.ts +6 -0
  18. package/dist/diff.js +7 -0
  19. package/dist/diff.js.map +1 -0
  20. package/dist/doctor.d.ts +23 -0
  21. package/dist/doctor.js +140 -0
  22. package/dist/doctor.js.map +1 -0
  23. package/dist/fix.d.ts +19 -0
  24. package/dist/fix.js +71 -0
  25. package/dist/fix.js.map +1 -0
  26. package/dist/instructions.d.ts +8 -1
  27. package/dist/instructions.js +370 -11
  28. package/dist/instructions.js.map +1 -1
  29. package/dist/oauth.d.ts +2 -0
  30. package/dist/oauth.js +7 -0
  31. package/dist/oauth.js.map +1 -0
  32. package/dist/paths.d.ts +4 -0
  33. package/dist/paths.js +5 -0
  34. package/dist/paths.js.map +1 -1
  35. package/dist/reconcile.d.ts +27 -0
  36. package/dist/reconcile.js +122 -0
  37. package/dist/reconcile.js.map +1 -0
  38. package/dist/report-parser.d.ts +81 -0
  39. package/dist/report-parser.js +129 -0
  40. package/dist/report-parser.js.map +1 -0
  41. package/dist/report-schema-renderer.d.ts +2 -0
  42. package/dist/report-schema-renderer.js +129 -0
  43. package/dist/report-schema-renderer.js.map +1 -0
  44. package/dist/report-schema-sync.d.ts +9 -0
  45. package/dist/report-schema-sync.js +28 -0
  46. package/dist/report-schema-sync.js.map +1 -0
  47. package/dist/report.d.ts +47 -0
  48. package/dist/report.js +55 -0
  49. package/dist/report.js.map +1 -0
  50. package/dist/types.d.ts +1 -1
  51. package/dist/validation.d.ts +18 -0
  52. package/dist/validation.js +62 -0
  53. package/dist/validation.js.map +1 -0
  54. package/dist/writers/codex.js +12 -2
  55. package/dist/writers/codex.js.map +1 -1
  56. package/dist/writers/kimi.d.ts +7 -0
  57. package/dist/writers/kimi.js +25 -0
  58. package/dist/writers/kimi.js.map +1 -0
  59. package/package.json +7 -3
  60. package/skills/sync-awareness/SKILL.md +37 -0
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "sync-agents-settings",
3
+ "version": "0.4.0",
4
+ "description": "Sync MCP server configs and instructions from Claude Code to other AI agents (Gemini, Codex, Cursor, Kiro, OpenCode)",
5
+ "repository": "https://github.com/Leoyang183/sync-agents-settings",
6
+ "author": {
7
+ "name": "Leoyang183"
8
+ },
9
+ "license": "MIT",
10
+ "keywords": ["mcp", "sync", "agents", "settings"]
11
+ }
package/README.md CHANGED
@@ -11,18 +11,42 @@
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
 
24
25
  ## Quick Start
25
26
 
27
+ ### Option A: Claude Code Plugin (recommended)
28
+
29
+ Use directly inside Claude Code with slash commands:
30
+
31
+ ```bash
32
+ # Load the plugin for this session
33
+ claude --plugin-dir /path/to/sync-agents-settings
34
+
35
+ # Then use slash commands in the conversation:
36
+ # /sync-list — list all MCP servers
37
+ # /sync — sync MCP configs (with dry-run preview)
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
43
+ # /sync-instructions — sync CLAUDE.md to other agents
44
+ ```
45
+
46
+ The plugin also includes a **sync-awareness skill** that automatically suggests syncing when you edit MCP settings or CLAUDE.md files.
47
+
48
+ ### Option B: CLI via npx
49
+
26
50
  No installation needed — just run with `npx`:
27
51
 
28
52
  ```bash
@@ -39,7 +63,7 @@ npx sync-agents-settings sync
39
63
  npx sync-agents-settings sync-instructions
40
64
  ```
41
65
 
42
- ## Install (optional)
66
+ ### Option C: Global Install
43
67
 
44
68
  ```bash
45
69
  # Global install for the `sync-agents` command
@@ -59,13 +83,60 @@ sync-agents sync --target codex
59
83
  sync-agents sync --target opencode
60
84
  sync-agents sync --target kiro
61
85
  sync-agents sync --target cursor
86
+ sync-agents sync --target kimi
62
87
 
63
88
  # Sync to Codex project-level config
64
89
  sync-agents sync --target codex --codex-home ./my-project/.codex
65
90
 
91
+ # Sync to Kimi project-level config
92
+ sync-agents sync --target kimi --kimi-home ./my-project/.kimi
93
+
66
94
  # Compare differences
67
95
  sync-agents diff
68
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
+
69
140
  # Skip OAuth-only servers (e.g. Slack)
70
141
  sync-agents sync --skip-oauth
71
142
 
@@ -75,7 +146,23 @@ sync-agents sync --no-backup
75
146
  # Verbose output
76
147
  sync-agents sync -v
77
148
 
78
- # 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)
79
166
  sync-agents sync-instructions
80
167
 
81
168
  # Sync only global instructions
@@ -85,11 +172,17 @@ sync-agents sync-instructions --global
85
172
  sync-agents sync-instructions --local
86
173
 
87
174
  # Sync to specific targets
88
- sync-agents sync-instructions --target gemini codex
175
+ sync-agents sync-instructions --target gemini codex kimi aider
89
176
 
90
177
  # Auto-overwrite without prompts (for CI)
91
178
  sync-agents sync-instructions --on-conflict overwrite
92
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
+
93
186
  # Preview instruction sync
94
187
  sync-agents sync-instructions --dry-run
95
188
  ```
@@ -115,7 +208,8 @@ pnpm test # Run tests
115
208
  ├─→ Reader ─→ UnifiedMcpServer[] ─â”ŧ─→ OpenCode Writer ─→ ~/.config/opencode/opencode.json
116
209
  ~/.claude/plugins/ ──┘ │
117
210
  ├─→ Kiro Writer ─→ ~/.kiro/settings/mcp.json
118
- └─→ Cursor Writer ─→ ~/.cursor/mcp.json
211
+ ├─→ Cursor Writer ─→ ~/.cursor/mcp.json
212
+ └─→ Kimi Writer ─→ ~/.kimi/mcp.json
119
213
  ```
120
214
 
121
215
  | Stage | Description |
@@ -126,6 +220,7 @@ pnpm test # Run tests
126
220
  | **OpenCode Writer** | JSON → JSON, `command`+`args` → merged `command` array, `env` → `environment`, `type: "local"`/`"remote"` |
127
221
  | **Kiro Writer** | Same format as Claude, `${VAR:-default}` → expanded |
128
222
  | **Cursor Writer** | Same format as Claude, `${VAR:-default}` → expanded |
223
+ | **Kimi Writer** | Same format as Claude, `${VAR:-default}` → expanded |
129
224
 
130
225
  ### Instruction Sync (`sync-instructions`)
131
226
 
@@ -134,24 +229,37 @@ Syncs CLAUDE.md instruction files to each target's native format:
134
229
  ```
135
230
  ┌─→ ~/.gemini/GEMINI.md (plain copy)
136
231
  ├─→ ~/.codex/AGENTS.md (plain copy)
137
- ~/.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)
138
234
  ├─→ ~/.kiro/steering/claude-instructions.md (+ inclusion: always)
139
235
  └─→ ⚠ Cursor global not supported (SQLite)
140
236
 
141
237
  ┌─→ ./GEMINI.md (plain copy)
142
- ├─→ ./AGENTS.md (Codex + OpenCode share)
143
- ./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)
144
240
  └─→ .cursor/rules/claude-instructions.mdc (+ alwaysApply: true)
145
241
  ```
146
242
 
147
243
  | Target | Global | Local | Format Transform |
148
244
  |--------|--------|-------|------------------|
149
- | Gemini | `~/.gemini/GEMINI.md` | `./GEMINI.md` | Plain copy (filter `@import` lines) |
150
- | Codex | `~/.codex/AGENTS.md` | `./AGENTS.md` | Plain copy (filter `@import` lines) |
151
- | 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` |
152
250
  | Kiro | `~/.kiro/steering/claude-instructions.md` | `.kiro/steering/claude-instructions.md` | Add `inclusion: always` frontmatter |
153
251
  | Cursor | Not supported (SQLite) | `.cursor/rules/claude-instructions.mdc` | Add `alwaysApply: true` frontmatter |
154
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
+
155
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.
156
264
 
157
265
  **Safety mechanisms:**
@@ -277,15 +385,21 @@ Writes to **`~/.cursor/mcp.json`** → `mcpServers` object.
277
385
 
278
386
  Same format as Claude Code. `${VAR:-default}` syntax in URLs is auto-expanded during sync.
279
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
+
280
394
  ## Transport Type Mapping
281
395
 
282
- | Claude Code | Gemini CLI | Codex CLI | OpenCode | Kiro CLI | Cursor |
283
- |------------|-----------|----------|----------|----------|--------|
284
- | `command` + `args` (stdio) | `command` + `args` | `command` + `args` | `type: "local"`, `command: [cmd, ...args]` | same as Claude | same as Claude |
285
- | `type: "http"` + `url` | `httpUrl` | `url` | `type: "remote"`, `url` | same as Claude | same as Claude |
286
- | `type: "sse"` + `url` | `url` | `url` | `type: "remote"`, `url` | same as Claude | same as Claude |
287
- | `env` | `env` | `env` | `environment` | `env` | `env` |
288
- | `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 |
289
403
 
290
404
  ## Backup
291
405
 
@@ -306,8 +420,10 @@ Every sync automatically backs up all affected config files to `~/.sync-agents-b
306
420
  ├── .kiro/
307
421
  │ └── settings/
308
422
  │ └── mcp.json # ← ~/.kiro/settings/mcp.json
309
- └── .cursor/
310
- └── mcp.json # ← ~/.cursor/mcp.json
423
+ ├── .cursor/
424
+ │ └── mcp.json # ← ~/.cursor/mcp.json
425
+ └── .kimi/
426
+ └── mcp.json # ← ~/.kimi/mcp.json
311
427
  ```
312
428
 
313
429
  Use `--no-backup` to skip. Target directories that don't exist (CLI not installed) will be skipped with a warning, not created.
@@ -330,18 +446,48 @@ Use `--no-backup` to skip. Target directories that don't exist (CLI not installe
330
446
  | Kiro CLI (project) | `.kiro/settings/mcp.json` in project root | JSON |
331
447
  | Cursor (global) | `~/.cursor/mcp.json` | JSON |
332
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 |
333
451
 
334
452
  ### Instruction Files
335
453
 
336
454
  | Tool | Global Path | Project Path | Format |
337
455
  |------|------------|-------------|--------|
338
- | Claude Code | `~/.claude/CLAUDE.md` | `./CLAUDE.md` | Markdown |
456
+ | Claude Code | `~/.claude/CLAUDE.md` | `./.claude/CLAUDE.md` (fallback `./CLAUDE.md`) | Markdown |
339
457
  | Gemini CLI | `~/.gemini/GEMINI.md` | `./GEMINI.md` | Markdown |
340
458
  | Codex CLI | `~/.codex/AGENTS.md` | `./AGENTS.md` | Markdown |
341
459
  | OpenCode | `~/.config/opencode/AGENTS.md` | `./AGENTS.md` | Markdown |
460
+ | Kimi CLI | `~/.kimi/AGENTS.md` | `./AGENTS.md` | Markdown |
342
461
  | Kiro CLI | `~/.kiro/steering/claude-instructions.md` | `.kiro/steering/claude-instructions.md` | Markdown + frontmatter |
343
462
  | Cursor | Not supported (SQLite) | `.cursor/rules/claude-instructions.mdc` | MDC (Markdown + frontmatter) |
344
463
 
464
+ ## Claude Code Plugin
465
+
466
+ This project can be used as a Claude Code plugin, providing slash commands and a contextual skill directly inside Claude Code conversations.
467
+
468
+ ### Slash Commands
469
+
470
+ | Command | Description |
471
+ |---------|-------------|
472
+ | `/sync` | Sync MCP server configs to other agents (with dry-run preview and confirmation) |
473
+ | `/sync-list` | List all MCP servers configured in Claude Code |
474
+ | `/sync-diff` | Compare MCP configs between Claude and other agents |
475
+ | `/sync-instructions` | Sync CLAUDE.md instruction files to other agent formats |
476
+
477
+ ### Sync-Awareness Skill
478
+
479
+ The plugin includes a skill that automatically detects when you're editing MCP settings (`.claude.json`, `.mcp.json`) or `CLAUDE.md` files, and suggests syncing to other agents.
480
+
481
+ ### Plugin Development
482
+
483
+ ```bash
484
+ # Validate plugin structure
485
+ claude plugins validate /path/to/sync-agents-settings
486
+
487
+ # Test locally (loads plugin for this session only)
488
+ claude --plugin-dir /path/to/sync-agents-settings
489
+ ```
490
+
345
491
  ## Limitations
346
492
 
347
493
  - **OAuth servers** (e.g. Slack with `oauth.clientId`) are synced as URL-only — you'll need to authenticate manually in each CLI
@@ -358,4 +504,3 @@ Use `--no-backup` to skip. Target directories that don't exist (CLI not installe
358
504
  ## License
359
505
 
360
506
  MIT
361
-
File without changes
@@ -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.
@@ -0,0 +1,32 @@
1
+ ---
2
+ name: sync-diff
3
+ description: Compare MCP server configurations between Claude Code and other AI agents
4
+ ---
5
+
6
+ Compare which MCP servers exist in Claude Code vs other AI agents.
7
+
8
+ ## Arguments
9
+
10
+ The user may pass target names: `/sync-diff gemini`
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)
15
+
16
+ ## Execution Flow
17
+
18
+ 1. Parse targets from user arguments. Run:
19
+ `npx sync-agents-settings diff --target <targets>`
20
+
21
+ 2. Present the comparison for each target:
22
+ - **Shared** — servers that exist in both Claude and the target
23
+ - **Only in Claude** — servers that could be synced to the target
24
+ - **Only in target** — servers that exist in the target but not in Claude
25
+
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.
28
+
29
+ ## Error Handling
30
+
31
+ - If `npx` fails: suggest `npm install -g sync-agents-settings` as fallback.
32
+ - Note: Codex diff shows a message to use `codex mcp list` instead (CLI limitation).
@@ -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).
@@ -0,0 +1,50 @@
1
+ ---
2
+ name: sync-instructions
3
+ description: Sync CLAUDE.md instruction files to other AI agents (Gemini, Codex, OpenCode, Kiro, Cursor, Kimi)
4
+ ---
5
+
6
+ Sync CLAUDE.md instruction files from Claude Code format to other AI agent formats.
7
+
8
+ ## Arguments
9
+
10
+ The user may pass target names: `/sync-instructions gemini codex`
11
+ If no targets specified, sync to all targets.
12
+
13
+ The user may also pass flags:
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)
17
+
18
+ ## Execution Flow
19
+
20
+ 1. Ask the user which scope to sync:
21
+ - **Global** (`~/.claude/CLAUDE.md`) — syncs to agent-specific global instruction files
22
+ - **Local** (`./.claude/CLAUDE.md` in current directory, fallback `./CLAUDE.md`) — syncs to project-level instruction files
23
+ - **Both** (default) — syncs both global and local
24
+
25
+ 2. Parse targets from user arguments. Build the dry-run command:
26
+ `npx sync-agents-settings sync-instructions --dry-run [--global|--local] --target <targets>`
27
+ Omit `--global`/`--local` if syncing both (this is the CLI default).
28
+ Add `--no-backup` if the user specified it.
29
+
30
+ 3. Run the dry-run command. Present what will be written:
31
+ - Which instruction files will be created or updated
32
+ - Which targets will be skipped (e.g., Cursor global is unsupported — uses SQLite)
33
+
34
+ 4. If any target files already exist, ask the user what to do:
35
+ - **Overwrite** — replace the existing file entirely
36
+ - **Append** — add Claude instructions after the existing content
37
+ - **Skip** — leave the existing file untouched
38
+
39
+ 5. Run the actual command. IMPORTANT: Always pass `--on-conflict <action>` to prevent the CLI from entering interactive mode (which does not work in Claude Code's bash execution):
40
+ `npx sync-agents-settings sync-instructions [--global|--local] --target <targets> --on-conflict <action>`
41
+ Add `--no-backup` if the user specified it.
42
+
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.
45
+
46
+ ## Error Handling
47
+
48
+ - If `npx` fails: suggest `npm install -g sync-agents-settings` as fallback.
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,19 @@
1
+ ---
2
+ name: sync-list
3
+ description: List all MCP servers configured in Claude Code with transport type and source
4
+ ---
5
+
6
+ List all MCP servers that Claude Code knows about.
7
+
8
+ ## Execution Flow
9
+
10
+ 1. Run: `npx sync-agents-settings list`
11
+
12
+ 2. Present the output to the user in a readable format:
13
+ - Group servers by transport type (STDIO, HTTP, SSE)
14
+ - Show the source of each server (config = from ~/.claude.json, plugin = from Claude plugin)
15
+ - Highlight any servers that require OAuth authentication
16
+
17
+ ## Error Handling
18
+
19
+ - If `npx` fails: suggest `npm install -g sync-agents-settings` as fallback.
@@ -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).
@@ -0,0 +1,44 @@
1
+ ---
2
+ name: sync
3
+ description: Sync MCP server configurations from Claude Code to other AI agents (Gemini, Codex, OpenCode, Kiro, Cursor, Kimi)
4
+ ---
5
+
6
+ Sync MCP server settings from Claude Code to other AI coding agents.
7
+
8
+ ## Arguments
9
+
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, kimi).
12
+
13
+ The user may also pass flags:
14
+ - `--skip-oauth` — skip MCP servers that require OAuth authentication
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)
19
+
20
+ ## Execution Flow
21
+
22
+ 1. Parse targets from user arguments. Build the command:
23
+ `npx sync-agents-settings sync --dry-run --target <targets>`
24
+ Add `--skip-oauth` or `--no-backup` if the user specified them.
25
+
26
+ 2. Run the dry-run command using bash. This previews what will change without writing files.
27
+
28
+ 3. Present the results to the user:
29
+ - Servers that will be **added** to each target
30
+ - Servers that will be **skipped** (already exist or unsupported)
31
+ - If all servers are skipped, inform the user and stop here.
32
+
33
+ 4. Ask the user: "Proceed with sync?"
34
+
35
+ 5. If confirmed, run the same command without `--dry-run`:
36
+ `npx sync-agents-settings sync --target <targets>`
37
+
38
+ 6. Present the final results.
39
+ - If `--report json` is used, return raw JSON and avoid text post-processing.
40
+
41
+ ## Error Handling
42
+
43
+ - If `npx` fails with "command not found" or network error: suggest `npm install -g sync-agents-settings` as fallback.
44
+ - If the CLI exits with non-zero code: show the stderr output and suggest checking that target agent directories exist.
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
+ }
40
43
  if (targets.includes("cursor")) {
41
44
  files.push(PATHS.cursorMcpConfig);
42
45
  }