@carllee1983/dbcli 1.42.0 → 1.43.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/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/.cursor/rules/dbcli.mdc +29 -5
- package/.cursor/skills/dbcli/reference.md +79 -4
- package/.cursor-plugin/plugin.json +1 -1
- package/.github/skills/dbcli/SKILL.md +29 -5
- package/.github/skills/dbcli/reference.md +79 -4
- package/CHANGELOG.md +32 -0
- package/README.dev.md +1 -1
- package/README.md +72 -10
- package/README.zh-TW.md +70 -10
- package/assets/SKILL.md +29 -5
- package/assets/SKILL.zh-TW.md +27 -4
- package/assets/reference.md +79 -4
- package/assets/ui-template.html +19 -19
- package/dist/agent-core.d.ts +32 -0
- package/dist/agent-core.mjs +92 -0
- package/dist/cli.mjs +1539 -686
- package/dist/core.d.ts +23 -0
- package/dist/core.mjs +323 -76
- package/dist/ui-style.css +1 -1
- package/gemini-extension.json +1 -1
- package/package.json +9 -3
- package/plugins/dbcli-agent/.codex-plugin/plugin.json +1 -1
- package/plugins/dbcli-agent/skills/dbcli/SKILL.md +29 -5
- package/plugins/dbcli-agent/skills/dbcli/reference.md +79 -4
- package/skills/dbcli/SKILL.md +29 -5
- package/skills/dbcli/reference.md +79 -4
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// Generated by dts-bundle-generator v9.5.1
|
|
2
|
+
|
|
3
|
+
/** Load a file into process.env without overwriting existing values. */
|
|
4
|
+
export declare function loadEnvFile(filePath: string): Promise<void>;
|
|
5
|
+
export interface AppliedLimitMetadata {
|
|
6
|
+
/** True only when the caller fetched and removed an additional row. */
|
|
7
|
+
truncated: boolean;
|
|
8
|
+
/** User-facing row limit, never the internal lookahead size. */
|
|
9
|
+
limitApplied: number;
|
|
10
|
+
}
|
|
11
|
+
export interface AppliedLimitResult<T> {
|
|
12
|
+
rows: T[];
|
|
13
|
+
metadata: AppliedLimitMetadata;
|
|
14
|
+
}
|
|
15
|
+
/** Trim a one-row lookahead without mutating the input. */
|
|
16
|
+
export declare function trimAppliedLimit<T>(rows: readonly T[], limit: number): AppliedLimitResult<T>;
|
|
17
|
+
export interface ConnectionSelectorInputs {
|
|
18
|
+
root?: string;
|
|
19
|
+
command?: string;
|
|
20
|
+
environment?: string;
|
|
21
|
+
}
|
|
22
|
+
/** Resolve one invocation-scoped selector without changing persisted state. */
|
|
23
|
+
export declare function resolveConnectionSelector(inputs: ConnectionSelectorInputs): string | undefined;
|
|
24
|
+
/** Parse a comma-separated selector into ordered, unique names. */
|
|
25
|
+
export declare function parseConnectionNames(selector: string): string[];
|
|
26
|
+
interface EnvReference {
|
|
27
|
+
$env: string;
|
|
28
|
+
}
|
|
29
|
+
/** Resolve a literal or environment reference with a field-specific error. */
|
|
30
|
+
export declare function resolveEnvRef(value: string | EnvReference, fieldName: string, env?: Record<string, string | undefined>): string;
|
|
31
|
+
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// src/agent-core/errors.ts
|
|
3
|
+
class ConfigError extends Error {
|
|
4
|
+
constructor(message) {
|
|
5
|
+
super(message);
|
|
6
|
+
this.name = "ConfigError";
|
|
7
|
+
if (Error.captureStackTrace)
|
|
8
|
+
Error.captureStackTrace(this, ConfigError);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// src/agent-core/env-loader.ts
|
|
13
|
+
function parseEnvContent(content) {
|
|
14
|
+
const entries = [];
|
|
15
|
+
for (const line of content.split(`
|
|
16
|
+
`)) {
|
|
17
|
+
const trimmed = line.trim();
|
|
18
|
+
if (!trimmed || trimmed.startsWith("#"))
|
|
19
|
+
continue;
|
|
20
|
+
const eqIndex = trimmed.indexOf("=");
|
|
21
|
+
if (eqIndex === -1)
|
|
22
|
+
continue;
|
|
23
|
+
const key = trimmed.slice(0, eqIndex).trim();
|
|
24
|
+
let value = trimmed.slice(eqIndex + 1);
|
|
25
|
+
if (value.startsWith('"') && value.endsWith('"') || value.startsWith("'") && value.endsWith("'")) {
|
|
26
|
+
value = value.slice(1, -1);
|
|
27
|
+
}
|
|
28
|
+
entries.push([key, value]);
|
|
29
|
+
}
|
|
30
|
+
return entries;
|
|
31
|
+
}
|
|
32
|
+
async function loadEnvFile(filePath) {
|
|
33
|
+
const file = Bun.file(filePath);
|
|
34
|
+
if (!await file.exists())
|
|
35
|
+
throw new ConfigError(`\u627E\u4E0D\u5230 env \u6A94\u6848\uFF1A${filePath}`);
|
|
36
|
+
for (const [key, value] of parseEnvContent(await file.text())) {
|
|
37
|
+
if (process.env[key] === undefined)
|
|
38
|
+
process.env[key] = value;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
// src/agent-core/applied-limit.ts
|
|
42
|
+
function trimAppliedLimit(rows, limit) {
|
|
43
|
+
const truncated = rows.length > limit;
|
|
44
|
+
return {
|
|
45
|
+
rows: truncated ? rows.slice(0, limit) : [...rows],
|
|
46
|
+
metadata: { truncated, limitApplied: limit }
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
// src/agent-core/connection-selector.ts
|
|
50
|
+
function resolveConnectionSelector(inputs) {
|
|
51
|
+
if (inputs.root !== undefined && inputs.command !== undefined && inputs.root !== inputs.command) {
|
|
52
|
+
throw new Error(`Conflicting connection selectors: root value '${inputs.root}' does not match command value '${inputs.command}'`);
|
|
53
|
+
}
|
|
54
|
+
const explicit = inputs.command ?? inputs.root;
|
|
55
|
+
if (explicit !== undefined)
|
|
56
|
+
return explicit;
|
|
57
|
+
const environment = inputs.environment?.trim();
|
|
58
|
+
return environment ? environment : undefined;
|
|
59
|
+
}
|
|
60
|
+
function parseConnectionNames(selector) {
|
|
61
|
+
const names = selector.split(",").map((name) => name.trim());
|
|
62
|
+
if (names.some((name) => name === "")) {
|
|
63
|
+
throw new Error("Connection selector contains an empty connection name");
|
|
64
|
+
}
|
|
65
|
+
const seen = new Set;
|
|
66
|
+
for (const name of names) {
|
|
67
|
+
if (seen.has(name)) {
|
|
68
|
+
throw new Error(`Connection selector contains duplicate connection name '${name}'`);
|
|
69
|
+
}
|
|
70
|
+
seen.add(name);
|
|
71
|
+
}
|
|
72
|
+
return names;
|
|
73
|
+
}
|
|
74
|
+
// src/agent-core/env-ref.ts
|
|
75
|
+
function resolveEnvRef(value, fieldName, env = process.env) {
|
|
76
|
+
if (typeof value === "string")
|
|
77
|
+
return value;
|
|
78
|
+
const envKey = value.$env;
|
|
79
|
+
const resolved = env[envKey];
|
|
80
|
+
if (resolved === undefined) {
|
|
81
|
+
throw new ConfigError(`Environment variable not defined: ${envKey} (field: ${fieldName})
|
|
82
|
+
` + `Please set ${envKey} in an env file or your environment.`);
|
|
83
|
+
}
|
|
84
|
+
return resolved;
|
|
85
|
+
}
|
|
86
|
+
export {
|
|
87
|
+
trimAppliedLimit,
|
|
88
|
+
resolveEnvRef,
|
|
89
|
+
resolveConnectionSelector,
|
|
90
|
+
parseConnectionNames,
|
|
91
|
+
loadEnvFile
|
|
92
|
+
};
|