Skip to content

Commit 85473ec

Browse files
committed
Correct casing of GitHub in types for .NET and Go
1 parent 4dc5629 commit 85473ec

File tree

14 files changed

+229
-165
lines changed

14 files changed

+229
-165
lines changed

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

Lines changed: 36 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ The human will then review the plan and selectively ask Copilot to implement spe
2727

2828
Create a file called `docs/IMPROVEMENT_PLAN.md` with this structure:
2929

30-
```markdown
30+
````markdown
3131
# Documentation Improvement Plan
3232

3333
Generated: [date]
@@ -43,6 +43,7 @@ Audited by: docs-maintenance agent
4343
## Critical Issues (Fix Immediately)
4444

4545
### 1. [Issue Title]
46+
4647
- **File**: `docs/path/to/file.md`
4748
- **Line**: ~42
4849
- **Problem**: [description]
@@ -53,6 +54,7 @@ Audited by: docs-maintenance agent
5354
## High Priority (Should Fix Soon)
5455

5556
### 1. [Issue Title]
57+
5658
- **File**: `docs/path/to/file.md`
5759
- **Problem**: [description]
5860
- **Fix**: [specific action to take]
@@ -79,15 +81,18 @@ The following code samples don't match the SDK interface:
7981
### File: `docs/example.md`
8082

8183
**Line ~25 - TypeScript sample uses wrong method name:**
84+
8285
```typescript
8386
// Current (wrong):
84-
await client.create_session()
87+
await client.create_session();
8588

8689
// Should be:
87-
await client.createSession()
90+
await client.createSession();
8891
```
92+
````
8993

9094
**Line ~45 - Python sample has camelCase:**
95+
9196
```python
9297
# Current (wrong):
9398
client = CopilotClient(cliPath="/usr/bin/copilot")
@@ -98,14 +103,15 @@ client = CopilotClient(cli_path="/usr/bin/copilot")
98103

99104
## Broken Links
100105

101-
| Source File | Line | Broken Link | Suggested Fix |
102-
|-------------|------|-------------|---------------|
103-
| `docs/a.md` | 15 | `./missing.md` | Remove or create file |
106+
| Source File | Line | Broken Link | Suggested Fix |
107+
| ----------- | ---- | -------------- | --------------------- |
108+
| `docs/a.md` | 15 | `./missing.md` | Remove or create file |
104109

105110
## Consistency Issues
106111

107112
- [ ] Term "XXX" used inconsistently (file1.md says "A", file2.md says "B")
108113
- [ ] ...
114+
109115
```
110116
111117
After creating this plan file, your work is complete. The platform (github.com) will handle creating a PR if applicable.
@@ -242,21 +248,23 @@ When auditing documentation, check:
242248
The expected documentation structure is:
243249
244250
```
251+
245252
docs/
246-
├── getting-started.md # Quick start tutorial
247-
├── debugging.md # General debugging guide
248-
├── compatibility.md # SDK vs CLI feature comparison
253+
├── getting-started.md # Quick start tutorial
254+
├── debugging.md # General debugging guide
255+
├── compatibility.md # SDK vs CLI feature comparison
249256
├── hooks/
250-
├── overview.md # Hooks introduction
251-
├── pre-tool-use.md # Permission control
252-
├── post-tool-use.md # Result transformation
253-
├── user-prompt-submitted.md
254-
├── session-lifecycle.md
255-
└── error-handling.md
257+
│ ├── overview.md # Hooks introduction
258+
│ ├── pre-tool-use.md # Permission control
259+
│ ├── post-tool-use.md # Result transformation
260+
│ ├── user-prompt-submitted.md
261+
│ ├── session-lifecycle.md
262+
│ └── error-handling.md
256263
└── mcp/
257-
├── overview.md # MCP configuration
258-
└── debugging.md # MCP troubleshooting
259-
```
264+
├── overview.md # MCP configuration
265+
└── debugging.md # MCP troubleshooting
266+
267+
````
260268
261269
Additional directories to consider:
262270
- `docs/tools/` - Custom tool development
@@ -274,7 +282,7 @@ find docs -name "*.md" -type f | sort
274282
275283
# Check for README references
276284
grep -r "docs/" README.md
277-
```
285+
````
278286

279287
### Step 2: Check Feature Coverage
280288

@@ -342,6 +350,7 @@ cat nodejs/src/types.ts | grep -A 10 "export interface ExportSessionOptions"
342350
```
343351

344352
**Must match:**
353+
345354
- `CopilotClient` constructor options: `cliPath`, `cliUrl`, `useStdio`, `port`, `logLevel`, `autoStart`, `autoRestart`, `env`, `githubToken`, `useLoggedInUser`
346355
- `createSession()` config: `model`, `tools`, `hooks`, `systemMessage`, `mcpServers`, `availableTools`, `excludedTools`, `streaming`, `reasoningEffort`, `provider`, `infiniteSessions`, `customAgents`, `workingDirectory`
347356
- `CopilotSession` methods: `send()`, `sendAndWait()`, `getMessages()`, `destroy()`, `abort()`, `on()`, `once()`, `off()`
@@ -360,6 +369,7 @@ cat python/copilot/types.py | grep -A 15 "class SessionHooks"
360369
```
361370

362371
**Must match (snake_case):**
372+
363373
- `CopilotClient` options: `cli_path`, `cli_url`, `use_stdio`, `port`, `log_level`, `auto_start`, `auto_restart`, `env`, `github_token`, `use_logged_in_user`
364374
- `create_session()` config keys: `model`, `tools`, `hooks`, `system_message`, `mcp_servers`, `available_tools`, `excluded_tools`, `streaming`, `reasoning_effort`, `provider`, `infinite_sessions`, `custom_agents`, `working_directory`
365375
- `CopilotSession` methods: `send()`, `send_and_wait()`, `get_messages()`, `destroy()`, `abort()`, `export_session()`
@@ -378,7 +388,8 @@ cat go/types.go | grep -A 15 "type SessionHooks struct"
378388
```
379389

380390
**Must match (PascalCase for exported):**
381-
- `ClientOptions` fields: `CLIPath`, `CLIUrl`, `UseStdio`, `Port`, `LogLevel`, `AutoStart`, `AutoRestart`, `Env`, `GithubToken`, `UseLoggedInUser`
391+
392+
- `ClientOptions` fields: `CLIPath`, `CLIUrl`, `UseStdio`, `Port`, `LogLevel`, `AutoStart`, `AutoRestart`, `Env`, `GitHubToken`, `UseLoggedInUser`
382393
- `SessionConfig` fields: `Model`, `Tools`, `Hooks`, `SystemMessage`, `MCPServers`, `AvailableTools`, `ExcludedTools`, `Streaming`, `ReasoningEffort`, `Provider`, `InfiniteSessions`, `CustomAgents`, `WorkingDirectory`
383394
- `Session` methods: `Send()`, `SendAndWait()`, `GetMessages()`, `Destroy()`, `Abort()`, `ExportSession()`
384395
- Hook fields: `OnPreToolUse`, `OnPostToolUse`, `OnUserPromptSubmitted`, `OnSessionStart`, `OnSessionEnd`, `OnErrorOccurred`
@@ -396,7 +407,8 @@ cat dotnet/src/Types.cs | grep -A 15 "public class SessionHooks"
396407
```
397408

398409
**Must match (PascalCase):**
399-
- `CopilotClientOptions` properties: `CliPath`, `CliUrl`, `UseStdio`, `Port`, `LogLevel`, `AutoStart`, `AutoRestart`, `Environment`, `GithubToken`, `UseLoggedInUser`
410+
411+
- `CopilotClientOptions` properties: `CliPath`, `CliUrl`, `UseStdio`, `Port`, `LogLevel`, `AutoStart`, `AutoRestart`, `Environment`, `GitHubToken`, `UseLoggedInUser`
400412
- `SessionConfig` properties: `Model`, `Tools`, `Hooks`, `SystemMessage`, `McpServers`, `AvailableTools`, `ExcludedTools`, `Streaming`, `ReasoningEffort`, `Provider`, `InfiniteSessions`, `CustomAgents`, `WorkingDirectory`
401413
- `CopilotSession` methods: `SendAsync()`, `SendAndWaitAsync()`, `GetMessagesAsync()`, `DisposeAsync()`, `AbortAsync()`, `ExportSessionAsync()`
402414
- Hook properties: `OnPreToolUse`, `OnPostToolUse`, `OnUserPromptSubmitted`, `OnSessionStart`, `OnSessionEnd`, `OnErrorOccurred`
@@ -429,7 +441,7 @@ cat dotnet/src/Types.cs | grep -A 15 "public class SessionHooks"
429441

430442
Run this to extract all code blocks and check for common issues:
431443

432-
```bash
444+
````bash
433445
# Extract TypeScript examples and check for Python-style naming
434446
grep -A 20 '```typescript' docs/**/*.md | grep -E "cli_path|create_session|send_and_wait" && echo "ERROR: Python naming in TypeScript"
435447

@@ -438,7 +450,7 @@ grep -A 20 '```python' docs/**/*.md | grep -E "cliPath|createSession|sendAndWait
438450

439451
# Check Go examples have context parameter
440452
grep -A 20 '```go' docs/**/*.md | grep -E "CreateSession\([^c]|Send\([^c]" && echo "WARNING: Go method may be missing context"
441-
```
453+
````
442454

443455
### Step 6: Create the Plan
444456

@@ -448,6 +460,7 @@ After completing the audit:
448460
2. Your work is complete - the platform handles PR creation
449461

450462
The human reviewer can then:
463+
451464
- Review the plan
452465
- Comment on specific items to prioritize
453466
- Ask Copilot to implement specific fixes from the plan

docs/auth/index.md

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,19 @@ The GitHub Copilot SDK supports multiple authentication methods to fit different
44

55
## Authentication Methods
66

7-
| Method | Use Case | Copilot Subscription Required |
8-
|--------|----------|-------------------------------|
9-
| [GitHub Signed-in User](#github-signed-in-user) | Interactive apps where users sign in with GitHub | Yes |
10-
| [OAuth GitHub App](#oauth-github-app) | Apps acting on behalf of users via OAuth | Yes |
11-
| [Environment Variables](#environment-variables) | CI/CD, automation, server-to-server | Yes |
12-
| [BYOK (Bring Your Own Key)](./byok.md) | Using your own API keys (Azure AI Foundry, OpenAI, etc.) | No |
7+
| Method | Use Case | Copilot Subscription Required |
8+
| ----------------------------------------------- | -------------------------------------------------------- | ----------------------------- |
9+
| [GitHub Signed-in User](#github-signed-in-user) | Interactive apps where users sign in with GitHub | Yes |
10+
| [OAuth GitHub App](#oauth-github-app) | Apps acting on behalf of users via OAuth | Yes |
11+
| [Environment Variables](#environment-variables) | CI/CD, automation, server-to-server | Yes |
12+
| [BYOK (Bring Your Own Key)](./byok.md) | Using your own API keys (Azure AI Foundry, OpenAI, etc.) | No |
1313

1414
## GitHub Signed-in User
1515

1616
This is the default authentication method when running the Copilot CLI interactively. Users authenticate via GitHub OAuth device flow, and the SDK uses their stored credentials.
1717

1818
**How it works:**
19+
1920
1. User runs `copilot` CLI and signs in via GitHub OAuth
2021
2. Credentials are stored securely in the system keychain
2122
3. SDK automatically uses stored credentials
@@ -51,6 +52,7 @@ await client.start()
5152
<summary><strong>Go</strong></summary>
5253

5354
<!-- docs-validate: skip -->
55+
5456
```go
5557
import copilot "github.com/github/copilot-sdk/go"
5658

@@ -73,6 +75,7 @@ await using var client = new CopilotClient();
7375
</details>
7476

7577
**When to use:**
78+
7679
- Desktop applications where users interact directly
7780
- Development and testing environments
7881
- Any scenario where a user can sign in interactively
@@ -82,6 +85,7 @@ await using var client = new CopilotClient();
8285
Use an OAuth GitHub App to authenticate users through your application and pass their credentials to the SDK. This enables your application to make Copilot API requests on behalf of users who authorize your app.
8386

8487
**How it works:**
88+
8589
1. User authorizes your OAuth GitHub App
8690
2. Your app receives a user access token (`gho_` or `ghu_` prefix)
8791
3. Pass the token to the SDK via `githubToken` option
@@ -95,8 +99,8 @@ Use an OAuth GitHub App to authenticate users through your application and pass
9599
import { CopilotClient } from "@github/copilot-sdk";
96100

97101
const client = new CopilotClient({
98-
githubToken: userAccessToken, // Token from OAuth flow
99-
useLoggedInUser: false, // Don't use stored CLI credentials
102+
githubToken: userAccessToken, // Token from OAuth flow
103+
useLoggedInUser: false, // Don't use stored CLI credentials
100104
});
101105
```
102106

@@ -121,11 +125,12 @@ await client.start()
121125
<summary><strong>Go</strong></summary>
122126

123127
<!-- docs-validate: skip -->
128+
124129
```go
125130
import copilot "github.com/github/copilot-sdk/go"
126131

127132
client := copilot.NewClient(&copilot.ClientOptions{
128-
GithubToken: userAccessToken, // Token from OAuth flow
133+
GitHubToken: userAccessToken, // Token from OAuth flow
129134
UseLoggedInUser: copilot.Bool(false), // Don't use stored CLI credentials
130135
})
131136
```
@@ -136,27 +141,31 @@ client := copilot.NewClient(&copilot.ClientOptions{
136141
<summary><strong>.NET</strong></summary>
137142

138143
<!-- docs-validate: skip -->
144+
139145
```csharp
140146
using GitHub.Copilot.SDK;
141147

142148
await using var client = new CopilotClient(new CopilotClientOptions
143149
{
144-
GithubToken = userAccessToken, // Token from OAuth flow
150+
GitHubToken = userAccessToken, // Token from OAuth flow
145151
UseLoggedInUser = false, // Don't use stored CLI credentials
146152
});
147153
```
148154

149155
</details>
150156

151157
**Supported token types:**
158+
152159
- `gho_` - OAuth user access tokens
153-
- `ghu_` - GitHub App user access tokens
160+
- `ghu_` - GitHub App user access tokens
154161
- `github_pat_` - Fine-grained personal access tokens
155162

156163
**Not supported:**
164+
157165
- `ghp_` - Classic personal access tokens (deprecated)
158166

159167
**When to use:**
168+
160169
- Web applications where users sign in via GitHub
161170
- SaaS applications building on top of Copilot
162171
- Any multi-user application where you need to make requests on behalf of different users
@@ -166,11 +175,13 @@ await using var client = new CopilotClient(new CopilotClientOptions
166175
For automation, CI/CD pipelines, and server-to-server scenarios, you can authenticate using environment variables.
167176

168177
**Supported environment variables (in priority order):**
178+
169179
1. `COPILOT_GITHUB_TOKEN` - Recommended for explicit Copilot usage
170180
2. `GH_TOKEN` - GitHub CLI compatible
171181
3. `GITHUB_TOKEN` - GitHub Actions compatible
172182

173183
**How it works:**
184+
174185
1. Set one of the supported environment variables with a valid token
175186
2. The SDK automatically detects and uses the token
176187

@@ -204,6 +215,7 @@ await client.start()
204215
</details>
205216

206217
**When to use:**
218+
207219
- CI/CD pipelines (GitHub Actions, Jenkins, etc.)
208220
- Automated testing
209221
- Server-side applications with service accounts
@@ -214,12 +226,14 @@ await client.start()
214226
BYOK allows you to use your own API keys from model providers like Azure AI Foundry, OpenAI, or Anthropic. This bypasses GitHub Copilot authentication entirely.
215227

216228
**Key benefits:**
229+
217230
- No GitHub Copilot subscription required
218231
- Use enterprise model deployments
219232
- Direct billing with your model provider
220233
- Support for Azure AI Foundry, OpenAI, Anthropic, and OpenAI-compatible endpoints
221234

222235
**See the [BYOK documentation](./byok.md) for complete details**, including:
236+
223237
- Azure AI Foundry setup
224238
- Provider configuration options
225239
- Limitations and considerations
@@ -245,7 +259,7 @@ To prevent the SDK from automatically using stored credentials or `gh` CLI auth,
245259

246260
```typescript
247261
const client = new CopilotClient({
248-
useLoggedInUser: false, // Only use explicit tokens
262+
useLoggedInUser: false, // Only use explicit tokens
249263
});
250264
```
251265

@@ -255,6 +269,7 @@ const client = new CopilotClient({
255269
<summary><strong>Python</strong></summary>
256270

257271
<!-- docs-validate: skip -->
272+
258273
```python
259274
client = CopilotClient({
260275
"use_logged_in_user": False, # Only use explicit tokens
@@ -267,6 +282,7 @@ client = CopilotClient({
267282
<summary><strong>Go</strong></summary>
268283

269284
<!-- docs-validate: skip -->
285+
270286
```go
271287
client := copilot.NewClient(&copilot.ClientOptions{
272288
UseLoggedInUser: copilot.Bool(false), // Only use explicit tokens

0 commit comments

Comments
 (0)