Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 94 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: CI

on:
push:
branches: ["main", "master"]
pull_request:
branches: ["main", "master"]

env:
CARGO_TERM_COLOR: always
RUSTFLAGS: "-D warnings"

permissions:
contents: read

jobs:
# ─────────────────────────────────────────────────────────────────────────────
# Format check
# ─────────────────────────────────────────────────────────────────────────────
fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install Rust (stable + rustfmt)
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt

- name: Check formatting
run: cargo fmt --all -- --check

# ─────────────────────────────────────────────────────────────────────────────
# Lint (clippy)
# ─────────────────────────────────────────────────────────────────────────────
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install Rust (stable + clippy)
uses: dtolnay/rust-toolchain@stable
with:
components: clippy

- name: Cache Cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: clippy-${{ hashFiles('**/Cargo.lock') }}
restore-keys: clippy-

- name: Run Clippy
run: cargo clippy --all-targets --all-features

# ─────────────────────────────────────────────────────────────────────────────
# Build + test on multiple platforms
# ─────────────────────────────────────────────────────────────────────────────
build:
name: Build · ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]

steps:
- uses: actions/checkout@v4

- name: Install Rust (stable)
uses: dtolnay/rust-toolchain@stable

- name: Cache Cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: build-${{ matrix.os }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: build-${{ matrix.os }}-

- name: Build
run: cargo build --locked

- name: Test
run: cargo test --locked
3 changes: 3 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ jobs:
mkdir "$STAGING"
cp target/${{ matrix.target }}/release/mineru "$STAGING/"
cp README.md "$STAGING/"
cp skill/SKILL.md "$STAGING/"
tar czf "${STAGING}.tar.gz" "$STAGING"
echo "ASSET=${STAGING}.tar.gz" >> "$GITHUB_ENV"

Expand All @@ -106,6 +107,7 @@ jobs:
New-Item -ItemType Directory $staging
Copy-Item "target\${{ matrix.target }}\release\mineru.exe" "$staging\"
Copy-Item "README.md" "$staging\"
Copy-Item "skill\SKILL.md" "$staging\"
Compress-Archive -Path "$staging\*" -DestinationPath "$staging.zip"
"ASSET=$staging.zip" | Out-File -FilePath $env:GITHUB_ENV -Append

Expand Down Expand Up @@ -152,6 +154,7 @@ jobs:
dl/x86_64/mineru
lipo -info "$STAGING/mineru"
cp README.md "$STAGING/"
cp skill/SKILL.md "$STAGING/"
tar czf "${STAGING}.tar.gz" "$STAGING"
echo "ASSET=${STAGING}.tar.gz" >> "$GITHUB_ENV"

Expand Down
92 changes: 73 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# mineru-cli

[![CI](https://github.com/neipor/mineru-cli/actions/workflows/ci.yml/badge.svg)](https://github.com/neipor/mineru-cli/actions/workflows/ci.yml)
[![Release](https://github.com/neipor/mineru-cli/actions/workflows/release.yml/badge.svg)](https://github.com/neipor/mineru-cli/actions/workflows/release.yml)
[![Latest Release](https://img.shields.io/github/v/release/neipor/mineru-cli)](https://github.com/neipor/mineru-cli/releases/latest)
[![License: MIT](https://img.shields.io/badge/license-MIT-blue)](LICENSE)

A Rust CLI tool that extracts text from **PDFs, images, and Office documents** using the [MinerU OCR](https://huggingface.co/spaces/opendatalab/MinerU) HuggingFace Space, and outputs **LLM-friendly Markdown** (or JSON / plain text).

```
Expand All @@ -22,23 +27,69 @@ echo "$(mineru scan.pdf)" | llm summarize

## Installation

### Prebuilt binaries (recommended)
### One-liner install (macOS / Linux — recommended)

Download from [GitHub Releases](https://github.com/neipor/mineru-cli/releases/latest):
These commands download the binary and place it in `/usr/local/bin/` so it is
immediately available on your `PATH`.

| Platform | File |
|---|---|
| macOS Apple Silicon | `mineru-aarch64-apple-darwin.tar.gz` |
| macOS Intel | `mineru-x86_64-apple-darwin.tar.gz` |
| macOS Universal | `mineru-universal-apple-darwin.tar.gz` |
| Linux x86_64 | `mineru-x86_64-unknown-linux-musl.tar.gz` |
| Linux ARM64 | `mineru-aarch64-unknown-linux-musl.tar.gz` |
| Windows x86_64 | `mineru-x86_64-pc-windows-msvc.zip` |
```bash
# macOS — Universal binary (Intel + Apple Silicon)
curl -fsSL https://github.com/neipor/mineru-cli/releases/latest/download/mineru-universal-apple-darwin.tar.gz \
| tar -xz --strip-components=1 -C /usr/local/bin/ mineru-*/mineru
chmod +x /usr/local/bin/mineru && mineru --version
```

```bash
# Linux x86_64 (static musl binary, no libc dependency)
curl -fsSL https://github.com/neipor/mineru-cli/releases/latest/download/mineru-x86_64-unknown-linux-musl.tar.gz \
| tar -xz --strip-components=1 -C /usr/local/bin/ mineru-*/mineru
chmod +x /usr/local/bin/mineru && mineru --version
```

```bash
# macOS Apple Silicon
curl -L https://github.com/neipor/mineru-cli/releases/latest/download/mineru-aarch64-apple-darwin.tar.gz \
| tar -xz -C /usr/local/bin/
# Linux ARM64 (Raspberry Pi 4/5, AWS Graviton, Oracle Ampere, …)
curl -fsSL https://github.com/neipor/mineru-cli/releases/latest/download/mineru-aarch64-unknown-linux-musl.tar.gz \
| tar -xz --strip-components=1 -C /usr/local/bin/ mineru-*/mineru
chmod +x /usr/local/bin/mineru && mineru --version
```

> **No root?** Replace `/usr/local/bin/` with `$HOME/.local/bin/` and ensure
> `export PATH="$HOME/.local/bin:$PATH"` is in your `~/.bashrc` / `~/.zshrc`.

### Windows (PowerShell)

```powershell
$ver = (Invoke-RestMethod "https://api.github.com/repos/neipor/mineru-cli/releases/latest").tag_name
$url = "https://github.com/neipor/mineru-cli/releases/download/$ver/mineru-$ver-x86_64-pc-windows-msvc.zip"
Invoke-WebRequest -Uri $url -OutFile "$env:TEMP\mineru.zip"
Expand-Archive "$env:TEMP\mineru.zip" -DestinationPath "$env:TEMP\mineru-pkg" -Force

# Install to %LOCALAPPDATA%\Programs\mineru and add to PATH
$dest = "$env:LOCALAPPDATA\Programs\mineru"
New-Item -ItemType Directory -Force $dest | Out-Null
Copy-Item "$env:TEMP\mineru-pkg\*\mineru.exe" $dest
$cur = [Environment]::GetEnvironmentVariable("Path","User")
if ($cur -notlike "*$dest*") {
[Environment]::SetEnvironmentVariable("Path","$cur;$dest","User")
Write-Host "Restart your terminal to use mineru."
}
& "$dest\mineru.exe" --version
```

### cargo install (requires Rust 1.85+)

```bash
# Install from crates.io — binary lands in ~/.cargo/bin/ (already on PATH)
cargo install mineru-cli

# Or build from source
git clone https://github.com/neipor/mineru-cli.git
cd mineru-cli
cargo build --release
# System-wide:
sudo cp target/release/mineru /usr/local/bin/
# User-level (no root):
cp target/release/mineru ~/.local/bin/
```

### OpenClaw / ClawHub
Expand All @@ -49,13 +100,16 @@ openclaw skills install mineru-ocr-cli
clawhub install mineru-ocr-cli
```

### Build from source (requires Rust 1.85+)
### Available binaries

```bash
git clone https://github.com/neipor/mineru-cli.git
cd mineru-cli && cargo build --release
cp target/release/mineru /usr/local/bin/
```
| Platform | Architecture | File |
|---|---|---|
| macOS Universal | Intel + Apple Silicon | `mineru-*-universal-apple-darwin.tar.gz` |
| macOS | Apple Silicon (M1/M2/M3/M4) | `mineru-*-aarch64-apple-darwin.tar.gz` |
| macOS | Intel | `mineru-*-x86_64-apple-darwin.tar.gz` |
| Linux | x86_64 (static musl) | `mineru-*-x86_64-unknown-linux-musl.tar.gz` |
| Linux | ARM64 (static musl) | `mineru-*-aarch64-unknown-linux-musl.tar.gz` |
| Windows | x86_64 | `mineru-*-x86_64-pc-windows-msvc.zip` |

## 🌐 Network (China mainland / restricted regions)

Expand Down
Loading
Loading