Skip to content

unfuck

by official

Other

Analyze and repair corrupted files by detecting and fixing encoding issues, merge conflicts, malformed JSON/XML, mixed line endings, and truncation. Examines input to identify problems and applies appropriate corrections.

utility text debugging
# unfuck

Analyze and repair corrupted files by detecting and fixing encoding issues, merge conflicts, malformed JSON/XML, mixed line endings, and truncation. Examines input to identify problems and applies appropriate corrections.

## Installation

This is a CmdForge tool. Once installed via CmdForge, it's available as a command-line executable.

## Usage

The `unfuck` tool accepts input via pipe and outputs the repaired content:

```bash
# Repair a corrupted JSON file
cat broken.json | unfuck > fixed.json

# Fix encoding issues in text
echo "Some text with ��� encoding problems" | unfuck

# Repair a file with merge conflicts
cat conflicted.txt | unfuck > resolved.txt

# Fix malformed XML
echo "<root><tag>unclosed</root>" | unfuck

# Clean up mixed line endings
cat messy_file.txt | unfuck > clean_file.txt
```

## Arguments

This tool takes no arguments.

## How It Works

The `unfuck` tool processes input through a three-step pipeline:

1. **detect_issues** (code): Analyzes the input to identify corruption types including encoding errors, merge conflicts, malformed JSON/XML, mixed line endings, and truncation
2. **apply_basic_fixes** (code): Applies automated corrections for common issues like line ending normalization, basic encoding fixes, and structural repairs
3. **intelligent_repair** (prompt via claude-sonnet): Uses AI to intelligently repair complex corruption that requires contextual understanding, such as completing truncated content or resolving ambiguous merge conflicts

The tool returns the fully repaired content to stdout.

## Dependencies

No external dependencies required.

No reviews yet.

Issues

No issues reported for this tool.