@veewo/gitnexus 1.4.9-rc → 1.4.9
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/cli/ai-context.js
CHANGED
|
@@ -36,13 +36,12 @@ function generateGitNexusContent(projectName, stats, skillScope, cliPackageSpec,
|
|
|
36
36
|
return `${GITNEXUS_START_MARKER}
|
|
37
37
|
# GitNexus MCP
|
|
38
38
|
|
|
39
|
-
This project is indexed by GitNexus as **${projectName}** (${stats.nodes || 0} symbols, ${stats.edges || 0} relationships, ${stats.processes || 0} execution flows).
|
|
40
|
-
|
|
41
39
|
## Always Start Here
|
|
42
40
|
|
|
43
41
|
1. **Read \`gitnexus://repo/{name}/context\`** — codebase overview + check index freshness
|
|
44
42
|
2. **Match your task to a skill below** and **read that skill file**
|
|
45
43
|
3. **Follow the skill's workflow and checklist**
|
|
44
|
+
4. **Follow config/state file rules:** \`docs/gitnexus-config-files.md\`
|
|
46
45
|
|
|
47
46
|
> If step 1 warns the index is stale, ask user whether to rebuild index via \`gitnexus analyze\` when local CLI exists; otherwise resolve the pinned npx package spec from \`~/.gitnexus/config.json\` (\`cliPackageSpec\` first, then \`cliVersion\`) and run \`${reindexCmd}\` with that exact package spec (it reuses previous analyze scope/options by default; add \`--no-reuse-options\` to reset). If user declines, explicitly warn that retrieval may not reflect current codebase. For build/analyze/test commands, use a 10-30 minute timeout; on failure/timeout, report exact tool output and do not auto-retry or silently fall back to glob/grep.
|
|
48
47
|
|
package/dist/cli/analyze.js
CHANGED
|
@@ -360,9 +360,10 @@ export const analyzeCommand = async (inputPath, options) => {
|
|
|
360
360
|
embeddings: embeddingCount,
|
|
361
361
|
},
|
|
362
362
|
};
|
|
363
|
+
const registeredRepo = await registerRepo(repoPath, meta, { repoAlias });
|
|
364
|
+
meta.repoId = registeredRepo.name;
|
|
363
365
|
await saveMeta(storagePath, meta);
|
|
364
366
|
await persistUnityParitySeed(storagePath, pipelineRuntime.unityResult?.paritySeed);
|
|
365
|
-
const registeredRepo = await registerRepo(repoPath, meta, { repoAlias });
|
|
366
367
|
await addToGitignore(repoPath);
|
|
367
368
|
const projectName = path.basename(repoPath);
|
|
368
369
|
let aggregatedClusterCount = 0;
|
|
@@ -43,6 +43,7 @@ test('saveMeta/loadMeta persists analyzeOptions for future re-index reuse', asyn
|
|
|
43
43
|
const storagePath = path.join(tmpDir, '.gitnexus');
|
|
44
44
|
await saveMeta(storagePath, {
|
|
45
45
|
repoPath: tmpDir,
|
|
46
|
+
repoId: 'neonspark-v1-subset',
|
|
46
47
|
lastCommit: 'abc1234',
|
|
47
48
|
indexedAt: '2026-03-12T00:00:00.000Z',
|
|
48
49
|
analyzeOptions: {
|
|
@@ -60,4 +61,5 @@ test('saveMeta/loadMeta persists analyzeOptions for future re-index reuse', asyn
|
|
|
60
61
|
repoAlias: 'neonspark-v1-subset',
|
|
61
62
|
embeddings: true,
|
|
62
63
|
});
|
|
64
|
+
assert.equal(meta?.repoId, 'neonspark-v1-subset');
|
|
63
65
|
});
|
package/dist/cli/tool.js
CHANGED
|
@@ -15,7 +15,10 @@
|
|
|
15
15
|
* See the output() function for details (#324).
|
|
16
16
|
*/
|
|
17
17
|
import { writeSync } from 'node:fs';
|
|
18
|
+
import path from 'node:path';
|
|
18
19
|
import { LocalBackend } from '../mcp/local/local-backend.js';
|
|
20
|
+
import { getGitRoot } from '../storage/git.js';
|
|
21
|
+
import { getStoragePaths, listRegisteredRepos, loadMeta } from '../storage/repo-manager.js';
|
|
19
22
|
let _backend = null;
|
|
20
23
|
async function getBackend() {
|
|
21
24
|
if (_backend)
|
|
@@ -59,12 +62,29 @@ function isUnityUiTraceGoal(value) {
|
|
|
59
62
|
function isUnityUiSelectorMode(value) {
|
|
60
63
|
return value === 'strict' || value === 'balanced';
|
|
61
64
|
}
|
|
65
|
+
async function resolveRepoOption(explicitRepo) {
|
|
66
|
+
if (explicitRepo?.trim())
|
|
67
|
+
return explicitRepo.trim();
|
|
68
|
+
const gitRoot = getGitRoot(process.cwd());
|
|
69
|
+
if (!gitRoot)
|
|
70
|
+
return undefined;
|
|
71
|
+
const { storagePath } = getStoragePaths(gitRoot);
|
|
72
|
+
const meta = await loadMeta(storagePath);
|
|
73
|
+
const repoId = typeof meta?.repoId === 'string' ? meta.repoId.trim() : '';
|
|
74
|
+
if (repoId)
|
|
75
|
+
return repoId;
|
|
76
|
+
// Backward compatibility for indexes created before repoId persisted in meta.json.
|
|
77
|
+
const entries = await listRegisteredRepos({ validate: false });
|
|
78
|
+
const matched = entries.find((entry) => path.resolve(entry.path) === gitRoot);
|
|
79
|
+
return matched?.name || undefined;
|
|
80
|
+
}
|
|
62
81
|
export async function queryCommand(queryText, options) {
|
|
63
82
|
if (!queryText?.trim()) {
|
|
64
83
|
console.error('Usage: gitnexus query <search_query>');
|
|
65
84
|
process.exit(1);
|
|
66
85
|
}
|
|
67
86
|
const backend = await getBackend();
|
|
87
|
+
const repo = await resolveRepoOption(options?.repo);
|
|
68
88
|
const result = await backend.callTool('query', {
|
|
69
89
|
query: queryText,
|
|
70
90
|
task_context: options?.context,
|
|
@@ -74,7 +94,7 @@ export async function queryCommand(queryText, options) {
|
|
|
74
94
|
scope_preset: options?.scopePreset,
|
|
75
95
|
unity_resources: options?.unityResources,
|
|
76
96
|
unity_hydration_mode: options?.unityHydration,
|
|
77
|
-
repo
|
|
97
|
+
repo,
|
|
78
98
|
});
|
|
79
99
|
output(result);
|
|
80
100
|
}
|
|
@@ -84,6 +104,7 @@ export async function contextCommand(name, options) {
|
|
|
84
104
|
process.exit(1);
|
|
85
105
|
}
|
|
86
106
|
const backend = await getBackend();
|
|
107
|
+
const repo = await resolveRepoOption(options?.repo);
|
|
87
108
|
const result = await backend.callTool('context', {
|
|
88
109
|
name: name || undefined,
|
|
89
110
|
uid: options?.uid,
|
|
@@ -91,7 +112,7 @@ export async function contextCommand(name, options) {
|
|
|
91
112
|
include_content: options?.content ?? false,
|
|
92
113
|
unity_resources: options?.unityResources,
|
|
93
114
|
unity_hydration_mode: options?.unityHydration,
|
|
94
|
-
repo
|
|
115
|
+
repo,
|
|
95
116
|
});
|
|
96
117
|
output(result);
|
|
97
118
|
}
|
|
@@ -102,6 +123,7 @@ export async function impactCommand(target, options) {
|
|
|
102
123
|
}
|
|
103
124
|
try {
|
|
104
125
|
const backend = await getBackend();
|
|
126
|
+
const repo = await resolveRepoOption(options?.repo);
|
|
105
127
|
const result = await backend.callTool('impact', {
|
|
106
128
|
target,
|
|
107
129
|
target_uid: options?.uid,
|
|
@@ -110,7 +132,7 @@ export async function impactCommand(target, options) {
|
|
|
110
132
|
maxDepth: options?.depth ? parseInt(options.depth, 10) : undefined,
|
|
111
133
|
minConfidence: options?.minConfidence ? parseFloat(options.minConfidence) : undefined,
|
|
112
134
|
includeTests: options?.includeTests ?? false,
|
|
113
|
-
repo
|
|
135
|
+
repo,
|
|
114
136
|
});
|
|
115
137
|
output(result);
|
|
116
138
|
}
|
|
@@ -131,9 +153,10 @@ export async function cypherCommand(query, options) {
|
|
|
131
153
|
process.exit(1);
|
|
132
154
|
}
|
|
133
155
|
const backend = await getBackend();
|
|
156
|
+
const repo = await resolveRepoOption(options?.repo);
|
|
134
157
|
const result = await backend.callTool('cypher', {
|
|
135
158
|
query,
|
|
136
|
-
repo
|
|
159
|
+
repo,
|
|
137
160
|
});
|
|
138
161
|
output(result);
|
|
139
162
|
}
|
|
@@ -153,11 +176,12 @@ export async function unityUiTraceCommand(target, options, deps) {
|
|
|
153
176
|
process.exit(1);
|
|
154
177
|
}
|
|
155
178
|
const backend = deps?.backend || await getBackend();
|
|
179
|
+
const repo = await resolveRepoOption(options?.repo);
|
|
156
180
|
const result = await backend.callTool('unity_ui_trace', {
|
|
157
181
|
target,
|
|
158
182
|
goal,
|
|
159
183
|
selector_mode: selectorMode,
|
|
160
|
-
repo
|
|
184
|
+
repo,
|
|
161
185
|
});
|
|
162
186
|
(deps?.output || output)(result);
|
|
163
187
|
}
|
package/package.json
CHANGED