Documentation
¶
Overview ¶
Package scope resolves the analysis scope: the repo root, changed files (delta mode), and the mode (full vs delta) for a run.
Package scope resolves the analysis scope: the repo root, changed files (delta mode), and the mode (full vs delta) for a run.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultExclusions = []string{
"**/.archfit-cache/**",
"**/.archfit-baseline.json",
"**/.gitnexus/**",
"**/.codegraph/**",
"**/reports/**",
"**/.venv/**",
"**/node_modules/**",
"**/vendor/**",
"**/dist/**",
"**/build/**",
}
DefaultExclusions are tool-artifact, cache, and dependency directories archfit never analyses: measuring them yields non-deterministic or irrelevant facts — a vendored tree's complexity, a generated index, or a report written back into the scanned repo (the OpenAI study's self-scan "instability"). They are MERGED with — never replace — the config `exclusions` (see MergeExclusions). Kept here in the core ring as pure data so scope stays free of I/O. Globs use doublestar `**/<name>/**` form so they match the directory at the repo root and at any nested depth without over-matching siblings (e.g. `reports.go`).
Functions ¶
func MergeExclusions ¶ added in v0.5.0
MergeExclusions returns the effective exclusion globs: DefaultExclusions supplemented by the configured ones, de-duplicated and sorted so a double-run stays byte-identical regardless of config order. A configured entry prefixed with "!" re-includes a default — it removes the matching default from the result and is itself dropped, so extractors never see the negation marker. "!reports", "!.archfit-baseline.json", and the exact "!**/reports/**" all remove their default. Pure: no filesystem access.
Types ¶
type Resolver ¶
type Resolver interface {
// RepoRoot returns the absolute repository root.
RepoRoot(ctx context.Context) (string, error)
// HeadRef returns the resolved HEAD SHA.
HeadRef(ctx context.Context) (string, error)
// Changed returns the repo-relative files changed between base and head.
Changed(ctx context.Context, base, head string) ([]string, error)
}
Resolver supplies the version-control queries scope resolution needs. cmd wires the concrete git implementation; tests use an in-memory fake. scope itself stays free of process and tool dependencies.
type Scope ¶
type Scope struct {
// Base is the git ref used as the diff base in delta mode; empty in full mode.
Base string
// Head is the resolved HEAD SHA in delta mode; empty in full mode.
Head string
// Changed is the sorted list of repo-relative files changed since Base.
// Nil/empty in full mode.
Changed []string
// Root is the absolute path to the repository root.
Root string
// Mode indicates whether this is a delta or full-repo run.
Mode ScopeMode
}
Scope carries the resolved analysis scope for a single run.
func Resolve ¶
Resolve determines the Scope for a run.
It always resolves the repo root via the Resolver; a failing resolver is a hard error (exit 3). If cfg.Full is true the result has Mode=full and no Changed files. Otherwise HeadRef and Changed populate the delta. Changed files are sorted here so scope's determinism contract does not depend on resolver discipline.