Skip to content

Commit 5d998ff

Browse files
authored
fix(review): classify .markdown/.asciidoc files as doc in RAG indexing (#2839)
DOC_EXT_RE recognized md/mdx/rst/adoc but not the long-form markdown/asciidoc spellings, so files like NOTES.markdown / guide.asciidoc were classified as skip instead of doc and dropped from RAG code-review indexing. Align it with the canonical DOCS_EXTENSIONS set in signals/path-matchers.ts (which already lists markdown + asciidoc). Extends classifyRepoFile test coverage for both.
1 parent f2fd057 commit 5d998ff

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

src/review/rag.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,11 @@ const BINARY_EXT_RE =
123123
/\.(png|jpe?g|gif|webp|avif|svg|ico|pdf|zip|gz|tgz|tar|wasm|woff2?|ttf|eot|mp4|mov|mp3|wav|bin|exe|dll|so|dylib|node|parquet|onnx)$/i;
124124
const CODE_EXT_RE =
125125
/\.(ts|tsx|js|jsx|mjs|cjs|py|go|rs|java|kt|kts|rb|php|c|h|cc|cpp|hpp|cs|swift|scala|sh|bash|zsh|sql|graphql|proto|toml|yaml|yml|json|jsonc|css|scss|less|vue|svelte|astro|tf|hcl)$/i;
126-
const DOC_EXT_RE = /\.(md|mdx|rst|txt|adoc)$/i;
126+
// Doc extensions mirror the canonical DOCS_EXTENSIONS set in signals/path-matchers.ts
127+
// (md, mdx, markdown, rst, adoc, asciidoc); the long-form `markdown`/`asciidoc`
128+
// spellings were missing here, so e.g. NOTES.markdown / guide.asciidoc were
129+
// misclassified as skip instead of doc.
130+
const DOC_EXT_RE = /\.(md|mdx|markdown|rst|adoc|asciidoc|txt)$/i;
127131
const ALLOW_EXTLESS_RE = /(^|\/)(Dockerfile|Makefile|Justfile|Procfile)$/i;
128132

129133
/** code | doc | skip. Skips dependency/build/content/data/binary paths — RAG indexes code for code

test/unit/rag.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ describe("rag: code-not-content filtering (free-tier cost guard)", () => {
4747
expect(classifyRepoFile("scripts/build.mjs")).toBe("code");
4848
expect(classifyRepoFile("README.md")).toBe("doc");
4949
expect(classifyRepoFile("docs/architecture.mdx")).toBe("doc");
50+
// long-form doc spellings (parity with signals/path-matchers DOCS_EXTENSIONS)
51+
expect(classifyRepoFile("NOTES.markdown")).toBe("doc");
52+
expect(classifyRepoFile("docs/guide.asciidoc")).toBe("doc");
5053
// skipped: the huge content corpus, data, deps, build output, binaries, lockfiles
5154
expect(classifyRepoFile("content/mcp/some-entry.mdx")).toBe("skip");
5255
expect(classifyRepoFile("data/fixtures.json")).toBe("skip");

0 commit comments

Comments
 (0)