view

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package view provides dashboard functionality for displaying a comprehensive project overview including specs, changes, and tasks.

Package view provides dashboard functionality for displaying a comprehensive project overview including specs, changes, and tasks.

Package view provides dashboard functionality for displaying a comprehensive project overview including specs, changes, and tasks.

Package view provides dashboard functionality for displaying a comprehensive project overview including specs, changes, and tasks.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatDashboardJSON

func FormatDashboardJSON(data *DashboardData) (string, error)

FormatDashboardJSON formats the dashboard data as machine-readable JSON output.

The output structure matches the schema defined in design.md:

  • summary: Aggregate metrics (totalSpecs, totalRequirements, activeChanges, etc.)
  • activeChanges: Array of changes in progress with task completion metrics
  • completedChanges: Array of completed changes
  • specs: Array of specifications with requirement counts

Arrays are pre-sorted by the CollectData() function, ensuring consistent output. The JSON is formatted with indentation for human readability.

Returns the formatted JSON string and any marshaling error.

func FormatDashboardText

func FormatDashboardText(data *DashboardData) string

FormatDashboardText formats the dashboard data as human-readable terminal output with colored sections, progress bars, and visual indicators.

The output follows the format specification in design.md: - Dashboard title with double-line separator - Summary section with bullet points and metrics - Active changes with progress bars - Completed changes with checkmarks - Specifications with requirement counts - Footer with navigation hints

Empty sections (e.g., no completed changes) are automatically hidden.

func RenderBar

func RenderBar(completed, total int) string

RenderBar creates a visual progress bar string with the format: [████████████░░░░░░░░] 60% It uses a fixed width of 20 characters with filled (█) and empty (░) block characters. The filled portion is colored green and the empty portion is dim gray.

Parameters:

  • completed: number of completed tasks
  • total: total number of tasks

Returns a formatted string containing the progress bar and percentage.

Edge case: If total is 0, renders an empty bar [░░░░░░░░░░░░░░░░░░░░] with dim styling.

Types

type ChangeProgress

type ChangeProgress struct {
	ID       string          `json:"id"`       // Change ID (directory name)
	Title    string          `json:"title"`    // Change title from proposal.md
	Progress ProgressMetrics `json:"progress"` // Task completion metrics
}

ChangeProgress represents an active change with task completion progress

type CompletedChange

type CompletedChange struct {
	ID    string `json:"id"`    // Change ID (directory name)
	Title string `json:"title"` // Change title from proposal.md
}

CompletedChange represents a change that has all tasks completed

type DashboardData

type DashboardData struct {
	Summary          SummaryMetrics    `json:"summary"`
	ActiveChanges    []ChangeProgress  `json:"activeChanges"`
	CompletedChanges []CompletedChange `json:"completedChanges"`
	Specs            []SpecInfo        `json:"specs"`
}

DashboardData represents the complete dashboard data structure containing summary metrics, active changes, completed changes, and specifications.

func CollectData

func CollectData(projectPath string) (*DashboardData, error)

CollectData gathers all dashboard information from the project, including active changes, completed changes, specifications, and summary metrics.

The function performs the following steps:

  1. Discovers all changes in spectr/changes/ directory
  2. Parses each change's proposal.md for title
  3. Parses each change's tasks.md for task completion status
  4. Categorizes changes as active (incomplete) or completed
  5. Discovers all specs in spectr/specs/ directory
  6. Parses each spec's spec.md for title and requirement count
  7. Sorts results per design specification (active changes by completion ascending, specs by requirement count descending)

Returns DashboardData structure or error if discovery fails.

type ProgressMetrics

type ProgressMetrics struct {
	Total      int `json:"total"`      // Total number of tasks
	Completed  int `json:"completed"`  // Number of completed tasks
	Percentage int `json:"percentage"` // Completion percentage (0-100)
}

ProgressMetrics represents task completion statistics for a change

type SpecInfo

type SpecInfo struct {
	// Spec ID (directory name)
	ID string `json:"id"`
	// Spec title from spec.md
	Title string `json:"title"`
	// Number of requirements in spec
	RequirementCount int `json:"requirementCount"`
}

SpecInfo represents a specification with metadata

type SummaryMetrics

type SummaryMetrics struct {
	// Total number of specifications
	TotalSpecs int `json:"totalSpecs"`
	// Total requirements across all specs
	TotalRequirements int `json:"totalRequirements"`
	// Number of active changes (incomplete)
	ActiveChanges int `json:"activeChanges"`
	// Number of completed changes
	CompletedChanges int `json:"completedChanges"`
	// Total tasks across all active changes
	TotalTasks int `json:"totalTasks"`
	// Completed tasks across all active changes
	CompletedTasks int `json:"completedTasks"`
}

SummaryMetrics represents aggregate metrics across the project

Jump to

Keyboard shortcuts

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