context

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package context provides CONTEXT.md generation for agent onboarding.

Index

Constants

This section is empty.

Variables

GitOpener is the opener used to access git repositories in the context package. Defaults to testable.DefaultGitOpener. Tests can replace this to inject mocks.

Functions

func Generate

func Generate(analysis *docs.RepoAnalysis, history *GitHistory, scanState *state.ScanState, w io.Writer) error

Generate writes a CONTEXT.md to w based on analysis, git history, and scan state. scanState may be nil if no previous scan exists.

Types

type AuthorStats

type AuthorStats struct {
	Name    string
	Commits int
}

AuthorStats tracks commit count per contributor.

type CommitSummary

type CommitSummary struct {
	Hash    string
	Message string
	Author  string
	Date    time.Time
	Files   int    // number of files changed
	IsMerge bool   // true if commit has 2+ parents
	Tag     string // non-empty if commit has a semver tag
}

CommitSummary holds metadata about a single commit.

type GitHistory

type GitHistory struct {
	RecentWeeks  []WeekActivity
	TopAuthors   []AuthorStats
	TotalCommits int
	Milestones   []TagInfo // all version tags, newest first, max 10
}

GitHistory holds aggregated git log analysis.

func AnalyzeHistory

func AnalyzeHistory(repoPath string, weeks int) (*GitHistory, error)

AnalyzeHistory walks the git log and groups commits by week. weeks controls how many weeks of history to include (default: 4).

type TagInfo added in v0.5.0

type TagInfo struct {
	Name string    // e.g. "v1.2.0"
	Hash string    // 8-char short hash
	Date time.Time // commit date
}

TagInfo holds metadata about a version tag.

type WeekActivity

type WeekActivity struct {
	WeekStart time.Time
	Commits   []CommitSummary
	Tags      []TagInfo // version tags that landed in this week
}

WeekActivity groups commits by ISO week.

Jump to

Keyboard shortcuts

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