Add gitea-cli project skill
This commit is contained in:
117
.claude/skills/gitea-cli/SKILL.md
Normal file
117
.claude/skills/gitea-cli/SKILL.md
Normal file
@@ -0,0 +1,117 @@
|
||||
---
|
||||
name: gitea-cli
|
||||
description: |
|
||||
Use this skill whenever you need to interact with Gitea: creating pull requests,
|
||||
listing issues, managing branches, checking PR status, or any other Gitea repo
|
||||
operations in this project. The CLI tool is `tea`, already configured with login
|
||||
`allanjsouza` pointing to `gitea.allanjsouza.cloud`. Use this skill any time the
|
||||
user mentions PRs, pull requests, issues, Gitea, or asks you to open/create/list
|
||||
anything on the remote repo — even if they don't say "tea" explicitly.
|
||||
---
|
||||
|
||||
# Gitea CLI Skill (`tea`)
|
||||
|
||||
Gitea instance: `gitea.allanjsouza.cloud`
|
||||
Login configured: `allanjsouza`
|
||||
Repo remote: `ssh://git@gitea.allanjsouza.cloud:2222/allanjsouza/ctgwf.git`
|
||||
|
||||
## Critical: No-TTY Mode
|
||||
|
||||
`tea` tries to open an interactive TTY for some operations. This always fails in
|
||||
Claude Code. Always pass all required fields as flags — never rely on interactive
|
||||
prompts. When in doubt, check `tea <cmd> -h` and supply every required flag
|
||||
explicitly.
|
||||
|
||||
## Creating a Pull Request
|
||||
|
||||
```bash
|
||||
tea pulls create \
|
||||
--title "feat: short description" \
|
||||
--description "$(cat <<'EOF'
|
||||
## Summary
|
||||
- bullet 1
|
||||
- bullet 2
|
||||
|
||||
## Test plan
|
||||
- [ ] item
|
||||
EOF
|
||||
)" \
|
||||
--base main \
|
||||
--head <current-branch>
|
||||
```
|
||||
|
||||
Key flags:
|
||||
- `--base` — target branch (usually `main`)
|
||||
- `--head` — source branch (current feature branch; defaults to current if omitted)
|
||||
- `--title` — PR title (follow repo commit style: `type: description`)
|
||||
- `--description` — PR body (use a heredoc to avoid quoting issues)
|
||||
- `--assignees allanjsouza` — optionally assign to user
|
||||
- `--labels "label1,label2"` — optionally add labels
|
||||
|
||||
**Always verify the current branch before creating a PR:**
|
||||
```bash
|
||||
git branch --show-current
|
||||
```
|
||||
|
||||
**Push the branch first if not yet on remote:**
|
||||
```bash
|
||||
git push -u origin <branch>
|
||||
```
|
||||
|
||||
## Listing PRs
|
||||
|
||||
```bash
|
||||
tea pulls list # open PRs
|
||||
tea pulls list --state all # all PRs
|
||||
tea pulls list --output json # JSON output
|
||||
```
|
||||
|
||||
## Listing Issues
|
||||
|
||||
```bash
|
||||
tea issues list # open issues
|
||||
tea issues list --state all
|
||||
```
|
||||
|
||||
## Other Useful Commands
|
||||
|
||||
```bash
|
||||
tea pulls list --fields index,title,state,author,updated
|
||||
tea repo # show repo info
|
||||
tea branches list # list branches
|
||||
tea comment <issue-index> --body "…" # add comment
|
||||
```
|
||||
|
||||
## Advanced API Operations (Review)
|
||||
|
||||
`tea api` handles the construction of a JSON body when using `-f` (string) and `-F` (typed) flags. It also automatically replaces `{owner}` and `{repo}` placeholders with values from the current repository context.
|
||||
|
||||
### Fetch PR Diff
|
||||
```bash
|
||||
tea api /repos/<owner>/<repo>/pulls/<index>.diff
|
||||
```
|
||||
|
||||
### Submit a Review with Comments
|
||||
```bash
|
||||
tea api -X POST /repos/<owner>/<repo>/pulls/<index>/reviews \
|
||||
-f "body=Automated Review" \
|
||||
-f "event=COMMENT" \
|
||||
-F "comments=@-" <<'EOF'
|
||||
[
|
||||
{
|
||||
"path": "app/models/user.rb",
|
||||
"body": "Suggestion content",
|
||||
"new_position": 42,
|
||||
"old_position": 0
|
||||
}
|
||||
]
|
||||
EOF
|
||||
```
|
||||
|
||||
## Workflow for PR Creation
|
||||
|
||||
1. Confirm all changes are committed: `git status`
|
||||
2. Push branch: `git push -u origin <branch>`
|
||||
3. Build PR title from commit history: `git log main.. --oneline`
|
||||
4. Create PR with `tea pulls create` (all flags explicit, no prompts)
|
||||
5. Return the PR URL from the `tea` output
|
||||
Reference in New Issue
Block a user