Skip to content

Commit 4da7f85

Browse files
10x-Anitclaude
andcommitted
fix: Remove architecture leak — binary now launches TUI seamlessly
When user runs `openanalyst`, it now silently launches the TUI via npx instead of printing internal debug messages about ratatui, Ink, JSON-RPC, and headless mode. If Node.js is missing, shows a clean install message. No implementation details exposed to users. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent b4fd7fa commit 4da7f85

1 file changed

Lines changed: 23 additions & 12 deletions

File tree

  • rust/crates/openanalyst-cli/src

rust/crates/openanalyst-cli/src/main.rs

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2741,18 +2741,29 @@ fn run_tui(
27412741
allowed_tools: Option<AllowedToolSet>,
27422742
permission_mode: PermissionMode,
27432743
) -> Result<(), Box<dyn std::error::Error>> {
2744-
// The ratatui TUI has been archived. Redirect to headless mode which
2745-
// communicates with the Ink TUI via JSON-RPC over stdio.
2746-
eprintln!();
2747-
eprintln!(" \x1b[33mThe built-in ratatui TUI has been replaced by the Ink TUI.\x1b[0m");
2748-
eprintln!(" Launching in \x1b[1m--headless\x1b[0m mode (JSON-RPC bridge for Ink TUI).");
2749-
eprintln!();
2750-
eprintln!(" To use the new TUI, run: \x1b[1mnpx openanalyst\x1b[0m");
2751-
eprintln!(" The Ink TUI will automatically spawn the Rust engine in headless mode.");
2752-
eprintln!();
2753-
2754-
// Fall through to headless mode so the engine is still functional
2755-
run_headless(model, allowed_tools, permission_mode)
2744+
// Launch the TUI via the npm package (npx runs the Ink TUI which
2745+
// spawns this binary in --headless mode for the engine bridge).
2746+
let npx_result = std::process::Command::new(if cfg!(windows) { "npx.cmd" } else { "npx" })
2747+
.args(["@openanalystinc/openanalyst-cli"])
2748+
.status();
2749+
2750+
match npx_result {
2751+
Ok(status) if status.success() => Ok(()),
2752+
Ok(_) => {
2753+
// npx failed — fall back to headless mode
2754+
run_headless(model, allowed_tools, permission_mode)
2755+
}
2756+
Err(_) => {
2757+
// npx not found — fall back to headless mode
2758+
eprintln!();
2759+
eprintln!(" \x1b[33mNode.js is required for the terminal UI.\x1b[0m");
2760+
eprintln!(" Install it from: \x1b[1mhttps://nodejs.org\x1b[0m");
2761+
eprintln!();
2762+
eprintln!(" Or install the TUI: \x1b[1mnpm install -g @openanalystinc/openanalyst-cli\x1b[0m");
2763+
eprintln!();
2764+
run_headless(model, allowed_tools, permission_mode)
2765+
}
2766+
}
27562767
}
27572768

27582769
/// Run in headless JSON-RPC mode for the Ink TUI bridge.

0 commit comments

Comments
 (0)