gitnexus 1.6.5-rc.10 → 1.6.5-rc.11

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.
@@ -76,6 +76,9 @@ async function findRepoForCwd(cwd) {
76
76
  export async function augment(pattern, cwd) {
77
77
  if (!pattern || pattern.length < 3)
78
78
  return '';
79
+ const patternFirstWord = pattern.trim().replace(/'/g, "''").split(/\s+/)[0];
80
+ if (!patternFirstWord || patternFirstWord.length < 2)
81
+ return '';
79
82
  const workDir = cwd || process.cwd();
80
83
  try {
81
84
  const repo = await findRepoForCwd(workDir);
@@ -90,9 +93,7 @@ export async function augment(pattern, cwd) {
90
93
  await initLbug(repoId, repo.lbugPath);
91
94
  }
92
95
  // Step 1: BM25 search (fast, no embeddings)
93
- const { results: bm25Results } = await searchFTSFromLbug(pattern, 10, repoId);
94
- if (bm25Results.length === 0)
95
- return '';
96
+ const { results: bm25Results, ftsAvailable } = await searchFTSFromLbug(pattern, 10, repoId);
96
97
  // Step 2: Map BM25 file results to symbols
97
98
  const symbolMatches = [];
98
99
  for (const result of bm25Results.slice(0, 5)) {
@@ -100,7 +101,7 @@ export async function augment(pattern, cwd) {
100
101
  try {
101
102
  const symbols = await executeQuery(repoId, `
102
103
  MATCH (n) WHERE n.filePath = '${escaped}'
103
- AND n.name CONTAINS '${pattern.replace(/'/g, "''").split(/\s+/)[0]}'
104
+ AND n.name CONTAINS '${patternFirstWord}'
104
105
  RETURN n.id AS id, n.name AS name, labels(n)[0] AS type, n.filePath AS filePath
105
106
  LIMIT 3
106
107
  `);
@@ -118,6 +119,25 @@ export async function augment(pattern, cwd) {
118
119
  /* skip */
119
120
  }
120
121
  }
122
+ // When FTS indexes are unavailable (read-only DB, first run before indexes are built),
123
+ // fall back to a direct name CONTAINS query so enrichment still works.
124
+ if (symbolMatches.length === 0 && !ftsAvailable) {
125
+ const fallbackRows = await executeQuery(repoId, `
126
+ MATCH (n)
127
+ WHERE n.name CONTAINS '${patternFirstWord}'
128
+ RETURN n.id AS id, n.name AS name, labels(n)[0] AS type, n.filePath AS filePath
129
+ LIMIT 5
130
+ `).catch(() => []);
131
+ for (const sym of fallbackRows) {
132
+ symbolMatches.push({
133
+ nodeId: sym.id || sym[0],
134
+ name: sym.name || sym[1],
135
+ type: sym.type || sym[2],
136
+ filePath: sym.filePath || sym[3],
137
+ score: 1.0,
138
+ });
139
+ }
140
+ }
121
141
  if (symbolMatches.length === 0)
122
142
  return '';
123
143
  // Step 3: Batch-fetch callers/callees/processes/cohesion for top matches
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gitnexus",
3
- "version": "1.6.5-rc.10",
3
+ "version": "1.6.5-rc.11",
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",