The resolveContentFileFromId function within buildScripts/generateSeoFiles.mjs is responsible for mapping ids from learn/tree.json to actual content files on disk. The current implementation includes a nestedCandidates logic that attempts to find README or index files within directories corresponding to tree.json ids.
This nestedCandidates logic appears to be an incorrect assumption or a "hallucination" as the tree.json ids are designed to provide direct paths to content files (e.g., benefits/Effort should map to learn/benefits/Effort.md). The current approach can lead to incorrect file resolution or unnecessary complexity.
Acceptance Criteria:
- Simplify
resolveContentFileFromId: Remove the nestedCandidates logic from resolveContentFileFromId.
- Direct Path Resolution: The function should directly resolve content file paths by combining
LEARN_DIR, the id (split into segments), and iterating through SUPPORTED_DOC_EXTENSIONS.
- Accurate Extension Handling: Ensure that the function correctly appends the appropriate file extension (e.g.,
.md, .json) to the id to find the corresponding content file.
- Validation: Verify that all
ids in learn/tree.json correctly resolve to their respective content files after the refactoring.
The
resolveContentFileFromIdfunction withinbuildScripts/generateSeoFiles.mjsis responsible for mappingids fromlearn/tree.jsonto actual content files on disk. The current implementation includes anestedCandidateslogic that attempts to findREADMEorindexfiles within directories corresponding totree.jsonids.This
nestedCandidateslogic appears to be an incorrect assumption or a "hallucination" as thetree.jsonids are designed to provide direct paths to content files (e.g.,benefits/Effortshould map tolearn/benefits/Effort.md). The current approach can lead to incorrect file resolution or unnecessary complexity.Acceptance Criteria:
resolveContentFileFromId: Remove thenestedCandidateslogic fromresolveContentFileFromId.LEARN_DIR, theid(split into segments), and iterating throughSUPPORTED_DOC_EXTENSIONS..md,.json) to theidto find the corresponding content file.ids inlearn/tree.jsoncorrectly resolve to their respective content files after the refactoring.