Skip to content

armgit / Ix

Public Imported from GitHub
0

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

fix(pro-loader): await the async Pro command registrar (#245)

Joseph Mikhail8792f16a33e3
diff --git a/ix-cli/src/cli/register/pro-loader.ts b/ix-cli/src/cli/register/pro-loader.ts
index 5f2a07bc..64293f34 100644
--- a/ix-cli/src/cli/register/pro-loader.ts
+++ b/ix-cli/src/cli/register/pro-loader.ts
@@ -10,7 +10,14 @@ export async function tryLoadProCommands(program: Command): Promise<boolean> {
const mod = await dynamicImport("@ix/pro/register");
if (mod?.registerProCommands) {
- mod.registerProCommands(program);
+ // registerProCommands is async: it dynamically imports each command so
+ // one broken command can't disable them all. It MUST be awaited here.
+ // main.ts calls program.parse() synchronously right after this resolves,
+ // so without the await the dynamic imports are still pending and NO pro
+ // command is registered in time — every `ix <pro-cmd>` then fails with
+ // "unknown command". (Older sync versions of registerProCommands did not
+ // need the await; awaiting is safe for both.)
+ await mod.registerProCommands(program);
return true;
}