diff --git a/NAMESPACE b/NAMESPACE index 4b5b043..e33f67e 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,5 +1,6 @@ # Generated by roxygen2: do not edit by hand +export(default_allowlist) export(use_agent) export(use_ai) export(use_github_copilot) diff --git a/R/aaa-shared_params.R b/R/aaa-shared_params.R index 40a1c69..2435342 100644 --- a/R/aaa-shared_params.R +++ b/R/aaa-shared_params.R @@ -5,8 +5,8 @@ #' #' @param agents_lines (`character`) Lines of `AGENTS.md`. #' @param allowlist (`character`) Hostnames to add to the GitHub Copilot coding -#' agent firewall allowlist. Defaults to a curated set of R and GitHub -#' domains. +#' agent firewall allowlist. Defaults to [default_allowlist()], a curated set +#' of R and GitHub domains. #' @param call (`environment`) The caller environment for error messages. #' @param data (`list`) Named list of whisker template variables for rendering. #' @param fields (`character`) Field name(s) to read from `DESCRIPTION`. @@ -16,7 +16,7 @@ #' @param new_row (`character(1)`) A pre-built skill row string, as produced by #' `.make_skill_row()`. #' @param open (`logical(1)`) Whether to open the file after creation. -#' @param overwrite (`logical(1)`) Whether to overwrite an existing file. +#' @param overwrite (`logical(1)`) Whether to overwrite existing file(s). #' Defaults to `FALSE`. #' @param owner (`character(1)`) GitHub repository owner (user or organization). #' @param repo (`character(1)`) GitHub repository name. diff --git a/R/use_ai.R b/R/use_ai.R index 96a094b..21e24c4 100644 --- a/R/use_ai.R +++ b/R/use_ai.R @@ -27,19 +27,7 @@ use_ai <- function( overwrite = FALSE, open = rlang::is_interactive(), gh_token = gh::gh_token(), - allowlist = c( - "api.github.com", - "api2r.org", - "bioconductor.org", - "cloud.r-project.org", - "CRAN.R-project.org", - "docs.github.com", - "r-lib.org", - "rstudio.github.io", - "tidymodels.org", - "tidyverse.org", - "wrangle.zone" - ), + allowlist = default_allowlist(), skills = c( "create-issue", "document", diff --git a/R/use_github_copilot.R b/R/use_github_copilot.R index 9301680..7c16960 100644 --- a/R/use_github_copilot.R +++ b/R/use_github_copilot.R @@ -4,8 +4,6 @@ #' `.github/workflows/` directory. Also calls [use_github_copilot_whitelist()] #' to configure the coding agent firewall allowlist. #' -#' @param overwrite (`logical(1)`) Whether to overwrite existing files. Defaults -#' to `FALSE`. #' @inheritParams .shared-params #' @returns The path to the installed #' `.github/workflows/copilot-setup-steps.yml`, invisibly. @@ -16,19 +14,7 @@ use_github_copilot <- function( overwrite = FALSE, open = rlang::is_interactive(), - allowlist = c( - "api.github.com", - "api2r.org", - "bioconductor.org", - "cloud.r-project.org", - "CRAN.R-project.org", - "docs.github.com", - "r-lib.org", - "rstudio.github.io", - "tidymodels.org", - "tidyverse.org", - "wrangle.zone" - ), + allowlist = default_allowlist(), gh_token = gh::gh_token() ) { overwrite <- stbl::to_lgl_scalar(overwrite) diff --git a/R/use_github_copilot_whitelist.R b/R/use_github_copilot_whitelist.R index ccac918..d9aae0a 100644 --- a/R/use_github_copilot_whitelist.R +++ b/R/use_github_copilot_whitelist.R @@ -13,19 +13,7 @@ #' #' use_github_copilot_whitelist() use_github_copilot_whitelist <- function( - allowlist = c( - "api.github.com", - "api2r.org", - "bioconductor.org", - "cloud.r-project.org", - "CRAN.R-project.org", - "docs.github.com", - "r-lib.org", - "rstudio.github.io", - "tidymodels.org", - "tidyverse.org", - "wrangle.zone" - ), + allowlist = default_allowlist(), gh_token = gh::gh_token() ) { repo_parts <- .extract_repo_from_desc() @@ -43,6 +31,37 @@ use_github_copilot_whitelist <- function( invisible(NULL) } +#' Curated R and GitHub domains +#' +#' A curated set of R and GitHub domains to add to the GitHub Copilot coding +#' agent firewall allowlist, or other agent domain whitelists. +#' +#' @returns A character vector of suggested domains. +#' @export +#' +#' @examples +#' default_allowlist() +default_allowlist <- function() { + c( + "api.github.com", + "api2r.org", + "bioconductor.org", + "cloud.r-project.org", + "CRAN.R-project.org", + "docs.github.com", + "github.com", + "hadley.nz", + "r-lib.org", + "r-pkgs.org", + "r-project.org", + "rstudio.com", + "rstudio.github.io", + "tidymodels.org", + "tidyverse.org", + "wrangle.zone" + ) +} + #' Call the GitHub API to set the Copilot allowlist #' #' @inheritParams .shared-params diff --git a/man/default_allowlist.Rd b/man/default_allowlist.Rd new file mode 100644 index 0000000..29c3bad --- /dev/null +++ b/man/default_allowlist.Rd @@ -0,0 +1,18 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/use_github_copilot_whitelist.R +\name{default_allowlist} +\alias{default_allowlist} +\title{Curated R and GitHub domains} +\usage{ +default_allowlist() +} +\value{ +A character vector of suggested domains. +} +\description{ +A curated set of R and GitHub domains to add to the GitHub Copilot coding +agent firewall allowlist, or other agent domain whitelists. +} +\examples{ +default_allowlist() +} diff --git a/man/dot-check_path_writable.Rd b/man/dot-check_path_writable.Rd index da0acb5..6ee57e8 100644 --- a/man/dot-check_path_writable.Rd +++ b/man/dot-check_path_writable.Rd @@ -9,7 +9,7 @@ \arguments{ \item{path}{(\code{character(1)}) Absolute path to the file.} -\item{overwrite}{(\code{logical(1)}) Whether to overwrite an existing file. +\item{overwrite}{(\code{logical(1)}) Whether to overwrite existing file(s). Defaults to \code{FALSE}.} \item{call}{(\code{environment}) The caller environment for error messages.} diff --git a/man/dot-inform_copilot_allowlist.Rd b/man/dot-inform_copilot_allowlist.Rd index c1a877c..f98efa3 100644 --- a/man/dot-inform_copilot_allowlist.Rd +++ b/man/dot-inform_copilot_allowlist.Rd @@ -12,8 +12,8 @@ \item{repo}{(\code{character(1)}) GitHub repository name.} \item{allowlist}{(\code{character}) Hostnames to add to the GitHub Copilot coding -agent firewall allowlist. Defaults to a curated set of R and GitHub -domains.} +agent firewall allowlist. Defaults to \code{\link[=default_allowlist]{default_allowlist()}}, a curated set +of R and GitHub domains.} } \value{ \code{NULL}, invisibly. diff --git a/man/dot-path_proj_save_as.Rd b/man/dot-path_proj_save_as.Rd index 28d3ab8..0f30269 100644 --- a/man/dot-path_proj_save_as.Rd +++ b/man/dot-path_proj_save_as.Rd @@ -10,7 +10,7 @@ \item{save_as}{(\code{character(1)}) Output file path, relative to the project root.} -\item{overwrite}{(\code{logical(1)}) Whether to overwrite an existing file. +\item{overwrite}{(\code{logical(1)}) Whether to overwrite existing file(s). Defaults to \code{FALSE}.} \item{call}{(\code{environment}) The caller environment for error messages.} diff --git a/man/dot-set_copilot_allowlist.Rd b/man/dot-set_copilot_allowlist.Rd index 00cca5f..bfc042e 100644 --- a/man/dot-set_copilot_allowlist.Rd +++ b/man/dot-set_copilot_allowlist.Rd @@ -12,8 +12,8 @@ \item{repo}{(\code{character(1)}) GitHub repository name.} \item{allowlist}{(\code{character}) Hostnames to add to the GitHub Copilot coding -agent firewall allowlist. Defaults to a curated set of R and GitHub -domains.} +agent firewall allowlist. Defaults to \code{\link[=default_allowlist]{default_allowlist()}}, a curated set +of R and GitHub domains.} \item{gh_token}{(\code{character(1)}) A GitHub personal access token. Defaults to \code{gh::gh_token()}.} diff --git a/man/dot-shared-params.Rd b/man/dot-shared-params.Rd index 3cbbc6d..f454fca 100644 --- a/man/dot-shared-params.Rd +++ b/man/dot-shared-params.Rd @@ -7,8 +7,8 @@ \item{agents_lines}{(\code{character}) Lines of \code{AGENTS.md}.} \item{allowlist}{(\code{character}) Hostnames to add to the GitHub Copilot coding -agent firewall allowlist. Defaults to a curated set of R and GitHub -domains.} +agent firewall allowlist. Defaults to \code{\link[=default_allowlist]{default_allowlist()}}, a curated set +of R and GitHub domains.} \item{call}{(\code{environment}) The caller environment for error messages.} @@ -26,7 +26,7 @@ domains.} \item{open}{(\code{logical(1)}) Whether to open the file after creation.} -\item{overwrite}{(\code{logical(1)}) Whether to overwrite an existing file. +\item{overwrite}{(\code{logical(1)}) Whether to overwrite existing file(s). Defaults to \code{FALSE}.} \item{owner}{(\code{character(1)}) GitHub repository owner (user or organization).} diff --git a/man/dot-use_skill.Rd b/man/dot-use_skill.Rd index f257ae4..f44aedc 100644 --- a/man/dot-use_skill.Rd +++ b/man/dot-use_skill.Rd @@ -28,7 +28,7 @@ installed, relative to the project root. Defaults to \code{".github"}.} under a \code{skills} subdirectory of \code{target_dir}. Defaults to \code{TRUE}, producing \code{.github/skills/{skill}/SKILL.md}.} -\item{overwrite}{(\code{logical(1)}) Whether to overwrite an existing file. +\item{overwrite}{(\code{logical(1)}) Whether to overwrite existing file(s). Defaults to \code{FALSE}.} \item{open}{(\code{logical(1)}) Whether to open the file after creation.} diff --git a/man/dot-use_template_as_is.Rd b/man/dot-use_template_as_is.Rd index 415ba9e..6852c88 100644 --- a/man/dot-use_template_as_is.Rd +++ b/man/dot-use_template_as_is.Rd @@ -16,7 +16,7 @@ \item{save_as}{(\code{character(1)}) Output file path, relative to the project root.} -\item{overwrite}{(\code{logical(1)}) Whether to overwrite an existing file. +\item{overwrite}{(\code{logical(1)}) Whether to overwrite existing file(s). Defaults to \code{FALSE}.} \item{open}{(\code{logical(1)}) Whether to open the file after creation.} diff --git a/man/use_agent.Rd b/man/use_agent.Rd index 39e7860..987e109 100644 --- a/man/use_agent.Rd +++ b/man/use_agent.Rd @@ -14,7 +14,7 @@ use_agent( \item{save_as}{(\code{character(1)}) Output file path, relative to the project root.} -\item{overwrite}{(\code{logical(1)}) Whether to overwrite an existing file. +\item{overwrite}{(\code{logical(1)}) Whether to overwrite existing file(s). Defaults to \code{FALSE}.} \item{open}{(\code{logical(1)}) Whether to open the file after creation.} diff --git a/man/use_ai.Rd b/man/use_ai.Rd index bf47169..01fd672 100644 --- a/man/use_ai.Rd +++ b/man/use_ai.Rd @@ -11,9 +11,7 @@ use_ai( overwrite = FALSE, open = rlang::is_interactive(), gh_token = gh::gh_token(), - allowlist = c("api.github.com", "api2r.org", "bioconductor.org", "cloud.r-project.org", - "CRAN.R-project.org", "docs.github.com", "r-lib.org", "rstudio.github.io", - "tidymodels.org", "tidyverse.org", "wrangle.zone"), + allowlist = default_allowlist(), skills = c("create-issue", "document", "github", "implement-issue", "r-code", "search-code", "tdd-workflow") ) @@ -29,7 +27,7 @@ installed. Passed to all \verb{use_skill_*()} functions as \code{target_dir}.} under a \code{skills} subdirectory of \code{target_dir}. Defaults to \code{TRUE}, producing \code{.github/skills/{skill}/SKILL.md}.} -\item{overwrite}{(\code{logical(1)}) Whether to overwrite an existing file. +\item{overwrite}{(\code{logical(1)}) Whether to overwrite existing file(s). Defaults to \code{FALSE}.} \item{open}{(\code{logical(1)}) Whether to open the file after creation.} @@ -38,8 +36,8 @@ Defaults to \code{FALSE}.} \code{gh::gh_token()}.} \item{allowlist}{(\code{character}) Hostnames to add to the GitHub Copilot coding -agent firewall allowlist. Defaults to a curated set of R and GitHub -domains.} +agent firewall allowlist. Defaults to \code{\link[=default_allowlist]{default_allowlist()}}, a curated set +of R and GitHub domains.} \item{skills}{(\code{character}) Which skills to install. Defaults to all known skills. Pass a subset to install only specific skills, or \code{character(0)} diff --git a/man/use_github_copilot.Rd b/man/use_github_copilot.Rd index 5de6196..7276c09 100644 --- a/man/use_github_copilot.Rd +++ b/man/use_github_copilot.Rd @@ -7,21 +7,19 @@ use_github_copilot( overwrite = FALSE, open = rlang::is_interactive(), - allowlist = c("api.github.com", "api2r.org", "bioconductor.org", "cloud.r-project.org", - "CRAN.R-project.org", "docs.github.com", "r-lib.org", "rstudio.github.io", - "tidymodels.org", "tidyverse.org", "wrangle.zone"), + allowlist = default_allowlist(), gh_token = gh::gh_token() ) } \arguments{ -\item{overwrite}{(\code{logical(1)}) Whether to overwrite existing files. Defaults -to \code{FALSE}.} +\item{overwrite}{(\code{logical(1)}) Whether to overwrite existing file(s). +Defaults to \code{FALSE}.} \item{open}{(\code{logical(1)}) Whether to open the file after creation.} \item{allowlist}{(\code{character}) Hostnames to add to the GitHub Copilot coding -agent firewall allowlist. Defaults to a curated set of R and GitHub -domains.} +agent firewall allowlist. Defaults to \code{\link[=default_allowlist]{default_allowlist()}}, a curated set +of R and GitHub domains.} \item{gh_token}{(\code{character(1)}) A GitHub personal access token. Defaults to \code{gh::gh_token()}.} @@ -31,10 +29,9 @@ The path to the installed \code{.github/workflows/copilot-setup-steps.yml}, invisibly. } \description{ -Installs a \code{copilot-setup-steps.yml} workflow and its companion reusable -\code{install} action into the project's \verb{.github/workflows/} directory. Also -calls \code{\link[=use_github_copilot_whitelist]{use_github_copilot_whitelist()}} to configure the coding agent firewall -allowlist. +Installs a \code{copilot-setup-steps.yml} workflow into the project's +\verb{.github/workflows/} directory. Also calls \code{\link[=use_github_copilot_whitelist]{use_github_copilot_whitelist()}} +to configure the coding agent firewall allowlist. } \examples{ \dontshow{if (interactive()) withAutoprint(\{ # examplesIf} diff --git a/man/use_github_copilot_whitelist.Rd b/man/use_github_copilot_whitelist.Rd index 40640f5..547916a 100644 --- a/man/use_github_copilot_whitelist.Rd +++ b/man/use_github_copilot_whitelist.Rd @@ -5,16 +5,14 @@ \title{Update the GitHub Copilot coding agent firewall allowlist} \usage{ use_github_copilot_whitelist( - allowlist = c("api.github.com", "api2r.org", "bioconductor.org", "cloud.r-project.org", - "CRAN.R-project.org", "docs.github.com", "r-lib.org", "rstudio.github.io", - "tidymodels.org", "tidyverse.org", "wrangle.zone"), + allowlist = default_allowlist(), gh_token = gh::gh_token() ) } \arguments{ \item{allowlist}{(\code{character}) Hostnames to add to the GitHub Copilot coding -agent firewall allowlist. Defaults to a curated set of R and GitHub -domains.} +agent firewall allowlist. Defaults to \code{\link[=default_allowlist]{default_allowlist()}}, a curated set +of R and GitHub domains.} \item{gh_token}{(\code{character(1)}) A GitHub personal access token. Defaults to \code{gh::gh_token()}.} diff --git a/man/use_skill_create_issue.Rd b/man/use_skill_create_issue.Rd index 058e943..e650df8 100644 --- a/man/use_skill_create_issue.Rd +++ b/man/use_skill_create_issue.Rd @@ -20,7 +20,7 @@ installed, relative to the project root. Defaults to \code{".github"}.} under a \code{skills} subdirectory of \code{target_dir}. Defaults to \code{TRUE}, producing \code{.github/skills/{skill}/SKILL.md}.} -\item{overwrite}{(\code{logical(1)}) Whether to overwrite an existing file. +\item{overwrite}{(\code{logical(1)}) Whether to overwrite existing file(s). Defaults to \code{FALSE}.} \item{open}{(\code{logical(1)}) Whether to open the file after creation.} diff --git a/man/use_skill_document.Rd b/man/use_skill_document.Rd index 91a6f9d..c473bff 100644 --- a/man/use_skill_document.Rd +++ b/man/use_skill_document.Rd @@ -19,7 +19,7 @@ installed, relative to the project root. Defaults to \code{".github"}.} under a \code{skills} subdirectory of \code{target_dir}. Defaults to \code{TRUE}, producing \code{.github/skills/{skill}/SKILL.md}.} -\item{overwrite}{(\code{logical(1)}) Whether to overwrite an existing file. +\item{overwrite}{(\code{logical(1)}) Whether to overwrite existing file(s). Defaults to \code{FALSE}.} \item{open}{(\code{logical(1)}) Whether to open the file after creation.} diff --git a/man/use_skill_github.Rd b/man/use_skill_github.Rd index 08692d5..701a6b3 100644 --- a/man/use_skill_github.Rd +++ b/man/use_skill_github.Rd @@ -19,7 +19,7 @@ installed, relative to the project root. Defaults to \code{".github"}.} under a \code{skills} subdirectory of \code{target_dir}. Defaults to \code{TRUE}, producing \code{.github/skills/{skill}/SKILL.md}.} -\item{overwrite}{(\code{logical(1)}) Whether to overwrite an existing file. +\item{overwrite}{(\code{logical(1)}) Whether to overwrite existing file(s). Defaults to \code{FALSE}.} \item{open}{(\code{logical(1)}) Whether to open the file after creation.} diff --git a/man/use_skill_implement_issue.Rd b/man/use_skill_implement_issue.Rd index 8df2a5f..478b893 100644 --- a/man/use_skill_implement_issue.Rd +++ b/man/use_skill_implement_issue.Rd @@ -19,7 +19,7 @@ installed, relative to the project root. Defaults to \code{".github"}.} under a \code{skills} subdirectory of \code{target_dir}. Defaults to \code{TRUE}, producing \code{.github/skills/{skill}/SKILL.md}.} -\item{overwrite}{(\code{logical(1)}) Whether to overwrite an existing file. +\item{overwrite}{(\code{logical(1)}) Whether to overwrite existing file(s). Defaults to \code{FALSE}.} \item{open}{(\code{logical(1)}) Whether to open the file after creation.} diff --git a/man/use_skill_r_code.Rd b/man/use_skill_r_code.Rd index 8ddd8d1..a083284 100644 --- a/man/use_skill_r_code.Rd +++ b/man/use_skill_r_code.Rd @@ -19,7 +19,7 @@ installed, relative to the project root. Defaults to \code{".github"}.} under a \code{skills} subdirectory of \code{target_dir}. Defaults to \code{TRUE}, producing \code{.github/skills/{skill}/SKILL.md}.} -\item{overwrite}{(\code{logical(1)}) Whether to overwrite an existing file. +\item{overwrite}{(\code{logical(1)}) Whether to overwrite existing file(s). Defaults to \code{FALSE}.} \item{open}{(\code{logical(1)}) Whether to open the file after creation.} diff --git a/man/use_skill_search_code.Rd b/man/use_skill_search_code.Rd index f72c675..9dfe1fb 100644 --- a/man/use_skill_search_code.Rd +++ b/man/use_skill_search_code.Rd @@ -19,7 +19,7 @@ installed, relative to the project root. Defaults to \code{".github"}.} under a \code{skills} subdirectory of \code{target_dir}. Defaults to \code{TRUE}, producing \code{.github/skills/{skill}/SKILL.md}.} -\item{overwrite}{(\code{logical(1)}) Whether to overwrite an existing file. +\item{overwrite}{(\code{logical(1)}) Whether to overwrite existing file(s). Defaults to \code{FALSE}.} \item{open}{(\code{logical(1)}) Whether to open the file after creation.} diff --git a/man/use_skill_tdd_workflow.Rd b/man/use_skill_tdd_workflow.Rd index 7c1d089..7bb60d2 100644 --- a/man/use_skill_tdd_workflow.Rd +++ b/man/use_skill_tdd_workflow.Rd @@ -19,7 +19,7 @@ installed, relative to the project root. Defaults to \code{".github"}.} under a \code{skills} subdirectory of \code{target_dir}. Defaults to \code{TRUE}, producing \code{.github/skills/{skill}/SKILL.md}.} -\item{overwrite}{(\code{logical(1)}) Whether to overwrite an existing file. +\item{overwrite}{(\code{logical(1)}) Whether to overwrite existing file(s). Defaults to \code{FALSE}.} \item{open}{(\code{logical(1)}) Whether to open the file after creation.}