commitplan

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package commitplan builds verifiable, read-only semantic commit plans from Git-owned patches. It never stages files or changes repository history.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Group

type Group struct {
	Name               string   `json:"name"`
	Intent             string   `json:"intent"`
	SuggestedSubject   string   `json:"suggested_subject"`
	UnitIDs            []string `json:"unit_ids"`
	Files              []string `json:"files"`
	DependsOn          []string `json:"depends_on,omitempty"`
	ValidationCommands []string `json:"validation_commands,omitempty"`
	TestOwners         []string `json:"test_owners,omitempty"`
}

Group is one proposed semantic commit.

type GroupInput

type GroupInput struct {
	Name               string
	Intent             string
	Type               string
	Scope              string
	UnitIDs            []string
	DependsOn          []string
	ValidationCommands []string
	TestOwners         []string
}

GroupInput supplies semantic judgment while deterministic code verifies coverage and dependencies.

type Inventory

type Inventory struct {
	Units             []Unit    `json:"units"`
	Warnings          []Warning `json:"warnings,omitempty"`
	SourcePatchSHA256 string    `json:"source_patch_sha256"`
	InventorySHA256   string    `json:"inventory_sha256"`
}

Inventory is a bounded, deterministic view of one source patch.

func Inspect

func Inspect(ctx context.Context, snapshot Snapshot) (Inventory, error)

Inspect parses one bounded Git patch with a maintained unified-diff parser.

type Plan

type Plan struct {
	Groups         []Group        `json:"groups"`
	Unresolved     []Unresolved   `json:"unresolved,omitempty"`
	Warnings       []Warning      `json:"warnings,omitempty"`
	Reconstruction Reconstruction `json:"reconstruction"`
}

Plan is a read-only semantic proposal plus deterministic coverage proof.

func Build

func Build(ctx context.Context, inventory Inventory, input PlanInput) (Plan, error)

Build validates semantic groups against a frozen inventory.

type PlanInput

type PlanInput struct {
	Groups     []GroupInput
	Unresolved []UnresolvedInput
}

PlanInput is the agent-authored semantic layer over a frozen inventory.

type Reconstruction

type Reconstruction struct {
	SourcePatchSHA256 string `json:"source_patch_sha256"`
	InventorySHA256   string `json:"inventory_sha256"`
	AssignedSHA256    string `json:"assigned_sha256"`
	UnitCount         int    `json:"unit_count"`
	AssignedCount     int    `json:"assigned_count"`
	Verified          bool   `json:"verified"`
}

Reconstruction binds exact source bytes to one-to-one unit coverage.

type Snapshot

type Snapshot struct {
	Patch     []byte
	Untracked []UntrackedFile
}

Snapshot is the immutable input observed from one workspace.

type Unit

type Unit struct {
	ID             string `json:"id"`
	Kind           string `json:"kind"`
	Path           string `json:"path"`
	OldPath        string `json:"old_path,omitempty"`
	Operation      string `json:"operation"`
	OldStart       int32  `json:"old_start,omitempty"`
	OldLines       int32  `json:"old_lines,omitempty"`
	NewStart       int32  `json:"new_start,omitempty"`
	NewLines       int32  `json:"new_lines,omitempty"`
	Patch          string `json:"patch,omitempty"`
	ContentHash    string `json:"content_sha256"`
	Generated      bool   `json:"generated"`
	WhitespaceOnly bool   `json:"whitespace_only"`
}

Unit is the smallest assignable file or hunk change.

type Unresolved

type Unresolved struct {
	UnitID string `json:"unit_id"`
	Reason string `json:"reason"`
}

Unresolved records an unassigned or ambiguous unit.

type UnresolvedInput

type UnresolvedInput struct {
	UnitID string
	Reason string
}

UnresolvedInput explains why a unit cannot yet be assigned safely.

type UntrackedFile

type UntrackedFile struct {
	Path     string
	ObjectID string
}

UntrackedFile identifies exact untracked content without embedding it.

type Warning

type Warning struct {
	Code    string `json:"code"`
	Message string `json:"message"`
	Path    string `json:"path,omitempty"`
	UnitID  string `json:"unit_id,omitempty"`
}

Warning describes a condition requiring human or agent judgment.

Jump to

Keyboard shortcuts

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