diff --git a/cmd/harness.go b/cmd/harness.go index f5474dc4..91596c7b 100644 --- a/cmd/harness.go +++ b/cmd/harness.go @@ -46,13 +46,13 @@ Use --fix to automatically repair missing AGENTS.md, skills, or spec directories } if harnessFix || (len(args) > 0 && args[0] == "fix") { - fixResult, err := harness.FixWorkspaceHarness(ctx, targetDir, report) - if err != nil { - return fmt.Errorf("harness auto-fix failed: %w", err) + fixResult, fixErr := harness.FixWorkspaceHarness(ctx, targetDir, report) + if fixErr != nil { + return fmt.Errorf("harness auto-fix failed: %w", fixErr) } - fmt.Printf("🔧 Hawk Harness Auto-Repair Results:\n") + fmt.Printf("[FIX] Hawk Harness Auto-Repair Results:\n") for _, repair := range fixResult.RepairsPerformed { - fmt.Printf(" ✓ %s\n", repair) + fmt.Printf(" + %s\n", repair) } // Re-evaluate workspace after fix report, _ = harness.EvaluateWorkspace(ctx, targetDir, opts) @@ -63,38 +63,38 @@ Use --fix to automatically repair missing AGENTS.md, skills, or spec directories outDir = filepath.Join(targetDir, ".hawk", "harness") } - if err := os.MkdirAll(outDir, 0o755); err != nil { - return fmt.Errorf("failed to create harness output directory: %w", err) + if mkdirErr := os.MkdirAll(outDir, 0o755); mkdirErr != nil { + return fmt.Errorf("failed to create harness output directory: %w", mkdirErr) } // Write Markdown report mdPath := filepath.Join(outDir, "report.md") mdContent := harness.RenderMarkdown(report) - if err := os.WriteFile(mdPath, []byte(mdContent), 0o644); err != nil { - return fmt.Errorf("failed to write report.md: %w", err) + if writeErr := os.WriteFile(mdPath, []byte(mdContent), 0o644); writeErr != nil { + return fmt.Errorf("failed to write report.md: %w", writeErr) } // Write HTML report htmlPath := filepath.Join(outDir, "report.html") htmlContent := harness.RenderHTML(report) - if err := os.WriteFile(htmlPath, []byte(htmlContent), 0o644); err != nil { - return fmt.Errorf("failed to write report.html: %w", err) + if writeErr := os.WriteFile(htmlPath, []byte(htmlContent), 0o644); writeErr != nil { + return fmt.Errorf("failed to write report.html: %w", writeErr) } // Write JSON report jsonPath := filepath.Join(outDir, "findings.json") - jsonContent, err := harness.RenderJSON(report) - if err != nil { - return fmt.Errorf("failed to serialize findings.json: %w", err) + jsonContent, renderErr := harness.RenderJSON(report) + if renderErr != nil { + return fmt.Errorf("failed to serialize findings.json: %w", renderErr) } - if err := os.WriteFile(jsonPath, jsonContent, 0o644); err != nil { - return fmt.Errorf("failed to write findings.json: %w", err) + if writeErr := os.WriteFile(jsonPath, jsonContent, 0o644); writeErr != nil { + return fmt.Errorf("failed to write findings.json: %w", writeErr) } // Journal quality observation to Hawk execution graph _ = harness.JournalHarnessReport(report, "") - fmt.Printf("🦅 Hawk Harness Evaluation Complete\n") + fmt.Printf("[HAWK] Hawk Harness Evaluation Complete\n") fmt.Printf(" Overall Score : %d/100 (%s)\n", report.OverallScore, report.OverallStatus) fmt.Printf(" Findings : %d prioritized issues\n", len(report.Findings)) fmt.Printf(" HTML Report : %s\n", htmlPath) diff --git a/external/hawk-core-contracts b/external/hawk-core-contracts index ee09466e..60c9bd56 160000 --- a/external/hawk-core-contracts +++ b/external/hawk-core-contracts @@ -1 +1 @@ -Subproject commit ee09466e706410430230cc2a0774cd7fcd108416 +Subproject commit 60c9bd56a11f74938ff403491b4c66dfae9ec5d6 diff --git a/go.mod b/go.mod index 81add1f6..ad506938 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( charm.land/bubbletea/v2 v2.0.7 charm.land/lipgloss/v2 v2.0.3 github.com/GrayCodeAI/eyrie v0.1.4-0.20260727034005-5b332a4d6be5 - github.com/GrayCodeAI/hawk-core-contracts v0.1.9 + github.com/GrayCodeAI/hawk-core-contracts v0.1.10 github.com/GrayCodeAI/inspect v0.0.0-20260726091806-08f3151d5738 github.com/GrayCodeAI/sight v0.0.0-20260726091804-84c96edfc589 github.com/GrayCodeAI/tok v0.1.5-0.20260727034347-2afc7f549e35 diff --git a/go.sum b/go.sum index fd5519bc..9028e0d4 100644 --- a/go.sum +++ b/go.sum @@ -18,8 +18,8 @@ github.com/BurntSushi/toml v1.6.0 h1:dRaEfpa2VI55EwlIW72hMRHdWouJeRF7TPYhI+AUQjk github.com/BurntSushi/toml v1.6.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= github.com/GrayCodeAI/eyrie v0.1.4-0.20260727034005-5b332a4d6be5 h1:EpZ2JmtzR6gD8perOTr0tCLqK0Rxc50DIQZEC+zdej0= github.com/GrayCodeAI/eyrie v0.1.4-0.20260727034005-5b332a4d6be5/go.mod h1:rnouStzgv5q8hSvLdsVQazBkLBuYbm+WGCwRcAc5zXE= -github.com/GrayCodeAI/hawk-core-contracts v0.1.9 h1:uXX/gtNM+3kxSEzu+rZkHykzcEaAbASn1lmPyOGMXvc= -github.com/GrayCodeAI/hawk-core-contracts v0.1.9/go.mod h1:BXbh68YrCf+s9HVqND5F8DAvl2MnE5NcOwZZZB56HGA= +github.com/GrayCodeAI/hawk-core-contracts v0.1.10 h1:mvp6d2clwjHiBZpde8G9y8o/5jf/Qx69xXytTdPtVks= +github.com/GrayCodeAI/hawk-core-contracts v0.1.10/go.mod h1:BXbh68YrCf+s9HVqND5F8DAvl2MnE5NcOwZZZB56HGA= github.com/GrayCodeAI/hawk-mcpkit v0.1.5-0.20260725110526-3e80e92bf6cd h1:ACnGttHskvqwhL3nWbIi1ALpkpqQyZsyI3GhB3ZmKwg= github.com/GrayCodeAI/hawk-mcpkit v0.1.5-0.20260725110526-3e80e92bf6cd/go.mod h1:C32HPDRqiDETbVbMIbOTvguek6KImpLCffJjet7sqck= github.com/GrayCodeAI/inspect v0.0.0-20260726091806-08f3151d5738 h1:T9mQS75wTtTq6xqX1KGsQJyhnRFnd5YmoaGnHe9jppI= diff --git a/internal/harness/harness_test.go b/internal/harness/harness_test.go index 849f9eaa..eced0526 100644 --- a/internal/harness/harness_test.go +++ b/internal/harness/harness_test.go @@ -39,8 +39,8 @@ func TestEvaluateWorkspace(t *testing.T) { - Build with make - Run tests before opening PR ` - if err := os.WriteFile(agentsPath, []byte(agentsContent), 0o644); err != nil { - t.Fatalf("Failed to write AGENTS.md: %v", err) + if writeErr := os.WriteFile(agentsPath, []byte(agentsContent), 0o644); writeErr != nil { + t.Fatalf("Failed to write AGENTS.md: %v", writeErr) } makefileContent := `test: @@ -48,12 +48,12 @@ func TestEvaluateWorkspace(t *testing.T) { lint: golangci-lint run ` - if err := os.WriteFile(filepath.Join(tmpDir, "Makefile"), []byte(makefileContent), 0o644); err != nil { - t.Fatalf("Failed to write Makefile: %v", err) + if writeErr := os.WriteFile(filepath.Join(tmpDir, "Makefile"), []byte(makefileContent), 0o644); writeErr != nil { + t.Fatalf("Failed to write Makefile: %v", writeErr) } - if err := os.WriteFile(filepath.Join(tmpDir, ".golangci.yml"), []byte("linters:\n enable:\n - errcheck\n"), 0o644); err != nil { - t.Fatalf("Failed to write .golangci.yml: %v", err) + if writeErr := os.WriteFile(filepath.Join(tmpDir, ".golangci.yml"), []byte("linters:\n enable:\n - errcheck\n"), 0o644); writeErr != nil { + t.Fatalf("Failed to write .golangci.yml: %v", writeErr) } // 3. Re-evaluate with assets present diff --git a/internal/harness/render.go b/internal/harness/render.go index ec7ca825..3ada0bdf 100644 --- a/internal/harness/render.go +++ b/internal/harness/render.go @@ -16,7 +16,7 @@ func RenderJSON(report *HarnessReport) ([]byte, error) { func RenderMarkdown(report *HarnessReport) string { var sb strings.Builder - sb.WriteString("# 🦅 Hawk Agent Harness Review Report\n\n") + sb.WriteString("# Hawk Agent Harness Review Report\n\n") sb.WriteString(fmt.Sprintf("**Target Workspace:** `%s` \n", report.TargetPath)) sb.WriteString(fmt.Sprintf("**Generated At:** %s \n", report.GeneratedAt.Format(time.RFC1123))) sb.WriteString(fmt.Sprintf("**Overall Harness Health Score:** **%d / 100** (%s)\n\n", report.OverallScore, report.OverallStatus)) @@ -24,7 +24,7 @@ func RenderMarkdown(report *HarnessReport) string { sb.WriteString("## Executive Summary\n\n") sb.WriteString(report.Summary + "\n\n") - sb.WriteString("## 📊 Agent Work Loop Dimensions\n\n") + sb.WriteString("## Agent Work Loop Dimensions\n\n") sb.WriteString("| Dimension | Score | Status | Summary |\n") sb.WriteString("| :--- | :---: | :---: | :--- |\n") @@ -43,7 +43,7 @@ func RenderMarkdown(report *HarnessReport) string { } sb.WriteString("\n") - sb.WriteString("## 🔍 Detected Harness Assets\n\n") + sb.WriteString("## Detected Harness Assets\n\n") sb.WriteString(fmt.Sprintf("- **AGENTS.md**: %v\n", report.Assets.AgentsMD)) if report.Assets.AgentsMDPath != "" { sb.WriteString(fmt.Sprintf(" - *Path*: `%s`\n", report.Assets.AgentsMDPath)) @@ -55,9 +55,9 @@ func RenderMarkdown(report *HarnessReport) string { sb.WriteString(fmt.Sprintf("- **Hooks**: %s\n", strings.Join(report.Assets.Hooks, ", "))) sb.WriteString(fmt.Sprintf("- **Autonomy Policy**: `%s` tier (Sandbox: `%s`)\n\n", report.Assets.AutonomyTier, report.Assets.SandboxPolicy)) - sb.WriteString("## ⚠️ Prioritized Findings & Repair Recommendations\n\n") + sb.WriteString("## Prioritized Findings & Repair Recommendations\n\n") if len(report.Findings) == 0 { - sb.WriteString("✨ **No critical harness findings detected!** Your project is well-configured for AI agent workflows.\n") + sb.WriteString("**No critical harness findings detected!** Your project is well-configured for AI agent workflows.\n") } else { for i, f := range report.Findings { sb.WriteString(fmt.Sprintf("### %d. [%s] %s (%s)\n\n", i+1, f.Severity, f.Title, f.Dimension)) @@ -208,7 +208,7 @@ func RenderHTML(report *HarnessReport) string {
✨ No critical findings! Workspace harness is well-configured.
`) + sb.WriteString(`No critical findings! Workspace harness is well-configured.
`) } else { for _, f := range report.Findings { sb.WriteString(fmt.Sprintf(`