dispatch

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: May 7, 2026 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const CloudRepoLimit = 5

CloudRepoLimit caps how many repos the cloud mode may query in one request.

Variables

This section is empty.

Functions

func NormalizeWindow

func NormalizeWindow(since, until time.Time) (time.Time, time.Time)

func ParseSinceAtNow

func ParseSinceAtNow(value string, now time.Time) (time.Time, error)

ParseSinceAtNow parses durations like 7d, relative times like "2 days ago", RFC3339 timestamps, and ISO dates.

func ParseUntilAtNow

func ParseUntilAtNow(value string, now time.Time) (time.Time, error)

func RenderMarkdown

func RenderMarkdown(dispatch *Dispatch) string

Types

type APIBranches

type APIBranches struct {
	Values []string
	All    bool
}

func (*APIBranches) UnmarshalJSON

func (b *APIBranches) UnmarshalJSON(data []byte) error

type APIBullet

type APIBullet struct {
	CheckpointID string   `json:"checkpoint_id"`
	Text         string   `json:"text"`
	Source       string   `json:"source"`
	Branch       string   `json:"branch"`
	CreatedAt    string   `json:"created_at"`
	Labels       []string `json:"labels"`
}

type APIRepo

type APIRepo struct {
	FullName string       `json:"full_name"`
	URL      string       `json:"url,omitempty"`
	Sections []APISection `json:"sections"`
}

type APISection

type APISection struct {
	Label   string      `json:"label"`
	Bullets []APIBullet `json:"bullets"`
}

type APITotals

type APITotals struct {
	Checkpoints         int `json:"checkpoints"`
	UsedCheckpointCount int `json:"used_checkpoint_count"`
	Branches            int `json:"branches"`
	FilesTouched        int `json:"files_touched"`
}

type APIWarnings

type APIWarnings struct {
	AccessDeniedCount  int `json:"access_denied_count"`
	PendingCount       int `json:"pending_count"`
	FailedCount        int `json:"failed_count"`
	UnknownCount       int `json:"unknown_count"`
	UncategorizedCount int `json:"uncategorized_count"`
	TruncatedCount     int `json:"truncated_count"`
}

type APIWindow

type APIWindow struct {
	NormalizedSince          string `json:"normalized_since"`
	NormalizedUntil          string `json:"normalized_until"`
	FirstCheckpointCreatedAt string `json:"first_checkpoint_created_at,omitempty"`
	LastCheckpointCreatedAt  string `json:"last_checkpoint_created_at,omitempty"`
}

type Bullet

type Bullet struct {
	CheckpointID string
	Text         string
	Source       string
	Branch       string
	CreatedAt    time.Time
	Labels       []string
}

type CloudClient

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

func NewCloudClient

func NewCloudClient(cfg CloudConfig) *CloudClient

func (*CloudClient) CreateDispatch

func (c *CloudClient) CreateDispatch(ctx context.Context, reqBody CreateDispatchRequest) (*CreateDispatchResponse, error)

type CloudConfig

type CloudConfig struct {
	BaseURL string
	Token   string
	HTTP    *http.Client
	Timeout time.Duration
}

type CreateDispatchRequest

type CreateDispatchRequest struct {
	Repos    []string `json:"repos,omitempty"`
	Since    string   `json:"since"`
	Until    string   `json:"until"`
	Generate bool     `json:"generate"`
	Voice    string   `json:"voice,omitempty"`
}

type CreateDispatchResponse

type CreateDispatchResponse struct {
	Window            APIWindow   `json:"window"`
	Title             string      `json:"title,omitempty"`
	CoveredRepos      []string    `json:"covered_repos,omitempty"`
	Branches          APIBranches `json:"branches,omitempty"`
	Voice             *string     `json:"voice"`
	Repos             []APIRepo   `json:"repos,omitempty"`
	Totals            APITotals   `json:"totals"`
	Warnings          APIWarnings `json:"warnings"`
	GeneratedText     string      `json:"generated_text,omitempty"`
	GeneratedMarkdown string      `json:"generated_markdown,omitempty"`
}

type Dispatch

type Dispatch struct {
	Window        Window
	CoveredRepos  []string
	Repos         []RepoGroup
	GeneratedText string
}

func Run

func Run(ctx context.Context, opts Options) (*Dispatch, error)

type Mode

type Mode int
const (
	ModeServer Mode = iota
	ModeLocal
)

func (Mode) String

func (m Mode) String() string

type Options

type Options struct {
	Mode                  Mode
	RepoPaths             []string
	Since                 string
	Until                 string
	Branches              []string
	AllBranches           bool
	ImplicitCurrentBranch bool
	Voice                 string
	InsecureHTTPAuth      bool
}

func ResolveOptions

func ResolveOptions(
	flagLocal bool,
	flagSince string,
	flagUntil string,
	flagAllBranches bool,
	flagRepos []string,
	flagVoice string,
	flagInsecureHTTPAuth bool,
	currentBranch func() (string, error),
) (Options, error)

type RepoGroup

type RepoGroup struct {
	FullName string
	URL      string
	Sections []Section
}

type Section

type Section struct {
	Label   string
	Bullets []Bullet
}

type Voice

type Voice struct {
	Name string
	Text string
}

func ResolveVoice

func ResolveVoice(value string) Voice

type Window

type Window struct {
	NormalizedSince   time.Time
	NormalizedUntil   time.Time
	FirstCheckpointAt time.Time
	LastCheckpointAt  time.Time
}

Jump to

Keyboard shortcuts

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