fix(context): skip test/example-style directories only at the repo root - #166
Conversation
`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 detectedLatest commit: 2d50434 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
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 |
|
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 Two definitions now pull in files that aren't docs, the same problem you handled for vue:
I screened all 137 git definitions and found nothing else beyond the small gains you already listed. antd's 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.
|
Thanks for screening the whole registry. Added both in 2d50434: |
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.
The problem
Same shape as #125, one level up.
IGNORED_DIRSinpackages/context/src/git.tsis matched at every depth whatever the scan root. In a whole-repo scan that is the point:test/,examples/andinternal/hold code, fixtures and notes. Inside adocs_pathfolder the same names are ordinary sections, and 135 of the 140 definitions setdocs_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 underdocs_paththat sit inside a directory inIGNORED_DIRS:dockerbuild/, 10dev/, 7plans/, 6examples/content/manuals/build/is the whole Docker Build manual (Bake, BuildKit, builders, cache, CI, exporters)antdspec/zh-CN)wranglerexamples/kyselyexamples/site/docsbuntest/docs/guides/test/, the test-runner guidesvueexamples/(+27 code fragments, see below)src/examples/index.mdexpobuild/, 6examples/, 1internal/formikexamples/pydanticexamples/prismadev/prisma devCLI referencebetter-authexamples/vitestpayload1,valibot1,elysia1Confirmed on real clones by building
readLocalDocsFilesbefore and after: kysely 27 → 67 files, bun 303 → 335, matching the tree count exactly.Whole-repo scans are unchanged.
jsdom(319 files undertest/),sql.js,turndownandiorediskeep dropping what they drop today, which is the case the rule was written for.The change
IGNORED_DIRSis split in two:node_modules,dist,out,.next,.nuxt,fixtures,__tests__,__test__,__fixtures__,__mocks__.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.fixturesstays in the always set on evidence: remix hasdocs/shared/prerender/bench/fixtures/*.html, which really are fixtures.buildmoves to the root-only set on evidence: docker'sbuild/is the biggest single loss.One registry edit comes with it. vue's
src/examples/src/holds 27 playground code fragments (App/template.htmland the like) that the directory rule had been hiding by accident.registry/npm/vue.yamlnow setsexclude_paths: ["examples/src/**"], so they stay out andexamples/index.mdcomes 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 theatRepoRootguard is removed (this is the one that was red onmain).still skips tooling directories inside a docs folder: fails if the always set is disabled.230/230 in
context, 93/93 inregistry,tscclean,biome ci --error-on-warningsclean in the package.Worth knowing
docs/pages/internal/test-markdown-pipeline.mdx. I left the definition alone; oneexclude_pathsline if you'd rather not have it.examples/really is documentation, like a corpus assembled by hand. That is a judgement call about code repos in general, anddocs_pathis the right lever there, so I haven't touched it.