cloudsync-cli 2026.7.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/LICENSE +21 -0
- package/README.md +560 -0
- package/bin/cloudsync.js +48 -0
- package/package.json +104 -0
- package/src/cli/commands/clone.js +103 -0
- package/src/cli/commands/commit.js +153 -0
- package/src/cli/commands/config.js +188 -0
- package/src/cli/commands/diff.js +122 -0
- package/src/cli/commands/doctor.js +142 -0
- package/src/cli/commands/download.js +130 -0
- package/src/cli/commands/history.js +92 -0
- package/src/cli/commands/init.js +103 -0
- package/src/cli/commands/log.js +124 -0
- package/src/cli/commands/port.js +76 -0
- package/src/cli/commands/rollback.js +100 -0
- package/src/cli/commands/share.js +305 -0
- package/src/cli/commands/stage.js +155 -0
- package/src/cli/commands/status.js +193 -0
- package/src/cli/commands/sync.js +255 -0
- package/src/cli/commands/unstage.js +92 -0
- package/src/cli/commands/upload.js +287 -0
- package/src/cli/index.js +134 -0
- package/src/core/crypto/index.js +94 -0
- package/src/core/transport/index.js +264 -0
- package/src/core/vcs/index.js +202 -0
- package/src/utils/helpers.js +234 -0
- package/src/utils/logger.js +66 -0
- package/src/version.mjs +1 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logger - Shared operation logging for all CloudSync commands
|
|
3
|
+
* Writes structured JSON logs to .cloudsync/logs/
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { existsSync, mkdirSync, writeFileSync, readFileSync, readdirSync } from 'fs';
|
|
7
|
+
import { join } from 'path';
|
|
8
|
+
|
|
9
|
+
const LOGS_DIR = join(process.cwd(), '.cloudsync', 'logs');
|
|
10
|
+
|
|
11
|
+
function ensureLogsDir() {
|
|
12
|
+
if (!existsSync(LOGS_DIR)) {
|
|
13
|
+
mkdirSync(LOGS_DIR, { recursive: true });
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Log an operation
|
|
19
|
+
*/
|
|
20
|
+
export function logOperation(type, message, meta = {}) {
|
|
21
|
+
ensureLogsDir();
|
|
22
|
+
|
|
23
|
+
const timestamp = new Date().toISOString();
|
|
24
|
+
const logEntry = {
|
|
25
|
+
type,
|
|
26
|
+
message,
|
|
27
|
+
timestamp,
|
|
28
|
+
...meta
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const filename = `op-${Date.now()}-${Math.random().toString(36).slice(2, 6)}.json`;
|
|
32
|
+
writeFileSync(join(LOGS_DIR, filename), JSON.stringify(logEntry, null, 2));
|
|
33
|
+
|
|
34
|
+
return logEntry;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Get recent log entries
|
|
39
|
+
*/
|
|
40
|
+
export function getRecentLogs(limit = 20, type = 'all') {
|
|
41
|
+
ensureLogsDir();
|
|
42
|
+
|
|
43
|
+
try {
|
|
44
|
+
const files = readdirSync(LOGS_DIR)
|
|
45
|
+
.filter(f => f.endsWith('.json'))
|
|
46
|
+
.sort()
|
|
47
|
+
.reverse()
|
|
48
|
+
.slice(0, limit * 2); // over-fetch to account for type filtering
|
|
49
|
+
|
|
50
|
+
const logs = [];
|
|
51
|
+
for (const file of files) {
|
|
52
|
+
try {
|
|
53
|
+
const log = JSON.parse(readFileSync(join(LOGS_DIR, file), 'utf8'));
|
|
54
|
+
if (type === 'all' || log.type === type) {
|
|
55
|
+
logs.push(log);
|
|
56
|
+
}
|
|
57
|
+
if (logs.length >= limit) break;
|
|
58
|
+
} catch (e) { /* skip */ }
|
|
59
|
+
}
|
|
60
|
+
return logs;
|
|
61
|
+
} catch (e) {
|
|
62
|
+
return [];
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export default { logOperation, getRecentLogs };
|
package/src/version.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const VERSION = '2026.7.1';
|