@carllee1983/dbcli 1.57.0 → 1.58.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/.cursor/rules/dbcli.mdc +7 -2
- package/.cursor/skills/dbcli/reference.md +12 -3
- package/.github/skills/dbcli/SKILL.md +7 -2
- package/.github/skills/dbcli/reference.md +12 -3
- package/CHANGELOG.md +40 -0
- package/assets/SKILL.md +7 -2
- package/assets/SKILL.zh-TW.md +4 -1
- package/assets/reference.md +12 -3
- package/dist/cli-runtime.mjs +817 -575
- package/dist/cli.mjs +4 -2
- package/dist/core.d.ts +79 -24
- package/dist/core.mjs +315 -343
- package/package.json +4 -2
- package/plugins/dbcli-agent/skills/dbcli/SKILL.md +7 -2
- package/plugins/dbcli-agent/skills/dbcli/reference.md +12 -3
- package/skills/dbcli/SKILL.md +7 -2
- package/skills/dbcli/reference.md +12 -3
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: "1.
|
|
6
|
+
version: "1.58.0",
|
|
7
7
|
description: "Database CLI for AI agents",
|
|
8
8
|
type: "module",
|
|
9
9
|
publishConfig: {
|
|
@@ -77,12 +77,14 @@ var package_default = {
|
|
|
77
77
|
"test:unit": "bun test tests/unit tests/core",
|
|
78
78
|
"test:integration": "bun test tests/integration",
|
|
79
79
|
"test:gherkin": "bun test tests/gherkin",
|
|
80
|
-
"test:docker": "docker compose -f docker-compose.test.yml up -d --wait && bun test tests/integration
|
|
80
|
+
"test:docker": "docker compose -f docker-compose.test.yml up -d --wait && bun test tests/integration; docker compose -f docker-compose.test.yml down",
|
|
81
|
+
"services:check": "bun run scripts/check-test-services.ts",
|
|
81
82
|
"docs:check": "bun run scripts/check-user-docs.ts",
|
|
82
83
|
"contract:check": "bun run scripts/check-cli-contract.ts",
|
|
83
84
|
"skill:check": "bun run scripts/check-skill-parity.ts",
|
|
84
85
|
"platform:check": "bun run scripts/check-platform-parity.ts",
|
|
85
86
|
"agent-core:check": "bun run scripts/check-agent-core-purity.ts",
|
|
87
|
+
"core-stdout:check": "bun run scripts/check-core-no-stdout.ts",
|
|
86
88
|
typecheck: "tsc --noEmit --pretty false",
|
|
87
89
|
"test:perf": "bun test ./tests/perf/*.bench.ts",
|
|
88
90
|
lint: "eslint src tests scripts --ext .ts --max-warnings=0",
|
package/dist/core.d.ts
CHANGED
|
@@ -410,8 +410,17 @@ export declare class AdapterFactory {
|
|
|
410
410
|
* Used to wrap the execution result and metadata of data modification operations
|
|
411
411
|
*/
|
|
412
412
|
export interface DataExecutionResult {
|
|
413
|
-
/**
|
|
414
|
-
|
|
413
|
+
/**
|
|
414
|
+
* What became of the operation.
|
|
415
|
+
*
|
|
416
|
+
* `success` means the statement ran — `rows_affected` may still be 0 if it
|
|
417
|
+
* matched nothing. `cancelled` means a user declined at the confirmation.
|
|
418
|
+
* `dry_run` means it was previewed and deliberately not run. The last two
|
|
419
|
+
* were reported as `success` with `rows_affected: 0` until 2.0.0, which made
|
|
420
|
+
* them indistinguishable from a write that matched no rows and caused the
|
|
421
|
+
* audit log to record declined operations as writes that happened.
|
|
422
|
+
*/
|
|
423
|
+
status: "success" | "error" | "cancelled" | "dry_run";
|
|
415
424
|
/** Type of operation executed */
|
|
416
425
|
operation: "insert" | "update" | "delete";
|
|
417
426
|
/** Number of rows affected */
|
|
@@ -434,7 +443,53 @@ export interface DataExecutionOptions {
|
|
|
434
443
|
force?: boolean;
|
|
435
444
|
/** Verbose output */
|
|
436
445
|
verbose?: boolean;
|
|
446
|
+
/**
|
|
447
|
+
* How to ask the caller's user whether to proceed.
|
|
448
|
+
*
|
|
449
|
+
* Core states what is about to happen; the caller decides how to present it
|
|
450
|
+
* and how to collect an answer. Required whenever a mutation would execute
|
|
451
|
+
* without `force`, and absent by design rather than defaulted: silently
|
|
452
|
+
* proceeding unconfirmed, or silently declining, are both worse than saying
|
|
453
|
+
* that nobody was available to ask.
|
|
454
|
+
*/
|
|
455
|
+
confirm?: MutationConfirmer;
|
|
456
|
+
}
|
|
457
|
+
/**
|
|
458
|
+
* Everything a caller needs to describe a pending mutation to its user.
|
|
459
|
+
*/
|
|
460
|
+
export interface MutationConfirmationRequest {
|
|
461
|
+
operation: DataExecutionResult["operation"];
|
|
462
|
+
/**
|
|
463
|
+
* Which engine will run it.
|
|
464
|
+
*
|
|
465
|
+
* Only presentation depends on this: a MongoDB shell line or a Redis command
|
|
466
|
+
* announced as "Generated SQL" would be a lie about what is being approved,
|
|
467
|
+
* and approving the wrong thing is the failure this whole prompt exists to
|
|
468
|
+
* prevent.
|
|
469
|
+
*/
|
|
470
|
+
engine: "sql" | "mongodb" | "redis";
|
|
471
|
+
/** The parameterised statement that will run if confirmed */
|
|
472
|
+
sql: string;
|
|
473
|
+
/** Values bound to the statement's placeholders */
|
|
474
|
+
params: (string | number | boolean | null)[];
|
|
475
|
+
/**
|
|
476
|
+
* Whether this operation is irreversible.
|
|
477
|
+
*
|
|
478
|
+
* A flag rather than the warning sentence and the question themselves, which
|
|
479
|
+
* is what this carried first. The division is not "core cannot translate" —
|
|
480
|
+
* `permission-guard` translates the refusal it throws, and so does
|
|
481
|
+
* `blacklist-validator` — it is that core owns facts and the command layer
|
|
482
|
+
* owns presentation. Whether a delete can be undone is a fact. Which sentence
|
|
483
|
+
* a person is shown about it, in what tone, on which stream, is presentation,
|
|
484
|
+
* and a caller embedding the executor should be able to say it in its own
|
|
485
|
+
* product's voice rather than inheriting dbcli's.
|
|
486
|
+
*/
|
|
487
|
+
destructive: boolean;
|
|
437
488
|
}
|
|
489
|
+
/**
|
|
490
|
+
* Returns true to proceed, false to abandon the mutation.
|
|
491
|
+
*/
|
|
492
|
+
export type MutationConfirmer = (request: MutationConfirmationRequest) => Promise<boolean>;
|
|
438
493
|
interface SqlConnectionConfig {
|
|
439
494
|
system: "postgresql" | "mysql" | "mariadb";
|
|
440
495
|
host: string | {
|
|
@@ -1355,6 +1410,7 @@ declare const DbcliConfigSchema: z.ZodObject<{
|
|
|
1355
1410
|
max_entries: number;
|
|
1356
1411
|
};
|
|
1357
1412
|
};
|
|
1413
|
+
permission: "admin" | "query-only" | "read-write" | "data-admin";
|
|
1358
1414
|
connection: {
|
|
1359
1415
|
password: string | {
|
|
1360
1416
|
$env: string;
|
|
@@ -1453,7 +1509,6 @@ declare const DbcliConfigSchema: z.ZodObject<{
|
|
|
1453
1509
|
} | undefined;
|
|
1454
1510
|
caPath?: string | undefined;
|
|
1455
1511
|
};
|
|
1456
|
-
permission: "admin" | "query-only" | "read-write" | "data-admin";
|
|
1457
1512
|
metadata: {
|
|
1458
1513
|
version: string;
|
|
1459
1514
|
createdAt?: string | undefined;
|
|
@@ -1706,8 +1761,8 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
1706
1761
|
$env: string;
|
|
1707
1762
|
} | undefined;
|
|
1708
1763
|
timeout?: number | undefined;
|
|
1709
|
-
statementTimeout?: number | undefined;
|
|
1710
1764
|
permission?: "admin" | "query-only" | "read-write" | "data-admin" | undefined;
|
|
1765
|
+
statementTimeout?: number | undefined;
|
|
1711
1766
|
envFile?: string | undefined;
|
|
1712
1767
|
environment?: string | undefined;
|
|
1713
1768
|
}>,
|
|
@@ -1868,8 +1923,8 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
1868
1923
|
tls?: boolean | undefined;
|
|
1869
1924
|
srv?: boolean | undefined;
|
|
1870
1925
|
timeout?: number | undefined;
|
|
1871
|
-
statementTimeout?: number | undefined;
|
|
1872
1926
|
permission?: "admin" | "query-only" | "read-write" | "data-admin" | undefined;
|
|
1927
|
+
statementTimeout?: number | undefined;
|
|
1873
1928
|
envFile?: string | undefined;
|
|
1874
1929
|
environment?: string | undefined;
|
|
1875
1930
|
}>,
|
|
@@ -1976,8 +2031,8 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
1976
2031
|
$env: string;
|
|
1977
2032
|
} | undefined;
|
|
1978
2033
|
timeout?: number | undefined;
|
|
1979
|
-
statementTimeout?: number | undefined;
|
|
1980
2034
|
permission?: "admin" | "query-only" | "read-write" | "data-admin" | undefined;
|
|
2035
|
+
statementTimeout?: number | undefined;
|
|
1981
2036
|
envFile?: string | undefined;
|
|
1982
2037
|
environment?: string | undefined;
|
|
1983
2038
|
}>,
|
|
@@ -2089,8 +2144,8 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
2089
2144
|
$env: string;
|
|
2090
2145
|
};
|
|
2091
2146
|
rejectUnauthorized: boolean;
|
|
2092
|
-
protocol: "http" | "https";
|
|
2093
2147
|
permission: "admin" | "query-only" | "read-write" | "data-admin";
|
|
2148
|
+
protocol: "http" | "https";
|
|
2094
2149
|
timeout?: number | undefined;
|
|
2095
2150
|
statementTimeout?: number | undefined;
|
|
2096
2151
|
nodes?: string[] | undefined;
|
|
@@ -2122,6 +2177,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
2122
2177
|
} | undefined;
|
|
2123
2178
|
rejectUnauthorized?: boolean | undefined;
|
|
2124
2179
|
timeout?: number | undefined;
|
|
2180
|
+
permission?: "admin" | "query-only" | "read-write" | "data-admin" | undefined;
|
|
2125
2181
|
statementTimeout?: number | undefined;
|
|
2126
2182
|
protocol?: "http" | "https" | undefined;
|
|
2127
2183
|
nodes?: string[] | undefined;
|
|
@@ -2132,7 +2188,6 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
2132
2188
|
$env: string;
|
|
2133
2189
|
} | undefined;
|
|
2134
2190
|
caPath?: string | undefined;
|
|
2135
|
-
permission?: "admin" | "query-only" | "read-write" | "data-admin" | undefined;
|
|
2136
2191
|
envFile?: string | undefined;
|
|
2137
2192
|
environment?: string | undefined;
|
|
2138
2193
|
}>
|
|
@@ -2231,8 +2286,8 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
2231
2286
|
$env: string;
|
|
2232
2287
|
};
|
|
2233
2288
|
rejectUnauthorized: boolean;
|
|
2234
|
-
protocol: "http" | "https";
|
|
2235
2289
|
permission: "admin" | "query-only" | "read-write" | "data-admin";
|
|
2290
|
+
protocol: "http" | "https";
|
|
2236
2291
|
timeout?: number | undefined;
|
|
2237
2292
|
statementTimeout?: number | undefined;
|
|
2238
2293
|
nodes?: string[] | undefined;
|
|
@@ -2263,8 +2318,8 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
2263
2318
|
$env: string;
|
|
2264
2319
|
} | undefined;
|
|
2265
2320
|
timeout?: number | undefined;
|
|
2266
|
-
statementTimeout?: number | undefined;
|
|
2267
2321
|
permission?: "admin" | "query-only" | "read-write" | "data-admin" | undefined;
|
|
2322
|
+
statementTimeout?: number | undefined;
|
|
2268
2323
|
envFile?: string | undefined;
|
|
2269
2324
|
environment?: string | undefined;
|
|
2270
2325
|
} | {
|
|
@@ -2296,8 +2351,8 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
2296
2351
|
tls?: boolean | undefined;
|
|
2297
2352
|
srv?: boolean | undefined;
|
|
2298
2353
|
timeout?: number | undefined;
|
|
2299
|
-
statementTimeout?: number | undefined;
|
|
2300
2354
|
permission?: "admin" | "query-only" | "read-write" | "data-admin" | undefined;
|
|
2355
|
+
statementTimeout?: number | undefined;
|
|
2301
2356
|
envFile?: string | undefined;
|
|
2302
2357
|
environment?: string | undefined;
|
|
2303
2358
|
} | {
|
|
@@ -2318,8 +2373,8 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
2318
2373
|
$env: string;
|
|
2319
2374
|
} | undefined;
|
|
2320
2375
|
timeout?: number | undefined;
|
|
2321
|
-
statementTimeout?: number | undefined;
|
|
2322
2376
|
permission?: "admin" | "query-only" | "read-write" | "data-admin" | undefined;
|
|
2377
|
+
statementTimeout?: number | undefined;
|
|
2323
2378
|
envFile?: string | undefined;
|
|
2324
2379
|
environment?: string | undefined;
|
|
2325
2380
|
} | {
|
|
@@ -2341,6 +2396,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
2341
2396
|
} | undefined;
|
|
2342
2397
|
rejectUnauthorized?: boolean | undefined;
|
|
2343
2398
|
timeout?: number | undefined;
|
|
2399
|
+
permission?: "admin" | "query-only" | "read-write" | "data-admin" | undefined;
|
|
2344
2400
|
statementTimeout?: number | undefined;
|
|
2345
2401
|
protocol?: "http" | "https" | undefined;
|
|
2346
2402
|
nodes?: string[] | undefined;
|
|
@@ -2351,7 +2407,6 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
2351
2407
|
$env: string;
|
|
2352
2408
|
} | undefined;
|
|
2353
2409
|
caPath?: string | undefined;
|
|
2354
|
-
permission?: "admin" | "query-only" | "read-write" | "data-admin" | undefined;
|
|
2355
2410
|
envFile?: string | undefined;
|
|
2356
2411
|
environment?: string | undefined;
|
|
2357
2412
|
}>>;
|
|
@@ -2546,8 +2601,8 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
2546
2601
|
$env: string;
|
|
2547
2602
|
};
|
|
2548
2603
|
rejectUnauthorized: boolean;
|
|
2549
|
-
protocol: "http" | "https";
|
|
2550
2604
|
permission: "admin" | "query-only" | "read-write" | "data-admin";
|
|
2605
|
+
protocol: "http" | "https";
|
|
2551
2606
|
timeout?: number | undefined;
|
|
2552
2607
|
statementTimeout?: number | undefined;
|
|
2553
2608
|
nodes?: string[] | undefined;
|
|
@@ -2589,8 +2644,8 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
2589
2644
|
$env: string;
|
|
2590
2645
|
} | undefined;
|
|
2591
2646
|
timeout?: number | undefined;
|
|
2592
|
-
statementTimeout?: number | undefined;
|
|
2593
2647
|
permission?: "admin" | "query-only" | "read-write" | "data-admin" | undefined;
|
|
2648
|
+
statementTimeout?: number | undefined;
|
|
2594
2649
|
envFile?: string | undefined;
|
|
2595
2650
|
environment?: string | undefined;
|
|
2596
2651
|
} | {
|
|
@@ -2622,8 +2677,8 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
2622
2677
|
tls?: boolean | undefined;
|
|
2623
2678
|
srv?: boolean | undefined;
|
|
2624
2679
|
timeout?: number | undefined;
|
|
2625
|
-
statementTimeout?: number | undefined;
|
|
2626
2680
|
permission?: "admin" | "query-only" | "read-write" | "data-admin" | undefined;
|
|
2681
|
+
statementTimeout?: number | undefined;
|
|
2627
2682
|
envFile?: string | undefined;
|
|
2628
2683
|
environment?: string | undefined;
|
|
2629
2684
|
} | {
|
|
@@ -2644,8 +2699,8 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
2644
2699
|
$env: string;
|
|
2645
2700
|
} | undefined;
|
|
2646
2701
|
timeout?: number | undefined;
|
|
2647
|
-
statementTimeout?: number | undefined;
|
|
2648
2702
|
permission?: "admin" | "query-only" | "read-write" | "data-admin" | undefined;
|
|
2703
|
+
statementTimeout?: number | undefined;
|
|
2649
2704
|
envFile?: string | undefined;
|
|
2650
2705
|
environment?: string | undefined;
|
|
2651
2706
|
} | {
|
|
@@ -2667,6 +2722,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
2667
2722
|
} | undefined;
|
|
2668
2723
|
rejectUnauthorized?: boolean | undefined;
|
|
2669
2724
|
timeout?: number | undefined;
|
|
2725
|
+
permission?: "admin" | "query-only" | "read-write" | "data-admin" | undefined;
|
|
2670
2726
|
statementTimeout?: number | undefined;
|
|
2671
2727
|
protocol?: "http" | "https" | undefined;
|
|
2672
2728
|
nodes?: string[] | undefined;
|
|
@@ -2677,7 +2733,6 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
2677
2733
|
$env: string;
|
|
2678
2734
|
} | undefined;
|
|
2679
2735
|
caPath?: string | undefined;
|
|
2680
|
-
permission?: "admin" | "query-only" | "read-write" | "data-admin" | undefined;
|
|
2681
2736
|
envFile?: string | undefined;
|
|
2682
2737
|
environment?: string | undefined;
|
|
2683
2738
|
}>;
|
|
@@ -2822,8 +2877,8 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
2822
2877
|
$env: string;
|
|
2823
2878
|
};
|
|
2824
2879
|
rejectUnauthorized: boolean;
|
|
2825
|
-
protocol: "http" | "https";
|
|
2826
2880
|
permission: "admin" | "query-only" | "read-write" | "data-admin";
|
|
2881
|
+
protocol: "http" | "https";
|
|
2827
2882
|
timeout?: number | undefined;
|
|
2828
2883
|
statementTimeout?: number | undefined;
|
|
2829
2884
|
nodes?: string[] | undefined;
|
|
@@ -2865,8 +2920,8 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
2865
2920
|
$env: string;
|
|
2866
2921
|
} | undefined;
|
|
2867
2922
|
timeout?: number | undefined;
|
|
2868
|
-
statementTimeout?: number | undefined;
|
|
2869
2923
|
permission?: "admin" | "query-only" | "read-write" | "data-admin" | undefined;
|
|
2924
|
+
statementTimeout?: number | undefined;
|
|
2870
2925
|
envFile?: string | undefined;
|
|
2871
2926
|
environment?: string | undefined;
|
|
2872
2927
|
} | {
|
|
@@ -2898,8 +2953,8 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
2898
2953
|
tls?: boolean | undefined;
|
|
2899
2954
|
srv?: boolean | undefined;
|
|
2900
2955
|
timeout?: number | undefined;
|
|
2901
|
-
statementTimeout?: number | undefined;
|
|
2902
2956
|
permission?: "admin" | "query-only" | "read-write" | "data-admin" | undefined;
|
|
2957
|
+
statementTimeout?: number | undefined;
|
|
2903
2958
|
envFile?: string | undefined;
|
|
2904
2959
|
environment?: string | undefined;
|
|
2905
2960
|
} | {
|
|
@@ -2920,8 +2975,8 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
2920
2975
|
$env: string;
|
|
2921
2976
|
} | undefined;
|
|
2922
2977
|
timeout?: number | undefined;
|
|
2923
|
-
statementTimeout?: number | undefined;
|
|
2924
2978
|
permission?: "admin" | "query-only" | "read-write" | "data-admin" | undefined;
|
|
2979
|
+
statementTimeout?: number | undefined;
|
|
2925
2980
|
envFile?: string | undefined;
|
|
2926
2981
|
environment?: string | undefined;
|
|
2927
2982
|
} | {
|
|
@@ -2943,6 +2998,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
2943
2998
|
} | undefined;
|
|
2944
2999
|
rejectUnauthorized?: boolean | undefined;
|
|
2945
3000
|
timeout?: number | undefined;
|
|
3001
|
+
permission?: "admin" | "query-only" | "read-write" | "data-admin" | undefined;
|
|
2946
3002
|
statementTimeout?: number | undefined;
|
|
2947
3003
|
protocol?: "http" | "https" | undefined;
|
|
2948
3004
|
nodes?: string[] | undefined;
|
|
@@ -2953,7 +3009,6 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
2953
3009
|
$env: string;
|
|
2954
3010
|
} | undefined;
|
|
2955
3011
|
caPath?: string | undefined;
|
|
2956
|
-
permission?: "admin" | "query-only" | "read-write" | "data-admin" | undefined;
|
|
2957
3012
|
envFile?: string | undefined;
|
|
2958
3013
|
environment?: string | undefined;
|
|
2959
3014
|
}>;
|
|
@@ -3105,7 +3160,7 @@ export declare class DataExecutor {
|
|
|
3105
3160
|
private getQuoteChar;
|
|
3106
3161
|
private checkBlacklist;
|
|
3107
3162
|
private executeMutation;
|
|
3108
|
-
private
|
|
3163
|
+
private outcomeResult;
|
|
3109
3164
|
private handleMutationError;
|
|
3110
3165
|
/**
|
|
3111
3166
|
* Build a parameterized UPDATE SQL statement
|