triage

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2020 License: MIT Imports: 26 Imported by: 0

README

Triage

Interactive command-line GitHub issue & notification triaging tool.

Features

Some of the current features include:

  • Quickly view and search notifications
  • View issue details, labels, and comments
  • View notifications without marking them as read
  • Mark notifications as read, or unsubscribe entirely
  • Unwatch entire repositories
  • Add and remove issue labels
  • Add comments to issues

Upcoming features may include things like:

  • Global priority management across all of your projects
  • Automatically prioritize based on your GitHub sponsors
  • Templated comment responses

Installation

Via gobinaries.com:

$ curl -sf https://gobinaries.com/tj/triage/cmd/triage | sh

Via ops run by CTO.ai:

$ npm install -g @cto.ai/ops && ops account:signup
$ ops run @tj/triage

Environment Variables

GITHUB_TOKEN

To access your Github activity, set your GITHUB_TOKEN environment variable to a valid personal access token:

export GITHUB_TOKEN=1234567c5560a274c59541e0787bf12345abcdef

The following permissions are needed for all functionality to work:

  • notifications for listing and unsubscribing from notifications
  • repo for adding labels and comments

Screenshots

Notifications listing:

Filtering notifications with the / search:

Viewing issue details:

Adding and removing labels:

Leaving a comment:


GoDoc

Sponsors

This project is sponsored by CTO.ai, making it easy for development teams to create and share workflow automations without leaving the command line.

Documentation

Overview

Package triage provides an interactive command-line GitHub issue & notification triaging tool.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddComment

func AddComment(n *github.Notification, issue *github.Issue, comment string) tea.Cmd

AddComment adds a comment to an issue.

func ClientFromContext

func ClientFromContext(ctx context.Context) (*github.Client, bool)

ClientFromContext returns client from context.

func GetDimensions

func GetDimensions(ctx context.Context) tea.Msg

GetDimensions requests the terminal dimensions.

func Init

func Init(ctx context.Context) (tea.Model, tea.Cmd)

Init function.

func LoadNotification

func LoadNotification(n *github.Notification) tea.Cmd

LoadNotification loads a notification's issue, labels, and comments.

func LoadNotificationComments

func LoadNotificationComments(issue *github.Issue) tea.Cmd

LoadNotificationComments loads a notification's comments.

func LoadNotificationIssue

func LoadNotificationIssue(n *github.Notification) tea.Cmd

LoadNotificationIssue loads a notification's issue.

func LoadNotificationLabels

func LoadNotificationLabels(n *github.Notification, issue *github.Issue) tea.Cmd

LoadNotificationLabels loads a notification's labels.

func LoadNotifications

func LoadNotifications(ctx context.Context) tea.Msg

LoadNotifications loads the notifications.

func LoadRepoLabels

func LoadRepoLabels(n *github.Notification) tea.Cmd

LoadRepoLabels loads a repo's labels.

func MarkAsRead

func MarkAsRead(n *github.Notification) tea.Cmd

MarkAsRead marks an issue as read.

func MustClientFromContext

func MustClientFromContext(ctx context.Context) *github.Client

MustClientFromContext returns client from context.

func NewClientContext

func NewClientContext(ctx context.Context, v *github.Client) context.Context

NewClientContext returns a new context with client.

func NewConfigContext

func NewConfigContext(ctx context.Context, v *Config) context.Context

NewConfigContext returns a new context with config.

func OpenInBrowser

func OpenInBrowser(n *github.Notification) tea.Cmd

OpenInBrowser opens the in the browser.

func Unsubscribe

func Unsubscribe(n *github.Notification) tea.Cmd

Unsubscribe unsubscribes from the issue, and marks it as read.

func Unwatch

func Unwatch(owner, repo string) tea.Cmd

Unwatch unwatches the repository, and marks it as read.

func Update

func Update(ctx context.Context, msg tea.Msg, model tea.Model) (tea.Model, tea.Cmd)

Update function.

func UpdateNotificationLabels

func UpdateNotificationLabels(n *github.Notification, issue *github.Issue, labels []string) tea.Cmd

UpdateNotificationLabels updates an issue's labels.

func UpdateNotificationPriority

func UpdateNotificationPriority(n *github.Notification, issue *github.Issue, name string) tea.Cmd

UpdateNotificationPriority updates an issue's priority by name.

func View

func View(ctx context.Context, model tea.Model) string

View function.

Types

type CommentAdded

type CommentAdded struct{}

CommentAdded msg.

type Config

type Config struct {
	// Priorities is a set of priorities used in assigning. By default
	// low, medium, and high are provided.
	Priorities []Priority

	// Theme is style related configuration.
	Theme struct {
		// Code is the syntax theme used for highlighting blocks of code.
		Code *termd.SyntaxTheme `json:"code"`
	} `json:"theme"`
}

Config is the user configuration.

func ConfigFromContext

func ConfigFromContext(ctx context.Context) (*Config, bool)

ConfigFromContext returns config from context.

func MustConfigFromContext

func MustConfigFromContext(ctx context.Context) *Config

MustConfigFromContext returns config from context.

type GotDimensions

type GotDimensions struct {
	Width  int
	Height int
}

GotDimensions msg.

type LabelsLoaded

type LabelsLoaded struct {
	Labels []*github.Label
}

LabelsLoaded msg.

type MarkedAsRead

type MarkedAsRead struct {
	*github.Notification
}

MarkedAsRead msg.

type Model

type Model struct {
	// active page
	Page

	// notifications page
	Notifications        []*github.Notification
	NotificationsScrollY int
	Selected             int
	Searching            bool
	SearchInput          input.Model

	// notification page
	Notification        *github.Notification
	NotificationScrollY int
	Labels              []*github.Label
	Issue               *github.Issue
	Comments            []*github.IssueComment
	LoadingIssue        bool
	LoadingLabels       bool
	LoadingComments     bool

	// priorities page
	PriorityOptions option.Model

	// labels page
	LabelOptions options.Model
	RepoLabels   []*github.Label

	// comment
	CommentInput input.Model

	// shared
	MarkingAsRead bool
	Unsubscribing bool
	Unwatching    bool
	Loading       bool
	Width         int
	Height        int
}

Model is the application model.

type NotificationCommentsLoaded

type NotificationCommentsLoaded struct {
	Comments []*github.IssueComment
}

NotificationCommentsLoaded msg.

type NotificationIssueLoaded

type NotificationIssueLoaded struct {
	Issue *github.Issue
}

NotificationIssueLoaded msg.

type NotificationLabelsLoaded

type NotificationLabelsLoaded struct {
	Labels []*github.Label
}

NotificationLabelsLoaded msg.

type NotificationLabelsUpdated

type NotificationLabelsUpdated struct{}

NotificationLabelsUpdated msg.

type NotificationPriorityUpdated

type NotificationPriorityUpdated struct{}

NotificationPriorityUpdated msg.

type NotificationsLoaded

type NotificationsLoaded struct {
	Notifications []*github.Notification
}

NotificationsLoaded msg.

type Page

type Page int

Page is the page the user is viewing.

const (
	PageNotifications Page = iota
	PageNotification
	PageLabels
	PageComment
	PagePriorities
)

Pages available.

type Priority

type Priority struct {
	// Name of the priority.
	Name string `json:"name"`

	// Label is the GitHub label name.
	Label string `json:"label"`

	// Color is the GitHub label color, for example "#532BE3".
	Color string `json:"color"`
}

Priority is user configurable priority name and label.

type Unsubscribed

type Unsubscribed struct {
	*github.Notification
}

Unsubscribed msg.

type Unwatched

type Unwatched struct {
	Owner string
	Repo  string
}

Unwatched msg.

Directories

Path Synopsis
cmd
internal

Jump to

Keyboard shortcuts

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