gitnexus 1.6.4-rc.65 → 1.6.4-rc.67

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.
@@ -206,6 +206,15 @@ 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
+ }
209
218
  try {
210
219
  if (conn)
211
220
  await conn.close();
@@ -245,6 +254,15 @@ const ensureLbugInitialized = async (dbPath) => {
245
254
  const doInitLbug = async (dbPath) => {
246
255
  // Different database requested — close the old one first
247
256
  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
+ }
248
266
  try {
249
267
  if (conn)
250
268
  await conn.close();
@@ -931,6 +949,22 @@ export const fetchExistingEmbeddingHashes = async (execQuery) => {
931
949
  }
932
950
  };
933
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
+ }
967
+ }
934
968
  if (conn) {
935
969
  try {
936
970
  await conn.close();
@@ -13,7 +13,17 @@ export const isGitRepo = (repoPath) => {
13
13
  };
14
14
  export const getCurrentCommit = (repoPath) => {
15
15
  try {
16
- return execSync('git rev-parse HEAD', { cwd: repoPath }).toString().trim();
16
+ return execSync('git rev-parse HEAD', {
17
+ cwd: repoPath,
18
+ // Suppress stderr -- without an explicit stdio option, Node's execSync
19
+ // forwards the child's stderr to the parent process (documented behaviour).
20
+ // When repoPath is not inside a git worktree, git prints
21
+ // "fatal: not a git repository" to stderr, which leaks to the user's
22
+ // terminal even though the error is caught here (#1172).
23
+ stdio: ['ignore', 'pipe', 'ignore'],
24
+ })
25
+ .toString()
26
+ .trim();
17
27
  }
18
28
  catch {
19
29
  return '';
@@ -83,7 +93,13 @@ export const getRemoteUrl = (repoPath) => {
83
93
  */
84
94
  export const getGitRoot = (fromPath) => {
85
95
  try {
86
- const raw = execSync('git rev-parse --show-toplevel', { cwd: fromPath }).toString().trim();
96
+ const raw = execSync('git rev-parse --show-toplevel', {
97
+ cwd: fromPath,
98
+ // Suppress stderr -- see getCurrentCommit comment and #1172.
99
+ stdio: ['ignore', 'pipe', 'ignore'],
100
+ })
101
+ .toString()
102
+ .trim();
87
103
  // On Windows, git returns /d/Projects/Foo — path.resolve normalizes to D:\Projects\Foo
88
104
  return path.resolve(raw);
89
105
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gitnexus",
3
- "version": "1.6.4-rc.65",
3
+ "version": "1.6.4-rc.67",
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",