mirror of
https://github.com/jackwener/OpenCLI.git
synced 2026-09-14 18:25:42 +08:00
498ad3930c
Six new public-API sites — package registries + Docker images + OpenAlex
scholarly works — all unauthenticated, no browser required.
dockerhub search image
rubygems search gem
homebrew formula cask popular
packagist search package
maven search artifact
openalex search work
Conventions held:
- access: 'read' on every command
- typed errors (ArgumentError / EmptyResultError / CommandExecutionError)
instead of generic CliError or silent fallback
- input validators per site (image slugs, gem names, Composer names,
Maven coordinates, OpenAlex work-id / DOI normalization)
- listing rows carry an id-shaped column (image / gem / token / package /
coordinate / id) that round-trips into the corresponding detail command
- HTTP 429 surfaces with retry hint, 404 → EmptyResultError
Audits:
- check:typed-error-lint → no new violations (baseline 196)
- check:silent-column-drop → no new violations (baseline 103)
- advise:listing-id-pairing → unchanged at 13
2.6 KiB
2.6 KiB
OpenAlex
Mode: 🌐 Public · Domain: api.openalex.org
Search and inspect scholarly Works (papers, preprints, books) on OpenAlex without auth or browser. Two commands.
Commands
| Command | Description |
|---|---|
opencli openalex search <query> |
Search OpenAlex Works by keyword |
opencli openalex work <id> |
Single Work — metadata + reconstructed abstract |
Usage Examples
# Free-text search
opencli openalex search transformers --limit 10
opencli openalex search "open access scholarly" --limit 5
# Single Work by OpenAlex id (use `id` from search rows)
opencli openalex work W2741809807
# Single Work by DOI (raw or full URL)
opencli openalex work 10.7717/peerj.4375
opencli openalex work https://doi.org/10.7717/peerj.4375
# JSON output
opencli openalex search transformers -f json
opencli openalex work W2741809807 -f json
Output Columns
| Command | Columns |
|---|---|
search |
rank, id, title, year, citations, firstAuthor, venue, openAccess, type, doi, url |
work |
id, title, type, year, date, language, authors, venue, citations, openAccess, openAccessUrl, referencedCount, doi, abstract, url |
The id column from search round-trips into work exactly. work accepts an OpenAlex Work id, a raw DOI, or any openalex.org / doi.org URL.
Options
openalex search
| Option | Description |
|---|---|
query (positional) |
Search text |
--limit |
Max Works (1-200, default: 20) |
openalex work
| Option | Description |
|---|---|
id (positional) |
OpenAlex Work id (W2741809807), DOI (10.7717/peerj.4375), or full URL |
Caveats
- Work id input is validated upfront — only
W…IDs / DOIs /openalex.org/doi.orgURLs are accepted; OpenAlex itself does the canonicalization for DOIs. Bad input raisesArgumentError. - The
abstractcolumn is reconstructed from OpenAlex'sabstract_inverted_index(token → positions) — this is how OpenAlex distributes abstracts for licensing reasons. It's the verbatim abstract text. - Set
OPENALEX_MAILTO=you@example.comto opt into the OpenAlex polite pool (faster + more reliable). Optional — anonymous requests still work. - OpenAlex
select=rejects unknown fields. The adapter pins a vetted field list (primary_location,open_access,authorships, etc.) to avoid passing aliases that 400. - OpenAlex throttles unauthenticated traffic;
HTTP 429surfaces as a typedCommandExecutionErrorwith a retry hint.
Prerequisites
- No browser required — uses
api.openalex.org/works.