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.
This commit is contained in:
Willie
2026-04-07 18:05:40 +08:00
parent e29a42d2d1
commit c176d89405
5 changed files with 6 additions and 0 deletions
+1
View File
@@ -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 {
+1
View File
@@ -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) {
+2
View File
@@ -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")
+1
View File
@@ -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 {
+1
View File
@@ -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 {