Documentation
¶
Overview ¶
Package draft provides draft management for spec authoring.
Index ¶
- Variables
- func AddEvalResult(projectPath string, specType types.SpecType, score float64, passed bool, ...) error
- func Discard(projectPath string, specType types.SpecType) error
- func DraftPath(projectPath string, specType types.SpecType) string
- func Exists(projectPath string, specType types.SpecType) bool
- func Finalize(projectPath string, specType types.SpecType) error
- func MetadataPath(projectPath string, specType types.SpecType) string
- func SpecExists(projectPath string, specType types.SpecType) bool
- type Draft
- type EvalSummary
- type Metadata
- type Session
- func (s *Session) Content() string
- func (s *Session) Discard() error
- func (s *Session) EvalCount() int
- func (s *Session) Finalize() error
- func (s *Session) HasPassingEval() bool
- func (s *Session) Instructions() string
- func (s *Session) IsNew() bool
- func (s *Session) LastEval() *EvalSummary
- func (s *Session) RecordEval(score float64, passed bool, findings int) error
- func (s *Session) Status() SessionStatus
- func (s *Session) Summary() SessionSummary
- func (s *Session) Update(content string) error
- func (s *Session) Version() int
- type SessionStatus
- type SessionSummary
Constants ¶
This section is empty.
Variables ¶
var ErrDraftExists = errors.New("draft already exists")
ErrDraftExists indicates a draft already exists.
var ErrDraftNotFound = errors.New("draft not found")
ErrDraftNotFound indicates no draft exists.
var ErrSpecExists = errors.New("spec already exists")
ErrSpecExists indicates the final spec already exists.
Functions ¶
func AddEvalResult ¶
func AddEvalResult(projectPath string, specType types.SpecType, score float64, passed bool, findings int) error
AddEvalResult adds an evaluation result to the draft metadata.
func MetadataPath ¶
MetadataPath returns the full path for a draft metadata file.
Types ¶
type Draft ¶
Draft represents a draft document with its metadata.
func ListDrafts ¶
ListDrafts returns all drafts in a project.
type EvalSummary ¶
type EvalSummary struct {
Timestamp time.Time `json:"timestamp"`
Score float64 `json:"score"`
Passed bool `json:"passed"`
Findings int `json:"findings"`
}
EvalSummary summarizes a previous evaluation.
type Metadata ¶
type Metadata struct {
SpecType types.SpecType `json:"spec_type"`
ProjectName string `json:"project_name"`
StartedAt time.Time `json:"started_at"`
UpdatedAt time.Time `json:"updated_at"`
Version int `json:"version"`
EvalHistory []EvalSummary `json:"eval_history,omitempty"`
}
Metadata contains draft metadata.
type Session ¶
Session manages the state of a draft authoring session.
func ResumeSession ¶
ResumeSession resumes an existing draft session.
func StartSession ¶
StartSession begins a new draft session. If a draft already exists, it resumes that draft instead of creating a new one.
func (*Session) HasPassingEval ¶
HasPassingEval returns true if the draft has passed evaluation at least once.
func (*Session) Instructions ¶
Instructions returns authoring instructions based on current status.
func (*Session) LastEval ¶
func (s *Session) LastEval() *EvalSummary
LastEval returns the most recent evaluation summary, or nil if none.
func (*Session) RecordEval ¶
RecordEval records an evaluation result.
func (*Session) Status ¶
func (s *Session) Status() SessionStatus
Status returns the current session status.
func (*Session) Summary ¶
func (s *Session) Summary() SessionSummary
Summary returns a summary of the session.
type SessionStatus ¶
type SessionStatus string
SessionStatus represents the status of a draft session.
const ( StatusNew SessionStatus = "new" // Just started, no edits StatusEditing SessionStatus = "editing" // Has edits, not evaluated StatusEvaluated SessionStatus = "evaluated" // Has been evaluated StatusPassing SessionStatus = "passing" // Passed evaluation StatusFailing SessionStatus = "failing" // Failed evaluation StatusReady SessionStatus = "ready" // Ready to finalize )
type SessionSummary ¶
type SessionSummary struct {
SpecType types.SpecType `json:"spec_type"`
SpecName string `json:"spec_name"`
Version int `json:"version"`
Status SessionStatus `json:"status"`
EvalCount int `json:"eval_count"`
LastScore *float64 `json:"last_score,omitempty"`
LastPassed *bool `json:"last_passed,omitempty"`
HasTemplate bool `json:"has_template"`
ContentLength int `json:"content_length"`
}
Summary returns a brief summary of the session state.