diff --git a/gitnexus-shared/src/graph/types.ts b/gitnexus-shared/src/graph/types.ts index d3dc81625..2c85fd030 100644 --- a/gitnexus-shared/src/graph/types.ts +++ b/gitnexus-shared/src/graph/types.ts @@ -115,7 +115,8 @@ export type RelationshipType = | 'HANDLES_TOOL' | 'ENTRY_POINT_OF' | 'WRAPS' - | 'QUERIES'; + | 'QUERIES' + | 'CROSS_REPO_IMPORT'; export interface GraphNode { id: string; diff --git a/gitnexus/src/core/group/extractors/import-scanner.ts b/gitnexus/src/core/group/extractors/import-scanner.ts index c6c460712..2bac8de42 100644 --- a/gitnexus/src/core/group/extractors/import-scanner.ts +++ b/gitnexus/src/core/group/extractors/import-scanner.ts @@ -159,7 +159,7 @@ export async function scanRepoForImports( let content: string; try { - content = fs.readFileSync(abs, 'utf-8'); + content = await fs.promises.readFile(abs, 'utf-8'); } catch { continue; } diff --git a/gitnexus/src/core/group/service.ts b/gitnexus/src/core/group/service.ts index 55b379d5f..c371ff41c 100644 --- a/gitnexus/src/core/group/service.ts +++ b/gitnexus/src/core/group/service.ts @@ -638,6 +638,10 @@ export class GroupService { remoteRepo: remoteRepoGroupPath, remoteContext, }); + + // Recurse into the remote repo so depth > 1 actually traverses further. + // `visited` (closed over above) prevents cycles. + await findConnections(remoteRegistryName, currentDepth + 1); } }; diff --git a/gitnexus/src/mcp/tools.ts b/gitnexus/src/mcp/tools.ts index 917ee3fbf..255948c0b 100644 --- a/gitnexus/src/mcp/tools.ts +++ b/gitnexus/src/mcp/tools.ts @@ -576,18 +576,23 @@ WHEN TO USE: After group_sync, to explore how a symbol in one repo connects to s }, { name: 'group_discover', - description: `Auto-discover indexed repos in a directory and create a group with code-level dependency detection. + description: `Auto-discover indexed repos in a directory (or from an explicit list) and create a group with code-level dependency detection. -WHEN TO USE: When a user wants to see a combined knowledge graph from a parent directory containing multiple indexed repos. Scans for .gitnexus/ in subdirectories, reads package manifests, builds package mappings, creates a group, and optionally runs sync.`, +WHEN TO USE: When a user wants to see a combined knowledge graph from multiple indexed repos. Reads package manifests, builds package mappings, creates a group, and optionally runs sync. Provide either \`directory\` (parent-dir scan) or \`repoPaths\` (explicit list).`, inputSchema: { type: 'object', properties: { - directory: { type: 'string', description: 'Parent directory containing repos' }, + directory: { type: 'string', description: 'Parent directory containing repos (alternative to repoPaths)' }, + repoPaths: { + type: 'array', + items: { type: 'string' }, + description: 'Explicit list of repo paths (alternative to directory scan)', + }, name: { type: 'string', description: 'Group name (default: workspace)' }, force: { type: 'boolean', description: 'Overwrite existing group' }, skipSync: { type: 'boolean', description: 'Skip running sync after creation' }, }, - required: ['directory'], + required: [], }, }, ];