homegraph 1.0.0 → 1.1.2

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 (669) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +243 -0
  3. package/dist/bin/fatal-handler.d.ts +20 -0
  4. package/dist/bin/fatal-handler.d.ts.map +1 -0
  5. package/dist/bin/fatal-handler.js +118 -0
  6. package/dist/bin/fatal-handler.js.map +1 -0
  7. package/dist/bin/homegraph.d.ts +26 -0
  8. package/dist/bin/homegraph.d.ts.map +1 -0
  9. package/dist/bin/homegraph.js +1995 -0
  10. package/dist/bin/homegraph.js.map +1 -0
  11. package/dist/bin/node-version-check.d.ts +37 -0
  12. package/dist/bin/node-version-check.d.ts.map +1 -0
  13. package/dist/bin/node-version-check.js +79 -0
  14. package/dist/bin/node-version-check.js.map +1 -0
  15. package/dist/bin/uninstall.d.ts +14 -0
  16. package/dist/bin/uninstall.d.ts.map +1 -0
  17. package/dist/bin/uninstall.js +36 -0
  18. package/dist/bin/uninstall.js.map +1 -0
  19. package/dist/context/formatter.d.ts +30 -0
  20. package/dist/context/formatter.d.ts.map +1 -0
  21. package/dist/context/formatter.js +263 -0
  22. package/dist/context/formatter.js.map +1 -0
  23. package/dist/context/index.d.ts +119 -0
  24. package/dist/context/index.d.ts.map +1 -0
  25. package/dist/context/index.js +1296 -0
  26. package/dist/context/index.js.map +1 -0
  27. package/dist/context/markers.d.ts +19 -0
  28. package/dist/context/markers.d.ts.map +1 -0
  29. package/dist/context/markers.js +22 -0
  30. package/dist/context/markers.js.map +1 -0
  31. package/dist/db/index.d.ts +122 -0
  32. package/dist/db/index.d.ts.map +1 -0
  33. package/dist/db/index.js +296 -0
  34. package/dist/db/index.js.map +1 -0
  35. package/dist/db/migrations.d.ts +44 -0
  36. package/dist/db/migrations.d.ts.map +1 -0
  37. package/dist/db/migrations.js +140 -0
  38. package/dist/db/migrations.js.map +1 -0
  39. package/dist/db/queries.d.ts +406 -0
  40. package/dist/db/queries.d.ts.map +1 -0
  41. package/dist/db/queries.js +1605 -0
  42. package/dist/db/queries.js.map +1 -0
  43. package/dist/db/schema.sql +152 -0
  44. package/dist/db/sqlite-adapter.d.ts +53 -0
  45. package/dist/db/sqlite-adapter.d.ts.map +1 -0
  46. package/dist/db/sqlite-adapter.js +117 -0
  47. package/dist/db/sqlite-adapter.js.map +1 -0
  48. package/dist/directory.d.ts +138 -0
  49. package/dist/directory.d.ts.map +1 -0
  50. package/dist/directory.js +515 -0
  51. package/dist/directory.js.map +1 -0
  52. package/dist/errors.d.ts +136 -0
  53. package/dist/errors.d.ts.map +1 -0
  54. package/dist/errors.js +219 -0
  55. package/dist/errors.js.map +1 -0
  56. package/dist/extraction/astro-extractor.d.ts +79 -0
  57. package/dist/extraction/astro-extractor.d.ts.map +1 -0
  58. package/dist/extraction/astro-extractor.js +320 -0
  59. package/dist/extraction/astro-extractor.js.map +1 -0
  60. package/dist/extraction/context.d.ts +12 -0
  61. package/dist/extraction/context.d.ts.map +1 -0
  62. package/dist/extraction/context.js +29 -0
  63. package/dist/extraction/context.js.map +1 -0
  64. package/dist/extraction/dfm-extractor.d.ts +31 -0
  65. package/dist/extraction/dfm-extractor.d.ts.map +1 -0
  66. package/dist/extraction/dfm-extractor.js +151 -0
  67. package/dist/extraction/dfm-extractor.js.map +1 -0
  68. package/dist/extraction/extraction-version.d.ts +25 -0
  69. package/dist/extraction/extraction-version.d.ts.map +1 -0
  70. package/dist/extraction/extraction-version.js +28 -0
  71. package/dist/extraction/extraction-version.js.map +1 -0
  72. package/dist/extraction/function-ref.d.ts +118 -0
  73. package/dist/extraction/function-ref.d.ts.map +1 -0
  74. package/dist/extraction/function-ref.js +727 -0
  75. package/dist/extraction/function-ref.js.map +1 -0
  76. package/dist/extraction/generated-detection.d.ts +30 -0
  77. package/dist/extraction/generated-detection.d.ts.map +1 -0
  78. package/dist/extraction/generated-detection.js +83 -0
  79. package/dist/extraction/generated-detection.js.map +1 -0
  80. package/dist/extraction/grammars.d.ts +118 -0
  81. package/dist/extraction/grammars.d.ts.map +1 -0
  82. package/dist/extraction/grammars.js +499 -0
  83. package/dist/extraction/grammars.js.map +1 -0
  84. package/dist/extraction/index.d.ts +175 -0
  85. package/dist/extraction/index.d.ts.map +1 -0
  86. package/dist/extraction/index.js +1888 -0
  87. package/dist/extraction/index.js.map +1 -0
  88. package/dist/extraction/languages/arkts-viewtree.d.ts +22 -0
  89. package/dist/extraction/languages/arkts-viewtree.d.ts.map +1 -0
  90. package/dist/extraction/languages/arkts-viewtree.js +133 -0
  91. package/dist/extraction/languages/arkts-viewtree.js.map +1 -0
  92. package/dist/extraction/languages/arkts.d.ts +18 -0
  93. package/dist/extraction/languages/arkts.d.ts.map +1 -0
  94. package/dist/extraction/languages/arkts.js +1069 -0
  95. package/dist/extraction/languages/arkts.js.map +1 -0
  96. package/dist/extraction/languages/c-cpp.d.ts +12 -0
  97. package/dist/extraction/languages/c-cpp.d.ts.map +1 -0
  98. package/dist/extraction/languages/c-cpp.js +275 -0
  99. package/dist/extraction/languages/c-cpp.js.map +1 -0
  100. package/dist/extraction/languages/csharp.d.ts +25 -0
  101. package/dist/extraction/languages/csharp.d.ts.map +1 -0
  102. package/dist/extraction/languages/csharp.js +175 -0
  103. package/dist/extraction/languages/csharp.js.map +1 -0
  104. package/dist/extraction/languages/dart.d.ts +3 -0
  105. package/dist/extraction/languages/dart.d.ts.map +1 -0
  106. package/dist/extraction/languages/dart.js +374 -0
  107. package/dist/extraction/languages/dart.js.map +1 -0
  108. package/dist/extraction/languages/go.d.ts +3 -0
  109. package/dist/extraction/languages/go.d.ts.map +1 -0
  110. package/dist/extraction/languages/go.js +111 -0
  111. package/dist/extraction/languages/go.js.map +1 -0
  112. package/dist/extraction/languages/index.d.ts +10 -0
  113. package/dist/extraction/languages/index.d.ts.map +1 -0
  114. package/dist/extraction/languages/index.js +53 -0
  115. package/dist/extraction/languages/index.js.map +1 -0
  116. package/dist/extraction/languages/java.d.ts +3 -0
  117. package/dist/extraction/languages/java.d.ts.map +1 -0
  118. package/dist/extraction/languages/java.js +315 -0
  119. package/dist/extraction/languages/java.js.map +1 -0
  120. package/dist/extraction/languages/javascript.d.ts +3 -0
  121. package/dist/extraction/languages/javascript.d.ts.map +1 -0
  122. package/dist/extraction/languages/javascript.js +106 -0
  123. package/dist/extraction/languages/javascript.js.map +1 -0
  124. package/dist/extraction/languages/kotlin.d.ts +3 -0
  125. package/dist/extraction/languages/kotlin.d.ts.map +1 -0
  126. package/dist/extraction/languages/kotlin.js +379 -0
  127. package/dist/extraction/languages/kotlin.js.map +1 -0
  128. package/dist/extraction/languages/lua.d.ts +3 -0
  129. package/dist/extraction/languages/lua.d.ts.map +1 -0
  130. package/dist/extraction/languages/lua.js +150 -0
  131. package/dist/extraction/languages/lua.js.map +1 -0
  132. package/dist/extraction/languages/luau.d.ts +3 -0
  133. package/dist/extraction/languages/luau.d.ts.map +1 -0
  134. package/dist/extraction/languages/luau.js +37 -0
  135. package/dist/extraction/languages/luau.js.map +1 -0
  136. package/dist/extraction/languages/objc.d.ts +3 -0
  137. package/dist/extraction/languages/objc.d.ts.map +1 -0
  138. package/dist/extraction/languages/objc.js +175 -0
  139. package/dist/extraction/languages/objc.js.map +1 -0
  140. package/dist/extraction/languages/pascal.d.ts +3 -0
  141. package/dist/extraction/languages/pascal.d.ts.map +1 -0
  142. package/dist/extraction/languages/pascal.js +77 -0
  143. package/dist/extraction/languages/pascal.js.map +1 -0
  144. package/dist/extraction/languages/php.d.ts +3 -0
  145. package/dist/extraction/languages/php.d.ts.map +1 -0
  146. package/dist/extraction/languages/php.js +196 -0
  147. package/dist/extraction/languages/php.js.map +1 -0
  148. package/dist/extraction/languages/python.d.ts +3 -0
  149. package/dist/extraction/languages/python.d.ts.map +1 -0
  150. package/dist/extraction/languages/python.js +56 -0
  151. package/dist/extraction/languages/python.js.map +1 -0
  152. package/dist/extraction/languages/r.d.ts +3 -0
  153. package/dist/extraction/languages/r.d.ts.map +1 -0
  154. package/dist/extraction/languages/r.js +314 -0
  155. package/dist/extraction/languages/r.js.map +1 -0
  156. package/dist/extraction/languages/ruby.d.ts +3 -0
  157. package/dist/extraction/languages/ruby.d.ts.map +1 -0
  158. package/dist/extraction/languages/ruby.js +149 -0
  159. package/dist/extraction/languages/ruby.js.map +1 -0
  160. package/dist/extraction/languages/rust.d.ts +3 -0
  161. package/dist/extraction/languages/rust.d.ts.map +1 -0
  162. package/dist/extraction/languages/rust.js +142 -0
  163. package/dist/extraction/languages/rust.js.map +1 -0
  164. package/dist/extraction/languages/scala.d.ts +3 -0
  165. package/dist/extraction/languages/scala.d.ts.map +1 -0
  166. package/dist/extraction/languages/scala.js +209 -0
  167. package/dist/extraction/languages/scala.js.map +1 -0
  168. package/dist/extraction/languages/swift.d.ts +3 -0
  169. package/dist/extraction/languages/swift.d.ts.map +1 -0
  170. package/dist/extraction/languages/swift.js +152 -0
  171. package/dist/extraction/languages/swift.js.map +1 -0
  172. package/dist/extraction/languages/typescript.d.ts +16 -0
  173. package/dist/extraction/languages/typescript.d.ts.map +1 -0
  174. package/dist/extraction/languages/typescript.js +167 -0
  175. package/dist/extraction/languages/typescript.js.map +1 -0
  176. package/dist/extraction/liquid-extractor.d.ts +59 -0
  177. package/dist/extraction/liquid-extractor.d.ts.map +1 -0
  178. package/dist/extraction/liquid-extractor.js +357 -0
  179. package/dist/extraction/liquid-extractor.js.map +1 -0
  180. package/dist/extraction/mybatis-extractor.d.ts +48 -0
  181. package/dist/extraction/mybatis-extractor.d.ts.map +1 -0
  182. package/dist/extraction/mybatis-extractor.js +198 -0
  183. package/dist/extraction/mybatis-extractor.js.map +1 -0
  184. package/dist/extraction/parse-worker.d.ts +8 -0
  185. package/dist/extraction/parse-worker.d.ts.map +1 -0
  186. package/dist/extraction/parse-worker.js +97 -0
  187. package/dist/extraction/parse-worker.js.map +1 -0
  188. package/dist/extraction/razor-extractor.d.ts +42 -0
  189. package/dist/extraction/razor-extractor.d.ts.map +1 -0
  190. package/dist/extraction/razor-extractor.js +285 -0
  191. package/dist/extraction/razor-extractor.js.map +1 -0
  192. package/dist/extraction/svelte-extractor.d.ts +56 -0
  193. package/dist/extraction/svelte-extractor.d.ts.map +1 -0
  194. package/dist/extraction/svelte-extractor.js +275 -0
  195. package/dist/extraction/svelte-extractor.js.map +1 -0
  196. package/dist/extraction/tree-sitter-helpers.d.ts +28 -0
  197. package/dist/extraction/tree-sitter-helpers.d.ts.map +1 -0
  198. package/dist/extraction/tree-sitter-helpers.js +152 -0
  199. package/dist/extraction/tree-sitter-helpers.js.map +1 -0
  200. package/dist/extraction/tree-sitter-types.d.ts +239 -0
  201. package/dist/extraction/tree-sitter-types.d.ts.map +1 -0
  202. package/dist/extraction/tree-sitter-types.js +10 -0
  203. package/dist/extraction/tree-sitter-types.js.map +1 -0
  204. package/dist/extraction/tree-sitter.d.ts +647 -0
  205. package/dist/extraction/tree-sitter.d.ts.map +1 -0
  206. package/dist/extraction/tree-sitter.js +5597 -0
  207. package/dist/extraction/tree-sitter.js.map +1 -0
  208. package/dist/extraction/vue-extractor.d.ts +51 -0
  209. package/dist/extraction/vue-extractor.d.ts.map +1 -0
  210. package/dist/extraction/vue-extractor.js +254 -0
  211. package/dist/extraction/vue-extractor.js.map +1 -0
  212. package/dist/extraction/wasm/tree-sitter-c_sharp.wasm +0 -0
  213. package/dist/extraction/wasm/tree-sitter-lua.wasm +0 -0
  214. package/dist/extraction/wasm/tree-sitter-luau.wasm +0 -0
  215. package/dist/extraction/wasm/tree-sitter-pascal.wasm +0 -0
  216. package/dist/extraction/wasm/tree-sitter-r.wasm +0 -0
  217. package/dist/extraction/wasm/tree-sitter-scala.wasm +0 -0
  218. package/dist/extraction/wasm-runtime-flags.d.ts +38 -0
  219. package/dist/extraction/wasm-runtime-flags.d.ts.map +1 -0
  220. package/dist/extraction/wasm-runtime-flags.js +106 -0
  221. package/dist/extraction/wasm-runtime-flags.js.map +1 -0
  222. package/dist/graph/index.d.ts +8 -0
  223. package/dist/graph/index.d.ts.map +1 -0
  224. package/dist/graph/index.js +13 -0
  225. package/dist/graph/index.js.map +1 -0
  226. package/dist/graph/queries.d.ts +106 -0
  227. package/dist/graph/queries.d.ts.map +1 -0
  228. package/dist/graph/queries.js +339 -0
  229. package/dist/graph/queries.js.map +1 -0
  230. package/dist/graph/traversal.d.ts +127 -0
  231. package/dist/graph/traversal.d.ts.map +1 -0
  232. package/dist/graph/traversal.js +540 -0
  233. package/dist/graph/traversal.js.map +1 -0
  234. package/dist/index.d.ts +563 -0
  235. package/dist/index.d.ts.map +1 -0
  236. package/dist/index.js +1043 -0
  237. package/dist/index.js.map +1 -0
  238. package/dist/installer/config-writer.d.ts +28 -0
  239. package/dist/installer/config-writer.d.ts.map +1 -0
  240. package/dist/installer/config-writer.js +91 -0
  241. package/dist/installer/config-writer.js.map +1 -0
  242. package/dist/installer/index.d.ts +100 -0
  243. package/dist/installer/index.d.ts.map +1 -0
  244. package/dist/installer/index.js +524 -0
  245. package/dist/installer/index.js.map +1 -0
  246. package/dist/installer/instructions-template.d.ts +41 -0
  247. package/dist/installer/instructions-template.d.ts.map +1 -0
  248. package/dist/installer/instructions-template.js +53 -0
  249. package/dist/installer/instructions-template.js.map +1 -0
  250. package/dist/installer/targets/antigravity.d.ts +57 -0
  251. package/dist/installer/targets/antigravity.d.ts.map +1 -0
  252. package/dist/installer/targets/antigravity.js +308 -0
  253. package/dist/installer/targets/antigravity.js.map +1 -0
  254. package/dist/installer/targets/claude.d.ts +62 -0
  255. package/dist/installer/targets/claude.d.ts.map +1 -0
  256. package/dist/installer/targets/claude.js +456 -0
  257. package/dist/installer/targets/claude.js.map +1 -0
  258. package/dist/installer/targets/codebuddy.d.ts +17 -0
  259. package/dist/installer/targets/codebuddy.d.ts.map +1 -0
  260. package/dist/installer/targets/codebuddy.js +150 -0
  261. package/dist/installer/targets/codebuddy.js.map +1 -0
  262. package/dist/installer/targets/codex.d.ts +18 -0
  263. package/dist/installer/targets/codex.d.ts.map +1 -0
  264. package/dist/installer/targets/codex.js +185 -0
  265. package/dist/installer/targets/codex.js.map +1 -0
  266. package/dist/installer/targets/cursor.d.ts +35 -0
  267. package/dist/installer/targets/cursor.d.ts.map +1 -0
  268. package/dist/installer/targets/cursor.js +254 -0
  269. package/dist/installer/targets/cursor.js.map +1 -0
  270. package/dist/installer/targets/deveco.d.ts +28 -0
  271. package/dist/installer/targets/deveco.d.ts.map +1 -0
  272. package/dist/installer/targets/deveco.js +247 -0
  273. package/dist/installer/targets/deveco.js.map +1 -0
  274. package/dist/installer/targets/gemini.d.ts +26 -0
  275. package/dist/installer/targets/gemini.d.ts.map +1 -0
  276. package/dist/installer/targets/gemini.js +165 -0
  277. package/dist/installer/targets/gemini.js.map +1 -0
  278. package/dist/installer/targets/hermes.d.ts +18 -0
  279. package/dist/installer/targets/hermes.d.ts.map +1 -0
  280. package/dist/installer/targets/hermes.js +359 -0
  281. package/dist/installer/targets/hermes.js.map +1 -0
  282. package/dist/installer/targets/kiro.d.ts +27 -0
  283. package/dist/installer/targets/kiro.d.ts.map +1 -0
  284. package/dist/installer/targets/kiro.js +178 -0
  285. package/dist/installer/targets/kiro.js.map +1 -0
  286. package/dist/installer/targets/opencode.d.ts +38 -0
  287. package/dist/installer/targets/opencode.d.ts.map +1 -0
  288. package/dist/installer/targets/opencode.js +288 -0
  289. package/dist/installer/targets/opencode.js.map +1 -0
  290. package/dist/installer/targets/registry.d.ts +35 -0
  291. package/dist/installer/targets/registry.d.ts.map +1 -0
  292. package/dist/installer/targets/registry.js +95 -0
  293. package/dist/installer/targets/registry.js.map +1 -0
  294. package/dist/installer/targets/shared.d.ts +101 -0
  295. package/dist/installer/targets/shared.d.ts.map +1 -0
  296. package/dist/installer/targets/shared.js +264 -0
  297. package/dist/installer/targets/shared.js.map +1 -0
  298. package/dist/installer/targets/toml.d.ts +52 -0
  299. package/dist/installer/targets/toml.d.ts.map +1 -0
  300. package/dist/installer/targets/toml.js +147 -0
  301. package/dist/installer/targets/toml.js.map +1 -0
  302. package/dist/installer/targets/types.d.ts +108 -0
  303. package/dist/installer/targets/types.d.ts.map +1 -0
  304. package/dist/installer/targets/types.js +16 -0
  305. package/dist/installer/targets/types.js.map +1 -0
  306. package/dist/mcp/daemon-manager.d.ts +42 -0
  307. package/dist/mcp/daemon-manager.d.ts.map +1 -0
  308. package/dist/mcp/daemon-manager.js +129 -0
  309. package/dist/mcp/daemon-manager.js.map +1 -0
  310. package/dist/mcp/daemon-paths.d.ts +46 -0
  311. package/dist/mcp/daemon-paths.d.ts.map +1 -0
  312. package/dist/mcp/daemon-paths.js +125 -0
  313. package/dist/mcp/daemon-paths.js.map +1 -0
  314. package/dist/mcp/daemon-registry.d.ts +47 -0
  315. package/dist/mcp/daemon-registry.d.ts.map +1 -0
  316. package/dist/mcp/daemon-registry.js +229 -0
  317. package/dist/mcp/daemon-registry.js.map +1 -0
  318. package/dist/mcp/daemon.d.ts +220 -0
  319. package/dist/mcp/daemon.d.ts.map +1 -0
  320. package/dist/mcp/daemon.js +637 -0
  321. package/dist/mcp/daemon.js.map +1 -0
  322. package/dist/mcp/dynamic-boundaries.d.ts +41 -0
  323. package/dist/mcp/dynamic-boundaries.d.ts.map +1 -0
  324. package/dist/mcp/dynamic-boundaries.js +359 -0
  325. package/dist/mcp/dynamic-boundaries.js.map +1 -0
  326. package/dist/mcp/engine.d.ts +105 -0
  327. package/dist/mcp/engine.d.ts.map +1 -0
  328. package/dist/mcp/engine.js +278 -0
  329. package/dist/mcp/engine.js.map +1 -0
  330. package/dist/mcp/index.d.ts +113 -0
  331. package/dist/mcp/index.d.ts.map +1 -0
  332. package/dist/mcp/index.js +499 -0
  333. package/dist/mcp/index.js.map +1 -0
  334. package/dist/mcp/liveness-watchdog.d.ts +18 -0
  335. package/dist/mcp/liveness-watchdog.d.ts.map +1 -0
  336. package/dist/mcp/liveness-watchdog.js +207 -0
  337. package/dist/mcp/liveness-watchdog.js.map +1 -0
  338. package/dist/mcp/ppid-watchdog.d.ts +44 -0
  339. package/dist/mcp/ppid-watchdog.d.ts.map +1 -0
  340. package/dist/mcp/ppid-watchdog.js +27 -0
  341. package/dist/mcp/ppid-watchdog.js.map +1 -0
  342. package/dist/mcp/proxy.d.ts +87 -0
  343. package/dist/mcp/proxy.d.ts.map +1 -0
  344. package/dist/mcp/proxy.js +641 -0
  345. package/dist/mcp/proxy.js.map +1 -0
  346. package/dist/mcp/server-instructions.d.ts +34 -0
  347. package/dist/mcp/server-instructions.d.ts.map +1 -0
  348. package/dist/mcp/server-instructions.js +106 -0
  349. package/dist/mcp/server-instructions.js.map +1 -0
  350. package/dist/mcp/session.d.ts +79 -0
  351. package/dist/mcp/session.d.ts.map +1 -0
  352. package/dist/mcp/session.js +330 -0
  353. package/dist/mcp/session.js.map +1 -0
  354. package/dist/mcp/stdin-teardown.d.ts +27 -0
  355. package/dist/mcp/stdin-teardown.d.ts.map +1 -0
  356. package/dist/mcp/stdin-teardown.js +49 -0
  357. package/dist/mcp/stdin-teardown.js.map +1 -0
  358. package/dist/mcp/tools.d.ts +534 -0
  359. package/dist/mcp/tools.d.ts.map +1 -0
  360. package/dist/mcp/tools.js +4101 -0
  361. package/dist/mcp/tools.js.map +1 -0
  362. package/dist/mcp/transport.d.ts +188 -0
  363. package/dist/mcp/transport.d.ts.map +1 -0
  364. package/dist/mcp/transport.js +359 -0
  365. package/dist/mcp/transport.js.map +1 -0
  366. package/dist/mcp/version.d.ts +19 -0
  367. package/dist/mcp/version.d.ts.map +1 -0
  368. package/dist/mcp/version.js +71 -0
  369. package/dist/mcp/version.js.map +1 -0
  370. package/dist/project-config.d.ts +36 -0
  371. package/dist/project-config.d.ts.map +1 -0
  372. package/dist/project-config.js +235 -0
  373. package/dist/project-config.js.map +1 -0
  374. package/dist/reasoning/config.d.ts +45 -0
  375. package/dist/reasoning/config.d.ts.map +1 -0
  376. package/dist/reasoning/config.js +171 -0
  377. package/dist/reasoning/config.js.map +1 -0
  378. package/dist/reasoning/credentials.d.ts +5 -0
  379. package/dist/reasoning/credentials.d.ts.map +1 -0
  380. package/dist/reasoning/credentials.js +83 -0
  381. package/dist/reasoning/credentials.js.map +1 -0
  382. package/dist/reasoning/login.d.ts +21 -0
  383. package/dist/reasoning/login.d.ts.map +1 -0
  384. package/dist/reasoning/login.js +85 -0
  385. package/dist/reasoning/login.js.map +1 -0
  386. package/dist/reasoning/reasoner.d.ts +43 -0
  387. package/dist/reasoning/reasoner.d.ts.map +1 -0
  388. package/dist/reasoning/reasoner.js +308 -0
  389. package/dist/reasoning/reasoner.js.map +1 -0
  390. package/dist/resolution/c-fnptr-synthesizer.d.ts +33 -0
  391. package/dist/resolution/c-fnptr-synthesizer.d.ts.map +1 -0
  392. package/dist/resolution/c-fnptr-synthesizer.js +352 -0
  393. package/dist/resolution/c-fnptr-synthesizer.js.map +1 -0
  394. package/dist/resolution/callback-synthesizer.d.ts +15 -0
  395. package/dist/resolution/callback-synthesizer.d.ts.map +1 -0
  396. package/dist/resolution/callback-synthesizer.js +3014 -0
  397. package/dist/resolution/callback-synthesizer.js.map +1 -0
  398. package/dist/resolution/frameworks/arkts-entry.d.ts +12 -0
  399. package/dist/resolution/frameworks/arkts-entry.d.ts.map +1 -0
  400. package/dist/resolution/frameworks/arkts-entry.js +214 -0
  401. package/dist/resolution/frameworks/arkts-entry.js.map +1 -0
  402. package/dist/resolution/frameworks/arkts-napi.d.ts +3 -0
  403. package/dist/resolution/frameworks/arkts-napi.d.ts.map +1 -0
  404. package/dist/resolution/frameworks/arkts-napi.js +166 -0
  405. package/dist/resolution/frameworks/arkts-napi.js.map +1 -0
  406. package/dist/resolution/frameworks/astro.d.ts +9 -0
  407. package/dist/resolution/frameworks/astro.d.ts.map +1 -0
  408. package/dist/resolution/frameworks/astro.js +169 -0
  409. package/dist/resolution/frameworks/astro.js.map +1 -0
  410. package/dist/resolution/frameworks/cargo-workspace.d.ts +18 -0
  411. package/dist/resolution/frameworks/cargo-workspace.d.ts.map +1 -0
  412. package/dist/resolution/frameworks/cargo-workspace.js +225 -0
  413. package/dist/resolution/frameworks/cargo-workspace.js.map +1 -0
  414. package/dist/resolution/frameworks/csharp.d.ts +8 -0
  415. package/dist/resolution/frameworks/csharp.d.ts.map +1 -0
  416. package/dist/resolution/frameworks/csharp.js +241 -0
  417. package/dist/resolution/frameworks/csharp.js.map +1 -0
  418. package/dist/resolution/frameworks/drupal.d.ts +51 -0
  419. package/dist/resolution/frameworks/drupal.d.ts.map +1 -0
  420. package/dist/resolution/frameworks/drupal.js +367 -0
  421. package/dist/resolution/frameworks/drupal.js.map +1 -0
  422. package/dist/resolution/frameworks/expo-modules.d.ts +3 -0
  423. package/dist/resolution/frameworks/expo-modules.d.ts.map +1 -0
  424. package/dist/resolution/frameworks/expo-modules.js +148 -0
  425. package/dist/resolution/frameworks/expo-modules.js.map +1 -0
  426. package/dist/resolution/frameworks/express.d.ts +8 -0
  427. package/dist/resolution/frameworks/express.d.ts.map +1 -0
  428. package/dist/resolution/frameworks/express.js +308 -0
  429. package/dist/resolution/frameworks/express.js.map +1 -0
  430. package/dist/resolution/frameworks/fabric.d.ts +3 -0
  431. package/dist/resolution/frameworks/fabric.d.ts.map +1 -0
  432. package/dist/resolution/frameworks/fabric.js +354 -0
  433. package/dist/resolution/frameworks/fabric.js.map +1 -0
  434. package/dist/resolution/frameworks/go.d.ts +8 -0
  435. package/dist/resolution/frameworks/go.d.ts.map +1 -0
  436. package/dist/resolution/frameworks/go.js +161 -0
  437. package/dist/resolution/frameworks/go.js.map +1 -0
  438. package/dist/resolution/frameworks/goframe.d.ts +41 -0
  439. package/dist/resolution/frameworks/goframe.d.ts.map +1 -0
  440. package/dist/resolution/frameworks/goframe.js +112 -0
  441. package/dist/resolution/frameworks/goframe.js.map +1 -0
  442. package/dist/resolution/frameworks/index.d.ts +51 -0
  443. package/dist/resolution/frameworks/index.d.ts.map +1 -0
  444. package/dist/resolution/frameworks/index.js +177 -0
  445. package/dist/resolution/frameworks/index.js.map +1 -0
  446. package/dist/resolution/frameworks/java.d.ts +8 -0
  447. package/dist/resolution/frameworks/java.d.ts.map +1 -0
  448. package/dist/resolution/frameworks/java.js +509 -0
  449. package/dist/resolution/frameworks/java.js.map +1 -0
  450. package/dist/resolution/frameworks/laravel.d.ts +13 -0
  451. package/dist/resolution/frameworks/laravel.d.ts.map +1 -0
  452. package/dist/resolution/frameworks/laravel.js +257 -0
  453. package/dist/resolution/frameworks/laravel.js.map +1 -0
  454. package/dist/resolution/frameworks/nestjs.d.ts +26 -0
  455. package/dist/resolution/frameworks/nestjs.d.ts.map +1 -0
  456. package/dist/resolution/frameworks/nestjs.js +698 -0
  457. package/dist/resolution/frameworks/nestjs.js.map +1 -0
  458. package/dist/resolution/frameworks/play.d.ts +19 -0
  459. package/dist/resolution/frameworks/play.d.ts.map +1 -0
  460. package/dist/resolution/frameworks/play.js +111 -0
  461. package/dist/resolution/frameworks/play.js.map +1 -0
  462. package/dist/resolution/frameworks/python.d.ts +10 -0
  463. package/dist/resolution/frameworks/python.d.ts.map +1 -0
  464. package/dist/resolution/frameworks/python.js +400 -0
  465. package/dist/resolution/frameworks/python.js.map +1 -0
  466. package/dist/resolution/frameworks/react-native.d.ts +3 -0
  467. package/dist/resolution/frameworks/react-native.d.ts.map +1 -0
  468. package/dist/resolution/frameworks/react-native.js +410 -0
  469. package/dist/resolution/frameworks/react-native.js.map +1 -0
  470. package/dist/resolution/frameworks/react.d.ts +8 -0
  471. package/dist/resolution/frameworks/react.d.ts.map +1 -0
  472. package/dist/resolution/frameworks/react.js +334 -0
  473. package/dist/resolution/frameworks/react.js.map +1 -0
  474. package/dist/resolution/frameworks/ruby.d.ts +8 -0
  475. package/dist/resolution/frameworks/ruby.d.ts.map +1 -0
  476. package/dist/resolution/frameworks/ruby.js +302 -0
  477. package/dist/resolution/frameworks/ruby.js.map +1 -0
  478. package/dist/resolution/frameworks/rust.d.ts +8 -0
  479. package/dist/resolution/frameworks/rust.d.ts.map +1 -0
  480. package/dist/resolution/frameworks/rust.js +304 -0
  481. package/dist/resolution/frameworks/rust.js.map +1 -0
  482. package/dist/resolution/frameworks/svelte.d.ts +9 -0
  483. package/dist/resolution/frameworks/svelte.d.ts.map +1 -0
  484. package/dist/resolution/frameworks/svelte.js +253 -0
  485. package/dist/resolution/frameworks/svelte.js.map +1 -0
  486. package/dist/resolution/frameworks/swift-objc.d.ts +37 -0
  487. package/dist/resolution/frameworks/swift-objc.d.ts.map +1 -0
  488. package/dist/resolution/frameworks/swift-objc.js +252 -0
  489. package/dist/resolution/frameworks/swift-objc.js.map +1 -0
  490. package/dist/resolution/frameworks/swift.d.ts +10 -0
  491. package/dist/resolution/frameworks/swift.d.ts.map +1 -0
  492. package/dist/resolution/frameworks/swift.js +400 -0
  493. package/dist/resolution/frameworks/swift.js.map +1 -0
  494. package/dist/resolution/frameworks/vue.d.ts +9 -0
  495. package/dist/resolution/frameworks/vue.d.ts.map +1 -0
  496. package/dist/resolution/frameworks/vue.js +303 -0
  497. package/dist/resolution/frameworks/vue.js.map +1 -0
  498. package/dist/resolution/go-module.d.ts +26 -0
  499. package/dist/resolution/go-module.d.ts.map +1 -0
  500. package/dist/resolution/go-module.js +78 -0
  501. package/dist/resolution/go-module.js.map +1 -0
  502. package/dist/resolution/goframe-synthesizer.d.ts +28 -0
  503. package/dist/resolution/goframe-synthesizer.d.ts.map +1 -0
  504. package/dist/resolution/goframe-synthesizer.js +158 -0
  505. package/dist/resolution/goframe-synthesizer.js.map +1 -0
  506. package/dist/resolution/import-resolver.d.ts +78 -0
  507. package/dist/resolution/import-resolver.d.ts.map +1 -0
  508. package/dist/resolution/import-resolver.js +1849 -0
  509. package/dist/resolution/import-resolver.js.map +1 -0
  510. package/dist/resolution/index.d.ts +196 -0
  511. package/dist/resolution/index.d.ts.map +1 -0
  512. package/dist/resolution/index.js +1328 -0
  513. package/dist/resolution/index.js.map +1 -0
  514. package/dist/resolution/lru-cache.d.ts +24 -0
  515. package/dist/resolution/lru-cache.d.ts.map +1 -0
  516. package/dist/resolution/lru-cache.js +62 -0
  517. package/dist/resolution/lru-cache.js.map +1 -0
  518. package/dist/resolution/name-matcher.d.ts +93 -0
  519. package/dist/resolution/name-matcher.d.ts.map +1 -0
  520. package/dist/resolution/name-matcher.js +1212 -0
  521. package/dist/resolution/name-matcher.js.map +1 -0
  522. package/dist/resolution/path-aliases.d.ts +68 -0
  523. package/dist/resolution/path-aliases.d.ts.map +1 -0
  524. package/dist/resolution/path-aliases.js +238 -0
  525. package/dist/resolution/path-aliases.js.map +1 -0
  526. package/dist/resolution/strip-comments.d.ts +27 -0
  527. package/dist/resolution/strip-comments.d.ts.map +1 -0
  528. package/dist/resolution/strip-comments.js +443 -0
  529. package/dist/resolution/strip-comments.js.map +1 -0
  530. package/dist/resolution/swift-objc-bridge.d.ts +134 -0
  531. package/dist/resolution/swift-objc-bridge.d.ts.map +1 -0
  532. package/dist/resolution/swift-objc-bridge.js +256 -0
  533. package/dist/resolution/swift-objc-bridge.js.map +1 -0
  534. package/dist/resolution/types.d.ts +233 -0
  535. package/dist/resolution/types.d.ts.map +1 -0
  536. package/dist/resolution/types.js +8 -0
  537. package/dist/resolution/types.js.map +1 -0
  538. package/dist/resolution/workspace-packages.d.ts +48 -0
  539. package/dist/resolution/workspace-packages.d.ts.map +1 -0
  540. package/dist/resolution/workspace-packages.js +208 -0
  541. package/dist/resolution/workspace-packages.js.map +1 -0
  542. package/dist/search/query-parser.d.ts +57 -0
  543. package/dist/search/query-parser.d.ts.map +1 -0
  544. package/dist/search/query-parser.js +177 -0
  545. package/dist/search/query-parser.js.map +1 -0
  546. package/dist/search/query-utils.d.ts +87 -0
  547. package/dist/search/query-utils.d.ts.map +1 -0
  548. package/dist/search/query-utils.js +449 -0
  549. package/dist/search/query-utils.js.map +1 -0
  550. package/dist/sync/git-hooks.d.ts +45 -0
  551. package/dist/sync/git-hooks.d.ts.map +1 -0
  552. package/dist/sync/git-hooks.js +225 -0
  553. package/dist/sync/git-hooks.js.map +1 -0
  554. package/dist/sync/index.d.ts +19 -0
  555. package/dist/sync/index.d.ts.map +1 -0
  556. package/dist/sync/index.js +35 -0
  557. package/dist/sync/index.js.map +1 -0
  558. package/dist/sync/watch-policy.d.ts +48 -0
  559. package/dist/sync/watch-policy.d.ts.map +1 -0
  560. package/dist/sync/watch-policy.js +124 -0
  561. package/dist/sync/watch-policy.js.map +1 -0
  562. package/dist/sync/watcher.d.ts +350 -0
  563. package/dist/sync/watcher.d.ts.map +1 -0
  564. package/dist/sync/watcher.js +811 -0
  565. package/dist/sync/watcher.js.map +1 -0
  566. package/dist/sync/worktree.d.ts +54 -0
  567. package/dist/sync/worktree.d.ts.map +1 -0
  568. package/dist/sync/worktree.js +137 -0
  569. package/dist/sync/worktree.js.map +1 -0
  570. package/dist/telemetry/index.d.ts +143 -0
  571. package/dist/telemetry/index.d.ts.map +1 -0
  572. package/dist/telemetry/index.js +541 -0
  573. package/dist/telemetry/index.js.map +1 -0
  574. package/dist/types.d.ts +392 -0
  575. package/dist/types.d.ts.map +1 -0
  576. package/dist/types.js +82 -0
  577. package/dist/types.js.map +1 -0
  578. package/dist/ui/glyphs.d.ts +42 -0
  579. package/dist/ui/glyphs.d.ts.map +1 -0
  580. package/dist/ui/glyphs.js +78 -0
  581. package/dist/ui/glyphs.js.map +1 -0
  582. package/dist/ui/shimmer-progress.d.ts +11 -0
  583. package/dist/ui/shimmer-progress.d.ts.map +1 -0
  584. package/dist/ui/shimmer-progress.js +90 -0
  585. package/dist/ui/shimmer-progress.js.map +1 -0
  586. package/dist/ui/shimmer-worker.d.ts +2 -0
  587. package/dist/ui/shimmer-worker.d.ts.map +1 -0
  588. package/dist/ui/shimmer-worker.js +118 -0
  589. package/dist/ui/shimmer-worker.js.map +1 -0
  590. package/dist/ui/types.d.ts +17 -0
  591. package/dist/ui/types.d.ts.map +1 -0
  592. package/dist/ui/types.js +3 -0
  593. package/dist/ui/types.js.map +1 -0
  594. package/dist/upgrade/index.d.ts +132 -0
  595. package/dist/upgrade/index.d.ts.map +1 -0
  596. package/dist/upgrade/index.js +498 -0
  597. package/dist/upgrade/index.js.map +1 -0
  598. package/dist/utils.d.ts +224 -0
  599. package/dist/utils.d.ts.map +1 -0
  600. package/dist/utils.js +583 -0
  601. package/dist/utils.js.map +1 -0
  602. package/package.json +57 -5
  603. package/scripts/add-lang/bench.sh +60 -0
  604. package/scripts/add-lang/check-grammar.mjs +75 -0
  605. package/scripts/add-lang/dump-ast.mjs +103 -0
  606. package/scripts/add-lang/verify-extraction.mjs +70 -0
  607. package/scripts/agent-eval/ab-adoption.sh +91 -0
  608. package/scripts/agent-eval/ab-hook.sh +86 -0
  609. package/scripts/agent-eval/ab-impl.sh +78 -0
  610. package/scripts/agent-eval/ab-new-vs-baseline.sh +102 -0
  611. package/scripts/agent-eval/ab-sufficiency.sh +78 -0
  612. package/scripts/agent-eval/arms-F.sh +21 -0
  613. package/scripts/agent-eval/arms-matrix.sh +37 -0
  614. package/scripts/agent-eval/audit.sh +68 -0
  615. package/scripts/agent-eval/bench-readme.sh +28 -0
  616. package/scripts/agent-eval/bench-why-repo.sh +22 -0
  617. package/scripts/agent-eval/block-read-hook.sh +19 -0
  618. package/scripts/agent-eval/hook-settings.json +15 -0
  619. package/scripts/agent-eval/itrun.sh +120 -0
  620. package/scripts/agent-eval/offload-eval-3arm.sh +72 -0
  621. package/scripts/agent-eval/offload-eval-cost.mjs +133 -0
  622. package/scripts/agent-eval/offload-eval-effort.mjs +108 -0
  623. package/scripts/agent-eval/offload-eval-frontload-matrix.sh +25 -0
  624. package/scripts/agent-eval/offload-eval-frontload.sh +47 -0
  625. package/scripts/agent-eval/offload-eval-ground-truth.json +18 -0
  626. package/scripts/agent-eval/offload-eval-hook.mjs +84 -0
  627. package/scripts/agent-eval/offload-eval-judge.mjs +103 -0
  628. package/scripts/agent-eval/offload-eval-matrix.sh +20 -0
  629. package/scripts/agent-eval/offload-eval-metrics.mjs +94 -0
  630. package/scripts/agent-eval/offload-eval-refs1.sh +50 -0
  631. package/scripts/agent-eval/offload-eval-setup.sh +24 -0
  632. package/scripts/agent-eval/offload-eval-styles.sh +72 -0
  633. package/scripts/agent-eval/offload-eval-summarize.mjs +68 -0
  634. package/scripts/agent-eval/offload-eval.md +76 -0
  635. package/scripts/agent-eval/parse-arms.mjs +116 -0
  636. package/scripts/agent-eval/parse-bench-readme.mjs +84 -0
  637. package/scripts/agent-eval/parse-run.mjs +45 -0
  638. package/scripts/agent-eval/parse-session.mjs +93 -0
  639. package/scripts/agent-eval/probe-context.mjs +21 -0
  640. package/scripts/agent-eval/probe-explore.mjs +40 -0
  641. package/scripts/agent-eval/probe-node.mjs +20 -0
  642. package/scripts/agent-eval/probe-sweep.mjs +119 -0
  643. package/scripts/agent-eval/probe-trace.mjs +20 -0
  644. package/scripts/agent-eval/redirect-read-hook.sh +38 -0
  645. package/scripts/agent-eval/run-agent.sh +34 -0
  646. package/scripts/agent-eval/run-all.sh +69 -0
  647. package/scripts/agent-eval/run-arms.sh +56 -0
  648. package/scripts/agent-eval/seq-matrix.mjs +137 -0
  649. package/scripts/build-bundle.sh +118 -0
  650. package/scripts/extract-release-notes.mjs +130 -0
  651. package/scripts/local-install.sh +41 -0
  652. package/scripts/npm-sdk.js +75 -0
  653. package/scripts/npm-shim.js +246 -0
  654. package/scripts/pack-npm.sh +119 -0
  655. package/scripts/prepare-release.mjs +270 -0
  656. package/scripts/qa_eval/README.md +404 -0
  657. package/scripts/qa_eval/_test_deveco_probe.py +41 -0
  658. package/scripts/qa_eval/agent_runner.py +526 -0
  659. package/scripts/qa_eval/data/.gitignore +4 -0
  660. package/scripts/qa_eval/data/test-set.jsonl +22 -0
  661. package/scripts/qa_eval/eval_metrics.py +233 -0
  662. package/scripts/qa_eval/external_agent.py +671 -0
  663. package/scripts/qa_eval/llm_config.py +92 -0
  664. package/scripts/qa_eval/memory_monitor.py +132 -0
  665. package/scripts/qa_eval/my_answer_accuracy.py +187 -0
  666. package/scripts/qa_eval/requirements.txt +2 -0
  667. package/scripts/qa_eval/run_pipeline.py +711 -0
  668. package/scripts/qa_eval/stats_efficiency.py +279 -0
  669. package/scripts/qa_eval/stats_scores.py +207 -0
package/dist/index.js ADDED
@@ -0,0 +1,1043 @@
1
+ "use strict";
2
+ /**
3
+ * HomeGraph
4
+ *
5
+ * A local-first code intelligence system that builds a semantic
6
+ * knowledge graph from any codebase.
7
+ */
8
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
+ if (k2 === undefined) k2 = k;
10
+ var desc = Object.getOwnPropertyDescriptor(m, k);
11
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
12
+ desc = { enumerable: true, get: function() { return m[k]; } };
13
+ }
14
+ Object.defineProperty(o, k2, desc);
15
+ }) : (function(o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ o[k2] = m[k];
18
+ }));
19
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
20
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
21
+ }) : function(o, v) {
22
+ o["default"] = v;
23
+ });
24
+ var __importStar = (this && this.__importStar) || (function () {
25
+ var ownKeys = function(o) {
26
+ ownKeys = Object.getOwnPropertyNames || function (o) {
27
+ var ar = [];
28
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
29
+ return ar;
30
+ };
31
+ return ownKeys(o);
32
+ };
33
+ return function (mod) {
34
+ if (mod && mod.__esModule) return mod;
35
+ var result = {};
36
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
37
+ __setModuleDefault(result, mod);
38
+ return result;
39
+ };
40
+ })();
41
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
42
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
43
+ };
44
+ Object.defineProperty(exports, "__esModule", { value: true });
45
+ exports.HomeGraph = exports.MCPServer = exports.LockUnavailableError = exports.FileWatcher = exports.MemoryMonitor = exports.throttle = exports.debounce = exports.processInBatches = exports.FileLock = exports.Mutex = exports.defaultLogger = exports.silentLogger = exports.getLogger = exports.setLogger = exports.ConfigError = exports.VectorError = exports.SearchError = exports.DatabaseError = exports.ParseError = exports.FileError = exports.HomeGraphError = exports.loadAllGrammars = exports.loadGrammarsForLanguages = exports.initGrammars = exports.getSupportedLanguages = exports.isGrammarLoaded = exports.isLanguageSupported = exports.detectLanguage = exports.HOMEGRAPH_DIR = exports.findNearestHomeGraphRoot = exports.isInitialized = exports.getHomeGraphDir = exports.QueryBuilder = exports.DatabaseConnection = exports.getDatabasePath = void 0;
46
+ const path = __importStar(require("path"));
47
+ const db_1 = require("./db");
48
+ const queries_1 = require("./db/queries");
49
+ const directory_1 = require("./directory");
50
+ const extraction_1 = require("./extraction");
51
+ const context_1 = require("./extraction/context");
52
+ const resolution_1 = require("./resolution");
53
+ const graph_1 = require("./graph");
54
+ const context_2 = require("./context");
55
+ const utils_1 = require("./utils");
56
+ const sync_1 = require("./sync");
57
+ const extraction_version_1 = require("./extraction/extraction-version");
58
+ const directory_2 = require("./directory");
59
+ const query_utils_1 = require("./search/query-utils");
60
+ const version_1 = require("./mcp/version");
61
+ // Re-export types for consumers
62
+ __exportStar(require("./types"), exports);
63
+ // Storage building blocks for embedded/SDK consumers that drive the graph
64
+ // directly (open a DB, run prepared queries) rather than through the HomeGraph
65
+ // facade. Exposed from the package entry so they no longer require deep imports
66
+ // into dist/ (issue #354).
67
+ var db_2 = require("./db");
68
+ Object.defineProperty(exports, "getDatabasePath", { enumerable: true, get: function () { return db_2.getDatabasePath; } });
69
+ Object.defineProperty(exports, "DatabaseConnection", { enumerable: true, get: function () { return db_2.DatabaseConnection; } });
70
+ var queries_2 = require("./db/queries");
71
+ Object.defineProperty(exports, "QueryBuilder", { enumerable: true, get: function () { return queries_2.QueryBuilder; } });
72
+ var directory_3 = require("./directory");
73
+ Object.defineProperty(exports, "getHomeGraphDir", { enumerable: true, get: function () { return directory_3.getHomeGraphDir; } });
74
+ Object.defineProperty(exports, "isInitialized", { enumerable: true, get: function () { return directory_3.isInitialized; } });
75
+ Object.defineProperty(exports, "findNearestHomeGraphRoot", { enumerable: true, get: function () { return directory_3.findNearestHomeGraphRoot; } });
76
+ Object.defineProperty(exports, "HOMEGRAPH_DIR", { enumerable: true, get: function () { return directory_3.HOMEGRAPH_DIR; } });
77
+ var extraction_2 = require("./extraction");
78
+ Object.defineProperty(exports, "detectLanguage", { enumerable: true, get: function () { return extraction_2.detectLanguage; } });
79
+ Object.defineProperty(exports, "isLanguageSupported", { enumerable: true, get: function () { return extraction_2.isLanguageSupported; } });
80
+ Object.defineProperty(exports, "isGrammarLoaded", { enumerable: true, get: function () { return extraction_2.isGrammarLoaded; } });
81
+ Object.defineProperty(exports, "getSupportedLanguages", { enumerable: true, get: function () { return extraction_2.getSupportedLanguages; } });
82
+ Object.defineProperty(exports, "initGrammars", { enumerable: true, get: function () { return extraction_2.initGrammars; } });
83
+ Object.defineProperty(exports, "loadGrammarsForLanguages", { enumerable: true, get: function () { return extraction_2.loadGrammarsForLanguages; } });
84
+ Object.defineProperty(exports, "loadAllGrammars", { enumerable: true, get: function () { return extraction_2.loadAllGrammars; } });
85
+ var errors_1 = require("./errors");
86
+ Object.defineProperty(exports, "HomeGraphError", { enumerable: true, get: function () { return errors_1.HomeGraphError; } });
87
+ Object.defineProperty(exports, "FileError", { enumerable: true, get: function () { return errors_1.FileError; } });
88
+ Object.defineProperty(exports, "ParseError", { enumerable: true, get: function () { return errors_1.ParseError; } });
89
+ Object.defineProperty(exports, "DatabaseError", { enumerable: true, get: function () { return errors_1.DatabaseError; } });
90
+ Object.defineProperty(exports, "SearchError", { enumerable: true, get: function () { return errors_1.SearchError; } });
91
+ Object.defineProperty(exports, "VectorError", { enumerable: true, get: function () { return errors_1.VectorError; } });
92
+ Object.defineProperty(exports, "ConfigError", { enumerable: true, get: function () { return errors_1.ConfigError; } });
93
+ Object.defineProperty(exports, "setLogger", { enumerable: true, get: function () { return errors_1.setLogger; } });
94
+ Object.defineProperty(exports, "getLogger", { enumerable: true, get: function () { return errors_1.getLogger; } });
95
+ Object.defineProperty(exports, "silentLogger", { enumerable: true, get: function () { return errors_1.silentLogger; } });
96
+ Object.defineProperty(exports, "defaultLogger", { enumerable: true, get: function () { return errors_1.defaultLogger; } });
97
+ var utils_2 = require("./utils");
98
+ Object.defineProperty(exports, "Mutex", { enumerable: true, get: function () { return utils_2.Mutex; } });
99
+ Object.defineProperty(exports, "FileLock", { enumerable: true, get: function () { return utils_2.FileLock; } });
100
+ Object.defineProperty(exports, "processInBatches", { enumerable: true, get: function () { return utils_2.processInBatches; } });
101
+ Object.defineProperty(exports, "debounce", { enumerable: true, get: function () { return utils_2.debounce; } });
102
+ Object.defineProperty(exports, "throttle", { enumerable: true, get: function () { return utils_2.throttle; } });
103
+ Object.defineProperty(exports, "MemoryMonitor", { enumerable: true, get: function () { return utils_2.MemoryMonitor; } });
104
+ var sync_2 = require("./sync");
105
+ Object.defineProperty(exports, "FileWatcher", { enumerable: true, get: function () { return sync_2.FileWatcher; } });
106
+ Object.defineProperty(exports, "LockUnavailableError", { enumerable: true, get: function () { return sync_2.LockUnavailableError; } });
107
+ var mcp_1 = require("./mcp");
108
+ Object.defineProperty(exports, "MCPServer", { enumerable: true, get: function () { return mcp_1.MCPServer; } });
109
+ /**
110
+ * Main HomeGraph class
111
+ *
112
+ * Provides the primary interface for interacting with the code knowledge graph.
113
+ */
114
+ class HomeGraph {
115
+ db;
116
+ queries;
117
+ projectRoot;
118
+ // Assigned via wireLayers() from the constructor (and again on reopen) — the
119
+ // `!` tells TS these are definitely set even though the assignment is one
120
+ // method call away from the constructor body.
121
+ orchestrator;
122
+ resolver;
123
+ graphManager;
124
+ traverser;
125
+ contextBuilder;
126
+ // Mutex for preventing concurrent indexing operations (in-process)
127
+ indexMutex = new utils_1.Mutex();
128
+ // File lock for preventing concurrent writes across processes (CLI, MCP, git hooks)
129
+ fileLock;
130
+ // File watcher for auto-sync on file changes
131
+ watcher = null;
132
+ constructor(db, queries, projectRoot) {
133
+ this.db = db;
134
+ this.queries = queries;
135
+ this.projectRoot = projectRoot;
136
+ (0, context_1.bindExtractionContext)(projectRoot, queries);
137
+ this.fileLock = new utils_1.FileLock(path.join((0, directory_2.getHomeGraphDir)(projectRoot), 'homegraph.lock'));
138
+ this.wireLayers();
139
+ }
140
+ /**
141
+ * (Re)build the query/extraction/graph layers over the current `this.queries`
142
+ * (which wraps `this.db`). Factored out of the constructor so `reopenIfReplaced`
143
+ * can rebuild them against a fresh connection without duplicating the wiring.
144
+ * The path-based `fileLock` is independent of the DB handle, so it stays put.
145
+ */
146
+ wireLayers() {
147
+ // Down-weight the project name as a query term in search ranking — it names
148
+ // the whole repo, not a symbol, so it has no discriminative value (#720).
149
+ try {
150
+ this.queries.setProjectNameTokens((0, query_utils_1.deriveProjectNameTokens)(this.projectRoot));
151
+ }
152
+ catch {
153
+ // Best-effort: ranking still works without it.
154
+ }
155
+ this.orchestrator = new extraction_1.ExtractionOrchestrator(this.projectRoot, this.queries);
156
+ this.resolver = (0, resolution_1.createResolver)(this.projectRoot, this.queries);
157
+ this.graphManager = new graph_1.GraphQueryManager(this.queries);
158
+ this.traverser = new graph_1.GraphTraverser(this.queries);
159
+ this.contextBuilder = (0, context_2.createContextBuilder)(this.projectRoot, this.queries, this.traverser);
160
+ }
161
+ /**
162
+ * Heal a stale database handle in place. If `.homegraph/` was removed and
163
+ * recreated at the SAME path while this instance held the DB open — a git
164
+ * worktree removed and re-added, or `rm -rf .homegraph` + `homegraph init` —
165
+ * our open fd points at the now-unlinked inode and can never see the new
166
+ * index, so every query returns the pre-removal snapshot until the process
167
+ * restarts (#925). When that's detected, open the live file at the same path,
168
+ * rebuild the query layers, and swap them IN PLACE, so every holder of this
169
+ * instance (the MCP daemon's default project, cached projectPath connections)
170
+ * heals without a restart. Returns true iff it reopened.
171
+ *
172
+ * POSIX-only in practice: `isReplacedOnDisk` never fires on Windows (an open
173
+ * file can't be unlinked there, and st_ino is unreliable).
174
+ */
175
+ reopenIfReplaced() {
176
+ if (!this.db.isReplacedOnDisk())
177
+ return false;
178
+ const dbPath = this.db.getPath();
179
+ // Open the live file FIRST — if that throws (e.g. mid-recreate), the old
180
+ // handle stays in place and the caller retries on the next query, rather
181
+ // than leaving this instance with no connection at all.
182
+ const fresh = db_1.DatabaseConnection.open(dbPath);
183
+ const stale = this.db;
184
+ this.db = fresh;
185
+ this.queries = new queries_1.QueryBuilder(fresh.getDb());
186
+ this.wireLayers();
187
+ // Releasing the dead handle also frees the leaked db/-wal/-shm fds that were
188
+ // pinning the unlinked inode (#925).
189
+ try {
190
+ stale.close();
191
+ }
192
+ catch { /* the old inode is gone; closing just frees fds */ }
193
+ return true;
194
+ }
195
+ // ===========================================================================
196
+ // Lifecycle Methods
197
+ // ===========================================================================
198
+ /**
199
+ * Initialize a new HomeGraph project
200
+ *
201
+ * Creates the .HomeGraph directory, database, and configuration.
202
+ *
203
+ * @param projectRoot - Path to the project root directory
204
+ * @param options - Initialization options
205
+ * @returns A new HomeGraph instance
206
+ */
207
+ static async init(projectRoot, options = {}) {
208
+ await (0, extraction_1.initGrammars)();
209
+ const resolvedRoot = path.resolve(projectRoot);
210
+ // Check if already initialized
211
+ if ((0, directory_1.isInitialized)(resolvedRoot)) {
212
+ throw new Error(`HomeGraph already initialized in ${resolvedRoot}`);
213
+ }
214
+ // Create directory structure
215
+ (0, directory_1.createDirectory)(resolvedRoot);
216
+ // Initialize database
217
+ const dbPath = (0, db_1.getDatabasePath)(resolvedRoot);
218
+ const db = db_1.DatabaseConnection.initialize(dbPath);
219
+ const queries = new queries_1.QueryBuilder(db.getDb());
220
+ const instance = new HomeGraph(db, queries, resolvedRoot);
221
+ // Run initial indexing if requested
222
+ if (options.index) {
223
+ await instance.indexAll({ onProgress: options.onProgress });
224
+ }
225
+ return instance;
226
+ }
227
+ /**
228
+ * Initialize synchronously (without indexing)
229
+ */
230
+ static initSync(projectRoot) {
231
+ const resolvedRoot = path.resolve(projectRoot);
232
+ // Check if already initialized
233
+ if ((0, directory_1.isInitialized)(resolvedRoot)) {
234
+ throw new Error(`HomeGraph already initialized in ${resolvedRoot}`);
235
+ }
236
+ // Create directory structure
237
+ (0, directory_1.createDirectory)(resolvedRoot);
238
+ // Initialize database
239
+ const dbPath = (0, db_1.getDatabasePath)(resolvedRoot);
240
+ const db = db_1.DatabaseConnection.initialize(dbPath);
241
+ const queries = new queries_1.QueryBuilder(db.getDb());
242
+ return new HomeGraph(db, queries, resolvedRoot);
243
+ }
244
+ /**
245
+ * Open an existing HomeGraph project
246
+ *
247
+ * @param projectRoot - Path to the project root directory
248
+ * @param options - Open options
249
+ * @returns A HomeGraph instance
250
+ */
251
+ static async open(projectRoot, options = {}) {
252
+ await (0, extraction_1.initGrammars)();
253
+ const resolvedRoot = path.resolve(projectRoot);
254
+ // Check if initialized
255
+ if (!(0, directory_1.isInitialized)(resolvedRoot)) {
256
+ throw new Error(`HomeGraph not initialized in ${resolvedRoot}. Run init() first.`);
257
+ }
258
+ // Validate directory structure
259
+ const validation = (0, directory_1.validateDirectory)(resolvedRoot);
260
+ if (!validation.valid) {
261
+ throw new Error(`Invalid HomeGraph directory: ${validation.errors.join(', ')}`);
262
+ }
263
+ // Open database
264
+ const dbPath = (0, db_1.getDatabasePath)(resolvedRoot);
265
+ const db = db_1.DatabaseConnection.open(dbPath);
266
+ const queries = new queries_1.QueryBuilder(db.getDb());
267
+ const instance = new HomeGraph(db, queries, resolvedRoot);
268
+ // Sync if requested
269
+ if (options.sync) {
270
+ await instance.sync();
271
+ }
272
+ return instance;
273
+ }
274
+ /**
275
+ * Open synchronously (without sync)
276
+ */
277
+ static openSync(projectRoot) {
278
+ const resolvedRoot = path.resolve(projectRoot);
279
+ // Check if initialized
280
+ if (!(0, directory_1.isInitialized)(resolvedRoot)) {
281
+ throw new Error(`HomeGraph not initialized in ${resolvedRoot}. Run init() first.`);
282
+ }
283
+ // Validate directory structure
284
+ const validation = (0, directory_1.validateDirectory)(resolvedRoot);
285
+ if (!validation.valid) {
286
+ throw new Error(`Invalid HomeGraph directory: ${validation.errors.join(', ')}`);
287
+ }
288
+ // Open database
289
+ const dbPath = (0, db_1.getDatabasePath)(resolvedRoot);
290
+ const db = db_1.DatabaseConnection.open(dbPath);
291
+ const queries = new queries_1.QueryBuilder(db.getDb());
292
+ return new HomeGraph(db, queries, resolvedRoot);
293
+ }
294
+ /**
295
+ * Check if a directory has been initialized as a HomeGraph project
296
+ */
297
+ static isInitialized(projectRoot) {
298
+ return (0, directory_1.isInitialized)(path.resolve(projectRoot));
299
+ }
300
+ /**
301
+ * Close the HomeGraph instance and release resources
302
+ */
303
+ close() {
304
+ this.unwatch();
305
+ // Release file lock if held
306
+ this.fileLock.release();
307
+ this.db.close();
308
+ }
309
+ /**
310
+ * Get the project root directory
311
+ */
312
+ getProjectRoot() {
313
+ return this.projectRoot;
314
+ }
315
+ // ===========================================================================
316
+ // Indexing
317
+ // ===========================================================================
318
+ /**
319
+ * Index all files in the project
320
+ *
321
+ * Uses a mutex to prevent concurrent indexing operations.
322
+ */
323
+ async indexAll(options = {}) {
324
+ return this.indexMutex.withLock(async () => {
325
+ try {
326
+ this.fileLock.acquire();
327
+ }
328
+ catch {
329
+ return { success: false, filesIndexed: 0, filesSkipped: 0, filesErrored: 0, nodesCreated: 0, edgesCreated: 0, errors: [{ message: 'Could not acquire file lock - another process may be indexing', severity: 'error' }], durationMs: 0 };
330
+ }
331
+ try {
332
+ const before = this.queries.getNodeAndEdgeCount();
333
+ const result = await this.orchestrator.indexAll(options.onProgress, options.signal, options.verbose);
334
+ // Re-detect frameworks now that the index is populated. The resolver
335
+ // is constructed with createResolver() before any files exist, so
336
+ // framework resolvers whose detect() consults the indexed file list
337
+ // (e.g. UIKit/SwiftUI scanning for imports, swift-objc-bridge looking
338
+ // for both Swift and ObjC files) all return false on that initial pass
339
+ // and silently drop themselves. Re-initializing here gives them a
340
+ // chance to see the actual project before resolution runs.
341
+ if (result.success && result.filesIndexed > 0) {
342
+ this.resolver.initialize();
343
+ // Cross-file finalization (e.g. NestJS RouterModule prefixes). Runs
344
+ // before resolution so updated names show up in subsequent reads.
345
+ this.resolver.runPostExtract();
346
+ }
347
+ // Resolve references to create call/import/extends edges
348
+ if (result.success && result.filesIndexed > 0) {
349
+ // Get count without loading all refs into memory
350
+ const unresolvedCount = this.queries.getUnresolvedReferencesCount();
351
+ options.onProgress?.({
352
+ phase: 'resolving',
353
+ current: 0,
354
+ total: unresolvedCount,
355
+ });
356
+ await this.resolveReferencesBatched((current, total) => {
357
+ options.onProgress?.({
358
+ phase: 'resolving',
359
+ current,
360
+ total,
361
+ });
362
+ });
363
+ // Second pass: chained calls whose method lives on a supertype the
364
+ // receiver conforms to (protocol-extension / inherited / default-
365
+ // interface). Needs the implements/extends edges the main pass just
366
+ // built, so it runs after resolution (#750).
367
+ this.resolver.resolveChainedCallsViaConformance();
368
+ // Same lifecycle for `this.<member>` callback registrations whose
369
+ // member is inherited from a supertype (#808).
370
+ this.resolver.resolveDeferredThisMemberRefs();
371
+ }
372
+ // Refresh planner stats + checkpoint the WAL after bulk writes.
373
+ // Cheap and non-blocking; never load-bearing for correctness.
374
+ if (result.success && result.filesIndexed > 0) {
375
+ this.db.runMaintenance();
376
+ }
377
+ // The orchestrator only sees extraction-phase counts; resolution and
378
+ // synthesizer edges (often >50% of the graph on JVM repos) come later.
379
+ // Recompute against the DB so the CLI summary reports the true totals.
380
+ if (result.success && result.filesIndexed > 0) {
381
+ const after = this.queries.getNodeAndEdgeCount();
382
+ result.nodesCreated = after.nodes - before.nodes;
383
+ result.edgesCreated = after.edges - before.edges;
384
+ }
385
+ // Stamp the index with the engine that built it, so `homegraph status`
386
+ // and `homegraph upgrade` can recommend a re-index when the running
387
+ // engine produces richer extraction than the one on disk. Only on a
388
+ // real full index — a sync touches a subset, so it must NOT advance the
389
+ // extraction stamp (the bulk would still be stale). See extraction-version.ts.
390
+ if (result.success && result.filesIndexed > 0) {
391
+ try {
392
+ this.queries.setMetadata('indexed_with_version', version_1.HomeGraphPackageVersion);
393
+ this.queries.setMetadata('indexed_with_extraction_version', String(extraction_version_1.EXTRACTION_VERSION));
394
+ }
395
+ catch { /* metadata is advisory — never fail an index over it */ }
396
+ }
397
+ return result;
398
+ }
399
+ finally {
400
+ this.fileLock.release();
401
+ }
402
+ });
403
+ }
404
+ /**
405
+ * Index specific files
406
+ *
407
+ * Uses a mutex to prevent concurrent indexing operations.
408
+ */
409
+ async indexFiles(filePaths) {
410
+ return this.indexMutex.withLock(async () => {
411
+ try {
412
+ this.fileLock.acquire();
413
+ }
414
+ catch {
415
+ return { success: false, filesIndexed: 0, filesSkipped: 0, filesErrored: 0, nodesCreated: 0, edgesCreated: 0, errors: [{ message: 'Could not acquire file lock - another process may be indexing', severity: 'error' }], durationMs: 0 };
416
+ }
417
+ try {
418
+ return this.orchestrator.indexFiles(filePaths);
419
+ }
420
+ finally {
421
+ this.fileLock.release();
422
+ }
423
+ });
424
+ }
425
+ /**
426
+ * Sync with current file state (incremental update)
427
+ *
428
+ * Uses a mutex to prevent concurrent indexing operations.
429
+ */
430
+ async sync(options = {}) {
431
+ return this.indexMutex.withLock(async () => {
432
+ try {
433
+ this.fileLock.acquire();
434
+ }
435
+ catch {
436
+ return { filesChecked: 0, filesAdded: 0, filesModified: 0, filesRemoved: 0, nodesUpdated: 0, durationMs: 0 };
437
+ }
438
+ try {
439
+ const result = await this.orchestrator.sync(options.onProgress);
440
+ // Cross-file finalization (e.g. NestJS RouterModule prefixes). Run on
441
+ // every sync that touched files so edits to `app.module.ts` propagate
442
+ // to controllers in unchanged files. The pass is idempotent and cheap
443
+ // (regex over *.module.ts only).
444
+ if (result.filesAdded > 0 || result.filesModified > 0) {
445
+ this.resolver.runPostExtract();
446
+ }
447
+ // Resolve references if files were updated
448
+ if (result.filesAdded > 0 || result.filesModified > 0) {
449
+ if (result.changedFilePaths) {
450
+ // Scope resolution to changed files (git fast path — bounded set)
451
+ const unresolvedRefs = this.queries.getUnresolvedReferencesByFiles(result.changedFilePaths);
452
+ options.onProgress?.({
453
+ phase: 'resolving',
454
+ current: 0,
455
+ total: unresolvedRefs.length,
456
+ });
457
+ this.resolver.resolveAndPersist(unresolvedRefs, (current, total) => {
458
+ options.onProgress?.({
459
+ phase: 'resolving',
460
+ current,
461
+ total,
462
+ });
463
+ });
464
+ }
465
+ else {
466
+ // No git info — use batched resolution to avoid OOM
467
+ const unresolvedCount = this.queries.getUnresolvedReferencesCount();
468
+ options.onProgress?.({
469
+ phase: 'resolving',
470
+ current: 0,
471
+ total: unresolvedCount,
472
+ });
473
+ await this.resolveReferencesBatched((current, total) => {
474
+ options.onProgress?.({
475
+ phase: 'resolving',
476
+ current,
477
+ total,
478
+ });
479
+ });
480
+ }
481
+ // Second pass: chained calls whose method lives on a supertype the
482
+ // receiver conforms to (protocol-extension / inherited). Needs the
483
+ // implements/extends edges built above (#750).
484
+ this.resolver.resolveChainedCallsViaConformance();
485
+ // Same lifecycle for `this.<member>` callback registrations whose
486
+ // member is inherited from a supertype (#808).
487
+ this.resolver.resolveDeferredThisMemberRefs();
488
+ }
489
+ // Refresh planner stats + checkpoint the WAL after bulk writes.
490
+ if (result.filesAdded > 0 || result.filesModified > 0 || result.filesRemoved > 0) {
491
+ this.db.runMaintenance();
492
+ }
493
+ return result;
494
+ }
495
+ finally {
496
+ this.fileLock.release();
497
+ }
498
+ });
499
+ }
500
+ /**
501
+ * Check if an indexing operation is currently in progress
502
+ */
503
+ isIndexing() {
504
+ return this.indexMutex.isLocked();
505
+ }
506
+ // ===========================================================================
507
+ // File Watching
508
+ // ===========================================================================
509
+ /**
510
+ * Start watching for file changes and auto-syncing.
511
+ *
512
+ * Uses native OS file events (FSEvents on macOS, inotify on Linux 19+,
513
+ * ReadDirectoryChangesW on Windows) with debouncing to avoid thrashing.
514
+ *
515
+ * @param options - Watch options (debounce delay, callbacks)
516
+ * @returns true if watching started successfully
517
+ */
518
+ watch(options = {}) {
519
+ if (this.watcher?.isActive())
520
+ return true;
521
+ this.watcher = new sync_1.FileWatcher(this.projectRoot, async () => {
522
+ const result = await this.sync();
523
+ // sync() returns this exact zero-shape iff it failed to acquire the
524
+ // file lock (a real empty sync always has filesChecked > 0 because
525
+ // scanDirectory ran). Surface that to the watcher as a typed error
526
+ // so it keeps pendingFiles + reschedules instead of clearing them
527
+ // (#449).
528
+ if (result.filesChecked === 0 && result.durationMs === 0) {
529
+ throw new sync_1.LockUnavailableError();
530
+ }
531
+ const filesChanged = result.filesAdded + result.filesModified + result.filesRemoved;
532
+ return { filesChanged, durationMs: result.durationMs };
533
+ }, options);
534
+ return this.watcher.start();
535
+ }
536
+ /**
537
+ * Stop watching for file changes.
538
+ */
539
+ unwatch() {
540
+ if (this.watcher) {
541
+ this.watcher.stop();
542
+ this.watcher = null;
543
+ }
544
+ }
545
+ /**
546
+ * Check if the file watcher is active.
547
+ */
548
+ isWatching() {
549
+ return this.watcher?.isActive() ?? false;
550
+ }
551
+ /**
552
+ * True once live watching has permanently degraded (OS watch-resource
553
+ * exhaustion, or a write lock held past the retry budget) and auto-sync is
554
+ * disabled until the next {@link watch} call. Distinct from `!isWatching()`:
555
+ * a stopped/never-started watcher is inactive but NOT degraded. MCP tools use
556
+ * this to surface a whole-index "results may be stale" notice, since
557
+ * `getPendingFiles()` goes empty once watching stops (#876).
558
+ */
559
+ isWatcherDegraded() {
560
+ return this.watcher?.isDegraded() ?? false;
561
+ }
562
+ /** The reason live watching degraded, or null if it is healthy (#876). */
563
+ getWatcherDegradedReason() {
564
+ return this.watcher?.getDegradedReason() ?? null;
565
+ }
566
+ /**
567
+ * Files seen by the file watcher since the last successful sync —
568
+ * the per-file "stale" signal MCP tools attach to responses so an agent
569
+ * can fall back to {@link Read} for just the affected file without
570
+ * waiting for a debounced sync to complete (issue #403).
571
+ *
572
+ * Returns an empty list when the watcher isn't active, or no events have
573
+ * arrived. Each entry includes `firstSeenMs` and `lastSeenMs` (wall-clock
574
+ * `Date.now()` values) so callers can render "edited Nms ago", plus an
575
+ * `indexing` flag indicating whether the in-flight sync (if any) will
576
+ * absorb that file.
577
+ */
578
+ getPendingFiles() {
579
+ return this.watcher?.getPendingFiles() ?? [];
580
+ }
581
+ /**
582
+ * Resolves once the file watcher has installed its watch set. Useful for
583
+ * tests that need a deterministic boundary before asserting on
584
+ * `getPendingFiles()`. Resolves immediately when no watcher is active.
585
+ */
586
+ waitUntilWatcherReady(timeoutMs) {
587
+ return this.watcher ? this.watcher.waitUntilReady(timeoutMs) : Promise.resolve();
588
+ }
589
+ /**
590
+ * Get files that have changed since last index
591
+ */
592
+ getChangedFiles() {
593
+ return this.orchestrator.getChangedFiles();
594
+ }
595
+ /**
596
+ * Most recent index timestamp (ms since epoch) across all tracked files, or
597
+ * null when nothing is indexed yet. Lets library consumers check index
598
+ * freshness without shelling out to `homegraph status --json`. (#329)
599
+ */
600
+ getLastIndexedAt() {
601
+ return this.queries.getLastIndexedAt();
602
+ }
603
+ /**
604
+ * Which engine built the current index: the package version + extraction
605
+ * version stamped at the last full `indexAll`. Either field is null for an
606
+ * index built before stamping existed (treated as stale). See
607
+ * `extraction-version.ts` and `isIndexStale()`.
608
+ */
609
+ getIndexBuildInfo() {
610
+ const version = this.queries.getMetadata('indexed_with_version');
611
+ const ev = this.queries.getMetadata('indexed_with_extraction_version');
612
+ const parsed = ev != null ? parseInt(ev, 10) : NaN;
613
+ return { version, extractionVersion: Number.isFinite(parsed) ? parsed : null };
614
+ }
615
+ /**
616
+ * True when the on-disk index was built by an engine whose extraction is
617
+ * older than the one now running — i.e. a re-index would add data a migration
618
+ * can't backfill. False when there's no index yet (nothing to refresh) or the
619
+ * stamp is current. This is the signal behind `homegraph status`'s re-index
620
+ * hint and `homegraph upgrade`'s reminder.
621
+ */
622
+ isIndexStale() {
623
+ if (this.queries.getLastIndexedAt() == null)
624
+ return false;
625
+ const { extractionVersion } = this.getIndexBuildInfo();
626
+ return extractionVersion == null || extractionVersion < extraction_version_1.EXTRACTION_VERSION;
627
+ }
628
+ /**
629
+ * Extract nodes and edges from source code (without storing)
630
+ */
631
+ extractFromSource(filePath, source) {
632
+ return (0, extraction_1.extractFromSource)(filePath, source);
633
+ }
634
+ // ===========================================================================
635
+ // Reference Resolution
636
+ // ===========================================================================
637
+ /**
638
+ * Resolve unresolved references and create edges
639
+ *
640
+ * This method takes unresolved references from extraction and attempts
641
+ * to resolve them using multiple strategies:
642
+ * - Framework-specific patterns (React, Express, Laravel)
643
+ * - Import-based resolution
644
+ * - Name-based symbol matching
645
+ */
646
+ resolveReferences(onProgress) {
647
+ // Get all unresolved references from the database
648
+ const unresolvedRefs = this.queries.getUnresolvedReferences();
649
+ return this.resolver.resolveAndPersist(unresolvedRefs, onProgress);
650
+ }
651
+ /**
652
+ * Resolve references in batches to keep memory bounded on large codebases.
653
+ * Processes chunks of unresolved refs, persisting results after each batch.
654
+ */
655
+ async resolveReferencesBatched(onProgress) {
656
+ return this.resolver.resolveAndPersistBatched(onProgress);
657
+ }
658
+ /**
659
+ * Get detected frameworks in the project
660
+ */
661
+ getDetectedFrameworks() {
662
+ return this.resolver.getDetectedFrameworks();
663
+ }
664
+ /**
665
+ * Re-initialize the resolver (useful after adding new files)
666
+ */
667
+ reinitializeResolver() {
668
+ this.resolver.initialize();
669
+ }
670
+ // ===========================================================================
671
+ // Graph Statistics
672
+ // ===========================================================================
673
+ /**
674
+ * Get statistics about the knowledge graph
675
+ */
676
+ getStats() {
677
+ const stats = this.queries.getStats();
678
+ stats.dbSizeBytes = this.db.getSize();
679
+ return stats;
680
+ }
681
+ /**
682
+ * Active SQLite backend for this project's connection (`node-sqlite` — Node's
683
+ * built-in real-SQLite module). Surfaced via `homegraph status` and the
684
+ * `homegraph_status` MCP tool alongside the effective journal mode.
685
+ */
686
+ getBackend() {
687
+ return this.db.getBackend();
688
+ }
689
+ /**
690
+ * The journal mode actually in effect ('wal', 'delete', …). 'wal' means
691
+ * readers never block on a concurrent writer; anything else means they can,
692
+ * which is the precondition for the "database is locked" failures in issue
693
+ * #238. Surfaced via `homegraph status` and the `homegraph_status` MCP tool.
694
+ */
695
+ getJournalMode() {
696
+ return this.db.getJournalMode();
697
+ }
698
+ // ===========================================================================
699
+ // Node Operations
700
+ // ===========================================================================
701
+ /**
702
+ * Get a node by ID
703
+ */
704
+ getNode(id) {
705
+ return this.queries.getNodeById(id);
706
+ }
707
+ /**
708
+ * Get all nodes in a file
709
+ */
710
+ getNodesInFile(filePath) {
711
+ return this.queries.getNodesByFile(filePath);
712
+ }
713
+ /**
714
+ * Get all nodes of a specific kind
715
+ */
716
+ getNodesByKind(kind) {
717
+ return this.queries.getNodesByKind(kind);
718
+ }
719
+ /**
720
+ * Get ALL nodes with an exact name (direct index lookup, not FTS-ranked/capped).
721
+ * Used to enumerate every overload of a heavily-overloaded name so the specific
722
+ * definition the caller wants is never dropped below a search cut.
723
+ */
724
+ getNodesByName(name) {
725
+ return this.queries.getNodesByName(name);
726
+ }
727
+ /**
728
+ * Search nodes by text
729
+ */
730
+ searchNodes(query, options) {
731
+ return this.queries.searchNodes(query, options);
732
+ }
733
+ /**
734
+ * Normalized project-name tokens (go.mod / package.json / repo dir) used to
735
+ * down-weight the non-discriminative project name in search ranking (#720).
736
+ * Exposed so explore can exclude it from the PascalCase type-disambiguation
737
+ * bias, which would otherwise pull overloaded tokens toward whichever stack
738
+ * embeds the project name.
739
+ */
740
+ getProjectNameTokens() {
741
+ return this.queries.getProjectNameTokens();
742
+ }
743
+ /**
744
+ * Find the project's "primary route file" — the file with the densest
745
+ * concentration of framework-emitted `route` nodes (≥3 routes, ≥30%
746
+ * of all non-test routes). Used to inline the routing config in
747
+ * `homegraph_explore` responses on small realworld template repos
748
+ * (rails-realworld, laravel-realworld, drupal-admintoolbar, …) where
749
+ * Glob+Read of `routes.rb`/`urls.py`/etc. otherwise beats homegraph.
750
+ */
751
+ getTopRouteFile() {
752
+ return this.queries.getTopRouteFile();
753
+ }
754
+ /**
755
+ * Build a URL → handler routing manifest from the index. Each entry
756
+ * pairs a route node (URL + method) with its handler function/method
757
+ * via the `references` edge that framework resolvers emit. Returns
758
+ * null when fewer than 3 valid (non-test) routes exist.
759
+ */
760
+ getRoutingManifest(limit) {
761
+ return this.queries.getRoutingManifest(limit);
762
+ }
763
+ // ===========================================================================
764
+ // Edge Operations
765
+ // ===========================================================================
766
+ /**
767
+ * Get outgoing edges from a node
768
+ */
769
+ getOutgoingEdges(nodeId) {
770
+ return this.queries.getOutgoingEdges(nodeId);
771
+ }
772
+ /**
773
+ * Get incoming edges to a node
774
+ */
775
+ getIncomingEdges(nodeId) {
776
+ return this.queries.getIncomingEdges(nodeId);
777
+ }
778
+ // ===========================================================================
779
+ // File Operations
780
+ // ===========================================================================
781
+ /**
782
+ * Get a file record by path
783
+ */
784
+ getFile(filePath) {
785
+ return this.queries.getFileByPath(filePath);
786
+ }
787
+ /**
788
+ * Get all tracked files
789
+ */
790
+ getFiles() {
791
+ return this.queries.getAllFiles();
792
+ }
793
+ // ===========================================================================
794
+ // Graph Query Methods
795
+ // ===========================================================================
796
+ /**
797
+ * Get the context for a node (ancestors, children, references)
798
+ *
799
+ * Returns comprehensive context about a node including its containment
800
+ * hierarchy, children, incoming/outgoing references, type information,
801
+ * and relevant imports.
802
+ *
803
+ * @param nodeId - ID of the focal node
804
+ * @returns Context object with all related information
805
+ */
806
+ getContext(nodeId) {
807
+ return this.graphManager.getContext(nodeId);
808
+ }
809
+ /**
810
+ * Traverse the graph from a starting node
811
+ *
812
+ * Uses breadth-first search by default. Supports filtering by edge types,
813
+ * node types, and traversal direction.
814
+ *
815
+ * @param startId - Starting node ID
816
+ * @param options - Traversal options
817
+ * @returns Subgraph containing traversed nodes and edges
818
+ */
819
+ traverse(startId, options) {
820
+ return this.traverser.traverseBFS(startId, options);
821
+ }
822
+ /**
823
+ * Get the call graph for a function
824
+ *
825
+ * Returns both callers (functions that call this function) and
826
+ * callees (functions called by this function) up to the specified depth.
827
+ *
828
+ * @param nodeId - ID of the function/method node
829
+ * @param depth - Maximum depth in each direction (default: 2)
830
+ * @returns Subgraph containing the call graph
831
+ */
832
+ getCallGraph(nodeId, depth = 2) {
833
+ return this.traverser.getCallGraph(nodeId, depth);
834
+ }
835
+ /**
836
+ * Get the type hierarchy for a class/interface
837
+ *
838
+ * Returns both ancestors (types this extends/implements) and
839
+ * descendants (types that extend/implement this).
840
+ *
841
+ * @param nodeId - ID of the class/interface node
842
+ * @returns Subgraph containing the type hierarchy
843
+ */
844
+ getTypeHierarchy(nodeId) {
845
+ return this.traverser.getTypeHierarchy(nodeId);
846
+ }
847
+ /**
848
+ * Find all usages of a symbol
849
+ *
850
+ * Returns all nodes that reference the specified symbol through
851
+ * any edge type (calls, references, type_of, etc.).
852
+ *
853
+ * @param nodeId - ID of the symbol node
854
+ * @returns Array of nodes and edges that reference this symbol
855
+ */
856
+ findUsages(nodeId) {
857
+ return this.traverser.findUsages(nodeId);
858
+ }
859
+ /**
860
+ * Get callers of a function/method
861
+ *
862
+ * @param nodeId - ID of the function/method node
863
+ * @param maxDepth - Maximum depth to traverse (default: 1)
864
+ * @returns Array of nodes that call this function
865
+ */
866
+ getCallers(nodeId, maxDepth = 1) {
867
+ return this.traverser.getCallers(nodeId, maxDepth);
868
+ }
869
+ /**
870
+ * Get callees of a function/method
871
+ *
872
+ * @param nodeId - ID of the function/method node
873
+ * @param maxDepth - Maximum depth to traverse (default: 1)
874
+ * @returns Array of nodes called by this function
875
+ */
876
+ getCallees(nodeId, maxDepth = 1) {
877
+ return this.traverser.getCallees(nodeId, maxDepth);
878
+ }
879
+ /**
880
+ * Calculate the impact radius of a node
881
+ *
882
+ * Returns all nodes that could be affected by changes to this node.
883
+ *
884
+ * @param nodeId - ID of the node
885
+ * @param maxDepth - Maximum depth to traverse (default: 3)
886
+ * @returns Subgraph containing potentially impacted nodes
887
+ */
888
+ getImpactRadius(nodeId, maxDepth = 3) {
889
+ return this.traverser.getImpactRadius(nodeId, maxDepth);
890
+ }
891
+ /**
892
+ * Find the shortest path between two nodes
893
+ *
894
+ * @param fromId - Starting node ID
895
+ * @param toId - Target node ID
896
+ * @param edgeKinds - Edge types to consider (all if empty)
897
+ * @returns Array of nodes and edges forming the path, or null if no path exists
898
+ */
899
+ findPath(fromId, toId, edgeKinds) {
900
+ return this.traverser.findPath(fromId, toId, edgeKinds);
901
+ }
902
+ /**
903
+ * Get ancestors of a node in the containment hierarchy
904
+ *
905
+ * @param nodeId - ID of the node
906
+ * @returns Array of ancestor nodes from immediate parent to root
907
+ */
908
+ getAncestors(nodeId) {
909
+ return this.traverser.getAncestors(nodeId);
910
+ }
911
+ /**
912
+ * Get immediate children of a node
913
+ *
914
+ * @param nodeId - ID of the node
915
+ * @returns Array of child nodes
916
+ */
917
+ getChildren(nodeId) {
918
+ return this.traverser.getChildren(nodeId);
919
+ }
920
+ /**
921
+ * Get dependencies of a file
922
+ *
923
+ * @param filePath - Path to the file
924
+ * @returns Array of file paths this file depends on
925
+ */
926
+ getFileDependencies(filePath) {
927
+ return this.graphManager.getFileDependencies(filePath);
928
+ }
929
+ /**
930
+ * Get dependents of a file
931
+ *
932
+ * @param filePath - Path to the file
933
+ * @returns Array of file paths that depend on this file
934
+ */
935
+ getFileDependents(filePath) {
936
+ return this.graphManager.getFileDependents(filePath);
937
+ }
938
+ /**
939
+ * Find circular dependencies in the codebase
940
+ *
941
+ * @returns Array of cycles, each cycle is an array of file paths
942
+ */
943
+ findCircularDependencies() {
944
+ return this.graphManager.findCircularDependencies();
945
+ }
946
+ /**
947
+ * Find dead code (unreferenced symbols)
948
+ *
949
+ * @param kinds - Node kinds to check (default: functions, methods, classes)
950
+ * @returns Array of unreferenced nodes
951
+ */
952
+ findDeadCode(kinds) {
953
+ return this.graphManager.findDeadCode(kinds);
954
+ }
955
+ /**
956
+ * Get complexity metrics for a node
957
+ *
958
+ * @param nodeId - ID of the node
959
+ * @returns Object containing various complexity metrics
960
+ */
961
+ getNodeMetrics(nodeId) {
962
+ return this.graphManager.getNodeMetrics(nodeId);
963
+ }
964
+ // ===========================================================================
965
+ // Context Building
966
+ // ===========================================================================
967
+ /**
968
+ * Get the source code for a node
969
+ *
970
+ * Reads the file and extracts the code between startLine and endLine.
971
+ *
972
+ * @param nodeId - ID of the node
973
+ * @returns Code string or null if not found
974
+ */
975
+ async getCode(nodeId) {
976
+ return this.contextBuilder.getCode(nodeId);
977
+ }
978
+ /**
979
+ * Find relevant subgraph for a query
980
+ *
981
+ * Combines semantic search with graph traversal to find the most
982
+ * relevant nodes and their relationships for a given query.
983
+ *
984
+ * @param query - Natural language query describing the task
985
+ * @param options - Search and traversal options
986
+ * @returns Subgraph of relevant nodes and edges
987
+ */
988
+ async findRelevantContext(query, options) {
989
+ return this.contextBuilder.findRelevantContext(query, options);
990
+ }
991
+ /**
992
+ * Build context for a task
993
+ *
994
+ * Creates comprehensive context by:
995
+ * 1. Running FTS search to find entry points
996
+ * 2. Expanding the graph around entry points
997
+ * 3. Extracting code blocks for key nodes
998
+ * 4. Formatting output for Claude
999
+ *
1000
+ * @param input - Task description (string or {title, description})
1001
+ * @param options - Build options (maxNodes, includeCode, format, etc.)
1002
+ * @returns TaskContext object or formatted string (markdown/JSON)
1003
+ */
1004
+ async buildContext(input, options) {
1005
+ return this.contextBuilder.buildContext(input, options);
1006
+ }
1007
+ // ===========================================================================
1008
+ // Database Management
1009
+ // ===========================================================================
1010
+ /**
1011
+ * Optimize the database (vacuum and analyze)
1012
+ */
1013
+ optimize() {
1014
+ this.db.optimize();
1015
+ }
1016
+ /**
1017
+ * Clear all data from the graph
1018
+ */
1019
+ clear() {
1020
+ this.queries.clear();
1021
+ }
1022
+ /**
1023
+ * Alias for close() for backwards compatibility.
1024
+ * @deprecated Use close() instead
1025
+ */
1026
+ destroy() {
1027
+ this.close();
1028
+ }
1029
+ /**
1030
+ * Completely remove HomeGraph from the project.
1031
+ * This closes the database and deletes the .HomeGraph directory.
1032
+ *
1033
+ * WARNING: This permanently deletes all HomeGraph data for the project.
1034
+ */
1035
+ uninitialize() {
1036
+ this.close();
1037
+ (0, directory_1.removeDirectory)(this.projectRoot);
1038
+ }
1039
+ }
1040
+ exports.HomeGraph = HomeGraph;
1041
+ // Default export
1042
+ exports.default = HomeGraph;
1043
+ //# sourceMappingURL=index.js.map