Commit graph

103 commits

Author SHA1 Message Date
William Martin
268453803e fix(api): propagate InvokingAgent in gh api HTTP client
The gh api command builds its own HTTP client inline without
forwarding InvokingAgent, so the User-Agent header was missing
the Agent/<name> suffix when invoked by AI coding agents.

Thread InvokingAgent through Factory → ApiOptions → HTTPClientOptions,
mirroring the existing AppVersion pattern.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-26 16:55:16 +01:00
Kynan Ware
87426ee236 Add experimental huh-only prompter gated by GH_EXPERIMENTAL_PROMPTER
Introduce a new Prompter implementation (huhPrompter) that uses the
charmbracelet/huh library in its standard interactive mode, as an
alternative to the survey-based default prompter. The new implementation
is gated behind the GH_EXPERIMENTAL_PROMPTER environment variable,
following the same truthy/falsey pattern as GH_ACCESSIBLE_PROMPTER.

Key differences from the accessible prompter:
- No WithAccessible(true) flag (full interactive TUI)
- Uses EchoModePassword (masked with *) instead of EchoModeNone
- No default value annotations appended to prompt text

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-26 14:24:56 +01:00
William Martin
c51769c977 Record agentic invocations in User-Agent header
Detect which AI coding agent is invoking gh by checking well-known
environment variables and include the agent name in the User-Agent
header sent to GitHub APIs.

Supported agents: Codex, Gemini CLI, Copilot CLI, OpenCode,
Claude Code, and Amp. Generic AI_AGENT env var is also supported
with validation to prevent header injection.

Fixes github/cli#1111

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-24 19:58:37 +01:00
William Martin
166db75d36 pin REST API version to 2022-11-28
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-02-13 19:46:16 +01:00
Babak K. Shandiz
2794f7b8d6
fix(factory): add PlainHttpClient to factory
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-10-13 16:42:18 +01:00
Kynan Ware
138bccd437 feat(config): add accessible prompter and spinner 2025-04-22 16:50:58 -06:00
Kynan Ware
dabb29bd36 test(factory): remove needless nil check 2025-04-16 11:21:39 -06:00
Kynan Ware
3eba461afb fix(iostreams): spinner env var is now in factory
- Move env var evaluation to the factory defaults.
- Use only the label for the spinner instead of adding
"working..." every time. "working..." remains the default
when no label is provided.
2025-04-14 15:07:11 -06:00
Andy Feller
5c12f5633e Test for explicit config disable of label colors 2025-04-08 15:27:36 -04:00
Andy Feller
c5206109ca Use truthy value for GH_COLOR_LABELS 2025-04-08 15:24:18 -04:00
Andy Feller
e9a12853cb Merge branch 'trunk' into andyfeler/colorize-label-optin 2025-04-04 09:47:41 -04:00
Andy Feller
3eca268a7f Introduce color_labels support, update commands
This commit implements the actual changes around configuration setting / environment variable logic for displaying labels using their RGB hex color code in terminals with truecolor support.

One of the subtler changes in this commit is renaming generic ColorScheme.HexToRGB logic to render truecolor to ColorScheme.Label as this feature was being used exclusively for labels.  This is due to confusion about introducing the new `color_labels` config on top of generic coloring logic.
2025-04-02 18:24:20 -04:00
Andy Feller
346fab212b Accessible color config boilerplate, colors update
This commit is focused on incorporating cli/go-gh accessible colors configuration setting into GitHub CLI experience along with new color function to supersede ColorScheme.Gray and ColorScheme.Grayf.

Originally, I was considering having all use of ColorScheme.Gray and ColorScheme.Grayf fallback to the new muted logic if accessible colors were enabled, however I decided not being that it exceeds the acceptance criteria.  This means that every command using ColorScheme.Gray needs to be updated to use ColorScheme.Muted
2025-03-31 11:19:51 -04:00
William Martin
b61f2efcac Refactor remote resolver caching tests 2025-02-20 13:15:56 +01:00
Azeem Sajid
f236c7efab Fix remoteResolver caching issue 2025-02-20 13:15:23 +01:00
petercover
bad7098cfe chore: fix some comments
Signed-off-by: petercover <raowanxiang@outlook.com>
2025-01-23 00:47:27 +08:00
William Martin
4da4c82090 Rename secret BaseRepo func 2025-01-15 14:55:17 +01:00
William Martin
b9c597458b Document SmartBaseRepoFunc 2024-12-23 19:07:17 +01:00
William Martin
7a954cde82 Document BaseRepoFunc 2024-12-23 19:07:17 +01:00
William Martin
07e0ff7127 Fix repo fork to use remote protocol if none configured 2024-05-10 10:48:36 +02:00
William Martin
1d38230675
Move config interfaces into gh package (#9060) 2024-05-10 10:39:36 +02:00
Sam Coe
024cb939af Rename authCfg.Token to authCfg.ActiveToken and authCfg.SetToken to authCfg.SetActiveToken 2023-12-06 14:06:28 +01:00
Sam Coe
7924878315
Fix git protocol and refactor Config interface (#8246) 2023-10-27 15:42:05 +02:00
Jun Nishimura
508065b72d
Add verbose flag to api cmd (#7826) 2023-08-25 09:37:37 -07:00
Sam Coe
dbc2f05124
Update go-gh to v2 (#7299)
* Update go-gh

* Update code for go-gh v2
2023-04-16 15:34:23 +10:00
Benjamin Levesque
9596fd5368
Skip checking keyring for token in certain scenarios (#7169) 2023-03-18 08:59:43 +11:00
Sam Coe
c9a2d85793
Cleanup config.AuthToken and config.DefaultHost methods (#7049) 2023-02-28 00:24:45 +00:00
Sam Coe
a33e12a21d
Refactor Config interface in preperation for encrypted token storage (#7033) 2023-02-28 10:51:12 +11:00
vilmibm
290d90430d select base repo correctly when only one remote 2023-01-03 11:58:48 -08:00
vilmibm
f5d19b831e error instead of prompt when no base repo + fixes 2022-12-15 11:44:37 -08:00
Sam Coe
6bbfc5056d
Use git client in extension manager (#6547) 2022-11-10 11:38:12 +02:00
Sam Coe
4294ee14a1
revert revert 57fbe4f317 (#6474) 2022-10-20 12:17:20 +00:00
Sam Coe
2cefb9fa59
Fix pr create regression (#6472)
* Revert "Refactor to use new git client (#6447)"

This reverts commit 57fbe4f317.

* Fix pr create regression
2022-10-20 12:46:23 +03:00
Sam Coe
57fbe4f317
Refactor to use new git client (#6447) 2022-10-19 21:11:36 +03:00
Sam Coe
2944f7c3ab
Create git client (#6354) 2022-10-14 07:47:03 +00:00
Eng Zer Jun
471cbea4fa
test: use t.Setenv to set env vars in tests (#6333)
This commit replaces `os.Setenv` with `t.Setenv` in tests. The
environment variable is automatically restored to its original value
when the test and all its subtests complete.

Reference: https://pkg.go.dev/testing#T.Setenv
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-09-26 08:46:02 +00:00
vilmibm
7b21a3ea45 use Prompter in context 2022-09-21 11:33:28 -07:00
Sam Coe
4bd5c2db9d
Rely on go-gh browser resolution (#6237) 2022-09-12 13:23:36 +04:00
Sam Coe
6a8deb1f5a
Integrate latest go-gh packages (#6084) 2022-08-18 09:04:13 +03:00
Ariel Deitcher
43325fb3e1
Disable interactive prompting with GH_PROMPT_DISABLED (#6082) 2022-08-17 09:11:54 +03:00
vilmibm
8bba7f9624 rename NewPrompter to New 2022-08-15 13:28:15 -05:00
vilmibm
791b8b4173 Merge remote-tracking branch 'origin/trunk' into prompt-factory 2022-08-15 13:21:22 -05:00
Mislav Marohnić
d21d388b8d
Restore old GH_DEBUG=1 behavior for HTTP logging (#6054)
- No HTTP bodies or headers are logged until `GH_DEBUG=api` is used.
- Logging to terminal now supports colorization.
2022-08-10 17:59:13 +02:00
vilmibm
f7d5c5f725 move prompter to own package 2022-07-26 16:41:13 -05:00
vilmibm
4afb567d06 WIP: survey wrapper 2022-07-26 14:39:38 -05:00
casswedson
00bc550dc6 chore: typo hunting ft. codespell 2022-07-09 21:41:09 -05:00
Sam Coe
cacff4ad6d
Use go-gh config package (#5771) 2022-06-23 11:50:04 +00:00
Sam Coe
074ed50b8a
Integrate go-gh API package (#5614) 2022-06-23 04:05:31 +01:00
Sam Coe
743a747804
Use go-gh for SSH hostname alias translation (#5654) 2022-06-08 21:32:29 +00:00
Håvard Anda Estensen
58cb773e09
Replace ioutil with io and os (#5498) 2022-04-26 13:07:44 +02:00