|
| 1 | +# cb (Codeberg CLI) |
| 2 | + |
| 3 | +`cb` is a minimal, `gh`-style CLI for Codeberg focused on practical daily workflows. |
| 4 | + |
| 5 | +Current scope: |
| 6 | +- auth login/logout/status |
| 7 | +- repo list/create/migrate |
| 8 | +- self update |
| 9 | + |
| 10 | +## Install / Update / Uninstall |
| 11 | + |
| 12 | +Install: |
| 13 | + |
| 14 | +```bash |
| 15 | +curl -fsSL https://raw.githubusercontent.com/rishabyd/codeberg-cli/main/install.sh | sh |
| 16 | +``` |
| 17 | + |
| 18 | +Update: |
| 19 | + |
| 20 | +```bash |
| 21 | +cb update |
| 22 | +``` |
| 23 | + |
| 24 | +Uninstall: |
| 25 | + |
| 26 | +```bash |
| 27 | +curl -fsSL https://raw.githubusercontent.com/rishabyd/codeberg-cli/main/uninstall.sh | sh |
| 28 | +``` |
| 29 | + |
| 30 | +From local checkout: |
| 31 | + |
| 32 | +```bash |
| 33 | +./install.sh |
| 34 | +./uninstall.sh |
| 35 | +``` |
| 36 | + |
| 37 | +## Command Syntax |
| 38 | + |
| 39 | +```bash |
| 40 | +cb auth <action> |
| 41 | +cb repo <action> [target] |
| 42 | +cb update |
| 43 | +``` |
| 44 | + |
| 45 | +Auth: |
| 46 | + |
| 47 | +```bash |
| 48 | +cb auth login |
| 49 | +cb auth status |
| 50 | +cb auth logout |
| 51 | +``` |
| 52 | + |
| 53 | +Repo: |
| 54 | + |
| 55 | +```bash |
| 56 | +cb repo list [--limit <n>] |
| 57 | +cb repo create <name> [flags] |
| 58 | +cb repo migrate <owner/repo> [--clone] |
| 59 | +``` |
| 60 | + |
| 61 | +Create flags: |
| 62 | +- `-d, --description <text>` |
| 63 | +- `--public` |
| 64 | +- `--private` |
| 65 | +- `--add-readme` |
| 66 | +- `-c, --clone` |
| 67 | + |
| 68 | +## Common Workflows |
| 69 | + |
| 70 | +Create repository: |
| 71 | + |
| 72 | +```bash |
| 73 | +cb repo create my-project --public |
| 74 | +cb repo create my-project --private --description "internal tools" |
| 75 | +cb repo create my-project --public --add-readme --clone |
| 76 | +``` |
| 77 | + |
| 78 | +Migrate repository: |
| 79 | + |
| 80 | +```bash |
| 81 | +cb repo migrate owner/repo |
| 82 | +cb repo migrate owner/repo --clone |
| 83 | +``` |
| 84 | + |
| 85 | +`cb repo migrate` performs public GitHub -> public Codeberg migration and includes: |
| 86 | +- source code |
| 87 | +- issues |
| 88 | +- pull requests |
| 89 | +- wiki |
| 90 | +- labels |
| 91 | +- milestones |
| 92 | +- releases |
| 93 | + |
| 94 | +## Troubleshooting |
| 95 | + |
| 96 | +- DNS failure (`lookup codeberg.org ... server misbehaving`) is a local network resolver issue, not token expiry. |
| 97 | +- If refresh token is revoked or expired, run `cb auth login` again. |
| 98 | +- Verify auth and API reachability with `cb auth status`. |
| 99 | +- Ensure git HTTPS helper is configured: `git config --global --get credential.https://codeberg.org.helper`. |
| 100 | + |
| 101 | +## Exit Codes |
| 102 | + |
| 103 | +- `0`: success |
| 104 | +- `1`: runtime/auth/network/api error |
| 105 | +- `2`: usage or argument error |
| 106 | + |
| 107 | +## Build from Source |
| 108 | + |
| 109 | +```bash |
| 110 | +go build -o cb ./cmd/cb |
| 111 | +./cb --help |
| 112 | +``` |
| 113 | + |
| 114 | +## Platform Compatibility |
| 115 | + |
| 116 | +Official prebuilt release binaries are provided for: |
| 117 | +- Linux x86_64 (`linux_amd64`) |
| 118 | +- Linux ARM64 (`linux_arm64`) |
| 119 | + |
| 120 | +Other platforms can use source build (`go build -o cb ./cmd/cb`). |
| 121 | + |
| 122 | +## Versioning |
| 123 | + |
| 124 | +This project uses Go-native tag-based versioning. |
| 125 | + |
| 126 | +- Local/dev builds show version `dev`. |
| 127 | +- Release builds inject version from git tag using Go linker flags. |
| 128 | + |
| 129 | +Create and publish a release: |
| 130 | + |
| 131 | +```bash |
| 132 | +git status |
| 133 | +git tag -a v0.4.13 -m "v0.4.13" |
| 134 | +git push origin main --tags |
| 135 | +``` |
| 136 | + |
| 137 | +To verify locally: |
| 138 | + |
| 139 | +```bash |
| 140 | +go build -ldflags "-X main.version=0.4.13" -o cb ./cmd/cb |
| 141 | +./cb --version |
| 142 | +``` |
| 143 | + |
| 144 | +Required secret for releases: |
| 145 | +- `GITHUB_TOKEN` (provided automatically by GitHub Actions) |
0 commit comments