@backbencher/brain 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (319) hide show
  1. package/CHANGELOG.md +298 -0
  2. package/EMBEDDINGS.md +355 -0
  3. package/LICENSE +21 -0
  4. package/README.md +415 -2
  5. package/bin/bb +13 -0
  6. package/dist/analysis-exclusions-7ZJDXOVZ.js +35 -0
  7. package/dist/brain-index-health-KY7K552E.js +17 -0
  8. package/dist/brain-relationship-enrichment-QH7OOHUF.js +558 -0
  9. package/dist/brain.sql-EIM4WS4D.js +29 -0
  10. package/dist/chunk-2BSKD7O3.js +40 -0
  11. package/dist/chunk-2DE27DVC.js +1314 -0
  12. package/dist/chunk-2RRBMNBQ.js +322 -0
  13. package/dist/chunk-2RTN2DFU.js +711 -0
  14. package/dist/chunk-2WXYNLBA.js +29 -0
  15. package/dist/chunk-3CTFIJJB.js +17 -0
  16. package/dist/chunk-3LFTSMIV.js +174 -0
  17. package/dist/chunk-47HKX4AJ.js +930 -0
  18. package/dist/chunk-4H22TLOT.js +543 -0
  19. package/dist/chunk-5SD45FLC.js +818 -0
  20. package/dist/chunk-66A5ZFYA.js +1758 -0
  21. package/dist/chunk-6AIRWAO2.js +247 -0
  22. package/dist/chunk-6WNGD3NN.js +196 -0
  23. package/dist/chunk-7AN7U5IZ.js +371 -0
  24. package/dist/chunk-BHB7BYYI.js +626 -0
  25. package/dist/chunk-BQ3OVQ3P.js +125 -0
  26. package/dist/chunk-CW4XXSNN.js +1479 -0
  27. package/dist/chunk-D2Q4Y47A.js +53 -0
  28. package/dist/chunk-DIYAGQJL.js +34 -0
  29. package/dist/chunk-DYM4FQEE.js +90 -0
  30. package/dist/chunk-EWMWK7WN.js +75 -0
  31. package/dist/chunk-FVVQTSIM.js +3427 -0
  32. package/dist/chunk-FWSL4VG6.js +1290 -0
  33. package/dist/chunk-GBI7V7KY.js +69 -0
  34. package/dist/chunk-GEFFO6O2.js +152 -0
  35. package/dist/chunk-HOWAQXJO.js +236 -0
  36. package/dist/chunk-HQSPJDHI.js +613 -0
  37. package/dist/chunk-IFZNR5UJ.js +2863 -0
  38. package/dist/chunk-J4PMBXQQ.js +336 -0
  39. package/dist/chunk-KAET47ZL.js +125 -0
  40. package/dist/chunk-KCDECRJY.js +440 -0
  41. package/dist/chunk-KLK3PBTO.js +1119 -0
  42. package/dist/chunk-L5TDYKYK.js +76 -0
  43. package/dist/chunk-MLKGABMK.js +9 -0
  44. package/dist/chunk-OWISBAOF.js +61 -0
  45. package/dist/chunk-PJTNGD3Z.js +6924 -0
  46. package/dist/chunk-QLK6ED4Q.js +235 -0
  47. package/dist/chunk-R2GW4F6R.js +19 -0
  48. package/dist/chunk-RCMTFSEF.js +87 -0
  49. package/dist/chunk-RH7KC5HU.js +12050 -0
  50. package/dist/chunk-RM3PY6TG.js +376 -0
  51. package/dist/chunk-ROMM6KMC.js +433 -0
  52. package/dist/chunk-SK6YVHFZ.js +211 -0
  53. package/dist/chunk-SM7RFQRO.js +214 -0
  54. package/dist/chunk-UFE77L67.js +782 -0
  55. package/dist/chunk-UGR4QIGS.js +67 -0
  56. package/dist/chunk-UUNHHX4M.js +13 -0
  57. package/dist/chunk-V44PGPA6.js +2104 -0
  58. package/dist/chunk-VL52PL2T.js +71 -0
  59. package/dist/chunk-VURYFIHW.js +201 -0
  60. package/dist/chunk-XJKJYIPP.js +7436 -0
  61. package/dist/chunk-YI6FF2ZR.js +340 -0
  62. package/dist/cli/index.js +37 -0
  63. package/dist/config-HZAAYDP3.js +10 -0
  64. package/dist/content-search-642F7E5V.js +593 -0
  65. package/dist/database-TCTZDLE5.js +9 -0
  66. package/dist/doctor-GXCKSJOX.js +395 -0
  67. package/dist/edit-engine-KM7MPFEC.js +51 -0
  68. package/dist/engine-42TZFNIZ.js +11 -0
  69. package/dist/engine-LO6L4JLQ.js +18 -0
  70. package/dist/fingerprint-XDXFRWO6.js +33 -0
  71. package/dist/framework-intelligence-DWFCKV44.js +860 -0
  72. package/dist/freshness-3K6VU5OT.js +174 -0
  73. package/dist/graph-engine-PL5YA7BA.js +21 -0
  74. package/dist/graph_request-MM4REP6H.js +350 -0
  75. package/dist/impact_request-WDE47IZ5.js +68 -0
  76. package/dist/index-space-IUUN5WYV.js +15 -0
  77. package/dist/index-status-6BD7UBHR.js +34 -0
  78. package/dist/index.js +159 -0
  79. package/dist/instance-FO6QZRLH.js +19 -0
  80. package/dist/language-detection-DFCAU5DZ.js +11 -0
  81. package/dist/lsp/server.js +4301 -0
  82. package/dist/mcp/server.js +132 -0
  83. package/dist/onboard-DIQZV2NW.js +161 -0
  84. package/dist/override-companion-pass-XR7MHTP7.js +117 -0
  85. package/dist/parallel-indexer-4PW3AFXP.js +88 -0
  86. package/dist/pool-worker.js +1153 -0
  87. package/dist/project-health-ZS5TS2Z6.js +94 -0
  88. package/dist/project-index-5SDPHITE.js +57 -0
  89. package/dist/project-registry-DGZBIZS7.js +355 -0
  90. package/dist/real-bash-analyzer-SXSV67E2.js +2201 -0
  91. package/dist/real-c-analyzer-SY7FTZ6W.js +5942 -0
  92. package/dist/real-clean-analyzer-IGDHHLZK.js +3470 -0
  93. package/dist/real-clojure-analyzer-4OH7IWLB.js +2818 -0
  94. package/dist/real-cpp-analyzer-7LTDRJRJ.js +4101 -0
  95. package/dist/real-csharp-analyzer-KICU3TLH.js +3298 -0
  96. package/dist/real-css-analyzer-HPU277Q6.js +15 -0
  97. package/dist/real-dart-analyzer-7LZ5LCMW.js +3944 -0
  98. package/dist/real-elixir-analyzer-BE3MEVZO.js +2192 -0
  99. package/dist/real-erlang-analyzer-BZMAKYBK.js +1731 -0
  100. package/dist/real-fsharp-analyzer-5QLTOV3E.js +2390 -0
  101. package/dist/real-go-analyzer-POD7MZQR.js +4126 -0
  102. package/dist/real-graphql-analyzer-MAQRZ6QW.js +1442 -0
  103. package/dist/real-groovy-analyzer-MEWSUPMJ.js +2285 -0
  104. package/dist/real-haskell-analyzer-I5L2GR3Y.js +2533 -0
  105. package/dist/real-hcl-analyzer-DBOPXSWJ.js +725 -0
  106. package/dist/real-html-analyzer-O63XZLZD.js +1759 -0
  107. package/dist/real-java-analyzer-CHCW3EKA.js +4677 -0
  108. package/dist/real-javascript-analyzer-QAAJQYZE.js +14 -0
  109. package/dist/real-json-analyzer-UGBR7YQN.js +1640 -0
  110. package/dist/real-julia-analyzer-35Q4GHOZ.js +2085 -0
  111. package/dist/real-kotlin-analyzer-GRAYCWW2.js +3956 -0
  112. package/dist/real-lua-analyzer-5BAPDZDF.js +1957 -0
  113. package/dist/real-makefile-analyzer-YJKAHNAS.js +920 -0
  114. package/dist/real-markdown-analyzer-UKUQZO4F.js +1215 -0
  115. package/dist/real-matlab-analyzer-FVIKQZKG.js +480 -0
  116. package/dist/real-nim-analyzer-M7FAIABG.js +3603 -0
  117. package/dist/real-objective-c-analyzer-XMYQIGQI.js +1518 -0
  118. package/dist/real-perl-analyzer-ZLY6M2DZ.js +1865 -0
  119. package/dist/real-php-analyzer-KI2ZAM7X.js +9368 -0
  120. package/dist/real-powershell-analyzer-B3T5ZP6U.js +2915 -0
  121. package/dist/real-protobuf-analyzer-23OZ75XV.js +867 -0
  122. package/dist/real-python-analyzer-I4TIUB6D.js +4880 -0
  123. package/dist/real-r-analyzer-FJZJXXS6.js +2596 -0
  124. package/dist/real-ruby-analyzer-M3UFIVTQ.js +2429 -0
  125. package/dist/real-rust-analyzer-LVSONPAN.js +3359 -0
  126. package/dist/real-scala-analyzer-CWPI33Q2.js +3293 -0
  127. package/dist/real-scss-analyzer-TGRJQ7TH.js +1515 -0
  128. package/dist/real-solidity-analyzer-4P2VBVWA.js +2608 -0
  129. package/dist/real-sql-analyzer-J7DYZOZR.js +3840 -0
  130. package/dist/real-svelte-analyzer-NHEN2SX5.js +2532 -0
  131. package/dist/real-swift-analyzer-2NSYULWI.js +2311 -0
  132. package/dist/real-toml-analyzer-L3C66L7Q.js +929 -0
  133. package/dist/real-typescript-analyzer-FTC6ETRQ.js +14 -0
  134. package/dist/real-vb-analyzer-ORY7LAQS.js +3145 -0
  135. package/dist/real-vba-analyzer-JH2TTUFI.js +466 -0
  136. package/dist/real-vue-analyzer-OO4FUGBV.js +2680 -0
  137. package/dist/real-xml-analyzer-6CQVR477.js +2405 -0
  138. package/dist/real-yaml-analyzer-J6MQG3YX.js +3528 -0
  139. package/dist/real-zig-analyzer-EFKCPJNU.js +2430 -0
  140. package/dist/regex-search-OPTLKUN5.js +239 -0
  141. package/dist/rules-I453JTRC.js +152 -0
  142. package/dist/scoped-path-MJYWJZQX.js +11 -0
  143. package/dist/setup-show-Y5GB5KXA.js +15 -0
  144. package/dist/setup-wizard-G5YYR5T6.js +24 -0
  145. package/dist/symbol-search-KB4MU4SI.js +16 -0
  146. package/dist/taint-YOTN5X55.js +202 -0
  147. package/dist/taint-analyzer-N7YLZU3N.js +163 -0
  148. package/dist/tool-handlers-G4NAGJIH.js +72 -0
  149. package/dist/tool-registry-BPEJNSZG.js +17 -0
  150. package/dist/tool-validation-RF675A3C.js +32 -0
  151. package/dist/type-inference-4Y7WTMFE.js +13 -0
  152. package/dist/vector-binary-LMY4QGAN.js +19 -0
  153. package/dist/version-LXGNFO37.js +9 -0
  154. package/dist/wasm-NMWO3WXY.js +16 -0
  155. package/docs/EMBEDDINGS.md +132 -0
  156. package/docs/README.md +178 -0
  157. package/docs/data/m10-baseline.json +602 -0
  158. package/docs/data/m10-benchmark-baseline.json +57 -0
  159. package/docs/data/m10-benchmark-last-run.json +127 -0
  160. package/docs/data/m10-final-audit.json +215 -0
  161. package/docs/data/m12-final-audit.json +138 -0
  162. package/docs/data/m12-surface-matrix.json +50 -0
  163. package/docs/data/public-tools.json +1902 -0
  164. package/docs/indexing/DEAD-ASSETS.md +88 -0
  165. package/docs/indexing/INDEXER-REVIEW.md +634 -0
  166. package/docs/indexing/PERFORMANCE-FINDINGS.md +106 -0
  167. package/docs/indexing/README.md +427 -0
  168. package/docs/indexing/discovery-matrix.md +41 -0
  169. package/docs/indexing/embeddings.md +325 -0
  170. package/docs/indexing/environment-variables.md +77 -0
  171. package/docs/indexing/performance.md +323 -0
  172. package/docs/indexing/resume.md +345 -0
  173. package/docs/indexing/troubleshooting.md +391 -0
  174. package/docs/man/bb.1 +190 -0
  175. package/docs/tools/bb_analyze.md +147 -0
  176. package/docs/tools/bb_annotate.md +110 -0
  177. package/docs/tools/bb_annotations.md +106 -0
  178. package/docs/tools/bb_ask.md +101 -0
  179. package/docs/tools/bb_cross_language.md +103 -0
  180. package/docs/tools/bb_doc.md +169 -0
  181. package/docs/tools/bb_edit.md +185 -0
  182. package/docs/tools/bb_graph.md +169 -0
  183. package/docs/tools/bb_health.md +156 -0
  184. package/docs/tools/bb_impact.md +117 -0
  185. package/docs/tools/bb_index.md +108 -0
  186. package/docs/tools/bb_migrate.md +135 -0
  187. package/docs/tools/bb_patterns.md +140 -0
  188. package/docs/tools/bb_search.md +150 -0
  189. package/docs/tools/bb_security.md +100 -0
  190. package/docs/tools/bb_visualize.md +184 -0
  191. package/grammars/README.md +57 -0
  192. package/grammars/THIRD-PARTY-NOTICES.md +50 -0
  193. package/grammars/tree-sitter-c/LICENSE +21 -0
  194. package/grammars/tree-sitter-clojure/LICENSE.md +21 -0
  195. package/grammars/tree-sitter-cpp/LICENSE +21 -0
  196. package/grammars/tree-sitter-csharp/LICENSE +21 -0
  197. package/grammars/tree-sitter-css/LICENSE +21 -0
  198. package/grammars/tree-sitter-css/README.md +21 -0
  199. package/grammars/tree-sitter-dart/LICENSE +20 -0
  200. package/grammars/tree-sitter-dart-upstream/LICENSE +20 -0
  201. package/grammars/tree-sitter-dart-upstream/README.md +18 -0
  202. package/grammars/tree-sitter-elixir/LICENSE +176 -0
  203. package/grammars/tree-sitter-elixir/README.md +11 -0
  204. package/grammars/tree-sitter-fsharp/LICENSE +21 -0
  205. package/grammars/tree-sitter-fsharp/README.md +45 -0
  206. package/grammars/tree-sitter-graphql/LICENSE +21 -0
  207. package/grammars/tree-sitter-graphql/README.md +106 -0
  208. package/grammars/tree-sitter-groovy/LICENSE +21 -0
  209. package/grammars/tree-sitter-groovy/README.md +4 -0
  210. package/grammars/tree-sitter-haskell/LICENSE +21 -0
  211. package/grammars/tree-sitter-haskell/README.md +394 -0
  212. package/grammars/tree-sitter-hcl/CHANGELOG.md +102 -0
  213. package/grammars/tree-sitter-hcl/LICENSE +201 -0
  214. package/grammars/tree-sitter-hcl/README.md +39 -0
  215. package/grammars/tree-sitter-html/LICENSE +21 -0
  216. package/grammars/tree-sitter-html/README.md +21 -0
  217. package/grammars/tree-sitter-julia/LICENSE +21 -0
  218. package/grammars/tree-sitter-julia/README.md +24 -0
  219. package/grammars/tree-sitter-kotlin/LICENSE +9 -0
  220. package/grammars/tree-sitter-lua/LICENSE.md +21 -0
  221. package/grammars/tree-sitter-lua/README.md +29 -0
  222. package/grammars/tree-sitter-make/LICENSE +21 -0
  223. package/grammars/tree-sitter-matlab/LICENSE +19 -0
  224. package/grammars/tree-sitter-matlab/README.md +99 -0
  225. package/grammars/tree-sitter-nim/LICENSE +373 -0
  226. package/grammars/tree-sitter-nim/README.md +46 -0
  227. package/grammars/tree-sitter-objc/LICENSE +21 -0
  228. package/grammars/tree-sitter-objc/README.md +20 -0
  229. package/grammars/tree-sitter-perl/LICENSE +7 -0
  230. package/grammars/tree-sitter-perl/README.md +100 -0
  231. package/grammars/tree-sitter-powershell/LICENSE +21 -0
  232. package/grammars/tree-sitter-powershell/README.md +7 -0
  233. package/grammars/tree-sitter-proto/LICENSE +21 -0
  234. package/grammars/tree-sitter-proto/README.md +105 -0
  235. package/grammars/tree-sitter-r/LICENSE +9 -0
  236. package/grammars/tree-sitter-r/README.md +66 -0
  237. package/grammars/tree-sitter-ruby/LICENSE +22 -0
  238. package/grammars/tree-sitter-scss/LICENSE +21 -0
  239. package/grammars/tree-sitter-scss/README.md +17 -0
  240. package/grammars/tree-sitter-solidity/LICENSE +7 -0
  241. package/grammars/tree-sitter-sql/LICENSE +21 -0
  242. package/grammars/tree-sitter-typescript/LICENSE +21 -0
  243. package/grammars/tree-sitter-vba/LICENSE +21 -0
  244. package/grammars/tree-sitter-vba/README.md +738 -0
  245. package/grammars/tree-sitter-vbnet/LICENSE +21 -0
  246. package/grammars/tree-sitter-vbnet/README.md +322 -0
  247. package/grammars/tree-sitter-xml/LICENSE +19 -0
  248. package/grammars/tree-sitter-yaml/LICENSE +20 -0
  249. package/grammars/tree-sitter-yaml/README.md +21 -0
  250. package/package.json +184 -4
  251. package/wasm/dart.wasm +0 -0
  252. package/wasm/tree-sitter-bash.wasm +0 -0
  253. package/wasm/tree-sitter-c.wasm +0 -0
  254. package/wasm/tree-sitter-c_sharp.wasm +0 -0
  255. package/wasm/tree-sitter-clean.wasm +0 -0
  256. package/wasm/tree-sitter-clojure.wasm +0 -0
  257. package/wasm/tree-sitter-core_schema.wasm +0 -0
  258. package/wasm/tree-sitter-cpp.wasm +0 -0
  259. package/wasm/tree-sitter-css.wasm +0 -0
  260. package/wasm/tree-sitter-dart.wasm +0 -0
  261. package/wasm/tree-sitter-elisp.wasm +0 -0
  262. package/wasm/tree-sitter-elixir.wasm +0 -0
  263. package/wasm/tree-sitter-elm.wasm +0 -0
  264. package/wasm/tree-sitter-embedded_template.wasm +0 -0
  265. package/wasm/tree-sitter-erlang.wasm +0 -0
  266. package/wasm/tree-sitter-fsharp.wasm +0 -0
  267. package/wasm/tree-sitter-fsharp_signature.wasm +0 -0
  268. package/wasm/tree-sitter-go.wasm +0 -0
  269. package/wasm/tree-sitter-graphql.wasm +0 -0
  270. package/wasm/tree-sitter-groovy.wasm +0 -0
  271. package/wasm/tree-sitter-haskell.wasm +0 -0
  272. package/wasm/tree-sitter-hcl.wasm +0 -0
  273. package/wasm/tree-sitter-html.wasm +0 -0
  274. package/wasm/tree-sitter-java.wasm +0 -0
  275. package/wasm/tree-sitter-javascript.wasm +0 -0
  276. package/wasm/tree-sitter-json.wasm +0 -0
  277. package/wasm/tree-sitter-json_schema.wasm +0 -0
  278. package/wasm/tree-sitter-julia.wasm +0 -0
  279. package/wasm/tree-sitter-kotlin.wasm +0 -0
  280. package/wasm/tree-sitter-lua.wasm +0 -0
  281. package/wasm/tree-sitter-make.wasm +0 -0
  282. package/wasm/tree-sitter-markdown.wasm +0 -0
  283. package/wasm/tree-sitter-markdown_inline.wasm +0 -0
  284. package/wasm/tree-sitter-matlab.wasm +0 -0
  285. package/wasm/tree-sitter-nim.wasm +0 -0
  286. package/wasm/tree-sitter-objc.wasm +0 -0
  287. package/wasm/tree-sitter-ocaml.wasm +0 -0
  288. package/wasm/tree-sitter-perl.wasm +0 -0
  289. package/wasm/tree-sitter-php.wasm +0 -0
  290. package/wasm/tree-sitter-php_only.wasm +0 -0
  291. package/wasm/tree-sitter-powershell.wasm +0 -0
  292. package/wasm/tree-sitter-protobuf.wasm +0 -0
  293. package/wasm/tree-sitter-python.wasm +0 -0
  294. package/wasm/tree-sitter-ql.wasm +0 -0
  295. package/wasm/tree-sitter-r.wasm +0 -0
  296. package/wasm/tree-sitter-rescript.wasm +0 -0
  297. package/wasm/tree-sitter-ruby.wasm +0 -0
  298. package/wasm/tree-sitter-rust.wasm +0 -0
  299. package/wasm/tree-sitter-scala.wasm +0 -0
  300. package/wasm/tree-sitter-scss.wasm +0 -0
  301. package/wasm/tree-sitter-solidity.wasm +0 -0
  302. package/wasm/tree-sitter-sql.wasm +0 -0
  303. package/wasm/tree-sitter-svelte.wasm +0 -0
  304. package/wasm/tree-sitter-swift.wasm +0 -0
  305. package/wasm/tree-sitter-systemrdl.wasm +0 -0
  306. package/wasm/tree-sitter-terraform.wasm +0 -0
  307. package/wasm/tree-sitter-tlaplus.wasm +0 -0
  308. package/wasm/tree-sitter-toml.wasm +0 -0
  309. package/wasm/tree-sitter-tsx.wasm +0 -0
  310. package/wasm/tree-sitter-typescript.wasm +0 -0
  311. package/wasm/tree-sitter-vba.wasm +0 -0
  312. package/wasm/tree-sitter-vbnet.wasm +0 -0
  313. package/wasm/tree-sitter-vue.wasm +0 -0
  314. package/wasm/tree-sitter-xml.wasm +0 -0
  315. package/wasm/tree-sitter-yaml.wasm +0 -0
  316. package/wasm/tree-sitter-zig.wasm +0 -0
  317. package/wasm/tree-sitter.wasm +0 -0
  318. package/wasm/tsx.wasm +0 -0
  319. package/wasm/typescript.wasm +0 -0
@@ -0,0 +1,440 @@
1
+ // src/ast/language-detection.ts
2
+ var EXTENSION_LANGUAGE = {
3
+ // `.mts` was missing from this table entirely, so 490 tracked files in this repository —
4
+ // much of the m12/m14 gate suite among them — were rejected by `detectLanguageFromPath`
5
+ // before a grammar could even be chosen, and the engine answered "Unsupported file type".
6
+ // `.mts` is a TypeScript ES module: same language, explicit module system.
7
+ //
8
+ // Measured before declaring, by script/m12/measure-extension-coverage.ts over every
9
+ // tracked `.mts` file in the tree:
10
+ //
11
+ // 490 files 490 parsed 8 error files 54 error nodes 0 threw
12
+ // 18,586 symbols 54,485 relationships 2,115 imports
13
+ //
14
+ // 98.4% parse clean, and the 8 imperfect files are gate fixtures rather than library code.
15
+ // The 18,586 symbols were invisible to the index — the difference between "bb indexes
16
+ // TypeScript" and the truth of what this repository is written in.
17
+ //
18
+ // `.cts` is deliberately NOT declared: the measured corpus is ZERO files, so there is
19
+ // nothing to support a claim about it (the same rule that kept `.jul` undeclared). Add it
20
+ // with its numbers once a corpus exists.
21
+ ts: "typescript",
22
+ tsx: "tsx",
23
+ mts: "typescript",
24
+ // `.cts` was MISSING while every sibling was present — `ts`, `tsx`, `mts` and `js`, `cjs`, `mjs`, `jsx`.
25
+ // It is TypeScript's CommonJS extension and the exact counterpart of `.mts`, which maps to `typescript`,
26
+ // so this is an omission and not a decision. MEASURED: 3,118 `.cts` files in the corpus, and one lane
27
+ // probed a stride that held 3 of them, which is how it read as a 3-file curiosity rather than a fleet gap.
28
+ // Same defect class as `.graphqls` (97 files) — an extension the corpus carries that NOTHING routes, so the
29
+ // file is read, answered with the fallback, and produces no symbols while APPEARING in the population.
30
+ cts: "typescript",
31
+ js: "javascript",
32
+ cjs: "javascript",
33
+ mjs: "javascript",
34
+ jsx: "javascript",
35
+ html: "html",
36
+ htm: "html",
37
+ // THIRTEENTH ROUTER GAP, AND THE LARGEST FAMILY YET — found by hcl-lane's html population census on
38
+ // 2026-10-13, which counted these files IN THE CORPUS while every one of them was UNROUTED:
39
+ // xhtml 30 · hbs 1,531 · twig 274 · pug 70 · erb 46 = 1,951 files, and `.hbs` alone is 1,531.
40
+ // These are HTML-TEMPLATE languages: the file IS HTML with embedded template syntax, so the html
41
+ // analyzer reads the structure it already reads. AND `detectLanguageFromPath` returned null for every
42
+ // one of them, which means ZERO ROWS — routing them cannot lose a row, only add.
43
+ // MEASURED, not remembered: xhtml/hbs/twig/pug/erb/mustache/ejs/liquid/njk/jinja/j2 ALL returned
44
+ // `*** UNROUTED ***` in a single check against this function.
45
+ // AND THE UNROUTED-EXTENSION GATE PASSED WHILE THIS WAS TRUE — so its `textBearingNewKeys 0` is a
46
+ // statement about the corpus IT walks, not about the corpus at large. Named, not hidden.
47
+ xhtml: "html",
48
+ hbs: "html",
49
+ twig: "html",
50
+ pug: "html",
51
+ erb: "html",
52
+ mustache: "html",
53
+ ejs: "html",
54
+ liquid: "html",
55
+ njk: "html",
56
+ jinja: "html",
57
+ j2: "html",
58
+ vue: "vue",
59
+ svelte: "svelte",
60
+ css: "css",
61
+ // scss is its own language, not a css dialect. It was mapped to "css" here while
62
+ // the CSS grammar was the only wasm available, which is a decision made for lack of
63
+ // an alternative and then left in place after the alternative existed — the shape of
64
+ // claim that outlives the reason for it.
65
+ //
66
+ // `sass` was in exactly that state and worse: it mapped to "css" while being DECLARED
67
+ // in SUPPORTED_LANGUAGES, so `sass` was a language no extension could ever select —
68
+ // the registry advertised a lane the router could not enter, and the coverage gate
69
+ // reported it as unreachable. It is routed to its own name now. The GRAMMAR is still
70
+ // the css one (there is no tree-sitter-sass here), and that grammar cannot represent
71
+ // indented syntax — the measured consequence is that a real .sass file parses with
72
+ // ERROR nodes. Naming the lane honestly is what makes that visible per-language
73
+ // instead of hiding it inside "css"; fixing the fidelity needs a sass grammar, which
74
+ // is a separate piece of work and is recorded in script/m60/routing-outlier-census.ts.
75
+ //
76
+ // `less` still maps to "css" deliberately: LESS is a CSS superset and it is NOT in
77
+ // SUPPORTED_LANGUAGES, so no unreachable language is declared by leaving it here.
78
+ scss: "scss",
79
+ sass: "sass",
80
+ less: "css",
81
+ json: "json",
82
+ jsonc: "json",
83
+ // `.jsonl` ADDED — JSON LINES, one JSON document per line, which the `json` grammar reads with NO representational
84
+ // gap. Found by the fleet unrouted-extension census (script/m60/unrouted-extension-census.ts): 31 corpus files,
85
+ // 4,676 symbols and 4,651 relationships through the winning grammar, and the extension was simply missing.
86
+ // IT IS THE SAFEST ENTRY IN THAT CENSUS'S 154-ROW CANDIDATE SET, and chosen over the higher-priced `.jsonschema`
87
+ // (7,255 relationships from THREE files — about 2,400 per file, above any routed language's density here) because
88
+ // THIS ONE HAS NO REPRESENTATIONAL QUESTION TO ANSWER. The census measures that a grammar PRODUCES SYMBOLS, not
89
+ // that it is the RIGHT grammar — `.pyx` sits in the same list at 1,540 files with a Python grammar that cannot
90
+ // represent Cython, which is the failure mode `routing-outlier-census.ts` exists to catch.
91
+ // `.jsonlog` ADDED — a JSON-per-line log, the same shape as `.jsonl` and read by the `json` grammar
92
+ // with no representational gap. From the fleet census: 5 corpus files, 408 symbols, 403 relationships.
93
+ // THE THIRD `.json`-family extension taken and the FIRST LEFT: `.jsonschema` (3 files, 7,255 relationships
94
+ // — ~2,400 per file, ABOVE ANY ROUTED LANGUAGE'S DENSITY HERE) is NOT taken, because the census measures
95
+ // that a grammar PRODUCES SYMBOLS and not that it is the RIGHT grammar, and that density is a claim
96
+ // nobody has checked. `.jsonl` and `.jsonlog` answer a question; `.jsonschema` asks one.
97
+ jsonl: "json",
98
+ jsonlog: "json",
99
+ yml: "yaml",
100
+ yaml: "yaml",
101
+ // `.graphqls` was missing while `graphql` and `gql` were present. It is the GraphQL SCHEMA extension —
102
+ // the same format, spelled for schema files — so this is an omission and not a decision. MEASURED
103
+ // THROUGH PRODUCTION DISCOVERY, not by walking the filesystem: the graphql lane's own instrument priced
104
+ // 97 corpus `.graphqls` files as `filesTheIndexerDidNotAdmit`, and a Lead measurement of the ADMITTED
105
+ // count returns 0 — so all 97 are read by nothing, answered with the fallback, and produce no symbols
106
+ // while APPEARING in the population. Same defect class as `.cts`.
107
+ graphql: "graphql",
108
+ gql: "graphql",
109
+ graphqls: "graphql",
110
+ c: "c",
111
+ h: "c",
112
+ cpp: "cpp",
113
+ cc: "cpp",
114
+ cxx: "cpp",
115
+ "c++": "cpp",
116
+ hpp: "cpp",
117
+ hxx: "cpp",
118
+ // FOUR ADDED 2026-10-12, from the A-lane router census: .ipp (11 corpus files, inline C++ implementation),
119
+ // .inl (3, the same convention spelled differently), .cu (3, CUDA — a C++ dialect the cpp grammar reads),
120
+ // and .pod (11, Perl's own documentation format, beside the .pl/.pm/.t the perl lane already routes).
121
+ // MEASURED TOGETHER: 28 corpus files routed to NOTHING. Same class as .cts, .graphqls, .sbt and .phpt.
122
+ // AND THE CHECK THAT WOULD HAVE CAUGHT THEM IS COMMITTED: script/m60/unrouted-extension-gate.ts.
123
+ ipp: "cpp",
124
+ inl: "cpp",
125
+ cu: "cpp",
126
+ pod: "perl",
127
+ rs: "rust",
128
+ go: "go",
129
+ zig: "zig",
130
+ // `.jl` measured, not assumed: 941 tracked files in the Julia corpus, all of which the pinned
131
+ // grammar parses (772 clean, 177 carrying tree-sitter ERROR nodes the patch inventory records).
132
+ // `.jul` exists in the wild and is NOT claimed here — declaring a format the corpus cannot
133
+ // support is the claim-without-coverage class the M60 rules forbid, so it stays undeclared until
134
+ // a corpus measures it.
135
+ jl: "julia",
136
+ // M60 honesty rule applied on measurement, not on the grammar's file-types
137
+ // list. The pinned grammar declares `nimble` and `nims` alongside `nim`, but
138
+ // declaring a format is not evidence the analyzer models it, and routing on
139
+ // the declaration alone is the claim-without-coverage class. So both were
140
+ // MEASURED first, over every tracked file of all 12 pinned corpora:
141
+ //
142
+ // .nims 65 files 0 error files 0 error nodes 43 symbols 279 relationships 96 imports
143
+ // .nimble 171 files 0 error files 0 error nodes 26 symbols 315 relationships 11 imports
144
+ //
145
+ // 100% parse health on both, and both carry real declarations rather than
146
+ // being pure data: a .nims is a NimScript (set_cmd/switch/buildFile, all
147
+ // procs), and a .nimble's `task`/`bin` blocks declare things. Routing them is
148
+ // what the evidence supports; rulings NIMD4/NIMD5 in
149
+ // script/m14/spec/nim-completeness.json.
150
+ nim: "nim",
151
+ nims: "nim",
152
+ nimble: "nim",
153
+ java: "java",
154
+ kt: "kotlin",
155
+ kts: "kotlin",
156
+ scala: "scala",
157
+ sc: "scala",
158
+ // `.sbt` ADDED — the Scala Build Tool's own format, which IS Scala source (an sbt file is a Scala program
159
+ // against the sbt DSL). MEASURED by the scala lane: 163 corpus files, routed to NOTHING. Same defect class
160
+ // as `.cts` and `.graphqls` — the file is read, answered with the fallback, and produces no symbols while
161
+ // APPEARING in the population. `.ktm` is deliberately NOT added: the lane measured 0 files for it.
162
+ sbt: "scala",
163
+ groovy: "groovy",
164
+ // M49 W21 (#850): Gradle's Groovy DSL. `.gradle` had NO registry entry, so every
165
+ // `build.gradle`/`settings.gradle` was rejected by detectLanguage before a grammar
166
+ // was chosen — the largest real-world Groovy surface (454 files in grails-core alone)
167
+ // was invisible to bb_analyze. The Kotlin DSL was already covered via `kts`.
168
+ gradle: "groovy",
169
+ // M60 (#913 ruling, 2026-09-24): `.gsp` used to sit here, mapped to groovy the same
170
+ // way `.gradle` is — and it is not Groovy either. A Grails Server Page is an HTML
171
+ // document carrying `${}`/`<g:...>` tags and `<%--%>` comments; the Groovy grammar
172
+ // has no productions for it, and 39 of 39 sampled grails-core files parse with ERROR
173
+ // nodes. The class-wide ruling is "stop claiming": an extension whose format no
174
+ // pinned grammar can represent is NOT routed, rather than routed to a grammar that
175
+ // cannot represent it and then reported as covered. The census that owns the class
176
+ // (its evidence, its refusals and the sibling instances) is
177
+ // script/m60/routing-outlier-census.ts → validation/m60/results/routing-outliers.json.
178
+ py: "python",
179
+ pyw: "python",
180
+ pyi: "python",
181
+ // `.pyx`/`.pxd` (Cython) sat here until the same ruling. Cython is a different
182
+ // language — `cdef`/`cpdef`/`cimport`, buffer syntax, and the whole `.pxd`
183
+ // declaration grammar — and the Python grammar has no productions for it: measured
184
+ // `.pyx` 231/270 (85.6 %) and `.pxd` 42/44 (95.5 %) carrying ERROR nodes against
185
+ // `.py` 2/86 (2.3 %). The lane still reported 100 % coverage and MISSING=0 there,
186
+ // because F5 compares the analyzer against an oracle that walks the SAME partial
187
+ // tree and recovery keeps symbols flowing through the ERROR regions — which is what
188
+ // made a 68.8 %-unparseable corpus read as a pass. Nothing now claims to have
189
+ // analyzed them; if a Cython grammar is ever vendored, this is the line it changes.
190
+ rb: "ruby",
191
+ // `.phpt` ADDED — the PHP test-file format, PHP source with an expected-output section. MEASURED by the php
192
+ // lane: 1,314 corpus files, routed to NOTHING.
193
+ // `.inc` IS DELIBERATELY NOT ADDED (61 files): `.inc` is genuinely ambiguous across languages — PHP include,
194
+ // Pascal include, assembly include — and this table's own rule is that a format is declared on measurement,
195
+ // not on the extension's existence. 61 files do not justify guessing which language they are.
196
+ php: "php",
197
+ phpt: "php",
198
+ lua: "lua",
199
+ pl: "perl",
200
+ pm: "perl",
201
+ t: "perl",
202
+ perl: "perl",
203
+ ex: "elixir",
204
+ exs: "elixir",
205
+ erl: "erlang",
206
+ hrl: "erlang",
207
+ hs: "haskell",
208
+ lhs: "haskell",
209
+ icl: "clean",
210
+ dcl: "clean",
211
+ clj: "clojure",
212
+ cljs: "clojure",
213
+ cljc: "clojure",
214
+ edn: "clojure",
215
+ swift: "swift",
216
+ dart: "dart",
217
+ cs: "csharp",
218
+ csx: "csharp",
219
+ vb: "vb",
220
+ vba: "vba",
221
+ bas: "vba",
222
+ cls: "vba",
223
+ frm: "vba",
224
+ matlab: "matlab",
225
+ fs: "fsharp",
226
+ fsi: "fsharp",
227
+ fsx: "fsharp",
228
+ r: "r",
229
+ sql: "sql",
230
+ sh: "bash",
231
+ bash: "bash",
232
+ zsh: "bash",
233
+ ps1: "powershell",
234
+ psm1: "powershell",
235
+ psd1: "powershell",
236
+ sol: "solidity",
237
+ // Terraform is HCL, and `.tf` files ARE Terraform — the same relationship `sass`
238
+ // had with `css` above, resolved the same way. `terraform` was declared in
239
+ // SUPPORTED_LANGUAGES with an analyzer and a grammar arm while every `.tf`/`.tfvars`/
240
+ // `.tofu` file routed to `hcl`, so the language was unreachable and the coverage gate
241
+ // failed on it. The grammar is unchanged (tree-sitter-hcl parses Terraform, measured
242
+ // clean: the gate's .tf fixture yields 8 symbols with no ERROR nodes); what changes is
243
+ // that the lane is named after the thing the files are, so `--language terraform`
244
+ // can find them. `.hcl` keeps its own name for the generic-HCL case.
245
+ tf: "terraform",
246
+ tfvars: "terraform",
247
+ tofu: "terraform",
248
+ hcl: "hcl",
249
+ m: "objective-c",
250
+ mm: "objective-c",
251
+ md: "markdown",
252
+ markdown: "markdown",
253
+ toml: "toml",
254
+ proto: "protobuf",
255
+ // M60 XML lane: `xml` was routed for `.xml`/`.xsd`/`.dtd` only, while the wired
256
+ // grammar's OWN `tree-sitter.json` declares `file-types: [xml, svg, xsd, xslt,
257
+ // xsl, rng]`. Three of the grammar's six declared types were unreachable, and
258
+ // the corpus cost is measured, not asserted: 617 `.xsl`, 31 `.xslt`, 155 `.svg`
259
+ // and 110 `.rng` files across the lane's 6 pinned repos — 913 XML documents
260
+ // that bb never opened. Routing is taken from the grammar's own declaration
261
+ // rather than from taste.
262
+ //
263
+ // DELIBERATELY NOT ROUTED, under the M60 #913 ruling ("an extension whose
264
+ // format no pinned grammar can represent is NOT routed"): `.wsdl` (805 files),
265
+ // `.pom` (693), `.xhtml` (36) and `.plist` are XML-shaped, but the grammar
266
+ // does not declare them, so routing them would be a claim the grammar does not
267
+ // back. They stay invisible and are recorded as owed in
268
+ // `reviews/xml/master-review.md` §F — visible debt rather than a silent gap.
269
+ xml: "xml",
270
+ xsd: "xml",
271
+ dtd: "xml",
272
+ svg: "xml",
273
+ xsl: "xml",
274
+ xslt: "xml",
275
+ rng: "xml",
276
+ mk: "make",
277
+ mak: "make",
278
+ makefile: "make"
279
+ };
280
+ var BASENAME_LANGUAGE = {
281
+ "bashrc": "bash",
282
+ ".bashrc": "bash",
283
+ ".zshrc": "bash",
284
+ "makefile": "make",
285
+ "gnumakefile": "make",
286
+ ".makefile": "make",
287
+ ".gnumakefile": "make",
288
+ // Extensionless files that are nonetheless a language bb can parse. Measured:
289
+ // a project containing a `Rakefile` indexed ZERO files and ZERO symbols, with
290
+ // no error and no warning — the file was silently skipped. The identical Ruby
291
+ // content in `tasks.rb` IS detected, so this was a routing gap and not a
292
+ // parsing failure.
293
+ //
294
+ // Each entry below was checked to have BOTH an analyzer and a grammar, so
295
+ // routing to it cannot create a new class of "detected but unparseable".
296
+ // Deliberately NOT added, because neither support exists:
297
+ // Dockerfile, Jenkinsfile — no grammar and no analyzer
298
+ // Gemfile, CMakeLists.txt — no grammar
299
+ // Returning null for those is correct and honest; a user with a Dockerfile is
300
+ // not told it is unsupported, which is a separate (and real) gap.
301
+ "rakefile": "ruby",
302
+ "gemfile": "ruby",
303
+ "guardfile": "ruby",
304
+ "capfile": "ruby",
305
+ "vagrantfile": "ruby",
306
+ "brewfile": "ruby",
307
+ "podfile": "ruby",
308
+ "berksfile": "ruby",
309
+ "thorfile": "ruby",
310
+ "buildfile": "ruby",
311
+ "gemrc": "ruby",
312
+ // Python tooling that ships without an extension, in the same class as Rakefile.
313
+ "pipfile": "toml",
314
+ "poetry.lock": "toml"
315
+ };
316
+ function stripCommentsAndStrings(src) {
317
+ let out = "";
318
+ let i = 0;
319
+ const n = src.length;
320
+ const blank = (from, to) => {
321
+ for (let k = from; k < to; k++) out += src[k] === "\n" ? "\n" : " ";
322
+ };
323
+ while (i < n) {
324
+ const c = src[i];
325
+ const next = src[i + 1];
326
+ if (c === "/" && next === "/") {
327
+ let j = i;
328
+ while (j < n && src[j] !== "\n") j++;
329
+ blank(i, j);
330
+ i = j;
331
+ continue;
332
+ }
333
+ if (c === "/" && next === "*") {
334
+ let j = i + 2;
335
+ while (j < n && !(src[j] === "*" && src[j + 1] === "/")) j++;
336
+ const end = Math.min(n, j + 2);
337
+ blank(i, end);
338
+ i = end;
339
+ continue;
340
+ }
341
+ if (c === '"' || c === "'") {
342
+ const quote = c;
343
+ let j = i + 1;
344
+ while (j < n) {
345
+ if (src[j] === "\\") {
346
+ j += 2;
347
+ continue;
348
+ }
349
+ if (src[j] === quote) {
350
+ j++;
351
+ break;
352
+ }
353
+ if (src[j] === "\n") break;
354
+ j++;
355
+ }
356
+ blank(i, Math.min(j, n));
357
+ i = Math.min(j, n);
358
+ continue;
359
+ }
360
+ out += c;
361
+ i++;
362
+ }
363
+ return out;
364
+ }
365
+ var SHEBANG_LANGUAGE = [
366
+ ["/usr/bin/env node", "javascript"],
367
+ ["/usr/bin/node", "javascript"],
368
+ ["/usr/local/bin/node", "javascript"],
369
+ ["/bin/node", "javascript"],
370
+ ["/bin/bash", "bash"],
371
+ ["/usr/bin/bash", "bash"],
372
+ ["/usr/bin/env bash", "bash"],
373
+ ["/bin/sh", "bash"],
374
+ ["/usr/bin/sh", "bash"],
375
+ ["/usr/bin/env sh", "bash"],
376
+ ["/bin/zsh", "bash"],
377
+ ["/usr/bin/zsh", "bash"],
378
+ ["/usr/bin/env zsh", "bash"],
379
+ ["/bin/dash", "bash"],
380
+ ["/usr/bin/dash", "bash"],
381
+ ["/bin/ksh", "bash"],
382
+ ["/usr/bin/ksh", "bash"],
383
+ ["/usr/bin/env ksh", "bash"]
384
+ ];
385
+ function languageFromShebang(content) {
386
+ const nl = content.indexOf("\n");
387
+ const first = (nl === -1 ? content : content.slice(0, nl)).trim();
388
+ if (!first.startsWith("#!")) return null;
389
+ const rest = first.slice(2).trimStart();
390
+ for (const [interpreter, lang] of SHEBANG_LANGUAGE) {
391
+ if (rest === interpreter) return lang;
392
+ if (rest.startsWith(interpreter) && /[\s]/.test(rest.charAt(interpreter.length))) return lang;
393
+ }
394
+ return null;
395
+ }
396
+ function detectLanguageFromPath(filePath, content) {
397
+ const normalized = filePath.replace(/\\/g, "/");
398
+ const basename = normalized.slice(normalized.lastIndexOf("/") + 1);
399
+ const basenameMatch = BASENAME_LANGUAGE[basename.toLowerCase()];
400
+ if (basenameMatch) return basenameMatch;
401
+ const dot = basename.lastIndexOf(".");
402
+ if (dot < 0 || dot === basename.length - 1) {
403
+ if (dot < 0 && content && content.length > 0) return languageFromShebang(content);
404
+ return null;
405
+ }
406
+ const ext = basename.slice(dot + 1).toLowerCase();
407
+ if (ext === "m" && content) {
408
+ const head = content.slice(0, 65536);
409
+ if (head.includes("function ") || head.includes("classdef ")) return "matlab";
410
+ }
411
+ const byExtension = EXTENSION_LANGUAGE[ext];
412
+ if (ext === "h" && content && content.length > 0) {
413
+ const head = content.length > 65536 ? content.slice(0, 65536) : content;
414
+ const code = stripCommentsAndStrings(head);
415
+ if (/@(?:interface|protocol|implementation)\s+[A-Za-z_]/m.test(code)) return "objective-c";
416
+ const cppMarkers = [
417
+ /\bnamespace\s+[A-Za-z_][\w:]*\s*\{/m,
418
+ /\btemplate\s*</m,
419
+ /\bclass\s+[A-Za-z_][\w:]*\s*(?::\s*[^\n{]*)?\s*\{/m,
420
+ /\b(?:public|private|protected)\s*:/m,
421
+ /\b(?:virtual|override|constexpr|explicit)\b/m,
422
+ /\bstd::[A-Za-z_]/m,
423
+ /#include\s*[<"](?:algorithm|array|bits\/|cassert|cctype|cerrno|cfloat|climits|cmath|cstddef|cstdint|cstdio|cstdlib|cstring|ctime|deque|exception|fstream|functional|iomanip|ios|iosfwd|iostream|istream|iterator|limits|list|locale|map|memory|mutex|new|numeric|ostream|queue|regex|set|sstream|stack|stdexcept|streambuf|string|typeinfo|unordered_map|unordered_set|utility|valarray|vector)[">]/m
424
+ ];
425
+ for (let i = 0; i < cppMarkers.length; i++) {
426
+ if (cppMarkers[i].test(code)) return "cpp";
427
+ }
428
+ return "c";
429
+ }
430
+ return byExtension ?? null;
431
+ }
432
+ function languageExtensionEntries() {
433
+ return Object.entries(EXTENSION_LANGUAGE);
434
+ }
435
+
436
+ export {
437
+ EXTENSION_LANGUAGE,
438
+ detectLanguageFromPath,
439
+ languageExtensionEntries
440
+ };