--- name: issues description: Create and Manage issues in Gitea dependencies: tea --- # Issue Management Comprehensive guide for managing Gitea issues using the tea CLI. ## Table of Contents - [Viewing Issues](#viewing-issues) - [Creating Issues](#creating-issues) - [Updating Issues](#updating-issues) - [Closing and Reopening Issues](#closing-and-reopening-issues) - [Labels](#labels) - [Milestones](#milestones) - [Projects](#projects) - [Search and Filtering](#search-and-filtering) - [Common Workflows](#common-workflows) ## Viewing Issues ### ls issues ```bash # ls open issues in current repository tea issue ls --repo thatguygriff/walkies # ls all issues (open and closed) tea issue ls --state all --repo thatguygriff/walkies # Limit number of results tea issue ls --limit 50 --repo thatguygriff/walkies # Filter by label tea issue ls --labels bug --repo thatguygriff/walkies tea issue ls --labels "help wanted,good first issue" --repo thatguygriff/walkies # Filter by assignee tea issue ls --assignee @me --repo thatguygriff/walkies tea issue ls --assignee username --repo thatguygriff/walkies # Filter by milestone tea issue ls --milestones "v1.0" --repo thatguygriff/walkies # Get JSON output (use --fields to select columns) tea issue ls --output json --fields number,title,state,labels,assignees --repo thatguygriff/walkies ``` ### View specific issue ```bash # View issue details tea issue view 123 # View in browser tea issue view 123 --web # View issue comments tea issue view 123 --comments # Get JSON output tea issue view 123 --output json ``` ## Creating Issues ### Interactive creation ```bash # Create issue with interactive prompts tea issue create --repo thatguygriff/walkies # Follow prompts for: # - Title # - Body # - Metadata (labels, assignees, milestones) ``` ### Non-interactive creation ```bash # Create issue with title only tea issue create --title "Fix login bug" --repo thatguygriff/walkies # Create issue with title and body tea issue create --title "Add dark mode" --description "Users have requested dark mode support" --repo thatguygriff/walkies # Create issue with metadata tea issue create \ --title "Performance optimization" \ --description "Optimize database queries" \ --labels bug,performance \ --assignees username \ --milestone "v2.0" \ --repo thatguygriff/walkies ``` ## Updating Issues ### Edit issue ```bash # Edit issue interactively tea issue edit 123 # Update title tea issue edit 123 --title "New title" # Update body tea issue edit 123 --description "Updated description" # Add labels (flag is plural: --add-labels) tea issue edit 123 --add-labels bug,priority-high # Remove labels (flag is plural: --remove-labels) tea issue edit 123 --remove-labels wontfix # Add assignees (flag is plural: --add-assignees) tea issue edit 123 --add-assignees user1,user2 # Set milestone tea issue edit 123 --milestone "v1.5" # Remove milestone tea issue edit 123 --milestone "" ``` ### Comment on issue ```bash # Add comment — body is a positional argument, not a flag tea comment 123 "Working on this now" --repo thatguygriff/walkies # Edit comment (requires comment ID, via API) tea api repos/:owner/:repo/issues/comments/COMMENT_ID -X PATCH -f body="Updated comment" ``` ## Closing and Reopening Issues ```bash # Close issue (no --comment or --reason flags available) tea issue close 123 --repo thatguygriff/walkies # Close multiple issues for issue in 123 124 125; do tea issue close $issue --repo thatguygriff/walkies done # Reopen issue tea issue reopen 123 --repo thatguygriff/walkies # To add a comment when closing, close first then comment separately tea issue close 123 --repo thatguygriff/walkies tea comment 123 "Fixed in PR #456" --repo thatguygriff/walkies ``` ### Delete issues ```bash # Delete issue (via API - CAREFUL) tea api repos/:owner/:repo/issues/123 -X DELETE ``` ## Labels ### ls labels ```bash # ls labels in repository tea label ls --repo thatguygriff/walkies # Get JSON output tea label ls --output json --repo thatguygriff/walkies ``` ### Create labels ```bash # Create label — name is a named flag (--name), not positional tea label create --name bug --description "Something isn't working" --color d73a4a --repo thatguygriff/walkies # Create multiple labels tea label create --name enhancement --description "New feature or request" --color a2eeef --repo thatguygriff/walkies tea label create --name documentation --description "Improvements to documentation" --color 0075ca --repo thatguygriff/walkies tea label create --name "good first issue" --description "Good for newcomers" --color 7057ff --repo thatguygriff/walkies ``` ### Update labels ```bash # tea label edit does not exist — use tea label update with --id (get ID from tea label ls --output json) tea label update --id 42 --name "bug" --description "Bug report" --color ff0000 --repo thatguygriff/walkies # Rename label (change --name) tea label update --id 42 --name new-name --repo thatguygriff/walkies ``` ### Delete labels ```bash # Delete label by ID (get ID from tea label ls --output json) tea label delete --id 42 --repo thatguygriff/walkies ``` ### Manage issue labels ```bash # Add labels to issue tea issue edit 123 --add-labels bug,priority-high --repo thatguygriff/walkies # Remove labels from issue tea issue edit 123 --remove-labels wontfix --repo thatguygriff/walkies # Replace all labels (via API) tea api repos/:owner/:repo/issues/123 -X PATCH -f labels='["bug","confirmed"]' ``` ## Milestones ### ls milestones ```bash # ls milestones (via API) tea api repos/:owner/:repo/milestones | jq '.[] | {number: .number, title: .title, due_on: .due_on}' ``` ### Create milestone ```bash # Create milestone tea api repos/:owner/:repo/milestones -X POST \ -f title="v1.0" \ -f description="First major release" \ -f due_on="2024-12-31T23:59:59Z" ``` ### Update milestone ```bash # Update milestone tea api repos/:owner/:repo/milestones/1 -X PATCH \ -f title="v1.0.0" \ -f state="closed" ``` ### Delete milestone ```bash # Delete milestone tea api repos/:owner/:repo/milestones/1 -X DELETE ``` ## Projects Projects are managed via the API — `tea issue edit` does not support `--add-project` or `--remove-project`. ```bash # ls projects (via API) tea api repos/:owner/:repo/projects | jq '.[] | {name: .name, number: .number}' # ls organization projects tea api orgs/:org/projects | jq '.[] | {name: .name, number: .number}' ``` ## Search and Filtering Search uses `--keyword` / `-k`, not `--search`. ```bash # Filter by keyword in title/body tea issue ls --keyword "authentication" --repo thatguygriff/walkies # Filter by label + keyword tea issue ls --labels bug --keyword "login" --repo thatguygriff/walkies # Filter by assignee + state tea issue ls --assignee @me --state open --repo thatguygriff/walkies # Filter by milestone tea issue ls --milestones "v2.0" --repo thatguygriff/walkies # Filter by date range tea issue ls --from "2024-01-01" --until "2024-12-31" --repo thatguygriff/walkies ``` ### Filter with JSON output Pipe `--output json` to `jq` for advanced filtering — there is no `--jq` flag. ```bash # Get open issues as JSON and filter with jq tea issue ls --output json --repo thatguygriff/walkies \ | jq '.[] | select(.labels[].name == "bug")' # Count issues by label tea issue ls --state all --output json --repo thatguygriff/walkies \ | jq '[.[] | .labels[].name] | group_by(.) | map({label: .[0], count: length})' # Find untriaged issues (no labels) tea issue ls --output json --repo thatguygriff/walkies \ | jq '.[] | select(.labels | length == 0) | {number: .number, title: .title}' ``` ## Common Workflows ### Workflow 1: Bug report workflow ```bash # Create bug report tea issue create \ --title "Login fails with 2FA enabled" \ --description "$(cat < issues.csv ``` ## Tips and Best Practices 1. **Label systematically**: Develop a consistent labeling scheme 2. **Triage regularly**: Review and label new issues promptly 3. **Link PRs**: Always reference issues in PR descriptions 4. **Use milestones**: Group related issues for release planning 5. **Assign clearly**: Assign issues to specific people 6. **Comment updates**: Keep stakeholders informed with comments 7. **Use --output json + jq**: Combine for powerful filtering and reporting 8. **Get label IDs first**: `tea label update` and `tea label delete` require `--id`, not name — run `tea label ls --output json` to find IDs ## Quick Reference ```bash # List tea issue ls # ls open issues tea issue ls --state all # ls all issues tea issue ls --labels bug # Filter by label (plural flag) tea issue ls --assignee @me # Your issues tea issue ls --keyword "auth" # Search by keyword # View tea issue view 123 # View issue details tea issue view 123 --web # Open in browser tea issue view 123 --comments # Include comments # Create tea issue create # Interactive creation tea issue create --title "text" --description "text" # Non-interactive tea issue create --labels bug --assignees user # With metadata (both plural) # Update tea issue edit 123 --title "new title" # Change title tea issue edit 123 --add-labels bug # Add label (plural flag) tea issue edit 123 --remove-labels wontfix # Remove label (plural flag) tea issue edit 123 --add-assignees user # Add assignee (plural flag) # Comment (tea comment, not tea issue comment) tea comment 123 "comment text" --repo thatguygriff/walkies # Close/Reopen (no --comment or --reason flags; add comment separately) tea issue close 123 # Close issue tea issue reopen 123 # Reopen issue # Labels tea label ls # ls labels tea label create --name "bug" --color d73a4a # Create (--name flag required) tea label update --id 42 --name new-name # Update (--id required, not name) tea label delete --id 42 # Delete (--id required, not name) ```