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
- Field
Match - File
Refs [file_refs]— how document ids are mentioned in code, foropys show <id> --refsand the post-renumberreference warning. This is about textual mentions of an id (e.g.FEAT-0123) in source files, distinct from thereferencesrelation maps between documents (seecrate::refs).- Layout
- The on-disk layout: a single path template rendered per document. The
{type}placeholder resolves to the type’sdir,{status}to the type’sstatus_dirs[status](both empty by default), and{id}toPREFIX-NNNN. Empty segments collapse, so the order of segments is freely configurable. - LinkReq
requires_link = { to = "feature", min = 1 }— a type must reference ≥mindocs of typeto.- Project
Config - RefFormat
- One way a document id may appear in code.
templateis rendered for a given id with these placeholders:{id}(the fullPREFIX-NNNN),{prefix}/{prefix_lower},{num}(the unpadded number), and{padded}(zero-padded topad). Withword(the default) the match must fall on word boundaries; setword = falseto match anywhere (substring). - Rule
- A conditional validation rule: a
whenguard plus exactly one assertion from the closed set below. - Section
Check - A universal, config-driven content check attached to a section.
patternparses a line into named capture groups;file(a group name) and/ormust_match(a regex built from${group}substitutions) then assert the captured reference points at something real. - Section
Spec - Stat
Spec - One custom stats section for
opys stats.sqlis a single SQL query run against an in-memory relational view of the corpus (tablesdocs,tags,sections,fields— seecrate::commands::stats). Withouttemplatethe result set renders as a markdown table headed byname; withtemplate, each result row is rendered through it ({column}placeholders,{{/}}for literal braces) and the rendered rows are joined under thenameheading. - TuiConfig
[tui]— presentation knobs for theopys tuiboard (ignored by the core engine, validated here soconfig validatecatches mistakes).- When
- A rule’s match guard. Both fields optional: omitting both means “always”.
Enums§
- Check
Scope - Which lines of a section a
SectionCheckvalidates. - Section
Kind - 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
structuredkind is the configurable one: its content shape is declared by the section’sstructure(an [mdprism] schema; seedocs/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 holdsopys.toml; the configbasedefault. - 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 flatPREFIX-NNNN.mdat the base. - REF_
PLACEHOLDERS - The placeholder names
{id}/{prefix}/{prefix_lower}/{num}/{padded}that aRefFormattemplate may use.