maturity

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package maturity provides types and functions for maturity model management.

Index

Constants

View Source
const (
	StatusNotStarted = "not_started"
	StatusInProgress = "in_progress"
	StatusCompleted  = "completed"
	StatusBlocked    = "blocked"
)

Enabler status constants.

View Source
const (
	TypeImplementation = "implementation"
	TypeProcess        = "process"
	TypeTraining       = "training"
	TypeTooling        = "tooling"
)

Enabler type constants.

View Source
const (
	OpGTE = "gte" // Greater than or equal
	OpLTE = "lte" // Less than or equal
	OpGT  = "gt"  // Greater than
	OpLT  = "lt"  // Less than
	OpEQ  = "eq"  // Equal
)

Operator constants.

View Source
const (
	LevelNameReactive   = "Reactive"
	LevelNameBasic      = "Basic"
	LevelNameDefined    = "Defined"
	LevelNameManaged    = "Managed"
	LevelNameOptimizing = "Optimizing"
)

Level name constants.

Variables

This section is empty.

Functions

func DefaultLevelNames

func DefaultLevelNames() map[int]string

DefaultLevelNames returns the standard M1-M5 level names.

func GenerateMarp

func GenerateMarp(specFile, outputFile string) error

GenerateMarp is a convenience function to generate Marp from a spec file.

func GenerateSimpleXLSX

func GenerateSimpleXLSX(specFile, outputFile string) error

GenerateSimpleXLSX generates a simple XLSX report using omniframe. This provides a basic export without conditional styling.

func GenerateXLSX

func GenerateXLSX(specFile, outputFile string) error

GenerateXLSX is a convenience function to generate XLSX from a spec file.

func OperatorSymbol

func OperatorSymbol(op string) string

OperatorSymbol returns the symbol for an operator.

Types

type Criterion

type Criterion struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`

	// SLO Definition
	MetricName string  `json:"metricName"`     // Human-readable metric description
	Operator   string  `json:"operator"`       // gte, lte, gt, lt, eq
	Target     float64 `json:"target"`         // Target value
	Unit       string  `json:"unit,omitempty"` // %, days, count, seconds, etc.

	// Classification
	Layer    string `json:"layer,omitempty"`    // requirements, code, infra, runtime, adoption, support
	Category string `json:"category,omitempty"` // prevention, detection, response

	// Assessment (populated during evaluation)
	Current float64 `json:"current,omitempty"` // Current value
	IsMet   bool    `json:"isMet,omitempty"`   // Calculated: meets target?

	// Weighting
	Weight   float64 `json:"weight,omitempty"`   // Relative importance (default 1.0)
	Required bool    `json:"required,omitempty"` // Must pass for level (default true if omitted)
}

Criterion is a measurable SLO that defines level achievement.

func (*Criterion) CheckMet

func (c *Criterion) CheckMet(current float64) bool

IsMet checks if a criterion is met given a current value.

func (*Criterion) CurrentString

func (c *Criterion) CurrentString() string

CurrentString returns a formatted current value string.

func (*Criterion) TargetString

func (c *Criterion) TargetString() string

TargetString returns a formatted target string like ">=95%".

type DomainAssessment

type DomainAssessment struct {
	Domain         string             `json:"domain"`
	AssessedAt     string             `json:"assessedAt,omitempty"`
	AssessedBy     string             `json:"assessedBy,omitempty"`
	CurrentLevel   int                `json:"currentLevel"`             // Achieved level (1-5)
	TargetLevel    int                `json:"targetLevel"`              // Goal level
	CriteriaValues map[string]float64 `json:"criteriaValues,omitempty"` // Current values by criterion ID
	EnablerStatus  map[string]string  `json:"enablerStatus,omitempty"`  // Status by enabler ID
}

DomainAssessment captures current state against a domain's maturity model.

type DomainModel

type DomainModel struct {
	Name        string  `json:"name"`
	Description string  `json:"description,omitempty"`
	Owner       string  `json:"owner,omitempty"`
	Levels      []Level `json:"levels"`
}

DomainModel defines maturity levels for a specific domain.

func (*DomainModel) AllCriteria

func (d *DomainModel) AllCriteria() []Criterion

AllCriteria returns all criteria across all levels for a domain.

func (*DomainModel) AllEnablers

func (d *DomainModel) AllEnablers() []Enabler

AllEnablers returns all enablers across all levels for a domain.

func (*DomainModel) CriteriaForLevel

func (d *DomainModel) CriteriaForLevel(level int) []Criterion

CriteriaForLevel returns criteria for a specific level.

func (*DomainModel) EnablersForLevel

func (d *DomainModel) EnablersForLevel(level int) []Enabler

EnablersForLevel returns enablers for a specific level.

func (*DomainModel) GetLevel

func (d *DomainModel) GetLevel(level int) (*Level, bool)

GetLevel returns the level definition for a domain.

type Enabler

type Enabler struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`

	// Classification
	Type  string `json:"type,omitempty"`  // implementation, process, training, tooling
	Layer string `json:"layer,omitempty"` // requirements, code, infra, runtime, adoption, support

	// Effort
	Effort string `json:"effort,omitempty"` // T-shirt size or duration
	Team   string `json:"team,omitempty"`   // Responsible team

	// Tracking
	Status      string   `json:"status,omitempty"`      // not_started, in_progress, completed
	CriteriaIDs []string `json:"criteriaIds,omitempty"` // Which SLOs this enables

	// Dependencies
	DependsOn []string `json:"dependsOn,omitempty"` // Other enabler IDs
}

Enabler is implementation work to achieve criteria.

type KPIThreshold

type KPIThreshold struct {
	ID          string          `json:"id"`
	Name        string          `json:"name"`
	Description string          `json:"description,omitempty"`
	Unit        string          `json:"unit,omitempty"`
	Operator    string          `json:"operator,omitempty"` // gte (default), lte for "lower is better"
	Thresholds  LevelThresholds `json:"thresholds"`
	Current     any             `json:"current,omitempty"` // Current value for assessment
}

KPIThreshold defines the progression of a KPI across maturity levels.

type Level

type Level struct {
	Level       int         `json:"level"` // 1-5
	Name        string      `json:"name"`  // Reactive, Basic, Defined, Managed, Optimizing
	Description string      `json:"description"`
	Criteria    []Criterion `json:"criteria,omitempty"` // SLOs that define the level
	Enablers    []Enabler   `json:"enablers,omitempty"` // Tasks to achieve the level
}

Level defines a maturity level (M1-M5) for a domain.

func (*Level) CalculateLevelProgress

func (l *Level) CalculateLevelProgress(values map[string]float64, enablerStatus map[string]string) LevelProgress

CalculateLevelProgress calculates progress for a level given current values.

func (*Level) IsLevelAchieved

func (l *Level) IsLevelAchieved(values map[string]float64) bool

IsLevelAchieved checks if all required criteria for a level are met.

type LevelProgress

type LevelProgress struct {
	Level           int     `json:"level"`
	CriteriaMet     int     `json:"criteriaMet"`
	CriteriaTotal   int     `json:"criteriaTotal"`
	ProgressPercent float64 `json:"progressPercent"`
	EnablersDone    int     `json:"enablersDone"`
	EnablersTotal   int     `json:"enablersTotal"`
}

LevelProgress tracks progress toward a maturity level.

type LevelThresholds

type LevelThresholds struct {
	M1 any `json:"m1,omitempty"`
	M2 any `json:"m2,omitempty"`
	M3 any `json:"m3,omitempty"`
	M4 any `json:"m4,omitempty"`
	M5 any `json:"m5,omitempty"`
}

LevelThresholds holds threshold values for each maturity level.

type MarpGenerator

type MarpGenerator struct {
	// contains filtered or unexported fields
}

MarpGenerator generates Marp presentations from maturity specs.

func NewMarpGenerator

func NewMarpGenerator(spec *Spec) *MarpGenerator

NewMarpGenerator creates a new Marp generator.

func (*MarpGenerator) Generate

func (g *MarpGenerator) Generate() (string, error)

Generate creates the Marp presentation content.

func (*MarpGenerator) SaveAs

func (g *MarpGenerator) SaveAs(filename string) error

SaveAs saves the presentation to a file.

type Spec

type Spec struct {
	Schema        string                       `json:"$schema,omitempty"`
	Metadata      *SpecMetadata                `json:"metadata,omitempty"`
	KPIThresholds map[string][]KPIThreshold    `json:"kpiThresholds,omitempty"`
	Domains       map[string]*DomainModel      `json:"domains"`
	Assessments   map[string]*DomainAssessment `json:"assessments,omitempty"`
}

Spec defines a complete maturity specification for an organization. It contains maturity models for multiple domains.

func ReadSpecFile

func ReadSpecFile(filename string) (*Spec, error)

ReadSpecFile reads a maturity spec from a JSON file.

func (*Spec) GetDomain

func (s *Spec) GetDomain(name string) (*DomainModel, bool)

GetDomain returns the domain model by name.

func (*Spec) WriteSpecFile

func (s *Spec) WriteSpecFile(filename string) error

WriteSpecFile writes a maturity spec to a JSON file.

type SpecMetadata

type SpecMetadata struct {
	Name         string `json:"name,omitempty"`
	Description  string `json:"description,omitempty"`
	Version      string `json:"version,omitempty"`
	Organization string `json:"organization,omitempty"`
	CreatedAt    string `json:"createdAt,omitempty"`
	UpdatedAt    string `json:"updatedAt,omitempty"`
}

SpecMetadata contains metadata about the maturity specification.

type XLSXGenerator

type XLSXGenerator struct {
	// contains filtered or unexported fields
}

XLSXGenerator generates Excel reports from maturity specs.

func NewXLSXGenerator

func NewXLSXGenerator(spec *Spec) *XLSXGenerator

NewXLSXGenerator creates a new XLSX generator.

func (*XLSXGenerator) Generate

func (g *XLSXGenerator) Generate() error

Generate creates the XLSX file with all sheets.

func (*XLSXGenerator) SaveAs

func (g *XLSXGenerator) SaveAs(filename string) error

SaveAs saves the XLSX file to the specified path.

Directories

Path Synopsis
Command-line tool for generating maturity reports.
Command-line tool for generating maturity reports.

Jump to

Keyboard shortcuts

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