@clawmover/cli 0.0.1 → 0.0.2
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 +122 -122
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
# @clawmover/cli
|
|
2
2
|
|
|
3
|
-
OpenClaw
|
|
3
|
+
Command-line tool for OpenClaw data backup and recovery.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Features
|
|
6
6
|
|
|
7
|
-
- 🔄
|
|
8
|
-
- 📥
|
|
9
|
-
- 🔒
|
|
10
|
-
- ⚡
|
|
11
|
-
- 🏷️
|
|
12
|
-
- ⚖️
|
|
13
|
-
- 📊
|
|
14
|
-
- 🔍
|
|
7
|
+
- 🔄 **Auto Backup**: Backup OpenClaw data to remote servers
|
|
8
|
+
- 📥 **Data Recovery**: Quickly restore data from server to local
|
|
9
|
+
- 🔒 **Data Encryption**: All backup data encrypted with data-secret-key
|
|
10
|
+
- ⚡ **Incremental Backup**: Restic-based incremental backup saves storage
|
|
11
|
+
- 🏷️ **Tag Management**: Organize and filter backups with tags
|
|
12
|
+
- ⚖️ **Conflict Handling**: Multiple strategies for file conflicts
|
|
13
|
+
- 📊 **Progress Display**: Real-time backup and restore progress
|
|
14
|
+
- 🔍 **Detailed Logs**: Complete operation log records
|
|
15
15
|
|
|
16
|
-
##
|
|
16
|
+
## Installation
|
|
17
17
|
|
|
18
18
|
```bash
|
|
19
19
|
npm install -g @clawmover/cli
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
Or install from source:
|
|
23
23
|
|
|
24
24
|
```bash
|
|
25
25
|
git clone https://github.com/clawmover/clawmover-cli.git
|
|
@@ -29,32 +29,32 @@ npm run build
|
|
|
29
29
|
npm link
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
-
##
|
|
32
|
+
## Configuration
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
The tool automatically reads OpenClaw config file. You can also override via command-line options:
|
|
35
35
|
|
|
36
36
|
```bash
|
|
37
|
-
#
|
|
37
|
+
# Show config file path
|
|
38
38
|
openclaw config file
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
-
##
|
|
41
|
+
## Usage
|
|
42
42
|
|
|
43
|
-
###
|
|
43
|
+
### Backup Data
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
Basic backup command:
|
|
46
46
|
|
|
47
47
|
```bash
|
|
48
48
|
clawmover backup
|
|
49
49
|
```
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
Specify instance ID and key:
|
|
52
52
|
|
|
53
53
|
```bash
|
|
54
54
|
clawmover backup --instance-id your-instance-id --data-secret-key your-secret-key
|
|
55
55
|
```
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
Advanced options:
|
|
58
58
|
|
|
59
59
|
```bash
|
|
60
60
|
clawmover backup \
|
|
@@ -67,38 +67,38 @@ clawmover backup \
|
|
|
67
67
|
--log-level debug
|
|
68
68
|
```
|
|
69
69
|
|
|
70
|
-
|
|
70
|
+
**Options:**
|
|
71
71
|
|
|
72
|
-
- `--instance-id <id>`:
|
|
73
|
-
- `--data-secret-key <key>`:
|
|
74
|
-
- `--tags <tags>`:
|
|
75
|
-
- `--conflict-strategy <strategy>`:
|
|
76
|
-
- `--skip-temp`:
|
|
77
|
-
- `--skip-cache`:
|
|
78
|
-
- `--storage-path <path>`:
|
|
79
|
-
- `--log-level <level>`:
|
|
72
|
+
- `--instance-id <id>`: Instance ID (override config file)
|
|
73
|
+
- `--data-secret-key <key>`: Data secret key (override config file)
|
|
74
|
+
- `--tags <tags>`: Comma-separated tag list
|
|
75
|
+
- `--conflict-strategy <strategy>`: Conflict strategy (smart|interactive|overwrite), default: smart
|
|
76
|
+
- `--skip-temp`: Skip temporary files
|
|
77
|
+
- `--skip-cache`: Skip cache files
|
|
78
|
+
- `--storage-path <path>`: Custom storage path
|
|
79
|
+
- `--log-level <level>`: Log level (debug|info|warn|error)
|
|
80
80
|
|
|
81
|
-
###
|
|
81
|
+
### Restore Data
|
|
82
82
|
|
|
83
|
-
|
|
83
|
+
Basic restore command:
|
|
84
84
|
|
|
85
85
|
```bash
|
|
86
86
|
clawmover restore
|
|
87
87
|
```
|
|
88
88
|
|
|
89
|
-
|
|
89
|
+
Specify snapshot ID:
|
|
90
90
|
|
|
91
91
|
```bash
|
|
92
92
|
clawmover restore --snapshot-id abc123
|
|
93
93
|
```
|
|
94
94
|
|
|
95
|
-
|
|
95
|
+
Filter by tags:
|
|
96
96
|
|
|
97
97
|
```bash
|
|
98
98
|
clawmover restore --tags core,imessage-db
|
|
99
99
|
```
|
|
100
100
|
|
|
101
|
-
|
|
101
|
+
Advanced options:
|
|
102
102
|
|
|
103
103
|
```bash
|
|
104
104
|
clawmover restore \
|
|
@@ -111,178 +111,178 @@ clawmover restore \
|
|
|
111
111
|
--log-level info
|
|
112
112
|
```
|
|
113
113
|
|
|
114
|
-
|
|
114
|
+
**Options:**
|
|
115
115
|
|
|
116
|
-
- `--instance-id <id>`:
|
|
117
|
-
- `--data-secret-key <key>`:
|
|
118
|
-
- `--snapshot-id <id>`:
|
|
119
|
-
- `--tags <tags>`:
|
|
120
|
-
- `--conflict-strategy <strategy>`:
|
|
121
|
-
- `--target-path <path>`:
|
|
122
|
-
- `--log-level <level>`:
|
|
116
|
+
- `--instance-id <id>`: Instance ID (override config file)
|
|
117
|
+
- `--data-secret-key <key>`: Data secret key (override config file)
|
|
118
|
+
- `--snapshot-id <id>`: Snapshot ID to restore (default: latest)
|
|
119
|
+
- `--tags <tags>`: Comma-separated tags to filter snapshots
|
|
120
|
+
- `--conflict-strategy <strategy>`: Conflict strategy (smart|interactive|overwrite), default: smart
|
|
121
|
+
- `--target-path <path>`: Target directory for restoration
|
|
122
|
+
- `--log-level <level>`: Log level (debug|info|warn|error)
|
|
123
123
|
|
|
124
|
-
##
|
|
124
|
+
## Conflict Handling Strategies
|
|
125
125
|
|
|
126
|
-
### Smart (
|
|
126
|
+
### Smart (Recommended)
|
|
127
127
|
|
|
128
|
-
-
|
|
129
|
-
-
|
|
130
|
-
-
|
|
131
|
-
-
|
|
128
|
+
- **Config files**: Ask user for decision
|
|
129
|
+
- **Database**: Auto backup old version
|
|
130
|
+
- **Attachments**: Rename local file
|
|
131
|
+
- **Regular files**: Compare modification time, keep newer
|
|
132
132
|
|
|
133
|
-
### Interactive
|
|
133
|
+
### Interactive
|
|
134
134
|
|
|
135
|
-
|
|
136
|
-
-
|
|
137
|
-
-
|
|
138
|
-
-
|
|
139
|
-
-
|
|
135
|
+
Ask user for each conflict:
|
|
136
|
+
- Backup existing file and overwrite
|
|
137
|
+
- Rename existing file
|
|
138
|
+
- Skip this file
|
|
139
|
+
- Overwrite directly
|
|
140
140
|
|
|
141
|
-
### Overwrite
|
|
141
|
+
### Overwrite
|
|
142
142
|
|
|
143
|
-
|
|
143
|
+
Overwrite all conflicting files without backup
|
|
144
144
|
|
|
145
|
-
##
|
|
145
|
+
## Backup Plan
|
|
146
146
|
|
|
147
|
-
|
|
147
|
+
The tool automatically generates backup plan with these data types:
|
|
148
148
|
|
|
149
|
-
1. **Core
|
|
150
|
-
- OpenClaw
|
|
151
|
-
-
|
|
149
|
+
1. **Core Data** (Required)
|
|
150
|
+
- OpenClaw core config and data
|
|
151
|
+
- Tag: `core`
|
|
152
152
|
|
|
153
|
-
2. **iMessage
|
|
154
|
-
-
|
|
155
|
-
-
|
|
153
|
+
2. **iMessage Database** (Optional)
|
|
154
|
+
- If `imessageDb` is configured
|
|
155
|
+
- Tags: `imessage-db`, `core`
|
|
156
156
|
|
|
157
|
-
3. **iMessage
|
|
158
|
-
-
|
|
159
|
-
-
|
|
157
|
+
3. **iMessage Attachments** (Optional)
|
|
158
|
+
- If `imessageAttachments` is configured
|
|
159
|
+
- Tags: `imessage-attachments`, `core`
|
|
160
160
|
|
|
161
|
-
4. **Sandbox
|
|
162
|
-
-
|
|
163
|
-
-
|
|
161
|
+
4. **Sandbox Data** (Optional)
|
|
162
|
+
- Sandbox environment data
|
|
163
|
+
- Tag: `sandbox`
|
|
164
164
|
|
|
165
|
-
5.
|
|
166
|
-
-
|
|
167
|
-
-
|
|
165
|
+
5. **Cache Data** (Optional)
|
|
166
|
+
- Application cache
|
|
167
|
+
- Tag: `cache`
|
|
168
168
|
|
|
169
|
-
6.
|
|
170
|
-
-
|
|
171
|
-
-
|
|
169
|
+
6. **Temporary Files** (Optional)
|
|
170
|
+
- Temporary files
|
|
171
|
+
- Tag: `temp`
|
|
172
172
|
|
|
173
|
-
##
|
|
173
|
+
## Tag System
|
|
174
174
|
|
|
175
|
-
|
|
175
|
+
Use tags to organize and filter backups:
|
|
176
176
|
|
|
177
177
|
```bash
|
|
178
|
-
#
|
|
178
|
+
# Create backup with tags
|
|
179
179
|
clawmover backup --tags production,daily
|
|
180
180
|
|
|
181
|
-
#
|
|
181
|
+
# Restore specific tagged data
|
|
182
182
|
clawmover restore --tags production
|
|
183
183
|
|
|
184
|
-
#
|
|
184
|
+
# List all backups for an instance
|
|
185
185
|
clawmover list --instance-id your-instance-id
|
|
186
186
|
```
|
|
187
187
|
|
|
188
|
-
|
|
189
|
-
- `instance:<instanceId>`:
|
|
190
|
-
- `date:<YYYY-MM-DD>`:
|
|
188
|
+
Auto-added tags:
|
|
189
|
+
- `instance:<instanceId>`: Instance ID
|
|
190
|
+
- `date:<YYYY-MM-DD>`: Backup date
|
|
191
191
|
|
|
192
|
-
##
|
|
192
|
+
## Logging and Debugging
|
|
193
193
|
|
|
194
|
-
|
|
194
|
+
Set log level:
|
|
195
195
|
|
|
196
196
|
```bash
|
|
197
|
-
#
|
|
197
|
+
# Verbose debug info
|
|
198
198
|
clawmover backup --log-level debug
|
|
199
199
|
|
|
200
|
-
#
|
|
200
|
+
# Errors only
|
|
201
201
|
clawmover backup --log-level error
|
|
202
202
|
```
|
|
203
203
|
|
|
204
|
-
|
|
204
|
+
Log file is saved to `./logs/clawmover.log` by default.
|
|
205
205
|
|
|
206
|
-
##
|
|
206
|
+
## Development
|
|
207
207
|
|
|
208
|
-
###
|
|
208
|
+
### Project Structure
|
|
209
209
|
|
|
210
210
|
```
|
|
211
211
|
@clawmover/cli/
|
|
212
212
|
├── src/
|
|
213
|
-
│ ├── commands/ #
|
|
214
|
-
│ ├── services/ #
|
|
215
|
-
│ ├── integrations/ #
|
|
216
|
-
│ ├── system/ #
|
|
217
|
-
│ ├── types/ #
|
|
218
|
-
│ ├── utils/ #
|
|
219
|
-
│ └── index.ts #
|
|
220
|
-
├── tests/ #
|
|
213
|
+
│ ├── commands/ # Command execution layer
|
|
214
|
+
│ ├── services/ # Core service layer
|
|
215
|
+
│ ├── integrations/ # External integration layer
|
|
216
|
+
│ ├── system/ # System service layer
|
|
217
|
+
│ ├── types/ # Type definitions
|
|
218
|
+
│ ├── utils/ # Utility functions
|
|
219
|
+
│ └── index.ts # Entry point
|
|
220
|
+
├── tests/ # Test files
|
|
221
221
|
├── package.json
|
|
222
222
|
├── tsconfig.json
|
|
223
223
|
└── README.md
|
|
224
224
|
```
|
|
225
225
|
|
|
226
|
-
###
|
|
226
|
+
### Build
|
|
227
227
|
|
|
228
228
|
```bash
|
|
229
229
|
npm run build
|
|
230
230
|
```
|
|
231
231
|
|
|
232
|
-
###
|
|
232
|
+
### Test
|
|
233
233
|
|
|
234
234
|
```bash
|
|
235
|
-
#
|
|
235
|
+
# Run all tests
|
|
236
236
|
npm test
|
|
237
237
|
|
|
238
|
-
#
|
|
238
|
+
# Watch mode
|
|
239
239
|
npm run test:watch
|
|
240
240
|
|
|
241
|
-
#
|
|
241
|
+
# Coverage report
|
|
242
242
|
npm run test:coverage
|
|
243
243
|
```
|
|
244
244
|
|
|
245
|
-
###
|
|
245
|
+
### Code Quality
|
|
246
246
|
|
|
247
247
|
```bash
|
|
248
248
|
# Lint
|
|
249
249
|
npm run lint
|
|
250
250
|
|
|
251
|
-
#
|
|
251
|
+
# Auto fix
|
|
252
252
|
npm run lint:fix
|
|
253
253
|
|
|
254
|
-
#
|
|
254
|
+
# Format code
|
|
255
255
|
npm run format
|
|
256
256
|
```
|
|
257
257
|
|
|
258
|
-
##
|
|
258
|
+
## Troubleshooting
|
|
259
259
|
|
|
260
|
-
###
|
|
260
|
+
### Backup Failed
|
|
261
261
|
|
|
262
|
-
1.
|
|
263
|
-
2.
|
|
264
|
-
3.
|
|
262
|
+
1. Check network connection
|
|
263
|
+
2. Verify `data-secret-key` is correct
|
|
264
|
+
3. Check log file for detailed error info
|
|
265
265
|
|
|
266
|
-
###
|
|
266
|
+
### Restore Failed
|
|
267
267
|
|
|
268
|
-
1.
|
|
269
|
-
2.
|
|
270
|
-
3.
|
|
268
|
+
1. Confirm snapshot ID exists
|
|
269
|
+
2. Check target directory permissions
|
|
270
|
+
3. Verify `data-secret-key` matches the backup
|
|
271
271
|
|
|
272
|
-
###
|
|
272
|
+
### OpenClaw Config Not Found
|
|
273
273
|
|
|
274
|
-
|
|
274
|
+
Run this command to check config file location:
|
|
275
275
|
|
|
276
276
|
```bash
|
|
277
277
|
openclaw config file
|
|
278
278
|
```
|
|
279
279
|
|
|
280
|
-
##
|
|
280
|
+
## License
|
|
281
281
|
|
|
282
282
|
MIT
|
|
283
283
|
|
|
284
|
-
##
|
|
284
|
+
## Support
|
|
285
285
|
|
|
286
|
-
|
|
286
|
+
For issues or suggestions, visit:
|
|
287
287
|
- GitHub Issues: https://github.com/clawmover/clawmover-cli/issues
|
|
288
|
-
-
|
|
288
|
+
- Documentation: https://github.com/clawmover/clawmover-cli#readme
|