diff --git a/docs/skills/SKILLS-INDEX.md b/docs/skills/SKILLS-INDEX.md index 5c09934..d233b92 100644 --- a/docs/skills/SKILLS-INDEX.md +++ b/docs/skills/SKILLS-INDEX.md @@ -72,6 +72,33 @@ --- +### tea-cli +**Location:** `docs/skills/tea-cli/` +**Source:** skill.fish +**Triggers:** Gitea, tea CLI, issues, pull requests, releases, repositories + +**Purpose:** Official Gitea CLI for command-line operations + +**What It Covers:** +- **SKILL.md** — Quick reference and common commands +- **references/authentication.md** — Login and token setup +- **references/commands.md** — Complete command reference +- **references/workflows.md** — Common workflow patterns + +**Read This When:** +- Managing Gitea issues from command line +- Creating/reviewing pull requests +- Publishing releases with assets +- Scripting Gitea operations +- CI/CD integration with Gitea + +**Firefrost Context:** +- Gitea instance: git.firefrostgaming.com +- Token: (see project instructions) +- Main repos: firefrost-operations-manual, firefrost-services, firefrost-website + +--- + ### task-creation **Location:** `docs/skills/task-creation/SKILL.md` **Triggers:** New task, task status, "add to backlog", task frontmatter, priority, creating tasks @@ -437,6 +464,12 @@ docs/skills/ │ └── youtube-automation.md ├── stripe-best-practices/ │ └── SKILL.md +├── tea-cli/ +│ ├── SKILL.md +│ └── references/ +│ ├── authentication.md +│ ├── commands.md +│ └── workflows.md └── discord-automation/ (skill collection) ├── README.md ├── discord-create-channel.md diff --git a/docs/skills/tea-cli/SKILL.md b/docs/skills/tea-cli/SKILL.md new file mode 100644 index 0000000..efe1ee3 --- /dev/null +++ b/docs/skills/tea-cli/SKILL.md @@ -0,0 +1,91 @@ +--- +name: tea-cli +description: Use when interacting with Gitea via command line - managing issues, PRs, releases, repos, or any git forge operations with tea CLI +--- + +# Tea CLI for Gitea + +## Overview + +Tea is the official CLI for Gitea. Use it for quick operations, scripting, and CI/CD workflows. For complex automation or custom integrations, use the `gitea:go-sdk` skill instead. + +## Quick Setup + +```bash +# Install +brew install tea # or: go install code.gitea.io/tea@latest + +# Authenticate +tea login add --name myserver --url https://gitea.example.com --token YOUR_TOKEN +``` + +See `references/authentication.md` for detailed auth options. + +## Quick Reference + +| Task | Command | +|------|---------| +| **Issues** | | +| List issues | `tea issues` | +| Create issue | `tea issues create --title "Bug" --body "Details"` | +| Close issue | `tea issues close 123` | +| **Pull Requests** | | +| List PRs | `tea pr` | +| Create PR | `tea pr create --head feature --base main` | +| Checkout PR | `tea pr checkout 45` | +| Merge PR | `tea pr merge 45` | +| Review PR | `tea pr review 45 --approve` | +| **Releases** | | +| List releases | `tea releases` | +| Create release | `tea release create --tag v1.0.0 --title "Release"` | +| Upload asset | `tea release assets create --tag v1.0.0 FILE` | +| **Repos** | | +| List repos | `tea repos` | +| Create repo | `tea repos create --name myrepo` | +| Clone repo | `tea clone owner/repo` | +| Fork repo | `tea repos fork owner/repo` | + +## Command Categories + +See `references/commands.md` for complete command reference: +- Issues & comments +- Pull requests & reviews +- Releases & assets +- Repositories & branches +- Labels, milestones, organizations +- Webhooks, notifications, time tracking +- Actions (secrets/variables) + +## Common Workflows + +See `references/workflows.md` for patterns: +- Feature branch to merged PR +- Release with assets +- Issue triage +- Multi-instance management + +## Output Formats + +```bash +tea issues --output json # JSON +tea issues --output yaml # YAML +tea issues --output csv # CSV +tea issues --output simple # Plain text +``` + +## Repository Context + +Tea auto-detects repo from current directory's git remote. Override with: +```bash +tea issues --repo owner/repo +tea issues --login myserver # specific Gitea instance +``` + +## Common Mistakes + +| Problem | Solution | +|---------|----------| +| "not logged in" | Run `tea login add` first | +| Wrong repo context | Use `--repo owner/repo` flag | +| Can't find PR | Check `--state` flag (open/closed/all) | +| Token expired | Re-run `tea login add` with new token | diff --git a/docs/skills/tea-cli/references/authentication.md b/docs/skills/tea-cli/references/authentication.md new file mode 100644 index 0000000..ef60823 --- /dev/null +++ b/docs/skills/tea-cli/references/authentication.md @@ -0,0 +1,93 @@ +# Tea CLI Authentication + +## Token Creation + +1. Open Gitea web UI +2. Go to **Settings → Applications** +3. Under "Generate New Token", enter a name +4. Select scopes (or leave empty for full access) +5. Click **Generate Token** +6. Copy the token immediately (shown only once) + +## Adding a Login + +```bash +# Interactive +tea login add + +# Non-interactive +tea login add \ + --name myserver \ + --url https://gitea.example.com \ + --token ghp_xxxxxxxxxxxx + +# With SSH key authentication +tea login add \ + --name myserver \ + --url https://gitea.example.com \ + --ssh-key ~/.ssh/id_ed25519 +``` + +## Managing Logins + +```bash +tea login list # List all logins +tea login default myserver # Set default +tea login edit myserver # Modify login +tea login delete myserver # Remove login +``` + +## Environment Variables + +```bash +export GITEA_SERVER_URL=https://gitea.example.com +export GITEA_SERVER_TOKEN=your_token + +# Or per-command +GITEA_SERVER_TOKEN=xxx tea issues +``` + +## Multiple Instances + +```bash +# Add multiple servers +tea login add --name work --url https://git.work.com --token xxx +tea login add --name personal --url https://gitea.io --token yyy + +# Switch between them +tea issues --login work +tea pr --login personal + +# Set default +tea login default work +``` + +## OAuth Flow + +```bash +# Browser-based OAuth +tea login add --name myserver --url https://gitea.example.com + +# Refresh expired OAuth token +tea login oauth-refresh myserver +``` + +## CI/CD Usage + +```yaml +# GitHub Actions example +- name: Create PR + env: + GITEA_SERVER_URL: ${{ secrets.GITEA_URL }} + GITEA_SERVER_TOKEN: ${{ secrets.GITEA_TOKEN }} + run: tea pr create --head ${{ github.ref_name }} --base main +``` + +## Troubleshooting + +| Issue | Solution | +|-------|----------| +| "401 Unauthorized" | Token expired or invalid - regenerate | +| "no login" | Run `tea login add` first | +| Wrong server | Check `tea login list`, use `--login name` | +| SSH auth fails | Ensure key is added to Gitea account | diff --git a/docs/skills/tea-cli/references/commands.md b/docs/skills/tea-cli/references/commands.md new file mode 100644 index 0000000..dca0a97 --- /dev/null +++ b/docs/skills/tea-cli/references/commands.md @@ -0,0 +1,254 @@ +# Tea CLI Command Reference + +## Global Flags + +All commands support: +``` +--login, -l Use specific login +--repo, -r Override repository (owner/repo) +--output, -o Output format: table|csv|simple|tsv|yaml|json +``` + +--- + +## Issues + +```bash +tea issues # List open issues +tea issues --state all # All issues +tea issues --state closed # Closed only +tea issues --mine # Assigned to me +tea issues --author username # By author +tea issues --labels bug,urgent # With labels +tea issues --milestones v1.0 # In milestone + +tea issues create \ + --title "Title" \ + --body "Description" \ + --labels bug,priority \ + --assignees user1,user2 \ + --milestone "v1.0" + +tea issues edit 123 --title "New title" +tea issues close 123 +tea issues reopen 123 + +# View issue details +tea issues 123 +``` + +## Pull Requests + +```bash +tea pr # List open PRs +tea pr --state all +tea pr --author username + +tea pr create \ + --head feature-branch \ + --base main \ + --title "Add feature" \ + --body "Description" + +tea pr edit 45 --title "Updated title" +tea pr close 45 +tea pr reopen 45 + +# Checkout PR locally +tea pr checkout 45 +tea pr clean # Remove checked-out PR branches + +# Reviews +tea pr review 45 --approve +tea pr review 45 --reject --body "Needs changes" +tea pr review 45 --comment --body "Looking good" +tea pr approve 45 # Shorthand +tea pr reject 45 + +# Merge +tea pr merge 45 # Default merge +tea pr merge 45 --style rebase +tea pr merge 45 --style squash + +# View PR details +tea pr 45 +``` + +## Releases + +```bash +tea releases # List releases +tea release 1 # View release details + +tea release create \ + --tag v1.0.0 \ + --title "Version 1.0" \ + --note "Release notes here" \ + --draft \ + --prerelease + +tea release edit 1 --title "New title" +tea release delete 1 + +# Assets +tea release assets 1 # List assets +tea release assets create 1 ./dist/app.zip +tea release assets delete 1 asset-id +``` + +## Repositories + +```bash +tea repos # List your repos +tea repos --type owner # Owned repos +tea repos --type member # Member repos +tea repos search query # Search repos + +tea repos create \ + --name myrepo \ + --description "Description" \ + --private \ + --init # Initialize with README + +tea repos create-from-template \ + --template owner/template \ + --name newrepo + +tea repos fork owner/repo +tea repos fork owner/repo --name myfork + +tea repos migrate \ + --clone-addr https://github.com/owner/repo \ + --repo-name imported + +tea repos delete owner/repo + +# Clone +tea clone owner/repo +tea clone owner/repo --depth 1 +``` + +## Branches + +```bash +tea branches # List branches +tea branches --output json + +tea branches protect main # Protect branch +tea branches unprotect main +``` + +## Labels + +```bash +tea labels # List labels +tea labels create \ + --name bug \ + --color "#ff0000" \ + --description "Bug reports" + +tea labels update bug --color "#cc0000" +tea labels delete bug +``` + +## Milestones + +```bash +tea milestones # List milestones +tea ms # Alias + +tea milestones create \ + --title "v1.0" \ + --description "First release" \ + --deadline 2024-12-31 + +tea milestones close 1 +tea milestones reopen 1 +tea milestones delete 1 +tea milestones issues 1 # Issues in milestone +``` + +## Organizations + +```bash +tea orgs # List organizations +tea orgs create \ + --name myorg \ + --description "Organization" + +tea orgs delete myorg +``` + +## Comments + +```bash +tea comment 123 --body "Comment text" # Comment on issue #123 +tea comment 45 --body "LGTM" # Comment on PR #45 +``` + +## Notifications + +```bash +tea notifications # List notifications +tea notifications mark-read 1 # Mark as read +tea notifications mark-read --all # Mark all as read +tea notifications mark-pinned 1 # Pin notification +tea notifications unpin 1 +``` + +## Time Tracking + +```bash +tea times # List tracked times +tea times --mine # My tracked time +tea times add 123 1h30m # Add time to issue +tea times delete 123 time-id +tea times reset 123 # Reset issue time +``` + +## Webhooks + +```bash +tea webhooks # List repo webhooks +tea webhooks --org myorg # Org webhooks + +tea webhooks create \ + --url https://example.com/hook \ + --events push,pull_request \ + --secret mysecret + +tea webhooks update 1 --url https://new.url +tea webhooks delete 1 +``` + +## Actions (CI/CD) + +```bash +# Secrets +tea actions secrets # List secrets +tea actions secrets create \ + --name SECRET_NAME \ + --value "secret-value" +tea actions secrets delete SECRET_NAME + +# Variables +tea actions variables # List variables +tea actions variables set VAR_NAME "value" +tea actions variables delete VAR_NAME +``` + +## Utility Commands + +```bash +tea whoami # Current user info +tea open # Open repo in browser +tea open 123 # Open issue #123 +tea open pulls # Open PRs page +tea open milestones # Open milestones page +``` + +## Admin Commands + +```bash +tea admin users # List all users (admin only) +``` diff --git a/docs/skills/tea-cli/references/workflows.md b/docs/skills/tea-cli/references/workflows.md new file mode 100644 index 0000000..f5c9ab7 --- /dev/null +++ b/docs/skills/tea-cli/references/workflows.md @@ -0,0 +1,170 @@ +# Tea CLI Workflows + +## Feature Branch to PR + +```bash +# 1. Create branch and make changes +git checkout -b feature/new-feature +# ... make changes ... +git add . && git commit -m "Add new feature" +git push -u origin feature/new-feature + +# 2. Create PR +tea pr create \ + --head feature/new-feature \ + --base main \ + --title "Add new feature" \ + --body "## Changes +- Added X +- Fixed Y + +## Testing +- [ ] Unit tests pass +- [ ] Manual testing done" + +# 3. Address review feedback +# ... make changes ... +git push + +# 4. Merge when approved +tea pr merge 45 --style squash +``` + +## Release Workflow + +```bash +# 1. Create and push tag +git tag -a v1.0.0 -m "Release v1.0.0" +git push origin v1.0.0 + +# 2. Create release +tea release create \ + --tag v1.0.0 \ + --title "Version 1.0.0" \ + --note "## What's New +- Feature A +- Feature B + +## Bug Fixes +- Fixed issue #42" + +# 3. Upload release assets +tea release assets create --tag v1.0.0 ./dist/app-linux-amd64 +tea release assets create --tag v1.0.0 ./dist/app-darwin-amd64 +tea release assets create --tag v1.0.0 ./dist/app-windows-amd64.exe +``` + +## Issue Triage + +```bash +# Review new issues +tea issues --state open --labels "" + +# Label and assign +tea issues edit 123 \ + --labels bug,priority-high \ + --assignees developer1 \ + --milestone v1.1 + +# Close duplicates +tea comment 124 --body "Duplicate of #123" +tea issues close 124 +``` + +## Batch Operations with Scripts + +```bash +# Close all issues with label "wontfix" +tea issues --labels wontfix --output json | \ + jq -r '.[].number' | \ + xargs -I {} tea issues close {} + +# Export all issues to CSV +tea issues --state all --output csv > issues.csv + +# Create issues from file +while IFS=, read -r title body labels; do + tea issues create --title "$title" --body "$body" --labels "$labels" +done < issues.csv +``` + +## Multi-Instance Workflow + +```bash +# Morning: Check work notifications +tea notifications --login work + +# Create issue on work instance +tea issues create --login work \ + --repo team/project \ + --title "Bug report" + +# Evening: Personal project +tea pr --login personal +``` + +## CI/CD Integration + +```yaml +# .github/workflows/pr.yml (or Gitea Actions) +name: Create PR +on: + push: + branches: [feature/*] + +jobs: + create-pr: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install tea + run: | + curl -sL https://dl.gitea.com/tea/main/tea-main-linux-amd64 -o tea + chmod +x tea + + - name: Create PR + env: + GITEA_SERVER_URL: ${{ secrets.GITEA_URL }} + GITEA_SERVER_TOKEN: ${{ secrets.GITEA_TOKEN }} + run: | + ./tea pr create \ + --head ${GITHUB_REF_NAME} \ + --base main \ + --title "Auto PR: ${GITHUB_REF_NAME}" +``` + +## PR Review Workflow + +```bash +# 1. List PRs awaiting review +tea pr --state open + +# 2. Checkout and test locally +tea pr checkout 45 +make test + +# 3. Approve or request changes +tea pr approve 45 +# or +tea pr review 45 --reject --body "Please fix the failing tests" + +# 4. Clean up after merge +tea pr clean +``` + +## Managing Labels Across Repos + +```bash +# Export labels from one repo +tea labels --output json > labels.json + +# Apply to another repo (script) +cat labels.json | jq -c '.[]' | while read label; do + name=$(echo $label | jq -r '.name') + color=$(echo $label | jq -r '.color') + desc=$(echo $label | jq -r '.description') + tea labels create --repo other/repo \ + --name "$name" --color "$color" --description "$desc" +done +```