Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Generated by roxygen2: do not edit by hand

export(default_allowlist)
export(update_ai)
export(use_agent)
export(use_ai)
export(use_github_copilot)
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# pkgskills (development version)

* `update_ai()` now wraps `use_ai()` with `overwrite = TRUE` by default (#94).

* `use_github_copilot_code_review()` now installs `.github/copilot-instructions.md` to skip `man/*.Rd` files during Copilot code review, and `use_github_copilot()` now calls it (#89).

* `use_github_copilot()` now uses the external, stable `api2r/actions/install@v1` composite workflow instead of the local `install` action (#84).
Expand Down
41 changes: 41 additions & 0 deletions R/update_ai.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#' Update the full AI agent suite for a project
#'
#' Update all files generated by [use_ai()]. Equivalent to `use_ai(overwrite = TRUE)`.
#'
#' @inheritParams use_ai
#' @param overwrite (`logical(1)`) Whether to overwrite existing file(s).
#' Defaults to `TRUE`.
#' @returns A named list of paths returned by [use_ai()], invisibly.
#' @export
#' @examplesIf interactive()
#'
#' update_ai()
update_ai <- function(
save_agent_as = "AGENTS.md",
target_skills_dir = ".github",
use_skills_subdir = TRUE,
overwrite = TRUE,
open = rlang::is_interactive(),
gh_token = gh::gh_token(),
allowlist = default_allowlist(),
skills = c(
"create-issue",
"document",
"github",
"implement-issue",
"r-code",
"search-code",
"tdd-workflow"
)
) {
use_ai(
save_agent_as = save_agent_as,
target_skills_dir = target_skills_dir,
use_skills_subdir = use_skills_subdir,
overwrite = overwrite,
open = open,
gh_token = gh_token,
allowlist = allowlist,
skills = skills
)
}
57 changes: 57 additions & 0 deletions man/update_ai.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

51 changes: 51 additions & 0 deletions tests/testthat/test-update_ai.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
test_that("update_ai() defaults overwrite to TRUE (#94)", {
local_pkg()
local_gh_mock()
local_mocked_bindings(
use_ai = function(
save_agent_as,
target_skills_dir,
use_skills_subdir,
overwrite,
open,
gh_token,
allowlist,
skills
) {
expect_true(overwrite)
invisible("ok")
}
)

result <- withVisible(update_ai(open = FALSE, skills = "r-code"))
expect_false(result$visible)
expect_identical(result$value, "ok")
})

test_that("update_ai() still allows explicit overwrite = FALSE (#94)", {
local_pkg()
local_gh_mock()
local_mocked_bindings(
use_ai = function(
save_agent_as,
target_skills_dir,
use_skills_subdir,
overwrite,
open,
gh_token,
allowlist,
skills
) {
expect_false(overwrite)
invisible("ok")
}
)

result <- withVisible(update_ai(
overwrite = FALSE,
open = FALSE,
skills = "r-code"
))
expect_false(result$visible)
expect_identical(result$value, "ok")
})
Loading