hsync-cli 1.0.0 → 1.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 +152 -0
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
# hsync-cli
|
|
2
|
+
|
|
3
|
+
> Premium, zero-dependency cross-device file synchronization and storage manager terminal client.
|
|
4
|
+
|
|
5
|
+
`hsync-cli` is a powerful, lightweight command-line companion for **File Sync V2**. It allows you to manage buckets, transfer files, and orchestrate automated, real-time bidirectional synchronization directly from your terminal.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 🚀 Installation
|
|
10
|
+
|
|
11
|
+
Install the package globally via your preferred Node package manager:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install -g hsync-cli
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
*Note: Once installed, the `hsync` command will be globally symlinked to your shell environment.*
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## 🛠️ Setup & Authentication
|
|
22
|
+
|
|
23
|
+
Before running synchronization tasks, configure the CLI to target your Express API server and authenticate.
|
|
24
|
+
|
|
25
|
+
### 1. Set API Server Target
|
|
26
|
+
Specify the URL of the running File Sync V2 API server:
|
|
27
|
+
```bash
|
|
28
|
+
hsync config set-server http://localhost:3000
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### 2. Login & Authenticate
|
|
32
|
+
Log in securely to generate and download your persistent personal API key (`X-API-Key`):
|
|
33
|
+
```bash
|
|
34
|
+
hsync login
|
|
35
|
+
```
|
|
36
|
+
*Note: You can skip interactive prompts in script/headless environments by passing a pre-generated API key directly:*
|
|
37
|
+
```bash
|
|
38
|
+
hsync login --api-key hmd_xxxxxxxxxxxxxxxxxxxx
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### 3. Check Connection
|
|
42
|
+
Verify your authenticated session details:
|
|
43
|
+
```bash
|
|
44
|
+
hsync me
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### 4. Logout
|
|
48
|
+
Remove credentials and invalidate the active API key session locally:
|
|
49
|
+
```bash
|
|
50
|
+
hsync logout
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## 📁 Managing Storage Buckets
|
|
56
|
+
|
|
57
|
+
Storage buckets are logical sandboxes backed by pluggable providers (Local folders or Amazon S3 buckets).
|
|
58
|
+
|
|
59
|
+
### List Buckets
|
|
60
|
+
See all buckets registered under your account:
|
|
61
|
+
```bash
|
|
62
|
+
hsync bucket list
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Create a Bucket
|
|
66
|
+
Register a new storage sandbox:
|
|
67
|
+
```bash
|
|
68
|
+
# Create a Local folder provider bucket
|
|
69
|
+
hsync bucket create "My Projects" my-projects --provider local --rootPath /data/my-projects
|
|
70
|
+
|
|
71
|
+
# Create an Amazon S3 provider bucket
|
|
72
|
+
hsync bucket create "Cloud Backups" backups --provider s3 --bucket my-aws-s3-bucket-name
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Delete a Bucket
|
|
76
|
+
Permanently destroy a storage bucket (this also wipes files inside):
|
|
77
|
+
```bash
|
|
78
|
+
hsync bucket delete my-projects
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## ⚡ Direct File Transfers (Push & Pull)
|
|
84
|
+
|
|
85
|
+
You can run immediate, one-off file or folder transfers without setting up persistent schedules.
|
|
86
|
+
|
|
87
|
+
### Push (Upload to Server)
|
|
88
|
+
Upload a local folder or file to a specific remote bucket target (e.g. `bucket-slug:optional-remote-path`):
|
|
89
|
+
```bash
|
|
90
|
+
hsync push ./my-local-code projects-bucket:active-source
|
|
91
|
+
```
|
|
92
|
+
*Tip: Skip conflict resolution prompts and force overwrites using `-y` or `--yes`:*
|
|
93
|
+
```bash
|
|
94
|
+
hsync push ./my-local-code projects-bucket:active-source --yes
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Pull (Download to Machine)
|
|
98
|
+
Download a folder or file from a remote bucket directly to your local machine:
|
|
99
|
+
```bash
|
|
100
|
+
hsync pull projects-bucket:active-source ./downloaded-code
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## 🔄 Automated Folder Synchronization
|
|
106
|
+
|
|
107
|
+
The sync engine uses local SQLite trackers to orchestrate continuous synchronization cycles, keeping folders on multiple devices automatically in sync with the remote server.
|
|
108
|
+
|
|
109
|
+
### 1. Register a Sync Profile
|
|
110
|
+
Define a persistent local-to-remote folder synchronization job:
|
|
111
|
+
```bash
|
|
112
|
+
hsync sync add /path/to/local/dir bucket-slug:remote-path \
|
|
113
|
+
--name project-sync \
|
|
114
|
+
--direction bidirectional \
|
|
115
|
+
--strategy newer-wins \
|
|
116
|
+
--interval 10
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
#### Sync Config Flags:
|
|
120
|
+
* `-n, --name <jobName>`: A unique name identifier for your job.
|
|
121
|
+
* `-d, --direction <push|pull|bidirectional>`: Sync direction format.
|
|
122
|
+
* `-s, --strategy <local-wins|server-wins|newer-wins>`: Rules on resolving file modifications conflicts.
|
|
123
|
+
* `-i, --interval <seconds>`: Frequency of the background scan cycle (default: `10` seconds).
|
|
124
|
+
* `--no-conflict-copy`: Disable saving conflict backup files (`filename.conflict-YYYY-MM-DD.ext`).
|
|
125
|
+
|
|
126
|
+
### 2. List Registered Sync Jobs
|
|
127
|
+
List all synchronization jobs configured on your machine:
|
|
128
|
+
```bash
|
|
129
|
+
hsync sync list
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### 3. Remove a Sync Job
|
|
133
|
+
Stop tracking a registered sync job:
|
|
134
|
+
```bash
|
|
135
|
+
hsync sync remove project-sync
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### 4. Start the Synchronization Scheduler
|
|
139
|
+
Launch the active sync loop to scan and synchronize folders automatically in the background:
|
|
140
|
+
```bash
|
|
141
|
+
# Start all registered sync jobs
|
|
142
|
+
hsync sync start
|
|
143
|
+
|
|
144
|
+
# Start a specific sync job by name
|
|
145
|
+
hsync sync start project-sync
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## 🛡️ License
|
|
151
|
+
|
|
152
|
+
MIT License. Designed with antigravity by the Advanced Agentic Coding team.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hsync-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "hsync CLI for file sync operations",
|
|
5
5
|
"bin": {
|
|
6
6
|
"hsync": "./dist/bin.js"
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
"test": "bun test"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@file-sync/sync-engine": "workspace:*",
|
|
19
18
|
"chalk": "^5.3.0",
|
|
20
19
|
"commander": "^12.0.0",
|
|
21
20
|
"axios": "^1.6.5",
|
|
@@ -23,6 +22,7 @@
|
|
|
23
22
|
"ora": "^8.0.1"
|
|
24
23
|
},
|
|
25
24
|
"devDependencies": {
|
|
25
|
+
"@file-sync/sync-engine": "workspace:*",
|
|
26
26
|
"@types/bun": "^1.1.0",
|
|
27
27
|
"@types/node": "^20.11.0",
|
|
28
28
|
"typescript": "^5.3.0"
|