factory

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package factory implements the supermodel factory command: an AI-native SDLC orchestration system that uses the Supermodel code graph API to provide health analysis, graph-enriched execution plans, and prioritised improvement prompts.

Three sub-commands are exposed:

  • health — analyse codebase health (circular deps, coupling, blast radius)
  • run — generate a graph-enriched 8-phase SDLC prompt for a given goal
  • improve — generate a prioritised improvement plan from health data

The design is inspired by the Big Iron project (github.com/supermodeltools/bigiron).

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.

Strategy: use git archive when the repo is clean (committed state matches working tree, so the archive reflects what the user is actually looking at). Falls back to a manual directory walk otherwise.

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
	CriticalFiles []CriticalFile

	// 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 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