| @@ -12,18 +12,24 @@ access token (PAT). It imports none of the server's code: a clean client boundar |
| 12 | | 12 | |
| 13 | **Download a release.** Binaries for linux (amd64, arm64) and macos (amd64, | 13 | **Download a release.** Binaries for linux (amd64, arm64) and macos (amd64, |
| 14 | arm64) are attached to each release at <https://rickub.com/rickub/cli/releases>. | 14 | arm64) are attached to each release at <https://rickub.com/rickub/cli/releases>. |
| 15 | -Open that page, download the archive matching your OS and architecture, extract | 15 | +Assets are served at `releases/download/<tag>/<asset>`, and `releases/latest` |
| 16 | -it, and put `rickub` on your `PATH`: | 16 | +redirects to the newest release: |
| 17 | | 17 | |
| 18 | ```sh | 18 | ```sh |
| 19 | -# after downloading the asset for your platform from the releases page: | 19 | +# newest release tag, e.g. v0.1.0 (or set it by hand) |
| 20 | -tar -xzf rickub_<version>_<os>_<arch>.tar.gz rickub | 20 | +tag=$(curl -fsSI https://rickub.com/rickub/cli/releases/latest | awk 'tolower($1)=="location:"{print $2}' | tr -d '\r' | sed 's#.*/##') |
| | 21 | +v=${tag#v} |
| | 22 | +os=$(uname -s | tr '[:upper:]' '[:lower:]') |
| | 23 | +arch=$(uname -m); case "$arch" in x86_64) arch=amd64 ;; aarch64) arch=arm64 ;; esac |
| | 24 | + |
| | 25 | +base=https://rickub.com/rickub/cli/releases/download/$tag |
| | 26 | +curl -fsSLO "$base/rickub_${v}_${os}_${arch}.tar.gz" && curl -fsSLO "$base/SHA256SUMS" |
| | 27 | +sha256sum -c SHA256SUMS --ignore-missing # shasum -a 256 -c on macOS |
| | 28 | +tar -xzf "rickub_${v}_${os}_${arch}.tar.gz" rickub |
| 21 | sudo install rickub /usr/local/bin/rickub | 29 | sudo install rickub /usr/local/bin/rickub |
| 22 | ``` | 30 | ``` |
| 23 | | 31 | |
| 24 | -> Note: rickub.com serves release assets from the release page itself — there is | 32 | +Each archive holds the `rickub` binary plus `README.md` and `LICENSE`. |
| 25 | -> no `/releases/latest/download/…` redirect, so pick the asset from the page (or | | |
| 26 | -> from the release's API entry) rather than guessing a URL. | | |
| 27 | | 33 | |
| 28 | **Build from source** (Go 1.26+): | 34 | **Build from source** (Go 1.26+): |
| 29 | | 35 | |
| @@ -33,10 +39,10 @@ cd cli |
| 33 | go build -o rickub . # produces ./rickub at the repo root | 39 | go build -o rickub . # produces ./rickub at the repo root |
| 34 | ``` | 40 | ``` |
| 35 | | 41 | |
| 36 | -To stamp a version into the binary: | 42 | +To stamp a version into the binary (releases use the bare version, no `v`): |
| 37 | | 43 | |
| 38 | ```sh | 44 | ```sh |
| 39 | -go build -ldflags "-X rickub.com/rickub/cli/cmd.Version=$(git describe --tags)" -o rickub . | 45 | +go build -ldflags "-X rickub.com/rickub/cli/cmd.Version=$(cat VERSION)-dev" -o rickub . |
| 40 | ``` | 46 | ``` |
| 41 | | 47 | |
| 42 | Verify: | 48 | Verify: |
| @@ -138,7 +144,7 @@ rickub repo create <name> [--org H] [--public|--private] [-d desc] |
| 138 | rickub repo view <owner/repo> | 144 | rickub repo view <owner/repo> |
| 139 | rickub repo edit <owner/repo> [--visibility public|private] [-d desc] [--default-branch B] | 145 | rickub repo edit <owner/repo> [--visibility public|private] [-d desc] [--default-branch B] |
| 140 | rickub repo delete <owner/repo> [--yes] | 146 | rickub repo delete <owner/repo> [--yes] |
| 141 | -rickub repo clone <owner/repo> [dir] [-- git-args…] | 147 | +rickub repo clone <owner/repo> [dir] [--protocol ssh|https] [-- git-args…] |
| 142 | rickub repo files <owner/repo> [path] [--ref R] | 148 | rickub repo files <owner/repo> [path] [--ref R] |
| 143 | rickub repo cat <owner/repo> <path> [--ref R] | 149 | rickub repo cat <owner/repo> <path> [--ref R] |
| 144 | rickub repo commits <owner/repo> [ref] [--page N] [--per-page N] | 150 | rickub repo commits <owner/repo> [ref] [--page N] [--per-page N] |
| @@ -149,7 +155,8 @@ rickub repo collaborator remove <owner/repo> <user> |
| 149 | | 155 | |
| 150 | rickub pr list [-R owner/repo] [--state open|closed|merged|all] | 156 | rickub pr list [-R owner/repo] [--state open|closed|merged|all] |
| 151 | rickub pr view <number> [-R owner/repo] | 157 | rickub pr view <number> [-R owner/repo] |
| 152 | -rickub pr create [-R owner/repo] --base B --head H --title T [-b body] [--head-owner O --head-repo R] | 158 | +rickub pr create [-R owner/repo] --base B --head H --title T [-b body] [--draft] [--head-owner O --head-repo R] |
| | 159 | +rickub pr ready <number> [-R owner/repo] [--undo] # draft → ready for review (or back) |
| 153 | rickub pr merge <number> [-R owner/repo] [--method merge|squash|ff-only] | 160 | rickub pr merge <number> [-R owner/repo] [--method merge|squash|ff-only] |
| 154 | rickub pr close <number> [-R owner/repo] | 161 | rickub pr close <number> [-R owner/repo] |
| 155 | rickub pr comment <number> [-R owner/repo] -b "text" | 162 | rickub pr comment <number> [-R owner/repo] -b "text" |
| @@ -174,6 +181,12 @@ rickub issue milestone <number> [-R owner/repo] --milestone "v1.0" | --clear |
| 174 | rickub issue assign <number> [-R owner/repo] --user H [--remove] | 181 | rickub issue assign <number> [-R owner/repo] --user H [--remove] |
| 175 | rickub issue labels [-R owner/repo] | 182 | rickub issue labels [-R owner/repo] |
| 176 | | 183 | |
| | 184 | +rickub label list [-R owner/repo] |
| | 185 | +rickub label create <name> [-R owner/repo] [--color d73a4a] # colors come from `label palette` |
| | 186 | +rickub label edit <name> [-R owner/repo] [--name new] [--color hex] |
| | 187 | +rickub label delete <name> [-R owner/repo] |
| | 188 | +rickub label palette |
| | 189 | + |
| 177 | rickub milestone list [-R owner/repo] [--state open|closed|all] | 190 | rickub milestone list [-R owner/repo] [--state open|closed|all] |
| 178 | rickub milestone create [-R owner/repo] -t "v1.0" [-d desc] [--due YYYY-MM-DD] | 191 | rickub milestone create [-R owner/repo] -t "v1.0" [-d desc] [--due YYYY-MM-DD] |
| 179 | rickub milestone close <id> [-R owner/repo] | 192 | rickub milestone close <id> [-R owner/repo] |
| @@ -191,9 +204,18 @@ rickub browse [owner/repo] [--print] |
| 191 | rickub version | 204 | rickub version |
| 192 | ``` | 205 | ``` |
| 193 | | 206 | |
| | 207 | +### Cloning |
| | 208 | + |
| | 209 | +`repo clone` derives the git URL from the API host: `ssh://git@<host>/<owner>/<repo>.git` |
| | 210 | +by default, which your SSH keys authenticate, or `https://git.<host>/<owner>/<repo>.git` |
| | 211 | +with `--protocol https`, where the token authenticates that clone (git receives it |
| | 212 | +through its environment, never on the command line or in `.git/config`; later |
| | 213 | +fetches of a private repo over HTTPS need a git credential helper). Merge requests |
| | 214 | +open ready for review; pass `--draft` to open a draft, and `pr ready` flips it. |
| | 215 | + |
| 194 | ### Repo selector | 216 | ### Repo selector |
| 195 | | 217 | |
| 196 | -`pr`, `run`, `issue`, and `milestone` subcommands take `-R/--repo owner/repo`. When omitted, the repo is | 218 | +`pr`, `run`, `issue`, `label`, and `milestone` subcommands take `-R/--repo owner/repo`. When omitted, the repo is |
| 197 | inferred from the current directory's git `origin` remote (any of `https://`, | 219 | inferred from the current directory's git `origin` remote (any of `https://`, |
| 198 | `ssh://`, or `git@host:owner/repo` forms). | 220 | `ssh://`, or `git@host:owner/repo` forms). |
| 199 | | 221 | |
| @@ -235,7 +257,7 @@ Layout: |
| 235 | | 257 | |
| 236 | ``` | 258 | ``` |
| 237 | main.go # entrypoint; maps API errors to exit codes | 259 | main.go # entrypoint; maps API errors to exit codes |
| 238 | -cmd/ # Cobra command tree (auth, repo, pr, issue, milestone, run, org, search, api, browse) | 260 | +cmd/ # Cobra command tree (auth, repo, pr, issue, label, milestone, run, org, search, api, browse) |
| 239 | internal/api/ # typed HTTP client for the rickub JSON API | 261 | internal/api/ # typed HTTP client for the rickub JSON API |
| 240 | internal/config/ # config load/save + host/token resolution and binding | 262 | internal/config/ # config load/save + host/token resolution and binding |
| 241 | ``` | 263 | ``` |