Skip to content

scanner: parse YAML block-list tags/keywords in frontmatter - #5

Merged
mockingbird777 merged 1 commit into
mockingbird777:mainfrom
dchaudhari7177:feat/frontmatter-block-lists
Jul 22, 2026
Merged

scanner: parse YAML block-list tags/keywords in frontmatter#5
mockingbird777 merged 1 commit into
mockingbird777:mainfrom
dchaudhari7177:feat/frontmatter-block-lists

Conversation

@dchaudhari7177

Copy link
Copy Markdown
Contributor

What

Markdown resources may declare tags/keywords as a YAML block list, but the lightweight frontmatter scanner only understood the inline [a, b] form. This adds block-list support with no YAML runtime dependency:

---
tags:
  - security
  - review
---

When a tags/keywords key has an empty inline value, the parser consumes the following - scalar lines.

Acceptance criteria

  • ✅ recognizes simple block lists under tags and keywords
  • ✅ merges with the kind tag, dedupes, deterministic order (existing uniqueSorted)
  • ✅ inline [a, b] syntax preserved
  • simple scalars only — a nested/mapping item (- foo: bar) ends the list rather than recursing, so malformed/nested structures neither execute code nor crash the scan
  • ✅ 256-item safety boundary preserved (loop caps at MAX_LIST_ITEMS, and the merged result is re-sliced)
  • ✅ README example + CHANGELOG [Unreleased] entry

Tests

Three deterministic scanner tests (synthetic fixtures via the existing workspace/scanWorkspace helpers): a block list of tags+keywords[audit, prompt, review, security]; the inline form still → [prompt, review, security]; and a block list with a nested - key: value item stops cleanly, keeping the scalar before it. My three tests pass; the only two failing tests in the suite are the pre-existing Windows-only symlink EPERM cases (unrelated).

Fixes #4

The lightweight frontmatter scanner only understood inline [a, b] tag
lists. Recognize the common YAML block-list form (tags: then indented
- items) with no YAML runtime dependency: when a tags/keywords key has
an empty inline value, consume following '  - scalar' lines. Only
simple scalars are accepted — a nested/mapping item (- foo: bar) ends
the list rather than recursing, so malformed input can't crash the scan.
Values merge with the kind tag, dedupe, sort deterministically, and stay
within the 256-item bound. Inline lists are unchanged.

Fixes mockingbird777#4
@mockingbird777
mockingbird777 merged commit 48ed656 into mockingbird777:main Jul 22, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants