Skip to content

armgit / Ix

Public Imported from GitHub
0

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

feat(cli): add createClient factory for shared IxClient instantiation

Joseph Mikhail75b524c9d771
diff --git a/ix-cli/src/cli/config.ts b/ix-cli/src/cli/config.ts
index 20f06bb3..0b62c20f 100644
--- a/ix-cli/src/cli/config.ts
+++ b/ix-cli/src/cli/config.ts
@@ -3,6 +3,7 @@ import { join } from "node:path";
import { homedir } from "node:os";
import { execSync } from "node:child_process";
import { parse, stringify } from "yaml";
+import { IxClient } from "../client/api.js";
export interface WorkspaceConfig {
workspace_id: string;
@@ -44,6 +45,13 @@ export function getEndpoint(): string {
return process.env.IX_ENDPOINT || loadConfig().endpoint;
}
+// Single-place factory for IxClient instances. Pro commands and future OSS
+// code paths should prefer this over `new IxClient(getEndpoint())` so auth
+// and endpoint resolution can evolve in one spot.
+export async function createClient(): Promise<IxClient> {
+ return new IxClient(getEndpoint());
+}
+
export function loadWorkspaces(): WorkspaceConfig[] {
const config = loadConfig();
return config.workspaces ?? [];