Skip to main content

plan-doc

Typed parser for plan-file YAML frontmatter (schema v1). Extracts the machine-readable fields a plan-driven-PR workflow needs — template, disposal, branch, a planner-handoff dossier block — from markdown plan documents. Validation is strict on plan-doc's own fields (loud failures on bad values and typos) but lenient on foreign top-level fields a host project carries alongside the schema (captured in .extra).

Source is maintained in a private monorepo. Releases are built and published by GitHub Actions through a PyPI Trusted Publisher; provenance attestations are visible on the PyPI file listing.

from pathlib import Path
from plan_doc import PlanDoc, PlanDocError, NonDraftPrFrontmatterError

doc = PlanDoc.from_path(Path("docs/plans/my-plan.md"))
if doc.disposal == "delete-on-merge":
    ...
if doc.dossier is not None:
    files = doc.dossier.get("files", [])

What it enforces

  • Schema v1. plan_schema: 1 is required; template, disposal, phase, cleanup_trigger, ticket, branch, tdd_mode, dossier are plan-doc's own top-level keys. Foreign top-level keys (a host project's own frontmatter convention — id, title, status, …) are tolerated and captured in PlanDoc.extra, so a plan can carry both schemas at once. The typo guard survives: an unknown key within edit-distance 1 of a known field still raises PlanDocError (dispozal fails loud), so a misspelling can't silently disable disposal/minimal handling. (Lenient policy since 0.1.1; 0.1.0 rejected every non-schema key.)
  • First-block-only parsing. Only a ---...--- block at the very top of the file is frontmatter. Body-level --- horizontal rules are never split on.
  • Foreign-document discrimination. Valid frontmatter with no plan_schema and no plan indicator fields raises the typed subclass NonDraftPrFrontmatterError, so callers can treat non-plan documents leniently without swallowing real validation errors.
  • No frontmatter at all raises PlanDocError with an actionable message (add plan_schema: 1).

Dependency note

pyyaml is a hard dependency, and the module also keeps a minimal no-yaml fallback parser (_parse_yaml_minimal) for simple key: value frontmatter. Both halves are deliberate: the upstream source of this module runs in a zero-pip environment and relies on the fallback, while the package declares full functionality. The fallback is covered by tests here — don't remove either half.

Provenance

Originally extracted (code byte-identical, module docstring reframed) from the draft-pr skill of the m0j0d portfolio plugin. As of 2026-06-14 this package is the canonical source of truth: the plugin's vendored copy was deleted and plugin now consumes this package via editable install.

Pool purity rule: transport-free, LLM-agnostic, no secrets. Pure parsing; the only I/O is Path.read_text in PlanDoc.from_path.

License

MIT

Download files

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

Source Distribution

plan_doc-0.1.3.tar.gz (16.6 kB view details)

Uploaded Source

Built Distribution

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

plan_doc-0.1.3-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

Details for the file plan_doc-0.1.3.tar.gz.

File metadata

  • Download URL: plan_doc-0.1.3.tar.gz
  • Upload date:
  • Size: 16.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for plan_doc-0.1.3.tar.gz
Algorithm Hash digest
SHA256 fd9bf313911bcc2effea34c90bda57896ce7a2fb5ce83888c5ef11779b184d9f
MD5 6807e3b097937b44e5ccaa8495fbba71
BLAKE2b-256 7fa80ec80028bfd693c125a9b3755766cb415b834fc0a304dcae324e9e3cce22

See more details on using hashes here.

Provenance

The following attestation bundles were made for plan_doc-0.1.3.tar.gz:

Publisher: release-plan-doc.yml on m0j0d/libs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file plan_doc-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: plan_doc-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 11.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for plan_doc-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 ca0a7818be2b2b64c55e7c2c33ad2b9b639725ed5fec08fa2d25e9670c8ac7de
MD5 f67f3afd1eb357b83fa81828863a2b7f
BLAKE2b-256 22dec0e4382523b288b326d712b47c4705ae530d046eb085262fe8f35a0ea7e0

See more details on using hashes here.

Provenance

The following attestation bundles were made for plan_doc-0.1.3-py3-none-any.whl:

Publisher: release-plan-doc.yml on m0j0d/libs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page