Commit d0569cc
authored
Add pkg_detail RPC for packages pane detail editor (#1291)
Adds a `.ps.rpc.pkg_detail(name)` RPC that returns cheap, kernel-local detail
metadata for a single installed package. Positron's new package detail editor
calls this when a package is opened.
The RPC reads the installed package's `DESCRIPTION` via
`utils::packageDescription(...)` and returns a named list with:
- `name`
- `dependencyCount` - count of `Depends` + `Imports` + `LinkingTo`, excluding
base packages and `R` itself
- `title` - the `Title` field (when present)
- `author` - `Maintainer`, falling back to `Author` (when present)
- `license` - the `License` field (when present)
- `sourceRepository` - the `Repository` field, e.g. "CRAN" (when present)
- `publishedDate` - the `Date/Publication` field (when present)
It returns `NULL` for an empty name or a package that isn't installed. No Rust
change is needed - the generic `.ps.rpc.<method>` dispatch in
`crates/ark/src/ui/ui_comm.rs` already routes it.
Companion Positron work: **posit-dev/positron#12926** (the package detail
editor, which adds the `getPackageDetail` package-manager hook that calls this
RPC). The Positron PR will bump the ark submodule to this change once merged.
Positron PR: posit-dev/positron#14440
## QA
In an R session:
```r
.ps.rpc.pkg_detail("utils") # base pkg: name/title/author/license, dependencyCount 0
.ps.rpc.pkg_detail("dplyr") # CRAN pkg: + sourceRepository, publishedDate, dependencyCount > 0
.ps.rpc.pkg_detail("nope") # NULL
```1 parent 881e84a commit d0569cc
1 file changed
Lines changed: 69 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
118 | 187 | | |
119 | 188 | | |
120 | 189 | | |
| |||
0 commit comments