feat: 添加微信小程序调试工具和完整参数参考文档

This commit is contained in:
2026-07-24 09:09:15 +08:00
parent 773679c292
commit 6bc4d64c6b
20 changed files with 1449 additions and 240 deletions

View File

@@ -1,74 +1,74 @@
---
name: inspect-shz-logs
description: Inspect and follow the SHZ backend's local, test, and production logs through bounded, read-only commands. Use when Codex is working in the shz-backend project and needs to diagnose startup failures, exceptions, request behavior, scheduled jobs, or runtime incidents from local backend.log or the test and production backend, error, info, and user logs.
description: 通过有界的只读命令检查和跟踪 SHZ 后端的本地、测试及生产日志。适用于 Codex 在 shz-backend 项目中从本地 backend.log 或测试/生产环境的 backenderrorinfo user 日志诊断启动失败、异常、请求行为、定时任务或运行时事件。
---
# Inspect SHZ Logs
# 检查 SHZ 日志
Use the bundled script instead of assembling SSH commands manually. Keep every initial read bounded; follow logs only when the user explicitly asks to monitor live activity.
使用随附脚本,不要手动拼接 SSH 命令。每次首次读取都保持范围有界;只有用户明确要求实时监控时,才跟踪日志。
## Inspect local logs
## 检查本地日志
Read the last 200 lines:
读取最后 200 行:
```bash
.codex/skills/inspect-shz-logs/scripts/view.sh local 200
```
Follow the local log interactively:
交互式跟踪本地日志:
```bash
.codex/skills/inspect-shz-logs/scripts/view.sh local 200 --follow
```
## Inspect production logs
## 检查生产日志
Read the main application log:
读取主应用日志:
```bash
.codex/skills/inspect-shz-logs/scripts/view.sh online backend 200
```
Read the current error log:
读取当前错误日志:
```bash
.codex/skills/inspect-shz-logs/scripts/view.sh online error 200
```
`online` is the existing production-environment name and remains supported. `production` is an equivalent alias.
`online` 是现有的生产环境名称,仍受支持。`production` 是等效别名。
Choose only one log type: `backend`, `error`, `info`, or `user`. Add `--follow` as the final argument only for an explicit live-monitoring request.
只选择一种日志类型:`backend``error``info` `user`。只有在明确的实时监控请求中,才能将 `--follow` 作为最后一个参数添加。
## Inspect test logs
## 检查测试日志
Read the main test-environment application log:
读取测试环境主应用日志:
```bash
.codex/skills/inspect-shz-logs/scripts/view.sh test backend 200
```
Read the current test-environment error log:
读取当前测试环境错误日志:
```bash
.codex/skills/inspect-shz-logs/scripts/view.sh test error 200
```
The test environment uses the same four log types as production. The default test server is `root@47.111.103.66` on SSH port `22`; the endpoint and log directory can be overridden with `SHZ_TEST_SSH_HOST`, `SHZ_TEST_SSH_PORT`, and `SHZ_TEST_LOG_DIR` when the server layout changes.
测试环境与生产环境使用相同的四种日志类型。默认测试服务器是 SSH 端口 `22` 上的 `root@47.111.103.66`;服务器布局变化时,可使用 `SHZ_TEST_SSH_HOST``SHZ_TEST_SSH_PORT` `SHZ_TEST_LOG_DIR` 覆盖端点和日志目录。
For keyword analysis, fetch a bounded window and filter locally, for example:
进行关键词分析时,获取有界窗口并在本地过滤,例如:
```bash
.codex/skills/inspect-shz-logs/scripts/view.sh online error 1000 | rg -i 'exception|error|failed'
```
## Diagnose from logs
## 根据日志诊断
1. Establish whether the request concerns local, test, or production behavior.
2. Read 100300 recent lines from the relevant log.
3. Expand up to the script's 5,000-line cap only when timestamps or stack traces require more context.
4. Correlate timestamps, thread names, exception causes, and nearby requests.
5. Report the evidence and likely cause without exposing tokens, passwords, personal data, or unrelated log content.
1. 确认请求涉及本地、测试还是生产行为。
2. 从相关日志读取最近 100300 行。
3. 只有在时间戳或堆栈跟踪需要更多上下文时,才扩展到脚本允许的 5,000 行上限。
4. 关联时间戳、线程名称、异常原因和相邻请求。
5. 报告证据和可能原因,不得暴露令牌、密码、个人数据或无关日志内容。
Treat test and production access as read-only. Never restart services, edit files, deploy code, truncate logs, or run arbitrary remote commands through this skill.
将测试和生产访问视为只读。不得通过此 skill 重启服务、编辑文件、部署代码、截断日志或执行任意远程命令。
Read [references/log-locations.md](references/log-locations.md) only when checking server identity, paths, or supported log types.
只有在检查服务器身份、路径或支持的日志类型时,才阅读 [references/log-locations.md](references/log-locations.md)

View File

@@ -1,4 +1,4 @@
interface:
display_name: "查看 SHZ 项目日志"
short_description: "安全查看并跟踪 SHZ 项目的本地、测试与线上日志内容"
default_prompt: "Use $inspect-shz-logs to inspect recent local, test, or production logs for the SHZ backend."
default_prompt: "使用 $inspect-shz-logs 检查 SHZ 后端近期的本地、测试或生产日志。"

View File

@@ -1,32 +1,32 @@
# Log locations
# 日志位置
## Local
## 本地
- Main log: `<project>/.local/logs/backend.log`
- Producer: `<project>/local.sh`
- 主日志:`<project>/.local/logs/backend.log`
- 生成者:`<project>/local.sh`
## Production: shz
## 生产环境:shz
- SSH: `root@39.98.44.136:6022`
- Application: `/opt/service/project/shz-backend/ruoyi-admin/target/ruoyi-admin.jar`
- Profile: `dev`
- HTTP port: `9091`
- Main process log: `/opt/service/project/shz-backend/logs/backend.log`
- Current error log: `/opt/service/project/shz-backend/logs/sys-error.log`
- Current info log: `/opt/service/project/shz-backend/logs/sys-info.log`
- Current user log: `/opt/service/project/shz-backend/logs/sys-user.log`
- SSH`root@39.98.44.136:6022`
- 应用:`/opt/service/project/shz-backend/ruoyi-admin/target/ruoyi-admin.jar`
- Profile`dev`
- HTTP 端口:`9091`
- 主进程日志:`/opt/service/project/shz-backend/logs/backend.log`
- 当前错误日志:`/opt/service/project/shz-backend/logs/sys-error.log`
- 当前信息日志:`/opt/service/project/shz-backend/logs/sys-info.log`
- 当前用户日志:`/opt/service/project/shz-backend/logs/sys-user.log`
## Test: shz-test
## 测试环境:shz-test
- SSH: `root@47.111.103.66:22`
- Application: `/data/code/shz-backend/ruoyi-admin/target/ruoyi-admin.jar`
- Profile: `test`
- HTTP port: `9091`
- Main process log: `/data/code/shz-backend/logs/backend.log`
- Current error log: `/data/code/shz-backend/logs/sys-error.log`
- Current info log: `/data/code/shz-backend/logs/sys-info.log`
- Current user log: `/data/code/shz-backend/logs/sys-user.log`
- SSH`root@47.111.103.66:22`
- 应用:`/data/code/shz-backend/ruoyi-admin/target/ruoyi-admin.jar`
- Profile`test`
- HTTP 端口:`9091`
- 主进程日志:`/data/code/shz-backend/logs/backend.log`
- 当前错误日志:`/data/code/shz-backend/logs/sys-error.log`
- 当前信息日志:`/data/code/shz-backend/logs/sys-info.log`
- 当前用户日志:`/data/code/shz-backend/logs/sys-user.log`
The test endpoint defaults can be overridden with `SHZ_TEST_SSH_HOST`, `SHZ_TEST_SSH_PORT`, and `SHZ_TEST_LOG_DIR`.
测试端点默认值可通过 `SHZ_TEST_SSH_HOST``SHZ_TEST_SSH_PORT` `SHZ_TEST_LOG_DIR` 覆盖。
Use only the bundled read-only viewer. Rotated files use date suffixes but are intentionally not exposed by the default script.
只能使用随附的只读查看器。轮换文件使用日期后缀,但默认脚本不会暴露这些文件。