Summary
cdidx languages maps JavaScript to .js / .jsx and TypeScript to .ts / .tsx only. The Node.js ecosystem has used additional, standard, non-optional extensions for years:
.cjs — explicit CommonJS module (Node ≥ 12, widely used since ~2019).
.mjs — explicit ES module (Node ≥ 12, widely used since ~2019).
.cts — TypeScript authored for CommonJS output (tsc standard).
.mts — TypeScript authored for ESM output (tsc standard).
.d.cts / .d.mts — matching type declaration variants.
Files with these extensions are silently skipped by the scanner, so indexing any modern Node package yields a misleadingly small file count and a near-empty symbol graph.
Repro
On this environment Node 22's bundled packages are installed at /opt/node22/lib/node_modules:
curl -fsSL https://raw.githubusercontent.com/Widthdom/CodeIndex/main/install.sh | bash
CDIDX=/root/.local/bin/cdidx
"$CDIDX" /opt/node22/lib/node_modules/prettier --db /tmp/prettier.db
"$CDIDX" map --db /tmp/prettier.db
Observed
Files : 34
Lines : 9,772
Symbols : 292
Prettier ships 19 .mjs files (doc.mjs, index.mjs, standalone.mjs, and the entire plugins/ directory: babel.mjs, typescript.mjs, markdown.mjs, html.mjs, ...), all of which are invisible to the scanner. The only files indexed are a handful of .js and .ts leftovers plus READMEs, not the actual prettier logic.
Same pattern reproduces across /opt/node22/lib/node_modules/pnpm (entire runtime is a single dist/pnpm.cjs, indexed as 0 symbols), eslint (many .cjs / .d.cts type declarations missed), playwright (index.mjs / test.mjs missed), and so on.
Rough file-type counts under /opt/node22 show dozens of .mjs, dozens of .cjs, and dozens of .cts files, none of which are indexable today.
Root cause
src/CodeIndex/Indexer/FileIndexer.cs — LangMap is built from a fixed extension table and the current JavaScript / TypeScript entries do not cover .cjs / .mjs / .cts / .mts:
Confirmed via cdidx languages:
javascript .js .jsx yes yes
typescript .ts .tsx yes yes
Why it matters
- Coverage collapse on modern Node packages. Pure-ESM packages (
"type": "module" in package.json, all sources as .mjs) and dual-publish packages (bundlers emit both .cjs and .mjs) index as empty or near-empty. Users running cdidx on their own Node monorepo will silently get the wrong view.
- Asymmetric with TypeScript's own conventions. tsc officially emits
.cts / .mts for explicit CJS / ESM targeting, and many library authors have adopted them for dual-publishing. Missing these makes cdidx's TypeScript coverage noticeably partial on real-world repos.
- Silent failure. The scanner just doesn't add the file — there's no warning, no "unsupported extension" hint. A user sees
Files : 34 and must know Node's extension conventions to realize what's missing.
Suggested direction
- Add the extensions to the language map. Treat
.cjs and .mjs as javascript; .cts and .mts as typescript. .d.cts / .d.mts are type declaration variants that parallel .d.ts — treat the same way .d.ts is treated today.
- Confirm the regex patterns in
SymbolExtractor.cs and ReferenceExtractor.cs don't key off the extension specifically (they shouldn't — they key off language name), so adding extensions to the language map should be sufficient.
- Update
cdidx languages output to include the new extensions.
- Add README notes for "modern Node extensions supported" so users running dual-publish monorepos know cdidx covers them.
Bonus follow-up (separate issue if desired): surface a WARN when cdidx <path> scans find files whose extensions are not in LangMap but are unusually common (e.g. .cjs, .pm, .vim), to avoid silent zero-index.
Scope
src/CodeIndex/Indexer/FileIndexer.cs — extend LangMap entries.
src/CodeIndex/Cli/ConsoleUi.cs — update help / languages tables if any of them hardcode the list.
tests/CodeIndex.Tests/FileIndexerTests.cs — regression fixtures covering each new extension + one .d.cts / .d.mts type declaration.
- README / DEVELOPER_GUIDE language tables if they enumerate extensions.
Related
Environment
- cdidx: v1.9.0 (installed via
install.sh).
- Indexed:
/opt/node22/lib/node_modules/prettier (8.2 MB, ships mostly .mjs bundles); repro also trivially hits on pnpm, eslint, playwright, ts-node, chromedriver, http-server.
- Platform: linux-x64 container.
- Filed from a cloud Claude Code session per
CLOUD_BOOTSTRAP_PROMPT.md.
Summary
cdidx languagesmaps JavaScript to.js/.jsxand TypeScript to.ts/.tsxonly. The Node.js ecosystem has used additional, standard, non-optional extensions for years:.cjs— explicit CommonJS module (Node ≥ 12, widely used since ~2019)..mjs— explicit ES module (Node ≥ 12, widely used since ~2019)..cts— TypeScript authored for CommonJS output (tsc standard)..mts— TypeScript authored for ESM output (tsc standard)..d.cts/.d.mts— matching type declaration variants.Files with these extensions are silently skipped by the scanner, so indexing any modern Node package yields a misleadingly small file count and a near-empty symbol graph.
Repro
On this environment Node 22's bundled packages are installed at
/opt/node22/lib/node_modules:Observed
Prettier ships 19
.mjsfiles (doc.mjs,index.mjs,standalone.mjs, and the entireplugins/directory:babel.mjs,typescript.mjs,markdown.mjs,html.mjs, ...), all of which are invisible to the scanner. The only files indexed are a handful of.jsand.tsleftovers plus READMEs, not the actual prettier logic.Same pattern reproduces across
/opt/node22/lib/node_modules/pnpm(entire runtime is a singledist/pnpm.cjs, indexed as 0 symbols),eslint(many.cjs/.d.ctstype declarations missed),playwright(index.mjs/test.mjsmissed), and so on.Rough file-type counts under
/opt/node22show dozens of.mjs, dozens of.cjs, and dozens of.ctsfiles, none of which are indexable today.Root cause
src/CodeIndex/Indexer/FileIndexer.cs—LangMapis built from a fixed extension table and the current JavaScript / TypeScript entries do not cover.cjs/.mjs/.cts/.mts:Confirmed via
cdidx languages:Why it matters
"type": "module"in package.json, all sources as.mjs) and dual-publish packages (bundlers emit both.cjsand.mjs) index as empty or near-empty. Users runningcdidxon their own Node monorepo will silently get the wrong view..cts/.mtsfor explicit CJS / ESM targeting, and many library authors have adopted them for dual-publishing. Missing these makes cdidx's TypeScript coverage noticeably partial on real-world repos.Files : 34and must know Node's extension conventions to realize what's missing.Suggested direction
.cjsand.mjsas javascript;.ctsand.mtsas typescript..d.cts/.d.mtsare type declaration variants that parallel.d.ts— treat the same way.d.tsis treated today.SymbolExtractor.csandReferenceExtractor.csdon't key off the extension specifically (they shouldn't — they key off language name), so adding extensions to the language map should be sufficient.cdidx languagesoutput to include the new extensions.Bonus follow-up (separate issue if desired): surface a WARN when
cdidx <path>scans find files whose extensions are not inLangMapbut are unusually common (e.g..cjs,.pm,.vim), to avoid silent zero-index.Scope
src/CodeIndex/Indexer/FileIndexer.cs— extendLangMapentries.src/CodeIndex/Cli/ConsoleUi.cs— update help / languages tables if any of them hardcode the list.tests/CodeIndex.Tests/FileIndexerTests.cs— regression fixtures covering each new extension + one.d.cts/.d.mtstype declaration.Related
cdidx <path>silently indexes 0 files when<path>itself is aSkipDirs-named directory (node_modules, target, vendor, bin, dist, ...) #153 (silent zero-index when root is aSkipDirs-named directory) — same "silent empty index" UX pattern, different root cause.rbenv-init) are not detected" gap I'll file as its own issue.Environment
install.sh)./opt/node22/lib/node_modules/prettier(8.2 MB, ships mostly.mjsbundles); repro also trivially hits onpnpm,eslint,playwright,ts-node,chromedriver,http-server.CLOUD_BOOTSTRAP_PROMPT.md.