Documentation
¶
Index ¶
- Constants
- func GenerateMessage(summary ChangeSummary) string
- func ValidateMessage(message string) error
- type ChangeSnapshot
- type ChangeSummary
- type CommandResult
- type CommitOptions
- type CommitResult
- type DiffStat
- type EnvRunner
- type Event
- type EventType
- type FileChange
- type InspectOptions
- type Runner
Constants ¶
View Source
const ChangeContractVersion = "zero.changes.report.v1"
View Source
const RuntimeGo = "go"
Variables ¶
This section is empty.
Functions ¶
func GenerateMessage ¶
func GenerateMessage(summary ChangeSummary) string
func ValidateMessage ¶
Types ¶
type ChangeSnapshot ¶
type ChangeSnapshot struct {
Contract string `json:"contract"`
Runtime string `json:"runtime"`
Root string `json:"root"`
Branch string `json:"branch,omitempty"`
Base string `json:"base,omitempty"`
Commit string `json:"commit,omitempty"`
Clean bool `json:"clean"`
Files []FileChange `json:"files"`
DiffStat string `json:"diffStat,omitempty"`
Diff string `json:"diff,omitempty"`
Truncated bool `json:"truncated,omitempty"`
Events []Event `json:"events"`
}
func SnapshotFromSummary ¶
func SnapshotFromSummary(summary ChangeSummary) ChangeSnapshot
type ChangeSummary ¶
type ChangeSummary struct {
Root string `json:"root"`
Branch string `json:"branch,omitempty"`
Base string `json:"base,omitempty"`
Commit string `json:"commit,omitempty"`
Clean bool `json:"clean"`
Files []FileChange `json:"files"`
DiffStat string `json:"diffStat,omitempty"`
Diff string `json:"diff,omitempty"`
Truncated bool `json:"truncated,omitempty"`
}
func Inspect ¶
func Inspect(ctx context.Context, options InspectOptions) (ChangeSummary, error)
type CommandResult ¶
type CommitOptions ¶
type CommitResult ¶
type CommitResult struct {
Root string `json:"root"`
Message string `json:"message"`
DryRun bool `json:"dryRun"`
Committed bool `json:"committed"`
CommitHash string `json:"commitHash,omitempty"`
Before ChangeSummary `json:"before"`
}
func Commit ¶
func Commit(ctx context.Context, options CommitOptions) (CommitResult, error)
type DiffStat ¶
DiffStat is the parsed summary line of a `git diff --stat` invocation. The summary line ("N files changed, A insertions(+), B deletions(-)") carries no secret-bearing tokens, so it is safe to parse from an already-redacted stat.
func ParseDiffStat ¶
ParseDiffStat extracts file/insertion/deletion counts from the trailing summary line of a `git diff --stat` output, e.g. "3 files changed, 12 insertions(+), 4 deletions(-)". Missing insertion or deletion clauses default to zero, and any malformed input yields a zero-value DiffStat without panicking.
type Event ¶
type Event struct {
Type EventType `json:"type"`
Runtime string `json:"runtime,omitempty"`
Contract string `json:"contract,omitempty"`
Root string `json:"root,omitempty"`
Branch string `json:"branch,omitempty"`
Commit string `json:"commit,omitempty"`
Clean bool `json:"clean,omitempty"`
FileCount int `json:"fileCount,omitempty"`
Path string `json:"path,omitempty"`
Status string `json:"status,omitempty"`
Staged bool `json:"staged,omitempty"`
Unstaged bool `json:"unstaged,omitempty"`
Untracked bool `json:"untracked,omitempty"`
}
func EventsFromSummary ¶
func EventsFromSummary(summary ChangeSummary) []Event
type FileChange ¶
type InspectOptions ¶
Click to show internal directories.
Click to hide internal directories.