core

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 18, 2026 License: MIT Imports: 3 Imported by: 0

README

PRISM Core

Go CI Go Lint Go SAST Go Report Card Docs Visualization License

Shared primitives and types for the PRISM ecosystem.

Overview

PRISM Core provides foundational types and constants used across the PRISM ecosystem:

Installation

go get github.com/grokify/prism-core

Packages

Domain Types (domain.go)

Domain constants for categorizing capabilities and metrics:

  • DomainSecurity - Security and compliance
  • DomainOperations - Operations and reliability
  • DomainQuality - Quality and testing
  • DomainPlatform - Platform and infrastructure
  • DomainAI - AI and machine learning
  • DomainData - Data management
Status Types (status.go)

Status enumerations for documents and workflows:

  • Document Status: StatusDraft, StatusApproved, StatusActive, etc.
  • Health Status: HealthGreen, HealthYellow, HealthRed
  • Priority: PriorityCritical, PriorityHigh, PriorityMedium, PriorityLow
  • MoSCoW: MoSCoWMust, MoSCoWShould, MoSCoWCould, MoSCoWWont
Metadata (metadata.go)

Common metadata structure for documents:

type Metadata struct {
    ID          string    `json:"id,omitempty"`
    Name        string    `json:"name,omitempty"`
    Title       string    `json:"title,omitempty"`
    Description string    `json:"description,omitempty"`
    Version     string    `json:"version,omitempty"`
    Status      string    `json:"status,omitempty"`
    Domain      string    `json:"domain,omitempty"`
    Owner       string    `json:"owner,omitempty"`
    Team        string    `json:"team,omitempty"`
    Authors     []Person  `json:"authors,omitempty"`
    Tags        []string  `json:"tags,omitempty"`
    CreatedAt   time.Time `json:"createdAt,omitzero"`
    UpdatedAt   time.Time `json:"updatedAt,omitzero"`
}
Person & Team (person.go)

People and team structures with Team Topologies support:

type Person struct {
    Name  string `json:"name"`
    Email string `json:"email,omitempty"`
    Role  string `json:"role,omitempty"`
}

type Team struct {
    ID      string   `json:"id,omitempty"`
    Name    string   `json:"name"`
    Type    string   `json:"type,omitempty"` // stream_aligned, platform, enabling, overlay
    Members []Person `json:"members,omitempty"`
}
Layers & Stages (layer.go)

Value stream layers and lifecycle stages:

Layers:

  • LayerRequirements - Product ideation, specs, design
  • LayerCode - Application code, libraries, dependencies
  • LayerInfra - Cloud resources, networking, platform
  • LayerRuntime - Running services, containers, workloads
  • LayerAdoption - Product analytics, user engagement
  • LayerSupport - Customer support, incident management

Stages:

  • StageDesign - Architecture, requirements, planning
  • StageBuild - CI/CD, code quality, dependency management
  • StageTest - Testing coverage, quality assurance
  • StageRuntime - Production monitoring, availability
  • StageResponse - Incident response, remediation
Maturity Levels (maturity.go)

5-level maturity model (M1-M5):

Level Name Description
M1 Reactive Ad-hoc processes, firefighting mode
M2 Basic Basic controls, individual-dependent
M3 Defined Standardized, repeatable processes
M4 Managed Data-driven, measured and controlled
M5 Optimizing Continuous improvement, automated
Frameworks (framework.go)

Compliance and security framework constants:

  • NIST: CSF, CSF 2.0, 800-53, 800-171, RMF, AI RMF
  • FedRAMP: High, Moderate, Low
  • Industry: ISO 27001, SOC 2, PCI DSS, HIPAA, GDPR
  • Security: MITRE ATT&CK, OWASP, CIS Controls
  • Operations: DORA, SRE
Risk Types (risk.go)

Risk assessment primitives:

type Risk struct {
    ID          string `json:"id,omitempty"`
    Description string `json:"description"`
    Impact      string `json:"impact,omitempty"`      // low, medium, high, critical
    Probability string `json:"probability,omitempty"` // low, medium, high
    Mitigation  string `json:"mitigation,omitempty"`
    Status      string `json:"status,omitempty"`      // open, mitigated, accepted, closed
    Owner       string `json:"owner,omitempty"`
}
SLI Types (sli.go)

Service Level Indicator types:

  • SLITypeAvailability - Service uptime
  • SLITypeLatency - Response time
  • SLITypeThroughput - Requests per second
  • SLITypeErrorRate - Error percentage
  • SLITypeFreshness - Data staleness
  • SLITypeCorrectness - Result accuracy
  • SLITypeCoverage - Response coverage
  • SLITypeDurability - Data persistence
Trend Types (trend.go)

Trend direction and analysis:

type TrendInfo struct {
    Direction  string  `json:"direction"`  // up, down, flat, unknown
    Magnitude  float64 `json:"magnitude,omitempty"`
    Percentage float64 `json:"percentage,omitempty"`
}

PRISM Ecosystem

┌───────────────────────────────────────────────────────────┐
│                         PRISM Core                        │
│              (Shared Primitives & Types)                  │
└───────────────────────────────────────────────────────────┘
                              │
          ┌───────────────────┼───────────────────┐
          │                   │                   │
          ▼                   ▼                   ▼
┌──────────────────┐ ┌──────────────────┐ ┌─────────────────┐
│ PRISM Capability │ │PRISM Intelligence│ │ PRISM Execution │
│                  │ │                  │ │                 │
│ "What we need"   │ │"How we measure"  │ │  "How we act"   │
│                  │ │                  │ │                 │
│ - Capabilities   │ │ - Metrics        │ │ - Initiatives   │
│ - Requirements   │ │ - SLIs/SLOs      │ │ - Roadmaps      │
│ - Gaps           │ │ - Assessments    │ │ - Tasks         │
└──────────────────┘ └──────────────────┘ └─────────────────┘

License

MIT License - see LICENSE for details.

Documentation

Overview

Package core provides shared primitives for the PRISM ecosystem.

The PRISM ecosystem consists of three modules:

  • prism-capability: What capabilities exist (capability stacks, layers)
  • prism-intelligence: How we measure maturity (SLIs, SLOs, maturity models)
  • prism-execution: How we improve (OKRs, V2MOM, roadmaps)

This package provides shared types used across all three modules.

Index

Constants

View Source
const (
	// Primary domains
	DomainSecurity   = "security"   // Application and infrastructure security
	DomainOperations = "operations" // Reliability, performance, efficiency
	DomainQuality    = "quality"    // Testing, code quality, defects

	// Extended domains
	DomainPlatform       = "platform"       // Platform engineering
	DomainAI             = "ai"             // AI/ML capabilities
	DomainData           = "data"           // Data management
	DomainObservability  = "observability"  // Monitoring and observability
	DomainInfrastructure = "infrastructure" // Infrastructure management
	DomainProduct        = "product"        // Product management
	DomainCompliance     = "compliance"     // Compliance and governance
)

Domain constants represent functional areas with their own standards.

View Source
const (
	// NIST Frameworks
	FrameworkNISTCSF    = "NIST_CSF"    // NIST Cybersecurity Framework 1.1
	FrameworkNISTCSF2   = "NIST_CSF_2"  // NIST Cybersecurity Framework 2.0
	FrameworkNIST80053  = "NIST_800_53" // NIST 800-53 Security Controls
	FrameworkNIST800171 = "NIST_800_171"
	FrameworkNISTRMF    = "NIST_RMF"    // NIST Risk Management Framework
	FrameworkNISTAIRMF  = "NIST_AI_RMF" // NIST AI Risk Management Framework

	// FedRAMP Baselines
	FrameworkFedRAMPHigh = "FEDRAMP_HIGH"
	FrameworkFedRAMPMod  = "FEDRAMP_MOD"
	FrameworkFedRAMPLow  = "FEDRAMP_LOW"

	// Industry Standards
	FrameworkISO27001    = "ISO_27001"
	FrameworkSOC2        = "SOC_2"
	FrameworkCISControls = "CIS_CONTROLS"
	FrameworkPCIDSS      = "PCI_DSS"
	FrameworkHIPAA       = "HIPAA"
	FrameworkGDPR        = "GDPR"

	// Security Frameworks
	FrameworkMITREATTACK = "MITRE_ATTACK"
	FrameworkOWASP       = "OWASP"

	// Operations Frameworks
	FrameworkDORA = "DORA" // DevOps Research and Assessment
	FrameworkSRE  = "SRE"  // Site Reliability Engineering
)

Framework constants for compliance and methodology mappings.

View Source
const (
	NISTCSFGovern   = "govern"
	NISTCSFIdentify = "identify"
	NISTCSFProtect  = "protect"
	NISTCSFDetect   = "detect"
	NISTCSFRespond  = "respond"
	NISTCSFRecover  = "recover"
)

NIST CSF Function constants.

View Source
const (
	LayerRequirements = "requirements" // Product ideation, specs, design
	LayerCode         = "code"         // Application code, libraries, dependencies
	LayerInfra        = "infra"        // Cloud resources, networking, platform
	LayerRuntime      = "runtime"      // Running services, containers, workloads
	LayerAdoption     = "adoption"     // Product analytics, user engagement
	LayerSupport      = "support"      // Customer support, incident management
)

Layer constants represent value stream phases.

View Source
const (
	StageDesign   = "design"   // Architecture, requirements, planning
	StageBuild    = "build"    // CI/CD, code quality, dependency management
	StageTest     = "test"     // Testing coverage, quality assurance
	StageRuntime  = "runtime"  // Production monitoring, availability
	StageResponse = "response" // Incident response, remediation, recovery
)

Lifecycle stage constants for SDLC phases.

View Source
const (
	MaturityLevel1 = 1 // Reactive/Ad-hoc
	MaturityLevel2 = 2 // Basic
	MaturityLevel3 = 3 // Defined
	MaturityLevel4 = 4 // Managed
	MaturityLevel5 = 5 // Optimizing
)

Maturity level constants (M1-M5).

View Source
const (
	MaturityNameReactive   = "Reactive"
	MaturityNameBasic      = "Basic"
	MaturityNameDefined    = "Defined"
	MaturityNameManaged    = "Managed"
	MaturityNameOptimizing = "Optimizing"
)

Maturity level name constants.

View Source
const (
	TeamTypeStreamAligned = "stream_aligned"
	TeamTypePlatform      = "platform"
	TeamTypeEnabling      = "enabling"
	TeamTypeOverlay       = "overlay"
)

Team type constants following Team Topologies.

View Source
const (
	RiskProbabilityLow    = "low"
	RiskProbabilityMedium = "medium"
	RiskProbabilityHigh   = "high"
)

Risk probability constants.

View Source
const (
	RiskImpactLow      = "low"
	RiskImpactMedium   = "medium"
	RiskImpactHigh     = "high"
	RiskImpactCritical = "critical"
)

Risk impact constants.

View Source
const (
	RiskStatusOpen      = "open"
	RiskStatusMitigated = "mitigated"
	RiskStatusAccepted  = "accepted"
	RiskStatusClosed    = "closed"
)

Risk status constants.

View Source
const (
	SLITypeAvailability = "availability"
	SLITypeLatency      = "latency"
	SLITypeThroughput   = "throughput"
	SLITypeErrorRate    = "error_rate"
	SLITypeFreshness    = "freshness"
	SLITypeCorrectness  = "correctness"
	SLITypeCoverage     = "coverage"
	SLITypeDurability   = "durability"
)

SLI type constants.

View Source
const (
	SLIDirectionHigherIsBetter = "higher_is_better"
	SLIDirectionLowerIsBetter  = "lower_is_better"
)

SLI comparison direction constants.

View Source
const (
	SLIAggregationAverage    = "average"
	SLIAggregationPercentile = "percentile"
	SLIAggregationSum        = "sum"
	SLIAggregationMin        = "min"
	SLIAggregationMax        = "max"
	SLIAggregationCount      = "count"
)

SLI aggregation method constants.

View Source
const (
	StatusDraft      = "draft"
	StatusInReview   = "in_review"
	StatusApproved   = "approved"
	StatusActive     = "active"
	StatusCompleted  = "completed"
	StatusDeprecated = "deprecated"
	StatusArchived   = "archived"
)

Status constants for document lifecycle.

View Source
const (
	HealthGreen  = "green"
	HealthYellow = "yellow"
	HealthRed    = "red"
)

HealthStatus constants for metric health indicators.

View Source
const (
	PriorityCritical = "critical"
	PriorityHigh     = "high"
	PriorityMedium   = "medium"
	PriorityLow      = "low"
)

Priority constants for prioritization.

View Source
const (
	MoSCoWMust   = "must"
	MoSCoWShould = "should"
	MoSCoWCould  = "could"
	MoSCoWWont   = "wont"
)

MoSCoW prioritization constants.

View Source
const (
	CapabilityStatusPlanned     = "planned"
	CapabilityStatusInProgress  = "in_progress"
	CapabilityStatusImplemented = "implemented"
	CapabilityStatusOperational = "operational"
	CapabilityStatusDeprecated  = "deprecated"
)

CapabilityStatus constants for capability lifecycle.

View Source
const (
	InitiativeStatusPlanned    = "planned"
	InitiativeStatusInProgress = "in_progress"
	InitiativeStatusCompleted  = "completed"
	InitiativeStatusCancelled  = "cancelled"
	InitiativeStatusOnHold     = "on_hold"
)

InitiativeStatus constants for initiative tracking.

View Source
const (
	TrendUp      = "up"
	TrendDown    = "down"
	TrendFlat    = "flat"
	TrendUnknown = "unknown"
)

Trend direction constants.

Variables

This section is empty.

Functions

func AllDomains

func AllDomains() []string

AllDomains returns all available domain constants.

func AllFrameworks

func AllFrameworks() []string

AllFrameworks returns all framework constants.

func AllLayers

func AllLayers() []string

AllLayers returns all layer constants in order.

func AllSLITypes

func AllSLITypes() []string

AllSLITypes returns all SLI type constants.

func AllStages

func AllStages() []string

AllStages returns all lifecycle stage constants in order.

func ComplianceFrameworks

func ComplianceFrameworks() []string

ComplianceFrameworks returns compliance-focused frameworks.

func DomainDisplayName

func DomainDisplayName(domain string) string

DomainDisplayName returns a human-readable name for a domain.

func FormatPeopleMarkdown

func FormatPeopleMarkdown(people []Person) string

FormatPeopleMarkdown formats a list of people for markdown output.

func FormatPersonMarkdown

func FormatPersonMarkdown(p Person) string

FormatPersonMarkdown formats a person for markdown output.

func FrameworkDisplayName

func FrameworkDisplayName(framework string) string

FrameworkDisplayName returns a human-readable name for a framework.

func LayerDisplayName

func LayerDisplayName(layer string) string

LayerDisplayName returns a human-readable name for a layer.

func MaturityGap

func MaturityGap(current, target int) int

MaturityGap calculates the gap between current and target maturity levels.

func MaturityLevelDescription

func MaturityLevelDescription(level int) string

MaturityLevelDescription returns a description for a maturity level.

func MaturityLevelName

func MaturityLevelName(level int) string

MaturityLevelName returns the name for a maturity level.

func MaturityLevelShortName

func MaturityLevelShortName(level int) string

MaturityLevelShortName returns short name like "M1", "M2", etc.

func MaturityProgress

func MaturityProgress(current, target int) float64

MaturityProgress calculates progress as a percentage (0.0 to 1.0).

func MoSCoWWeight

func MoSCoWWeight(moscow string) int

MoSCoWWeight returns a numeric weight for sorting MoSCoW priorities.

func NISTCSFFunctionSortWeight

func NISTCSFFunctionSortWeight(function string) int

NISTCSFFunctionSortWeight returns a sort weight for NIST CSF functions. Returns the canonical order: govern=1, identify=2, protect=3, detect=4, respond=5, recover=6.

func NISTCSFFunctions

func NISTCSFFunctions() []string

NISTCSFFunctions returns NIST CSF functions in canonical order.

func NISTFrameworks

func NISTFrameworks() []string

NISTFrameworks returns NIST-related frameworks.

func OperationsFrameworks

func OperationsFrameworks() []string

OperationsFrameworks returns operations-focused frameworks.

func PrimaryDomains

func PrimaryDomains() []string

PrimaryDomains returns the three primary domains.

func PriorityWeight

func PriorityWeight(priority string) int

PriorityWeight returns a numeric weight for sorting priorities. Higher weight = higher priority.

func RiskScore

func RiskScore(probability, impact string) int

RiskScore calculates a numeric score based on probability and impact. Returns a value from 1 (low/low) to 12 (high/critical).

func RiskSeverity

func RiskSeverity(score int) string

RiskSeverity returns a severity level based on risk score.

func SLITypeDirection

func SLITypeDirection(sliType string) string

SLITypeDirection returns the default comparison direction for an SLI type.

func SLITypeDisplayName

func SLITypeDisplayName(sliType string) string

SLITypeDisplayName returns a human-readable name for an SLI type.

func SecurityFrameworks

func SecurityFrameworks() []string

SecurityFrameworks returns security-focused frameworks.

func StageDisplayName

func StageDisplayName(stage string) string

StageDisplayName returns a human-readable name for a stage.

func TrendFromDelta

func TrendFromDelta(delta float64) string

TrendFromDelta returns a trend direction based on a delta value.

func TrendIcon

func TrendIcon(direction string) string

TrendIcon returns an emoji icon for a trend direction.

func ValidDomain

func ValidDomain(domain string) bool

ValidDomain checks if a domain value is valid.

func ValidFramework

func ValidFramework(framework string) bool

ValidFramework checks if a framework value is valid.

func ValidHealthStatus

func ValidHealthStatus(status string) bool

ValidHealthStatus checks if a health status value is valid.

func ValidLayer

func ValidLayer(layer string) bool

ValidLayer checks if a layer value is valid.

func ValidMaturityLevel

func ValidMaturityLevel(level int) bool

ValidMaturityLevel checks if a maturity level is valid (1-5).

func ValidMoSCoW

func ValidMoSCoW(moscow string) bool

ValidMoSCoW checks if a MoSCoW value is valid.

func ValidPriority

func ValidPriority(priority string) bool

ValidPriority checks if a priority value is valid.

func ValidRiskImpact

func ValidRiskImpact(impact string) bool

ValidRiskImpact checks if a risk impact value is valid.

func ValidRiskProbability

func ValidRiskProbability(probability string) bool

ValidRiskProbability checks if a risk probability value is valid.

func ValidRiskStatus

func ValidRiskStatus(status string) bool

ValidRiskStatus checks if a risk status value is valid.

func ValidSLIType

func ValidSLIType(sliType string) bool

ValidSLIType checks if an SLI type value is valid.

func ValidStage

func ValidStage(stage string) bool

ValidStage checks if a lifecycle stage value is valid.

func ValidTeamType

func ValidTeamType(teamType string) bool

ValidTeamType checks if a team type is valid.

func ValidTrend

func ValidTrend(direction string) bool

ValidTrend checks if a trend direction value is valid.

Types

type Approver

type Approver struct {
	Person
	ApprovedAt time.Time `json:"approvedAt,omitzero"`
	Approved   bool      `json:"approved,omitempty"`
	Comments   string    `json:"comments,omitempty"`
}

Approver represents a person who approved something.

func NewApprover

func NewApprover(p Person, approved bool, comments string) Approver

NewApprover creates an approver from a person.

type FrameworkMapping

type FrameworkMapping struct {
	Framework   string   `json:"framework"`
	Reference   string   `json:"reference,omitempty"`
	Controls    []string `json:"controls,omitempty"`
	Description string   `json:"description,omitempty"`
}

FrameworkMapping represents a mapping to an external framework.

type LayerDef

type LayerDef struct {
	ID          string  `json:"id"`
	Name        string  `json:"name"`
	Description string  `json:"description,omitempty"`
	Order       int     `json:"order,omitempty"`
	Weight      float64 `json:"weight,omitempty"`
}

LayerDef defines a layer with metadata.

func DefaultLayers

func DefaultLayers() []LayerDef

DefaultLayers returns default layer definitions with weights.

type MaturityLevelDef

type MaturityLevelDef struct {
	Level       int     `json:"level"`
	Name        string  `json:"name"`
	Description string  `json:"description,omitempty"`
	Weight      float64 `json:"weight,omitempty"`
}

MaturityLevelDef defines a maturity level with metadata.

func DefaultMaturityLevels

func DefaultMaturityLevels() []MaturityLevelDef

DefaultMaturityLevels returns the standard 5-level maturity definitions.

type Metadata

type Metadata struct {
	ID          string    `json:"id,omitempty"`
	Name        string    `json:"name,omitempty"`
	Title       string    `json:"title,omitempty"`
	Description string    `json:"description,omitempty"`
	Version     string    `json:"version,omitempty"`
	Status      string    `json:"status,omitempty"`
	Domain      string    `json:"domain,omitempty"`
	Owner       string    `json:"owner,omitempty"`
	Team        string    `json:"team,omitempty"`
	Authors     []Person  `json:"authors,omitempty"`
	Tags        []string  `json:"tags,omitempty"`
	CreatedAt   time.Time `json:"createdAt,omitzero"`
	UpdatedAt   time.Time `json:"updatedAt,omitzero"`
}

Metadata contains common document metadata fields.

func NewMetadata

func NewMetadata(name string, author Person) *Metadata

NewMetadata creates a new Metadata with the given name and author.

func (*Metadata) AddAuthor

func (m *Metadata) AddAuthor(author Person)

AddAuthor adds an author if not already present.

func (*Metadata) AddTag

func (m *Metadata) AddTag(tag string)

AddTag adds a tag if not already present.

func (*Metadata) HasTag

func (m *Metadata) HasTag(tag string) bool

HasTag checks if the metadata has a specific tag.

func (*Metadata) Touch

func (m *Metadata) Touch()

Touch updates the UpdatedAt timestamp.

type Person

type Person struct {
	Name  string `json:"name"`
	Email string `json:"email,omitempty"`
	Role  string `json:"role,omitempty"`
}

Person represents an individual.

type Risk

type Risk struct {
	ID          string `json:"id,omitempty"`
	Description string `json:"description"`
	Impact      string `json:"impact,omitempty"`
	Probability string `json:"probability,omitempty"`
	Mitigation  string `json:"mitigation,omitempty"`
	Status      string `json:"status,omitempty"`
	Owner       string `json:"owner,omitempty"`
}

Risk represents a risk item.

type SLITypeDef

type SLITypeDef struct {
	Type        string `json:"type"`
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
	Direction   string `json:"direction"`
	Unit        string `json:"unit,omitempty"`
}

SLITypeDef defines an SLI type with metadata.

func DefaultSLITypes

func DefaultSLITypes() []SLITypeDef

DefaultSLITypes returns default SLI type definitions.

type Team

type Team struct {
	ID          string   `json:"id,omitempty"`
	Name        string   `json:"name"`
	Description string   `json:"description,omitempty"`
	Type        string   `json:"type,omitempty"` // stream_aligned, platform, enabling, overlay
	Domain      string   `json:"domain,omitempty"`
	Owner       string   `json:"owner,omitempty"`
	Email       string   `json:"email,omitempty"`
	Slack       string   `json:"slack,omitempty"`
	Members     []Person `json:"members,omitempty"`
}

Team represents a group of people.

type TrendInfo

type TrendInfo struct {
	Direction  string  `json:"direction"`
	Magnitude  float64 `json:"magnitude,omitempty"`
	Percentage float64 `json:"percentage,omitempty"`
}

TrendInfo represents a trend with direction and magnitude.

func NewTrendInfo

func NewTrendInfo(delta, previous float64) TrendInfo

NewTrendInfo creates a TrendInfo from a delta value.

Jump to

Keyboard shortcuts

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