@oh-gc/cli 0.7.4 → 0.7.6
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/api/prs.d.ts +2 -0
- package/dist/api/prs.js +4 -0
- package/dist/api/prs.js.map +1 -1
- 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-reply.d.ts +19 -0
- package/dist/commands/pr/comment-reply.js +123 -0
- package/dist/commands/pr/comment-reply.js.map +1 -0
- 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/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 +5 -3
- 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
- package/dist/commands/search/users.d.ts +0 -16
- package/dist/commands/search/users.js +0 -52
- package/dist/commands/search/users.js.map +0 -1
- package/dist/commands/user/key-get.d.ts +0 -12
- package/dist/commands/user/key-get.js +0 -36
- package/dist/commands/user/key-get.js.map +0 -1
- package/dist/commands/user/update.d.ts +0 -15
- package/dist/commands/user/update.js +0 -60
- package/dist/commands/user/update.js.map +0 -1
|
@@ -38,9 +38,9 @@ class UserStarred extends base_command_1.BaseCommand {
|
|
|
38
38
|
}
|
|
39
39
|
UserStarred.description = 'List starred repositories';
|
|
40
40
|
UserStarred.examples = [
|
|
41
|
-
'<%= config.bin %> user
|
|
42
|
-
'<%= config.bin %> user
|
|
43
|
-
'<%= config.bin %> user
|
|
41
|
+
'<%= config.bin %> user starred',
|
|
42
|
+
'<%= config.bin %> user starred alice',
|
|
43
|
+
'<%= config.bin %> user starred --sort last_push',
|
|
44
44
|
];
|
|
45
45
|
UserStarred.flags = {
|
|
46
46
|
...base_command_1.BaseCommand.baseFlags,
|
|
@@ -38,9 +38,9 @@ class UserSubscriptions extends base_command_1.BaseCommand {
|
|
|
38
38
|
}
|
|
39
39
|
UserSubscriptions.description = 'List watched (subscribed) repositories';
|
|
40
40
|
UserSubscriptions.examples = [
|
|
41
|
-
'<%= config.bin %> user
|
|
42
|
-
'<%= config.bin %> user
|
|
43
|
-
'<%= config.bin %> user
|
|
41
|
+
'<%= config.bin %> user subscriptions',
|
|
42
|
+
'<%= config.bin %> user subscriptions alice',
|
|
43
|
+
'<%= config.bin %> user subscriptions --sort last_push',
|
|
44
44
|
];
|
|
45
45
|
UserSubscriptions.flags = {
|
|
46
46
|
...base_command_1.BaseCommand.baseFlags,
|
|
@@ -33,8 +33,8 @@ class UserView extends base_command_1.BaseCommand {
|
|
|
33
33
|
}
|
|
34
34
|
UserView.description = 'View user profile';
|
|
35
35
|
UserView.examples = [
|
|
36
|
-
'<%= config.bin %> user
|
|
37
|
-
'<%= config.bin %> user
|
|
36
|
+
'<%= config.bin %> user view',
|
|
37
|
+
'<%= config.bin %> user view alice',
|
|
38
38
|
];
|
|
39
39
|
UserView.flags = {
|
|
40
40
|
...base_command_1.BaseCommand.baseFlags,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oh-gc/cli",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.6",
|
|
4
4
|
"description": "GitCode CLI — manage issues and PRs from the terminal",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "guozejun",
|
|
@@ -33,7 +33,8 @@
|
|
|
33
33
|
"dist/",
|
|
34
34
|
"!dist/**/*.test.*",
|
|
35
35
|
"README.md",
|
|
36
|
-
"LICENSE"
|
|
36
|
+
"LICENSE",
|
|
37
|
+
"skills/"
|
|
37
38
|
],
|
|
38
39
|
"oclif": {
|
|
39
40
|
"bin": "oh-gc",
|
|
@@ -67,6 +68,7 @@
|
|
|
67
68
|
"jest-fetch-mock": "^3",
|
|
68
69
|
"ts-jest": "^29",
|
|
69
70
|
"ts-node": "^10",
|
|
70
|
-
"typescript": "^5"
|
|
71
|
+
"typescript": "^5",
|
|
72
|
+
"unzipper": "^0.12.3"
|
|
71
73
|
}
|
|
72
74
|
}
|
|
@@ -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.6 | **Updated:** 2026-05-17
|
|
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/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}`.
|