prd

package
v0.8.0 Latest Latest
Warning

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

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

Documentation

Overview

Package prd provides data types for structured Product Requirements Documents.

Index

Constants

View Source
const (
	FrameworkOKR   = goals.FrameworkOKR
	FrameworkV2MOM = goals.FrameworkV2MOM
)

Framework constants re-exported for convenience.

View Source
const (
	StatusDraft      = common.StatusDraft
	StatusInReview   = common.StatusInReview
	StatusApproved   = common.StatusApproved
	StatusDeprecated = common.StatusDeprecated
)

Status constants re-exported from common for backward compatibility.

View Source
const (
	RiskProbabilityLow    = common.RiskProbabilityLow
	RiskProbabilityMedium = common.RiskProbabilityMedium
	RiskProbabilityHigh   = common.RiskProbabilityHigh

	RiskImpactLow      = common.RiskImpactLow
	RiskImpactMedium   = common.RiskImpactMedium
	RiskImpactHigh     = common.RiskImpactHigh
	RiskImpactCritical = common.RiskImpactCritical

	RiskStatusOpen      = common.RiskStatusOpen
	RiskStatusMitigated = common.RiskStatusMitigated
	RiskStatusAccepted  = common.RiskStatusAccepted
	RiskStatusClosed    = common.RiskStatusClosed
)

Risk constants re-exported from common for backward compatibility.

View Source
const (
	ConstraintTechnical  = common.ConstraintTechnical
	ConstraintBudget     = common.ConstraintBudget
	ConstraintTimeline   = common.ConstraintTimeline
	ConstraintRegulatory = common.ConstraintRegulatory
	ConstraintResource   = common.ConstraintResource
	ConstraintLegal      = common.ConstraintLegal
)

Constraint type constants re-exported from common for backward compatibility.

View Source
const (
	OpenItemStatusOpen         = common.OpenItemStatusOpen
	OpenItemStatusInDiscussion = common.OpenItemStatusInDiscussion
	OpenItemStatusBlocked      = common.OpenItemStatusBlocked
	OpenItemStatusResolved     = common.OpenItemStatusResolved
	OpenItemStatusDeferred     = common.OpenItemStatusDeferred
)

OpenItem status constants re-exported from common for backward compatibility.

View Source
const (
	EffortLow    = common.EffortLow
	EffortMedium = common.EffortMedium
	EffortHigh   = common.EffortHigh
)

Effort level constants re-exported from common for backward compatibility.

View Source
const (
	RiskLevelLow    = common.RiskLevelLow
	RiskLevelMedium = common.RiskLevelMedium
	RiskLevelHigh   = common.RiskLevelHigh
)

Risk level constants re-exported from common for backward compatibility.

View Source
const (
	DecisionProposed   = common.DecisionProposed
	DecisionAccepted   = common.DecisionAccepted
	DecisionSuperseded = common.DecisionSuperseded
	DecisionDeprecated = common.DecisionDeprecated
)

Decision status constants re-exported from common for backward compatibility.

View Source
const (
	PriorityCritical = common.PriorityCritical
	PriorityHigh     = common.PriorityHigh
	PriorityMedium   = common.PriorityMedium
	PriorityLow      = common.PriorityLow
)

Priority constants re-exported from common for backward compatibility.

View Source
const (
	// PhaseType constants
	PhaseTypeGeneric   = roadmap.PhaseTypeGeneric
	PhaseTypeQuarter   = roadmap.PhaseTypeQuarter
	PhaseTypeMonth     = roadmap.PhaseTypeMonth
	PhaseTypeSprint    = roadmap.PhaseTypeSprint
	PhaseTypeMilestone = roadmap.PhaseTypeMilestone

	// PhaseStatus constants
	PhaseStatusPlanned    = roadmap.PhaseStatusPlanned
	PhaseStatusInProgress = roadmap.PhaseStatusInProgress
	PhaseStatusCompleted  = roadmap.PhaseStatusCompleted
	PhaseStatusDelayed    = roadmap.PhaseStatusDelayed
	PhaseStatusCancelled  = roadmap.PhaseStatusCancelled

	// DeliverableType constants
	DeliverableFeature        = roadmap.DeliverableFeature
	DeliverableDocumentation  = roadmap.DeliverableDocumentation
	DeliverableInfrastructure = roadmap.DeliverableInfrastructure
	DeliverableIntegration    = roadmap.DeliverableIntegration
	DeliverableMilestone      = roadmap.DeliverableMilestone
	DeliverableRollout        = roadmap.DeliverableRollout

	// DeliverableStatus constants
	DeliverableNotStarted = roadmap.DeliverableNotStarted
	DeliverableInProgress = roadmap.DeliverableInProgress
	DeliverableCompleted  = roadmap.DeliverableCompleted
	DeliverableBlocked    = roadmap.DeliverableBlocked
)

Constants re-exported for backward compatibility.

View Source
const (
	ThresholdApprove     = 8.0
	ThresholdRevise      = 6.5
	ThresholdHumanReview = 6.5
	ThresholdBlocker     = 3.0
)

Thresholds for scoring decisions.

View Source
const DefaultDescriptionMaxLen = 0

DefaultDescriptionMaxLen is the default maximum length for description fields in tables. A value of 0 means no truncation (full text is displayed).

View Source
const DefaultFilename = "PRD.json"

DefaultFilename is the standard PRD filename.

View Source
const DefaultPersonaLibraryFilename = "personas.json"

DefaultPersonaLibraryFilename is the standard filename for persona libraries.

Variables

View Source
var (
	ErrPersonaNotFound      = errors.New("persona not found in library")
	ErrPersonaAlreadyExists = errors.New("persona with this ID already exists")
	ErrPersonaNameRequired  = errors.New("persona name is required")
	ErrInvalidPersonaID     = errors.New("invalid persona ID")
)

Common errors for persona library operations.

DefaultSectionOrder is the current v0.8.0 order for backward compatibility.

FeatureSectionOrder focuses on user needs before solution details. Best for feature PRDs and user-facing product changes.

View Source
var SectionAnchors = map[SectionID]string{
	SectionExecutiveSummary:  "executive-summary",
	SectionCurrentState:      "current-state",
	SectionProblem:           "problem-definition",
	SectionMarket:            "market-analysis",
	SectionSolution:          "solution",
	SectionSuccessMetrics:    "success-metrics",
	SectionObjectives:        "objectives-and-goals",
	SectionNonGoals:          "non-goals",
	SectionPersonas:          "personas",
	SectionUserStories:       "user-stories",
	SectionFunctionalReqs:    "functional-requirements",
	SectionNonFunctionalReqs: "non-functional-requirements",
	SectionRoadmap:           "roadmap",
	SectionTechArchitecture:  "technical-architecture",
	SectionSecurityModel:     "security-model",
	SectionDecisions:         "decisions",
	SectionRisks:             "risk-assessment",
	SectionAssumptions:       "assumptions-and-constraints",
	SectionInScope:           "in-scope",
	SectionOutOfScope:        "out-of-scope",
	SectionOpenItems:         "open-items",
	SectionRelatedDocuments:  "related-documents",
	SectionAppendices:        "appendices",
	SectionGlossary:          "glossary",
	SectionReviews:           "reviews",
	SectionRevisionHistory:   "revision-history",
}

SectionAnchors maps section IDs to markdown anchors for TOC links.

View Source
var SectionDisplayNames = map[SectionID]string{
	SectionExecutiveSummary:  "Executive Summary",
	SectionCurrentState:      "Current State",
	SectionProblem:           "Problem Definition",
	SectionMarket:            "Market Analysis",
	SectionSolution:          "Solution",
	SectionSuccessMetrics:    "Success Metrics",
	SectionObjectives:        "Objectives and Goals",
	SectionNonGoals:          "Non-Goals",
	SectionPersonas:          "Personas",
	SectionUserStories:       "User Stories",
	SectionFunctionalReqs:    "Functional Requirements",
	SectionNonFunctionalReqs: "Non-Functional Requirements",
	SectionRoadmap:           "Roadmap",
	SectionTechArchitecture:  "Technical Architecture",
	SectionSecurityModel:     "Security Model",
	SectionDecisions:         "Decisions",
	SectionRisks:             "Risk Assessment",
	SectionAssumptions:       "Assumptions and Constraints",
	SectionInScope:           "In Scope",
	SectionOutOfScope:        "Out of Scope",
	SectionOpenItems:         "Open Items",
	SectionRelatedDocuments:  "Related Documents",
	SectionAppendices:        "Appendices",
	SectionGlossary:          "Glossary",
	SectionReviews:           "Reviews",
	SectionRevisionHistory:   "Revision History",
}

SectionDisplayNames maps section IDs to display names for TOC and headers.

StrategySectionOrder places context (CurrentState, Problem, Market) early. Best for strategy PRDs, business cases, and product vision documents.

TechnicalSectionOrder emphasizes architecture and technical details. Best for technical PRDs, infrastructure changes, and platform work.

Functions

func AllSectionIDs added in v0.8.0

func AllSectionIDs() map[SectionID]bool

AllSectionIDs returns a set of all known section IDs.

func CategoryDescriptions

func CategoryDescriptions() map[string]string

CategoryDescriptions returns a map of category IDs to descriptions. Useful for providing context to LLM judges.

func CategoryOwners

func CategoryOwners() map[string]string

CategoryOwners returns a map of category IDs to suggested owners. Useful for assigning findings to responsible teams.

func GenerateEvaluationTemplate

func GenerateEvaluationTemplate(doc *Document, filename string) *evaluation.EvaluationReport

GenerateEvaluationTemplate creates an EvaluationReport template from a PRD document. The template includes all standard categories plus custom sections. Scores are initialized to zero - they will be filled in by the LLM judge.

func GenerateEvaluationTemplateWithWeights

func GenerateEvaluationTemplateWithWeights(doc *Document, filename string, weights map[string]float64) *evaluation.EvaluationReport

GenerateEvaluationTemplateWithWeights creates a template with custom category weights.

func GenerateID

func GenerateID() string

GenerateID generates a PRD ID based on the current date. Format: PRD-YYYY-DDD where DDD is the day of year.

func GenerateIDWithPrefix

func GenerateIDWithPrefix(prefix string) string

GenerateIDWithPrefix generates an ID with a custom prefix. Format: PREFIX-YYYY-DDD where DDD is the day of year.

func ListSections added in v0.8.0

func ListSections() []struct {
	ID          SectionID
	DisplayName string
}

ListSections returns all section IDs with their display names, sorted by default order.

func RenderExecMarkdown

func RenderExecMarkdown(view *ExecView) string

RenderExecMarkdown generates markdown output for exec view.

func RenderPMMarkdown

func RenderPMMarkdown(view *PMView) string

RenderPMMarkdown generates markdown output for PM view.

func RenderPRFAQMarkdown

func RenderPRFAQMarkdown(view *PRFAQView) string

RenderPRFAQMarkdown generates markdown output for the PR/FAQ view.

func RenderSixPagerMarkdown

func RenderSixPagerMarkdown(view *SixPagerView) string

RenderSixPagerMarkdown generates markdown output for the 6-pager view.

func Save

func Save(doc *Document, path string) error

Save writes a Document to a JSON file.

func ScoreToEvaluationReport

func ScoreToEvaluationReport(doc *Document, filename string) *evaluation.EvaluationReport

ScoreToEvaluationReport converts deterministic scoring results to an EvaluationReport. This allows the existing deterministic scoring to output in the standardized format that can be combined with LLM-based evaluations.

func StatusLegend

func StatusLegend() string

StatusLegend returns a markdown table explaining the status icons.

func StatusLegendWithOptions added in v0.7.0

func StatusLegendWithOptions(useText bool) string

StatusLegendWithOptions returns a markdown table explaining the status icons. If useText is true, shows ASCII text icons instead of emoji.

func ToJSON

func ToJSON(v interface{}) (string, error)

ToJSON converts a view to JSON string.

func ValidateSectionOrder added in v0.8.0

func ValidateSectionOrder(order []string) []string

ValidateSectionOrder checks if all section IDs in the order are valid. Returns a list of invalid section IDs.

func ValidateTag

func ValidateTag(tag string) error

ValidateTag checks if a tag follows kebab-case conventions. Valid tags are lowercase alphanumeric with single hyphens between segments.

func ValidateTags

func ValidateTags(tags []string) []error

ValidateTags checks multiple tags and returns all validation errors.

Types

type APIEndpoint added in v0.7.0

type APIEndpoint struct {
	ID          string   `json:"id,omitempty"`
	Method      string   `json:"method"`
	Path        string   `json:"path"`
	Description string   `json:"description,omitempty"`
	RequestBody string   `json:"requestBody,omitempty"`
	Response    string   `json:"response,omitempty"`
	Auth        string   `json:"auth,omitempty"`
	Tags        []string `json:"tags,omitempty"`
}

APIEndpoint represents a single API endpoint.

type APISpec added in v0.7.0

type APISpec struct {
	ID           string        `json:"id,omitempty"`
	ServiceID    string        `json:"serviceId,omitempty"`
	Name         string        `json:"name"`
	Protocol     Protocol      `json:"protocol"`
	BasePath     string        `json:"basePath,omitempty"`
	Version      string        `json:"version,omitempty"`
	Description  string        `json:"description,omitempty"`
	Endpoints    []APIEndpoint `json:"endpoints,omitempty"`
	OpenAPISpec  string        `json:"openApiSpec,omitempty"`
	ProtobufSpec string        `json:"protobufSpec,omitempty"`
}

APISpec represents an API specification for a service.

type AcceptanceCriterion

type AcceptanceCriterion struct {
	ID          string `json:"id"`
	Description string `json:"description"`
	Given       string `json:"given,omitempty"` // Precondition
	When        string `json:"when,omitempty"`  // Action
	Then        string `json:"then,omitempty"`  // Expected result
}

AcceptanceCriterion defines a testable condition for a user story.

type AccessControl

type AccessControl struct {
	// Model is the access control model (RBAC, ABAC, ReBAC, etc.).
	Model string `json:"model"`

	// Description provides details on the access control approach.
	Description string `json:"description,omitempty"`

	// Layers describes access control at different layers.
	Layers []AccessControlLayer `json:"layers,omitempty"`

	// Roles defines available roles and permissions.
	Roles []SecurityRole `json:"roles,omitempty"`

	// Policies describes policy enforcement (e.g., Cedar, OPA).
	Policies string `json:"policies,omitempty"`
}

AccessControl defines access control strategy.

type AccessControlLayer

type AccessControlLayer struct {
	// Layer name (e.g., "API Gateway", "Application", "Data").
	Layer string `json:"layer"`

	// Controls implemented at this layer.
	Controls []string `json:"controls"`

	// Description provides additional context.
	Description string `json:"description,omitempty"`
}

AccessControlLayer describes access control at a specific layer.

type AccessibilitySpec

type AccessibilitySpec struct {
	Standard        string   `json:"standard"` // WCAG 2.1 AA
	Requirements    []string `json:"requirements,omitempty"`
	TestingApproach string   `json:"testingApproach,omitempty"`
}

AccessibilitySpec defines accessibility requirements.

type AlertingSpec

type AlertingSpec struct {
	Channels          []string `json:"channels"` // PagerDuty, Slack, Email
	EscalationPolicy  string   `json:"escalationPolicy,omitempty"`
	OnCallIntegration bool     `json:"onCallIntegration,omitempty"`
}

AlertingSpec defines alerting requirements.

type Alternative

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

	// Name is the name of the alternative.
	Name string `json:"name"`

	// Type categorizes the alternative.
	Type AlternativeType `json:"type"`

	// Description provides details about the alternative.
	Description string `json:"description,omitempty"`

	// Strengths are advantages of this alternative.
	Strengths []string `json:"strengths,omitempty"`

	// Weaknesses are disadvantages of this alternative.
	Weaknesses []string `json:"weaknesses,omitempty"`

	// WhyNotChosen explains why this alternative was not selected.
	WhyNotChosen string `json:"whyNotChosen,omitempty"`
}

Alternative represents a competing product or alternative approach.

type AlternativeSnapshot

type AlternativeSnapshot struct {
	Name       string   `json:"name"`
	Weaknesses []string `json:"weaknesses"`
}

AlternativeSnapshot describes current alternatives/workarounds.

type AlternativeType

type AlternativeType string

AlternativeType categorizes alternatives.

const (
	// AlternativeCompetitor is a competing product.
	AlternativeCompetitor AlternativeType = "competitor"

	// AlternativeWorkaround is a manual or existing workaround.
	AlternativeWorkaround AlternativeType = "workaround"

	// AlternativeDoNothing represents the option to not address the problem.
	AlternativeDoNothing AlternativeType = "do_nothing"

	// AlternativeInternalTool is an existing internal solution.
	AlternativeInternalTool AlternativeType = "internal_tool"
)

type Appendix

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

	// Title is the appendix title.
	Title string `json:"title"`

	// Description provides context for this appendix.
	Description string `json:"description,omitempty"`

	// Type indicates the primary content type (hint for rendering).
	Type AppendixType `json:"type"`

	// ContentString is Markdown text content.
	// Rendered before ContentTable if both are set.
	ContentString string `json:"contentString,omitempty"`

	// ContentTable is structured table data.
	// Rendered after ContentString if both are set.
	ContentTable *AppendixTable `json:"contentTable,omitempty"`

	// Schema is the standard schema type (for validation and rendering hints).
	Schema AppendixSchema `json:"schema,omitempty"`

	// Tags for filtering and categorization.
	Tags []string `json:"tags,omitempty"`

	// ReferencedBy lists IDs of items that reference this appendix.
	// This is typically computed, not manually set.
	ReferencedBy []string `json:"referencedBy,omitempty"`
}

Appendix represents a single appendix section. Content can be provided via ContentString, ContentTable, or both. When both are set, ContentString is rendered before ContentTable.

func NewCodeAppendix

func NewCodeAppendix(id, title, description, code string) Appendix

NewCodeAppendix creates a new code appendix.

func NewReferenceAppendix

func NewReferenceAppendix(id, title, description, references string) Appendix

NewReferenceAppendix creates a new reference appendix for links and citations.

func NewTableAppendix

func NewTableAppendix(id, title, description string, headers []string) Appendix

NewTableAppendix creates a new table appendix with custom headers.

func NewTextAppendix

func NewTextAppendix(id, title, description, content string) Appendix

NewTextAppendix creates a new text/markdown appendix.

type AppendixSchema

type AppendixSchema string

AppendixSchema identifies the schema type for appendices. This field can be used for validation hints or future plugin-based rendering. For now, use "custom" or any descriptive string for your use case.

const (
	// AppendixSchemaCustom is a custom/unstructured appendix (default).
	AppendixSchemaCustom AppendixSchema = "custom"
)

type AppendixTable

type AppendixTable struct {
	// Headers are column headers.
	Headers []string `json:"headers,omitempty"`

	// Rows are table rows.
	Rows [][]string `json:"rows"`

	// Caption provides optional table description/footer.
	Caption string `json:"caption,omitempty"`
}

AppendixTable represents tabular data.

type AppendixType

type AppendixType string

AppendixType indicates the primary content type.

const (
	// AppendixTypeTable uses ContentTable for structured data.
	AppendixTypeTable AppendixType = "table"

	// AppendixTypeText uses ContentString for free-form text/markdown.
	AppendixTypeText AppendixType = "text"

	// AppendixTypeCode uses ContentString for code blocks.
	AppendixTypeCode AppendixType = "code"

	// AppendixTypeReference uses ContentString for reference links.
	AppendixTypeReference AppendixType = "reference"

	// AppendixTypeDiagram uses ContentString for diagram references or embedded diagrams.
	AppendixTypeDiagram AppendixType = "diagram"
)

type Approver

type Approver = common.Approver

Approver is an alias for common.Approver for backwards compatibility.

type Assumption

type Assumption = common.Assumption

Assumption represents a condition assumed to be true.

type AssumptionsConstraints

type AssumptionsConstraints struct {
	Assumptions  []Assumption `json:"assumptions"`
	Constraints  []Constraint `json:"constraints"`
	Dependencies []Dependency `json:"dependencies,omitempty"`
}

AssumptionsConstraints contains assumptions and constraints.

type AuditLogging

type AuditLogging struct {
	// Scope describes what is logged.
	Scope string `json:"scope"`

	// Events lists specific events that are logged.
	Events []string `json:"events,omitempty"`

	// Format is the log format (e.g., "OCSF", "JSON", "CEF").
	Format string `json:"format,omitempty"`

	// Retention is how long logs are retained.
	Retention string `json:"retention"`

	// Immutability describes tamper-proofing approach.
	Immutability string `json:"immutability,omitempty"`

	// Destination is where logs are stored.
	Destination string `json:"destination,omitempty"`
}

AuditLogging defines audit logging requirements.

type BaselineMetric

type BaselineMetric struct {
	// ID is the unique identifier for this metric.
	ID string `json:"id,omitempty"`

	// Name of the metric.
	Name string `json:"name"`

	// CurrentValue is the baseline value.
	CurrentValue string `json:"currentValue"`

	// TargetValue is the desired value after implementation.
	TargetValue string `json:"targetValue,omitempty"`

	// MeasurementMethod describes how this is measured.
	MeasurementMethod string `json:"measurementMethod,omitempty"`

	// Source is where the current value was obtained.
	Source string `json:"source,omitempty"`
}

BaselineMetric provides current state metrics for comparison.

type Blocker

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

	// Category is the scoring category related to this blocker.
	Category string `json:"category"`

	// Description describes the blocking issue.
	Description string `json:"description"`
}

Blocker represents an issue that blocks PRD approval.

type CategoryScore

type CategoryScore struct {
	Category       string  `json:"category"`
	Weight         float64 `json:"weight"`
	Score          float64 `json:"score"`
	MaxScore       float64 `json:"maxScore"`
	Justification  string  `json:"justification"`
	Evidence       string  `json:"evidence"`
	BelowThreshold bool    `json:"belowThreshold"`
}

CategoryScore represents a score for a single category.

type CategoryWeight

type CategoryWeight struct {
	Category string
	Weight   float64
}

CategoryWeight defines the weight for each scoring category.

func DefaultWeights

func DefaultWeights() []CategoryWeight

DefaultWeights returns the standard category weights. Weights sum to 1.0.

type CompletenessReport

type CompletenessReport struct {
	OverallScore     float64          `json:"overallScore"`     // 0-100
	Grade            string           `json:"grade"`            // A, B, C, D, F
	Sections         []SectionScore   `json:"sections"`         // Per-section scores
	Recommendations  []Recommendation `json:"recommendations"`  // Improvement suggestions
	Summary          string           `json:"summary"`          // Human-readable summary
	RequiredComplete int              `json:"requiredComplete"` // Count of complete required sections
	RequiredTotal    int              `json:"requiredTotal"`    // Total required sections
	OptionalComplete int              `json:"optionalComplete"` // Count of complete optional sections
	OptionalTotal    int              `json:"optionalTotal"`    // Total optional sections
}

CompletenessReport contains the results of a PRD completeness check.

func (*CompletenessReport) FormatReport

func (r *CompletenessReport) FormatReport() string

FormatReport returns a human-readable string representation of the report.

type Constraint

type Constraint = common.Constraint

Constraint represents a limitation on the project.

type ConstraintType

type ConstraintType = common.ConstraintType

ConstraintType represents types of constraints.

type CurrentApproach

type CurrentApproach struct {
	// ID is the unique identifier for this approach.
	ID string `json:"id,omitempty"`

	// Name is the identifier for this approach.
	Name string `json:"name"`

	// Description explains how this approach works.
	Description string `json:"description"`

	// Problems lists issues with this approach.
	Problems []string `json:"problems,omitempty"`

	// Usage indicates adoption level (e.g., "80% of customers").
	Usage string `json:"usage,omitempty"`

	// Owner is the team/person responsible for this approach.
	Owner string `json:"owner,omitempty"`
}

CurrentApproach describes an existing approach or solution.

type CurrentProblem

type CurrentProblem struct {
	// ID is the unique identifier for this problem.
	ID string `json:"id,omitempty"`

	// Description of the problem.
	Description string `json:"description"`

	// Impact on users or business.
	Impact string `json:"impact,omitempty"`

	// Frequency of occurrence.
	Frequency string `json:"frequency,omitempty"`

	// AffectedUsers describes who is impacted.
	AffectedUsers string `json:"affectedUsers,omitempty"`

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

CurrentProblem describes a specific problem with the current state.

type CurrentState

type CurrentState struct {
	// Overview provides a high-level summary of the current state.
	Overview string `json:"overview"`

	// Approaches describes current approaches/solutions in use.
	Approaches []CurrentApproach `json:"approaches,omitempty"`

	// Problems lists specific problems with the current state.
	Problems []CurrentProblem `json:"problems,omitempty"`

	// TargetState describes the desired future state.
	TargetState string `json:"targetState"`

	// Metrics provides baseline metrics for comparison.
	Metrics []BaselineMetric `json:"metrics,omitempty"`

	// Diagrams provides links to architecture or flow diagrams.
	Diagrams []DiagramRef `json:"diagrams,omitempty"`
}

CurrentState documents the existing state before the proposed solution.

type CustomSection

type CustomSection = common.CustomSection

CustomSection allows project-specific sections.

type CustomerProblemSection

type CustomerProblemSection struct {
	Statement           string                `json:"statement"`
	Impact              string                `json:"impact"`
	Personas            []PersonaSnapshot     `json:"personas"`
	CurrentAlternatives []AlternativeSnapshot `json:"currentAlternatives"`
	Evidence            []EvidenceSnapshot    `json:"evidence,omitempty"`
}

CustomerProblemSection describes the user pain points.

type DataClassification

type DataClassification struct {
	// Level is the classification level (e.g., "public", "internal", "confidential", "restricted").
	Level string `json:"level"`

	// Description explains this classification level.
	Description string `json:"description"`

	// Examples of data at this level.
	Examples []string `json:"examples,omitempty"`

	// Handling requirements for this level.
	Handling string `json:"handling,omitempty"`
}

DataClassification defines data sensitivity classification.

type DataSegregation

type DataSegregation string

DataSegregation represents database isolation levels.

const (
	DataSharedSchema      DataSegregation = "shared_schema"       // Single schema with tenant ID
	DataSchemaPerTenant   DataSegregation = "schema_per_tenant"   // Separate schema per tenant
	DataDatabasePerTenant DataSegregation = "database_per_tenant" // Separate database per tenant
)

type DecisionRecord

type DecisionRecord = common.DecisionRecord

DecisionRecord documents a completed decision.

type DecisionStatus

type DecisionStatus = common.DecisionStatus

DecisionStatus represents the status of a decision.

type DecisionsDefinition

type DecisionsDefinition struct {
	// Records are the decision records.
	Records []DecisionRecord `json:"records,omitempty"`
}

DecisionsDefinition contains decision records for the PRD.

type Deliverable

type Deliverable = roadmap.Deliverable

Deliverable represents a phase deliverable.

type DeliverableStatus

type DeliverableStatus = roadmap.DeliverableStatus

DeliverableStatus represents the status of a deliverable.

type DeliverableType

type DeliverableType = roadmap.DeliverableType

DeliverableType represents types of deliverables.

type Demographics

type Demographics struct {
	AgeRange    string `json:"ageRange,omitempty"`
	Location    string `json:"location,omitempty"`
	Industry    string `json:"industry,omitempty"`
	CompanySize string `json:"companySize,omitempty"`
	Experience  string `json:"experience,omitempty"` // Years of experience
}

Demographics contains optional demographic information.

type Dependency

type Dependency struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
	Type        string `json:"type,omitempty"` // API, Service, Team, Vendor
	Owner       string `json:"owner,omitempty"`
	Status      string `json:"status,omitempty"` // Available, Pending, Blocked
	DueDate     string `json:"dueDate,omitempty"`
}

Dependency represents an external dependency.

type DiagramRef

type DiagramRef struct {
	// Title is the diagram title.
	Title string `json:"title"`

	// URL is the link to the diagram.
	URL string `json:"url"`

	// Description provides context.
	Description string `json:"description,omitempty"`

	// Type is the diagram type (e.g., "architecture", "flow", "sequence").
	Type string `json:"type,omitempty"`
}

DiagramRef references a diagram or visual.

type Document

type Document struct {
	Metadata         Metadata         `json:"metadata"`
	ExecutiveSummary ExecutiveSummary `json:"executiveSummary"`
	Objectives       Objectives       `json:"objectives"`
	Personas         []Persona        `json:"personas"`
	UserStories      []UserStory      `json:"userStories"`
	Requirements     Requirements     `json:"requirements"`
	Roadmap          Roadmap          `json:"roadmap"`

	// ProductGoals contains the product goals using the framework-agnostic Goals wrapper.
	// This supports either OKR or V2MOM frameworks. When set, this takes precedence
	// over the legacy Objectives field for roadmap rendering and other goal-related features.
	ProductGoals *Goals `json:"productGoals,omitempty"`

	// Optional sections
	Assumptions      *AssumptionsConstraints `json:"assumptions,omitempty"`
	InScope          []string                `json:"inScope,omitempty"`
	OutOfScope       []string                `json:"outOfScope,omitempty"`
	TechArchitecture *TechnicalArchitecture  `json:"technicalArchitecture,omitempty"`

	// RelatedDocuments lists related requirements documents.
	RelatedDocuments []RelatedDocument `json:"relatedDocuments,omitempty"`
	UXRequirements   *UXRequirements   `json:"uxRequirements,omitempty"`
	Risks            []Risk            `json:"risks,omitempty"`
	Glossary         []GlossaryTerm    `json:"glossary,omitempty"`

	// Custom sections for project-specific needs
	CustomSections []CustomSection `json:"customSections,omitempty"`

	// Problem provides detailed problem definition with evidence.
	Problem *ProblemDefinition `json:"problem,omitempty"`

	// Market contains market analysis and competitive landscape.
	Market *MarketDefinition `json:"market,omitempty"`

	// Solution contains solution options and selection rationale.
	Solution *SolutionDefinition `json:"solution,omitempty"`

	// Decisions contains decision records for the PRD.
	Decisions *DecisionsDefinition `json:"decisions,omitempty"`

	// OpenItems contains pending decisions that need resolution.
	OpenItems []OpenItem `json:"openItems,omitempty"`

	// Reviews contains review outcomes and quality assessments.
	Reviews *ReviewsDefinition `json:"reviews,omitempty"`

	// RevisionHistory tracks changes to the PRD over time.
	RevisionHistory []RevisionRecord `json:"revisionHistory,omitempty"`

	// Goals contains alignment with strategic goals (V2MOM, OKR).
	Goals *GoalsAlignment `json:"goals,omitempty"`

	// CurrentState documents the existing state before the proposed solution.
	CurrentState *CurrentState `json:"currentState,omitempty"`

	// SecurityModel documents security architecture and threat model.
	// This section is strongly recommended for all PRDs.
	SecurityModel *SecurityModel `json:"securityModel,omitempty"`

	// Appendices contains supplementary information and domain-specific data.
	Appendices []Appendix `json:"appendices,omitempty"`

	// NonGoals contains structured non-goals with rationale.
	// More structured than OutOfScope for explicit exclusions.
	NonGoals []NonGoal `json:"nonGoals,omitempty"`

	// SuccessMetrics contains structured success metrics organized by type.
	SuccessMetrics *SuccessMetrics `json:"successMetrics,omitempty"`
}

Document represents a complete Product Requirements Document.

func Load

func Load(path string) (*Document, error)

Load reads a Document from a JSON file.

func New

func New(id, title string, authors ...Person) *Document

New creates a new Document with required fields initialized.

func (*Document) AddRevision

func (doc *Document) AddRevision(changes []string, trigger RevisionTriggerType, author string)

AddRevision records a revision in the Document history.

func (*Document) CheckCompleteness

func (d *Document) CheckCompleteness() CompletenessReport

CheckCompleteness analyzes the PRD and returns a completeness report.

func (Document) FilterByTags

func (d Document) FilterByTags(tags ...string) Document

FilterByTags returns a new Document containing only entities that have at least one of the specified tags (OR logic). If no tags are provided, returns a copy of the original document. Metadata tags are always preserved.

func (Document) FilterByTagsAll

func (d Document) FilterByTagsAll(tags ...string) Document

FilterByTagsAll returns a new Document containing only entities that have ALL of the specified tags (AND logic). If no tags are provided, returns a copy of the original document.

func (*Document) GetActiveSections added in v0.8.0

func (d *Document) GetActiveSections() []SectionID

GetActiveSections returns only sections that have content, in order.

func (*Document) GetProductGoals

func (d *Document) GetProductGoals() *Goals

GetProductGoals returns the product goals, preferring ProductGoals if set, otherwise converting legacy Objectives to Goals format. This enables framework-agnostic rendering in roadmaps and other sections.

func (*Document) GetSectionOrder added in v0.8.0

func (d *Document) GetSectionOrder() []SectionID

GetSectionOrder returns the effective section order for this document. Priority: 1) Custom SectionOrder, 2) PRDType template, 3) DefaultSectionOrder

func (*Document) HasProductGoals

func (d *Document) HasProductGoals() bool

HasProductGoals returns true if the document has product goals defined (either in ProductGoals or legacy Objectives).

func (*Document) HasSection added in v0.8.0

func (d *Document) HasSection(id SectionID) bool

HasSection returns true if the document has content for the given section.

func (*Document) ToJSON

func (doc *Document) ToJSON() (string, error)

ToJSON converts the Document to JSON string.

func (*Document) ToMarkdown

func (d *Document) ToMarkdown(opts MarkdownOptions) string

ToMarkdown converts a PRD Document to markdown format.

func (*Document) ToSwimlaneTableWithGoals

func (d *Document) ToSwimlaneTableWithGoals(opts RoadmapTableOptions) string

ToSwimlaneTableWithGoals generates a markdown table with phases as columns, deliverable types as swimlane rows, and goal swimlanes auto-derived from PhaseTargets. This method supports both OKR and V2MOM frameworks via the Goals abstraction.

Labels are dynamic based on the framework:

  • OKR: "Objectives" and "Key Results"
  • V2MOM: "Methods" and "Measures"

Example output:

| Swimlane       | **Phase 1**<br>Q1 2026 | **Phase 2**<br>Q2 2026 |
|----------------|------------------------|------------------------|
| Features       | • Auth<br>• Dashboard  | • Reporting            |
| Objectives     | • O1: Market leader    |                        |
| Key Results    | • KR1.1: Share → 15%   | • KR1.1: Share → 20%   |

func (*Document) ToSwimlaneTableWithOKRs

func (d *Document) ToSwimlaneTableWithOKRs(opts RoadmapTableOptions) string

ToSwimlaneTableWithOKRs generates a markdown table with phases as columns, deliverable types as swimlane rows, and OKR swimlanes auto-derived from PhaseTargets. Deprecated: Use ToSwimlaneTableWithGoals for framework-agnostic goal support.

type DocumentType added in v0.7.0

type DocumentType string

DocumentType represents types of related documents.

const (
	DocTypePRD       DocumentType = "prd"
	DocTypeTRD       DocumentType = "trd"
	DocTypeMRD       DocumentType = "mrd"
	DocTypeDesignDoc DocumentType = "design-doc"
	DocTypeRFC       DocumentType = "rfc"
)

type EffortLevel

type EffortLevel = common.EffortLevel

EffortLevel represents effort estimates.

type EncryptionModel

type EncryptionModel string

EncryptionModel represents cryptographic isolation levels.

const (
	EncryptionSharedKeys     EncryptionModel = "shared_keys"
	EncryptionTenantSpecific EncryptionModel = "tenant_specific_keys"
	EncryptionBYOK           EncryptionModel = "byok" // Bring Your Own Key
)

type EncryptionRequirements

type EncryptionRequirements struct {
	// AtRest describes encryption at rest.
	AtRest EncryptionSpec `json:"atRest"`

	// InTransit describes encryption in transit.
	InTransit EncryptionSpec `json:"inTransit"`

	// FieldLevel describes field-level encryption if applicable.
	FieldLevel *EncryptionSpec `json:"fieldLevel,omitempty"`
}

EncryptionRequirements specifies encryption requirements.

type EncryptionSpec

type EncryptionSpec struct {
	// Method is the encryption method (e.g., "AES-256-GCM").
	Method string `json:"method"`

	// KeyManagement describes key management approach.
	KeyManagement string `json:"keyManagement"`

	// Rotation describes key rotation policy.
	Rotation string `json:"rotation,omitempty"`

	// Provider is the encryption provider (e.g., "AWS KMS", "HashiCorp Vault").
	Provider string `json:"provider,omitempty"`
}

EncryptionSpec describes encryption configuration.

type EvaluationCategory

type EvaluationCategory struct {
	ID          string  // Category identifier
	Name        string  // Human-readable name
	Description string  // What this category evaluates
	Weight      float64 // Weight in overall score (0.0-1.0)
	Owner       string  // Suggested agent/team owner
}

EvaluationCategory defines metadata for a PRD evaluation category.

func GetCategoriesFromDocument

func GetCategoriesFromDocument(doc *Document) []EvaluationCategory

GetCategoriesFromDocument extracts the list of categories that should be evaluated based on what's present in the document. This includes standard categories and any custom sections defined in the PRD.

func StandardCategories

func StandardCategories() []EvaluationCategory

StandardCategories returns the standard PRD evaluation categories. These match the sections defined in the PRD schema.

type Evidence

type Evidence struct {
	// Type categorizes the evidence source.
	Type EvidenceType `json:"type"`

	// Source identifies where the evidence came from.
	Source string `json:"source"`

	// Summary describes what the evidence shows.
	Summary string `json:"summary,omitempty"`

	// SampleSize is the number of data points (for quantitative evidence).
	SampleSize int `json:"sampleSize,omitempty"`

	// Strength indicates how strong the evidence is.
	Strength EvidenceStrength `json:"strength,omitempty"`

	// Date is when the evidence was collected.
	Date string `json:"date,omitempty"`
}

Evidence supports a problem statement or claim.

type EvidenceSnapshot

type EvidenceSnapshot struct {
	Type        string `json:"type"`
	Description string `json:"description"`
	Strength    string `json:"strength"`
}

EvidenceSnapshot is a brief evidence summary.

type EvidenceStrength

type EvidenceStrength string

EvidenceStrength indicates how strong evidence is.

const (
	// StrengthLow indicates weak evidence.
	StrengthLow EvidenceStrength = "low"

	// StrengthMedium indicates moderate evidence.
	StrengthMedium EvidenceStrength = "medium"

	// StrengthHigh indicates strong evidence.
	StrengthHigh EvidenceStrength = "high"
)

type EvidenceType

type EvidenceType string

EvidenceType categorizes evidence sources.

const (
	// EvidenceInterview is from user interviews.
	EvidenceInterview EvidenceType = "interview"

	// EvidenceSurvey is from user surveys.
	EvidenceSurvey EvidenceType = "survey"

	// EvidenceAnalytics is from product analytics.
	EvidenceAnalytics EvidenceType = "analytics"

	// EvidenceSupportTicket is from support tickets.
	EvidenceSupportTicket EvidenceType = "support_ticket"

	// EvidenceMarketResearch is from market research.
	EvidenceMarketResearch EvidenceType = "market_research"

	// EvidenceAssumption is an assumption (not validated).
	EvidenceAssumption EvidenceType = "assumption"
)

type ExecAction

type ExecAction struct {
	Action    string `json:"action"`
	Owner     string `json:"owner"`
	Priority  string `json:"priority"`
	Rationale string `json:"rationale"`
}

ExecAction represents a required action.

type ExecHeader

type ExecHeader struct {
	PRDID           string  `json:"prdId"`
	Title           string  `json:"title"`
	OverallDecision string  `json:"overallDecision"`
	ConfidenceLevel string  `json:"confidenceLevel"`
	OverallScore    float64 `json:"overallScore"`
}

ExecHeader contains high-level decision info.

type ExecRisk

type ExecRisk struct {
	Risk       string `json:"risk"`
	Impact     string `json:"impact"`
	Mitigation string `json:"mitigation"`
	Confidence string `json:"confidence"`
}

ExecRisk is a high-level risk summary.

type ExecView

type ExecView struct {
	Header                ExecHeader   `json:"header"`
	Strengths             []string     `json:"strengths"`
	Blockers              []string     `json:"blockers"`
	RequiredActions       []ExecAction `json:"requiredActions"`
	TopRisks              []ExecRisk   `json:"topRisks"`
	RecommendationSummary string       `json:"recommendationSummary"`
}

ExecView represents the Executive view of a PRD.

func GenerateExecView

func GenerateExecView(doc *Document, scores *ScoringResult) *ExecView

GenerateExecView creates an executive-friendly view of the Document.

type ExecutiveSummary

type ExecutiveSummary struct {
	ProblemStatement string   `json:"problemStatement"`
	ProposedSolution string   `json:"proposedSolution"`
	ExpectedOutcomes []string `json:"expectedOutcomes"`
	TargetAudience   string   `json:"targetAudience,omitempty"`
	ValueProposition string   `json:"valueProposition,omitempty"`
}

ExecutiveSummary provides high-level product overview.

type FAQ

type FAQ struct {
	Question string `json:"question"`
	Answer   string `json:"answer"`
}

FAQ represents a question and answer pair.

type FAQSection

type FAQSection struct {
	CustomerFAQs  []FAQ `json:"customerFaqs"`
	InternalFAQs  []FAQ `json:"internalFaqs"`
	TechnicalFAQs []FAQ `json:"technicalFaqs,omitempty"`
}

FAQSection contains anticipated questions and answers.

type FeatureSnapshot

type FeatureSnapshot struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Priority    string `json:"priority"`
}

FeatureSnapshot is a brief feature summary.

type Framework

type Framework = goals.Framework

Framework identifies the goal-setting framework in use.

type FunctionalRequirement

type FunctionalRequirement struct {
	ID                 string                `json:"id"` // e.g., FR-001
	Title              string                `json:"title"`
	Description        string                `json:"description"`
	Category           string                `json:"category"` // Feature category
	Priority           MoSCoW                `json:"priority"`
	UserStoryIDs       []string              `json:"userStoryIds"` // Related user stories
	AcceptanceCriteria []AcceptanceCriterion `json:"acceptanceCriteria"`
	PhaseID            string                `json:"phaseId"` // Target roadmap phase
	Dependencies       []string              `json:"dependencies,omitempty"`
	Assumptions        []string              `json:"assumptions,omitempty"`
	Tags               []string              `json:"tags,omitempty"` // For filtering by topic/domain
	Notes              string                `json:"notes,omitempty"`

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

FunctionalRequirement represents a functional requirement.

type GitOpsConfig added in v0.7.0

type GitOpsConfig struct {
	Enabled        bool            `json:"enabled"`
	Provider       string          `json:"provider,omitempty"`
	Workflow       string          `json:"workflow,omitempty"`
	SourcesOfTruth []SourceOfTruth `json:"sourcesOfTruth,omitempty"`
}

GitOpsConfig defines GitOps integration.

type GlossaryTerm

type GlossaryTerm = common.GlossaryTerm

GlossaryTerm defines a glossary entry.

type GoalItem

type GoalItem = goals.GoalItem

GoalItem represents a high-level goal (Objective or Method).

type GoalReference

type GoalReference struct {
	// ID is the unique identifier of the goals document.
	ID string `json:"id"`

	// Path is the file path to the goals document.
	Path string `json:"path,omitempty"`

	// URL is a URL to the goals document (e.g., Confluence, Notion).
	URL string `json:"url,omitempty"`

	// Version is the version of the goals document this PRD aligns with.
	Version string `json:"version,omitempty"`
}

GoalReference represents a reference to an external goals document.

type Goals

type Goals = goals.Goals

Goals is a framework-agnostic container for organizational goals.

type GoalsAlignment

type GoalsAlignment struct {
	// V2MOMRef is a reference to an external V2MOM document.
	V2MOMRef *GoalReference `json:"v2mom_ref,omitempty"`

	// V2MOM is an embedded V2MOM document.
	V2MOM *v2mom.V2MOM `json:"v2mom,omitempty"`

	// OKRRef is a reference to an external OKR document.
	OKRRef *GoalReference `json:"okrRef,omitempty"`

	// OKR is an embedded OKR document.
	OKR *okr.OKRDocument `json:"okr,omitempty"`

	// AlignedObjectives maps PRD objectives to goal IDs.
	// Key is the PRD objective ID, value is the goal/method/objective ID.
	AlignedObjectives map[string]string `json:"alignedObjectives,omitempty"`
}

GoalsAlignment represents alignment with strategic goals. This allows a PRD to reference or embed goals from the structured-goals package.

func (*GoalsAlignment) GetV2MOMMethodIDs

func (g *GoalsAlignment) GetV2MOMMethodIDs() []string

GetV2MOMMethodIDs returns the IDs of all V2MOM methods referenced by this PRD.

func (*GoalsAlignment) HasOKR

func (g *GoalsAlignment) HasOKR() bool

HasOKR returns true if OKR alignment is configured (ref or embedded).

func (*GoalsAlignment) HasV2MOM

func (g *GoalsAlignment) HasV2MOM() bool

HasV2MOM returns true if V2MOM alignment is configured (ref or embedded).

type Integration

type Integration struct {
	ID            string `json:"id"`
	Name          string `json:"name"`
	Type          string `json:"type"` // REST API, GraphQL, Event, Database
	Description   string `json:"description"`
	Protocol      string `json:"protocol,omitempty"`
	AuthMethod    string `json:"authMethod,omitempty"`
	DataFormat    string `json:"dataFormat,omitempty"` // JSON, XML, Protobuf
	RateLimit     string `json:"rateLimit,omitempty"`
	Documentation string `json:"documentation,omitempty"` // URL to docs
}

Integration represents an external integration point.

type InteractionFlow

type InteractionFlow struct {
	ID          string   `json:"id"`
	Title       string   `json:"title"`
	Description string   `json:"description"`
	Steps       []string `json:"steps"`
	DiagramURL  string   `json:"diagramUrl,omitempty"`
}

InteractionFlow represents a user interaction flow.

type IsolationModel

type IsolationModel string

IsolationModel represents tenant isolation strategies.

const (
	IsolationPool   IsolationModel = "pool"   // Shared resources
	IsolationSilo   IsolationModel = "silo"   // Dedicated resources
	IsolationBridge IsolationModel = "bridge" // Hybrid approach
)

type KeyResult

type KeyResult = okr.KeyResult

KeyResult represents a measurable outcome that indicates objective achievement.

type LibraryMetadata

type LibraryMetadata struct {
	Name        string    `json:"name,omitempty"`
	Description string    `json:"description,omitempty"`
	CreatedAt   time.Time `json:"createdAt,omitempty"`
	UpdatedAt   time.Time `json:"updatedAt,omitempty"`
}

LibraryMetadata contains metadata about the persona library itself.

type LibraryPersona

type LibraryPersona struct {
	Persona
	CreatedAt   time.Time `json:"createdAt,omitempty"`
	UpdatedAt   time.Time `json:"updatedAt,omitempty"`
	UsedInPRDs  []string  `json:"usedInPrds,omitempty"`         // Track which PRDs use this persona
	Tags        []string  `json:"tags,omitempty"`               // For organization/filtering
	Description string    `json:"libraryDescription,omitempty"` // Additional context for library
}

LibraryPersona extends Persona with library-specific metadata.

func (*LibraryPersona) ToPersona

func (lp *LibraryPersona) ToPersona() Persona

ToPersona converts a LibraryPersona to a basic Persona (drops library metadata).

type LoggingSpec

type LoggingSpec struct {
	Format                string   `json:"format"`          // JSON, structured
	RetentionPeriod       string   `json:"retentionPeriod"` // e.g., "90 days"
	LogLevels             []string `json:"logLevels"`
	CorrelationID         bool     `json:"correlationId"` // Include trace/correlation IDs
	SensitiveDataHandling string   `json:"sensitiveDataHandling,omitempty"`
}

LoggingSpec defines logging requirements.

type MarkdownOptions

type MarkdownOptions struct {
	// IncludeFrontmatter adds YAML frontmatter for Pandoc
	IncludeFrontmatter bool
	// Margin sets the page margin (e.g., "2cm")
	Margin string
	// MainFont sets the main font family
	MainFont string
	// SansFont sets the sans-serif font family
	SansFont string
	// MonoFont sets the monospace font family
	MonoFont string
	// FontFamily sets the LaTeX font family (e.g., "helvet")
	FontFamily string
	// DescriptionMaxLen sets the max length for description fields in tables (default: 0, no limit)
	DescriptionMaxLen int
	// IncludeSwimlaneTable adds a swimlane view of the roadmap (phases as columns, deliverable types as rows)
	IncludeSwimlaneTable bool
	// RoadmapTableOptions configures the swimlane/roadmap table generation
	RoadmapTableOptions *RoadmapTableOptions
	// IncludeTOC adds a Table of Contents with internal links (default: true)
	IncludeTOC *bool
	// UseTextIcons uses ASCII text instead of emoji for status icons.
	// Enable this for Pandoc/LaTeX PDF generation compatibility.
	// This sets RoadmapTableOptions.UseTextIcons and affects open items rendering.
	UseTextIcons bool
}

MarkdownOptions configures markdown generation.

func DefaultMarkdownOptions

func DefaultMarkdownOptions() MarkdownOptions

DefaultMarkdownOptions returns sensible defaults for markdown generation. By default, no text truncation is applied (DescriptionMaxLen = 0). Default fonts work with standard pdflatex. For Unicode/emoji support, use --pdf-engine=xelatex with appropriate system fonts.

type MarketDefinition

type MarketDefinition struct {
	// Alternatives are competing products, workarounds, or alternative approaches.
	Alternatives []Alternative `json:"alternatives,omitempty"`

	// Differentiation describes how this solution differs from alternatives.
	Differentiation []string `json:"differentiation,omitempty"`

	// MarketRisks are risks related to market conditions or competition.
	MarketRisks []string `json:"marketRisks,omitempty"`
}

MarketDefinition contains market analysis and competitive landscape.

type Metadata

type Metadata struct {
	ID        string     `json:"id"`
	Title     string     `json:"title"`
	Version   string     `json:"version"`
	Status    Status     `json:"status"`
	CreatedAt time.Time  `json:"createdAt"`
	UpdatedAt time.Time  `json:"updatedAt"`
	Authors   []Person   `json:"authors"`
	Reviewers []Person   `json:"reviewers,omitempty"`
	Approvers []Approver `json:"approvers,omitempty"`
	Tags      []string   `json:"tags,omitempty"`

	// SemanticVersioning indicates the Version field follows Semantic Versioning (semver.org).
	SemanticVersioning bool `json:"semanticVersioning,omitempty"`

	// PRDType determines the section ordering template for markdown generation.
	// Options: "", "strategy", "feature", "technical"
	// If empty, uses default order for backward compatibility.
	PRDType PRDType `json:"prdType,omitempty"`

	// SectionOrder specifies a custom section order for markdown generation.
	// If provided, overrides the template order from PRDType.
	// Sections not listed are appended in template order.
	// Use section IDs like "executiveSummary", "problem", "market", etc.
	SectionOrder []string `json:"sectionOrder,omitempty"`
}

Metadata contains document metadata.

type Metric added in v0.8.0

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

	// Name is the name of this metric.
	Name string `json:"name"`

	// Description provides details about what this metric measures.
	Description string `json:"description,omitempty"`

	// Baseline is the current or starting value of this metric.
	Baseline string `json:"baseline,omitempty"`

	// Target is the goal value for this metric.
	Target string `json:"target"`

	// MeasurementMethod describes how this metric is measured.
	MeasurementMethod string `json:"measurementMethod,omitempty"`
}

Metric represents a measurable success metric.

type MetricSnapshot

type MetricSnapshot struct {
	Name        string `json:"name"`
	Target      string `json:"target"`
	Baseline    string `json:"baseline,omitempty"`
	Measurement string `json:"measurement,omitempty"`
}

MetricSnapshot is a brief metric summary.

type MetricsSpec

type MetricsSpec struct {
	Format             string   `json:"format"`             // Prometheus, OpenTelemetry
	CollectionInterval string   `json:"collectionInterval"` // e.g., "15s"
	RetentionPeriod    string   `json:"retentionPeriod"`
	CustomMetrics      []string `json:"customMetrics,omitempty"`
}

MetricsSpec defines metrics requirements.

type MetricsSummary

type MetricsSummary struct {
	Primary    string   `json:"primary,omitempty"`
	Supporting []string `json:"supporting,omitempty"`
	Guardrails []string `json:"guardrails,omitempty"`
}

MetricsSummary shows key metrics.

type MoSCoW

type MoSCoW string

MoSCoW represents the MoSCoW prioritization method.

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

type MultiTenancySpec

type MultiTenancySpec struct {
	IsolationModel          IsolationModel   `json:"isolationModel"`
	DataSegregation         DataSegregation  `json:"dataSegregation"`
	EncryptionModel         EncryptionModel  `json:"encryptionModel,omitempty"`
	NetworkIsolation        NetworkIsolation `json:"networkIsolation,omitempty"`
	NoisyNeighborProtection string           `json:"noisyNeighborProtection,omitempty"`
}

MultiTenancySpec defines multi-tenancy requirements.

type NFRCategory

type NFRCategory string

NFRCategory represents categories of non-functional requirements.

const (
	NFRPerformance      NFRCategory = "performance"
	NFRScalability      NFRCategory = "scalability"
	NFRReliability      NFRCategory = "reliability"
	NFRAvailability     NFRCategory = "availability"
	NFRSecurity         NFRCategory = "security"
	NFRMultiTenancy     NFRCategory = "multi_tenancy"
	NFRObservability    NFRCategory = "observability"
	NFRMaintainability  NFRCategory = "maintainability"
	NFRUsability        NFRCategory = "usability"
	NFRCompatibility    NFRCategory = "compatibility"
	NFRCompliance       NFRCategory = "compliance"
	NFRDisasterRecovery NFRCategory = "disaster_recovery"
	NFRCostEfficiency   NFRCategory = "cost_efficiency"
	NFRPortability      NFRCategory = "portability"
	NFRTestability      NFRCategory = "testability"
	NFRExtensibility    NFRCategory = "extensibility"
	NFRInteroperability NFRCategory = "interoperability"
	NFRLocalization     NFRCategory = "localization"
)

type NetworkIsolation

type NetworkIsolation string

NetworkIsolation represents network-level isolation.

const (
	NetworkShared             NetworkIsolation = "shared"
	NetworkVPCPerTenant       NetworkIsolation = "vpc_per_tenant"
	NetworkNamespaceIsolation NetworkIsolation = "namespace_isolation"
)

type NonFunctionalRequirement

type NonFunctionalRequirement struct {
	ID                string      `json:"id"` // e.g., NFR-001
	Category          NFRCategory `json:"category"`
	Title             string      `json:"title"`
	Description       string      `json:"description"`
	Metric            string      `json:"metric"` // What is measured
	Target            string      `json:"target"` // Target value (e.g., "P95 < 200ms")
	MeasurementMethod string      `json:"measurementMethod,omitempty"`
	Priority          MoSCoW      `json:"priority"`
	PhaseID           string      `json:"phaseId"`
	CurrentBaseline   string      `json:"currentBaseline,omitempty"`
	Notes             string      `json:"notes,omitempty"`

	// SLO-specific fields (for observability/reliability)
	SLO *SLOSpec `json:"slo,omitempty"`

	// Multi-tenancy specific fields
	MultiTenancy *MultiTenancySpec `json:"multiTenancy,omitempty"`

	// Security specific fields
	Security *SecuritySpec `json:"security,omitempty"`

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

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

NonFunctionalRequirement represents a non-functional requirement.

type NonGoal

type NonGoal = common.NonGoal

NonGoal represents an explicit out-of-scope item.

type OKR

type OKR = okr.OKR

OKR represents an Objective with its Key Results.

type Objective

type Objective = okr.Objective

Objective represents a qualitative, inspirational goal.

type Objectives

type Objectives struct {
	// OKRs contains Objectives and Key Results in nested OKR format.
	OKRs []OKR `json:"okrs"`
}

Objectives defines business and product goals using OKR structure. Deprecated: Use ProductGoals field with goals.Goals wrapper for new PRDs.

type ObservabilitySpec

type ObservabilitySpec struct {
	Logging    LoggingSpec  `json:"logging"`
	Metrics    MetricsSpec  `json:"metrics"`
	Tracing    TracingSpec  `json:"tracing"`
	Alerting   AlertingSpec `json:"alerting"`
	Dashboards []string     `json:"dashboards,omitempty"`
}

ObservabilitySpec defines observability requirements.

type OpenItem

type OpenItem = common.OpenItem

OpenItem represents a pending decision or question.

type OpenItemResolution

type OpenItemResolution = common.OpenItemResolution

OpenItemResolution documents how an open item was resolved.

type OpenItemStatus

type OpenItemStatus = common.OpenItemStatus

OpenItemStatus represents the status of an open item.

type Option

type Option = common.Option

Option represents one possible choice for an open item.

type OrchestrationConfig added in v0.7.0

type OrchestrationConfig struct {
	ShortLived  *OrchestrationEngine `json:"shortLived,omitempty"`
	LongRunning *OrchestrationEngine `json:"longRunning,omitempty"`
	Description string               `json:"description,omitempty"`
}

OrchestrationConfig defines workflow orchestration configuration.

type OrchestrationEngine added in v0.7.0

type OrchestrationEngine struct {
	Name      string   `json:"name"`
	UseCases  []string `json:"useCases,omitempty"`
	Language  string   `json:"language,omitempty"`
	Rationale string   `json:"rationale,omitempty"`
}

OrchestrationEngine represents a workflow orchestration engine.

type PMView

type PMView struct {
	Title          string           `json:"title"`
	Status         string           `json:"status"`
	Owner          string           `json:"owner"`
	Version        string           `json:"version"`
	ProblemSummary string           `json:"problemSummary"`
	Personas       []PersonaSummary `json:"personas"`
	Goals          []string         `json:"goals"`
	NonGoals       []string         `json:"nonGoals"`
	Solution       SolutionSummary  `json:"solution"`
	Requirements   RequirementsList `json:"requirements"`
	Metrics        MetricsSummary   `json:"metrics"`
	Risks          []RiskSummary    `json:"risks"`
	OpenQuestions  []string         `json:"openQuestions,omitempty"`
}

PMView represents the Product Manager view of a PRD.

func GeneratePMView

func GeneratePMView(doc *Document) *PMView

GeneratePMView creates a PM-friendly view of the Document.

type PRDType added in v0.8.0

type PRDType string

PRDType determines the section ordering template for markdown generation. This is distinct from DocumentType which categorizes related documents.

const (
	PRDTypeDefault   PRDType = ""          // Uses DefaultSectionOrder
	PRDTypeStrategy  PRDType = "strategy"  // Context-first ordering
	PRDTypeFeature   PRDType = "feature"   // User-needs-first ordering
	PRDTypeTechnical PRDType = "technical" // Architecture-focused ordering
)

type PRFAQView

type PRFAQView struct {
	// Metadata
	Title   string `json:"title"`
	Version string `json:"version"`
	Author  string `json:"author"`
	Date    string `json:"date"`
	PRDID   string `json:"prdId"`

	// The two main sections
	PressRelease PressReleaseSection `json:"pressRelease"`
	FAQ          FAQSection          `json:"faq"`
}

PRFAQView represents the Amazon-style PR/FAQ document format. This is a lighter-weight alternative to the full 6-pager, focusing on the press release and frequently asked questions.

func GeneratePRFAQView

func GeneratePRFAQView(doc *Document) *PRFAQView

GeneratePRFAQView creates an Amazon-style PR/FAQ view from a PRD. This reuses the press release and FAQ generation logic from the 6-pager.

type Person

type Person = common.Person

Person is an alias for common.Person for backwards compatibility.

type Persona

type Persona struct {
	ID                   string               `json:"id"`
	Name                 string               `json:"name"`                // e.g., "Developer Dan"
	Role                 string               `json:"role"`                // Job title
	Description          string               `json:"description"`         // Background and context
	Goals                []string             `json:"goals"`               // What they want to achieve
	PainPoints           []string             `json:"painPoints"`          // Current frustrations
	Behaviors            []string             `json:"behaviors,omitempty"` // Typical patterns
	TechnicalProficiency TechnicalProficiency `json:"technicalProficiency,omitempty"`
	Demographics         *Demographics        `json:"demographics,omitempty"`
	Motivations          []string             `json:"motivations,omitempty"`
	Frustrations         []string             `json:"frustrations,omitempty"`
	PreferredChannels    []string             `json:"preferredChannels,omitempty"` // How they prefer to interact
	Quote                string               `json:"quote,omitempty"`             // Representative quote
	ImageURL             string               `json:"imageUrl,omitempty"`
	IsPrimary            bool                 `json:"isPrimary,omitempty"`  // Is this the primary persona?
	LibraryRef           string               `json:"libraryRef,omitempty"` // Reference to persona in library (for tracking origin)
	Tags                 []string             `json:"tags,omitempty"`       // For filtering by topic/domain
}

Persona represents a user persona for the product.

type PersonaLibrary

type PersonaLibrary struct {
	SchemaVersion string           `json:"schemaVersion"`
	Personas      []LibraryPersona `json:"personas"`
	Metadata      LibraryMetadata  `json:"metadata,omitempty"`
}

PersonaLibrary manages reusable personas across documents.

func LoadPersonaLibrary

func LoadPersonaLibrary(path string) (*PersonaLibrary, error)

LoadPersonaLibrary reads a persona library from a JSON file.

func NewPersonaLibrary

func NewPersonaLibrary() *PersonaLibrary

NewPersonaLibrary creates a new empty persona library.

func (*PersonaLibrary) Add

func (lib *PersonaLibrary) Add(p Persona) (string, error)

Add adds a new persona to the library. Generates an ID if not provided. Returns the ID.

func (*PersonaLibrary) Count

func (lib *PersonaLibrary) Count() int

Count returns the number of personas in the library.

func (*PersonaLibrary) ExportAllFrom

func (lib *PersonaLibrary) ExportAllFrom(doc *Document) (added int, updated int, errs []error)

ExportAllFrom exports all personas from a document to the library. Returns the count of added and updated personas.

func (*PersonaLibrary) ExportFrom

func (lib *PersonaLibrary) ExportFrom(doc *Document, personaID string) (string, error)

ExportFrom exports a persona from a document to the library. If the persona already exists in the library (by ID), it's updated. If not, it's added as a new persona. Returns the library persona ID.

func (*PersonaLibrary) Get

func (lib *PersonaLibrary) Get(id string) *LibraryPersona

Get retrieves a persona by ID.

func (*PersonaLibrary) GetByName

func (lib *PersonaLibrary) GetByName(name string) *LibraryPersona

GetByName retrieves a persona by name (case-sensitive).

func (*PersonaLibrary) ImportTo

func (lib *PersonaLibrary) ImportTo(doc *Document, personaID string, isPrimary bool) error

ImportTo imports a persona from the library into a document. The persona is copied (not referenced) so the document is self-contained. Sets LibraryRef to track the origin.

func (*PersonaLibrary) List

func (lib *PersonaLibrary) List() []LibraryPersona

List returns all personas in the library.

func (*PersonaLibrary) ListByTag

func (lib *PersonaLibrary) ListByTag(tag string) []LibraryPersona

ListByTag returns personas matching a specific tag.

func (*PersonaLibrary) Remove

func (lib *PersonaLibrary) Remove(id string) error

Remove removes a persona from the library by ID.

func (*PersonaLibrary) Save

func (lib *PersonaLibrary) Save(path string) error

Save writes the persona library to a JSON file.

func (*PersonaLibrary) SyncFromLibrary

func (lib *PersonaLibrary) SyncFromLibrary(doc *Document) int

SyncFromLibrary updates all personas in a document with their latest library versions. Only updates personas that have a LibraryRef set. Returns the count of updated personas.

func (*PersonaLibrary) Update

func (lib *PersonaLibrary) Update(p Persona) error

Update updates an existing persona in the library.

type PersonaSnapshot

type PersonaSnapshot struct {
	Name       string   `json:"name"`
	Role       string   `json:"role"`
	PainPoints []string `json:"painPoints"`
}

PersonaSnapshot is a brief persona summary for the 6-pager.

type PersonaSummary

type PersonaSummary struct {
	Name       string   `json:"name"`
	Role       string   `json:"role"`
	PainPoints []string `json:"painPoints"`
	IsPrimary  bool     `json:"isPrimary"`
}

PersonaSummary is a condensed persona view.

type Phase

type Phase = roadmap.Phase

Phase represents a roadmap phase.

type PhaseSnapshot

type PhaseSnapshot struct {
	Name         string   `json:"name"`
	Description  string   `json:"description"`
	Deliverables []string `json:"deliverables"`
	Status       string   `json:"status,omitempty"`
}

PhaseSnapshot is a brief phase summary.

type PhaseStatus

type PhaseStatus = roadmap.PhaseStatus

PhaseStatus represents the current status of a phase.

type PhaseTarget

type PhaseTarget = okr.PhaseTarget

PhaseTarget represents a Key Result target for a specific roadmap phase.

type PhaseType

type PhaseType = roadmap.PhaseType

PhaseType represents the type of roadmap phase.

type PressReleaseSection

type PressReleaseSection struct {
	Headline      string   `json:"headline"`
	Subheadline   string   `json:"subheadline"`
	Summary       string   `json:"summary"`
	ProblemSolved string   `json:"problemSolved"`
	Solution      string   `json:"solution"`
	Quote         Quote    `json:"quote,omitempty"`
	CustomerQuote Quote    `json:"customerQuote,omitempty"`
	CallToAction  string   `json:"callToAction"`
	Benefits      []string `json:"benefits"`
}

PressReleaseSection is a future-dated announcement of the product.

type Priority

type Priority = common.Priority

Priority represents priority levels.

type ProblemDefinition

type ProblemDefinition struct {
	// ID is the unique identifier for this problem.
	ID string `json:"id,omitempty"`

	// Statement is the problem statement.
	Statement string `json:"statement"`

	// UserImpact describes how users are affected by this problem.
	UserImpact string `json:"userImpact,omitempty"`

	// Evidence supports the existence and severity of the problem.
	Evidence []Evidence `json:"evidence,omitempty"`

	// Confidence is the confidence level in the problem definition (0.0-1.0).
	Confidence float64 `json:"confidence,omitempty"`

	// RootCauses are the underlying causes of the problem.
	RootCauses []string `json:"rootCauses,omitempty"`

	// AffectedSegments are user segments affected by this problem.
	AffectedSegments []string `json:"affectedSegments,omitempty"`

	// SecondaryProblems are related or secondary problems.
	SecondaryProblems []ProblemDefinition `json:"secondaryProblems,omitempty"`
}

ProblemDefinition contains the problem statement with evidence.

type Protocol added in v0.7.0

type Protocol string

Protocol represents an API protocol.

const (
	ProtocolREST      Protocol = "REST"
	ProtocolGRPC      Protocol = "gRPC"
	ProtocolGraphQL   Protocol = "GraphQL"
	ProtocolWebSocket Protocol = "WebSocket"
)

type QualityScores

type QualityScores struct {
	ProblemDefinition    float64 `json:"problemDefinition"`
	UserUnderstanding    float64 `json:"userUnderstanding"`
	MarketAwareness      float64 `json:"marketAwareness"`
	SolutionFit          float64 `json:"solutionFit"`
	ScopeDiscipline      float64 `json:"scopeDiscipline"`
	RequirementsQuality  float64 `json:"requirementsQuality"`
	UXCoverage           float64 `json:"uxCoverage"`
	TechnicalFeasibility float64 `json:"technicalFeasibility"`
	MetricsQuality       float64 `json:"metricsQuality"`
	RiskManagement       float64 `json:"riskManagement"`
	OverallScore         float64 `json:"overallScore"`
}

QualityScores contains scores across the 10 quality dimensions.

type Quote

type Quote struct {
	Speaker string `json:"speaker"`
	Role    string `json:"role,omitempty"`
	Text    string `json:"text"`
}

Quote represents a quote in the press release.

type RecommendPriority

type RecommendPriority string

RecommendPriority represents recommendation priority levels.

const (
	RecommendCritical RecommendPriority = "critical"
	RecommendHigh     RecommendPriority = "high"
	RecommendMedium   RecommendPriority = "medium"
	RecommendLow      RecommendPriority = "low"
)

type Recommendation

type Recommendation struct {
	Section  string            `json:"section"`
	Priority RecommendPriority `json:"priority"` // critical, high, medium, low
	Message  string            `json:"message"`
	Guidance string            `json:"guidance,omitempty"`
}

Recommendation provides specific guidance on improving the PRD.

type RelatedDocument added in v0.7.0

type RelatedDocument struct {
	ID           string           `json:"id"`
	Title        string           `json:"title"`
	Type         DocumentType     `json:"type"`
	Relationship RelationshipType `json:"relationship"`
	Path         string           `json:"path,omitempty"`
	URL          string           `json:"url,omitempty"`
	Description  string           `json:"description,omitempty"`
}

RelatedDocument references another requirements document.

type RelationshipType added in v0.7.0

type RelationshipType string

RelationshipType represents document relationships.

const (
	RelationshipChild      RelationshipType = "child"
	RelationshipParent     RelationshipType = "parent"
	RelationshipSibling    RelationshipType = "sibling"
	RelationshipImplements RelationshipType = "implements"
	RelationshipSupersedes RelationshipType = "supersedes"
	RelationshipRelated    RelationshipType = "related"
)

type ReliabilitySpec

type ReliabilitySpec struct {
	TargetUptime         string `json:"targetUptime"`   // e.g., "99.9%"
	MTBF                 string `json:"mtbf,omitempty"` // Mean Time Between Failures
	MTTR                 string `json:"mttr,omitempty"` // Mean Time To Recovery
	RTO                  string `json:"rto,omitempty"`  // Recovery Time Objective
	RPO                  string `json:"rpo,omitempty"`  // Recovery Point Objective
	FailoverStrategy     string `json:"failoverStrategy,omitempty"`
	BackupFrequency      string `json:"backupFrequency,omitempty"`
	DisasterRecoveryPlan bool   `json:"disasterRecoveryPlan,omitempty"`
}

ReliabilitySpec defines reliability requirements.

type Requirements

type Requirements struct {
	Functional    []FunctionalRequirement    `json:"functional"`
	NonFunctional []NonFunctionalRequirement `json:"nonFunctional"`
}

Requirements contains both functional and non-functional requirements.

type RequirementsList

type RequirementsList struct {
	Must   []string `json:"must"`
	Should []string `json:"should"`
	Could  []string `json:"could"`
}

RequirementsList groups requirements by priority.

type ResultItem

type ResultItem = goals.ResultItem

ResultItem represents a measurable result (Key Result or Measure).

type ReviewDecision

type ReviewDecision string

ReviewDecision represents the outcome of a review.

const (
	// ReviewApprove means the PRD is approved.
	ReviewApprove ReviewDecision = "approve"

	// ReviewRevise means the PRD needs targeted revisions.
	ReviewRevise ReviewDecision = "revise"

	// ReviewReject means the PRD has blocking issues.
	ReviewReject ReviewDecision = "reject"

	// ReviewHumanReview means the PRD requires human review.
	ReviewHumanReview ReviewDecision = "human_review"
)

type ReviewsDefinition

type ReviewsDefinition struct {
	// ReviewBoardSummary is a summary from the review board.
	ReviewBoardSummary string `json:"reviewBoardSummary,omitempty"`

	// QualityScores contains scores across quality dimensions.
	QualityScores *QualityScores `json:"qualityScores,omitempty"`

	// Decision is the review decision.
	Decision ReviewDecision `json:"decision,omitempty"`

	// Blockers are issues that block approval.
	Blockers []Blocker `json:"blockers,omitempty"`

	// RevisionTriggers are issues requiring revision.
	RevisionTriggers []RevisionTrigger `json:"revisionTriggers,omitempty"`
}

ReviewsDefinition contains review outcomes and quality assessments.

type RevisionRecord

type RevisionRecord struct {
	// Version is the version number after this revision.
	Version string `json:"version"`

	// Changes lists what changed in this revision.
	Changes []string `json:"changes"`

	// Trigger indicates what triggered this revision.
	Trigger RevisionTriggerType `json:"trigger"`

	// Date is when this revision was made.
	Date time.Time `json:"date"`

	// Author is who made this revision.
	Author string `json:"author,omitempty"`
}

RevisionRecord documents a revision to the PRD.

type RevisionTrigger

type RevisionTrigger struct {
	// IssueID is the unique identifier for this issue.
	IssueID string `json:"issueId"`

	// Category is the scoring category related to this issue.
	Category string `json:"category"`

	// Severity indicates how severe the issue is (blocker, major, minor).
	Severity string `json:"severity"`

	// Description describes the issue.
	Description string `json:"description"`

	// RecommendedOwner suggests who should address this issue.
	RecommendedOwner string `json:"recommendedOwner,omitempty"`
}

RevisionTrigger represents an issue that requires revision.

type RevisionTriggerType

type RevisionTriggerType string

RevisionTriggerType indicates what triggered a revision.

const (
	// TriggerInitial is for the initial PRD creation.
	TriggerInitial RevisionTriggerType = "initial"

	// TriggerReview is for revisions from review feedback.
	TriggerReview RevisionTriggerType = "review"

	// TriggerScore is for revisions from scoring feedback.
	TriggerScore RevisionTriggerType = "score"

	// TriggerHuman is for revisions from human feedback.
	TriggerHuman RevisionTriggerType = "human"
)

type Risk

type Risk = common.Risk

Risk represents a project risk.

type RiskImpact

type RiskImpact = common.RiskImpact

RiskImpact represents risk impact levels.

type RiskLevel

type RiskLevel = common.RiskLevel

RiskLevel represents risk levels for options.

type RiskProbability

type RiskProbability = common.RiskProbability

RiskProbability represents risk probability levels.

type RiskSnapshot

type RiskSnapshot struct {
	Description string `json:"description"`
	Impact      string `json:"impact"`
	Mitigation  string `json:"mitigation"`
}

RiskSnapshot is a brief risk summary.

type RiskStatus

type RiskStatus = common.RiskStatus

RiskStatus represents risk status.

type RiskSummary

type RiskSummary struct {
	Description string `json:"description"`
	Impact      string `json:"impact"`
	Mitigation  string `json:"mitigation"`
}

RiskSummary is a condensed risk view.

type Roadmap

type Roadmap = roadmap.Roadmap

Roadmap contains the product roadmap with phases.

type RoadmapTableOptions

type RoadmapTableOptions = roadmap.TableOptions

RoadmapTableOptions configures roadmap table generation. This is an alias for backward compatibility.

func DefaultRoadmapTableOptions

func DefaultRoadmapTableOptions() RoadmapTableOptions

DefaultRoadmapTableOptions returns sensible defaults for roadmap table generation.

type SLOSpec

type SLOSpec struct {
	SLI            string `json:"sli"`       // Service Level Indicator
	SLOTarget      string `json:"sloTarget"` // e.g., "99.9%"
	Window         string `json:"window"`    // e.g., "30 days rolling"
	ErrorBudget    string `json:"errorBudget,omitempty"`
	Consequences   string `json:"consequences,omitempty"` // What happens on breach
	AlertThreshold string `json:"alertThreshold,omitempty"`
}

SLOSpec defines Service Level Objective specifications.

type ScopeSnapshot

type ScopeSnapshot struct {
	InScope    []string `json:"inScope"`
	OutOfScope []string `json:"outOfScope"`
}

ScopeSnapshot defines what's in and out of scope.

type ScoringResult

type ScoringResult struct {
	CategoryScores   []CategoryScore   `json:"categoryScores"`
	WeightedScore    float64           `json:"weightedScore"`
	Decision         string            `json:"decision"`
	Blockers         []string          `json:"blockers"`
	RevisionTriggers []RevisionTrigger `json:"revisionTriggers"`
	Summary          string            `json:"summary"`
}

ScoringResult contains the complete scoring output.

func Score

func Score(doc *Document) *ScoringResult

Score evaluates a Document and returns scoring results.

type SectionID added in v0.8.0

type SectionID string

SectionID identifies a section for ordering purposes.

const (
	SectionExecutiveSummary  SectionID = "executiveSummary"
	SectionCurrentState      SectionID = "currentState"
	SectionProblem           SectionID = "problem"
	SectionMarket            SectionID = "market"
	SectionSolution          SectionID = "solution"
	SectionSuccessMetrics    SectionID = "successMetrics"
	SectionObjectives        SectionID = "objectives"
	SectionNonGoals          SectionID = "nonGoals"
	SectionPersonas          SectionID = "personas"
	SectionUserStories       SectionID = "userStories"
	SectionFunctionalReqs    SectionID = "functionalRequirements"
	SectionNonFunctionalReqs SectionID = "nonFunctionalRequirements"
	SectionRoadmap           SectionID = "roadmap"
	SectionTechArchitecture  SectionID = "technicalArchitecture"
	SectionSecurityModel     SectionID = "securityModel"
	SectionDecisions         SectionID = "decisions"
	SectionRisks             SectionID = "risks"
	SectionAssumptions       SectionID = "assumptions"
	SectionInScope           SectionID = "inScope"
	SectionOutOfScope        SectionID = "outOfScope"
	SectionOpenItems         SectionID = "openItems"
	SectionRelatedDocuments  SectionID = "relatedDocuments"
	SectionAppendices        SectionID = "appendices"
	SectionGlossary          SectionID = "glossary"
	SectionReviews           SectionID = "reviews"
	SectionRevisionHistory   SectionID = "revisionHistory"
	SectionCustom            SectionID = "custom"
)

Section ID constants for all PRD sections.

func CompleteSectionOrder added in v0.8.0

func CompleteSectionOrder(partial []SectionID, template []SectionID) []SectionID

CompleteSectionOrder takes a partial order and appends any missing sections from the template order, returning a complete section list.

func GetSectionOrder added in v0.8.0

func GetSectionOrder(prdType PRDType) []SectionID

GetSectionOrder returns the section order for a PRD type.

type SectionScore

type SectionScore struct {
	Name        string   `json:"name"`
	Score       float64  `json:"score"`     // 0-100
	MaxPoints   float64  `json:"maxPoints"` // Weight in overall score
	Required    bool     `json:"required"`
	Status      string   `json:"status"` // complete, partial, missing
	Issues      []string `json:"issues,omitempty"`
	Suggestions []string `json:"suggestions,omitempty"`
}

SectionScore represents the completeness score for a document section.

type SecurityModel

type SecurityModel struct {
	// Overview provides a high-level summary of the security approach.
	Overview string `json:"overview"`

	// ThreatModel identifies assets, threat actors, and threats.
	ThreatModel ThreatModel `json:"threatModel"`

	// AccessControl defines access control strategy.
	AccessControl AccessControl `json:"accessControl"`

	// Encryption specifies encryption requirements.
	Encryption EncryptionRequirements `json:"encryption"`

	// AuditLogging defines audit logging requirements.
	AuditLogging AuditLogging `json:"auditLogging"`

	// ComplianceControls maps to compliance frameworks.
	// Key is framework name (e.g., "SOC2", "GDPR"), value is list of controls.
	ComplianceControls map[string][]string `json:"complianceControls,omitempty"`

	// DataClassification defines data sensitivity levels.
	DataClassification []DataClassification `json:"dataClassification,omitempty"`

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

SecurityModel documents security architecture and threat model. This section is required for all PRDs.

type SecurityRole

type SecurityRole struct {
	// ID is the unique identifier for this role.
	ID string `json:"id,omitempty"`

	// Role name.
	Role string `json:"role"`

	// Description of the role.
	Description string `json:"description,omitempty"`

	// Permissions granted to this role.
	Permissions []string `json:"permissions"`

	// Scope defines where this role applies.
	Scope string `json:"scope,omitempty"`
}

SecurityRole defines a role with permissions.

type SecuritySpec

type SecuritySpec struct {
	AuthenticationMethods  []string `json:"authenticationMethods,omitempty"` // OAuth2, SAML, MFA
	AuthorizationModel     string   `json:"authorizationModel,omitempty"`    // RBAC, ABAC
	EncryptionAtRest       bool     `json:"encryptionAtRest,omitempty"`
	EncryptionInTransit    bool     `json:"encryptionInTransit,omitempty"`
	ComplianceStandards    []string `json:"complianceStandards,omitempty"` // SOC2, GDPR, HIPAA
	VulnerabilityScanning  bool     `json:"vulnerabilityScanning,omitempty"`
	PenetrationTesting     bool     `json:"penetrationTesting,omitempty"`
	SecurityAuditFrequency string   `json:"securityAuditFrequency,omitempty"`
}

SecuritySpec defines security-specific requirements.

type SecurityThreat

type SecurityThreat struct {
	// ID is the unique identifier for this threat.
	ID string `json:"id,omitempty"`

	// Threat description.
	Threat string `json:"threat"`

	// Category is the threat category (e.g., "STRIDE" categories).
	Category string `json:"category,omitempty"`

	// Mitigation strategy.
	Mitigation string `json:"mitigation"`

	// Severity level (critical, high, medium, low).
	Severity string `json:"severity,omitempty"`

	// Status of mitigation (planned, implemented, verified).
	Status string `json:"status,omitempty"`

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

SecurityThreat represents a security threat.

type Service added in v0.7.0

type Service struct {
	ID                string       `json:"id"`
	Name              string       `json:"name"`
	Description       string       `json:"description"`
	Responsibilities  []string     `json:"responsibilities,omitempty"`
	Language          string       `json:"language,omitempty"`
	LanguageRationale string       `json:"languageRationale,omitempty"`
	Layer             ServiceLayer `json:"layer,omitempty"`
	Protocol          Protocol     `json:"protocol,omitempty"`
	Owner             string       `json:"owner,omitempty"`
	Dependencies      []string     `json:"dependencies,omitempty"`
	Tags              []string     `json:"tags,omitempty"`
}

Service represents a microservice in the architecture.

type ServiceLayer added in v0.7.0

type ServiceLayer string

ServiceLayer represents the architectural layer of a service.

const (
	LayerControlPlane   ServiceLayer = "control-plane"
	LayerExecutionPlane ServiceLayer = "execution-plane"
	LayerDataPlane      ServiceLayer = "data-plane"
	LayerGateway        ServiceLayer = "gateway"
)

type SixPagerView

type SixPagerView struct {
	// Metadata
	Title   string `json:"title"`
	Version string `json:"version"`
	Author  string `json:"author"`
	Date    string `json:"date"`
	PRDID   string `json:"prdId"`

	// The six sections
	PressRelease    PressReleaseSection    `json:"pressRelease"`
	FAQ             FAQSection             `json:"faq"`
	CustomerProblem CustomerProblemSection `json:"customerProblem"`
	Solution        SolutionSection        `json:"solution"`
	SuccessMetrics  SuccessMetricsSection  `json:"successMetrics"`
	Timeline        TimelineSection        `json:"timeline"`
}

SixPagerView represents the Amazon-style 6-pager document format. This is a deterministic transformation from PRD data.

func GenerateSixPagerView

func GenerateSixPagerView(doc *Document) *SixPagerView

GenerateSixPagerView creates an Amazon-style 6-pager view from a PRD.

type SolutionDefinition

type SolutionDefinition struct {
	// SolutionOptions are the possible solutions considered.
	SolutionOptions []SolutionOption `json:"solutionOptions,omitempty"`

	// SelectedSolutionID is the ID of the chosen solution.
	SelectedSolutionID string `json:"selectedSolutionId,omitempty"`

	// SolutionRationale explains why the selected solution was chosen.
	SolutionRationale string `json:"solutionRationale,omitempty"`

	// Confidence is the confidence level in the solution (0.0-1.0).
	Confidence float64 `json:"confidence,omitempty"`
}

SolutionDefinition contains solution options and selection rationale.

func (*SolutionDefinition) SelectedSolution

func (s *SolutionDefinition) SelectedSolution() *SolutionOption

SelectedSolution returns the selected solution option, or nil if none selected.

type SolutionOption

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

	// Name is the name of this solution option.
	Name string `json:"name"`

	// Description provides details about the solution.
	Description string `json:"description,omitempty"`

	// ProblemsAddressed lists problem IDs this solution addresses.
	ProblemsAddressed []string `json:"problemsAddressed,omitempty"`

	// Benefits are advantages of this solution.
	Benefits []string `json:"benefits,omitempty"`

	// Tradeoffs are compromises or downsides of this solution.
	Tradeoffs []string `json:"tradeoffs,omitempty"`

	// Risks are potential risks of this solution.
	Risks []string `json:"risks,omitempty"`

	// EstimatedEffort is a high-level effort estimate.
	EstimatedEffort string `json:"estimatedEffort,omitempty"`
}

SolutionOption represents a possible solution approach.

type SolutionSection

type SolutionSection struct {
	Overview        string            `json:"overview"`
	HowItWorks      string            `json:"howItWorks"`
	KeyFeatures     []FeatureSnapshot `json:"keyFeatures"`
	Differentiators []string          `json:"differentiators"`
	Scope           ScopeSnapshot     `json:"scope"`
}

SolutionSection describes the proposed solution.

type SolutionSummary

type SolutionSummary struct {
	Name        string   `json:"name"`
	Description string   `json:"description"`
	Rationale   string   `json:"rationale"`
	Tradeoffs   []string `json:"tradeoffs"`
}

SolutionSummary is a condensed solution view.

type SourceOfTruth added in v0.7.0

type SourceOfTruth struct {
	Artifact      string                `json:"artifact"`
	Location      SourceOfTruthLocation `json:"location"`
	Rationale     string                `json:"rationale,omitempty"`
	GitOpsEnabled bool                  `json:"gitOpsEnabled,omitempty"`
}

SourceOfTruth defines where authoritative data lives.

type SourceOfTruthLocation added in v0.7.0

type SourceOfTruthLocation string

SourceOfTruthLocation represents where artifacts are stored.

const (
	LocationGit            SourceOfTruthLocation = "git"
	LocationS3             SourceOfTruthLocation = "s3"
	LocationDatabase       SourceOfTruthLocation = "database"
	LocationSecretsManager SourceOfTruthLocation = "secrets-manager"
	LocationRegistry       SourceOfTruthLocation = "registry"
)

type Status

type Status = common.Status

Status represents the document lifecycle status.

type StorageCategory added in v0.7.0

type StorageCategory struct {
	ID         string              `json:"id,omitempty"`
	Category   StorageCategoryType `json:"category"`
	Purpose    string              `json:"purpose"`
	Technology string              `json:"technology"`
	Rationale  string              `json:"rationale,omitempty"`
	Encryption string              `json:"encryption,omitempty"`
	Retention  string              `json:"retention,omitempty"`
	PerTenant  bool                `json:"perTenant,omitempty"`
}

StorageCategory represents a storage use case.

type StorageCategoryType added in v0.7.0

type StorageCategoryType string

StorageCategoryType represents storage categories.

const (
	StorageMetadata      StorageCategoryType = "metadata"
	StorageArtifacts     StorageCategoryType = "artifacts"
	StorageState         StorageCategoryType = "state"
	StorageCache         StorageCategoryType = "cache"
	StorageObservability StorageCategoryType = "observability"
	StorageAudit         StorageCategoryType = "audit"
	StorageSecrets       StorageCategoryType = "secrets"
)

type SuccessMetrics added in v0.8.0

type SuccessMetrics struct {
	// NorthStar contains the primary metrics that define success.
	// These are the most important metrics that the team focuses on.
	NorthStar []Metric `json:"northStar"`

	// Supporting contains metrics that support the north star metrics.
	// These help explain or contribute to north star metric performance.
	Supporting []Metric `json:"supporting,omitempty"`

	// Guardrail contains metrics that should not degrade.
	// These ensure that improvements to north star metrics don't come at
	// the expense of other important aspects of the product.
	Guardrail []Metric `json:"guardrail,omitempty"`
}

SuccessMetrics contains structured success metrics organized by type. These metrics help define and measure the success of the product or feature.

type SuccessMetricsSection

type SuccessMetricsSection struct {
	PrimaryMetric    MetricSnapshot   `json:"primaryMetric"`
	SecondaryMetrics []MetricSnapshot `json:"secondaryMetrics"`
	Guardrails       []MetricSnapshot `json:"guardrails,omitempty"`
	BusinessGoals    []string         `json:"businessGoals"`
}

SuccessMetricsSection defines how success will be measured.

type TechnicalArchitecture

type TechnicalArchitecture struct {
	Overview          string          `json:"overview"`
	SystemDiagram     string          `json:"systemDiagram,omitempty"` // URL or path to diagram
	DataModel         string          `json:"dataModel,omitempty"`     // URL or path to ERD
	IntegrationPoints []Integration   `json:"integrationPoints,omitempty"`
	TechnologyStack   TechnologyStack `json:"technologyStack,omitempty"`
	SecurityDesign    string          `json:"securityDesign,omitempty"`
	ScalabilityDesign string          `json:"scalabilityDesign,omitempty"`

	// Services lists the microservices in the architecture.
	Services []Service `json:"services,omitempty"`

	// APIs lists the API specifications.
	APIs []APISpec `json:"apis,omitempty"`

	// StorageArchitecture defines storage by category.
	StorageArchitecture []StorageCategory `json:"storageArchitecture,omitempty"`

	// GitOps defines GitOps configuration.
	GitOps *GitOpsConfig `json:"gitOps,omitempty"`

	// Orchestration defines workflow orchestration.
	Orchestration *OrchestrationConfig `json:"orchestration,omitempty"`
}

TechnicalArchitecture contains technical design information.

type TechnicalProficiency

type TechnicalProficiency string

TechnicalProficiency represents a user's technical skill level.

const (
	ProficiencyLow    TechnicalProficiency = "low"
	ProficiencyMedium TechnicalProficiency = "medium"
	ProficiencyHigh   TechnicalProficiency = "high"
	ProficiencyExpert TechnicalProficiency = "expert"
)

type Technology

type Technology struct {
	Name         string   `json:"name"`
	Version      string   `json:"version,omitempty"`
	Purpose      string   `json:"purpose,omitempty"`
	Rationale    string   `json:"rationale,omitempty"`
	Alternatives []string `json:"alternatives,omitempty"` // Considered alternatives
}

Technology represents a technology choice.

type TechnologyStack

type TechnologyStack struct {
	Frontend       []Technology `json:"frontend,omitempty"`
	Backend        []Technology `json:"backend,omitempty"`
	Database       []Technology `json:"database,omitempty"`
	Infrastructure []Technology `json:"infrastructure,omitempty"`
	DevOps         []Technology `json:"devops,omitempty"`
	Monitoring     []Technology `json:"monitoring,omitempty"`
}

TechnologyStack defines the technology choices.

type ThreatModel

type ThreatModel struct {
	// Assets are the valuable resources to protect.
	Assets []string `json:"assets"`

	// ThreatActors are potential attackers.
	ThreatActors []string `json:"threatActors"`

	// KeyThreats lists major threats with mitigations.
	KeyThreats []SecurityThreat `json:"keyThreats"`

	// TrustBoundaries identifies trust boundaries in the system.
	TrustBoundaries []string `json:"trustBoundaries,omitempty"`
}

ThreatModel identifies security threats and mitigations.

type TimelineSection

type TimelineSection struct {
	Phases       []PhaseSnapshot `json:"phases"`
	Dependencies []string        `json:"dependencies"`
	Risks        []RiskSnapshot  `json:"risks"`
	TeamNeeds    string          `json:"teamNeeds,omitempty"`
}

TimelineSection describes the roadmap and resources.

type TracingSpec

type TracingSpec struct {
	Enabled           bool   `json:"enabled"`
	SamplingRate      string `json:"samplingRate"`      // e.g., "100%", "10%"
	PropagationFormat string `json:"propagationFormat"` // W3C, B3
	ExportFormat      string `json:"exportFormat"`      // OTLP, Jaeger, Zipkin
}

TracingSpec defines distributed tracing requirements.

type UXRequirements

type UXRequirements struct {
	DesignPrinciples []string          `json:"designPrinciples,omitempty"`
	Wireframes       []Wireframe       `json:"wireframes,omitempty"`
	InteractionFlows []InteractionFlow `json:"interactionFlows,omitempty"`
	Accessibility    AccessibilitySpec `json:"accessibility,omitempty"`
	BrandGuidelines  string            `json:"brandGuidelines,omitempty"` // URL or path
	DesignSystem     string            `json:"designSystem,omitempty"`    // URL or path
}

UXRequirements contains UX/UI requirements.

type UserStory

type UserStory struct {
	ID                 string                `json:"id"`
	PersonaID          string                `json:"personaId"` // Reference to persona
	Title              string                `json:"title"`
	AsA                string                `json:"asA"`    // Persona role (e.g., "developer", "admin")
	IWant              string                `json:"iWant"`  // Desired action/feature
	SoThat             string                `json:"soThat"` // Benefit/reason
	AcceptanceCriteria []AcceptanceCriterion `json:"acceptanceCriteria"`
	Priority           Priority              `json:"priority"`
	PhaseID            string                `json:"phaseId"` // Reference to roadmap phase
	StoryPoints        *int                  `json:"storyPoints,omitempty"`
	Dependencies       []string              `json:"dependencies,omitempty"` // Dependent story IDs
	Epic               string                `json:"epic,omitempty"`         // Parent epic
	Tags               []string              `json:"tags,omitempty"`         // For filtering by topic/domain
	Notes              string                `json:"notes,omitempty"`
}

UserStory represents a user story with acceptance criteria.

func (UserStory) Story

func (us UserStory) Story() string

Story returns the full user story string in standard format.

type ValidationError

type ValidationError struct {
	Field   string `json:"field"`
	Message string `json:"message"`
}

ValidationError represents a validation failure.

type ValidationResult

type ValidationResult struct {
	Valid    bool                `json:"valid"`
	Errors   []ValidationError   `json:"errors,omitempty"`
	Warnings []ValidationWarning `json:"warnings,omitempty"`
}

ValidationResult contains validation errors and warnings.

func Validate

func Validate(doc *Document) *ValidationResult

Validate checks the Document for structural and content issues.

type ValidationWarning

type ValidationWarning struct {
	Field   string `json:"field"`
	Message string `json:"message"`
}

ValidationWarning represents a non-blocking issue.

type Wireframe

type Wireframe struct {
	ID          string `json:"id"`
	Title       string `json:"title"`
	Description string `json:"description,omitempty"`
	URL         string `json:"url"`              // Link to wireframe
	Status      string `json:"status,omitempty"` // Draft, Approved
}

Wireframe represents a wireframe or mockup.

Directories

Path Synopsis
Package render provides interfaces and utilities for rendering PRD documents to various output formats including Marp slides.
Package render provides interfaces and utilities for rendering PRD documents to various output formats including Marp slides.
marp
Package marp provides a Marp markdown renderer for PRD documents.
Package marp provides a Marp markdown renderer for PRD documents.
terminal
Package terminal provides terminal rendering for PRD evaluation reports.
Package terminal provides terminal rendering for PRD evaluation reports.

Jump to

Keyboard shortcuts

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