From c176d8940533ac793082123beffb5fb78b0f016e Mon Sep 17 00:00:00 2001 From: Willie Date: Mon, 30 Mar 2026 00:39:37 +0800 Subject: [PATCH] feat(api): add kind field to sync, audit, check, update, and install handlers handler_sync: add Kind field to diff stream item struct. handler_audit: add Kind field to audit stream result. handler_check: add Kind field to check stream result. handler_update: add Kind field to update stream result. handler_install: add Kind field to install request for agent support. --- internal/server/handler_audit.go | 1 + internal/server/handler_check.go | 1 + internal/server/handler_install.go | 2 ++ internal/server/handler_sync.go | 1 + internal/server/handler_update.go | 1 + 5 files changed, 6 insertions(+) diff --git a/internal/server/handler_audit.go b/internal/server/handler_audit.go index 8056e3089..1fb978080 100644 --- a/internal/server/handler_audit.go +++ b/internal/server/handler_audit.go @@ -40,6 +40,7 @@ type auditResultResponse struct { AuditableBytes int64 `json:"auditableBytes"` Analyzability float64 `json:"analyzability"` TierProfile audit.TierProfile `json:"tierProfile"` + Kind string `json:"kind,omitempty"` } type auditSummary struct { diff --git a/internal/server/handler_check.go b/internal/server/handler_check.go index d9e5adfd0..11ac5d189 100644 --- a/internal/server/handler_check.go +++ b/internal/server/handler_check.go @@ -23,6 +23,7 @@ type skillCheckResult struct { Version string `json:"version"` Status string `json:"status"` InstalledAt string `json:"installed_at,omitempty"` + Kind string `json:"kind,omitempty"` } func (s *Server) handleCheck(w http.ResponseWriter, r *http.Request) { diff --git a/internal/server/handler_install.go b/internal/server/handler_install.go index eb3c0301b..a919193ee 100644 --- a/internal/server/handler_install.go +++ b/internal/server/handler_install.go @@ -91,6 +91,7 @@ func (s *Server) handleInstallBatch(w http.ResponseWriter, r *http.Request) { SkipAudit bool `json:"skipAudit"` Into string `json:"into"` Name string `json:"name"` + Kind string `json:"kind,omitempty"` } if err := json.NewDecoder(r.Body).Decode(&body); err != nil { writeError(w, http.StatusBadRequest, "invalid JSON body") @@ -251,6 +252,7 @@ func (s *Server) handleInstall(w http.ResponseWriter, r *http.Request) { SkipAudit bool `json:"skipAudit"` Track bool `json:"track"` Into string `json:"into"` + Kind string `json:"kind,omitempty"` } if err := json.NewDecoder(r.Body).Decode(&body); err != nil { writeError(w, http.StatusBadRequest, "invalid JSON body") diff --git a/internal/server/handler_sync.go b/internal/server/handler_sync.go index b93f99d5c..9e6729db9 100644 --- a/internal/server/handler_sync.go +++ b/internal/server/handler_sync.go @@ -181,6 +181,7 @@ type diffItem struct { Skill string `json:"skill"` Action string `json:"action"` // "link", "update", "skip", "prune", "local" Reason string `json:"reason"` // human-readable description + Kind string `json:"kind,omitempty"` } type diffTarget struct { diff --git a/internal/server/handler_update.go b/internal/server/handler_update.go index eba69bcee..2743b39f1 100644 --- a/internal/server/handler_update.go +++ b/internal/server/handler_update.go @@ -28,6 +28,7 @@ type updateResultItem struct { IsRepo bool `json:"isRepo"` AuditRiskScore int `json:"auditRiskScore,omitempty"` AuditRiskLabel string `json:"auditRiskLabel,omitempty"` + Kind string `json:"kind,omitempty"` } func (s *Server) updateAuditThreshold() string {