{"modulePath":"github.com/codefit-cli/codefit","version":"v0.2.9","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package scope\n\nPackage scope is layer 0 of the filtering pyramid (PRD section 19), as a value: WHICH project-relative files an audit pass is allowed to look at.\n\nIt is a pure leaf — it imports nothing from codefit — so the core, the sensors and the MCP adapter can all speak the same narrowing without a dependency.\n\ncodefit does not derive the scope from git. It never reads .git, never diffs refs and assumes no branch model: it has no power over the user's git (CLAUDE.md, autonomy principle), and the MCP caller is an agent that already knows which files it touched. The scope is therefore an INPUT.\n\nTwo fail-safes point in opposite directions, on purpose:\n\n  - [Of](#Of) with an absent or empty list returns [Full](#Full). \"Nothing was passed\" must never be read as \"audit nothing\"; the safe direction for an auditor is to look at MORE.\n  - The zero value Scope{} includes NOTHING, and that is why [Full](#Full) is an explicit constructor rather than the zero value. baseline.Diff uses [Scope.Includes](#Scope.Includes) to decide whether an item may be marked gone (and later pruned), so a caller that forgets to pass a scope prunes nothing — under-reporting instead of deleting audit memory it never verified.\n\nA walk wants the third question, not either of those: does this scope restrict me at all? That is [Scope.Narrows](#Scope.Narrows), false for both Full{} and the zero value, so an unset scope can never silently blank a walk.\n\n## Functions\n\n```go\nfunc Canon(p string) string\n```\nCanon is the canonical form of a project-relative path, and the SINGLE definition of it: separators normalized to \"/\", then cleaned. A caller that must compare a path against a scope (a configured schema path, say) uses this rather than re-deriving the rule.\n\nIt is deliberately platform-INDEPENDENT — path.Clean over slash-normalized text, not filepath.Clean. The paths a scope holds are project-relative identifiers that travel between an agent, a committed baseline and a repository checked out on either OS; resolving \\`src\\\\a.ts\\` only when codefit happens to be running on Windows would reintroduce exactly the separator drift v0.2.6 paid to remove.\n\n## Types\n\n```go\ntype Scope struct {\n\t// contains filtered or unexported fields\n}\n```\nScope is the set of project-relative files an audit pass may examine. Build it with [Full](#Full) or [Of](#Of); the zero value includes nothing (see the package doc).\n\n```go\nfunc Full() Scope\n```\nFull returns the scope that includes every file — a complete audit.\n\n```go\nfunc Of(rels []string) Scope\n```\nOf returns the scope of exactly these project-relative paths, canonicalized. An absent or empty list (or one holding only blanks) returns [Full](#Full): an empty scope is never read as \"audit nothing\".\n\n```go\nfunc (s Scope) Files() []string\n```\nFiles returns the scoped paths, canonical and sorted — nil when the scope is full (there is no finite list of \"everything\"). The result is a copy.\n\n```go\nfunc (s Scope) Includes(rel string) bool\n```\nIncludes reports whether rel is in the scope. rel is canonicalized on lookup, exactly as it was on construction, so a caller's separator or \"./\" prefix cannot make the same file miss itself.\n\n```go\nfunc (s Scope) IsFull() bool\n```\nIsFull reports whether the scope includes every file.\n\n```go\nfunc (s Scope) Narrows() bool\n```\nNarrows reports whether the scope actually restricts anything. It is false for [Full](#Full) AND for the zero value — the question a WALK must ask, so an unconfigured scope widens the audit instead of blanking it. Do not confuse it with [Scope.Includes](#Scope.Includes), whose zero-value answer is deliberately the opposite.\n\n","path":"github.com/codefit-cli/codefit/internal/core/scope","name":"scope","synopsis":"Package scope is layer 0 of the filtering pyramid (PRD section 19), as a value: WHICH project-relative files an audit pass is allowed to look at.","isRedistributable":true}
