92 lines
1.9 KiB
Markdown
92 lines
1.9 KiB
Markdown
# gitea-pr-review
|
|
|
|
> English documentation | 中文: [README.md](./README.md)
|
|
|
|
`gitea-pr-review` fetches Gitea Pull Requests and converts them into LLM-friendly documents.
|
|
|
|
## Features
|
|
|
|
- Fetch core PR context: title, status, branches, commit list, and basic diff stat
|
|
- Preserve review/comment/reply content in full
|
|
- Two output formats:
|
|
- `markdown`: ready for direct LLM input
|
|
- `json`: structured output for automation and post-processing
|
|
- Re-render Markdown from existing JSON without calling Gitea again
|
|
|
|
## Build
|
|
|
|
```bash
|
|
cargo build --release
|
|
# binary: target/release/gitea-pr-review
|
|
```
|
|
|
|
## Environment Variables
|
|
|
|
Required for the `fetch` subcommand:
|
|
|
|
- `GITEA_PR_CLI_API_TOKEN`
|
|
- `GITEA_PR_CLI_URL` (for example: `https://gitea.com`)
|
|
- `GITEA_PR_CLI_REPO` (for example: `Origami404/aaa`)
|
|
|
|
## Usage
|
|
|
|
### 1) Fetch from Gitea (`fetch`)
|
|
|
|
```bash
|
|
# default: markdown to stdout
|
|
gitea-pr-review fetch <pr-index>
|
|
|
|
# json to stdout
|
|
gitea-pr-review fetch <pr-index> --format json
|
|
|
|
# write to file
|
|
gitea-pr-review fetch <pr-index> --out pr.md
|
|
gitea-pr-review fetch <pr-index> --format json --out pr.json
|
|
```
|
|
|
|
### 2) Render Markdown from JSON (`render-md`)
|
|
|
|
```bash
|
|
# to stdout
|
|
gitea-pr-review render-md --in pr.json
|
|
|
|
# to file
|
|
gitea-pr-review render-md --in pr.json --out pr.md
|
|
```
|
|
|
|
## Markdown Output Shape (Example)
|
|
|
|
````md
|
|
# <repo> `#<pr-index>` <pr-title>
|
|
|
|
## Metadata
|
|
|
|
### Commits
|
|
- <sha-short> <title> (<author>, <date>)
|
|
|
|
### Diff Stat
|
|
total: <files_changed> files, +<additions>, -<deletions>
|
|
- <file-path>: +<additions>, -<deletions>
|
|
|
|
## Review 1 (<review-state>)
|
|
> <reviewer>
|
|
|
|
### Comment 1.1
|
|
<file>:<line>
|
|
<user>:
|
|
```md
|
|
<original comment body>
|
|
```
|
|
|
|
### Reply 1.1.1
|
|
<user>:
|
|
```md
|
|
<original reply body>
|
|
```
|
|
````
|
|
|
|
## Notes
|
|
|
|
- Output goes to `stdout` by default; use `--out` to write a file.
|
|
- The renderer preserves markdown-heavy comment bodies safely by adjusting code fences when needed.
|