Documentation
¶
Overview ¶
Package decisions provides decision log persistence and rationale tracking.
This package captures architectural decisions, their rationale, and the relationships between decisions to create a comprehensive decision history.
Package decisions provides rationale graph generation from decision logs.
Index ¶
- type Alternative
- type Decision
- type DecisionLog
- func (l *DecisionLog) Add(d *Decision) error
- func (l *DecisionLog) ExportJSON() ([]byte, error)
- func (l *DecisionLog) Get(id string) (*Decision, error)
- func (l *DecisionLog) GetAllTags() []string
- func (l *DecisionLog) GetStatistics() *Statistics
- func (l *DecisionLog) List() []*Decision
- func (l *DecisionLog) ListByProject(project string) []*Decision
- func (l *DecisionLog) ListByStatus(status DecisionStatus) []*Decision
- func (l *DecisionLog) ListByTag(tag string) []*Decision
- func (l *DecisionLog) RenderIndex() string
- func (l *DecisionLog) Save() error
- func (l *DecisionLog) SaveDecisionFiles(dir string) error
- func (l *DecisionLog) Supersede(oldID, newID string) error
- func (l *DecisionLog) Update(d *Decision) error
- type DecisionStatus
- type EdgeType
- type ImpactAnalysis
- type RationaleEdge
- type RationaleGraph
- func (g *RationaleGraph) AnalyzeImpact(decisionID string) *ImpactAnalysis
- func (g *RationaleGraph) FindCentralNodes(topN int) []RationaleNode
- func (g *RationaleGraph) FindPath(fromID, toID string) []string
- func (g *RationaleGraph) GetClusters() map[string][]RationaleNode
- func (g *RationaleGraph) GetConnectedComponents() [][]string
- func (g *RationaleGraph) RenderDOT() string
- func (g *RationaleGraph) RenderMermaid() string
- type RationaleNode
- type Statistics
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Alternative ¶
type Alternative struct {
Title string `json:"title" yaml:"title"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
Pros []string `json:"pros,omitempty" yaml:"pros,omitempty"`
Cons []string `json:"cons,omitempty" yaml:"cons,omitempty"`
RejectedFor string `json:"rejected_for,omitempty" yaml:"rejected_for,omitempty"`
}
Alternative represents an option that was considered but not chosen.
type Decision ¶
type Decision struct {
ID string `json:"id" yaml:"id"`
Title string `json:"title" yaml:"title"`
Status DecisionStatus `json:"status" yaml:"status"`
Date time.Time `json:"date" yaml:"date"`
DecisionMakers []string `json:"decision_makers,omitempty" yaml:"decision_makers,omitempty"`
Context string `json:"context" yaml:"context"`
Decision string `json:"decision" yaml:"decision"`
Rationale string `json:"rationale" yaml:"rationale"`
Consequences []string `json:"consequences,omitempty" yaml:"consequences,omitempty"`
Alternatives []Alternative `json:"alternatives,omitempty" yaml:"alternatives,omitempty"`
Related []string `json:"related,omitempty" yaml:"related,omitempty"` // Related decision IDs
Supersedes string `json:"supersedes,omitempty" yaml:"supersedes,omitempty"` // ID of decision this replaces
SupersededBy string `json:"superseded_by,omitempty" yaml:"superseded_by,omitempty"`
Tags []string `json:"tags,omitempty" yaml:"tags,omitempty"`
Project string `json:"project,omitempty" yaml:"project,omitempty"`
Specs []string `json:"specs,omitempty" yaml:"specs,omitempty"` // Affected specs
Metadata map[string]string `json:"metadata,omitempty" yaml:"metadata,omitempty"`
}
Decision represents a single architectural or design decision.
func (*Decision) RenderMarkdown ¶
RenderMarkdown renders a single decision as Markdown (ADR format).
type DecisionLog ¶
type DecisionLog struct {
// contains filtered or unexported fields
}
DecisionLog manages a collection of decisions.
func NewDecisionLog ¶
func NewDecisionLog(path string) (*DecisionLog, error)
NewDecisionLog creates a new decision log at the given path.
func (*DecisionLog) Add ¶
func (l *DecisionLog) Add(d *Decision) error
Add adds a new decision to the log.
func (*DecisionLog) ExportJSON ¶
func (l *DecisionLog) ExportJSON() ([]byte, error)
ExportJSON exports the decision log as JSON.
func (*DecisionLog) Get ¶
func (l *DecisionLog) Get(id string) (*Decision, error)
Get retrieves a decision by ID.
func (*DecisionLog) GetAllTags ¶
func (l *DecisionLog) GetAllTags() []string
GetAllTags returns all unique tags used in decisions.
func (*DecisionLog) GetStatistics ¶
func (l *DecisionLog) GetStatistics() *Statistics
GetStatistics returns statistics about the decision log.
func (*DecisionLog) List ¶
func (l *DecisionLog) List() []*Decision
List returns all decisions in order.
func (*DecisionLog) ListByProject ¶
func (l *DecisionLog) ListByProject(project string) []*Decision
ListByProject returns decisions filtered by project.
func (*DecisionLog) ListByStatus ¶
func (l *DecisionLog) ListByStatus(status DecisionStatus) []*Decision
ListByStatus returns decisions filtered by status.
func (*DecisionLog) ListByTag ¶
func (l *DecisionLog) ListByTag(tag string) []*Decision
ListByTag returns decisions filtered by tag.
func (*DecisionLog) RenderIndex ¶
func (l *DecisionLog) RenderIndex() string
RenderIndex renders the decision log as a Markdown index.
func (*DecisionLog) Save ¶
func (l *DecisionLog) Save() error
Save persists the decision log to disk.
func (*DecisionLog) SaveDecisionFiles ¶
func (l *DecisionLog) SaveDecisionFiles(dir string) error
SaveDecisionFiles saves each decision as an individual Markdown file.
func (*DecisionLog) Supersede ¶
func (l *DecisionLog) Supersede(oldID, newID string) error
Supersede marks a decision as superseded by another.
func (*DecisionLog) Update ¶
func (l *DecisionLog) Update(d *Decision) error
Update updates an existing decision.
type DecisionStatus ¶
type DecisionStatus string
DecisionStatus indicates the current state of a decision.
const ( StatusProposed DecisionStatus = "proposed" StatusAccepted DecisionStatus = "accepted" StatusDeprecated DecisionStatus = "deprecated" StatusSuperseded DecisionStatus = "superseded" StatusRejected DecisionStatus = "rejected" )
type ImpactAnalysis ¶
type ImpactAnalysis struct {
DecisionID string `json:"decision_id"`
DirectlyAffected []string `json:"directly_affected"`
IndirectlyAffected []string `json:"indirectly_affected"`
TotalImpact int `json:"total_impact"`
}
ImpactAnalysis represents the impact of changing a decision.
type RationaleEdge ¶
type RationaleEdge struct {
From string `json:"from"`
To string `json:"to"`
Type EdgeType `json:"type"`
Label string `json:"label,omitempty"`
}
RationaleEdge represents a relationship between decisions.
type RationaleGraph ¶
type RationaleGraph struct {
Nodes []RationaleNode `json:"nodes"`
Edges []RationaleEdge `json:"edges"`
}
RationaleGraph represents the relationships between decisions.
func BuildRationaleGraph ¶
func BuildRationaleGraph(log *DecisionLog) *RationaleGraph
BuildRationaleGraph creates a graph from a decision log.
func (*RationaleGraph) AnalyzeImpact ¶
func (g *RationaleGraph) AnalyzeImpact(decisionID string) *ImpactAnalysis
AnalyzeImpact determines what would be affected by changing a decision.
func (*RationaleGraph) FindCentralNodes ¶
func (g *RationaleGraph) FindCentralNodes(topN int) []RationaleNode
FindCentralNodes returns nodes with the most connections.
func (*RationaleGraph) FindPath ¶
func (g *RationaleGraph) FindPath(fromID, toID string) []string
FindPath finds a path between two decisions (BFS).
func (*RationaleGraph) GetClusters ¶
func (g *RationaleGraph) GetClusters() map[string][]RationaleNode
GetClusters groups nodes by project.
func (*RationaleGraph) GetConnectedComponents ¶
func (g *RationaleGraph) GetConnectedComponents() [][]string
GetConnectedComponents finds disconnected subgraphs.
func (*RationaleGraph) RenderDOT ¶
func (g *RationaleGraph) RenderDOT() string
RenderDOT exports the graph in Graphviz DOT format.
func (*RationaleGraph) RenderMermaid ¶
func (g *RationaleGraph) RenderMermaid() string
RenderMermaid exports the graph as a Mermaid diagram.
type RationaleNode ¶
type RationaleNode struct {
ID string `json:"id"`
Title string `json:"title"`
Status DecisionStatus `json:"status"`
Project string `json:"project,omitempty"`
Tags []string `json:"tags,omitempty"`
Weight int `json:"weight"` // Number of connections
}
RationaleNode represents a decision in the graph.