repocontext

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package repocontext gathers common repo metadata (name, CLAUDE.md, README, git log) used by multiple commands as prompt context for AI calls.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GatherRepoContext

func GatherRepoContext() string

GatherRepoContext returns a markdown snapshot of the current repo state: CLAUDE.md/AGENTS.md/README.md previews, recent commits, working tree, and file structure. It operates on the current working directory and never returns an error — failures are surfaced as empty sections.

Types

type Context

type Context struct {
	// RepoPath is the absolute path to the repository root.
	RepoPath string
	// Name is the base directory name of the repository.
	Name string
	// Claude is the full content of CLAUDE.md, or empty if not present.
	Claude string
	// Readme is the first 2048 bytes of README.md, or empty if not present.
	Readme string
	// GitLog is the output of `git log --oneline -20`, or empty on error.
	GitLog string
}

Context holds the gathered metadata for a repository.

func Gather

func Gather(repoPath string) (Context, error)

Gather reads repo metadata from repoPath. If repoPath is empty, os.Getwd is used. Missing files are silently ignored; only the repoPath resolution can return an error.

func (Context) MarkdownSections

func (c Context) MarkdownSections() string

MarkdownSections renders the populated fields as markdown sections. Fields with no content are omitted.

func (Context) Summary

func (c Context) Summary() string

Summary returns a single-line repo description suitable for use in prompts. Format: "repo: <name>"

Jump to

Keyboard shortcuts

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