plan-doc 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
plan_doc-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 m0j0d
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,77 @@
1
+ Metadata-Version: 2.4
2
+ Name: plan-doc
3
+ Version: 0.1.0
4
+ Summary: Typed parser for plan-file YAML frontmatter (schema v1) — strict validation, first-block-only extraction, foreign-document discrimination
5
+ License: MIT
6
+ Classifier: Programming Language :: Python :: 3
7
+ Classifier: Programming Language :: Python :: 3.10
8
+ Classifier: Programming Language :: Python :: 3.11
9
+ Classifier: Programming Language :: Python :: 3.12
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
13
+ Classifier: Development Status :: 4 - Beta
14
+ Requires-Python: >=3.10
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE
17
+ Requires-Dist: pyyaml>=6.0
18
+ Provides-Extra: dev
19
+ Requires-Dist: pytest>=9.0.3; extra == "dev"
20
+ Dynamic: license-file
21
+
22
+ # plan-doc
23
+
24
+ Typed parser for plan-file YAML frontmatter (schema v1). Extracts the
25
+ machine-readable fields a plan-driven-PR workflow needs — `template`,
26
+ `disposal`, `branch`, a planner-handoff `dossier` block — from markdown
27
+ plan documents, with strict validation and loud failures.
28
+
29
+ ```python
30
+ from pathlib import Path
31
+ from plan_doc import PlanDoc, PlanDocError, NonDraftPrFrontmatterError
32
+
33
+ doc = PlanDoc.from_path(Path("docs/plans/my-plan.md"))
34
+ if doc.disposal == "delete-on-merge":
35
+ ...
36
+ if doc.dossier is not None:
37
+ files = doc.dossier.get("files", [])
38
+ ```
39
+
40
+ ## What it enforces
41
+
42
+ - **Schema v1.** `plan_schema: 1` is required; `template`, `disposal`,
43
+ `phase`, `cleanup_trigger`, `ticket`, `branch`, `tdd_mode`, `dossier`
44
+ are the only other top-level keys. Unknown keys raise `PlanDocError` —
45
+ this is the typo guard (`dispozal` fails loud).
46
+ - **First-block-only parsing.** Only a `---`...`---` block at the very
47
+ top of the file is frontmatter. Body-level `---` horizontal rules are
48
+ never split on.
49
+ - **Foreign-document discrimination.** Valid frontmatter with no
50
+ `plan_schema` and no plan indicator fields raises the typed subclass
51
+ `NonDraftPrFrontmatterError`, so callers can treat non-plan documents
52
+ leniently without swallowing real validation errors.
53
+ - **No frontmatter at all** raises `PlanDocError` with an actionable
54
+ message (add `plan_schema: 1`).
55
+
56
+ ## Dependency note
57
+
58
+ `pyyaml` is a hard dependency, and the module *also* keeps a minimal
59
+ no-yaml fallback parser (`_parse_yaml_minimal`) for simple `key: value`
60
+ frontmatter. Both halves are deliberate: the upstream source of this
61
+ module runs in a zero-pip environment and relies on the fallback, while
62
+ the package declares full functionality. The fallback is covered by
63
+ tests here — don't remove either half.
64
+
65
+ ## Provenance
66
+
67
+ Extracted verbatim (code byte-identical, module docstring reframed) from
68
+ the draft-pr skill of the m0j0d portfolio plugin, where the vendored copy
69
+ remains the operational source of truth. This package mirrors it at
70
+ release points.
71
+
72
+ Pool purity rule: transport-free, LLM-agnostic, no secrets. Pure parsing;
73
+ the only I/O is `Path.read_text` in `PlanDoc.from_path`.
74
+
75
+ ## License
76
+
77
+ MIT
@@ -0,0 +1,56 @@
1
+ # plan-doc
2
+
3
+ Typed parser for plan-file YAML frontmatter (schema v1). Extracts the
4
+ machine-readable fields a plan-driven-PR workflow needs — `template`,
5
+ `disposal`, `branch`, a planner-handoff `dossier` block — from markdown
6
+ plan documents, with strict validation and loud failures.
7
+
8
+ ```python
9
+ from pathlib import Path
10
+ from plan_doc import PlanDoc, PlanDocError, NonDraftPrFrontmatterError
11
+
12
+ doc = PlanDoc.from_path(Path("docs/plans/my-plan.md"))
13
+ if doc.disposal == "delete-on-merge":
14
+ ...
15
+ if doc.dossier is not None:
16
+ files = doc.dossier.get("files", [])
17
+ ```
18
+
19
+ ## What it enforces
20
+
21
+ - **Schema v1.** `plan_schema: 1` is required; `template`, `disposal`,
22
+ `phase`, `cleanup_trigger`, `ticket`, `branch`, `tdd_mode`, `dossier`
23
+ are the only other top-level keys. Unknown keys raise `PlanDocError` —
24
+ this is the typo guard (`dispozal` fails loud).
25
+ - **First-block-only parsing.** Only a `---`...`---` block at the very
26
+ top of the file is frontmatter. Body-level `---` horizontal rules are
27
+ never split on.
28
+ - **Foreign-document discrimination.** Valid frontmatter with no
29
+ `plan_schema` and no plan indicator fields raises the typed subclass
30
+ `NonDraftPrFrontmatterError`, so callers can treat non-plan documents
31
+ leniently without swallowing real validation errors.
32
+ - **No frontmatter at all** raises `PlanDocError` with an actionable
33
+ message (add `plan_schema: 1`).
34
+
35
+ ## Dependency note
36
+
37
+ `pyyaml` is a hard dependency, and the module *also* keeps a minimal
38
+ no-yaml fallback parser (`_parse_yaml_minimal`) for simple `key: value`
39
+ frontmatter. Both halves are deliberate: the upstream source of this
40
+ module runs in a zero-pip environment and relies on the fallback, while
41
+ the package declares full functionality. The fallback is covered by
42
+ tests here — don't remove either half.
43
+
44
+ ## Provenance
45
+
46
+ Extracted verbatim (code byte-identical, module docstring reframed) from
47
+ the draft-pr skill of the m0j0d portfolio plugin, where the vendored copy
48
+ remains the operational source of truth. This package mirrors it at
49
+ release points.
50
+
51
+ Pool purity rule: transport-free, LLM-agnostic, no secrets. Pure parsing;
52
+ the only I/O is `Path.read_text` in `PlanDoc.from_path`.
53
+
54
+ ## License
55
+
56
+ MIT
@@ -0,0 +1,77 @@
1
+ Metadata-Version: 2.4
2
+ Name: plan-doc
3
+ Version: 0.1.0
4
+ Summary: Typed parser for plan-file YAML frontmatter (schema v1) — strict validation, first-block-only extraction, foreign-document discrimination
5
+ License: MIT
6
+ Classifier: Programming Language :: Python :: 3
7
+ Classifier: Programming Language :: Python :: 3.10
8
+ Classifier: Programming Language :: Python :: 3.11
9
+ Classifier: Programming Language :: Python :: 3.12
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
13
+ Classifier: Development Status :: 4 - Beta
14
+ Requires-Python: >=3.10
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE
17
+ Requires-Dist: pyyaml>=6.0
18
+ Provides-Extra: dev
19
+ Requires-Dist: pytest>=9.0.3; extra == "dev"
20
+ Dynamic: license-file
21
+
22
+ # plan-doc
23
+
24
+ Typed parser for plan-file YAML frontmatter (schema v1). Extracts the
25
+ machine-readable fields a plan-driven-PR workflow needs — `template`,
26
+ `disposal`, `branch`, a planner-handoff `dossier` block — from markdown
27
+ plan documents, with strict validation and loud failures.
28
+
29
+ ```python
30
+ from pathlib import Path
31
+ from plan_doc import PlanDoc, PlanDocError, NonDraftPrFrontmatterError
32
+
33
+ doc = PlanDoc.from_path(Path("docs/plans/my-plan.md"))
34
+ if doc.disposal == "delete-on-merge":
35
+ ...
36
+ if doc.dossier is not None:
37
+ files = doc.dossier.get("files", [])
38
+ ```
39
+
40
+ ## What it enforces
41
+
42
+ - **Schema v1.** `plan_schema: 1` is required; `template`, `disposal`,
43
+ `phase`, `cleanup_trigger`, `ticket`, `branch`, `tdd_mode`, `dossier`
44
+ are the only other top-level keys. Unknown keys raise `PlanDocError` —
45
+ this is the typo guard (`dispozal` fails loud).
46
+ - **First-block-only parsing.** Only a `---`...`---` block at the very
47
+ top of the file is frontmatter. Body-level `---` horizontal rules are
48
+ never split on.
49
+ - **Foreign-document discrimination.** Valid frontmatter with no
50
+ `plan_schema` and no plan indicator fields raises the typed subclass
51
+ `NonDraftPrFrontmatterError`, so callers can treat non-plan documents
52
+ leniently without swallowing real validation errors.
53
+ - **No frontmatter at all** raises `PlanDocError` with an actionable
54
+ message (add `plan_schema: 1`).
55
+
56
+ ## Dependency note
57
+
58
+ `pyyaml` is a hard dependency, and the module *also* keeps a minimal
59
+ no-yaml fallback parser (`_parse_yaml_minimal`) for simple `key: value`
60
+ frontmatter. Both halves are deliberate: the upstream source of this
61
+ module runs in a zero-pip environment and relies on the fallback, while
62
+ the package declares full functionality. The fallback is covered by
63
+ tests here — don't remove either half.
64
+
65
+ ## Provenance
66
+
67
+ Extracted verbatim (code byte-identical, module docstring reframed) from
68
+ the draft-pr skill of the m0j0d portfolio plugin, where the vendored copy
69
+ remains the operational source of truth. This package mirrors it at
70
+ release points.
71
+
72
+ Pool purity rule: transport-free, LLM-agnostic, no secrets. Pure parsing;
73
+ the only I/O is `Path.read_text` in `PlanDoc.from_path`.
74
+
75
+ ## License
76
+
77
+ MIT
@@ -0,0 +1,10 @@
1
+ LICENSE
2
+ README.md
3
+ plan_doc.py
4
+ pyproject.toml
5
+ plan_doc.egg-info/PKG-INFO
6
+ plan_doc.egg-info/SOURCES.txt
7
+ plan_doc.egg-info/dependency_links.txt
8
+ plan_doc.egg-info/requires.txt
9
+ plan_doc.egg-info/top_level.txt
10
+ tests/test_plan_doc.py
@@ -0,0 +1,4 @@
1
+ pyyaml>=6.0
2
+
3
+ [dev]
4
+ pytest>=9.0.3
@@ -0,0 +1 @@
1
+ plan_doc