Skip to content

Pipreola/gitee-cli

Repository files navigation

gitee-cli

English | 简体中文

A command-line tool for interacting with Gitee, built on the Gitee OpenAPI v5.

Manage authentication, pull requests, issues, repositories, and CI status from your terminal — with an output style consistent with gh / glab.

Status

  • ✅ Phase 1 — Project scaffolding (done)
  • ✅ Phase 1 — Authentication module (done)
  • ✅ PR create / list / view / checkout (done)
  • ✅ Issue list / view (done)
  • ✅ CI status (done)
  • ✅ P1 — PR / Issue edit, browse, direct API pass-through (done)

The current release ships the project skeleton, configuration management, an API client wrapper, full authentication, and PR / Issue / Repo / CI / Browse / API capabilities.

Features

The first release covers the following commands:

Command Description
gitee auth login Interactive or token-based login
gitee auth status Show the current login state
gitee auth logout Log out and clear local credentials
gitee repo view View repository information
gitee repo clone Clone a repository with authentication
gitee pr create Create a Pull Request (interactive or flags)
gitee pr list List PRs with state / author / label / branch filters
gitee pr view View Pull Request details
gitee pr checkout Check out a PR into a local branch
gitee pr edit Edit a PR's title / body / labels / assignees / milestone
gitee pr review Review a PR (--approve to approve / --comment to comment)
gitee pr ready Mark a draft PR as ready for review (--undo to revert to draft)
gitee issue list List issues with filters
gitee issue view View issue details
gitee issue edit Edit an issue's title / body / labels / assignee / milestone
gitee release list List repository releases
gitee release view View release details (by ID / tag / latest)
gitee release create Create a release from a tag (with --notes-file and --prerelease)
gitee release delete Delete a release (by ID / tag / latest; interactive confirm)
gitee search Search repositories / issues / users across Gitee
gitee ci status View CI/CD build status for the repository
gitee browse Open the repo / PR / Issue / commit in a browser
gitee api Make authenticated Gitee API calls (like gh api)

Output matches the conventions of gh / glab, and most read commands support --json for scripting.

Requirements

  • Go 1.25+ (only required when building from source or using go install)
  • Git (used for repository detection and branch operations)

Quick Start

# 1. Install (macOS / Linux)
curl -fsSL https://raw.githubusercontent.com/Pipreola/gitee-cli/main/install.sh | bash

# 2. Log in (generate a token at https://gitee.com/profile/personal_access_tokens)
gitee auth login

# 3. Verify
gitee auth status

# 4. Create a PR from the current branch
gitee pr create --title "Add new feature" --body "This PR adds ..."

Installation

One-line install script (recommended)

macOS / Linux / Git Bash / WSL:

curl -fsSL https://raw.githubusercontent.com/Pipreola/gitee-cli/main/install.sh | bash

Windows PowerShell:

irm https://raw.githubusercontent.com/Pipreola/gitee-cli/main/install.ps1 | iex

The PowerShell script auto-detects the architecture (x64 / arm64), downloads the matching gitee.exe from GitHub Releases, installs it to %LOCALAPPDATA%\Programs\gitee, and adds it to the user PATH. Reopen your terminal afterwards to use gitee.

If you hit an execution-policy restriction, relax it for the current session only: Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass

Manual download

  1. Download the archive for your platform from the latest release:
    • Linux / macOS: gitee_<version>_<OS>_<arch>.tar.gz
    • Windows: gitee_<version>_Windows_<arch>.zip
  2. Extract the archive to obtain the gitee (or gitee.exe) binary.
  3. Move it to a directory on your PATH:
    • macOS / Linux: sudo mv gitee /usr/local/bin/
    • Windows: place gitee.exe in a folder such as %LOCALAPPDATA%\Programs\gitee and add that folder to your user PATH.
  4. Verify: gitee version

Using go install

go install github.com/Pipreola/gitee-cli@latest

Build from source

git clone https://github.com/Pipreola/gitee-cli.git
cd gitee-cli
go build -o gitee .

Project Layout

.
├── main.go              # Program entry point
├── cmd/                 # Cobra command tree (root / version / auth / pr / issue / repo / ci / browse / api)
├── pkg/
│   ├── api/             # Gitee OpenAPI v5 client (auth, PR, issue, repo, CI, error handling)
│   ├── config/          # Config read/write (~/.config/gitee-cli/config.yaml)
│   └── auth/            # Authentication logic bridging config and API
├── internal/
│   └── version/         # Version metadata
└── docs/api/            # OpenAPI specs

Usage

Authentication

Generate a personal access token at https://gitee.com/profile/personal_access_tokens. Recommended scopes: user_info, projects, pull_requests, issues.

# Interactive login (recommended; token input is hidden)
gitee auth login

# Login with a flag
gitee auth login --token <your-personal-access-token>

# Show current login state
gitee auth status

# Log out and clear local credentials
gitee auth logout

# Show version
gitee version

Pull Requests

# Interactive create (recommended)
gitee pr create

# Create with flags
gitee pr create --title "Add new feature" --body "This PR adds ..."

# Draft PR
gitee pr create --draft --title "WIP: Refactor auth module"

# Reviewers and labels
gitee pr create --title "Fix bug" --assignees user1,user2 --labels bug,urgent

# Open the PR in a browser after creating
gitee pr create --title "Update docs" --web

# List open PRs in the current repo (default --state open)
gitee pr list

# List merged PRs / PRs you authored
gitee pr list --state merged
gitee pr list --author @me

# JSON output for scripting
gitee pr list --json --limit 50

# View PR details (with comments)
gitee pr view 123 --comments

# Check out a PR into a local branch named pr-<number>
gitee pr checkout 123
gitee pr checkout https://gitee.com/owner/repo/pulls/456

# Edit a PR (only the flags you pass are changed)
gitee pr edit 123 --title "New title" --body "Updated description"
gitee pr edit 123 --labels bug,urgent --assignees user1,user2
gitee pr edit 123 --labels ""   # pass empty string to clear labels

# Review a PR
gitee pr review 123 --approve                                          # approve
gitee pr review 123 --approve --body "LGTM, looks clean"               # approve with a comment
gitee pr review 123 --approve --force                                  # force-approve (bypass branch protection rules)
gitee pr review 123 --comment --body "Line 10: please add bounds check" # comment-only review

# Mark a draft PR as ready for review (or revert back to draft)
gitee pr ready 123          # draft -> ready
gitee pr ready 123 --undo   # ready -> draft

Search

# Search repositories (filter by owner / language / sort by stars)
gitee search repos kubernetes
gitee search repos cli --owner oschina --language Go --sort stars_count

# Search issues (full-site or within a repo)
gitee search issues "memory leak"
gitee search issues bug --repo oschina/git-osc --state closed --label bug

# Search users
gitee search users zhang

# Any search supports --json for scripting
gitee search repos cli --limit 50 --json

Note: Gitee OpenAPI v5 only supports repository / issue / user search — there is no code-content search endpoint.

Issues

# List issues (filter by assignee, state, labels, ...)
gitee issue list
gitee issue list --assignee @me

# View issue details with comments
gitee issue view IABCDE --comments

# Edit an issue (only the flags you pass are changed)
gitee issue edit IABCDE --title "New title" --body "Updated description"
gitee issue edit IABCDE --labels bug --assignee user1 --milestone 5

Browse

# Open the current repo homepage in a browser
gitee browse

# Open a specific PR
gitee browse --pr 123

# Open a specific issue
gitee browse --issue 456

# Open a specific commit
gitee browse --commit abc1234

Direct API Access

# Get current user info
gitee api /user

# Get repository info
gitee api /repos/owner/repo

# Create an issue (POST with form fields)
gitee api /repos/owner/repo/issues -X POST -f title="Bug report" -f body="Description"

# Use JSON input
gitee api /repos/owner/repo/issues -X POST --input '{"title":"Bug","body":"Fix it"}'

# Add query parameters
gitee api /user/repos -F state=all -F sort=updated

# Raw output (no JSON formatting)
gitee api /user --raw

# Custom request header
gitee api /user -H "X-Custom-Header: value"

Repository & CI

# View repository info (current repo or owner/repo)
gitee repo view
gitee repo view owner/repo --json

# Clone a repository using the saved token (origin is reset to a token-free URL afterwards)
gitee repo clone owner/repo
gitee repo clone owner/repo my-dir
# Pass extra args through to git after --
gitee repo clone owner/repo -- --depth 1 --branch dev

# View CI/CD status for the current branch
gitee ci status
gitee ci status --ref abc1234 --json

Run gitee <command> --help for the full flag list of any command.

Configuration

Default path: ~/.config/gitee-cli/config.yaml. The token is stored with 0600 permissions.

host: https://gitee.com/api/v5
token: <your-token>
user: <login>

The config directory can be overridden with the GITEE_CLI_CONFIG_DIR environment variable, which is handy for testing and custom deployments.

Testing

go test ./... -cover

API Docs

OpenAPI 3.0 specs live in docs/api/: user, pr, issue, repo, ci, browse, and api.

Claude / Multica Skill

The repository ships a skill guide for Claude / Multica agents covering all first-release commands with parameters, runnable examples, auth prerequisites, and common error handling:

  • .claude/skills/gitee-cli/SKILL.md

Contributing

Issues and pull requests are welcome. Please run go test ./... and gofmt before submitting, and reference the related issue in your commits. See CHANGELOG.md for the release history.

License

Licensed under the Apache License 2.0.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors