gitfacts

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package gitfacts renders a deterministic, zero-LLM analysis of a git repository: modules and churn, commit conventions, dependencies, build/test layout, branch-unique work, and the existing CLAUDE.md as a prior. Its output is the entire input to `culi gen`'s model calls — pay for intelligence only where determinism can't reach (§9). The render is content-hashed so an unchanged repo costs zero LLM calls.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Facts

type Facts struct {
	Repo    string
	Root    string
	Branch  string // current branch ("" when detached/unreadable)
	Modules []Module
	// Conventions describes commit-subject style (conventional-commit ratio,
	// common prefixes).
	Conventions string
	Deps        []string
	BuildTest   string // Makefile targets, CI workflows, test-file count
	// BranchWork is non-empty only when a branch was requested: unique
	// commits vs the merge base and the directories they touch.
	BranchWork string
	// Prior is the existing CLAUDE.md with culi marker spans stripped — the
	// human-authored content the draft must respect, never duplicate.
	Prior string
}

Facts is one repo's deterministic analysis.

func Collect

func Collect(ctx context.Context, root, branch string) (Facts, error)

Collect analyzes the repo at root. branch "" analyzes the repo as a whole; otherwise BranchWork covers branch-unique commits. Individual probe failures degrade to empty sections (detached HEAD, mid-rebase, shallow clones must not fail the run); only "not a git repo" is fatal.

func (Facts) Hash

func (f Facts) Hash() string

Hash fingerprints the render; unchanged hash = whole gen run is a no-op.

func (Facts) Render

func (f Facts) Render() string

Render renders the facts as the markdown fed to the model.

type Module

type Module struct {
	Dir     string
	Commits int
	Lines   int
}

Module is one directory's churn summary.

Jump to

Keyboard shortcuts

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