herdux-cli 0.4.2 → 0.7.0
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 +116 -241
- package/README.pt-BR.md +120 -215
- package/dist/commands/backup.d.ts.map +1 -1
- package/dist/commands/backup.js +12 -1
- package/dist/commands/backup.js.map +1 -1
- package/dist/commands/clean.d.ts.map +1 -1
- package/dist/commands/clean.js +12 -2
- package/dist/commands/clean.js.map +1 -1
- package/dist/commands/config.d.ts.map +1 -1
- package/dist/commands/config.js +19 -2
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/create.d.ts.map +1 -1
- package/dist/commands/create.js +13 -2
- 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 +8 -2
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/drop.d.ts.map +1 -1
- package/dist/commands/drop.js +14 -2
- 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 +11 -2
- package/dist/commands/list.js.map +1 -1
- package/dist/commands/restore.d.ts.map +1 -1
- package/dist/commands/restore.js +10 -1
- package/dist/commands/restore.js.map +1 -1
- package/dist/commands/version.d.ts.map +1 -1
- package/dist/commands/version.js +32 -17
- package/dist/commands/version.js.map +1 -1
- package/dist/core/interfaces/database-engine.interface.d.ts +1 -1
- package/dist/core/interfaces/database-engine.interface.d.ts.map +1 -1
- package/dist/index.js +31 -2
- package/dist/index.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/engine-factory.d.ts.map +1 -1
- package/dist/infra/engines/engine-factory.js +3 -0
- package/dist/infra/engines/engine-factory.js.map +1 -1
- 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.map +1 -1
- package/dist/infra/engines/resolve-connection.js +78 -55
- package/dist/infra/engines/resolve-connection.js.map +1 -1
- package/dist/infra/engines/sqlite/sqlite-env.d.ts +2 -0
- package/dist/infra/engines/sqlite/sqlite-env.d.ts.map +1 -0
- package/dist/infra/engines/sqlite/sqlite-env.js +24 -0
- package/dist/infra/engines/sqlite/sqlite-env.js.map +1 -0
- package/dist/infra/engines/sqlite/sqlite.engine.d.ts +21 -0
- package/dist/infra/engines/sqlite/sqlite.engine.d.ts.map +1 -0
- package/dist/infra/engines/sqlite/sqlite.engine.js +207 -0
- package/dist/infra/engines/sqlite/sqlite.engine.js.map +1 -0
- package/package.json +4 -1
package/README.md
CHANGED
|
@@ -8,94 +8,59 @@
|
|
|
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
|

|
|
19
19
|

|
|
20
|
+

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