common

package
v0.7.0 Latest Latest
Warning

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

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

Documentation

Overview

Package common provides shared types used across PRD, MRD, and TRD documents.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatPeopleMarkdown

func FormatPeopleMarkdown(people []Person) string

FormatPeopleMarkdown formats a slice of Person for markdown display. Returns a comma-separated list of formatted persons.

func FormatPersonMarkdown

func FormatPersonMarkdown(p Person) string

FormatPersonMarkdown formats a Person for markdown display. Output formats:

  • "Name" (name only)
  • "[Name](mailto:email)" (name + email)
  • "Name (Role)" (name + role)
  • "[Name](mailto:email) (Role)" (all fields)

Types

type Approver

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

Approver represents a person with approval authority.

type Assumption

type Assumption struct {
	ID          string `json:"id"`
	Description string `json:"description"`
	Rationale   string `json:"rationale,omitempty"`
	Risk        string `json:"risk,omitempty"` // What happens if assumption is wrong
	Validated   bool   `json:"validated,omitempty"`
}

Assumption represents a condition assumed to be true. Used across PRD, MRD, and TRD documents.

type Constraint

type Constraint struct {
	ID          string         `json:"id"`
	Type        ConstraintType `json:"type"`
	Description string         `json:"description"`
	Impact      string         `json:"impact,omitempty"`
	Mitigation  string         `json:"mitigation,omitempty"`
	Rationale   string         `json:"rationale,omitempty"`
	Tags        []string       `json:"tags,omitempty"`
}

Constraint represents a limitation on the project. Used across PRD and TRD documents.

type ConstraintType

type ConstraintType string

ConstraintType represents types of constraints.

const (
	ConstraintTechnical  ConstraintType = "technical"
	ConstraintBudget     ConstraintType = "budget"
	ConstraintTimeline   ConstraintType = "timeline"
	ConstraintRegulatory ConstraintType = "regulatory"
	ConstraintResource   ConstraintType = "resource"
	ConstraintLegal      ConstraintType = "legal"
)

type CustomSection

type CustomSection struct {
	ID          string `json:"id"`
	Title       string `json:"title"`
	Description string `json:"description,omitempty"`
	Content     any    `json:"content"`          // Flexible content structure
	Schema      string `json:"schema,omitempty"` // Optional JSON schema for validation
}

CustomSection allows project-specific sections. Used across PRD, MRD, and TRD documents.

type DecisionRecord

type DecisionRecord struct {
	// ID is the unique identifier for this decision.
	ID string `json:"id"`

	// Decision is the decision that was made.
	Decision string `json:"decision"`

	// Rationale explains why this decision was made.
	Rationale string `json:"rationale,omitempty"`

	// AlternativesConsidered lists other options that were evaluated.
	AlternativesConsidered []string `json:"alternativesConsidered,omitempty"`

	// MadeBy is the person or group who made the decision.
	MadeBy string `json:"madeBy,omitempty"`

	// Date is when the decision was made.
	Date time.Time `json:"date,omitempty"`

	// Status is the current status of the decision.
	Status DecisionStatus `json:"status,omitempty"`

	// RelatedIDs are IDs of related items (requirements, risks, etc.).
	RelatedIDs []string `json:"relatedIds,omitempty"`
}

DecisionRecord documents a decision made during document development. Used for completed decisions (vs OpenItem for pending decisions).

type DecisionStatus

type DecisionStatus string

DecisionStatus represents the status of a decision.

const (
	// DecisionProposed means the decision is proposed but not finalized.
	DecisionProposed DecisionStatus = "proposed"

	// DecisionAccepted means the decision has been accepted.
	DecisionAccepted DecisionStatus = "accepted"

	// DecisionSuperseded means the decision has been replaced by another.
	DecisionSuperseded DecisionStatus = "superseded"

	// DecisionDeprecated means the decision is no longer relevant.
	DecisionDeprecated DecisionStatus = "deprecated"
)

type EffortLevel

type EffortLevel string

EffortLevel represents effort estimates.

const (
	EffortLow    EffortLevel = "low"
	EffortMedium EffortLevel = "medium"
	EffortHigh   EffortLevel = "high"
)

type GlossaryTerm

type GlossaryTerm struct {
	Term       string   `json:"term"`
	Definition string   `json:"definition"`
	Acronym    string   `json:"acronym,omitempty"`
	Context    string   `json:"context,omitempty"`
	Related    []string `json:"related,omitempty"` // Related terms
}

GlossaryTerm defines a glossary entry. Used across PRD, MRD, and TRD documents.

type NonGoal

type NonGoal struct {
	ID          string   `json:"id"`
	Title       string   `json:"title"`
	Description string   `json:"description,omitempty"`
	Rationale   string   `json:"rationale,omitempty"`   // Why it's out of scope
	FuturePhase string   `json:"futurePhase,omitempty"` // "Phase 2", "v2.0", etc.
	Tags        []string `json:"tags,omitempty"`
}

NonGoal represents an explicit out-of-scope item with rationale. More structured than a simple []string for OutOfScope.

type OpenItem

type OpenItem struct {
	// ID is the unique identifier for this open item.
	ID string `json:"id"`

	// Title is a brief summary of the decision needed.
	Title string `json:"title"`

	// Description provides detailed context about what needs to be decided.
	Description string `json:"description,omitempty"`

	// Context explains the background and why this decision is needed.
	Context string `json:"context,omitempty"`

	// Options are the available choices with their tradeoffs.
	Options []Option `json:"options,omitempty"`

	// Status is the current status of this open item.
	Status OpenItemStatus `json:"status,omitempty"`

	// Priority indicates how urgent this decision is.
	Priority Priority `json:"priority,omitempty"`

	// Owner is the person or group responsible for making this decision.
	Owner string `json:"owner,omitempty"`

	// Stakeholders are people who should be consulted.
	Stakeholders []string `json:"stakeholders,omitempty"`

	// DueDate is when this decision needs to be made.
	DueDate *time.Time `json:"dueDate,omitempty"`

	// CreatedAt is when this open item was created.
	CreatedAt *time.Time `json:"createdAt,omitempty"`

	// Resolution documents the final decision once made.
	Resolution *OpenItemResolution `json:"resolution,omitempty"`

	// RelatedIDs links to related requirements, risks, or other items.
	RelatedIDs []string `json:"relatedIds,omitempty"`

	// Tags for filtering by topic/domain.
	Tags []string `json:"tags,omitempty"`
}

OpenItem represents a pending decision or question that needs resolution. Unlike DecisionRecord (for completed decisions), OpenItem tracks items that are still under consideration with options and tradeoffs.

type OpenItemResolution

type OpenItemResolution struct {
	// ChosenOptionID is the ID of the option that was selected.
	ChosenOptionID string `json:"chosenOptionId,omitempty"`

	// Decision summarizes the final decision.
	Decision string `json:"decision"`

	// Rationale explains why this decision was made.
	Rationale string `json:"rationale,omitempty"`

	// DecidedBy is who made the final decision.
	DecidedBy string `json:"decidedBy,omitempty"`

	// DecidedAt is when the decision was made.
	DecidedAt *time.Time `json:"decidedAt,omitempty"`

	// Notes captures any additional context.
	Notes string `json:"notes,omitempty"`
}

OpenItemResolution documents how an open item was resolved.

type OpenItemStatus

type OpenItemStatus string

OpenItemStatus represents the status of an open item.

const (
	// OpenItemStatusOpen means the item is awaiting decision.
	OpenItemStatusOpen OpenItemStatus = "open"

	// OpenItemStatusInDiscussion means the item is being actively discussed.
	OpenItemStatusInDiscussion OpenItemStatus = "in_discussion"

	// OpenItemStatusBlocked means the item is blocked on something else.
	OpenItemStatusBlocked OpenItemStatus = "blocked"

	// OpenItemStatusResolved means a decision has been made.
	OpenItemStatusResolved OpenItemStatus = "resolved"

	// OpenItemStatusDeferred means the decision has been postponed.
	OpenItemStatusDeferred OpenItemStatus = "deferred"
)

type Option

type Option struct {
	// ID is the unique identifier for this option.
	ID string `json:"id"`

	// Title is a brief name for this option.
	Title string `json:"title"`

	// Description explains this option in detail.
	Description string `json:"description,omitempty"`

	// Pros lists the benefits and advantages of this option.
	Pros []string `json:"pros,omitempty"`

	// Cons lists the drawbacks and disadvantages of this option.
	Cons []string `json:"cons,omitempty"`

	// Effort estimates the implementation effort.
	Effort EffortLevel `json:"effort,omitempty"`

	// Risk estimates the risk level of this option.
	Risk RiskLevel `json:"risk,omitempty"`

	// Cost provides cost estimate or impact.
	Cost string `json:"cost,omitempty"`

	// Timeline provides time estimate or impact.
	Timeline string `json:"timeline,omitempty"`

	// Recommended indicates if this is the recommended option.
	Recommended bool `json:"recommended,omitempty"`

	// RecommendationRationale explains why this option is recommended (if applicable).
	RecommendationRationale string `json:"recommendationRationale,omitempty"`
}

Option represents one possible choice for an open item decision.

type Person

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

Person represents an individual contributor.

type Priority

type Priority string

Priority represents priority levels.

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

type Risk

type Risk struct {
	ID          string          `json:"id"`
	Description string          `json:"description"`
	Probability RiskProbability `json:"probability"`
	Impact      RiskImpact      `json:"impact"`
	Mitigation  string          `json:"mitigation"`
	Owner       string          `json:"owner,omitempty"`
	Status      RiskStatus      `json:"status,omitempty"`
	Category    string          `json:"category,omitempty"` // Market, Competitive, Technical, etc.
	DueDate     string          `json:"dueDate,omitempty"`
	Tags        []string        `json:"tags,omitempty"`
	Notes       string          `json:"notes,omitempty"`

	// AppendixRefs references appendices with additional details for this risk.
	AppendixRefs []string `json:"appendixRefs,omitempty"`
}

Risk represents a project risk. Used across PRD, MRD, and TRD documents.

type RiskImpact

type RiskImpact string

RiskImpact represents risk impact levels.

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

type RiskLevel

type RiskLevel string

RiskLevel represents risk levels for options.

const (
	RiskLevelLow    RiskLevel = "low"
	RiskLevelMedium RiskLevel = "medium"
	RiskLevelHigh   RiskLevel = "high"
)

type RiskProbability

type RiskProbability string

RiskProbability represents risk probability levels.

const (
	RiskProbabilityLow    RiskProbability = "low"
	RiskProbabilityMedium RiskProbability = "medium"
	RiskProbabilityHigh   RiskProbability = "high"
)

type RiskStatus

type RiskStatus string

RiskStatus represents risk status.

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

type Status

type Status string

Status represents the document lifecycle status. Used across PRD, MRD, and TRD documents.

const (
	StatusDraft      Status = "draft"
	StatusInReview   Status = "in_review"
	StatusApproved   Status = "approved"
	StatusDeprecated Status = "deprecated"
)

Jump to

Keyboard shortcuts

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