Documentation
¶
Index ¶
Constants ¶
const ( UnstageKindBinary = "binary" UnstageKindSubmodule = "submodule" )
Kinds reported by DetectUnstageCandidates.
Variables ¶
This section is empty.
Functions ¶
func RunGenCommitMsg ¶
func UnstageCandidatePaths ¶ added in v0.0.224
func UnstageCandidatePaths(candidates []UnstageCandidate) []string
UnstageCandidatePaths returns the paths of candidates, preserving order.
Types ¶
type CommitMsg ¶ added in v0.0.9
func SanitizeOrError ¶ added in v0.0.63
SanitizeOrError runs Sanitize and returns an error when the message is rejected.
type GenerateOptions ¶
type SanitizeResult ¶ added in v0.0.63
SanitizeResult is the structured outcome of post-parse commit message sanitization.
func Sanitize ¶ added in v0.0.63
func Sanitize(raw string) SanitizeResult
Sanitize applies post-parse anti-pattern cleanup to agent commit-message text. On success returns a usable CommitMsg. On unusable garbage returns Rejected=true.
type UnstageCandidate ¶ added in v0.0.224
type UnstageCandidate struct {
// Path is repo-relative.
Path string
// Kind is UnstageKindBinary or UnstageKindSubmodule.
Kind string
// Desc describes the file type; only set for binaries.
Desc string
// SubmoduleDir is the owning submodule; only set for submodule paths.
SubmoduleDir string
}
UnstageCandidate is one path that gen-commit-msg removes from the index before generating a message: a staged binary file, or any staged path inside a submodule. Callers that stage files on the user's behalf can ask DetectUnstageCandidates what generation would drop and keep those paths out of the index, so generation never has to mutate a freshly prepared staging area.
func DetectUnstageCandidates ¶ added in v0.0.224
func DetectUnstageCandidates(dir string, paths []string) ([]UnstageCandidate, error)
DetectUnstageCandidates reports which of paths gen-commit-msg would unstage. A nil paths list means "the current staged set". Nothing is mutated and the process working directory is restored before returning.
This is the single detector behind both the --dry-run plan and the real unstage step, so external callers and generation can never disagree about which paths are excluded.