---
description: List all bugs from .bugs.local.md with filtering options
argument-hint: [--status=<status>] [--priority=<priority>] [--open]
allowed-tools: Bash, Read
---

# List Bugs: $ARGUMENTS

## Phase 0: Parse Arguments

Extract from `$ARGUMENTS`:

- **--status=<status>**: Filter by status (Open, Rejected, Ready, In Progress, Resolved, Closed)
- **--priority=<priority>**: Filter by priority (Low, Medium, High, Critical, Blocker)
- **--open**: Shortcut for --status=Open (default if no filters)

**Default behavior** (no args): Show all bugs with status != Closed

## Phase 1: Read Bug File

### 1.1 Check for Bug File

````bash
test -f .bugs.local.md
```text

**If .bugs.local.md NOT found:**

- Error: "⚠️  No bugs file found. Create your first bug with: /bug <summary>"
- Exit with status 0 (not an error condition)

### 1.2 Read and Parse File

```bash
cat .bugs.local.md
```text

- Parse summary table rows
- Extract: Issue ID, Summary, Status, Priority, Resolution, Task Reference
- Skip header row and separator row

## Phase 2: Apply Filters

### 2.1 Filter by Status

If `--status` specified:

- Match exact status value (case-insensitive)
- Empty result is valid (show "No bugs match filter")

If `--open` flag:

- Filter to Status = "Open" only

Default (no filter):

- Show all bugs where Status != "Closed"

### 2.2 Filter by Priority

If `--priority` specified:

- Match exact priority value (case-insensitive)
- Can combine with status filter

### 2.3 Sort Results

- By bug ID (numerical order)
- Newest first or oldest first (maintain consistency with table order)

## Phase 3: Format Output

### 3.1 Summary Statistics

```text
📋 Bug List
Total: [total-count] | Open: [open-count] | In Progress: [in-progress-count] | Resolved: [resolved-count]
```text

If filters applied:

```text
Filters: Status=[status] | Priority=[priority]
Showing [filtered-count] of [total-count] bugs
```text

### 3.2 Bug List Table

```text
ID  | Status      | Priority | Resolution          | Summary
----|-------------|----------|---------------------|----------------------------
1   | Open        | High     | Under Investigation | Selective tool install not working
2   | In Progress | Medium   | Unresolved          | Documentation needs update
3   | Resolved    | Low      | Fixed               | Typo in README
```text

### 3.3 Task Master References

For bugs with Task Master references, show indicator:

```text
ID  | Status | Priority | Summary                          | Tasks
----|--------|----------|----------------------------------|-------
1   | Open   | High     | Selective install not working    | TM:#26
2   | Ready  | Medium   | Add error handling               | TM:#27, Jira:ABC-123
```text

### 3.4 Quick Actions

```text
Quick Actions:
  /bug:show <id>       # View full details
  /bug:triage <id>     # Update status/priority
  /bug:close <id>      # Close a bug
  /bug:fix <id>        # Start working on fix

  /bug <summary>       # Create new bug
```text

## Phase 4: Interactive Selection (Optional)

If bug list is < 20 items, offer interactive selection:

```text
? Select bug for details: (Use arrow keys, Enter to view, q to quit)
❯ #1 - Selective tool install not working (Open, High)
  #2 - Documentation needs update (In Progress, Medium)
  #3 - Typo in README (Resolved, Low)
```text

On selection: Run `/bug:show <selected-id>`

## Error Handling

- **File not found**: Show friendly message to create first bug
- **Malformed table**: Show warning, attempt to parse valid rows
- **Invalid filter value**: Show available options, continue with no filter
- **Empty result**: "No bugs match your filters. Try /bug:list with different filters."

## Exit Codes

- 0: Success (even if empty results)
- 1: File read error
- 2: Parse error that prevents any output
````
