Skip to content

CLI Development

The bucky CLI is a Rust binary that sets up workflows in target repos via the GitHub API. Source code is in cli/.

Terminal window
cd cli
make build # cargo build --release (binary: target/release/bucky)
make test # cargo test (unit + integration)
make lint # cargo clippy -- -D warnings
make fmt # cargo fmt
make fmt-check # cargo fmt --check
make install # build + copy binary to /usr/local/bin/bucky

Run a single test:

Terminal window
cd cli && cargo test <test_name>
ModuleFilePurpose
mainsrc/main.rsEntry point, error handling
clisrc/cli.rsArg parsing (clap), workflow enum, repo format validation, git remote detection
presetsrc/preset.rsPreset enum, config loading from embedded presets.json
detectsrc/detect.rsAuto-detect project type (checks for go.mod, package.json)
templatessrc/templates.rsEmbedded workflow templates with __PRESET__ and @main@v{major} substitution
versionsrc/version.rsVersion constants from VERSION file via build.rs
githubsrc/github.rsGitHub API interactions via octocrab
promptsrc/prompt.rsInteractive preset selection via dialoguer
pr_bodysrc/pr_body.rsPR description generation
labelssrc/labels.rsLabel creation/management
outputsrc/output.rsOutput formatting
  • Error handling: anyhow::Result throughout; errors bubble up to main() which prints and exits with code 1
  • Async: Single-threaded tokio runtime (current_thread) for GitHub API calls
  • Testing: Unit tests inline in source files, integration tests in cli/tests/integration.rs using assert_cmd and predicates
  • Auth: Relies on gh CLI being installed and authenticated
  • Compile-time embedding: presets.json is embedded via include_str! and parsed into a LazyLock<HashMap> static; workflow templates embedded similarly; version from VERSION file via build.rs
  • Dry-run: --dry-run flag previews all changes without writing to the remote