踢腿
后台自动化守护进程,具有任务调度、可组合技能、工作流引擎、凭证库、事件系统、webhook触发器、通知、插件生态系统和通过MCP的双向克劳德代码集成。
特性
- 任务调度器 --间隔时间(
1h,30m),每天定时(at:09:00),或完整的cron(0 9 * * MON-FRI) - 技能引擎 --具有Zod验证输入/输出的可组合、可链接的工作单元
- 工作流引擎 --具有条件、并行执行和延迟的多步骤流水线
- 凭证保险库 --具有14种以上内置类型(GitHub、Slack、AWS、Stripe等)的加密凭据存储
- 事件系统 --反应式规则:“当任务X完成时,运行技能Y”
- Webhook触发器 --通过带有HMAC签名的HTTP webhooks触发任务/技能
- 通知 --任务成功/失败时的Slack、Discord或通用webhook警报
- 变量 --具有作用域和模板解析的持久键值存储
- 任务队列 --具有可配置限制的基于优先级的并发执行
- 使用回退重试 --具有指数退避和抖动的可配置重试
- 结构化日志记录 --使用JSON模式和文件输出对日志进行分级
- 普罗米修斯指标 —
/metrics监控端点 - 健康检查 --详细的运行状况报告(数据库、内存、队列、任务)
- 速率限制 --内存滑动窗口速率限制器
- 优雅关闭 --信号情报/信号处理干净
- SQLite持久性 --记录并可查询的所有运行、事件、变量和配置
- MCP服务器 --将所有内容公开为Claude Code可以直接调用的工具
- 克劳德代码桥 --从自动化中调用Claude Code CLI
- 插件系统 --从npm安装技能(`kickd install
`)
- HTTP API -所有操作的完整REST API
- 命令行界面 --从终端管理所有内容
- 认证 --可选的承载令牌身份验证
- 码头工人 --即用型Dockerfile
需求
- 包子 >= 1.0.0
- Claude 代码命令行界面 (可选,适用于克劳德桥)
快速开始
git clone https://github.com/anbturki/kickd.git
cd kickd
bun install
bun run start验证: curl http://localhost:7400/health
CLI参考
# Tasks
kickd list # List all tasks
kickd run [json] # Run a task
kickd history # Task run history
# Skills
kickd skills # List all skills
kickd skill [json] # Run a skill
# Workflows
kickd workflow list # List workflows
kickd workflow run [json] # Run a workflow
kickd workflow delete # Delete a workflow
# Variables
kickd vars list [scope] # List variables
kickd vars set # Set a variable
kickd vars get # Get a variable
kickd vars delete # Delete a variable
# Credentials
kickd creds list # List stored credentials
kickd creds types # List available types (github, slack, aws, ...)
kickd creds add # Store a credential (encrypted)
kickd creds get # View credential (sensitive values redacted)
kickd creds test # Test connectivity
kickd creds delete # Delete a credential
# Webhooks
kickd webhook list # List webhooks
kickd webhook create task: # Create a webhook
kickd webhook delete # Delete a webhook
# Events
kickd events # Show recent events
kickd events rules # List reactive rules
kickd events add run_task: # Add a rule
# Notifications
kickd notify add slack # Add Slack notifications
kickd notify add discord # Add Discord notifications
# Queue
kickd queue # Show queue stats
# Plugins
kickd install
# Install a plugin from npm
kickd uninstall
# Uninstall a plugin
kickd plugins # List installed plugins
# Other
kickd stats # Global statistics
kickd health # Detailed health report
kickd ask "prompt" # Ask Claude CodeHTTP API
| 方法 | 端点 | 描述 |
|---|---|---|
GET | /health | 详细的健康报告 |
GET | /stats | 全球统计 |
GET | /metrics | Prometheus兼容指标 |
GET | /tasks | 列出任务 |
GET | /tasks/:id | 获取任务 |
POST | /tasks/:id/run | 运行任务 |
GET | /tasks/:id/history | 任务运行历史记录 |
GET | /tasks/:id/stats | 任务统计 |
GET | /skills | 列出技能 |
POST | /skills/:id/run | 运行技能 |
GET | /skills/:id/history | 技能运行历史 |
POST | /skills/chain | 链技能 |
GET | /workflows | 列出工作流 |
GET | /workflows/:id | 获取工作流 |
POST | /workflows | 注册工作流 |
POST | /workflows/:id/run | 运行工作流 |
DELETE | /workflows/:id | 删除工作流 |
GET | /variables | 列出变量 |
GET | /variables/:key | 获取变量 |
PUT | /variables/:key | 设置变量 |
DELETE | /variables/:key | 删除变量 |
GET | /queue/stats | 队列统计 |
POST | /queue/clear | 清除待处理队列 |
GET | /credentials | 列出凭据(已编辑) |
POST | /credentials | 存储凭据 |
GET | /credentials/:id | 获取凭证(已编辑) |
PUT | /credentials/:id | 更新凭据 |
DELETE | /credentials/:id | 删除凭据 |
GET | /credentials/types | 列出凭证类型 |
POST | /credentials/:id/test | 测试证书 |
GET | /credentials/:id/audit | 凭证审核日志 |
POST | /credentials/oauth2/start | 启动OAuth2流 |
GET | /credentials/oauth2/callback | OAuth2回调 |
GET | /hooks | 列出webhooks |
POST | /hooks | 创建webhook |
POST | /hooks/:id | 触发webhook |
DELETE | /hooks/:id | 删除webhook |
GET | /events | 事件日志 |
GET | /events/rules | 列出事件规则 |
POST | /events/rules | 创建事件规则 |
GET | /notifications/channels | 列出通知渠道 |
POST | /notifications/channels | 添加通知通道 |
GET | /plugins | 列出已安装的插件 |
POST | /plugins/install | 安装插件 |
POST | /claude | 向Claude Code发送提示 |
MCP服务器(克劳德代码)
添加 ~/.claude.json 或项目 .mcp.json:
{
"mcpServers": {
"kickd": {
"command": "bun",
"args": ["run", "mcp"],
"cwd": "/path/to/kickd"
}
}
}可用的MCP工具: list_automations, run_automation, run_skill, chain_skills, list_workflows, run_workflow, set_variable, get_variable, list_variables, queue_stats, list_credentials, store_credential, test_credential, list_credential_types, list_webhooks, create_webhook, list_event_rules, create_event_rule, get_task_history, get_stats, run_command, ask_claude.
添加任务
// tasks/my-task.ts
import type { Task, TaskResult } from "../src/types";
export const task: Task = {
id: "my-task",
name: "My Task",
description: "Does something useful",
handler: "tasks/my-task.ts",
schedule: "0 9 * * MON-FRI", // weekdays at 9am (full cron)
retry: { maxAttempts: 3, baseDelayMs: 1000, maxDelayMs: 30000, backoffMultiplier: 2 },
enabled: true,
status: "idle",
};
export async function handler(params?: Record): Promise {
return { success: true, output: "Done", duration: 0 };
}计划格式
| 格式 | 示例 | 说明 |
|---|---|---|
Ns | 30s | 每N秒 |
Nm | 5m | 每N分钟 |
Nh | 1h | 每N小时 |
Nd | 1d | 每N天 |
at:HH:MM | at:09:00 | 每天特定时间 |
| 克朗 | 0 9 * * MON-FRI | 标准5场克戎(最小小时dom mon dow) |
添加技能
// skills/my-skill.ts
import { z } from "zod";
import { skills } from "../src/skills/engine";
skills.register({
id: "my-skill",
name: "My Skill",
description: "A composable unit of work",
input: z.object({ message: z.string() }),
output: z.object({ result: z.string() }),
execute: async (input) => {
return { result: `Processed: ${input.message}` };
},
});工作流
定义结合任务、技能、条件、延迟和并行执行的多步骤流程:
curl -X POST http://localhost:7400/workflows \
-H "Content-Type: application/json" \
-d '{
"id": "deploy-pipeline",
"name": "Deploy Pipeline",
"description": "Build, test, and deploy",
"startStep": "build",
"steps": [
{ "id": "build", "type": "task", "targetId": "build-app", "next": "test" },
{ "id": "test", "type": "task", "targetId": "run-tests", "next": "check" },
{ "id": "check", "type": "condition", "condition": "{{prev.success}} === true", "onTrue": "deploy", "onFalse": "notify-fail" },
{ "id": "deploy", "type": "skill", "targetId": "deploy-prod" },
{ "id": "notify-fail", "type": "skill", "targetId": "send-alert", "input": { "message": "Tests failed" } }
]
}'步骤类型: task, skill, condition, delay, parallel.
凭证保险库
使用静态AES-256-CBC加密安全地存储凭据。
# Generate an encryption key
openssl rand -base64 32
# Add to .env: KICKD_ENCRYPTION_KEY=
# Store a GitHub token
kickd creds add my-github github '{"token":"ghp_abc123..."}'
# Store Slack credentials
kickd creds add my-slack slack '{"botToken":"xoxb-...", "webhookUrl":"https://hooks.slack.com/..."}'
# Test connectivity
kickd creds test my-github内置凭据类型: bearer, api_key, basic_auth, oauth2, github, slack, discord, stripe, openai, anthropic, linkedin, sendgrid, aws, custom.
事件系统
制定反应性规则——当有事情发生时,做其他事情:
# When task "hello" completes, run the "disk-usage" task
kickd events add task.completed run_task:disk-usage --source hello
# When any skill fails, run a notification task
kickd events add skill.failed run_task:alert事件类型: task.completed, task.failed, task.retry, skill.completed, skill.failed, webhook.triggered, workflow.started, workflow.completed, workflow.failed.
Webhook触发器
通过HTTP从外部触发任务:
# Create a webhook for the "hello" task
kickd webhook create deploy-hook task:hello
# Trigger it (e.g., from GitHub Actions, Stripe, etc.)
curl -X POST http://localhost:7400/hooks/ \
-H "Content-Type: application/json" \
-d '{}'通知
任务失败时收到警报:
# Via CLI
kickd notify add slack https://hooks.slack.com/services/...
kickd notify add discord https://discord.com/api/webhooks/...
# Or via environment variables
KICKD_NOTIFY_SLACK_URL=https://hooks.slack.com/services/...
KICKD_NOTIFY_DISCORD_URL=https://discord.com/api/webhooks/...插件
从npm安装技能:
kickd install kickd-skill-example
kickd plugins插件包可以导出 register(skills) 功能或a skills 阵列。
配置
cp .env.example .env| 变量 | 默认值 | 描述 |
|---|---|---|
KICKD_PORT | 7400 | HTTP API端口 |
KICKD_API_TOKEN | - | API身份验证的承载令牌(可选) |
KICKD_ENCRYPTION_KEY | -- | 凭证库的AES-256密钥 |
KICKD_LOG_LEVEL | info | 日志级别: debug, info, warn, error |
KICKD_LOG_FORMAT | text | 日志格式: text 或 json |
KICKD_LOG_FILE | -- | 日志文件路径(可选) |
KICKD_RATE_LIMIT | true | 设置 false 禁用速率限制 |
KICKD_QUEUE_CONCURRENCY | 5 | 最大并发排队任务数 |
KICKD_QUEUE_MAX_SIZE | 1000 | 最大队列大小 |
KICKD_NOTIFY_SLACK_URL | -- | 用于通知的Slack webhook |
KICKD_NOTIFY_DISCORD_URL | -- | 对通知的webhook进行Discord |
KICKD_NOTIFY_WEBHOOK_URL | -- | 用于通知的通用webhook |
码头工人
docker build -t kickd .
docker run -p 7400:7400 -v kickd-data:/app/data kickd在后台运行
macOS(launchd)
# Create plist at ~/Library/LaunchAgents/com.kickd.daemon.plist
# then:
launchctl load ~/Library/LaunchAgents/com.kickd.daemon.plistpm2
pm2 start "bun run start" --name kickd
pm2 save建筑
┌──────────────┐ MCP (stdio) ┌───────────────────────────────────────┐
│ Claude Code │ ────────────────► │ kickd daemon │
│ │ ◄──────────────── │ │
└──────────────┘ │ ┌───────┐ ┌───────┐ ┌────────────┐ │
│ │ Tasks │ │Skills │ │ Workflows │ │
┌──────────────┐ HTTP :7400 │ └───┬───┘ └───┬───┘ └──────┬─────┘ │
│ You (CLI) │ ────────────────► │ │ │ │ │
│ │ ◄──────────────── │ ┌───┴─────────┴────────────┴───┐ │
└──────────────┘ │ │ Event Bus │ │
│ └───┬─────────┬───────────┬────┘ │
┌──────────────┐ Webhooks │ ┌───┴───┐ ┌───┴────┐ ┌───┴──────┐ │
│ External │ ────────────────► │ │Notify │ │SQLite │ │Cred Vault│ │
│ Services │ │ └───────┘ └────────┘ └──────────┘ │
└──────────────┘ └───────────────────────────────────────┘许可证
麻省理工学院
