@dbx-app/cli 0.4.29 → 0.4.30

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.
Files changed (2) hide show
  1. package/dist/cli.js +3 -2
  2. package/package.json +2 -2
package/dist/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { readFile } from "node:fs/promises";
3
- import { buildSchemaContext, createBackend, DIRECT_QUERY_TYPES, BRIDGE_REQUIRED_TYPES, evaluateSqlSafety, formatSchemaContext, getDbxDiagnostics, isMainModule, postBridge } from "@dbx-app/node-core";
3
+ import { buildSchemaContext, createBackend, DIRECT_QUERY_TYPES, BRIDGE_REQUIRED_TYPES, evaluateSqlSafety, formatSchemaContext, getDbxDiagnostics, isMainModule, postBridge, supportsHashLineComments } from "@dbx-app/node-core";
4
4
  import { connectionSummary, csvTable, errorPayload, formatCell, formatErrorMessage, mdTable } from "./cli-format.js";
5
5
  class CliError extends Error {
6
6
  code;
@@ -104,6 +104,7 @@ export async function runCli(argv, options = {}) {
104
104
  }
105
105
  const sqlArg = usesDefaultConnection ? args[1] : args[2];
106
106
  const sql = flags.file ? await readFile(flags.file, "utf-8") : required(sqlArg, "SQL string or --file is required.");
107
+ const config = await findConnectionOrThrow(backend, connectionName);
107
108
  const envSafety = sqlSafetyFromCliEnv(env);
108
109
  if (flags.allowDangerous && !flags.allowWrites && !envSafety.allowWrites) {
109
110
  throw new CliError("INVALID_OPTION", "--allow-dangerous-sql requires --allow-writes.");
@@ -111,11 +112,11 @@ export async function runCli(argv, options = {}) {
111
112
  const safetyOptions = {
112
113
  allowWrites: flags.allowWrites || envSafety.allowWrites,
113
114
  allowDangerous: flags.allowDangerous || envSafety.allowDangerous,
115
+ hashLineComments: supportsHashLineComments(config.db_type),
114
116
  };
115
117
  const safety = evaluateSqlSafety(sql, safetyOptions);
116
118
  if (!safety.allowed)
117
119
  return fail("SQL_BLOCKED", safety.reason ?? "SQL blocked.", flags.json);
118
- const config = await findConnectionOrThrow(backend, connectionName);
119
120
  const result = await backend.executeQuery(config, sql, { maxRows: flags.maxRows, timeoutMs: flags.timeoutMs });
120
121
  if (flags.format === "json") {
121
122
  return okJson({ connection: connectionName, columns: result.columns, rows: result.rows, row_count: result.row_count });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dbx-app/cli",
3
- "version": "0.4.29",
3
+ "version": "0.4.30",
4
4
  "description": "Command line interface for DBX database connections, schema, and safe queries",
5
5
  "keywords": [
6
6
  "ai-agent",
@@ -28,7 +28,7 @@
28
28
  ],
29
29
  "type": "module",
30
30
  "dependencies": {
31
- "@dbx-app/node-core": "^0.4.29"
31
+ "@dbx-app/node-core": "^0.4.30"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@types/node": "^22.15.21",