prd

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package prd provides data types for structured Product Requirements Documents.

Index

Constants

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.

Functions

func CategoryDescriptions added in v0.3.0

func CategoryDescriptions() map[string]string

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

func CategoryOwners added in v0.3.0

func CategoryOwners() map[string]string

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

func GenerateEvaluationTemplate added in v0.3.0

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 added in v0.3.0

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 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 added in v0.3.0

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 added in v0.4.0

func StatusLegend() string

StatusLegend returns a markdown table explaining the status icons.

func ToJSON

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

ToJSON converts a view to JSON string.

func ValidateTag added in v0.4.0

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 added in v0.4.0

func ValidateTags(tags []string) []error

ValidateTags checks multiple tags and returns all validation errors.

Types

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 added in v0.4.0

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 added in v0.4.0

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:"testing_approach,omitempty"`
}

AccessibilitySpec defines accessibility requirements.

type AlertingSpec

type AlertingSpec struct {
	Channels          []string `json:"channels"` // PagerDuty, Slack, Email
	EscalationPolicy  string   `json:"escalation_policy,omitempty"`
	OnCallIntegration bool     `json:"on_call_integration,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:"why_not_chosen,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 added in v0.4.0

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:"content_string,omitempty"`

	// ContentTable is structured table data.
	// Rendered after ContentString if both are set.
	ContentTable *AppendixTable `json:"content_table,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:"referenced_by,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 added in v0.4.0

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

NewCodeAppendix creates a new code appendix.

func NewReferenceAppendix added in v0.4.0

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

NewReferenceAppendix creates a new reference appendix for links and citations.

func NewTableAppendix added in v0.4.0

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

NewTableAppendix creates a new table appendix with custom headers.

func NewTextAppendix added in v0.4.0

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

NewTextAppendix creates a new text/markdown appendix.

type AppendixSchema added in v0.4.0

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 added in v0.4.0

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 added in v0.4.0

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 struct {
	ID          string `json:"id"`
	Description string `json:"description"`
	Rationale   string `json:"rationale,omitempty"`
	Risk        string `json:"risk,omitempty"` // What happens if assumption is wrong
	Validated   bool   `json:"validated,omitempty"`
}

Assumption represents a condition assumed to be true.

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 added in v0.4.0

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 added in v0.4.0

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:"current_value"`

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

	// MeasurementMethod describes how this is measured.
	MeasurementMethod string `json:"measurement_method,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:"max_score"`
	Justification  string  `json:"justification"`
	Evidence       string  `json:"evidence"`
	BelowThreshold bool    `json:"below_threshold"`
}

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:"overall_score"`     // 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:"required_complete"` // Count of complete required sections
	RequiredTotal    int              `json:"required_total"`    // Total required sections
	OptionalComplete int              `json:"optional_complete"` // Count of complete optional sections
	OptionalTotal    int              `json:"optional_total"`    // 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 struct {
	ID          string         `json:"id"`
	Type        ConstraintType `json:"type"`
	Description string         `json:"description"`
	Impact      string         `json:"impact,omitempty"`
	Mitigation  string         `json:"mitigation,omitempty"`
}

Constraint represents a limitation on the project.

type ConstraintType

type ConstraintType string

ConstraintType represents types of constraints.

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

type CurrentApproach added in v0.4.0

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 added in v0.4.0

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:"affected_users,omitempty"`

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

CurrentProblem describes a specific problem with the current state.

type CurrentState added in v0.4.0

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:"target_state"`

	// 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 struct {
	ID          string `json:"id"`
	Title       string `json:"title"`
	Description string `json:"description,omitempty"`
	Content     any    `json:"content"`          // Flexible content structure
	Schema      string `json:"schema,omitempty"` // Optional JSON schema for validation
}

CustomSection allows project-specific sections.

type CustomerProblemSection

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

CustomerProblemSection describes the user pain points.

type DataClassification added in v0.4.0

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 struct {
	// ID is the unique identifier for this decision.
	ID string `json:"id"`

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

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

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

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

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

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

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

DecisionRecord documents a decision made during PRD development.

type DecisionStatus

type DecisionStatus string

DecisionStatus represents the status of a decision.

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

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

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

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

type 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 struct {
	ID          string            `json:"id"`
	Title       string            `json:"title"`
	Description string            `json:"description"`
	Type        DeliverableType   `json:"type"`
	Status      DeliverableStatus `json:"status,omitempty"`
	Tags        []string          `json:"tags,omitempty"` // For filtering by topic/domain
}

Deliverable represents a phase deliverable.

type DeliverableStatus

type DeliverableStatus string

DeliverableStatus represents the status of a deliverable.

const (
	DeliverableNotStarted DeliverableStatus = "not_started"
	DeliverableInProgress DeliverableStatus = "in_progress"
	DeliverableCompleted  DeliverableStatus = "completed"
	DeliverableBlocked    DeliverableStatus = "blocked"
)

type DeliverableType

type DeliverableType string

DeliverableType represents types of deliverables.

const (
	DeliverableFeature        DeliverableType = "feature"
	DeliverableDocumentation  DeliverableType = "documentation"
	DeliverableInfrastructure DeliverableType = "infrastructure"
	DeliverableIntegration    DeliverableType = "integration"
	DeliverableMilestone      DeliverableType = "milestone"
	DeliverableRollout        DeliverableType = "rollout"
)

type Demographics

type Demographics struct {
	AgeRange    string `json:"age_range,omitempty"`
	Location    string `json:"location,omitempty"`
	Industry    string `json:"industry,omitempty"`
	CompanySize string `json:"company_size,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:"due_date,omitempty"`
}

Dependency represents an external dependency.

type DiagramRef added in v0.4.0

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:"executive_summary"`
	Objectives       Objectives       `json:"objectives"`
	Personas         []Persona        `json:"personas"`
	UserStories      []UserStory      `json:"user_stories"`
	Requirements     Requirements     `json:"requirements"`
	Roadmap          Roadmap          `json:"roadmap"`

	// Optional sections
	Assumptions      *AssumptionsConstraints `json:"assumptions,omitempty"`
	OutOfScope       []string                `json:"out_of_scope,omitempty"`
	TechArchitecture *TechnicalArchitecture  `json:"technical_architecture,omitempty"`
	UXRequirements   *UXRequirements         `json:"ux_requirements,omitempty"`
	Risks            []Risk                  `json:"risks,omitempty"`
	Glossary         []GlossaryTerm          `json:"glossary,omitempty"`

	// Custom sections for project-specific needs
	CustomSections []CustomSection `json:"custom_sections,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:"open_items,omitempty"`

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

	// RevisionHistory tracks changes to the PRD over time.
	RevisionHistory []RevisionRecord `json:"revision_history,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:"current_state,omitempty"`

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

	// Appendices contains supplementary information and domain-specific data.
	Appendices []Appendix `json:"appendices,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 added in v0.4.0

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 added in v0.4.0

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) 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) ToSwimlaneTableWithOKRs added in v0.4.0

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.

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%   |

type EffortLevel added in v0.4.0

type EffortLevel string

EffortLevel represents effort estimates.

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

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 added in v0.4.0

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

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

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

EncryptionRequirements specifies encryption requirements.

type EncryptionSpec added in v0.4.0

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:"key_management"`

	// 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 added in v0.3.0

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 added in v0.3.0

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 added in v0.3.0

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:"sample_size,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:"prd_id"`
	Title           string  `json:"title"`
	OverallDecision string  `json:"overall_decision"`
	ConfidenceLevel string  `json:"confidence_level"`
	OverallScore    float64 `json:"overall_score"`
}

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:"required_actions"`
	TopRisks              []ExecRisk   `json:"top_risks"`
	RecommendationSummary string       `json:"recommendation_summary"`
}

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:"problem_statement"`
	ProposedSolution string   `json:"proposed_solution"`
	ExpectedOutcomes []string `json:"expected_outcomes"`
	TargetAudience   string   `json:"target_audience,omitempty"`
	ValueProposition string   `json:"value_proposition,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:"customer_faqs"`
	InternalFAQs  []FAQ `json:"internal_faqs"`
	TechnicalFAQs []FAQ `json:"technical_faqs,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 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:"user_story_ids"` // Related user stories
	AcceptanceCriteria []AcceptanceCriterion `json:"acceptance_criteria"`
	PhaseID            string                `json:"phase_id"` // 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:"appendix_refs,omitempty"`
}

FunctionalRequirement represents a functional requirement.

type GlossaryTerm

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

GlossaryTerm defines a glossary entry.

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 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:"okr_ref,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:"aligned_objectives,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:"auth_method,omitempty"`
	DataFormat    string `json:"data_format,omitempty"` // JSON, XML, Protobuf
	RateLimit     string `json:"rate_limit,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:"diagram_url,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 added in v0.4.0

type KeyResult struct {
	ID                string        `json:"id"`
	Description       string        `json:"description"`
	Metric            string        `json:"metric"`                       // What is measured (e.g., "Monthly Active Users")
	Baseline          string        `json:"baseline,omitempty"`           // Starting value
	Target            string        `json:"target"`                       // Target value to achieve
	Current           string        `json:"current,omitempty"`            // Current value (for tracking)
	Unit              string        `json:"unit,omitempty"`               // e.g., "%", "users", "$"
	MeasurementMethod string        `json:"measurement_method,omitempty"` // How it's measured
	Owner             string        `json:"owner,omitempty"`              // Person or team responsible
	Confidence        float64       `json:"confidence,omitempty"`         // 0.0-1.0 confidence score
	PhaseTargets      []PhaseTarget `json:"phase_targets,omitempty"`      // Per-phase targets for roadmap alignment
	Tags              []string      `json:"tags,omitempty"`               // For filtering by topic/domain
}

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:"created_at,omitempty"`
	UpdatedAt   time.Time `json:"updated_at,omitempty"`
}

LibraryMetadata contains metadata about the persona library itself.

type LibraryPersona

type LibraryPersona struct {
	Persona
	CreatedAt   time.Time `json:"created_at,omitempty"`
	UpdatedAt   time.Time `json:"updated_at,omitempty"`
	UsedInPRDs  []string  `json:"used_in_prds,omitempty"`        // Track which PRDs use this persona
	Tags        []string  `json:"tags,omitempty"`                // For organization/filtering
	Description string    `json:"library_description,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:"retention_period"` // e.g., "90 days"
	LogLevels             []string `json:"log_levels"`
	CorrelationID         bool     `json:"correlation_id"` // Include trace/correlation IDs
	SensitiveDataHandling string   `json:"sensitive_data_handling,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
}

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).

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:"market_risks,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:"created_at"`
	UpdatedAt time.Time  `json:"updated_at"`
	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:"semantic_versioning,omitempty"`
}

Metadata contains document metadata.

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:"collection_interval"` // e.g., "15s"
	RetentionPeriod    string   `json:"retention_period"`
	CustomMetrics      []string `json:"custom_metrics,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:"isolation_model"`
	DataSegregation         DataSegregation  `json:"data_segregation"`
	EncryptionModel         EncryptionModel  `json:"encryption_model,omitempty"`
	NetworkIsolation        NetworkIsolation `json:"network_isolation,omitempty"`
	NoisyNeighborProtection string           `json:"noisy_neighbor_protection,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:"measurement_method,omitempty"`
	Priority          MoSCoW      `json:"priority"`
	PhaseID           string      `json:"phase_id"`
	CurrentBaseline   string      `json:"current_baseline,omitempty"`
	Notes             string      `json:"notes,omitempty"`

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

	// Multi-tenancy specific fields
	MultiTenancy *MultiTenancySpec `json:"multi_tenancy,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:"appendix_refs,omitempty"`
}

NonFunctionalRequirement represents a non-functional requirement.

type OKR added in v0.4.0

type OKR struct {
	Objective  Objective   `json:"objective"`
	KeyResults []KeyResult `json:"key_results"` // Must have 1+ Key Results
}

OKR represents an Objective with its Key Results. Following the OKR methodology used at Google, Intel, Intuit, and others.

type Objective

type Objective struct {
	ID          string   `json:"id"`
	Description string   `json:"description"`
	Rationale   string   `json:"rationale,omitempty"`
	AlignedWith string   `json:"aligned_with,omitempty"` // Parent strategy/OKR
	Category    string   `json:"category,omitempty"`     // Business, Product, Team, etc.
	Owner       string   `json:"owner,omitempty"`        // Person or team responsible
	Timeframe   string   `json:"timeframe,omitempty"`    // e.g., "Q1 2026", "H1 2026", "FY2026"
	Tags        []string `json:"tags,omitempty"`         // For filtering by topic/domain
}

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.

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 added in v0.4.0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

type OpenItemResolution added in v0.4.0

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

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

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

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

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

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

OpenItemResolution documents how an open item was resolved.

type OpenItemStatus added in v0.4.0

type OpenItemStatus string

OpenItemStatus represents the status of an open item.

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

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

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

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

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

type Option added in v0.4.0

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

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

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

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

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

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

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

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

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

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

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

Option represents one possible choice for an open item decision.

type PMView

type PMView struct {
	Title          string           `json:"title"`
	Status         string           `json:"status"`
	Owner          string           `json:"owner"`
	Version        string           `json:"version"`
	ProblemSummary string           `json:"problem_summary"`
	Personas       []PersonaSummary `json:"personas"`
	Goals          []string         `json:"goals"`
	NonGoals       []string         `json:"non_goals"`
	Solution       SolutionSummary  `json:"solution"`
	Requirements   RequirementsList `json:"requirements"`
	Metrics        MetricsSummary   `json:"metrics"`
	Risks          []RiskSummary    `json:"risks"`
	OpenQuestions  []string         `json:"open_questions,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 PRFAQView

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

	// The two main sections
	PressRelease PressReleaseSection `json:"press_release"`
	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:"pain_points"`         // Current frustrations
	Behaviors            []string             `json:"behaviors,omitempty"` // Typical patterns
	TechnicalProficiency TechnicalProficiency `json:"technical_proficiency,omitempty"`
	Demographics         *Demographics        `json:"demographics,omitempty"`
	Motivations          []string             `json:"motivations,omitempty"`
	Frustrations         []string             `json:"frustrations,omitempty"`
	PreferredChannels    []string             `json:"preferred_channels,omitempty"` // How they prefer to interact
	Quote                string               `json:"quote,omitempty"`              // Representative quote
	ImageURL             string               `json:"image_url,omitempty"`
	IsPrimary            bool                 `json:"is_primary,omitempty"`  // Is this the primary persona?
	LibraryRef           string               `json:"library_ref,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:"schema_version"`
	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:"pain_points"`
}

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:"pain_points"`
	IsPrimary  bool     `json:"is_primary"`
}

PersonaSummary is a condensed persona view.

type Phase

type Phase struct {
	ID              string        `json:"id"`   // e.g., "phase-1", "q1-2026"
	Name            string        `json:"name"` // e.g., "MVP", "Q1 2026"
	Type            PhaseType     `json:"type"`
	StartDate       *time.Time    `json:"start_date,omitempty"`
	EndDate         *time.Time    `json:"end_date,omitempty"`
	Goals           []string      `json:"goals"`
	Deliverables    []Deliverable `json:"deliverables"`
	SuccessCriteria []string      `json:"success_criteria"`
	Dependencies    []string      `json:"dependencies,omitempty"` // Dependent phase IDs
	Risks           []Risk        `json:"risks,omitempty"`
	Status          PhaseStatus   `json:"status,omitempty"`
	Progress        *int          `json:"progress,omitempty"` // 0-100 percentage
	Tags            []string      `json:"tags,omitempty"`     // For filtering by topic/domain
	Notes           string        `json:"notes,omitempty"`
}

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 string

PhaseStatus represents the current status of a phase.

const (
	PhaseStatusPlanned    PhaseStatus = "planned"
	PhaseStatusInProgress PhaseStatus = "in_progress"
	PhaseStatusCompleted  PhaseStatus = "completed"
	PhaseStatusDelayed    PhaseStatus = "delayed"
	PhaseStatusCancelled  PhaseStatus = "cancelled"
)

type PhaseTarget added in v0.4.0

type PhaseTarget struct {
	PhaseID string `json:"phase_id"`         // Reference to roadmap phase
	Target  string `json:"target"`           // Target value for this phase
	Status  string `json:"status,omitempty"` // not_started, in_progress, achieved, missed
	Actual  string `json:"actual,omitempty"` // Actual value achieved
	Notes   string `json:"notes,omitempty"`  // Commentary on progress
}

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

type PhaseType

type PhaseType string

PhaseType represents the type of roadmap phase.

const (
	PhaseTypeGeneric   PhaseType = "generic"   // Phase 1, 2, 3
	PhaseTypeQuarter   PhaseType = "quarter"   // Q1 2026, Q2 2026
	PhaseTypeMonth     PhaseType = "month"     // January 2026
	PhaseTypeSprint    PhaseType = "sprint"    // Sprint 1, Sprint 2
	PhaseTypeMilestone PhaseType = "milestone" // MVP, GA, etc.
)

type PressReleaseSection

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

PressReleaseSection is a future-dated announcement of the product.

type Priority

type Priority string

Priority represents requirement priority levels.

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

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:"user_impact,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:"root_causes,omitempty"`

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

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

ProblemDefinition contains the problem statement with evidence.

type QualityScores

type QualityScores struct {
	ProblemDefinition    float64 `json:"problem_definition"`
	UserUnderstanding    float64 `json:"user_understanding"`
	MarketAwareness      float64 `json:"market_awareness"`
	SolutionFit          float64 `json:"solution_fit"`
	ScopeDiscipline      float64 `json:"scope_discipline"`
	RequirementsQuality  float64 `json:"requirements_quality"`
	UXCoverage           float64 `json:"ux_coverage"`
	TechnicalFeasibility float64 `json:"technical_feasibility"`
	MetricsQuality       float64 `json:"metrics_quality"`
	RiskManagement       float64 `json:"risk_management"`
	OverallScore         float64 `json:"overall_score"`
}

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 ReliabilitySpec

type ReliabilitySpec struct {
	TargetUptime         string `json:"target_uptime"`  // 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:"failover_strategy,omitempty"`
	BackupFrequency      string `json:"backup_frequency,omitempty"`
	DisasterRecoveryPlan bool   `json:"disaster_recovery_plan,omitempty"`
}

ReliabilitySpec defines reliability requirements.

type Requirements

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

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 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:"review_board_summary,omitempty"`

	// QualityScores contains scores across quality dimensions.
	QualityScores *QualityScores `json:"quality_scores,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:"revision_triggers,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:"issue_id"`

	// 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:"recommended_owner,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 struct {
	ID          string          `json:"id"`
	Description string          `json:"description"`
	Probability RiskProbability `json:"probability"`
	Impact      RiskImpact      `json:"impact"`
	Mitigation  string          `json:"mitigation"`
	Owner       string          `json:"owner,omitempty"`
	Status      RiskStatus      `json:"status,omitempty"`
	DueDate     string          `json:"due_date,omitempty"`
	Tags        []string        `json:"tags,omitempty"` // For filtering by topic/domain
	Notes       string          `json:"notes,omitempty"`

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

Risk represents a project risk.

type RiskImpact

type RiskImpact string

RiskImpact represents risk impact levels.

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

type RiskLevel added in v0.4.0

type RiskLevel string

RiskLevel represents risk levels for options.

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

type RiskProbability

type RiskProbability string

RiskProbability represents risk probability levels.

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

type 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 string

RiskStatus represents risk status.

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

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 struct {
	Phases []Phase `json:"phases"`
}

Roadmap contains the product roadmap with phases.

func (*Roadmap) ToPhaseTable added in v0.4.0

func (r *Roadmap) ToPhaseTable(opts RoadmapTableOptions) string

ToPhaseTable generates a traditional phase-based table showing each phase with its deliverables listed.

Example output:

| Phase   | Status      | Deliverables                          |
|---------|-------------|---------------------------------------|
| Phase 1 | In Progress | • ✅ Auth<br>• 🔄 Search<br>• ⏳ Docs |
| Phase 2 | Planned     | • Dashboard<br>• Monitoring           |

func (*Roadmap) ToSwimlaneTable added in v0.4.0

func (r *Roadmap) ToSwimlaneTable(opts RoadmapTableOptions) string

ToSwimlaneTable generates a markdown table with phases as columns and deliverable types as swimlane rows.

Example output:

| Swimlane       | **Phase 1**<br>Foundation | **Phase 2**<br>Core Features |
|----------------|---------------------------|------------------------------|
| Features       | • Auth<br>• Search        | • Dashboard                  |
| Infrastructure | • CI/CD                   | • Monitoring                 |

type RoadmapTableOptions added in v0.4.0

type RoadmapTableOptions struct {
	// IncludeStatus adds status indicators to deliverables
	IncludeStatus bool
	// IncludeEmptySwimlanes shows rows even if no deliverables of that type exist
	IncludeEmptySwimlanes bool
	// SwimlaneOrder specifies the order of swimlanes (nil = alphabetical)
	SwimlaneOrder []DeliverableType
	// MaxTitleLen truncates deliverable titles (0 = no limit)
	MaxTitleLen int
	// IncludeOKRs adds Objectives and Key Results swimlanes derived from PhaseTargets
	IncludeOKRs bool
}

RoadmapTableOptions configures roadmap table generation.

func DefaultRoadmapTableOptions added in v0.4.0

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:"slo_target"` // e.g., "99.9%"
	Window         string `json:"window"`     // e.g., "30 days rolling"
	ErrorBudget    string `json:"error_budget,omitempty"`
	Consequences   string `json:"consequences,omitempty"` // What happens on breach
	AlertThreshold string `json:"alert_threshold,omitempty"`
}

SLOSpec defines Service Level Objective specifications.

type ScopeSnapshot

type ScopeSnapshot struct {
	InScope    []string `json:"in_scope"`
	OutOfScope []string `json:"out_of_scope"`
}

ScopeSnapshot defines what's in and out of scope.

type ScoringResult

type ScoringResult struct {
	CategoryScores   []CategoryScore   `json:"category_scores"`
	WeightedScore    float64           `json:"weighted_score"`
	Decision         string            `json:"decision"`
	Blockers         []string          `json:"blockers"`
	RevisionTriggers []RevisionTrigger `json:"revision_triggers"`
	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 SectionScore

type SectionScore struct {
	Name        string   `json:"name"`
	Score       float64  `json:"score"`      // 0-100
	MaxPoints   float64  `json:"max_points"` // 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 added in v0.4.0

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:"threat_model"`

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

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

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

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

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

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

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

type SecurityRole added in v0.4.0

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:"authentication_methods,omitempty"` // OAuth2, SAML, MFA
	AuthorizationModel     string   `json:"authorization_model,omitempty"`    // RBAC, ABAC
	EncryptionAtRest       bool     `json:"encryption_at_rest,omitempty"`
	EncryptionInTransit    bool     `json:"encryption_in_transit,omitempty"`
	ComplianceStandards    []string `json:"compliance_standards,omitempty"` // SOC2, GDPR, HIPAA
	VulnerabilityScanning  bool     `json:"vulnerability_scanning,omitempty"`
	PenetrationTesting     bool     `json:"penetration_testing,omitempty"`
	SecurityAuditFrequency string   `json:"security_audit_frequency,omitempty"`
}

SecuritySpec defines security-specific requirements.

type SecurityThreat added in v0.4.0

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:"related_ids,omitempty"`
}

SecurityThreat represents a security threat.

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:"prd_id"`

	// The six sections
	PressRelease    PressReleaseSection    `json:"press_release"`
	FAQ             FAQSection             `json:"faq"`
	CustomerProblem CustomerProblemSection `json:"customer_problem"`
	Solution        SolutionSection        `json:"solution"`
	SuccessMetrics  SuccessMetricsSection  `json:"success_metrics"`
	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:"solution_options,omitempty"`

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

	// SolutionRationale explains why the selected solution was chosen.
	SolutionRationale string `json:"solution_rationale,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:"problems_addressed,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:"estimated_effort,omitempty"`
}

SolutionOption represents a possible solution approach.

type SolutionSection

type SolutionSection struct {
	Overview        string            `json:"overview"`
	HowItWorks      string            `json:"how_it_works"`
	KeyFeatures     []FeatureSnapshot `json:"key_features"`
	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 Status

type Status string

Status represents the document lifecycle status.

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

type SuccessMetricsSection

type SuccessMetricsSection struct {
	PrimaryMetric    MetricSnapshot   `json:"primary_metric"`
	SecondaryMetrics []MetricSnapshot `json:"secondary_metrics"`
	Guardrails       []MetricSnapshot `json:"guardrails,omitempty"`
	BusinessGoals    []string         `json:"business_goals"`
}

SuccessMetricsSection defines how success will be measured.

type TechnicalArchitecture

type TechnicalArchitecture struct {
	Overview          string          `json:"overview"`
	SystemDiagram     string          `json:"system_diagram,omitempty"` // URL or path to diagram
	DataModel         string          `json:"data_model,omitempty"`     // URL or path to ERD
	IntegrationPoints []Integration   `json:"integration_points,omitempty"`
	TechnologyStack   TechnologyStack `json:"technology_stack,omitempty"`
	SecurityDesign    string          `json:"security_design,omitempty"`
	ScalabilityDesign string          `json:"scalability_design,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 added in v0.4.0

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

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

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

	// TrustBoundaries identifies trust boundaries in the system.
	TrustBoundaries []string `json:"trust_boundaries,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:"team_needs,omitempty"`
}

TimelineSection describes the roadmap and resources.

type TracingSpec

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

TracingSpec defines distributed tracing requirements.

type UXRequirements

type UXRequirements struct {
	DesignPrinciples []string          `json:"design_principles,omitempty"`
	Wireframes       []Wireframe       `json:"wireframes,omitempty"`
	InteractionFlows []InteractionFlow `json:"interaction_flows,omitempty"`
	Accessibility    AccessibilitySpec `json:"accessibility,omitempty"`
	BrandGuidelines  string            `json:"brand_guidelines,omitempty"` // URL or path
	DesignSystem     string            `json:"design_system,omitempty"`    // URL or path
}

UXRequirements contains UX/UI requirements.

type UserStory

type UserStory struct {
	ID                 string                `json:"id"`
	PersonaID          string                `json:"persona_id"` // Reference to persona
	Title              string                `json:"title"`
	AsA                string                `json:"as_a"`    // Persona role (e.g., "developer", "admin")
	IWant              string                `json:"i_want"`  // Desired action/feature
	SoThat             string                `json:"so_that"` // Benefit/reason
	AcceptanceCriteria []AcceptanceCriterion `json:"acceptance_criteria"`
	Priority           Priority              `json:"priority"`
	PhaseID            string                `json:"phase_id"` // Reference to roadmap phase
	StoryPoints        *int                  `json:"story_points,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