@oh-gc/cli 0.7.5 → 0.7.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/commands/auth/status.js +1 -1
- package/dist/commands/auth/status.js.map +1 -1
- package/dist/commands/branch/get.js +1 -1
- package/dist/commands/branch/get.js.map +1 -1
- package/dist/commands/branch/list.js +1 -1
- package/dist/commands/branch/list.js.map +1 -1
- package/dist/commands/branch/protect.js +1 -1
- package/dist/commands/branch/protect.js.map +1 -1
- package/dist/commands/collaborator/add.js +1 -1
- package/dist/commands/collaborator/add.js.map +1 -1
- package/dist/commands/collaborator/list.js +1 -1
- package/dist/commands/collaborator/list.js.map +1 -1
- package/dist/commands/collaborator/permission.js +1 -1
- package/dist/commands/collaborator/permission.js.map +1 -1
- package/dist/commands/collaborator/remove.js +1 -1
- package/dist/commands/collaborator/remove.js.map +1 -1
- package/dist/commands/commit/compare.js +1 -1
- package/dist/commands/commit/compare.js.map +1 -1
- package/dist/commands/commit/diff.js +1 -1
- package/dist/commands/commit/diff.js.map +1 -1
- package/dist/commands/commit/get.js +1 -1
- package/dist/commands/commit/get.js.map +1 -1
- package/dist/commands/commit/list.js +1 -1
- package/dist/commands/commit/list.js.map +1 -1
- package/dist/commands/file/get.js +1 -1
- package/dist/commands/file/get.js.map +1 -1
- package/dist/commands/file/list.js +1 -1
- package/dist/commands/file/list.js.map +1 -1
- package/dist/commands/file/raw.js +1 -1
- package/dist/commands/file/raw.js.map +1 -1
- package/dist/commands/hook/create.js +1 -1
- package/dist/commands/hook/create.js.map +1 -1
- package/dist/commands/hook/delete.js +1 -1
- package/dist/commands/hook/delete.js.map +1 -1
- package/dist/commands/hook/get.js +1 -1
- package/dist/commands/hook/get.js.map +1 -1
- package/dist/commands/hook/list.js +1 -1
- package/dist/commands/hook/list.js.map +1 -1
- package/dist/commands/issue/close.js +1 -1
- package/dist/commands/issue/comment.js +1 -1
- package/dist/commands/issue/comment.js.map +1 -1
- package/dist/commands/issue/history.js +1 -1
- package/dist/commands/issue/labels.js +2 -2
- package/dist/commands/issue/list.js +1 -1
- package/dist/commands/issue/list.js.map +1 -1
- package/dist/commands/issue/reactions.js +1 -1
- package/dist/commands/issue/reopen.js +1 -1
- package/dist/commands/issue/update.js +3 -3
- package/dist/commands/issue/view.js +1 -1
- package/dist/commands/issue/view.js.map +1 -1
- package/dist/commands/label/create.js +1 -1
- package/dist/commands/label/create.js.map +1 -1
- package/dist/commands/label/delete.js +1 -1
- package/dist/commands/label/delete.js.map +1 -1
- package/dist/commands/label/list.js +1 -1
- package/dist/commands/label/list.js.map +1 -1
- package/dist/commands/label/update.js +1 -1
- package/dist/commands/label/update.js.map +1 -1
- package/dist/commands/milestone/create.js +1 -1
- package/dist/commands/milestone/create.js.map +1 -1
- package/dist/commands/milestone/delete.js +1 -1
- package/dist/commands/milestone/delete.js.map +1 -1
- package/dist/commands/milestone/get.js +1 -1
- package/dist/commands/milestone/get.js.map +1 -1
- package/dist/commands/milestone/list.js +1 -1
- package/dist/commands/milestone/list.js.map +1 -1
- package/dist/commands/milestone/update.js +1 -1
- package/dist/commands/milestone/update.js.map +1 -1
- package/dist/commands/org/list.js +1 -1
- package/dist/commands/org/list.js.map +1 -1
- package/dist/commands/org/members.js +1 -1
- package/dist/commands/org/members.js.map +1 -1
- package/dist/commands/org/view.js +1 -1
- package/dist/commands/org/view.js.map +1 -1
- package/dist/commands/pr/close.js +1 -1
- package/dist/commands/pr/comment.js +3 -3
- package/dist/commands/pr/comments.js +1 -1
- package/dist/commands/pr/comments.js.map +1 -1
- package/dist/commands/pr/commits.js +1 -1
- package/dist/commands/pr/commits.js.map +1 -1
- package/dist/commands/pr/diff.js +1 -1
- package/dist/commands/pr/diff.js.map +1 -1
- package/dist/commands/pr/discussions.d.ts +19 -0
- package/dist/commands/pr/discussions.js +111 -0
- package/dist/commands/pr/discussions.js.map +1 -0
- package/dist/commands/pr/labels.js +4 -4
- package/dist/commands/pr/labels.js.map +1 -1
- package/dist/commands/pr/link.js +1 -1
- package/dist/commands/pr/link.js.map +1 -1
- package/dist/commands/pr/list.js +1 -1
- package/dist/commands/pr/list.js.map +1 -1
- package/dist/commands/pr/logs.js +1 -1
- package/dist/commands/pr/logs.js.map +1 -1
- package/dist/commands/pr/merge.js +1 -1
- package/dist/commands/pr/merge.js.map +1 -1
- package/dist/commands/pr/reactions.js +1 -1
- package/dist/commands/pr/reopen.js +1 -1
- package/dist/commands/pr/review.js +3 -3
- package/dist/commands/pr/review.js.map +1 -1
- package/dist/commands/pr/reviewers.js +6 -6
- package/dist/commands/pr/reviewers.js.map +1 -1
- package/dist/commands/pr/test.js +3 -3
- package/dist/commands/pr/test.js.map +1 -1
- package/dist/commands/pr/testers.js +6 -6
- package/dist/commands/pr/testers.js.map +1 -1
- package/dist/commands/pr/update.js +1 -1
- package/dist/commands/pr/update.js.map +1 -1
- package/dist/commands/pr/view.js +1 -1
- package/dist/commands/pr/view.js.map +1 -1
- package/dist/commands/release/create.js +1 -1
- package/dist/commands/release/create.js.map +1 -1
- package/dist/commands/repo/archive.js +1 -1
- package/dist/commands/repo/archive.js.map +1 -1
- package/dist/commands/repo/contributors.js +1 -1
- package/dist/commands/repo/contributors.js.map +1 -1
- package/dist/commands/repo/create.js +1 -1
- package/dist/commands/repo/create.js.map +1 -1
- package/dist/commands/repo/delete.js +1 -1
- package/dist/commands/repo/delete.js.map +1 -1
- package/dist/commands/repo/events.js +1 -1
- package/dist/commands/repo/events.js.map +1 -1
- package/dist/commands/repo/fork.js +1 -1
- package/dist/commands/repo/fork.js.map +1 -1
- package/dist/commands/repo/forks.js +1 -1
- package/dist/commands/repo/forks.js.map +1 -1
- package/dist/commands/repo/get-remote.js +1 -1
- package/dist/commands/repo/get-remote.js.map +1 -1
- package/dist/commands/repo/languages.js +1 -1
- package/dist/commands/repo/languages.js.map +1 -1
- package/dist/commands/repo/list.js +1 -1
- package/dist/commands/repo/list.js.map +1 -1
- package/dist/commands/repo/module.js +1 -1
- package/dist/commands/repo/module.js.map +1 -1
- package/dist/commands/repo/roles.js +1 -1
- package/dist/commands/repo/roles.js.map +1 -1
- package/dist/commands/repo/set-remote.js +1 -1
- package/dist/commands/repo/set-remote.js.map +1 -1
- package/dist/commands/repo/settings.js +1 -1
- package/dist/commands/repo/settings.js.map +1 -1
- package/dist/commands/repo/stats.js +1 -1
- package/dist/commands/repo/stats.js.map +1 -1
- package/dist/commands/repo/transfer.js +1 -1
- package/dist/commands/repo/transfer.js.map +1 -1
- package/dist/commands/repo/transition.js +1 -1
- package/dist/commands/repo/transition.js.map +1 -1
- package/dist/commands/repo/update.js +1 -1
- package/dist/commands/repo/update.js.map +1 -1
- package/dist/commands/repo/view.js +1 -1
- package/dist/commands/repo/view.js.map +1 -1
- package/dist/commands/search/code.js +1 -1
- package/dist/commands/search/code.js.map +1 -1
- package/dist/commands/search/issues.js +1 -1
- package/dist/commands/search/issues.js.map +1 -1
- package/dist/commands/search/repos.js +1 -1
- package/dist/commands/search/repos.js.map +1 -1
- package/dist/commands/tag/list.js +1 -1
- package/dist/commands/tag/list.js.map +1 -1
- package/dist/commands/tag/protect.js +1 -1
- package/dist/commands/tag/protect.js.map +1 -1
- package/dist/commands/user/edit.js +2 -2
- package/dist/commands/user/emails.js +1 -1
- package/dist/commands/user/events.d.ts +1 -1
- package/dist/commands/user/events.js +3 -7
- package/dist/commands/user/events.js.map +1 -1
- package/dist/commands/user/followers.js +2 -2
- package/dist/commands/user/following.js +2 -2
- package/dist/commands/user/issues.js +3 -3
- package/dist/commands/user/key-add.js +1 -1
- package/dist/commands/user/key-delete.js +1 -1
- package/dist/commands/user/keys.js +1 -1
- package/dist/commands/user/leave-org.js +1 -1
- package/dist/commands/user/membership.js +1 -1
- package/dist/commands/user/namespace.js +2 -2
- package/dist/commands/user/namespaces.js +2 -2
- package/dist/commands/user/orgs.js +1 -1
- package/dist/commands/user/prs.js +3 -3
- package/dist/commands/user/search.js +2 -2
- package/dist/commands/user/starred.js +3 -3
- package/dist/commands/user/subscriptions.js +3 -3
- package/dist/commands/user/view.js +2 -2
- package/package.json +6 -4
- package/skills/gitcode-cli/INSTALL.md +112 -0
- package/skills/gitcode-cli/SKILL.md +152 -0
- package/skills/gitcode-cli/agents/openai.yaml +7 -0
- package/skills/gitcode-cli/references/commands.md +382 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# Installing the gitcode-cli Skill
|
|
2
|
+
|
|
3
|
+
This document tells AI assistants how to install the `gitcode-cli` skill for Claude Code and Codex so it is available across projects and sessions.
|
|
4
|
+
|
|
5
|
+
## Detect the User's AI Tool
|
|
6
|
+
|
|
7
|
+
Check which tool the user is running and install accordingly:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
which claude >/dev/null 2>&1 && echo "CLAUDE_CODE"
|
|
11
|
+
which codex >/dev/null 2>&1 && echo "CODEX"
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Install for Claude Code
|
|
15
|
+
|
|
16
|
+
Claude Code supports plugin marketplaces. The oh-gc CLI repository provides a marketplace for one-command installation:
|
|
17
|
+
|
|
18
|
+
```text
|
|
19
|
+
/plugin marketplace add https://gitcode.com/guozejun/ohos_gitcode_cli.git
|
|
20
|
+
/plugin install gitcode-cli@oh-gc
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
The Claude plugin reads `skills/gitcode-cli/SKILL.md` from this repository. The Codex-only `skills/gitcode-cli/agents/openai.yaml` file can remain present; Claude ignores it.
|
|
24
|
+
|
|
25
|
+
For a manual Claude Code install from a checkout of this repository:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
mkdir -p "$HOME/.claude/skills/gitcode-cli"
|
|
29
|
+
mkdir -p "$HOME/.claude/skills/gitcode-cli/references"
|
|
30
|
+
cp skills/gitcode-cli/SKILL.md "$HOME/.claude/skills/gitcode-cli/SKILL.md"
|
|
31
|
+
cp skills/gitcode-cli/references/commands.md "$HOME/.claude/skills/gitcode-cli/references/commands.md"
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Install for Codex
|
|
35
|
+
|
|
36
|
+
Codex loads user skills from `$CODEX_HOME/skills`; when `CODEX_HOME` is not set, use `~/.codex/skills`. Install both `SKILL.md` and the Codex metadata under `agents/`.
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
# From a checkout of this repository
|
|
40
|
+
mkdir -p "${CODEX_HOME:-$HOME/.codex}/skills/gitcode-cli"
|
|
41
|
+
mkdir -p "${CODEX_HOME:-$HOME/.codex}/skills/gitcode-cli/agents"
|
|
42
|
+
mkdir -p "${CODEX_HOME:-$HOME/.codex}/skills/gitcode-cli/references"
|
|
43
|
+
cp skills/gitcode-cli/SKILL.md "${CODEX_HOME:-$HOME/.codex}/skills/gitcode-cli/SKILL.md"
|
|
44
|
+
cp skills/gitcode-cli/agents/openai.yaml "${CODEX_HOME:-$HOME/.codex}/skills/gitcode-cli/agents/openai.yaml"
|
|
45
|
+
cp skills/gitcode-cli/references/commands.md "${CODEX_HOME:-$HOME/.codex}/skills/gitcode-cli/references/commands.md"
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Start a new Codex session for the skill metadata to be discovered.
|
|
49
|
+
|
|
50
|
+
## Install from npm
|
|
51
|
+
|
|
52
|
+
If `oh-gc` was installed with npm and the package includes the skill files:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
SKILL_SRC="$(npm root -g)/@oh-gc/cli/skills/gitcode-cli"
|
|
56
|
+
|
|
57
|
+
# Codex
|
|
58
|
+
mkdir -p "${CODEX_HOME:-$HOME/.codex}/skills/gitcode-cli"
|
|
59
|
+
mkdir -p "${CODEX_HOME:-$HOME/.codex}/skills/gitcode-cli/agents"
|
|
60
|
+
mkdir -p "${CODEX_HOME:-$HOME/.codex}/skills/gitcode-cli/references"
|
|
61
|
+
cp "$SKILL_SRC/SKILL.md" "${CODEX_HOME:-$HOME/.codex}/skills/gitcode-cli/SKILL.md"
|
|
62
|
+
cp "$SKILL_SRC/agents/openai.yaml" "${CODEX_HOME:-$HOME/.codex}/skills/gitcode-cli/agents/openai.yaml"
|
|
63
|
+
cp "$SKILL_SRC/references/commands.md" "${CODEX_HOME:-$HOME/.codex}/skills/gitcode-cli/references/commands.md"
|
|
64
|
+
|
|
65
|
+
# Claude Code manual install
|
|
66
|
+
mkdir -p "$HOME/.claude/skills/gitcode-cli"
|
|
67
|
+
mkdir -p "$HOME/.claude/skills/gitcode-cli/references"
|
|
68
|
+
cp "$SKILL_SRC/SKILL.md" "$HOME/.claude/skills/gitcode-cli/SKILL.md"
|
|
69
|
+
cp "$SKILL_SRC/references/commands.md" "$HOME/.claude/skills/gitcode-cli/references/commands.md"
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Optional OpenCode Install
|
|
73
|
+
|
|
74
|
+
OpenCode can consume the same `SKILL.md` by referencing it from `opencode.json`. Copy `references/commands.md` next to `SKILL.md` if you want the full command catalog available.
|
|
75
|
+
|
|
76
|
+
```json
|
|
77
|
+
{
|
|
78
|
+
"instructions": ["~/.config/opencode/skills/gitcode-cli/SKILL.md"]
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Uninstall
|
|
83
|
+
|
|
84
|
+
Claude Code marketplace:
|
|
85
|
+
|
|
86
|
+
```text
|
|
87
|
+
# Claude Code marketplace
|
|
88
|
+
/plugin uninstall gitcode-cli
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Manual installs:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
rm -rf "$HOME/.claude/skills/gitcode-cli"
|
|
95
|
+
rm -rf "${CODEX_HOME:-$HOME/.codex}/skills/gitcode-cli"
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Verification
|
|
99
|
+
|
|
100
|
+
After installation, start a new session and ask:
|
|
101
|
+
|
|
102
|
+
```text
|
|
103
|
+
What oh-gc PR commands are available?
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
In Codex, explicit invocation should also work:
|
|
107
|
+
|
|
108
|
+
```text
|
|
109
|
+
Use $gitcode-cli to show available oh-gc PR commands.
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
If the skill is loaded, the assistant should answer from the `oh-gc` command reference without needing to inspect this repository.
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: gitcode-cli
|
|
3
|
+
description: Use when managing GitCode repositories from the terminal with the oh-gc CLI, including auth, issues, PRs, reviewers, testers, labels, releases, repository settings, and GitCode URLs. Trigger when a user asks to run, choose, script, or troubleshoot oh-gc commands or interact with GitCode without a browser.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# oh-gc CLI - GitCode Command Line Tool
|
|
7
|
+
|
|
8
|
+
**Version:** 0.7.7 | **Updated:** 2026-05-27
|
|
9
|
+
|
|
10
|
+
`oh-gc` is a CLI for [GitCode](https://gitcode.com), modeled after GitHub CLI (`gh`). It manages authentication, issues, pull requests, releases, repository settings, and repository content from the terminal.
|
|
11
|
+
|
|
12
|
+
**Package:** `npm install -g @oh-gc/cli` (requires Node.js 18+)
|
|
13
|
+
|
|
14
|
+
For exact command flags and examples, read [references/commands.md](references/commands.md). If that file is unavailable, use `oh-gc <topic> <command> --help`.
|
|
15
|
+
|
|
16
|
+
## Operating Rules
|
|
17
|
+
|
|
18
|
+
- Before executing the first `oh-gc` command in a session, run `oh-gc --version`.
|
|
19
|
+
- If `oh-gc` is missing or is not version `0.7.6`, install `npm install -g @oh-gc/cli@0.7.6` before using other `oh-gc` commands.
|
|
20
|
+
- Follow the host tool's approval model for installation, login, publishing, network access, or any other restricted action.
|
|
21
|
+
- Prefer `--json` for scripting and parse it with a structured parser such as `jq` when available.
|
|
22
|
+
- Use `--repo owner/repo` when the current directory is not the target repository or when working across repositories.
|
|
23
|
+
- Do not guess GitCode PR URLs: use `https://gitcode.com/{owner}/{repo}/pull/{number}` with singular `pull`.
|
|
24
|
+
|
|
25
|
+
## State-Changing Commands
|
|
26
|
+
|
|
27
|
+
Read-only commands can be run when they answer the user's request. For commands that mutate GitCode or git state, make sure the user explicitly requested the action and the target repository is unambiguous.
|
|
28
|
+
|
|
29
|
+
State-changing actions include:
|
|
30
|
+
|
|
31
|
+
- Creating, updating, closing, reopening, merging, approving, testing, assigning, labeling, linking, or deleting issues/PRs/comments.
|
|
32
|
+
- Creating, updating, deleting, protecting, archiving, transferring, or changing settings for repos, branches, tags, files, collaborators, labels, milestones, hooks, SSH keys, modules, or permission modes.
|
|
33
|
+
- Running `oh-gc release create`, which can run tests/builds, create commits/tags, push to git, create a GitCode release, and upload assets.
|
|
34
|
+
|
|
35
|
+
For high-impact actions such as `repo delete`, `repo archive`, `repo transfer`, `release create`, `pr merge`, `branch delete`, `tag delete`, `file delete`, and forced review/test approval, restate the target and proceed only when the user's request is explicit.
|
|
36
|
+
|
|
37
|
+
## Mandatory Preflight
|
|
38
|
+
|
|
39
|
+
1. Version: `oh-gc --version`
|
|
40
|
+
2. Auth: `oh-gc auth status`
|
|
41
|
+
- If not logged in: `oh-gc auth login`
|
|
42
|
+
- Token source: GitCode -> 个人设置 -> 访问令牌
|
|
43
|
+
3. Repository context:
|
|
44
|
+
- Inside a git repo with a `gitcode.com` remote, or
|
|
45
|
+
- Pass `--repo owner/repo`
|
|
46
|
+
|
|
47
|
+
Most repository commands support:
|
|
48
|
+
|
|
49
|
+
- `--repo owner/repo` - target repository in OWNER/REPO format
|
|
50
|
+
- `--json` - raw JSON output
|
|
51
|
+
- `--help` - command help
|
|
52
|
+
|
|
53
|
+
Remote override is stored at `.gitcode/oh-gc-config.json` and managed by `oh-gc repo set-remote <name>` / `oh-gc repo get-remote`.
|
|
54
|
+
|
|
55
|
+
## PR Template Rule
|
|
56
|
+
|
|
57
|
+
`oh-gc pr create` does **not** automatically read `.gitcode/PULL_REQUEST_TEMPLATE.md`. Agents must handle templates explicitly.
|
|
58
|
+
|
|
59
|
+
Before creating a PR:
|
|
60
|
+
|
|
61
|
+
1. Determine the target repository and base branch.
|
|
62
|
+
2. Check for a template in the target repository:
|
|
63
|
+
- Local target repo: `test -f .gitcode/PULL_REQUEST_TEMPLATE.md && cat .gitcode/PULL_REQUEST_TEMPLATE.md`
|
|
64
|
+
- Remote/cross-repo target: `oh-gc file raw .gitcode/PULL_REQUEST_TEMPLATE.md <base-branch> --repo owner/repo`
|
|
65
|
+
- If the template lookup returns "not found", proceed without a template.
|
|
66
|
+
3. If a template exists, build the PR body around its sections and fill them in.
|
|
67
|
+
4. For non-interactive automation, pass the filled body with `--body`. Otherwise, create the PR and immediately run `oh-gc pr update <number> --body "<filled template>"`.
|
|
68
|
+
5. Do not replace the template with a free-form body unless the user explicitly requests that.
|
|
69
|
+
|
|
70
|
+
For fork-to-upstream PRs, `--repo` targets the upstream repo and `--head` must use `owner:branch` format, not `owner/branch`.
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
oh-gc pr create --repo upstream-owner/repo --head myname:my-feature --base main --title "Fix bug" --body "<filled template>"
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Common Workflows
|
|
77
|
+
|
|
78
|
+
### Issue Triage
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
oh-gc issue list --search "crash"
|
|
82
|
+
oh-gc issue view 15
|
|
83
|
+
oh-gc issue comment 15 --body "Investigating, likely related to #12"
|
|
84
|
+
oh-gc issue update 15 --labels "bug,P0" --assignee bob
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### PR Review
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
oh-gc pr view 42 --json
|
|
91
|
+
oh-gc pr diff 42
|
|
92
|
+
oh-gc pr comments 42 --latest
|
|
93
|
+
oh-gc pr comment 42 --body "Please update the tests."
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Only approve, mark tests passed, or merge when explicitly requested:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
oh-gc pr review 42
|
|
100
|
+
oh-gc pr test 42
|
|
101
|
+
oh-gc pr merge 42 --method squash
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Cross-Repo PR
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
oh-gc pr create --repo upstream-owner/repo --head myname:my-feature --base master --title "Fix bug" --body "<filled template or summary>"
|
|
108
|
+
oh-gc pr view 42 --repo upstream-owner/repo --json
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Command Selection
|
|
112
|
+
|
|
113
|
+
Read [references/commands.md](references/commands.md) for the full command catalog. This map is for choosing the command family quickly:
|
|
114
|
+
|
|
115
|
+
- Auth: `oh-gc auth login/status/logout`
|
|
116
|
+
- Issues: `oh-gc issue list/view/create/update/comment/close/reopen/labels/history/reactions/prs/branches`
|
|
117
|
+
- PRs: `oh-gc pr list/view/create/update/close/reopen/diff/comment/comments/discussions/reviewers/testers/review/test/labels/link/merge/files/history/logs`
|
|
118
|
+
- Repos: `oh-gc repo list/view/create/update/delete/fork/forks/settings/languages/contributors/events/stats/archive/transition/module/roles/transfer`
|
|
119
|
+
- Users: `oh-gc user view/edit/emails/followers/following/events/search/keys/starred/subscriptions/issues/prs/orgs`
|
|
120
|
+
- Branches/tags: `oh-gc branch ...`, `oh-gc tag ...`
|
|
121
|
+
- Contents: `oh-gc file get/raw/list/create/update/delete`, `oh-gc commit ...`
|
|
122
|
+
- Admin objects: `oh-gc collaborator ...`, `oh-gc label ...`, `oh-gc milestone ...`, `oh-gc hook ...`, `oh-gc org ...`
|
|
123
|
+
- Search/release: `oh-gc search repos/issues/code`, `oh-gc release create`
|
|
124
|
+
|
|
125
|
+
## Configuration
|
|
126
|
+
|
|
127
|
+
| Setting | Location | How to set |
|
|
128
|
+
|---------|----------|------------|
|
|
129
|
+
| Auth token | `~/.config/gitcode-cli/config.json` | `oh-gc auth login` |
|
|
130
|
+
| Remote override | `.gitcode/oh-gc-config.json` | `oh-gc repo set-remote <name>` |
|
|
131
|
+
| Proxy | `https_proxy` / `HTTPS_PROXY` env var | Automatic |
|
|
132
|
+
|
|
133
|
+
## Error Handling
|
|
134
|
+
|
|
135
|
+
| Error | Cause | Fix |
|
|
136
|
+
|-------|-------|-----|
|
|
137
|
+
| "Not logged in" | No token configured | `oh-gc auth login` |
|
|
138
|
+
| "Authentication failed" | Token expired or invalid | Re-run `oh-gc auth login` with a new token |
|
|
139
|
+
| "Remote not found" | Not in a git repo or remote missing | `cd` to repo, check `git remote -v`, or pass `--repo owner/repo` |
|
|
140
|
+
| "Not a GitCode repository" | Remote URL is not `gitcode.com` | Add a GitCode remote or pass `--repo owner/repo` |
|
|
141
|
+
| "Could not connect" | Network/proxy issue | Check network; set `https_proxy` / `HTTPS_PROXY` if needed |
|
|
142
|
+
| "Rate limit exceeded" | Too many API calls | Wait and retry |
|
|
143
|
+
| "Can not find the branch" | Cross-repo PR `--head` lacks fork owner | Use `--head owner:branch` |
|
|
144
|
+
| PR body missing template fields | Template was skipped or replaced | Read the template and update the PR body with filled sections |
|
|
145
|
+
|
|
146
|
+
## Tips
|
|
147
|
+
|
|
148
|
+
- `oh-gc file raw <path> <ref>` prints decoded content; `oh-gc file get <path> --ref <ref>` prints metadata plus base64 content.
|
|
149
|
+
- `oh-gc pr comments --comment-type diff_comment` filters to code review comments.
|
|
150
|
+
- `oh-gc pr reviewers --append` adds reviewers without replacing existing reviewers.
|
|
151
|
+
- `oh-gc pr update --state closed` closes a PR without merging.
|
|
152
|
+
- When reporting PR links, always use `https://gitcode.com/{owner}/{repo}/pull/{number}`.
|
|
@@ -0,0 +1,382 @@
|
|
|
1
|
+
# oh-gc Command Reference
|
|
2
|
+
|
|
3
|
+
Use this reference for exact `oh-gc` command names, common flags, and examples.
|
|
4
|
+
|
|
5
|
+
## Authentication
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
oh-gc auth login # Log in with personal access token
|
|
9
|
+
oh-gc auth logout # Remove stored token
|
|
10
|
+
oh-gc auth status # Show current user info
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Token is stored at `~/.config/gitcode-cli/config.json`.
|
|
14
|
+
|
|
15
|
+
## Repository Flag
|
|
16
|
+
|
|
17
|
+
Most repository commands support:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
oh-gc issue list --repo openharmony/arkui_ace_engine
|
|
21
|
+
oh-gc issue create --repo owner/repo --title "Bug report"
|
|
22
|
+
oh-gc pr view 123 --repo owner/repo
|
|
23
|
+
oh-gc pr create --repo upstream-owner/repo --head myname:my-feature --base main
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Issues
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
# List and view
|
|
30
|
+
oh-gc issue list
|
|
31
|
+
oh-gc issue list --state closed
|
|
32
|
+
oh-gc issue list --state all
|
|
33
|
+
oh-gc issue list --assignee alice
|
|
34
|
+
oh-gc issue list --search "login bug"
|
|
35
|
+
oh-gc issue list --limit 50
|
|
36
|
+
oh-gc issue view 12
|
|
37
|
+
|
|
38
|
+
# Create
|
|
39
|
+
oh-gc issue create
|
|
40
|
+
oh-gc issue create --title "Bug" --body "..."
|
|
41
|
+
oh-gc issue create --repo owner/repo --title "Bug"
|
|
42
|
+
oh-gc issue create --assignee alice --labels "bug,P0"
|
|
43
|
+
|
|
44
|
+
# Update
|
|
45
|
+
oh-gc issue update 12 --title "New title"
|
|
46
|
+
oh-gc issue update 12 --body "New body"
|
|
47
|
+
oh-gc issue update 12 --state closed
|
|
48
|
+
oh-gc issue update 12 --state open
|
|
49
|
+
oh-gc issue update 12 --labels "bug,urgent" --assignee bob
|
|
50
|
+
|
|
51
|
+
# Comment
|
|
52
|
+
oh-gc issue comment 12
|
|
53
|
+
oh-gc issue comment 12 --body "Confirmed"
|
|
54
|
+
|
|
55
|
+
# Close/reopen
|
|
56
|
+
oh-gc issue close 12
|
|
57
|
+
oh-gc issue reopen 12
|
|
58
|
+
|
|
59
|
+
# Labels
|
|
60
|
+
oh-gc issue labels 12 bug,feature
|
|
61
|
+
oh-gc issue labels 12 bug --remove
|
|
62
|
+
|
|
63
|
+
# History, reactions, related objects
|
|
64
|
+
oh-gc issue history 12
|
|
65
|
+
oh-gc issue reactions 12
|
|
66
|
+
oh-gc issue prs 12
|
|
67
|
+
oh-gc issue prs 12 --mode 1
|
|
68
|
+
oh-gc issue branches 12
|
|
69
|
+
oh-gc issue branches 12 --set feature-x,fix-y
|
|
70
|
+
|
|
71
|
+
# Comment management
|
|
72
|
+
oh-gc issue comment-get <id>
|
|
73
|
+
oh-gc issue comment-edit <id> --body "new"
|
|
74
|
+
oh-gc issue comment-delete <id>
|
|
75
|
+
oh-gc issue comment-history <id>
|
|
76
|
+
oh-gc issue comment-reactions <id>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Pull Requests
|
|
80
|
+
|
|
81
|
+
Before creating a PR, read the PR template rule in `SKILL.md`. `oh-gc pr create` does not automatically load `.gitcode/PULL_REQUEST_TEMPLATE.md`.
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
# List and view
|
|
85
|
+
oh-gc pr list
|
|
86
|
+
oh-gc pr list --state merged
|
|
87
|
+
oh-gc pr list --state all
|
|
88
|
+
oh-gc pr list --author alice
|
|
89
|
+
oh-gc pr list --reviewer bob
|
|
90
|
+
oh-gc pr list --assignee carol
|
|
91
|
+
oh-gc pr list --limit 50
|
|
92
|
+
oh-gc pr view 5
|
|
93
|
+
|
|
94
|
+
# Create
|
|
95
|
+
oh-gc pr create
|
|
96
|
+
oh-gc pr create --title "Fix bug" --base main --body "<filled template or summary>"
|
|
97
|
+
oh-gc pr create --head feature --base main --draft --body "<body>"
|
|
98
|
+
oh-gc pr create --repo owner/repo --head myname:feature --base main --body "<body>"
|
|
99
|
+
|
|
100
|
+
# Update
|
|
101
|
+
oh-gc pr update 5 --title "New title"
|
|
102
|
+
oh-gc pr update 5 --body "New description"
|
|
103
|
+
oh-gc pr update 5 --state closed
|
|
104
|
+
oh-gc pr update 5 --state open
|
|
105
|
+
oh-gc pr update 5 --draft
|
|
106
|
+
oh-gc pr update 5 --labels "bug,wip"
|
|
107
|
+
|
|
108
|
+
# Close/reopen
|
|
109
|
+
oh-gc pr close 5
|
|
110
|
+
oh-gc pr reopen 5
|
|
111
|
+
|
|
112
|
+
# Diff
|
|
113
|
+
oh-gc pr diff 5
|
|
114
|
+
oh-gc pr diff 5 --name-only
|
|
115
|
+
oh-gc pr diff 5 --color never
|
|
116
|
+
|
|
117
|
+
# Merge
|
|
118
|
+
oh-gc pr merge 5
|
|
119
|
+
oh-gc pr merge 5 --method squash
|
|
120
|
+
oh-gc pr merge 5 --method rebase
|
|
121
|
+
|
|
122
|
+
# Comment
|
|
123
|
+
oh-gc pr comment 5 --body "LGTM!"
|
|
124
|
+
oh-gc pr comment 5 --body "Fix this" --path src/main.ts --line 10
|
|
125
|
+
oh-gc pr comment 5 --repo owner/repo --body "Note"
|
|
126
|
+
oh-gc pr comment-reply 5 --comment-id 456 --body "Thanks, fixed"
|
|
127
|
+
oh-gc pr comment-reply 5 --discussion-id abc123 --body "Addressed"
|
|
128
|
+
|
|
129
|
+
# List/delete comments
|
|
130
|
+
oh-gc pr comments 5
|
|
131
|
+
oh-gc pr comments 5 --limit 10 --latest
|
|
132
|
+
oh-gc pr comments 5 --full-body
|
|
133
|
+
oh-gc pr comments 5 --comment-type diff_comment
|
|
134
|
+
oh-gc pr comments 5 --comment-type pr_comment
|
|
135
|
+
oh-gc pr comments 5 --delete 12345
|
|
136
|
+
|
|
137
|
+
# Reactions, commits, files, history
|
|
138
|
+
oh-gc pr reactions 5
|
|
139
|
+
oh-gc pr commits 5
|
|
140
|
+
oh-gc pr files 5
|
|
141
|
+
oh-gc pr history 5
|
|
142
|
+
oh-gc pr logs 5
|
|
143
|
+
oh-gc pr linked-issues 5
|
|
144
|
+
|
|
145
|
+
# Reviewers/testers/approval
|
|
146
|
+
oh-gc pr reviewers 5 alice,bob
|
|
147
|
+
oh-gc pr reviewers 5 alice --append
|
|
148
|
+
oh-gc pr reviewers 5 alice --remove
|
|
149
|
+
oh-gc pr testers 5 alice,bob
|
|
150
|
+
oh-gc pr testers 5 alice --append
|
|
151
|
+
oh-gc pr testers 5 alice --remove
|
|
152
|
+
oh-gc pr review 5
|
|
153
|
+
oh-gc pr review 5 --force
|
|
154
|
+
oh-gc pr test 5
|
|
155
|
+
oh-gc pr test 5 --force
|
|
156
|
+
|
|
157
|
+
# Labels, links, assignees
|
|
158
|
+
oh-gc pr labels 5 bug,enhancement
|
|
159
|
+
oh-gc pr labels 5 bug --remove
|
|
160
|
+
oh-gc pr labels 5 bug,feature --replace
|
|
161
|
+
oh-gc pr link 5 1,2,3
|
|
162
|
+
oh-gc pr link 5 1,2 --remove
|
|
163
|
+
oh-gc pr assignees 5 --add alice,bob
|
|
164
|
+
oh-gc pr assignees 5 --reset
|
|
165
|
+
oh-gc pr assignees 5 --reset --all
|
|
166
|
+
oh-gc pr assignees 5 --remove alice
|
|
167
|
+
|
|
168
|
+
# Settings and option reviewers
|
|
169
|
+
oh-gc pr settings
|
|
170
|
+
oh-gc pr settings-update --merge-method squash --delete-branch-on-merge
|
|
171
|
+
oh-gc pr option-reviewers 5
|
|
172
|
+
|
|
173
|
+
# Comment management
|
|
174
|
+
oh-gc pr comment-get <id>
|
|
175
|
+
oh-gc pr comment-edit <id> --body "new"
|
|
176
|
+
oh-gc pr comment-delete <id>
|
|
177
|
+
oh-gc pr comment-history <id>
|
|
178
|
+
oh-gc pr comment-reactions <id>
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## Releases
|
|
182
|
+
|
|
183
|
+
`oh-gc release create` is high-impact: it can run tests/builds, create commits/tags, push to git, create the GitCode release, and upload assets.
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
oh-gc release create
|
|
187
|
+
oh-gc release create v1.0.0
|
|
188
|
+
oh-gc release create --prerelease
|
|
189
|
+
oh-gc release create v1.0.0 --notes "..."
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
## Repositories
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
# List, view, create, update
|
|
196
|
+
oh-gc repo list
|
|
197
|
+
oh-gc repo list --org myorg
|
|
198
|
+
oh-gc repo list --user alice
|
|
199
|
+
oh-gc repo list --visibility private
|
|
200
|
+
oh-gc repo view
|
|
201
|
+
oh-gc repo create myrepo
|
|
202
|
+
oh-gc repo create myrepo --org myorg
|
|
203
|
+
oh-gc repo update --description "..."
|
|
204
|
+
|
|
205
|
+
# High-impact repo operations
|
|
206
|
+
oh-gc repo delete --repo owner/repo --yes
|
|
207
|
+
oh-gc repo transfer <new-owner>
|
|
208
|
+
oh-gc repo archive --password secret
|
|
209
|
+
oh-gc repo archive --open --password secret
|
|
210
|
+
|
|
211
|
+
# Forks and metadata
|
|
212
|
+
oh-gc repo fork
|
|
213
|
+
oh-gc repo fork --org myorg
|
|
214
|
+
oh-gc repo forks
|
|
215
|
+
oh-gc repo languages
|
|
216
|
+
oh-gc repo contributors
|
|
217
|
+
oh-gc repo contributors --stats
|
|
218
|
+
oh-gc repo events
|
|
219
|
+
oh-gc repo events --filter push
|
|
220
|
+
oh-gc repo stats --branch main
|
|
221
|
+
oh-gc repo stats --downloads
|
|
222
|
+
|
|
223
|
+
# Settings and modules
|
|
224
|
+
oh-gc repo settings
|
|
225
|
+
oh-gc repo settings --disable-fork
|
|
226
|
+
oh-gc repo settings --open-gpg --lfs
|
|
227
|
+
oh-gc repo transition
|
|
228
|
+
oh-gc repo transition --mode 2
|
|
229
|
+
oh-gc repo module --wiki --issues
|
|
230
|
+
oh-gc repo module --no-fork
|
|
231
|
+
oh-gc repo roles
|
|
232
|
+
|
|
233
|
+
# Remote config
|
|
234
|
+
oh-gc repo get-remote
|
|
235
|
+
oh-gc repo set-remote upstream
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
Remote override is stored at `.gitcode/oh-gc-config.json`.
|
|
239
|
+
|
|
240
|
+
## Search
|
|
241
|
+
|
|
242
|
+
```bash
|
|
243
|
+
oh-gc search repos "keyword"
|
|
244
|
+
oh-gc search issues "keyword"
|
|
245
|
+
oh-gc search code "keyword"
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
## Users
|
|
249
|
+
|
|
250
|
+
```bash
|
|
251
|
+
oh-gc user view
|
|
252
|
+
oh-gc user view alice
|
|
253
|
+
oh-gc user edit --name "New Name" --bio "..."
|
|
254
|
+
oh-gc user edit --avatar "https://..."
|
|
255
|
+
oh-gc user emails
|
|
256
|
+
oh-gc user followers
|
|
257
|
+
oh-gc user following
|
|
258
|
+
oh-gc user events alice
|
|
259
|
+
oh-gc user events alice --year 2024
|
|
260
|
+
oh-gc user search alice
|
|
261
|
+
oh-gc user search bob --sort joined_at
|
|
262
|
+
oh-gc user namespace alice
|
|
263
|
+
oh-gc user namespaces
|
|
264
|
+
oh-gc user namespaces --mode project
|
|
265
|
+
oh-gc user keys
|
|
266
|
+
oh-gc user key-add --title "My Key" --key "ssh-rsa ..."
|
|
267
|
+
oh-gc user key-delete 123
|
|
268
|
+
oh-gc user starred
|
|
269
|
+
oh-gc user starred alice
|
|
270
|
+
oh-gc user subscriptions
|
|
271
|
+
oh-gc user subscriptions alice
|
|
272
|
+
oh-gc user issues
|
|
273
|
+
oh-gc user issues --state closed --filter created
|
|
274
|
+
oh-gc user issues --since "2024-01-01T00:00:00Z"
|
|
275
|
+
oh-gc user prs
|
|
276
|
+
oh-gc user prs --state merged --scope assigned_to_me
|
|
277
|
+
oh-gc user prs --source-branch feature --target-branch main
|
|
278
|
+
oh-gc user orgs alice
|
|
279
|
+
oh-gc user membership myorg
|
|
280
|
+
oh-gc user leave-org myorg
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
## Branches
|
|
284
|
+
|
|
285
|
+
```bash
|
|
286
|
+
oh-gc branch list
|
|
287
|
+
oh-gc branch list --protected
|
|
288
|
+
oh-gc branch get <name>
|
|
289
|
+
oh-gc branch create <name> --ref <sha/branch>
|
|
290
|
+
oh-gc branch delete <name>
|
|
291
|
+
oh-gc branch protect <name>
|
|
292
|
+
oh-gc branch protect <name> --enforce-admins
|
|
293
|
+
oh-gc branch protect <name> --require-status-checks ci,lint
|
|
294
|
+
oh-gc branch protect <name> --dismiss-stale-reviews
|
|
295
|
+
oh-gc branch protect <name> --unprotect
|
|
296
|
+
oh-gc branch protect-rules
|
|
297
|
+
oh-gc branch protect-rule-create <pattern> --pusher <roles> --merger <roles>
|
|
298
|
+
oh-gc branch protect-rule-update <pattern> --pusher <roles> --merger <roles>
|
|
299
|
+
oh-gc branch protect-rule-delete <pattern>
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
## Commits
|
|
303
|
+
|
|
304
|
+
```bash
|
|
305
|
+
oh-gc commit list
|
|
306
|
+
oh-gc commit list --sha main
|
|
307
|
+
oh-gc commit get <sha>
|
|
308
|
+
oh-gc commit diff <sha>
|
|
309
|
+
oh-gc commit compare <base> <head>
|
|
310
|
+
oh-gc commit comments <sha>
|
|
311
|
+
oh-gc commit comment <sha> --body "text"
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
## Files
|
|
315
|
+
|
|
316
|
+
```bash
|
|
317
|
+
oh-gc file get <path>
|
|
318
|
+
oh-gc file get <path> --ref main
|
|
319
|
+
oh-gc file raw <path> main
|
|
320
|
+
oh-gc file list
|
|
321
|
+
oh-gc file create <path> --content "text" --message "msg"
|
|
322
|
+
oh-gc file update <path> --sha <sha> --content "text" --message "msg"
|
|
323
|
+
oh-gc file delete <path> --sha <sha> --message "msg"
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
## Collaborators
|
|
327
|
+
|
|
328
|
+
```bash
|
|
329
|
+
oh-gc collaborator list
|
|
330
|
+
oh-gc collaborator add <username>
|
|
331
|
+
oh-gc collaborator remove <username>
|
|
332
|
+
oh-gc collaborator permission <username>
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
## Labels
|
|
336
|
+
|
|
337
|
+
```bash
|
|
338
|
+
oh-gc label list
|
|
339
|
+
oh-gc label create
|
|
340
|
+
oh-gc label update <name>
|
|
341
|
+
oh-gc label delete <name>
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
## Milestones
|
|
345
|
+
|
|
346
|
+
```bash
|
|
347
|
+
oh-gc milestone list
|
|
348
|
+
oh-gc milestone get <number>
|
|
349
|
+
oh-gc milestone create
|
|
350
|
+
oh-gc milestone update <number>
|
|
351
|
+
oh-gc milestone delete <number>
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
## Webhooks
|
|
355
|
+
|
|
356
|
+
```bash
|
|
357
|
+
oh-gc hook list
|
|
358
|
+
oh-gc hook get <id>
|
|
359
|
+
oh-gc hook create "webhook" --url https://example.com/hook --events push
|
|
360
|
+
oh-gc hook delete <id>
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
## Tags
|
|
364
|
+
|
|
365
|
+
```bash
|
|
366
|
+
oh-gc tag list
|
|
367
|
+
oh-gc tag create <name> --ref <sha/branch>
|
|
368
|
+
oh-gc tag delete <name>
|
|
369
|
+
oh-gc tag protect <name>
|
|
370
|
+
oh-gc tag protect-get <name>
|
|
371
|
+
oh-gc tag protect-create <name> --access-level 40
|
|
372
|
+
oh-gc tag protect-update <name> --access-level 30
|
|
373
|
+
oh-gc tag protect-delete <name>
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
## Organizations
|
|
377
|
+
|
|
378
|
+
```bash
|
|
379
|
+
oh-gc org list
|
|
380
|
+
oh-gc org view <org>
|
|
381
|
+
oh-gc org members <org>
|
|
382
|
+
```
|