Repository navigation
feat: --json for jh package info, dependency and dependents - #69
Merged
Merged
Conversation
This was referenced Oct 14, 2026
pankgeorg
marked this pull request as ready for review
October 14, 2026 17:15
Each prints only a JSON document on stdout, 2-space indented with a trailing
newline, like `jh package search --json`:
- `info`: `{"results": [...], "total": N}`, the same document as
`package search --json`, holding the exact matches (one per registry); no
match gives an empty `results`.
- `dependency`: `{"name", "version", "registry", "dependencies": [...]}`;
`--indirect` adds the indirect dependencies, each entry carries `direct`.
- `dependents`: `{"name", "version", "registry", "direct", "indirect",
"total", "dependents": [...]}`; the counts always cover every dependent,
and `dependents` lists the indirect ones only with `--indirect`.
`getPackageInfo` now collects the matches (REST, then GraphQL) and prints
once, and `writeJSON` is shared by every package JSON document. Errors from
these three commands go to stderr, so stdout holds only the document.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…json details The REST listing already returns `owner`, `is_app`, `is_dyad` and `downloads_timeseries`, but `RESTPackage` dropped them (it decoded a `downloads.count` the API does not send). `restToInfo` now carries them, with `downloads_30d` as the sum of the 30 daily counts, so `jh package search --verbose`/`--json` show them too. `jh package info` also fetches the stable version's pkg.json for each match and prints its homepage, release date, dependency and dependent counts, contributors and docs build type. In `--json` these are under `details`, together with the daily download counts and the full contributor list. If pkg.json cannot be fetched, a warning goes to stderr and the listing fields are still printed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- `info` (and `search --verbose`) print a card per package: a header line `name vX · registry · owner`, the description, then aligned fields with thousands separators, a 30-day download sparkline, a link to the package's JuliaHub page and an install hint. - `search` prints an aligned table with STARS and DL/30 DAYS columns; the OWNER separator and VERSION column used to be wider than their headers. Long names and descriptions are cut at rune boundaries with "…". - `dependency` and `dependents` print the same heading and direct/indirect/total counts, with standard libraries shown as `stdlib`. `dependency` lists each package once: `deps` can hold a package as both direct and indirect, and `splitDependencies` keeps one entry per UUID (direct wins), in `--json` too. Bold and dim styling is used only when stdout is a terminal, `NO_COLOR` is unset and `TERM` is not `dumb`. The helpers live in `style.go`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Prints a single line with the counts, e.g.
JuMP v1.32.1 · General: 9 direct · 40 indirect · 49 total dependencies
`--short` cannot be combined with `--json`.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
pankgeorg
force-pushed
the
feat/package-json
branch
from
October 15, 2026 15:13
ab8c358 to
e177fe1
Compare
pankgeorg
added a commit
that referenced
this pull request
Oct 15, 2026
Each prints only a JSON document on stdout, 2-space indented with a trailing
newline:
- `info`: `{"results": [...], "total": N}` holding the exact matches (one
per registry); no match gives an empty `results`.
- `dependency`: `{"name", "version", "registry", "dependencies": [...]}`;
`--indirect` adds the indirect dependencies, each entry carries `direct`.
- `dependents`: `{"name", "version", "registry", "direct", "indirect",
"total", "dependents": [...]}`; the counts always cover every dependent,
and `dependents` lists the indirect ones only with `--indirect`.
`getPackageInfo` now collects the matches (REST, then GraphQL) and prints
once. Errors from these three commands go to stderr, so stdout holds only the
document.
Backport of #69 (6186cca) to the 0.4 line, which has no
`jh package search --json`.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
krynju
approved these changes
Oct 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
--jsontojh package info,jh package dependencyandjh package dependents. Each prints only a JSON document on stdout, 2-space indented with a trailing newline, asjh package search --jsonalready does; errors from these commands now go to stderr.info:{"results": [...], "total": N}, the same document aspackage search --json, holding the exact matches (one per registry); no match gives{"results": [], "total": 0}.dependency:{"name", "version", "registry", "dependencies": [...]};--indirectadds the indirect dependencies, and each entry carriesdirect.dependents:{"name", "version", "registry", "direct", "indirect", "total", "dependents": [...]}; the counts always cover every dependent, anddependentslists the indirect ones only with--indirect.getPackageInfonow collects matches (REST, then the GraphQL fallback) and prints once, andwriteJSONis shared by every package JSON document. Checked against juliahub.com:info JuMP --json,dependency JuMP --json [--indirect](9 / 57 entries),dependents JuMP --json [--indirect](335 direct, 94 indirect, 429 total; 335 / 429 listed), a missing package, and an error (empty stdout, exit 1).#67 is on
mainand this branch is rebased onto it.This PR also carries #70 (
jh package infoshows downloads, owner and the package'spkg.jsondetails) and #72 (clearer text output for thejh packagecommands,--shortfordependencyanddependents), which were approved and merged into this branch; their descriptions cover those changes. The branch holds one commit per feature, and its tree is identical to the approved head of #72.