Commit graph

31 commits

Author SHA1 Message Date
William Martin
c50fb793ea Record official extension telemetry 2026-04-21 11:48:32 +02: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
75909ed2ba Suggest and install official extensions for unknown commands
When a user runs an unknown command that matches a known official
extension (e.g. `gh stack` or `gh aw`), show an install suggestion.
In interactive TTY sessions, prompt the user to install it on the spot.

The official extension registry is hard-coded in pkg/extensions/.
Current entries are github/gh-aw and github/gh-stack. Teams can add
their extensions via PR. Install suggestions use an explicit github.com
host prefix for GHES compatibility.

Refs github/cli#220

Co-Authored-By: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-15 17:50:31 -06:00
Andrew Feller
a55f50b115 Remove Extension.FullName() from interface
- this was something I did in the original implementation of this improved extension update notification logic
- discovering other parts of the extension manager code that were working with non-prefixed extension names motivated a different approach
- the extension manager code that requires the extension be prefixed has been enhanced to use the centralized ensurePrefixed() logic, making the need for this on the extension unnecessary
2024-12-08 20:01:26 -05:00
Andrew Feller
97630fe73c Enhance extension manager and tests
- extension manager has been made responsible for extension update directory information
- extension manager has been enhanced to ensure that previously left extension update metadata is deleted before installing an extension
- extension manager has been enhanced to ensure that extension update metadata is deleted when extension is being removed
- refactored extension command tests for manager change, ensuring previous and expected states along with returned release info
- refactored extension manager tests for ensuring previous extension update entries are removed before installing extension
- created extension manager test for installing local extension
- centralized logic for checking and ensuring extension name is "gh-" prefixed
2024-12-08 19:40:24 -05:00
Andy Feller
0d3f7cae4e Bring extension update check in line with gh check
This commit is a bit of refactoring to bring the extension update checking logic up to par with what is done with `gh` including creation of state file per extension and listening to env vars for disabling version checking.

This work is not complete as it does not address necessary test changes.
2024-11-17 16:10:58 -05:00
Swastik Baranwal
6696229fb1
gh extension install not give an error if extension already installed and a clear message (#8211)
* `gh extension install` not give an error if extension already installed and a clear message

* remove test

* Add implementation

* lint go.sum

---------

Co-authored-by: Sam Coe <samcoe@users.noreply.github.com>
2023-10-19 15:22:21 +02:00
Mislav Marohnić
beb6234f96
Speed up listing extensions by lazy-loading extension information when needed (#7493) 2023-06-14 09:33:18 +09:00
Mislav Marohnić
e4f5545e86
Go 1.19: fix comment formatting for moq-generated mocks 2022-12-12 16:58:25 +01:00
Sam Coe
2c0236d096
Add extension upgrade --dry-run (#5098) 2022-04-12 07:18:08 +00:00
meiji163
aad291a3b8 Merge branch 'tmp' into pin-ext 2022-03-07 17:53:42 -08:00
meiji163
bed630452b list pinned exts 2022-03-07 17:49:04 -08:00
meiji163
d7277e396c pinning binary exts 2022-03-07 17:02:22 -08:00
Seito Tanaka
6f66a1d265
Add version to extension list command (#5219)
* Add version to extension list command

* Trim sha only when displaying
2022-03-07 07:14:26 +00:00
meiji163
bdab7de1d2 list pinned exts 2022-03-02 21:06:23 -08:00
meiji163
fe5eca1dd5 pinning binary exts 2022-03-01 15:01:04 -08:00
vilmibm
6950c6ee32 binary extension create
- add a wizard to gh extension create
- add --precompiled-go
- add --precompiled-other
- build out scaffolding for both types of binary extensions
2021-11-23 16:53:45 -06:00
nate smith
42ce8faafa dispatch binary extensions directly 2021-10-19 14:25:33 -05:00
vilmibm
1fe49fa776 fix listing, cleanup 2021-09-28 13:07:01 -05:00
vilmibm
db5bbf799f use manager io in Upgrade 2021-09-28 13:03:00 -05:00
vilmibm
514d4d992c refactor dependencies of ext manager 2021-09-21 15:55:31 -05:00
vilmibm
0e2861a507 WIP refactoring 2021-09-20 17:05:19 -05:00
vilmibm
af7805af53 WIP refactoring 2021-09-20 16:46:54 -05:00
vilmibm
f4d97dcedd WIP refactoring 2021-09-20 16:25:26 -05:00
vilmibm
eeca998640 binary extension support in gh extension install 2021-09-15 18:46:17 -05:00
Sam Coe
e9f7459ce2
Add extension create command 2021-08-19 13:30:34 -07:00
Mislav Marohnić
0d999ddaa1 Rework local extensions for Windows
Replace the implementation that relied on symlinks with the one that
create regular files that act like symlinks: they contain a reference to
the local directory where to find the extension.
2021-07-28 22:47:54 +02:00
Sam Coe
340a1fdc93
Add --force flag for extensions upgrade 2021-07-21 11:06:22 -07:00
Sam Coe
e70bdbf7a9
Add update checking to extensions list 2021-07-20 13:13:20 -07:00
Sam Coe
bc7eaf8004
Add IsLocal helper func 2021-07-01 11:19:25 -07:00
Mislav Marohnić
1ec47d8191 Improvements to gh extensions
- Extensions on Windows now enabled through the `sh.exe` interpreter
- `sh.exe` now found on Windows when git was installed via scoop
- `gh extensions list` command shows origin repo for the extension
- `gh extensions upgrade --all` is required to upgrade all extensions
- Added `gh extensions remove`
- Shell completions now include aliases and extension names
- `gh` help output now lists available extension names
- Extensions are stored to XDG_DATA_HOME
2021-06-21 16:54:08 +02:00