agent-database-cli 0.2.15 → 0.2.17

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/README.md CHANGED
@@ -12,7 +12,7 @@ MySQL · PostgreSQL · Redis · Oracle · MongoDB · 只读模式 · 命令黑
12
12
  <img src="https://img.shields.io/badge/Node.js-%3E%3D20-339933?logo=node.js&logoColor=white" alt="Node.js >=20">
13
13
  <img src="https://img.shields.io/badge/npm-%3E%3D10-CB3837?logo=npm&logoColor=white" alt="npm >=10">
14
14
  <img src="https://img.shields.io/badge/sys-win%2Fmac%2Flinux-0078D6" alt="sys win/mac/linux">
15
- <img src="https://img.shields.io/badge/release-v0.2.12-blue" alt="release v0.2.12">
15
+ <img src="https://img.shields.io/badge/release-v0.2.17-blue" alt="release v0.2.17">
16
16
  </p>
17
17
 
18
18
  [AI 一键安装](#ai-一键安装) · [安装](#安装) · [配置](#配置) · [权限配置](#权限配置) · [Oracle SQLcl](#oracle-sqlcl) · [许可证](#许可证) · [友情链接](#友情链接)
@@ -29,7 +29,7 @@ MySQL · PostgreSQL · Redis · Oracle · MongoDB · 只读模式 · 命令黑
29
29
 
30
30
  - 列出当前支持的数据库类型和本地已配置连接
31
31
  - 对指定数据库执行 SQL、Redis 命令或 MongoDB JSON 命令
32
- - 查询数据库元信息,例如表、列、集合、Redis keys
32
+ - 查询数据库元信息,例如表、列、集合、Redis keys;Redis keys 元信息使用 `SCAN` 分批读取,避免阻塞式 `KEYS`
33
33
  - 按单个数据库配置启用只读模式和命令黑名单
34
34
  - Oracle 默认使用 SQLcl;需要 Oracle Instant Client 时可显式切换到 `oracle`/`oracledb` 原生驱动
35
35
  - 不保存或输出脱敏前的密码、token、secret
@@ -243,6 +243,7 @@ SSH 隧道配置支持密码、私钥、密码加私钥、带通行短语的私
243
243
 
244
244
  - 默认值是 `true`
245
245
  - 不配置 `readonly` 时,仍然会按只读模式处理
246
+ - 只读模式会额外拒绝存在写入语义的查询,例如 PostgreSQL `SELECT INTO` 和 MongoDB aggregate 中的 `$out`、`$merge`
246
247
  - 推荐所有日常查询连接都保持默认只读
247
248
  - 需要修改数据时,建议先让 AI 生成对应 SQL 或命令,再由你确认后执行
248
249
  - 只有明确需要写入的专用连接,才单独配置 `readonly: false`
@@ -272,13 +273,13 @@ MySQL / PostgreSQL / Oracle 常见高危 SQL:
272
273
  Redis 常见高危命令:
273
274
 
274
275
  ```json
275
- ["flushall", "flushdb", "del", "unlink", "set", "mset", "expire", "rename", "hset", "lpush", "rpush", "sadd", "zadd"]
276
+ ["flushall", "flushdb", "del", "unlink", "set", "mset", "expire", "rename", "hset", "lpush", "rpush", "sadd", "zadd", "keys"]
276
277
  ```
277
278
 
278
279
  MongoDB 常见高危命令:
279
280
 
280
281
  ```json
281
- ["insertOne", "insertMany", "updateOne", "updateMany", "replaceOne", "deleteOne", "deleteMany", "findAndModify", "findOneAndUpdate", "findOneAndDelete", "drop", "dropDatabase", "createIndex", "dropIndex"]
282
+ ["insertOne", "insertMany", "updateOne", "updateMany", "replaceOne", "deleteOne", "deleteMany", "findAndModify", "findOneAndUpdate", "findOneAndDelete", "drop", "dropDatabase", "createIndex", "dropIndex", "$out", "$merge"]
282
283
  ```
283
284
 
284
285
  ### 推荐配置示例
package/README_EN.md CHANGED
@@ -12,7 +12,7 @@ MySQL · PostgreSQL · Redis · Oracle · MongoDB · Read-only mode · Command b
12
12
  <img src="https://img.shields.io/badge/Node.js-%3E%3D20-339933?logo=node.js&logoColor=white" alt="Node.js >=20">
13
13
  <img src="https://img.shields.io/badge/npm-%3E%3D10-CB3837?logo=npm&logoColor=white" alt="npm >=10">
14
14
  <img src="https://img.shields.io/badge/sys-win%2Fmac%2Flinux-0078D6" alt="sys win/mac/linux">
15
- <img src="https://img.shields.io/badge/release-v0.2.12-blue" alt="release v0.2.12">
15
+ <img src="https://img.shields.io/badge/release-v0.2.17-blue" alt="release v0.2.17">
16
16
  </p>
17
17
 
18
18
  [AI One-Click Installation](#ai-one-click-installation) · [Installation](#installation) · [Configuration](#configuration) · [Permission Configuration](#permission-configuration) · [Oracle SQLcl](#oracle-sqlcl) · [License](#license) · [Friendly Links](#friendly-links)
@@ -29,7 +29,7 @@ What it can do:
29
29
 
30
30
  - List currently supported database types and locally configured connections
31
31
  - Execute SQL, Redis commands, or MongoDB JSON commands against a specified database
32
- - Query database metadata such as tables, columns, collections, and Redis keys
32
+ - Query database metadata such as tables, columns, collections, and Redis keys. Redis keys metadata uses cursor-based `SCAN` instead of blocking `KEYS`
33
33
  - Enable read-only mode and command blocklists per database configuration
34
34
  - Auto-start the local daemon on demand; the daemon exits after `300` idle seconds by default
35
35
  - Keep connections alive through the local daemon; each database connection is released after `180` idle seconds by default
@@ -245,6 +245,7 @@ It is recommended to use both `readonly` and `blacklist` together for permission
245
245
 
246
246
  - The default value is `true`
247
247
  - When `readonly` is omitted, the connection is still treated as read-only
248
+ - Read-only mode also rejects queries with write semantics, such as PostgreSQL `SELECT INTO` and MongoDB aggregate `$out` / `$merge`
248
249
  - It is recommended to keep all day-to-day query connections read-only by default
249
250
  - When data changes are needed, let AI generate the SQL or command first, then execute it after your confirmation
250
251
  - Only dedicated writable connections should explicitly set `readonly: false`
@@ -274,13 +275,13 @@ Common high-risk SQL for MySQL / PostgreSQL / Oracle:
274
275
  Common high-risk Redis commands:
275
276
 
276
277
  ```json
277
- ["flushall", "flushdb", "del", "unlink", "set", "mset", "expire", "rename", "hset", "lpush", "rpush", "sadd", "zadd"]
278
+ ["flushall", "flushdb", "del", "unlink", "set", "mset", "expire", "rename", "hset", "lpush", "rpush", "sadd", "zadd", "keys"]
278
279
  ```
279
280
 
280
281
  Common high-risk MongoDB commands:
281
282
 
282
283
  ```json
283
- ["insertOne", "insertMany", "updateOne", "updateMany", "replaceOne", "deleteOne", "deleteMany", "findAndModify", "findOneAndUpdate", "findOneAndDelete", "drop", "dropDatabase", "createIndex", "dropIndex"]
284
+ ["insertOne", "insertMany", "updateOne", "updateMany", "replaceOne", "deleteOne", "deleteMany", "findAndModify", "findOneAndUpdate", "findOneAndDelete", "drop", "dropDatabase", "createIndex", "dropIndex", "$out", "$merge"]
284
285
  ```
285
286
 
286
287
  ### Recommended Configuration Examples
package/SKILL.md CHANGED
@@ -172,7 +172,7 @@ agent-database-cli exec --db local-mongodb --command '{"find":{"collection":"use
172
172
 
173
173
  - 成功时 stdout 输出 `rows`、`fields`、`rowCount`
174
174
  - 命中黑名单、违反只读模式、命令执行失败时 stderr 输出错误,退出码为 `1`
175
- - SQLcl Oracle 模式返回 SQLcl 文本输出,字段名为 `output`
175
+ - SQLcl Oracle 模式会解析 SQLcl JSON 输出,成功时同样返回统一的 `rows`、`fields`、`rowCount`;仅在无法解析为 JSON 时才以 `output` 字段返回原始文本
176
176
 
177
177
  ## meta
178
178
 
@@ -239,7 +239,7 @@ agent-database-cli reset --db "<databaseName>"
239
239
  }
240
240
  ```
241
241
 
242
- SQLcl 模式通过 stdin 传入连接脚本,避免密码出现在命令行参数列表中。执行前仍会先走本地黑名单和只读检查。
242
+ SQLcl 模式通过 stdin 传入连接脚本,避免密码出现在命令行参数列表中。执行前仍会先走本地黑名单和只读检查;输出会按内部标记截取 SQLcl 查询结果并解析为统一结果结构。
243
243
 
244
244
  ## 错误规则
245
245
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-database-cli",
3
- "version": "0.2.15",
3
+ "version": "0.2.17",
4
4
  "description": "统一数据库命令行工具,支持只读、黑名单和本地连接守护进程。",
5
5
  "type": "module",
6
6
  "bin": {
@@ -24,11 +24,11 @@
24
24
  "config/docker-test.json"
25
25
  ],
26
26
  "optionalDependencies": {
27
- "@agent-database-cli/darwin-arm64": "0.2.15",
28
- "@agent-database-cli/darwin-x64": "0.2.15",
29
- "@agent-database-cli/linux-arm64": "0.2.15",
30
- "@agent-database-cli/linux-x64": "0.2.15",
31
- "@agent-database-cli/win32-x64": "0.2.15"
27
+ "@agent-database-cli/darwin-arm64": "0.2.17",
28
+ "@agent-database-cli/darwin-x64": "0.2.17",
29
+ "@agent-database-cli/linux-arm64": "0.2.17",
30
+ "@agent-database-cli/linux-x64": "0.2.17",
31
+ "@agent-database-cli/win32-x64": "0.2.17"
32
32
  },
33
33
  "publishConfig": {
34
34
  "access": "public"