diff --git a/.agents/modules/mcp/server/kb.py b/.agents/modules/mcp/server/kb.py
index ea49edc..dcc3a03 100644
--- a/.agents/modules/mcp/server/kb.py
+++ b/.agents/modules/mcp/server/kb.py
@@ -41,15 +41,19 @@ class Author:
return f"{self.name} <{self.email}>"
+FM_CLOSE_RE = re.compile(r"^---[ \t]*$", re.M) # the closing line; may end the file
+
+
def parse_frontmatter(text):
"""Flat key: value frontmatter, the same deliberately simple reading as the rest of the template."""
if not text.startswith("---\n"):
return {}, text
- end = text.find("\n---", 4)
- if end < 0:
+ close = FM_CLOSE_RE.search(text, 4)
+ if close is None:
return {}, text
+ end = close.start() - 1
fm = {}
- for line in text[4:end].splitlines():
+ for line in text[4:max(end, 4)].splitlines():
m = re.match(r"^([A-Za-z_][\w-]*):\s*(.*)$", line)
if m:
fm[m.group(1)] = m.group(2).strip().strip('"').strip("'")
diff --git a/.agents/modules/share/skills/ckb-share/scripts/share.py b/.agents/modules/share/skills/ckb-share/scripts/share.py
index 3f26351..ba45a20 100644
--- a/.agents/modules/share/skills/ckb-share/scripts/share.py
+++ b/.agents/modules/share/skills/ckb-share/scripts/share.py
@@ -85,11 +85,14 @@ def identity(root, author):
return name or user, email or f"{user}@localhost"
+FM_CLOSE_RE = re.compile(r"^---[ \t]*$", re.M) # the closing line; may end the file
+
+
def split_frontmatter(text):
if text.startswith("---\n"):
- end = text.find("\n---\n", 4)
- if end != -1:
- return text[4:end], text[end + 5:]
+ close = FM_CLOSE_RE.search(text, 4)
+ if close is not None:
+ return text[4:close.start()].rstrip("\n"), text[close.end() + 1:]
return "", text
diff --git a/.agents/skills/ckb-consolidate/scripts/consolidate.py b/.agents/skills/ckb-consolidate/scripts/consolidate.py
index 4d00678..4c5bdd9 100644
--- a/.agents/skills/ckb-consolidate/scripts/consolidate.py
+++ b/.agents/skills/ckb-consolidate/scripts/consolidate.py
@@ -44,18 +44,21 @@ MIN_SCOPE_CLUSTER = 2
OLD_LOG_DAYS = 90
+FM_CLOSE_RE = re.compile(r"^---[ \t]*$", re.M) # the closing line; may end the file
+
+
def parse(text):
if not text.startswith("---\n"):
return {}, text
- end = text.find("\n---\n", 4)
- if end == -1:
+ close = FM_CLOSE_RE.search(text, 4)
+ if close is None:
return {}, text
fm = {}
- for line in text[4:end].split("\n"):
+ for line in text[4:close.start()].split("\n"):
k, sep, v = line.partition(":")
- if sep and not line[:1].isspace():
+ if sep and not line[:1].isspace() and not line.lstrip().startswith("#"):
fm[k.strip()] = v.strip().strip("\"'")
- return fm, text[end + 5:]
+ return fm, text[close.end() + 1:]
def words(s):
diff --git a/.agents/skills/ckb-export-okf/scripts/export_okf.py b/.agents/skills/ckb-export-okf/scripts/export_okf.py
index 71c1cb6..2ea81a8 100644
--- a/.agents/skills/ckb-export-okf/scripts/export_okf.py
+++ b/.agents/skills/ckb-export-okf/scripts/export_okf.py
@@ -71,16 +71,19 @@ VERB_MAP = {
PRIVATE_RE = re.compile(r".*?(?:|\Z)", re.S | re.I)
+FM_CLOSE_RE = re.compile(r"^---[ \t]*$", re.M) # the closing line; may end the file
+
+
def parse_frontmatter(text):
"""Return (dict, body). Flat `key: value` YAML only — that is all the
schema uses. Unparseable or absent frontmatter yields ({}, text)."""
if not text.startswith("---\n"):
return {}, text
- end = text.find("\n---\n", 4)
- if end == -1:
+ close = FM_CLOSE_RE.search(text, 4)
+ if close is None:
return {}, text
- raw = text[4:end]
- body = text[end + 5 :]
+ raw = text[4:close.start()]
+ body = text[close.end() + 1 :]
fm = {}
for line in raw.split("\n"):
line = line.rstrip()
diff --git a/.agents/skills/ckb-export-starlight/scripts/export_starlight.py b/.agents/skills/ckb-export-starlight/scripts/export_starlight.py
index 6bc5130..8eeaf16 100644
--- a/.agents/skills/ckb-export-starlight/scripts/export_starlight.py
+++ b/.agents/skills/ckb-export-starlight/scripts/export_starlight.py
@@ -63,15 +63,18 @@ def yaml_quote(s):
return f'"{s}"'
+FM_CLOSE_RE = re.compile(r"^---[ \t]*$", re.M) # the closing line; may end the file
+
+
def parse_frontmatter(text):
"""Minimal parser for this repo's flat key: value frontmatter (no lists/nesting)."""
if not text.startswith("---\n"):
return {}, text
- end = text.find("\n---", 4)
- if end == -1:
+ close = FM_CLOSE_RE.search(text, 4)
+ if close is None:
return {}, text
- fm_block = text[4:end]
- body = text[end + 4 :].lstrip("\n")
+ fm_block = text[4:close.start()]
+ body = text[close.end() + 1 :].lstrip("\n")
fm = {}
for line in fm_block.splitlines():
line = line.strip()
diff --git a/.agents/skills/ckb-ingest/scripts/dedup_inbox.py b/.agents/skills/ckb-ingest/scripts/dedup_inbox.py
index 476c149..be70f58 100644
--- a/.agents/skills/ckb-ingest/scripts/dedup_inbox.py
+++ b/.agents/skills/ckb-ingest/scripts/dedup_inbox.py
@@ -96,11 +96,14 @@ def files_under(base):
if p.is_file() and not any(part.startswith(".") for part in p.relative_to(base).parts)]
+FM_CLOSE_RE = re.compile(r"^---[ \t]*$", re.M) # the closing line; may end the file
+
+
def frontmatter_value(text, key):
if not text.startswith("---\n"):
return ""
- end = text.find("\n---\n", 4)
- for line in text[4:end if end != -1 else 0].split("\n"):
+ close = FM_CLOSE_RE.search(text, 4)
+ for line in text[4:close.start() if close else 4].split("\n"):
if line.startswith(f"{key}:"):
return line.split(":", 1)[1].strip().strip("\"'")
return ""
diff --git a/.agents/skills/ckb-retrieve/scripts/retrieve_candidates.py b/.agents/skills/ckb-retrieve/scripts/retrieve_candidates.py
index ff61ab5..f3f1fe7 100755
--- a/.agents/skills/ckb-retrieve/scripts/retrieve_candidates.py
+++ b/.agents/skills/ckb-retrieve/scripts/retrieve_candidates.py
@@ -52,14 +52,18 @@ MD_EXCLUDE = {"index.md", "log.md"}
# ---------------------------------------------------------------- parsing ---
+FM_CLOSE_RE = re.compile(r"^---[ \t]*$", re.M) # the closing line; may end the file
+
+
def parse_frontmatter(text):
if not text.startswith("---\n"):
return {}, text
- end = text.find("\n---", 4)
- if end < 0:
+ close = FM_CLOSE_RE.search(text, 4)
+ if close is None:
return {}, text
+ end = close.start() - 1
fm = {}
- for line in text[4:end].splitlines():
+ for line in text[4:max(end, 4)].splitlines():
m = re.match(r"^([A-Za-z_][\w-]*):\s*(.*)$", line)
if m:
fm[m.group(1)] = m.group(2).strip().strip('"').strip("'")
diff --git a/VERSION b/VERSION
index ea9e107..0ad2129 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.28.6
+1.28.7
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
index cb0ca4a..9d1469e 100644
--- a/docs/CHANGELOG.md
+++ b/docs/CHANGELOG.md
@@ -340,7 +340,8 @@ docs. Independent of the content schema above.
| Version | Date | What landed | Schema |
|---|---|---|---|
-| **1.28.6** | 2026-11-11 | `1.x` backport of the 2.0.5 fixes, no new features: `routines.py` zero-indent lists, escaped `--do`, `--remove` continuation lines; `` redaction across content blocks; OKF quoting and code-fence titles; Unicode search tokens; workload date guard, frontmatter at end of file, `wiki/` refs without a slash, Starlight route collisions, labelled wikilinks, splash sections, `` dropped from exports. Same tests as 2.0.5 | 1.7 |
+| **1.28.7** | 2026-11-11 | `1.x` backport of 2.0.6: all eight frontmatter readers close at a `---` line, including one at end of file; frontmatter contract test and dirty-KB lint test | 1.7 |
+| 1.28.6 | 2026-11-11 | `1.x` backport of the 2.0.5 fixes, no new features: `routines.py` zero-indent lists, escaped `--do`, `--remove` continuation lines; `` redaction across content blocks; OKF quoting and code-fence titles; Unicode search tokens; workload date guard, frontmatter at end of file, `wiki/` refs without a slash, Starlight route collisions, labelled wikilinks, splash sections, `` dropped from exports. Same tests as 2.0.5 | 1.7 |
| 1.28.5 | 2026-11-11 | `1.x` backport of the 2.0.4 fixes, no new features: wider secret scan (hidden folders, key files, dotfiles, extensionless text, unquoted secret-looking assignments, oversized files reported); mcp search filtered by the read policy, case-insensitive `.local.yaml` refusal, verified OAuth email only, DNS-rebinding protection on by default, single-use confirmation codes; capture refuses link-local/metadata always and private networks without `--allow-private`, total download limit, charset fallback, `