---
description: Merge a completed feature branch
argument-hint: <feature-slug>
allowed-tools: Bash
---

Merge feature: $ARGUMENTS

## Instructions

### 1. Check Merge Readiness

```bash
sdlc feature show $ARGUMENTS --json
```

Verify that:
- All required artifacts are approved (review, audit, qa_results)
- No blockers exist
- The feature is in the `merge` phase

### 2. Check Branch Status

```bash
sdlc query ready
```

Confirm the feature appears in the ready-to-merge list.

### 3. Run Final Tests

```bash
go test ./... -v 2>&1 | tee /tmp/merge-test-output.txt
```

All tests must pass before merge.

### 4. Execute the Merge

```bash
sdlc merge $ARGUMENTS
```

This command atomically:
- Checks out the main branch
- Merges (or squashes) the feature branch
- Updates the branch manifest
- Transitions the feature to the `released` phase

### 5. Report

Confirm the merge completed successfully:
- Feature name and slug
- Final phase: `released`
- All gates that were passed

If the merge fails, report the error and do not retry without user guidance.

## Critical Rules

- NEVER merge without all required gates passed
- ALWAYS run tests immediately before merging
- ALWAYS report merge conflicts or failures to the user
- NEVER force a merge past failing checks
- NEVER merge if the classifier says the feature is not ready
