Skip to contents

Interactive helper that picks the right backend for the host and walks through prerequisites. Two paths:

Usage

hal_setup(force = FALSE, quiet = FALSE, backend = NULL)

Arguments

force

Logical; re-run setup even if the backend is already ready.

quiet

Logical; suppress progress messages.

backend

Optional backend override ("vscode", "copilot", "claude"). When NULL, picks vscode in Positron and copilot elsewhere.

Value

Invisibly TRUE if the backend transport is available after setup, FALSE otherwise.

Details

  • Positron (recommended): installs the hal-bridge extension from the VSIX bundled with hal, so hal talks to vscode.lm directly. No Node.js, no Copilot CLI, no GitHub CLI, no download – the only requirement is that you are signed in to GitHub Copilot inside Positron itself (the account menu in the lower left).

  • Other hosts (RStudio, VS Code, command-line R): installs the GitHub Copilot CLI (gh copilot extension preferred, npm @github/copilot fallback).

  • Claude Code: verifies the claude CLI and points at the download and one-time sign-in. hal does not install this one for you: Claude Code's sign-in is an interactive browser flow, and installing it via npm yields a shim whose output is unreliable when driven from R.

Detection is via POSITRON_VERSION. Pass backend = "copilot" to force the Copilot CLI path inside Positron, or backend = "claude" to check the Claude Code CLI instead.

Examples

if (FALSE) { # \dontrun{
hal_setup()                          # auto: vscode in Positron, copilot elsewhere
hal_setup(backend = "copilot")       # force the Copilot CLI path
hal_setup(backend = "claude")        # check the Claude Code CLI
} # }