Why: Layout rules alone do not produce conclusion-first documents, extra views, or infographics, and nothing scored a deliverable before it was returned. Evidence: go test ./internal/prompts/ ./internal/quality/ ./internal/tools/ ./internal/squadadapter/ ./eval/ -count=1 and the house-style unittest passed in the previous session. Impact: Every task inherits content rules. Meetings, reports, and comparisons can name a view family. Long documents without a visual summary warn. quality_review and the squad checker share one scorecard. Refs: deliverable-quality-system A1-A5 Co-authored-by: Cursor <cursoragent@cursor.com>
33 lines
848 B
Go
33 lines
848 B
Go
package quality
|
||
|
||
import (
|
||
"os"
|
||
"path/filepath"
|
||
"strings"
|
||
"time"
|
||
|
||
"agent-squad/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
|
||
}
|