You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feature request: auto-detect R package in well-known subdirectories #459
Multi-language repositories are becoming more common within the Shiny team - a single repo may contain a Python package, a
JavaScript frontend, and an R package, each in their own subdirectory. Today, installing the R package from
such a repo requires explicitly specifying subdir:
pak::pkg_install("owner/repo/pkg-r")
This works, but it requires the caller to know ahead of time where the R package lives. It also makes it
impossible for package authors to establish a convention that "just works" for users installing with pak.
Proposed behaviour
When a GitHub (or Git) remote is resolved and no subdir is specified, and no DESCRIPTION is found at
the repo root, automatically probe a list of well-known subdirectory candidates before failing with a "no
package" error.
A reasonable default probe list might be:
pkg-r/
r/
The first subdirectory containing a valid DESCRIPTION file would be used automatically.
Current behaviour
In type-github.R, type_github_get_data_ref() constructs a GraphQL query that looks for DESCRIPTION at
exactly {subdir}DESCRIPTION. If subdir is empty (not specified) and no DESCRIPTION exists at the
root, check_github_response_ref() throws a new_github_no_package_error. There is no fallback probing.
Implementation sketch
The probing could be done by:
Issuing a single GraphQL query that requests DESCRIPTION at multiple paths in one round-trip (GraphQL
aliases make this straightforward).
If the root DESCRIPTION is null, iterating through the alias results to find the first non-null hit
and using that subdir for the remainder of resolution.
This avoids additional HTTP round-trips and keeps the change self-contained in type_github_get_data_ref()
(and the equivalent _pull/_sha variants).
Notes
This would be opt-in via convention — repos that have a DESCRIPTION at the root are unaffected.
The probe list could be configurable (e.g., via a pak option or a DESCRIPTION-adjacent marker file),
but a sensible hardcoded default would cover the majority of cases.
Activity
docs: shorten issue ref in NEWS to (r-lib#459)
fix(github): drop sys.call capture in ref variant
feat(github): add subdir probing helpers (#459)
refactor(github): fix github_subdir_paths empty-input type; add tests (…
test(github): make fake GraphQL server alias-aware (#459)
test(github): word-boundary on file() alias regex (#459)
feat(github): auto-detect subdir for ref resolution (#459)
docs(github): clarify github_pick_desc binary-blob comment (#459)
feat(github): auto-detect subdir for pull request resolution (#459)
feat(github): auto-detect subdir for release resolution (#459)
docs: NEWS for GitHub subdir auto-detection (#459)
test(github): update github-tools snapshot for subdir field (#459)
refactor(github): capture call in ref variant for consistent errors (#…