fix(group): address senior review feedback

- Add CROSS_REPO_IMPORT to RelationshipType so api.ts cast typechecks.
- Wire actual recursion into findConnections so groupGraph depth > 1
  traverses transitive cross-links instead of silently stopping at 1.
- Drop shadowing dynamic imports in groupStatus; use the module-level
  fsp/path already in scope.
- Switch import-scanner to fs.promises.readFile so file reads no longer
  block the event loop inside the async scanner.
- Extend group_discover MCP schema with repoPaths so the explicit-path
  mode is reachable via MCP (was CLI-only).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
sahalterion 2026-04-17 19:52:53 -07:00
parent b893a06780
commit f9134f1882
4 changed files with 16 additions and 6 deletions

View file

@ -115,7 +115,8 @@ export type RelationshipType =
| 'HANDLES_TOOL'
| 'ENTRY_POINT_OF'
| 'WRAPS'
| 'QUERIES';
| 'QUERIES'
| 'CROSS_REPO_IMPORT';
export interface GraphNode {
id: string;

View file

@ -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;
}

View file

@ -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);
}
};

View file

@ -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: [],
},
},
];