Skip to content

Installation

CodeKnife ships as one self-contained binary named codeknife. You can install it with the install script, unpack a release archive by hand, use the Homebrew formula the release workflow publishes, or build it from source with Cargo.

Terminal window
curl -fsSL https://raw.githubusercontent.com/robertguss/codeknife/main/scripts/install.sh | bash

The script is written for bash (it starts with set -euo pipefail), so pipe it to bash, not sh. On a supported platform it downloads the latest prebuilt release. On any other platform it builds from source with Cargo. Then confirm the install.

The script takes no arguments. It runs these steps in order:

  1. Creates the install directory with mkdir -p.

  2. Detects the platform from uname -s and uname -m (see the table below).

  3. If the platform is supported and curl is on your PATH, asks the GitHub API for the latest release (https://api.github.com/repos/<repo>/releases/latest) and reads its tag_name.

  4. Downloads https://github.com/<repo>/releases/download/<tag>/codeknife-<tag>-<target>.tar.gz into a temporary directory, extracts it, and copies codeknife-<tag>-<target>/codeknife into the install directory with mode 0755. It prints Installed codeknife (<tag>) to <dir>/codeknife. The temporary directory is deleted when the script exits.

  5. If any of the steps above fails (unsupported platform, no curl, no tag found, or the download fails), it falls back to a source build: it prints Building codeknife from source via cargo... and runs:

    Terminal window
    cargo install --git "https://github.com/robertguss/codeknife.git" codeknife-cli

If the fallback is needed and cargo is not installed, the script stops with exit code 1 and prints:

error: no prebuilt release found and 'cargo' is not installed.
Install Rust from https://rustup.rs and re-run.
uname -s uname -m Target name Result
Darwin arm64 or aarch64 aarch64-macos Prebuilt binary
Linux x86_64 x86_64-linux Prebuilt binary
anything else anything else none Prints unsupported prebuilt platform: <os>/<arch> to stderr, then builds with Cargo

Intel Macs, Linux on ARM, and Windows have no prebuilt binary. On those platforms the script always takes the Cargo path.

Variable Default Effect
CODEKNIFE_INSTALL_DIR $HOME/.local/bin Directory the prebuilt binary is copied into.
CODEKNIFE_REPO robertguss/codeknife GitHub owner/name used for the release lookup, the archive download and the Cargo fallback URL.

Example with a custom directory:

Terminal window
curl -fsSL https://raw.githubusercontent.com/robertguss/codeknife/main/scripts/install.sh | CODEKNIFE_INSTALL_DIR="$HOME/bin" bash

Each GitHub release created by the release workflow contains these assets:

Asset Contents
codeknife-<tag>-x86_64-linux.tar.gz Directory codeknife-<tag>-x86_64-linux/ with codeknife, README.md, LICENSE-MIT, LICENSE-APACHE
codeknife-<tag>-aarch64-macos.tar.gz Directory codeknife-<tag>-aarch64-macos/ with the same four files
SHA256SUMS.txt Output of sha256sum codeknife-*.tar.gz for both archives

<tag> is the full Git tag, including the leading v, for example codeknife-v0.2.0-x86_64-linux.tar.gz.

To install one by hand, download the archive for your platform and SHA256SUMS.txt from the release page, then:

Terminal window
sha256sum --check --ignore-missing SHA256SUMS.txt
codeknife-v0.2.0-x86_64-linux.tar.gz: OK
Terminal window
tar -xzf codeknife-v0.2.0-x86_64-linux.tar.gz
install -m 0755 codeknife-v0.2.0-x86_64-linux/codeknife ~/.local/bin/codeknife

These are the same tar and install steps the install script performs. The output above comes from an archive packaged locally with the workflow’s own packaging commands.

The Release workflow runs on every pushed tag that matches v*, or by hand with an optional tag input.

  • x86_64-linux is built on ubuntu-24.04 inside the rust:1-bookworm container with cargo build --release --bin codeknife. The job reads the highest GLIBC_ symbol version the binary needs (with objdump -T) and fails if it is above 2.36. The Linux binary is dynamically linked against glibc, and glibc 2.36 or newer is enough to run it.
  • aarch64-macos is built on macos-latest with the stable Rust toolchain and the same cargo build command.
  • Both jobs run codeknife --version and codeknife --no-cache check --strict against the CodeKnife repository itself before packaging.
  • Neither job passes --target, so each binary is a native build for its runner.

The release workflow can also update a Homebrew formula: Formula/codeknife.rb in the robertguss/homebrew-tap repository.

Terminal window
brew install robertguss/tap/codeknife

The generated formula installs as follows:

Platform What the formula installs
macOS on Apple silicon The aarch64-macos release archive
Linux on x86_64 The x86_64-linux release archive
macOS on Intel Builds from the tagged source archive (depends_on "rust" => :build)
Linux on ARM Builds from the tagged source archive (depends_on "rust" => :build)
--HEAD Builds from the main branch with Rust

Source builds run cargo install on crates/codeknife-cli. The formula also installs README.md, LICENSE-MIT and LICENSE-APACHE as docs. Its test runs codeknife --version and codeknife --no-cache --path <testpath> check on a one-file Python project.

You need a Rust toolchain that supports the workspace settings in the root Cargo.toml:

Setting Value
rust-version (minimum supported Rust) 1.88
edition 2024
Workspace version 0.2.0
License MIT OR Apache-2.0

The binary target is declared in crates/codeknife-cli/Cargo.toml as [[bin]] name = "codeknife". The CLI crate defines no Cargo features, so there is nothing to switch on. A Cargo.lock is committed at the workspace root.

From a clone of the repository:

Terminal window
cargo build --release
...
Compiling codeknife-cli v0.2.0 (.../crates/codeknife-cli)
Finished `release` profile [optimized] target(s) in 1m 28s

The binary is written to target/release/codeknife. This is the same command the CI workflow uses before it runs ./target/release/codeknife --no-cache check --strict.

The workspace release profile sets strip = true, lto = "thin" and codegen-units = 1.

Terminal window
codeknife --version
codeknife 0.2.0

-V prints the same line. --version also works on every subcommand, which prefixes the subcommand name:

Terminal window
codeknife check --version
codeknife-check 0.2.0

Both exit with code 0. Running codeknife with no subcommand prints the usage text and exits with code 2.