- 本地化命令描述(英文→中文) - 删除未使用命令文件 - 新增 summarize-conversation 命令 - 更新 AI 模型配置为 DeepSeek - 新增 agent-browser 技能 - 重构技能目录结构(重命名)
2.7 KiB
2.7 KiB
description
| description |
|---|
| 在 Gitea 上创建新的 Git 仓库 |
Create a new Git repository on Gitea via API.
工作目录
macOS / Linux:
~/.config/gitea/
Windows:
%USERPROFILE%\.config\gitea\
配置文件从该目录加载。
User input format:
$ARGUMENTS = [<owner>/]<repo> [private|public]
Examples:
my-project- Private repo under default org or current userai/my-project- Private repo under ai organizationai/my-project public- Public repo under ai organizationusername/test private- Private repo under username
Please perform the following:
- Load configuration:
macOS / Linux:
source ~/.config/gitea/config.env
Windows PowerShell:
Get-Content "$env:USERPROFILE\.config\gitea\config.env" | ForEach-Object {
if ($_ -match '^([^=]+)=(.*)$') {
[Environment]::SetEnvironmentVariable($matches[1], $matches[2], 'Process')
}
}
- If not exists: prompt to run
/gitea-reset
-
Parse user input from
$ARGUMENTS:- Extract: owner (optional), repo (required), visibility (optional, default: private)
- If no owner specified:
- Use
GITEA_DEFAULT_ORGif set - Otherwise get current user from API:
GET /api/v1/user
- Use
- Validate repo name: only letters, numbers, underscores, hyphens, dots
-
Create repository via API:
- Try organization API first:
POST ${GITEA_URL}/api/v1/orgs/${owner}/repos Body: { "name": "${repo}", "private": true/false, "auto_init": false, "default_branch": "main" } - If 404, try user API:
POST /api/v1/user/repos - Handle response codes:
- 201: Success
- 409: Repository already exists
- 404: Owner not found or no permission
- Other: API error
- Try organization API first:
-
Extract repository info from response:
html_url- Web URLclone_url- HTTPS URLssh_url- SSH URL
-
Ask user if they want to add remote:
- Check if current directory is a git repo
- If not, ask to initialize:
git init - Check if
originremote exists - Add or update remote:
git remote add/set-url origin <clone_url>
-
Display result in Chinese:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
仓库创建成功
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
名称: [owner]/[repo]
可见性: [private/public]
Web URL: [html_url]
HTTPS URL: [clone_url]
SSH URL: [ssh_url]
Notes:
- Requires repo creation permission in token
- Organization and user repositories use different API endpoints
- Default branch is
main(notmaster)