| Title: | Context-Aware AI Assistant for 'RStudio' |
| Version: | 1.0.0 |
| Description: | A context-aware AI assistant for 'RStudio' that works directly in the source editor without switching context or opening a separate chat window. Reads the cursor position and selection to automatically choose the right action - generate, complete, continue, edit, or comment. Supports configuration of multiple large language model providers and can be invoked via the keyboard shortcut or Addins menu. |
| URL: | https://vdwulp.github.io/codriver/ |
| BugReports: | https://github.com/vdwulp/codriver/issues |
| License: | MIT + file LICENSE |
| Encoding: | UTF-8 |
| Config/roxygen2/version: | 8.0.0 |
| Config/roxygen2/markdown: | TRUE |
| Config/testthat/edition: | 3 |
| VignetteBuilder: | knitr |
| SystemRequirements: | RStudio (>= 2026.04, https://posit.co/download/rstudio-desktop/) |
| Depends: | R (≥ 4.0.0) |
| Imports: | cli, ellmer (≥ 0.3.0), jsonlite, rlang, rstudio.prefs (≥ 0.1.6), rstudioapi (≥ 0.19.0) |
| Suggests: | testthat (≥ 3.0.0), glue, knitr, rmarkdown, withr |
| NeedsCompilation: | no |
| Packaged: | 2026-08-03 13:40:03 UTC; wulps |
| Author: | S.A. van der Wulp [aut, cre, cph] |
| Maintainer: | S.A. van der Wulp <vdwulp@gmail.com> |
| Repository: | CRAN |
| Date/Publication: | 2026-08-08 12:20:02 UTC |
Context-aware AI assistant for RStudio
Description
Inspects the current editor context — cursor position and any selection — and automatically chooses and executes one of five modes: complete, continue, generate, edit, or comment. Results are presented as ghost text or an edit suggestion directly in the source editor.
Usage
codriver()
Details
Codriver is intended to be invoked via a keyboard shortcut Ctrl+/
(default) or the RStudio Addins menu, not called directly. Use
codriver_configure() to set up a provider and register the recommended
shortcut before first use.
Value
Returns TRUE invisibly on success. Returns FALSE invisibly if
RStudio is not available, no configuration is found, or the mode cannot be
resolved.
See Also
-
codriver_configure()to set up the LLM provider and recommended keyboard shortcut -
vignette("getting-started-with-codriver")for extended information on configuring codriver -
vignette("start-using-codriver")for an overview of modes and result presentation
Configure codriver
Description
Set up the AI provider that codriver uses to generate and edit R code and comments. The configuration is saved locally and validated immediately by making a test call to the provider.
Usage
codriver_configure(name, ...)
Arguments
name |
Character. Provider name passed to |
... |
Named arguments passed to the ellmer constructor, such as
|
Details
Pass any arguments supported by the underlying ellmer::chat() constructor
directly via name and ....
If no keyboard shortcut is registered for codriver, the function offers to
register the default shortcut Ctrl+/. Shortcut registration is strongly
recommended but can be skipped or changed later via Tools >
Modify Keyboard Shortcuts in RStudio.
Value
Returns TRUE invisibly on successful provider configuration.
Returns FALSE invisibly if RStudio is not available or provider
validation fails.
See Also
-
vignette("getting-started-with-codriver")for extended information on configuring codriver -
vignette("start-using-codriver")for an overview of modes and result presentation -
ellmer::chat()and supported providers at https://ellmer.tidyverse.org/index.html#providers
Examples
## Not run:
codriver_configure("openai", model = "gpt-4o")
codriver_configure("openai_compatible/mistral", base_url = "http://localhost:1234/v1")
## End(Not run)