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.
Quick install
Section titled “Quick install”curl -fsSL https://raw.githubusercontent.com/robertguss/codeknife/main/scripts/install.sh | bashThe 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.
What the install script does
Section titled “What the install script does”The script takes no arguments. It runs these steps in order:
-
Creates the install directory with
mkdir -p. -
Detects the platform from
uname -sanduname -m(see the table below). -
If the platform is supported and
curlis on yourPATH, asks the GitHub API for the latest release (https://api.github.com/repos/<repo>/releases/latest) and reads itstag_name. -
Downloads
https://github.com/<repo>/releases/download/<tag>/codeknife-<tag>-<target>.tar.gzinto a temporary directory, extracts it, and copiescodeknife-<tag>-<target>/codeknifeinto the install directory with mode0755. It printsInstalled codeknife (<tag>) to <dir>/codeknife. The temporary directory is deleted when the script exits. -
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 printsBuilding 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.Supported prebuilt platforms
Section titled “Supported prebuilt platforms”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.
Environment variables
Section titled “Environment variables”| 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:
curl -fsSL https://raw.githubusercontent.com/robertguss/codeknife/main/scripts/install.sh | CODEKNIFE_INSTALL_DIR="$HOME/bin" bashManual download from a release
Section titled “Manual download from a release”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:
sha256sum --check --ignore-missing SHA256SUMS.txtcodeknife-v0.2.0-x86_64-linux.tar.gz: OKtar -xzf codeknife-v0.2.0-x86_64-linux.tar.gzinstall -m 0755 codeknife-v0.2.0-x86_64-linux/codeknife ~/.local/bin/codeknifeThese 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.
How release binaries are built
Section titled “How release binaries are built”The Release workflow runs on every pushed tag that matches v*, or by hand with an optional tag input.
x86_64-linuxis built onubuntu-24.04inside therust:1-bookwormcontainer withcargo build --release --bin codeknife. The job reads the highestGLIBC_symbol version the binary needs (withobjdump -T) and fails if it is above2.36. The Linux binary is dynamically linked against glibc, and glibc 2.36 or newer is enough to run it.aarch64-macosis built onmacos-latestwith the stable Rust toolchain and the samecargo buildcommand.- Both jobs run
codeknife --versionandcodeknife --no-cache check --strictagainst the CodeKnife repository itself before packaging. - Neither job passes
--target, so each binary is a native build for its runner.
Homebrew
Section titled “Homebrew”The release workflow can also update a Homebrew formula: Formula/codeknife.rb in the robertguss/homebrew-tap repository.
brew install robertguss/tap/codeknifeThe 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.
Build from source
Section titled “Build from source”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:
cargo build --release... Compiling codeknife-cli v0.2.0 (.../crates/codeknife-cli) Finished `release` profile [optimized] target(s) in 1m 28sThe 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.
From a clone of the repository:
cargo install --path crates/codeknife-cli... Installing .../bin/codeknife Installed package `codeknife-cli v0.2.0 (.../crates/codeknife-cli)` (executable `codeknife`)The package is codeknife-cli and the executable it installs is codeknife.
Without cloning, the same command the install script falls back to:
cargo install --git https://github.com/robertguss/codeknife.git codeknife-cliThis builds the default branch.
The workspace release profile sets strip = true, lto = "thin" and codegen-units = 1.
Confirm the install
Section titled “Confirm the install”codeknife --versioncodeknife 0.2.0-V prints the same line. --version also works on every subcommand, which prefixes the subcommand name:
codeknife check --versioncodeknife-check 0.2.0Both exit with code 0. Running codeknife with no subcommand prints the usage text and exits with code 2.
Next steps
Section titled “Next steps”- Quickstart: run CodeKnife on a small repository in about ten minutes.
- Core Concepts: blades, findings, the gate and the baseline.
- CLI Reference: every command and flag.