### Build and Install AtomGit CLI Source: https://github.com/openeuler/ag-cli/blob/master/README.md Instructions for building the AtomGit CLI from source and installing it into the Go binary path. ```bash # 从源码构建 go build ./cmd/ag # 安装到 $GOPATH/bin go install ./cmd/ag ``` -------------------------------- ### Configuration Token File Example Source: https://context7.com/openeuler/ag-cli/llms.txt This JSON file stores your personal access token and username for authentication with the AtomGit API. Ensure this file is placed in the correct directory according to XDG specifications. ```json // ~/.config/ag-cli/token.json { "access_token": "your-personal-access-token", "user": "your-username" } ``` -------------------------------- ### Build and Test Project Source: https://github.com/openeuler/ag-cli/blob/master/CONTRIBUTING.md Build the project using 'go build', run tests with 'go test', and check code formatting with 'gofmt'. ```bash # 构建项目 go build ./cmd/ag # 运行测试(如果有) go test ./... # 检查代码格式 gofmt -l . ``` -------------------------------- ### Create a New Repository Source: https://context7.com/openeuler/ag-cli/llms.txt Use `ag repo create` to create a new repository. You can specify the repository name, description, and visibility (public or private). The command can also prompt for cloning instructions. ```bash # 创建私有仓库(默认) $ ag repo create my-new-project --description "A new project" ✓ Created repository alice/my-new-project URL: https://atomgit.com/alice/my-new-project # 在组织下创建公开仓库并提示克隆命令 $ ag repo create my-org/shared-lib --public --clone ✓ Created repository my-org/shared-lib URL: https://atomgit.com/my-org/shared-lib To clone this repository, run: git clone https://atomgit.com/my-org/shared-lib ``` -------------------------------- ### Manage AtomGit Repositories Source: https://github.com/openeuler/ag-cli/blob/master/README.md Commands for listing, viewing, creating, cloning, forking, and deleting repositories. ```bash # 列出仓库 ag repo list # 查看仓库详情 ag repo view owner/repo # 创建仓库 ag repo create my-project --public --description "My project" # 克隆仓库 ag repo clone owner/repo ag repo clone owner/repo --branch develop # Fork 仓库 ag repo fork owner/repo ag repo fork owner/repo --name my-fork --public # 删除仓库 ag repo delete owner/repo --yes ``` -------------------------------- ### AtomGit CLI Project Structure Source: https://github.com/openeuler/ag-cli/blob/master/README.md Overview of the AtomGit CLI project's directory structure, highlighting key components like main entry point, internal modules, and package commands. ```text ag-cli/ ├── cmd/ag/main.go # 入口 ├── internal/ │ ├── agcmd/cmd.go # 核心命令处理 │ ├── config/config.go # 配置管理 │ └── api/ │ ├── client.go # API 客户端 │ └── types.go # 数据类型 ├── pkg/ │ ├── cmdutil/factory.go # 命令工厂 │ └── cmd/ │ ├── root/root.go # 根命令 │ ├── auth/auth.go # 认证命令 │ ├── repo/ # 仓库命令 │ │ ├── repo.go │ │ ├── create.go │ │ ├── clone.go │ │ ├── delete.go │ │ └── fork.go │ ├── pr/ # PR 命令 │ │ ├── pr.go │ │ └── comment/ # PR 评论命令 │ ├── issue/ # Issue 命令 │ │ ├── issue.go │ │ └── comment/ # Issue 评论命令 │ ├── license/ # License 命令 │ │ ├── license.go │ │ └── check.go │ └── ssh-key/ssh_key.go # SSH key 命令 └── go.mod ``` -------------------------------- ### Project Structure Overview Source: https://github.com/openeuler/ag-cli/blob/master/CONTRIBUTING.md Understand the directory structure of the ag-cli project, which includes main entry points, internal packages, public packages, and documentation. ```bash ag-cli/ ├── cmd/ag/ # 主程序入口 ├── internal/ # 内部包 │ ├── agcmd/ # 核心命令处理 │ ├── config/ # 配置管理 │ └── api/ # API 客户端 ├── pkg/ # 公共包 │ ├── cmdutil/ # 命令工具 │ └── cmd/ # 命令实现 └── docs/ # 文档 ``` -------------------------------- ### List User Repositories Source: https://context7.com/openeuler/ag-cli/llms.txt Use `ag repo list` to display all repositories accessible by the authenticated user. You can control the number of results displayed using the `-L` flag. ```bash $ ag repo list alice/my-project alice/blog openeuler/kernel $ ag repo list -L 5 # 最多显示 5 个仓库 ``` -------------------------------- ### List Tags Source: https://context7.com/openeuler/ag-cli/llms.txt List all tags associated with a repository. ```bash $ ag tag list openeuler/kernel v6.6-openeuler v6.1-openeuler-lts v5.10-openeuler-lts ``` -------------------------------- ### Create AtomGit API Client in Go Source: https://context7.com/openeuler/ag-cli/llms.txt Initializes an HTTP client for interacting with the AtomGit API v5. All requests automatically include the 'Authorization: Bearer ' header and have a 30-second timeout. This client can be embedded in other tools. ```go package main import ( "fmt" "atomgit.com/openeuler/ag-cli/internal/api" ) func main() { client := api.NewClient("your-personal-access-token") // GET 请求:列出仓库 var repos []api.Repository if err := client.Get("/user/repos", &repos); err != nil { fmt.Printf("错误: %v\n", err) return } for _, r := range repos { fmt.Printf("%s/%s\n", r.Owner.Login, r.Name) } // POST 请求:创建 Issue body := map[string]interface{}{ "title": "测试 Issue", "body": "通过 API 客户端创建的测试 Issue", } var issue api.Issue if err := client.Post("/repos/alice/myrepo/issues", body, &issue); err != nil { fmt.Printf("创建失败: %v\n", err) return } fmt.Printf("Created issue #%s\n", issue.GetNumber()) // PATCH 请求:关闭 PR patch := map[string]string{"state": "closed"} var pr api.PullRequest if err := client.Patch("/repos/alice/myrepo/pulls/5", patch, &pr); err != nil { fmt.Printf("关闭失败: %v\n", err) return } fmt.Printf("Closed PR #%s\n", pr.GetNumber()) // DELETE 请求 if err := client.Delete("/repos/alice/myrepo/tags/v0.0.1"); err != nil { fmt.Printf("删除失败: %v\n", err) } } ``` -------------------------------- ### Configure AtomGit CLI Token Source: https://github.com/openeuler/ag-cli/blob/master/README.md Details on how to configure the access token for AtomGit CLI, including recommended XDG path and a fallback path. The file should contain JSON with 'access_token' and 'user'. ```json { "access_token": "your-token-here", "user": "your-username" } ``` -------------------------------- ### Create Repository Source: https://context7.com/openeuler/ag-cli/llms.txt Create a new repository, either in the user's personal namespace or within an organization. Supports specifying visibility and description. ```APIDOC ## ag repo create — 创建仓库 支持在个人名下或组织名下创建仓库,可指定可见性和描述。 ```bash # 创建私有仓库(默认) $ ag repo create my-new-project --description "A new project" ✓ Created repository alice/my-new-project URL: https://atomgit.com/alice/my-new-project # 在组织下创建公开仓库并提示克隆命令 $ ag repo create my-org/shared-lib --public --clone ✓ Created repository my-org/shared-lib URL: https://atomgit.com/my-org/shared-lib To clone this repository, run: git clone https://atomgit.com/my-org/shared-lib ``` ``` -------------------------------- ### Manage AtomGit Issues Source: https://github.com/openeuler/ag-cli/blob/master/README.md Commands for listing, viewing, and creating issues. ```bash # 列出 Issue ag issue list owner/repo ag issue list owner/repo --state all # 查看 Issue ag issue view owner/repo 42 # 创建 Issue ag issue create owner/repo --title "Bug report" --body "Description" ``` -------------------------------- ### Clone the Repository Source: https://github.com/openeuler/ag-cli/blob/master/CONTRIBUTING.md Clone the AtomGit CLI repository to your local machine and navigate into the project directory. ```bash git clone https://gitcode.com/openeuler/ag-cli.git cd ag-cli ``` -------------------------------- ### View Repository Details Source: https://context7.com/openeuler/ag-cli/llms.txt The `ag repo view` command provides detailed information about a specific repository, including its name, description, URL, star count, fork count, open issues, default branch, and visibility. ```bash $ ag repo view openeuler/kernel Name: openeuler/kernel Description: OpenEuler kernel repository URL: https://atomgit.com/openeuler/kernel Stars: 128 Forks: 34 Open Issues: 12 Default Branch: master Private: false ``` -------------------------------- ### Create a Tag Source: https://context7.com/openeuler/ag-cli/llms.txt Create a new tag. Supports creating annotated tags based on a specified branch or commit SHA. ```bash # Create an annotated tag based on a specified branch or commit SHA $ ag tag create openeuler/kernel v6.6.1-hotfix \ --message "Hotfix release for CVE-2026-xxxx" \ --ref stable-6.6 Created tag v6.6.1-hotfix ``` -------------------------------- ### Check License Compliance with AtomGit CLI Source: https://github.com/openeuler/ag-cli/blob/master/README.md Command to check license compliance for specified licenses like MIT, Apache-2.0, and GPL-3.0. ```bash # 检查 license 合规性 ag license check MIT ag license check Apache-2.0 ag license check GPL-3.0 ``` -------------------------------- ### List Repositories Source: https://context7.com/openeuler/ag-cli/llms.txt List all repositories accessible by the currently authenticated user. Supports limiting the number of results. ```APIDOC ## ag repo list — 列出仓库 列出当前认证用户可访问的所有仓库,默认最多 30 条,可用 `-L` 调整。 ```bash $ ag repo list alice/my-project alice/blog openeuler/kernel $ ag repo list -L 5 # 最多显示 5 个仓库 ``` ``` -------------------------------- ### Create a New Branch Source: https://github.com/openeuler/ag-cli/blob/master/CONTRIBUTING.md Create a new branch for your feature or bug fix. Use a descriptive name, such as 'feature/your-feature-name' or 'fix/bug-description'. ```bash git checkout -b feature/your-feature-name # 或 git checkout -b fix/bug-description ``` -------------------------------- ### Manage AtomGit Pull Requests Source: https://github.com/openeuler/ag-cli/blob/master/README.md Commands for listing, viewing, creating, and closing pull requests. ```bash # 列出 PR ag pr list owner/repo ag pr list owner/repo --state closed # 查看 PR ag pr view owner/repo 123 # 创建 PR ag pr create owner/repo --title "Fix bug" --body "Description" --base master --head feature-branch # 关闭 PR ag pr close owner/repo 123 ``` -------------------------------- ### View Issue Details Source: https://context7.com/openeuler/ag-cli/llms.txt View the detailed information of a specific issue, including title, state, author, URL, and creation date. ```bash $ ag issue view openeuler/kernel 38 Title: OOM crash under heavy workload State: open Author: charlie URL: https://atomgit.com/openeuler/kernel/issues/38 Created: 2026-01-10T08:00:00Z System crashes with OOM killer on 16GB machines under heavy I/O workload. Steps to reproduce: ... ``` -------------------------------- ### API Client Source: https://context7.com/openeuler/ag-cli/llms.txt Provides functionality to create an API client for interacting with the AtomGit API, supporting various HTTP methods. ```APIDOC ## api.NewClient ### Description Creates a new API client with a 30-second timeout. All requests automatically include an `Authorization: Bearer ` header. ### Signature `func NewClient(token string) *Client` ### Parameters #### Parameters - **token** (string) - Required - The personal access token for authentication. ### Usage Example ```go package main import ( "fmt" "atomgit.com/openeuler/ag-cli/internal/api" ) func main() { client := api.NewClient("your-personal-access-token") // GET Request: List repositories var repos []api.Repository if err := client.Get("/user/repos", &repos); err != nil { fmt.Printf("Error: %v\n", err) return } for _, r := range repos { fmt.Printf("%s/%s\n", r.Owner.Login, r.Name) } // POST Request: Create an Issue body := map[string]interface{}{ "title": "Test Issue", "body": "A test issue created via the API client", } var issue api.Issue if err := client.Post("/repos/alice/myrepo/issues", body, &issue); err != nil { fmt.Printf("Creation failed: %v\n", err) return } fmt.Printf("Created issue #%s\n", issue.GetNumber()) // PATCH Request: Close a PR patch := map[string]string{"state": "closed"} var pr api.PullRequest if err := client.Patch("/repos/alice/myrepo/pulls/5", patch, &pr); err != nil { fmt.Printf("Closing failed: %v\n", err) return } fmt.Printf("Closed PR #%s\n", pr.GetNumber()) // DELETE Request if err := client.Delete("/repos/alice/myrepo/tags/v0.0.1"); err != nil { fmt.Printf("Deletion failed: %v\n", err) } } ``` ### Methods - **Get(path string, result interface{}) error**: Performs a GET request. - **Post(path string, body interface{}, result interface{}) error**: Performs a POST request. - **Patch(path string, body interface{}, result interface{}) error**: Performs a PATCH request. - **Delete(path string) error**: Performs a DELETE request. ``` -------------------------------- ### Clone a Repository Source: https://context7.com/openeuler/ag-cli/llms.txt The `ag repo clone` command allows you to clone a repository from AtomGit. You can clone the default branch or specify a different branch using the `--branch` flag. ```bash # 克隆默认分支 $ ag repo clone openeuler/docs # 克隆指定分支 $ ag repo clone openeuler/docs --branch stable-22.03 ``` -------------------------------- ### Check SPDX License Compliance Source: https://context7.com/openeuler/ag-cli/llms.txt Queries the openEuler compliance service to determine the compliance status of a given SPDX license identifier. Use this to ensure introduced dependencies meet compatibility requirements. ```bash ag license check MIT compliant ``` ```bash ag license check Apache-2.0 compliant ``` ```bash ag license check GPL-3.0 compliant ``` ```bash ag license check UNKNOWN-LICENSE 未知 ``` -------------------------------- ### View Repository Details Source: https://context7.com/openeuler/ag-cli/llms.txt Display detailed information about a specific repository, including its name, description, URL, stars, forks, and visibility. ```APIDOC ## ag repo view — 查看仓库详情 ```bash $ ag repo view openeuler/kernel Name: openeuler/kernel Description: OpenEuler kernel repository URL: https://atomgit.com/openeuler/kernel Stars: 128 Forks: 34 Open Issues: 12 Default Branch: master Private: false ``` ``` -------------------------------- ### Commit and Push Changes Source: https://github.com/openeuler/ag-cli/blob/master/CONTRIBUTING.md Stage all changes, commit them with a descriptive message following the specified format, and push to your remote branch. ```bash git add . git commit -m "feat: add new feature description" git push origin feature/your-feature-name ``` -------------------------------- ### Create a Pull Request Source: https://context7.com/openeuler/ag-cli/llms.txt Use `ag pr create` to submit a new Pull Request. You must provide the repository, title, body, base branch, and head branch for the PR. ```bash $ ag pr create openeuler/kernel \ --title "Fix memory leak in mm subsystem" \ --body "Fixes OOM issue under heavy workload. See issue #38." \ --base master \ --head fix/mm-leak Created PR #42: https://atomgit.com/openeuler/kernel/pull/42 ``` -------------------------------- ### Create an Issue Source: https://context7.com/openeuler/ag-cli/llms.txt Create a new issue in a repository. Requires title and body content, which can be provided directly or via a file. ```bash $ ag issue create openeuler/kernel \ --title "Build failure on RISC-V" \ --body "Compilation fails with GCC 13 on RISC-V targets. Error: undefined reference to..." Created issue #40: https://atomgit.com/openeuler/kernel/issues/40 ``` -------------------------------- ### Clone Repository Source: https://context7.com/openeuler/ag-cli/llms.txt Clone a repository from AtomGit to your local machine. Supports cloning a specific branch. ```APIDOC ## ag repo clone — 克隆仓库 ```bash # 克隆默认分支 $ ag repo clone openeuler/docs # 克隆指定分支 $ ag repo clone openeuler/docs --branch stable-22.03 ``` ``` -------------------------------- ### Fork a Repository Source: https://context7.com/openeuler/ag-cli/llms.txt Use `ag repo fork` to create a fork of an existing repository. You can specify a new name for the fork and set its visibility. ```bash # 使用默认名称 Fork $ ag repo fork openeuler/kernel # 指定 Fork 名称和可见性 $ ag repo fork openeuler/kernel --name my-kernel --public ``` -------------------------------- ### List Tags Source: https://context7.com/openeuler/ag-cli/llms.txt Lists all tags in a repository. ```APIDOC ## ag tag list ### Description Lists all tags in a repository. ### Method `ag tag list` ### Parameters - **repository** (string) - Required - The repository path (e.g., openeuler/kernel). ### Example ```bash $ ag tag list openeuler/kernel v6.6-openeuler v6.1-openeuler-lts v5.10-openeuler-lts ``` ``` -------------------------------- ### Add SSH Key Source: https://context7.com/openeuler/ag-cli/llms.txt Adds an SSH public key to your account, supporting file paths or stdin. ```APIDOC ## ag ssh-key add ### Description Adds an SSH public key to your account. Supports reading the key from a file path or via stdin. ### Method `ag ssh-key add` ### Parameters - **public_key_path** (string) - Optional - Path to the SSH public key file (e.g., ~/.ssh/id_ed25519.pub). - **title** (string) - Required - A title for the SSH key. ### Examples ```bash # Add from a file $ ag ssh-key add ~/.ssh/id_ed25519.pub --title "Work Laptop" ✓ SSH key added to your account # Add via stdin $ cat ~/.ssh/id_rsa.pub | ag ssh-key add --title "CI Server" ✓ SSH key added to your account ``` ``` -------------------------------- ### Print Raw Authentication Token Source: https://context7.com/openeuler/ag-cli/llms.txt The `ag auth token` command outputs your full, unmasked personal access token. This is useful for scripting and passing the token to other tools like `curl`. ```bash $ ag auth token ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx # 脚本用法:将 token 传递给 curl $ curl -H "Authorization: Bearer $(ag auth token)" \ https://api.atomgit.com/api/v5/user ``` -------------------------------- ### Create Tag Source: https://context7.com/openeuler/ag-cli/llms.txt Creates a new tag in a repository, optionally with a message and based on a specific reference. ```APIDOC ## ag tag create ### Description Creates a new tag in a repository. Can be an annotated tag based on a specified branch or commit SHA. ### Method `ag tag create` ### Parameters - **repository** (string) - Required - The repository path (e.g., openeuler/kernel). - **tag_name** (string) - Required - The name of the tag to create (e.g., v6.6.1-hotfix). - **message** (string) - Optional - An annotated message for the tag. - **ref** (string) - Optional - The branch or commit SHA to base the tag on. ### Example ```bash # Create an annotated tag based on a specific branch $ ag tag create openeuler/kernel v6.6.1-hotfix \ --message "Hotfix release for CVE-2026-xxxx" \ --ref stable-6.6 Created tag v6.6.1-hotfix ``` ``` -------------------------------- ### Fork Repository Source: https://context7.com/openeuler/ag-cli/llms.txt Create a fork of an existing repository. Allows specifying a custom name and visibility for the fork. ```APIDOC ## ag repo fork — Fork 仓库 ```bash # 使用默认名称 Fork $ ag repo fork openeuler/kernel # 指定 Fork 名称和可见性 $ ag repo fork openeuler/kernel --name my-kernel --public ``` ``` -------------------------------- ### Create Issue Source: https://context7.com/openeuler/ag-cli/llms.txt Creates a new issue in a repository with a title and body. ```APIDOC ## ag issue create ### Description Creates a new issue in a repository. ### Method `ag issue create` ### Parameters - **repository** (string) - Required - The repository path (e.g., openeuler/kernel). - **title** (string) - Required - The title of the issue. - **body** (string) - Optional - The description content of the issue. ### Example ```bash $ ag issue create openeuler/kernel \ --title "Build failure on RISC-V" \ --body "Compilation fails with GCC 13 on RISC-V targets. Error: undefined reference to..." Created issue #40: https://atomgit.com/openeuler/kernel/issues/40 ``` ``` -------------------------------- ### View All Issue Comments Source: https://context7.com/openeuler/ag-cli/llms.txt View all comments associated with a specific issue, displayed in chronological order. ```bash $ ag issue comment view openeuler/kernel 38 Issue #38 的评论 (共 2 条): [2001] @charlie 2026-01-11 09:00 我也能复现,系统版本 openEuler 22.03 SP3。 [2002] @alice 2026-01-12 14:00 (你) 已定位到 mm/slab.c 中的内存释放逻辑问题,正在修复。 ``` -------------------------------- ### Authentication Token Source: https://context7.com/openeuler/ag-cli/llms.txt Print the full, unmasked personal access token. Useful for scripting and passing the token to other tools. ```APIDOC ## ag auth token — 打印原始 token 直接输出完整 token,可用于脚本中传递给其他工具。 ```bash $ ag auth token ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx # 脚本用法:将 token 传递给 curl $ curl -H "Authorization: Bearer $(ag auth token)" \ https://api.atomgit.com/api/v5/user ``` ``` -------------------------------- ### Add SSH Public Key Source: https://context7.com/openeuler/ag-cli/llms.txt Add an SSH public key to your account. Supports adding from a file path or piping the key content via stdin. ```bash # Add from a file $ ag ssh-key add ~/.ssh/id_ed25519.pub --title "Work Laptop" ✓ SSH key added to your account ``` ```bash # Add via stdin $ cat ~/.ssh/id_rsa.pub | ag ssh-key add --title "CI Server" ✓ SSH key added to your account ``` -------------------------------- ### Check Authentication Status Source: https://context7.com/openeuler/ag-cli/llms.txt Use `ag auth status` to verify your current login status and view a masked version of your access token. It also provides helpful error messages and search paths if authentication fails. ```bash $ ag auth status # 已认证输出示例: ✓ Logged in to atomgit.com as alice Token: abcd****ef12 # 未认证输出示例: ✗ Not authenticated Token file error: token file not found. Searched locations: - /home/alice/.config/ag-cli/token.json - /home/alice/.atomgit_personal_token.json ``` -------------------------------- ### List Issues Source: https://context7.com/openeuler/ag-cli/llms.txt List issues for a repository. Supports filtering by state (open, closed, all) and limiting the number of results. ```bash $ ag issue list openeuler/kernel #38 OOM crash under heavy workload [open] #37 Build failure on ARM64 [open] ``` ```bash $ ag issue list openeuler/kernel --state closed ``` ```bash $ ag issue list openeuler/kernel --state all -L 50 ``` -------------------------------- ### Generate and Add SSH Key Source: https://context7.com/openeuler/ag-cli/llms.txt Generates a new SSH key using ed25519 and immediately adds it to the account with a specified title. Ensure the key path and title are appropriate for your deployment. ```bash ssh-keygen -t ed25519 -C "deploy@server" -f ~/.ssh/deploy_key -N "" ag ssh-key add ~/.ssh/deploy_key.pub --title "Deploy Key" ✓ SSH key added to your account ``` -------------------------------- ### License Compliance Check Source: https://context7.com/openeuler/ag-cli/llms.txt Checks the compliance status of a given SPDX license identifier by querying the openEuler compliance service. ```APIDOC ## ag license check ### Description Checks the compliance status of a specified SPDX license identifier against the openEuler compliance service. ### Method `ag license check ` ### Parameters #### Path Parameters - **SPDX_LICENSE_IDENTIFIER** (string) - Required - The SPDX license identifier to check (e.g., MIT, Apache-2.0, GPL-3.0). ### Request Example ```bash ag license check MIT ``` ### Response #### Success Response - **compliant**: The license is compliant. - **unknown**: The license identifier is not recognized. ### Response Example ``` compliant ``` ``` -------------------------------- ### Link Issues to a PR Source: https://context7.com/openeuler/ag-cli/llms.txt Use this command to associate multiple issues with a specific pull request. ```bash $ ag pr link-issues openeuler/kernel 42 --issue 38 --issue 39 Linked issues #38, #39 to PR #42 ``` -------------------------------- ### Manage AtomGit Issue Comments Source: https://github.com/openeuler/ag-cli/blob/master/README.md Commands for creating, viewing, editing, and deleting comments on issues. Supports creating comments from files and interactive editing. ```bash # 创建评论 ag issue comment create owner/repo 42 --body "I can reproduce this issue" ag issue comment create owner/repo 42 --body-file details.md # 查看所有评论 ag issue comment view owner/repo 42 # 编辑评论(交互式编辑) ag issue comment edit owner/repo 42 789 ag issue comment edit owner/repo 42 789 --body "Updated information" # 删除评论 ag issue comment delete owner/repo 42 789 ag issue comment delete owner/repo 42 789 --yes ``` -------------------------------- ### Add SSH Key using AtomGit CLI Source: https://github.com/openeuler/ag-cli/blob/master/README.md Commands to add an SSH public key, either by providing the file path or piping the key content. Allows specifying a title for the key. ```bash # 添加 SSH key ag ssh-key add ~/.ssh/id_rsa.pub --title "My Laptop" cat ~/.ssh/id_rsa.pub | ag ssh-key add --title "My Laptop" ``` -------------------------------- ### View Issue Details Source: https://context7.com/openeuler/ag-cli/llms.txt Retrieves and displays the detailed information of a specific issue. ```APIDOC ## ag issue view ### Description Retrieves and displays the detailed information of a specific issue. ### Method `ag issue view` ### Parameters - **repository** (string) - Required - The repository path (e.g., openeuler/kernel). - **issue_number** (integer) - Required - The number of the issue to view. ### Example ```bash $ ag issue view openeuler/kernel 38 Title: OOM crash under heavy workload State: open Author: charlie URL: https://atomgit.com/openeuler/kernel/issues/38 Created: 2026-01-10T08:00:00Z System crashes with OOM killer on 16GB machines under heavy I/O workload. Steps to reproduce: ... ``` ``` -------------------------------- ### Create an Issue Comment Source: https://context7.com/openeuler/ag-cli/llms.txt Add a comment to an issue. Comments can be provided directly as text or read from a file. ```bash $ ag issue comment create openeuler/kernel 38 --body "我也能复现,系统版本 openEuler 22.03 SP3。" Created comment #2001 on issue #38: https://atomgit.com/openeuler/kernel/issues/38#comment-2001 ``` ```bash # Read detailed content from a file $ ag issue comment create openeuler/kernel 38 --body-file repro-steps.md ``` -------------------------------- ### List Pull Requests Source: https://context7.com/openeuler/ag-cli/llms.txt Use `ag pr list` to view Pull Requests for a repository. You can filter by state (open, closed, all) to find specific PRs. ```bash # 列出开放状态的 PR(默认) $ ag pr list openeuler/kernel #42 Fix memory leak in mm subsystem [open] #41 Add support for RISC-V [open] # 列出已关闭的 PR $ ag pr list openeuler/kernel --state closed # 列出所有状态 $ ag pr list openeuler/kernel --state all ``` -------------------------------- ### Create a PR Comment Source: https://context7.com/openeuler/ag-cli/llms.txt Create comments on a pull request. Supports direct text, file input, or interactive input. Ensure the PR exists before commenting. ```bash # Directly specify comment content $ ag pr comment create openeuler/kernel 42 --body "LGTM! 代码逻辑清晰。" Created comment #1001 on PR #42: https://atomgit.com/openeuler/kernel/pull/42#comment-1001 ``` ```bash # Read comment content from a file $ ag pr comment create openeuler/kernel 42 --body-file review-notes.md Created comment #1002 on PR #42: https://atomgit.com/openeuler/kernel/pull/42#comment-1002 ``` ```bash # Interactive input (without --body parameter) $ ag pr comment create openeuler/kernel 42 Enter comment body (press Ctrl+D when done): 请在测试环境验证后合并。 ^D Created comment #1003 on PR #42: https://atomgit.com/openeuler/kernel/pull/42#comment-1003 ``` -------------------------------- ### Create Internal Repo PR with ag-cli Source: https://github.com/openeuler/ag-cli/blob/master/notes/cross_repo_pr_demo.md Use this command to create a Pull Request within the same repository, merging a development branch into a base branch. Omit the 'owner:' prefix in the `--head` parameter for internal PRs. ```bash ag pr create mywaaagh_admin/ag-cli --title 'Internal Repo PR Demo (Auto-generated by Showboat)' --body 'This is an internal PR creation test.' --base test-base --head test-head ``` ```output Created PR #2: ``` -------------------------------- ### Create Cross-Repo PR with ag-cli Source: https://github.com/openeuler/ag-cli/blob/master/notes/cross_repo_pr_demo.md Use this command to create a Pull Request from a fork to an upstream repository's master branch. Specify the `--head` parameter as 'username:branch' to indicate the source fork and branch. ```bash ag pr create openeuler/ag-cli --title 'Cross Repo PR Demo (Auto-generated by Showboat)' --body 'This is an automated cross-repo PR creation test from my fork.' --base master --head mywaaagh_admin:test-head ``` ```output Created PR #14: ``` -------------------------------- ### Check AtomGit CLI Authentication Status Source: https://github.com/openeuler/ag-cli/blob/master/README.md Command to check the current authentication status and display the active token. ```bash # 查看认证状态 ag auth status # 显示当前 token ag auth token ``` -------------------------------- ### Create Pull Request Source: https://context7.com/openeuler/ag-cli/llms.txt Create a new pull request, specifying the title, body, base branch, and head branch. ```APIDOC ## ag pr create — 创建 PR ```bash $ ag pr create openeuler/kernel \ --title "Fix memory leak in mm subsystem" \ --body "Fixes OOM issue under heavy workload. See issue #38." \ --base master \ --head fix/mm-leak Created PR #42: https://atomgit.com/openeuler/kernel/pull/42 ``` ``` -------------------------------- ### Close an Issue Source: https://context7.com/openeuler/ag-cli/llms.txt Close an issue by sending a '/close' command comment. This action marks the issue as resolved. ```bash $ ag issue close openeuler/kernel 38 Closed issue #38 ``` -------------------------------- ### View Pull Request Details Source: https://context7.com/openeuler/ag-cli/llms.txt Display detailed information about a specific pull request, including its title, state, author, URL, branches, labels, and creation date. ```APIDOC ## ag pr view — 查看 PR 详情 ```bash $ ag pr view openeuler/kernel 42 Title: Fix memory leak in mm subsystem State: open Author: bob URL: https://atomgit.com/openeuler/kernel/pull/42 Branch: fix/mm-leak -> master Labels: bug, high-priority Created: 2026-01-15T10:30:00Z Fixes a memory leak in the mm subsystem that causes OOM on heavy workloads. ``` ``` -------------------------------- ### Manage AtomGit PR Comments Source: https://github.com/openeuler/ag-cli/blob/master/README.md Commands for creating, viewing, editing, deleting, and replying to comments on pull requests. Supports creating comments from files. ```bash # 创建评论 ag pr comment create owner/repo 123 --body "LGTM!" ag pr comment create owner/repo 123 --body-file review.md # 查看所有评论(树形结构显示) ag pr comment view owner/repo 123 # 编辑评论(交互式编辑) ag pr comment edit owner/repo 123 456 ag pr comment edit owner/repo 123 456 --body "Updated comment" # 删除评论 ag pr comment delete owner/repo 123 456 ag pr comment delete owner/repo 123 456 --yes # 回复评论(PR 特有) ag pr comment reply owner/repo 123 456 --body "Thanks for the feedback!" ``` -------------------------------- ### View Pull Request Details Source: https://context7.com/openeuler/ag-cli/llms.txt The `ag pr view` command displays comprehensive details of a specific Pull Request, including its title, state, author, URL, branch information, labels, creation date, and the PR body. ```bash $ ag pr view openeuler/kernel 42 Title: Fix memory leak in mm subsystem State: open Author: bob URL: https://atomgit.com/openeuler/kernel/pull/42 Branch: fix/mm-leak -> master Labels: bug, high-priority Created: 2026-01-15T10:30:00Z Fixes a memory leak in the mm subsystem that causes OOM on heavy workloads. ``` -------------------------------- ### Link Multiple Issues to a PR Source: https://context7.com/openeuler/ag-cli/llms.txt Command to link multiple issues to a specific pull request. ```APIDOC ## ag pr link-issues ### Description Links multiple issues to a specified pull request. ### Method `ag pr link-issues` ### Parameters - **repository** (string) - Required - The repository path (e.g., openeuler/kernel). - **pr_number** (integer) - Required - The number of the pull request. - **issue** (integer) - Required - The number of the issue to link. Can be specified multiple times. ### Example ```bash $ ag pr link-issues openeuler/kernel 42 --issue 38 --issue 39 Linked issues #38, #39 to PR #42 ``` ``` -------------------------------- ### List Issues Source: https://context7.com/openeuler/ag-cli/llms.txt Lists issues in a repository, with options to filter by state. ```APIDOC ## ag issue list ### Description Lists issues in a repository. Supports filtering by state and limiting the number of results. ### Method `ag issue list` ### Parameters - **repository** (string) - Required - The repository path (e.g., openeuler/kernel). - **state** (string) - Optional - Filter issues by state (e.g., 'open', 'closed', 'all'). - **L** (integer) - Optional - Limit the number of issues to list. ### Examples ```bash $ ag issue list openeuler/kernel #38 OOM crash under heavy workload [open] #37 Build failure on ARM64 [open] $ ag issue list openeuler/kernel --state closed $ ag issue list openeuler/kernel --state all -L 50 ``` ``` -------------------------------- ### List Pull Requests Source: https://context7.com/openeuler/ag-cli/llms.txt List pull requests for a repository. Supports filtering by state (open, closed, all). ```APIDOC ## ag pr list — 列出 PR ```bash # 列出开放状态的 PR(默认) $ ag pr list openeuler/kernel #42 Fix memory leak in mm subsystem [open] #41 Add support for RISC-V [open] # 列出已关闭的 PR $ ag pr list openeuler/kernel --state closed # 列出所有状态 $ ag pr list openeuler/kernel --state all ``` ``` -------------------------------- ### View All PR Comments Source: https://context7.com/openeuler/ag-cli/llms.txt View all comments on a pull request in a threaded structure. Converts HTML tables to Markdown and marks the current user's comments. ```bash $ ag pr comment view openeuler/kernel 42 PR #42 的评论 (共 3 条): [1001] @bob 2026-01-16 09:00 LGTM! 代码逻辑清晰。 [1002] @alice 2026-01-16 10:00 (你) 请在测试环境验证后合并。 [1003] @bob 2026-01-16 10:30 已在测试环境验证,结果正常。 ``` -------------------------------- ### Delete a Repository Source: https://context7.com/openeuler/ag-cli/llms.txt The `ag repo delete` command removes a repository. It includes an interactive confirmation by default, but you can bypass this with the `--yes` flag for automated deletion (use with caution). ```bash # 交互式确认删除 $ ag repo delete alice/old-project # 跳过确认直接删除(危险操作) $ ag repo delete alice/old-project --yes ``` -------------------------------- ### Diff Pull Request Source: https://context7.com/openeuler/ag-cli/llms.txt View the differences introduced by a pull request. Supports output in patch format or as raw JSON. ```APIDOC ## ag pr diff — 查看 PR 差异 ```bash # 以 patch 格式输出差异 $ ag pr diff openeuler/kernel 42 diff --git a/mm/slab.c b/mm/slab.c --- a/mm/slab.c +++ b/mm/slab.c static void cache_free_debugcheck(struct kmem_cache *cachep, void *objp) - kfree(ptr); + // ptr already freed in parent function # 输出原始 JSON $ ag pr diff openeuler/kernel 42 --json {"code":0,"diffs":[...]} ``` ``` -------------------------------- ### List Issues Linked to Pull Request Source: https://context7.com/openeuler/ag-cli/llms.txt View issues that are linked to a specific pull request. ```APIDOC ## ag pr issues — 查看 PR 关联的 Issue ```bash $ ag pr issues openeuler/kernel 42 PR #42 linked issues: #38 OOM crash under heavy workload [open] #39 Memory usage regression [closed] ``` ``` -------------------------------- ### Create Issue Comment Source: https://context7.com/openeuler/ag-cli/llms.txt Adds a comment to an issue, supporting direct text or file input. ```APIDOC ## ag issue comment create ### Description Creates a comment on an issue. Supports direct text input or reading from a file. ### Method `ag issue comment create` ### Parameters - **repository** (string) - Required - The repository path (e.g., openeuler/kernel). - **issue_number** (integer) - Required - The number of the issue. - **body** (string) - Optional - The content of the comment. - **body_file** (string) - Optional - Path to a file containing the comment content. ### Examples ```bash $ ag issue comment create openeuler/kernel 38 --body "我也能复现,系统版本 openEuler 22.03 SP3。" Created comment #2001 on issue #38: https://atomgit.com/openeuler/kernel/issues/38#comment-2001 # Read detailed content from a file $ ag issue comment create openeuler/kernel 38 --body-file repro-steps.md ``` ``` -------------------------------- ### Delete a Tag Source: https://context7.com/openeuler/ag-cli/llms.txt Delete a tag from the repository. ```bash $ ag tag delete openeuler/kernel v6.6.1-hotfix Deleted tag v6.6.1-hotfix ``` -------------------------------- ### Delete Repository Source: https://context7.com/openeuler/ag-cli/llms.txt Delete a repository. Requires interactive confirmation by default, but can be bypassed with the `--yes` flag for automated deletion. ```APIDOC ## ag repo delete — 删除仓库 ```bash # 交互式确认删除 $ ag repo delete alice/old-project # 跳过确认直接删除(危险操作) $ ag repo delete alice/old-project --yes ``` ``` -------------------------------- ### Close Cross-Repo PR with ag-cli Source: https://github.com/openeuler/ag-cli/blob/master/notes/cross_repo_pr_demo.md Use this command to close a previously created Pull Request. Provide the repository and the PR number. ```bash ag pr close openeuler/ag-cli 14 ``` ```output Closed PR #: ``` -------------------------------- ### View Issue Comments Source: https://context7.com/openeuler/ag-cli/llms.txt Displays all comments on an issue. ```APIDOC ## ag issue comment view ### Description Displays all comments on an issue. ### Method `ag issue comment view` ### Parameters - **repository** (string) - Required - The repository path (e.g., openeuler/kernel). - **issue_number** (integer) - Required - The number of the issue. ### Example ```bash $ ag issue comment view openeuler/kernel 38 Issue #38 的评论 (共 2 条): [2001] @charlie 2026-01-11 09:00 我也能复现,系统版本 openEuler 22.03 SP3。 [2002] @alice 2026-01-12 14:00 (你) 已定位到 mm/slab.c 中的内存释放逻辑问题,正在修复。 ``` ``` -------------------------------- ### View Issues Linked to a Pull Request Source: https://context7.com/openeuler/ag-cli/llms.txt Use `ag pr issues` to list all issues that are associated with a specific Pull Request, showing their numbers, titles, and states. ```bash $ ag pr issues openeuler/kernel 42 PR #42 linked issues: #38 OOM crash under heavy workload [open] #39 Memory usage regression [closed] ``` -------------------------------- ### Create PR Comment Source: https://context7.com/openeuler/ag-cli/llms.txt Creates a comment on a pull request, with options for direct text, file input, or interactive input. ```APIDOC ## ag pr comment create ### Description Creates a comment on a pull request. Supports direct text input, reading from a file, or interactive input. ### Method `ag pr comment create` ### Parameters - **repository** (string) - Required - The repository path (e.g., openeuler/kernel). - **pr_number** (integer) - Required - The number of the pull request. - **body** (string) - Optional - The content of the comment. - **body_file** (string) - Optional - Path to a file containing the comment content. ### Examples ```bash # Directly specify comment content $ ag pr comment create openeuler/kernel 42 --body "LGTM! 代码逻辑清晰。" Created comment #1001 on PR #42: https://atomgit.com/openeuler/kernel/pull/42#comment-1001 # Read from a file $ ag pr comment create openeuler/kernel 42 --body-file review-notes.md Created comment #1002 on PR #42: https://atomgit.com/openeuler/kernel/pull/42#comment-1002 # Interactive input $ ag pr comment create openeuler/kernel 42 Enter comment body (press Ctrl+D when done): 请在测试环境验证后合并。 ^D Created comment #1003 on PR #42: https://atomgit.com/openeuler/kernel/pull/42#comment-1003 ``` ``` -------------------------------- ### View Pull Request Diff Source: https://context7.com/openeuler/ag-cli/llms.txt The `ag pr diff` command shows the changes introduced by a Pull Request. It can output the diff in a standard patch format or as raw JSON. ```bash # 以 patch 格式输出差异 $ ag pr diff openeuler/kernel 42 diff --git a/mm/slab.c b/mm/slab.c --- a/mm/slab.c +++ b/mm/slab.c static void cache_free_debugcheck(struct kmem_cache *cachep, void *objp) - kfree(ptr); + // ptr already freed in parent function # 输出原始 JSON $ ag pr diff openeuler/kernel 42 --json {"code":0,"diffs":[...]} ``` -------------------------------- ### Link Issues to a Pull Request Source: https://context7.com/openeuler/ag-cli/llms.txt Associate one or more issues with a Pull Request using `ag pr link-issues`. This helps in tracking dependencies and related work. ```bash # 关联单个 Issue $ ag pr link-issues openeuler/kernel 42 --issue 38 Linked issue #38 to PR #42 ``` -------------------------------- ### Authentication Status Source: https://context7.com/openeuler/ag-cli/llms.txt Check the current authentication status, including the logged-in user and a masked token, or display an error if not authenticated. ```APIDOC ## ag auth status — 查看认证状态 显示当前登录用户和脱敏 token,未配置时输出错误提示。 ```bash $ ag auth status # 已认证输出示例: ✓ Logged in to atomgit.com as alice Token: abcd****ef12 # 未认证输出示例: ✗ Not authenticated Token file error: token file not found. Searched locations: - /home/alice/.config/ag-cli/token.json - /home/alice/.atomgit_personal_token.json ``` ```