Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BranchFromRefspec ¶
BranchFromRefspec extracts the branch name from a refspec like "HEAD:refs/heads/main".
Types ¶
type Backend ¶
type Backend interface {
Execute(ctx context.Context, plan *Plan, conventional bool) (*Result, error)
}
Backend executes a commit plan.
type DryRunBackend ¶
type DryRunBackend struct {
RootDir string
}
DryRunBackend prints the commit plan without side effects.
type FileChange ¶
FileChange represents a file with its change status.
type ForgeBackend ¶
ForgeBackend creates commits purely via forge API (no local git commit).
type GitBackend ¶
type GitBackend struct {
RootDir string
}
GitBackend executes commits via the git CLI.
type Plan ¶
type Plan struct {
Type string
Scope string
Summary string
Body string
Breaking bool
SkipCI bool
Paths []string // for StageExplicit
StageMode StageMode
Push PushOptions
SignOff bool
}
Plan is a fully resolved, validated commit intent.
func BuildPlan ¶
func BuildPlan(opts PlannerOptions, cfg config.CommitConfig, registry *TypeRegistry, rootDir string) (*Plan, error)
BuildPlan merges CLI flags with config defaults, validates, and returns a Plan.
type PlannerOptions ¶
type PlannerOptions struct {
Type string
Scope string
Message string // positional or --message
Body string
Breaking bool
SkipCI *bool // nil = use config default
Push *bool // nil = use config default
Paths []string // from --add flags
All bool
SignOff bool
Remote string
Refspec string
}
PlannerOptions holds raw inputs from CLI flags and positional args.
type PushOptions ¶
type PushOptions struct {
Enabled bool
Remote string // default: "origin"
Refspec string // default: "" (current branch)
}
PushOptions controls post-commit push behavior.
type Result ¶
type Result struct {
SHA string
Message string
Files []string // actual staged files (from git diff --cached --name-only)
Pushed bool
NoOp bool
Backend string // stable descriptor: "git", "forge (gitlab)", "forge (github)", "dry-run"
}
Result holds the outcome of a commit execution. All informational status must be represented here, not printed by backends.
type TypeRegistry ¶
type TypeRegistry struct {
// contains filtered or unexported fields
}
TypeRegistry validates and resolves commit type keys.
func NewTypeRegistry ¶
func NewTypeRegistry(types []config.CommitType) *TypeRegistry
NewTypeRegistry creates a registry from configured commit types.
func (*TypeRegistry) List ¶
func (r *TypeRegistry) List() []config.CommitType
List returns all configured commit types in definition order.
func (*TypeRegistry) Resolve ¶
func (r *TypeRegistry) Resolve(key string) (resolvedKey string, forceBang bool, err error)
Resolve returns the resolved type key and whether a bang (!) is forced. If the type has an AliasFor, it returns the alias target key.
func (*TypeRegistry) Valid ¶
func (r *TypeRegistry) Valid(key string) bool
Valid returns true if the key is a recognized commit type.