changed

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package changed implements `sf changed` — a compact, classified summary of a git diff: per file its status, churn (+/-), category, language, and the enclosing functions/classes touched (read from git's own hunk-header function context, no file parsing). Replaces reading a full `git diff` just to learn what changed and where.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCommand

func NewCommand() *cobra.Command

NewCommand returns the `changed` Cobra command (`sf changed`).

func Run

func Run(opts Options, w io.Writer) error

Run collects the classified diff, renders it, and logs the call.

Types

type Change

type Change struct {
	Status   string   `json:"status"` // M, A, D, R, untracked
	Path     string   `json:"path"`
	Category string   `json:"category"`
	Lang     string   `json:"lang,omitempty"`
	Adds     int      `json:"adds"`
	Dels     int      `json:"dels"`
	Symbols  []string `json:"symbols,omitempty"` // enclosing funcs/classes touched
}

Change is one changed file.

type Options

type Options struct {
	Root    string // git repo dir (default: cwd)
	Range   string // optional revision/range (e.g. HEAD~3, main..HEAD)
	Staged  bool   // staged changes only
	Symbols bool   // include touched symbols (from hunk headers); default true
	Format  string
}

type Result

type Result struct {
	Spec    string   `json:"spec"` // what was diffed (range/staged/working tree)
	Changes []Change `json:"changes"`
}

Result is the classified diff.

func Collect

func Collect(opts Options) (*Result, error)

Collect runs git and assembles the classified diff.

Jump to

Keyboard shortcuts

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