source

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 9, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package source manages multi-repo source tracking with git commit awareness.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SaveManifest

func SaveManifest(graphPath string, m *Manifest) error

SaveManifest saves the manifest to a graph directory.

Types

type Manifest

type Manifest struct {
	// Sources is the list of tracked repositories.
	Sources []*Source `json:"sources"`

	// Directed indicates whether the graph should be treated as directed.
	// Default is true (edges have direction from->to).
	Directed bool `json:"directed"`

	// CreatedAt is when the manifest was created.
	CreatedAt time.Time `json:"created_at"`

	// UpdatedAt is when the manifest was last updated.
	UpdatedAt time.Time `json:"updated_at"`
}

Manifest tracks all sources in a Graphize database.

func LoadManifest

func LoadManifest(graphPath string) (*Manifest, error)

LoadManifest loads the manifest from a graph directory. Returns an empty manifest if the file doesn't exist.

func NewManifest

func NewManifest() *Manifest

NewManifest creates an empty manifest.

func (*Manifest) AddSource

func (m *Manifest) AddSource(s *Source)

AddSource adds or updates a source in the manifest.

func (*Manifest) CheckAllStatus

func (m *Manifest) CheckAllStatus() ([]*SourceStatus, error)

CheckAllStatus checks the status of all sources in the manifest.

func (*Manifest) GetSource

func (m *Manifest) GetSource(path string) *Source

GetSource returns a source by path, or nil if not found.

func (*Manifest) RemoveSource

func (m *Manifest) RemoveSource(path string) bool

RemoveSource removes a source from the manifest by path.

type Source

type Source struct {
	// Path is the absolute path to the repository root.
	Path string `json:"path"`

	// Commit is the git commit hash that was last analyzed.
	Commit string `json:"commit"`

	// Branch is the git branch that was checked out during analysis.
	Branch string `json:"branch"`

	// AnalyzedAt is when the source was last analyzed.
	AnalyzedAt time.Time `json:"analyzed_at"`
}

Source represents a tracked source repository.

func NewSourceFromPath

func NewSourceFromPath(path string) (*Source, error)

NewSourceFromPath creates a Source from a git repository path.

type SourceStatus

type SourceStatus struct {
	Source        *Source
	CurrentCommit string
	CurrentBranch string
	IsStale       bool
	CommitsBehind int // -1 if unknown
}

SourceStatus represents the currency status of a source.

func CheckStatus

func CheckStatus(s *Source) (*SourceStatus, error)

CheckStatus checks if a source is current with git HEAD.

Jump to

Keyboard shortcuts

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