cluster

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2026 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExportEpisodes

func ExportEpisodes(episodes []Episode, format string, writer io.Writer) error

ExportEpisodes exports episodes in JSON format

Types

type Artifact

type Artifact struct {
	ID          string           `json:"id"`
	Number      int              `json:"number"`
	Type        ArtifactType     `json:"type"`
	Title       string           `json:"title"`
	Description string           `json:"description"`
	State       string           `json:"state"` // open, closed, merged
	Author      git.Author       `json:"author"`
	Assignees   []string         `json:"assignees"`
	Labels      []string         `json:"labels"`
	CreatedAt   time.Time        `json:"created_at"`
	UpdatedAt   time.Time        `json:"updated_at"`
	ClosedAt    *time.Time       `json:"closed_at,omitempty"`
	MergedAt    *time.Time       `json:"merged_at,omitempty"`
	Discussions []Discussion     `json:"discussions"`
	Metadata    ArtifactMetadata `json:"metadata"`
	URL         string           `json:"url"`
}

Artifact represents unified development artifacts (issues, PRs, tickets) Normalizes issue/PR data across GitHub, GitLab, Bitbucket, etc.

type ArtifactMetadata

type ArtifactMetadata struct {
	// Pull Request / Merge Request specific
	BaseBranch     string `json:"base_branch,omitempty"`
	HeadBranch     string `json:"head_branch,omitempty"`
	MergeCommitSHA string `json:"merge_commit_sha,omitempty"`
	Additions      int    `json:"additions,omitempty"`
	Deletions      int    `json:"deletions,omitempty"`
	ChangedFiles   int    `json:"changed_files,omitempty"`
	ReviewState    string `json:"review_state,omitempty"`
	IsDraft        bool   `json:"is_draft,omitempty"`

	// Issue / Ticket specific
	Priority  string     `json:"priority,omitempty"`
	Milestone string     `json:"milestone,omitempty"`
	DueDate   *time.Time `json:"due_date,omitempty"`

	// Cross-references
	RelatedArtifacts []string `json:"related_artifacts,omitempty"`
}

ArtifactMetadata contains type-specific metadata for artifacts

type ArtifactType

type ArtifactType string

ArtifactType represents the type of development artifact

const (
	ArtifactIssue        ArtifactType = "issue"
	ArtifactPullRequest  ArtifactType = "pull_request"
	ArtifactMergeRequest ArtifactType = "merge_request" // GitLab terminology
	ArtifactTicket       ArtifactType = "ticket"
)

type Discussion

type Discussion struct {
	ID        string         `json:"id"`
	Type      DiscussionType `json:"type"`
	Author    git.Author     `json:"author"`
	Body      string         `json:"body"`
	CreatedAt time.Time      `json:"created_at"`
	UpdatedAt time.Time      `json:"updated_at"`

	// Thread context
	ParentID string `json:"parent_id,omitempty"`
	ThreadID string `json:"thread_id,omitempty"`

	// Code review specific
	FilePath    string `json:"file_path,omitempty"`
	LineNumber  int    `json:"line_number,omitempty"`
	CommitHash  string `json:"commit_hash,omitempty"`
	ReviewState string `json:"review_state,omitempty"` // approved, changes_requested, commented

	// Engagement
	Reactions Reactions `json:"reactions,omitempty"`
}

Discussion represents unified conversation threads Normalizes comments, reviews, and discussion threads across platforms

type DiscussionType

type DiscussionType string

DiscussionType represents the type of discussion entry

const (
	DiscussionComment      DiscussionType = "comment"
	DiscussionReview       DiscussionType = "review"
	DiscussionReviewThread DiscussionType = "review_thread"
	DiscussionNote         DiscussionType = "note" // GitLab terminology
)

type Episode

type Episode struct {
	ID        string       `json:"id"`
	Commits   []git.Commit `json:"commits"`
	Artifacts []Artifact   `json:"artifacts,omitempty"`
}

Episode represents a narrative grouping of commits and optionally artifacts

func (*Episode) GetArtifactAuthors

func (e *Episode) GetArtifactAuthors() []git.Author

GetArtifactAuthors extracts unique authors from the episode's artifacts

func (*Episode) GetAuthorNames

func (e *Episode) GetAuthorNames() []string

GetAuthorNames extracts unique author names from commits and artifacts Returns a sorted list of author names

func (*Episode) GetCommitAuthors

func (e *Episode) GetCommitAuthors() []git.Author

GetCommitAuthors extracts unique authors from the episode's commits

func (*Episode) GetDateRange

func (e *Episode) GetDateRange() (time.Time, time.Time)

GetDateRange returns the start and end times for the episode Examines both commits and artifacts to find the earliest and latest timestamps

func (*Episode) GetDiscussionAuthors

func (e *Episode) GetDiscussionAuthors() []git.Author

GetDiscussionAuthors extracts unique authors from discussions within the episode's artifacts

func (*Episode) GetDuration

func (e *Episode) GetDuration() time.Duration

GetDuration returns the time span from oldest to newest commit in the episode Returns zero duration if there are no commits or only one commit

func (*Episode) GetFileCount

func (e *Episode) GetFileCount() int

GetFileCount returns the total number of unique files changed across all commits

type EpisodeExport

type EpisodeExport struct {
	ID           string       `json:"id"`
	CommitCount  int          `json:"commit_count"`
	AuthorCount  int          `json:"author_count"`
	PRCount      int          `json:"pr_count"`
	IssueCount   int          `json:"issue_count"`
	StartDate    time.Time    `json:"start_date"`
	EndDate      time.Time    `json:"end_date"`
	Duration     string       `json:"duration"`
	Authors      []string     `json:"authors"`
	CommitHashes []string     `json:"commit_hashes"`
	Commits      []git.Commit `json:"commits"`
	Artifacts    []Artifact   `json:"artifacts"`
}

EpisodeExport represents an episode with enrichment counts for export

type ExportFormat

type ExportFormat string

ExportFormat represents supported export formats

const (
	FormatJSON ExportFormat = "json"
)

type GroupingConfig

type GroupingConfig struct {
	// Maximum time gap between commits in the same episode
	MaxTimeGap time.Duration

	// Minimum number of commits to form an episode
	MinCommits int

	// Weight factors for similarity scoring (should sum to 1.0)
	TimeWeight     float64
	AuthorWeight   float64
	FileWeight     float64
	MessageWeight  float64
	ArtifactWeight float64

	// Similarity thresholds
	MinSimilarityScore float64 // Minimum score to group commits together
}

GroupingConfig defines parameters for episode grouping heuristics

func DefaultGroupingConfig

func DefaultGroupingConfig() GroupingConfig

DefaultGroupingConfig returns sensible default grouping parameters

type Reactions

type Reactions struct {
	ThumbsUp   int `json:"thumbs_up"`
	ThumbsDown int `json:"thumbs_down"`
	Laugh      int `json:"laugh"`
	Hooray     int `json:"hooray"`
	Confused   int `json:"confused"`
	Heart      int `json:"heart"`
	Rocket     int `json:"rocket"`
	Eyes       int `json:"eyes"`
	TotalCount int `json:"total_count"`
}

Reactions represents engagement reactions on discussions

type RepositoryActivity

type RepositoryActivity struct {
	Platform       SourcePlatform `json:"platform"`
	RepositoryURL  string         `json:"repository_url"`
	RepositoryName string         `json:"repository_name"`
	Owner          string         `json:"owner"`
	DefaultBranch  string         `json:"default_branch"`
	Commits        []git.Commit   `json:"commits"`
	Artifacts      []Artifact     `json:"artifacts"`
	FetchedAt      time.Time      `json:"fetched_at"`
}

RepositoryActivity represents unified repository data across all platforms Designed to aggregate commits, artifacts, and discussions for narrative generation

func (*RepositoryActivity) GroupIntoEpisodes

func (ra *RepositoryActivity) GroupIntoEpisodes(config GroupingConfig) []Episode

GroupIntoEpisodes groups commits and artifacts into logical episodes using heuristics based on time, author, file paths, and artifact references

type SourcePlatform

type SourcePlatform string

SourcePlatform represents the origin platform of repository data

const (
	PlatformGit       SourcePlatform = "git"
	PlatformGitHub    SourcePlatform = "github"
	PlatformGitLab    SourcePlatform = "gitlab"
	PlatformBitbucket SourcePlatform = "bitbucket"
	PlatformLocal     SourcePlatform = "local"
)

Jump to

Keyboard shortcuts

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