Commit graph

11156 commits

Author SHA1 Message Date
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
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
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
Kynan Ware
d88705ea96 Add @cli/code-reviewers to all CODEOWNERS rules
This ensures that an approval from @cli/code-reviewers can satisfy the
CODEOWNERS requirement for any path, not just the catch-all wildcard.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-16 09:47:40 -06:00
Kynan Ware
2fd2fcfe8b
Merge pull request #13189 from cli/kw/skill-reviewers-codeowners
Add cli/skill-reviewers as CODEOWNERS for skills packages
2026-04-16 09:30:28 -06:00
Kynan Ware
a38e81ea5e Add cli/skill-reviewers as CODEOWNERS for skills packages
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-16 09:10:00 -06:00
Kynan Ware
97af1a5eb7
Merge pull request #13165 from cli/sm/add-skills-command
Add agent skills command
2026-04-16 09:05:47 -06:00
Sam Morrow
9d00ecc248
style: fix gofmt alignment in publish tests
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-16 17:04:12 +02:00
William Martin
a69a5fb2a4
Merge pull request #13187 from cli/sammorrowdrums/fix-skills-acceptance-test
Fix skills-publish-dry-run acceptance test error message mismatch
2026-04-16 16:53:08 +02:00
Sam Morrow
08a0c11d77
fix: update acceptance test to match current error message
The skills-publish-dry-run acceptance test expected 'no skills/ directory
found' on stderr, but the actual error message from discovery is
'no skills found in <dir>'. Update the stderr matcher accordingly.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-16 16:37:34 +02:00
Sam Morrow
8b115d2c23
fix: address post-merge review feedback for skills commands
- Remove direct opts.client injection in publish; use HttpClient factory
  pattern (PR #13168 feedback)
- Rename testName to name in discovery test struct (PR #13170 feedback)
- Use typed struct keys for dedup map with case-insensitive comparison
  in deduplicateResults (PR #13170 feedback)
- Simplify remote selection to use Remotes() ordering instead of manual
  origin-first logic (PR #13171 feedback)
- Fix push icon timing: show no icon before push, SuccessIcon after
  success (PR #13171 feedback)

Closes #13184

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-16 16:19:59 +02:00
Sam Morrow
1aa19846d4
Merge branch 'trunk' into sm/add-skills-command 2026-04-16 15:56:48 +02:00
Sam Morrow
963a1438a9
Merge pull request #13170 from cli/sammorrowdrums/fix-skills-namespace-dedup
fix: preserve namespace in skills search deduplication
2026-04-16 15:55:41 +02:00
Sam Morrow
29e55fe5b9
refactor: remove redundant nil-client fallback in skills publish (#13168)
Remove the dead code block that silently swallowed errors from
opts.HttpClient() and opts.Config() when creating an API client.
Instead, create the client with proper error propagation inside the
remote-checks block where it is actually needed.

Changes:
- Remove the error-swallowing client == nil fallback (lines 363-376)
- Create the API client inside the remote repo checks block with
  proper error returns from HttpClient() and Config()
- Resolve host from repoInfo first, then fall back to config
- Remove the now-unreachable 'client == nil' early exit before publish

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-16 15:52:53 +02:00
Sam Morrow
cf1afc9b88
Merge pull request #13167 from cli/sammorrowdrums/publish-use-shared-discovery
Publish: use shared discovery logic instead of requiring skills/ directory
2026-04-16 15:48:20 +02:00
Sam Morrow
31265d371b
Merge pull request #13171 from cli/sammorrowdrums/skill-publish-unpushed-check
feat(skills): auto-push unpushed commits before publish
2026-04-16 15:47:06 +02:00
Sam Morrow
e559a7cd5b
feat(skills): auto-push unpushed commits before publish
Like gh pr create, skill publish now automatically pushes unpushed
local commits before creating a release. This prevents the footgun
where a release is created against stale remote state when the user
has local commits that haven't been pushed yet.

The ensurePushed function checks for unpushed commits using
git rev-list @{push}..HEAD. If commits exist or the branch has
never been pushed, it pushes automatically and prints a status
message. This matches the CLI's opinionated-defaults philosophy
of doing the right thing by default.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-16 15:43:10 +02:00
Sam Morrow
b63f5bfd9a
refactor: use shared discovery logic in publish command
Replace the hardcoded skills/ directory requirement in the publish
command with the shared DiscoverLocalSkills() function used by install
and other commands. This removes the opinionated restriction that skills
must live under a skills/ directory and supports all discovery
conventions:

- skills/*/SKILL.md
- skills/{scope}/*/SKILL.md
- */SKILL.md (root-level)
- plugins/{scope}/skills/*/SKILL.md

All per-skill validation (frontmatter, spec-compliant naming, metadata
stripping, etc.) is preserved.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-16 15:38:36 +02:00
Sam Morrow
c5cff0f298
Merge pull request #13183 from cli/babakks/improve-skill-docs
docs(skill): polish skill commadset docs
2026-04-16 15:19:38 +02:00
Babak K. Shandiz
a1eb707e26
fix(skill publish): remove misleading validate alias
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2026-04-16 14:04:29 +01:00
Babak K. Shandiz
3dce81a0d6
docs(skill): improve help docs
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2026-04-16 14:03:54 +01:00
William Martin
ebe0631de2
Merge pull request #13176 from cli/kw/remove-ext-install-auth-check
Disable auth check for `gh extension install`
2026-04-16 12:18:43 +02:00
tommaso-moro
a6e9722ec1 fix skills names in examples 2026-04-16 10:20:24 +01:00