✨ feat: 添加微信小程序调试工具和完整参数参考文档
This commit is contained in:
@@ -1,45 +1,45 @@
|
||||
---
|
||||
name: query-shz-highgo
|
||||
description: Query the SHZ HighGo Security Enterprise Edition database in the test or production environment through an SSH gateway using a guarded read-only psql workflow. Use when Codex is working in the shz-backend project and needs to inspect database schemas, tables, columns, row counts, or application data; diagnose data-related behavior; or execute SELECT, WITH, SHOW, or EXPLAIN statements against the project's HighGo database.
|
||||
description: 通过 SSH 网关和受保护的只读 psql 流程查询测试或生产环境中的 SHZ HighGo Security Enterprise Edition 数据库。适用于 Codex 在 shz-backend 项目中检查数据库 schema、表、列、行数或应用数据,诊断数据相关行为,或对项目 HighGo 数据库执行 SELECT、WITH、SHOW 或 EXPLAIN 语句。
|
||||
---
|
||||
|
||||
# Query SHZ HighGo
|
||||
# 查询 SHZ HighGo 数据库
|
||||
|
||||
Use the bundled script to run read-only SQL through the configured SSH gateway. The existing one-argument form queries production; pass `test` as the first argument to query the test environment.
|
||||
使用随附脚本,通过已配置的 SSH 网关执行只读 SQL。省略环境参数时查询生产环境;将 `test` 作为第一个参数传入以查询测试环境。
|
||||
|
||||
## Query workflow
|
||||
## 查询流程
|
||||
|
||||
1. Form the narrowest useful query. Add a small `LIMIT` when inspecting rows.
|
||||
2. For unfamiliar tables, inspect `information_schema.columns` before selecting business data.
|
||||
3. Run:
|
||||
1. 构造范围最小且有用的查询。检查数据行时增加较小的 `LIMIT`。
|
||||
2. 对陌生表,先检查 `information_schema.columns`,再查询业务数据。
|
||||
3. 运行:
|
||||
|
||||
```bash
|
||||
.codex/skills/query-shz-highgo/scripts/query.sh 'SELECT current_database(), current_user, current_schema()'
|
||||
|
||||
# Test environment
|
||||
# 测试环境
|
||||
.codex/skills/query-shz-highgo/scripts/query.sh test 'SELECT current_database(), current_user, current_schema()'
|
||||
```
|
||||
|
||||
4. Summarize the result and distinguish returned facts from inferences.
|
||||
4. 总结查询结果,并区分返回的事实和推断。
|
||||
|
||||
The script accepts only statements beginning with `SELECT`, `WITH`, `SHOW`, or `EXPLAIN`, rejects multiple statements, sets `search_path` to `shz,public`, enforces database-level read-only mode, and applies a 30-second timeout. Never bypass these controls or perform writes unless the user explicitly requests a separate write-capable workflow.
|
||||
脚本只接受以 `SELECT`、`WITH`、`SHOW` 或 `EXPLAIN` 开头的语句,拒绝多条语句,将 `search_path` 设置为 `shz,public`,启用数据库级只读模式,并设置 30 秒超时。不得绕过这些控制,也不得执行写入;除非用户明确要求,否则不得使用单独的可写流程。
|
||||
|
||||
## Schema discovery
|
||||
## 发现 schema
|
||||
|
||||
List user tables:
|
||||
列出用户表:
|
||||
|
||||
```bash
|
||||
.codex/skills/query-shz-highgo/scripts/query.sh "SELECT table_schema, table_name FROM information_schema.tables WHERE table_schema NOT IN ('pg_catalog', 'information_schema') ORDER BY 1, 2"
|
||||
```
|
||||
|
||||
Inspect columns:
|
||||
检查列:
|
||||
|
||||
```bash
|
||||
.codex/skills/query-shz-highgo/scripts/query.sh "SELECT column_name, data_type, is_nullable FROM information_schema.columns WHERE table_schema = 'shz' AND table_name = 'lowercase_table_name' ORDER BY ordinal_position"
|
||||
```
|
||||
|
||||
HighGo may expose unquoted identifiers in lowercase and quoted identifiers with exact case. Query `information_schema` first when the spelling is uncertain.
|
||||
HighGo 可能将未加引号的标识符以小写暴露,也可能将加引号的标识符保持精确大小写。无法确定拼写时,先查询 `information_schema`。
|
||||
|
||||
## Connection details
|
||||
## 连接信息
|
||||
|
||||
Read [references/connection.md](references/connection.md) only when troubleshooting connectivity or updating the endpoint. Do not print, quote, or expose the password file.
|
||||
只有在排查连接问题或更新端点时,才阅读 [references/connection.md](references/connection.md)。不得打印、引用或暴露密码文件。
|
||||
|
||||
Reference in New Issue
Block a user