gitnexus 1.6.3 → 1.6.4-rc.10
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.
- package/dist/_shared/index.d.ts +1 -1
- package/dist/_shared/index.d.ts.map +1 -1
- package/dist/_shared/index.js +1 -1
- package/dist/_shared/index.js.map +1 -1
- package/dist/_shared/scope-resolution/finalize-algorithm.d.ts +22 -14
- package/dist/_shared/scope-resolution/finalize-algorithm.d.ts.map +1 -1
- package/dist/_shared/scope-resolution/finalize-algorithm.js +298 -37
- package/dist/_shared/scope-resolution/finalize-algorithm.js.map +1 -1
- package/dist/_shared/scope-resolution/scope-tree.d.ts +23 -1
- package/dist/_shared/scope-resolution/scope-tree.d.ts.map +1 -1
- package/dist/_shared/scope-resolution/scope-tree.js +36 -2
- package/dist/_shared/scope-resolution/scope-tree.js.map +1 -1
- package/dist/_shared/scope-resolution/types.d.ts +47 -3
- package/dist/_shared/scope-resolution/types.d.ts.map +1 -1
- package/dist/_shared/scope-resolution/types.js +10 -2
- package/dist/_shared/scope-resolution/types.js.map +1 -1
- package/dist/core/embeddings/embedder.js +2 -1
- package/dist/core/ingestion/call-processor.js +2 -2
- package/dist/core/ingestion/constants.d.ts +4 -3
- package/dist/core/ingestion/constants.js +8 -3
- package/dist/core/ingestion/finalize-orchestrator.js +6 -3
- package/dist/core/ingestion/heritage-processor.js +2 -2
- package/dist/core/ingestion/import-processor.js +1 -1
- package/dist/core/ingestion/languages/csharp/captures.js +4 -1
- package/dist/core/ingestion/languages/csharp/namespace-siblings.d.ts +14 -13
- package/dist/core/ingestion/languages/csharp/namespace-siblings.js +62 -50
- package/dist/core/ingestion/languages/python/captures.js +9 -1
- package/dist/core/ingestion/languages/python/index.d.ts +1 -1
- package/dist/core/ingestion/languages/python/index.js +1 -1
- package/dist/core/ingestion/languages/python/simple-hooks.d.ts +3 -1
- package/dist/core/ingestion/languages/python/simple-hooks.js +8 -0
- package/dist/core/ingestion/languages/python.js +2 -1
- package/dist/core/ingestion/languages/typescript/arity-metadata.d.ts +59 -0
- package/dist/core/ingestion/languages/typescript/arity-metadata.js +103 -0
- package/dist/core/ingestion/languages/typescript/arity.d.ts +37 -0
- package/dist/core/ingestion/languages/typescript/arity.js +54 -0
- package/dist/core/ingestion/languages/typescript/cache-stats.d.ts +17 -0
- package/dist/core/ingestion/languages/typescript/cache-stats.js +28 -0
- package/dist/core/ingestion/languages/typescript/captures.d.ts +28 -0
- package/dist/core/ingestion/languages/typescript/captures.js +451 -0
- package/dist/core/ingestion/languages/typescript/import-decomposer.d.ts +49 -0
- package/dist/core/ingestion/languages/typescript/import-decomposer.js +371 -0
- package/dist/core/ingestion/languages/typescript/import-target.d.ts +50 -0
- package/dist/core/ingestion/languages/typescript/import-target.js +61 -0
- package/dist/core/ingestion/languages/typescript/index.d.ts +94 -0
- package/dist/core/ingestion/languages/typescript/index.js +94 -0
- package/dist/core/ingestion/languages/typescript/interpret.d.ts +35 -0
- package/dist/core/ingestion/languages/typescript/interpret.js +317 -0
- package/dist/core/ingestion/languages/typescript/merge-bindings.d.ts +62 -0
- package/dist/core/ingestion/languages/typescript/merge-bindings.js +158 -0
- package/dist/core/ingestion/languages/typescript/query.d.ts +77 -0
- package/dist/core/ingestion/languages/typescript/query.js +778 -0
- package/dist/core/ingestion/languages/typescript/receiver-binding.d.ts +59 -0
- package/dist/core/ingestion/languages/typescript/receiver-binding.js +171 -0
- package/dist/core/ingestion/languages/typescript/scope-resolver.d.ts +16 -0
- package/dist/core/ingestion/languages/typescript/scope-resolver.js +113 -0
- package/dist/core/ingestion/languages/typescript/simple-hooks.d.ts +71 -0
- package/dist/core/ingestion/languages/typescript/simple-hooks.js +131 -0
- package/dist/core/ingestion/languages/typescript.js +19 -0
- package/dist/core/ingestion/model/scope-resolution-indexes.d.ts +14 -1
- package/dist/core/ingestion/parsing-processor.js +3 -3
- package/dist/core/ingestion/registry-primary-flag.d.ts +3 -1
- package/dist/core/ingestion/registry-primary-flag.js +4 -1
- package/dist/core/ingestion/scope-extractor-bridge.d.ts +5 -2
- package/dist/core/ingestion/scope-extractor-bridge.js +7 -2
- package/dist/core/ingestion/scope-extractor.js +19 -18
- package/dist/core/ingestion/scope-resolution/contract/scope-resolver.d.ts +73 -11
- package/dist/core/ingestion/scope-resolution/contract/scope-resolver.js +48 -10
- package/dist/core/ingestion/scope-resolution/passes/compound-receiver.js +283 -14
- package/dist/core/ingestion/scope-resolution/passes/imported-return-types.d.ts +23 -2
- package/dist/core/ingestion/scope-resolution/passes/imported-return-types.js +109 -37
- package/dist/core/ingestion/scope-resolution/passes/mro.js +3 -1
- package/dist/core/ingestion/scope-resolution/passes/receiver-bound-calls.js +13 -5
- package/dist/core/ingestion/scope-resolution/pipeline/phase.js +11 -2
- package/dist/core/ingestion/scope-resolution/pipeline/registry.js +2 -0
- package/dist/core/ingestion/scope-resolution/pipeline/run.d.ts +8 -0
- package/dist/core/ingestion/scope-resolution/pipeline/run.js +21 -5
- package/dist/core/ingestion/scope-resolution/pipeline/validate-bindings-immutability.d.ts +39 -0
- package/dist/core/ingestion/scope-resolution/pipeline/validate-bindings-immutability.js +65 -0
- package/dist/core/ingestion/scope-resolution/scope/walkers.d.ts +54 -11
- package/dist/core/ingestion/scope-resolution/scope/walkers.js +105 -30
- package/dist/core/ingestion/utils/ast-helpers.d.ts +2 -0
- package/dist/core/ingestion/utils/ast-helpers.js +12 -0
- package/dist/core/ingestion/utils/env.d.ts +10 -0
- package/dist/core/ingestion/utils/env.js +14 -0
- package/dist/core/ingestion/workers/parse-worker.js +3 -3
- package/dist/core/lbug/lbug-adapter.d.ts +3 -4
- package/dist/core/lbug/lbug-adapter.js +6 -9
- package/dist/core/run-analyze.js +4 -6
- package/dist/core/search/bm25-index.d.ts +0 -17
- package/dist/core/search/bm25-index.js +10 -118
- package/dist/core/search/fts-indexes.d.ts +1 -0
- package/dist/core/search/fts-indexes.js +7 -0
- package/dist/core/search/fts-schema.d.ts +6 -0
- package/dist/core/search/fts-schema.js +7 -0
- package/dist/mcp/core/embedder.js +3 -1
- package/package.json +1 -1
- package/skills/gitnexus-cli.md +1 -1
package/dist/core/run-analyze.js
CHANGED
|
@@ -12,6 +12,7 @@ import path from 'path';
|
|
|
12
12
|
import fs from 'fs/promises';
|
|
13
13
|
import { runPipelineFromRepo } from './ingestion/pipeline.js';
|
|
14
14
|
import { initLbug, loadGraphToLbug, getLbugStats, executeQuery, executeWithReusedStatement, closeLbug, loadCachedEmbeddings, } from './lbug/lbug-adapter.js';
|
|
15
|
+
import { createSearchFTSIndexes } from './search/fts-indexes.js';
|
|
15
16
|
import { getStoragePaths, saveMeta, loadMeta, addToGitignore, registerRepo, cleanupOldKuzuFiles, } from '../storage/repo-manager.js';
|
|
16
17
|
import { getCurrentCommit, getRemoteUrl, hasGitDir, getInferredRepoName } from '../storage/git.js';
|
|
17
18
|
import { generateAIContextFiles } from '../cli/ai-context.js';
|
|
@@ -165,12 +166,9 @@ export async function runFullAnalysis(repoPath, options, callbacks) {
|
|
|
165
166
|
progress('lbug', pct, msg);
|
|
166
167
|
});
|
|
167
168
|
// ── Phase 3: FTS (85–90%) ─────────────────────────────────────────
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
// which dominated `analyze` runtime and pushed Windows CI past its
|
|
172
|
-
// 30 s test budget. Lazy creation is implemented in
|
|
173
|
-
// `core/search/bm25-index.ts` via `ensureFTSIndex`.
|
|
169
|
+
progress('fts', 85, 'Creating search indexes...');
|
|
170
|
+
await createSearchFTSIndexes();
|
|
171
|
+
progress('fts', 90, 'Search indexes ready');
|
|
174
172
|
// ── Phase 3.5: Re-insert cached embeddings ────────────────────────
|
|
175
173
|
if (cachedEmbeddings.length > 0) {
|
|
176
174
|
const cachedDims = cachedEmbeddings[0].embedding.length;
|
|
@@ -3,12 +3,6 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Uses LadybugDB's built-in full-text search indexes for keyword-based search.
|
|
5
5
|
* Always reads from the database (no cached state to drift).
|
|
6
|
-
*
|
|
7
|
-
* FTS indexes are created lazily on first query (via `ensureFTSIndex`) — see
|
|
8
|
-
* `lbug-adapter.ts` for the rationale. This keeps `analyze` fast (the
|
|
9
|
-
* ~440 ms × 5 LadybugDB CREATE_FTS_INDEX cost dominates pipeline time on
|
|
10
|
-
* small repos / CI runners) at the cost of paying that overhead on the
|
|
11
|
-
* first `query`/`context` call in a session.
|
|
12
6
|
*/
|
|
13
7
|
export interface BM25SearchResult {
|
|
14
8
|
filePath: string;
|
|
@@ -16,17 +10,6 @@ export interface BM25SearchResult {
|
|
|
16
10
|
rank: number;
|
|
17
11
|
nodeIds?: string[];
|
|
18
12
|
}
|
|
19
|
-
/**
|
|
20
|
-
* Drop all ensured-FTS cache entries for a given repoId.
|
|
21
|
-
*
|
|
22
|
-
* Called from the pool-close listener so that a pool teardown / recreation
|
|
23
|
-
* forces the next `searchFTSFromLbug` call to re-issue `CREATE_FTS_INDEX`
|
|
24
|
-
* against the fresh connection rather than trust stale ensure-state from a
|
|
25
|
-
* previous pool lifetime.
|
|
26
|
-
*
|
|
27
|
-
* Exported for tests; the listener wiring is internal.
|
|
28
|
-
*/
|
|
29
|
-
export declare function invalidateEnsuredFTSForRepo(repoId: string): void;
|
|
30
13
|
/**
|
|
31
14
|
* Search using LadybugDB's built-in FTS (always fresh, reads from disk)
|
|
32
15
|
*
|
|
@@ -3,96 +3,9 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Uses LadybugDB's built-in full-text search indexes for keyword-based search.
|
|
5
5
|
* Always reads from the database (no cached state to drift).
|
|
6
|
-
*
|
|
7
|
-
* FTS indexes are created lazily on first query (via `ensureFTSIndex`) — see
|
|
8
|
-
* `lbug-adapter.ts` for the rationale. This keeps `analyze` fast (the
|
|
9
|
-
* ~440 ms × 5 LadybugDB CREATE_FTS_INDEX cost dominates pipeline time on
|
|
10
|
-
* small repos / CI runners) at the cost of paying that overhead on the
|
|
11
|
-
* first `query`/`context` call in a session.
|
|
12
|
-
*/
|
|
13
|
-
import { queryFTS, ensureFTSIndex } from '../lbug/lbug-adapter.js';
|
|
14
|
-
/**
|
|
15
|
-
* FTS schema served by `searchFTSFromLbug`. Centralised so that both the
|
|
16
|
-
* CLI/pipeline path and the MCP pool path use identical (table, index,
|
|
17
|
-
* properties) tuples and the lazy-create logic stays in one place.
|
|
18
|
-
*/
|
|
19
|
-
const FTS_INDEXES = [
|
|
20
|
-
{ table: 'File', indexName: 'file_fts', properties: ['name', 'content'] },
|
|
21
|
-
{ table: 'Function', indexName: 'function_fts', properties: ['name', 'content'] },
|
|
22
|
-
{ table: 'Class', indexName: 'class_fts', properties: ['name', 'content'] },
|
|
23
|
-
{ table: 'Method', indexName: 'method_fts', properties: ['name', 'content'] },
|
|
24
|
-
{ table: 'Interface', indexName: 'interface_fts', properties: ['name', 'content'] },
|
|
25
|
-
];
|
|
26
|
-
/**
|
|
27
|
-
* Per-process cache for the MCP pool path: tracks which `(repoId, table)`
|
|
28
|
-
* pairs have been ensured. The CLI/pipeline path gets its own cache inside
|
|
29
|
-
* `lbug-adapter.ts` keyed by table/index, scoped to the singleton connection.
|
|
30
|
-
*
|
|
31
|
-
* IMPORTANT: an entry is added ONLY when the index was confirmed to exist
|
|
32
|
-
* (CREATE_FTS_INDEX succeeded, or failed with `'already exists'`). Other
|
|
33
|
-
* failures (transient lock errors, missing extension, etc.) leave the key
|
|
34
|
-
* unset so the next query retries instead of silently caching the failure.
|
|
35
|
-
*
|
|
36
|
-
* Entries for a given repoId are invalidated when its pool is closed —
|
|
37
|
-
* see the `addPoolCloseListener` registration in `searchFTSFromLbug`.
|
|
38
|
-
*/
|
|
39
|
-
const ensuredPoolFTS = new Set();
|
|
40
|
-
/**
|
|
41
|
-
* Drop all ensured-FTS cache entries for a given repoId.
|
|
42
|
-
*
|
|
43
|
-
* Called from the pool-close listener so that a pool teardown / recreation
|
|
44
|
-
* forces the next `searchFTSFromLbug` call to re-issue `CREATE_FTS_INDEX`
|
|
45
|
-
* against the fresh connection rather than trust stale ensure-state from a
|
|
46
|
-
* previous pool lifetime.
|
|
47
|
-
*
|
|
48
|
-
* Exported for tests; the listener wiring is internal.
|
|
49
6
|
*/
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
for (const key of ensuredPoolFTS) {
|
|
53
|
-
if (key.startsWith(prefix))
|
|
54
|
-
ensuredPoolFTS.delete(key);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Tracks whether we've already wired the pool-close listener for this
|
|
59
|
-
* process. The pool adapter is dynamically imported, so registration
|
|
60
|
-
* happens lazily on the first MCP-pool-backed FTS query.
|
|
61
|
-
*/
|
|
62
|
-
let poolCloseListenerRegistered = false;
|
|
63
|
-
function registerPoolCloseListenerOnce(addPoolCloseListener) {
|
|
64
|
-
if (poolCloseListenerRegistered)
|
|
65
|
-
return;
|
|
66
|
-
poolCloseListenerRegistered = true;
|
|
67
|
-
addPoolCloseListener((repoId) => invalidateEnsuredFTSForRepo(repoId));
|
|
68
|
-
}
|
|
69
|
-
async function ensureFTSIndexViaExecutor(executor, repoId, table, indexName, properties) {
|
|
70
|
-
const key = `${repoId}:${table}:${indexName}`;
|
|
71
|
-
if (ensuredPoolFTS.has(key))
|
|
72
|
-
return;
|
|
73
|
-
const propList = properties.map((p) => `'${p}'`).join(', ');
|
|
74
|
-
try {
|
|
75
|
-
await executor(`CALL CREATE_FTS_INDEX('${table}', '${indexName}', [${propList}], stemmer := 'porter')`);
|
|
76
|
-
// Index was created successfully — safe to cache.
|
|
77
|
-
ensuredPoolFTS.add(key);
|
|
78
|
-
}
|
|
79
|
-
catch (e) {
|
|
80
|
-
// 'already exists' is the happy path (index persists on disk between
|
|
81
|
-
// process invocations) — cache it. Anything else is treated as a
|
|
82
|
-
// transient failure: surface a one-time warning and leave the key
|
|
83
|
-
// unset so the NEXT query retries rather than silently using a
|
|
84
|
-
// cached failure (which previously disabled BM25 for the whole
|
|
85
|
-
// process for that repo).
|
|
86
|
-
const msg = String(e?.message ?? '');
|
|
87
|
-
if (msg.includes('already exists')) {
|
|
88
|
-
ensuredPoolFTS.add(key);
|
|
89
|
-
}
|
|
90
|
-
else {
|
|
91
|
-
console.warn(`[gitnexus] FTS index ensure failed for repo "${repoId}" table "${table}" ` +
|
|
92
|
-
`(index "${indexName}"): ${msg || e}. Will retry on next query.`);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
7
|
+
import { queryFTS } from '../lbug/lbug-adapter.js';
|
|
8
|
+
import { FTS_INDEXES } from './fts-schema.js';
|
|
96
9
|
/**
|
|
97
10
|
* Execute a single FTS query via a custom executor (for MCP connection pool).
|
|
98
11
|
* Returns the same shape as core queryFTS (from LadybugDB adapter).
|
|
@@ -134,41 +47,23 @@ async function queryFTSViaExecutor(executor, tableName, indexName, query, limit)
|
|
|
134
47
|
* @returns Ranked search results from FTS indexes
|
|
135
48
|
*/
|
|
136
49
|
export const searchFTSFromLbug = async (query, limit = 20, repoId) => {
|
|
137
|
-
|
|
50
|
+
const resultsByIndex = [];
|
|
138
51
|
if (repoId) {
|
|
139
52
|
// Use MCP connection pool via dynamic import
|
|
140
53
|
// IMPORTANT: FTS queries run sequentially to avoid connection contention.
|
|
141
54
|
// The MCP pool supports multiple connections, but FTS is best run serially.
|
|
142
55
|
const poolMod = await import('../lbug/pool-adapter.js');
|
|
143
|
-
const { executeQuery
|
|
144
|
-
// Register the pool-close listener lazily on first use so a teardown of
|
|
145
|
-
// the pool entry (LRU eviction, idle timeout, explicit close) drops the
|
|
146
|
-
// matching `ensuredPoolFTS` entries. Without this, stale ensure-state
|
|
147
|
-
// can outlive the pool that produced it.
|
|
148
|
-
registerPoolCloseListenerOnce(addPoolCloseListener);
|
|
56
|
+
const { executeQuery } = poolMod;
|
|
149
57
|
const executor = (cypher) => executeQuery(repoId, cypher);
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
for (const { table, indexName, properties } of FTS_INDEXES) {
|
|
153
|
-
await ensureFTSIndexViaExecutor(executor, repoId, table, indexName, properties);
|
|
58
|
+
for (const { table, indexName } of FTS_INDEXES) {
|
|
59
|
+
resultsByIndex.push(await queryFTSViaExecutor(executor, table, indexName, query, limit));
|
|
154
60
|
}
|
|
155
|
-
fileResults = await queryFTSViaExecutor(executor, 'File', 'file_fts', query, limit);
|
|
156
|
-
functionResults = await queryFTSViaExecutor(executor, 'Function', 'function_fts', query, limit);
|
|
157
|
-
classResults = await queryFTSViaExecutor(executor, 'Class', 'class_fts', query, limit);
|
|
158
|
-
methodResults = await queryFTSViaExecutor(executor, 'Method', 'method_fts', query, limit);
|
|
159
|
-
interfaceResults = await queryFTSViaExecutor(executor, 'Interface', 'interface_fts', query, limit);
|
|
160
61
|
}
|
|
161
62
|
else {
|
|
162
63
|
// Use core lbug adapter (CLI / pipeline context) — also sequential for safety.
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
await ensureFTSIndex(table, indexName, [...properties]).catch(() => { });
|
|
64
|
+
for (const { table, indexName } of FTS_INDEXES) {
|
|
65
|
+
resultsByIndex.push(await queryFTS(table, indexName, query, limit, false).catch(() => []));
|
|
166
66
|
}
|
|
167
|
-
fileResults = await queryFTS('File', 'file_fts', query, limit, false).catch(() => []);
|
|
168
|
-
functionResults = await queryFTS('Function', 'function_fts', query, limit, false).catch(() => []);
|
|
169
|
-
classResults = await queryFTS('Class', 'class_fts', query, limit, false).catch(() => []);
|
|
170
|
-
methodResults = await queryFTS('Method', 'method_fts', query, limit, false).catch(() => []);
|
|
171
|
-
interfaceResults = await queryFTS('Interface', 'interface_fts', query, limit, false).catch(() => []);
|
|
172
67
|
}
|
|
173
68
|
// Collect all node scores per filePath to track which nodes actually matched
|
|
174
69
|
const fileNodeScores = new Map();
|
|
@@ -179,11 +74,8 @@ export const searchFTSFromLbug = async (query, limit = 20, repoId) => {
|
|
|
179
74
|
fileNodeScores.get(r.filePath).push({ score: r.score, nodeId: r.nodeId });
|
|
180
75
|
}
|
|
181
76
|
};
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
addResults(classResults);
|
|
185
|
-
addResults(methodResults);
|
|
186
|
-
addResults(interfaceResults);
|
|
77
|
+
for (const results of resultsByIndex)
|
|
78
|
+
addResults(results);
|
|
187
79
|
// Sum the top-3 highest-scoring nodes per file and collect their nodeIds.
|
|
188
80
|
// Summing all nodes naively inflates scores for files with many mediocre
|
|
189
81
|
// matches (e.g. test files) over files with a single highly-relevant symbol.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function createSearchFTSIndexes(): Promise<void>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createFTSIndex } from '../lbug/lbug-adapter.js';
|
|
2
|
+
import { FTS_INDEXES } from './fts-schema.js';
|
|
3
|
+
export async function createSearchFTSIndexes() {
|
|
4
|
+
for (const { table, indexName, properties } of FTS_INDEXES) {
|
|
5
|
+
await createFTSIndex(table, indexName, [...properties]);
|
|
6
|
+
}
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export const FTS_INDEXES = [
|
|
2
|
+
{ table: 'File', indexName: 'file_fts', properties: ['name', 'content'] },
|
|
3
|
+
{ table: 'Function', indexName: 'function_fts', properties: ['name', 'content'] },
|
|
4
|
+
{ table: 'Class', indexName: 'class_fts', properties: ['name', 'content'] },
|
|
5
|
+
{ table: 'Method', indexName: 'method_fts', properties: ['name', 'content'] },
|
|
6
|
+
{ table: 'Interface', indexName: 'interface_fts', properties: ['name', 'content'] },
|
|
7
|
+
];
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
* For MCP, we only need to compute query embeddings, not batch embed.
|
|
6
6
|
*/
|
|
7
7
|
import { pipeline, env } from '@huggingface/transformers';
|
|
8
|
+
import os from 'os';
|
|
9
|
+
import { join } from 'path';
|
|
8
10
|
import { isHttpMode, getHttpDimensions, httpEmbedQuery, } from '../../core/embeddings/http-client.js';
|
|
9
11
|
import { silenceStdout, restoreStdout, realStderrWrite } from '../../core/lbug/pool-adapter.js';
|
|
10
12
|
// Model config
|
|
@@ -34,7 +36,7 @@ export const initEmbedder = async () => {
|
|
|
34
36
|
// ./node_modules/.cache inside its own install dir, which is unwritable
|
|
35
37
|
// when gitnexus is installed globally (e.g. /usr/lib/node_modules/).
|
|
36
38
|
// Respect HF_HOME if set, otherwise fall back to ~/.cache/huggingface.
|
|
37
|
-
env.cacheDir = process.env.HF_HOME ??
|
|
39
|
+
env.cacheDir = process.env.HF_HOME ?? join(os.homedir(), '.cache', 'huggingface');
|
|
38
40
|
console.error('GitNexus: Loading embedding model (first search may take a moment)...');
|
|
39
41
|
// Try GPU first (DirectML on Windows, CUDA on Linux), fall back to CPU
|
|
40
42
|
const isWindows = process.platform === 'win32';
|
package/package.json
CHANGED
package/skills/gitnexus-cli.md
CHANGED
|
@@ -23,7 +23,7 @@ Run from the project root. This parses all source files, builds the knowledge gr
|
|
|
23
23
|
| `--embeddings` | Enable embedding generation for semantic search (off by default) |
|
|
24
24
|
| `--drop-embeddings` | Drop existing embeddings on rebuild. By default, an `analyze` without `--embeddings` preserves them. |
|
|
25
25
|
|
|
26
|
-
**When to run:** First time in a project, after major code changes, or when `gitnexus://repo/{name}/context` reports the index is stale. In Claude Code, a PostToolUse hook
|
|
26
|
+
**When to run:** First time in a project, after major code changes, or when `gitnexus://repo/{name}/context` reports the index is stale. In Claude Code, a PostToolUse hook detects staleness after `git commit` and `git merge` and notifies the agent to run `analyze` — the hook does not run analyze itself, to avoid blocking the agent for up to 120s and risking KuzuDB corruption on timeout.
|
|
27
27
|
|
|
28
28
|
### status — Check index freshness
|
|
29
29
|
|