Skip to content

Add RPCs for package documentation tools - #868

Merged
jmcphers merged 3 commits into
mainfrom
feature/llm-package-doc-tools
Jul 8, 2025
Merged

jmcphers merged 3 commits into
mainfrom
feature/llm-package-doc-tools

Conversation

@jmcphers

@jmcphers jmcphers commented Jul 7, 2025 •

Copy link
Copy Markdown
Contributor

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.

@lionel- lionel- left a comment •

Copy link
Copy Markdown
Contributor

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

jmcphers commented Jul 8, 2025

Copy link
Copy Markdown
Contributor Author

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
@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-

lionel- commented Jul 10, 2025

Copy link
Copy Markdown
Contributor

@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