Add LOCAL_DATA_DIR: filesystem-based manifest indexing - #2
Merged
Merged
Conversation
- New src/manifest/local-builder.ts: scans a local 5etools data/ directory directly via fs.readdir instead of the GitHub Contents API. Uses file mtime+size as a cache-invalidation key in place of a GitHub blob SHA. - github.ts fetchRaw() now handles file:// URLs by reading straight from disk, so content fetching is fully network-free too when LOCAL_DATA_DIR is set (LOCAL_BASE_URL is then ignored). - builder.ts: buildManifest() branches on LOCAL_DATA_DIR; falls back to the existing GitHub-based path when unset, so stdio/Claude Desktop users are unaffected. - Homebrew indexing is unchanged (still GitHub-only, already non-fatal on rate-limit errors) — self-hosted mirrors don't bundle third-party homebrew content. - Tests: tests/manifest/local-builder.test.ts (5 tests) and file:// coverage added to tests/github.test.ts (2 tests). Full suite: 440 tests, lint/typecheck/build all clean. - Verified end-to-end against a real fixture data/ directory: served correct, fixture-only content with zero GitHub calls.
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.
Summary
Follow-up to #1. LOCAL_BASE_URL only replaced content fetching — manifest indexing (directory listing) still hit the GitHub Contents API, which is rate-limited to 60/hr unauthenticated and was failing for anyone running the server without a GITHUB_TOKEN.
LOCAL_DATA_DIRenv var: when set, both indexing and content fetching read directly from a localdata/directory on disk (fs.readdir+file://URLs), no GitHub calls at all for core content.LOCAL_BASE_URLis ignored whenLOCAL_DATA_DIRis set.LOCAL_DATA_DIRis unset, so stdio/Claude Desktop users are unaffected.Testing
tests/manifest/local-builder.test.ts(5),file://coverage intests/github.test.ts(2). Full suite: 440 tests, lint/typecheck/build clean.data/directory over the HTTP transport: returned exactly the fixture content with zero GitHub calls in the log.