Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.
fix(cli): build the headless CLI from the jan-cli crate
thinhlpga8abd1481994
diff --git a/build-tui.sh b/build-tui.shindex 3ca7d4ebf..e156e5c4a 100755--- a/build-tui.sh+++ b/build-tui.sh@@ -14,7 +14,8 @@ set -euo pipefail# ────────────────────────────────────────────────────────────SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"-CRATE_DIR="$SCRIPT_DIR/src-tauri"+APP_DIR="$SCRIPT_DIR/src-tauri" # the app_lib library crate (check/test)+CLI_DIR="$SCRIPT_DIR/src-tauri/jan-cli" # the standalone `jan` CLI crate (build)INSTALL_DIR="${HOME}/.local/bin"BIN_NAME="jan"@@ -32,9 +33,10 @@ build() {fiecho "==> Building CLI binary (${profile})..."- (cd "$CRATE_DIR" && cargo build $flag --no-default-features --features cli --bin jan)+ (cd "$CLI_DIR" && cargo build $flag --features cli)- local artifact="$CRATE_DIR/target/$target_dir/jan"+ # jan-cli's .cargo/config.toml redirects output into the app's target dir.+ local artifact="$APP_DIR/target/$target_dir/jan"if [ ! -f "$artifact" ]; thenecho "ERROR: build artifact not found at $artifact"exit 1@@ -51,12 +53,12 @@ build() {case "${1:-debug}" incheck)echo "==> cargo check (no binary produced)..."- (cd "$CRATE_DIR" && cargo check --no-default-features --features cli --lib)+ (cd "$APP_DIR" && cargo check --no-default-features --features cli --lib)echo "==> OK";;test)echo "==> Running TUI tests..."- (cd "$CRATE_DIR" && cargo test --no-default-features --features cli --lib -- core::cli::tui)+ (cd "$APP_DIR" && cargo test --no-default-features --features cli --lib -- core::cli::tui)echo "==> All TUI tests passed";;release)diff --git a/scripts/install-jan-agent.ps1 b/scripts/install-jan-agent.ps1index afe91e63b..42a94aa91 100644--- a/scripts/install-jan-agent.ps1+++ b/scripts/install-jan-agent.ps1@@ -111,11 +111,11 @@ function Install-FromSource {throw 'cargo not found; install Rust first'}Write-Host "building the CLI from $RepoRoot (release)"- Push-Location (Join-Path $RepoRoot 'src-tauri')+ Push-Location (Join-Path $RepoRoot 'src-tauri\jan-cli')try {- # The CLI and the desktop app are mutually exclusive feature configs, so- # the default features must stay off.- cargo build --no-default-features --features cli --bin jan --release+ # The CLI is a standalone crate (no default features); its `cli` feature+ # pulls in `app_lib/cli`, which is compiled with default features off.+ cargo build --features cli --releaseif ($LASTEXITCODE -ne 0) { throw "cargo build failed with exit code $LASTEXITCODE" }} finally {Pop-Locationdiff --git a/scripts/install-jan-agent.sh b/scripts/install-jan-agent.shindex 461e59c59..ea80db00b 100755--- a/scripts/install-jan-agent.sh+++ b/scripts/install-jan-agent.sh@@ -139,9 +139,9 @@ install_binary() {build_from_source() {command -v cargo >/dev/null 2>&1 || die "cargo not found; install Rust first"echo "building the CLI from $REPO_ROOT (release)"- # The CLI and the desktop app are mutually exclusive feature configs, so the- # default features must stay off.- (cd "$REPO_ROOT/src-tauri" && cargo build --no-default-features --features cli --bin jan --release)+ # The CLI is a standalone crate (no default features); its `cli` feature+ # pulls in `app_lib/cli`, which is compiled with default features off.+ (cd "$REPO_ROOT/src-tauri/jan-cli" && cargo build --features cli --release)local built="$REPO_ROOT/src-tauri/target/release/$BINARY_NAME"[ -f "$built" ] || die "expected a binary at $built"install_binary "$built"diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rsindex d0c034650..3672745e2 100644--- a/src-tauri/src/lib.rs+++ b/src-tauri/src/lib.rs@@ -6,7 +6,7 @@#[cfg(all(feature = "cli", feature = "tauri-app"))]compile_error!("features `cli` and `tauri-app`/`desktop` are mutually exclusive; \- build the CLI with `cargo build --no-default-features --features cli --bin jan`"+ build the CLI from the standalone crate: `cd src-tauri/jan-cli && cargo build --features cli`");pub mod core;