Skip to main content

Open Knowledge Format tooling

Project description

okf-cli — Open Knowledge Format tooling

Converts plain markdown into OKF-conformant knowledge bundles. Domain experts write the content, okf bundle generates frontmatter, type, timestamps, and index files.

Also validates bundles, lists concept IDs, and reads concepts by ID.

Install

uv tool install okf-cli

Dev quickstart

uv sync
uv run okf --help

Commands

okf bundle — convert plain markdown to OKF bundle

okf bundle <input-dir> [output-dir] [--default-type <name>] [--force] [--strict]
Argument Description
input-dir Directory of plain .md files
output-dir Target directory (default: bundled)
--default-type Type for root-level files (skip root files if omitted)
--force, -f Overwrite output directory if it exists
--strict Enforce strict OKF spec output: fail on broken local .md links and skip AGENTS.md generation
okf bundle example --default-type reference  # → bundled/
okf bundle example --default-type reference --force --strict

.okfignore: put in input-dir root; one bundle-relative .md path per line. Exact match only (no glob).

Link checking: scans body links to local .md targets. Missing or out-of-bundle links warn by default, fail with --strict.

okf list — list concept IDs in a bundle

okf list <directory>

Prints concept IDs (path without .md). Requires valid OKF bundle.

okf list bundled/
# datasets/sales
# tables/orders

okf show — read a concept by ID

okf show <directory> <concept-id>

Prints full concept contents (frontmatter + body). Concept IDs as printed by okf list. Guards against path traversal.

okf validate — check OKF conformance

okf validate <directory>

Checks OKF v0.1 §9 conformance: frontmatter required, type required, reserved filenames follow spec structure, UTF-8 required.

okf validate bundled/
# 16 files: 16 ok

Input format

Strict (recommended)

# Title

> Description

Lenient fallback

Files without strict format are bundled best-effort: title omitted if absent, description synthesized from first 80 chars of body.

Rule Why
Folder name = concept type tables/orders.mdtype: "tables"
Only .md files processed Non-.md files ignored
index.md, log.md, README.md skipped in bundle Repo artifacts; not OKF concepts. list/show/validate only reserve index.md and log.md.
.okfignore entries skipped Skip selected files without moving them.

Root files need --default-type. See example/ for sample structure.

Output

Each concept becomes a markdown file with YAML frontmatter:

---
type: "tables"
title: "Customer Orders"
description: "One row per completed customer order across all channels."
timestamp: "2026-07-04T15:06:51+00:00"
---

Original body preserved as-is.

Every directory gets an index.md listing files and subdirs.

OKF Conformance

Generated bundles conform to OKF v0.1 (§9): frontmatter required, non-empty type, reserved filenames follow spec structure.

Project layout

okf-cli
├── .github/workflows/test.yml  # CI
├── OKF_SPEC.md                 # OKF specification
├── pyproject.toml              # uv-managed Python project
├── src/okf/
│   ├── cli.py            # Typer entrypoint
│   ├── api.py            # Programmatic Python API
│   ├── core.py           # Shared parsing/formatting
│   └── commands/         # bundle, list, show, validate
├── tests/                # pytest suite
└── example/              # Sample input markdown

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

okf_cli-0.4.8.tar.gz (43.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

okf_cli-0.4.8-py3-none-any.whl (14.3 kB view details)

Uploaded Python 3

File details

Details for the file okf_cli-0.4.8.tar.gz.

File metadata

  • Download URL: okf_cli-0.4.8.tar.gz
  • Upload date:
  • Size: 43.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for okf_cli-0.4.8.tar.gz
Algorithm Hash digest
SHA256 493f41e3e99d9adf15b3a5877519258d4a7dc706889a732b8264960eb7b55576
MD5 5d4a0dd740f0e05963021e87c2bd607a
BLAKE2b-256 5392245ff2c337a89f423884c16b0d0303c9df40927cf19b90a142be57906e04

See more details on using hashes here.

File details

Details for the file okf_cli-0.4.8-py3-none-any.whl.

File metadata

  • Download URL: okf_cli-0.4.8-py3-none-any.whl
  • Upload date:
  • Size: 14.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for okf_cli-0.4.8-py3-none-any.whl
Algorithm Hash digest
SHA256 5a150bfe173a67c04c50fc8d1d3eaa352d3ab3d678fd3dafc0f8375d1effa49c
MD5 f46db88cf4757bd2a641bdca6acb7b1e
BLAKE2b-256 5353eb25e8627fca00e53ec2170a28756e546d974b227e8e853ff7c4025e0ab4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page