Commit graph

11279 commits

Author SHA1 Message Date
William Martin
e52070e07e
Merge pull request #13205 from cli/wm/record-official-extension-telemetry
Record official extension telemetry
2026-04-21 11:57:11 +02:00
William Martin
c50fb793ea Record official extension telemetry 2026-04-21 11:48:32 +02:00
Sam Morrow
1b236f23c5
Merge pull request #13249 from cli/sammorrowdrums/fix-skill-install-preview-sha
fix(skills): match skills by install name in preview command
2026-04-21 11:30:11 +02:00
Sam Morrow
6fcc9c24df
fix(skills): prioritize DisplayName/Name over InstallName match
Use a two-pass search so exact DisplayName and Name matches are
preferred over InstallName. This avoids incorrectly selecting a
plugins-convention skill via InstallName when a standard namespaced
skill with a matching DisplayName exists later in the sorted slice.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-21 10:09:20 +02:00
Sam Morrow
a67f4f7303
Merge pull request #13235 from cli/sammorrowdrums/fix-skill-install-discovery
Make skill discovery less strict: support nested `skills/` directories
2026-04-21 10:01:53 +02:00
Sam Morrow
1160943af3
fix(skills): match skills by install name in preview command
The preview command's selectSkill function only matched skills by
DisplayName() and Name. For plugins-convention skills, the install
hint outputs InstallName() (namespace/name), which matched neither -
DisplayName() includes a [plugins] prefix and Name is just the base
name. This caused 'skill not found' errors when users ran the
suggested preview command after install.

Add InstallName() as an additional match criterion so that namespaced
skill identifiers produced by the install hint are accepted.

Closes #13248

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-21 09:56:27 +02:00
Kynan Ware
74d377313a
use the right json field names for skills
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-04-20 14:22:08 -06:00
Kynan Ware
01e345082c
fix totalCount guidance
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-04-20 14:21:26 -06:00
Kynan Ware
65974f568f docs(skills): note --template collisions and single-string search
Addresses review feedback on PR #13244:

- Flag that --template/-T collides with body-template flags on
  pr create / issue create, so agents should check --help.
- Recommend the single quoted-string form for gh search (matching
  --search), since multi-arg invocations join oddly and can produce
  invalid queries.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-20 14:18:46 -06:00
Kynan Ware
72884d9e41
backtick skill filename
Co-authored-by: Babak K. Shandiz <babakks@github.com>
2026-04-20 14:14:07 -06:00
Kynan Ware
01ca82955b docs(skills): drop hand-copied naming rules from gh-skill
Avoids drift between this skill and the actual validation logic in
publish. Agents should run `gh skill publish --dry-run` to learn the
current rules from the source of truth.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-20 14:12:27 -06:00
Kynan Ware
991e37dc25
use hyphen instead 2026-04-20 14:07:56 -06:00
Kynan Ware
33789149b9 docs(skills): add gh and gh-skill agent skills
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-20 13:38:59 -06:00
Sam Morrow
9a368f45e9
feat(skills): support nested skills/ directories in discovery
Relax skill discovery to recognize skills/ directories at any depth
in the repository tree, not just at the root. This enables repos like
hashicorp/agent-skills that organize skills under prefixes such as
terraform/code-generation/skills/*/SKILL.md.

Changes:
- matchSkillConventions: add checks for <prefix>/skills/<name>/SKILL.md
  and <prefix>/skills/<ns>/<name>/SKILL.md at any depth
- isSkillPath: also match paths containing /skills/ for direct
  path-based install
- DiscoverSkillByPath: fix namespace detection to find the skills
  segment anywhere in the path
- Update error messages and help text to mention nested conventions

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-20 21:07:15 +02:00
Fredric Silberberg
c139b17e9f
Apply patch from code review feedback. 2026-04-20 11:52:03 -07:00
Fredric Silberberg
a656271f26 Print gh auth refresh for 401 returns
`gh auth refresh` exists to make it simpler for users to refresh their tokens on expiration/scope mismatch, but help messages only suggest using it in limited scenarios, and not in a common case of a token expiring and the user receiving a 401 error. Now, the auth flow will detect this case, and for refreshable tokens (namely, tokens created by logging in with `gh auth login` in the first place), it will suggest using `gh auth refresh` for these cases.
2026-04-20 12:07:14 -06:00
Sam Morrow
49d4747a81
Merge pull request #13237 from cli/sammorrowdrums/fix-skill-publish-fix-flag 2026-04-20 19:23:09 +02:00
Sam Morrow
f88a2a671c
fix(skills): make --fix and --dry-run mutually exclusive, suppress publish prompt
- --fix and --dry-run now error when combined
- "Ready to publish!" is suppressed when --fix is set since user must
  commit first

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-20 12:36:57 +02:00
Sam Morrow
c703294fbe
fix(skills): use canonical 'gh skill' not 'gh skills' alias
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-20 12:34:59 +02:00
Sam Morrow
2e64043d55
fix(skills): stop publish --fix from publishing
When --fix is used, return early after applying fixes instead of
continuing to the publish flow. The fixed files need to be committed
before publishing, so proceeding would fail anyway since the repo
would not be in sync.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-20 12:22:55 +02:00
William Martin
43f9944920
Merge pull request #13210 from cli/wm/record-ci
Record CI context in telemetry
2026-04-20 12:14:20 +02:00
William Martin
78f1ad537c Include CI context in telemetry 2026-04-20 12:02:56 +02:00
Sam Morrow
61a7865380
Merge pull request #13213 from cli/sammorrowdrums/sm-allow-hidden-dirs-flag
Add --allow-hidden-dirs flag to gh skill install
2026-04-20 11:33:12 +02:00
Sam Morrow
eaa018545a
refactor: decouple hidden-dir filtering from discovery layer
Move --allow-hidden-dirs filtering logic from the discovery package to
the install command, addressing review feedback. Discovery functions now
always return all skills (including hidden-dir), and callers decide how
to handle them.

Changes:
- DiscoverSkillsWithOptions/DiscoverLocalSkillsWithOptions always return
  hidden-dir skills; callers filter using IsHiddenDirConvention()
- DiscoverSkills/DiscoverLocalSkills (convenience wrappers) auto-filter
  hidden-dir skills for backward compatibility with preview/update/publish
- Remove --allow-hidden-dirs reference from discovery error messages
- Add filterHiddenDirSkills in install.go with caller-side flag logic
- Inline warning using heredoc.Docf, remove printHiddenDirWarning
- Add inline comments in matchHiddenDirConventions (babakks nitpicks)
- Add non-hidden-namespaced dir and no-skills-at-all test cases
- Add --allow-hidden-dirs tests in TestNewCmdInstall, TestInstallRun,
  and TestRunLocalInstall

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-20 11:14:39 +02:00
Tommaso Moro
082f15a8fd
Add support for installation in multiple agent hosts in gh skills install (#13209)
* add support for installation in multiple agent host

* print correct dir in warning

* remove dir as it depends on user vs project installation scope

* Move comment closer to assertion in registry test

Move the explanatory comment from above the map initialization to
directly above the assertions it describes, per review feedback.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* List supported agent names and IDs in help text

Replace the self-referencing "run --help" sentence with an inline list
of all supported --agent values showing Name (id) pairs.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Use heredoc.Docf for Kiro CLI post-install hint

Replace individual fmt.Fprintln calls with a single heredoc.Docf block
for the Kiro CLI post-install guidance, per review feedback. Also
shorten the --agent flag usage line by overriding the auto-generated
enum list with a reference to the supported values in the help text.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Kynan Ware <47394200+BagToad@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-18 15:22:09 -06:00
William Martin
998b6212b3
Add skills specific telemetry
* Add skills specific telemetry

* Remove VisibilityFuture, inline goroutine at call sites

The VisibilityFuture/FetchRepoVisibilityAsync/Wait wrapper was an
unidiomatic async abstraction built for a single pattern used in
exactly two call sites. In Go the channel is already the future;
wrapping it in a struct with a Wait(timeout) method adds no value.

Delete the abstraction and inline a local visResult struct,
buffered channel, goroutine, and select at each call site. Behavior
is preserved exactly: err -> "unknown", timeout -> "unknown",
success+public -> include skill_names.

FetchRepoVisibility (synchronous) is kept as-is.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Fix nonsense copilot tests

* Update telemetry tests for public-only dims and search event removal

Production telemetry emission changed:
- preview: skill_owner/skill_repo/skill_name (renamed from skill_names)
  are now emitted only when repo_visibility=public.
- install: skill_owner/skill_repo/skill_names are now emitted only
  when repo_visibility=public.
- search: the initial skill_search event was removed entirely; the
  skill_search_install event no longer carries query/owner dims.

Update tests to match: rename skill_names -> skill_name in preview,
make owner/repo assertions conditional on public visibility in both
preview and install, and reduce the search test to a single event
with explicit Empty assertions for the removed query/owner dims so a
privacy regression cannot pass silently.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Test CategorizeHost and switch telemetry to skill_host_type

Add TestCategorizeHost covering all four classification branches
(github.com, ghes, tenancy, uncategorized) with cases verified
against the real ghauth implementation rather than guessed.

Update install and preview unit tests to assert the new
skill_host_type dimension name, and fix a typo in the preview
acceptance txtar (skill_hos_type -> skill_host_type).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Shrink visibility wait and test unknown visibility

The 2s visibilityWaitTimeout was wildly overprovisioned: by the time
telemetry emission reaches the select, the command has already done
several serial GitHub REST calls (and for install, a git sparse-checkout
plus possibly interactive prompts), so the one-call visibility fetch
has almost always completed. Drop the timeout to 200ms — a short safety
net for a stalled REST call, not a wait budget for a healthy one.

Also adds a table-driven case to TestFetchRepoVisibility covering an
unknown/future visibility value from the API, addressing @babakks'
review nitpick.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-17 19:58:59 +02:00
William Martin
451d399eac
Merge pull request #13192 from cli/wm/no-alias-telemetry
Do not send telemetry for aliases
2026-04-17 14:40:22 +02:00
dependabot[bot]
fd28f058aa
chore(deps): bump github.com/google/go-containerregistry
Bumps [github.com/google/go-containerregistry](https://github.com/google/go-containerregistry) from 0.21.4 to 0.21.5.
- [Release notes](https://github.com/google/go-containerregistry/releases)
- [Commits](https://github.com/google/go-containerregistry/compare/v0.21.4...v0.21.5)

---
updated-dependencies:
- dependency-name: github.com/google/go-containerregistry
  dependency-version: 0.21.5
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-17 12:30:09 +00:00
William Martin
6709e315df Do not send telemetry for aliases 2026-04-17 14:28:49 +02:00
William Martin
73f390073c
Merge pull request #13191 from cli/wm/add-telemetry-to-cli
Add sampled command telemetry
2026-04-17 14:28:46 +02:00
William Martin
17776cafc1 Apply review feedback
- Harden SpawnSendTelemetry against relative executable paths
- Use io.Copy for telemetry subprocess stdin write
- Clean up GH_TELEMETRY/DO_NOT_TRACK help text
- Fall back to built-in defaults (NoOp telemetry) on config load failure

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-17 12:28:52 +02:00
William Martin
3ed389d664 Disable telemetry for GHES 2026-04-17 11:50:24 +02:00
Babak K. Shandiz
bc9ba9b0e6
Merge pull request #13203 from cli/tm/skills-search-fix
Remove misleading text
2026-04-17 10:34:39 +01:00
tommaso-moro
d333093efd remove misleading text 2026-04-17 10:26:03 +01:00
William Martin
18dc5e77f0 Add sampled command telemetry 2026-04-16 21:42:46 +02:00
Babak K. Shandiz
26d2302cb8
Merge pull request #13188 from cli/sammorrowdrums/skills-replace-git-in-publish-tests
Skills: replace real git in publish tests with CommandStubber
2026-04-16 18:30:31 +01:00
Sam Morrow
c5c7d790c5
Update publish_test.go
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-04-16 19:21:35 +02:00
Sam Morrow
bce04e3245
Merge branch 'trunk' into sammorrowdrums/skills-replace-git-in-publish-tests 2026-04-16 19:06:38 +02:00
Copilot
5ae5d1db7f refactor: replace real git with run.CommandStubber in publish tests
Replace all exec.Command("git", ...), initGitRepo, runGitInDir, and
newTestGitClientWithUpstream with run.Stub()/run.CommandStubber stubs.

Changes:
- Remove os/exec and strings imports; add fmt, regexp, internal/run
- Add newTestGitClient(), stubGitRemote(), stubEnsurePushed() helpers
- Remove initGitRepo, runGitInDir, newTestGitClientWithUpstream helpers
- Add cmdStubs field to TestPublishRun table struct
- Convert all test cases to use stub-based git interactions
- Use regexp.QuoteMeta for remote name patterns
- Use %[1]s/%[2]s format args in stubGitRemote
- Initialize git.Client with explicit GitPath to avoid real git resolution
- Rewrite TestEnsurePushed with stub-based tests
- Update TestDetectGitHubRemote_UsesDir and TestPublishRun_DirArgUsesTargetRemote

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-16 19:02:53 +02:00
Sam Morrow
d7961f1393
Merge pull request #13185 from cli/sammorrowdrums/skills-post-merge-review-followups
Address post-merge review feedback for skills commands
2026-04-16 18:59:21 +02:00
Sam Morrow
de204f8518
fix: apply review feedback — nil HttpClient, local dedup type
- Return nil instead of real http.Client in unsupported host test
- Move skillResultKey type inside deduplicateResults function scope

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-16 18:49:54 +02:00
Kynan Ware
3265170df9
Merge pull request #13175 from cli/kw/first-party-extension-suggestions
Suggest and install official extensions for unknown commands
2026-04-16 10:48:28 -06:00
Kynan Ware
32b8af1017 Remove dispatch after install, install only
Removes post-install extension dispatch to keep the stub focused on
installation. Also removes unused args parameter from the run function.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-16 10:38:33 -06:00
Kynan Ware
b8d504cbd9 Rename official extension files and types to stubs
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-16 10:34:48 -06:00
Kynan Ware
1d59334964 Replace em-dashes with regular dashes
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-16 10:32:00 -06:00
William Martin
81afcd0de0
Merge pull request #13182 from cli/wm/first-party-extension-suggestions
Suggest first party extensions
2026-04-16 18:13:59 +02:00
William Martin
abc2a50b4c Address PR review feedback
- Use cmdutil.DisableAuthCheck instead of raw annotation map
- Convert tests to table-driven format
- Use generic extension name in tests (gh-cool)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-16 18:11:28 +02:00
William Martin
9596f99e56 Add no em dash rule to AGENTS.md
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-16 18:09:16 +02:00
Kynan Ware
c8053034e7
Merge pull request #13190 from cli/kw/codeowners-add-code-reviewers
Add @cli/code-reviewers to all CODEOWNERS rules
2026-04-16 09:59:28 -06:00
William Martin
7ad1d7c0a1 Suggest and install official extensions via stub commands
Register hidden stub commands for official GitHub extensions (gh-aw,
gh-stack) that offer to install the extension when invoked. This
replaces the error-string-matching approach from the original PR with
proper cobra commands that:

- Avoid false-positive matches on flag values or post-'--' args
- Eliminate conflicting cobra 'Did you mean?' suggestions
- Properly propagate prompt/install errors for correct exit codes
- Are hidden from help output and shell completions
- Use GroupID "extension" so checkValidExtension allows installing over them
- Are registered after extensions and aliases so both take priority

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-16 17:58:37 +02:00