# AutoDriveCursor **Repository Path**: project_hub_1/auto-drive-cursor ## Basic Information - **Project Name**: AutoDriveCursor - **Description**: 用来生成任务,然后让Cursor在我睡觉的时候继续完成任务 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-02-04 - **Last Updated**: 2026-02-04 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Cursor 自动化工具 基于 Cursor CLI 的任务自动化工具,支持「需求→设计→实现→测试→修复」工作流、健康监控与断点续传。 ## 安装 ### 推荐:pipx 一键安装(适合所有用户) **无需 Gitee 账号,一条命令即可**: ```bash # 若未安装 pipx: brew install pipx && pipx ensurepath pipx install git+https://gitee.com/project_hub_1/auto-drive-cursor.git ``` 安装后 `cursor-automation` 命令全局可用。 ### 方式二:Homebrew 安装 ```bash # 使用 SSH(推荐,无需输入密码) brew tap project_hub_1/cursor-automation git@gitee.com:project_hub_1/homebrew-cursor-automation.git brew install cursor-automation # 或使用 HTTPS(可能需输入 Gitee 账号) brew tap project_hub_1/cursor-automation https://gitee.com/project_hub_1/homebrew-cursor-automation brew install cursor-automation ``` 需先创建 [homebrew-cursor-automation](https://gitee.com/project_hub_1/homebrew-cursor-automation) 仓库,详见 [Homebrew 安装指南](docs/Homebrew安装指南.md)。 ### 方式三:项目内开发 ```bash git clone https://gitee.com/project_hub_1/auto-drive-cursor.git cd auto-drive-cursor python3 -m venv .venv && source .venv/bin/activate pip install -e . ``` ## 分享给他人 将以下内容发给对方即可(需已安装 [Cursor CLI](https://cursor.com/docs/cli/installation)): ```bash pipx install git+https://gitee.com/project_hub_1/auto-drive-cursor.git cursor-automation init cursor-automation --mode once ``` ## 前置条件 - Python 3.8+ - [Cursor CLI](https://cursor.com/docs/cli/installation) 已安装并认证 - macOS(优先 Mac mini) ## 配置 主配置文件:`config/config.yaml` | 配置项 | 说明 | 默认值 | |--------|------|--------| | tasks_file | 任务列表 JSON 路径 | config/tasks.json | | output_dir | 输出目录 | outputs | | output_subdir_by | 简单任务输出子目录:none / date / task_id | date | | loop_mode | 执行模式:once / infinite | once | | loop_interval_sec | 轮次间隔(秒) | 60 | | task_interval_sec | 任务间隔(秒) | 5 | | retry_count | 失败重试次数 | 1 | | cli_command | Cursor CLI 命令 | agent | | cli_timeout | 单任务超时(秒) | 300 | | health_check_interval_sec | 健康检查间隔(秒) | 300 | ## 初始化 在任意目录执行 `init`,会在当前目录创建配置结构: ```bash cursor-automation init # 或指定目录: cursor-automation init --dir /path/to/project ``` 将创建: - `config/config.yaml` - 主配置 - `config/tasks.json` - 任务列表 - `outputs/` - 输出目录 - `logs/` - 日志目录 ## 运行 ```bash # 若通过 pipx/brew 安装,直接使用命令: cursor-automation --mode once # 若在项目内,使用模块方式: python -m src.main --mode once # 无限循环 cursor-automation --mode infinite # 指定任务文件 cursor-automation --tasks config/my_tasks.json # 从断点恢复(默认开启) cursor-automation --resume # 强制重新开始 cursor-automation --no-resume # 调试模式 cursor-automation --debug # 后台运行 nohup cursor-automation --mode infinite > /dev/null 2>&1 & # 防止休眠(睡觉时持续运行) caffeinate -i cursor-automation --mode infinite ``` ## 任务格式 ### 简单模式 单 prompt,直接生成内容。输出文件默认按 `output_subdir_by` 建子目录,文件名用任务名+时间戳(如 `用户登录模块_1770197224.txt`)。可设 `output_file` 指定完整路径: ```json { "tasks": [ { "id": "task_001", "name": "用户登录模块", "prompt": "prompt 内容", "type": "article", "output_format": "md", "output_file": "outputs/用户登录/执行摘要.md", "enabled": true } ] } ``` ### 工作流模式 需求→设计→实现→测试→修复: ```json { "tasks": [ { "id": "task_001", "name": "实现用户登录", "enabled": true, "workflow": { "stages": [ { "name": "requirements", "prompt": "根据需求输出 PRD...", "output_file": "outputs/task_001/PRD.md" }, { "name": "design", "prompt": "根据 {{stage:requirements.output}} 输出概要设计...", "output_file": "outputs/task_001/概要设计.md" } ] } } ] } ``` 占位符 `{{stage:xxx.output}}` 会在执行时替换为上一阶段的输出路径。 ## 任务生成 批量生成 tasks.json:参见 [docs/任务生成指南.md](docs/任务生成指南.md) ```bash python scripts/generate_tasks.py task_list.txt -o config/tasks.json ``` ## 断点续传 执行状态保存在 `outputs/state.json`。进程中断后,再次启动时默认从断点恢复。使用 `--no-resume` 可强制重新开始。 ## Mac 休眠配置(睡觉时持续运行) 1. **系统设置 → 锁定屏幕 / 节能**:将「使电脑进入睡眠」设为「永不」或较长时间 2. **caffeinate**:`caffeinate -i python -m src.main` 3. **LaunchAgent**:参见 `launchd/com.cursor.automation.plist` ## 文档 - [PRD 需求文档](docs/PRD_需求文档.md) - [概要设计文档](docs/概要设计文档.md) - [任务生成指南](docs/任务生成指南.md) ## 参考 - [Cursor CLI 文档](https://cursor.com/docs/cli/overview) - [Cursor Headless CLI](https://cursor.com/docs/cli/headless)