Skip to content

Commit 680e81d

Browse files
fix: correct 'GithubToken' casing to 'GitHubToken' in .NET and Go
Rename GithubToken to GitHubToken (capital H) across all .NET and Go type definitions, client code, tests, test scenarios, and READMEs to match the correct 'GitHub' brand casing. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 0e6561d commit 680e81d

File tree

53 files changed

+92
-92
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+92
-92
lines changed

dotnet/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ new CopilotClient(CopilotClientOptions? options = null)
7777
- `Cwd` - Working directory for the CLI process
7878
- `Environment` - Environment variables to pass to the CLI process
7979
- `Logger` - `ILogger` instance for SDK logging
80-
- `GithubToken` - GitHub token for authentication. When provided, takes priority over other auth methods.
81-
- `UseLoggedInUser` - Whether to use logged-in user for authentication (default: true, but false when `GithubToken` is provided). Cannot be used with `CliUrl`.
80+
- `GitHubToken` - GitHub token for authentication. When provided, takes priority over other auth methods.
81+
- `UseLoggedInUser` - Whether to use logged-in user for authentication (default: true, but false when `GitHubToken` is provided). Cannot be used with `CliUrl`.
8282

8383
#### Methods
8484

dotnet/src/Client.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,9 @@ public CopilotClient(CopilotClientOptions? options = null)
117117
}
118118

119119
// Validate auth options with external server
120-
if (!string.IsNullOrEmpty(_options.CliUrl) && (!string.IsNullOrEmpty(_options.GithubToken) || _options.UseLoggedInUser != null))
120+
if (!string.IsNullOrEmpty(_options.CliUrl) && (!string.IsNullOrEmpty(_options.GitHubToken) || _options.UseLoggedInUser != null))
121121
{
122-
throw new ArgumentException("GithubToken and UseLoggedInUser cannot be used with CliUrl (external server manages its own auth)");
122+
throw new ArgumentException("GitHubToken and UseLoggedInUser cannot be used with CliUrl (external server manages its own auth)");
123123
}
124124

125125
_logger = _options.Logger ?? NullLogger.Instance;
@@ -944,13 +944,13 @@ private async Task VerifyProtocolVersionAsync(Connection connection, Cancellatio
944944
}
945945

946946
// Add auth-related flags
947-
if (!string.IsNullOrEmpty(options.GithubToken))
947+
if (!string.IsNullOrEmpty(options.GitHubToken))
948948
{
949949
args.AddRange(["--auth-token-env", "COPILOT_SDK_AUTH_TOKEN"]);
950950
}
951951

952-
// Default UseLoggedInUser to false when GithubToken is provided
953-
var useLoggedInUser = options.UseLoggedInUser ?? string.IsNullOrEmpty(options.GithubToken);
952+
// Default UseLoggedInUser to false when GitHubToken is provided
953+
var useLoggedInUser = options.UseLoggedInUser ?? string.IsNullOrEmpty(options.GitHubToken);
954954
if (!useLoggedInUser)
955955
{
956956
args.Add("--no-auto-login");
@@ -982,9 +982,9 @@ private async Task VerifyProtocolVersionAsync(Connection connection, Cancellatio
982982
startInfo.Environment.Remove("NODE_DEBUG");
983983

984984
// Set auth token in environment if provided
985-
if (!string.IsNullOrEmpty(options.GithubToken))
985+
if (!string.IsNullOrEmpty(options.GitHubToken))
986986
{
987-
startInfo.Environment["COPILOT_SDK_AUTH_TOKEN"] = options.GithubToken;
987+
startInfo.Environment["COPILOT_SDK_AUTH_TOKEN"] = options.GitHubToken;
988988
}
989989

990990
var cliProcess = new Process { StartInfo = startInfo };

dotnet/src/Types.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ protected CopilotClientOptions(CopilotClientOptions? other)
4444
CliUrl = other.CliUrl;
4545
Cwd = other.Cwd;
4646
Environment = other.Environment;
47-
GithubToken = other.GithubToken;
47+
GitHubToken = other.GitHubToken;
4848
Logger = other.Logger;
4949
LogLevel = other.LogLevel;
5050
Port = other.Port;
@@ -72,13 +72,13 @@ protected CopilotClientOptions(CopilotClientOptions? other)
7272
/// When provided, the token is passed to the CLI server via environment variable.
7373
/// This takes priority over other authentication methods.
7474
/// </summary>
75-
public string? GithubToken { get; set; }
75+
public string? GitHubToken { get; set; }
7676

7777
/// <summary>
7878
/// Whether to use the logged-in user for authentication.
7979
/// When true, the CLI server will attempt to use stored OAuth tokens or gh CLI auth.
80-
/// When false, only explicit tokens (GithubToken or environment variables) are used.
81-
/// Default: true (but defaults to false when GithubToken is provided).
80+
/// When false, only explicit tokens (GitHubToken or environment variables) are used.
81+
/// Default: true (but defaults to false when GitHubToken is provided).
8282
/// </summary>
8383
public bool? UseLoggedInUser { get; set; }
8484

dotnet/test/ClientTests.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -149,14 +149,14 @@ public async Task Should_List_Models_When_Authenticated()
149149
}
150150

151151
[Fact]
152-
public void Should_Accept_GithubToken_Option()
152+
public void Should_Accept_GitHubToken_Option()
153153
{
154154
var options = new CopilotClientOptions
155155
{
156-
GithubToken = "gho_test_token"
156+
GitHubToken = "gho_test_token"
157157
};
158158

159-
Assert.Equal("gho_test_token", options.GithubToken);
159+
Assert.Equal("gho_test_token", options.GitHubToken);
160160
}
161161

162162
[Fact]
@@ -179,26 +179,26 @@ public void Should_Allow_Explicit_UseLoggedInUser_False()
179179
}
180180

181181
[Fact]
182-
public void Should_Allow_Explicit_UseLoggedInUser_True_With_GithubToken()
182+
public void Should_Allow_Explicit_UseLoggedInUser_True_With_GitHubToken()
183183
{
184184
var options = new CopilotClientOptions
185185
{
186-
GithubToken = "gho_test_token",
186+
GitHubToken = "gho_test_token",
187187
UseLoggedInUser = true
188188
};
189189

190190
Assert.True(options.UseLoggedInUser);
191191
}
192192

193193
[Fact]
194-
public void Should_Throw_When_GithubToken_Used_With_CliUrl()
194+
public void Should_Throw_When_GitHubToken_Used_With_CliUrl()
195195
{
196196
Assert.Throws<ArgumentException>(() =>
197197
{
198198
_ = new CopilotClient(new CopilotClientOptions
199199
{
200200
CliUrl = "localhost:8080",
201-
GithubToken = "gho_test_token"
201+
GitHubToken = "gho_test_token"
202202
});
203203
});
204204
}

dotnet/test/CloneTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public void CopilotClientOptions_Clone_CopiesAllProperties()
2424
AutoStart = false,
2525
AutoRestart = false,
2626
Environment = new Dictionary<string, string> { ["KEY"] = "value" },
27-
GithubToken = "ghp_test",
27+
GitHubToken = "ghp_test",
2828
UseLoggedInUser = false,
2929
};
3030

@@ -40,7 +40,7 @@ public void CopilotClientOptions_Clone_CopiesAllProperties()
4040
Assert.Equal(original.AutoStart, clone.AutoStart);
4141
Assert.Equal(original.AutoRestart, clone.AutoRestart);
4242
Assert.Equal(original.Environment, clone.Environment);
43-
Assert.Equal(original.GithubToken, clone.GithubToken);
43+
Assert.Equal(original.GitHubToken, clone.GitHubToken);
4444
Assert.Equal(original.UseLoggedInUser, clone.UseLoggedInUser);
4545
}
4646

dotnet/test/Harness/E2ETestContext.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public IReadOnlyDictionary<string, string> GetEnvironment()
9494
Cwd = WorkDir,
9595
CliPath = GetCliPath(_repoRoot),
9696
Environment = GetEnvironment(),
97-
GithubToken = !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("CI")) ? "fake-token-for-e2e-tests" : null,
97+
GitHubToken = !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("CI")) ? "fake-token-for-e2e-tests" : null,
9898
});
9999

100100
public async ValueTask DisposeAsync()

go/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ Event types: `SessionLifecycleCreated`, `SessionLifecycleDeleted`, `SessionLifec
138138
- `AutoStart` (\*bool): Auto-start server on first use (default: true). Use `Bool(false)` to disable.
139139
- `AutoRestart` (\*bool): Auto-restart on crash (default: true). Use `Bool(false)` to disable.
140140
- `Env` ([]string): Environment variables for CLI process (default: inherits from current process)
141-
- `GithubToken` (string): GitHub token for authentication. When provided, takes priority over other auth methods.
142-
- `UseLoggedInUser` (\*bool): Whether to use logged-in user for authentication (default: true, but false when `GithubToken` is provided). Cannot be used with `CLIUrl`.
141+
- `GitHubToken` (string): GitHub token for authentication. When provided, takes priority over other auth methods.
142+
- `UseLoggedInUser` (\*bool): Whether to use logged-in user for authentication (default: true, but false when `GitHubToken` is provided). Cannot be used with `CLIUrl`.
143143

144144
**SessionConfig:**
145145

go/client.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ func NewClient(options *ClientOptions) *Client {
134134
}
135135

136136
// Validate auth options with external server
137-
if options.CLIUrl != "" && (options.GithubToken != "" || options.UseLoggedInUser != nil) {
138-
panic("GithubToken and UseLoggedInUser cannot be used with CLIUrl (external server manages its own auth)")
137+
if options.CLIUrl != "" && (options.GitHubToken != "" || options.UseLoggedInUser != nil) {
138+
panic("GitHubToken and UseLoggedInUser cannot be used with CLIUrl (external server manages its own auth)")
139139
}
140140

141141
// Parse CLIUrl if provided
@@ -177,8 +177,8 @@ func NewClient(options *ClientOptions) *Client {
177177
if options.AutoRestart != nil {
178178
client.autoRestart = *options.AutoRestart
179179
}
180-
if options.GithubToken != "" {
181-
opts.GithubToken = options.GithubToken
180+
if options.GitHubToken != "" {
181+
opts.GitHubToken = options.GitHubToken
182182
}
183183
if options.UseLoggedInUser != nil {
184184
opts.UseLoggedInUser = options.UseLoggedInUser
@@ -1040,14 +1040,14 @@ func (c *Client) startCLIServer(ctx context.Context) error {
10401040
}
10411041

10421042
// Add auth-related flags
1043-
if c.options.GithubToken != "" {
1043+
if c.options.GitHubToken != "" {
10441044
args = append(args, "--auth-token-env", "COPILOT_SDK_AUTH_TOKEN")
10451045
}
1046-
// Default useLoggedInUser to false when GithubToken is provided
1046+
// Default useLoggedInUser to false when GitHubToken is provided
10471047
useLoggedInUser := true
10481048
if c.options.UseLoggedInUser != nil {
10491049
useLoggedInUser = *c.options.UseLoggedInUser
1050-
} else if c.options.GithubToken != "" {
1050+
} else if c.options.GitHubToken != "" {
10511051
useLoggedInUser = false
10521052
}
10531053
if !useLoggedInUser {
@@ -1074,8 +1074,8 @@ func (c *Client) startCLIServer(ctx context.Context) error {
10741074

10751075
// Add auth token if needed.
10761076
c.process.Env = c.options.Env
1077-
if c.options.GithubToken != "" {
1078-
c.process.Env = append(c.process.Env, "COPILOT_SDK_AUTH_TOKEN="+c.options.GithubToken)
1077+
if c.options.GitHubToken != "" {
1078+
c.process.Env = append(c.process.Env, "COPILOT_SDK_AUTH_TOKEN="+c.options.GitHubToken)
10791079
}
10801080

10811081
if c.useStdio {

go/client_test.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -255,17 +255,17 @@ func TestClient_URLParsing(t *testing.T) {
255255
}
256256

257257
func TestClient_AuthOptions(t *testing.T) {
258-
t.Run("should accept GithubToken option", func(t *testing.T) {
258+
t.Run("should accept GitHubToken option", func(t *testing.T) {
259259
client := NewClient(&ClientOptions{
260-
GithubToken: "gho_test_token",
260+
GitHubToken: "gho_test_token",
261261
})
262262

263-
if client.options.GithubToken != "gho_test_token" {
264-
t.Errorf("Expected GithubToken to be 'gho_test_token', got %q", client.options.GithubToken)
263+
if client.options.GitHubToken != "gho_test_token" {
264+
t.Errorf("Expected GitHubToken to be 'gho_test_token', got %q", client.options.GitHubToken)
265265
}
266266
})
267267

268-
t.Run("should default UseLoggedInUser to nil when no GithubToken", func(t *testing.T) {
268+
t.Run("should default UseLoggedInUser to nil when no GitHubToken", func(t *testing.T) {
269269
client := NewClient(&ClientOptions{})
270270

271271
if client.options.UseLoggedInUser != nil {
@@ -283,9 +283,9 @@ func TestClient_AuthOptions(t *testing.T) {
283283
}
284284
})
285285

286-
t.Run("should allow explicit UseLoggedInUser true with GithubToken", func(t *testing.T) {
286+
t.Run("should allow explicit UseLoggedInUser true with GitHubToken", func(t *testing.T) {
287287
client := NewClient(&ClientOptions{
288-
GithubToken: "gho_test_token",
288+
GitHubToken: "gho_test_token",
289289
UseLoggedInUser: Bool(true),
290290
})
291291

@@ -294,12 +294,12 @@ func TestClient_AuthOptions(t *testing.T) {
294294
}
295295
})
296296

297-
t.Run("should throw error when GithubToken is used with CLIUrl", func(t *testing.T) {
297+
t.Run("should throw error when GitHubToken is used with CLIUrl", func(t *testing.T) {
298298
defer func() {
299299
if r := recover(); r == nil {
300300
t.Error("Expected panic for auth options with CLIUrl")
301301
} else {
302-
matched, _ := regexp.MatchString("GithubToken and UseLoggedInUser cannot be used with CLIUrl", r.(string))
302+
matched, _ := regexp.MatchString("GitHubToken and UseLoggedInUser cannot be used with CLIUrl", r.(string))
303303
if !matched {
304304
t.Errorf("Expected panic message about auth options, got: %v", r)
305305
}
@@ -308,7 +308,7 @@ func TestClient_AuthOptions(t *testing.T) {
308308

309309
NewClient(&ClientOptions{
310310
CLIUrl: "localhost:8080",
311-
GithubToken: "gho_test_token",
311+
GitHubToken: "gho_test_token",
312312
})
313313
})
314314

@@ -317,7 +317,7 @@ func TestClient_AuthOptions(t *testing.T) {
317317
if r := recover(); r == nil {
318318
t.Error("Expected panic for auth options with CLIUrl")
319319
} else {
320-
matched, _ := regexp.MatchString("GithubToken and UseLoggedInUser cannot be used with CLIUrl", r.(string))
320+
matched, _ := regexp.MatchString("GitHubToken and UseLoggedInUser cannot be used with CLIUrl", r.(string))
321321
if !matched {
322322
t.Errorf("Expected panic message about auth options, got: %v", r)
323323
}

go/internal/e2e/testharness/context.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ func (c *TestContext) NewClient() *copilot.Client {
167167

168168
// Use fake token in CI to allow cached responses without real auth
169169
if os.Getenv("CI") == "true" {
170-
options.GithubToken = "fake-token-for-e2e-tests"
170+
options.GitHubToken = "fake-token-for-e2e-tests"
171171
}
172172

173173
return copilot.NewClient(options)

0 commit comments

Comments
 (0)