SuperAPI AI Directory

codeup

Coding & development

View repository

Updated 10-15 08:13

About this skill

Codeup Skill

This skill provides Python script tools for interacting with the Yunxiao (Codeup) platform, uniformly invoked through codeup.py .

Environment Configuration

Before use, the following environment variables need to be configured:

export YUNXIAO_ACCESS_TOKEN="你的个人访问令牌"

Obtain access token:

  1. Log in to the Alibaba Cloud console
  2. Enter Yunxiao (Codeup)
  3. Settings -> Access Token Management -> Create Personal Access Token

Usage

python scripts/codeup.py <command> [参数]

All commands output results in JSON format by default.

Command List

Users and Organization

Command Description
get_current_user Get current user information
list_organizations List organizations the user belongs to (get org_id)

Departments and Members

Command Description
list_departments List departments
get_department Get department details
list_members List organization members
get_organization_member Get member details
search_members Search members
list_roles List roles

Repository Operations

Command Description
get_repository Get repository details
list_repositories List repositories

repo_id parameter format (general)

All commands supporting the repo_id parameter support two formats:

Format Example Description
Numeric ID 5822285 The numeric ID of the repository
URL-Encoder path abcyun%2Fabc-fed-common%2Fabc-nestjs-lib Encoded namespace/group/repoName

Supported commands:

  • Repository operations: get_repository
  • Branch operations: get_branch, create_branch, delete_branch, list_branches
  • File operations: get_file, create_file, update_file, delete_file, list_files
  • Code comparison: compare
  • MR operations: get_change_request, create_merge_request, close_merge_request, merge_change_request, reopen_change_request, review_change_request, update_change_request, get_change_request_tree, create_merge_request_comment, list_merge_request_comments, delete_change_request_comment, update_change_request_comment, list_merge_request_patch_sets

Usage Examples:

# 方式1: 使用数字 ID
python scripts/codeup.py get_repository --org_id 62d62893487c500c27f72e36 --repo_id 5822285

# 方式2: 使用 URL-Encoder 编码路径
python scripts/codeup.py get_repository \
    --org_id 62d62893487c500c27f72e36 \
    --repo_id abcyun%2Fabc-fed-common%2Fabc-nestjs-lib

# 分支操作也支持
python scripts/codeup.py list_branches \
    --org_id 62d62893487c500c27f72e36 \
    --repo_id abcyun%2Fabc-fed-common%2Fabc-nestjs-lib

# 文件操作也支持
python scripts/codeup.py get_file \
    --org_id 62d62893487c500c27f72e36 \
    --repo_id abcyun%2Fabc-fed-common%2Fabc-nestjs-lib \
    --file_path README.md \
    --branch master

Usage Scenarios: When the user provides a repository URL (such as https://codeup.aliyun.com/abcyun/abc-fed-common/abc-nestjs-lib/change/1), the LLM can:

  1. Extract path: abcyun/abc-fed-common/abc-nestjs-lib
  2. URL-encode / as %2F: abcyun%2Fabc-fed-common%2Fabc-nestjs-lib
  3. Directly call any command without first querying repo_id

Branch Operations

Command Description
get_branch Get branch details
create_branch Create branch
delete_branch Delete branch
list_branches List branches

File Operations

Command Description
get_file Get file content
create_file Create file
update_file Update file
delete_file Delete file
list_files List file tree
compare Compare code differences

Merge Requests

Command Description
get_change_request Get MR details
list_merge_requests List MRs
create_merge_request Create MR
close_merge_request Close MR
merge_change_request Merge MR
reopen_change_request Reopen a closed MR
review_change_request Review MR (approve/reject)
update_change_request Update MR information
get_change_request_tree Get MR changed file list
create_merge_request_comment Add MR comment
list_merge_request_comments List MR comments
delete_change_request_comment Delete MR comment
update_change_request_comment Update MR comment
list_merge_request_patch_sets List MR patch sets

Usage examples

Query organization information

# 获取当前用户
python scripts/codeup.py get_current_user

# 列出用户所属组织(获取 org_id)
python scripts/codeup.py list_organizations

Organization member management

# 列出部门
python scripts/codeup.py list_departments --org_id 62d62893487c500c27f72e36

# 获取部门详情
python scripts/codeup.py get_department --org_id 62d62893487c500c27f72e36 --dept_id 68d910db15dfc6c8604fccb4

# 列出所有成员
python scripts/codeup.py list_members --org_id 62d62893487c500c27f72e36

# 获取成员详情
python scripts/codeup.py get_organization_member --org_id 62d62893487c500c27f72e36 --member_id 639fe0e38d9a873a30aad3df

# 搜索成员
python scripts/codeup.py search_members --org_id 62d62893487c500c27f72e36 --query "姓名"

# 列出角色
python scripts/codeup.py list_roles --org_id 62d62893487c500c27f72e36

Repository and branch management

# 列出仓库
python scripts/codeup.py list_repositories --org_id 62d62893487c500c27f72e36

# 获取仓库详情
python scripts/codeup.py get_repository --org_id 62d62893487c500c27f72e36 --repo_id 5822285

# 列出分支
python scripts/codeup.py list_branches --org_id 62d62893487c500c27f72e36 --repo_id 5822285

# 创建分支
python scripts/codeup.py create_branch \
    --org_id 62d62893487c500c27f72e36 \
    --repo_id 5822285 \
    --branch_name feature/new-feature \
    --source_branch master

# 删除分支
python scripts/codeup.py delete_branch \
    --org_id 62d62893487c500c27f72e36 \
    --repo_id 5822285 \
    --branch_name feature/old-feature

File operations

# 获取文件内容
python scripts/codeup.py get_file \
    --org_id 62d62893487c500c27f72e36 \
    --repo_id 5822285 \
    --file_path README.md \
    --branch master

# 创建文件
python scripts/codeup.py create_file \
    --org_id 62d62893487c500c27f72e36 \
    --repo_id 5822285 \
    --file_path docs/new-doc.md \
    --content "# 新文档\n\n这是内容" \
    --branch feature/new-feature \
    --message "Add new documentation"

# 更新文件
python scripts/codeup.py update_file \
    --org_id 62d62893487c500c27f72e36 \
    --repo_id 5822285 \
    --file_path README.md \
    --content "# 更新后的内容" \
    --message "Update README"

# 列出文件
python scripts/codeup.py list_files \
    --org_id 62d62893487c500c27f72e36 \
    --repo_id 5822285 \
    --path src \
    --branch master

# 对比代码
python scripts/codeup.py compare \
    --org_id 62d62893487c500c27f72e36 \
    --repo_id 5822285 \
    --from feature/new-feature \
    --to master

Merge request management

# 列出 MR
python scripts/codeup.py list_merge_requests \
    --org_id 62d62893487c500c27f72e36 \
    --repo_id 5822285

# 列出打开的 MR
python scripts/codeup.py list_merge_requests \
    --org_id 62d62893487c500c27f72e36 \
    --repo_id 5822285 \
    --state opened

# 获取 MR 详情
python scripts/codeup.py get_change_request \
    --org_id 62d62893487c500c27f72e36 \
    --repo_id 5822285 \
    --local_id 584

# 创建 MR
python scripts/codeup.py create_merge_request \
    --org_id 62d62893487c500c27f72e36 \
    --repo_id 5822285 \
    --title "Feature: 新功能" \
    --source_branch feature/new-feature \
    --target_branch master \
    --description "实现用户登录功能"

# 关闭 MR
python scripts/codeup.py close_merge_request \
    --org_id 62d62893487c500c27f72e36 \
    --repo_id 5822285 \
    --local_id 584

# 添加 MR 评论
python scripts/codeup.py create_merge_request_comment \
    --org_id 62d62893487c500c27f72e36 \
    --repo_id 5822285 \
    --local_id 584 \
    --content "代码审查通过"

# 列出 MR 评论
python scripts/codeup.py list_merge_request_comments \
    --org_id 62d62893487c500c27f72e36 \
    --repo_id 5822285 \
    --local_id 584

# 列出 MR 补丁集(提交)
python scripts/codeup.py list_merge_request_patch_sets \
    --org_id 62d62893487c500c27f72e36 \
    --repo_id 5822285 \
    --local_id 584

# 合并 MR
python scripts/codeup.py merge_change_request \
    --org_id 62d62893487c500c27f72e36 \
    --repo_id 5822285 \
    --local_id 584 \
    --merge_type "no-fast-forward" \
    --remove_source_branch

# 重新打开已关闭的 MR
python scripts/codeup.py reopen_change_request \
    --org_id 62d62893487c500c27f72e36 \
    --repo_id 5822285 \
    --local_id 584

# 审查 MR(批准)
python scripts/codeup.py review_change_request \
    --org_id 62d62893487c500c27f72e36 \
    --repo_id 5822285 \
    --local_id 584 \
    --review_opinion PASS \
    --review_comment "代码审查通过"

# 审查 MR(拒绝)
python scripts/codeup.py review_change_request \
    --org_id 62d62893487c500c27f72e36 \
    --repo_id 5822285 \
    --local_id 584 \
    --review_opinion NOT_PASS \
    --review_comment "需要修复单元测试"

# 更新 MR 标题
python scripts/codeup.py update_change_request \
    --org_id 62d62893487c500c27f72e36 \
    --repo_id 5822285 \
    --local_id 584 \
    --title "新的 MR 标题"

# 获取 MR 变更文件列表
python scripts/codeup.py get_change_request_tree \
    --org_id 62d62893487c500c27f72e36 \
    --repo_id 5822285 \
    --local_id 584 \
    --from_patch_set_id patch_set_1 \
    --to_patch_set_id patch_set_2

# 删除 MR 评论
python scripts/codeup.py delete_change_request_comment \
    --org_id 62d62893487c500c27f72e36 \
    --repo_id 5822285 \
    --local_id 584 \
    --comment_biz_id 682d5c6d8a3b400a8c4b1234

# 更新 MR 评论
python scripts/codeup.py update_change_request_comment \
    --org_id 62d62893487c500c27f72e36 \
    --repo_id 5822285 \
    --local_id 584 \
    --comment_biz_id 682d5c6d8a3b400a8c4b1234 \
    --content "更新后的评论内容"

Common commands quick reference

# 组织成员
python scripts/codeup.py list_members --org_id 62d62893487c500c27f72e36
python scripts/codeup.py search_members --org_id 62d62893487c500c27f72e36 --query "姓名"

# 仓库操作
python scripts/codeup.py list_repositories --org_id 62d62893487c500c27f72e36
python scripts/codeup.py list_branches --org_id 62d62893487c500c27f72e36 --repo_id 5822285

# 文件操作
python scripts/codeup.py get_file --org_id 62d62893487c500c27f72e36 --repo_id 5822285 --file_path README.md

# MR 操作
python scripts/codeup.py list_merge_requests --org_id 62d62893487c500c27f72e36 --repo_id 5822285 --state opened
python scripts/codeup.py get_change_request --org_id 62d62893487c500c27f72e36 --repo_id 5822285 --local_id 584

How to use Claude

When the user needs to interact with Yunxiao:

  1. Get org_id: first call list_organizations to get the organization list, and select the target organization
  2. Get repo_id:
    • Method 1: call list_repositories to list repositories, and select the target repository to get its numeric ID
    • Method 2: extract namespace/group(可选)/repoNamefrom the URL or path provided by the user, then use,
  3. Build command: build the corresponding parameters according to the requirement
  4. Execute script: run using the Bash tool
  5. Process results: parse the output and analyze the data

Example workflow:

用户: "查看当前组织的成员列表"

Claude:
1. python scripts/codeup.py list_organizations  # 获取 org_id
2. python scripts/codeup.py list_members --org_id $ORG_ID  # 列出成员
3. 分析返回结果并展示

Frequently asked questions

1. How to get org_id and repo_id?

# 列出用户所属组织(包含 org_id)
python scripts/codeup.py list_organizations

# 列出仓库(包含 repo_id)
python scripts/codeup.py list_repositories --org_id 62d62893487c500c27f72e36

2. What should I do if permissions are insufficient?

Ensure the access token has the corresponding permissions:

  • Repository read permission: view repositories, branches, files
  • Repository write permission: create/update/delete files, create branches
  • MR management permission: create/update MRs, add comments

3. Merge request status values

Status Description
opened Open
closed Closed
merged Merged

File structure

codeup/
├── SKILL.md
├── references/
│   ├── code-management.md          # 代码管理 API 参考
│   └── organization-management.md  # 组织管理 API 参考
└── scripts/
    ├── codeup.py              # 统一入口脚本(34个子命令)
    ├── codeup_client.py       # Codeup API 客户端
    └── requirements.txt       # 依赖:requests>=2.28.0