okflint.index module
OKF §6 index.md generation.
Pure computation only: no file is written here. cli.py owns the
dry-run/diff/write orchestration (see okflint index).
- class okflint.index.IndexEntry(filename, title, description)[source]
Bases:
objectA single concept file to list in an index.md.
- okflint.index.build_index_content(dir_path, entries, subdirs)[source]
Build the OKF §6 markdown body of an index.md for one directory.
No frontmatter is emitted (safe default with respect to R001). Sub-directories are listed before files, both in case-insensitive alphabetical order.
- Parameters:
dir_path (
Path) – Directory this index.md belongs to (kept for signature symmetry withgenerate_indexes; the content only depends onentries/subdirs).entries (
list[IndexEntry]) – Concept files to list.subdirs (
list[str]) – Names of sub-directories that own their own index.md.
- Return type:
- Returns:
The markdown body (no frontmatter).
- okflint.index.generate_indexes(manifest)[source]
Compute the expected index.md content for every directory in the base.
Walks every manifest root, respecting
exclude_patternsand skipping the reserved index/log files. One entry is produced per directory that contains at least one (non-excluded).mdfile, directly or in a sub-directory. Performs no write.