gitnexus 1.4.1 → 1.4.5
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/README.md +215 -194
- package/dist/cli/ai-context.d.ts +2 -1
- package/dist/cli/ai-context.js +117 -90
- package/dist/cli/analyze.d.ts +2 -0
- package/dist/cli/analyze.js +57 -30
- package/dist/cli/augment.js +1 -1
- package/dist/cli/eval-server.d.ts +1 -1
- package/dist/cli/eval-server.js +1 -1
- package/dist/cli/index.js +18 -25
- package/dist/cli/lazy-action.d.ts +6 -0
- package/dist/cli/lazy-action.js +18 -0
- package/dist/cli/mcp.js +1 -1
- package/dist/cli/setup.js +42 -32
- package/dist/cli/skill-gen.d.ts +26 -0
- package/dist/cli/skill-gen.js +549 -0
- package/dist/cli/status.js +13 -4
- package/dist/cli/tool.d.ts +1 -1
- package/dist/cli/tool.js +2 -2
- package/dist/cli/wiki.js +2 -2
- package/dist/config/ignore-service.d.ts +25 -0
- package/dist/config/ignore-service.js +76 -0
- package/dist/config/supported-languages.d.ts +1 -0
- package/dist/config/supported-languages.js +1 -1
- package/dist/core/augmentation/engine.js +99 -72
- package/dist/core/embeddings/embedder.d.ts +1 -1
- package/dist/core/embeddings/embedder.js +1 -1
- package/dist/core/embeddings/embedding-pipeline.d.ts +3 -3
- package/dist/core/embeddings/embedding-pipeline.js +74 -47
- package/dist/core/embeddings/types.d.ts +1 -1
- package/dist/core/graph/types.d.ts +5 -2
- package/dist/core/ingestion/ast-cache.js +3 -2
- package/dist/core/ingestion/call-processor.d.ts +6 -7
- package/dist/core/ingestion/call-processor.js +560 -282
- package/dist/core/ingestion/call-routing.d.ts +53 -0
- package/dist/core/ingestion/call-routing.js +108 -0
- package/dist/core/ingestion/cluster-enricher.js +16 -16
- package/dist/core/ingestion/constants.d.ts +16 -0
- package/dist/core/ingestion/constants.js +16 -0
- package/dist/core/ingestion/entry-point-scoring.d.ts +2 -1
- package/dist/core/ingestion/entry-point-scoring.js +94 -24
- package/dist/core/ingestion/export-detection.d.ts +18 -0
- package/dist/core/ingestion/export-detection.js +231 -0
- package/dist/core/ingestion/filesystem-walker.js +4 -3
- package/dist/core/ingestion/framework-detection.d.ts +5 -1
- package/dist/core/ingestion/framework-detection.js +48 -8
- package/dist/core/ingestion/heritage-processor.d.ts +13 -5
- package/dist/core/ingestion/heritage-processor.js +109 -55
- package/dist/core/ingestion/import-processor.d.ts +16 -20
- package/dist/core/ingestion/import-processor.js +202 -696
- package/dist/core/ingestion/language-config.d.ts +46 -0
- package/dist/core/ingestion/language-config.js +167 -0
- package/dist/core/ingestion/mro-processor.d.ts +45 -0
- package/dist/core/ingestion/mro-processor.js +369 -0
- package/dist/core/ingestion/named-binding-extraction.d.ts +61 -0
- package/dist/core/ingestion/named-binding-extraction.js +363 -0
- package/dist/core/ingestion/parsing-processor.d.ts +3 -11
- package/dist/core/ingestion/parsing-processor.js +82 -181
- package/dist/core/ingestion/pipeline.d.ts +5 -1
- package/dist/core/ingestion/pipeline.js +192 -116
- package/dist/core/ingestion/process-processor.js +2 -1
- package/dist/core/ingestion/resolution-context.d.ts +53 -0
- package/dist/core/ingestion/resolution-context.js +132 -0
- package/dist/core/ingestion/resolvers/csharp.d.ts +22 -0
- package/dist/core/ingestion/resolvers/csharp.js +109 -0
- package/dist/core/ingestion/resolvers/go.d.ts +19 -0
- package/dist/core/ingestion/resolvers/go.js +42 -0
- package/dist/core/ingestion/resolvers/index.d.ts +18 -0
- package/dist/core/ingestion/resolvers/index.js +13 -0
- package/dist/core/ingestion/resolvers/jvm.d.ts +23 -0
- package/dist/core/ingestion/resolvers/jvm.js +87 -0
- package/dist/core/ingestion/resolvers/php.d.ts +15 -0
- package/dist/core/ingestion/resolvers/php.js +35 -0
- package/dist/core/ingestion/resolvers/python.d.ts +19 -0
- package/dist/core/ingestion/resolvers/python.js +52 -0
- package/dist/core/ingestion/resolvers/ruby.d.ts +12 -0
- package/dist/core/ingestion/resolvers/ruby.js +15 -0
- package/dist/core/ingestion/resolvers/rust.d.ts +15 -0
- package/dist/core/ingestion/resolvers/rust.js +73 -0
- package/dist/core/ingestion/resolvers/standard.d.ts +28 -0
- package/dist/core/ingestion/resolvers/standard.js +123 -0
- package/dist/core/ingestion/resolvers/utils.d.ts +33 -0
- package/dist/core/ingestion/resolvers/utils.js +122 -0
- package/dist/core/ingestion/symbol-table.d.ts +15 -1
- package/dist/core/ingestion/symbol-table.js +20 -12
- package/dist/core/ingestion/tree-sitter-queries.d.ts +12 -11
- package/dist/core/ingestion/tree-sitter-queries.js +642 -485
- package/dist/core/ingestion/type-env.d.ts +49 -0
- package/dist/core/ingestion/type-env.js +559 -0
- package/dist/core/ingestion/type-extractors/c-cpp.d.ts +2 -0
- package/dist/core/ingestion/type-extractors/c-cpp.js +385 -0
- package/dist/core/ingestion/type-extractors/csharp.d.ts +2 -0
- package/dist/core/ingestion/type-extractors/csharp.js +369 -0
- package/dist/core/ingestion/type-extractors/go.d.ts +2 -0
- package/dist/core/ingestion/type-extractors/go.js +436 -0
- package/dist/core/ingestion/type-extractors/index.d.ts +22 -0
- package/dist/core/ingestion/type-extractors/index.js +31 -0
- package/dist/core/ingestion/type-extractors/jvm.d.ts +3 -0
- package/dist/core/ingestion/type-extractors/jvm.js +654 -0
- package/dist/core/ingestion/type-extractors/php.d.ts +2 -0
- package/dist/core/ingestion/type-extractors/php.js +411 -0
- package/dist/core/ingestion/type-extractors/python.d.ts +2 -0
- package/dist/core/ingestion/type-extractors/python.js +392 -0
- package/dist/core/ingestion/type-extractors/ruby.d.ts +2 -0
- package/dist/core/ingestion/type-extractors/ruby.js +389 -0
- package/dist/core/ingestion/type-extractors/rust.d.ts +2 -0
- package/dist/core/ingestion/type-extractors/rust.js +436 -0
- package/dist/core/ingestion/type-extractors/shared.d.ts +132 -0
- package/dist/core/ingestion/type-extractors/shared.js +571 -0
- package/dist/core/ingestion/type-extractors/swift.d.ts +2 -0
- package/dist/core/ingestion/type-extractors/swift.js +137 -0
- package/dist/core/ingestion/type-extractors/types.d.ts +95 -0
- package/dist/core/ingestion/type-extractors/types.js +1 -0
- package/dist/core/ingestion/type-extractors/typescript.d.ts +2 -0
- package/dist/core/ingestion/type-extractors/typescript.js +480 -0
- package/dist/core/ingestion/utils.d.ts +98 -0
- package/dist/core/ingestion/utils.js +1064 -9
- package/dist/core/ingestion/workers/parse-worker.d.ts +38 -4
- package/dist/core/ingestion/workers/parse-worker.js +248 -359
- package/dist/core/ingestion/workers/worker-pool.js +8 -0
- package/dist/core/{kuzu → lbug}/csv-generator.d.ts +1 -1
- package/dist/core/{kuzu → lbug}/csv-generator.js +20 -4
- package/dist/core/{kuzu/kuzu-adapter.d.ts → lbug/lbug-adapter.d.ts} +19 -19
- package/dist/core/{kuzu/kuzu-adapter.js → lbug/lbug-adapter.js} +82 -82
- package/dist/core/{kuzu → lbug}/schema.d.ts +4 -4
- package/dist/core/{kuzu → lbug}/schema.js +304 -289
- package/dist/core/search/bm25-index.d.ts +4 -4
- package/dist/core/search/bm25-index.js +17 -16
- package/dist/core/search/hybrid-search.d.ts +2 -2
- package/dist/core/search/hybrid-search.js +9 -9
- package/dist/core/tree-sitter/parser-loader.js +9 -2
- package/dist/core/wiki/generator.d.ts +4 -52
- package/dist/core/wiki/generator.js +53 -552
- package/dist/core/wiki/graph-queries.d.ts +4 -46
- package/dist/core/wiki/graph-queries.js +103 -282
- package/dist/core/wiki/html-viewer.js +192 -192
- package/dist/core/wiki/llm-client.js +11 -73
- package/dist/core/wiki/prompts.d.ts +8 -52
- package/dist/core/wiki/prompts.js +86 -200
- package/dist/mcp/compatible-stdio-transport.d.ts +25 -0
- package/dist/mcp/compatible-stdio-transport.js +200 -0
- package/dist/mcp/core/{kuzu-adapter.d.ts → lbug-adapter.d.ts} +7 -9
- package/dist/mcp/core/{kuzu-adapter.js → lbug-adapter.js} +77 -79
- package/dist/mcp/local/local-backend.d.ts +6 -6
- package/dist/mcp/local/local-backend.js +153 -146
- package/dist/mcp/resources.js +42 -42
- package/dist/mcp/server.js +18 -19
- package/dist/mcp/tools.js +103 -104
- package/dist/server/api.js +12 -12
- package/dist/server/mcp-http.d.ts +1 -1
- package/dist/server/mcp-http.js +1 -1
- package/dist/storage/repo-manager.d.ts +20 -2
- package/dist/storage/repo-manager.js +55 -1
- package/dist/types/pipeline.d.ts +1 -1
- package/hooks/claude/gitnexus-hook.cjs +238 -155
- package/hooks/claude/pre-tool-use.sh +79 -79
- package/hooks/claude/session-start.sh +42 -42
- package/package.json +98 -96
- package/scripts/patch-tree-sitter-swift.cjs +74 -74
- package/skills/gitnexus-cli.md +82 -82
- package/skills/gitnexus-debugging.md +89 -89
- package/skills/gitnexus-exploring.md +78 -78
- package/skills/gitnexus-guide.md +64 -64
- package/skills/gitnexus-impact-analysis.md +97 -97
- package/skills/gitnexus-pr-review.md +163 -163
- package/skills/gitnexus-refactoring.md +121 -121
- package/vendor/leiden/index.cjs +355 -355
- package/vendor/leiden/utils.cjs +392 -392
- package/dist/core/wiki/diagrams.d.ts +0 -27
- package/dist/core/wiki/diagrams.js +0 -163
package/dist/cli/mcp.js
CHANGED
|
@@ -9,7 +9,7 @@ import { startMCPServer } from '../mcp/server.js';
|
|
|
9
9
|
import { LocalBackend } from '../mcp/local/local-backend.js';
|
|
10
10
|
export const mcpCommand = async () => {
|
|
11
11
|
// Prevent unhandled errors from crashing the MCP server process.
|
|
12
|
-
//
|
|
12
|
+
// LadybugDB lock conflicts and transient errors should degrade gracefully.
|
|
13
13
|
process.on('uncaughtException', (err) => {
|
|
14
14
|
console.error(`GitNexus MCP: uncaught exception — ${err.message}`);
|
|
15
15
|
// Process is in an undefined state after uncaughtException — exit after flushing
|
package/dist/cli/setup.js
CHANGED
|
@@ -9,6 +9,7 @@ import fs from 'fs/promises';
|
|
|
9
9
|
import path from 'path';
|
|
10
10
|
import os from 'os';
|
|
11
11
|
import { fileURLToPath } from 'url';
|
|
12
|
+
import { glob } from 'glob';
|
|
12
13
|
import { getGlobalDir } from '../storage/repo-manager.js';
|
|
13
14
|
const __filename = fileURLToPath(import.meta.url);
|
|
14
15
|
const __dirname = path.dirname(__filename);
|
|
@@ -147,36 +148,34 @@ async function installClaudeCodeHooks(result) {
|
|
|
147
148
|
// even when it's no longer inside the npm package tree
|
|
148
149
|
const resolvedCli = path.join(__dirname, '..', 'cli', 'index.js');
|
|
149
150
|
const normalizedCli = path.resolve(resolvedCli).replace(/\\/g, '/');
|
|
150
|
-
|
|
151
|
+
const jsonCli = JSON.stringify(normalizedCli);
|
|
152
|
+
content = content.replace("let cliPath = path.resolve(__dirname, '..', '..', 'dist', 'cli', 'index.js');", `let cliPath = ${jsonCli};`);
|
|
151
153
|
await fs.writeFile(dest, content, 'utf-8');
|
|
152
154
|
}
|
|
153
155
|
catch {
|
|
154
156
|
// Script not found in source — skip
|
|
155
157
|
}
|
|
156
|
-
const
|
|
158
|
+
const hookPath = path.join(destHooksDir, 'gitnexus-hook.cjs').replace(/\\/g, '/');
|
|
159
|
+
const hookCmd = `node "${hookPath.replace(/"/g, '\\"')}"`;
|
|
157
160
|
// Merge hook config into ~/.claude/settings.json
|
|
158
161
|
const existing = await readJsonFile(settingsPath) || {};
|
|
159
162
|
if (!existing.hooks)
|
|
160
163
|
existing.hooks = {};
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
type: 'command',
|
|
172
|
-
command: hookCmd,
|
|
173
|
-
timeout: 8000,
|
|
174
|
-
statusMessage: 'Enriching with GitNexus graph context...',
|
|
175
|
-
}],
|
|
176
|
-
});
|
|
164
|
+
function ensureHookEntry(eventName, matcher, timeout, statusMessage) {
|
|
165
|
+
if (!existing.hooks[eventName])
|
|
166
|
+
existing.hooks[eventName] = [];
|
|
167
|
+
const hasHook = existing.hooks[eventName].some((h) => h.hooks?.some(hh => hh.command?.includes('gitnexus-hook')));
|
|
168
|
+
if (!hasHook) {
|
|
169
|
+
existing.hooks[eventName].push({
|
|
170
|
+
matcher,
|
|
171
|
+
hooks: [{ type: 'command', command: hookCmd, timeout, statusMessage }],
|
|
172
|
+
});
|
|
173
|
+
}
|
|
177
174
|
}
|
|
175
|
+
ensureHookEntry('PreToolUse', 'Grep|Glob|Bash', 10, 'Enriching with GitNexus graph context...');
|
|
176
|
+
ensureHookEntry('PostToolUse', 'Bash', 10, 'Checking GitNexus index freshness...');
|
|
178
177
|
await writeJsonFile(settingsPath, existing);
|
|
179
|
-
result.configured.push('Claude Code hooks (PreToolUse)');
|
|
178
|
+
result.configured.push('Claude Code hooks (PreToolUse, PostToolUse)');
|
|
180
179
|
}
|
|
181
180
|
catch (err) {
|
|
182
181
|
result.errors.push(`Claude Code hooks: ${err.message}`);
|
|
@@ -203,7 +202,6 @@ async function setupOpenCode(result) {
|
|
|
203
202
|
}
|
|
204
203
|
}
|
|
205
204
|
// ─── Skill Installation ───────────────────────────────────────────
|
|
206
|
-
const SKILL_NAMES = ['gitnexus-exploring', 'gitnexus-debugging', 'gitnexus-impact-analysis', 'gitnexus-refactoring', 'gitnexus-guide', 'gitnexus-cli'];
|
|
207
205
|
/**
|
|
208
206
|
* Install GitNexus skills to a target directory.
|
|
209
207
|
* Each skill is installed as {targetDir}/gitnexus-{skillName}/SKILL.md
|
|
@@ -216,24 +214,36 @@ const SKILL_NAMES = ['gitnexus-exploring', 'gitnexus-debugging', 'gitnexus-impac
|
|
|
216
214
|
async function installSkillsTo(targetDir) {
|
|
217
215
|
const installed = [];
|
|
218
216
|
const skillsRoot = path.join(__dirname, '..', '..', 'skills');
|
|
219
|
-
|
|
217
|
+
let flatFiles = [];
|
|
218
|
+
let dirSkillFiles = [];
|
|
219
|
+
try {
|
|
220
|
+
[flatFiles, dirSkillFiles] = await Promise.all([
|
|
221
|
+
glob('*.md', { cwd: skillsRoot }),
|
|
222
|
+
glob('*/SKILL.md', { cwd: skillsRoot }),
|
|
223
|
+
]);
|
|
224
|
+
}
|
|
225
|
+
catch {
|
|
226
|
+
return [];
|
|
227
|
+
}
|
|
228
|
+
const skillSources = new Map();
|
|
229
|
+
for (const relPath of dirSkillFiles) {
|
|
230
|
+
skillSources.set(path.dirname(relPath), { isDirectory: true });
|
|
231
|
+
}
|
|
232
|
+
for (const relPath of flatFiles) {
|
|
233
|
+
const skillName = path.basename(relPath, '.md');
|
|
234
|
+
if (!skillSources.has(skillName)) {
|
|
235
|
+
skillSources.set(skillName, { isDirectory: false });
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
for (const [skillName, source] of skillSources) {
|
|
220
239
|
const skillDir = path.join(targetDir, skillName);
|
|
221
240
|
try {
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
const dirSkillFile = path.join(dirSource, 'SKILL.md');
|
|
225
|
-
let isDirectory = false;
|
|
226
|
-
try {
|
|
227
|
-
const stat = await fs.stat(dirSource);
|
|
228
|
-
isDirectory = stat.isDirectory();
|
|
229
|
-
}
|
|
230
|
-
catch { /* not a directory */ }
|
|
231
|
-
if (isDirectory) {
|
|
241
|
+
if (source.isDirectory) {
|
|
242
|
+
const dirSource = path.join(skillsRoot, skillName);
|
|
232
243
|
await copyDirRecursive(dirSource, skillDir);
|
|
233
244
|
installed.push(skillName);
|
|
234
245
|
}
|
|
235
246
|
else {
|
|
236
|
-
// Fall back to flat file (skills/{name}.md)
|
|
237
247
|
const flatSource = path.join(skillsRoot, `${skillName}.md`);
|
|
238
248
|
const content = await fs.readFile(flatSource, 'utf-8');
|
|
239
249
|
await fs.mkdir(skillDir, { recursive: true });
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Skill File Generator
|
|
3
|
+
*
|
|
4
|
+
* Generates repo-specific SKILL.md files from detected Leiden communities.
|
|
5
|
+
* Each significant community becomes a skill that describes a functional area
|
|
6
|
+
* of the codebase, including key files, entry points, execution flows, and
|
|
7
|
+
* cross-community connections.
|
|
8
|
+
*/
|
|
9
|
+
import { PipelineResult } from '../types/pipeline.js';
|
|
10
|
+
export interface GeneratedSkillInfo {
|
|
11
|
+
name: string;
|
|
12
|
+
label: string;
|
|
13
|
+
symbolCount: number;
|
|
14
|
+
fileCount: number;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* @brief Generate repo-specific skill files from detected communities
|
|
18
|
+
* @param {string} repoPath - Absolute path to the repository root
|
|
19
|
+
* @param {string} projectName - Human-readable project name
|
|
20
|
+
* @param {PipelineResult} pipelineResult - In-memory pipeline data with communities, processes, graph
|
|
21
|
+
* @returns {Promise<{ skills: GeneratedSkillInfo[], outputPath: string }>} Generated skill metadata
|
|
22
|
+
*/
|
|
23
|
+
export declare const generateSkillFiles: (repoPath: string, projectName: string, pipelineResult: PipelineResult) => Promise<{
|
|
24
|
+
skills: GeneratedSkillInfo[];
|
|
25
|
+
outputPath: string;
|
|
26
|
+
}>;
|