claude-code-backup 1.0.0 → 1.0.1
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 +64 -64
- package/bin/{claude-backup.js → claude-code-backup.js} +2 -2
- package/package.json +4 -4
- package/src/backends/github.js +66 -66
- package/src/commands/config-cmd.js +7 -7
- package/src/commands/init.js +6 -6
- package/src/commands/pull.js +1 -1
- package/src/commands/service.js +2 -2
- package/src/commands/status.js +2 -2
- package/src/core/config.js +4 -4
package/README.md
CHANGED
|
@@ -54,7 +54,7 @@ None of this is synced by Anthropic. A new machine, an accidental `rm -rf ~/.cla
|
|
|
54
54
|
npm install -g claude-code-backup
|
|
55
55
|
```
|
|
56
56
|
|
|
57
|
-
Installs the `claude-backup` command globally.
|
|
57
|
+
Installs the `claude-code-backup` command globally.
|
|
58
58
|
|
|
59
59
|
---
|
|
60
60
|
|
|
@@ -62,16 +62,16 @@ Installs the `claude-backup` command globally.
|
|
|
62
62
|
|
|
63
63
|
```bash
|
|
64
64
|
# 1. Run the setup wizard
|
|
65
|
-
claude-backup init
|
|
65
|
+
claude-code-backup init
|
|
66
66
|
|
|
67
67
|
# 2. Do your first manual backup
|
|
68
|
-
claude-backup push
|
|
68
|
+
claude-code-backup push
|
|
69
69
|
|
|
70
70
|
# 3. Install the background service (auto-syncs on every login)
|
|
71
|
-
claude-backup service install
|
|
71
|
+
claude-code-backup service install
|
|
72
72
|
|
|
73
73
|
# 4. Check everything is working
|
|
74
|
-
claude-backup status
|
|
74
|
+
claude-code-backup status
|
|
75
75
|
```
|
|
76
76
|
|
|
77
77
|
That's it. From this point the watcher runs silently in the background and pushes every change to your private GitHub repo.
|
|
@@ -81,20 +81,20 @@ That's it. From this point the watcher runs silently in the background and pushe
|
|
|
81
81
|
## Setup Wizard (`init`)
|
|
82
82
|
|
|
83
83
|
```
|
|
84
|
-
$ claude-backup init
|
|
84
|
+
$ claude-code-backup init
|
|
85
85
|
|
|
86
86
|
Claude Backup — Setup Wizard
|
|
87
87
|
|
|
88
88
|
Step 1 of 4 — GitHub Personal Access Token
|
|
89
89
|
|
|
90
|
-
claude-backup needs a PAT with "repo" scope to create
|
|
90
|
+
claude-code-backup needs a PAT with "repo" scope to create
|
|
91
91
|
and push to a private GitHub repository on your behalf.
|
|
92
92
|
|
|
93
93
|
Create your token here:
|
|
94
94
|
https://github.com/settings/tokens/new
|
|
95
95
|
|
|
96
96
|
Instructions:
|
|
97
|
-
1. Note name → e.g. "claude-backup"
|
|
97
|
+
1. Note name → e.g. "claude-code-backup"
|
|
98
98
|
2. Expiration → your preference (No expiration is fine)
|
|
99
99
|
3. Scopes → tick repo (the top-level checkbox)
|
|
100
100
|
4. Click "Generate token" and copy the value
|
|
@@ -102,7 +102,7 @@ Step 1 of 4 — GitHub Personal Access Token
|
|
|
102
102
|
? Paste your GitHub PAT: ****
|
|
103
103
|
|
|
104
104
|
Step 2 of 4 — Repository & Branch
|
|
105
|
-
? GitHub repo name (e.g. yourname/claude-backup): yourname/claude-backup
|
|
105
|
+
? GitHub repo name (e.g. yourname/claude-code-backup): yourname/claude-code-backup
|
|
106
106
|
? Branch name: main
|
|
107
107
|
|
|
108
108
|
Step 3 of 4 — Watched Directories & Filters
|
|
@@ -114,37 +114,37 @@ Step 4 of 4 — Project CLAUDE.md Files
|
|
|
114
114
|
? Project root directories with CLAUDE.md (blank to skip): /Users/you/projects/my-app
|
|
115
115
|
|
|
116
116
|
✔ Config saved
|
|
117
|
-
✔ Created: github.com/yourname/claude-backup
|
|
117
|
+
✔ Created: github.com/yourname/claude-code-backup
|
|
118
118
|
✔ Repo cloned
|
|
119
119
|
✔ GitHub setup complete
|
|
120
120
|
```
|
|
121
121
|
|
|
122
122
|
The wizard:
|
|
123
123
|
- Creates the GitHub repo as **private** if it doesn't exist
|
|
124
|
-
- Clones it locally to `~/.config/claude-backup/repo/`
|
|
124
|
+
- Clones it locally to `~/.config/claude-code-backup/repo/`
|
|
125
125
|
- Writes a detailed `README.md` into your backup repo documenting the structure and restore process
|
|
126
126
|
|
|
127
127
|
---
|
|
128
128
|
|
|
129
129
|
## Command Reference
|
|
130
130
|
|
|
131
|
-
### `claude-backup init`
|
|
131
|
+
### `claude-code-backup init`
|
|
132
132
|
|
|
133
133
|
Interactive setup wizard. Run once to configure, or again at any time to update settings.
|
|
134
134
|
|
|
135
135
|
```bash
|
|
136
|
-
claude-backup init
|
|
136
|
+
claude-code-backup init
|
|
137
137
|
```
|
|
138
138
|
|
|
139
139
|
---
|
|
140
140
|
|
|
141
|
-
### `claude-backup push`
|
|
141
|
+
### `claude-code-backup push`
|
|
142
142
|
|
|
143
143
|
Manually push a backup to GitHub right now.
|
|
144
144
|
|
|
145
145
|
```bash
|
|
146
|
-
claude-backup push # auto commit message: "backup: <ISO timestamp>"
|
|
147
|
-
claude-backup push -m "before OS upgrade" # custom commit message
|
|
146
|
+
claude-code-backup push # auto commit message: "backup: <ISO timestamp>"
|
|
147
|
+
claude-code-backup push -m "before OS upgrade" # custom commit message
|
|
148
148
|
```
|
|
149
149
|
|
|
150
150
|
What it does:
|
|
@@ -158,17 +158,17 @@ What it does:
|
|
|
158
158
|
|
|
159
159
|
---
|
|
160
160
|
|
|
161
|
-
### `claude-backup pull`
|
|
161
|
+
### `claude-code-backup pull`
|
|
162
162
|
|
|
163
163
|
Restore files from your GitHub backup.
|
|
164
164
|
|
|
165
165
|
```bash
|
|
166
|
-
claude-backup pull # restore the latest backup
|
|
167
|
-
claude-backup pull --history # browse commits, pick a specific version
|
|
168
|
-
claude-backup pull --dry-run # preview what would change — no files written
|
|
166
|
+
claude-code-backup pull # restore the latest backup
|
|
167
|
+
claude-code-backup pull --history # browse commits, pick a specific version
|
|
168
|
+
claude-code-backup pull --dry-run # preview what would change — no files written
|
|
169
169
|
```
|
|
170
170
|
|
|
171
|
-
**Safety:** before touching any file, `pull` creates a timestamped snapshot of your current state at `~/.config/claude-backup/pre-restore-<timestamp>/`. You can always manually recover from there.
|
|
171
|
+
**Safety:** before touching any file, `pull` creates a timestamped snapshot of your current state at `~/.config/claude-code-backup/pre-restore-<timestamp>/`. You can always manually recover from there.
|
|
172
172
|
|
|
173
173
|
Restore works on:
|
|
174
174
|
- **Same machine** — recover from accidental deletion
|
|
@@ -177,13 +177,13 @@ Restore works on:
|
|
|
177
177
|
|
|
178
178
|
---
|
|
179
179
|
|
|
180
|
-
### `claude-backup watch`
|
|
180
|
+
### `claude-code-backup watch`
|
|
181
181
|
|
|
182
182
|
Start the real-time file watcher. Normally this runs via the launchd service — use this command to run it manually in the foreground.
|
|
183
183
|
|
|
184
184
|
```bash
|
|
185
|
-
claude-backup watch # file watcher (recommended)
|
|
186
|
-
claude-backup watch --interval 5 # poll every 5 minutes instead
|
|
185
|
+
claude-code-backup watch # file watcher (recommended)
|
|
186
|
+
claude-code-backup watch --interval 5 # poll every 5 minutes instead
|
|
187
187
|
```
|
|
188
188
|
|
|
189
189
|
The watcher:
|
|
@@ -194,12 +194,12 @@ The watcher:
|
|
|
194
194
|
|
|
195
195
|
---
|
|
196
196
|
|
|
197
|
-
### `claude-backup status`
|
|
197
|
+
### `claude-code-backup status`
|
|
198
198
|
|
|
199
199
|
Show the current state of your backup.
|
|
200
200
|
|
|
201
201
|
```
|
|
202
|
-
$ claude-backup status
|
|
202
|
+
$ claude-code-backup status
|
|
203
203
|
|
|
204
204
|
Claude Backup Status
|
|
205
205
|
|
|
@@ -211,7 +211,7 @@ Project CLAUDE.md dirs:
|
|
|
211
211
|
/Users/you/projects/my-app
|
|
212
212
|
CLAUDE.md files: 1
|
|
213
213
|
|
|
214
|
-
GitHub: yourname/claude-backup [main]
|
|
214
|
+
GitHub: yourname/claude-code-backup [main]
|
|
215
215
|
Last backup: 2026-05-18 10:34:22
|
|
216
216
|
Commit: a3f9c1d backup: 2026-05-18T10:34:22.000Z
|
|
217
217
|
Sync status: Up to date
|
|
@@ -221,43 +221,43 @@ Auto-sync service: running (PID 4821)
|
|
|
221
221
|
|
|
222
222
|
---
|
|
223
223
|
|
|
224
|
-
### `claude-backup service <action>`
|
|
224
|
+
### `claude-code-backup service <action>`
|
|
225
225
|
|
|
226
226
|
Manage the macOS launchd background service.
|
|
227
227
|
|
|
228
228
|
```bash
|
|
229
|
-
claude-backup service install # write plist, load service, start immediately
|
|
230
|
-
claude-backup service uninstall # stop service, remove plist
|
|
231
|
-
claude-backup service status # check if running, show PID
|
|
232
|
-
claude-backup service logs # tail the watcher log in real-time
|
|
229
|
+
claude-code-backup service install # write plist, load service, start immediately
|
|
230
|
+
claude-code-backup service uninstall # stop service, remove plist
|
|
231
|
+
claude-code-backup service status # check if running, show PID
|
|
232
|
+
claude-code-backup service logs # tail the watcher log in real-time
|
|
233
233
|
```
|
|
234
234
|
|
|
235
235
|
The service plist is installed at:
|
|
236
236
|
|
|
237
237
|
```
|
|
238
|
-
~/Library/LaunchAgents/com.claude-backup.watch.plist
|
|
238
|
+
~/Library/LaunchAgents/com.claude-code-backup.watch.plist
|
|
239
239
|
```
|
|
240
240
|
|
|
241
241
|
Key behaviour:
|
|
242
242
|
- `RunAtLoad: true` — starts immediately when installed, and on every login
|
|
243
243
|
- `KeepAlive: true` — launchd restarts the watcher automatically if it crashes
|
|
244
244
|
- `ThrottleInterval: 10` — prevents restart storms
|
|
245
|
-
- Logs go to `~/.config/claude-backup/watch.log`
|
|
246
|
-
- Errors go to `~/.config/claude-backup/watch.error.log`
|
|
245
|
+
- Logs go to `~/.config/claude-code-backup/watch.log`
|
|
246
|
+
- Errors go to `~/.config/claude-code-backup/watch.error.log`
|
|
247
247
|
|
|
248
248
|
---
|
|
249
249
|
|
|
250
|
-
### `claude-backup config <action>`
|
|
250
|
+
### `claude-code-backup config <action>`
|
|
251
251
|
|
|
252
252
|
View or modify configuration without re-running `init`.
|
|
253
253
|
|
|
254
254
|
```bash
|
|
255
|
-
claude-backup config show # print config (PAT masked)
|
|
256
|
-
claude-backup config set auto_sync.debounce_ms 3000 # change a value
|
|
257
|
-
claude-backup config add-dir <path> # fully mirror an extra directory
|
|
258
|
-
claude-backup config remove-dir <path>
|
|
259
|
-
claude-backup config add-project <path> # back up only CLAUDE.md from a project root
|
|
260
|
-
claude-backup config remove-project <path>
|
|
255
|
+
claude-code-backup config show # print config (PAT masked)
|
|
256
|
+
claude-code-backup config set auto_sync.debounce_ms 3000 # change a value
|
|
257
|
+
claude-code-backup config add-dir <path> # fully mirror an extra directory
|
|
258
|
+
claude-code-backup config remove-dir <path>
|
|
259
|
+
claude-code-backup config add-project <path> # back up only CLAUDE.md from a project root
|
|
260
|
+
claude-code-backup config remove-project <path>
|
|
261
261
|
```
|
|
262
262
|
|
|
263
263
|
---
|
|
@@ -271,7 +271,7 @@ Claude Code lets you put a `CLAUDE.md` file at any project root. Claude reads it
|
|
|
271
271
|
```bash
|
|
272
272
|
# Add a project during init (Step 4)
|
|
273
273
|
# Or add it later:
|
|
274
|
-
claude-backup config add-project /Users/you/projects/my-app
|
|
274
|
+
claude-code-backup config add-project /Users/you/projects/my-app
|
|
275
275
|
```
|
|
276
276
|
|
|
277
277
|
In the backup repo, it appears as:
|
|
@@ -315,7 +315,7 @@ Every push is a Git commit — you get full history, diffs, and can restore any
|
|
|
315
315
|
|
|
316
316
|
## Configuration Reference
|
|
317
317
|
|
|
318
|
-
Config file: `~/.config/claude-backup/config.json` (chmod 600)
|
|
318
|
+
Config file: `~/.config/claude-code-backup/config.json` (chmod 600)
|
|
319
319
|
|
|
320
320
|
| Key | Type | Default | Description |
|
|
321
321
|
|---|---|---|---|
|
|
@@ -329,7 +329,7 @@ Config file: `~/.config/claude-backup/config.json` (chmod 600)
|
|
|
329
329
|
|
|
330
330
|
Default excludes: `settings.local.json`, `*.log`, `.DS_Store`
|
|
331
331
|
|
|
332
|
-
Local repo clone: `~/.config/claude-backup/repo/`
|
|
332
|
+
Local repo clone: `~/.config/claude-code-backup/repo/`
|
|
333
333
|
|
|
334
334
|
---
|
|
335
335
|
|
|
@@ -338,22 +338,22 @@ Local repo clone: `~/.config/claude-backup/repo/`
|
|
|
338
338
|
### After accidental deletion (same machine)
|
|
339
339
|
|
|
340
340
|
```bash
|
|
341
|
-
claude-backup pull
|
|
341
|
+
claude-code-backup pull
|
|
342
342
|
```
|
|
343
343
|
|
|
344
344
|
### Setting up a new machine
|
|
345
345
|
|
|
346
346
|
```bash
|
|
347
347
|
npm install -g claude-code-backup
|
|
348
|
-
claude-backup init # use same repo name, generate a new PAT
|
|
349
|
-
claude-backup pull
|
|
350
|
-
claude-backup service install
|
|
348
|
+
claude-code-backup init # use same repo name, generate a new PAT
|
|
349
|
+
claude-code-backup pull
|
|
350
|
+
claude-code-backup service install
|
|
351
351
|
```
|
|
352
352
|
|
|
353
353
|
### Restoring a specific historical version
|
|
354
354
|
|
|
355
355
|
```bash
|
|
356
|
-
claude-backup pull --history
|
|
356
|
+
claude-code-backup pull --history
|
|
357
357
|
```
|
|
358
358
|
|
|
359
359
|
Shows a list of all commits — pick the one you want by timestamp and message.
|
|
@@ -363,7 +363,7 @@ Shows a list of all commits — pick the one you want by timestamp and message.
|
|
|
363
363
|
Every `pull` creates a safety snapshot first:
|
|
364
364
|
|
|
365
365
|
```bash
|
|
366
|
-
ls ~/.config/claude-backup/pre-restore-*/
|
|
366
|
+
ls ~/.config/claude-code-backup/pre-restore-*/
|
|
367
367
|
# Copy what you need back manually
|
|
368
368
|
```
|
|
369
369
|
|
|
@@ -371,34 +371,34 @@ ls ~/.config/claude-backup/pre-restore-*/
|
|
|
371
371
|
|
|
372
372
|
## Troubleshooting
|
|
373
373
|
|
|
374
|
-
**"Not configured. Run: claude-backup init"**
|
|
375
|
-
Config file is missing. Re-run `claude-backup init`.
|
|
374
|
+
**"Not configured. Run: claude-code-backup init"**
|
|
375
|
+
Config file is missing. Re-run `claude-code-backup init`.
|
|
376
376
|
|
|
377
377
|
**Push fails with 401 or authentication error**
|
|
378
378
|
Your PAT may have expired. Generate a new one and update:
|
|
379
379
|
```bash
|
|
380
|
-
claude-backup config set github.pat <new-token>
|
|
381
|
-
claude-backup service install # restart the watcher with the new token
|
|
380
|
+
claude-code-backup config set github.pat <new-token>
|
|
381
|
+
claude-code-backup service install # restart the watcher with the new token
|
|
382
382
|
```
|
|
383
383
|
|
|
384
384
|
**Service shows "loaded but not running"**
|
|
385
385
|
```bash
|
|
386
|
-
claude-backup service logs
|
|
387
|
-
cat ~/.config/claude-backup/watch.error.log
|
|
388
|
-
claude-backup service install # reinstall to reset
|
|
386
|
+
claude-code-backup service logs
|
|
387
|
+
cat ~/.config/claude-code-backup/watch.error.log
|
|
388
|
+
claude-code-backup service install # reinstall to reset
|
|
389
389
|
```
|
|
390
390
|
|
|
391
391
|
**Changes not being detected**
|
|
392
392
|
Confirm the directory is watched:
|
|
393
393
|
```bash
|
|
394
|
-
claude-backup config show
|
|
395
|
-
claude-backup config add-dir /missing/path
|
|
394
|
+
claude-code-backup config show
|
|
395
|
+
claude-code-backup config add-dir /missing/path
|
|
396
396
|
```
|
|
397
397
|
|
|
398
398
|
**Want to watch a project directory without backing up all source code**
|
|
399
399
|
Use `add-project` instead of `add-dir` — it only collects the `CLAUDE.md` file:
|
|
400
400
|
```bash
|
|
401
|
-
claude-backup config add-project /path/to/project
|
|
401
|
+
claude-code-backup config add-project /path/to/project
|
|
402
402
|
```
|
|
403
403
|
|
|
404
404
|
---
|
|
@@ -417,7 +417,7 @@ claude-backup config add-project /path/to/project
|
|
|
417
417
|
└─ grab CLAUDE.md from claude_md_dirs
|
|
418
418
|
│
|
|
419
419
|
▼
|
|
420
|
-
copy to ~/.config/claude-backup/repo/
|
|
420
|
+
copy to ~/.config/claude-code-backup/repo/
|
|
421
421
|
write backup-manifest.json
|
|
422
422
|
write README.md
|
|
423
423
|
│
|
|
@@ -425,7 +425,7 @@ claude-backup config add-project /path/to/project
|
|
|
425
425
|
git add -A → git commit → git push
|
|
426
426
|
│
|
|
427
427
|
▼
|
|
428
|
-
github.com/you/claude-backup (private)
|
|
428
|
+
github.com/you/claude-code-backup (private)
|
|
429
429
|
```
|
|
430
430
|
|
|
431
431
|
---
|
|
@@ -438,7 +438,7 @@ Contributions are welcome. Please open an issue first for any significant change
|
|
|
438
438
|
git clone https://github.com/mafzal9/claude-code-backup.git
|
|
439
439
|
cd claude-code-backup
|
|
440
440
|
npm install
|
|
441
|
-
node bin/claude-backup.js --help
|
|
441
|
+
node bin/claude-code-backup.js --help
|
|
442
442
|
```
|
|
443
443
|
|
|
444
444
|
Ideas for future contributions:
|
|
@@ -10,9 +10,9 @@ import { runService } from '../src/commands/service.js';
|
|
|
10
10
|
import { runConfig } from '../src/commands/config-cmd.js';
|
|
11
11
|
|
|
12
12
|
program
|
|
13
|
-
.name('claude-backup')
|
|
13
|
+
.name('claude-code-backup')
|
|
14
14
|
.description('Backup and auto-sync Claude Code memory and settings to GitHub')
|
|
15
|
-
.version('1.0.
|
|
15
|
+
.version('1.0.1');
|
|
16
16
|
|
|
17
17
|
program
|
|
18
18
|
.command('init')
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-code-backup",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Backup and auto-sync Claude Code memory, settings, and CLAUDE.md files to a private GitHub repo — with real-time file watching and macOS launchd auto-start",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
|
-
"claude-backup": "
|
|
7
|
+
"claude-code-backup": "bin/claude-code-backup.js"
|
|
8
8
|
},
|
|
9
9
|
"files": [
|
|
10
|
-
"bin/",
|
|
10
|
+
"bin/claude-code-backup.js",
|
|
11
11
|
"src/",
|
|
12
12
|
"README.md",
|
|
13
13
|
"LICENSE"
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"homepage": "https://github.com/mafzal9/claude-code-backup#readme",
|
|
38
38
|
"repository": {
|
|
39
39
|
"type": "git",
|
|
40
|
-
"url": "https://github.com/mafzal9/claude-code-backup.git"
|
|
40
|
+
"url": "git+https://github.com/mafzal9/claude-code-backup.git"
|
|
41
41
|
},
|
|
42
42
|
"bugs": {
|
|
43
43
|
"url": "https://github.com/mafzal9/claude-code-backup/issues"
|
package/src/backends/github.js
CHANGED
|
@@ -16,8 +16,8 @@ function repoGit() {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
async function configureGit(g) {
|
|
19
|
-
await g.addConfig('user.email', 'claude-backup@local', false, 'local');
|
|
20
|
-
await g.addConfig('user.name', 'claude-backup', false, 'local');
|
|
19
|
+
await g.addConfig('user.email', 'claude-code-backup@local', false, 'local');
|
|
20
|
+
await g.addConfig('user.name', 'claude-code-backup', false, 'local');
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
async function syncRemote(g, config) {
|
|
@@ -36,11 +36,11 @@ function buildReadme(config) {
|
|
|
36
36
|
const claudeMdDirs = config.claude_md_dirs || [];
|
|
37
37
|
const claudeMdList = claudeMdDirs.length
|
|
38
38
|
? claudeMdDirs.map(d => `- \`${d}/CLAUDE.md\``).join('\n')
|
|
39
|
-
: '_No project CLAUDE.md dirs configured yet._\n\nAdd one with: `claude-backup config add-project /path/to/project`';
|
|
39
|
+
: '_No project CLAUDE.md dirs configured yet._\n\nAdd one with: `claude-code-backup config add-project /path/to/project`';
|
|
40
40
|
|
|
41
41
|
return `# Claude Code Backup
|
|
42
42
|
|
|
43
|
-
> Auto-synced by [claude-backup](https://www.npmjs.com/package/claude-backup) — a CLI tool that watches your Claude Code data directories and commits every change to this private repo.
|
|
43
|
+
> Auto-synced by [claude-code-backup](https://www.npmjs.com/package/claude-code-backup) — a CLI tool that watches your Claude Code data directories and commits every change to this private repo.
|
|
44
44
|
|
|
45
45
|
**Repo:** \`${config.github.repo}\` · **Branch:** \`${config.github.branch}\` · **Last setup:** ${now}
|
|
46
46
|
|
|
@@ -81,8 +81,8 @@ ${claudeMdList}
|
|
|
81
81
|
|
|
82
82
|
Add or remove projects at any time:
|
|
83
83
|
\`\`\`bash
|
|
84
|
-
claude-backup config add-project /path/to/project
|
|
85
|
-
claude-backup config remove-project /path/to/project
|
|
84
|
+
claude-code-backup config add-project /path/to/project
|
|
85
|
+
claude-code-backup config remove-project /path/to/project
|
|
86
86
|
\`\`\`
|
|
87
87
|
|
|
88
88
|
---
|
|
@@ -141,7 +141,7 @@ These files are the most valuable thing to back up because they accumulate over
|
|
|
141
141
|
## Installation
|
|
142
142
|
|
|
143
143
|
\`\`\`bash
|
|
144
|
-
npm install -g claude-backup
|
|
144
|
+
npm install -g claude-code-backup
|
|
145
145
|
\`\`\`
|
|
146
146
|
|
|
147
147
|
Requires Node.js 18 or later.
|
|
@@ -150,12 +150,12 @@ Requires Node.js 18 or later.
|
|
|
150
150
|
|
|
151
151
|
## Command Reference
|
|
152
152
|
|
|
153
|
-
### \`claude-backup init\`
|
|
153
|
+
### \`claude-code-backup init\`
|
|
154
154
|
|
|
155
155
|
Interactive setup wizard. Run this once (or again to reconfigure).
|
|
156
156
|
|
|
157
157
|
\`\`\`
|
|
158
|
-
$ claude-backup init
|
|
158
|
+
$ claude-code-backup init
|
|
159
159
|
|
|
160
160
|
Step 1 of 3 — GitHub Personal Access Token
|
|
161
161
|
Create your token here: https://github.com/settings/tokens/new
|
|
@@ -164,7 +164,7 @@ Step 1 of 3 — GitHub Personal Access Token
|
|
|
164
164
|
? Paste your GitHub PAT: ****
|
|
165
165
|
|
|
166
166
|
Step 2 of 3 — Repository & Branch
|
|
167
|
-
? GitHub repo name: yourname/claude-backup
|
|
167
|
+
? GitHub repo name: yourname/claude-code-backup
|
|
168
168
|
? Branch name: main
|
|
169
169
|
|
|
170
170
|
Step 3 of 3 — Watched Directories & Filters
|
|
@@ -174,20 +174,20 @@ Step 3 of 3 — Watched Directories & Filters
|
|
|
174
174
|
\`\`\`
|
|
175
175
|
|
|
176
176
|
What it does:
|
|
177
|
-
- Saves config to \`~/.config/claude-backup/config.json\` (chmod 600)
|
|
177
|
+
- Saves config to \`~/.config/claude-code-backup/config.json\` (chmod 600)
|
|
178
178
|
- Creates this GitHub repo as private if it doesn't exist
|
|
179
|
-
- Clones the repo locally to \`~/.config/claude-backup/repo/\`
|
|
179
|
+
- Clones the repo locally to \`~/.config/claude-code-backup/repo/\`
|
|
180
180
|
- Writes this README into the repo
|
|
181
181
|
|
|
182
182
|
---
|
|
183
183
|
|
|
184
|
-
### \`claude-backup push\`
|
|
184
|
+
### \`claude-code-backup push\`
|
|
185
185
|
|
|
186
186
|
Manually push a backup right now.
|
|
187
187
|
|
|
188
188
|
\`\`\`bash
|
|
189
|
-
claude-backup push # auto commit message: "backup: <ISO timestamp>"
|
|
190
|
-
claude-backup push -m "before upgrade" # custom commit message
|
|
189
|
+
claude-code-backup push # auto commit message: "backup: <ISO timestamp>"
|
|
190
|
+
claude-code-backup push -m "before upgrade" # custom commit message
|
|
191
191
|
\`\`\`
|
|
192
192
|
|
|
193
193
|
What it does:
|
|
@@ -199,17 +199,17 @@ What it does:
|
|
|
199
199
|
|
|
200
200
|
---
|
|
201
201
|
|
|
202
|
-
### \`claude-backup pull\`
|
|
202
|
+
### \`claude-code-backup pull\`
|
|
203
203
|
|
|
204
204
|
Restore files from this repo back to their original locations.
|
|
205
205
|
|
|
206
206
|
\`\`\`bash
|
|
207
|
-
claude-backup pull # restore the latest backup
|
|
208
|
-
claude-backup pull --history # browse commits, pick a specific version
|
|
209
|
-
claude-backup pull --dry-run # preview what would be restored — no files written
|
|
207
|
+
claude-code-backup pull # restore the latest backup
|
|
208
|
+
claude-code-backup pull --history # browse commits, pick a specific version
|
|
209
|
+
claude-code-backup pull --dry-run # preview what would be restored — no files written
|
|
210
210
|
\`\`\`
|
|
211
211
|
|
|
212
|
-
**Safety:** before writing anything, \`pull\` creates a timestamped snapshot of your current state at \`~/.config/claude-backup/pre-restore-<timestamp>/\` so you can always undo.
|
|
212
|
+
**Safety:** before writing anything, \`pull\` creates a timestamped snapshot of your current state at \`~/.config/claude-code-backup/pre-restore-<timestamp>/\` so you can always undo.
|
|
213
213
|
|
|
214
214
|
Restore flow:
|
|
215
215
|
1. \`git fetch origin\` to get latest from GitHub
|
|
@@ -221,13 +221,13 @@ Restore flow:
|
|
|
221
221
|
|
|
222
222
|
---
|
|
223
223
|
|
|
224
|
-
### \`claude-backup watch\`
|
|
224
|
+
### \`claude-code-backup watch\`
|
|
225
225
|
|
|
226
226
|
Start the real-time file watcher. Detects changes in watched directories and auto-pushes to GitHub.
|
|
227
227
|
|
|
228
228
|
\`\`\`bash
|
|
229
|
-
claude-backup watch # real-time via chokidar (recommended)
|
|
230
|
-
claude-backup watch --interval 5 # poll every 5 minutes instead
|
|
229
|
+
claude-code-backup watch # real-time via chokidar (recommended)
|
|
230
|
+
claude-code-backup watch --interval 5 # poll every 5 minutes instead
|
|
231
231
|
\`\`\`
|
|
232
232
|
|
|
233
233
|
The watcher:
|
|
@@ -241,12 +241,12 @@ In normal use you don't run this directly — the launchd service runs it for yo
|
|
|
241
241
|
|
|
242
242
|
---
|
|
243
243
|
|
|
244
|
-
### \`claude-backup status\`
|
|
244
|
+
### \`claude-code-backup status\`
|
|
245
245
|
|
|
246
246
|
Show a summary of the current state.
|
|
247
247
|
|
|
248
248
|
\`\`\`
|
|
249
|
-
$ claude-backup status
|
|
249
|
+
$ claude-code-backup status
|
|
250
250
|
|
|
251
251
|
Claude Backup Status
|
|
252
252
|
|
|
@@ -255,7 +255,7 @@ Watched dirs:
|
|
|
255
255
|
|
|
256
256
|
Files tracked: 42
|
|
257
257
|
|
|
258
|
-
GitHub: yourname/claude-backup [main]
|
|
258
|
+
GitHub: yourname/claude-code-backup [main]
|
|
259
259
|
Last backup: 2026-05-18 10:34:22
|
|
260
260
|
Commit: a3f9c1d backup: 2026-05-18T10:34:22.000Z
|
|
261
261
|
Sync status: Up to date
|
|
@@ -265,40 +265,40 @@ Auto-sync service: running (PID 1234)
|
|
|
265
265
|
|
|
266
266
|
---
|
|
267
267
|
|
|
268
|
-
### \`claude-backup service <action>\`
|
|
268
|
+
### \`claude-code-backup service <action>\`
|
|
269
269
|
|
|
270
270
|
Manage the macOS launchd background service that runs the file watcher automatically on every login.
|
|
271
271
|
|
|
272
272
|
\`\`\`bash
|
|
273
|
-
claude-backup service install # write plist + load service now
|
|
274
|
-
claude-backup service uninstall # stop service + remove plist
|
|
275
|
-
claude-backup service status # check if running, show PID
|
|
276
|
-
claude-backup service logs # tail the watcher log in real-time
|
|
273
|
+
claude-code-backup service install # write plist + load service now
|
|
274
|
+
claude-code-backup service uninstall # stop service + remove plist
|
|
275
|
+
claude-code-backup service status # check if running, show PID
|
|
276
|
+
claude-code-backup service logs # tail the watcher log in real-time
|
|
277
277
|
\`\`\`
|
|
278
278
|
|
|
279
279
|
The service plist is installed at:
|
|
280
280
|
\`\`\`
|
|
281
|
-
~/Library/LaunchAgents/com.claude-backup.watch.plist
|
|
281
|
+
~/Library/LaunchAgents/com.claude-code-backup.watch.plist
|
|
282
282
|
\`\`\`
|
|
283
283
|
|
|
284
284
|
Key plist settings:
|
|
285
285
|
- \`RunAtLoad: true\` — starts when the service is loaded (immediately on install)
|
|
286
286
|
- \`KeepAlive: true\` — launchd restarts the watcher if it ever crashes
|
|
287
287
|
- \`ThrottleInterval: 10\` — prevents rapid restart loops if something goes wrong
|
|
288
|
-
- Stdout → \`~/.config/claude-backup/watch.log\`
|
|
289
|
-
- Stderr → \`~/.config/claude-backup/watch.error.log\`
|
|
288
|
+
- Stdout → \`~/.config/claude-code-backup/watch.log\`
|
|
289
|
+
- Stderr → \`~/.config/claude-code-backup/watch.error.log\`
|
|
290
290
|
|
|
291
291
|
---
|
|
292
292
|
|
|
293
|
-
### \`claude-backup config <action>\`
|
|
293
|
+
### \`claude-code-backup config <action>\`
|
|
294
294
|
|
|
295
295
|
View or modify configuration without re-running \`init\`.
|
|
296
296
|
|
|
297
297
|
\`\`\`bash
|
|
298
|
-
claude-backup config show # print current config (PAT masked)
|
|
299
|
-
claude-backup config set auto_sync.debounce_ms 3000 # change a value
|
|
300
|
-
claude-backup config add-dir /path/to/project # watch an extra directory
|
|
301
|
-
claude-backup config remove-dir /path/to/project # stop watching a directory
|
|
298
|
+
claude-code-backup config show # print current config (PAT masked)
|
|
299
|
+
claude-code-backup config set auto_sync.debounce_ms 3000 # change a value
|
|
300
|
+
claude-code-backup config add-dir /path/to/project # watch an extra directory
|
|
301
|
+
claude-code-backup config remove-dir /path/to/project # stop watching a directory
|
|
302
302
|
\`\`\`
|
|
303
303
|
|
|
304
304
|
Nested keys use dot notation. Values are auto-cast (numbers, booleans).
|
|
@@ -310,7 +310,7 @@ Nested keys use dot notation. Values are auto-cast (numbers, booleans).
|
|
|
310
310
|
After running \`init\` and \`push\`, install the background service:
|
|
311
311
|
|
|
312
312
|
\`\`\`bash
|
|
313
|
-
claude-backup service install
|
|
313
|
+
claude-code-backup service install
|
|
314
314
|
\`\`\`
|
|
315
315
|
|
|
316
316
|
From this point on:
|
|
@@ -322,8 +322,8 @@ From this point on:
|
|
|
322
322
|
To verify it's working:
|
|
323
323
|
|
|
324
324
|
\`\`\`bash
|
|
325
|
-
claude-backup status # should show "running (PID ...)"
|
|
326
|
-
claude-backup service logs # live log of every sync
|
|
325
|
+
claude-code-backup status # should show "running (PID ...)"
|
|
326
|
+
claude-code-backup service logs # live log of every sync
|
|
327
327
|
\`\`\`
|
|
328
328
|
|
|
329
329
|
---
|
|
@@ -333,7 +333,7 @@ claude-backup service logs # live log of every sync
|
|
|
333
333
|
### Restore to the same machine (after accidental deletion)
|
|
334
334
|
|
|
335
335
|
\`\`\`bash
|
|
336
|
-
claude-backup pull
|
|
336
|
+
claude-code-backup pull
|
|
337
337
|
\`\`\`
|
|
338
338
|
|
|
339
339
|
Confirm the preview, and your files are back.
|
|
@@ -341,25 +341,25 @@ Confirm the preview, and your files are back.
|
|
|
341
341
|
### Restore to a new machine
|
|
342
342
|
|
|
343
343
|
\`\`\`bash
|
|
344
|
-
# 1. Install Node.js (18+) and claude-backup
|
|
345
|
-
npm install -g claude-backup
|
|
344
|
+
# 1. Install Node.js (18+) and claude-code-backup
|
|
345
|
+
npm install -g claude-code-backup
|
|
346
346
|
|
|
347
347
|
# 2. Run init with the same GitHub repo
|
|
348
|
-
claude-backup init
|
|
349
|
-
# → Same repo name (yourname/claude-backup)
|
|
348
|
+
claude-code-backup init
|
|
349
|
+
# → Same repo name (yourname/claude-code-backup)
|
|
350
350
|
# → New GitHub PAT (generate a new one)
|
|
351
351
|
|
|
352
352
|
# 3. Pull the latest backup
|
|
353
|
-
claude-backup pull
|
|
353
|
+
claude-code-backup pull
|
|
354
354
|
|
|
355
355
|
# 4. Install the background service on the new machine
|
|
356
|
-
claude-backup service install
|
|
356
|
+
claude-code-backup service install
|
|
357
357
|
\`\`\`
|
|
358
358
|
|
|
359
359
|
### Restore a specific historical version
|
|
360
360
|
|
|
361
361
|
\`\`\`bash
|
|
362
|
-
claude-backup pull --history
|
|
362
|
+
claude-code-backup pull --history
|
|
363
363
|
\`\`\`
|
|
364
364
|
|
|
365
365
|
This shows a list of all commits in this repo. Select the one you want — the timestamp and commit message help identify when each backup was taken.
|
|
@@ -368,7 +368,7 @@ This shows a list of all commits in this repo. Select the one you want — the t
|
|
|
368
368
|
|
|
369
369
|
## Configuration Reference
|
|
370
370
|
|
|
371
|
-
Config file location: \`~/.config/claude-backup/config.json\`
|
|
371
|
+
Config file location: \`~/.config/claude-code-backup/config.json\`
|
|
372
372
|
|
|
373
373
|
| Key | Type | Default | Description |
|
|
374
374
|
|---|---|---|---|
|
|
@@ -383,57 +383,57 @@ Config file location: \`~/.config/claude-backup/config.json\`
|
|
|
383
383
|
|
|
384
384
|
Default excludes: \`settings.local.json\`, \`*.log\`, \`.DS_Store\`
|
|
385
385
|
|
|
386
|
-
The local repo clone lives at: \`~/.config/claude-backup/repo/\`
|
|
386
|
+
The local repo clone lives at: \`~/.config/claude-code-backup/repo/\`
|
|
387
387
|
|
|
388
388
|
---
|
|
389
389
|
|
|
390
390
|
## Security Notes
|
|
391
391
|
|
|
392
392
|
- This repo is **private** — only you and anyone you explicitly invite can see it
|
|
393
|
-
- Your GitHub PAT is stored locally at \`~/.config/claude-backup/config.json\` with \`chmod 600\` (owner-read only)
|
|
393
|
+
- Your GitHub PAT is stored locally at \`~/.config/claude-code-backup/config.json\` with \`chmod 600\` (owner-read only)
|
|
394
394
|
- The PAT is never committed to this repo
|
|
395
395
|
- \`settings.local.json\` is excluded by default because it may contain machine-specific or sensitive values
|
|
396
|
-
- If you ever rotate your PAT, run \`claude-backup config set github.pat <new-token>\` then \`claude-backup service install\` to restart the watcher with the new token
|
|
396
|
+
- If you ever rotate your PAT, run \`claude-code-backup config set github.pat <new-token>\` then \`claude-code-backup service install\` to restart the watcher with the new token
|
|
397
397
|
|
|
398
398
|
---
|
|
399
399
|
|
|
400
400
|
## Troubleshooting
|
|
401
401
|
|
|
402
|
-
**"Not configured. Run: claude-backup init"**
|
|
403
|
-
The config file is missing or incomplete. Re-run \`claude-backup init\`.
|
|
402
|
+
**"Not configured. Run: claude-code-backup init"**
|
|
403
|
+
The config file is missing or incomplete. Re-run \`claude-code-backup init\`.
|
|
404
404
|
|
|
405
405
|
**Push fails with authentication error**
|
|
406
406
|
Your PAT may have expired or been revoked. Generate a new one at
|
|
407
407
|
https://github.com/settings/tokens/new and run:
|
|
408
408
|
\`\`\`bash
|
|
409
|
-
claude-backup config set github.pat <new-token>
|
|
409
|
+
claude-code-backup config set github.pat <new-token>
|
|
410
410
|
\`\`\`
|
|
411
411
|
|
|
412
412
|
**Service shows "loaded but not running"**
|
|
413
413
|
Check the error log:
|
|
414
414
|
\`\`\`bash
|
|
415
|
-
claude-backup service logs
|
|
416
|
-
cat ~/.config/claude-backup/watch.error.log
|
|
415
|
+
claude-code-backup service logs
|
|
416
|
+
cat ~/.config/claude-code-backup/watch.error.log
|
|
417
417
|
\`\`\`
|
|
418
|
-
Then reinstall the service: \`claude-backup service install\`
|
|
418
|
+
Then reinstall the service: \`claude-code-backup service install\`
|
|
419
419
|
|
|
420
420
|
**Files not being detected by the watcher**
|
|
421
421
|
Confirm the directory is in your watch list:
|
|
422
422
|
\`\`\`bash
|
|
423
|
-
claude-backup config show
|
|
424
|
-
claude-backup config add-dir /path/to/missing/dir
|
|
423
|
+
claude-code-backup config show
|
|
424
|
+
claude-code-backup config add-dir /path/to/missing/dir
|
|
425
425
|
\`\`\`
|
|
426
426
|
|
|
427
427
|
**Restore wrote wrong files / I want to undo**
|
|
428
428
|
Every restore creates a safety snapshot before touching anything:
|
|
429
429
|
\`\`\`bash
|
|
430
|
-
ls ~/.config/claude-backup/pre-restore-*/
|
|
430
|
+
ls ~/.config/claude-code-backup/pre-restore-*/
|
|
431
431
|
\`\`\`
|
|
432
432
|
Copy the files you need back from there manually.
|
|
433
433
|
|
|
434
434
|
---
|
|
435
435
|
|
|
436
|
-
*This README is auto-generated by \`claude-backup init\` and reflects the configuration at setup time.*
|
|
436
|
+
*This README is auto-generated by \`claude-code-backup init\` and reflects the configuration at setup time.*
|
|
437
437
|
`;
|
|
438
438
|
}
|
|
439
439
|
|
|
@@ -479,7 +479,7 @@ export async function ensureRepo(config) {
|
|
|
479
479
|
|
|
480
480
|
export async function push(config, commitMessage) {
|
|
481
481
|
if (!existsSync(REPO_DIR)) {
|
|
482
|
-
log.error('Repo not set up. Run: claude-backup init');
|
|
482
|
+
log.error('Repo not set up. Run: claude-code-backup init');
|
|
483
483
|
process.exit(1);
|
|
484
484
|
}
|
|
485
485
|
|
|
@@ -559,7 +559,7 @@ export async function getHistory(config, limit = 15) {
|
|
|
559
559
|
|
|
560
560
|
export async function fetchForRestore(config, ref) {
|
|
561
561
|
if (!existsSync(REPO_DIR)) {
|
|
562
|
-
log.error('Repo not set up. Run: claude-backup init');
|
|
562
|
+
log.error('Repo not set up. Run: claude-code-backup init');
|
|
563
563
|
process.exit(1);
|
|
564
564
|
}
|
|
565
565
|
|
|
@@ -26,7 +26,7 @@ export function runConfig(action, key, value) {
|
|
|
26
26
|
function showConfig() {
|
|
27
27
|
const config = loadConfig();
|
|
28
28
|
if (!config) {
|
|
29
|
-
log.warn('Not configured yet. Run: claude-backup init');
|
|
29
|
+
log.warn('Not configured yet. Run: claude-code-backup init');
|
|
30
30
|
return;
|
|
31
31
|
}
|
|
32
32
|
const safe = JSON.parse(JSON.stringify(config));
|
|
@@ -40,8 +40,8 @@ function showConfig() {
|
|
|
40
40
|
|
|
41
41
|
function setConfig(key, value) {
|
|
42
42
|
if (!key || value === undefined) {
|
|
43
|
-
log.error('Usage: claude-backup config set <key> <value>');
|
|
44
|
-
log.dim('Example: claude-backup config set auto_sync.debounce_ms 3000');
|
|
43
|
+
log.error('Usage: claude-code-backup config set <key> <value>');
|
|
44
|
+
log.dim('Example: claude-code-backup config set auto_sync.debounce_ms 3000');
|
|
45
45
|
process.exit(1);
|
|
46
46
|
}
|
|
47
47
|
const config = requireConfig();
|
|
@@ -63,7 +63,7 @@ function setConfig(key, value) {
|
|
|
63
63
|
|
|
64
64
|
function addDir(dirPath) {
|
|
65
65
|
if (!dirPath) {
|
|
66
|
-
log.error('Usage: claude-backup config add-dir <path>');
|
|
66
|
+
log.error('Usage: claude-code-backup config add-dir <path>');
|
|
67
67
|
process.exit(1);
|
|
68
68
|
}
|
|
69
69
|
const config = requireConfig();
|
|
@@ -79,7 +79,7 @@ function addDir(dirPath) {
|
|
|
79
79
|
|
|
80
80
|
function removeDir(dirPath) {
|
|
81
81
|
if (!dirPath) {
|
|
82
|
-
log.error('Usage: claude-backup config remove-dir <path>');
|
|
82
|
+
log.error('Usage: claude-code-backup config remove-dir <path>');
|
|
83
83
|
process.exit(1);
|
|
84
84
|
}
|
|
85
85
|
const config = requireConfig();
|
|
@@ -98,7 +98,7 @@ function removeDir(dirPath) {
|
|
|
98
98
|
|
|
99
99
|
function addProject(dirPath) {
|
|
100
100
|
if (!dirPath) {
|
|
101
|
-
log.error('Usage: claude-backup config add-project <project-root-path>');
|
|
101
|
+
log.error('Usage: claude-code-backup config add-project <project-root-path>');
|
|
102
102
|
log.dim('Only the CLAUDE.md file at that path will be backed up.');
|
|
103
103
|
process.exit(1);
|
|
104
104
|
}
|
|
@@ -117,7 +117,7 @@ function addProject(dirPath) {
|
|
|
117
117
|
|
|
118
118
|
function removeProject(dirPath) {
|
|
119
119
|
if (!dirPath) {
|
|
120
|
-
log.error('Usage: claude-backup config remove-project <project-root-path>');
|
|
120
|
+
log.error('Usage: claude-code-backup config remove-project <project-root-path>');
|
|
121
121
|
process.exit(1);
|
|
122
122
|
}
|
|
123
123
|
const config = requireConfig();
|
package/src/commands/init.js
CHANGED
|
@@ -13,12 +13,12 @@ export async function runInit() {
|
|
|
13
13
|
|
|
14
14
|
// ── Step 1: GitHub PAT ───────────────────────────────────────────────────
|
|
15
15
|
console.log(chalk.bold.underline('Step 1 of 4 — GitHub Personal Access Token') + '\n');
|
|
16
|
-
console.log('claude-backup needs a PAT with ' + chalk.cyan('"repo"') + ' scope to create');
|
|
16
|
+
console.log('claude-code-backup needs a PAT with ' + chalk.cyan('"repo"') + ' scope to create');
|
|
17
17
|
console.log('and push to a private GitHub repository on your behalf.\n');
|
|
18
18
|
console.log(chalk.bold(' Create your token here:'));
|
|
19
19
|
console.log(' ' + chalk.underline.blue('https://github.com/settings/tokens/new') + '\n');
|
|
20
20
|
console.log(chalk.dim(' Instructions:'));
|
|
21
|
-
console.log(chalk.dim(' 1. Note name → e.g. "claude-backup"'));
|
|
21
|
+
console.log(chalk.dim(' 1. Note name → e.g. "claude-code-backup"'));
|
|
22
22
|
console.log(chalk.dim(' 2. Expiration → your preference (No expiration is fine)'));
|
|
23
23
|
console.log(chalk.dim(' 3. Scopes → tick ') + chalk.cyan('repo') + chalk.dim(' (the top-level checkbox covers everything needed)'));
|
|
24
24
|
console.log(chalk.dim(' 4. Click "Generate token" and copy the value\n'));
|
|
@@ -44,7 +44,7 @@ export async function runInit() {
|
|
|
44
44
|
{
|
|
45
45
|
type: 'input',
|
|
46
46
|
name: 'repo',
|
|
47
|
-
message: 'GitHub repo name (e.g. yourname/claude-backup):',
|
|
47
|
+
message: 'GitHub repo name (e.g. yourname/claude-code-backup):',
|
|
48
48
|
default: existing?.github?.repo || '',
|
|
49
49
|
validate: v =>
|
|
50
50
|
/^[\w.-]+\/[\w.-]+$/.test(v.trim()) || 'Format must be owner/repo',
|
|
@@ -122,14 +122,14 @@ export async function runInit() {
|
|
|
122
122
|
};
|
|
123
123
|
|
|
124
124
|
saveConfig(config);
|
|
125
|
-
log.success('Config saved (~/.config/claude-backup/config.json, chmod 600)');
|
|
125
|
+
log.success('Config saved (~/.config/claude-code-backup/config.json, chmod 600)');
|
|
126
126
|
|
|
127
127
|
try {
|
|
128
128
|
await ensureRepo(config);
|
|
129
129
|
log.success('GitHub setup complete\n');
|
|
130
130
|
log.info('Next steps:');
|
|
131
|
-
log.dim(' claude-backup push — do your first backup now');
|
|
132
|
-
log.dim(' claude-backup service install — enable auto-sync on login');
|
|
131
|
+
log.dim(' claude-code-backup push — do your first backup now');
|
|
132
|
+
log.dim(' claude-code-backup service install — enable auto-sync on login');
|
|
133
133
|
} catch (err) {
|
|
134
134
|
log.error(`GitHub setup failed: ${err.message}`);
|
|
135
135
|
if (process.env.DEBUG) console.error(err);
|
package/src/commands/pull.js
CHANGED
package/src/commands/service.js
CHANGED
|
@@ -63,7 +63,7 @@ async function unloadService() {
|
|
|
63
63
|
|
|
64
64
|
async function installService() {
|
|
65
65
|
const nodePath = process.execPath; // path to the node binary running this script
|
|
66
|
-
const scriptPath = process.argv[1]; // absolute path to claude-backup.js
|
|
66
|
+
const scriptPath = process.argv[1]; // absolute path to claude-code-backup.js
|
|
67
67
|
|
|
68
68
|
const plist = buildPlist(nodePath, scriptPath);
|
|
69
69
|
writeFileSync(LAUNCHD_PLIST, plist, 'utf8');
|
|
@@ -106,7 +106,7 @@ async function uninstallService() {
|
|
|
106
106
|
async function serviceStatus() {
|
|
107
107
|
if (!existsSync(LAUNCHD_PLIST)) {
|
|
108
108
|
log.warn('Service is not installed');
|
|
109
|
-
log.dim('Run: claude-backup service install');
|
|
109
|
+
log.dim('Run: claude-code-backup service install');
|
|
110
110
|
return;
|
|
111
111
|
}
|
|
112
112
|
|
package/src/commands/status.js
CHANGED
|
@@ -65,7 +65,7 @@ export async function runStatus() {
|
|
|
65
65
|
console.log(`${chalk.bold('Sync status:')} ${chalk.green('Up to date')}`);
|
|
66
66
|
}
|
|
67
67
|
} else {
|
|
68
|
-
console.log(chalk.dim(' No backups yet. Run: claude-backup push'));
|
|
68
|
+
console.log(chalk.dim(' No backups yet. Run: claude-code-backup push'));
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
// Launchd service
|
|
@@ -73,7 +73,7 @@ export async function runStatus() {
|
|
|
73
73
|
const svcColor = svc.startsWith('running') ? chalk.green : chalk.yellow;
|
|
74
74
|
console.log(`\n${chalk.bold('Auto-sync service:')} ${svcColor(svc)}`);
|
|
75
75
|
if (!svc.startsWith('running')) {
|
|
76
|
-
console.log(chalk.dim(' Run: claude-backup service install'));
|
|
76
|
+
console.log(chalk.dim(' Run: claude-code-backup service install'));
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
console.log('');
|
package/src/core/config.js
CHANGED
|
@@ -2,15 +2,15 @@ import { homedir } from 'os';
|
|
|
2
2
|
import { join } from 'path';
|
|
3
3
|
import { readFileSync, writeFileSync, mkdirSync, existsSync, chmodSync } from 'fs';
|
|
4
4
|
|
|
5
|
-
export const CONFIG_DIR = join(homedir(), '.config', 'claude-backup');
|
|
5
|
+
export const CONFIG_DIR = join(homedir(), '.config', 'claude-code-backup');
|
|
6
6
|
export const CONFIG_FILE = join(CONFIG_DIR, 'config.json');
|
|
7
7
|
export const REPO_DIR = join(CONFIG_DIR, 'repo');
|
|
8
8
|
export const LOG_FILE = join(CONFIG_DIR, 'watch.log');
|
|
9
9
|
export const ERROR_LOG_FILE = join(CONFIG_DIR, 'watch.error.log');
|
|
10
10
|
export const LAUNCHD_PLIST = join(
|
|
11
|
-
homedir(), 'Library', 'LaunchAgents', 'com.claude-backup.watch.plist'
|
|
11
|
+
homedir(), 'Library', 'LaunchAgents', 'com.claude-code-backup.watch.plist'
|
|
12
12
|
);
|
|
13
|
-
export const LAUNCHD_LABEL = 'com.claude-backup.watch';
|
|
13
|
+
export const LAUNCHD_LABEL = 'com.claude-code-backup.watch';
|
|
14
14
|
|
|
15
15
|
export function ensureConfigDir() {
|
|
16
16
|
mkdirSync(CONFIG_DIR, { recursive: true });
|
|
@@ -34,7 +34,7 @@ export function saveConfig(config) {
|
|
|
34
34
|
export function requireConfig() {
|
|
35
35
|
const config = loadConfig();
|
|
36
36
|
if (!config || !config.github?.pat || !config.github?.repo) {
|
|
37
|
-
console.error('Not configured. Run: claude-backup init');
|
|
37
|
+
console.error('Not configured. Run: claude-code-backup init');
|
|
38
38
|
process.exit(1);
|
|
39
39
|
}
|
|
40
40
|
return config;
|