SuperAPI AI 工具集

redis-crud

通用与其它

查看项目

更新于 10-15 21:41

技能介绍

用途:通过保存的 Redis 连接配置(profile)查看和修改 Redis 键。基于 Bash 脚本和 redis-cli,不依赖 Python 或 jq,输出为 stdout 的 JSON,并默认同时保存到 ./out/redis-crud-<UTC 时间戳>-<pid>.json。

主要能力:支持配置可复用的连接配置;直连、SSH 隧道、SSH 远程执行(服务器上已有 REDIS_URL,例如远程 .env);PING、GET、SET、DEL、HGET、HSET、HGETALL、SCAN 以及受保护的 raw 命令;SCAN 支持 cursor 与 --all 分页直到返回 0。

使用方式:配置保存在 ~/.config/redis-crud/profiles/<profile>.conf(0600),默认 profile 名保存在 ~/.config/redis-crud/default_profile。配置示例:bash <skill-path>/scripts/redis_crud.sh configure --profile local --mode direct --url "redis://:password@127.0.0.1:6379/0" --default,可加 --test-connection 验证 PING。SSH 远程用 --mode ssh-remote 配合 --ssh-alias、--remote-cwd、--env-file、--env-key、--readonly。查看配置用 list-profiles(输出已脱敏),删除用 remove-profile。读写命令如 get/hget/hgetall/scan、set/del/hset;raw 命令可用 --command 或重复 --arg。

限制与安全规则:禁止在仓库中保存 Redis 凭据;不得打印密码或完整 Redis URL;默认优先只读命令;SET、DEL、HSET 及 raw 写命令默认 dry-run,结构化写需 --execute 且经用户明确确认,raw 写还需 --allow-raw-write;readonly profile 不可用于写操作;有结构化命令时优先使用,值含空格时优先用多个 --arg;脚本不是 Redis 迁移或备份工具,不应执行大范围破坏性操作。依赖 bash、redis-cli、ssh,隧道端口检查使用 nc、lsof、ss 或 netstat 回退。其他收费或平台相关信息暂未提供。