gitnexus 1.6.4-rc.76 → 1.6.4-rc.78

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 (79) hide show
  1. package/dist/core/lbug/lbug-adapter.d.ts +25 -0
  2. package/dist/core/lbug/lbug-adapter.js +47 -64
  3. package/dist/server/api.js +3 -8
  4. package/package.json +1 -1
  5. package/web/assets/{agent-C9r8n_cf.js → agent-BjrCBEHR.js} +86 -86
  6. package/web/assets/architecture-YZFGNWBL-S5CXDPWN-D9pPD7Kb.js +1 -0
  7. package/web/assets/{architectureDiagram-EMZXCZ2Q-B7rdIFf-.js → architectureDiagram-EMZXCZ2Q-4q3MhuoF.js} +1 -1
  8. package/web/assets/{blockDiagram-IGV67L2C--OWFEwfO.js → blockDiagram-IGV67L2C-VMdXFXJJ.js} +1 -1
  9. package/web/assets/{c4Diagram-DFAF54RM-7j_8iiE6.js → c4Diagram-DFAF54RM-BcfusHPE.js} +1 -1
  10. package/web/assets/{chunk-3GS5O3IE-DRiJzb4K.js → chunk-3GS5O3IE-B3pmB04B.js} +1 -1
  11. package/web/assets/{chunk-3YCYZ6SJ-DINjuUhe.js → chunk-3YCYZ6SJ-BryGoQ4A.js} +1 -1
  12. package/web/assets/{chunk-6NTNNK5N-mbpPKRom.js → chunk-6NTNNK5N-BNhxj6xT.js} +1 -1
  13. package/web/assets/{chunk-A34GCYZU-9BNw3Yti.js → chunk-A34GCYZU-3UhGHJ1-.js} +1 -1
  14. package/web/assets/{chunk-DJ7UZH7F-B_7r9FpO.js → chunk-DJ7UZH7F-BKRo14eK.js} +1 -1
  15. package/web/assets/{chunk-DKKBVRCY-frEm8KEW.js → chunk-DKKBVRCY-CK6G8RrK.js} +2 -2
  16. package/web/assets/{chunk-DU5LTGQ6-BfEgiOSb.js → chunk-DU5LTGQ6-8K5PRaUH.js} +1 -1
  17. package/web/assets/{chunk-FXACKDTF-DDbh9iQA.js → chunk-FXACKDTF-cUe7-0hU.js} +1 -1
  18. package/web/assets/{chunk-H3VCZNTA-S6JCDFX6.js → chunk-H3VCZNTA-BX5l6OqC.js} +1 -1
  19. package/web/assets/{chunk-HN6EAY2L-DsuA2uD1.js → chunk-HN6EAY2L-CZJhj2LL.js} +1 -1
  20. package/web/assets/{chunk-O5ABG6QK-L5KyjcYu.js → chunk-O5ABG6QK-e6Czq1Xx.js} +1 -1
  21. package/web/assets/{chunk-PK6DOVAG-Cur_aKHW.js → chunk-PK6DOVAG-DmcZE3_M.js} +1 -1
  22. package/web/assets/{chunk-RNJOYNJ4-DcsVbdDR.js → chunk-RNJOYNJ4-CdN4Vf3V.js} +1 -1
  23. package/web/assets/{chunk-RWUO3TPN-DUDKXAYC.js → chunk-RWUO3TPN-BFZIkoo8.js} +1 -1
  24. package/web/assets/{chunk-TBF5ZNIQ-DEtcUvI1.js → chunk-TBF5ZNIQ-Bozwl_JU.js} +1 -1
  25. package/web/assets/{chunk-TYMNRAUI-0TEOcBv3.js → chunk-TYMNRAUI-DnyxLzTi.js} +1 -1
  26. package/web/assets/{chunk-W7ZLLLMY-DevGErJ8.js → chunk-W7ZLLLMY-c9tMkMDY.js} +1 -1
  27. package/web/assets/{chunk-WSB5WSVC-CckGrZr6.js → chunk-WSB5WSVC-C0abTbRm.js} +1 -1
  28. package/web/assets/{chunk-XGPFEOL4-C8lmtgql.js → chunk-XGPFEOL4-Dpk4IqZz.js} +1 -1
  29. package/web/assets/classDiagram-PPOCWD7C-C5OgoFTG.js +1 -0
  30. package/web/assets/classDiagram-v2-23LJLIIU-Ccdo6Y5l.js +1 -0
  31. package/web/assets/{cose-bilkent-PNC4W37J-DHbxEBIZ.js → cose-bilkent-PNC4W37J-DcwzKm9T.js} +1 -1
  32. package/web/assets/{dagre-E77IOHMT-BY6pnK09.js → dagre-E77IOHMT-2hVPofoA.js} +1 -1
  33. package/web/assets/{diagram-H7BISOXX-bqy_URgj.js → diagram-H7BISOXX-DVbs7hPw.js} +1 -1
  34. package/web/assets/{diagram-JC5VWROH-OMAxOz8H.js → diagram-JC5VWROH-D50OFTsF.js} +1 -1
  35. package/web/assets/{diagram-LXUTUG65-DIFIO54C.js → diagram-LXUTUG65-D8gbEZVJ.js} +1 -1
  36. package/web/assets/{diagram-WEHSV5V5-DWsrP1hB.js → diagram-WEHSV5V5-B2EmabEy.js} +1 -1
  37. package/web/assets/{erDiagram-GCSMX5X6-DIqN4pJM.js → erDiagram-GCSMX5X6-IzmUklsG.js} +1 -1
  38. package/web/assets/{flowDiagram-OTCZ4VVT-BHlfKH3t.js → flowDiagram-OTCZ4VVT-1YG9rasQ.js} +1 -1
  39. package/web/assets/{ganttDiagram-MUNLMDZQ-BJGbHagV.js → ganttDiagram-MUNLMDZQ-DJAjgiG1.js} +1 -1
  40. package/web/assets/gitGraph-7Q5UKJZL-54BCDZD5-CGY6QtbB.js +1 -0
  41. package/web/assets/{gitGraphDiagram-3HKGZ4G3-BlTN08lB.js → gitGraphDiagram-3HKGZ4G3-DZHVw0gL.js} +1 -1
  42. package/web/assets/{index-BcZj1uBK.js → index-BJ0KGZDn.js} +5 -5
  43. package/web/assets/info-OMHHGYJF-BF2H5H6G-B0_cQocP.js +1 -0
  44. package/web/assets/infoDiagram-MN7RKWGX-CQ66aaUD.js +2 -0
  45. package/web/assets/{ishikawaDiagram-YMYX4NHK-CZbsOXar.js → ishikawaDiagram-YMYX4NHK-K6PLvpwk.js} +1 -1
  46. package/web/assets/{journeyDiagram-SO5T7YLQ-DReaD--j.js → journeyDiagram-SO5T7YLQ-CXQwBWaw.js} +1 -1
  47. package/web/assets/{kanban-definition-LJHFXRCJ-BflrNkXo.js → kanban-definition-LJHFXRCJ-DgWn2fKY.js} +1 -1
  48. package/web/assets/{mindmap-definition-2EUWGEK5-BhFh-jY5.js → mindmap-definition-2EUWGEK5-kXsXFB47.js} +1 -1
  49. package/web/assets/packet-4T2RLAQJ-EV4IVRXR-oDY5WeCv.js +1 -0
  50. package/web/assets/pie-ZZUOXDRM-N23DN5KN-DgB0_1l6.js +1 -0
  51. package/web/assets/{pieDiagram-3IATQBI2-BM0_qTtj.js → pieDiagram-3IATQBI2-GjlQpIGV.js} +1 -1
  52. package/web/assets/{quadrantDiagram-E256RVCF-BPuExOtT.js → quadrantDiagram-E256RVCF-DF9_HGKP.js} +1 -1
  53. package/web/assets/radar-PYXPWWZC-P6TP7ZYP-DBCyufJh.js +1 -0
  54. package/web/assets/{requirementDiagram-M5DCFWZL-B-eP1h6R.js → requirementDiagram-M5DCFWZL-C3V0vpHf.js} +1 -1
  55. package/web/assets/{sankeyDiagram-L3NBLAOT-CJxcV3gi.js → sankeyDiagram-L3NBLAOT-5aPkPkKk.js} +1 -1
  56. package/web/assets/{sequenceDiagram-ZOUHS735-UyDJSU5_.js → sequenceDiagram-ZOUHS735-Ca4Mv7IK.js} +1 -1
  57. package/web/assets/{stateDiagram-MLPALWAM-CxB09HjX.js → stateDiagram-MLPALWAM-DGOkeb_a.js} +1 -1
  58. package/web/assets/stateDiagram-v2-B5LQ5ZB2-CjTKy3R1.js +1 -0
  59. package/web/assets/{timeline-definition-5SPVSISX-DkQCsILJ.js → timeline-definition-5SPVSISX-CTItG-AD.js} +1 -1
  60. package/web/assets/treeView-SZITEDCU-5DXDK3XO-CYy1b1gp.js +1 -0
  61. package/web/assets/treemap-W4RFUUIX-WYLRDWKO-ChoE4k2h.js +1 -0
  62. package/web/assets/{vennDiagram-IE5QUKF5-DyVkJExs.js → vennDiagram-IE5QUKF5-DRvKea_K.js} +1 -1
  63. package/web/assets/wardley-RL74JXVD-BCRCBASE-1idCtz75.js +1 -0
  64. package/web/assets/{wardleyDiagram-XU3VSMPF-DBXK78Eu.js → wardleyDiagram-XU3VSMPF-fD-6gFHA.js} +1 -1
  65. package/web/assets/{xychartDiagram-ZHJ5623Y-CZXbnIMV.js → xychartDiagram-ZHJ5623Y-CZ_NZz1Z.js} +1 -1
  66. package/web/index.html +1 -1
  67. package/web/assets/architecture-YZFGNWBL-S5CXDPWN-CL__bSw6.js +0 -1
  68. package/web/assets/classDiagram-PPOCWD7C-CTGiPkXU.js +0 -1
  69. package/web/assets/classDiagram-v2-23LJLIIU-Dzp9gwLx.js +0 -1
  70. package/web/assets/gitGraph-7Q5UKJZL-54BCDZD5-oeTgf84r.js +0 -1
  71. package/web/assets/info-OMHHGYJF-BF2H5H6G-DDl1dEae.js +0 -1
  72. package/web/assets/infoDiagram-MN7RKWGX-QsjEzLKD.js +0 -2
  73. package/web/assets/packet-4T2RLAQJ-EV4IVRXR-Bzc2XTYv.js +0 -1
  74. package/web/assets/pie-ZZUOXDRM-N23DN5KN-BpY1H6Ka.js +0 -1
  75. package/web/assets/radar-PYXPWWZC-P6TP7ZYP-tdqhrT8k.js +0 -1
  76. package/web/assets/stateDiagram-v2-B5LQ5ZB2-CoVPTpMR.js +0 -1
  77. package/web/assets/treeView-SZITEDCU-5DXDK3XO-DRdCAWYC.js +0 -1
  78. package/web/assets/treemap-W4RFUUIX-WYLRDWKO-Cwb3nItN.js +0 -1
  79. package/web/assets/wardley-RL74JXVD-BCRCBASE-Dd87C4yq.js +0 -1
@@ -119,6 +119,31 @@ export declare const loadCachedEmbeddings: () => Promise<{
119
119
  * @param execQuery - Cypher query executor (typically pool-adapter's `executeQuery`)
120
120
  */
121
121
  export declare const fetchExistingEmbeddingHashes: (execQuery: (cypher: string) => Promise<any[]>) => Promise<Map<string, string> | undefined>;
122
+ /**
123
+ * Flush the WAL so all pending writes are visible to subsequent readers.
124
+ *
125
+ * Best-effort: swallows errors from older LadybugDB versions or schemaless
126
+ * databases that do not support the CHECKPOINT command. A no-op when there
127
+ * is nothing pending, so safe (and cheap) to call unconditionally after any
128
+ * write path.
129
+ *
130
+ * Use this instead of safeClose when the connection must stay open
131
+ * (e.g. the /api/embed handler that keeps serving queries after flushing).
132
+ *
133
+ * @see safeClose — CHECKPOINT + connection/database close
134
+ */
135
+ export declare const flushWAL: () => Promise<void>;
136
+ /**
137
+ * Flush the WAL and close the connection and database handles.
138
+ *
139
+ * Consolidates the CHECKPOINT + close pattern into a single function so
140
+ * callers never call conn.close() or db.close() directly (#1376).
141
+ * An ESLint no-restricted-syntax rule enforces this — see eslint.config.mjs.
142
+ *
143
+ * @see flushWAL — CHECKPOINT-only (connection stays open)
144
+ * @see closeLbug — safeClose + module state reset (full teardown)
145
+ */
146
+ export declare const safeClose: () => Promise<void>;
122
147
  export declare const closeLbug: () => Promise<void>;
123
148
  export declare const isLbugReady: () => boolean;
124
149
  /**
@@ -206,31 +206,7 @@ export const withLbugDb = async (dbPath, operation) => {
206
206
  // Close stale connection inside the session lock to prevent race conditions
207
207
  // with concurrent operations that might acquire the lock between cleanup steps
208
208
  await runWithSessionLock(async () => {
209
- // CHECKPOINT before close to flush WAL contents (same rationale as closeLbug)
210
- if (conn) {
211
- try {
212
- await conn.query('CHECKPOINT');
213
- }
214
- catch {
215
- /* best-effort */
216
- }
217
- }
218
- try {
219
- if (conn)
220
- await conn.close();
221
- }
222
- catch {
223
- /* best-effort */
224
- }
225
- try {
226
- if (db)
227
- await db.close();
228
- }
229
- catch {
230
- /* best-effort */
231
- }
232
- conn = null;
233
- db = null;
209
+ await safeClose();
234
210
  currentDbPath = null;
235
211
  ftsLoaded = false;
236
212
  vectorExtensionLoaded = false;
@@ -254,27 +230,7 @@ const ensureLbugInitialized = async (dbPath) => {
254
230
  const doInitLbug = async (dbPath) => {
255
231
  // Different database requested — close the old one first
256
232
  if (conn || db) {
257
- // CHECKPOINT before close to flush WAL contents (same rationale as closeLbug)
258
- if (conn) {
259
- try {
260
- await conn.query('CHECKPOINT');
261
- }
262
- catch {
263
- /* ignore — older LadybugDB or schemaless DB may not accept it */
264
- }
265
- }
266
- try {
267
- if (conn)
268
- await conn.close();
269
- }
270
- catch { }
271
- try {
272
- if (db)
273
- await db.close();
274
- }
275
- catch { }
276
- conn = null;
277
- db = null;
233
+ await safeClose();
278
234
  currentDbPath = null;
279
235
  ftsLoaded = false;
280
236
  vectorExtensionLoaded = false;
@@ -948,37 +904,64 @@ export const fetchExistingEmbeddingHashes = async (execQuery) => {
948
904
  throw err;
949
905
  }
950
906
  };
951
- export const closeLbug = async () => {
952
- // CHECKPOINT before close so the WAL/.shadow contents are flushed into
953
- // the main database file. Without this, LadybugDB 0.16.0's non-blocking
954
- // checkpoint thread can outlive the close call and leave sidecar pages
955
- // pending on disk, which makes a subsequent read-side open either race
956
- // with the WAL replay or trip the database-id check on the sidecars.
957
- // This is especially critical after embedding writes, which generate
958
- // large amounts of WAL data. CHECKPOINT is a no-op when there's nothing
959
- // pending, so it's cheap on the happy path.
960
- if (conn) {
961
- try {
962
- await conn.query('CHECKPOINT');
963
- }
964
- catch {
965
- /* ignore — older LadybugDB or schemaless DB may not accept it */
966
- }
907
+ /**
908
+ * Flush the WAL so all pending writes are visible to subsequent readers.
909
+ *
910
+ * Best-effort: swallows errors from older LadybugDB versions or schemaless
911
+ * databases that do not support the CHECKPOINT command. A no-op when there
912
+ * is nothing pending, so safe (and cheap) to call unconditionally after any
913
+ * write path.
914
+ *
915
+ * Use this instead of safeClose when the connection must stay open
916
+ * (e.g. the /api/embed handler that keeps serving queries after flushing).
917
+ *
918
+ * @see safeClose — CHECKPOINT + connection/database close
919
+ */
920
+ export const flushWAL = async () => {
921
+ if (!conn)
922
+ return;
923
+ try {
924
+ await conn.query('CHECKPOINT');
967
925
  }
926
+ catch {
927
+ /* ignore — older LadybugDB or schemaless DB may not accept it */
928
+ }
929
+ };
930
+ /**
931
+ * Flush the WAL and close the connection and database handles.
932
+ *
933
+ * Consolidates the CHECKPOINT + close pattern into a single function so
934
+ * callers never call conn.close() or db.close() directly (#1376).
935
+ * An ESLint no-restricted-syntax rule enforces this — see eslint.config.mjs.
936
+ *
937
+ * @see flushWAL — CHECKPOINT-only (connection stays open)
938
+ * @see closeLbug — safeClose + module state reset (full teardown)
939
+ */
940
+ export const safeClose = async () => {
941
+ await flushWAL();
968
942
  if (conn) {
969
943
  try {
944
+ // eslint-disable-next-line no-restricted-syntax -- sole authorised close site
970
945
  await conn.close();
971
946
  }
972
- catch { }
947
+ catch {
948
+ /* best-effort */
949
+ }
973
950
  conn = null;
974
951
  }
975
952
  if (db) {
976
953
  try {
954
+ // eslint-disable-next-line no-restricted-syntax -- sole authorised close site
977
955
  await db.close();
978
956
  }
979
- catch { }
957
+ catch {
958
+ /* best-effort */
959
+ }
980
960
  db = null;
981
961
  }
962
+ };
963
+ export const closeLbug = async () => {
964
+ await safeClose();
982
965
  currentDbPath = null;
983
966
  ftsLoaded = false;
984
967
  vectorExtensionLoaded = false;
@@ -13,7 +13,7 @@ import path from 'path';
13
13
  import fs from 'fs/promises';
14
14
  import { createRequire } from 'node:module';
15
15
  import { loadMeta, listRegisteredRepos, getStoragePath } from '../storage/repo-manager.js';
16
- import { executeQuery, executePrepared, executeWithReusedStatement, streamQuery, closeLbug, withLbugDb, } from '../core/lbug/lbug-adapter.js';
16
+ import { executeQuery, executePrepared, executeWithReusedStatement, streamQuery, flushWAL, closeLbug, withLbugDb, } from '../core/lbug/lbug-adapter.js';
17
17
  import { isWriteQuery } from '../core/lbug/pool-adapter.js';
18
18
  import { NODE_TABLES } from '../_shared/index.js';
19
19
  import { searchFTSFromLbug } from '../core/search/bm25-index.js';
@@ -1508,13 +1508,8 @@ export const createServer = async (port, host = '127.0.0.1') => {
1508
1508
  // Flush WAL so subsequent /api/search requests see the new
1509
1509
  // embeddings immediately (#1149). In the CLI path closeLbug()
1510
1510
  // handles this during process exit, but the server keeps the
1511
- // connection open for other routes -- a CHECKPOINT is enough.
1512
- try {
1513
- await executeQuery('CHECKPOINT');
1514
- }
1515
- catch {
1516
- /* best-effort -- older LadybugDB may not support it */
1517
- }
1511
+ // connection open for other routes a CHECKPOINT is enough.
1512
+ await flushWAL();
1518
1513
  });
1519
1514
  clearTimeout(embedTimeout);
1520
1515
  releaseRepoLock(repoLockPath);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gitnexus",
3
- "version": "1.6.4-rc.76",
3
+ "version": "1.6.4-rc.78",
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",