claude-chats-sync 0.0.7 → 0.0.9

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 CHANGED
@@ -1,307 +1,337 @@
1
- # claude-chats-sync
2
-
3
- [![npm version](https://badge.fury.io/js/claude-chats-sync.svg)](https://www.npmjs.com/package/claude-chats-sync)
4
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
- [![Node](https://img.shields.io/node/v/claude-chats-sync.svg)](https://nodejs.org)
6
-
7
- > Cross-platform CLI tool to sync Claude Code chat sessions to your project directory
8
-
9
- [中文文档](README.zh-CN.md) | English
10
-
11
- ## Features
12
-
13
- - 🔄 **Auto-sync** - Creates symlinks from Claude Code local storage to your project folder
14
- - 📁 **Project-local history** - Chat sessions stored in your project, not user home directory
15
- - 🔒 **Sensitive data protection** - Cleans API keys from session files
16
- - 🎯 **Simple to use** - Initialize sync with a single command
17
- - 📊 **Status tracking** - Check sync status and session count
18
- - 🌳 **Git-friendly** - Configure Git filters for safe version control
19
- - 🔧 **Cross-platform** - Works on Windows, macOS, and Linux
20
-
21
- ## 📦 Installation
22
-
23
- ### Install globally (recommended)
24
-
25
- ```bash
26
- npm install -g claude-chats-sync
27
- ```
28
-
29
- This allows you to use `claude-chats-sync` command from anywhere.
30
-
31
- ### Install locally
32
-
33
- ```bash
34
- npm install -D claude-chats-sync
35
- ```
36
-
37
- Then use it via `npx`:
38
- ```bash
39
- npx claude-chats-sync init
40
- ```
41
-
42
- ## 🚀 Quick Start
43
-
44
- ### Initialize sync
45
-
46
- ```bash
47
- # In your project directory
48
- claude-chats-sync init
49
- ```
50
-
51
- This will:
52
- - Create a `.claudeCodeSessions/` folder in your project
53
- - Create a symlink in `~/.claude/projects/`
54
- - Configure Git filter for automatic sensitive data cleaning
55
- - Add `.claudeCodeSessions/` to `.gitignore` (commented by default)
56
-
57
- ### Check status
58
-
59
- ```bash
60
- claude-chats-sync status
61
- ```
62
-
63
- ### Open history folder
64
-
65
- ```bash
66
- claude-chats-sync open
67
- ```
68
-
69
- ## 📖 Commands
70
-
71
- | Command | Description |
72
- |---------|-------------|
73
- | `init` | Initialize sync for current project |
74
- | `status` | Check sync status and session count |
75
- | `open` | Open history folder in file manager |
76
- | `clean` | Clean sensitive data from session files |
77
- | `setup-git-filter` | Setup Git filter for automatic cleaning |
78
- | `help` | Show help message |
79
-
80
- ## 🔧 Usage Examples
81
-
82
- ### Basic usage
83
-
84
- ```bash
85
- # Initialize sync
86
- claude-chats-sync init
87
-
88
- # Check status
89
- claude-chats-sync status
90
-
91
- # Open sessions folder
92
- claude-chats-sync open
93
- ```
94
-
95
- ### Advanced options
96
-
97
- ```bash
98
- # Custom folder name
99
- claude-chats-sync init --folder-name .sessions
100
-
101
- # Force migrate existing sessions
102
- claude-chats-sync init --force
103
-
104
- # Specify project path
105
- claude-chats-sync init --project-path /path/to/project
106
- ```
107
-
108
- ### Cleaning sensitive data
109
-
110
- ```bash
111
- # Manual cleanup
112
- claude-chats-sync clean
113
-
114
- # Setup Git auto-filter
115
- claude-chats-sync setup-git-filter
116
- ```
117
-
118
- ## ⚙️ Environment Variables (Recommended)
119
-
120
- Configure API keys via environment variables to prevent them from appearing in session files:
121
-
122
- **Linux/macOS** - Add to `~/.bashrc` or `~/.zshrc`:
123
- ```bash
124
- export ANTHROPIC_AUTH_TOKEN="sk-ant-..."
125
- export ANTHROPIC_BASE_URL="https://api.example.com" # Optional: for third-party API
126
- ```
127
-
128
- **Windows PowerShell**:
129
- ```powershell
130
- $env:ANTHROPIC_AUTH_TOKEN="sk-ant-..."
131
- $env:ANTHROPIC_BASE_URL="https://api.example.com"
132
- ```
133
-
134
- **Windows CMD (permanent)**:
135
- ```cmd
136
- setx ANTHROPIC_AUTH_TOKEN "sk-ant-..."
137
- setx ANTHROPIC_BASE_URL "https://api.example.com"
138
- ```
139
-
140
- ## 🔒 Security & Version Control
141
-
142
- ### ⚠️ Security Warning
143
-
144
- Session files may contain sensitive information:
145
- - API keys and authentication tokens
146
- - Proprietary code and business logic
147
- - Private conversations and internal discussions
148
- - System paths and environment details
149
-
150
- While this tool provides API key cleaning, **no automated cleaning is 100% complete**. Only commit these files if you fully understand and accept the security risks.
151
-
152
- ### Options for securing API keys
153
-
154
- **Option 1: Use environment variables (Recommended)**
155
-
156
- Configure Claude Code to use API keys from environment variables. This prevents them from appearing in session files entirely.
157
-
158
- **Option 2: Use Git filter**
159
-
160
- If you store API keys in config files, the Git filter automatically cleans them on commit.
161
-
162
- ### Git filter usage
163
-
164
- After initialization, commit normally:
165
-
166
- ```bash
167
- git add .claudeCodeSessions/
168
- git commit -m "Add conversation history"
169
-
170
- # API keys are automatically replaced with [REDACTED]
171
- # Your local files remain unchanged
172
- ```
173
-
174
- ### Complete Git ignore (safest)
175
-
176
- **RECOMMENDED**: Ignore session files entirely. Uncomment in `.gitignore`:
177
-
178
- ```gitignore
179
- .claudeCodeSessions/
180
- ```
181
-
182
- This prevents accidentally committing sensitive data to your repository.
183
-
184
- ## 🌐 How It Works
185
-
186
- Claude Code stores chat sessions in `~/.claude/projects/{normalized-project-path}/`.
187
-
188
- This CLI creates a symbolic link to a folder in your project (default: `.claudeCodeSessions/`), making the chat history part of your project.
189
-
190
- ### Example structure
191
-
192
- ```
193
- Your Project/
194
- ├── src/
195
- ├── .claudeCodeSessions/ # Chat sessions (synced with ~/.claude)
196
- │ ├── session-abc123.jsonl
197
- │ └── session-def456.jsonl
198
- ├── .gitignore # Auto-updated
199
- ├── .gitattributes # Git filter configuration
200
- └── package.json
201
- ```
202
-
203
- ## 🔄 Syncing Across Machines
204
-
205
- If you choose to sync session files:
206
-
207
- 1. Commit the `.claudeCodeSessions/` folder
208
- 2. Push to GitHub
209
- 3. Pull on another machine
210
- 4. Run `claude-chats-sync init` to create the symlink
211
-
212
- ## 🔧 Platform-specific Notes
213
-
214
- ### Windows
215
- - Uses junction points (no admin privileges required)
216
- - Supports PowerShell and CMD
217
- - Run PowerShell scripts may require: `Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser`
218
-
219
- ### macOS
220
- - Requires execute permissions: `chmod +x $(which claude-chats-sync)`
221
- - Uses standard symbolic links
222
-
223
- ### Linux
224
- - Requires execute permissions: `chmod +x $(which claude-chats-sync)`
225
- - Uses standard symbolic links
226
-
227
- ## 🐛 Troubleshooting
228
-
229
- ### Symlink creation fails (Windows)
230
-
231
- The tool uses junction points which work without admin privileges. If issues persist:
232
- - Ensure Node.js is in your PATH
233
- - Try running as administrator
234
- - Check that your project path doesn't contain special characters
235
-
236
- ### History not syncing
237
-
238
- 1. Check if symlink exists:
239
- - Windows: `dir %USERPROFILE%\.claude\projects`
240
- - macOS/Linux: `ls -la ~/.claude/projects`
241
-
242
- 2. Verify symlink points to your project's `.claudeCodeSessions/` folder
243
-
244
- ### Reinitialize
245
-
246
- Delete existing symlink:
247
-
248
- ```bash
249
- # Windows
250
- rmdir "%USERPROFILE%\.claude\projects\{project-name}"
251
-
252
- # macOS/Linux
253
- rm ~/.claude/projects/{project-name}
254
- ```
255
-
256
- Then run `claude-chats-sync init` again.
257
-
258
- ## 📚 Related Projects
259
-
260
- - [VSCode Extension](https://marketplace.visualstudio.com/items?itemName=tubo.claude-code-chats-sync) - Full-featured VSCode extension with the same functionality
261
-
262
- ## 💰 Token Usage & Cost Considerations
263
-
264
- > ⚠️ **IMPORTANT**: When sharing session files, each team member uses their own API key and incurs their own API costs.
265
-
266
- ### Key points
267
-
268
- 1. **Each member pays for their own usage**
269
- - Every team member must configure their own API key
270
- - When you continue a shared conversation, **you pay for all new tokens** generated
271
- - The original creator's API key is **never** used
272
-
273
- 2. **Context window considerations**
274
- - Long shared conversations consume more tokens as context
275
- - A shared conversation with 50,000 tokens will consume ~50,000 input tokens each time a new member continues it
276
-
277
- 3. **Cost-saving best practices**
278
- - Generate conversation summaries before sharing
279
- - Start new conversations when possible
280
- - Archive old sessions
281
- - Monitor your API usage
282
-
283
- For detailed cost considerations, see [Token Usage Guide](TOKEN_USAGE.md).
284
-
285
- ## 📝 License
286
-
287
- MIT - see [LICENSE](LICENSE) file for details
288
-
289
- ## 🤝 Contributing
290
-
291
- Contributions are welcome! Please open an issue or submit a pull request.
292
-
293
- ## 📞 Support
294
-
295
- - 📧 [Issues](https://github.com/tubo70/claude-chats-sync-cli/issues)
296
- - 📖 [Documentation](https://github.com/tubo70/claude-chats-sync-cli/wiki)
297
- - 💬 [Discussions](https://github.com/tubo70/claude-chats-sync-cli/discussions)
298
-
299
- ## 🔗 Links
300
-
301
- - [npm](https://www.npmjs.com/package/claude-chats-sync)
302
- - [GitHub](https://github.com/tubo70/claude-chats-sync-cli)
303
- - [VSCode Marketplace](https://marketplace.visualstudio.com/items?itemName=tubo.claude-code-chats-sync)
304
-
305
- ---
306
-
307
- Made with ❤️ by [tubo70](https://github.com/tubo70)
1
+ # claude-chats-sync
2
+
3
+ [![npm version](https://badge.fury.io/js/claude-chats-sync.svg)](https://www.npmjs.com/package/claude-chats-sync)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+ [![Node](https://img.shields.io/node/v/claude-chats-sync.svg)](https://nodejs.org)
6
+
7
+ > Cross-platform CLI tool to sync Claude Code chat sessions to your project directory
8
+
9
+ [中文文档](README.zh-CN.md) | English
10
+
11
+ ## ⚠️ Security Warning - Read Before Using
12
+
13
+ > **IMPORTANT**: Do NOT commit `.claudeCodeSessions/` to your repository unless absolutely necessary!
14
+
15
+ ### What are the risks?
16
+
17
+ Session files may contain sensitive information:
18
+ - **API keys and authentication tokens** - Can be used to access your account
19
+ - **Proprietary code and business logic** - Your confidential code and algorithms
20
+ - **Private conversations** - Internal discussions and sensitive topics
21
+ - **System paths and environment details** - Information about your infrastructure
22
+
23
+ ### Recommended Approach
24
+
25
+ **Keep `.claudeCodeSessions/` in your `.gitignore`**
26
+
27
+ This is the safest option. After running `claude-chats-sync init`, the tool automatically adds a commented entry to `.gitignore`. Uncomment it:
28
+
29
+ ```gitignore
30
+ # Claude Code conversation history
31
+ .claudeCodeSessions/
32
+ ```
33
+
34
+ ### If you MUST commit session files
35
+
36
+ 1. **Use environment variables for API keys** - This prevents them from appearing in session files
37
+ 2. **Use the Git filter** - Automatically cleans API keys on commit (but not 100% reliable)
38
+ 3. **Review files before committing** - Manually check for any sensitive data
39
+ 4. **Understand the risks** - No automated cleaning is 100% complete
40
+
41
+ **You are responsible for ensuring no sensitive data is committed.**
42
+
43
+ ---
44
+
45
+ ## ✨ Features
46
+
47
+ - 🔄 **Auto-sync** - Creates symlinks from Claude Code local storage to your project folder
48
+ - 📁 **Project-local history** - Chat sessions stored in your project, not user home directory
49
+ - 🔒 **Sensitive data protection** - Cleans API keys from session files
50
+ - 🎯 **Simple to use** - Initialize sync with a single command
51
+ - 📊 **Status tracking** - Check sync status and session count
52
+ - 🌳 **Git-friendly** - Configure Git filters for safe version control
53
+ - 🔧 **Cross-platform** - Works on Windows, macOS, and Linux
54
+
55
+ ## 📦 Installation
56
+
57
+ ### Install globally (recommended)
58
+
59
+ ```bash
60
+ npm install -g claude-chats-sync
61
+ ```
62
+
63
+ This allows you to use `claude-chats-sync` command from anywhere.
64
+
65
+ ### Install locally
66
+
67
+ ```bash
68
+ npm install -D claude-chats-sync
69
+ ```
70
+
71
+ Then use it via `npx`:
72
+ ```bash
73
+ npx claude-chats-sync init
74
+ ```
75
+
76
+ ## 🚀 Quick Start
77
+
78
+ ### Initialize sync
79
+
80
+ ```bash
81
+ # In your project directory
82
+ claude-chats-sync init
83
+ ```
84
+
85
+ This will:
86
+ - Create a `.claudeCodeSessions/` folder in your project
87
+ - Create a symlink in `~/.claude/projects/`
88
+ - Configure Git filter for automatic sensitive data cleaning
89
+ - Add `.claudeCodeSessions/` to `.gitignore` (commented by default)
90
+
91
+ ### Check status
92
+
93
+ ```bash
94
+ claude-chats-sync status
95
+ ```
96
+
97
+ ### Open history folder
98
+
99
+ ```bash
100
+ claude-chats-sync open
101
+ ```
102
+
103
+ ## 📖 Commands
104
+
105
+ | Command | Description |
106
+ |---------|-------------|
107
+ | `init` | Initialize sync for current project |
108
+ | `status` | Check sync status and session count |
109
+ | `open` | Open history folder in file manager |
110
+ | `clean` | Clean sensitive data from session files |
111
+ | `setup-git-filter` | Setup Git filter for automatic cleaning |
112
+ | `update` | Update Git filter to latest version (for existing projects) |
113
+ | `help` | Show help message |
114
+
115
+ ## 🔧 Usage Examples
116
+
117
+ ### Basic usage
118
+
119
+ ```bash
120
+ # Initialize sync
121
+ claude-chats-sync init
122
+
123
+ # Check status
124
+ claude-chats-sync status
125
+
126
+ # Open sessions folder
127
+ claude-chats-sync open
128
+ ```
129
+
130
+ ### Advanced options
131
+
132
+ ```bash
133
+ # Custom folder name
134
+ claude-chats-sync init --folder-name .sessions
135
+
136
+ # Force migrate existing sessions
137
+ claude-chats-sync init --force
138
+
139
+ # Specify project path
140
+ claude-chats-sync init --project-path /path/to/project
141
+ ```
142
+
143
+ ### Cleaning sensitive data
144
+
145
+ ```bash
146
+ # Manual cleanup
147
+ claude-chats-sync clean
148
+
149
+ # Setup Git auto-filter
150
+ claude-chats-sync setup-git-filter
151
+
152
+ # Update Git filter (for existing projects)
153
+ claude-chats-sync update
154
+ ```
155
+
156
+ > **Note**: If you initialized your project with an older version (before v0.0.8), run `claude-chats-sync update` to get the latest Git filter features including path cleaning and smudge filter.
157
+
158
+ ## ⚙️ Environment Variables (Recommended)
159
+
160
+ Configure API keys via environment variables to prevent them from appearing in session files:
161
+
162
+ **Linux/macOS** - Add to `~/.bashrc` or `~/.zshrc`:
163
+ ```bash
164
+ export ANTHROPIC_AUTH_TOKEN="sk-ant-..."
165
+ export ANTHROPIC_BASE_URL="https://api.example.com" # Optional: for third-party API
166
+ ```
167
+
168
+ **Windows PowerShell**:
169
+ ```powershell
170
+ $env:ANTHROPIC_AUTH_TOKEN="sk-ant-..."
171
+ $env:ANTHROPIC_BASE_URL="https://api.example.com"
172
+ ```
173
+
174
+ **Windows CMD (permanent)**:
175
+ ```cmd
176
+ setx ANTHROPIC_AUTH_TOKEN "sk-ant-..."
177
+ setx ANTHROPIC_BASE_URL "https://api.example.com"
178
+ ```
179
+
180
+ ## 🔒 Security & Version Control
181
+
182
+ ### Options for securing API keys
183
+
184
+ **Option 1: Use environment variables (Recommended)**
185
+
186
+ Configure Claude Code to use API keys from environment variables. This prevents them from appearing in session files entirely.
187
+
188
+ **Option 2: Use Git filter**
189
+
190
+ If you store API keys in config files, the Git filter automatically cleans them on commit.
191
+
192
+ ### Git filter usage
193
+
194
+ After initialization, commit normally:
195
+
196
+ ```bash
197
+ git add .claudeCodeSessions/
198
+ git commit -m "Add conversation history"
199
+
200
+ # API keys are automatically replaced with [REDACTED]
201
+ # Your local files remain unchanged
202
+ ```
203
+
204
+ ### Complete Git ignore (safest)
205
+
206
+ **RECOMMENDED**: Ignore session files entirely. Uncomment in `.gitignore`:
207
+
208
+ ```gitignore
209
+ .claudeCodeSessions/
210
+ ```
211
+
212
+ This prevents accidentally committing sensitive data to your repository.
213
+
214
+ ## 🌐 How It Works
215
+
216
+ Claude Code stores chat sessions in `~/.claude/projects/{normalized-project-path}/`.
217
+
218
+ This CLI creates a symbolic link to a folder in your project (default: `.claudeCodeSessions/`), making the chat history part of your project.
219
+
220
+ ### Example structure
221
+
222
+ ```
223
+ Your Project/
224
+ ├── src/
225
+ ├── .claudeCodeSessions/ # Chat sessions (synced with ~/.claude)
226
+ │ ├── session-abc123.jsonl
227
+ │ └── session-def456.jsonl
228
+ ├── .gitignore # Auto-updated
229
+ ├── .gitattributes # Git filter configuration
230
+ └── package.json
231
+ ```
232
+
233
+ ## 🔄 Syncing Across Machines
234
+
235
+ If you choose to sync session files:
236
+
237
+ 1. Commit the `.claudeCodeSessions/` folder
238
+ 2. Push to GitHub
239
+ 3. Pull on another machine
240
+ 4. Run `claude-chats-sync init` to create the symlink
241
+
242
+ ## 🔧 Platform-specific Notes
243
+
244
+ ### Windows
245
+ - Uses junction points (no admin privileges required)
246
+ - Supports PowerShell and CMD
247
+ - Run PowerShell scripts may require: `Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser`
248
+
249
+ ### macOS
250
+ - Requires execute permissions: `chmod +x $(which claude-chats-sync)`
251
+ - Uses standard symbolic links
252
+
253
+ ### Linux
254
+ - Requires execute permissions: `chmod +x $(which claude-chats-sync)`
255
+ - Uses standard symbolic links
256
+
257
+ ## 🐛 Troubleshooting
258
+
259
+ ### Symlink creation fails (Windows)
260
+
261
+ The tool uses junction points which work without admin privileges. If issues persist:
262
+ - Ensure Node.js is in your PATH
263
+ - Try running as administrator
264
+ - Check that your project path doesn't contain special characters
265
+
266
+ ### History not syncing
267
+
268
+ 1. Check if symlink exists:
269
+ - Windows: `dir %USERPROFILE%\.claude\projects`
270
+ - macOS/Linux: `ls -la ~/.claude/projects`
271
+
272
+ 2. Verify symlink points to your project's `.claudeCodeSessions/` folder
273
+
274
+ ### Reinitialize
275
+
276
+ Delete existing symlink:
277
+
278
+ ```bash
279
+ # Windows
280
+ rmdir "%USERPROFILE%\.claude\projects\{project-name}"
281
+
282
+ # macOS/Linux
283
+ rm ~/.claude/projects/{project-name}
284
+ ```
285
+
286
+ Then run `claude-chats-sync init` again.
287
+
288
+ ## 📚 Related Projects
289
+
290
+ - [VSCode Extension](https://marketplace.visualstudio.com/items?itemName=tubo.claude-code-chats-sync) - Full-featured VSCode extension with the same functionality
291
+
292
+ ## 💰 Token Usage & Cost Considerations
293
+
294
+ > ⚠️ **IMPORTANT**: When sharing session files, each team member uses their own API key and incurs their own API costs.
295
+
296
+ ### Key points
297
+
298
+ 1. **Each member pays for their own usage**
299
+ - Every team member must configure their own API key
300
+ - When you continue a shared conversation, **you pay for all new tokens** generated
301
+ - The original creator's API key is **never** used
302
+
303
+ 2. **Context window considerations**
304
+ - Long shared conversations consume more tokens as context
305
+ - A shared conversation with 50,000 tokens will consume ~50,000 input tokens each time a new member continues it
306
+
307
+ 3. **Cost-saving best practices**
308
+ - Generate conversation summaries before sharing
309
+ - Start new conversations when possible
310
+ - Archive old sessions
311
+ - Monitor your API usage
312
+
313
+ For detailed cost considerations, see [Token Usage Guide](TOKEN_USAGE.md).
314
+
315
+ ## 📝 License
316
+
317
+ MIT - see [LICENSE](LICENSE) file for details
318
+
319
+ ## 🤝 Contributing
320
+
321
+ Contributions are welcome! Please open an issue or submit a pull request.
322
+
323
+ ## 📞 Support
324
+
325
+ - 📧 [Issues](https://github.com/tubo70/claude-chats-sync-cli/issues)
326
+ - 📖 [Documentation](https://github.com/tubo70/claude-chats-sync-cli/wiki)
327
+ - 💬 [Discussions](https://github.com/tubo70/claude-chats-sync-cli/discussions)
328
+
329
+ ## 🔗 Links
330
+
331
+ - [npm](https://www.npmjs.com/package/claude-chats-sync)
332
+ - [GitHub](https://github.com/tubo70/claude-chats-sync-cli)
333
+ - [VSCode Marketplace](https://marketplace.visualstudio.com/items?itemName=tubo.claude-code-chats-sync)
334
+
335
+ ---
336
+
337
+ Made with ❤️ by [tubo70](https://github.com/tubo70)