Expand description
The repository scope: what a worker reads of the repository, and what it never reads.
Declared once, as data: .ai/repo/scope.yaml when the manifest names a scope
section, otherwise the distribution’s default, the same file majordomus init seeds
(share/skeleton/ai/repo/scope.yaml). in is the allow-list of pathspecs; out wins
over in and carries a reason: a path never read, a secret, a generated asset, an
archive, an image, a video, a PDF, a database dump, a fixture over its limit, a file
over the limit, binary content. A path matching nothing is out as undeclared.
The declaration is read and compiled once at start-up. Discovery drops a source outside
it with a diagnostic, so the index, and every projection of the index, holds nothing a
worker must not read; repository.scope_classify answers for any path, with the rule that decided;
repository.scope reports the declaration and a tally of every tracked file against it.
Nothing here reads a file’s content beyond the first SNIFF_BYTES, and the tally
judges names and sizes only: content is judged when a file is read.
Structs§
- Category
- One category of
out: pathspecs and file-name patterns. - Classification
- One path, judged.
- Declaration
scope.yaml, typed. Unknown keys are refused by the type and by thescopeschema.- Fixtures
- The
fixturescategory: where fixtures live and how large one may be. - Out
- The
out:mapping: every category optional, each the reason a path is out. - OutFile
- One tracked file that is out.
- Scope
- The declaration, compiled, with where it came from.
- Scoped
- The scope with its tally: what the index was built under.
- Tally
- Every tracked file against the scope, counted.
Enums§
- Origin
- Where the declaration was read from.
- Reason
- Why a path is out. The order is the order the rules decide in.
- Verdict
- In or out.
Constants§
- SCOPE_
FILE - The file, under the tracked half, the manifest’s
scopesection names by convention. - SCOPE_
VERSION - The
version:ofscope.yamlthis executable reads. - SKELETON_
SCOPE - The distribution’s default declaration, relative to the share directory: the file
majordomus initseeds, so that a repository declaring no scope is read under the scope it would have been given. - SNIFF_
BYTES - How many leading bytes decide whether content is text.
Functions§
- is_text
- Is the file text? The first
SNIFF_BYTEScarry no NUL byte, which is the judgement version control makes too; encoding is the reader’s concern, so a Latin-1 file passes here and is refused by name where it is read. An unreadable file is not text. - is_
text_ bytes - The text judgement over a window of bytes: no NUL byte.