@carllee1983/dbcli 10.0.0 → 11.0.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/dist/cli.mjs CHANGED
@@ -3,7 +3,7 @@
3
3
  // package.json
4
4
  var package_default = {
5
5
  name: "@carllee1983/dbcli",
6
- version: "10.0.0",
6
+ version: "11.0.0",
7
7
  description: "Database CLI for AI agents",
8
8
  type: "module",
9
9
  publishConfig: {
@@ -103,6 +103,7 @@ var package_default = {
103
103
  "lru-cache": "^11.4.0",
104
104
  "lucide-react": "^1.16.0",
105
105
  mongodb: "^7.2.0",
106
+ "mongodb-connection-string-url": "^7.0.1",
106
107
  mysql2: "^3.24.3",
107
108
  "node-sql-parser": "5",
108
109
  open: "^11.0.0",
package/dist/core.d.ts CHANGED
@@ -36,6 +36,8 @@ export interface ConnectionOptions {
36
36
  replicaSet?: string;
37
37
  /** MongoDB TLS switch (optional, field-based config; implied true when srv) */
38
38
  tls?: boolean;
39
+ /** MongoDB extra driver options appended to the URI query string (field-based config, plain strings only) */
40
+ options?: Record<string, string>;
39
41
  /** MongoDB SRV lookup — build a mongodb+srv:// URI from host (optional, field-based config) */
40
42
  srv?: boolean;
41
43
  /** Connection timeout in milliseconds (default: 5000) */
@@ -440,6 +442,8 @@ interface MongoDBConnectionConfig {
440
442
  $env: string;
441
443
  };
442
444
  tls?: boolean;
445
+ /** Extra driver options appended to the URI query string; plain strings, no env-ref */
446
+ options?: Record<string, string>;
443
447
  /** Build a mongodb+srv:// URI from host and expand it via DNS SRV lookup */
444
448
  srv?: boolean;
445
449
  }
@@ -1105,6 +1109,7 @@ declare const DbcliConfigSchema: z.ZodObject<{
1105
1109
  }>
1106
1110
  ]>>;
1107
1111
  tls: z.ZodOptional<z.ZodBoolean>;
1112
+ options: z.ZodOptional<z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodString>, Record<string, string>, Record<string, string>>>;
1108
1113
  srv: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1109
1114
  }, "strip", z.ZodTypeAny, {
1110
1115
  password: string | {
@@ -1134,6 +1139,7 @@ declare const DbcliConfigSchema: z.ZodObject<{
1134
1139
  $env: string;
1135
1140
  } | undefined;
1136
1141
  tls?: boolean | undefined;
1142
+ options?: Record<string, string> | undefined;
1137
1143
  timeout?: number | undefined;
1138
1144
  statementTimeout?: number | undefined;
1139
1145
  }, {
@@ -1163,6 +1169,7 @@ declare const DbcliConfigSchema: z.ZodObject<{
1163
1169
  $env: string;
1164
1170
  } | undefined;
1165
1171
  tls?: boolean | undefined;
1172
+ options?: Record<string, string> | undefined;
1166
1173
  srv?: boolean | undefined;
1167
1174
  timeout?: number | undefined;
1168
1175
  statementTimeout?: number | undefined;
@@ -1569,6 +1576,7 @@ declare const DbcliConfigSchema: z.ZodObject<{
1569
1576
  $env: string;
1570
1577
  } | undefined;
1571
1578
  tls?: boolean | undefined;
1579
+ options?: Record<string, string> | undefined;
1572
1580
  timeout?: number | undefined;
1573
1581
  statementTimeout?: number | undefined;
1574
1582
  } | {
@@ -1701,6 +1709,7 @@ declare const DbcliConfigSchema: z.ZodObject<{
1701
1709
  $env: string;
1702
1710
  } | undefined;
1703
1711
  tls?: boolean | undefined;
1712
+ options?: Record<string, string> | undefined;
1704
1713
  srv?: boolean | undefined;
1705
1714
  timeout?: number | undefined;
1706
1715
  statementTimeout?: number | undefined;
@@ -2154,6 +2163,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
2154
2163
  }>
2155
2164
  ]>>;
2156
2165
  tls: z.ZodOptional<z.ZodBoolean>;
2166
+ options: z.ZodOptional<z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodString>, Record<string, string>, Record<string, string>>>;
2157
2167
  srv: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
2158
2168
  } & {
2159
2169
  permission: z.ZodDefault<z.ZodEnum<[
@@ -2193,6 +2203,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
2193
2203
  $env: string;
2194
2204
  } | undefined;
2195
2205
  tls?: boolean | undefined;
2206
+ options?: Record<string, string> | undefined;
2196
2207
  timeout?: number | undefined;
2197
2208
  statementTimeout?: number | undefined;
2198
2209
  envFile?: string | undefined;
@@ -2224,6 +2235,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
2224
2235
  $env: string;
2225
2236
  } | undefined;
2226
2237
  tls?: boolean | undefined;
2238
+ options?: Record<string, string> | undefined;
2227
2239
  srv?: boolean | undefined;
2228
2240
  timeout?: number | undefined;
2229
2241
  permission?: "admin" | "query-only" | "read-write" | "data-admin" | undefined;
@@ -2570,6 +2582,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
2570
2582
  $env: string;
2571
2583
  } | undefined;
2572
2584
  tls?: boolean | undefined;
2585
+ options?: Record<string, string> | undefined;
2573
2586
  timeout?: number | undefined;
2574
2587
  statementTimeout?: number | undefined;
2575
2588
  envFile?: string | undefined;
@@ -2704,6 +2717,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
2704
2717
  $env: string;
2705
2718
  } | undefined;
2706
2719
  tls?: boolean | undefined;
2720
+ options?: Record<string, string> | undefined;
2707
2721
  timeout?: number | undefined;
2708
2722
  statementTimeout?: number | undefined;
2709
2723
  envFile?: string | undefined;
@@ -2980,6 +2994,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
2980
2994
  $env: string;
2981
2995
  } | undefined;
2982
2996
  tls?: boolean | undefined;
2997
+ options?: Record<string, string> | undefined;
2983
2998
  timeout?: number | undefined;
2984
2999
  statementTimeout?: number | undefined;
2985
3000
  envFile?: string | undefined;
@@ -3174,6 +3189,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
3174
3189
  $env: string;
3175
3190
  } | undefined;
3176
3191
  tls?: boolean | undefined;
3192
+ options?: Record<string, string> | undefined;
3177
3193
  timeout?: number | undefined;
3178
3194
  statementTimeout?: number | undefined;
3179
3195
  envFile?: string | undefined;
package/dist/core.mjs CHANGED
@@ -1261,6 +1261,22 @@ var messages_default = {
1261
1261
  secret_alternatives_sql: "pass --password, supply the credential through .env or the process environment, or store a reference with --use-env-refs",
1262
1262
  secret_alternatives_mongo_password: "pass --password, supply the credential through .env or the process environment, or paste the connection string with --uri",
1263
1263
  secret_alternatives_mongo_uri: "pass the connection string with --uri",
1264
+ mongo_uri_conflicts_fields: "--uri cannot be combined with {flags}: the connection string already carries those settings. Use one or the other (--name may be combined to override the database name).",
1265
+ mongo_uri_with_env_refs: "--uri cannot be combined with --use-env-refs: the connection string is decomposed into config fields, and its credentials are not moved into environment variables. Either remove --use-env-refs so dbcli decomposes the string into the field config, or use the --env-* flags (--env-host, --env-user, --env-password, ...) to name one variable per field.",
1266
+ mongo_uri_fallback_warning: "\u26A0\uFE0F This connection string {reasons}, so it cannot become fields. It is stored as-is in uri, and its credentials will sit in plaintext in the config file.",
1267
+ mongo_uri_reason_multi_host: "contains more than one host (a field config holds only one)",
1268
+ mongo_uri_reason_secret_option: "contains secret option(s) ({keys}) that would land in plaintext options",
1269
+ mongo_uri_reason_duplicate_key: "repeats the query key(s) {keys} (a field config can hold only one value per key)",
1270
+ mongo_uri_reason_non_scram: "uses the non-SCRAM auth mechanism {mechanism} (field config cannot express it)",
1271
+ mongo_decomposed_header: "Connection string decomposed into these fields (password hidden):",
1272
+ mongo_paste_env_refs_warning: "\u26A0\uFE0F --use-env-refs does not apply to a pasted connection string: its credentials are written to the config file as they are, not as environment-variable references.",
1273
+ mongo_setup_mode_paste: "Paste a connection string (copied from Atlas / Compass)",
1274
+ mongo_string_invalid: "Not a valid MongoDB connection string (it is not echoed because it may carry credentials).",
1275
+ mongo_string_bad_host: "The connection string has an invalid host or port (the port must be an integer from 1 to 65535).",
1276
+ mongo_string_bad_credentials: "The connection string's credentials contain an unescaped reserved character such as @, : or /. Percent-encode it (for example @ as %40).",
1277
+ mongo_string_tls_conflict: "The connection string sets tls and ssl to different values.",
1278
+ mongo_string_bad_tls: "The connection string's {key} must be true or false.",
1279
+ mongo_string_empty_option: "The connection string sets {key} but leaves it empty. Give it a value or remove it.",
1264
1280
  prompt_name: "Database name: ",
1265
1281
  prompt_permission: "Permission level (query-only, read-write, data-admin, admin): ",
1266
1282
  env_parse_note: "Note: Unable to parse .env configuration, using interactive prompts",
@@ -1598,6 +1614,22 @@ var messages_default2 = {
1598
1614
  secret_alternatives_sql: "\u6539\u7528 --password\u3001\u628A\u6191\u8B49\u653E\u9032 .env \u6216\u884C\u7A0B\u74B0\u5883\u8B8A\u6578\uFF0C\u6216\u4EE5 --use-env-refs \u5B58\u6210\u53C3\u7167",
1599
1615
  secret_alternatives_mongo_password: "\u6539\u7528 --password\u3001\u628A\u6191\u8B49\u653E\u9032 .env \u6216\u884C\u7A0B\u74B0\u5883\u8B8A\u6578\uFF0C\u6216\u4EE5 --uri \u8CBC\u4E0A\u9023\u7DDA\u5B57\u4E32",
1600
1616
  secret_alternatives_mongo_uri: "\u4EE5 --uri \u50B3\u5165\u9023\u7DDA\u5B57\u4E32",
1617
+ mongo_uri_conflicts_fields: "--uri \u4E0D\u80FD\u8207 {flags} \u4E26\u7528\uFF1A\u9023\u7DDA\u5B57\u4E32\u5DF2\u5305\u542B\u9019\u4E9B\u8A2D\u5B9A\u3002\u8ACB\u64C7\u4E00\u4F7F\u7528\uFF08--name \u53EF\u4E26\u7528\uFF0C\u7528\u4F86\u8986\u84CB\u8CC7\u6599\u5EAB\u540D\u7A31\uFF09\u3002",
1618
+ mongo_uri_with_env_refs: "--uri \u4E0D\u80FD\u8207 --use-env-refs \u4E26\u7528\uFF1A\u9023\u7DDA\u5B57\u4E32\u6703\u88AB\u62C6\u89E3\u6210\u6B04\u4F4D\u8A2D\u5B9A\u5BEB\u5165\uFF0C\u5E33\u5BC6\u4E0D\u6703\u88AB\u62BD\u6210\u74B0\u5883\u8B8A\u6578\u53C3\u7167\u3002\u8ACB\u6539\u8D70\u4E0B\u5217\u4EFB\u4E00\u505A\u6CD5\uFF1A\u62FF\u6389 --use-env-refs\uFF0C\u8B93 dbcli \u62C6\u89E3\u5B57\u4E32\u5BEB\u5165\u6B04\u4F4D\u8A2D\u5B9A\uFF1B\u6216\u6539\u7528 --env-* flag\uFF08--env-host\u3001--env-user\u3001--env-password \u7B49\uFF09\u9010\u6B04\u7D66\u8B8A\u6578\u540D\u7A31\u3002",
1619
+ mongo_uri_fallback_warning: "\u26A0\uFE0F \u6B64\u9023\u7DDA\u5B57\u4E32{reasons}\uFF0C\u7121\u6CD5\u62C6\u6210\u6B04\u4F4D\u8A2D\u5B9A\uFF0C\u5DF2\u539F\u6A23\u5B58\u5165 uri\uFF1B\u5E33\u5BC6\u5C07\u660E\u6587\u5B58\u653E\u65BC\u8A2D\u5B9A\u6A94\u3002",
1620
+ mongo_uri_reason_multi_host: "\u542B\u591A\u7D44 host\uFF08\u6B04\u4F4D\u8A2D\u5B9A\u53EA\u80FD\u8868\u9054\u4E00\u7D44\uFF09",
1621
+ mongo_uri_reason_secret_option: "\u542B\u6A5F\u5BC6 option\uFF08{keys}\uFF09\uFF0C\u62C6\u9032 options \u6703\u660E\u6587\u843D\u76E4",
1622
+ mongo_uri_reason_duplicate_key: "\u542B\u91CD\u8907\u7684 query \u9375\uFF08{keys}\uFF09\uFF08\u6B04\u4F4D\u8A2D\u5B9A\u6BCF\u500B\u9375\u53EA\u80FD\u5B58\u4E00\u500B\u503C\uFF09",
1623
+ mongo_uri_reason_non_scram: "\u4F7F\u7528\u975E SCRAM \u7684\u8A8D\u8B49\u6A5F\u5236 {mechanism}\uFF08\u6B04\u4F4D\u8A2D\u5B9A\u7121\u6CD5\u8868\u9054\uFF09",
1624
+ mongo_decomposed_header: "\u9023\u7DDA\u5B57\u4E32\u5DF2\u62C6\u89E3\u6210\u4E0B\u5217\u6B04\u4F4D\uFF08\u5BC6\u78BC\u5DF2\u906E\u853D\uFF09\uFF1A",
1625
+ mongo_paste_env_refs_warning: "\u26A0\uFE0F --use-env-refs \u4E0D\u9069\u7528\u65BC\u8CBC\u4E0A\u7684\u9023\u7DDA\u5B57\u4E32\uFF1A\u5E33\u5BC6\u6703\u4EE5\u5B57\u9762\u503C\u5BEB\u5165\u8A2D\u5B9A\u6A94\uFF0C\u4E0D\u6703\u8B8A\u6210\u74B0\u5883\u8B8A\u6578\u53C3\u7167\u3002",
1626
+ mongo_setup_mode_paste: "\u8CBC\u4E0A\u9023\u7DDA\u5B57\u4E32\uFF08Atlas / Compass \u8907\u88FD\u7684\uFF09",
1627
+ mongo_string_invalid: "\u4E0D\u662F\u5408\u6CD5\u7684 MongoDB \u9023\u7DDA\u5B57\u4E32\uFF08\u5B57\u4E32\u53EF\u80FD\u5E36\u6709\u5E33\u5BC6\uFF0C\u6240\u4EE5\u4E0D\u5370\u51FA\uFF09\u3002",
1628
+ mongo_string_bad_host: "\u9023\u7DDA\u5B57\u4E32\u7684 host \u6216\u57E0\u865F\u4E0D\u5408\u6CD5\uFF08\u57E0\u865F\u9808\u70BA 1 \u81F3 65535 \u7684\u6574\u6578\uFF09\u3002",
1629
+ mongo_string_bad_credentials: "\u9023\u7DDA\u5B57\u4E32\u7684\u5E33\u865F\u6216\u5BC6\u78BC\u542B\u6709\u672A\u8DF3\u812B\u7684\u4FDD\u7559\u5B57\u5143\uFF08\u5982 @\u3001:\u3001/\uFF09\u3002\u8ACB\u505A\u767E\u5206\u6BD4\u7DE8\u78BC\uFF08\u4F8B\u5982 @ \u5BEB\u6210 %40\uFF09\u3002",
1630
+ mongo_string_tls_conflict: "\u9023\u7DDA\u5B57\u4E32\u540C\u6642\u6307\u5B9A\u4E86 tls \u8207 ssl \u4E14\u503C\u4E0D\u540C\u3002",
1631
+ mongo_string_bad_tls: "\u9023\u7DDA\u5B57\u4E32\u7684 {key} \u53EA\u63A5\u53D7 true \u6216 false\u3002",
1632
+ mongo_string_empty_option: "\u9023\u7DDA\u5B57\u4E32\u6307\u5B9A\u4E86 {key} \u537B\u6C92\u6709\u503C\u3002\u8ACB\u7D66\u503C\u6216\u79FB\u9664\u3002",
1601
1633
  prompt_name: "\u8CC7\u6599\u5EAB\u540D\u7A31\uFF1A",
1602
1634
  prompt_permission: "\u6B0A\u9650\u7B49\u7D1A\uFF08query-only, read-write, data-admin, admin\uFF09\uFF1A",
1603
1635
  env_parse_note: "\u63D0\u793A\uFF1A\u7121\u6CD5\u89E3\u6790 .env \u914D\u7F6E\uFF0C\u4F7F\u7528\u4E92\u52D5\u5F0F\u63D0\u793A",
@@ -8496,6 +8528,24 @@ var TimeoutField = {
8496
8528
  timeout: numberType().int().min(MIN_CONNECTION_TIMEOUT_MS).max(MAX_CONNECTION_TIMEOUT_MS).optional(),
8497
8529
  statementTimeout: numberType().int().min(MIN_STATEMENT_TIMEOUT_MS).max(MAX_STATEMENT_TIMEOUT_MS).optional()
8498
8530
  };
8531
+ var RESERVED_MONGODB_OPTION_KEYS = {
8532
+ authsource: "authSource",
8533
+ replicaset: "replicaSet",
8534
+ tls: "tls",
8535
+ ssl: "tls"
8536
+ };
8537
+ var MongoDBOptionsSchema = recordType(stringType(), stringType()).superRefine((options, ctx) => {
8538
+ for (const key of Object.keys(options)) {
8539
+ const field = RESERVED_MONGODB_OPTION_KEYS[key.toLowerCase()];
8540
+ if (field) {
8541
+ ctx.addIssue({
8542
+ code: ZodIssueCode.custom,
8543
+ path: [key],
8544
+ message: `options.${key} duplicates the dedicated '${field}' field; set '${field}' instead`
8545
+ });
8546
+ }
8547
+ }
8548
+ });
8499
8549
  var MongoDBConnectionConfigSchema = objectType({
8500
8550
  system: literalType("mongodb"),
8501
8551
  uri: unionType([stringType(), EnvRefSchema]).optional(),
@@ -8507,6 +8557,7 @@ var MongoDBConnectionConfigSchema = objectType({
8507
8557
  authSource: unionType([stringType(), EnvRefSchema]).optional(),
8508
8558
  replicaSet: unionType([stringType(), EnvRefSchema]).optional(),
8509
8559
  tls: booleanType().optional(),
8560
+ options: MongoDBOptionsSchema.optional(),
8510
8561
  srv: booleanType().optional().default(false),
8511
8562
  ...TimeoutField
8512
8563
  });
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dbcli-agent",
3
- "version": "10.0.0",
3
+ "version": "11.0.0",
4
4
  "description": "Database CLI skill and command reference for AI agents.",
5
5
  "contextFileName": "AGENTS.md"
6
6
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@carllee1983/dbcli",
3
- "version": "10.0.0",
3
+ "version": "11.0.0",
4
4
  "description": "Database CLI for AI agents",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -100,6 +100,7 @@
100
100
  "lru-cache": "^11.4.0",
101
101
  "lucide-react": "^1.16.0",
102
102
  "mongodb": "^7.2.0",
103
+ "mongodb-connection-string-url": "^7.0.1",
103
104
  "mysql2": "^3.24.3",
104
105
  "node-sql-parser": "5",
105
106
  "open": "^11.0.0",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dbcli-agent",
3
- "version": "10.0.0",
3
+ "version": "11.0.0",
4
4
  "description": "Database CLI skill and command reference for AI agents",
5
5
  "author": {
6
6
  "name": "Carl Lee",
@@ -372,7 +372,7 @@ dbcli init # parses .env in cwd
372
372
  dbcli init --conn-name local --system mongodb --host localhost --port 27017 --name mydb
373
373
  dbcli init --conn-name local --system mongodb --host localhost --port 27017 \
374
374
  --user admin --password '<secret>' --auth-source admin --name mydb
375
- # MongoDB — full URI (advanced escape hatch: multi-host, non-standard driver options)
375
+ # MongoDB — full URI (decomposed into fields on write; multi-host / secret-option strings stay as `uri` with a warning)
376
376
  dbcli init --conn-name local --system mongodb \
377
377
  --uri "mongodb+srv://user:pw@cluster.example.mongodb.net/mydb?authSource=admin"
378
378
 
@@ -494,9 +494,10 @@ refs have no value to connect with yet.
494
494
  natively or via the DoH fallback; useful when the runtime restricts DNS.
495
495
  - **MongoDB `authSource` / `replicaSet` / `tls` / `srv`** — `init` asks for
496
496
  these interactively (`authSource` only when a user is set; `replicaSet` /
497
- `tls` behind an "advanced options?" prompt); `--auth-source <db>` is the
498
- only one with a dedicated non-interactive flag, so set `replicaSet` / `tls`
499
- interactively or edit `.dbcli` afterward. If a config has both `uri` and
497
+ `tls` behind an "advanced options?" prompt); non-interactive flags are
498
+ `--auth-source <db>`, `--replica-set <name>`, `--srv` (no `port` written) and
499
+ `--tls` / `--no-tls` (neither given writes no `tls`); a flag you pass skips
500
+ its prompt. If a config has both `uri` and
500
501
  per-field values, `uri` wins silently — `dbcli doctor` flags this and also
501
502
  warns when `srv: true` is combined with a non-default `port`.
502
503
  - **MySQL/Postgres password with `@` `:` `/`** — when using `DATABASE_URL`,
@@ -127,7 +127,7 @@ dbcli init --conn-name local --no-interactive --force # Non-interactive; cred
127
127
  # MongoDB — field-by-field (primary path, same shape as SQL)
128
128
  dbcli init --conn-name local --system mongodb --host localhost --port 27017 --user admin --password secret --auth-source admin --name mydb
129
129
  dbcli init --conn-name local --system mongodb --host localhost --port 27017 --name mydb # No auth
130
- # MongoDB — full URI (advanced fallback: multi-host, non-standard driver options)
130
+ # MongoDB — full URI (decomposed into fields on write; multi-host / secret-option strings stay as `uri` with a warning)
131
131
  dbcli init --conn-name local --system mongodb --uri "mongodb://user:pass@host:27017/mydb?authSource=admin"
132
132
 
133
133
  # Redis (database = logical DB index)
@@ -161,7 +161,7 @@ New initialization always creates named v2 configuration, including plain `init`
161
161
 
162
162
  **Environment-reference options:** `--env-host <var>`, `--env-port <var>`, `--env-user <var>`, `--env-password <var>`, `--env-database <var>`
163
163
 
164
- **MongoDB-specific options:** `--uri <uri>` (full connection URI — advanced fallback), `--auth-source <db>` (auth database, default: `admin` when user/password set). Interactive `init` also asks for `replicaSet` and `tls` under an "advanced options?" prompt; there is no dedicated non-interactive flag for either yet — set them interactively or edit `.dbcli` afterward. `srv` (boolean, builds `mongodb+srv://` and resolves hosts via DNS SRV, ignoring `port`) is asked right after `host`, before `port`, since it decides whether `port` is even relevant.
164
+ **MongoDB-specific options:** `--uri <uri>` (full connection URI, decomposed into field config on write: `authSource`/`replicaSet`/`tls`(`ssl`) become dedicated fields, `mongodb+srv` becomes `srv: true`, the path database becomes `database`, other parameters go to `options`; multi-host strings, strings carrying `authMechanismProperties`/`tlsCertificateKeyFilePassword`/`proxyPassword`, strings repeating a query key, and strings whose `authMechanism` is not SCRAM-SHA-1/SCRAM-SHA-256 are stored as-is in `uri` with a plaintext-credentials warning; cannot be combined with `--host`/`--port`/`--user`/`--password`/`--auth-source`/`--replica-set`/`--srv`/`--tls`/`--no-tls` or `--use-env-refs`; `--name` may be combined), `--auth-source <db>` (auth database, default: `admin` when user/password set). `--replica-set <name>` (writes `replicaSet`), `--srv` (writes `srv: true` and no `port`; builds `mongodb+srv://` and resolves hosts via DNS SRV), `--tls` / `--no-tls` (writes `tls: true` / `tls: false`; neither flag writes no `tls` key, so the driver default applies). Interactive `init` skips the prompt for any of these given as a flag; otherwise it asks `srv` right after `host` (before `port`) and `replicaSet` / `tls` under an "advanced options?" prompt. The flags also apply with `--use-env-refs`.
165
165
 
166
166
  **Elasticsearch-specific options:** `--cloud-id <id>` (Elastic Cloud), `--api-key <key>` (ApiKey auth). Other ES fields (`nodes[]`, `protocol`, `caPath`, `rejectUnauthorized`) can be edited directly in `.dbcli`.
167
167
 
@@ -3644,7 +3644,7 @@ Parser behaviour (`src/core/saved-queries/parser.ts::normaliseVisual`):
3644
3644
 
3645
3645
  MongoDB connections use a JSON-based query model instead of SQL. Treat MongoDB support as a narrower document-database path, not as a full SQL feature equivalent.
3646
3646
 
3647
- `init --system mongodb` defaults to a field-by-field wizard (`host`, `srv`, `port`, `user`, `password` + `authSource`, then optional `replicaSet` / `tls`); a full `uri` is an explicit advanced choice in the interactive flow and the non-interactive path via `--uri` (with the required `--conn-name`). Optional fields `authSource`, `replicaSet`, `tls`, and `srv` express what previously required embedding options in the `uri` query string. Atlas-style `mongodb+srv://` URIs are supported both as a full `uri` and via the per-field `srv: true` option. `list` and `query` run against the database configured for the connection, and `query` always requires `--collection <name>`.
3647
+ `init --system mongodb` defaults to a field-by-field wizard (`host`, `srv`, `port`, `user`, `password` + `authSource`, then optional `replicaSet` / `tls`); a full `uri` is an explicit advanced choice in the interactive flow (stored as-is) and the non-interactive path via `--uri` (with the required `--conn-name`), where the string is decomposed into the field config on write. Optional fields `authSource`, `replicaSet`, `tls`, and `srv` express what previously required embedding options in the `uri` query string. Atlas-style `mongodb+srv://` URIs are supported both as a full `uri` and via the per-field `srv: true` option. `list` and `query` run against the database configured for the connection, and `query` always requires `--collection <name>`.
3648
3648
 
3649
3649
  The 5000ms default server-selection timeout is often too tight for a connection over a VPN or to Atlas. Set a `timeout` field (ms) in the connection config, or override it per invocation with root-level `--timeout`, e.g. `dbcli --timeout 20000 --use <conn> list`.
3650
3650
 
@@ -372,7 +372,7 @@ dbcli init # parses .env in cwd
372
372
  dbcli init --conn-name local --system mongodb --host localhost --port 27017 --name mydb
373
373
  dbcli init --conn-name local --system mongodb --host localhost --port 27017 \
374
374
  --user admin --password '<secret>' --auth-source admin --name mydb
375
- # MongoDB — full URI (advanced escape hatch: multi-host, non-standard driver options)
375
+ # MongoDB — full URI (decomposed into fields on write; multi-host / secret-option strings stay as `uri` with a warning)
376
376
  dbcli init --conn-name local --system mongodb \
377
377
  --uri "mongodb+srv://user:pw@cluster.example.mongodb.net/mydb?authSource=admin"
378
378
 
@@ -494,9 +494,10 @@ refs have no value to connect with yet.
494
494
  natively or via the DoH fallback; useful when the runtime restricts DNS.
495
495
  - **MongoDB `authSource` / `replicaSet` / `tls` / `srv`** — `init` asks for
496
496
  these interactively (`authSource` only when a user is set; `replicaSet` /
497
- `tls` behind an "advanced options?" prompt); `--auth-source <db>` is the
498
- only one with a dedicated non-interactive flag, so set `replicaSet` / `tls`
499
- interactively or edit `.dbcli` afterward. If a config has both `uri` and
497
+ `tls` behind an "advanced options?" prompt); non-interactive flags are
498
+ `--auth-source <db>`, `--replica-set <name>`, `--srv` (no `port` written) and
499
+ `--tls` / `--no-tls` (neither given writes no `tls`); a flag you pass skips
500
+ its prompt. If a config has both `uri` and
500
501
  per-field values, `uri` wins silently — `dbcli doctor` flags this and also
501
502
  warns when `srv: true` is combined with a non-default `port`.
502
503
  - **MySQL/Postgres password with `@` `:` `/`** — when using `DATABASE_URL`,
@@ -127,7 +127,7 @@ dbcli init --conn-name local --no-interactive --force # Non-interactive; cred
127
127
  # MongoDB — field-by-field (primary path, same shape as SQL)
128
128
  dbcli init --conn-name local --system mongodb --host localhost --port 27017 --user admin --password secret --auth-source admin --name mydb
129
129
  dbcli init --conn-name local --system mongodb --host localhost --port 27017 --name mydb # No auth
130
- # MongoDB — full URI (advanced fallback: multi-host, non-standard driver options)
130
+ # MongoDB — full URI (decomposed into fields on write; multi-host / secret-option strings stay as `uri` with a warning)
131
131
  dbcli init --conn-name local --system mongodb --uri "mongodb://user:pass@host:27017/mydb?authSource=admin"
132
132
 
133
133
  # Redis (database = logical DB index)
@@ -161,7 +161,7 @@ New initialization always creates named v2 configuration, including plain `init`
161
161
 
162
162
  **Environment-reference options:** `--env-host <var>`, `--env-port <var>`, `--env-user <var>`, `--env-password <var>`, `--env-database <var>`
163
163
 
164
- **MongoDB-specific options:** `--uri <uri>` (full connection URI — advanced fallback), `--auth-source <db>` (auth database, default: `admin` when user/password set). Interactive `init` also asks for `replicaSet` and `tls` under an "advanced options?" prompt; there is no dedicated non-interactive flag for either yet — set them interactively or edit `.dbcli` afterward. `srv` (boolean, builds `mongodb+srv://` and resolves hosts via DNS SRV, ignoring `port`) is asked right after `host`, before `port`, since it decides whether `port` is even relevant.
164
+ **MongoDB-specific options:** `--uri <uri>` (full connection URI, decomposed into field config on write: `authSource`/`replicaSet`/`tls`(`ssl`) become dedicated fields, `mongodb+srv` becomes `srv: true`, the path database becomes `database`, other parameters go to `options`; multi-host strings, strings carrying `authMechanismProperties`/`tlsCertificateKeyFilePassword`/`proxyPassword`, strings repeating a query key, and strings whose `authMechanism` is not SCRAM-SHA-1/SCRAM-SHA-256 are stored as-is in `uri` with a plaintext-credentials warning; cannot be combined with `--host`/`--port`/`--user`/`--password`/`--auth-source`/`--replica-set`/`--srv`/`--tls`/`--no-tls` or `--use-env-refs`; `--name` may be combined), `--auth-source <db>` (auth database, default: `admin` when user/password set). `--replica-set <name>` (writes `replicaSet`), `--srv` (writes `srv: true` and no `port`; builds `mongodb+srv://` and resolves hosts via DNS SRV), `--tls` / `--no-tls` (writes `tls: true` / `tls: false`; neither flag writes no `tls` key, so the driver default applies). Interactive `init` skips the prompt for any of these given as a flag; otherwise it asks `srv` right after `host` (before `port`) and `replicaSet` / `tls` under an "advanced options?" prompt. The flags also apply with `--use-env-refs`.
165
165
 
166
166
  **Elasticsearch-specific options:** `--cloud-id <id>` (Elastic Cloud), `--api-key <key>` (ApiKey auth). Other ES fields (`nodes[]`, `protocol`, `caPath`, `rejectUnauthorized`) can be edited directly in `.dbcli`.
167
167
 
@@ -3644,7 +3644,7 @@ Parser behaviour (`src/core/saved-queries/parser.ts::normaliseVisual`):
3644
3644
 
3645
3645
  MongoDB connections use a JSON-based query model instead of SQL. Treat MongoDB support as a narrower document-database path, not as a full SQL feature equivalent.
3646
3646
 
3647
- `init --system mongodb` defaults to a field-by-field wizard (`host`, `srv`, `port`, `user`, `password` + `authSource`, then optional `replicaSet` / `tls`); a full `uri` is an explicit advanced choice in the interactive flow and the non-interactive path via `--uri` (with the required `--conn-name`). Optional fields `authSource`, `replicaSet`, `tls`, and `srv` express what previously required embedding options in the `uri` query string. Atlas-style `mongodb+srv://` URIs are supported both as a full `uri` and via the per-field `srv: true` option. `list` and `query` run against the database configured for the connection, and `query` always requires `--collection <name>`.
3647
+ `init --system mongodb` defaults to a field-by-field wizard (`host`, `srv`, `port`, `user`, `password` + `authSource`, then optional `replicaSet` / `tls`); a full `uri` is an explicit advanced choice in the interactive flow (stored as-is) and the non-interactive path via `--uri` (with the required `--conn-name`), where the string is decomposed into the field config on write. Optional fields `authSource`, `replicaSet`, `tls`, and `srv` express what previously required embedding options in the `uri` query string. Atlas-style `mongodb+srv://` URIs are supported both as a full `uri` and via the per-field `srv: true` option. `list` and `query` run against the database configured for the connection, and `query` always requires `--collection <name>`.
3648
3648
 
3649
3649
  The 5000ms default server-selection timeout is often too tight for a connection over a VPN or to Atlas. Set a `timeout` field (ms) in the connection config, or override it per invocation with root-level `--timeout`, e.g. `dbcli --timeout 20000 --use <conn> list`.
3650
3650