fsscanner

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package fsscanner implements application.FileScanner: it walks a repository root, discovers markdown files, applies ignore rules, and enforces the security boundary of ADR 0003 (no symlink following, root containment, resource caps). It returns a deterministic, sorted file list plus notices for anything skipped.

Index

Constants

View Source
const (
	// DefaultMaxFileSizeBytes is the per-file size cap; larger files are skipped.
	DefaultMaxFileSizeBytes int64 = 10 << 20 // 10 MiB
	// DefaultMaxFiles is the discovery cap; discovery stops once it is reached.
	DefaultMaxFiles = 10_000
)

Default resource caps (ADR 0003). They are safe-by-default and overridable via Config.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// MaxFileSizeBytes is the per-file size cap; files above it are skipped and
	// noticed, never read.
	MaxFileSizeBytes int64
	// MaxFiles caps discovery; once reached, discovery stops and a truncation
	// notice is emitted.
	MaxFiles int
	// OutputDir, when non-empty, is excluded from the walk (so a re-scan does
	// not ingest its own artifacts).
	OutputDir string
}

Config tunes a Scanner. The zero value is not valid; use New, which fills in safe defaults for any unset field.

type Scanner

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

Scanner discovers markdown files under a root.

func New

func New(cfg Config) *Scanner

New returns a Scanner, filling unset Config fields with safe defaults.

func (*Scanner) Scan

func (s *Scanner) Scan(ctx context.Context, root string) (application.ScanResult, error)

Scan walks root and returns the markdown files to parse plus notices. The returned file list is sorted by DocumentID for determinism. It honors context cancellation.

Jump to

Keyboard shortcuts

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