Skip to content

armgit / Ix

Public Imported from GitHub
0

Understand any codebase instantly. System intelligence for codebases, built for humans and AI.

fix(inventory): send --path as server-side scope to ix inventory (#229)

Joseph Mikhailbee214b30b85
diff --git a/ix-cli/src/cli/commands/inventory.ts b/ix-cli/src/cli/commands/inventory.ts
index 724c1c19..c8cc16cd 100644
--- a/ix-cli/src/cli/commands/inventory.ts
+++ b/ix-cli/src/cli/commands/inventory.ts
@@ -26,7 +26,11 @@ Examples:
const client = new IxClient(getEndpoint());
const limit = parseInt(opts.limit, 10);
- let nodes = await client.listByKind(opts.kind, { limit, workspaceId: resolveWorkspaceId() });
+ // Pass --path as a server-side scope so the LIMIT is applied AFTER path
+ // filtering (otherwise a capped fetch can truncate away the target before
+ // the client-side filter below ever sees it). The client-side filter is
+ // kept as a fallback for older servers that ignore the scope field.
+ let nodes = await client.listByKind(opts.kind, { limit, workspaceId: resolveWorkspaceId(), scope: opts.path });
if (opts.path) {
nodes = nodes.filter((n) => {
diff --git a/ix-cli/src/client/api.ts b/ix-cli/src/client/api.ts
index 9343fb13..6bf2459b 100644
--- a/ix-cli/src/client/api.ts
+++ b/ix-cli/src/client/api.ts
@@ -68,12 +68,13 @@ export class IxClient {
async listByKind(
kind: string,
- opts?: { limit?: number; workspaceId?: string }
+ opts?: { limit?: number; workspaceId?: string; scope?: string }
): Promise<GraphNode[]> {
return this.post("/v1/list", {
kind,
limit: opts?.limit,
workspaceId: opts?.workspaceId,
+ scope: opts?.scope,
});
}