Nigiri is a tool for managing upstream VCS repositories and build artifacts. It allows you to easily build, run, and manage different versions of upstream projects.
- Build projects from Git repositories
- Manage multiple versions of the same project using different commits
- Run built binaries with convenient command-line syntax
- Support for private repositories using GitHub tokens
- Configurable build commands for different operating systems
- Working directory support for repositories with subdirectories
- Storage optimization with binary-only mode and source code compression
git clone https://github.com/oota-sushikuitee/nigiri.git
cd nigiri
make build
After building, you can install the binary to your PATH or use it directly from the bin
directory.
- Initialize nigiri configuration:
./bin/nigiri init
This creates a configuration file at ~/.nigiri/.nigiri.yml
.
-
Edit the configuration file to add your targets.
-
Build and run your targets as needed.
The configuration file is located at ~/.nigiri/.nigiri.yml
. Here's an example configuration:
targets:
sample-project:
source: https://github.com/octocat/Hello-World
default-branch: main
# The directory within the repository to run the build command (optional)
working-directory: ""
# Whether to keep only the binary and remove source code after build (optional)
binary-only: false
build-command:
linux: make build
windows: make build
darwin: make build
# Path to the built binary (relative to working directory or repository root)
binary-path: bin/myapp
env:
- "GO111MODULE=on"
- "CGO_ENABLED=0"
source
: Git repository URLdefault-branch
: Default branch to use if no commit is specifiedworking-directory
: Subdirectory within the repository to run build commands (optional)binary-only
: Whether to keep only the binary and remove source code after building (optional)build-command
: OS-specific build commandslinux
,windows
,darwin
: Build commands for each OSbinary-path
: Path to the built binary relative to the repository root
env
: Environment variables to set during build and run
Create a new nigiri configuration file:
nigiri init
List all configured targets:
nigiri list
Build a target at a specific commit:
nigiri build <target> [commit]
To build a target with GitHub token authentication (for private repositories):
nigiri build <target> --use-token
# or
nigiri build <target> -t
To force rebuild even if the target has already been built:
nigiri build <target> --force
# or
nigiri build <target> -f
To build with a specific clone depth:
nigiri build <target> --depth <depth>
# or
nigiri build <target> -d <depth>
For verbose output:
nigiri build <target> --verbose
# or
nigiri build <target> -v
Run a built target:
nigiri run <target> [commit] [args...]
If the commit is not specified, the latest built commit will be used.
Run the latest build of a target:
nigiri run <target>
Run a specific commit:
nigiri run <target> <commit>
Run with HEAD (latest commit) explicitly:
nigiri run <target> HEAD
Run and pass arguments to the target:
nigiri run <target> <commit> arg1 arg2
Run with arguments including flags:
nigiri run <target> HEAD -v --flag=value
Explicitly separate nigiri arguments from target arguments:
nigiri run <target> <commit> -- -v --flag=value
Note: When the second argument starts with -
, it's treated as an argument for the target program, not a commit hash.
Remove a built target:
nigiri remove <target> [commit]
If the commit is not specified, all builds of the target will be removed.
Remove all builds:
nigiri cleanup
For private repositories, you need to provide authentication. Nigiri supports GitHub token authentication:
nigiri build <target> --use-token
The token is automatically sourced from:
- GitHub CLI (
gh auth token
) - GITHUB_TOKEN environment variable
If your project requires building from a specific subdirectory, use the working-directory
option in your configuration:
targets:
my-project:
source: https://github.com/octocat/project-example
working-directory: "cmd/app"
# ... other options
To save disk space, you can enable binary-only mode, which only keeps the compiled binary and removes the source code:
targets:
my-project:
source: https://github.com/example/repository
binary-only: true
# ... other options
When binary-only is disabled (default), nigiri will compress the source code to save space while still keeping it available.
Nigiri is licensed under the MIT License. See LICENSE for more information.