doc: doc the --json option

This commit is contained in:
2026-04-17 20:04:32 -04:00
parent e870fe280a
commit 76580fc4a2
3 changed files with 259 additions and 17 deletions
+43 -4
View File
@@ -180,14 +180,53 @@ cat path/to/library/papers/.../logs/mineru.log
## Machine-Readable Output
Most commands support `--json` output for automation:
Most commands support `--json` output for automation and integration:
```bash
paperlib list --json
paperlib show <paper-id> --json
# Get library configuration in JSON
paperlib status --json
# List all papers with metadata
paperlib list --json
# Get detailed paper information
paperlib show <paper-id> --json
# Get import results
paperlib import --arxiv 2212.06340 --json
# Get conversion status and results
paperlib convert --json
paperlib convert --paper-id <paper-id> --json
# Get reindexing statistics
paperlib reindex --json
```
### JSON Output Format
All JSON responses follow a consistent envelope format:
```json
{
"success": true,
"timestamp": "2024-01-15T10:30:00.000Z",
"data": { /* command-specific data */ }
}
```
For errors:
```json
{
"success": false,
"timestamp": "2024-01-15T10:30:00.000Z",
"error": "Error message here",
"error_code": 1
}
```
This structured output enables reliable automation, scripting, and integration with other tools. The JSON format is stable across paperlib versions.
## Development
paperlib is designed for extensibility and integration with higher-level tools.
@@ -238,7 +277,7 @@ paperlib follows clean architecture principles:
- [x] Comprehensive test suite
- [ ] Search command implementation
- [ ] AI summarization with provider abstraction
- [ ] JSON output for all commands
- [x] JSON output for core commands
- [ ] Configuration file support
- [ ] Advanced arXiv workflows