Skip to content

Commit dfec710

Browse files
10x-Anitclaude
andcommitted
fix: Binary shows clean message, install script adds npm package
- Rust binary no longer tries to run npx (caused recursive spawn) - Binary shows clean "run npx @openanalystinc/openanalyst-cli" message - Install script now also runs npm install for the TUI package - npm global command (bin/cli.js) is the proper entry point Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 904bbd2 commit dfec710

3 files changed

Lines changed: 26 additions & 24 deletions

File tree

install.ps1

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,16 @@ if (-not $Downloaded) {
104104
exit 1
105105
}
106106

107-
# ── Step 2: PATH ──
107+
# ── Step 2: Install npm package (TUI + proper entry point) ──
108+
Dim " "; Acc "$([char]0x203A)"; Dim " Installing TUI package..."
109+
try {
110+
$npmOutput = npm install -g @openanalystinc/openanalyst-cli@$Version 2>&1
111+
Write-Host " " -NoNewline; Grn "$([char]0x2713)"; Dim " npm package installed"; Nl
112+
} catch {
113+
Write-Host " " -NoNewline; Yl "npm install skipped"; Nl
114+
}
115+
116+
# ── Step 3: PATH ──
108117
Dim " "; Acc "$([char]0x203A)"; Dim " Configuring PATH..."
109118
$CurrentPath = [Environment]::GetEnvironmentVariable("Path", "User")
110119
if ($CurrentPath -notlike "*$InstallDir*") {

native/openanalyst.exe

-1 KB
Binary file not shown.

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

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2741,29 +2741,22 @@ fn run_tui(
27412741
allowed_tools: Option<AllowedToolSet>,
27422742
permission_mode: PermissionMode,
27432743
) -> Result<(), Box<dyn std::error::Error>> {
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-
}
2744+
// When called without --headless, this binary is the engine only.
2745+
// The TUI is launched via: npx @openanalystinc/openanalyst-cli
2746+
// which calls bin/cli.js → spawns this binary with --headless.
2747+
//
2748+
// If the user runs the binary directly (not via npm), show a clean message.
2749+
eprintln!();
2750+
eprintln!(" \x1b[38;2;255;140;0m\x1b[1mOpenAnalyst CLI v{}\x1b[0m", env!("CARGO_PKG_VERSION"));
2751+
eprintln!();
2752+
eprintln!(" To launch the terminal UI, run:");
2753+
eprintln!(" \x1b[1mnpx @openanalystinc/openanalyst-cli\x1b[0m");
2754+
eprintln!();
2755+
eprintln!(" Or install globally:");
2756+
eprintln!(" \x1b[1mnpm install -g @openanalystinc/openanalyst-cli\x1b[0m");
2757+
eprintln!(" \x1b[1mopenanalyst\x1b[0m");
2758+
eprintln!();
2759+
Ok(())
27672760
}
27682761

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

0 commit comments

Comments
 (0)