简而言之:.cursorrules 将 Rediacc 上下文加载到 Cursor 的 AI 中;终端则让它能够对实际机器运行 rdc 命令。
快速设置
- 安装 CLI:
curl -fsSL https://www.rediacc.com/install.sh | bash - 将 AGENTS.md 模板复制到项目根目录并命名为
.cursorrules - 在 Cursor 中打开项目
Cursor 在启动时读取 .cursorrules。需要注意的是:上下文窗口有容量限制,因此文件内容应聚焦于你的实际机器和仓库,而非通用样板内容。
.cursorrules 配置
在项目根目录中创建包含 Rediacc 基础设施上下文的 .cursorrules 文件。完整版本请参阅 AGENTS.md 模板。
需要包含的关键部分:
- CLI 工具名称(
rdc)和安装方法 - 带有
--output json标志的常用命令 - 架构概述(仓库隔离、Docker 守护进程)
- 术语规则(适配器,而非模式)
终端集成
Cursor 可以通过其集成终端执行 rdc 命令。常见模式:
检查状态
询问 Cursor:“检查我的生产服务器状态”
Cursor 在终端中运行:
rdc machine status prod-1 -o json
CLI参考: rdc machine status
部署更改
询问 Cursor:“部署更新后的 nextcloud 配置”
Cursor 在终端中运行:
rdc repo up nextcloud@prod-1 --yes
CLI参考: rdc repo up
查看日志
询问 Cursor:“显示最近的 mail 容器日志”
Cursor 在终端中运行:
rdc repo logs mail@prod-1 -c mail-postfix --lines 100
CLI参考: rdc repo logs
工作区设置
对于团队项目,将 Rediacc 特定的 Cursor 设置添加到 .cursor/settings.json:
{
"terminal.defaultProfile": "bash",
"ai.customInstructions": "Use rdc CLI for all infrastructure operations. Always use --output json when parsing results."
}
提示
- Cursor 的 Composer 模式非常适合多步骤基础设施任务
- 在 Cursor 聊天中使用
@terminal引用最近的终端输出 rdc --help-all命令为 Cursor 提供完整的命令参考- 将
.cursorrules与CLAUDE.md文件结合使用,以实现跨 AI 工具的最大兼容性