scanner

package
v0.6.7 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2026 License: BSD-2-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeduplicateFrontmatter

func DeduplicateFrontmatter(ctx context.Context, fmYAML string) (string, bool, error)

DeduplicateFrontmatter removes duplicate keys from YAML frontmatter, keeping the last value for each key.

func InjectTaskIdentifier

func InjectTaskIdentifier(ctx context.Context, content []byte, id string) ([]byte, error)

InjectTaskIdentifier injects a task_identifier into the frontmatter of content.

Types

type ScanResult

type ScanResult struct {
	Changed []lib.Task           // tasks whose content changed (new or modified)
	Deleted []lib.TaskIdentifier // task identifiers that were previously known but are now gone
}

ScanResult holds the outcome of a single vault scan cycle.

type VaultScanner

type VaultScanner interface {
	// Run starts the polling loop. Blocks until ctx is cancelled.
	// Results are sent to the provided channel; the caller owns the channel.
	Run(ctx context.Context, results chan<- ScanResult) error
	// RunCycle executes a single scan cycle (git pull + file scan + optional commit/push).
	// Exported for use in scanner_test package; prefer Run() in production.
	RunCycle(ctx context.Context, results chan<- ScanResult)
}

func NewGitRestVaultScanner

func NewGitRestVaultScanner(
	gitClient gitclient.GitClient,
	taskDir string,
	pollInterval time.Duration,
	trigger <-chan struct{},
	m metrics.Metrics,
	autoInject bool,
) VaultScanner

NewGitRestVaultScanner creates a VaultScanner that reads and writes vault files via the gitclient.GitClient interface methods (ListFiles, ReadFile, WriteFile). Use this constructor when git-rest HTTP mode is enabled.

func NewVaultScanner

func NewVaultScanner(
	gitClient gitclient.GitClient,
	taskDir string,
	pollInterval time.Duration,
	trigger <-chan struct{},
	m metrics.Metrics,
	autoInject bool,
) VaultScanner

NewVaultScanner creates a VaultScanner that polls git and scans the task directory.

Jump to

Keyboard shortcuts

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