fix(lattice): normalize Windows path separators in section/ref file IDs#67
Open
RicardoAGL wants to merge 2 commits into
Open
fix(lattice): normalize Windows path separators in section/ref file IDs#67RicardoAGL wants to merge 2 commits into
RicardoAGL wants to merge 2 commits into
Conversation
On Windows, path.relative() returns backslash-separated paths. These backslashes were embedded raw into section IDs and ref file fields, causing wiki-link resolution to fail with false broken-link errors on Windows (e.g. 8 spurious errors in a clean project). Fix: chain .replace(/\/g, '/') after the .md strip in both parseSections() and extractRefs(). This is a no-op on Mac/Linux where relative() already returns forward slashes. Fixes broken `lat check` output on Windows.
Adds `ollama:<model>` key format to LAT_LLM_KEY, enabling local embedding generation via Ollama without an external API key. Usage: LAT_LLM_KEY=ollama:nomic-embed-text lat search "query" Environment variables: OLLAMA_HOST Ollama base URL (default: http://localhost:11434) LAT_OLLAMA_DIMENSIONS Override vector dimensions for unlisted models Known dimensions are pre-configured for: nomic-embed-text (768), mxbai-embed-large (1024), all-minilm (384), snowflake-arctic-embed (1024), bge-large (1024), bge-base (768), bge-small (384). For any other model, set LAT_OLLAMA_DIMENSIONS to the model's output size. The Ollama /v1/embeddings endpoint is OpenAI-compatible — no auth header is sent (Ollama runs locally and requires none).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On Windows,
path.relative()returns backslash-separated paths (e.g.docs\api.md). These backslashes were embedded raw into thefilefield used for section IDs and ref resolution, causing wiki-link lookups to fail with false broken-link errors.Example: a clean project on Windows produces 8+ spurious broken-link errors from
lat checkwhere all links are valid — the IDs just don't match because one side uses\and the other uses/.Fix
Chain
.replace(/\/g, '/')after the.mdstrip in bothparseSections()andextractRefs()insrc/lattice.ts.This is a no-op on Mac/Linux —
path.relative()already returns forward slashes on those platforms, so the extra replace has zero effect and introduces no risk.Testing
Tested manually on Windows 11 with a project containing nested subdirectory markdown files:
lat checkreports 8 broken-link errors for valid linkslat checkreports 0 errors (only the expected "no init version" advisory)Scope
Only the two
relative()calls that feed into thefilevariable (used for ID construction). ThesectionFilePathfield (display-only, retains.md) is intentionally left as-is since it is not used in link resolution.