Skip to content

feat(md-autofix): auto-inject frontmatter into docs files missing it #730

Open
hilram7 wants to merge 4 commits intodevfrom
feature/frontmatter-autoinjection
Open

feat(md-autofix): auto-inject frontmatter into docs files missing it #730
hilram7 wants to merge 4 commits intodevfrom
feature/frontmatter-autoinjection

Conversation

@hilram7
Copy link
Copy Markdown
Collaborator

@hilram7 hilram7 commented Apr 8, 2026

Summary

Extends scripts/md-extension-autofix.sh (added in #720) to auto-inject
frontmatter (title, description, sidebar_position) into docs files
that are missing it. Applies to two cases:

  • Files in docs/ that are renamed by the script (missing .md extension)
  • Files in docs/ that already have .md but are missing frontmatter

docs/kb/* files are excluded — KB frontmatter is handled by a separate
skill. sidebar_position is derived from the file's alphabetical position
among its .md siblings.

Changes

scripts/md-extension-autofix.sh

  • 4 new functions: has_frontmatter, extract_h1, calculate_sidebar_position, inject_frontmatter
  • Script now injects frontmatter into renamed docs files missing it
  • Script now also injects frontmatter into already-.md docs files missing it

scripts/test-md-extension-autofix.sh

.github/workflows/md-extension-autofix.yml

  • Commit message updated: fix(docs): add missing .md extension and inject frontmatter
  • Bot-check pattern updated to match new commit message
  • PR comment extended with a Frontmatter injected table

Testing

  • 28 unit tests passed, 0 failed
  • Dev server verified (npm run start) — renamed and injected files render correctly
  • Production build passed (npm run build) — no errors
  • Coworker testing: Mac complete; additional coworker testing in progress

Test plan post-merge

  • Open a test PR adding files to docs/ and docs/kb/
  • Include various combinations of files with/without .md extension and frontmatter to verify workflow

hilram7 added 3 commits April 8, 2026 12:50
Adds has_frontmatter, extract_h1, calculate_sidebar_position, and inject_frontmatter
functions to md-extension-autofix.sh. Renamed docs files (non-KB) without frontmatter
get title, description, and sidebar_position injected automatically. Relaxed content
check to require heading only — frontmatter no longer required to trigger rename.
28 unit tests passing.
@hilram7 hilram7 deployed to development April 8, 2026 22:21 — with GitHub Actions Active
@hilram7 hilram7 marked this pull request as ready for review April 8, 2026 22:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant