gitnexus 1.4.7 → 1.4.9

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 (242) hide show
  1. package/README.md +29 -1
  2. package/dist/cli/ai-context.d.ts +1 -1
  3. package/dist/cli/ai-context.js +1 -1
  4. package/dist/cli/analyze.d.ts +2 -0
  5. package/dist/cli/analyze.js +54 -21
  6. package/dist/cli/index-repo.d.ts +15 -0
  7. package/dist/cli/index-repo.js +115 -0
  8. package/dist/cli/index.js +13 -3
  9. package/dist/cli/setup.js +90 -10
  10. package/dist/cli/wiki.d.ts +4 -0
  11. package/dist/cli/wiki.js +174 -53
  12. package/dist/config/supported-languages.d.ts +33 -1
  13. package/dist/config/supported-languages.js +32 -0
  14. package/dist/core/embeddings/embedder.d.ts +6 -1
  15. package/dist/core/embeddings/embedder.js +65 -5
  16. package/dist/core/embeddings/embedding-pipeline.js +11 -9
  17. package/dist/core/embeddings/http-client.d.ts +31 -0
  18. package/dist/core/embeddings/http-client.js +179 -0
  19. package/dist/core/embeddings/index.d.ts +1 -0
  20. package/dist/core/embeddings/index.js +1 -0
  21. package/dist/core/embeddings/types.d.ts +1 -1
  22. package/dist/core/graph/graph.js +9 -1
  23. package/dist/core/graph/types.d.ts +11 -2
  24. package/dist/core/ingestion/call-processor.d.ts +66 -2
  25. package/dist/core/ingestion/call-processor.js +650 -30
  26. package/dist/core/ingestion/call-routing.d.ts +9 -18
  27. package/dist/core/ingestion/call-routing.js +0 -19
  28. package/dist/core/ingestion/cobol/cobol-copy-expander.d.ts +57 -0
  29. package/dist/core/ingestion/cobol/cobol-copy-expander.js +385 -0
  30. package/dist/core/ingestion/cobol/cobol-preprocessor.d.ts +210 -0
  31. package/dist/core/ingestion/cobol/cobol-preprocessor.js +1509 -0
  32. package/dist/core/ingestion/cobol/jcl-parser.d.ts +68 -0
  33. package/dist/core/ingestion/cobol/jcl-parser.js +217 -0
  34. package/dist/core/ingestion/cobol/jcl-processor.d.ts +33 -0
  35. package/dist/core/ingestion/cobol/jcl-processor.js +229 -0
  36. package/dist/core/ingestion/cobol-processor.d.ts +54 -0
  37. package/dist/core/ingestion/cobol-processor.js +1186 -0
  38. package/dist/core/ingestion/entry-point-scoring.d.ts +17 -0
  39. package/dist/core/ingestion/entry-point-scoring.js +52 -28
  40. package/dist/core/ingestion/export-detection.d.ts +47 -8
  41. package/dist/core/ingestion/export-detection.js +29 -50
  42. package/dist/core/ingestion/field-extractor.d.ts +29 -0
  43. package/dist/core/ingestion/field-extractor.js +25 -0
  44. package/dist/core/ingestion/field-extractors/configs/c-cpp.d.ts +3 -0
  45. package/dist/core/ingestion/field-extractors/configs/c-cpp.js +108 -0
  46. package/dist/core/ingestion/field-extractors/configs/csharp.d.ts +8 -0
  47. package/dist/core/ingestion/field-extractors/configs/csharp.js +73 -0
  48. package/dist/core/ingestion/field-extractors/configs/dart.d.ts +8 -0
  49. package/dist/core/ingestion/field-extractors/configs/dart.js +76 -0
  50. package/dist/core/ingestion/field-extractors/configs/go.d.ts +11 -0
  51. package/dist/core/ingestion/field-extractors/configs/go.js +64 -0
  52. package/dist/core/ingestion/field-extractors/configs/helpers.d.ts +44 -0
  53. package/dist/core/ingestion/field-extractors/configs/helpers.js +134 -0
  54. package/dist/core/ingestion/field-extractors/configs/jvm.d.ts +3 -0
  55. package/dist/core/ingestion/field-extractors/configs/jvm.js +118 -0
  56. package/dist/core/ingestion/field-extractors/configs/php.d.ts +8 -0
  57. package/dist/core/ingestion/field-extractors/configs/php.js +67 -0
  58. package/dist/core/ingestion/field-extractors/configs/python.d.ts +12 -0
  59. package/dist/core/ingestion/field-extractors/configs/python.js +91 -0
  60. package/dist/core/ingestion/field-extractors/configs/ruby.d.ts +16 -0
  61. package/dist/core/ingestion/field-extractors/configs/ruby.js +75 -0
  62. package/dist/core/ingestion/field-extractors/configs/rust.d.ts +9 -0
  63. package/dist/core/ingestion/field-extractors/configs/rust.js +55 -0
  64. package/dist/core/ingestion/field-extractors/configs/swift.d.ts +8 -0
  65. package/dist/core/ingestion/field-extractors/configs/swift.js +63 -0
  66. package/dist/core/ingestion/field-extractors/configs/typescript-javascript.d.ts +3 -0
  67. package/dist/core/ingestion/field-extractors/configs/typescript-javascript.js +60 -0
  68. package/dist/core/ingestion/field-extractors/generic.d.ts +46 -0
  69. package/dist/core/ingestion/field-extractors/generic.js +111 -0
  70. package/dist/core/ingestion/field-extractors/typescript.d.ts +77 -0
  71. package/dist/core/ingestion/field-extractors/typescript.js +291 -0
  72. package/dist/core/ingestion/field-types.d.ts +59 -0
  73. package/dist/core/ingestion/field-types.js +2 -0
  74. package/dist/core/ingestion/framework-detection.d.ts +97 -2
  75. package/dist/core/ingestion/framework-detection.js +114 -14
  76. package/dist/core/ingestion/heritage-processor.js +62 -66
  77. package/dist/core/ingestion/import-processor.d.ts +9 -10
  78. package/dist/core/ingestion/import-processor.js +150 -196
  79. package/dist/core/ingestion/{resolvers → import-resolvers}/csharp.d.ts +6 -9
  80. package/dist/core/ingestion/{resolvers → import-resolvers}/csharp.js +20 -2
  81. package/dist/core/ingestion/import-resolvers/dart.d.ts +7 -0
  82. package/dist/core/ingestion/import-resolvers/dart.js +44 -0
  83. package/dist/core/ingestion/{resolvers → import-resolvers}/go.d.ts +4 -5
  84. package/dist/core/ingestion/{resolvers → import-resolvers}/go.js +17 -0
  85. package/dist/core/ingestion/{resolvers → import-resolvers}/jvm.d.ts +10 -1
  86. package/dist/core/ingestion/import-resolvers/jvm.js +159 -0
  87. package/dist/core/ingestion/import-resolvers/php.d.ts +25 -0
  88. package/dist/core/ingestion/import-resolvers/php.js +80 -0
  89. package/dist/core/ingestion/{resolvers → import-resolvers}/python.d.ts +9 -3
  90. package/dist/core/ingestion/{resolvers → import-resolvers}/python.js +35 -3
  91. package/dist/core/ingestion/{resolvers → import-resolvers}/ruby.d.ts +5 -2
  92. package/dist/core/ingestion/{resolvers → import-resolvers}/ruby.js +7 -2
  93. package/dist/core/ingestion/{resolvers → import-resolvers}/rust.d.ts +5 -2
  94. package/dist/core/ingestion/{resolvers → import-resolvers}/rust.js +41 -2
  95. package/dist/core/ingestion/{resolvers → import-resolvers}/standard.d.ts +15 -7
  96. package/dist/core/ingestion/{resolvers → import-resolvers}/standard.js +22 -3
  97. package/dist/core/ingestion/import-resolvers/swift.d.ts +7 -0
  98. package/dist/core/ingestion/import-resolvers/swift.js +23 -0
  99. package/dist/core/ingestion/import-resolvers/types.d.ts +44 -0
  100. package/dist/core/ingestion/import-resolvers/types.js +6 -0
  101. package/dist/core/ingestion/{resolvers → import-resolvers}/utils.d.ts +2 -0
  102. package/dist/core/ingestion/{resolvers → import-resolvers}/utils.js +7 -0
  103. package/dist/core/ingestion/language-config.d.ts +6 -0
  104. package/dist/core/ingestion/language-config.js +13 -0
  105. package/dist/core/ingestion/language-provider.d.ts +121 -0
  106. package/dist/core/ingestion/language-provider.js +24 -0
  107. package/dist/core/ingestion/languages/c-cpp.d.ts +12 -0
  108. package/dist/core/ingestion/languages/c-cpp.js +71 -0
  109. package/dist/core/ingestion/languages/cobol.d.ts +1 -0
  110. package/dist/core/ingestion/languages/cobol.js +26 -0
  111. package/dist/core/ingestion/languages/csharp.d.ts +8 -0
  112. package/dist/core/ingestion/languages/csharp.js +49 -0
  113. package/dist/core/ingestion/languages/dart.d.ts +12 -0
  114. package/dist/core/ingestion/languages/dart.js +58 -0
  115. package/dist/core/ingestion/languages/go.d.ts +11 -0
  116. package/dist/core/ingestion/languages/go.js +28 -0
  117. package/dist/core/ingestion/languages/index.d.ts +38 -0
  118. package/dist/core/ingestion/languages/index.js +63 -0
  119. package/dist/core/ingestion/languages/java.d.ts +9 -0
  120. package/dist/core/ingestion/languages/java.js +29 -0
  121. package/dist/core/ingestion/languages/kotlin.d.ts +9 -0
  122. package/dist/core/ingestion/languages/kotlin.js +53 -0
  123. package/dist/core/ingestion/languages/php.d.ts +8 -0
  124. package/dist/core/ingestion/languages/php.js +145 -0
  125. package/dist/core/ingestion/languages/python.d.ts +12 -0
  126. package/dist/core/ingestion/languages/python.js +39 -0
  127. package/dist/core/ingestion/languages/ruby.d.ts +9 -0
  128. package/dist/core/ingestion/languages/ruby.js +44 -0
  129. package/dist/core/ingestion/languages/rust.d.ts +12 -0
  130. package/dist/core/ingestion/languages/rust.js +44 -0
  131. package/dist/core/ingestion/languages/swift.d.ts +12 -0
  132. package/dist/core/ingestion/languages/swift.js +133 -0
  133. package/dist/core/ingestion/languages/typescript.d.ts +10 -0
  134. package/dist/core/ingestion/languages/typescript.js +60 -0
  135. package/dist/core/ingestion/markdown-processor.d.ts +17 -0
  136. package/dist/core/ingestion/markdown-processor.js +124 -0
  137. package/dist/core/ingestion/mro-processor.js +22 -18
  138. package/dist/core/ingestion/named-binding-processor.d.ts +18 -0
  139. package/dist/core/ingestion/named-binding-processor.js +42 -0
  140. package/dist/core/ingestion/named-bindings/csharp.d.ts +3 -0
  141. package/dist/core/ingestion/named-bindings/csharp.js +37 -0
  142. package/dist/core/ingestion/named-bindings/java.d.ts +3 -0
  143. package/dist/core/ingestion/named-bindings/java.js +29 -0
  144. package/dist/core/ingestion/named-bindings/kotlin.d.ts +3 -0
  145. package/dist/core/ingestion/named-bindings/kotlin.js +36 -0
  146. package/dist/core/ingestion/named-bindings/php.d.ts +3 -0
  147. package/dist/core/ingestion/named-bindings/php.js +61 -0
  148. package/dist/core/ingestion/named-bindings/python.d.ts +3 -0
  149. package/dist/core/ingestion/named-bindings/python.js +49 -0
  150. package/dist/core/ingestion/named-bindings/rust.d.ts +3 -0
  151. package/dist/core/ingestion/named-bindings/rust.js +64 -0
  152. package/dist/core/ingestion/named-bindings/types.d.ts +16 -0
  153. package/dist/core/ingestion/named-bindings/types.js +6 -0
  154. package/dist/core/ingestion/named-bindings/typescript.d.ts +3 -0
  155. package/dist/core/ingestion/named-bindings/typescript.js +58 -0
  156. package/dist/core/ingestion/parsing-processor.d.ts +6 -2
  157. package/dist/core/ingestion/parsing-processor.js +125 -85
  158. package/dist/core/ingestion/pipeline.d.ts +10 -0
  159. package/dist/core/ingestion/pipeline.js +1235 -317
  160. package/dist/core/ingestion/resolution-context.d.ts +5 -0
  161. package/dist/core/ingestion/resolution-context.js +8 -5
  162. package/dist/core/ingestion/route-extractors/expo.d.ts +1 -0
  163. package/dist/core/ingestion/route-extractors/expo.js +36 -0
  164. package/dist/core/ingestion/route-extractors/middleware.d.ts +47 -0
  165. package/dist/core/ingestion/route-extractors/middleware.js +143 -0
  166. package/dist/core/ingestion/route-extractors/nextjs.d.ts +3 -0
  167. package/dist/core/ingestion/route-extractors/nextjs.js +76 -0
  168. package/dist/core/ingestion/route-extractors/php.d.ts +7 -0
  169. package/dist/core/ingestion/route-extractors/php.js +21 -0
  170. package/dist/core/ingestion/route-extractors/response-shapes.d.ts +20 -0
  171. package/dist/core/ingestion/route-extractors/response-shapes.js +290 -0
  172. package/dist/core/ingestion/symbol-table.d.ts +16 -0
  173. package/dist/core/ingestion/symbol-table.js +20 -6
  174. package/dist/core/ingestion/tree-sitter-queries.d.ts +10 -9
  175. package/dist/core/ingestion/tree-sitter-queries.js +274 -11
  176. package/dist/core/ingestion/type-env.d.ts +42 -18
  177. package/dist/core/ingestion/type-env.js +481 -106
  178. package/dist/core/ingestion/type-extractors/c-cpp.d.ts +5 -0
  179. package/dist/core/ingestion/type-extractors/c-cpp.js +119 -0
  180. package/dist/core/ingestion/type-extractors/csharp.js +149 -16
  181. package/dist/core/ingestion/type-extractors/dart.d.ts +15 -0
  182. package/dist/core/ingestion/type-extractors/dart.js +371 -0
  183. package/dist/core/ingestion/type-extractors/jvm.js +169 -66
  184. package/dist/core/ingestion/type-extractors/rust.js +35 -1
  185. package/dist/core/ingestion/type-extractors/shared.d.ts +1 -15
  186. package/dist/core/ingestion/type-extractors/shared.js +14 -112
  187. package/dist/core/ingestion/type-extractors/swift.js +338 -7
  188. package/dist/core/ingestion/type-extractors/types.d.ts +40 -8
  189. package/dist/core/ingestion/type-extractors/typescript.js +141 -9
  190. package/dist/core/ingestion/utils/ast-helpers.d.ts +83 -0
  191. package/dist/core/ingestion/utils/ast-helpers.js +817 -0
  192. package/dist/core/ingestion/utils/call-analysis.d.ts +73 -0
  193. package/dist/core/ingestion/utils/call-analysis.js +527 -0
  194. package/dist/core/ingestion/utils/event-loop.d.ts +5 -0
  195. package/dist/core/ingestion/utils/event-loop.js +5 -0
  196. package/dist/core/ingestion/utils/language-detection.d.ts +9 -0
  197. package/dist/core/ingestion/utils/language-detection.js +70 -0
  198. package/dist/core/ingestion/utils/verbose.d.ts +1 -0
  199. package/dist/core/ingestion/utils/verbose.js +7 -0
  200. package/dist/core/ingestion/workers/parse-worker.d.ts +55 -5
  201. package/dist/core/ingestion/workers/parse-worker.js +415 -225
  202. package/dist/core/lbug/csv-generator.js +51 -1
  203. package/dist/core/lbug/lbug-adapter.d.ts +10 -0
  204. package/dist/core/lbug/lbug-adapter.js +75 -4
  205. package/dist/core/lbug/schema.d.ts +8 -4
  206. package/dist/core/lbug/schema.js +65 -4
  207. package/dist/core/tree-sitter/parser-loader.js +7 -1
  208. package/dist/core/wiki/cursor-client.d.ts +31 -0
  209. package/dist/core/wiki/cursor-client.js +127 -0
  210. package/dist/core/wiki/generator.d.ts +28 -9
  211. package/dist/core/wiki/generator.js +115 -18
  212. package/dist/core/wiki/graph-queries.d.ts +4 -0
  213. package/dist/core/wiki/graph-queries.js +7 -1
  214. package/dist/core/wiki/llm-client.d.ts +2 -0
  215. package/dist/core/wiki/llm-client.js +8 -4
  216. package/dist/core/wiki/prompts.d.ts +3 -3
  217. package/dist/core/wiki/prompts.js +6 -0
  218. package/dist/mcp/core/embedder.js +11 -3
  219. package/dist/mcp/core/lbug-adapter.d.ts +5 -0
  220. package/dist/mcp/core/lbug-adapter.js +23 -2
  221. package/dist/mcp/local/local-backend.d.ts +38 -5
  222. package/dist/mcp/local/local-backend.js +804 -63
  223. package/dist/mcp/resources.js +2 -0
  224. package/dist/mcp/tools.js +73 -4
  225. package/dist/server/api.d.ts +19 -1
  226. package/dist/server/api.js +66 -6
  227. package/dist/storage/git.d.ts +12 -0
  228. package/dist/storage/git.js +21 -0
  229. package/dist/storage/repo-manager.d.ts +3 -0
  230. package/package.json +25 -16
  231. package/dist/core/ingestion/named-binding-extraction.d.ts +0 -61
  232. package/dist/core/ingestion/named-binding-extraction.js +0 -363
  233. package/dist/core/ingestion/resolvers/index.d.ts +0 -18
  234. package/dist/core/ingestion/resolvers/index.js +0 -13
  235. package/dist/core/ingestion/resolvers/jvm.js +0 -87
  236. package/dist/core/ingestion/resolvers/php.d.ts +0 -15
  237. package/dist/core/ingestion/resolvers/php.js +0 -35
  238. package/dist/core/ingestion/type-extractors/index.d.ts +0 -22
  239. package/dist/core/ingestion/type-extractors/index.js +0 -31
  240. package/dist/core/ingestion/utils.d.ts +0 -138
  241. package/dist/core/ingestion/utils.js +0 -1290
  242. package/scripts/patch-tree-sitter-swift.cjs +0 -74
@@ -277,6 +277,8 @@ node_properties:
277
277
  Function: "parameterCount (INT32), returnType (STRING), isVariadic (BOOL)"
278
278
  Property: "declaredType (STRING) — the field's type annotation (e.g., 'Address', 'City'). Used for field-access chain resolution."
279
279
  Constructor: "parameterCount (INT32)"
280
+ Community: "heuristicLabel (STRING), cohesion (DOUBLE), symbolCount (INT32), keywords (STRING[]), description (STRING), enrichedBy (STRING)"
281
+ Process: "heuristicLabel (STRING), processType (STRING — 'intra_community' or 'cross_community'), stepCount (INT32), communities (STRING[]), entryPointId (STRING), terminalId (STRING)"
280
282
 
281
283
  relationships:
282
284
  - CONTAINS: File/Folder contains child
package/dist/mcp/tools.js CHANGED
@@ -58,10 +58,10 @@ WHEN TO USE: Complex structural queries that search/explore can't answer. READ g
58
58
  AFTER THIS: Use context() on result symbols for deeper context.
59
59
 
60
60
  SCHEMA:
61
- - Nodes: File, Folder, Function, Class, Interface, Method, CodeElement, Community, Process
61
+ - Nodes: File, Folder, Function, Class, Interface, Method, CodeElement, Community, Process, Route, Tool
62
62
  - Multi-language nodes (use backticks): \`Struct\`, \`Enum\`, \`Trait\`, \`Impl\`, etc.
63
63
  - All edges via single CodeRelation table with 'type' property
64
- - Edge types: CONTAINS, DEFINES, CALLS, IMPORTS, EXTENDS, IMPLEMENTS, HAS_METHOD, HAS_PROPERTY, ACCESSES, OVERRIDES, MEMBER_OF, STEP_IN_PROCESS
64
+ - Edge types: CONTAINS, DEFINES, CALLS, IMPORTS, EXTENDS, IMPLEMENTS, HAS_METHOD, HAS_PROPERTY, ACCESSES, OVERRIDES, MEMBER_OF, STEP_IN_PROCESS, HANDLES_ROUTE, FETCHES, HANDLES_TOOL, ENTRY_POINT_OF
65
65
  - Edge properties: type (STRING), confidence (DOUBLE), reason (STRING), step (INT32)
66
66
 
67
67
  EXAMPLES:
@@ -93,8 +93,8 @@ OUTPUT: Returns { markdown, row_count } — results formatted as a Markdown tabl
93
93
 
94
94
  TIPS:
95
95
  - All relationships use single CodeRelation table — filter with {type: 'CALLS'} etc.
96
- - Community = auto-detected functional area (Leiden algorithm)
97
- - Process = execution flow trace from entry point to terminal
96
+ - Community = auto-detected functional area (Leiden algorithm). Properties: heuristicLabel, cohesion, symbolCount, keywords, description, enrichedBy
97
+ - Process = execution flow trace from entry point to terminal. Properties: heuristicLabel, processType, stepCount, communities, entryPointId, terminalId
98
98
  - Use heuristicLabel (not label) for human-readable community/process names`,
99
99
  inputSchema: {
100
100
  type: 'object',
@@ -209,4 +209,73 @@ Confidence: 1.0 = certain, <0.8 = fuzzy match`,
209
209
  required: ['target', 'direction'],
210
210
  },
211
211
  },
212
+ {
213
+ name: 'route_map',
214
+ description: `Show API route mappings: which components/hooks fetch which API endpoints, and which handler files serve them.
215
+
216
+ WHEN TO USE: Understanding API consumption patterns, finding orphaned routes. For pre-change analysis, prefer \`api_impact\` which combines this data with mismatch detection and risk assessment.
217
+ AFTER THIS: Use impact() on specific route handlers to see full blast radius.
218
+
219
+ Returns: route nodes with their handlers, middleware wrapper chains (e.g., withAuth, withRateLimit), and consumers.`,
220
+ inputSchema: {
221
+ type: 'object',
222
+ properties: {
223
+ route: { type: 'string', description: 'Filter by route path (e.g., "/api/grants"). Omit for all routes.' },
224
+ repo: { type: 'string', description: 'Repository name or path. Omit if only one repo is indexed.' },
225
+ },
226
+ required: [],
227
+ },
228
+ },
229
+ {
230
+ name: 'tool_map',
231
+ description: `Show MCP/RPC tool definitions: which tools are defined, where they're handled, and their descriptions.
232
+
233
+ WHEN TO USE: Understanding tool APIs, finding tool implementations, impact analysis for tool changes.
234
+
235
+ Returns: tool nodes with their handler files and descriptions.`,
236
+ inputSchema: {
237
+ type: 'object',
238
+ properties: {
239
+ tool: { type: 'string', description: 'Filter by tool name. Omit for all tools.' },
240
+ repo: { type: 'string', description: 'Repository name or path.' },
241
+ },
242
+ required: [],
243
+ },
244
+ },
245
+ {
246
+ name: 'shape_check',
247
+ description: `Check response shapes for API routes against their consumers' property accesses.
248
+
249
+ WHEN TO USE: Detecting mismatches between what an API route returns and what consumers expect. Finding shape drift. For pre-change analysis, prefer \`api_impact\` which combines this data with mismatch detection and risk assessment.
250
+ REQUIRES: Route nodes with responseKeys (extracted from .json({...}) calls during indexing).
251
+
252
+ Returns routes that have both detected response keys AND consumers. Shows top-level keys each endpoint returns (e.g., data, pagination, error) and what keys each consumer accesses. Reports MISMATCH status when a consumer accesses keys not present in the route's response shape.`,
253
+ inputSchema: {
254
+ type: 'object',
255
+ properties: {
256
+ route: { type: 'string', description: 'Check a specific route (e.g., "/api/grants"). Omit to check all routes.' },
257
+ repo: { type: 'string', description: 'Repository name or path. Omit if only one repo is indexed.' },
258
+ },
259
+ required: [],
260
+ },
261
+ },
262
+ {
263
+ name: 'api_impact',
264
+ description: `Pre-change impact report for an API route handler.
265
+
266
+ WHEN TO USE: BEFORE modifying any API route handler. Shows what consumers depend on, what response fields they access, what middleware protects the route, and what execution flows it triggers. Requires at least "route" or "file" parameter.
267
+
268
+ Risk levels: LOW (0-3 consumers), MEDIUM (4-9 or any mismatches), HIGH (10+ consumers or mismatches with 4+ consumers). Mismatches with confidence "low" indicate the consumer file fetches multiple routes — property attribution is approximate.
269
+
270
+ Returns: single route object when one match, or { routes: [...], total: N } for multiple matches. Combines route_map, shape_check, and impact data.`,
271
+ inputSchema: {
272
+ type: 'object',
273
+ properties: {
274
+ route: { type: 'string', description: 'Route path (e.g., "/api/grants")' },
275
+ file: { type: 'string', description: 'Handler file path (alternative to route)' },
276
+ repo: { type: 'string', description: 'Repository name or path.' },
277
+ },
278
+ required: [],
279
+ },
280
+ },
212
281
  ];
@@ -5,6 +5,24 @@
5
5
  * Also hosts the MCP server over StreamableHTTP for remote AI tool access.
6
6
  *
7
7
  * Security: binds to 127.0.0.1 by default (use --host to override).
8
- * CORS is restricted to localhost and the deployed site.
8
+ * CORS is restricted to localhost, private/LAN networks, and the deployed site.
9
9
  */
10
+ /**
11
+ * Determine whether an HTTP Origin header value is allowed by CORS policy.
12
+ *
13
+ * Permitted origins:
14
+ * - No origin (non-browser requests such as curl or server-to-server calls)
15
+ * - http://localhost:<port> — local development
16
+ * - http://127.0.0.1:<port> — loopback alias
17
+ * - RFC 1918 private/LAN networks (any port):
18
+ * 10.0.0.0/8 → 10.x.x.x
19
+ * 172.16.0.0/12 → 172.16.x.x – 172.31.x.x
20
+ * 192.168.0.0/16 → 192.168.x.x
21
+ * - https://gitnexus.vercel.app — the deployed GitNexus web UI
22
+ *
23
+ * @param origin - The value of the HTTP `Origin` request header, or `undefined`
24
+ * when the header is absent (non-browser request).
25
+ * @returns `true` if the origin is allowed, `false` otherwise.
26
+ */
27
+ export declare const isAllowedOrigin: (origin: string | undefined) => boolean;
10
28
  export declare const createServer: (port: number, host?: string) => Promise<void>;
@@ -5,7 +5,7 @@
5
5
  * Also hosts the MCP server over StreamableHTTP for remote AI tool access.
6
6
  *
7
7
  * Security: binds to 127.0.0.1 by default (use --host to override).
8
- * CORS is restricted to localhost and the deployed site.
8
+ * CORS is restricted to localhost, private/LAN networks, and the deployed site.
9
9
  */
10
10
  import express from 'express';
11
11
  import cors from 'cors';
@@ -20,6 +20,69 @@ import { hybridSearch } from '../core/search/hybrid-search.js';
20
20
  // at server startup — crashes on unsupported Node ABI versions (#89)
21
21
  import { LocalBackend } from '../mcp/local/local-backend.js';
22
22
  import { mountMCPEndpoints } from './mcp-http.js';
23
+ /**
24
+ * Determine whether an HTTP Origin header value is allowed by CORS policy.
25
+ *
26
+ * Permitted origins:
27
+ * - No origin (non-browser requests such as curl or server-to-server calls)
28
+ * - http://localhost:<port> — local development
29
+ * - http://127.0.0.1:<port> — loopback alias
30
+ * - RFC 1918 private/LAN networks (any port):
31
+ * 10.0.0.0/8 → 10.x.x.x
32
+ * 172.16.0.0/12 → 172.16.x.x – 172.31.x.x
33
+ * 192.168.0.0/16 → 192.168.x.x
34
+ * - https://gitnexus.vercel.app — the deployed GitNexus web UI
35
+ *
36
+ * @param origin - The value of the HTTP `Origin` request header, or `undefined`
37
+ * when the header is absent (non-browser request).
38
+ * @returns `true` if the origin is allowed, `false` otherwise.
39
+ */
40
+ export const isAllowedOrigin = (origin) => {
41
+ if (origin === undefined) {
42
+ // Non-browser requests (curl, server-to-server) have no Origin header
43
+ return true;
44
+ }
45
+ if (origin.startsWith('http://localhost:')
46
+ || origin === 'http://localhost'
47
+ || origin.startsWith('http://127.0.0.1:')
48
+ || origin === 'http://127.0.0.1'
49
+ || origin.startsWith('http://[::1]:')
50
+ || origin === 'http://[::1]'
51
+ || origin === 'https://gitnexus.vercel.app') {
52
+ return true;
53
+ }
54
+ // RFC 1918 private network ranges — allow any port on these hosts.
55
+ // We parse the hostname out of the origin URL and check against each range.
56
+ let hostname;
57
+ let protocol;
58
+ try {
59
+ const parsed = new URL(origin);
60
+ hostname = parsed.hostname;
61
+ protocol = parsed.protocol;
62
+ }
63
+ catch {
64
+ // Malformed origin — reject
65
+ return false;
66
+ }
67
+ // Only allow HTTP(S) origins — reject ftp://, file://, etc.
68
+ if (protocol !== 'http:' && protocol !== 'https:')
69
+ return false;
70
+ const octets = hostname.split('.').map(Number);
71
+ if (octets.length !== 4 || octets.some(o => !Number.isInteger(o) || o < 0 || o > 255)) {
72
+ return false;
73
+ }
74
+ const [a, b] = octets;
75
+ // 10.0.0.0/8
76
+ if (a === 10)
77
+ return true;
78
+ // 172.16.0.0/12 → 172.16.x.x – 172.31.x.x
79
+ if (a === 172 && b >= 16 && b <= 31)
80
+ return true;
81
+ // 192.168.0.0/16
82
+ if (a === 192 && b === 168)
83
+ return true;
84
+ return false;
85
+ };
23
86
  const buildGraph = async () => {
24
87
  const nodes = [];
25
88
  for (const table of NODE_TABLES) {
@@ -101,14 +164,11 @@ const requestedRepo = (req) => {
101
164
  };
102
165
  export const createServer = async (port, host = '127.0.0.1') => {
103
166
  const app = express();
104
- // CORS: only allow localhost origins and the deployed site.
167
+ // CORS: allow localhost, private/LAN networks, and the deployed site.
105
168
  // Non-browser requests (curl, server-to-server) have no origin and are allowed.
106
169
  app.use(cors({
107
170
  origin: (origin, callback) => {
108
- if (!origin
109
- || origin.startsWith('http://localhost:')
110
- || origin.startsWith('http://127.0.0.1:')
111
- || origin === 'https://gitnexus.vercel.app') {
171
+ if (isAllowedOrigin(origin)) {
112
172
  callback(null, true);
113
173
  }
114
174
  else {
@@ -4,3 +4,15 @@ export declare const getCurrentCommit: (repoPath: string) => string;
4
4
  * Find the git repository root from any path inside the repo
5
5
  */
6
6
  export declare const getGitRoot: (fromPath: string) => string | null;
7
+ /**
8
+ * Check whether a directory contains a .git entry (file or folder).
9
+ *
10
+ * This is intentionally a simple filesystem check rather than running
11
+ * `git rev-parse`, so it works even when git is not installed or when
12
+ * the directory is a git-worktree root (which has a .git file, not a
13
+ * directory). Use `isGitRepo` for a definitive git answer.
14
+ *
15
+ * @param dirPath - Absolute path to the directory to inspect.
16
+ * @returns `true` when `.git` is present, `false` otherwise.
17
+ */
18
+ export declare const hasGitDir: (dirPath: string) => boolean;
@@ -1,4 +1,5 @@
1
1
  import { execSync } from 'child_process';
2
+ import { statSync } from 'fs';
2
3
  import path from 'path';
3
4
  // Git utilities for repository detection, commit tracking, and diff analysis
4
5
  export const isGitRepo = (repoPath) => {
@@ -33,3 +34,23 @@ export const getGitRoot = (fromPath) => {
33
34
  return null;
34
35
  }
35
36
  };
37
+ /**
38
+ * Check whether a directory contains a .git entry (file or folder).
39
+ *
40
+ * This is intentionally a simple filesystem check rather than running
41
+ * `git rev-parse`, so it works even when git is not installed or when
42
+ * the directory is a git-worktree root (which has a .git file, not a
43
+ * directory). Use `isGitRepo` for a definitive git answer.
44
+ *
45
+ * @param dirPath - Absolute path to the directory to inspect.
46
+ * @returns `true` when `.git` is present, `false` otherwise.
47
+ */
48
+ export const hasGitDir = (dirPath) => {
49
+ try {
50
+ statSync(path.join(dirPath, '.git'));
51
+ return true;
52
+ }
53
+ catch {
54
+ return false;
55
+ }
56
+ };
@@ -119,10 +119,13 @@ export declare const unregisterRepo: (repoPath: string) => Promise<void>;
119
119
  export declare const listRegisteredRepos: (opts?: {
120
120
  validate?: boolean;
121
121
  }) => Promise<RegistryEntry[]>;
122
+ export type LLMProvider = 'openai' | 'cursor';
122
123
  export interface CLIConfig {
123
124
  apiKey?: string;
124
125
  model?: string;
125
126
  baseUrl?: string;
127
+ provider?: LLMProvider;
128
+ cursorModel?: string;
126
129
  }
127
130
  /**
128
131
  * Get the path to the global CLI config file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gitnexus",
3
- "version": "1.4.7",
3
+ "version": "1.4.9",
4
4
  "description": "Graph-powered code intelligence for AI agents. Index any codebase, query via MCP or CLI.",
5
5
  "author": "Abhigyan Patwari",
6
6
  "license": "PolyForm-Noncommercial-1.0.0",
@@ -20,6 +20,7 @@
20
20
  "knowledge-graph",
21
21
  "cursor",
22
22
  "claude",
23
+ "codex",
23
24
  "ai-agent",
24
25
  "gitnexus",
25
26
  "static-analysis",
@@ -45,11 +46,11 @@
45
46
  "test:watch": "vitest",
46
47
  "test:coverage": "vitest run --coverage",
47
48
  "prepare": "npm run build",
48
- "postinstall": "node scripts/patch-tree-sitter-swift.cjs",
49
49
  "prepack": "npm run build && chmod +x dist/cli/index.js"
50
50
  },
51
51
  "dependencies": {
52
52
  "@huggingface/transformers": "^3.0.0",
53
+ "@ladybugdb/core": "^0.15.2",
53
54
  "@modelcontextprotocol/sdk": "^1.0.0",
54
55
  "cli-progress": "^3.12.0",
55
56
  "commander": "^12.0.0",
@@ -59,28 +60,29 @@
59
60
  "graphology": "^0.25.4",
60
61
  "graphology-indices": "^0.17.0",
61
62
  "graphology-utils": "^2.3.0",
62
- "@ladybugdb/core": "^0.15.2",
63
63
  "ignore": "^7.0.5",
64
64
  "lru-cache": "^11.0.0",
65
65
  "mnemonist": "^0.39.0",
66
+ "onnxruntime-node": "^1.24.0",
66
67
  "pandemonium": "^2.4.0",
67
- "tree-sitter": "^0.21.0",
68
- "tree-sitter-c": "^0.21.0",
69
- "tree-sitter-c-sharp": "^0.21.0",
70
- "tree-sitter-cpp": "^0.22.0",
71
- "tree-sitter-go": "^0.21.0",
72
- "tree-sitter-java": "^0.21.0",
73
- "tree-sitter-javascript": "^0.21.0",
74
- "tree-sitter-php": "^0.23.12",
75
- "tree-sitter-python": "^0.21.0",
68
+ "tree-sitter": "^0.25.0",
69
+ "tree-sitter-c": "^0.24.1",
70
+ "tree-sitter-c-sharp": "^0.23.1",
71
+ "tree-sitter-cpp": "^0.23.4",
72
+ "tree-sitter-go": "^0.25.0",
73
+ "tree-sitter-java": "^0.23.5",
74
+ "tree-sitter-javascript": "^0.25.0",
75
+ "tree-sitter-php": "^0.24.2",
76
+ "tree-sitter-python": "^0.25.0",
76
77
  "tree-sitter-ruby": "^0.23.1",
77
- "tree-sitter-rust": "^0.21.0",
78
- "tree-sitter-typescript": "^0.21.0",
78
+ "tree-sitter-rust": "^0.24.0",
79
+ "tree-sitter-typescript": "^0.23.2",
79
80
  "uuid": "^13.0.0"
80
81
  },
81
82
  "optionalDependencies": {
83
+ "tree-sitter-dart": "github:UserNobody14/tree-sitter-dart#0fc19c3a57b1109802af41d2b8f60d8835c5da3a",
82
84
  "tree-sitter-kotlin": "^0.3.8",
83
- "tree-sitter-swift": "^0.6.0"
85
+ "tree-sitter-swift": "0.7.1"
84
86
  },
85
87
  "devDependencies": {
86
88
  "@types/cli-progress": "^3.11.6",
@@ -89,11 +91,18 @@
89
91
  "@types/node": "^20.0.0",
90
92
  "@types/uuid": "^10.0.0",
91
93
  "@vitest/coverage-v8": "^4.0.18",
94
+ "husky": "^9.1.7",
92
95
  "tsx": "^4.0.0",
93
96
  "typescript": "^5.4.5",
94
97
  "vitest": "^4.0.18"
95
98
  },
99
+ "overrides": {
100
+ "@huggingface/transformers": {
101
+ "onnxruntime-node": "$onnxruntime-node"
102
+ },
103
+ "tree-sitter": "^0.25.0"
104
+ },
96
105
  "engines": {
97
- "node": ">=18.0.0"
106
+ "node": ">=20.0.0"
98
107
  }
99
108
  }
@@ -1,61 +0,0 @@
1
- import { SupportedLanguages } from '../../config/supported-languages.js';
2
- import type { SymbolTable, SymbolDefinition } from './symbol-table.js';
3
- import type { NamedImportMap } from './import-processor.js';
4
- /**
5
- * Walk a named-binding re-export chain through NamedImportMap.
6
- *
7
- * When file A imports { User } from B, and B re-exports { User } from C,
8
- * the NamedImportMap for A points to B, but B has no User definition.
9
- * This function follows the chain: A→B→C until a definition is found.
10
- *
11
- * Returns the definitions found at the end of the chain, or null if the
12
- * chain breaks (missing binding, circular reference, or depth exceeded).
13
- * Max depth 5 to prevent infinite loops.
14
- *
15
- * @param allDefs Pre-computed `symbolTable.lookupFuzzy(name)` result — must be the
16
- * complete unfiltered result. Passing a file-filtered subset will cause
17
- * silent misses at depth=0 for non-aliased bindings.
18
- */
19
- export declare function walkBindingChain(name: string, currentFilePath: string, symbolTable: SymbolTable, namedImportMap: NamedImportMap, allDefs: SymbolDefinition[]): SymbolDefinition[] | null;
20
- /**
21
- * Extract named bindings from an import AST node.
22
- * Returns undefined if the import is not a named import (e.g., import * or default).
23
- *
24
- * TS: import { User, Repo as R } from './models'
25
- * → [{local:'User', exported:'User'}, {local:'R', exported:'Repo'}]
26
- *
27
- * Python: from models import User, Repo as R
28
- * → [{local:'User', exported:'User'}, {local:'R', exported:'Repo'}]
29
- */
30
- export declare function extractNamedBindings(importNode: any, language: SupportedLanguages): {
31
- local: string;
32
- exported: string;
33
- }[] | undefined;
34
- export declare function extractTsNamedBindings(importNode: any): {
35
- local: string;
36
- exported: string;
37
- }[] | undefined;
38
- export declare function extractPythonNamedBindings(importNode: any): {
39
- local: string;
40
- exported: string;
41
- }[] | undefined;
42
- export declare function extractKotlinNamedBindings(importNode: any): {
43
- local: string;
44
- exported: string;
45
- }[] | undefined;
46
- export declare function extractRustNamedBindings(importNode: any): {
47
- local: string;
48
- exported: string;
49
- }[] | undefined;
50
- export declare function extractPhpNamedBindings(importNode: any): {
51
- local: string;
52
- exported: string;
53
- }[] | undefined;
54
- export declare function extractCsharpNamedBindings(importNode: any): {
55
- local: string;
56
- exported: string;
57
- }[] | undefined;
58
- export declare function extractJavaNamedBindings(importNode: any): {
59
- local: string;
60
- exported: string;
61
- }[] | undefined;