Documentation
¶
Index ¶
- type Cache
- func (c *Cache) AddLanguageMapping(language string, sourceFiles ...string)
- func (c *Cache) AddMapping(sourceFile string, docFiles ...string)
- func (c *Cache) Clear()
- func (c *Cache) GetAffectedDocs(changedFiles []string) []string
- func (c *Cache) GetDocFiles(sourceFile string) []string
- func (c *Cache) GetSourcesByLanguage(language string) []string
- func (c *Cache) HasChanges(currentCommit string) bool
- func (c *Cache) IsEmpty() bool
- func (c *Cache) Load(path string) error
- func (c *Cache) Save(path string) error
- func (c *Cache) UpdateCommit(commit string)
- type ChangeDetector
- func (d *ChangeDetector) DetectChanges(ctx context.Context, fromCommit, toCommit string) ([]string, error)
- func (d *ChangeDetector) DetectChangesSinceCommit(ctx context.Context, since string) ([]string, error)
- func (d *ChangeDetector) DetectUnstagedChanges(ctx context.Context) ([]string, error)
- func (d *ChangeDetector) FilterByLanguage(files []string, extensions []string) []string
- func (d *ChangeDetector) GetCurrentCommit(ctx context.Context) (string, error)
- func (d *ChangeDetector) IsGitRepository(ctx context.Context) bool
- type Manager
- func (m *Manager) GetAffectedDocumentation(ctx context.Context, extensions []string) ([]string, error)
- func (m *Manager) GetCache() *Cache
- func (m *Manager) GetChangedFiles(ctx context.Context) ([]string, error)
- func (m *Manager) IsFirstRun() bool
- func (m *Manager) LoadCache() error
- func (m *Manager) RegisterDocumentation(sourceFile string, docFiles ...string)
- func (m *Manager) RegisterLanguage(language string, sourceFiles ...string)
- func (m *Manager) Reset()
- func (m *Manager) SaveCache() error
- func (m *Manager) UpdateCommit(ctx context.Context) error
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 ¶
LoadFromFile loads a cache from file, returns new cache if file doesn't exist
func (*Cache) AddLanguageMapping ¶
AddLanguageMapping associates a language with source files
func (*Cache) AddMapping ¶
AddMapping adds a mapping from source file to documentation file(s)
func (*Cache) GetAffectedDocs ¶
GetAffectedDocs returns all documentation files affected by changed source files
func (*Cache) GetDocFiles ¶
GetDocFiles returns documentation files for a source file
func (*Cache) GetSourcesByLanguage ¶
GetSourcesByLanguage returns all source files for a language
func (*Cache) HasChanges ¶
HasChanges checks if cache has changes since last commit
func (*Cache) UpdateCommit ¶
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) GetChangedFiles ¶
GetChangedFiles returns files that changed since last documentation build
func (*Manager) IsFirstRun ¶
IsFirstRun returns true if this is the first documentation build
func (*Manager) RegisterDocumentation ¶
RegisterDocumentation records the mapping between source and documentation files
func (*Manager) RegisterLanguage ¶
RegisterLanguage associates source files with a programming language