Repository navigation
fix(core): build finds 0 pages when a folder above the docs matches a .gitignore pattern - #274
Merged
Merged
Conversation
… their own directory `docmd build` found 0 pages when the project folder (or any folder above it) had the same name as an unanchored .gitignore pattern. The common case: a checkout at /srv/site with `site/` (the default output dir) in its .gitignore. The directory-segment and glob checks ran against the absolute path, so `/srv/site/docs/index.md` matched `site/` and every page was hidden. - Each .gitignore pattern now carries the directory of the .gitignore it came from. Unanchored segment and wildcard checks run against the path below that directory only, as git does. - `config.exclude` patterns are relative to the project directory (the scan root when the source dir is outside it). - Exact-name, suffix and prefix matches on the entry name, and anchored (`/x`) patterns, are unchanged. - A pattern in a parent repo's .gitignore still applies to what is below it. - tests/cli-contracts/gitignore-scope.test.js, registered as `gitignore-scope`: a real build in a folder named `site`, ancestors named like a segment pattern and like a wildcard pattern, a parent .gitignore, and `exclude` with an ancestor of the same name.
Member
|
Great catch on the ancestor Checking unanchored patterns against absolute paths was a silent trap, especially when deploying in container environments mapped to Verified and passes all contract tests. Merging! |
mgks
added a commit
that referenced
this pull request
Nov 11, 2026
…ture additions Synchronize working branch 'dev-0.9.10' with 'main' following the review, security audit, and integration of 6 community pull requests alongside our static asset root mirroring feature. Merged Community Contributions: - PR #271 (@GPT-AGI / Ting Zhang): fix(parser): resolve folder-index links from nested pages Fixes relative link resolution for non-index folder references from deep subdirectories. - PR #274 (@svallory): fix(core): build finds 0 pages when an ancestor folder matches .gitignore Confines gitignore matching to repository root and avoids empty builds when parent paths match ignore patterns. - PR #275 (@svallory): fix(build): keep git tree clean after pnpm -r run build Eliminates timestamps from generated plugin registry and ignores pre-built native binaries across architectures. - PR #276 (@svallory): fix(tests): give each test run its own temp fixture root Isolates test fixtures into unique run directories under os.tmpdir() to prevent concurrency collisions. - PR #272 (@svallory): feat(api,core): plugin actions receive caller context; one shared action host Introduces shared ActionHost with caller context (identity, mode, transport, headers without cookies), origin allowlisting, and unified rebuild queue. - PR #273 (@svallory): feat(core): docmd serve, a production server for the built site Adds zero-dependency production HTTP/WS server with gzip compression, security headers (CSP, HSTS, CORS), health check endpoints (/healthz, /livez, /readyz), and SPA / clean URL routing. Working Branch Features Included: - feat(core): Zero-config static root asset mirroring Copies static assets from 'public/' or 'static/' (and docs/public/) directly to the output root ('site/'), preserving directory structure and files like 'funding.json', 'CNAME', and '.well-known/'. Adds canonical 'static' configuration option with support for boolean or custom directory lists. - feat(cli): --host flag support for dev and serve commands (defaults to loopback 127.0.0.1 for CWE-1385 protection, configurable to 0.0.0.0 for container / LAN hosting). Documentation Impact: - Configuration Reference: Document 'static' setting (boolean | string[]). - CLI Reference: Document 'docmd serve' command options and '--host' flag. - Plugin Guide: Document ActionHost caller context and execution modes.
Merged
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.
Description
A side fix found while working on #267 (not one of its numbered steps).
docmd buildreports "Generated 0 pages" when the project folder, or any folder above it, has the same name as an unanchored.gitignorepattern. The usual way to hit it: the project is checked out at/srv/site(a common container path) and its.gitignorelistssite/, the default output dir. Rename the folder and the same project builds every page.Repro on main:
Cause: in
packages/core/src/engine/assets.ts,isExcludedPathchecks unanchored patterns against the absolute path (normalizedPath.includes('/site/')), so/tmp/repro/site/docs/index.mdmatchessite/. The.gitignorepatterns from every directory up the tree are merged into one list and lose the directory they came from.Fix:
.gitignorepattern keeps the directory of its.gitignore. The unanchored segment check and the wildcard check run against the path below that directory only, as git does.config.excludepatterns are matched below the project directory (or the source dir, when it is outside the project directory).*.extandprefix-*matches on the entry name, anchored (/x) patterns, and the built-in hidden names. A pattern in a parent repo's.gitignorestill applies to everything below it.commands/mcp.tshas its own copy of this matcher (isExcludedByPatterns, used bysearch_docswithconfig.exclude). I left it alone to keep this PR to the build; happy to switch it to the shared matcher in a follow-up if you want.Type of change
How it was verified
New
tests/cli-contracts/gitignore-scope.test.js, registered asgitignore-scopeintests/runner.js:docmd buildin a folder namedsitewithsite/anddrafts/gitignored (2 pages, drafts still ignored), and the same project under another folder name;drafts/) and like a wildcard pattern (build-*/) does not hide the project, whiledocs/drafts/and*.secret.mdare still ignored;.gitignorestill ignores what is below it;exclude: ["drafts"]hidesdocs/drafts/but not an ancestor folder nameddrafts.Results:
node tests/runner.js --only=gitignore-scope,plugin-assets-pipeline,mcp-read-doc,features,validate-workspace: 235 passed, 0 failed. The existing.gitignore/excludechecks inplugin-assets-pipelinepass unchanged.pnpm lint: no new warnings in the changed files.Checklist: