fix: dist export erzeugt die TOC-Region nach dem Marker-Strip neu (CI-Fund im Export-Replay)
CI / verify (push) Successful in 1m0s
Release / release (push) Successful in 36s

Files changed:
- CHANGES.md
- VERSION
- tools/chemenu/commands/dist_cmd.py
- tools/chemenu/tests/test_dist_cmd.py
This commit is contained in:
2026-09-09 20:47:29 +02:00
parent 53e3527e0b
commit bb8f956719
4 changed files with 67 additions and 5 deletions
+22 -2
View File
@@ -45,7 +45,16 @@ from typing import Callable, NamedTuple, Optional, Union
import typer
from chemenu import config, conventions, kb_collections, kb_state, ownership, version as version_mod
from chemenu import (
blocks,
config,
conventions,
kb_collections,
kb_state,
ownership,
toc,
version as version_mod,
)
from chemenu.commands._util import console, fail, rel_path, success, today_iso
app = typer.Typer(help="Build a distributable copy of the wiki machinery.")
@@ -213,7 +222,18 @@ def _read_planned_file(path: Path, label: str) -> PlannedFile:
if path.suffix != ".md":
return PlannedFile(text, executable)
_validate_markers(text, label)
return PlannedFile(strip_markers(text), executable)
stripped = strip_markers(text)
# A table-of-contents region describes the file it sits in, and stripping
# just changed that file: `AGENTS.md`'s marked block wraps the whole
# `## Developing this stack` section, so the shipped copy has one heading
# fewer than the working tree's TOC lists. Regenerating here - after the
# strip, on the text that actually ships - is what keeps a fresh
# instance's own `docs verify` green on the very first run. A file with
# no region, or one the strip pushed under the threshold, is handled by
# `toc.upsert` itself.
if blocks.find(stripped, toc.REGION_NAME) is not None:
stripped = toc.upsert(stripped)
return PlannedFile(stripped, executable)
def _copy_tree(