feat(workflow-util): frontmatter markdown parser — RFC #351 Phase 1 #352
Reference in New Issue
Block a user
Delete Branch "feat/351-frontmatter-markdown-phase1"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Add frontmatter markdown parser and validator to workflow-util.
Why
RFC #351 — agent output needs a unified format where frontmatter carries structured meta (for moderator routing) and markdown body carries content (for downstream agents).
Changes
workflow-util/src/frontmatter-markdown/types.ts— AgentFrontmatter, ParsedFrontmatterMarkdown, FrontmatterValidationError typesworkflow-util/src/frontmatter-markdown/frontmatter-markdown.ts— parseFrontmatterMarkdown() + validateFrontmatter() with built-in minimal YAML parserworkflow-util/src/frontmatter-markdown/index.ts— module re-exportsworkflow-util/__tests__/frontmatter-markdown.test.ts— 45 testsDesign
T | null(no optional properties)Ref
Refs #351
LGTM ✅
整体评价: 干净利落的 Phase 1 实现。
亮点:
typenotinterface,T | nullnot?:, named exportsFrontmatterValidationError用 discriminated union,类型安全一个小 nit(不阻塞合并):
parseMinimalYaml的 JSDoc 写 "Throws on structural errors",但实际上它不会抛异常(遇到不可解析的行直接跳过)。建议后续顺手改一下注释。可以合并,推 Phase 2 🚀