Commit graph

28 commits

Author SHA1 Message Date
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
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
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
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
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
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
Sam Coe
4bd5c2db9d
Rely on go-gh browser resolution (#6237) 2022-09-12 13:23:36 +04:00
Ariel Deitcher
43325fb3e1
Disable interactive prompting with GH_PROMPT_DISABLED (#6082) 2022-08-17 09:11:54 +03: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
Mislav Marohnić
11fbb60ae7 Rename the module to "github.com/cli/cli/v2" 2021-08-25 12:41:30 +02:00
Sam Coe
a07748f1f1
Add support for GH_BROWSER env var 2021-08-17 14:07:49 -07:00
Sam Coe
34b3d5bb86
Add tests and a little polish 2021-08-17 10:05:54 -07:00
Mislav Marohnić
4b2cded1f8 Ensure that tests for command factory never read from user's config
If these tests are going to exerise `factory.New()`, the config getter
should always be overriden since the default config getter reads from
`~/.config/gh` and thus makes tests dependent on the user's environment.
2021-06-17 17:59:34 +02:00
Sam Coe
edfac42384
Set up iostreams in factory default 2021-06-15 09:20:00 -04:00
Sam Coe
53fac59ef9
Cleanup factory/default and add tests 2021-06-15 09:19:16 -04:00