reporting

package
v0.1.1 Latest Latest
Warning

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

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

Documentation

Overview

Package reporting generates morning summary reports for nightshift runs. Reports are generated as markdown and can be saved to disk or sent via notifications.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultReportsDir

func DefaultReportsDir() string

DefaultReportsDir returns the default directory for run reports.

func DefaultRunReportPath

func DefaultRunReportPath(ts time.Time) string

DefaultRunReportPath returns the default path for a run report file.

func DefaultRunResultsPath

func DefaultRunResultsPath(ts time.Time) string

DefaultRunResultsPath returns the default path for a run results JSON file.

func DefaultSummaryPath

func DefaultSummaryPath(date time.Time) string

DefaultSummaryPath returns the default path for a summary file.

func RenderRunReport

func RenderRunReport(results *RunResults, logPath string) (string, error)

RenderRunReport renders a markdown report for a single run.

func SaveRunReport

func SaveRunReport(results *RunResults, path string, logPath string) error

SaveRunReport writes a run report to disk.

func SaveRunResults

func SaveRunResults(results *RunResults, path string) error

SaveRunResults writes structured run results to disk as JSON.

Types

type Generator

type Generator struct {
	// contains filtered or unexported fields
}

Generator creates morning summary reports.

func NewGenerator

func NewGenerator(cfg *config.Config) *Generator

NewGenerator creates a summary generator with the given configuration.

func (*Generator) Generate

func (g *Generator) Generate(results *RunResults) (*Summary, error)

Generate creates a summary from run results.

func (*Generator) Save

func (g *Generator) Save(summary *Summary, path string) error

Save writes the summary to a file.

func (*Generator) SendNotifications

func (g *Generator) SendNotifications(summary *Summary) error

SendNotifications sends the summary via configured notification channels.

type RunResults

type RunResults struct {
	Date            time.Time    `json:"date"`
	StartBudget     int          `json:"start_budget"`
	UsedBudget      int          `json:"used_budget"`
	RemainingBudget int          `json:"remaining_budget"`
	Tasks           []TaskResult `json:"tasks"`
	StartTime       time.Time    `json:"start_time"`
	EndTime         time.Time    `json:"end_time"`
	LogPath         string       `json:"log_path,omitempty"`
}

RunResults holds all results from a nightshift run.

func LoadRunResults

func LoadRunResults(path string) (*RunResults, error)

LoadRunResults reads structured run results from disk.

type Summary

type Summary struct {
	Date            time.Time
	Content         string
	ProjectCounts   map[string]int
	CompletedTasks  []TaskResult
	SkippedTasks    []TaskResult
	FailedTasks     []TaskResult
	BudgetStart     int
	BudgetUsed      int
	BudgetRemaining int
}

Summary represents a generated morning summary.

type TaskResult

type TaskResult struct {
	Project    string        `json:"project"`
	TaskType   string        `json:"task_type"`
	Title      string        `json:"title"`
	Status     string        `json:"status"`                // completed, failed, skipped
	OutputType string        `json:"output_type,omitempty"` // PR, Report, Analysis, etc.
	OutputRef  string        `json:"output_ref,omitempty"`  // PR number, report path, etc.
	TokensUsed int           `json:"tokens_used"`
	SkipReason string        `json:"skip_reason,omitempty"` // e.g., "insufficient budget"
	Duration   time.Duration `json:"duration,omitempty"`
}

TaskResult represents a completed or skipped task in the run.

Jump to

Keyboard shortcuts

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