Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 30 additions & 87 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,96 +1,39 @@
name: CI/CD Pipeline
name: CI

on:
push:
branches: [ main ]
branches: [main, rust]
pull_request:
branches: [ main ]
release:
types: [ created ]
branches: [main]

env:
CARGO_TERM_COLOR: always

jobs:
lint:
rust:
name: Rust
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Install ShellCheck
run: sudo apt-get install -y shellcheck

- name: Lint shell scripts
run: shellcheck bin/* scripts/*.sh

test:
runs-on: ubuntu-latest
needs: lint
steps:
- uses: actions/checkout@v3

- name: Install BATS
run: |
git clone https://github.com/bats-core/bats-core.git
cd bats-core
sudo ./install.sh /usr/local

- name: Install bpkg
run: |
curl -Lo- http://get.bpkg.sh | bash
echo "PATH=$PATH:/usr/local/bin" >> $GITHUB_ENV
which bpkg

- name: Install dependencies
run: |
# Install Git
sudo apt-get update
sudo apt-get install -y git

# Install GitHub CLI properly
type -p curl >/dev/null || sudo apt-get install curl -y
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \
&& sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
&& sudo apt update \
&& sudo apt install gh -y

- name: Install CLI with bpkg
run: bpkg install hellobdo/bdo-cli -g

- name: Test CLI basic functionality
run: |
echo "Current PATH: $PATH"
which bdo || echo "bdo command not found in PATH"
bdo help || echo "Failed to run bdo help"

- name: Test CLI removal functionality
run: |
echo "y" | bdo remove
if command -v bdo &> /dev/null; then
echo "Error: bdo command still exists after removal"
exit 1
else
echo "✅ bdo-cli successfully removed"
fi

if [ -d "$HOME/.local/lib/bdo-cli" ]; then
echo "Error: bdo-cli library directory still exists after removal"
exit 1
else
echo "✅ bdo-cli library directory successfully removed"
fi

publish:
runs-on: ubuntu-latest
needs: test
if: github.event_name == 'release'
steps:
- uses: actions/checkout@v3

- name: Install jq
run: sudo apt-get install -y jq

- name: Update package.json version
run: |
TAG=${GITHUB_REF#refs/tags/}
VERSION=${TAG#v}
jq ".version = \"$VERSION\"" package.json > package.json.tmp
mv package.json.tmp package.json
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt

- name: Cache Cargo registry and build output
uses: Swatinem/rust-cache@v2

- name: Check formatting
run: cargo fmt --check

- name: Run Clippy
run: cargo clippy --all-targets --all-features -- -D warnings

- name: Run tests
run: cargo test --all-targets --all-features

- name: Build release binary
run: cargo build --release --locked
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/.vscode
/.vscode
/target
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[package]
name = "bdo-cli"
version = "1.1.0"
edition = "2021"
description = "BDO CLI tool for Git, GitHub, and development workflows"
license = "MIT"

[[bin]]
name = "bdo"
path = "src/main.rs"
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2025 hellobdo
Copyright (c) 2026 hellobdo

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
SOFTWARE.
18 changes: 0 additions & 18 deletions Makefile

This file was deleted.

54 changes: 39 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,41 +1,65 @@
# bdo-cli <img src="./assets/bdo-cli.svg" alt="Logo" width="20" />

bdo-cli provides a collection of helpful shell scripts for Git, GitHub, and development workflows.
`bdo-cli` is a small Rust CLI for common Git, GitHub, and repository workflow commands.

## Installation

Install the CLI with Cargo:

```bash
# One-line installer (installs bpkg if needed)
curl -Lo- https://raw.githubusercontent.com/hellobdo/bdo-cli/main/install-with-bpkg.sh | bash
cargo install --git https://github.com/hellobdo/bdo-cli
```

This installs the `bdo` binary into Cargo's bin directory, usually `~/.cargo/bin`.
Make sure that directory is available in your `PATH`.

## Requirements

Before installing, ensure you have the following prerequisites:
- **Git**: For repository operations
- **GitHub CLI**: For GitHub operations
- **Direnv Allow**: Making direnvs
`bdo-cli` shells out to existing developer tools. Before using it, install:

- **Rust and Cargo**: for installing and updating the CLI
- **Git**: for repository operations
- **GitHub CLI**: for creating GitHub repositories

You should also be authenticated with the GitHub CLI before using `bdo create`:

These tools must be installed on your system before attempting to install bdo-cli.
```bash
gh auth login
```

## Available Commands

- `bdo help` - Show all available commands
- `bdo create <repo-name>` - Create and initialize a new repository
- `bdo create <repo-name>` - Create a local repository, make the initial commit, and create the GitHub repository
- `bdo push` - Add, commit, and push changes
- `bdo branch <branch-name>` - Create and push a new branch
- `bdo checkout` - Reset to match remote main branch
- `bdo mkenvrc` - Creates a envrc file in folder and runs direnv allow
- `bdo checkout` - Switch back to `main`, delete the previous branch, and reset `main` to `origin/main`

## Development

Run the CLI locally with Cargo:

```bash
cargo run -- help
```

Run the Rust checks used by CI:

```bash
cargo fmt --check
cargo clippy --all-targets --all-features -- -D warnings
cargo test --all-targets --all-features
cargo build --release --locked
```

## Uninstallation

To remove bdo-cli from your system:
If you installed with Cargo, uninstall with:

```bash
# Run the built-in removal command
bdo remove
cargo uninstall bdo-cli
```

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
This project is licensed under the MIT License. See [LICENSE](LICENSE) for details.
60 changes: 0 additions & 60 deletions bin/bdo-cli

This file was deleted.

66 changes: 0 additions & 66 deletions install-with-bpkg.sh

This file was deleted.

Loading
Loading