vibe-config-sync 0.2.4 → 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.
- package/README.md +58 -16
- package/README.zh-CN.md +58 -16
- package/dist/index.js +1052 -339
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,14 +4,23 @@
|
|
|
4
4
|
|
|
5
5
|
> **Command:** `vibe-sync`
|
|
6
6
|
|
|
7
|
-
Sync AI coding tool configurations across machines via Git.
|
|
7
|
+
Sync AI coding tool configurations across machines via Git. Supports Claude Code (`~/.claude/`) and Codex (`~/.codex/`).
|
|
8
8
|
|
|
9
9
|
## Problem
|
|
10
10
|
|
|
11
11
|
When using AI coding tools on multiple machines, configurations like skills, commands, agents, plugins, and user preferences need to be manually replicated on each machine.
|
|
12
12
|
|
|
13
|
+
## Security Recommendation
|
|
14
|
+
|
|
15
|
+
- Use a **private** Git repository for sync data.
|
|
16
|
+
- If you use a public repository, do **not** sync any sensitive information (API keys, tokens, credentials, secrets in config files or MCP env).
|
|
17
|
+
|
|
13
18
|
## What Gets Synced
|
|
14
19
|
|
|
20
|
+
Default provider is `all` (both Claude and Codex).
|
|
21
|
+
|
|
22
|
+
### Claude (`data/claude/`)
|
|
23
|
+
|
|
15
24
|
| Content | Description |
|
|
16
25
|
|---------|-------------|
|
|
17
26
|
| `settings.json` | Plugin enable/disable flags |
|
|
@@ -21,8 +30,19 @@ When using AI coding tools on multiple machines, configurations like skills, com
|
|
|
21
30
|
| `agents/` | Agent definitions |
|
|
22
31
|
| `plugins/installed_plugins.json` | Plugin registry (machine paths stripped) |
|
|
23
32
|
| `plugins/known_marketplaces.json` | Plugin marketplace sources (machine paths stripped) |
|
|
33
|
+
| `mcp-servers.json` | MCP server configs (extracted from `~/.claude.json`) |
|
|
34
|
+
|
|
35
|
+
### Codex (`data/codex/`)
|
|
36
|
+
|
|
37
|
+
| Content | Description |
|
|
38
|
+
|---------|-------------|
|
|
39
|
+
| `config.toml` | Codex settings/preferences |
|
|
40
|
+
| `AGENTS.md` | Codex user preferences and workflow guidance |
|
|
41
|
+
| `commands/` | User custom commands (if present) |
|
|
42
|
+
| `skills/` | Codex skills |
|
|
43
|
+
| `agents/` | Codex agents |
|
|
24
44
|
|
|
25
|
-
**Not synced** (machine-specific / ephemeral / large):
|
|
45
|
+
**Not synced** (machine-specific / ephemeral / large): cache/log/temp/session state, lock files, and runtime auth/session material.
|
|
26
46
|
|
|
27
47
|
## Prerequisites
|
|
28
48
|
|
|
@@ -42,15 +62,17 @@ npm install -g vibe-config-sync
|
|
|
42
62
|
|
|
43
63
|
```bash
|
|
44
64
|
vibe-sync init # Initialize and connect to a Git remote
|
|
45
|
-
vibe-sync push # Export
|
|
65
|
+
vibe-sync push # Export all providers and push to remote
|
|
66
|
+
vibe-sync push --provider claude # Claude only
|
|
46
67
|
```
|
|
47
68
|
|
|
48
69
|
### Machine B (import)
|
|
49
70
|
|
|
50
71
|
```bash
|
|
51
72
|
vibe-sync init # Initialize and pull from remote
|
|
52
|
-
vibe-sync pull # Pull
|
|
53
|
-
vibe-sync pull --
|
|
73
|
+
vibe-sync pull # Pull + import all providers
|
|
74
|
+
vibe-sync pull --provider claude # Pull + import Claude only
|
|
75
|
+
vibe-sync pull --no-plugins # Disable Claude plugin phase
|
|
54
76
|
```
|
|
55
77
|
|
|
56
78
|
## Commands
|
|
@@ -58,17 +80,17 @@ vibe-sync pull --no-plugins # Pull and import configs only (skip plugins
|
|
|
58
80
|
| Command | Description |
|
|
59
81
|
|---------|-------------|
|
|
60
82
|
| `vibe-sync init` | Initialize sync repository and connect to Git remote |
|
|
61
|
-
| `vibe-sync export` |
|
|
62
|
-
| `vibe-sync import` |
|
|
63
|
-
| `vibe-sync import --no-plugins` |
|
|
83
|
+
| `vibe-sync export` | Export selected provider(s) (`--provider claude|codex|all`, default `all`) |
|
|
84
|
+
| `vibe-sync import` | Import selected provider(s) (`--provider claude|codex|all`, default `all`) |
|
|
85
|
+
| `vibe-sync import --no-plugins` | Skip Claude plugin sync phase (no effect for Codex) |
|
|
64
86
|
| `vibe-sync import --dry-run` | Preview what would be imported without making changes |
|
|
65
|
-
| `vibe-sync status` | Show diff
|
|
87
|
+
| `vibe-sync status` | Show diff for selected provider(s) |
|
|
66
88
|
| `vibe-sync push` | export + git commit + git push |
|
|
67
|
-
| `vibe-sync pull` | git pull + import
|
|
68
|
-
| `vibe-sync pull --no-plugins` |
|
|
89
|
+
| `vibe-sync pull` | git pull + import |
|
|
90
|
+
| `vibe-sync pull --no-plugins` | Skip Claude plugin phase during import |
|
|
69
91
|
| `vibe-sync pull --dry-run` | Preview what would be imported (skips git pull) |
|
|
70
|
-
| `vibe-sync restore` | List available backups |
|
|
71
|
-
| `vibe-sync restore <timestamp>` | Restore
|
|
92
|
+
| `vibe-sync restore` | List available backups (`--provider` supported, default `all`) |
|
|
93
|
+
| `vibe-sync restore <timestamp>` | Restore selected provider(s) from backup timestamp (`all` restores available providers, skips missing ones) |
|
|
72
94
|
|
|
73
95
|
## Daily Workflow
|
|
74
96
|
|
|
@@ -82,11 +104,13 @@ vibe-sync pull
|
|
|
82
104
|
|
|
83
105
|
## How It Works
|
|
84
106
|
|
|
85
|
-
- **
|
|
107
|
+
- **Provider-aware data layout** stores sync data under `~/.vibe-sync/data/claude/` and `~/.vibe-sync/data/codex/` (legacy Claude root layout is auto-migrated).
|
|
86
108
|
|
|
87
|
-
- **
|
|
109
|
+
- **Export** copies provider config files into the provider data directory. Claude plugin JSON files are sanitized (machine paths removed). Claude MCP server configs are extracted from `~/.claude.json`. Codex `config.toml` is scanned for sensitive keys; export requires interactive confirmation when sensitive fields are detected. In non-interactive mode, sensitive Codex `config.toml` export is skipped with a warning.
|
|
88
110
|
|
|
89
|
-
- **
|
|
111
|
+
- **Import** restores provider files from sync data to local provider directories. `--provider all` runs in order: `claude` then `codex`, with fail-fast semantics. Claude plugin JSON files are manifest-only (never copied directly) and are applied through `claude` CLI. Claude MCP servers are additive-only merges into `~/.claude.json`.
|
|
112
|
+
|
|
113
|
+
- **Backup** is provider-aware and created before import at `~/.vibe-sync/backups/<provider>/<timestamp>/`. In `all` mode, each provider is backed up independently; missing local provider config is skipped.
|
|
90
114
|
|
|
91
115
|
## Sync Strategy
|
|
92
116
|
|
|
@@ -118,6 +142,22 @@ In short: new content is added, existing content is overwritten, but nothing is
|
|
|
118
142
|
|
|
119
143
|
Plugin JSON files (`installed_plugins.json`, `known_marketplaces.json`) are exported with machine-specific paths stripped. On import, they are **not** copied to `~/.claude/plugins/` — instead they serve as a manifest. The `claude` CLI is invoked to install each plugin, and it writes correct registry files with local paths as a side effect. Already-installed plugins (detected by `installPath`) are skipped to avoid redundant network operations.
|
|
120
144
|
|
|
145
|
+
### MCP Servers
|
|
146
|
+
|
|
147
|
+
MCP server configurations live in `~/.claude.json` under the `mcpServers` key. On export, this section is extracted and saved as `mcp-servers.json` in the sync directory. If any server config contains `env` fields (which may hold secrets like API keys), the user is prompted before exporting.
|
|
148
|
+
|
|
149
|
+
On import, MCP servers are **additive only** — new servers from the sync repo are added to `~/.claude.json`, but existing servers with the same name are never overwritten. This preserves any machine-specific customizations (e.g., local paths, environment variables).
|
|
150
|
+
|
|
151
|
+
### Codex Files
|
|
152
|
+
|
|
153
|
+
Codex follows the same last-write-wins model:
|
|
154
|
+
|
|
155
|
+
- `config.toml`: whole-file overwrite (no schema validation)
|
|
156
|
+
- `AGENTS.md`: whole-file overwrite
|
|
157
|
+
- `commands/`, `skills/`, `agents/`: directory merge + file overwrite (no local deletion)
|
|
158
|
+
- Sensitive key handling applies only on export; import does not reconstruct redacted secrets
|
|
159
|
+
- `skills/` symlinks are resolved and synced as real directories
|
|
160
|
+
|
|
121
161
|
### What This Means in Practice
|
|
122
162
|
|
|
123
163
|
- If both machines modify different configs and then sync, the machine that runs `import` last will lose its local changes (a timestamped backup exists at `~/.vibe-sync/backups/claude/` for manual recovery)
|
|
@@ -129,6 +169,8 @@ Plugin JSON files (`installed_plugins.json`, `known_marketplaces.json`) are expo
|
|
|
129
169
|
| Variable | Description | Default |
|
|
130
170
|
|----------|-------------|---------|
|
|
131
171
|
| `CLAUDE_HOME` | Override Claude config directory | `~/.claude` |
|
|
172
|
+
| `CLAUDE_JSON` | Override Claude global config file (MCP servers) | `~/.claude.json` |
|
|
173
|
+
| `CODEX_HOME` | Override Codex config directory | `~/.codex` |
|
|
132
174
|
|
|
133
175
|
## License
|
|
134
176
|
|
package/README.zh-CN.md
CHANGED
|
@@ -4,14 +4,23 @@
|
|
|
4
4
|
|
|
5
5
|
> **命令:** `vibe-sync`
|
|
6
6
|
|
|
7
|
-
通过 Git 跨机器同步 AI
|
|
7
|
+
通过 Git 跨机器同步 AI 编程工具配置。支持 Claude Code(`~/.claude/`)和 Codex(`~/.codex/`)。
|
|
8
8
|
|
|
9
9
|
## 问题
|
|
10
10
|
|
|
11
11
|
在多台机器上使用 AI 编程工具时,技能、命令、代理、插件和用户偏好等配置需要在每台机器上手动复制。
|
|
12
12
|
|
|
13
|
+
## 安全建议
|
|
14
|
+
|
|
15
|
+
- 同步仓库强烈建议使用**私有仓库**。
|
|
16
|
+
- 如果使用公开仓库,请**不要**同步任何敏感信息(API Key、Token、凭据、配置文件或 MCP `env` 中的密钥等)。
|
|
17
|
+
|
|
13
18
|
## 同步内容
|
|
14
19
|
|
|
20
|
+
默认 provider 为 `all`(Claude + Codex)。
|
|
21
|
+
|
|
22
|
+
### Claude(`data/claude/`)
|
|
23
|
+
|
|
15
24
|
| 内容 | 说明 |
|
|
16
25
|
|------|------|
|
|
17
26
|
| `settings.json` | 插件启用/禁用标志 |
|
|
@@ -21,8 +30,19 @@
|
|
|
21
30
|
| `agents/` | 代理定义 |
|
|
22
31
|
| `plugins/installed_plugins.json` | 插件注册表(已剥离机器路径) |
|
|
23
32
|
| `plugins/known_marketplaces.json` | 插件市场来源(已剥离机器路径) |
|
|
33
|
+
| `mcp-servers.json` | MCP 服务器配置(从 `~/.claude.json` 提取) |
|
|
34
|
+
|
|
35
|
+
### Codex(`data/codex/`)
|
|
36
|
+
|
|
37
|
+
| 内容 | 说明 |
|
|
38
|
+
|------|------|
|
|
39
|
+
| `config.toml` | Codex 配置 |
|
|
40
|
+
| `AGENTS.md` | Codex 用户偏好与工作流说明 |
|
|
41
|
+
| `commands/` | 用户自定义命令(若存在) |
|
|
42
|
+
| `skills/` | Codex 技能 |
|
|
43
|
+
| `agents/` | Codex 代理 |
|
|
24
44
|
|
|
25
|
-
**不同步**(机器特定 / 临时 /
|
|
45
|
+
**不同步**(机器特定 / 临时 / 大文件):缓存、日志、临时/锁文件、会话态、运行期认证材料等。
|
|
26
46
|
|
|
27
47
|
## 前置条件
|
|
28
48
|
|
|
@@ -42,15 +62,17 @@ npm install -g vibe-config-sync
|
|
|
42
62
|
|
|
43
63
|
```bash
|
|
44
64
|
vibe-sync init # 初始化并连接 Git 远程仓库
|
|
45
|
-
vibe-sync push #
|
|
65
|
+
vibe-sync push # 导出所有 provider 并推送
|
|
66
|
+
vibe-sync push --provider claude # 仅 Claude
|
|
46
67
|
```
|
|
47
68
|
|
|
48
69
|
### 机器 B(导入)
|
|
49
70
|
|
|
50
71
|
```bash
|
|
51
72
|
vibe-sync init # 初始化并从远程仓库拉取
|
|
52
|
-
vibe-sync pull #
|
|
53
|
-
vibe-sync pull --
|
|
73
|
+
vibe-sync pull # 拉取并导入所有 provider
|
|
74
|
+
vibe-sync pull --provider claude # 仅 Claude
|
|
75
|
+
vibe-sync pull --no-plugins # 关闭 Claude 插件阶段
|
|
54
76
|
```
|
|
55
77
|
|
|
56
78
|
## 命令
|
|
@@ -58,17 +80,17 @@ vibe-sync pull --no-plugins # 仅拉取和导入配置(跳过插件)
|
|
|
58
80
|
| 命令 | 说明 |
|
|
59
81
|
|------|------|
|
|
60
82
|
| `vibe-sync init` | 初始化同步仓库并连接 Git 远程仓库 |
|
|
61
|
-
| `vibe-sync export` |
|
|
62
|
-
| `vibe-sync import` |
|
|
63
|
-
| `vibe-sync import --no-plugins` |
|
|
83
|
+
| `vibe-sync export` | 导出所选 provider(`--provider claude|codex|all`,默认 `all`) |
|
|
84
|
+
| `vibe-sync import` | 导入所选 provider(`--provider claude|codex|all`,默认 `all`) |
|
|
85
|
+
| `vibe-sync import --no-plugins` | 跳过 Claude 插件阶段(对 Codex 无影响) |
|
|
64
86
|
| `vibe-sync import --dry-run` | 预览将要导入的内容,不实际执行 |
|
|
65
|
-
| `vibe-sync status` |
|
|
87
|
+
| `vibe-sync status` | 显示所选 provider 的差异 |
|
|
66
88
|
| `vibe-sync push` | export + git commit + git push |
|
|
67
|
-
| `vibe-sync pull` | git pull + import
|
|
68
|
-
| `vibe-sync pull --no-plugins` |
|
|
89
|
+
| `vibe-sync pull` | git pull + import |
|
|
90
|
+
| `vibe-sync pull --no-plugins` | 导入时跳过 Claude 插件阶段 |
|
|
69
91
|
| `vibe-sync pull --dry-run` | 预览将要导入的内容(跳过 git pull) |
|
|
70
|
-
| `vibe-sync restore` |
|
|
71
|
-
| `vibe-sync restore <timestamp>` |
|
|
92
|
+
| `vibe-sync restore` | 列出可用备份(支持 `--provider`,默认 `all`) |
|
|
93
|
+
| `vibe-sync restore <timestamp>` | 从指定时间戳恢复所选 provider(`all` 会恢复存在的 provider,缺失则跳过) |
|
|
72
94
|
|
|
73
95
|
## 日常工作流
|
|
74
96
|
|
|
@@ -82,11 +104,13 @@ vibe-sync pull
|
|
|
82
104
|
|
|
83
105
|
## 工作原理
|
|
84
106
|
|
|
85
|
-
-
|
|
107
|
+
- **按 provider 分目录**:同步数据存储在 `~/.vibe-sync/data/claude/` 与 `~/.vibe-sync/data/codex/`(旧版 Claude 根目录布局会自动迁移)。
|
|
86
108
|
|
|
87
|
-
-
|
|
109
|
+
- **导出**:按 provider 复制配置。Claude 插件 JSON 会剥离机器路径;Claude MCP 从 `~/.claude.json` 提取。Codex `config.toml` 会做敏感键扫描,检测到敏感字段时必须交互确认后才可导出。非交互模式下若检测到敏感字段,会告警并跳过该文件导出。
|
|
88
110
|
|
|
89
|
-
-
|
|
111
|
+
- **导入**:从 provider 目录恢复到本地。`--provider all` 按 `claude -> codex` 顺序执行,采用 fail-fast。Claude 插件 JSON 仅做清单,不直接复制;通过 `claude` CLI 安装。Claude MCP 只做增量合并(不覆盖同名现有项)。
|
|
112
|
+
|
|
113
|
+
- **备份**:导入前在 `~/.vibe-sync/backups/<provider>/<timestamp>/` 创建 provider 级备份。`all` 模式下各 provider 独立备份,缺失本地配置则跳过。
|
|
90
114
|
|
|
91
115
|
## 同步策略
|
|
92
116
|
|
|
@@ -118,6 +142,22 @@ vibe-sync pull
|
|
|
118
142
|
|
|
119
143
|
插件 JSON 文件(`installed_plugins.json`、`known_marketplaces.json`)在导出时会剥离机器特定路径。导入时**不会**复制到 `~/.claude/plugins/`——而是作为清单使用。`claude` CLI 被调用来安装每个插件,并在安装过程中写入包含本地路径的正确注册文件。已安装的插件(通过 `installPath` 检测)会被跳过,以避免冗余的网络操作。
|
|
120
144
|
|
|
145
|
+
### MCP 服务器
|
|
146
|
+
|
|
147
|
+
MCP 服务器配置存储在 `~/.claude.json` 的 `mcpServers` 键下。导出时,该部分被提取并保存为同步目录中的 `mcp-servers.json`。如果任何服务器配置包含 `env` 字段(可能包含 API 密钥等密钥),导出前会提示用户确认。
|
|
148
|
+
|
|
149
|
+
导入时,MCP 服务器采用**仅增量**策略——同步仓库中的新服务器会被添加到 `~/.claude.json`,但同名的已有服务器不会被覆盖。这保留了机器特定的自定义配置(如本地路径、环境变量)。
|
|
150
|
+
|
|
151
|
+
### Codex 文件
|
|
152
|
+
|
|
153
|
+
Codex 也遵循相同的最后写入优先策略:
|
|
154
|
+
|
|
155
|
+
- `config.toml`:整文件覆盖(不做 schema 校验)
|
|
156
|
+
- `AGENTS.md`:整文件覆盖
|
|
157
|
+
- `commands/`、`skills/`、`agents/`:目录合并 + 文件覆盖(不删除本地额外文件)
|
|
158
|
+
- 敏感键处理仅发生在导出阶段;导入不会恢复被脱敏的密钥值
|
|
159
|
+
- `skills/` 中的符号链接会被解析并以真实目录形式同步
|
|
160
|
+
|
|
121
161
|
### 实际影响
|
|
122
162
|
|
|
123
163
|
- 如果两台机器修改了不同的配置然后同步,最后执行 `import` 的机器会丢失其本地更改(可在 `~/.vibe-sync/backups/claude/` 找到带时间戳的备份进行手动恢复)
|
|
@@ -129,6 +169,8 @@ vibe-sync pull
|
|
|
129
169
|
| 变量 | 说明 | 默认值 |
|
|
130
170
|
|------|------|--------|
|
|
131
171
|
| `CLAUDE_HOME` | 覆盖 Claude 配置目录 | `~/.claude` |
|
|
172
|
+
| `CLAUDE_JSON` | 覆盖 Claude 全局配置文件(MCP 服务器) | `~/.claude.json` |
|
|
173
|
+
| `CODEX_HOME` | 覆盖 Codex 配置目录 | `~/.codex` |
|
|
132
174
|
|
|
133
175
|
## 许可证
|
|
134
176
|
|