Skip to content

Add RPCs for package documentation tools #868

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 8, 2025

Conversation

jmcphers
Copy link
Contributor

@jmcphers jmcphers commented Jul 7, 2025

This change ports some package documentation tools from the btw package into ark, exposing them as RPCs that we can call from Positron (where we'll hook them up to language model tool calls).

Specifically, the changes from btw are as follows:

  • remove dependency on tidyverse (dplyr, etc.) by rewriting transformations in base R
  • return plain-text results rather than throwing errors in most cases
  • remove dependency on rmarkdown by bundling the needed pandoc conversion bits

Source for most RPCs: https://github.com/posit-dev/btw/blob/main/R/tool-docs.R

Part of posit-dev/positron#8016.

Copy link
Contributor

@lionel- lionel- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not do a deep review as this is mostly ported code and I'm not super familiar with the help system. But it looks good and I've tested the various RPCs. Only thing to note is that an error message has an interpolation bug:

.ps.rpc.get_help_page("list5", "rlang")
#> [1] "No help page found for topic list5 in package {.pkg {package_name}}."

@jmcphers Do you think it would be helpful for the rmarkdown and btw package to implement the tools used here in standalone files? These look like this: https://github.com/r-lib/rlang/blob/main/R/standalone-purrr.R

Since the standalone file is in the original repo and has clear dependency goals (for example only base R) that the maintainer abides to, this makes it easy to update upstream changes from downstream. We even have tooling for updating these files that manages dependencies (standalone files may depend on other standalone files): https://usethis.r-lib.org/reference/use_standalone.html.

@jmcphers
Copy link
Contributor Author

jmcphers commented Jul 8, 2025

an error message has an interpolation bug:

Thanks, fixed in 27b3fbb!

Do you think it would be helpful for the rmarkdown and btw package to implement the tools used here in standalone files?

Yes, it would be helpful! I didn't know about this mechanism.

@jmcphers jmcphers merged commit cfdee4e into main Jul 8, 2025
6 checks passed
@jmcphers jmcphers deleted the feature/llm-package-doc-tools branch July 8, 2025 18:03
@github-actions github-actions bot locked and limited conversation to collaborators Jul 8, 2025
@lionel-
Copy link
Contributor

lionel- commented Jul 10, 2025

@jmcphers I suggested implementing in standalone files in:

posit-dev/btw#78
rstudio/rmarkdown#2596

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants