askdb 1.0.0-beta.48 → 1.0.0-beta.49
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/ask.d.ts +15 -0
- package/dist/ask.d.ts.map +1 -0
- package/dist/ask.js +168 -0
- package/dist/ask.js.map +1 -0
- package/dist/bundle.d.ts +10 -0
- package/dist/bundle.d.ts.map +1 -0
- package/dist/bundle.js +51 -0
- package/dist/bundle.js.map +1 -0
- package/dist/cli-error.d.ts +10 -0
- package/dist/cli-error.d.ts.map +1 -0
- package/dist/cli-error.js +39 -0
- package/dist/cli-error.js.map +1 -0
- package/dist/cli.js +27 -308
- package/dist/cli.js.map +1 -1
- package/dist/command.d.ts +56 -0
- package/dist/command.d.ts.map +1 -0
- package/dist/command.js +139 -0
- package/dist/command.js.map +1 -0
- package/dist/dispatch.d.ts +6 -0
- package/dist/dispatch.d.ts.map +1 -0
- package/dist/dispatch.js +65 -0
- package/dist/dispatch.js.map +1 -0
- package/dist/init.d.ts +33 -20
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +273 -591
- package/dist/init.js.map +1 -1
- package/dist/introspect.d.ts +21 -1
- package/dist/introspect.d.ts.map +1 -1
- package/dist/introspect.js +57 -156
- package/dist/introspect.js.map +1 -1
- package/dist/logger.d.ts +3 -0
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +34 -1
- package/dist/logger.js.map +1 -1
- package/dist/prisma-install.d.ts +1 -1
- package/dist/prisma-install.js +1 -1
- package/dist/rag.d.ts +31 -0
- package/dist/rag.d.ts.map +1 -1
- package/dist/rag.js +175 -185
- package/dist/rag.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +13 -14
package/dist/cli.js
CHANGED
|
@@ -1,312 +1,25 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
if (error instanceof SqlValidationError) {
|
|
23
|
-
console.error(`${error.name} [${error.rule}]: ${error.message}`);
|
|
24
|
-
if (error.hint) {
|
|
25
|
-
console.error(`Hint: ${error.hint}`);
|
|
26
|
-
}
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
if (error instanceof AskDbError) {
|
|
30
|
-
console.error(`${error.name}: ${error.message}`);
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
if (error instanceof Error) {
|
|
34
|
-
console.error(error.message);
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
console.error(String(error));
|
|
38
|
-
}
|
|
39
|
-
async function runBundleCommand(args) {
|
|
40
|
-
const schemaDir = args[0];
|
|
41
|
-
const outFlag = args[1];
|
|
42
|
-
const outPath = args[2];
|
|
43
|
-
if (!schemaDir || outFlag !== "--out" || !outPath) {
|
|
44
|
-
process.stderr.write("Usage: askdb bundle <schema-dir> --out <bundle.json>\n");
|
|
45
|
-
return 1;
|
|
46
|
-
}
|
|
47
|
-
const { bundleSchemaDirectory } = await import("@askdb/enrich");
|
|
48
|
-
const { writeFileSync } = await import("node:fs");
|
|
49
|
-
const { resolve } = await import("node:path");
|
|
50
|
-
try {
|
|
51
|
-
const bundle = bundleSchemaDirectory(resolve(schemaDir));
|
|
52
|
-
writeFileSync(resolve(outPath), `${JSON.stringify(bundle, null, 2)}\n`, "utf8");
|
|
53
|
-
process.stdout.write(`Wrote ${resolve(outPath)}\n`);
|
|
54
|
-
return 0;
|
|
55
|
-
}
|
|
56
|
-
catch (error) {
|
|
57
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
58
|
-
process.stderr.write(`askdb bundle: ${message}\n`);
|
|
59
|
-
return 1;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
async function runStudioCommand(args) {
|
|
63
|
-
// Studio owns config loading for its own startup: a missing config opens the setup wizard.
|
|
64
|
-
const { runStudioBin } = await import("@askdb/studio");
|
|
65
|
-
return runStudioBin(args);
|
|
66
|
-
}
|
|
67
|
-
function formatSchemaPathHint(schemaPath) {
|
|
68
|
-
return `Schema path: ${schemaPath}\nHint: Try \`fixtures/schemas/orders-users.schema/\` (v2 directory) as a known-good example.`;
|
|
69
|
-
}
|
|
70
|
-
function loadSchemaFromPath(schemaPath) {
|
|
71
|
-
try {
|
|
72
|
-
return loadSchema(schemaPath);
|
|
73
|
-
}
|
|
74
|
-
catch (e) {
|
|
75
|
-
const err = e;
|
|
76
|
-
const code = typeof err.code === "string" ? err.code : undefined;
|
|
77
|
-
if (code === "ENOENT") {
|
|
78
|
-
throw new AskDbError(`Schema path not found.\n${formatSchemaPathHint(schemaPath)}`, e);
|
|
79
|
-
}
|
|
80
|
-
if (code === "EACCES") {
|
|
81
|
-
throw new AskDbError(`Schema path is not readable (permission denied).\n${formatSchemaPathHint(schemaPath)}`, e);
|
|
82
|
-
}
|
|
83
|
-
if (e instanceof SchemaParseError) {
|
|
84
|
-
throw new AskDbError(`Failed to parse schema.\n${formatSchemaPathHint(schemaPath)}\nDetails: ${e.message}`, e);
|
|
85
|
-
}
|
|
86
|
-
const msg = e instanceof Error ? e.message : String(e);
|
|
87
|
-
throw new AskDbError(`Failed to load schema.\n${formatSchemaPathHint(schemaPath)}\nDetails: ${msg}`, e);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
function resolveSchemaPathForAsk(optionSchema, runtime) {
|
|
91
|
-
return optionSchema ?? runtime.introspection.outputDir;
|
|
92
|
-
}
|
|
93
|
-
const program = new Command();
|
|
94
|
-
program
|
|
95
|
-
.name("askdb")
|
|
96
|
-
.description("AskDB — natural language → validated SQL for your database")
|
|
97
|
-
.version(readCliVersion(), "-V, --version", "Print the askdb version");
|
|
98
|
-
program
|
|
99
|
-
.command("init")
|
|
100
|
-
.description("Create tailored askdb.config.ts via a wizard (TTY) or flags (CI). Installs selected packages unless --skip-install.")
|
|
101
|
-
.option("-f, --force", "Overwrite an existing file", false)
|
|
102
|
-
.option("--path <path>", "Output path for askdb.config.ts", "askdb.config.ts")
|
|
103
|
-
.option("--skip-install", "Only write the file; do not install packages", false)
|
|
104
|
-
.option("-y, --yes", "Accept defaults without prompts", false)
|
|
105
|
-
.option("--interactive", "Force wizard mode; errors if stdin/stdout are not TTYs", false)
|
|
106
|
-
.option("--no-interactive", "Do not prompt; use defaults or flags")
|
|
107
|
-
.option("--database <db>", "postgres|mysql|sqlite|sqlserver|prisma")
|
|
108
|
-
.option("--connection-env <name>", "Env var name for connection URL")
|
|
109
|
-
.option("--sqlite-file <path>", "SQLite file path or env var name")
|
|
110
|
-
.option("--prisma-schema <path>", "Path to schema.prisma")
|
|
111
|
-
.option("--schema-out <dir>", "Schema output directory (default: ./askdb)")
|
|
112
|
-
.option("--ai-provider <name>", VALID_AI_PROVIDERS.join("|"))
|
|
113
|
-
.option("--ai-key-env <name>", "Env var name for AI API key")
|
|
114
|
-
.option("--ai-model-env <name>", "Env var name for model override")
|
|
115
|
-
.option("--rag-store <name>", "file|memory|pgvector (default: file)")
|
|
116
|
-
.option("--pgvector-env <name>", "Env var name for pgvector URL")
|
|
117
|
-
.option("--studio-execute", "Enable Studio execute")
|
|
118
|
-
.option("--no-studio-execute", "Disable Studio execute")
|
|
119
|
-
.action(async (opts) => {
|
|
120
|
-
const args = [];
|
|
121
|
-
if (opts.force)
|
|
122
|
-
args.push("--force");
|
|
123
|
-
if (opts.skipInstall)
|
|
124
|
-
args.push("--skip-install");
|
|
125
|
-
if (opts.yes)
|
|
126
|
-
args.push("--yes");
|
|
127
|
-
if (opts.interactive)
|
|
128
|
-
args.push("--interactive");
|
|
129
|
-
if (opts.noInteractive)
|
|
130
|
-
args.push("--no-interactive");
|
|
131
|
-
if (opts.path && opts.path !== "askdb.config.ts")
|
|
132
|
-
args.push("--path", opts.path);
|
|
133
|
-
if (opts.database)
|
|
134
|
-
args.push("--database", opts.database);
|
|
135
|
-
if (opts.connectionEnv)
|
|
136
|
-
args.push("--connection-env", opts.connectionEnv);
|
|
137
|
-
if (opts.sqliteFile)
|
|
138
|
-
args.push("--sqlite-file", opts.sqliteFile);
|
|
139
|
-
if (opts.prismaSchema)
|
|
140
|
-
args.push("--prisma-schema", opts.prismaSchema);
|
|
141
|
-
if (opts.schemaOut)
|
|
142
|
-
args.push("--schema-out", opts.schemaOut);
|
|
143
|
-
if (opts.aiProvider)
|
|
144
|
-
args.push("--ai-provider", opts.aiProvider);
|
|
145
|
-
if (opts.aiKeyEnv)
|
|
146
|
-
args.push("--ai-key-env", opts.aiKeyEnv);
|
|
147
|
-
if (opts.aiModelEnv)
|
|
148
|
-
args.push("--ai-model-env", opts.aiModelEnv);
|
|
149
|
-
if (opts.ragStore)
|
|
150
|
-
args.push("--rag-store", opts.ragStore);
|
|
151
|
-
if (opts.pgvectorEnv)
|
|
152
|
-
args.push("--pgvector-env", opts.pgvectorEnv);
|
|
153
|
-
if (opts.studioExecute === true)
|
|
154
|
-
args.push("--studio-execute");
|
|
155
|
-
if (opts.studioExecute === false)
|
|
156
|
-
args.push("--no-studio-execute");
|
|
157
|
-
process.exit(await runInitCli(args));
|
|
158
|
-
});
|
|
159
|
-
program
|
|
160
|
-
.command("enrich")
|
|
161
|
-
.description("Open Studio for Schema v2 enrichment (alias of `askdb studio`)")
|
|
162
|
-
.allowUnknownOption(true);
|
|
163
|
-
program
|
|
164
|
-
.command("studio")
|
|
165
|
-
.description("Start the local browser UI for Schema v2 enrichment")
|
|
166
|
-
.allowUnknownOption(true);
|
|
167
|
-
program
|
|
168
|
-
.command("bundle")
|
|
169
|
-
.description("Bundle a Schema v2 directory into a single JSON file")
|
|
170
|
-
.allowUnknownOption(true);
|
|
171
|
-
program
|
|
172
|
-
.command("introspect")
|
|
173
|
-
.description("Introspect a database into Schema v2 files (see `askdb introspect --help`)")
|
|
174
|
-
.allowUnknownOption(true);
|
|
175
|
-
program
|
|
176
|
-
.command("rag")
|
|
177
|
-
.description("Chunk, embed, and query a schema artifact for retrieval (see `askdb rag --help`)")
|
|
178
|
-
.allowUnknownOption(true);
|
|
179
|
-
program
|
|
180
|
-
.command("ask")
|
|
181
|
-
.description("Generate SQL from schema + question")
|
|
182
|
-
.hook("preAction", () => {
|
|
183
|
-
requireAskDbConfig();
|
|
184
|
-
})
|
|
185
|
-
.option("-s, --schema <path>", "Path to AskDB Schema v2 directory, bundled JSON, or schema.json (default: configured introspection.outputDir, or ./askdb/)")
|
|
186
|
-
.requiredOption("-q, --question <text>", "Natural language question")
|
|
187
|
-
.option("--explain", "After SQL, print a JSON block describing heuristic guardrails satisfied (Phase 2 explainability)", false)
|
|
188
|
-
.option("-v, --verbose", "Emit structured JSON logs (info) to stderr", false)
|
|
189
|
-
.option("--log-level <level>", "Structured log level (trace|debug|info|warn|error|fatal|silent)")
|
|
190
|
-
.option("--log-file <path>", "Append structured JSON logs to this file")
|
|
191
|
-
.option("--log-stdout", "Mirror structured JSON logs to stdout", false)
|
|
192
|
-
.option("--correlation-id <id>", "Correlation ID for logs (overrides logging.correlationId in askdb.config)")
|
|
193
|
-
.option("--mock-sql <sql>", "Deterministic NL→SQL for tests (bypasses live model call). Also via dev.mockSql in askdb.config.")
|
|
194
|
-
.option("--mode <id>", `Operating mode (${formatAskDbModesV1()}). Can tighten config modes.askdbMode (default schema_only), never loosen it`)
|
|
195
|
-
.option("--omit-sensitive-from-prompt", "Omit sensitive column/table names from NL→SQL DDL (default: include names, tagged as sensitive)", false)
|
|
196
|
-
.action(async (opts) => {
|
|
197
|
-
let logLevel;
|
|
198
|
-
// Only the flag is parsed here: the facade applies config `modes.askdbMode` (ADR 0025).
|
|
199
|
-
let mode;
|
|
200
|
-
const runtime = getAskDbRuntimeConfig();
|
|
201
|
-
try {
|
|
202
|
-
logLevel = resolveCliLogLevel(opts, runtime);
|
|
203
|
-
mode = opts.mode === undefined ? undefined : parseAskDbModeV1(opts.mode);
|
|
204
|
-
}
|
|
205
|
-
catch (e) {
|
|
206
|
-
printCliError(e);
|
|
207
|
-
process.exitCode = 1;
|
|
208
|
-
return;
|
|
209
|
-
}
|
|
210
|
-
const logger = createCliLogger(opts, runtime, logLevel);
|
|
211
|
-
const mockSql = opts.mockSql ?? runtime.dev.mockSql;
|
|
212
|
-
const aiConfig = mockSql ? undefined : ai.resolveAiConfig(runtime.ai.aiEnv);
|
|
213
|
-
if (!mockSql && !aiConfig) {
|
|
214
|
-
console.error(ai.keyMissingMessage("NL→SQL generation"));
|
|
215
|
-
console.error("Tip: in tests, pass --mock-sql or set dev.mockSql in askdb.config to bypass live model calls.");
|
|
216
|
-
process.exitCode = 1;
|
|
217
|
-
return;
|
|
218
|
-
}
|
|
219
|
-
logger.info({ event: AskDbLogEvent.RunStart }, "askdb run start");
|
|
220
|
-
try {
|
|
221
|
-
const schemaPath = resolveSchemaPathForAsk(opts.schema, runtime);
|
|
222
|
-
const schema = loadSchemaFromPath(schemaPath);
|
|
223
|
-
const askdb = createAskDb({
|
|
224
|
-
config: runtime,
|
|
225
|
-
registry: ai,
|
|
226
|
-
onResolve: (info) => {
|
|
227
|
-
if (info.dialect.note) {
|
|
228
|
-
logger.info({
|
|
229
|
-
event: "askdb.pipeline.dialect_override",
|
|
230
|
-
note: info.dialect.note,
|
|
231
|
-
}, info.dialect.note);
|
|
232
|
-
console.error(`Note: ${info.dialect.note}`);
|
|
233
|
-
}
|
|
234
|
-
},
|
|
235
|
-
});
|
|
236
|
-
const out = await askdb.ask(opts.question, {
|
|
237
|
-
schema: { schema },
|
|
238
|
-
logger,
|
|
239
|
-
...(mode ? { mode } : {}),
|
|
240
|
-
explain: Boolean(opts.explain),
|
|
241
|
-
// The facade adds config `modes.omitSensitiveFromPrompt` as a floor.
|
|
242
|
-
omitSensitiveIdentifiersFromNlToSqlPrompt: Boolean(opts.omitSensitiveFromPrompt),
|
|
243
|
-
// When --mock-sql flag is set explicitly (not just from runtime config),
|
|
244
|
-
// pass it as a per-call deps override so the flag wins over config.
|
|
245
|
-
...(opts.mockSql !== undefined
|
|
246
|
-
? {
|
|
247
|
-
deps: {
|
|
248
|
-
generateText: (async () => ({ text: opts.mockSql })),
|
|
249
|
-
},
|
|
250
|
-
}
|
|
251
|
-
: {}),
|
|
252
|
-
});
|
|
253
|
-
// `ask()` runs the sensitive-identifier guardrail in warn mode and emits
|
|
254
|
-
// askdb.pipeline.sensitive_sql_warning through the logger above; the CLI
|
|
255
|
-
// only renders it for the operator.
|
|
256
|
-
const sensitive = out.sensitiveGuardrail;
|
|
257
|
-
if (sensitive && sensitive.references.length > 0) {
|
|
258
|
-
const cols = sensitive.references.map(formatSensitiveReference);
|
|
259
|
-
console.error(`Warning: generated SQL references sensitive columns: ${cols.join(", ")}\n` +
|
|
260
|
-
"Review carefully before sharing or running this SQL outside AskDB.");
|
|
261
|
-
}
|
|
262
|
-
if (sensitive?.unresolvedScope) {
|
|
263
|
-
console.error(`Note: ${sensitive.unresolvedScope.message}`);
|
|
264
|
-
}
|
|
265
|
-
console.log("-- sql --");
|
|
266
|
-
console.log(out.sql);
|
|
267
|
-
if (opts.explain) {
|
|
268
|
-
console.log("-- explain --");
|
|
269
|
-
console.log(JSON.stringify(out.explain ?? null, null, 2));
|
|
270
|
-
}
|
|
271
|
-
logger.info({ event: AskDbLogEvent.RunEnd, ok: true }, "askdb run end");
|
|
272
|
-
}
|
|
273
|
-
catch (error) {
|
|
274
|
-
const msg = error instanceof Error ? error.message : String(error);
|
|
275
|
-
logger.error({ event: AskDbLogEvent.RunError, errMessage: msg }, "askdb run error");
|
|
276
|
-
printCliError(error);
|
|
277
|
-
process.exitCode = 1;
|
|
278
|
-
}
|
|
279
|
-
});
|
|
280
|
-
const RAG_NO_CONFIG_FLAGS = new Set(["--help", "-h", "--version", "-V"]);
|
|
281
|
-
// Each command loads askdb.config itself, only on the path that reads it.
|
|
282
|
-
async function main(argv) {
|
|
283
|
-
const [command, ...rest] = argv.slice(2);
|
|
284
|
-
switch (command) {
|
|
285
|
-
case "init":
|
|
286
|
-
return runInitCli(rest);
|
|
287
|
-
case "introspect":
|
|
288
|
-
return runIntrospectCli(rest);
|
|
289
|
-
case "rag":
|
|
290
|
-
// Help, version and no args work without a config; every other rag command reads it.
|
|
291
|
-
if (rest.length > 0 && !rest.some((arg) => RAG_NO_CONFIG_FLAGS.has(arg)))
|
|
292
|
-
requireAskDbConfig();
|
|
293
|
-
return runRagCli(rest);
|
|
294
|
-
case "enrich":
|
|
295
|
-
case "studio":
|
|
296
|
-
return runStudioCommand(rest);
|
|
297
|
-
case "bundle":
|
|
298
|
-
return runBundleCommand(rest);
|
|
299
|
-
default:
|
|
300
|
-
// Commander handles `--help`, `--version`, `help`, and no-args without loading config;
|
|
301
|
-
// commands that need config load it lazily in a preAction hook.
|
|
302
|
-
await program.parseAsync(argv);
|
|
303
|
-
return undefined;
|
|
304
|
-
}
|
|
305
|
-
}
|
|
2
|
+
import { isAskDbDebugEnabled } from "@askdb/config";
|
|
3
|
+
import { AskDbError } from "@askdb/core";
|
|
4
|
+
import { printCliError } from "./cli-error.js";
|
|
5
|
+
import { runCli } from "./dispatch.js";
|
|
6
|
+
/**
|
|
7
|
+
* Resolves once everything written so far has reached stdout and stderr, so exiting can't cut it
|
|
8
|
+
* off. A reader that closed early (`askdb --help | grep -q …`) leaves nothing to drain: its EPIPE
|
|
9
|
+
* resolves instead of crashing the exit.
|
|
10
|
+
*/
|
|
11
|
+
function drain() {
|
|
12
|
+
return Promise.all([process.stdout, process.stderr].map((stream) => new Promise((done) => {
|
|
13
|
+
stream.on("error", done);
|
|
14
|
+
stream.write("", done);
|
|
15
|
+
})));
|
|
16
|
+
}
|
|
17
|
+
const EXIT_GRACE_MS = 250;
|
|
18
|
+
// Each command loads askdb.config itself, only on the path that reads it. An error that escapes a
|
|
19
|
+
// command, such as a missing or broken config, lands here.
|
|
20
|
+
let exitCode;
|
|
306
21
|
try {
|
|
307
|
-
|
|
308
|
-
if (exitCode !== undefined)
|
|
309
|
-
process.exit(exitCode);
|
|
22
|
+
exitCode = await runCli(process.argv.slice(2));
|
|
310
23
|
}
|
|
311
24
|
catch (error) {
|
|
312
25
|
printCliError(error);
|
|
@@ -316,6 +29,12 @@ catch (error) {
|
|
|
316
29
|
else if (!(error instanceof AskDbError)) {
|
|
317
30
|
console.error("Set ASKDB_DEBUG=1 to print the stack trace.");
|
|
318
31
|
}
|
|
319
|
-
|
|
32
|
+
exitCode = 1;
|
|
320
33
|
}
|
|
34
|
+
await drain();
|
|
35
|
+
// Exit once the event loop is empty, so a logger's own pending writes (`--log-stdout` into a reader
|
|
36
|
+
// that closed early) settle instead of making the exit hook retry them forever. A command that
|
|
37
|
+
// leaves a handle open, such as Studio's sockets after it stops, is cut off after a grace period.
|
|
38
|
+
process.exitCode = exitCode;
|
|
39
|
+
setTimeout(() => process.exit(), EXIT_GRACE_MS).unref();
|
|
321
40
|
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAC3E,OAAO,EACL,gBAAgB,GACjB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,WAAW,EAA0B,MAAM,eAAe,CAAC;AACpE,OAAO,EACL,UAAU,EACV,aAAa,EAIb,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,wBAAwB,EACxB,UAAU,GACX,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC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,UAAU,CAAC,EAAE,CAAC;QAC1C,OAAO,CAAC,KAAK,CAAC,6CAA6C,CAAC,CAAC;IAC/D,CAAC;IACD,QAAQ,GAAG,CAAC,CAAC;AACf,CAAC;AACD,MAAM,KAAK,EAAE,CAAC;AACd,oGAAoG;AACpG,+FAA+F;AAC/F,kGAAkG;AAClG,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC;AAC5B,UAAU,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,aAAa,CAAC,CAAC,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/** One flag of a command: how it's spelt, how it shows in the help, and what it sets. */
|
|
2
|
+
export type Flag<O> = {
|
|
3
|
+
/** Spellings, short form first: `["-f", "--force"]`. */
|
|
4
|
+
names: readonly string[];
|
|
5
|
+
/** Placeholder for the flag's value, e.g. `<dir>`; absent for a switch. */
|
|
6
|
+
value?: string;
|
|
7
|
+
/** The help line; a function when it depends on something the command is built with. */
|
|
8
|
+
help: string | (() => string);
|
|
9
|
+
/** The help section, e.g. `Database options`. Absent: `Options`. */
|
|
10
|
+
group?: string;
|
|
11
|
+
/** Sets the flag on `opts`. A bad value throws; the error repeats it only when `showable()`. */
|
|
12
|
+
apply(opts: O, value: string): void;
|
|
13
|
+
};
|
|
14
|
+
/** Everything `runCommand` needs to parse, document, gate and run one `askdb` command. */
|
|
15
|
+
export type CommandSpec<O> = {
|
|
16
|
+
name: string;
|
|
17
|
+
/** One line, for the top of the command's help and for `askdb --help`. */
|
|
18
|
+
summary: string;
|
|
19
|
+
/** Usage lines, each starting `askdb <name>`. */
|
|
20
|
+
usage: readonly string[];
|
|
21
|
+
/** Lines printed between the usage and the options. */
|
|
22
|
+
notes?: readonly string[];
|
|
23
|
+
flags: readonly Flag<O>[];
|
|
24
|
+
/**
|
|
25
|
+
* Takes the `index`th argument that isn't a flag. Absent: the command takes none. Throws for
|
|
26
|
+
* one it doesn't take, without repeating it.
|
|
27
|
+
*/
|
|
28
|
+
positional?(opts: O, value: string, index: number): void;
|
|
29
|
+
/** Options before any flag is applied. */
|
|
30
|
+
initial(): O;
|
|
31
|
+
/** Conflicts between flags, after every flag is applied. Throws a usage error. */
|
|
32
|
+
check?(opts: O): void;
|
|
33
|
+
/** Whether this run reads askdb.config. */
|
|
34
|
+
needsConfig(opts: O): boolean;
|
|
35
|
+
run(opts: O): Promise<number>;
|
|
36
|
+
};
|
|
37
|
+
/** The spellings every command, and `askdb` itself, takes for its help and its version. */
|
|
38
|
+
export declare const HELP_FLAGS: readonly string[];
|
|
39
|
+
export declare const VERSION_FLAGS: readonly string[];
|
|
40
|
+
/** The help and version lines every command takes. `askdb --help` lists them too. */
|
|
41
|
+
export declare const GENERAL_OPTION_LINES: readonly OptionLine[];
|
|
42
|
+
type OptionLine = {
|
|
43
|
+
usage: string;
|
|
44
|
+
help: string;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Runs one command: `--help`/`-h` and `--version`/`-V` first, anywhere in `argv`; then the flags,
|
|
48
|
+
* positionals and `check`; then the config gate; then `run`. A usage error or an error `run`
|
|
49
|
+
* throws goes to stderr and returns 1. The config gate's error propagates, so the top-level
|
|
50
|
+
* handler prints it with its debug hint.
|
|
51
|
+
*/
|
|
52
|
+
export declare function runCommand<O>(spec: CommandSpec<O>, argv: readonly string[]): Promise<number>;
|
|
53
|
+
/** `Heading:` then one aligned line per option, for each section with any. */
|
|
54
|
+
export declare function formatOptionSections(sections: ReadonlyMap<string, readonly OptionLine[]>): string[];
|
|
55
|
+
export {};
|
|
56
|
+
//# sourceMappingURL=command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../src/command.ts"],"names":[],"mappings":"AAKA,yFAAyF;AACzF,MAAM,MAAM,IAAI,CAAC,CAAC,IAAI;IACpB,wDAAwD;IACxD,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IACzB,2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M,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAElD;;;;;GAKG;AACH,wBAAsB,UAAU,CAAC,CAAC,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAwBlG;AAqFD,8EAA8E;AAC9E,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,UAAU,EAAE,CAAC,GAAG,MAAM,EAAE,CAMnG"}
|
package/dist/command.js
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { errorMessage } from "./cli-error.js";
|
|
2
|
+
import { labelled } from "./error-values.js";
|
|
3
|
+
import { requireAskDbConfig } from "./project-config.js";
|
|
4
|
+
import { readCliVersion } from "./version.js";
|
|
5
|
+
/** The spellings every command, and `askdb` itself, takes for its help and its version. */
|
|
6
|
+
export const HELP_FLAGS = ["--help", "-h"];
|
|
7
|
+
export const VERSION_FLAGS = ["--version", "-V"];
|
|
8
|
+
/** The help and version lines every command takes. `askdb --help` lists them too. */
|
|
9
|
+
export const GENERAL_OPTION_LINES = [
|
|
10
|
+
{ usage: "-V, --version", help: "Print the askdb version." },
|
|
11
|
+
{ usage: "-h, --help", help: "Print this help." },
|
|
12
|
+
];
|
|
13
|
+
/**
|
|
14
|
+
* Runs one command: `--help`/`-h` and `--version`/`-V` first, anywhere in `argv`; then the flags,
|
|
15
|
+
* positionals and `check`; then the config gate; then `run`. A usage error or an error `run`
|
|
16
|
+
* throws goes to stderr and returns 1. The config gate's error propagates, so the top-level
|
|
17
|
+
* handler prints it with its debug hint.
|
|
18
|
+
*/
|
|
19
|
+
export async function runCommand(spec, argv) {
|
|
20
|
+
if (argv.some((arg) => HELP_FLAGS.includes(arg))) {
|
|
21
|
+
process.stdout.write(formatHelp(spec));
|
|
22
|
+
return 0;
|
|
23
|
+
}
|
|
24
|
+
if (argv.some((arg) => VERSION_FLAGS.includes(arg))) {
|
|
25
|
+
process.stdout.write(`${readCliVersion()}\n`);
|
|
26
|
+
return 0;
|
|
27
|
+
}
|
|
28
|
+
let opts;
|
|
29
|
+
try {
|
|
30
|
+
opts = parseArgs(spec, argv);
|
|
31
|
+
spec.check?.(opts);
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
process.stderr.write(`${errorMessage(error)}\n`);
|
|
35
|
+
return 1;
|
|
36
|
+
}
|
|
37
|
+
if (spec.needsConfig(opts))
|
|
38
|
+
requireAskDbConfig();
|
|
39
|
+
try {
|
|
40
|
+
return await spec.run(opts);
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
process.stderr.write(`${errorMessage(error)}\n`);
|
|
44
|
+
return 1;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function parseArgs(spec, argv) {
|
|
48
|
+
const byName = new Map(spec.flags.flatMap((flag) => flag.names.map((name) => [name, flag])));
|
|
49
|
+
const opts = spec.initial();
|
|
50
|
+
let positionals = 0;
|
|
51
|
+
for (let i = 0; i < argv.length; i += 1) {
|
|
52
|
+
const arg = argv[i];
|
|
53
|
+
// Errors never repeat an argument whole: it can be a connection string, password included.
|
|
54
|
+
if (!arg.startsWith("-")) {
|
|
55
|
+
if (!spec.positional) {
|
|
56
|
+
throw new Error(`Unexpected argument: askdb ${spec.name} takes no positional arguments. Pass values with their flag.`);
|
|
57
|
+
}
|
|
58
|
+
spec.positional(opts, arg, positionals);
|
|
59
|
+
positionals += 1;
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
// `--flag=value` works like `--flag value`.
|
|
63
|
+
const eq = arg.indexOf("=");
|
|
64
|
+
const name = eq === -1 ? arg : arg.slice(0, eq);
|
|
65
|
+
const inline = eq === -1 ? undefined : arg.slice(eq + 1);
|
|
66
|
+
const flag = byName.get(name);
|
|
67
|
+
if (flag) {
|
|
68
|
+
if (!flag.value) {
|
|
69
|
+
if (inline !== undefined)
|
|
70
|
+
throw new Error(`${name} takes no value.`);
|
|
71
|
+
flag.apply(opts, "");
|
|
72
|
+
}
|
|
73
|
+
else if (inline !== undefined) {
|
|
74
|
+
if (!inline)
|
|
75
|
+
throw new Error(`${name} requires a value.`);
|
|
76
|
+
flag.apply(opts, inline);
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
flag.apply(opts, readValue(argv, ++i, name));
|
|
80
|
+
}
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
if (arg.startsWith("--") || arg.length < 3)
|
|
84
|
+
throw new Error(labelled("Unknown option", name));
|
|
85
|
+
// Short flags cluster: `-fy` is `-f -y`, `-qtext` is `-q text`, and `-vq text` ends with the
|
|
86
|
+
// flag that takes a value.
|
|
87
|
+
for (let j = 1; j < arg.length; j += 1) {
|
|
88
|
+
const short = `-${arg[j]}`;
|
|
89
|
+
const cluster = byName.get(short);
|
|
90
|
+
if (!cluster)
|
|
91
|
+
throw new Error(labelled("Unknown option", short));
|
|
92
|
+
if (!cluster.value) {
|
|
93
|
+
cluster.apply(opts, "");
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
const rest = arg.slice(j + 1);
|
|
97
|
+
cluster.apply(opts, rest || readValue(argv, ++i, short));
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return opts;
|
|
102
|
+
}
|
|
103
|
+
/** The argument after a flag that takes a value; another flag there means the value is missing. */
|
|
104
|
+
function readValue(argv, index, name) {
|
|
105
|
+
const value = argv[index];
|
|
106
|
+
if (!value || value.startsWith("--"))
|
|
107
|
+
throw new Error(`${name} requires a value.`);
|
|
108
|
+
return value;
|
|
109
|
+
}
|
|
110
|
+
/** What `askdb <name> --help` and `askdb help <name>` print. */
|
|
111
|
+
function formatHelp(spec) {
|
|
112
|
+
const sections = new Map([["Options", []]]);
|
|
113
|
+
for (const flag of spec.flags) {
|
|
114
|
+
const group = flag.group ?? "Options";
|
|
115
|
+
if (!sections.has(group))
|
|
116
|
+
sections.set(group, []);
|
|
117
|
+
sections.get(group).push({
|
|
118
|
+
usage: flag.names.join(", ") + (flag.value ? ` ${flag.value}` : ""),
|
|
119
|
+
help: typeof flag.help === "function" ? flag.help() : flag.help,
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
sections.get("Options").push(...GENERAL_OPTION_LINES);
|
|
123
|
+
return [
|
|
124
|
+
`askdb ${spec.name} - ${spec.summary}`,
|
|
125
|
+
"",
|
|
126
|
+
"Usage:",
|
|
127
|
+
...spec.usage.map((line) => ` ${line}`),
|
|
128
|
+
"",
|
|
129
|
+
...(spec.notes && spec.notes.length > 0 ? [...spec.notes, ""] : []),
|
|
130
|
+
...formatOptionSections(sections),
|
|
131
|
+
].join("\n");
|
|
132
|
+
}
|
|
133
|
+
/** `Heading:` then one aligned line per option, for each section with any. */
|
|
134
|
+
export function formatOptionSections(sections) {
|
|
135
|
+
const all = [...sections.values()].flat();
|
|
136
|
+
const width = Math.max(...all.map((line) => line.usage.length)) + 2;
|
|
137
|
+
return [...sections].flatMap(([heading, lines]) => lines.length === 0 ? [] : [`${heading}:`, ...lines.map((line) => ` ${line.usage.padEnd(width)}${line.help}`), ""]);
|
|
138
|
+
}
|
|
139
|
+
//# sourceMappingURL=command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command.js","sourceRoot":"","sources":["../src/command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAwC9C,2FAA2F;AAC3F,MAAM,CAAC,MAAM,UAAU,GAAsB,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AAC9D,MAAM,CAAC,MAAM,aAAa,GAAsB,CAAC,WAAW,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CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC;IACpE,OAAO,CAAC,GAAG,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE,EAAE,CAChD,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,GAAG,EAAE,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CACnH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `askdb <command> …`, `askdb help <command>`, `--help` and `--version`. Returns the exit code.
|
|
3
|
+
* With no command, prints the help to stderr and returns 1.
|
|
4
|
+
*/
|
|
5
|
+
export declare function runCli(argv: readonly string[]): Promise<number>;
|
|
6
|
+
//# sourceMappingURL=dispatch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dispatch.d.ts","sourceRoot":"","sources":["../src/dispatch.ts"],"names":[],"mappings":"AA6CA;;;GAGG;AACH,wBAAsB,MAAM,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAsBrE"}
|