Skip to content

armgit / Ix

Public Imported from GitHub
0

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

Merge main into feat/ix-around

KageBinaryad31670aa95c
diff --cc CLAUDE.md
index f8d32d12,2ee6b3da..d44b49c4
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@@ -45,7 -45,7 +45,7 @@@ ix map --silen
`ix reset --workspace` (the registered workspace containing cwd, nothing
else). After a global reset, re-map each workspace.
- **The OSS↔Pro command boundary is derived at runtime, not declared.**
- `cli.ts` snapshots `ossCmdNames` right after `registerOssCommands()`; the
- `main.ts` snapshots `ossCmdNames` right after `registerOssCommands()`; the
++ `run-cli.ts` snapshots `ossCmdNames` right after `registerOssCommands()`; the
Pro probe diffs against it. Adding a command to `oss.ts` silently makes it
OSS; removing one makes Pro own it. `registerProCommands` is async and MUST
be awaited.
diff --cc ix-cli/scripts/dump-cli-surface.mjs
index d790d663,36196cec..b9e6fff6
--- a/ix-cli/scripts/dump-cli-surface.mjs
+++ b/ix-cli/scripts/dump-cli-surface.mjs
@@@ -39,8 -39,8 +39,8 @@@ try
}
const program = new Command();
- // Mirror cli.ts's root registration. `--version` / `-V` is declared on the
- // program itself (cli.ts), not on any subcommand, so without this the one
-// Mirror main.ts's root registration. `--version` / `-V` is declared on the
-// program itself (main.ts:64), not on any subcommand, so without this the one
++// Mirror run-cli.ts's root registration. `--version` / `-V` is declared on the
++// program itself (run-cli.ts), not on any subcommand, so without this the one
// place a flag can be added with no per-command file changing is also the one
// place this inventory cannot see it.
const pkg = createRequire(import.meta.url)("../package.json");
diff --cc ix-cli/src/cli/errors.ts
index 788cd5a2,20cf6451..6b1b6c29
--- a/ix-cli/src/cli/errors.ts
+++ b/ix-cli/src/cli/errors.ts
@@@ -18,7 -18,7 +18,7 @@@ import { llmError } from "./llm.js"
*/
let requestedFormat: string | undefined;
- /** Record the format for the error boundary. Called once, from `cli.ts`. */
-/** Record the format for the error boundary. Called once, from `main.ts`. */
++/** Record the format for the error boundary. Called once, from `run-cli.ts`. */
export function setErrorFormat(format: string | undefined): void {
requestedFormat = format;
}
diff --cc ix-cli/src/cli/main.ts
index 48dc07b1,67d2820a..4dbe1057
--- a/ix-cli/src/cli/main.ts
+++ b/ix-cli/src/cli/main.ts
@@@ -1,22 -1,39 +1,53 @@@
#!/usr/bin/env node
// Copyright 2026 Ix Infrastructure Inc.
- /**
- * The `ix` executable.
- *
- * Everything but one invocation goes straight to the CLI (`cli.ts`). The
- * exception is `ix hook claude-post-edit`, which an agent harness runs after
- * every hooked tool call -- every Bash command included -- and which almost
- * always has nothing to say. Loading the CLI's command tree costs ~140 ms
- * before a single line of it runs; the hook's "nothing changed" answer costs a
- * git call. So the hook is dispatched here, before that tree is loaded, and
- * loads the graph code itself only when there is an edit to report.
- * `--help` still goes through the CLI, where the command is documented.
- */
+ // The entry point, kept to what must happen before the CLI's own modules load.
-// Static imports are evaluated before a module's body runs, so the two steps
++// Static imports are evaluated before a module's body runs, so the steps
+ // below could not live in `run-cli.ts`: by the time its first line ran, the
+ // ~200 modules behind the command registry would already be loaded.
+
+ import * as nodeModule from "node:module";
+
+ // Runtime Node version guard. Runs before any command work so users on an
+ // unsupported Node get an actionable message instead of a cryptic "fetch
+ // failed" deep inside undici.
+ const MIN_NODE_MAJOR = 22;
+ {
+ const current = process.versions.node;
+ const major = parseInt(current.split(".")[0] ?? "0", 10);
+ if (!Number.isFinite(major) || major < MIN_NODE_MAJOR) {
+ process.stderr.write(
+ `Ix requires Node.js ${MIN_NODE_MAJOR} or newer. You are running v${current}.\n` +
+ `Install a supported version from https://nodejs.org/ and re-run.\n`
+ );
+ process.exit(1);
+ }
+ }
+
+ // V8's code cache for every module loaded from here on. Compiling the CLI's
+ // modules is most of its start-up: measured at ~40 ms of ~180 ms before the
+ // first request on a warm machine. Node >= 22.1 keeps the cache under the OS
+ // temp directory, keyed by file content and Node version, so an upgrade can
+ // never run stale code; NODE_COMPILE_CACHE moves it and
+ // NODE_DISABLE_COMPILE_CACHE=1 turns it off. Absent on 22.0: then a no-op.
+ try {
+ (nodeModule as { enableCompileCache?: () => unknown }).enableCompileCache?.();
+ } catch {
+ // A cache that cannot be opened only costs speed.
+ }
+
-await import("./run-cli.js");
++// Everything but one invocation goes straight to the CLI (`run-cli.ts`). The
++// exception is `ix hook claude-post-edit`, which an agent harness runs after
++// every hooked tool call -- every Bash command included -- and which almost
++// always has nothing to say. Loading the CLI's command tree costs ~140 ms
++// before a single line of it runs; the hook's "nothing changed" answer costs a
++// git call. So the hook is dispatched here, before that tree is loaded, and
++// loads the graph code itself only when there is an edit to report.
++// `--help` still goes through the CLI, where the command is documented.
+const args = process.argv.slice(2);
+if (args[0] === "hook" && args[1] === "claude-post-edit" && !args.some((a) => a === "-h" || a === "--help")) {
+ const { parseHookArgs, runHookProcess } = await import("./hook/entry.js");
+ await runHookProcess(parseHookArgs(args.slice(2)));
+} else {
- await import("./cli.js");
++ await import("./run-cli.js");
+}
diff --cc ix-cli/src/mcp/runner.ts
index ef6c504e,e029ac60..16c0db2a
--- a/ix-cli/src/mcp/runner.ts
+++ b/ix-cli/src/mcp/runner.ts
@@@ -350,7 -350,7 +350,7 @@@ function releaseLocksOf(run: ActiveRun)
/**
* Replace the CLI's fatal error handlers for the lifetime of the server.
*
- * `cli.ts` installs `unhandledRejection`/`uncaughtException` handlers whose
- * `main.ts` installs `unhandledRejection`/`uncaughtException` handlers whose
++ * `run-cli.ts` installs `unhandledRejection`/`uncaughtException` handlers whose
* every path ends in `process.exit(1)`. That is right for one command in one
* process and fatal for a server: a stray rejection from any command's
* fire-and-forget work would either exit outright, or — once the in-process
diff --cc skills/ix/references/commands.md
index 00796734,a4d29b24..e6895f50
--- a/skills/ix/references/commands.md
+++ b/skills/ix/references/commands.md
@@@ -207,7 -182,7 +207,7 @@@ ix inventory --kind function --path aut
degraded graph.
- **The OSS↔Pro command boundary is derived at runtime, not declared.**
- `cli.ts` (which `main.ts` loads) snapshots `ossCmdNames` immediately after `registerOssCommands()`;
- `main.ts` snapshots `ossCmdNames` immediately after `registerOssCommands()`;
++ `run-cli.ts` (which `main.ts` loads) snapshots `ossCmdNames` immediately after `registerOssCommands()`;
the Pro probe (`tryLoadProCommands`) then diffs whatever commands exist
against that set to decide which count as "Pro". Consequences:
- Adding a `register*Command` call in `oss.ts` silently reclassifies that