From 18f4fe3e9b06771f4d37694def10b3f32e69c89e Mon Sep 17 00:00:00 2001 From: RodCor Date: Sat, 30 May 2026 18:08:06 -0300 Subject: [PATCH] Fix Intel macOS release build flavor --- .github/workflows/release.yml | 18 +++++++++--------- README.md | 14 ++++++++------ crates/kimetsu-cli/Cargo.toml | 6 ++++-- crates/kimetsu-cli/src/update.rs | 28 +++++++++++++++++++++++++++- 4 files changed, 48 insertions(+), 18 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d1448ba..fce8022 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,13 +9,14 @@ # user. Manual `cargo publish` to crates.io is a follow-up step # (we don't auto-publish from CI to keep approvals explicit). # -# Two artifact sets per platform: +# Artifact flavors: # * `kimetsu---lean` — built with # `--no-default-features`: NoopEmbedder + FTS-only retrieval. # Smallest binary, no model download on install. -# * `kimetsu---embeddings` — default build. +# * `kimetsu---embeddings` — opt-in semantic build. # Larger binary; fastembed-rs + ONNX runtime linked statically -# when possible. +# when possible. Not built for x86_64-apple-darwin because `ort` +# does not publish a prebuilt ONNX Runtime for that target. name: release @@ -42,16 +43,15 @@ jobs: include: # Linux - { os: ubuntu-latest, target: x86_64-unknown-linux-gnu, flavor: lean, extra_features: "--no-default-features" } - - { os: ubuntu-latest, target: x86_64-unknown-linux-gnu, flavor: embeddings, extra_features: "" } + - { os: ubuntu-latest, target: x86_64-unknown-linux-gnu, flavor: embeddings, extra_features: "--features embeddings" } # macOS Intel - { os: macos-15-intel, target: x86_64-apple-darwin, flavor: lean, extra_features: "--no-default-features" } - - { os: macos-15-intel, target: x86_64-apple-darwin, flavor: embeddings, extra_features: "" } # macOS Apple Silicon - { os: macos-14, target: aarch64-apple-darwin, flavor: lean, extra_features: "--no-default-features" } - - { os: macos-14, target: aarch64-apple-darwin, flavor: embeddings, extra_features: "" } + - { os: macos-14, target: aarch64-apple-darwin, flavor: embeddings, extra_features: "--features embeddings" } # Windows - { os: windows-latest, target: x86_64-pc-windows-msvc, flavor: lean, extra_features: "--no-default-features" } - - { os: windows-latest, target: x86_64-pc-windows-msvc, flavor: embeddings, extra_features: "" } + - { os: windows-latest, target: x86_64-pc-windows-msvc, flavor: embeddings, extra_features: "--features embeddings" } steps: - uses: actions/checkout@v4 @@ -255,8 +255,8 @@ jobs: echo "" >> $GITHUB_STEP_SUMMARY echo "Users can now install with:" >> $GITHUB_STEP_SUMMARY echo '```' >> $GITHUB_STEP_SUMMARY - echo "cargo install kimetsu-cli" >> $GITHUB_STEP_SUMMARY - echo "cargo install kimetsu-cli --no-default-features # lean build" >> $GITHUB_STEP_SUMMARY + echo "cargo install kimetsu-cli # lean build" >> $GITHUB_STEP_SUMMARY + echo "cargo install kimetsu-cli --features embeddings # semantic build where ort supports the target" >> $GITHUB_STEP_SUMMARY echo "kimetsu update --check" >> $GITHUB_STEP_SUMMARY echo "kimetsu uninstall --dry-run" >> $GITHUB_STEP_SUMMARY echo '```' >> $GITHUB_STEP_SUMMARY diff --git a/README.md b/README.md index bcb165d..3e38e48 100644 --- a/README.md +++ b/README.md @@ -81,22 +81,24 @@ detection? See **[docs/HOW-KIMETSU-WORKS.md](docs/HOW-KIMETSU-WORKS.md)**. Kimetsu is a single Rust binary. Pick your flavor: ```bash -# Default — semantic search enabled (fastembed + ONNX; first run downloads BGE-small) +# Default lean build — fast lexical (FTS) retrieval, no model download cargo install kimetsu-cli -# Lean — fast lexical (FTS) retrieval, no model download -cargo install kimetsu-cli --no-default-features +# Semantic build — fastembed + ONNX; first run downloads BGE-small +cargo install kimetsu-cli --features embeddings # From source -cargo install --path crates/kimetsu-cli # add --no-default-features for lean +cargo install --path crates/kimetsu-cli # add --features embeddings for semantic search ``` Prefer not to touch the Rust toolchain? Pre-built binaries for **Linux / macOS / Windows** ship on every [GitHub Release](https://github.com/RodCor/kimetsu/releases). Extract the archive and put `kimetsu` / `kimetsu.exe` somewhere on `PATH` (`~/.local/bin`, `/usr/local/bin`, -or `%USERPROFILE%\.cargo\bin`). macOS prebuilt archives are published for both -Intel and Apple Silicon. +or `%USERPROFILE%\.cargo\bin`). Lean archives are published for Linux, +macOS Intel, macOS Apple Silicon, and Windows. Embeddings archives are +published where ONNX Runtime prebuilts are available: Linux x86_64, +macOS Apple Silicon, and Windows x86_64. Confirm it's healthy: diff --git a/crates/kimetsu-cli/Cargo.toml b/crates/kimetsu-cli/Cargo.toml index 8aa6944..67e9803 100644 --- a/crates/kimetsu-cli/Cargo.toml +++ b/crates/kimetsu-cli/Cargo.toml @@ -24,8 +24,10 @@ categories = ["command-line-utilities", "development-tools"] # Fan-out covers every kimetsu-* dep that kimetsu-cli actually # imports (kimetsu-harbor-rs is NOT among them — that crate's # binary is built separately by the release workflow). -# v0.7.1: embeddings on by default (requires VS2022 C++ runtime — ort prebuilts). -default = ["embeddings"] +# v0.7.3: keep the default install lean so `cargo install kimetsu-cli` +# works on every supported target. Embeddings remain available with +# `--features embeddings` on targets where `ort` ships prebuilts. +default = [] embeddings = [ "kimetsu-agent/embeddings", "kimetsu-brain/embeddings", diff --git a/crates/kimetsu-cli/src/update.rs b/crates/kimetsu-cli/src/update.rs index 415890d..bb28146 100644 --- a/crates/kimetsu-cli/src/update.rs +++ b/crates/kimetsu-cli/src/update.rs @@ -671,13 +671,28 @@ fn select_asset<'a>( } fn default_flavor() -> &'static str { - if cfg!(feature = "embeddings") { + default_flavor_for( + env::consts::OS, + env::consts::ARCH, + cfg!(feature = "embeddings"), + ) +} + +fn default_flavor_for(os: &str, arch: &str, embeddings_enabled: bool) -> &'static str { + if embeddings_enabled && embeddings_assets_supported(os, arch) { "embeddings" } else { "lean" } } +fn embeddings_assets_supported(os: &str, arch: &str) -> bool { + matches!( + (os, arch), + ("linux", "x86_64") | ("macos", "aarch64") | ("windows", "x86_64") + ) +} + fn release_target() -> Option<&'static str> { match (env::consts::OS, env::consts::ARCH) { ("linux", "x86_64") => Some("x86_64-unknown-linux-gnu"), @@ -752,4 +767,15 @@ mod tests { "kimetsu-0.7.3-x86_64-pc-windows-msvc-embeddings.zip" ); } + + #[test] + fn auto_flavor_falls_back_to_lean_for_intel_macos() { + assert_eq!( + default_flavor_for("macos", "x86_64", true), + "lean", + "the release workflow does not publish x86_64 macOS embeddings assets" + ); + assert_eq!(default_flavor_for("macos", "aarch64", true), "embeddings"); + assert_eq!(default_flavor_for("linux", "x86_64", false), "lean"); + } }