feat: cc-hook v1.0 - Claude Code 钩子服务
- Go HTTP 服务,监听 :8082 - 支持 Notification 和 Stop 事件 - 转发至 Gotify 推送通知 - Docker 多阶段构建 - 环境变量配置 - 详细中文 README 文档
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func main() {
|
||||
config := LoadConfig()
|
||||
|
||||
handler := NewHookHandler(config)
|
||||
|
||||
http.HandleFunc("/hooks", handler.HandleHook)
|
||||
http.HandleFunc("/health", func(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
w.Write([]byte(`{"status":"ok"}`))
|
||||
})
|
||||
|
||||
log.Printf("cc-hook service starting on %s", config.Port)
|
||||
log.Printf("gotify endpoint: %s", config.GotifyURL)
|
||||
|
||||
if err := http.ListenAndServe(config.Port, nil); err != nil {
|
||||
log.Fatalf("server failed: %v", err)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user