mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-04-28 19:41:17 +00:00
- Rename findings_mcp_adapter.go -> findings_tools_adapter.go - Update imports from mcp to tools package - Add findings_tools_adapter_test.go with basic tests - Add SetChatPatrol method as alias for SetOpenCodePatrol (maintains API compatibility during transition)
79 lines
2 KiB
Go
79 lines
2 KiB
Go
package ai
|
|
|
|
import (
|
|
"github.com/rcourtman/pulse-go-rewrite/internal/ai/tools"
|
|
)
|
|
|
|
// FindingsMCPAdapter adapts FindingsStore to MCP FindingsProvider interface
|
|
type FindingsMCPAdapter struct {
|
|
store *FindingsStore
|
|
}
|
|
|
|
// NewFindingsMCPAdapter creates a new adapter for findings store
|
|
func NewFindingsMCPAdapter(store *FindingsStore) *FindingsMCPAdapter {
|
|
if store == nil {
|
|
return nil
|
|
}
|
|
return &FindingsMCPAdapter{store: store}
|
|
}
|
|
|
|
// GetActiveFindings implements tools.FindingsProvider
|
|
func (a *FindingsMCPAdapter) GetActiveFindings() []tools.Finding {
|
|
if a.store == nil {
|
|
return nil
|
|
}
|
|
|
|
// Get all active findings (empty severity means all)
|
|
internal := a.store.GetActive("")
|
|
result := make([]tools.Finding, 0, len(internal))
|
|
|
|
for _, f := range internal {
|
|
result = append(result, tools.Finding{
|
|
ID: f.ID,
|
|
Key: f.Key,
|
|
Severity: string(f.Severity),
|
|
Category: string(f.Category),
|
|
ResourceID: f.ResourceID,
|
|
ResourceName: f.ResourceName,
|
|
ResourceType: f.ResourceType,
|
|
Title: f.Title,
|
|
Description: f.Description,
|
|
Recommendation: f.Recommendation,
|
|
Evidence: f.Evidence,
|
|
DetectedAt: f.DetectedAt,
|
|
LastSeenAt: f.LastSeenAt,
|
|
})
|
|
}
|
|
|
|
return result
|
|
}
|
|
|
|
// GetDismissedFindings implements tools.FindingsProvider
|
|
func (a *FindingsMCPAdapter) GetDismissedFindings() []tools.Finding {
|
|
if a.store == nil {
|
|
return nil
|
|
}
|
|
|
|
internal := a.store.GetDismissedFindings()
|
|
result := make([]tools.Finding, 0, len(internal))
|
|
|
|
for _, f := range internal {
|
|
result = append(result, tools.Finding{
|
|
ID: f.ID,
|
|
Key: f.Key,
|
|
Severity: string(f.Severity),
|
|
Category: string(f.Category),
|
|
ResourceID: f.ResourceID,
|
|
ResourceName: f.ResourceName,
|
|
ResourceType: f.ResourceType,
|
|
Title: f.Title,
|
|
Description: f.Description,
|
|
Recommendation: f.Recommendation,
|
|
Evidence: f.Evidence,
|
|
DetectedAt: f.DetectedAt,
|
|
LastSeenAt: f.LastSeenAt,
|
|
})
|
|
}
|
|
|
|
return result
|
|
}
|