index

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package index manages .agentstore/index.db — the local working state that is never pushed to the server: staged changes, merge-in-progress marker.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Index

type Index struct {
	// contains filtered or unexported fields
}

Index is a handle to index.db.

func Init

func Init(storeDir string) (*Index, error)

Init creates (or opens) index.db in storeDir with the schema applied. Safe to call on an already-initialized index.

func Open

func Open(storeDir string) (*Index, error)

Open opens an existing index.db from storeDir (.agentstore/).

func (*Index) Clear

func (i *Index) Clear() error

Clear removes all staged entries (called after a successful commit).

func (*Index) ClearMergeState

func (i *Index) ClearMergeState() error

ClearMergeState removes the merge-in-progress marker.

func (*Index) ClearUnresolved

func (i *Index) ClearUnresolved(path string) error

ClearUnresolved marks path as resolved.

func (*Index) Close

func (i *Index) Close() error

Close releases the database connection.

func (*Index) Entries

func (i *Index) Entries() ([]StagedEntry, error)

Entries returns all staged entries.

func (*Index) Get

func (i *Index) Get(path string) (*StagedEntry, error)

Get returns the staged entry for path, or nil if not staged.

func (*Index) GetMergeState

func (i *Index) GetMergeState() (*MergeState, error)

GetMergeState returns the current merge state, or nil if no merge is in progress.

func (*Index) SetMergeState

func (i *Index) SetMergeState(ms MergeState) error

SetMergeState records an in-progress merge. Replaces any prior state.

func (*Index) SetUnresolved

func (i *Index) SetUnresolved(path string) error

SetUnresolved marks path as having unresolved conflict markers.

func (*Index) Stage

func (i *Index) Stage(e StagedEntry) error

Stage upserts a staged entry. For a deletion, set ObjectHash = "".

func (*Index) UnresolvedPaths

func (i *Index) UnresolvedPaths() ([]string, error)

UnresolvedPaths returns all paths still marked as having conflict markers.

func (*Index) Unstage

func (i *Index) Unstage(path string) error

Unstage removes the staged entry for path, if any.

type MergeState

type MergeState struct {
	SecondParentCommitID string
}

MergeState records an in-progress merge after a conflicting pull.

type StagedEntry

type StagedEntry struct {
	Path            string
	ObjectHash      string // "" for a staged deletion
	ChangeType      string // "added", "modified", "deleted"
	BasedOnCommitID string // "" if file was not in HEAD when staged
}

StagedEntry is one row from the staged table.

Jump to

Keyboard shortcuts

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