incremental

package
v1.0.24 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	// LastCommit is the last processed git commit hash
	LastCommit string `json:"last_commit"`

	// LastUpdate is the timestamp of last cache update
	LastUpdate time.Time `json:"last_update"`

	// Mappings maps source file paths to their documentation file paths
	Mappings map[string][]string `json:"mappings"`

	// LanguageMappings maps languages to their source files
	LanguageMappings map[string][]string `json:"language_mappings"`
}

Cache stores mappings between source files and generated documentation

func LoadFromFile

func LoadFromFile(path string) (*Cache, error)

LoadFromFile loads a cache from file, returns new cache if file doesn't exist

func NewCache

func NewCache() *Cache

NewCache creates a new empty cache

func (*Cache) AddLanguageMapping

func (c *Cache) AddLanguageMapping(language string, sourceFiles ...string)

AddLanguageMapping associates a language with source files

func (*Cache) AddMapping

func (c *Cache) AddMapping(sourceFile string, docFiles ...string)

AddMapping adds a mapping from source file to documentation file(s)

func (*Cache) Clear

func (c *Cache) Clear()

Clear removes all mappings from cache

func (*Cache) GetAffectedDocs

func (c *Cache) GetAffectedDocs(changedFiles []string) []string

GetAffectedDocs returns all documentation files affected by changed source files

func (*Cache) GetDocFiles

func (c *Cache) GetDocFiles(sourceFile string) []string

GetDocFiles returns documentation files for a source file

func (*Cache) GetSourcesByLanguage

func (c *Cache) GetSourcesByLanguage(language string) []string

GetSourcesByLanguage returns all source files for a language

func (*Cache) HasChanges

func (c *Cache) HasChanges(currentCommit string) bool

HasChanges checks if cache has changes since last commit

func (*Cache) IsEmpty

func (c *Cache) IsEmpty() bool

IsEmpty returns true if cache has no mappings

func (*Cache) Load

func (c *Cache) Load(path string) error

Load reads cache from a JSON file

func (*Cache) Save

func (c *Cache) Save(path string) error

Save persists cache to a JSON file

func (*Cache) UpdateCommit

func (c *Cache) UpdateCommit(commit string)

UpdateCommit updates the last processed commit

type ChangeDetector

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

ChangeDetector detects source file changes using git

func NewChangeDetector

func NewChangeDetector(runner site.CommandRunner, repoDir string) *ChangeDetector

NewChangeDetector creates a new change detector

func (*ChangeDetector) DetectChanges

func (d *ChangeDetector) DetectChanges(ctx context.Context, fromCommit, toCommit string) ([]string, error)

DetectChanges detects changed files between two commits

func (*ChangeDetector) DetectChangesSinceCommit

func (d *ChangeDetector) DetectChangesSinceCommit(ctx context.Context, since string) ([]string, error)

DetectChangesSinceCommit detects changes since a specific commit

func (*ChangeDetector) DetectUnstagedChanges

func (d *ChangeDetector) DetectUnstagedChanges(ctx context.Context) ([]string, error)

DetectUnstagedChanges detects changes in working directory

func (*ChangeDetector) FilterByLanguage

func (d *ChangeDetector) FilterByLanguage(files []string, extensions []string) []string

FilterByLanguage filters files by programming language extensions

func (*ChangeDetector) GetCurrentCommit

func (d *ChangeDetector) GetCurrentCommit(ctx context.Context) (string, error)

GetCurrentCommit returns the current commit hash

func (*ChangeDetector) IsGitRepository

func (d *ChangeDetector) IsGitRepository(ctx context.Context) bool

IsGitRepository checks if the directory is a git repository

type Manager

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

Manager coordinates incremental documentation builds

func NewManager

func NewManager(runner site.CommandRunner, repoDir string) *Manager

NewManager creates a new incremental documentation manager

func NewManagerWithCache

func NewManagerWithCache(runner site.CommandRunner, repoDir, cachePath string) *Manager

NewManagerWithCache creates a manager with custom cache path

func (*Manager) GetAffectedDocumentation

func (m *Manager) GetAffectedDocumentation(ctx context.Context, extensions []string) ([]string, error)

GetAffectedDocumentation returns documentation files that need regeneration

func (*Manager) GetCache

func (m *Manager) GetCache() *Cache

GetCache returns the cache for direct access

func (*Manager) GetChangedFiles

func (m *Manager) GetChangedFiles(ctx context.Context) ([]string, error)

GetChangedFiles returns files that changed since last documentation build

func (*Manager) IsFirstRun

func (m *Manager) IsFirstRun() bool

IsFirstRun returns true if this is the first documentation build

func (*Manager) LoadCache

func (m *Manager) LoadCache() error

LoadCache loads the cache from disk

func (*Manager) RegisterDocumentation

func (m *Manager) RegisterDocumentation(sourceFile string, docFiles ...string)

RegisterDocumentation records the mapping between source and documentation files

func (*Manager) RegisterLanguage

func (m *Manager) RegisterLanguage(language string, sourceFiles ...string)

RegisterLanguage associates source files with a programming language

func (*Manager) Reset

func (m *Manager) Reset()

Reset clears all cache data

func (*Manager) SaveCache

func (m *Manager) SaveCache() error

SaveCache persists the cache to disk

func (*Manager) UpdateCommit

func (m *Manager) UpdateCommit(ctx context.Context) error

UpdateCommit updates the cache with current commit after successful build

Jump to

Keyboard shortcuts

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