Skip to content

Commit 82729d4

Browse files
CR feedback
1 parent 69eca40 commit 82729d4

File tree

4 files changed

+15
-6
lines changed

4 files changed

+15
-6
lines changed

.github/workflows/dotnet-sdk-tests.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,5 +80,4 @@ jobs:
8080
- name: Run .NET SDK tests
8181
env:
8282
COPILOT_HMAC_KEY: ${{ secrets.COPILOT_DEVELOPER_CLI_INTEGRATION_HMAC_KEY }}
83-
COPILOT_CLI_PATH: ${{ steps.setup-copilot.outputs.cli-path }}
8483
run: dotnet test --no-build -v n

dotnet/src/Client.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -975,7 +975,7 @@ private async Task VerifyProtocolVersionAsync(Connection connection, Cancellatio
975975
private static string? GetBundledCliPath(out string searchedPath)
976976
{
977977
var binaryName = OperatingSystem.IsWindows() ? "copilot.exe" : "copilot";
978-
var rid = System.Runtime.InteropServices.RuntimeInformation.RuntimeIdentifier;
978+
var rid = Path.GetFileName(System.Runtime.InteropServices.RuntimeInformation.RuntimeIdentifier);
979979
searchedPath = Path.Combine(AppContext.BaseDirectory, "runtimes", rid, "native", binaryName);
980980
return File.Exists(searchedPath) ? searchedPath : null;
981981
}

dotnet/src/Types.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ public enum ConnectionState
2424

2525
public class CopilotClientOptions
2626
{
27+
/// <summary>
28+
/// Path to the Copilot CLI executable. If not specified, uses the bundled CLI from the SDK.
29+
/// </summary>
2730
public string? CliPath { get; set; }
2831
public string[]? CliArgs { get; set; }
2932
public string? Cwd { get; set; }

dotnet/src/build/GitHub.Copilot.SDK.targets

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
<!-- Download and extract CLI binary -->
3030
<Target Name="_DownloadCopilotCli" BeforeTargets="BeforeBuild" Condition="'$(_CopilotPlatform)' != ''">
31-
<Error Condition="'$(CopilotCliVersion)' == ''" Text="CopilotCliVersion is not set. The GitHub.Copilot.SDK.Version.props file may be missing from the NuGet package." />
31+
<Error Condition="'$(CopilotCliVersion)' == ''" Text="CopilotCliVersion is not set. The GitHub.Copilot.SDK.props file may be missing from the NuGet package." />
3232

3333
<!-- Compute paths using version (now available) -->
3434
<PropertyGroup>
@@ -38,14 +38,21 @@
3838
<_CopilotDownloadUrl>https://registry.npmjs.org/@github/copilot-$(_CopilotPlatform)/-/copilot-$(_CopilotPlatform)-$(CopilotCliVersion).tgz</_CopilotDownloadUrl>
3939
</PropertyGroup>
4040

41+
<!-- Delete archive if binary missing (handles partial/corrupted downloads) -->
42+
<Delete Files="$(_CopilotArchivePath)" Condition="!Exists('$(_CopilotCliBinaryPath)') And Exists('$(_CopilotArchivePath)')" />
43+
4144
<!-- Download if not cached -->
4245
<MakeDir Directories="$(_CopilotCacheDir)" Condition="!Exists('$(_CopilotCliBinaryPath)')" />
4346
<Message Importance="high" Text="Downloading Copilot CLI $(CopilotCliVersion) for $(_CopilotPlatform)..." Condition="!Exists('$(_CopilotCliBinaryPath)')" />
4447
<DownloadFile SourceUrl="$(_CopilotDownloadUrl)" DestinationFolder="$(_CopilotCacheDir)" DestinationFileName="copilot.tgz"
45-
Condition="!Exists('$(_CopilotCliBinaryPath)') And !Exists('$(_CopilotArchivePath)')" />
48+
Condition="!Exists('$(_CopilotCliBinaryPath)')" />
4649

47-
<!-- Extract using tar -->
48-
<Exec Command="tar -xzf &quot;$(_CopilotArchivePath)&quot; --strip-components=1 -C &quot;$(_CopilotCacheDir)&quot;"
50+
<!-- Extract using tar (use Windows system tar explicitly to avoid Git bash tar issues) -->
51+
<PropertyGroup>
52+
<_TarCommand Condition="$([MSBuild]::IsOSPlatform('Windows'))">$(SystemRoot)\System32\tar.exe</_TarCommand>
53+
<_TarCommand Condition="'$(_TarCommand)' == ''">tar</_TarCommand>
54+
</PropertyGroup>
55+
<Exec Command="&quot;$(_TarCommand)&quot; -xzf &quot;$(_CopilotArchivePath)&quot; --strip-components=1 -C &quot;$(_CopilotCacheDir)&quot;"
4956
Condition="!Exists('$(_CopilotCliBinaryPath)')" />
5057

5158
<Error Condition="!Exists('$(_CopilotCliBinaryPath)')" Text="Failed to extract Copilot CLI binary to $(_CopilotCliBinaryPath)" />

0 commit comments

Comments
 (0)