scan

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package scan locates project checkouts on disk by walking the configured projects_roots to a bounded depth and matching directory basenames against a set of project names. Pure filesystem logic with no config or state knowledge: callers pass the roots, depth, and names in.

Distinct from package detect, which inspects one already-known project root for agent dirs. scan searches many roots to answer "where does project X live on this machine?" - the core of `lore pull --all`'s new-machine recovery sweep.

Linux + macOS only per ADR 0001.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ScanRoots

func ScanRoots(roots []string, depth int, names []string) (map[string][]string, error)

ScanRoots walks each root up to depth levels deep and returns, per wanted project name, every absolute directory path whose basename matches. depth counts levels below a root: depth 1 visits a root's direct children, depth 2 their children too. The root itself is level 0 and never a match.

Only real directories are descended into or matched. A symlink reports false from DirEntry.IsDir() (the entry type is read without following), so symlinked dirs are skipped: this both avoids walk loops and stops lore's own agent-dir symlinks from matching. Dot-prefixed directories (.git, .cache, ...) are skipped wholesale, since real checkouts are not dot-named and descending into them is pure waste. A root that doesn't exist on this machine is skipped silently (a fresh machine won't have every configured root).

The returned map only holds names that matched at least one path; names with zero matches are absent. Match order within a name follows root order then walk order, deterministic across runs for a fixed tree.

Types

This section is empty.

Jump to

Keyboard shortcuts

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