Skip to content

fix(context): skip test/example-style directories only at the repo root - #166

Merged
moshest merged 2 commits into
neuledge:mainfrom
JayOfTheKeyboard:fix/ignored-dirs-root-only
Sep 28, 2026
Merged

moshest merged 2 commits into
neuledge:mainfrom
JayOfTheKeyboard:fix/ignored-dirs-root-only

Conversation

@JayOfTheKeyboard

Copy link
Copy Markdown
Contributor

The problem

Same shape as #125, one level up. IGNORED_DIRS in packages/context/src/git.ts is matched at every depth whatever the scan root. In a whole-repo scan that is the point: test/, examples/ and internal/ hold code, fixtures and notes. Inside a docs_path folder the same names are ordinary sections, and 135 of the 140 definitions set docs_path.

As with #125, the build reports success, so the only symptom is a query that comes back empty.

Measured

Every git definition in registry/, checked against its repository's tree with the GitHub trees API (default branch, so versioned definitions are approximate). Documentation files under docs_path that sit inside a directory in IGNORED_DIRS:

definition dropped what it is
docker 100 under build/, 10 dev/, 7 plans/, 6 examples/ content/manuals/build/ is the whole Docker Build manual (Bake, BuildKit, builders, cache, CI, exporters)
antd 84 under spec/ the design specification pages (half are zh-CN)
wrangler 49 under examples/ the Workers examples section
kysely 40 under examples/ 40 of the 67 pages in site/docs
bun 32 under test/ docs/guides/test/, the test-runner guides
vue 1 under examples/ (+27 code fragments, see below) src/examples/index.md
expo 10 build/, 6 examples/, 1 internal/ EAS Build docs and workflow examples
formik 11 under examples/
pydantic 8 under examples/
prisma 5 under dev/ prisma dev CLI reference
better-auth 5 under examples/
vitest 2, payload 1, valibot 1, elysia 1

Confirmed on real clones by building readLocalDocsFiles before and after: kysely 27 → 67 files, bun 303 → 335, matching the tree count exactly.

Whole-repo scans are unchanged. jsdom (319 files under test/), sql.js, turndown and ioredis keep dropping what they drop today, which is the case the rule was written for.

The change

IGNORED_DIRS is split in two:

  • Always skipped, wherever the scan starts: tooling and generated output that never holds authored docs. node_modules, dist, out, .next, .nuxt, fixtures, __tests__, __test__, __fixtures__, __mocks__.
  • Skipped only when atRepoRoot (the flag from fix(context): only skip repo-meta filenames at the scan root #125): names that are also ordinary section names. test, tests, spec, specs, internal, dev, plans, .plans, build, examples, benchmarks, benchmark.

fixtures stays in the always set on evidence: remix has docs/shared/prerender/bench/fixtures/*.html, which really are fixtures. build moves to the root-only set on evidence: docker's build/ is the biggest single loss.

One registry edit comes with it. vue's src/examples/src/ holds 27 playground code fragments (App/template.html and the like) that the directory rule had been hiding by accident. registry/npm/vue.yaml now sets exclude_paths: ["examples/src/**"], so they stay out and examples/index.md comes in.

Tests

Three, written before the change and each mutation-checked:

  • skips test and example directories when scanning a repo root: fails if the root-only set is disabled.
  • keeps doc sections named like non-doc directories inside a docs folder: fails if the atRepoRoot guard is removed (this is the one that was red on main).
  • still skips tooling directories inside a docs folder: fails if the always set is disabled.

230/230 in context, 93/93 in registry, tsc clean, biome ci --error-on-warnings clean in the package.

Worth knowing

  • expo gains one page that is arguably a test page: docs/pages/internal/test-markdown-pipeline.mdx. I left the definition alone; one exclude_paths line if you'd rather not have it.
  • Packages will grow on the next rebuild for the definitions above. docker's is the big one.
  • This doesn't cover a whole-repo scan where examples/ really is documentation, like a corpus assembled by hand. That is a judgement call about code repos in general, and docs_path is the right lever there, so I haven't touched it.

`IGNORED_DIRS` was applied at every depth regardless of where the scan
started. In a whole-repo scan that is right: `test/`, `examples/` and
`internal/` hold code, fixtures and notes. Inside a `docs_path` folder the
same names are ordinary sections, and 135 of the 140 definitions set one.

Measured against every git definition in the registry (GitHub trees API,
default branch): 15 definitions lose real pages this way. The largest are
docker (`content/manuals/build/`, 100 pages, the entire Docker Build
manual), wrangler (49 Workers examples), kysely (40 of 67 pages) and bun
(32 test-runner guides under `docs/guides/test/`).

The set is split in two. Tooling and generated output (`node_modules`,
`dist`, `out`, `.next`, `.nuxt`, `fixtures` and the `__x__` test dirs) is
still skipped everywhere. The rest is skipped only when `atRepoRoot` is
set, the flag neuledge#125 introduced for the same reason.

vue's docs keep 27 playground code fragments (`App/template.html` and
the like) under `src/examples/src/`, which the directory rule had been
hiding by accident. `registry/npm/vue.yaml` now excludes
`examples/src/**`, so they stay out and `examples/index.md` comes in.

Three tests, each mutation-checked: removing the `atRepoRoot` guard fails
the docs-folder case, disabling the root-only set fails the repo-root case,
and disabling the always set fails the tooling case. Real clones agree
with the tree count: kysely 27 -> 67 files, bun 303 -> 335.

230/230 in context, 93/93 in registry, package lint clean.
@changeset-bot

changeset-bot Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 2d50434

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@neuledge/context Patch
@neuledge/registry Patch

Not sure what this means? Click here to learn what changesets are.

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

moshest commented Sep 27, 2026

Copy link
Copy Markdown
Member

Thanks, the fix itself checks out. I reviewed 03cc697 merged onto current main (which now includes #126). Lint, build and tests pass (context 230, registry 103). Removing the atRepoRoot guard turns your docs-folder test red, and forcing the guard to false turns the repo-root test red. Your numbers hold up: kysely goes from 78 to 116 sections and bun from 1172 to 1319. With examples/src/** excluded, vue gains only examples/index.md. The changeset is right.

Two definitions now pull in files that aren't docs, the same problem you handled for vue:

  • registry/npm/@angular/core.yaml: at 22.2.0, adev/src/content/examples/ adds 212 files, almost all component .html templates that the guides embed. Please add exclude_paths: ["examples/**"] under its source.
  • registry/npm/@docusaurus/core.yaml: at 3.10.2, website/_dogfooding/ adds 66 test pages. Please add exclude_paths: ["_dogfooding/**"].

I screened all 137 git definitions and found nothing else beyond the small gains you already listed. antd's docs/spec pages are real design docs, so keeping them is right. Once those two lines are in, I'll merge.


Generated by Claude Code

…ut of their docs

With test/example-style directories no longer skipped below the repo
root, adev/src/content/examples/ (212 files, mostly embedded component
templates) and website/_dogfooding/ (66 test pages) were pulled in.
@JayOfTheKeyboard

Copy link
Copy Markdown
Contributor Author

Thanks for screening the whole registry. Added both in 2d50434: exclude_paths: ["examples/**"] for @angular/core and exclude_paths: ["_dogfooding/**"] for @docusaurus/core, each with a one-line comment saying why, as in vue.yaml. Lint, build and tests pass.

@moshest
moshest merged commit b66d7ae into neuledge:main Sep 28, 2026
5 checks passed
@github-actions github-actions Bot mentioned this pull request Sep 28, 2026
moshest pushed a commit that referenced this pull request Sep 28, 2026
Releases @neuledge/context 1.2.8 -> 1.2.9 (patch).

Consumes one changeset, .changeset/quiet-docs-sections.md (patch on
@neuledge/context, from #166): section-like directories such as test/,
examples/ and build/ are only skipped at a repository root, so they are kept
inside a docs folder. @neuledge/registry 0.0.21 -> 0.0.22 is the automatic
dependent bump for the private workspace package.

Verified before merging: npm dist-tags.latest is 1.2.8 and 1.2.9 is not
published yet.
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