discover

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package discover performs bounded repository layout detection for ds init.

Index

Constants

View Source
const (
	// MaxDiscoveryDirs caps how many directories plainDocsWorthIndexing will visit under docs/
	// (including the docs/ root). Separate from MaxDocsFiles, which limits regular files scanned
	// for *.spec.md / *.plan.md / *.prd.md density.
	MaxDiscoveryDirs = 4096
	// MaxDocsFiles caps regular files inspected under docs/ for density heuristics.
	MaxDocsFiles = 400
)

Limits keep discovery bounded on large trees.

View Source
const MaxScanHints = 8

MaxScanHints is the maximum number of directory paths emitted for empty-scan recovery.

Variables

This section is empty.

Functions

func FormatSuggestCommand

func FormatSuggestCommand(h HintCandidate) string

FormatSuggestCommand returns a concrete ds config add-source line for the candidate.

func HintDisplayPath

func HintDisplayPath(rel string) string

HintDisplayPath returns a slash path with trailing slash for directory display lines.

Types

type HintCandidate

type HintCandidate struct {
	RelPath    string // repo-relative, slash-separated, no trailing slash
	SourceType string // markdown | adr | openspec
}

HintCandidate is an on-disk path that may help recover from an empty configured scan.

func ScanHintCandidates

func ScanHintCandidates(repoRoot string, m *ignore.Matcher) []HintCandidate

ScanHintCandidates returns bounded, stable-ordered directories that exist under repoRoot and are not ignored. Used when a configured scan finds zero artifacts.

type Result

type Result struct {
	MergeMarkdown []string
	MergeADR      []string
	Suggestions   []string
	// SkippedIgnored counts candidates skipped due to the ignore stack (approximate during walks).
	SkippedIgnored int
}

Result holds paths to merge into config (high confidence) and suggestion lines.

func Run

func Run(repoRoot string, m *ignore.Matcher) *Result

Run detects layout under repoRoot using m for ignore rules. If m is nil, a matcher is loaded from repoRoot.

Jump to

Keyboard shortcuts

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