@carllee1983/dbcli 1.1.0 → 1.2.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/CHANGELOG.md +29 -0
- package/README.md +240 -49
- package/README.zh-TW.md +951 -338
- package/assets/SKILL.md +33 -5
- package/dist/cli.mjs +481 -35
- package/package.json +1 -1
package/assets/SKILL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: dbcli
|
|
3
|
-
description: Database CLI for AI agents with permission-based access control. Use to query, inspect schemas, insert/update/delete data, export results, and manage sensitive data blacklists. Supports MySQL, PostgreSQL, MariaDB. Trigger when working with databases, running SQL, exploring table structures, or protecting sensitive columns/tables from AI access.
|
|
3
|
+
description: Database CLI for AI agents with permission-based access control. Use to query, inspect schemas, insert/update/delete data, export results, and manage sensitive data blacklists. Supports MySQL, PostgreSQL, MariaDB with multiple named connections per project and custom env files. Trigger when working with databases, running SQL, exploring table structures, switching between database environments, or protecting sensitive columns/tables from AI access.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# dbcli
|
|
@@ -22,16 +22,43 @@ dbcli query "SELECT * FROM users" # Execute SQL
|
|
|
22
22
|
Initialize `.dbcli` configuration file. Typically run manually by the developer — avoid running on behalf of the user unless explicitly requested.
|
|
23
23
|
|
|
24
24
|
```bash
|
|
25
|
-
dbcli init
|
|
25
|
+
dbcli init # Single connection (v1 format)
|
|
26
26
|
dbcli init --system mysql --host localhost --port 3306 --user root --name mydb
|
|
27
|
-
dbcli init --use-env-refs
|
|
28
|
-
dbcli init --no-interactive --force
|
|
27
|
+
dbcli init --use-env-refs # Store env var references
|
|
28
|
+
dbcli init --no-interactive --force # Non-interactive mode
|
|
29
|
+
|
|
30
|
+
# Multi-connection (v2 format)
|
|
31
|
+
dbcli init --conn-name staging --env-file .env.staging # Named connection with custom env file
|
|
32
|
+
dbcli init --conn-name prod --env-file .env.production --use-env-refs --skip-test
|
|
33
|
+
dbcli init --remove staging # Remove a named connection
|
|
34
|
+
dbcli init --rename staging:production # Rename a connection
|
|
29
35
|
```
|
|
30
36
|
|
|
31
|
-
**Key options:** `--system
|
|
37
|
+
**Key options:** `--system`, `--permission`, `--use-env-refs`, `--skip-test`, `--no-interactive`, `--force`, `--conn-name <name>`, `--env-file <path>`, `--remove <name>`, `--rename <old:new>`
|
|
38
|
+
|
|
39
|
+
**Multi-connection:** Using `--conn-name` or `--env-file` creates a v2 config with named connections. Each connection can have its own env file and permission level. Existing v1 configs are automatically imported as the `default` connection when upgrading.
|
|
32
40
|
|
|
33
41
|
> **AI agent note on `--use-env-refs`:** If an existing `.dbcli` config contains `{"$env": "DB_HOST"}` style references, the connection values are read from environment variables at runtime. Do NOT re-run `init` to replace these references with actual values — the env-ref format is intentional for CI/CD and multi-environment setups.
|
|
34
42
|
|
|
43
|
+
### use
|
|
44
|
+
|
|
45
|
+
Switch or display the default database connection (v2 multi-connection config).
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
dbcli use # Show current default connection
|
|
49
|
+
dbcli use staging # Switch default to 'staging'
|
|
50
|
+
dbcli use --list # List all connections (* marks default)
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Any command can also use `--use <name>` to temporarily select a connection without changing the default:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
dbcli query --use staging "SELECT * FROM users LIMIT 10"
|
|
57
|
+
dbcli list --use prod
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
**Requires v2 config** (created with `dbcli init --conn-name`).
|
|
61
|
+
|
|
35
62
|
### list
|
|
36
63
|
|
|
37
64
|
List all tables.
|
|
@@ -308,6 +335,7 @@ Set via `dbcli init --permission <level>` or in `.dbcli` config.
|
|
|
308
335
|
| Flag | Description |
|
|
309
336
|
|------|-------------|
|
|
310
337
|
| `--config <path>` | Path to .dbcli config file (default: `.dbcli`) |
|
|
338
|
+
| `--use <connection>` | Use a specific named connection (v2 config) |
|
|
311
339
|
| `-v, --verbose` | Increase verbosity (`-v` verbose, `-vv` debug) |
|
|
312
340
|
| `-q, --quiet` | Suppress non-essential output |
|
|
313
341
|
| `--no-color` | Disable colored output (also respects `NO_COLOR` env var) |
|