---
description: Show detailed information about a specific bug
argument-hint: <bug-id>
allowed-tools: Bash, Read
---

# Show Bug Details: $ARGUMENTS

## Phase 0: Parse Arguments

Extract from `$ARGUMENTS`:

- **bug-id**: Required bug ID to display

**If no bug-id provided:**

- Error: "❌ Bug ID required. Usage: /bug:show <bug-id>"
- Suggestion: "Use /bug:list to see all bugs"
- Exit with status 1

## Phase 1: Read Bug File

### 1.1 Validate File Exists

````bash
test -f .bugs.local.md || { echo "⚠️  No bugs found. Create one with: /bug <summary>"; exit 0; }
```text

### 1.2 Parse Bug File

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

Parse both summary table and detailed sections.

## Phase 2: Find Bug

### 2.1 Search by ID

Look for bug in:

1. Summary table row (extract basic info)
2. Detailed report section (extract full details)

### 2.2 Validate Bug Exists

**If bug not found:**

```text
❌ Bug #[id] not found

Available bugs:
  #1 - Selective tool install not working
  #2 - Documentation needs update
  #3 - Error handling missing

Use /bug:list for full list
```text

Exit with status 1

## Phase 3: Format Output

### 3.1 Bug Header

```text
═══════════════════════════════════════════════════════════
🐛 Bug #[ID]: [Summary]
═══════════════════════════════════════════════════════════
```text

### 3.2 Status and Metadata

```text
Status:       [status] [status-emoji]
Priority:     [priority] [priority-emoji]
Resolution:   [resolution]

Created:      [creation-date]
Updated:      [last-update-date]
Age:          [days-since-creation] days
```text

**Emoji indicators:**

- Status: Open 🔴, Ready 🟡, In Progress 🔵, Resolved 🟢, Closed ⚪, Rejected ⚫
- Priority: Low ➖, Medium ⚠️, High 🔥, Critical 💥, Blocker 🚫

### 3.3 Repository Context

```text
Repository Context:
  Branch:       [branch-name]
  Project:      [project-type]
  Framework:    [framework]
  Commit:       [commit-hash]
  Remote:       [git-remote-url]
```text

### 3.4 Task References

If Task Reference column has entries:

```text
Related Tasks:
  • Task Master: #26 (link to task if accessible)
  • Jira: PROJ-123 (clickable link if URL format)
  • GitHub: #456 (clickable link if URL format)
```text

### 3.5 Description

```text
Description:
─────────────────────────────────────────────────────────
[Full description from detailed section]
─────────────────────────────────────────────────────────
```text

### 3.6 Details Section

If `<details>` section exists in bug report:

```text
Technical Details:
─────────────────────────────────────────────────────────
[Content from details section, formatted]
─────────────────────────────────────────────────────────
```text

### 3.7 Triage History

If triage notes exist:

```text
Triage History:
  • [YYYY-MM-DD]: [triage note 1]
  • [YYYY-MM-DD]: [triage note 2]
```text

### 3.8 Activity Timeline

```text
Activity:
  • [creation-date]: Bug created
  • [date]: Status changed: Open → Ready
  • [date]: Priority changed: Medium → High
  • [date]: Assigned to Task Master #26
  • [update-date]: Last updated
```text

## Phase 4: Suggested Actions

### 4.1 Context-Aware Actions

**If status = Open or Ready:**

```text
Next Steps:
  /bug:triage [ID]    # Update status/priority
  /bug:fix [ID]       # Start working on fix
```text

**If status = In Progress:**

```text
Next Steps:
  /bug:triage [ID]    # Update status
  /bug:close [ID]     # Mark as resolved (if fix complete)
```text

**If status = Resolved:**

```text
Next Steps:
  /bug:close [ID]     # Verify and close
  /bug:triage [ID]    # Reopen if fix incomplete
```text

**If status = Closed:**

```text
This bug is closed. To reopen:
  /bug:triage [ID]
```text

### 4.2 File Navigation

```text
Quick Links:
  Edit bug: .bugs.local.md#[slug]
  View all: /bug:list
```text

Open bug in editor (scroll to bug section):

```bash
code .bugs.local.md
```text

## Phase 5: Related Information

### 5.1 Check for Related Files

If repository context available, search for related files:

```bash
# Search for issue references in code/commits
git log --all --grep="#[bug-id]" --oneline 2>/dev/null | head -5
```text

If found:

```text
Related Commits:
  • [commit-hash] - [commit-message]
  • [commit-hash] - [commit-message]
```text

### 5.2 Check for Fix Branch

If bug is In Progress or Resolved:

```bash
# Look for fix branches
git branch --all | grep -i "fix.*[bug-id]\|[bug-id].*fix" 2>/dev/null
```text

If found:

```text
Fix Branch:
  • [branch-name] (current: [current-branch])

  Switch to fix branch:
  git checkout [branch-name]
```text

## Error Handling

- **Bug ID not found**: Show available bugs, suggest /bug:list
- **File not found**: Friendly message to create first bug
- **Malformed bug data**: Show what can be parsed, note missing fields
- **Git commands fail**: Continue without git-related info
- **Invalid bug ID format**: "Bug ID must be a number"

## Exit Codes

- 0: Bug displayed successfully
- 1: Bug not found or invalid ID
- 2: File read error
````
