audit

package
v0.6.16 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 12, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateZip

func CreateZip(dir string) (string, error)

CreateZip archives the repository at dir into a temporary ZIP file and returns its path. The caller is responsible for removing the file.

func EnrichWithImpact

func EnrichWithImpact(r *HealthReport, impact *api.ImpactResult)

EnrichWithImpact adds impact analysis results to an existing HealthReport and re-scores status and recommendations.

func RenderHealth

func RenderHealth(w io.Writer, r *HealthReport)

RenderHealth writes a Markdown health report to w.

func RenderImprovePrompt

func RenderImprovePrompt(w io.Writer, d *SDLCPromptData)

RenderImprovePrompt writes a graph-driven improvement prompt to w.

func RenderRunPrompt

func RenderRunPrompt(w io.Writer, d *SDLCPromptData)

RenderRunPrompt writes a graph-enriched SDLC execution prompt to w. The AI agent receiving this output should follow the phases sequentially.

Types

type CriticalFile

type CriticalFile struct {
	Path              string
	RelationshipCount int
}

CriticalFile is a high blast-radius file derived from cross-domain references.

type DomainHealth

type DomainHealth struct {
	Name             string
	Description      string
	KeyFileCount     int
	Responsibilities int
	Subdomains       int
	// IncomingDeps are domain names that depend on this domain.
	IncomingDeps []string
	// OutgoingDeps are domain names this domain depends on.
	OutgoingDeps []string
}

DomainHealth holds structural metrics for a single semantic domain.

func (*DomainHealth) CouplingStatus

func (d *DomainHealth) CouplingStatus() string

CouplingStatus classifies a domain's coupling level.

type HealthReport

type HealthReport struct {
	ProjectName    string
	Language       string
	AnalyzedAt     time.Time
	Status         HealthStatus
	TotalFiles     int
	TotalFunctions int
	Languages      []string
	ExternalDeps   []string

	// Circular dependency data
	CircularDeps   int
	CircularCycles [][]string

	// Per-domain health
	Domains []DomainHealth

	// Highest blast-radius files (from domain key file overlap)
	CriticalFiles []CriticalFile

	// Impact analysis results (from /v1/analysis/impact)
	ImpactFiles []ImpactFile

	// Prioritised action items
	Recommendations []Recommendation
}

HealthReport is the output of a factory health analysis.

func Analyze

func Analyze(ir *api.SupermodelIR, projectName string) *HealthReport

Analyze derives a HealthReport from the raw SupermodelIR returned by the API.

type HealthStatus

type HealthStatus string

HealthStatus is the overall verdict of a health analysis.

const (
	// StatusHealthy means no critical issues detected.
	StatusHealthy HealthStatus = "HEALTHY"
	// StatusDegraded means non-critical issues are present (high coupling, warnings).
	StatusDegraded HealthStatus = "DEGRADED"
	// StatusCritical means blocking issues exist (circular dependencies).
	StatusCritical HealthStatus = "CRITICAL"
)

type ImpactFile

type ImpactFile struct {
	Path       string
	RiskScore  string
	Direct     int
	Transitive int
	Files      int
}

ImpactFile is a file with its blast radius risk from impact analysis.

type Recommendation

type Recommendation struct {
	// Priority: 1=critical, 2=high, 3=medium.
	Priority int
	Message  string
}

Recommendation is a prioritised actionable finding.

type SDLCPromptData

type SDLCPromptData struct {
	ProjectName    string
	Language       string
	TotalFiles     int
	TotalFunctions int
	ExternalDeps   []string
	Domains        []DomainHealth
	CriticalFiles  []CriticalFile
	CircularDeps   int

	// Goal is non-empty for the "run" command.
	Goal string
	// HealthReport is non-nil for the "improve" command.
	HealthReport *HealthReport

	GeneratedAt string
}

SDLCPromptData holds the inputs for rendering a factory run/improve prompt.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL