# Release v0.7.0

## Automation & Integration - JSON Output + Commit Feedback + Git Error Suggestions

This release focuses on improving automation capabilities and developer experience with JSON output support, command-line feedback parameter, and enhanced Git error messages.

### JSON Output Format Support

All major commands now support structured JSON output, making gcop-rs easy to integrate with other tools, scripts, and CI/CD pipelines.

**New options:**
- `--format json` - Full format specification
- `--json` - Shorthand for `--format json`

**Example usage:**

```bash
# Generate commit message as JSON
$ gcop-rs commit --json
{
  "success": true,
  "data": {
    "message": "feat: add user authentication module"
  }
}

# Review changes as JSON
$ gcop-rs review changes --json
{
  "success": true,
  "data": {
    "review": "...",
    "suggestions": [...]
  }
}

# Get stats as JSON
$ gcop-rs stats --json
{
  "success": true,
  "data": {
    "total_commits": 150,
    "contributors": 3,
    ...
  }
}

# Error output in JSON format
$ gcop-rs commit --json
{
  "success": false,
  "error": {
    "code": "NO_STAGED_CHANGES",
    "message": "No staged changes found"
  }
}
```

**JSON mode behavior:**
- Automatically disables colored output and UI spinners
- `commit` command implicitly enables dry-run mode
- Errors are output in structured format with error codes

### Commit Feedback Parameter

Pass initial instructions to the commit message generator directly from the command line.

```bash
# Use conventional commits format
$ gcop-rs commit --feedback "use conventional commits format"

# Request specific language
$ gcop-rs commit --feedback "write in Chinese"

# Add specific context
$ gcop-rs commit --feedback "this is a breaking change, mention migration steps"
```

**Use cases:**
- Scripting and automation workflows
- Consistent commit message style across team
- Quick one-liner commits without interactive prompts

### Git Error Suggestions

Git errors now come with actionable suggestions to help you resolve issues quickly.

**Before v0.7.0:**
```
Error: reference 'refs/heads/main' not found
```

**After v0.7.0:**
```
Error: reference 'refs/heads/main' not found

Suggestion: The branch 'main' does not exist. Try:
  - Check available branches with `git branch -a`
  - Create the branch with `git checkout -b main`
```

**Covered error scenarios:**
- Repository state issues (dirty worktree, unborn branch)
- Merge conflicts and rebase in progress
- Authentication and permission errors
- Network and remote operation failures
- Reference not found errors

## Upgrade Notes

Upgrading from v0.6.x requires **no action**. This release is **fully backward compatible**.

**What stays the same:**
- All existing CLI options work unchanged
- Configuration file format unchanged
- Default behavior unchanged (text output)

**What's new:**
- `--json` / `--format json` options on commit, review, stats
- `--feedback` option on commit command
- Enhanced error messages with suggestions

## Breaking Changes

**None.** This is a minor release with new features only.

## Installation

```bash
# Homebrew (macOS/Linux)
brew tap AptS-1547/tap
brew upgrade gcop-rs

# pipx (Python users, recommended)
pipx upgrade gcop-rs

# cargo-binstall (no compilation)
cargo binstall gcop-rs

# cargo install (compile from source)
cargo install gcop-rs --force
```

Or download pre-built binaries from [Releases](https://github.com/AptS-1547/gcop-rs/releases).

## Statistics

- **Files changed**: 14
- **Lines added**: +590
- **Lines removed**: -165
- **Commits**: 4

## Contributors

- AptS-1547 (Yuhan Bian / 卞雨涵)
- AptS-1548 (48)

## Feedback

If you have any issues or suggestions, please submit an [Issue](https://github.com/AptS-1547/gcop-rs/issues).

---

**Full Changelog**: [v0.6.1...v0.7.0](https://github.com/AptS-1547/gcop-rs/compare/v0.6.1...v0.7.0)
