Skip to content

Commit 8992ba9

Browse files
stephentoubCopilot
andauthored
Fix GitHub brand casing in SDK public surface (#1531)
* Fix GitHub brand casing in SDK public surface Generated identifiers and docs spelled the brand as "Github" instead of "GitHub". The names derive from schema titles/definition keys and from lowercase wire values, so the fix is applied in codegen rather than by hand-editing generated output. - scripts/codegen/utils.ts: add shared brand normalization (loadSchemaJson) that corrects title/description/markdownDescription, \ name segments, and definitions/\ keys, with collision detection. Wire values such as "github" and "github_reference" are left lowercase. - Per-language casers fixed: typescript, python, csharp (fixBrandCasing), rust (normalizeSchemaBrandCasing + fixBrandCasing), and go via the existing identifier override map ("github" -> "GitHub"). - java/scripts/codegen/java.ts: local copies of the same helpers wired into toPascalCase/toJavaClassName and the schema load sites. - Regenerated nodejs, dotnet, python, go, and rust outputs. - Java attachment union types are no longer emitted by the generator (Object fallback for the 5-branch anyOf); hand-corrected the casing and renamed the stale UserMessageAttachment*/SendAttachment* GitHub reference files. - Updated E2E tests referencing the renamed symbols (go, dotnet, python, rust) and corrected GitHubToken casing in docs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Use order-insensitive stable stringify for Java codegen collision check renameBrandDefinitionKeys compared schema fragments with JSON.stringify, which is sensitive to object key order and could report false-positive collisions (or miss real ones). Add a local key-sorted stableStringify helper (mirroring scripts/codegen/utils.ts) and use it for the check. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 5995295 commit 8992ba9

35 files changed

Lines changed: 604 additions & 418 deletions

.github/agents/docs-maintenance.agent.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ cat go/types.go | grep -A 15 "type SessionHooks struct"
377377
```
378378

379379
**Must match (PascalCase for exported):**
380-
- `ClientOptions` fields: `CLIPath`, `CLIUrl`, `UseStdio`, `Port`, `LogLevel`, `AutoStart`, `Env`, `GithubToken`, `UseLoggedInUser`
380+
- `ClientOptions` fields: `CLIPath`, `CLIUrl`, `UseStdio`, `Port`, `LogLevel`, `AutoStart`, `Env`, `GitHubToken`, `UseLoggedInUser`
381381
- `SessionConfig` fields: `Model`, `Tools`, `Hooks`, `SystemMessage`, `MCPServers`, `AvailableTools`, `ExcludedTools`, `Streaming`, `ReasoningEffort`, `Provider`, `InfiniteSessions`, `CustomAgents`, `WorkingDirectory`
382382
- `Session` methods: `Send()`, `SendAndWait()`, `GetMessages()`, `Disconnect()`, `Abort()`, `ExportSession()`
383383
- Hook fields: `OnPreToolUse`, `OnPostToolUse`, `OnPostToolUseFailure`, `OnUserPromptSubmitted`, `OnSessionStart`, `OnSessionEnd`, `OnErrorOccurred`
@@ -395,7 +395,7 @@ cat dotnet/src/Types.cs | grep -A 15 "public class SessionHooks"
395395
```
396396

397397
**Must match (PascalCase):**
398-
- `CopilotClientOptions` properties: `CliPath`, `CliUrl`, `UseStdio`, `Port`, `LogLevel`, `AutoStart`, `Environment`, `GithubToken`, `UseLoggedInUser`
398+
- `CopilotClientOptions` properties: `CliPath`, `CliUrl`, `UseStdio`, `Port`, `LogLevel`, `AutoStart`, `Environment`, `GitHubToken`, `UseLoggedInUser`
399399
- `SessionConfig` properties: `Model`, `Tools`, `Hooks`, `SystemMessage`, `McpServers`, `AvailableTools`, `ExcludedTools`, `Streaming`, `ReasoningEffort`, `Provider`, `InfiniteSessions`, `CustomAgents`, `WorkingDirectory`
400400
- `CopilotSession` methods: `SendAsync()`, `SendAndWaitAsync()`, `GetMessagesAsync()`, `DisposeAsync()`, `AbortAsync()`, `ExportSessionAsync()`
401401
- Hook properties: `OnPreToolUse`, `OnPostToolUse`, `OnPostToolUseFailure`, `OnUserPromptSubmitted`, `OnSessionStart`, `OnSessionEnd`, `OnErrorOccurred`

docs/auth/authenticate.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ func main() {
167167
import copilot "github.com/github/copilot-sdk/go"
168168

169169
client := copilot.NewClient(&copilot.ClientOptions{
170-
GithubToken: userAccessToken, // Token from OAuth flow
170+
GitHubToken: userAccessToken, // Token from OAuth flow
171171
UseLoggedInUser: copilot.Bool(false), // Don't use stored CLI credentials
172172
})
173173
```

docs/setup/github-oauth.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ func main() {
206206
```go
207207
func createClientForUser(userToken string) *copilot.Client {
208208
return copilot.NewClient(&copilot.ClientOptions{
209-
GithubToken: userToken,
209+
GitHubToken: userToken,
210210
UseLoggedInUser: copilot.Bool(false),
211211
})
212212
}

docs/troubleshooting/debugging.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ var client = new CopilotClient(new CopilotClientOptions
292292

293293
```go
294294
client := copilot.NewClient(&copilot.ClientOptions{
295-
GithubToken: os.Getenv("GITHUB_TOKEN"),
295+
GitHubToken: os.Getenv("GITHUB_TOKEN"),
296296
})
297297
```
298298
</details>
@@ -303,7 +303,7 @@ var client = new CopilotClient(new CopilotClientOptions
303303
```csharp
304304
var client = new CopilotClient(new CopilotClientOptions
305305
{
306-
GithubToken = Environment.GetEnvironmentVariable("GITHUB_TOKEN")
306+
GitHubToken = Environment.GetEnvironmentVariable("GITHUB_TOKEN")
307307
});
308308
```
309309
</details>

dotnet/src/Generated/Rpc.cs

Lines changed: 28 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)