Summary
On Windows, lat check produces false-positive broken link errors for every short-form [[<name>]] wikilink that appears in a directory-index file (e.g. the auto-generated codigo/codigo.md or top-level lat.md). The same project on macOS/Linux validates clean.
Repro (Windows 11, Node 24.11.1, npm 11.6.2, lat.md 0.11.0)
mkdir lat-windows-bug && cd lat-windows-bug
lat init
# Optionally add a sub-directory with multiple .md files:
mkdir codigo && cd codigo
echo "# A" > a.md
echo "# B" > b.md
echo "# Codigo`n[[a]] [[b]]" > codigo.md
cd ..
lat check
Expected: 0 errors.
Actual on Windows:
Scanned ... in ~400 ms
2 errors found
codigo\codigo.md: [[a]] not found
codigo\codigo.md: [[b]] not found
The fully-qualified links [[codigo\a]] and [[lat.md\codigo\a]] resolve correctly. Only the short bare-name form fails — even though lat's own lat init scaffold and the README examples both use the short form inside index files.
Root cause
dist/src/lattice.js:200 (in buildFileIndex()):
const baseName = s.file.split('/').pop();
Path values inside the section index are stored using the native OS separator. On Windows that's \, so 'codigo\codigo.md'.split('/').pop() returns 'codigo\codigo.md' (the whole path) rather than 'codigo.md'. The bare-name lookup table never gets populated, so the validator can't find any of the targets.
Suggested fix
- const baseName = s.file.split('/').pop();
+ const baseName = s.file.split(/[\/]/).pop();
Or equivalently use path.basename(s.file) for the same OS-neutral behavior.
Workaround until released
Use fully-qualified [[full/path#Section]] everywhere, never bare-name [[Section]]. Sacrifices the directory-listing convention the README documents but unblocks lat check.
Context
Found while migrating a structural engineering knowledge graph (8 directory-index files, 18 broken-link false positives, all caused by this one line). The rest of the lattice — wiki links, code annotations (// @lat:), lat section, lat refs, lat locate — works perfectly on Windows. Thanks for shipping this — it's a great tool.
Summary
On Windows,
lat checkproduces false-positivebroken linkerrors for every short-form[[<name>]]wikilink that appears in a directory-index file (e.g. the auto-generatedcodigo/codigo.mdor top-levellat.md). The same project on macOS/Linux validates clean.Repro (Windows 11, Node 24.11.1, npm 11.6.2, lat.md 0.11.0)
Expected: 0 errors.
Actual on Windows:
The fully-qualified links
[[codigo\a]]and[[lat.md\codigo\a]]resolve correctly. Only the short bare-name form fails — even though lat's ownlat initscaffold and the README examples both use the short form inside index files.Root cause
dist/src/lattice.js:200(inbuildFileIndex()):Path values inside the section index are stored using the native OS separator. On Windows that's
\, so'codigo\codigo.md'.split('/').pop()returns'codigo\codigo.md'(the whole path) rather than'codigo.md'. The bare-name lookup table never gets populated, so the validator can't find any of the targets.Suggested fix
Or equivalently use
path.basename(s.file)for the same OS-neutral behavior.Workaround until released
Use fully-qualified
[[full/path#Section]]everywhere, never bare-name[[Section]]. Sacrifices the directory-listing convention the README documents but unblockslat check.Context
Found while migrating a structural engineering knowledge graph (8 directory-index files, 18 broken-link false positives, all caused by this one line). The rest of the lattice — wiki links, code annotations (
// @lat:),lat section,lat refs,lat locate— works perfectly on Windows. Thanks for shipping this — it's a great tool.