Commit graph

26 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
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
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
William Martin
1d38230675
Move config interfaces into gh package (#9060) 2024-05-10 10:39:36 +02:00
Qiming Xu
5e14987d65
Fix determining executable location in PATH (#8238) 2023-11-14 08:26:19 +00:00
Jun Nishimura
508065b72d
Add verbose flag to api cmd (#7826) 2023-08-25 09:37:37 -07:00
Sam Coe
05bf29d88e
Introduce GH_PATH environment variable (#7025) 2023-03-07 11:30:10 +11:00
Sam Coe
2944f7c3ab
Create git client (#6354) 2022-10-14 07:47:03 +00:00
Sam Coe
6a8deb1f5a
Integrate latest go-gh packages (#6084) 2022-08-18 09:04:13 +03: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
Mislav Marohnić
7387346196 Fix determining the current executable under Homebrew for Linux
We need to use `os.Lstat` instead of `os.Stat` if we are going to
manually inspect files for whether they are a symlink. On macOS, it
looks like `os.Stat` returns information about the symlink itself.
2022-06-20 15:25:29 +02:00
Mislav Marohnić
3cce16e72d Refactor factory.Executable() to be a method rather than a func
This way, factory can satisfy an interface that requires `Executable()`.
2021-12-21 13:50:55 +01:00
Mislav Marohnić
d853ce5bc9 Avoid resolving executable() until requested at runtime
This is to avoid hitting the filesystem and resolving symlinks
unnecessarily. The value of executable is just used conditionally by a
handful of commands.
2021-09-24 14:42:41 +02:00
Mislav Marohnić
11fbb60ae7 Rename the module to "github.com/cli/cli/v2" 2021-08-25 12:41:30 +02: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
Mislav Marohnić
111e8dbcf2 Pass web browser to each individual command
This removes sensitivity to the BROWSER environment variable in tests
and makes it easier to verify the URL that the browser was invoked with
without having to stub sub-processes.
2021-03-19 21:22:37 +01:00
Mislav Marohnić
98f1f5ec0d Use absolute path when configuring gh as git credential
This keeps git operations working even when PATH is modified, e.g. `brew
update` will work even though Homebrew runs the command explicitly
without `/usr/local/bin` in PATH.

Additionally, this inserts a blank value for `credential.*.helper` to
instruct git to ignore previously configured credential helpers, i.e.
those that might have been set up in system configuration files. We do
this because otherwise, git will store the credential obtained from gh
in every other credential helper in the chain, which we want to avoid.

Before:

    git config --global credential.https://github.com.helper '!gh auth git-credential'

After:

    git config --global credential.https://github.com.helper ''
    git config --global --add credential.https://github.com.helper '!/path/to/gh auth git-credential'
2021-03-03 16:20:21 +01:00
Mislav Marohnić
12637d02d6 Isolate pr review command 2020-07-29 19:35:54 +02:00
vilmibm
f3eb092d7e isolate repo fork command and tweak usage
This commit is another isolation refactor, this time for repo fork.
However, I got fed up with the --remote="true|false|prompt" style of
flags and took this opportunity to switch to a set of bool flags:

--remote and --clone
--no-remote and --no-clone

the string args were really non standard and confusing; with only two
bools it was impossible to tell when to prompt.
2020-07-27 13:04:31 -05:00
vilmibm
1831d95433 isolated clone command
This commit hacks the existing repo clone tests into something usable by
the new isolated command. It went ok and was less effort than trying to
introduce the same kind of test format as repo view and gist create.
2020-07-23 16:40:31 -05:00
vilmibm
d92c80b560 just swap BaseRepo implementation 2020-07-23 11:58:22 -05:00
vilmibm
2a99ed9afb add ResolvedBaseRepo 2020-07-23 11:01:29 -05:00
Mislav Marohnić
acf0046718 api command: support {owner} and {repo} placeholders
When `{owner}` and `{repo}` strings are found in request path (for REST
requests) or `query` (for GraphQL), they are replaced with values from
the repository of the current working directory.
2020-06-11 15:00:29 +02:00
Mislav Marohnić
bef62faaea Make NewCmdApi testable 2020-05-20 15:21:35 +02:00