diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index be21442..e73abfc 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -1,4 +1,4 @@
-# PR / main: linux-x64 Payload + pack pointer + ghx.linux-x64. Full RID matrix is publish.yml.
+# PR / main: linux-x64 Payload + pack pointer + gh.linux-x64. Full RID matrix is publish.yml.
name: build
on:
@@ -59,23 +59,23 @@ jobs:
- name: ๐งช test
run: dnx --yes retest -- --no-build
- - name: ๐ฆ ghx
+ - name: ๐ฆ gh
run: |
$ErrorActionPreference = 'Stop'
- dotnet pack src/ghx/ghx.csproj -c $env:Configuration -p:GeneratePackageOnBuild=false -bl:pointer-pack-ghx.binlog
- if ($LASTEXITCODE -ne 0) { throw "ghx pointer pack failed with exit code $LASTEXITCODE." }
- dotnet pack src/ghx/ghx.csproj -c $env:Configuration -r linux-x64 -p:GeneratePackageOnBuild=false -bl:pack-ghx-linux-x64.binlog
- if ($LASTEXITCODE -ne 0) { throw "ghx linux-x64 pack failed with exit code $LASTEXITCODE." }
+ dotnet pack src/gh/gh.csproj -c $env:Configuration -p:GeneratePackageOnBuild=false -bl:pointer-pack-gh.binlog
+ if ($LASTEXITCODE -ne 0) { throw "gh pointer pack failed with exit code $LASTEXITCODE." }
+ dotnet pack src/gh/gh.csproj -c $env:Configuration -r linux-x64 -p:GeneratePackageOnBuild=false -bl:pack-gh-linux-x64.binlog
+ if ($LASTEXITCODE -ne 0) { throw "gh linux-x64 pack failed with exit code $LASTEXITCODE." }
- name: โ
unix execute bits
run: |
$ErrorActionPreference = 'Stop'
$script = Join-Path $pwd 'src/GitHub.Cli/unix-exec.ps1'
$cli = Get-ChildItem bin -Filter "GitHub.Cli.linux-x64.*.nupkg" | Where-Object Name -notlike '*.symbols.*' | Select-Object -First 1
- $ghx = Get-ChildItem bin -Filter "ghx.linux-x64.*.nupkg" | Where-Object Name -notlike '*.symbols.*' | Select-Object -First 1
+ $tool = Get-ChildItem bin -Filter "gh.linux-x64.*.nupkg" | Where-Object Name -notlike '*.symbols.*' | Select-Object -First 1
if (-not $cli) { throw "GitHub.Cli.linux-x64 nupkg not found" }
- if (-not $ghx) { throw "ghx.linux-x64 nupkg not found" }
- foreach ($pkg in @($cli, $ghx)) {
+ if (-not $tool) { throw "gh.linux-x64 nupkg not found" }
+ foreach ($pkg in @($cli, $tool)) {
& pwsh -NoProfile -File $script -Nupkg $pkg.FullName -Assert
if ($LASTEXITCODE -ne 0) { throw "unix execute bits missing in $($pkg.Name)" }
}
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
index 2d01488..9ded75f 100644
--- a/.github/workflows/publish.yml
+++ b/.github/workflows/publish.yml
@@ -56,10 +56,10 @@ jobs:
if ($LASTEXITCODE -ne 0) { throw "GitHub.Cli pointer pack failed with exit code $LASTEXITCODE." }
dotnet pack src/GitHub.Cli/GitHub.Cli.csproj -c $env:Configuration -r $rid $version -p:GeneratePackageOnBuild=false -bl:"pack-$rid.binlog"
if ($LASTEXITCODE -ne 0) { throw "GitHub.Cli $rid pack failed with exit code $LASTEXITCODE." }
- dotnet pack src/ghx/ghx.csproj -c $env:Configuration $version -p:GeneratePackageOnBuild=false -bl:pointer-pack-ghx.binlog
- if ($LASTEXITCODE -ne 0) { throw "ghx pointer pack failed with exit code $LASTEXITCODE." }
- dotnet pack src/ghx/ghx.csproj -c $env:Configuration -r $rid $version -p:GeneratePackageOnBuild=false -bl:"pack-ghx-$rid.binlog"
- if ($LASTEXITCODE -ne 0) { throw "ghx $rid pack failed with exit code $LASTEXITCODE." }
+ dotnet pack src/gh/gh.csproj -c $env:Configuration $version -p:GeneratePackageOnBuild=false -bl:pointer-pack-gh.binlog
+ if ($LASTEXITCODE -ne 0) { throw "gh pointer pack failed with exit code $LASTEXITCODE." }
+ dotnet pack src/gh/gh.csproj -c $env:Configuration -r $rid $version -p:GeneratePackageOnBuild=false -bl:"pack-gh-$rid.binlog"
+ if ($LASTEXITCODE -ne 0) { throw "gh $rid pack failed with exit code $LASTEXITCODE." }
- name: โ
unix execute bits
if: matrix.rid != 'win-x64'
@@ -67,10 +67,10 @@ jobs:
$ErrorActionPreference = 'Stop'
$script = Join-Path $pwd 'src/GitHub.Cli/unix-exec.ps1'
$cli = Get-ChildItem bin -Filter "GitHub.Cli.${{ matrix.rid }}.*.nupkg" | Where-Object Name -notlike '*.symbols.*' | Select-Object -First 1
- $ghx = Get-ChildItem bin -Filter "ghx.${{ matrix.rid }}.*.nupkg" | Where-Object Name -notlike '*.symbols.*' | Select-Object -First 1
+ $tool = Get-ChildItem bin -Filter "gh.${{ matrix.rid }}.*.nupkg" | Where-Object Name -notlike '*.symbols.*' | Select-Object -First 1
if (-not $cli) { throw "GitHub.Cli.${{ matrix.rid }} nupkg not found" }
- if (-not $ghx) { throw "ghx.${{ matrix.rid }} nupkg not found" }
- foreach ($pkg in @($cli, $ghx)) {
+ if (-not $tool) { throw "gh.${{ matrix.rid }} nupkg not found" }
+ foreach ($pkg in @($cli, $tool)) {
& pwsh -NoProfile -File $script -Nupkg $pkg.FullName -Assert
if ($LASTEXITCODE -ne 0) { throw "unix execute bits missing in $($pkg.Name)" }
}
@@ -83,7 +83,7 @@ jobs:
# into one GitHub.Cli.{version}.nupkg corrupts the zip (NUGET 400 / sleet EOCD).
path: |
bin/GitHub.Cli.${{ matrix.rid }}.*.nupkg
- bin/ghx.${{ matrix.rid }}.*.nupkg
+ bin/gh.${{ matrix.rid }}.*.nupkg
retention-days: 30
if-no-files-found: error
@@ -94,34 +94,34 @@ jobs:
name: package-pointer
path: |
bin/GitHub.Cli.${{ env.Version }}.nupkg
- bin/ghx.${{ env.Version }}.nupkg
+ bin/gh.${{ env.Version }}.nupkg
retention-days: 30
if-no-files-found: error
- - name: ๐งช ghx --version
+ - name: ๐งช dotnet-gh --version
run: |
$ErrorActionPreference = 'Stop'
- $nupkg = Get-ChildItem bin -Filter "ghx.${{ matrix.rid }}.*.nupkg" | Where-Object Name -notlike '*.symbols.*' | Select-Object -First 1
- if (-not $nupkg) { throw "ghx.${{ matrix.rid }} nupkg not found" }
- $extract = Join-Path $env:RUNNER_TEMP "ghx-${{ matrix.rid }}"
+ $nupkg = Get-ChildItem bin -Filter "gh.${{ matrix.rid }}.*.nupkg" | Where-Object Name -notlike '*.symbols.*' | Select-Object -First 1
+ if (-not $nupkg) { throw "gh.${{ matrix.rid }} nupkg not found" }
+ $extract = Join-Path $env:RUNNER_TEMP "gh-${{ matrix.rid }}"
$script = Join-Path $pwd 'src/GitHub.Cli/unix-exec.ps1'
& pwsh -NoProfile -File $script -Nupkg $nupkg.FullName -Destination $extract
if ($LASTEXITCODE -ne 0) { throw "nupkg extract failed for $($nupkg.Name)" }
- $ghx = Get-ChildItem $extract -Recurse -File | Where-Object { $_.Name -eq 'ghx' -or $_.Name -eq 'ghx.exe' } | Select-Object -First 1
- if (-not $ghx) { throw "ghx executable not found in $($nupkg.Name)" }
+ $tool = Get-ChildItem $extract -Recurse -File | Where-Object { $_.Name -eq 'dotnet-gh' -or $_.Name -eq 'dotnet-gh.exe' } | Select-Object -First 1
+ if (-not $tool) { throw "dotnet-gh executable not found in $($nupkg.Name)" }
if (-not $IsWindows) {
$gh = Get-ChildItem $extract -Recurse -File | Where-Object { $_.FullName.Replace('\', '/') -like '*/gh/bin/gh' } | Select-Object -First 1
if (-not $gh) { throw "gh/bin/gh not found in $($nupkg.Name)" }
$exec = [System.IO.UnixFileMode]::UserExecute
- if (([System.IO.File]::GetUnixFileMode($ghx.FullName) -band $exec) -eq 0) {
- throw "ghx is not executable after extract: $($ghx.FullName)"
+ if (([System.IO.File]::GetUnixFileMode($tool.FullName) -band $exec) -eq 0) {
+ throw "dotnet-gh is not executable after extract: $($tool.FullName)"
}
if (([System.IO.File]::GetUnixFileMode($gh.FullName) -band $exec) -eq 0) {
throw "gh/bin/gh is not executable after extract: $($gh.FullName)"
}
}
- & $ghx.FullName --version
- if ($LASTEXITCODE -ne 0) { throw "ghx --version failed with exit code $LASTEXITCODE." }
+ & $tool.FullName --version
+ if ($LASTEXITCODE -ne 0) { throw "dotnet-gh --version failed with exit code $LASTEXITCODE." }
- name: ๐ logs
uses: actions/upload-artifact@v4
@@ -163,12 +163,12 @@ jobs:
"GitHub.Cli.linux-arm64.$env:Version.nupkg",
"GitHub.Cli.osx-x64.$env:Version.nupkg",
"GitHub.Cli.osx-arm64.$env:Version.nupkg",
- "ghx.$env:Version.nupkg",
- "ghx.win-x64.$env:Version.nupkg",
- "ghx.linux-x64.$env:Version.nupkg",
- "ghx.linux-arm64.$env:Version.nupkg",
- "ghx.osx-x64.$env:Version.nupkg",
- "ghx.osx-arm64.$env:Version.nupkg"
+ "gh.$env:Version.nupkg",
+ "gh.win-x64.$env:Version.nupkg",
+ "gh.linux-x64.$env:Version.nupkg",
+ "gh.linux-arm64.$env:Version.nupkg",
+ "gh.osx-x64.$env:Version.nupkg",
+ "gh.osx-arm64.$env:Version.nupkg"
)) {
if ($names -notcontains $need) { throw "Missing $need" }
}
diff --git a/CONTEXT.md b/CONTEXT.md
index 4835cb6..6ef0f0c 100644
--- a/CONTEXT.md
+++ b/CONTEXT.md
@@ -1,6 +1,6 @@
# GitHub.Cli
-NuGet pointer and per-RID payloads that put a working GitHub CLI next to a .NET app or tool. Humans run that payload through **ghx**.
+NuGet pointer and per-RID payloads that put a working GitHub CLI next to a .NET app or tool. Humans run that payload through the **gh** tool package.
## Language
@@ -20,12 +20,12 @@ _Avoid_: native files, native/, binaries, sidecar
The managed type in namespace `GitHub` whose `ResolvePath` returns the Payload's `gh` executable (`gh.exe` on Windows). Callers write `GitHub.Cli.ResolvePath()`.
_Avoid_: Gh, Ghx, GitHubCli, ResolveBinaryPath
-**ghx**:
-The passthrough .NET tool that execs the Payload `gh` with the same arguments. Primary human vehicle via `dnx`/`ndnx ghx`.
-_Avoid_: GitHub CLI, gh, wrapper with its own GitHub verbs
+**gh** (tool package):
+The passthrough .NET tool. Package id `gh` so `dnx`/`ndnx gh`. `ToolCommandName` is `dotnet-gh`, so a locally/globally installed tool is `dotnet gh` and does not steal the `gh` command from GitHub's native CLI.
+_Avoid_: installing a command named `gh`; wrapping with its own GitHub verbs
**Execute**:
-ghx replacing itself with the Payload `gh`. Every argument is forwarded. The only exception is a lone `--version`, which prints ghx and `gh`.
+The tool replacing itself with the Payload `gh`. Every argument is forwarded. The only exception is a lone `--version`, which prints the wrapper version line (`gh {version}`) then payload `gh --version`.
_Avoid_: wrap, shell out and wait as the product metaphor (implementation may still spawn)
**Upstream**:
diff --git a/docs/adr/0002-nupkg-version-is-upstream.md b/docs/adr/0002-nupkg-version-is-upstream.md
index 382c0ba..fda587f 100644
--- a/docs/adr/0002-nupkg-version-is-upstream.md
+++ b/docs/adr/0002-nupkg-version-is-upstream.md
@@ -1,3 +1,3 @@
# Nupkg version is Upstream
-`GitHub.Cli` and `ghx` use the GitHub CLI version (`2.98.0`) so `ndnx ghx@2.98.0` is that CLI. The pin is `github-cli.version`. CI dogfood stays `42.42.*`. Packaging-only republishes of the same CLI use a SemVer label, not a different major.
+`GitHub.Cli` and the `gh` tool use the GitHub CLI version (`2.98.0`) so `ndnx gh@2.98.0` is that CLI. The pin is `github-cli.version`. CI dogfood stays `42.42.*`. Packaging-only republishes of the same CLI use a SemVer label, not a different major.
diff --git a/ghx.slnx b/ghx.slnx
index fb956ed..25f2446 100644
--- a/ghx.slnx
+++ b/ghx.slnx
@@ -1,5 +1,5 @@
-
+
diff --git a/readme.md b/readme.md
index ccdb319..3036acd 100644
--- a/readme.md
+++ b/readme.md
@@ -1,7 +1,7 @@
# ghx
-[](https://www.nuget.org/packages/ghx)
-[](https://www.nuget.org/packages/ghx)
+[](https://www.nuget.org/packages/gh)
+[](https://www.nuget.org/packages/gh)
[](https://github.com/devlooped/oss/blob/main/osmfeula.txt)
[](https://github.com/devlooped/oss/blob/main/license.txt)
@@ -21,11 +21,13 @@ OSMF tier. A single fee covers all of [Devlooped packages](https://www.nuget.org
## Usage
```bash
-ndnx ghx -- repo list
-dnx ghx -- repo list
-ghx --version # ghx version, then gh --version
+ndnx gh -- repo list
+dnx gh -- repo list
+dotnet tool install gh && dotnet gh --version
```
+`dnx`/`ndnx` use the package id `gh`. An installed tool is `dotnet gh` (`ToolCommandName` `dotnet-gh`) so it does not replace GitHub's native `gh` on PATH.
+
`PackageReference` `GitHub.Cli` and pack/publish for your RID to copy `gh/` next to the app. `GitHub.Cli.ResolvePath()` is the Payload `gh` executable.
diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets
index 0f03456..6e51ced 100644
--- a/src/Directory.Build.targets
+++ b/src/Directory.Build.targets
@@ -224,7 +224,7 @@
GitHub.Cli", githubCli);
@@ -51,7 +51,7 @@ public void Pointer_and_rid_csproj_use_pack_split()
Assert.Contains("Assert-NupkgUnixExecuteBits", unixExec);
Assert.Contains("Expand-NupkgWithUnixModes", unixExec);
Assert.Contains("gh/bin/gh", unixExec);
- Assert.Contains("ghx", unixExec);
+ Assert.Contains("dotnet-gh", unixExec);
var directoryTargets = File.ReadAllText(Path.Combine(repo, "src", "Directory.Build.targets"));
Assert.Contains("StampUnixExecuteBitsOnNupkg", directoryTargets);
@@ -72,27 +72,29 @@ public void Pointer_and_rid_csproj_use_pack_split()
Assert.Contains(@"TargetPath>gh\", consumer.Replace('/', '\\'));
Assert.DoesNotContain("runtimes/$(RuntimeIdentifier)/native/", consumer);
- var ghx = File.ReadAllText(Path.Combine(repo, "src", "ghx", "ghx.csproj"));
- Assert.Contains("ghx", ghx);
- Assert.Contains("true", ghx);
- Assert.Contains("true", ghx);
- Assert.Contains("ghx", ghx);
- Assert.Contains("win-x64;linux-x64;linux-arm64;osx-x64;osx-arm64", ghx);
- Assert.Contains("""""", ghx);
- Assert.DoesNotContain("NuGetizer", ghx, StringComparison.OrdinalIgnoreCase);
- Assert.Contains("Readme", ghx);
- var nuget = File.ReadAllText(Path.Combine(repo, "src", "ghx", "nuget.config"));
+ var tool = File.ReadAllText(Path.Combine(repo, "src", "gh", "gh.csproj"));
+ Assert.Contains("gh", tool);
+ Assert.Contains("true", tool);
+ Assert.Contains("true", tool);
+ Assert.Contains("dotnet-gh", tool);
+ Assert.Contains("dotnet-gh", tool);
+ Assert.Contains("win-x64;linux-x64;linux-arm64;osx-x64;osx-arm64", tool);
+ Assert.Contains("""""", tool);
+ Assert.DoesNotContain("NuGetizer", tool, StringComparison.OrdinalIgnoreCase);
+ Assert.Contains("Readme", tool);
+ var nuget = File.ReadAllText(Path.Combine(repo, "src", "gh", "nuget.config"));
Assert.Contains("key=\"local\"", nuget);
Assert.Contains("../../bin", nuget);
Assert.Contains("GitHub.Cli", nuget);
- Assert.DoesNotContain("win-arm64", ghx);
- Assert.DoesNotContain("ghx.$(RuntimeIdentifier)", ghx);
+ Assert.Contains("package pattern=\"gh\"", nuget);
+ Assert.DoesNotContain("win-arm64", tool);
+ Assert.DoesNotContain("gh.$(RuntimeIdentifier)", tool);
Assert.False(File.Exists(Path.Combine(repo, "src", "GitHub.Cli", "runtime.json")));
foreach (var rid in SupportedRids)
{
Assert.Contains(rid, githubCli);
- Assert.Contains(rid, ghx);
+ Assert.Contains(rid, tool);
}
}
@@ -185,12 +187,12 @@ public void Packed_nupkgs_have_pointer_and_rid_layout()
AssertUnixExecuteBits(ridPkg);
}
- foreach (var ghxRid in Directory.GetFiles(bin, "ghx.*.nupkg")
+ foreach (var toolRid in Directory.GetFiles(bin, "gh.*.nupkg")
.Where(f => !f.Contains(".symbols.", StringComparison.OrdinalIgnoreCase)
&& SupportedRids.Any(r => Path.GetFileName(f).Contains("." + r + ".", StringComparison.Ordinal)
&& !Path.GetFileName(f).Contains(".win-", StringComparison.Ordinal))))
{
- AssertUnixExecuteBits(ghxRid);
+ AssertUnixExecuteBits(toolRid);
}
}
@@ -203,11 +205,11 @@ public void Unix_exec_script_stamps_and_asserts_zip_modes()
Directory.CreateDirectory(scratch);
try
{
- var nupkg = Path.Combine(scratch, "ghx.linux-x64.1.0.0.nupkg");
+ var nupkg = Path.Combine(scratch, "gh.linux-x64.1.0.0.nupkg");
using (var archive = ZipFile.Open(nupkg, ZipArchiveMode.Create))
{
archive.CreateEntry("tools/any/linux-x64/gh/bin/gh");
- archive.CreateEntry("tools/any/linux-x64/ghx");
+ archive.CreateEntry("tools/any/linux-x64/dotnet-gh");
archive.CreateEntry("tools/any/linux-x64/gh/readme.txt");
}
@@ -227,7 +229,7 @@ public void Unix_exec_script_stamps_and_asserts_zip_modes()
using (var zip = ZipFile.OpenRead(nupkg))
{
Assert.True(HasUnixExecute(zip.GetEntry("tools/any/linux-x64/gh/bin/gh")!.ExternalAttributes));
- Assert.True(HasUnixExecute(zip.GetEntry("tools/any/linux-x64/ghx")!.ExternalAttributes));
+ Assert.True(HasUnixExecute(zip.GetEntry("tools/any/linux-x64/dotnet-gh")!.ExternalAttributes));
Assert.False(HasUnixExecute(zip.GetEntry("tools/any/linux-x64/gh/readme.txt")!.ExternalAttributes));
}
@@ -239,7 +241,7 @@ public void Unix_exec_script_stamps_and_asserts_zip_modes()
Expand-NupkgWithUnixModes '{nupkg.Replace("'", "''", StringComparison.Ordinal)}' '{dest.Replace("'", "''", StringComparison.Ordinal)}'
""");
var extractedGh = Path.Combine(dest, "tools", "any", "linux-x64", "gh", "bin", "gh");
- var extractedHost = Path.Combine(dest, "tools", "any", "linux-x64", "ghx");
+ var extractedHost = Path.Combine(dest, "tools", "any", "linux-x64", "dotnet-gh");
Assert.True(File.Exists(extractedGh), extractedGh);
Assert.True(File.Exists(extractedHost), extractedHost);
if (!OperatingSystem.IsWindows())
diff --git a/src/Tests/Tests.csproj b/src/Tests/Tests.csproj
index 5b92910..0b250e4 100644
--- a/src/Tests/Tests.csproj
+++ b/src/Tests/Tests.csproj
@@ -14,6 +14,6 @@
-
+
diff --git a/src/ghx/Program.cs b/src/gh/Program.cs
similarity index 94%
rename from src/ghx/Program.cs
rename to src/gh/Program.cs
index 96447b5..345c637 100644
--- a/src/ghx/Program.cs
+++ b/src/gh/Program.cs
@@ -11,7 +11,7 @@ static int Main(string[] args)
var version = typeof(Program).Assembly
.GetCustomAttribute()
?.InformationalVersion ?? "0.0.0";
- Console.WriteLine("ghx " + version);
+ Console.WriteLine("gh " + version);
}
var start = new ProcessStartInfo
diff --git a/src/ghx/ghx.csproj b/src/gh/gh.csproj
similarity index 71%
rename from src/ghx/ghx.csproj
rename to src/gh/gh.csproj
index d7ab767..3d85624 100644
--- a/src/ghx/ghx.csproj
+++ b/src/gh/gh.csproj
@@ -2,13 +2,13 @@
Exe
net10.0
- ghx
- ghx
- ghx
- Execute the bundled GitHub CLI. ndnx ghx -- repo list.
+ gh
+ gh
+ dotnet-gh
+ Execute the bundled GitHub CLI. ndnx gh / dnx gh / dotnet gh.
true
true
- ghx
+ dotnet-gh
win-x64;linux-x64;linux-arm64;osx-x64;osx-arm64
true
$(NoWarn);NU5128
@@ -18,7 +18,8 @@
diff --git a/src/ghx/nuget.config b/src/gh/nuget.config
similarity index 91%
rename from src/ghx/nuget.config
rename to src/gh/nuget.config
index c4c5ccc..fc2c5d8 100644
--- a/src/ghx/nuget.config
+++ b/src/gh/nuget.config
@@ -19,8 +19,8 @@
-
-
+
+
diff --git a/src/ghx/readme.md b/src/gh/readme.md
similarity index 100%
rename from src/ghx/readme.md
rename to src/gh/readme.md