summary

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package summary provides the command to display a high-level dashboard of the project's status. It aggregates data from the work item provider to show urgent bugs, user assignments, and active epics.

Index

Constants

This section is empty.

Variables

View Source
var SummaryCmd = &cobra.Command{
	Use:   "summary",
	Short: "Displays a 'Morning Briefing' of project status.",
	RunE: func(cmd *cobra.Command, _ []string) error {
		presenter := ui.NewPresenter(cmd.OutOrStdout(), cmd.ErrOrStderr())
		ctx := cmd.Context()

		provider, err := newProvider(ctx, globals.AppLogger, globals.LoadedAppConfig)
		if err != nil {
			presenter.Error("Failed to initialize work item provider: %v", err)

			return err
		}

		presenter.Summary("Project Morning Briefing")

		// We will fetch data in parallel
		var waitGroup sync.WaitGroup
		waitGroup.Add(concurrentFetches)

		var bugs, myTasks, epics []workitem.WorkItem
		var errBugs, errTasks, errEpics error

		go func() {
			defer waitGroup.Done()

			bugs, errBugs = provider.SearchItems(ctx, "is:open is:issue label:bug sort:updated-desc")
		}()

		go func() {
			defer waitGroup.Done()

			myTasks, errTasks = provider.SearchItems(ctx, "is:open is:issue assignee:@me sort:updated-desc")
		}()

		go func() {
			defer waitGroup.Done()

			epics, errEpics = provider.SearchItems(ctx, "is:open is:issue label:epic sort:updated-desc")
		}()

		presenter.Info("Fetching project data...")
		waitGroup.Wait()

		presenter.Header("[!] Urgent Attention (Bugs)")
		if errBugs != nil {
			presenter.Warning("Could not fetch bugs: %v", errBugs)
		} else if len(bugs) == 0 {
			presenter.Success("No open bugs found. Great work!")
		} else {
			for _, item := range limit(bugs, maxBugsToList) {
				printItem(presenter, item)
			}
			if len(bugs) > maxBugsToList {
				presenter.Detail("... and %d more.", len(bugs)-maxBugsToList)
			}
		}
		presenter.Newline()

		presenter.Header("[@] On Your Plate (Assigned to You)")
		if errTasks != nil {
			presenter.Warning("Could not fetch your tasks: %v", errTasks)
		} else if len(myTasks) == 0 {
			presenter.Info("You have no assigned issues.")
		} else {
			for _, item := range limit(myTasks, maxTasksToList) {
				printItem(presenter, item)
			}
			if len(myTasks) > maxTasksToList {
				presenter.Detail("... and %d more.", len(myTasks)-maxTasksToList)
			}
		}
		presenter.Newline()

		presenter.Header("[#] Strategic Context (Active Epics)")
		if errEpics != nil {
			presenter.Warning("Could not fetch epics: %v", errEpics)
		} else if len(epics) == 0 {
			presenter.Info("No active epics found.")
		} else {
			for _, item := range limit(epics, maxEpicsToList) {

				fmt.Fprintf(presenter.Out(), "  • #%d: %s\n", item.Number, item.Title)
			}
		}

		return nil
	},
}

SummaryCmd represents the project summary command.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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