package quality import ( "os" "path/filepath" "strings" "time" "git-ssh.u1680832.nyat.app/weichen/Agent-Squad.git/squad" ) // Checker 把评分卡接到小队质检。不通过时把意见写到工作区 quality-feedback.md, // 供返修步骤读入。 type Checker struct{} func (Checker) Check(req squad.CheckRequest) *squad.QualityReport { path := filepath.Join(req.Workspace, req.Deliverable) scored := ScoreFile(path) report := &squad.QualityReport{ CheckedAt: time.Now(), Score: float64(scored.Score), Passed: scored.Passed, Violations: scored.Violations, } if !scored.Passed { body := "质检未通过,请按下列意见改一版,不要解释规则本身。\n\n" body += strings.Join(scored.Violations, "\n") body += "\n" _ = os.WriteFile(filepath.Join(req.Workspace, "quality-feedback.md"), []byte(body), 0o644) } return report }