Skip to main content

Crate opys_engine

Crate opys_engine 

Source
Expand description

opys — a file-based inventory of typed markdown documents: one markdown file per document, with YAML frontmatter, stable IDs, tags, configurable types, test plans, and a verify gate for CI.

The binary is a thin wrapper around run. The modules are public so the crate can be used as a library.

Re-exports§

pub use error::OpysError;
pub use error::Result;
pub use frontmatter::Frontmatter;
pub use project::Project;

Modules§

backend
The storage backend seam.
body
Parsing of the markdown body: title, sections, and checklist items.
cli
Command-line interface (clap derive).
commands
Subcommand implementations. Each run takes the invocation Ctx plus its parsed arguments.
config
Shared field-spec types used by the universal config (opys.toml). See crate::project_config for the engine config.
doc
A single inventory document in memory — the unified representation of every configured type. This collapses the former Feature and WorkItem, which were identical {path, frontmatter, body, title} structs; a doc’s type is derived from its ID prefix via the config, not stored here.
error
file_refs
Scan source files for textual references to document ids.
frontmatter
Frontmatter parsing and canonical serialization.
links
Cross-reference auto-sync: keep every doc’s references map bidirectional and title-fresh, and rewrite bare FEAT-XXXX/WI-XXXX mentions in body prose into readable markdown links. Run by sync after every mutating command.
mdprism
mdprism — markdown ⇄ data, via a template
palette
Configurable presentation rules for the TUI ([palette] in opys.toml).
project
The project: opys.toml at the project root (found by searching upward), plus the inventory base it points at (default opys/, holding the document files and _retired.txt).
project_config
The universal typed-document config (opys.toml) — the sole source of truth for the engine.
refs
The uniform references field: an ID->title map linking a feature or work item to other features and work items.
retired
The retired-id ledger: _retired.md, a frontmatter map of reserved id -> title. Closing, retiring, renumbering, or deleting a document records its id here so the global id sequence never hands the number out again; the title is kept for human reference (git records the when and why).
rules
The conditional validation-rules engine for the universal config.
store
The in-memory SQL store — the internal working representation of the inventory. Markdown files remain the durable storage; per CLI invocation the corpus is loaded and decomposed into GlueSQL tables (schema), commands operate on those tables (plus reconstructed Docs for the Rust-side invariants: rules, linkify, mdprism), and [Store::flush] writes changed documents back to disk (create/rename/delete/ledger included).
templates
String templates emitted by opys init and opys agent-rules.

Structs§

Ctx
Shared invocation context: where the inventory lives, global flags, and the storage backend the commands load/flush through.

Functions§

run
Execute a parsed CLI invocation, returning the process exit code.