Skip to main content

Module project_config

Module project_config 

Source
Expand description

The universal typed-document config (opys.toml) — the sole source of truth for the engine.

A project declares its own document types (each with a prefix, dir, statuses, fields, and required sections) plus a list of conditional validation rules. Project::open loads this; every command reads it, and verify enforces it via crate::rules. Reuses config::FieldSpec/FieldType/TestRefCheck.

Structs§

AnyTerm
One term of a require_any (exactly one of the three is set).
DocType
FieldMatch
FileRefs
[file_refs] — how document ids are mentioned in code, for opys show <id> --refs and the post-renumber reference warning. This is about textual mentions of an id (e.g. FEAT-0123) in source files, distinct from the references relation maps between documents (see crate::refs).
Layout
The on-disk layout: a single path template rendered per document. The {type} placeholder resolves to the type’s dir, {status} to the type’s status_dirs[status] (both empty by default), and {id} to PREFIX-NNNN. Empty segments collapse, so the order of segments is freely configurable.
LinkReq
requires_link = { to = "feature", min = 1 } — a type must reference ≥min docs of type to.
ProjectConfig
RefFormat
One way a document id may appear in code. template is rendered for a given id with these placeholders: {id} (the full PREFIX-NNNN), {prefix} / {prefix_lower}, {num} (the unpadded number), and {padded} (zero-padded to pad). With word (the default) the match must fall on word boundaries; set word = false to match anywhere (substring).
Rule
A conditional validation rule: a when guard plus exactly one assertion from the closed set below.
SectionCheck
A universal, config-driven content check attached to a section. pattern parses a line into named capture groups; file (a group name) and/or must_match (a regex built from ${group} substitutions) then assert the captured reference points at something real.
SectionSpec
StatSpec
One custom stats section for opys stats. sql is a single SQL query run against an in-memory relational view of the corpus (tables docs, tags, sections, fields — see crate::commands::stats). Without template the result set renders as a markdown table headed by name; with template, each result row is rendered through it ({column} placeholders, {{/}} for literal braces) and the rendered rows are joined under the name heading.
TuiConfig
[tui] — presentation knobs for the opys tui board (ignored by the core engine, validated here so config validate catches mistakes).
When
A rule’s match guard. Both fields optional: omitting both means “always”.

Enums§

CheckScope
Which lines of a section a SectionCheck validates.
SectionKind
A built-in section behavior a type’s section opts into. The validator and scaffold for each kind are compiled code (closed set, not extensible from config) — this is the guardrail that keeps the engine opinionated. The structured kind is the configurable one: its content shape is declared by the section’s structure (an [mdprism] schema; see docs/structure-dsl-spec.md).

Constants§

BUILTIN_COLUMNS
Built-in column keys for the TUI list (everything else is a custom field).
DEFAULT_BASE
Inventory base directory (the documents and _retired.txt), relative to the project root that holds opys.toml; the config base default.
DEFAULT_DOC_DIR
Directory (under the inventory base) for a type that declares no explicit dir. Empty by default → documents live flat at the base.
DEFAULT_LAYOUT_PATH
Default file-path template (relative to the base). Both the {type} and {status} segments are empty by default, so this collapses to a flat PREFIX-NNNN.md at the base.
REF_PLACEHOLDERS
The placeholder names {id} / {prefix} / {prefix_lower} / {num} / {padded} that a RefFormat template may use.