Installation
This guide installs codeknit from source, adds it to your PATH, enables shell completions, and checks that it runs.
Install from source
Section titled “Install from source”Prerequisites
- Go 1.26 or later
- A C compiler. codeknit uses CGo to build its tree-sitter parsers.
Steps
git clone https://github.com/awslabs/codeknit.gitcd codeknitmake buildThe binary is written to ./bin/codeknit.
Use a prebuilt binary instead
Section titled “Use a prebuilt binary instead”Prebuilt binaries for Linux, macOS, and Windows (amd64 and arm64) are on the releases page. Download the archive for your platform, extract it, and move the binary onto your PATH. Each release includes a checksums.txt file you can verify the download against.
Add codeknit to your PATH
Section titled “Add codeknit to your PATH”Skip this section if you moved the binary into a directory that is already on your PATH, such as /usr/local/bin.
Replace /path/to/codeknit with the directory that contains the binary. If you built from source, that is the bin directory inside the cloned repository.
Add the line for your shell to its configuration file:
# bash (~/.bashrc)export PATH="$PATH:/path/to/codeknit"
# zsh (~/.zshrc)export PATH="$PATH:/path/to/codeknit"
# fish (~/.config/fish/config.fish)fish_add_path /path/to/codeknitReload your shell, or source the file you edited:
source ~/.bashrc # bashsource ~/.zshrc # zshFor fish, open a new terminal.
Enable shell completions
Section titled “Enable shell completions”codeknit generates completion scripts for bash, zsh, fish, and PowerShell. Run the command for your shell once:
# bashcodeknit completion bash >> ~/.bashrc
# zshcodeknit completion zsh >> ~/.zshrc
# fishcodeknit completion fish > ~/.config/fish/completions/codeknit.fish
# PowerShellcodeknit completion powershell >> $PROFILEThe bash, zsh, and PowerShell commands append to your profile. Running them again adds the script a second time, so run each one only once.
Open a new shell, or source your profile, to activate completions.
Verify the installation
Section titled “Verify the installation”codeknit --versionIf the command prints a version, codeknit is installed. If your shell reports command not found, check that the directory in your PATH line contains the codeknit binary, then reload your shell.
Set up a development environment
Section titled “Set up a development environment”Do this only if you plan to contribute to codeknit. Run these commands from the root of the cloned repository:
make deps # install dependenciesmake setup # configure git hooksmake test # run the test suitemake lint runs the linter and formatter.
Next steps
Section titled “Next steps”- Run your first command in Getting started.
- Browse every flag in the CLI flags reference.