gitnexus 1.6.6-rc.98 → 1.6.6

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 (541) hide show
  1. package/README.md +122 -68
  2. package/dist/_shared/graph/types.d.ts +17 -1
  3. package/dist/_shared/graph/types.d.ts.map +1 -1
  4. package/dist/_shared/index.d.ts +3 -5
  5. package/dist/_shared/index.d.ts.map +1 -1
  6. package/dist/_shared/index.js +2 -4
  7. package/dist/_shared/index.js.map +1 -1
  8. package/dist/_shared/scope-resolution/module-scope-index.d.ts +1 -2
  9. package/dist/_shared/scope-resolution/module-scope-index.d.ts.map +1 -1
  10. package/dist/_shared/scope-resolution/module-scope-index.js +1 -2
  11. package/dist/_shared/scope-resolution/module-scope-index.js.map +1 -1
  12. package/dist/_shared/scope-resolution/parsed-file.d.ts +24 -0
  13. package/dist/_shared/scope-resolution/parsed-file.d.ts.map +1 -1
  14. package/dist/_shared/scope-resolution/reference-site.d.ts +13 -1
  15. package/dist/_shared/scope-resolution/reference-site.d.ts.map +1 -1
  16. package/dist/_shared/scope-resolution/registries/context.d.ts +1 -0
  17. package/dist/_shared/scope-resolution/registries/context.d.ts.map +1 -1
  18. package/dist/_shared/scope-resolution/registries/context.js +6 -0
  19. package/dist/_shared/scope-resolution/registries/context.js.map +1 -1
  20. package/dist/_shared/scope-resolution/registries/evidence.d.ts +2 -3
  21. package/dist/_shared/scope-resolution/registries/evidence.d.ts.map +1 -1
  22. package/dist/_shared/scope-resolution/registries/evidence.js +2 -3
  23. package/dist/_shared/scope-resolution/registries/evidence.js.map +1 -1
  24. package/dist/_shared/scope-resolution/registries/macro-registry.d.ts +29 -0
  25. package/dist/_shared/scope-resolution/registries/macro-registry.d.ts.map +1 -0
  26. package/dist/_shared/scope-resolution/registries/macro-registry.js +32 -0
  27. package/dist/_shared/scope-resolution/registries/macro-registry.js.map +1 -0
  28. package/dist/_shared/scope-resolution/symbol-definition.d.ts +9 -0
  29. package/dist/_shared/scope-resolution/symbol-definition.d.ts.map +1 -1
  30. package/dist/_shared/scope-resolution/types.d.ts +1 -1
  31. package/dist/_shared/scope-resolution/types.d.ts.map +1 -1
  32. package/dist/cli/ai-context.d.ts +35 -1
  33. package/dist/cli/ai-context.js +111 -12
  34. package/dist/cli/analyze-config.d.ts +92 -0
  35. package/dist/cli/analyze-config.js +364 -0
  36. package/dist/cli/analyze.d.ts +17 -1
  37. package/dist/cli/analyze.js +224 -71
  38. package/dist/cli/cli-message.d.ts +1 -1
  39. package/dist/cli/doctor.d.ts +18 -0
  40. package/dist/cli/doctor.js +32 -0
  41. package/dist/cli/i18n/en.d.ts +2 -2
  42. package/dist/cli/i18n/en.js +2 -2
  43. package/dist/cli/i18n/resources.d.ts +2 -2
  44. package/dist/cli/i18n/zh-CN.js +2 -2
  45. package/dist/cli/index.js +4 -2
  46. package/dist/cli/resolve-invocation.d.ts +21 -0
  47. package/dist/cli/resolve-invocation.js +68 -0
  48. package/dist/cli/setup.d.ts +33 -0
  49. package/dist/cli/setup.js +96 -35
  50. package/dist/cli/skill-gen.js +2 -2
  51. package/dist/cli/wiki.js +20 -4
  52. package/dist/core/embeddings/embedder.d.ts +1 -1
  53. package/dist/core/embeddings/embedder.js +14 -1
  54. package/dist/core/embeddings/runtime-support.d.ts +41 -0
  55. package/dist/core/embeddings/runtime-support.js +65 -0
  56. package/dist/core/group/extractors/grpc-patterns/proto.js +2 -1
  57. package/dist/core/group/extractors/http-patterns/java.js +15 -1
  58. package/dist/core/ingestion/call-processor.d.ts +57 -227
  59. package/dist/core/ingestion/call-processor.js +172 -2595
  60. package/dist/core/ingestion/call-routing.d.ts +6 -5
  61. package/dist/core/ingestion/call-routing.js +6 -6
  62. package/dist/core/ingestion/call-types.d.ts +0 -75
  63. package/dist/core/ingestion/class-extractors/configs/c-cpp.js +26 -1
  64. package/dist/core/ingestion/class-extractors/configs/ruby.js +3 -0
  65. package/dist/core/ingestion/class-extractors/generic.js +9 -11
  66. package/dist/core/ingestion/class-types.d.ts +23 -0
  67. package/dist/core/ingestion/cobol/cobol-preprocessor.d.ts +11 -0
  68. package/dist/core/ingestion/cobol/cobol-preprocessor.js +227 -73
  69. package/dist/core/ingestion/cobol-processor.d.ts +1 -0
  70. package/dist/core/ingestion/cobol-processor.js +51 -2
  71. package/dist/core/ingestion/emit-references.js +8 -2
  72. package/dist/core/ingestion/export-detection.d.ts +2 -1
  73. package/dist/core/ingestion/export-detection.js +2 -6
  74. package/dist/core/ingestion/field-extractors/configs/dart.d.ts +0 -6
  75. package/dist/core/ingestion/field-extractors/configs/dart.js +62 -44
  76. package/dist/core/ingestion/field-extractors/configs/go.d.ts +0 -9
  77. package/dist/core/ingestion/field-extractors/configs/go.js +40 -1
  78. package/dist/core/ingestion/field-extractors/configs/jvm.js +43 -4
  79. package/dist/core/ingestion/field-extractors/configs/php.js +1 -2
  80. package/dist/core/ingestion/field-extractors/configs/swift.d.ts +12 -1
  81. package/dist/core/ingestion/field-extractors/configs/swift.js +31 -6
  82. package/dist/core/ingestion/field-extractors/generic.d.ts +6 -0
  83. package/dist/core/ingestion/field-extractors/generic.js +5 -4
  84. package/dist/core/ingestion/field-extractors/typescript.js +0 -29
  85. package/dist/core/ingestion/filesystem-walker.d.ts +0 -9
  86. package/dist/core/ingestion/filesystem-walker.js +0 -11
  87. package/dist/core/ingestion/finalize-orchestrator.js +14 -2
  88. package/dist/core/ingestion/import-resolvers/configs/swift.d.ts +21 -0
  89. package/dist/core/ingestion/import-resolvers/configs/swift.js +72 -11
  90. package/dist/core/ingestion/import-resolvers/python.d.ts +1 -1
  91. package/dist/core/ingestion/import-resolvers/standard.d.ts +2 -2
  92. package/dist/core/ingestion/import-resolvers/standard.js +6 -5
  93. package/dist/core/ingestion/import-resolvers/utils.d.ts +2 -5
  94. package/dist/core/ingestion/import-resolvers/utils.js +1 -9
  95. package/dist/core/ingestion/language-provider.d.ts +39 -119
  96. package/dist/core/ingestion/language-provider.js +0 -2
  97. package/dist/core/ingestion/languages/c/capture-side-channel.d.ts +62 -0
  98. package/dist/core/ingestion/languages/c/capture-side-channel.js +65 -0
  99. package/dist/core/ingestion/languages/c/captures.js +41 -23
  100. package/dist/core/ingestion/languages/c/import-decomposer.d.ts +9 -0
  101. package/dist/core/ingestion/languages/c/import-decomposer.js +15 -0
  102. package/dist/core/ingestion/languages/c/import-target.js +52 -9
  103. package/dist/core/ingestion/languages/c/index.d.ts +2 -1
  104. package/dist/core/ingestion/languages/c/index.js +2 -1
  105. package/dist/core/ingestion/languages/c/query.js +15 -0
  106. package/dist/core/ingestion/languages/c/scope-resolver.js +47 -4
  107. package/dist/core/ingestion/languages/c/static-linkage.d.ts +8 -0
  108. package/dist/core/ingestion/languages/c/static-linkage.js +46 -1
  109. package/dist/core/ingestion/languages/c-cpp.js +16 -7
  110. package/dist/core/ingestion/languages/cobol/captures.js +25 -2
  111. package/dist/core/ingestion/languages/cpp/adl.d.ts +88 -4
  112. package/dist/core/ingestion/languages/cpp/adl.js +380 -160
  113. package/dist/core/ingestion/languages/cpp/arity-metadata.js +2 -8
  114. package/dist/core/ingestion/languages/cpp/capture-side-channel.d.ts +65 -0
  115. package/dist/core/ingestion/languages/cpp/capture-side-channel.js +78 -0
  116. package/dist/core/ingestion/languages/cpp/captures.js +162 -54
  117. package/dist/core/ingestion/languages/cpp/file-local-linkage.d.ts +18 -52
  118. package/dist/core/ingestion/languages/cpp/file-local-linkage.js +49 -1
  119. package/dist/core/ingestion/languages/cpp/import-decomposer.d.ts +7 -0
  120. package/dist/core/ingestion/languages/cpp/import-decomposer.js +12 -0
  121. package/dist/core/ingestion/languages/cpp/index.d.ts +1 -0
  122. package/dist/core/ingestion/languages/cpp/index.js +1 -0
  123. package/dist/core/ingestion/languages/cpp/inline-namespaces.d.ts +8 -0
  124. package/dist/core/ingestion/languages/cpp/inline-namespaces.js +21 -0
  125. package/dist/core/ingestion/languages/cpp/query.js +21 -0
  126. package/dist/core/ingestion/languages/cpp/range-bindings.js +20 -5
  127. package/dist/core/ingestion/languages/cpp/scope-resolver.js +52 -5
  128. package/dist/core/ingestion/languages/cpp/two-phase-lookup.d.ts +20 -0
  129. package/dist/core/ingestion/languages/cpp/two-phase-lookup.js +83 -3
  130. package/dist/core/ingestion/languages/csharp/captures.js +205 -41
  131. package/dist/core/ingestion/languages/csharp/index.d.ts +3 -4
  132. package/dist/core/ingestion/languages/csharp/index.js +3 -4
  133. package/dist/core/ingestion/languages/csharp/interpret.js +17 -3
  134. package/dist/core/ingestion/languages/csharp/namespace-siblings.d.ts +17 -7
  135. package/dist/core/ingestion/languages/csharp/namespace-siblings.js +129 -124
  136. package/dist/core/ingestion/languages/csharp/qualified-type-names.d.ts +14 -0
  137. package/dist/core/ingestion/languages/csharp/qualified-type-names.js +59 -0
  138. package/dist/core/ingestion/languages/csharp/query.js +13 -0
  139. package/dist/core/ingestion/languages/csharp/receiver-binding.js +10 -6
  140. package/dist/core/ingestion/languages/csharp/scope-resolver.js +8 -1
  141. package/dist/core/ingestion/languages/csharp.js +0 -5
  142. package/dist/core/ingestion/languages/dart/arity-metadata.d.ts +25 -0
  143. package/dist/core/ingestion/languages/dart/arity-metadata.js +35 -0
  144. package/dist/core/ingestion/languages/dart/arity.d.ts +19 -0
  145. package/dist/core/ingestion/languages/dart/arity.js +31 -0
  146. package/dist/core/ingestion/languages/dart/built-ins.d.ts +11 -0
  147. package/dist/core/ingestion/languages/dart/built-ins.js +34 -0
  148. package/dist/core/ingestion/languages/dart/cache-stats.d.ts +13 -0
  149. package/dist/core/ingestion/languages/dart/cache-stats.js +24 -0
  150. package/dist/core/ingestion/languages/dart/captures.d.ts +29 -0
  151. package/dist/core/ingestion/languages/dart/captures.js +445 -0
  152. package/dist/core/ingestion/languages/dart/expand-wildcards.d.ts +13 -0
  153. package/dist/core/ingestion/languages/dart/expand-wildcards.js +31 -0
  154. package/dist/core/ingestion/languages/dart/import-target.d.ts +15 -0
  155. package/dist/core/ingestion/languages/dart/import-target.js +65 -0
  156. package/dist/core/ingestion/languages/dart/index.d.ts +28 -0
  157. package/dist/core/ingestion/languages/dart/index.js +28 -0
  158. package/dist/core/ingestion/languages/dart/interpret.d.ts +24 -0
  159. package/dist/core/ingestion/languages/dart/interpret.js +95 -0
  160. package/dist/core/ingestion/languages/dart/merge-bindings.d.ts +10 -0
  161. package/dist/core/ingestion/languages/dart/merge-bindings.js +39 -0
  162. package/dist/core/ingestion/languages/dart/query.d.ts +26 -0
  163. package/dist/core/ingestion/languages/dart/query.js +142 -0
  164. package/dist/core/ingestion/languages/dart/receiver-binding.d.ts +24 -0
  165. package/dist/core/ingestion/languages/dart/receiver-binding.js +87 -0
  166. package/dist/core/ingestion/languages/dart/scope-resolver.d.ts +29 -0
  167. package/dist/core/ingestion/languages/dart/scope-resolver.js +194 -0
  168. package/dist/core/ingestion/languages/dart/signature-bindings.d.ts +23 -0
  169. package/dist/core/ingestion/languages/dart/signature-bindings.js +51 -0
  170. package/dist/core/ingestion/languages/dart/simple-hooks.d.ts +20 -0
  171. package/dist/core/ingestion/languages/dart/simple-hooks.js +47 -0
  172. package/dist/core/ingestion/languages/dart.d.ts +0 -1
  173. package/dist/core/ingestion/languages/dart.js +15 -29
  174. package/dist/core/ingestion/languages/go/arity-metadata.d.ts +1 -0
  175. package/dist/core/ingestion/languages/go/arity-metadata.js +31 -1
  176. package/dist/core/ingestion/languages/go/captures.js +247 -26
  177. package/dist/core/ingestion/languages/go/interface-impls.js +476 -50
  178. package/dist/core/ingestion/languages/go/interpret.js +21 -11
  179. package/dist/core/ingestion/languages/go/method-owners.js +20 -8
  180. package/dist/core/ingestion/languages/go/query.js +15 -7
  181. package/dist/core/ingestion/languages/go/range-binding.js +24 -9
  182. package/dist/core/ingestion/languages/go/receiver-binding.js +1 -1
  183. package/dist/core/ingestion/languages/go/scope-resolver.js +2 -2
  184. package/dist/core/ingestion/languages/go/simple-hooks.js +10 -5
  185. package/dist/core/ingestion/languages/go/type-binding.d.ts +1 -0
  186. package/dist/core/ingestion/languages/go/type-binding.js +40 -2
  187. package/dist/core/ingestion/languages/go.d.ts +0 -1
  188. package/dist/core/ingestion/languages/go.js +0 -5
  189. package/dist/core/ingestion/languages/index.d.ts +0 -5
  190. package/dist/core/ingestion/languages/index.js +0 -3
  191. package/dist/core/ingestion/languages/java/captures.js +252 -23
  192. package/dist/core/ingestion/languages/java/interpret.js +12 -6
  193. package/dist/core/ingestion/languages/java/package-siblings.js +18 -5
  194. package/dist/core/ingestion/languages/java/query.js +16 -1
  195. package/dist/core/ingestion/languages/java/scope-resolver.d.ts +2 -8
  196. package/dist/core/ingestion/languages/java/scope-resolver.js +2 -8
  197. package/dist/core/ingestion/languages/java.js +0 -5
  198. package/dist/core/ingestion/languages/javascript/captures.js +185 -11
  199. package/dist/core/ingestion/languages/javascript/query.js +107 -1
  200. package/dist/core/ingestion/languages/kotlin/capture-side-channel.d.ts +57 -0
  201. package/dist/core/ingestion/languages/kotlin/capture-side-channel.js +60 -0
  202. package/dist/core/ingestion/languages/kotlin/captures.js +213 -22
  203. package/dist/core/ingestion/languages/kotlin/companion-scopes.d.ts +7 -0
  204. package/dist/core/ingestion/languages/kotlin/companion-scopes.js +10 -0
  205. package/dist/core/ingestion/languages/kotlin/index.d.ts +1 -0
  206. package/dist/core/ingestion/languages/kotlin/index.js +1 -0
  207. package/dist/core/ingestion/languages/kotlin/query.js +30 -0
  208. package/dist/core/ingestion/languages/kotlin/scope-resolver.d.ts +5 -7
  209. package/dist/core/ingestion/languages/kotlin/scope-resolver.js +22 -7
  210. package/dist/core/ingestion/languages/kotlin.js +8 -5
  211. package/dist/core/ingestion/languages/php/captures.js +135 -19
  212. package/dist/core/ingestion/languages/php/import-decomposer.js +21 -63
  213. package/dist/core/ingestion/languages/php/index.d.ts +3 -4
  214. package/dist/core/ingestion/languages/php/index.js +3 -4
  215. package/dist/core/ingestion/languages/php/query.js +5 -0
  216. package/dist/core/ingestion/languages/php/receiver-binding.js +8 -4
  217. package/dist/core/ingestion/languages/php.js +0 -4
  218. package/dist/core/ingestion/languages/python/captures.js +128 -13
  219. package/dist/core/ingestion/languages/python/depends-references.js +1 -1
  220. package/dist/core/ingestion/languages/python/import-target.d.ts +4 -5
  221. package/dist/core/ingestion/languages/python/import-target.js +108 -16
  222. package/dist/core/ingestion/languages/python/index-stats.d.ts +18 -0
  223. package/dist/core/ingestion/languages/python/index-stats.js +25 -0
  224. package/dist/core/ingestion/languages/python/index.d.ts +3 -4
  225. package/dist/core/ingestion/languages/python/index.js +3 -4
  226. package/dist/core/ingestion/languages/python/query.js +17 -0
  227. package/dist/core/ingestion/languages/python/scope-resolver.js +7 -6
  228. package/dist/core/ingestion/languages/python.d.ts +0 -2
  229. package/dist/core/ingestion/languages/python.js +0 -7
  230. package/dist/core/ingestion/languages/ruby/captures.js +174 -31
  231. package/dist/core/ingestion/languages/ruby/import-target.js +2 -1
  232. package/dist/core/ingestion/languages/ruby/interpret.js +2 -1
  233. package/dist/core/ingestion/languages/ruby/query.js +10 -0
  234. package/dist/core/ingestion/languages/ruby/scope-resolver.js +61 -11
  235. package/dist/core/ingestion/languages/ruby.js +4 -53
  236. package/dist/core/ingestion/languages/rust/captures.js +95 -13
  237. package/dist/core/ingestion/languages/rust/query.js +64 -1
  238. package/dist/core/ingestion/languages/rust/range-binding.js +40 -12
  239. package/dist/core/ingestion/languages/rust/receiver-binding.js +9 -0
  240. package/dist/core/ingestion/languages/rust/scope-resolver.js +75 -1
  241. package/dist/core/ingestion/languages/rust.d.ts +0 -2
  242. package/dist/core/ingestion/languages/rust.js +0 -6
  243. package/dist/core/ingestion/languages/swift/arity-metadata.d.ts +24 -0
  244. package/dist/core/ingestion/languages/swift/arity-metadata.js +41 -0
  245. package/dist/core/ingestion/languages/swift/arity.d.ts +29 -0
  246. package/dist/core/ingestion/languages/swift/arity.js +42 -0
  247. package/dist/core/ingestion/languages/swift/base-type.d.ts +20 -0
  248. package/dist/core/ingestion/languages/swift/base-type.js +27 -0
  249. package/dist/core/ingestion/languages/swift/cache-stats.d.ts +15 -0
  250. package/dist/core/ingestion/languages/swift/cache-stats.js +26 -0
  251. package/dist/core/ingestion/languages/swift/captures.d.ts +35 -0
  252. package/dist/core/ingestion/languages/swift/captures.js +495 -0
  253. package/dist/core/ingestion/languages/swift/implicit-imports.d.ts +34 -0
  254. package/dist/core/ingestion/languages/swift/implicit-imports.js +57 -0
  255. package/dist/core/ingestion/languages/swift/import-decomposer.d.ts +24 -0
  256. package/dist/core/ingestion/languages/swift/import-decomposer.js +84 -0
  257. package/dist/core/ingestion/languages/swift/import-target.d.ts +33 -0
  258. package/dist/core/ingestion/languages/swift/import-target.js +81 -0
  259. package/dist/core/ingestion/languages/swift/index.d.ts +37 -0
  260. package/dist/core/ingestion/languages/swift/index.js +37 -0
  261. package/dist/core/ingestion/languages/swift/interpret.d.ts +15 -0
  262. package/dist/core/ingestion/languages/swift/interpret.js +89 -0
  263. package/dist/core/ingestion/languages/swift/merge-bindings.d.ts +20 -0
  264. package/dist/core/ingestion/languages/swift/merge-bindings.js +48 -0
  265. package/dist/core/ingestion/languages/swift/query.d.ts +46 -0
  266. package/dist/core/ingestion/languages/swift/query.js +194 -0
  267. package/dist/core/ingestion/languages/swift/receiver-binding.d.ts +40 -0
  268. package/dist/core/ingestion/languages/swift/receiver-binding.js +161 -0
  269. package/dist/core/ingestion/languages/swift/scope-resolver.d.ts +50 -0
  270. package/dist/core/ingestion/languages/swift/scope-resolver.js +189 -0
  271. package/dist/core/ingestion/languages/swift/sibling-type-bindings.d.ts +34 -0
  272. package/dist/core/ingestion/languages/swift/sibling-type-bindings.js +65 -0
  273. package/dist/core/ingestion/languages/swift/signature-bindings.d.ts +25 -0
  274. package/dist/core/ingestion/languages/swift/signature-bindings.js +66 -0
  275. package/dist/core/ingestion/languages/swift/simple-hooks.d.ts +37 -0
  276. package/dist/core/ingestion/languages/swift/simple-hooks.js +60 -0
  277. package/dist/core/ingestion/languages/swift/target-grouping.d.ts +51 -0
  278. package/dist/core/ingestion/languages/swift/target-grouping.js +93 -0
  279. package/dist/core/ingestion/languages/swift/target-siblings.d.ts +30 -0
  280. package/dist/core/ingestion/languages/swift/target-siblings.js +71 -0
  281. package/dist/core/ingestion/languages/swift.d.ts +0 -5
  282. package/dist/core/ingestion/languages/swift.js +11 -87
  283. package/dist/core/ingestion/languages/typescript/array-callback.d.ts +3 -29
  284. package/dist/core/ingestion/languages/typescript/array-callback.js +4 -43
  285. package/dist/core/ingestion/languages/typescript/captures.js +147 -17
  286. package/dist/core/ingestion/languages/typescript/index.d.ts +3 -4
  287. package/dist/core/ingestion/languages/typescript/index.js +3 -4
  288. package/dist/core/ingestion/languages/typescript/query.d.ts +2 -3
  289. package/dist/core/ingestion/languages/typescript/query.js +125 -4
  290. package/dist/core/ingestion/languages/typescript/receiver-binding.js +0 -1
  291. package/dist/core/ingestion/languages/typescript.d.ts +2 -3
  292. package/dist/core/ingestion/languages/typescript.js +46 -23
  293. package/dist/core/ingestion/languages/vue/captures.d.ts +46 -0
  294. package/dist/core/ingestion/languages/vue/captures.js +67 -0
  295. package/dist/core/ingestion/languages/vue/import-target.d.ts +27 -0
  296. package/dist/core/ingestion/languages/vue/import-target.js +58 -0
  297. package/dist/core/ingestion/languages/vue/index.d.ts +49 -0
  298. package/dist/core/ingestion/languages/vue/index.js +49 -0
  299. package/dist/core/ingestion/languages/vue/scope-resolver.d.ts +55 -0
  300. package/dist/core/ingestion/languages/vue/scope-resolver.js +292 -0
  301. package/dist/core/ingestion/languages/vue.js +12 -4
  302. package/dist/core/ingestion/local-symbol-pruner.d.ts +11 -0
  303. package/dist/core/ingestion/local-symbol-pruner.js +63 -0
  304. package/dist/core/ingestion/method-extractors/configs/dart.js +14 -1
  305. package/dist/core/ingestion/method-extractors/configs/jvm.js +37 -20
  306. package/dist/core/ingestion/method-extractors/configs/php.js +0 -1
  307. package/dist/core/ingestion/method-extractors/configs/swift.js +11 -4
  308. package/dist/core/ingestion/method-types.d.ts +2 -2
  309. package/dist/core/ingestion/model/index.d.ts +0 -3
  310. package/dist/core/ingestion/model/index.js +0 -8
  311. package/dist/core/ingestion/model/resolve.d.ts +7 -43
  312. package/dist/core/ingestion/model/resolve.js +7 -226
  313. package/dist/core/ingestion/model/scope-resolution-indexes.d.ts +46 -1
  314. package/dist/core/ingestion/model/semantic-model.d.ts +4 -6
  315. package/dist/core/ingestion/model/semantic-model.js +1 -1
  316. package/dist/core/ingestion/model/symbol-table.d.ts +3 -4
  317. package/dist/core/ingestion/model/symbol-table.js +3 -4
  318. package/dist/core/ingestion/parsing-processor.d.ts +30 -24
  319. package/dist/core/ingestion/parsing-processor.js +76 -640
  320. package/dist/core/ingestion/pipeline-phases/communities.d.ts +1 -1
  321. package/dist/core/ingestion/pipeline-phases/communities.js +5 -2
  322. package/dist/core/ingestion/pipeline-phases/cross-file.d.ts +9 -8
  323. package/dist/core/ingestion/pipeline-phases/cross-file.js +16 -12
  324. package/dist/core/ingestion/pipeline-phases/index.d.ts +1 -0
  325. package/dist/core/ingestion/pipeline-phases/index.js +1 -0
  326. package/dist/core/ingestion/pipeline-phases/mro.d.ts +1 -1
  327. package/dist/core/ingestion/pipeline-phases/mro.js +2 -2
  328. package/dist/core/ingestion/pipeline-phases/parse-impl.d.ts +44 -22
  329. package/dist/core/ingestion/pipeline-phases/parse-impl.js +426 -565
  330. package/dist/core/ingestion/pipeline-phases/parse.d.ts +13 -33
  331. package/dist/core/ingestion/pipeline-phases/parse.js +2 -2
  332. package/dist/core/ingestion/pipeline-phases/processes.d.ts +1 -1
  333. package/dist/core/ingestion/pipeline-phases/processes.js +5 -3
  334. package/dist/core/ingestion/pipeline-phases/prune-local-symbols.d.ts +14 -0
  335. package/dist/core/ingestion/pipeline-phases/prune-local-symbols.js +26 -0
  336. package/dist/core/ingestion/pipeline.d.ts +27 -19
  337. package/dist/core/ingestion/pipeline.js +4 -2
  338. package/dist/core/ingestion/resolve-references.js +15 -3
  339. package/dist/core/ingestion/route-extractors/laravel.d.ts +10 -0
  340. package/dist/core/ingestion/route-extractors/laravel.js +88 -9
  341. package/dist/core/ingestion/scope-extractor-bridge.d.ts +2 -1
  342. package/dist/core/ingestion/scope-extractor-bridge.js +2 -2
  343. package/dist/core/ingestion/scope-extractor.js +13 -0
  344. package/dist/core/ingestion/scope-resolution/contract/scope-resolver.d.ts +181 -15
  345. package/dist/core/ingestion/scope-resolution/contract/scope-resolver.js +21 -10
  346. package/dist/core/ingestion/scope-resolution/graph-bridge/edges.js +10 -2
  347. package/dist/core/ingestion/scope-resolution/graph-bridge/ids.d.ts +7 -1
  348. package/dist/core/ingestion/scope-resolution/graph-bridge/ids.js +58 -6
  349. package/dist/core/ingestion/scope-resolution/graph-bridge/node-lookup.js +24 -5
  350. package/dist/core/ingestion/scope-resolution/passes/free-call-fallback.d.ts +68 -1
  351. package/dist/core/ingestion/scope-resolution/passes/free-call-fallback.js +189 -29
  352. package/dist/core/ingestion/scope-resolution/passes/imported-return-types.js +21 -1
  353. package/dist/core/ingestion/scope-resolution/passes/receiver-bound-calls.js +1 -1
  354. package/dist/core/ingestion/scope-resolution/pipeline/phase.d.ts +8 -11
  355. package/dist/core/ingestion/scope-resolution/pipeline/phase.js +171 -50
  356. package/dist/core/ingestion/scope-resolution/pipeline/registry.d.ts +3 -4
  357. package/dist/core/ingestion/scope-resolution/pipeline/registry.js +9 -4
  358. package/dist/core/ingestion/scope-resolution/pipeline/run.d.ts +28 -5
  359. package/dist/core/ingestion/scope-resolution/pipeline/run.js +191 -24
  360. package/dist/core/ingestion/scope-resolution/pipeline/validate-bindings-immutability.js +31 -0
  361. package/dist/core/ingestion/scope-resolution/scope/walkers.d.ts +72 -0
  362. package/dist/core/ingestion/scope-resolution/scope/walkers.js +440 -39
  363. package/dist/core/ingestion/scope-resolution/workspace-index.d.ts +18 -2
  364. package/dist/core/ingestion/scope-resolution/workspace-index.js +94 -7
  365. package/dist/core/ingestion/tree-sitter-queries.d.ts +14 -14
  366. package/dist/core/ingestion/tree-sitter-queries.js +380 -158
  367. package/dist/core/ingestion/ts-js-hoc-utils.d.ts +12 -0
  368. package/dist/core/ingestion/ts-js-hoc-utils.js +105 -0
  369. package/dist/core/ingestion/type-env.d.ts +2 -1
  370. package/dist/core/ingestion/type-env.js +6 -8
  371. package/dist/core/ingestion/type-extractors/c-cpp.js +8 -10
  372. package/dist/core/ingestion/type-extractors/csharp.js +18 -34
  373. package/dist/core/ingestion/type-extractors/go.js +2 -10
  374. package/dist/core/ingestion/type-extractors/jvm.js +6 -5
  375. package/dist/core/ingestion/type-extractors/php.js +1 -1
  376. package/dist/core/ingestion/type-extractors/python.js +1 -1
  377. package/dist/core/ingestion/type-extractors/ruby.js +2 -2
  378. package/dist/core/ingestion/type-extractors/rust.js +0 -16
  379. package/dist/core/ingestion/type-extractors/shared.d.ts +2 -2
  380. package/dist/core/ingestion/type-extractors/shared.js +25 -11
  381. package/dist/core/ingestion/type-extractors/swift.js +5 -5
  382. package/dist/core/ingestion/type-extractors/types.d.ts +1 -1
  383. package/dist/core/ingestion/type-extractors/typescript.js +1 -1
  384. package/dist/core/ingestion/utils/ast-helpers.d.ts +119 -1
  385. package/dist/core/ingestion/utils/ast-helpers.js +260 -13
  386. package/dist/core/ingestion/utils/callable-labels.d.ts +13 -0
  387. package/dist/core/ingestion/utils/callable-labels.js +14 -0
  388. package/dist/core/ingestion/utils/deferred-resolution-profile.d.ts +10 -0
  389. package/dist/core/ingestion/utils/deferred-resolution-profile.js +30 -0
  390. package/dist/core/ingestion/utils/heap-probe.d.ts +20 -0
  391. package/dist/core/ingestion/utils/heap-probe.js +39 -0
  392. package/dist/core/ingestion/utils/heritage-marker.d.ts +33 -0
  393. package/dist/core/ingestion/utils/heritage-marker.js +41 -0
  394. package/dist/core/ingestion/utils/qualified-name.d.ts +37 -0
  395. package/dist/core/ingestion/utils/qualified-name.js +67 -0
  396. package/dist/core/ingestion/variable-extractors/configs/c-cpp.js +49 -0
  397. package/dist/core/ingestion/variable-extractors/configs/dart.js +76 -62
  398. package/dist/core/ingestion/variable-extractors/configs/go.js +74 -7
  399. package/dist/core/ingestion/variable-extractors/configs/jvm.js +35 -8
  400. package/dist/core/ingestion/variable-extractors/generic.js +40 -12
  401. package/dist/core/ingestion/variable-types.d.ts +9 -0
  402. package/dist/core/ingestion/vue-sfc-extractor.d.ts +97 -7
  403. package/dist/core/ingestion/vue-sfc-extractor.js +433 -11
  404. package/dist/core/ingestion/workers/parse-worker.d.ts +0 -11
  405. package/dist/core/ingestion/workers/parse-worker.js +358 -187
  406. package/dist/core/ingestion/workers/worker-pool.d.ts +78 -9
  407. package/dist/core/ingestion/workers/worker-pool.js +346 -49
  408. package/dist/core/lbug/csv-generator.js +20 -2
  409. package/dist/core/lbug/lbug-adapter.js +29 -10
  410. package/dist/core/lbug/native-check.js +17 -5
  411. package/dist/core/lbug/pool-adapter.d.ts +0 -19
  412. package/dist/core/lbug/pool-adapter.js +40 -77
  413. package/dist/core/lbug/query-result-utils.d.ts +19 -0
  414. package/dist/core/lbug/query-result-utils.js +28 -0
  415. package/dist/core/run-analyze.d.ts +9 -2
  416. package/dist/core/run-analyze.js +24 -3
  417. package/dist/core/tree-sitter/parser-loader.d.ts +13 -0
  418. package/dist/core/tree-sitter/parser-loader.js +4 -0
  419. package/dist/core/tree-sitter/safe-parse.d.ts +70 -3
  420. package/dist/core/tree-sitter/safe-parse.js +214 -11
  421. package/dist/core/wiki/generator.js +13 -5
  422. package/dist/core/wiki/graph-queries.d.ts +3 -0
  423. package/dist/core/wiki/graph-queries.js +9 -1
  424. package/dist/core/wiki/llm-client.d.ts +1 -1
  425. package/dist/core/wiki/llm-client.js +7 -2
  426. package/dist/core/wiki/local-cli-client.d.ts +2 -1
  427. package/dist/core/wiki/local-cli-client.js +62 -4
  428. package/dist/mcp/compatible-stdio-transport.d.ts +3 -0
  429. package/dist/mcp/compatible-stdio-transport.js +22 -0
  430. package/dist/mcp/core/embedder.d.ts +1 -1
  431. package/dist/mcp/core/embedder.js +13 -1
  432. package/dist/mcp/local/local-backend.d.ts +37 -5
  433. package/dist/mcp/local/local-backend.js +227 -129
  434. package/dist/mcp/resources.js +3 -3
  435. package/dist/mcp/server.js +9 -1
  436. package/dist/storage/git.d.ts +11 -0
  437. package/dist/storage/git.js +30 -0
  438. package/dist/storage/parse-cache.d.ts +23 -1
  439. package/dist/storage/parse-cache.js +138 -32
  440. package/dist/storage/parsedfile-store.d.ts +142 -0
  441. package/dist/storage/parsedfile-store.js +367 -0
  442. package/dist/storage/repo-manager.d.ts +2 -1
  443. package/dist/storage/scope-index-store.d.ts +114 -0
  444. package/dist/storage/scope-index-store.js +236 -0
  445. package/dist/types/pipeline.d.ts +6 -3
  446. package/hooks/antigravity/gitnexus-antigravity-hook.cjs +2 -1
  447. package/hooks/claude/gitnexus-hook.cjs +2 -1
  448. package/hooks/claude/resolve-analyze-cmd.cjs +323 -0
  449. package/package.json +4 -5
  450. package/scripts/bench-scope-resolution.ts +1 -3
  451. package/scripts/cross-platform-tests.ts +4 -1
  452. package/skills/gitnexus-cli.md +8 -6
  453. package/skills/gitnexus-debugging.md +15 -15
  454. package/skills/gitnexus-exploring.md +11 -11
  455. package/skills/gitnexus-guide.md +1 -1
  456. package/skills/gitnexus-impact-analysis.md +10 -10
  457. package/skills/gitnexus-pr-review.md +19 -19
  458. package/skills/gitnexus-refactoring.md +25 -25
  459. package/web/assets/{agent-BRX-afm3.js → agent-EkX7webX.js} +156 -131
  460. package/web/assets/{architectureDiagram-UL44E2DR-B1oYB8-c.js → architectureDiagram-UL44E2DR-BoczH8cv.js} +1 -1
  461. package/web/assets/{chunk-LCXTWHL2-SPC6pgWI.js → chunk-LCXTWHL2-By5HB3b-.js} +1 -1
  462. package/web/assets/{chunk-RG4AUYOV-DZXr4Yv3.js → chunk-RG4AUYOV-BQE_DkpL.js} +1 -1
  463. package/web/assets/{classDiagram-KGZ6W3CR-BqpOj8L9.js → classDiagram-KGZ6W3CR-Dj_02GUH.js} +1 -1
  464. package/web/assets/{classDiagram-v2-72OJOZXJ-FmElywK2.js → classDiagram-v2-72OJOZXJ-D-NArMpf.js} +1 -1
  465. package/web/assets/{diagram-3NCE3AQN-BWtJXMDq.js → diagram-3NCE3AQN-VXtXDO95.js} +1 -1
  466. package/web/assets/{diagram-GF46GFSD-Hh-fChxU.js → diagram-GF46GFSD-B1qab2Ah.js} +1 -1
  467. package/web/assets/{diagram-QXG6HAR7-DYeQHxGU.js → diagram-QXG6HAR7-BSCHGzzT.js} +1 -1
  468. package/web/assets/{diagram-WEQXMOUZ-DYGU4T0y.js → diagram-WEQXMOUZ-DHtknmNT.js} +1 -1
  469. package/web/assets/{erDiagram-L5TCEMPS-bN3wlP2A.js → erDiagram-L5TCEMPS-Db-IYTmm.js} +1 -1
  470. package/web/assets/{flowDiagram-H6V6AXG4-YACVtF3-.js → flowDiagram-H6V6AXG4-BHDoyVoW.js} +1 -1
  471. package/web/assets/{index-BhnAdWTt.js → index-BR0IhgbR.js} +10 -10
  472. package/web/assets/{infoDiagram-3YFTVSEB-BWBzD28-.js → infoDiagram-3YFTVSEB-6h8wbWEe.js} +1 -1
  473. package/web/assets/{ishikawaDiagram-BNXS4ZKH-B8qYT-j9.js → ishikawaDiagram-BNXS4ZKH-Dx2OkPk1.js} +1 -1
  474. package/web/assets/{kanban-definition-75IXJCU3-BeoPr5Tl.js → kanban-definition-75IXJCU3-CIIEZfqV.js} +1 -1
  475. package/web/assets/{mindmap-definition-2TDM6QVE-CdLLN_so.js → mindmap-definition-2TDM6QVE-DUAqydRq.js} +1 -1
  476. package/web/assets/{pieDiagram-CU6KROY3-DEd2a_k_.js → pieDiagram-CU6KROY3-BntYuYZa.js} +1 -1
  477. package/web/assets/{requirementDiagram-JXO7QTGE-QNeTo5C_.js → requirementDiagram-JXO7QTGE-QCD6I29n.js} +1 -1
  478. package/web/assets/{sequenceDiagram-VS2MUI6T-BHC7q7yJ.js → sequenceDiagram-VS2MUI6T-DScFwLz2.js} +1 -1
  479. package/web/assets/{stateDiagram-7D4R322I-KONnc2Px.js → stateDiagram-7D4R322I-AkRAm6Hl.js} +1 -1
  480. package/web/assets/{stateDiagram-v2-36443NZ5-C2QfuMlu.js → stateDiagram-v2-36443NZ5-BCK1vigR.js} +1 -1
  481. package/web/assets/{timeline-definition-O6YCAMPW-D4t4NJx1.js → timeline-definition-O6YCAMPW-BvpIVXjX.js} +1 -1
  482. package/web/assets/{vennDiagram-MWXL3ELB-6bctC9Yg.js → vennDiagram-MWXL3ELB-BYGWk6dK.js} +1 -1
  483. package/web/assets/{wardleyDiagram-CUQ6CDDI-BPZYNTvC.js → wardleyDiagram-CUQ6CDDI-Dk1z7H2T.js} +1 -1
  484. package/web/assets/{xychartDiagram-N2JHSOCM-lBI9O6DW.js → xychartDiagram-N2JHSOCM-2N6NCSWN.js} +1 -1
  485. package/web/index.html +1 -1
  486. package/dist/_shared/scope-resolution/shadow/aggregate.d.ts +0 -63
  487. package/dist/_shared/scope-resolution/shadow/aggregate.d.ts.map +0 -1
  488. package/dist/_shared/scope-resolution/shadow/aggregate.js +0 -122
  489. package/dist/_shared/scope-resolution/shadow/aggregate.js.map +0 -1
  490. package/dist/_shared/scope-resolution/shadow/diff.d.ts +0 -59
  491. package/dist/_shared/scope-resolution/shadow/diff.d.ts.map +0 -1
  492. package/dist/_shared/scope-resolution/shadow/diff.js +0 -79
  493. package/dist/_shared/scope-resolution/shadow/diff.js.map +0 -1
  494. package/dist/core/ingestion/ast-cache.d.ts +0 -26
  495. package/dist/core/ingestion/ast-cache.js +0 -48
  496. package/dist/core/ingestion/heritage-extractors/configs/go.d.ts +0 -13
  497. package/dist/core/ingestion/heritage-extractors/configs/go.js +0 -20
  498. package/dist/core/ingestion/heritage-extractors/configs/ruby.d.ts +0 -18
  499. package/dist/core/ingestion/heritage-extractors/configs/ruby.js +0 -65
  500. package/dist/core/ingestion/heritage-extractors/generic.d.ts +0 -23
  501. package/dist/core/ingestion/heritage-extractors/generic.js +0 -47
  502. package/dist/core/ingestion/heritage-processor.d.ts +0 -54
  503. package/dist/core/ingestion/heritage-processor.js +0 -367
  504. package/dist/core/ingestion/heritage-types.d.ts +0 -73
  505. package/dist/core/ingestion/heritage-types.js +0 -2
  506. package/dist/core/ingestion/import-processor.d.ts +0 -23
  507. package/dist/core/ingestion/import-processor.js +0 -377
  508. package/dist/core/ingestion/model/heritage-map.d.ts +0 -105
  509. package/dist/core/ingestion/model/heritage-map.js +0 -294
  510. package/dist/core/ingestion/model/resolution-context.d.ts +0 -93
  511. package/dist/core/ingestion/model/resolution-context.js +0 -337
  512. package/dist/core/ingestion/named-bindings/csharp.d.ts +0 -3
  513. package/dist/core/ingestion/named-bindings/csharp.js +0 -37
  514. package/dist/core/ingestion/named-bindings/java.d.ts +0 -3
  515. package/dist/core/ingestion/named-bindings/java.js +0 -29
  516. package/dist/core/ingestion/named-bindings/kotlin.d.ts +0 -3
  517. package/dist/core/ingestion/named-bindings/kotlin.js +0 -36
  518. package/dist/core/ingestion/named-bindings/php.d.ts +0 -3
  519. package/dist/core/ingestion/named-bindings/php.js +0 -61
  520. package/dist/core/ingestion/named-bindings/python.d.ts +0 -3
  521. package/dist/core/ingestion/named-bindings/python.js +0 -49
  522. package/dist/core/ingestion/named-bindings/rust.d.ts +0 -3
  523. package/dist/core/ingestion/named-bindings/rust.js +0 -66
  524. package/dist/core/ingestion/named-bindings/types.d.ts +0 -16
  525. package/dist/core/ingestion/named-bindings/types.js +0 -6
  526. package/dist/core/ingestion/named-bindings/typescript.d.ts +0 -3
  527. package/dist/core/ingestion/named-bindings/typescript.js +0 -58
  528. package/dist/core/ingestion/pipeline-phases/cross-file-impl.d.ts +0 -17
  529. package/dist/core/ingestion/pipeline-phases/cross-file-impl.js +0 -209
  530. package/dist/core/ingestion/pipeline-phases/orm-extraction.d.ts +0 -22
  531. package/dist/core/ingestion/pipeline-phases/orm-extraction.js +0 -92
  532. package/dist/core/ingestion/pipeline-phases/wildcard-synthesis.d.ts +0 -70
  533. package/dist/core/ingestion/pipeline-phases/wildcard-synthesis.js +0 -312
  534. package/dist/core/ingestion/registry-primary-flag.d.ts +0 -89
  535. package/dist/core/ingestion/registry-primary-flag.js +0 -122
  536. package/dist/core/ingestion/shadow-harness.d.ts +0 -113
  537. package/dist/core/ingestion/shadow-harness.js +0 -148
  538. package/dist/core/ingestion/utils/ruby-self-call.d.ts +0 -52
  539. package/dist/core/ingestion/utils/ruby-self-call.js +0 -59
  540. package/scripts/ci-list-migrated-languages.ts +0 -24
  541. package/scripts/run-parity.ts +0 -128
@@ -143,7 +143,7 @@ export const zhCN = {
143
143
  'help.option.analyze.maxFileSize': '跳过大于该值的文件(KB)。默认:512。硬上限:32768(tree-sitter 限制)。',
144
144
  'help.option.analyze.workerTimeout': 'Worker 子批次空闲超时,超时后重试/回退。默认:30。',
145
145
  'help.option.analyze.walCheckpointThreshold': 'analyze 期间 LadybugDB WAL 自动 checkpoint 阈值(字节,整数 >= -1;默认:67108864 = 64 MiB;-1 保持 Ladybug 默认约 16 MiB)。',
146
- 'help.option.analyze.workers': '解析 worker 池大小。默认:cores-1,最多 16。传 0 禁用 worker(顺序执行)。',
146
+ 'help.option.analyze.workers': '解析 worker 池大小(>=1)。默认:cores-1,最多 16,按仓库规模自适应。',
147
147
  'help.option.analyze.embeddingThreads': '限制本地 ONNX 嵌入 CPU 线程数',
148
148
  'help.option.analyze.embeddingBatchSize': '每个嵌入批次的节点数',
149
149
  'help.option.analyze.embeddingSubBatchSize': '每次嵌入模型调用的分块数',
@@ -156,7 +156,7 @@ export const zhCN = {
156
156
  'help.option.clean.all': '清理所有已索引仓库',
157
157
  'help.option.clean.lbugSidecars': '清理已隔离的 LadybugDB missing-shadow WAL sidecar',
158
158
  'help.option.wiki.force': '即使已是最新也强制完整重新生成',
159
- 'help.option.wiki.provider': 'LLM 提供商:openai、openrouter、azure、custom、cursor、claude 或 codex(默认:openai)',
159
+ 'help.option.wiki.provider': 'LLM 提供商:openai、openrouter、azure、custom、cursor、claude、codexopencode(默认:openai)',
160
160
  'help.option.wiki.model': 'LLM 模型或 Azure deployment 名称(默认:minimax/minimax-m2.5)',
161
161
  'help.option.wiki.baseUrl': 'LLM API base URL。Azure v1:https://{resource}.openai.azure.com/openai/v1',
162
162
  'help.option.wiki.apiKey': 'LLM API key 或 Azure api-key(保存到 ~/.gitnexus/config.json)',
package/dist/cli/index.js CHANGED
@@ -27,6 +27,8 @@ program
27
27
  .option('--skills', 'Generate repo-specific skill files from detected communities ' +
28
28
  '(no-op when --index-only is also set).')
29
29
  .option('--skip-agents-md', 'Skip updating the gitnexus section in AGENTS.md and CLAUDE.md')
30
+ .option('--default-branch <branch>', 'Default branch used in the generated regression-compare example (base_ref). ' +
31
+ 'Falls back to .gitnexusrc, then auto-detected origin/HEAD, then "main".')
30
32
  .option('--no-stats', 'Omit volatile file/symbol counts from AGENTS.md and CLAUDE.md')
31
33
  .option('--skip-skills', 'Skip installing standard GitNexus skill files under .claude/skills/gitnexus/. ' +
32
34
  'Does not suppress community skills from --skills (those use .claude/skills/generated/). ' +
@@ -42,7 +44,7 @@ program
42
44
  .option('--worker-timeout <seconds>', 'Worker sub-batch idle timeout before retry/fallback. Default: 30.')
43
45
  .option('--wal-checkpoint-threshold <bytes>', 'LadybugDB WAL auto-checkpoint threshold in bytes during analyze ' +
44
46
  '(integer >= -1; default: 67108864 = 64 MiB; -1 keeps Ladybug stock ~16 MiB).')
45
- .option('--workers <n>', 'Parse worker pool size. Default: cores-1 capped at 16. Pass 0 to disable workers (sequential).')
47
+ .option('--workers <n>', 'Parse worker pool size (>=1). Default: cores-1 capped at 16, auto-sized to the repo.')
46
48
  .option('--embedding-threads <n>', 'Limit local ONNX embedding CPU threads')
47
49
  .option('--embedding-batch-size <n>', 'Number of nodes per embedding batch')
48
50
  .option('--embedding-sub-batch-size <n>', 'Number of chunks per embedding model call')
@@ -94,7 +96,7 @@ program
94
96
  .command('wiki [path]')
95
97
  .description('Generate repository wiki from knowledge graph')
96
98
  .option('-f, --force', 'Force full regeneration even if up to date')
97
- .option('--provider <provider>', 'LLM provider: openai, openrouter, azure, custom, cursor, claude, or codex (default: openai)')
99
+ .option('--provider <provider>', 'LLM provider: openai, openrouter, azure, custom, cursor, claude, codex, or opencode (default: openai)')
98
100
  .option('--model <model>', 'LLM model or Azure deployment name (default: minimax/minimax-m2.5)')
99
101
  .option('--base-url <url>', 'LLM API base URL. Azure v1: https://{resource}.openai.azure.com/openai/v1')
100
102
  .option('--api-key <key>', 'LLM API key or Azure api-key (saved to ~/.gitnexus/config.json)')
@@ -0,0 +1,21 @@
1
+ /**
2
+ * npm 11.x npx-install-crash nudge for the `analyze` command (#1939).
3
+ *
4
+ * The gitnexus/pnpm/npx selection itself lives in the canonical hook helper
5
+ * (hooks/claude/resolve-analyze-cmd.cjs) — self-contained CJS because the copied
6
+ * hook runtime cannot import from the package. We reuse it here via createRequire
7
+ * instead of re-implementing it, so there is one source of truth for the
8
+ * invocation decision. This module adds only the npm-version probe and the
9
+ * warning, which are CLI-only. The relative path resolves identically from
10
+ * src/cli/ (tsx, vitest) and dist/cli/ (shipped), since both sit one level under
11
+ * the package root and `hooks/` is published.
12
+ */
13
+ declare const NPX_REF: string;
14
+ export { NPX_REF };
15
+ export declare function getNpmMajorVersion(): number | null;
16
+ /**
17
+ * One-line stderr nudge when an npm 11+ user is on the npx install path (#1939).
18
+ * Skipped when a global `gitnexus` or `pnpm` is already preferred, so it never
19
+ * nags users who are not exposed to the npx/arborist crash.
20
+ */
21
+ export declare function warnIfNpm11NpxRisk(): void;
@@ -0,0 +1,68 @@
1
+ /**
2
+ * npm 11.x npx-install-crash nudge for the `analyze` command (#1939).
3
+ *
4
+ * The gitnexus/pnpm/npx selection itself lives in the canonical hook helper
5
+ * (hooks/claude/resolve-analyze-cmd.cjs) — self-contained CJS because the copied
6
+ * hook runtime cannot import from the package. We reuse it here via createRequire
7
+ * instead of re-implementing it, so there is one source of truth for the
8
+ * invocation decision. This module adds only the npm-version probe and the
9
+ * warning, which are CLI-only. The relative path resolves identically from
10
+ * src/cli/ (tsx, vitest) and dist/cli/ (shipped), since both sit one level under
11
+ * the package root and `hooks/` is published.
12
+ */
13
+ import { execFileSync } from 'node:child_process';
14
+ import { createRequire } from 'node:module';
15
+ const { resolveInvocationMode, formatDocumentationDlxCommand, NPX_REF } = createRequire(import.meta.url)('../../hooks/claude/resolve-analyze-cmd.cjs');
16
+ // Fail loud at module load if the canonical cjs export shape drifts (e.g. a
17
+ // renamed export), rather than as a late TypeError inside warnIfNpm11NpxRisk.
18
+ if (typeof resolveInvocationMode !== 'function' ||
19
+ typeof formatDocumentationDlxCommand !== 'function' ||
20
+ typeof NPX_REF !== 'string') {
21
+ throw new Error('resolve-analyze-cmd.cjs must export resolveInvocationMode (function), formatDocumentationDlxCommand (function), and NPX_REF (string)');
22
+ }
23
+ export { NPX_REF };
24
+ // Re-implemented here (rather than reusing the cjs export) so vitest's
25
+ // `vi.mock('node:child_process')` intercepts it — the cjs uses bare
26
+ // `require('child_process')`, which the mock cannot reach. Timeout matches the
27
+ // cjs PROBE_TIMEOUT_MS (1s) so this CLI probe shares the same hook-budget cap;
28
+ // `npm --version` is a sub-second local call.
29
+ export function getNpmMajorVersion() {
30
+ try {
31
+ const output = execFileSync('npm', ['--version'], {
32
+ encoding: 'utf-8',
33
+ timeout: 1000,
34
+ stdio: ['ignore', 'pipe', 'ignore'],
35
+ windowsHide: true,
36
+ // Windows `npm` is a `.cmd` shim; without a shell execFileSync ENOENTs
37
+ // (CVE-2024-27980) and the npm-11 npx-crash warning below would never
38
+ // fire on Windows. Mirrors probeVersion in resolve-analyze-cmd.cjs.
39
+ shell: process.platform === 'win32',
40
+ });
41
+ // Read the first version-shaped line so a Corepack/update banner on stdout
42
+ // doesn't defeat the parse (mirrors the cjs probeVersion hardening).
43
+ const major = output
44
+ .split('\n')
45
+ .map((l) => l.trim())
46
+ .find((l) => /^v?\d+\./.test(l))
47
+ ?.match(/^v?(\d+)\./);
48
+ return major ? Number(major[1]) : null;
49
+ }
50
+ catch {
51
+ return null;
52
+ }
53
+ }
54
+ /**
55
+ * One-line stderr nudge when an npm 11+ user is on the npx install path (#1939).
56
+ * Skipped when a global `gitnexus` or `pnpm` is already preferred, so it never
57
+ * nags users who are not exposed to the npx/arborist crash.
58
+ */
59
+ export function warnIfNpm11NpxRisk() {
60
+ if (resolveInvocationMode() !== 'npx')
61
+ return;
62
+ const major = getNpmMajorVersion();
63
+ if (major === null || major < 11)
64
+ return;
65
+ process.stderr.write(`Warning: npm ${major}.x can crash while installing gitnexus via npx ` +
66
+ `(npm/arborist "node.target is null"). Prefer: ${formatDocumentationDlxCommand('analyze')} ` +
67
+ `or npm install -g ${NPX_REF}. See https://github.com/abhigyanpatwari/GitNexus/issues/1939\n`);
68
+ }
@@ -5,4 +5,37 @@
5
5
  * Detects installed AI editors and writes the appropriate MCP config
6
6
  * so the GitNexus MCP server is available in all projects.
7
7
  */
8
+ /**
9
+ * Build the `command` string written into an editor's hook settings, which the
10
+ * editor shell-evaluates. `hookPath` is already forward-slash-normalized.
11
+ *
12
+ * On POSIX, single-quote the path: a single-quoted shell string expands nothing,
13
+ * so spaces and metacharacters ($, backtick, ;, |, &, newline, parens) in the
14
+ * install path cannot run as commands. The only character needing escaping
15
+ * inside single quotes is the single quote, via the standard `'\''` idiom
16
+ * (close, literal-quote, reopen). The previous double-quoted `node "..."` form
17
+ * left $/backtick live — a code-execution risk for an adversarial $HOME.
18
+ *
19
+ * On Windows, filenames cannot contain these POSIX metacharacters and the path
20
+ * is forward-slashed, so keep the double-quoted form with backslash-then-quote
21
+ * escaping (CodeQL js/incomplete-sanitization safe ordering).
22
+ */
23
+ export declare function formatHookCommand(hookPath: string, isWindows?: boolean): string;
24
+ interface SetupResult {
25
+ configured: string[];
26
+ skipped: string[];
27
+ errors: string[];
28
+ }
29
+ /**
30
+ * Copy the shared hook helpers from `srcDir` into `destDir`. The adapters
31
+ * top-level `require()` the `.cjs` helpers, so a missing required helper makes
32
+ * the installed hook crash with MODULE_NOT_FOUND. A failed copy is recorded as a
33
+ * setup error, and the names of any failed REQUIRED helpers are returned so the
34
+ * caller can fail closed (skip hook registration) instead of registering a hook
35
+ * that crashes at runtime. `win-rm-list-json.ps1` is best-effort — its absence is
36
+ * recorded but does not gate registration. Both the Claude and Antigravity
37
+ * install paths copy this same list from hooks/claude/ (the canonical source).
38
+ */
39
+ export declare function copyHookHelpers(srcDir: string, destDir: string, label: string, result: SetupResult): Promise<string[]>;
8
40
  export declare const setupCommand: () => Promise<void>;
41
+ export {};
package/dist/cli/setup.js CHANGED
@@ -28,7 +28,38 @@ const _pkg = _require('../../package.json');
28
28
  if (typeof _pkg.version !== 'string' || !_pkg.version) {
29
29
  throw new Error('gitnexus/package.json#version is missing or not a string — cannot generate MCP fallback config.');
30
30
  }
31
- const NPX_REF = `gitnexus@${_pkg.version}`;
31
+ // Version-pinned ref for the persisted MCP entry — deliberately distinct from
32
+ // the cjs's exported `gitnexus@latest` hint ref (resolve-analyze-cmd.cjs); the
33
+ // two are not unified (see the comment above and that file's MCP_PINNED_REF).
34
+ const MCP_PINNED_REF = `gitnexus@${_pkg.version}`;
35
+ /**
36
+ * Build the `command` string written into an editor's hook settings, which the
37
+ * editor shell-evaluates. `hookPath` is already forward-slash-normalized.
38
+ *
39
+ * On POSIX, single-quote the path: a single-quoted shell string expands nothing,
40
+ * so spaces and metacharacters ($, backtick, ;, |, &, newline, parens) in the
41
+ * install path cannot run as commands. The only character needing escaping
42
+ * inside single quotes is the single quote, via the standard `'\''` idiom
43
+ * (close, literal-quote, reopen). The previous double-quoted `node "..."` form
44
+ * left $/backtick live — a code-execution risk for an adversarial $HOME.
45
+ *
46
+ * On Windows, filenames cannot contain these POSIX metacharacters and the path
47
+ * is forward-slashed, so keep the double-quoted form with backslash-then-quote
48
+ * escaping (CodeQL js/incomplete-sanitization safe ordering).
49
+ */
50
+ export function formatHookCommand(hookPath, isWindows = process.platform === 'win32') {
51
+ if (isWindows) {
52
+ const escaped = hookPath.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
53
+ return `node "${escaped}"`;
54
+ }
55
+ return `node '${hookPath.replace(/'/g, "'\\''")}'`;
56
+ }
57
+ // The exact source line each hook adapter ships, rewritten at install time to
58
+ // point cliPath at the installed CLI. Kept as a named constant so the install
59
+ // patch and its drift guard reference one string — if the adapter source ever
60
+ // changes this literal, the guard records an actionable error instead of
61
+ // silently shipping a hook with an unresolved relative cliPath.
62
+ const CLI_PATH_SOURCE_LITERAL = "let cliPath = path.resolve(__dirname, '..', '..', 'dist', 'cli', 'index.js');";
32
63
  /**
33
64
  * Resolve the absolute path to the `gitnexus` binary if it's installed
34
65
  * globally (or via npm -g / yarn global). Returns null when not found.
@@ -83,12 +114,12 @@ function getMcpEntry() {
83
114
  if (process.platform === 'win32') {
84
115
  return {
85
116
  command: 'cmd',
86
- args: ['/c', 'npx', '-y', NPX_REF, 'mcp'],
117
+ args: ['/c', 'npx', '-y', MCP_PINNED_REF, 'mcp'],
87
118
  };
88
119
  }
89
120
  return {
90
121
  command: 'npx',
91
- args: ['-y', NPX_REF, 'mcp'],
122
+ args: ['-y', MCP_PINNED_REF, 'mcp'],
92
123
  };
93
124
  }
94
125
  /**
@@ -101,9 +132,9 @@ function getOpenCodeMcpEntry() {
101
132
  return { type: 'local', command: [bin, 'mcp'] };
102
133
  }
103
134
  if (process.platform === 'win32') {
104
- return { type: 'local', command: ['cmd', '/c', 'npx', '-y', NPX_REF, 'mcp'] };
135
+ return { type: 'local', command: ['cmd', '/c', 'npx', '-y', MCP_PINNED_REF, 'mcp'] };
105
136
  }
106
- return { type: 'local', command: ['npx', '-y', NPX_REF, 'mcp'] };
137
+ return { type: 'local', command: ['npx', '-y', MCP_PINNED_REF, 'mcp'] };
107
138
  }
108
139
  /**
109
140
  * Detect indentation style from file content.
@@ -281,6 +312,42 @@ async function mergeHooksJsonc(filePath, entries) {
281
312
  await fs.writeFile(filePath, current, 'utf-8');
282
313
  return true;
283
314
  }
315
+ const HOOK_HELPERS = [
316
+ 'hook-lock.cjs',
317
+ 'hook-db-lock-probe.cjs',
318
+ 'win-rm-list-json.ps1',
319
+ 'resolve-analyze-cmd.cjs',
320
+ ];
321
+ // win-rm-list-json.ps1 is best-effort: it is read (not require()'d) by
322
+ // hook-db-lock-probe.cjs only on Windows, and that probe fails open when the
323
+ // script is absent. Every other helper is top-level require()'d by the adapters,
324
+ // so its absence crashes the installed hook — those are the ones a failed copy
325
+ // must gate hook registration on (see copyHookHelpers' return value).
326
+ const BEST_EFFORT_HOOK_HELPERS = new Set(['win-rm-list-json.ps1']);
327
+ /**
328
+ * Copy the shared hook helpers from `srcDir` into `destDir`. The adapters
329
+ * top-level `require()` the `.cjs` helpers, so a missing required helper makes
330
+ * the installed hook crash with MODULE_NOT_FOUND. A failed copy is recorded as a
331
+ * setup error, and the names of any failed REQUIRED helpers are returned so the
332
+ * caller can fail closed (skip hook registration) instead of registering a hook
333
+ * that crashes at runtime. `win-rm-list-json.ps1` is best-effort — its absence is
334
+ * recorded but does not gate registration. Both the Claude and Antigravity
335
+ * install paths copy this same list from hooks/claude/ (the canonical source).
336
+ */
337
+ export async function copyHookHelpers(srcDir, destDir, label, result) {
338
+ const failedRequired = [];
339
+ for (const helper of HOOK_HELPERS) {
340
+ try {
341
+ await fs.copyFile(path.join(srcDir, helper), path.join(destDir, helper));
342
+ }
343
+ catch {
344
+ result.errors.push(`${label}: failed to copy ${helper} — hook may crash at runtime`);
345
+ if (!BEST_EFFORT_HOOK_HELPERS.has(helper))
346
+ failedRequired.push(helper);
347
+ }
348
+ }
349
+ return failedRequired;
350
+ }
284
351
  /**
285
352
  * Install GitNexus hooks to ~/.claude/settings.json for Claude Code.
286
353
  * Merges hook config without overwriting existing hooks, preserving
@@ -304,37 +371,32 @@ async function installClaudeCodeHooks(result) {
304
371
  const resolvedCli = path.join(__dirname, '..', 'cli', 'index.js');
305
372
  const normalizedCli = path.resolve(resolvedCli).replace(/\\/g, '/');
306
373
  const jsonCli = JSON.stringify(normalizedCli);
307
- content = content.replace("let cliPath = path.resolve(__dirname, '..', '..', 'dist', 'cli', 'index.js');", `let cliPath = ${jsonCli};`);
374
+ if (!content.includes(CLI_PATH_SOURCE_LITERAL)) {
375
+ result.errors.push('Claude Code hooks: gitnexus-hook.cjs no longer contains the cliPath literal to patch — the installed hook may fail to resolve the CLI. Update CLI_PATH_SOURCE_LITERAL in setup.ts.');
376
+ }
377
+ content = content.replace(CLI_PATH_SOURCE_LITERAL, `let cliPath = ${jsonCli};`);
308
378
  await fs.writeFile(dest, content, 'utf-8');
309
379
  }
310
380
  catch {
311
381
  // Script not found in source — skip
312
382
  }
383
+ // Fail closed: registering the hook without its adapter would crash on every
384
+ // tool invocation. Mirrors the Antigravity adapter guard below (this path
385
+ // previously registered regardless of whether the adapter wrote).
313
386
  try {
314
- await fs.copyFile(path.join(pluginHooksPath, 'hook-lock.cjs'), path.join(destHooksDir, 'hook-lock.cjs'));
387
+ await fs.access(dest);
315
388
  }
316
389
  catch {
317
- // Helper not found in sourceskip
318
- }
319
- try {
320
- await fs.copyFile(path.join(pluginHooksPath, 'hook-db-lock-probe.cjs'), path.join(destHooksDir, 'hook-db-lock-probe.cjs'));
321
- }
322
- catch {
323
- // Helper not found in source — skip
324
- }
325
- try {
326
- await fs.copyFile(path.join(pluginHooksPath, 'win-rm-list-json.ps1'), path.join(destHooksDir, 'win-rm-list-json.ps1'));
390
+ result.errors.push('Claude Code hooks: adapter script was not installed skipping hook registration');
391
+ return;
327
392
  }
328
- catch {
329
- // Helper not found in source — skip
393
+ const failedRequired = await copyHookHelpers(pluginHooksPath, destHooksDir, 'Claude Code hooks', result);
394
+ if (failedRequired.length > 0) {
395
+ result.errors.push(`Claude Code hooks: required helper(s) ${failedRequired.join(', ')} failed to copy — skipping hook registration`);
396
+ return;
330
397
  }
331
398
  const hookPath = path.join(destHooksDir, 'gitnexus-hook.cjs').replace(/\\/g, '/');
332
- // Escape backslashes FIRST, then quotes (CodeQL js/incomplete-sanitization).
333
- // The previous shape `replace(/"/g, '\\"')` alone would let `path\with"quote`
334
- // become `path\with\"quote`, where the trailing `\` before `"` could
335
- // unescape the quote inside the surrounding double-quoted shell context.
336
- const escapedHookPath = hookPath.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
337
- const hookCmd = `node "${escapedHookPath}"`;
399
+ const hookCmd = formatHookCommand(hookPath);
338
400
  // Check which hook events need entries (idempotent: skip if already registered)
339
401
  const parsed = await (async () => {
340
402
  try {
@@ -483,7 +545,10 @@ async function installAntigravityHooks(result) {
483
545
  const resolvedCli = path.join(__dirname, '..', 'cli', 'index.js');
484
546
  const normalizedCli = path.resolve(resolvedCli).replace(/\\/g, '/');
485
547
  const jsonCli = JSON.stringify(normalizedCli);
486
- content = content.replace("let cliPath = path.resolve(__dirname, '..', '..', 'dist', 'cli', 'index.js');", `let cliPath = ${jsonCli};`);
548
+ if (!content.includes(CLI_PATH_SOURCE_LITERAL)) {
549
+ result.errors.push('Antigravity hooks: gitnexus-antigravity-hook.cjs no longer contains the cliPath literal to patch — the installed hook may fail to resolve the CLI. Update CLI_PATH_SOURCE_LITERAL in setup.ts.');
550
+ }
551
+ content = content.replace(CLI_PATH_SOURCE_LITERAL, `let cliPath = ${jsonCli};`);
487
552
  await fs.writeFile(adapterDest, content, 'utf-8');
488
553
  }
489
554
  catch {
@@ -503,17 +568,13 @@ async function installAntigravityHooks(result) {
503
568
  // required by hook-db-lock-probe.cjs on Windows — without it, the MCP
504
569
  // server ownership probe silently fails open and the hook may contend
505
570
  // with the MCP server on the LadybugDB.
506
- for (const helper of ['hook-lock.cjs', 'hook-db-lock-probe.cjs', 'win-rm-list-json.ps1']) {
507
- try {
508
- await fs.copyFile(path.join(pluginClaudeDir, helper), path.join(destHooksDir, helper));
509
- }
510
- catch {
511
- result.errors.push(`Antigravity hooks: failed to copy ${helper} — hook may crash at runtime`);
512
- }
571
+ const failedRequired = await copyHookHelpers(pluginClaudeDir, destHooksDir, 'Antigravity hooks', result);
572
+ if (failedRequired.length > 0) {
573
+ result.errors.push(`Antigravity hooks: required helper(s) ${failedRequired.join(', ')} failed to copy — skipping hook registration`);
574
+ return;
513
575
  }
514
576
  const hookPath = path.join(destHooksDir, 'gitnexus-antigravity-hook.cjs').replace(/\\/g, '/');
515
- const escapedHookPath = hookPath.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
516
- const hookCmd = `node "${escapedHookPath}"`;
577
+ const hookCmd = formatHookCommand(hookPath);
517
578
  const parsed = await (async () => {
518
579
  try {
519
580
  const r = await fs.readFile(settingsPath, 'utf-8');
@@ -482,8 +482,8 @@ const renderSkillMarkdown = (community, projectName, members, files, entryPoints
482
482
  : community.label;
483
483
  lines.push('## How to Explore');
484
484
  lines.push('');
485
- lines.push(`1. \`gitnexus_context({name: "${firstEntry}"})\` \u2014 see callers and callees`);
486
- lines.push(`2. \`gitnexus_query({query: "${community.label.toLowerCase()}"})\` \u2014 find related execution flows`);
485
+ lines.push(`1. \`context({name: "${firstEntry}"})\` \u2014 see callers and callees`);
486
+ lines.push(`2. \`query({query: "${community.label.toLowerCase()}"})\` \u2014 find related execution flows`);
487
487
  lines.push('3. Read key files listed above for implementation details');
488
488
  lines.push('');
489
489
  return lines.join('\n');
package/dist/cli/wiki.js CHANGED
@@ -29,14 +29,21 @@ function parsePositiveIntegerOption(value, flag, multiplier = 1) {
29
29
  return parsed;
30
30
  }
31
31
  function isLocalProvider(provider) {
32
- return provider === 'cursor' || provider === 'claude' || provider === 'codex';
32
+ return (provider === 'cursor' ||
33
+ provider === 'claude' ||
34
+ provider === 'codex' ||
35
+ provider === 'opencode');
33
36
  }
34
37
  function localModelConfigKey(provider) {
35
38
  if (provider === 'cursor')
36
39
  return 'cursorModel';
37
40
  if (provider === 'claude')
38
41
  return 'claudeModel';
39
- return 'codexModel';
42
+ if (provider === 'codex')
43
+ return 'codexModel';
44
+ if (provider === 'opencode')
45
+ return 'opencodeModel';
46
+ throw new Error(`Unsupported local provider: ${provider}`);
40
47
  }
41
48
  /**
42
49
  * Prompt the user for input via stdin.
@@ -212,7 +219,7 @@ const wikiCommandImpl = async (inputPath, options) => {
212
219
  if (!llmConfig.apiKey && !isLocalProvider(llmConfig.provider)) {
213
220
  console.log(' Error: No LLM API key found.');
214
221
  console.log(' Set OPENAI_API_KEY or GITNEXUS_API_KEY environment variable,');
215
- console.log(' or pass --api-key <key>, or use --provider cursor|claude|codex.\n');
222
+ console.log(' or pass --api-key <key>, or use --provider cursor|claude|codex|opencode.\n');
216
223
  process.exitCode = 1;
217
224
  return;
218
225
  }
@@ -220,11 +227,12 @@ const wikiCommandImpl = async (inputPath, options) => {
220
227
  }
221
228
  else {
222
229
  console.log(" No LLM configured. Let's set it up.\n");
223
- console.log(' Supports OpenAI, OpenRouter, Azure, any OpenAI-compatible API, Cursor CLI, Claude CLI, or Codex CLI.\n');
230
+ console.log(' Supports OpenAI, OpenRouter, Azure, any OpenAI-compatible API, Cursor CLI, Claude CLI, Codex CLI, or OpenCode CLI.\n');
224
231
  // Check if local agent CLIs are available.
225
232
  const hasCursor = detectCursorCLI();
226
233
  const hasClaude = detectLocalCLI('claude');
227
234
  const hasCodex = detectLocalCLI('codex');
235
+ const hasOpenCode = detectLocalCLI('opencode');
228
236
  const localChoices = [];
229
237
  // Provider selection
230
238
  console.log(' [1] OpenAI (api.openai.com)');
@@ -256,6 +264,14 @@ const wikiCommandImpl = async (inputPath, options) => {
256
264
  });
257
265
  console.log(` [${choice}] Codex CLI (local, uses your Codex login)`);
258
266
  }
267
+ if (hasOpenCode) {
268
+ const choice = String(nextChoice++);
269
+ localChoices.push({
270
+ choice,
271
+ provider: 'opencode',
272
+ });
273
+ console.log(` [${choice}] OpenCode CLI (local, uses your OpenCode login/config)`);
274
+ }
259
275
  console.log('');
260
276
  const maxChoice = String(nextChoice - 1);
261
277
  const choice = await prompt(` Select provider (1/${maxChoice}): `);
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * Uses snowflake-arctic-embed-xs by default (22M params, 384 dims, ~90MB)
8
8
  */
9
- import { type FeatureExtractionPipeline } from '@huggingface/transformers';
9
+ import type { FeatureExtractionPipeline } from '@huggingface/transformers';
10
10
  import { type EmbeddingConfig, type ModelProgress } from './types.js';
11
11
  /**
12
12
  * Progress callback type for model loading
@@ -12,7 +12,6 @@
12
12
  if (!process.env.ORT_LOG_LEVEL) {
13
13
  process.env.ORT_LOG_LEVEL = '3';
14
14
  }
15
- import { pipeline, env, } from '@huggingface/transformers';
16
15
  import { existsSync } from 'fs';
17
16
  import { execFileSync } from 'child_process';
18
17
  import { join, dirname } from 'path';
@@ -21,6 +20,7 @@ import { DEFAULT_EMBEDDING_CONFIG } from './types.js';
21
20
  import { isHttpMode, getHttpDimensions, httpEmbed } from './http-client.js';
22
21
  import { resolveEmbeddingConfig } from './config.js';
23
22
  import { applyHfEnvOverrides, isHfDownloadFailure, withHfDownloadRetry } from './hf-env.js';
23
+ import { getLocalEmbeddingRuntimeBlocker } from './runtime-support.js';
24
24
  import { logger } from '../logger.js';
25
25
  /**
26
26
  * Check whether the onnxruntime-node package that @huggingface/transformers
@@ -117,6 +117,16 @@ export const initEmbedder = async (onProgress, config = {}, forceDevice) => {
117
117
  throw new Error('initEmbedder() should not be called in HTTP mode. ' +
118
118
  'Use embedText()/embedBatch() which handle HTTP transparently.');
119
119
  }
120
+ // Fail fast on platforms where the bundled native ONNX Runtime binding is not
121
+ // shipped (macOS Intel, #1515). Must run before any transformers.js /
122
+ // onnxruntime-node import or resolution — otherwise the native module load
123
+ // crashes with a raw "Cannot find module ...onnxruntime_binding.node" that
124
+ // ONNX_WEB_BACKEND=wasm cannot rescue (#1516). HTTP mode was already handled
125
+ // above, so this only blocks the local-runtime path.
126
+ const runtimeBlocker = getLocalEmbeddingRuntimeBlocker();
127
+ if (runtimeBlocker) {
128
+ throw new Error(runtimeBlocker);
129
+ }
120
130
  // Return existing instance if available
121
131
  if (embedderInstance) {
122
132
  return embedderInstance;
@@ -135,6 +145,9 @@ export const initEmbedder = async (onProgress, config = {}, forceDevice) => {
135
145
  const requestedDevice = forceDevice || (finalConfig.device === 'auto' ? gpuDevice : finalConfig.device);
136
146
  initPromise = (async () => {
137
147
  try {
148
+ // Lazy-load transformers.js only after the runtime guard has passed, so
149
+ // unsupported platforms never reach the native ONNX import (#1515).
150
+ const { pipeline, env } = await import('@huggingface/transformers');
138
151
  // Configure transformers.js environment
139
152
  env.allowLocalModels = false;
140
153
  // Bridge user-controlled env vars to transformers.js: HF_HOME →
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Local embedding runtime support guard.
3
+ *
4
+ * The bundled local embedding stack (`@huggingface/transformers` →
5
+ * `onnxruntime-node`) only ships native ONNX Runtime bindings for a subset of
6
+ * platform/arch pairs. On macOS Intel (`darwin`/`x64`), `onnxruntime-node`
7
+ * ships no `bin/napi-v6/darwin/x64/onnxruntime_binding.node`, so *importing*
8
+ * transformers.js throws a raw `Cannot find module ...onnxruntime_binding.node`
9
+ * before any device/backend selection can run (#1515). `ONNX_WEB_BACKEND=wasm`
10
+ * cannot rescue this — the failure is at native-module import time, not backend
11
+ * selection (#1516).
12
+ *
13
+ * This module is intentionally free of any native or transformers.js import (at
14
+ * module scope or inside its functions) so it can be consulted *before* the
15
+ * dynamic import that would crash. HTTP embedding mode never touches the native
16
+ * runtime, so callers in HTTP mode must skip this guard.
17
+ */
18
+ export interface LocalEmbeddingRuntimeOptions {
19
+ platform?: NodeJS.Platform;
20
+ arch?: NodeJS.Architecture;
21
+ }
22
+ /**
23
+ * Return a human-readable explanation when the *local* embedding runtime cannot
24
+ * load on this platform, or `null` when local embeddings are expected to work.
25
+ *
26
+ * Only `darwin`/`x64` is blocked today: it is the one platform/arch pair where
27
+ * the bundled `onnxruntime-node` ships no native binding (#1515). Every other
28
+ * platform returns `null` and follows the normal device-probe path, so genuine
29
+ * ONNX failures on supported platforms are never masked by this message.
30
+ *
31
+ * Accepts an explicit `{ platform, arch }` for testing; defaults to the current
32
+ * process values.
33
+ */
34
+ export declare const getLocalEmbeddingRuntimeBlocker: (options?: LocalEmbeddingRuntimeOptions) => string | null;
35
+ /**
36
+ * True when `message` is the macOS-Intel local-embedding blocker produced by
37
+ * {@link getLocalEmbeddingRuntimeBlocker}. Lets the CLI surface a clean,
38
+ * actionable message instead of a raw stack trace, without coupling to the
39
+ * full wording.
40
+ */
41
+ export declare const isLocalEmbeddingRuntimeBlockerMessage: (message: string) => boolean;
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Local embedding runtime support guard.
3
+ *
4
+ * The bundled local embedding stack (`@huggingface/transformers` →
5
+ * `onnxruntime-node`) only ships native ONNX Runtime bindings for a subset of
6
+ * platform/arch pairs. On macOS Intel (`darwin`/`x64`), `onnxruntime-node`
7
+ * ships no `bin/napi-v6/darwin/x64/onnxruntime_binding.node`, so *importing*
8
+ * transformers.js throws a raw `Cannot find module ...onnxruntime_binding.node`
9
+ * before any device/backend selection can run (#1515). `ONNX_WEB_BACKEND=wasm`
10
+ * cannot rescue this — the failure is at native-module import time, not backend
11
+ * selection (#1516).
12
+ *
13
+ * This module is intentionally free of any native or transformers.js import (at
14
+ * module scope or inside its functions) so it can be consulted *before* the
15
+ * dynamic import that would crash. HTTP embedding mode never touches the native
16
+ * runtime, so callers in HTTP mode must skip this guard.
17
+ */
18
+ /**
19
+ * Stable lead line of the macOS-Intel blocker message. Also used to recognise
20
+ * the thrown error in the CLI error handler without coupling to the full
21
+ * wording (see {@link isLocalEmbeddingRuntimeBlockerMessage}).
22
+ */
23
+ const LOCAL_EMBEDDING_BLOCKER_LEAD = 'Local semantic embeddings are unavailable on macOS Intel (darwin/x64).';
24
+ /**
25
+ * Return a human-readable explanation when the *local* embedding runtime cannot
26
+ * load on this platform, or `null` when local embeddings are expected to work.
27
+ *
28
+ * Only `darwin`/`x64` is blocked today: it is the one platform/arch pair where
29
+ * the bundled `onnxruntime-node` ships no native binding (#1515). Every other
30
+ * platform returns `null` and follows the normal device-probe path, so genuine
31
+ * ONNX failures on supported platforms are never masked by this message.
32
+ *
33
+ * Accepts an explicit `{ platform, arch }` for testing; defaults to the current
34
+ * process values.
35
+ */
36
+ export const getLocalEmbeddingRuntimeBlocker = (options = {}) => {
37
+ const platform = options.platform ?? process.platform;
38
+ const arch = options.arch ?? process.arch;
39
+ if (platform === 'darwin' && arch === 'x64') {
40
+ return [
41
+ LOCAL_EMBEDDING_BLOCKER_LEAD,
42
+ 'The bundled ONNX Runtime package (onnxruntime-node) does not ship a',
43
+ 'darwin/x64 native binding, so the local embedding model cannot load here.',
44
+ 'ONNX_WEB_BACKEND=wasm does not help: the failure happens while importing',
45
+ 'the native runtime, before any backend can be selected. Forcing',
46
+ 'GITNEXUS_EMBEDDING_DEVICE=wasm (or cpu) does not help either, for the same reason.',
47
+ '',
48
+ 'Use one of these instead:',
49
+ ' - Run analyze without --embeddings (all other indexing still works).',
50
+ ' - Point GITNEXUS_EMBEDDING_URL (with GITNEXUS_EMBEDDING_MODEL) at an',
51
+ ' OpenAI-compatible /v1/embeddings endpoint to embed over HTTP.',
52
+ ' - Run GitNexus on Linux or in Docker, where the native binding ships.',
53
+ ' - Run GitNexus on Apple Silicon (darwin/arm64), which ships a binding.',
54
+ ' - Use a future GitNexus build that restores darwin/x64 ONNX support.',
55
+ ].join('\n');
56
+ }
57
+ return null;
58
+ };
59
+ /**
60
+ * True when `message` is the macOS-Intel local-embedding blocker produced by
61
+ * {@link getLocalEmbeddingRuntimeBlocker}. Lets the CLI surface a clean,
62
+ * actionable message instead of a raw stack trace, without coupling to the
63
+ * full wording.
64
+ */
65
+ export const isLocalEmbeddingRuntimeBlockerMessage = (message) => message.includes(LOCAL_EMBEDDING_BLOCKER_LEAD);
@@ -11,7 +11,8 @@ import { compilePatterns, runCompiledPatterns, } from '../tree-sitter-scanner.js
11
11
  *
12
12
  * The grammar is vendored in `vendor/tree-sitter-proto/` with
13
13
  * parser.c regenerated against tree-sitter-cli 0.24 (ABI version 14)
14
- * so it is compatible with the project's tree-sitter 0.25 runtime.
14
+ * so it is compatible with the project's tree-sitter 0.21.1 runtime
15
+ * (which loads ABI 13–14).
15
16
  */
16
17
  const _require = createRequire(import.meta.url);
17
18
  let ProtoGrammar = null;