Resolve the gosec G122 CI-lint blocker: reserved files without
frontmatter were read a second time via a literal os.ReadFile inside the
filepath.WalkDir callback. Move the no-frontmatter fallback into the
concept package as ParseReserved, which reads the file exactly once and
returns a *Concept with empty Frontmatter and the raw content as Body.
No literal os.ReadFile remains in the walk callback.
Also stop silently swallowing malformed-frontmatter errors on reserved
files: ParseReserved only rescues ErrNoFrontmatter and surfaces every
other parse error, so a reserved file with broken frontmatter no longer
vanishes without a diagnostic.
Add an end-to-end regression test that generates index.md files via
index.Generate and asserts they appear in b.Reserved (the slice runIndex
scans), covering the user-visible empty-output symptom.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Problem
The
okf indexcommand generates index.md files into every directory, but JSON output reportscount: 0, indexes_written: null.Root Cause
bundle.Load()callsconcept.Parse()for reserved files (index.md). Generated index.md files have no YAML frontmatter, soconcept.ParsereturnsErrNoFrontmatter. The file is silently skipped becausebundle.goonly appends to Reserved whenperr == nil.Fix
When
concept.ParsereturnsErrNoFrontmatterfor a reserved file, load it as a Concept with empty Frontmatter and Body set to raw file content. This ensures generated index.md files are tracked in Reserved.