Conversation
Co-authored-by: jonthegeek <33983824+jonthegeek@users.noreply.github.com>
jonthegeek
left a comment
There was a problem hiding this comment.
@copilot Implement these changes. Continue to use red-green-refactor TDD and the skills in this repo.
Co-authored-by: jonthegeek <33983824+jonthegeek@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
There was a problem hiding this comment.
Pull request overview
Adds first “skill installer” workflow to pkgskills by introducing use_skill_create_issue(), which fetches GitHub repository metadata and renders an on-disk skill template into a target project (and optionally updates AGENTS.md).
Changes:
- Introduces
use_skill_create_issue()plus internal helpers to fetch repo ID / issue types via GitHub GraphQL and render thecreate-issueskill template. - Adds new internal utilities for coercion, paths, and markdown/YAML-front-matter parsing to support skill installation and
AGENTS.mdtable upserts. - Adds substantial test coverage (incl. snapshots) and updates docs/templates/metadata (NAMESPACE, Rd files, skills’ YAML front matter triggers, README install snippet, DESCRIPTION imports).
Reviewed changes
Copilot reviewed 75 out of 75 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/testthat/test-utils.R | Replaces prior coercion test with .format_now_utc() formatting test. |
| tests/testthat/test-utils-text.R | Adds tests + snapshots coverage for new text/YAML/table helpers. |
| tests/testthat/test-utils-path.R | Adds tests + snapshots for new path/writability helpers. |
| tests/testthat/test-utils-coerce.R | Adds tests for .to_string() and .to_boolean(). |
| tests/testthat/test-use_skill.R | Adds integration tests for .use_skill() + AGENTS.md upsert behavior. |
| tests/testthat/test-use_skill_create_issue.R | Adds tests + snapshots for use_skill_create_issue() validation and wiring. |
| tests/testthat/helper-local_pkg.R | Adds local_gh_mock() and updates default DESCRIPTION fixture. |
| tests/testthat/helper-expectations.R | Adds expect_pkg_error_snapshot() helper and path-scrubbing transform. |
| tests/testthat/.gitignore | Removes testthat artifact ignore rules under tests/testthat/. |
| tests/testthat/_snaps/utils-text.md | Snapshot outputs for YAML-front-matter helpers’ error cases. |
| tests/testthat/_snaps/utils-path.md | Snapshot outputs for path helpers’ error cases. |
| tests/testthat/_snaps/use_skill.md | Snapshot outputs for .use_skill() messaging + error cases. |
| tests/testthat/_snaps/use_skill_create_issue.md | Snapshot outputs for BugReports parsing error cases. |
| README.Rmd | Switches dev install instructions from remotes to pak. |
| README.md | Regenerated README reflecting pak-based install instructions. |
| R/utils.R | Adds .call_gh() wrapper and .format_now_utc(); moves coercion helper out. |
| R/utils-text.R | Adds pattern/table/YAML parsing helpers and line insertion utility. |
| R/utils-path.R | Adds package/template/project path helpers and writability checks. |
| R/utils-coerce.R | Adds .to_string() and .to_boolean() coercion helpers. |
| R/use_skill.R | Adds skill installation + AGENTS.md upsert implementation. |
| R/use_skill_create_issue.R | Adds exported use_skill_create_issue() and GitHub metadata collection. |
| R/use_agent.R | Tightens .use_template() validation and ensures output dir exists. |
| R/aaa-shared_params.R | Expands shared parameter docs used across new helpers. |
| R/aaa-conditions.R | Introduces .pkg_abort() wrapper for package-scoped errors. |
| NEWS.md | Notes new use_skill_create_issue() feature. |
| NAMESPACE | Exports use_skill_create_issue(). |
| man/use_skill_create_issue.Rd | Generated docs for new exported function. |
| man/use_agent.Rd | Updates save_as parameter wording. |
| man/dot-use_template.Rd | Updates data parameter description and save_as wording. |
| man/dot-use_skill.Rd | Generated docs for new internal skill installer. |
| man/dot-upsert_agents_skill.Rd | Generated docs for AGENTS.md upsert helper. |
| man/dot-upsert_agents_skill_from_template.Rd | Generated docs for template-based AGENTS.md upsert. |
| man/dot-to_string.Rd | Points .to_string() docs to new source file. |
| man/dot-to_boolean.Rd | Generated docs for .to_boolean(). |
| man/dot-shared-params.Rd | Generated docs updates for expanded shared params. |
| man/dot-read_skill_trigger.Rd | Generated docs for YAML trigger reader. |
| man/dot-pkg_abort.Rd | Generated docs for .pkg_abort(). |
| man/dot-path_template.Rd | Generated docs for .path_template(). |
| man/dot-path_skill_save_as.Rd | Generated docs for .path_skill_save_as(). |
| man/dot-path_proj_save_as.Rd | Generated docs for .path_proj_save_as(). |
| man/dot-path_pkg.Rd | Generated docs for .path_pkg(). |
| man/dot-parse_yaml_front_matter.Rd | Generated docs for YAML front matter parsing helper. |
| man/dot-make_skills_table.Rd | Generated docs for skills table builder. |
| man/dot-make_skills_section.Rd | Generated docs for skills section builder. |
| man/dot-make_skill_row.Rd | Generated docs for skills table row builder. |
| man/dot-lines_insert_after.Rd | Generated docs for .lines_insert_after(). |
| man/dot-is_first_run.Rd | Generated docs for .is_first_run(). |
| man/dot-get_create_issue_data.Rd | Generated docs for create-issue template data collector. |
| man/dot-format_now_utc.Rd | Generated docs for .format_now_utc(). |
| man/dot-find_table_last_row_idx.Rd | Generated docs for table row finder. |
| man/dot-find_skills_section_idx.Rd | Generated docs for skills section finder. |
| man/dot-find_skill_row_idx.Rd | Generated docs for existing skill row finder. |
| man/dot-find_pattern_idx.Rd | Generated docs for first-match index finder. |
| man/dot-fetch_repo_issue_types.Rd | Generated docs for issue types GraphQL fetch helper. |
| man/dot-fetch_repo_id.Rd | Generated docs for repo node ID GraphQL fetch helper. |
| man/dot-extract_yaml_scalar.Rd | Generated docs for YAML scalar extraction helper. |
| man/dot-extract_repo_from_desc.Rd | Generated docs for BugReports URL parsing helper. |
| man/dot-check_path_writable.Rd | Generated docs for .check_path_writable(). |
| man/dot-call_gh.Rd | Generated docs for .call_gh() wrapper. |
| man/dot-agents_lines_upsert_skill.Rd | Generated docs for computing AGENTS.md upserted lines. |
| man/dot-agents_lines_replace_row.Rd | Generated docs for replacing an existing skills row. |
| man/dot-agents_lines_insert_table.Rd | Generated docs for inserting a skills table in section. |
| man/dot-agents_lines_append_section.Rd | Generated docs for appending a skills section. |
| man/dot-agents_lines_append_row.Rd | Generated docs for appending a row after last table row. |
| man/dot-agents_lines_add_to_section.Rd | Generated docs for adding row/table within existing section. |
| man/dot-agents_lines_add_skill_row.Rd | Generated docs for adding a new skill row. |
| inst/templates/skills/create-issue/SKILL.md | Adds the installable create-issue skill template with whisker variables. |
| DESCRIPTION | Adds gh and stringr to Imports, adds R dependency, updates Suggests. |
| .github/skills/tdd-workflow/SKILL.md | Adds trigger and improves guidance around snapshots/errors. |
| .github/skills/search-code/SKILL.md | Adds trigger field. |
| .github/skills/r-code/SKILL.md | Adds trigger field. |
| .github/skills/implement-issue/SKILL.md | Adds trigger field. |
| .github/skills/github/SKILL.md | Adds trigger field. |
| .github/skills/document/SKILL.md | Adds trigger and updates documentation workflow guidance. |
| .github/skills/create-issue/SKILL.md | Adds trigger and refines sections guidance (removes “Implementation” section). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
jonthegeek
left a comment
There was a problem hiding this comment.
Looks good as long as checks pass!
Adds
use_skill_create_issue(), which installs a renderedcreate-issueskill into a project by querying the GitHub GraphQL API and filling a whisker template with repo-specific data (owner, repo ID, issue types, and install timestamp).New exported function
use_skill_create_issue()— validatesBugReportsinDESCRIPTIONis a GitHub URL, fetches repo node ID and issue types viagh::gh("POST /graphql", ...), captures a UTC install timestamp (update_time), then delegates to.use_skill()New internal infrastructure
.use_skill(skill, data, ...)— general-purpose skill installer; renders the template, errors on existing file whenoverwrite = FALSE, creates parent dirs, and upsertsAGENTS.md.read_skill_trigger(path)— parsestrigger:from YAML front matter between---delimiters.upsert_agents_skills_row(trigger, save_as)— self-contained: findsAGENTS.mditself, returnsNULLinvisibly if absent; handles all states: no## Skillssection, section with no table, update existing row, append new row.pkg_abort()— thin wrapper aroundstbl::pkg_abort()withmessage_env = rlang::caller_env()so cli{expr}interpolation resolves in the right frame.to_boolean()— logical scalar coercion helper inR/utils.R, analogous to.to_string().path_pkg()/.path_template()— package and template path helpers inR/utils.Rbuilt onfs::path_package().check_file_exists(save_as, overwrite)— validates file existence inR/utils.R; errors with"file_exists"subclass whenoverwrite = FALSETemplate
inst/templates/skills/create-issue/SKILL.md— whisker template with{{{owner}}},{{{repo}}},{{{repo_id}}},{{{update_time}}}, and a{{#issue_types}}section rendering one table row per issue type## Implementationsection merged into## Detailsin both the template and.github/skills/create-issue/SKILL.mdShared parameters
@param data,target_dir,use_skills_subdir, andoverwriteunified inR/aaa-shared_params.Rand inherited across functionsSkill front matter
trigger:field to the YAML front matter of all seven.github/skills/*/SKILL.mdfilesDependencies
ghmoved fromSuggests→ImportsOriginal prompt
This section details on the original issue you should resolve
<issue_title>feat: use_skill_create_issue()</issue_title>
<issue_description>## Summary
Proposed signature
Arguments
target_dir(character(1)) — Directory where the skill will be installed, relative to the project root. Defaults to".github".use_skills_subdir(logical(1)) — Whether to place thecreate-issuefolder under askillssubdirectory oftarget_dir. Defaults toTRUE, producing.github/skills/create-issue/SKILL.md.overwrite(logical(1)) — Whether to overwrite an existing skill file. Defaults toTRUE.open(logical(1)) — Whether to open the installed file in the editor after creation. Defaults torlang::is_interactive().gh_token(character(1)) — A GitHub personal access token. Defaults togh::gh_token().Returns the path to the installed skill file, invisibly (following the
usethisconvention).Under the hood,
use_skill_create_issue()delegates to an internal helper with this signature:.use_skill()argumentsskill(character(1)) — Skill name (folder name underinst/templates/skills/), e.g."create-issue". Determines the template path (inst/templates/skills/{skill}/SKILL.md) and the install subdirectory.data(list) — Named list of whisker template variables to fill into the skill template.use_skill_create_issue()above.Behavior
use_skill_create_issue()stbl(following ther-codeskill conventions).target_dirandgh_tokenarecharacter(1);use_skills_subdirandoverwritearelogical(1).BugReportsfield inDESCRIPTIONpointing to a GitHub URL. If not, errors with a{cli}message that includes{.run usethis::use_github()}.ownerandreponame from theBugReportsURL.gh::gh()(withgh_token) to fetch:repoId)issueTypesGraphQL query, requestingid,name, anddescriptionfor each nodedatalist containingowner,repo,repo_id, andissue_types: a list of lists, each withname,id, anddescriptionkeys..use_skill("create-issue", data = data, target_dir, use_skills_subdir, overwrite, open)..use_skill()stbl.save_as:use_skills_subdir = TRUE:fs::path(target_dir, "skills", skill, "SKILL.md")use_skills_subdir = FALSE:fs::path(target_dir, skill, "SKILL.md")trigger:field from the YAML front matter of the source template (inst/templates/skills/{skill}/SKILL.mdwithin the pkgskills package). The front matter uses simplekey: valuelines between---delimiters..use_template()(defined inR/use_agent.R) pointing toskills/{skill}/SKILL.md, with the derivedsave_asargument and the provideddataandopenarguments.AGENTS.mdexists at the project root, upserts a row for this skill into the## Skillstable:| {trigger} | @{save_as} |. If a row forsave_asalready exists, its trigger is updated in place; otherwise a new row is appended. IfAGENTS.mdexists but has no## Skillssection, the section is created.cli::cli_inform()message confirming the skill was installed and its path..use_skill()is the general pattern for how alluse_skill_*()functions in this package will work — analogous to howuse_agent()calls.use_template()internally.Implementation
trigger:to the YAML front matter of all skill files under.github/skills/and all templates underinst/templates/skills/. The value is the trigger phrase as it will appear in the## Skillstable ofAGENTS.md.inst/templates/skills/create-issue/SKILL.md: a whisker-rendered version of.github/skills/create-issue/SKILL.mdin which hardcoded values are replaced with template variables:{{{owner}}}and{{{repo}}}— repo owner and name (used in the GraphQL lookup examples){{{repo_id}}}— repository node ID (replaces the hardcodedR_kgDORkNSGw){{#issue_types}}/{{/issue_types}}whisker section iterating over a list of lists, each with{{name}},{{id}}, and{{description}}— renders one table row per issue type (re...🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.