zuppaclaude 1.3.20 → 1.3.21
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/lib/components/backup.js
CHANGED
|
@@ -17,7 +17,8 @@ class BackupManager {
|
|
|
17
17
|
this.sessionManager = new SessionManager();
|
|
18
18
|
this.cloudManager = new CloudManager();
|
|
19
19
|
this.settings = new Settings();
|
|
20
|
-
|
|
20
|
+
// New structure: backups/{hostname}/{username}/
|
|
21
|
+
this.backupDir = this.platform.backupBasePath;
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
/**
|
|
@@ -206,13 +207,16 @@ class BackupManager {
|
|
|
206
207
|
console.log('');
|
|
207
208
|
|
|
208
209
|
if (result) {
|
|
210
|
+
console.log(` 🖥️ Host: ${this.platform.hostname}`);
|
|
211
|
+
console.log(` 👤 User: ${this.platform.username}`);
|
|
212
|
+
console.log('');
|
|
209
213
|
console.log(` 📦 Backup ID: ${result.timestamp}`);
|
|
210
214
|
console.log(` 📁 Sessions: ${result.sessions}`);
|
|
211
215
|
console.log(` 💾 Size: ${this.formatSize(result.size)}`);
|
|
212
216
|
console.log(` 📍 Location: ${result.path}`);
|
|
213
217
|
|
|
214
218
|
if (cloud) {
|
|
215
|
-
console.log(` ☁️ Cloud: ${cloud}:zuppaclaude-backups/sessions/${result.timestamp}.zip`);
|
|
219
|
+
console.log(` ☁️ Cloud: ${cloud}:zuppaclaude-backups/${this.platform.hostname}/${this.platform.username}/sessions/${result.timestamp}.zip`);
|
|
216
220
|
}
|
|
217
221
|
}
|
|
218
222
|
|
package/lib/components/cloud.js
CHANGED
|
@@ -14,8 +14,10 @@ class CloudManager {
|
|
|
14
14
|
this.platform = new Platform();
|
|
15
15
|
this.logger = new Logger();
|
|
16
16
|
this.prompts = new Prompts();
|
|
17
|
-
|
|
18
|
-
this.
|
|
17
|
+
// New structure: backups/{hostname}/{username}/
|
|
18
|
+
this.backupDir = this.platform.backupBasePath;
|
|
19
|
+
// Cloud path: zuppaclaude-backups/{hostname}/{username}/
|
|
20
|
+
this.cloudPath = `zuppaclaude-backups/${this.platform.hostname}/${this.platform.username}`;
|
|
19
21
|
|
|
20
22
|
// Supported providers
|
|
21
23
|
this.providers = [
|
|
@@ -142,7 +144,7 @@ class CloudManager {
|
|
|
142
144
|
if (this.getRemotes().includes(provider.remoteName)) {
|
|
143
145
|
this.logger.success(`${provider.name} configured successfully`);
|
|
144
146
|
console.log('');
|
|
145
|
-
console.log(' Backup path: \x1b[36m' + provider.remoteName + ':
|
|
147
|
+
console.log(' Backup path: \x1b[36m' + provider.remoteName + ':' + this.cloudPath + '/\x1b[0m');
|
|
146
148
|
console.log(' ├── sessions/');
|
|
147
149
|
console.log(' └── settings/');
|
|
148
150
|
console.log('');
|
|
@@ -806,6 +808,9 @@ class CloudManager {
|
|
|
806
808
|
console.log(`\x1b[35m Delete Cloud Backup (${remote})\x1b[0m`);
|
|
807
809
|
console.log('\x1b[35m═══════════════════════════════════════════════════════════════════\x1b[0m');
|
|
808
810
|
console.log('');
|
|
811
|
+
console.log(` 🖥️ Host: ${this.platform.hostname}`);
|
|
812
|
+
console.log(` 👤 User: ${this.platform.username}`);
|
|
813
|
+
console.log('');
|
|
809
814
|
|
|
810
815
|
// Show numbered list
|
|
811
816
|
for (let i = 0; i < backups.length; i++) {
|
|
@@ -877,7 +882,9 @@ class CloudManager {
|
|
|
877
882
|
console.log(`\x1b[35m Cloud Backups (${remote})\x1b[0m`);
|
|
878
883
|
console.log('\x1b[35m═══════════════════════════════════════════════════════════════════\x1b[0m');
|
|
879
884
|
console.log('');
|
|
880
|
-
console.log(`
|
|
885
|
+
console.log(` 🖥️ Host: ${this.platform.hostname}`);
|
|
886
|
+
console.log(` 👤 User: ${this.platform.username}`);
|
|
887
|
+
console.log(` 📍 Path: ${remote}:${this.cloudPath}/`);
|
|
881
888
|
console.log('');
|
|
882
889
|
|
|
883
890
|
if (!output) {
|
|
@@ -13,7 +13,8 @@ class SessionManager {
|
|
|
13
13
|
this.logger = new Logger();
|
|
14
14
|
this.claudeDir = this.platform.claudeDir;
|
|
15
15
|
this.projectsDir = path.join(this.claudeDir, 'projects');
|
|
16
|
-
|
|
16
|
+
// New structure: backups/{hostname}/{username}/sessions/
|
|
17
|
+
this.backupDir = this.platform.backupBasePath;
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
/**
|
|
@@ -161,6 +162,8 @@ class SessionManager {
|
|
|
161
162
|
timestamp: timestamp,
|
|
162
163
|
timestampISO: new Date().toISOString(),
|
|
163
164
|
version: require('../../package.json').version,
|
|
165
|
+
hostname: this.platform.hostname,
|
|
166
|
+
username: this.platform.username,
|
|
164
167
|
projects: []
|
|
165
168
|
};
|
|
166
169
|
|
|
@@ -286,6 +289,9 @@ class SessionManager {
|
|
|
286
289
|
console.log('\x1b[35m Available Backups\x1b[0m');
|
|
287
290
|
console.log('\x1b[35m═══════════════════════════════════════════════════════════════════\x1b[0m');
|
|
288
291
|
console.log('');
|
|
292
|
+
console.log(` 🖥️ Host: ${this.platform.hostname}`);
|
|
293
|
+
console.log(` 👤 User: ${this.platform.username}`);
|
|
294
|
+
console.log('');
|
|
289
295
|
|
|
290
296
|
for (const backup of backups) {
|
|
291
297
|
console.log(` 📦 ${backup.id}`);
|
package/lib/utils/platform.js
CHANGED
|
@@ -11,6 +11,56 @@ class Platform {
|
|
|
11
11
|
constructor() {
|
|
12
12
|
this.platform = os.platform();
|
|
13
13
|
this.homedir = os.homedir();
|
|
14
|
+
this._hostname = null;
|
|
15
|
+
this._username = null;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Get sanitized hostname (computer name)
|
|
20
|
+
* Works on macOS, Linux, and Windows
|
|
21
|
+
*/
|
|
22
|
+
get hostname() {
|
|
23
|
+
if (this._hostname) return this._hostname;
|
|
24
|
+
|
|
25
|
+
let name = os.hostname();
|
|
26
|
+
|
|
27
|
+
// Remove .local suffix on macOS
|
|
28
|
+
name = name.replace(/\.local$/, '');
|
|
29
|
+
|
|
30
|
+
// Sanitize: lowercase, replace spaces/special chars with dash
|
|
31
|
+
name = name.toLowerCase()
|
|
32
|
+
.replace(/[^a-z0-9-]/g, '-')
|
|
33
|
+
.replace(/-+/g, '-')
|
|
34
|
+
.replace(/^-|-$/g, '');
|
|
35
|
+
|
|
36
|
+
this._hostname = name || 'unknown-host';
|
|
37
|
+
return this._hostname;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Get current username
|
|
42
|
+
* Works on macOS, Linux, and Windows
|
|
43
|
+
*/
|
|
44
|
+
get username() {
|
|
45
|
+
if (this._username) return this._username;
|
|
46
|
+
|
|
47
|
+
let name = os.userInfo().username;
|
|
48
|
+
|
|
49
|
+
// Sanitize: lowercase, replace spaces/special chars with dash
|
|
50
|
+
name = name.toLowerCase()
|
|
51
|
+
.replace(/[^a-z0-9-]/g, '-')
|
|
52
|
+
.replace(/-+/g, '-')
|
|
53
|
+
.replace(/^-|-$/g, '');
|
|
54
|
+
|
|
55
|
+
this._username = name || 'unknown-user';
|
|
56
|
+
return this._username;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Get backup base path: backups/{hostname}/{username}
|
|
61
|
+
*/
|
|
62
|
+
get backupBasePath() {
|
|
63
|
+
return path.join(this.zuppaconfigDir, 'backups', this.hostname, this.username);
|
|
14
64
|
}
|
|
15
65
|
|
|
16
66
|
get isWindows() {
|