feat: 多语言任务、WebUI 增强与 Agent MCP 集成
重构 lib 为扁平模块并支持 Windows schtasks;新增 JS/Bash/PowerShell 模板、WebUI 调度编辑,以及 Cursor Skill 与 MCP 工具供 Agent 管理定时任务。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
32
_template-javascript/README.md
Normal file
32
_template-javascript/README.md
Normal file
@@ -0,0 +1,32 @@
|
||||
# JavaScript 定时任务模板
|
||||
|
||||
Node.js hello world 示例。调度仍由 `cronctl.py run` 统一管理(disable / 锁 / 日志)。
|
||||
|
||||
## 依赖
|
||||
|
||||
- Python 3(cronctl)
|
||||
- Node.js(`node` 在 PATH 中)
|
||||
|
||||
## 新建任务
|
||||
|
||||
```bash
|
||||
TASK_ID="smallmengya-my-js-task"
|
||||
CRON_ROOT="/shumengya/project/agent/sproutclaw-cron"
|
||||
cp -a "$CRON_ROOT/_template-javascript" "$CRON_ROOT/$TASK_ID"
|
||||
sed -i "s/_template-javascript/$TASK_ID/g" "$CRON_ROOT/$TASK_ID/schedule.cron"
|
||||
```
|
||||
|
||||
编辑 `run.js` 与 `schedule.cron` 后试跑:
|
||||
|
||||
```bash
|
||||
python3 "$CRON_ROOT/cronctl.py" run "$TASK_ID"
|
||||
```
|
||||
|
||||
## 其他语言模板
|
||||
|
||||
| 目录 | 语言 |
|
||||
|---|---|
|
||||
| `_template` | Python(默认) |
|
||||
| `_template-javascript` | JavaScript |
|
||||
| `_template-bash` | Bash |
|
||||
| `_template-powershell` | PowerShell |
|
||||
1
_template-javascript/run.js
Normal file
1
_template-javascript/run.js
Normal file
@@ -0,0 +1 @@
|
||||
console.log("hello world");
|
||||
8
_template-javascript/schedule.cron
Normal file
8
_template-javascript/schedule.cron
Normal file
@@ -0,0 +1,8 @@
|
||||
SHELL=/bin/bash
|
||||
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
||||
HOME=/root
|
||||
CRON_MAIL_ENABLED=1
|
||||
|
||||
# 每天 08:00 JavaScript hello world 示例(Node.js)
|
||||
# 开关:python3 /shumengya/project/agent/sproutclaw-cron/cronctl.py enable|disable|toggle _template-javascript
|
||||
0 8 * * * root /usr/bin/python3 /shumengya/project/agent/sproutclaw-cron/cronctl.py run _template-javascript >/dev/null 2>&1
|
||||
8
_template-javascript/task.json
Normal file
8
_template-javascript/task.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"runtime": "javascript",
|
||||
"entry": "run.js",
|
||||
"tags": [
|
||||
"JavaScript",
|
||||
"模板"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user