herdux-cli 0.5.0 → 0.8.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 +165 -247
- package/README.pt-BR.md +169 -221
- package/dist/commands/backup.d.ts.map +1 -1
- package/dist/commands/backup.js +29 -2
- package/dist/commands/backup.js.map +1 -1
- package/dist/commands/clean.d.ts.map +1 -1
- package/dist/commands/clean.js +3 -1
- package/dist/commands/clean.js.map +1 -1
- package/dist/commands/cloud.d.ts +3 -0
- package/dist/commands/cloud.d.ts.map +1 -0
- package/dist/commands/cloud.js +322 -0
- package/dist/commands/cloud.js.map +1 -0
- package/dist/commands/create.d.ts.map +1 -1
- package/dist/commands/create.js +3 -1
- package/dist/commands/create.js.map +1 -1
- package/dist/commands/docker.d.ts +3 -0
- package/dist/commands/docker.d.ts.map +1 -0
- package/dist/commands/docker.js +106 -0
- package/dist/commands/docker.js.map +1 -0
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +2 -1
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/drop.d.ts.map +1 -1
- package/dist/commands/drop.js +3 -1
- package/dist/commands/drop.js.map +1 -1
- package/dist/commands/inspect.d.ts +3 -0
- package/dist/commands/inspect.d.ts.map +1 -0
- package/dist/commands/inspect.js +29 -0
- package/dist/commands/inspect.js.map +1 -0
- package/dist/commands/list.d.ts.map +1 -1
- package/dist/commands/list.js +3 -1
- package/dist/commands/list.js.map +1 -1
- package/dist/commands/restore.d.ts.map +1 -1
- package/dist/commands/restore.js +33 -1
- package/dist/commands/restore.js.map +1 -1
- package/dist/commands/version.d.ts.map +1 -1
- package/dist/commands/version.js +26 -16
- package/dist/commands/version.js.map +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/infra/cloud/cloud-credential.d.ts +4 -0
- package/dist/infra/cloud/cloud-credential.d.ts.map +1 -0
- package/dist/infra/cloud/cloud-credential.js +16 -0
- package/dist/infra/cloud/cloud-credential.js.map +1 -0
- package/dist/infra/cloud/s3.service.d.ts +23 -0
- package/dist/infra/cloud/s3.service.d.ts.map +1 -0
- package/dist/infra/cloud/s3.service.js +114 -0
- package/dist/infra/cloud/s3.service.js.map +1 -0
- package/dist/infra/config/config.service.d.ts +11 -0
- package/dist/infra/config/config.service.d.ts.map +1 -1
- package/dist/infra/config/config.service.js +16 -0
- package/dist/infra/config/config.service.js.map +1 -1
- package/dist/infra/docker/docker.service.d.ts +14 -0
- package/dist/infra/docker/docker.service.d.ts.map +1 -0
- package/dist/infra/docker/docker.service.js +83 -0
- package/dist/infra/docker/docker.service.js.map +1 -0
- package/dist/infra/engines/inspect-backup.d.ts +13 -0
- package/dist/infra/engines/inspect-backup.d.ts.map +1 -0
- package/dist/infra/engines/inspect-backup.js +97 -0
- package/dist/infra/engines/inspect-backup.js.map +1 -0
- package/dist/infra/engines/mysql/mysql.engine.d.ts +1 -1
- package/dist/infra/engines/mysql/mysql.engine.d.ts.map +1 -1
- package/dist/infra/engines/mysql/mysql.engine.js +4 -1
- package/dist/infra/engines/mysql/mysql.engine.js.map +1 -1
- package/dist/infra/engines/resolve-connection.d.ts +17 -0
- package/dist/infra/engines/resolve-connection.d.ts.map +1 -1
- package/dist/infra/engines/resolve-connection.js +4 -4
- package/dist/infra/engines/resolve-connection.js.map +1 -1
- package/package.json +3 -1
package/README.md
CHANGED
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
<img src=".github/assets/logo.svg" alt="Herdux banner" style="max-width: 100%; width: 600px;" />
|
|
9
9
|
</p>
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## Herdux — Database Workflow CLI
|
|
12
12
|
|
|
13
13
|
A fast, interactive CLI that removes friction from daily local database workflows, especially when juggling multiple instances and large datasets.
|
|
14
14
|
|
|
15
|
-

|
|
16
16
|

|
|
17
17
|

|
|
18
18
|

|
|
@@ -23,27 +23,21 @@ A fast, interactive CLI that removes friction from daily local database workflow
|
|
|
23
23
|
|
|
24
24
|
> Optimized for local and development environments. Production use is supported with explicit configuration.
|
|
25
25
|
|
|
26
|
-
<!-- <p align="center">
|
|
27
|
-
<img src=".github/herdux.gif" alt="herdux terminal gif" width="1220" />
|
|
28
|
-
</p> -->
|
|
29
|
-
|
|
30
26
|
---
|
|
31
27
|
|
|
32
|
-
##
|
|
28
|
+
## Quick Start
|
|
33
29
|
|
|
34
30
|
```bash
|
|
35
31
|
npm install -g herdux-cli
|
|
36
32
|
|
|
37
|
-
#
|
|
33
|
+
# Use either 'herdux' or the shorter 'hdx' alias
|
|
38
34
|
hdx doctor
|
|
39
35
|
herdux list
|
|
40
36
|
```
|
|
41
37
|
|
|
42
|
-
That's it. You're managing databases.
|
|
43
|
-
|
|
44
38
|
---
|
|
45
39
|
|
|
46
|
-
##
|
|
40
|
+
## Supported Engines
|
|
47
41
|
|
|
48
42
|
| Engine | Status | Client Tools Required |
|
|
49
43
|
| ---------- | ------ | ------------------------------- |
|
|
@@ -51,57 +45,22 @@ That's it. You're managing databases.
|
|
|
51
45
|
| MySQL | ✅ | `mysql`, `mysqldump` |
|
|
52
46
|
| SQLite | ✅ | `sqlite3` |
|
|
53
47
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
Internally, no command ever runs without a fully resolved engine.
|
|
48
|
+
Use `--engine <name>` or configure the engine in a saved profile. PostgreSQL is the default.
|
|
57
49
|
|
|
58
50
|
```bash
|
|
59
|
-
# PostgreSQL (default)
|
|
60
|
-
herdux list
|
|
61
|
-
herdux
|
|
62
|
-
|
|
63
|
-
# MySQL
|
|
64
|
-
herdux --engine mysql list
|
|
65
|
-
herdux --engine mysql create mydb
|
|
66
|
-
|
|
67
|
-
# SQLite (file-based, no server required)
|
|
68
|
-
herdux --engine sqlite list
|
|
69
|
-
herdux --engine sqlite create mydb
|
|
70
|
-
|
|
71
|
-
# Or save it in a profile and forget about it
|
|
72
|
-
herdux config add mysql-local --port 3306 --user root --password secret --engine mysql
|
|
73
|
-
herdux list -s mysql-local
|
|
51
|
+
herdux list # PostgreSQL (default)
|
|
52
|
+
herdux --engine mysql list # MySQL
|
|
53
|
+
herdux --engine sqlite list # SQLite (file-based, no server required)
|
|
54
|
+
herdux list -s my-profile # Using a saved server profile
|
|
74
55
|
```
|
|
75
56
|
|
|
76
57
|
---
|
|
77
58
|
|
|
78
|
-
## 🧠 How Herdux Thinks
|
|
79
|
-
|
|
80
|
-
Herdux is designed around **strict separation of concerns**:
|
|
81
|
-
|
|
82
|
-
- **Commands decide _what_ to do**
|
|
83
|
-
- **Engines decide _how_ to do it**
|
|
84
|
-
- **Binaries are never called directly by commands**
|
|
85
|
-
- **All external behavior is isolated behind engine contracts**
|
|
86
|
-
|
|
87
|
-
This architecture guarantees:
|
|
88
|
-
|
|
89
|
-
- predictable behavior
|
|
90
|
-
- engine-agnostic commands
|
|
91
|
-
- safer destructive operations
|
|
92
|
-
- easier extension to new databases
|
|
93
|
-
|
|
94
|
-
If something feels “magical”, it’s probably wrong.
|
|
95
|
-
|
|
96
|
-
Any change that breaks these boundaries is considered a bug.
|
|
97
|
-
|
|
98
|
-
---
|
|
99
|
-
|
|
100
59
|
## Why Herdux?
|
|
101
60
|
|
|
102
|
-
Managing local databases through raw
|
|
61
|
+
Managing local databases through raw binaries is repetitive, error-prone, and different for every engine.
|
|
103
62
|
|
|
104
|
-
|
|
63
|
+
**Before:**
|
|
105
64
|
|
|
106
65
|
```bash
|
|
107
66
|
# PostgreSQL backup
|
|
@@ -110,15 +69,14 @@ pg_dump -U postgres -h localhost -p 5416 -Fc -f ./backups/mydb.dump mydb
|
|
|
110
69
|
# MySQL backup
|
|
111
70
|
mysqldump -u root -h localhost -P 3306 -p mydb > ./backups/mydb.sql
|
|
112
71
|
|
|
113
|
-
# Manually drop, restore, check tools...
|
|
114
72
|
# Different flags, different tools, different muscle memory for each engine.
|
|
115
73
|
```
|
|
116
74
|
|
|
117
|
-
|
|
75
|
+
**After:**
|
|
118
76
|
|
|
119
77
|
```bash
|
|
120
78
|
herdux backup mydb --drop --yes # Backup + drop in one shot
|
|
121
|
-
herdux restore ./backups/mydb.dump --db mydb #
|
|
79
|
+
herdux restore ./backups/mydb.dump --db mydb # Detects format, creates DB if missing
|
|
122
80
|
herdux clean # Multi-select and batch-drop databases
|
|
123
81
|
herdux doctor # Full system health check
|
|
124
82
|
```
|
|
@@ -127,80 +85,23 @@ Same commands. Any engine. Fewer flags. Fewer mistakes. Zero terminal fatigue.
|
|
|
127
85
|
|
|
128
86
|
---
|
|
129
87
|
|
|
130
|
-
##
|
|
131
|
-
|
|
132
|
-
**Herdux** was built _for developers, by developers_.
|
|
133
|
-
|
|
134
|
-
It was born from the daily frustration of constantly having to restore backups to test specific states, drop corrupted databases during development, and juggle raw database binaries.
|
|
135
|
-
|
|
136
|
-
It is specifically designed for developers who:
|
|
137
|
-
|
|
138
|
-
- Manage local infrastructures and need to check disk sizes before seeding new databases.
|
|
139
|
-
- Want to quickly clone, seed, and reset databases without reading `man` pages.
|
|
140
|
-
- Need safe backup & restore workflows that don't rely on fragile bash scripts.
|
|
141
|
-
- Prefer terminal-first tooling.
|
|
142
|
-
- Want predictable connection resolution without hidden magic.
|
|
143
|
-
- Work with **multiple database engines** (PostgreSQL, MySQL, SQLite) and want a unified interface.
|
|
144
|
-
|
|
145
|
-
If you manage databases locally, Herdux was created to solve your pain.
|
|
146
|
-
|
|
147
|
-
---
|
|
148
|
-
|
|
149
|
-
## 🚀 Key Features
|
|
150
|
-
|
|
151
|
-
- **🔌 Multi-Engine Support** — First-class support for PostgreSQL, MySQL, and SQLite. Same commands, same workflow, any engine.
|
|
152
|
-
- **📋 Smart Listing** — Optimized listing strategy for massive clusters. Optional `--size` flag for disk usage analysis, sorted largest-first.
|
|
153
|
-
- **💾 Intelligent Backup & Restore** — Supports Custom (`.dump`) and Plain (`.sql`) formats. Auto-detects the right tool for restores.
|
|
154
|
-
- **🧹 Bulk Cleanup** — Multi-select databases, optionally backup, and batch-drop them. Reclaim disk space instantly.
|
|
155
|
-
- **🩺 System Diagnostics** — One-command health check verifying binaries, authentication, and connectivity.
|
|
156
|
-
- **⚙️ Persistent Profiles** — Save named server configurations with engine type. Switch between environments with `-s pg16`.
|
|
157
|
-
- **🎯 Smart Connection & Engine Resolution** — Explicit CLI flags → profiles → saved defaults → auto-discovery. Always predictable.
|
|
158
|
-
|
|
159
|
-
---
|
|
160
|
-
|
|
161
|
-
## 💡 Philosophy
|
|
162
|
-
|
|
163
|
-
**Herdux** combines _herd_ and _UX_ — delivering a better developer experience when managing your local database clusters. The name reflects our focus on improving the developer experience of managing database herds.
|
|
164
|
-
|
|
165
|
-
**Herdux** follows three principles:
|
|
166
|
-
|
|
167
|
-
- **Safety first** — Never drops data without explicit confirmation or a verified backup.
|
|
168
|
-
- **Explicit over implicit** — Connection and engine resolution follows a strict, documented priority. No magic.
|
|
169
|
-
- **Developer workflow optimization** — Every command is designed to save you from repetitive terminal work.
|
|
170
|
-
|
|
171
|
-
---
|
|
172
|
-
|
|
173
|
-
## 🔒 Safety
|
|
174
|
-
|
|
175
|
-
**Herdux** handles destructive operations with care:
|
|
176
|
-
|
|
177
|
-
- **Never drops a database** unless explicit confirmation is given
|
|
178
|
-
- **Aborts the entire operation** if a safety backup fails during `herdux clean`
|
|
179
|
-
- **Validates backup tool exit codes** before considering a backup successful
|
|
180
|
-
- **Requires `--drop` flag** intentionally — dropping is never the default
|
|
181
|
-
- **`--yes` must be combined with `--drop`** — cannot skip confirmation alone
|
|
182
|
-
|
|
183
|
-
> If you request a backup before dropping and that backup fails, **Herdux** stops immediately. No data is lost.
|
|
184
|
-
|
|
185
|
-
---
|
|
186
|
-
|
|
187
|
-
## 🧩 Requirements
|
|
88
|
+
## Requirements
|
|
188
89
|
|
|
189
90
|
- **Node.js** 18 or higher
|
|
190
|
-
- **For PostgreSQL:** `psql`, `pg_dump`, `pg_restore` installed and
|
|
191
|
-
- **For MySQL:** `mysql`, `mysqldump` installed and
|
|
192
|
-
- **For SQLite:** `sqlite3` installed and
|
|
91
|
+
- **For PostgreSQL:** `psql`, `pg_dump`, `pg_restore` installed and in your `PATH`
|
|
92
|
+
- **For MySQL:** `mysql`, `mysqldump` installed and in your `PATH`
|
|
93
|
+
- **For SQLite:** `sqlite3` installed and in your `PATH`
|
|
193
94
|
|
|
194
95
|
> [!TIP]
|
|
195
|
-
> Run `herdux doctor` after installation to verify everything is set up
|
|
96
|
+
> Run `herdux doctor` after installation to verify everything is correctly set up.
|
|
196
97
|
|
|
197
98
|
---
|
|
198
99
|
|
|
199
|
-
##
|
|
100
|
+
## Installation
|
|
200
101
|
|
|
201
102
|
**npm (recommended):**
|
|
202
103
|
|
|
203
|
-
>
|
|
104
|
+
> **Important:** Use the `-g` flag so the CLI is accessible anywhere in your terminal.
|
|
204
105
|
|
|
205
106
|
```bash
|
|
206
107
|
npm install -g herdux-cli
|
|
@@ -218,9 +119,7 @@ npm link
|
|
|
218
119
|
|
|
219
120
|
---
|
|
220
121
|
|
|
221
|
-
##
|
|
222
|
-
|
|
223
|
-
All commands work with PostgreSQL, MySQL, and SQLite. Use `--engine mysql` or `--engine sqlite`, or configure the engine in your server profile.
|
|
122
|
+
## Commands
|
|
224
123
|
|
|
225
124
|
### `herdux version`
|
|
226
125
|
|
|
@@ -233,11 +132,7 @@ herdux --engine mysql version
|
|
|
233
132
|
|
|
234
133
|
### `herdux doctor`
|
|
235
134
|
|
|
236
|
-
Runs a full system health check:
|
|
237
|
-
|
|
238
|
-
- Verifies the required client tools are installed and reachable (engine-specific)
|
|
239
|
-
- Attempts a live connection using the resolved configuration
|
|
240
|
-
- Tests authentication against the target server
|
|
135
|
+
Runs a full system health check: verifies client tools, tests connectivity, and validates authentication.
|
|
241
136
|
|
|
242
137
|
```bash
|
|
243
138
|
herdux doctor
|
|
@@ -246,17 +141,17 @@ herdux --engine mysql doctor
|
|
|
246
141
|
|
|
247
142
|
---
|
|
248
143
|
|
|
249
|
-
###
|
|
144
|
+
### `herdux list`
|
|
250
145
|
|
|
251
146
|
Lists all databases on the connected server.
|
|
252
147
|
|
|
253
148
|
```bash
|
|
254
|
-
herdux list #
|
|
255
|
-
herdux ls --size # Includes disk size, sorted largest
|
|
149
|
+
herdux list # Name, owner, encoding
|
|
150
|
+
herdux ls --size # Includes disk size, sorted largest to smallest
|
|
256
151
|
```
|
|
257
152
|
|
|
258
153
|
> [!NOTE]
|
|
259
|
-
> The `--size` flag calculates physical disk usage. On servers with dozens of multi-GB databases, this may take a few minutes
|
|
154
|
+
> The `--size` flag calculates physical disk usage. On servers with dozens of multi-GB databases, this may take a few minutes.
|
|
260
155
|
|
|
261
156
|
---
|
|
262
157
|
|
|
@@ -279,210 +174,233 @@ herdux drop my_old_db
|
|
|
279
174
|
|
|
280
175
|
---
|
|
281
176
|
|
|
282
|
-
###
|
|
283
|
-
|
|
284
|
-
Working with seed-heavy development databases? Need to reclaim disk space fast?
|
|
285
|
-
|
|
286
|
-
`herdux clean` allows you to:
|
|
177
|
+
### `herdux clean`
|
|
287
178
|
|
|
288
|
-
|
|
289
|
-
- **Optionally generate safety backups** before any destructive action
|
|
290
|
-
- **Batch-drop** all selected databases safely
|
|
291
|
-
- **Abort immediately** if any backup fails, preventing data loss
|
|
179
|
+
Interactive bulk cleanup: multi-select databases, optionally back them up, and batch-drop them.
|
|
292
180
|
|
|
293
181
|
```bash
|
|
294
182
|
herdux clean
|
|
295
183
|
```
|
|
296
184
|
|
|
297
|
-
|
|
185
|
+
Aborts immediately if any safety backup fails. No data is dropped without a confirmed backup.
|
|
298
186
|
|
|
299
187
|
---
|
|
300
188
|
|
|
301
|
-
###
|
|
189
|
+
### `herdux backup <database>`
|
|
302
190
|
|
|
303
|
-
|
|
191
|
+
Creates a timestamped backup in `~/.herdux/backups/` by default.
|
|
304
192
|
|
|
305
193
|
```bash
|
|
306
|
-
herdux backup mydb
|
|
307
|
-
herdux backup mydb --format plain
|
|
308
|
-
herdux backup mydb --drop
|
|
309
|
-
herdux backup mydb --drop --yes
|
|
310
|
-
herdux backup mydb -o ./my-backups
|
|
194
|
+
herdux backup mydb # Engine-native format (.dump for PG, .db for SQLite, .sql for MySQL)
|
|
195
|
+
herdux backup mydb --format plain # Plain SQL (.sql)
|
|
196
|
+
herdux backup mydb --drop # Backup, then prompt to drop
|
|
197
|
+
herdux backup mydb --drop --yes # Backup + drop, no confirmation
|
|
198
|
+
herdux backup mydb -o ./my-backups # Custom output directory
|
|
199
|
+
herdux backup mydb --upload backups/ # Backup and upload to S3 prefix backups/
|
|
200
|
+
herdux backup mydb --upload backups/ --no-keep # Backup, upload, then delete local file
|
|
311
201
|
```
|
|
312
202
|
|
|
313
|
-
| Option | Description
|
|
314
|
-
| --------------------- |
|
|
315
|
-
| `-F, --format <type>` | `custom` (default,
|
|
316
|
-
| `-d, --drop` | Prompt to drop database after successful backup
|
|
317
|
-
| `-y, --yes` | Skip drop confirmation (requires `--drop`)
|
|
318
|
-
| `-o, --output <dir>` | Output directory (default:
|
|
203
|
+
| Option | Description |
|
|
204
|
+
| --------------------- | ----------------------------------------------------------------- |
|
|
205
|
+
| `-F, --format <type>` | `custom` (default, engine-native) or `plain` (SQL) |
|
|
206
|
+
| `-d, --drop` | Prompt to drop the database after a successful backup |
|
|
207
|
+
| `-y, --yes` | Skip drop confirmation (requires `--drop`) |
|
|
208
|
+
| `-o, --output <dir>` | Output directory (default: `~/.herdux/backups`) |
|
|
209
|
+
| `--upload [prefix]` | Upload backup to S3 after creation (requires cloud config) |
|
|
210
|
+
| `--no-keep` | Delete local backup after successful upload (requires `--upload`) |
|
|
319
211
|
|
|
320
212
|
---
|
|
321
213
|
|
|
322
|
-
###
|
|
214
|
+
### `herdux restore <file>`
|
|
323
215
|
|
|
324
|
-
Restores a database from a backup file.
|
|
325
|
-
|
|
326
|
-
- `.sql` → uses the appropriate SQL import tool
|
|
327
|
-
- `.dump` or any other extension → uses the appropriate restore tool
|
|
216
|
+
Restores a database from a backup file. Auto-detects the format based on file extension.
|
|
328
217
|
|
|
329
218
|
```bash
|
|
330
219
|
herdux restore ./backups/mydb_2026-02-23.dump --db mydb
|
|
331
220
|
herdux restore ./exports/data.sql --db mydb
|
|
221
|
+
herdux restore archive.bkp --db mydb --format custom # Override auto-detection
|
|
332
222
|
```
|
|
333
223
|
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
```bash
|
|
337
|
-
herdux restore archive.bkp --db mydb --format custom
|
|
338
|
-
herdux restore script.txt --db mydb --format plain
|
|
339
|
-
```
|
|
224
|
+
The target database is automatically created if it does not exist.
|
|
340
225
|
|
|
341
226
|
> [!NOTE]
|
|
342
|
-
> When restoring dumps from managed environments (e.g
|
|
227
|
+
> When restoring dumps from managed environments (e.g. AWS RDS), Herdux configures the restore tool to ignore ownership and role assignments, preventing errors from missing production roles.
|
|
343
228
|
|
|
344
229
|
---
|
|
345
230
|
|
|
346
|
-
|
|
231
|
+
### `herdux inspect <file>`
|
|
347
232
|
|
|
348
|
-
|
|
233
|
+
Inspects the contents of a backup file without connecting to a database. Completely offline.
|
|
349
234
|
|
|
350
|
-
|
|
235
|
+
| Extension | Output |
|
|
236
|
+
| ----------------- | ---------------------------------------------------------------------- |
|
|
237
|
+
| `.dump` | PostgreSQL custom format: full Table of Contents (`pg_restore --list`) |
|
|
238
|
+
| `.tar` | PostgreSQL tar format: full Table of Contents (`pg_restore --list`) |
|
|
239
|
+
| `.sql` | Plain SQL (any engine): CREATE TABLE, VIEW, INDEX, SEQUENCE statements |
|
|
240
|
+
| `.db` / `.sqlite` | SQLite database file: schema (`sqlite3 .schema`) |
|
|
351
241
|
|
|
352
242
|
```bash
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
243
|
+
hdx inspect backup.dump # Table of Contents of a PostgreSQL custom dump
|
|
244
|
+
hdx inspect backup.tar # Table of Contents of a PostgreSQL tar dump
|
|
245
|
+
hdx inspect export.sql # CREATE statements extracted from plain SQL
|
|
246
|
+
hdx inspect mydb.db # SQLite schema
|
|
357
247
|
```
|
|
358
248
|
|
|
359
|
-
|
|
249
|
+
---
|
|
250
|
+
|
|
251
|
+
### `herdux docker`
|
|
360
252
|
|
|
361
|
-
|
|
253
|
+
Manages database containers running via Docker. Does not require a live database connection.
|
|
362
254
|
|
|
363
255
|
```bash
|
|
364
|
-
#
|
|
365
|
-
|
|
366
|
-
|
|
256
|
+
hdx docker list # List running postgres/mysql containers
|
|
257
|
+
hdx docker list --all # Include stopped containers
|
|
258
|
+
hdx docker start pg-dev # Start a stopped container
|
|
259
|
+
hdx docker stop pg-dev # Stop a running container
|
|
260
|
+
hdx docker stop pg-dev --remove # Stop and remove the container
|
|
261
|
+
```
|
|
367
262
|
|
|
368
|
-
|
|
369
|
-
herdux config add mysql-dev --port 3306 --user root --password secret --engine mysql
|
|
263
|
+
---
|
|
370
264
|
|
|
371
|
-
|
|
372
|
-
herdux config add staging --host 192.168.0.10 --port 5432
|
|
373
|
-
```
|
|
265
|
+
### `herdux cloud`
|
|
374
266
|
|
|
375
|
-
|
|
267
|
+
Manages backup files in S3-compatible cloud storage (AWS S3, Cloudflare R2, MinIO, DigitalOcean Spaces, and others).
|
|
376
268
|
|
|
377
269
|
```bash
|
|
378
|
-
|
|
379
|
-
|
|
270
|
+
# Configure
|
|
271
|
+
hdx cloud config bucket my-bucket
|
|
272
|
+
hdx cloud config region us-east-1
|
|
273
|
+
hdx cloud config access-key AKIAIO...
|
|
274
|
+
hdx cloud config secret-key wJalrX...
|
|
275
|
+
hdx cloud config endpoint https://account.r2.cloudflarestorage.com # optional, for non-AWS providers
|
|
276
|
+
|
|
277
|
+
# Browse and manage backups in the bucket
|
|
278
|
+
hdx cloud list # Directory mode: list immediate children at root
|
|
279
|
+
hdx cloud list backups/mydb/ # List immediate children at path (positional)
|
|
280
|
+
hdx cloud list --prefix backups/mydb/ # Same as above (flag form)
|
|
281
|
+
hdx cloud list --recursive # List all objects in the bucket
|
|
282
|
+
hdx cloud list backups/ --recursive # List all objects under a prefix
|
|
283
|
+
hdx cloud download backups/mydb_2026-03-03.dump # Save to ~/.herdux/backups/
|
|
284
|
+
hdx cloud download backups/mydb_2026-03-03.dump -o /tmp/ # Save to custom directory
|
|
285
|
+
hdx cloud upload ./mydb_2026-03-03.dump # Upload file to bucket root
|
|
286
|
+
hdx cloud upload ./mydb_2026-03-03.dump --prefix backups/ # Upload under a prefix
|
|
287
|
+
hdx cloud delete backups/mydb_2026-03-03.dump # Verifies existence, then asks for confirmation
|
|
288
|
+
hdx cloud delete backups/mydb_2026-03-03.dump --yes
|
|
289
|
+
|
|
290
|
+
# Backup directly to S3
|
|
291
|
+
hdx backup mydb --upload backups/ # Backup and upload to prefix backups/
|
|
292
|
+
hdx backup mydb --upload # Backup and upload to bucket root
|
|
293
|
+
hdx backup mydb --upload backups/ --no-keep # Backup, upload, then delete local file
|
|
294
|
+
|
|
295
|
+
# Restore directly from S3
|
|
296
|
+
hdx restore s3://my-bucket/backups/mydb_2026-03-03.dump --db mydb
|
|
380
297
|
```
|
|
381
298
|
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
### View & Manage Config
|
|
299
|
+
Credentials can also be provided via env vars (recommended for CI/production):
|
|
385
300
|
|
|
386
301
|
```bash
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
herdux config reset # Clear all configuration
|
|
302
|
+
export AWS_ACCESS_KEY_ID=AKIAIO...
|
|
303
|
+
export AWS_SECRET_ACCESS_KEY=wJalrX...
|
|
304
|
+
export AWS_DEFAULT_REGION=us-east-1
|
|
391
305
|
```
|
|
392
306
|
|
|
393
307
|
---
|
|
394
308
|
|
|
395
|
-
##
|
|
396
|
-
|
|
397
|
-
When resolving how to connect and which engine to use, **Herdux** follows a strict, predictable priority order:
|
|
309
|
+
## Configuration & Server Profiles
|
|
398
310
|
|
|
399
|
-
|
|
311
|
+
Configuration is stored at `~/.herdux/config.json`.
|
|
400
312
|
|
|
401
|
-
|
|
402
|
-
| -------- | ------------------ | -------------------------------- |
|
|
403
|
-
| 1️⃣ | **CLI flag** | `herdux --engine mysql list` |
|
|
404
|
-
| 2️⃣ | **Server profile** | Profile's `engine` field |
|
|
405
|
-
| 3️⃣ | **Saved default** | `herdux config set engine mysql` |
|
|
406
|
-
| 4️⃣ | **Fallback** | `postgres` |
|
|
313
|
+
### Global defaults
|
|
407
314
|
|
|
408
|
-
|
|
315
|
+
```bash
|
|
316
|
+
herdux config set engine postgres
|
|
317
|
+
herdux config set user postgres
|
|
318
|
+
herdux config set password my_secret
|
|
319
|
+
herdux config set port 5432
|
|
320
|
+
```
|
|
409
321
|
|
|
410
|
-
|
|
411
|
-
| -------- | ------------------ | --------------------------------------------- |
|
|
412
|
-
| 1️⃣ | **CLI flags** | `herdux list --port 5417` |
|
|
413
|
-
| 2️⃣ | **Server profile** | `herdux list -s pg16` |
|
|
414
|
-
| 3️⃣ | **Saved defaults** | `herdux config set port 5432` |
|
|
415
|
-
| 4️⃣ | **Auto-discovery** | Scans common ports; prompts if multiple found |
|
|
322
|
+
### Named server profiles
|
|
416
323
|
|
|
417
|
-
|
|
324
|
+
```bash
|
|
325
|
+
herdux config add pg16 --port 5416
|
|
326
|
+
herdux config add pg17 --port 5417 --user admin
|
|
327
|
+
herdux config add mysql-dev --port 3306 --user root --password secret --engine mysql
|
|
328
|
+
herdux config add staging --host 192.168.0.10 --port 5432
|
|
329
|
+
```
|
|
418
330
|
|
|
419
|
-
|
|
331
|
+
Use profiles with the `-s` flag:
|
|
420
332
|
|
|
421
|
-
|
|
333
|
+
```bash
|
|
334
|
+
herdux list -s pg16
|
|
335
|
+
herdux backup mydb -s mysql-dev
|
|
336
|
+
```
|
|
422
337
|
|
|
423
|
-
|
|
424
|
-
It's a workflow accelerator for developers who live in the terminal.
|
|
338
|
+
### Manage config
|
|
425
339
|
|
|
426
|
-
|
|
340
|
+
```bash
|
|
341
|
+
herdux config list # Show all settings and profiles
|
|
342
|
+
herdux config get port # Get a specific value
|
|
343
|
+
herdux config rm pg16 # Remove a profile
|
|
344
|
+
herdux config reset # Clear all configuration
|
|
345
|
+
```
|
|
427
346
|
|
|
428
347
|
---
|
|
429
348
|
|
|
430
|
-
##
|
|
349
|
+
## Connection & Engine Resolution
|
|
431
350
|
|
|
432
|
-
|
|
433
|
-
- No destructive magic.
|
|
434
|
-
- Deterministic connection and engine resolution.
|
|
435
|
-
- Explicit and composable commands.
|
|
436
|
-
- Engine-agnostic: same interface, any database.
|
|
351
|
+
Herdux follows a strict, predictable priority when resolving how to connect.
|
|
437
352
|
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
## 🐳 Docker Support
|
|
353
|
+
**Engine priority:**
|
|
441
354
|
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
355
|
+
| Priority | Source | Example |
|
|
356
|
+
| -------- | -------------- | -------------------------------- |
|
|
357
|
+
| 1 | CLI flag | `herdux --engine mysql list` |
|
|
358
|
+
| 2 | Server profile | Profile's `engine` field |
|
|
359
|
+
| 3 | Saved default | `herdux config set engine mysql` |
|
|
360
|
+
| 4 | Fallback | `postgres` |
|
|
445
361
|
|
|
446
|
-
|
|
362
|
+
**Connection priority:**
|
|
447
363
|
|
|
448
|
-
|
|
364
|
+
| Priority | Source | Example |
|
|
365
|
+
| -------- | -------------- | --------------------------------------------- |
|
|
366
|
+
| 1 | CLI flags | `herdux list --port 5417` |
|
|
367
|
+
| 2 | Server profile | `herdux list -s pg16` |
|
|
368
|
+
| 3 | Saved defaults | `herdux config set port 5432` |
|
|
369
|
+
| 4 | Auto-discovery | Scans common ports; prompts if multiple found |
|
|
449
370
|
|
|
450
|
-
|
|
371
|
+
Explicit input always wins. No surprises.
|
|
451
372
|
|
|
452
373
|
---
|
|
453
374
|
|
|
454
|
-
##
|
|
455
|
-
|
|
456
|
-
PRs are welcome! Please open an issue first to discuss major changes.
|
|
375
|
+
## Contributing
|
|
457
376
|
|
|
458
377
|
```bash
|
|
459
378
|
git clone https://github.com/herdux/herdux-cli.git
|
|
460
379
|
cd herdux-cli
|
|
461
380
|
npm install
|
|
462
|
-
npm run dev
|
|
463
381
|
|
|
464
|
-
#
|
|
465
|
-
npm run test:
|
|
466
|
-
|
|
467
|
-
npm run test:e2e:
|
|
468
|
-
npm run test:e2e:
|
|
382
|
+
npm run test:unit # Unit tests (238 tests, all engines)
|
|
383
|
+
npm run test:integration # Integration tests
|
|
384
|
+
npm run test:e2e:pgsql # E2E tests for PostgreSQL (requires Docker)
|
|
385
|
+
npm run test:e2e:mysql # E2E tests for MySQL (requires Docker)
|
|
386
|
+
npm run test:e2e:sqlite # E2E tests for SQLite (requires sqlite3)
|
|
469
387
|
```
|
|
470
388
|
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
389
|
+
Herdux follows strict architectural boundaries: commands are engine-agnostic, engines encapsulate all database-specific behavior, and all binaries are isolated behind adapters. Keep these boundaries intact when contributing.
|
|
390
|
+
|
|
391
|
+
PRs are welcome. Open an issue first for major changes.
|
|
474
392
|
|
|
475
393
|
---
|
|
476
394
|
|
|
477
|
-
##
|
|
395
|
+
## Support
|
|
478
396
|
|
|
479
|
-
If
|
|
397
|
+
If Herdux has saved you hours of debugging and database wrangling, consider supporting the project:
|
|
480
398
|
|
|
481
399
|
<a href="https://github.com/sponsors/eduardozaniboni" target="_blank"><img src="https://img.shields.io/badge/Sponsor-%E2%9D%A4-pink?style=for-the-badge&logo=github" alt="GitHub Sponsors"></a>
|
|
482
400
|
<a href="https://www.buymeacoffee.com/eduardozaniboni" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 28px !important;width: 100px !important;" ></a>
|
|
483
401
|
|
|
484
402
|
---
|
|
485
403
|
|
|
486
|
-
##
|
|
404
|
+
## License
|
|
487
405
|
|
|
488
406
|
MIT
|