✨ 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)。不得打印、引用或暴露密码文件。
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
interface:
|
||||
display_name: "查询 SHZ 翰高数据库"
|
||||
short_description: "通过 SSH 安全查询 SHZ 测试或线上翰高数据库"
|
||||
default_prompt: "Use $query-shz-highgo to run a read-only query against this project's test or production HighGo database."
|
||||
default_prompt: "使用 $query-shz-highgo 对本项目的测试或生产 HighGo 数据库执行只读查询。"
|
||||
|
||||
@@ -1,24 +1,23 @@
|
||||
# Connection reference
|
||||
# 连接参考
|
||||
|
||||
- SSH gateway: `root@124.243.245.42`
|
||||
- HighGo client: `/opt/HighGo4.5.7-see/bin/psql`
|
||||
- Database endpoint: `39.98.44.136:6023`
|
||||
- Database: `highgo`
|
||||
- User: `sysdba`
|
||||
- Default schemas: `shz,public`
|
||||
- Detected server: HighGo Security Enterprise Edition Database System 4.5.10
|
||||
- Password source: `../.password`, mode `600`; override with `HIGHGO_PASSWORD_FILE`
|
||||
- SSH 网关:`root@124.243.245.42`
|
||||
- HighGo 客户端:`/opt/HighGo4.5.7-see/bin/psql`
|
||||
- 数据库端点:`39.98.44.136:6023`
|
||||
- 数据库:`highgo`
|
||||
- 用户:`sysdba`
|
||||
- 默认 schema:`shz,public`
|
||||
- 检测到的服务器:HighGo Security Enterprise Edition Database System 4.5.10
|
||||
- 密码来源:`../.password`,权限为 `600`;使用 `HIGHGO_PASSWORD_FILE` 覆盖
|
||||
|
||||
## Test environment
|
||||
## 测试环境
|
||||
|
||||
- SSH gateway: `root@47.111.103.66:22`
|
||||
- HighGo client: `/opt/HighGo4.5.7-see/bin/psql`
|
||||
- Database endpoint from the test profile: `127.0.0.1:5866` (on the test server)
|
||||
- Database: `highgo`
|
||||
- User: `sysdba`
|
||||
- Default schemas: `shz,public`
|
||||
- Password source: `HIGHGO_TEST_PASSWORD_FILE` when set; otherwise the existing `HIGHGO_PASSWORD_FILE` or `../.password`
|
||||
- SSH 网关:`root@47.111.103.66:22`
|
||||
- HighGo 客户端:`/opt/HighGo4.5.7-see/bin/psql`
|
||||
- 数据库端点来自测试 profile:`127.0.0.1:5866`(位于测试服务器上)
|
||||
- 数据库:`highgo`
|
||||
- 用户:`sysdba`
|
||||
- 密码来源:设置 `HIGHGO_TEST_PASSWORD_FILE` 时使用该变量;否则使用已有的 `HIGHGO_PASSWORD_FILE` 或 `../.password`
|
||||
|
||||
The test connection is made by SSHing to `47.111.103.66` and running the HighGo client there against its loopback database endpoint. Override the test endpoint with `HIGHGO_TEST_SSH_HOST`, `HIGHGO_TEST_SSH_PORT`, `HIGHGO_TEST_PSQL_PATH`, `HIGHGO_TEST_DB_HOST`, `HIGHGO_TEST_DB_PORT`, `HIGHGO_TEST_DB_NAME`, or `HIGHGO_TEST_DB_USER` if the server layout differs.
|
||||
测试连接通过 SSH 登录 `47.111.103.66`,再在该服务器上使用 HighGo 客户端连接其 loopback 数据库端点。如果服务器布局不同,可使用 `HIGHGO_TEST_SSH_HOST`、`HIGHGO_TEST_SSH_PORT`、`HIGHGO_TEST_PSQL_PATH`、`HIGHGO_TEST_DB_HOST`、`HIGHGO_TEST_DB_PORT`、`HIGHGO_TEST_DB_NAME` 或 `HIGHGO_TEST_DB_USER` 覆盖测试端点。
|
||||
|
||||
The SSH gateway must be reachable with the workstation's existing SSH key. Keep credentials out of commands, logs, responses, and `SKILL.md`.
|
||||
SSH 网关必须能够使用工作站现有的 SSH 密钥访问。不得将凭据写入命令、日志、响应或 `SKILL.md`。
|
||||
|
||||
Reference in New Issue
Block a user