Skip to content

feat(registry): support exclude_paths on git sources - #135

Merged
moshest merged 2 commits into
mainfrom
claude/git-source-exclude-paths
Sep 8, 2026
Merged

feat(registry): support exclude_paths on git sources#135
moshest merged 2 commits into
mainfrom
claude/git-source-exclude-paths

Conversation

@moshest

@moshest moshest commented Sep 8, 2026

Copy link
Copy Markdown
Member

Why

exclude_paths was declared only on ZipSourceSchema, and both excludePaths call sites in build.ts sat inside source.type === "zip" branches. Git sources had no way to prune a subtree, so the only lever was narrowing docs_path — which fails when the content you want shares a directory with content you don't.

I found this the hard way: I suggested exclude_paths to the contributor on #133, having generalised from registry/java/java.yaml without noticing it's a zip source. They had already ruled it out in their PR description, correctly. This makes the advice true rather than leaving it wrong.

#133 is a good illustration of the gap. godot-docs keeps GDScript, C# and C++ tutorials as siblings under tutorials/scripting. C# is 40% of that subtree and outranks GDScript on the queries that matter — signal, await, export — so a GDScript package built from the wider path returns C# results. Without exclude_paths the only option is a narrow docs_path that also drops the built-in function reference.

What changed

  • exclude_paths added to GitSourceSchema, same shape and semantics as the zip one.
  • compileGlob moved from zip.ts into a new glob.ts and shared rather than copied, alongside a new excludeFiles helper.
  • Both git build paths — versioned (buildFromGit) and unversioned — filter through it.
  • Documented in registry/README.md, written before the code per the DX-first rule in CLAUDE.md.

Patterns match relative to docs_path, exactly as they already do for zip sources, so a definition reads the same whichever source type it uses. The zip builder strips the prefix while extracting; git file paths still carry it, which excludeFiles accounts for.

Filtering runs before the existing emptiness check, so an over-broad pattern fails the build rather than publishing an empty package.

Verification

Against real godot-docs clones, not just unit tests:

definition exclude_paths sections tokens
baseline none 129 60,921
same, two files pruned gdscript_styleguide.rst, static_typing.rst 103 46,911
same, everything pruned ** exits 1

The third row is the one worth having: No documentation files found in https://github.com/godotengine/godot-docs (default branch), exit 1 — not a silent empty package. The second row also confirms the docs_path-relative semantics, since bare filenames matched without the tutorials/scripting/gdscript/ prefix.

  • 5 new unit tests in glob.test.ts covering ** vs *, docs_path-relative matching, excluding everything, and literal metacharacters
  • pnpm lint — clean (needed pnpm fix for import order and wrapping)
  • pnpm build — clean
  • pnpm test — 221 context + 48 registry, all passing
  • Changeset added; zip.ts behaviour unchanged, covered by its existing tests

Not included

I haven't touched #133's definitions. Whether godot should exclude the gdscript tutorials is the author's call, and this only makes the option available.

🤖 Generated with Claude Code

https://claude.ai/code/session_01NBQQpA86yYzwJUiVz8ph2R


Generated by Claude Code

exclude_paths was declared only on ZipSourceSchema, and both call sites sat
inside `source.type === "zip"` branches. Git sources therefore had no way to
prune a subtree, so the only lever was narrowing docs_path — which fails when
the content you want shares a directory with content you don't.

#133 is the case: godot-docs keeps GDScript, C# and C++ tutorials as siblings
under tutorials/scripting. C# is 40% of that subtree and outranks GDScript on
the queries that matter (signal, await, export), so a GDScript package built
from the wider path returns C# results. Without exclude_paths the contributor's
only option was a narrow docs_path that also drops the built-in function
reference.

Patterns match relative to docs_path, as they already do for zip sources, so a
definition reads the same either way: the zip builder strips the prefix while
extracting, and git file paths still carry it, which excludeFiles accounts for.

compileGlob moves to glob.ts and is now shared rather than copied, alongside
excludeFiles.

Filtering happens before the existing emptiness check, so an over-broad pattern
fails the build instead of publishing an empty package. Verified against
godot-docs: 129 sections baseline, 103 with two files excluded, and exclude
"**" exits 1 with "No documentation files found" rather than succeeding.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NBQQpA86yYzwJUiVz8ph2R
@changeset-bot

changeset-bot Bot commented Sep 8, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: d259836

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

The changeset declared a patch on @neuledge/context, which this PR does not
touch. Left in, it would publish 1.2.5 with a changelog entry describing a
feature that is not in that package.

The package actually changed is @neuledge/registry, which is private: true.
CLAUDE.md scopes changesets to published packages and excludes internal
tooling, so this change takes none.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NBQQpA86yYzwJUiVz8ph2R
@moshest
moshest marked this pull request as ready for review September 8, 2026 23:30
@moshest
moshest merged commit 5a001c0 into main Sep 8, 2026
3 checks passed
@moshest
moshest deleted the claude/git-source-exclude-paths branch September 8, 2026 23:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants