Skip to content

Commit 1d7f37f

Browse files
authored
Merge pull request #228 from github/edburns/ghcp-sp-115-java-repackage
Edburns/ghcp sp 115 java repackage
2 parents 30b48a7 + 4c7a4e7 commit 1d7f37f

839 files changed

Lines changed: 1843 additions & 1686 deletions

File tree

Some content is hidden

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

.github/copilot-instructions.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ mvn test -Dtest=CopilotClientTest
7575

7676
### Package Structure
7777

78-
- `com.github.copilot.sdk` - Core classes (CopilotClient, CopilotSession, JsonRpcClient)
79-
- `com.github.copilot.sdk.json` - DTOs, request/response types, handler interfaces (SessionConfig, MessageOptions, ToolDefinition, etc.)
80-
- `com.github.copilot.sdk.generated` - Generated event types for session streaming (SessionEvent, AssistantMessageEvent, SessionIdleEvent, ToolExecutionStartEvent, etc.)
78+
- `com.github.copilot` - Core classes (CopilotClient, CopilotSession, JsonRpcClient)
79+
- `com.github.copilot.rpc` - DTOs, request/response types, handler interfaces (SessionConfig, MessageOptions, ToolDefinition, etc.)
80+
- `com.github.copilot.generated` - Generated event types for session streaming (SessionEvent, AssistantMessageEvent, SessionIdleEvent, ToolExecutionStartEvent, etc.)
8181

8282
### Test Infrastructure
8383

.github/prompts/agentic-merge-reference-impl.prompt.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,11 @@ For each change in the reference implementation diff, determine:
135135

136136
| reference implementation (.NET) | Java SDK Equivalent |
137137
|------------------------------------|--------------------------------------------------------|
138-
| `dotnet/src/Client.cs` | `src/main/java/com/github/copilot/sdk/CopilotClient.java` |
139-
| `dotnet/src/Session.cs` | `src/main/java/com/github/copilot/sdk/CopilotSession.java` |
140-
| `dotnet/src/Types.cs` | `src/main/java/com/github/copilot/sdk/types/*.java` |
138+
| `dotnet/src/Client.cs` | `src/main/java/com/github/copilot/CopilotClient.java` |
139+
| `dotnet/src/Session.cs` | `src/main/java/com/github/copilot/CopilotSession.java` |
140+
| `dotnet/src/Types.cs` | `src/main/java/com/github/copilot/types/*.java` |
141141
| `dotnet/src/Generated/*.cs` |**DO NOT TOUCH** `src/generated/java/**` — see top of this file |
142-
| `dotnet/test/*.cs` | `src/test/java/com/github/copilot/sdk/*Test.java` |
142+
| `dotnet/test/*.cs` | `src/test/java/com/github/copilot/*Test.java` |
143143
| `docs/getting-started.md` | `README.md` and `src/site/markdown/*.md` |
144144
| `docs/*.md` (new files) | `src/site/markdown/*.md` + update `src/site/site.xml` |
145145
| `sdk-protocol-version.json` | (embedded in Java code or resource file) |
@@ -209,7 +209,7 @@ This creates a clear history of changes that can be reviewed in the Pull Request
209209
Follow the existing Java SDK patterns:
210210
- Use Jackson for JSON serialization (`ObjectMapper`)
211211
- Use Java records for DTOs where appropriate
212-
- Follow the existing package structure under `com.github.copilot.sdk`
212+
- Follow the existing package structure under `com.github.copilot`
213213
- Maintain backward compatibility when possible
214214
- **Match the style of surrounding code** - Consistency with existing code is more important than reference implementation patterns
215215
- **Prefer existing abstractions** - If the Java SDK already solves a problem differently than .NET, keep the Java approach
@@ -230,7 +230,7 @@ git diff "$LAST_REFERENCE_IMPL_COMMIT"..origin/main --stat -- test/snapshots/
230230

231231
For each new or modified test file in `dotnet/test/`:
232232

233-
1. **Create corresponding Java test class** in `src/test/java/com/github/copilot/sdk/`
233+
1. **Create corresponding Java test class** in `src/test/java/com/github/copilot/`
234234
2. **Follow existing test patterns** - Look at existing tests like `PermissionsTest.java` for structure
235235
3. **Use the E2ETestContext** infrastructure for tests that need the test harness
236236
4. **Match snapshot directory names** - Test snapshots in `test/snapshots/` must match the directory name used in `ctx.configureForTest()`
@@ -239,10 +239,10 @@ For each new or modified test file in `dotnet/test/`:
239239

240240
| reference implementation Test (.NET) | Java SDK Test |
241241
|-----------------------------|--------------------------------------------------------|
242-
| `dotnet/test/AskUserTests.cs` | `src/test/java/com/github/copilot/sdk/AskUserTest.java` |
243-
| `dotnet/test/HooksTests.cs` | `src/test/java/com/github/copilot/sdk/HooksTest.java` |
244-
| `dotnet/test/ClientTests.cs` | `src/test/java/com/github/copilot/sdk/CopilotClientTest.java` |
245-
| `dotnet/test/*Tests.cs` | `src/test/java/com/github/copilot/sdk/*Test.java` |
242+
| `dotnet/test/AskUserTests.cs` | `src/test/java/com/github/copilot/AskUserTest.java` |
243+
| `dotnet/test/HooksTests.cs` | `src/test/java/com/github/copilot/HooksTest.java` |
244+
| `dotnet/test/ClientTests.cs` | `src/test/java/com/github/copilot/CopilotClientTest.java` |
245+
| `dotnet/test/*Tests.cs` | `src/test/java/com/github/copilot/*Test.java` |
246246

247247
### Test Snapshot Compatibility
248248

@@ -353,7 +353,7 @@ var session = client.createSession(
353353

354354
Explain the request/response objects and their properties.
355355

356-
See [FeatureHandler](apidocs/com/github/copilot/sdk/json/FeatureHandler.html) Javadoc for more details.
356+
See [FeatureHandler](apidocs/com/github/copilot/rpc/FeatureHandler.html) Javadoc for more details.
357357
```
358358

359359
### Verify Documentation Consistency

.github/prompts/documentation-coverage.prompt.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ Extract all public classes, methods, and features from the SDK:
1717

1818
```bash
1919
# List all public classes in core package
20-
grep -l "public class\|public interface\|public enum" src/main/java/com/github/copilot/sdk/*.java
20+
grep -l "public class\|public interface\|public enum" src/main/java/com/github/copilot/*.java
2121

2222
# List all public classes in json package (DTOs)
23-
grep -l "public class" src/main/java/com/github/copilot/sdk/json/*.java
23+
grep -l "public class" src/main/java/com/github/copilot/rpc/*.java
2424

2525
# List all event types
26-
ls src/main/java/com/github/copilot/sdk/events/
26+
ls src/main/java/com/github/copilot/events/
2727
```
2828

2929
### Step 2: Inventory Documentation
@@ -45,7 +45,7 @@ For each major feature area, determine if it's documented:
4545
Examine `CopilotClient.java` for public methods:
4646

4747
```bash
48-
grep "public.*(" src/main/java/com/github/copilot/sdk/CopilotClient.java | grep -v "@"
48+
grep "public.*(" src/main/java/com/github/copilot/CopilotClient.java | grep -v "@"
4949
```
5050

5151
| Method | Purpose | Documented In | Status |
@@ -66,7 +66,7 @@ grep "public.*(" src/main/java/com/github/copilot/sdk/CopilotClient.java | grep
6666
Examine `CopilotSession.java` for public methods:
6767

6868
```bash
69-
grep "public.*(" src/main/java/com/github/copilot/sdk/CopilotSession.java | grep -v "@"
69+
grep "public.*(" src/main/java/com/github/copilot/CopilotSession.java | grep -v "@"
7070
```
7171

7272
| Method | Purpose | Documented In | Status |
@@ -83,7 +83,7 @@ grep "public.*(" src/main/java/com/github/copilot/sdk/CopilotSession.java | grep
8383
Examine `SessionConfig.java` for configurable options:
8484

8585
```bash
86-
grep "public.*set\|private.*;" src/main/java/com/github/copilot/sdk/json/SessionConfig.java
86+
grep "public.*set\|private.*;" src/main/java/com/github/copilot/rpc/SessionConfig.java
8787
```
8888

8989
| Option | Purpose | Documented | Example Provided |
@@ -103,7 +103,7 @@ grep "public.*set\|private.*;" src/main/java/com/github/copilot/sdk/json/Session
103103
Check which events are documented:
104104

105105
```bash
106-
grep "TYPE_MAP.put" src/main/java/com/github/copilot/sdk/events/SessionEventParser.java
106+
grep "TYPE_MAP.put" src/main/java/com/github/copilot/events/SessionEventParser.java
107107
```
108108

109109
| Event Type | Event Class | Documented | Example |
@@ -118,7 +118,7 @@ grep "TYPE_MAP.put" src/main/java/com/github/copilot/sdk/events/SessionEventPars
118118
Check `SessionHooks.java` for hook types:
119119

120120
```bash
121-
grep "private.*Handler" src/main/java/com/github/copilot/sdk/json/SessionHooks.java
121+
grep "private.*Handler" src/main/java/com/github/copilot/rpc/SessionHooks.java
122122
```
123123

124124
| Hook | Handler Interface | Documented | Example |
@@ -193,11 +193,11 @@ Topics that warrant dedicated documentation:
193193
## Key Files
194194

195195
### Source Code
196-
- `src/main/java/com/github/copilot/sdk/CopilotClient.java`
197-
- `src/main/java/com/github/copilot/sdk/CopilotSession.java`
198-
- `src/main/java/com/github/copilot/sdk/json/SessionConfig.java`
199-
- `src/main/java/com/github/copilot/sdk/json/SessionHooks.java`
200-
- `src/main/java/com/github/copilot/sdk/events/SessionEventParser.java`
196+
- `src/main/java/com/github/copilot/CopilotClient.java`
197+
- `src/main/java/com/github/copilot/CopilotSession.java`
198+
- `src/main/java/com/github/copilot/rpc/SessionConfig.java`
199+
- `src/main/java/com/github/copilot/rpc/SessionHooks.java`
200+
- `src/main/java/com/github/copilot/events/SessionEventParser.java`
201201

202202
### Documentation
203203
- `src/site/markdown/index.md` - Landing page

.github/prompts/test-coverage-assessment.prompt.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ First, examine the source code to identify all components that should be tested:
1717

1818
```bash
1919
# List all event classes
20-
ls src/main/java/com/github/copilot/sdk/events/
20+
ls src/main/java/com/github/copilot/events/
2121

2222
# Check the event type mapping in SessionEventParser
23-
grep -n "TYPE_MAP.put" src/main/java/com/github/copilot/sdk/events/SessionEventParser.java
23+
grep -n "TYPE_MAP.put" src/main/java/com/github/copilot/events/SessionEventParser.java
2424
```
2525

2626
Extract the list of all registered event types from `SessionEventParser.java`.
@@ -30,7 +30,7 @@ Extract the list of all registered event types from `SessionEventParser.java`.
3030
Check `SessionHooks.java` for all available hook handlers:
3131

3232
```bash
33-
grep -E "private.*Handler" src/main/java/com/github/copilot/sdk/json/SessionHooks.java
33+
grep -E "private.*Handler" src/main/java/com/github/copilot/rpc/SessionHooks.java
3434
```
3535

3636
### Step 3: Analyze Existing Tests
@@ -39,13 +39,13 @@ Examine the test files to understand current coverage:
3939

4040
```bash
4141
# List all test files
42-
ls src/test/java/com/github/copilot/sdk/
42+
ls src/test/java/com/github/copilot/
4343

4444
# Check for event-related tests
45-
grep -r "import.*events\." src/test/java/com/github/copilot/sdk/ | grep -v "\.class"
45+
grep -r "import.*events\." src/test/java/com/github/copilot/ | grep -v "\.class"
4646

4747
# Check for hook tests
48-
grep -l "SessionHooks\|Hook" src/test/java/com/github/copilot/sdk/*.java
48+
grep -l "SessionHooks\|Hook" src/test/java/com/github/copilot/*.java
4949
```
5050

5151
### Step 4: Categorize Test Coverage
@@ -95,13 +95,13 @@ Prioritized list of tests to add:
9595

9696
## Key Files to Examine
9797

98-
- `src/main/java/com/github/copilot/sdk/events/SessionEventParser.java` - Event type registry
99-
- `src/main/java/com/github/copilot/sdk/json/SessionHooks.java` - Hook definitions
100-
- `src/main/java/com/github/copilot/sdk/CopilotSession.java` - Hook handling logic
101-
- `src/test/java/com/github/copilot/sdk/SessionEventParserTest.java` - Event parsing tests
102-
- `src/test/java/com/github/copilot/sdk/SessionEventsE2ETest.java` - Event E2E tests
103-
- `src/test/java/com/github/copilot/sdk/HooksTest.java` - Hook tests
104-
- `src/test/java/com/github/copilot/sdk/SessionEventHandlingTest.java` - Event handling tests
98+
- `src/main/java/com/github/copilot/events/SessionEventParser.java` - Event type registry
99+
- `src/main/java/com/github/copilot/rpc/SessionHooks.java` - Hook definitions
100+
- `src/main/java/com/github/copilot/CopilotSession.java` - Hook handling logic
101+
- `src/test/java/com/github/copilot/SessionEventParserTest.java` - Event parsing tests
102+
- `src/test/java/com/github/copilot/SessionEventsE2ETest.java` - Event E2E tests
103+
- `src/test/java/com/github/copilot/HooksTest.java` - Hook tests
104+
- `src/test/java/com/github/copilot/SessionEventHandlingTest.java` - Event handling tests
105105

106106
## Verification
107107

.github/workflows/codegen-agentic-fix.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ For each attempt:
177177
2. **Read the generated types** to understand what changed. Check the generated files that the handwritten code references:
178178
```bash
179179
# Example: check what a generated type looks like now
180-
cat src/generated/java/com/github/copilot/sdk/generated/rpc/<TypeName>.java
180+
cat src/generated/java/com/github/copilot/generated/rpc/<TypeName>.java
181181
```
182182

183183
3. **Fix the affected source files.** You may modify files under:

.github/workflows/update-copilot-dependency.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ jobs:
6161
cat > /tmp/verify-codegen-prompt.txt << 'PROMPT_EOF'
6262
You are running inside the copilot-sdk-java repository.
6363
The code generator has just run and produced Java source files under
64-
src/generated/java/com/github/copilot/sdk/generated/rpc/.
64+
src/generated/java/com/github/copilot/generated/rpc/.
6565
6666
Your task is to spot-check the generated API classes against the source
6767
JSON schema to verify the generator produced correct output.
@@ -74,9 +74,9 @@ jobs:
7474
scripts/codegen/node_modules/@github/copilot/schemas/api.schema.json
7575
7676
2. Pick these 3 generated API classes to verify:
77-
- src/generated/java/com/github/copilot/sdk/generated/rpc/SessionToolsApi.java
78-
- src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUiApi.java
79-
- src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsApi.java
77+
- src/generated/java/com/github/copilot/generated/rpc/SessionToolsApi.java
78+
- src/generated/java/com/github/copilot/generated/rpc/SessionUiApi.java
79+
- src/generated/java/com/github/copilot/generated/rpc/SessionPermissionsApi.java
8080
8181
3. For each class, verify:
8282
- Every RPC method in the schema's corresponding namespace has a

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ New types: `GetForegroundSessionResponse`, `SetForegroundSessionResponse`
405405

406406
- Advanced usage documentation with comprehensive examples
407407
- Getting started guide with Maven and JBang instructions
408-
- Package-info.java files for `com.github.copilot.sdk`, `events`, and `json` packages
408+
- Package-info.java files for `com.github.copilot`, `events`, and `json` packages
409409
- `@since` annotations on all public classes
410410
- Versioned documentation with version selector on GitHub Pages
411411
- Maven resources plugin for site markdown filtering

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,13 @@ implementation 'com.github:copilot-sdk-java:1.0.0-beta-java.4'
6767
## Quick Start
6868

6969
```java
70-
import com.github.copilot.sdk.CopilotClient;
71-
import com.github.copilot.sdk.generated.AssistantMessageEvent;
72-
import com.github.copilot.sdk.generated.SessionUsageInfoEvent;
73-
import com.github.copilot.sdk.json.CopilotClientOptions;
74-
import com.github.copilot.sdk.json.MessageOptions;
75-
import com.github.copilot.sdk.json.PermissionHandler;
76-
import com.github.copilot.sdk.json.SessionConfig;
70+
import com.github.copilot.CopilotClient;
71+
import com.github.copilot.generated.AssistantMessageEvent;
72+
import com.github.copilot.generated.SessionUsageInfoEvent;
73+
import com.github.copilot.rpc.CopilotClientOptions;
74+
import com.github.copilot.rpc.MessageOptions;
75+
import com.github.copilot.rpc.PermissionHandler;
76+
import com.github.copilot.rpc.SessionConfig;
7777

7878
import java.util.concurrent.Executors;
7979

config/spotbugs/spotbugs-exclude.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
-->
1111
<FindBugsFilter>
1212
<Match>
13-
<Package name="com.github.copilot.sdk.generated"/>
13+
<Package name="com.github.copilot.generated"/>
1414
<Bug pattern="EI_EXPOSE_REP,EI_EXPOSE_REP2"/>
1515
</Match>
1616
<Match>
17-
<Package name="com.github.copilot.sdk.json"/>
17+
<Package name="com.github.copilot.rpc"/>
1818
<Bug pattern="EI_EXPOSE_REP,EI_EXPOSE_REP2"/>
1919
</Match>
2020
</FindBugsFilter>

jbang-example.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
///usr/bin/env jbang "$0" "$@" ; exit $?
22
//DEPS com.github:copilot-sdk-java:1.0.0-beta-java.4
3-
import com.github.copilot.sdk.CopilotClient;
4-
import com.github.copilot.sdk.generated.AssistantMessageEvent;
5-
import com.github.copilot.sdk.generated.SessionUsageInfoEvent;
6-
import com.github.copilot.sdk.json.MessageOptions;
7-
import com.github.copilot.sdk.json.PermissionHandler;
8-
import com.github.copilot.sdk.json.SessionConfig;
3+
import com.github.copilot.CopilotClient;
4+
import com.github.copilot.generated.AssistantMessageEvent;
5+
import com.github.copilot.generated.SessionUsageInfoEvent;
6+
import com.github.copilot.rpc.MessageOptions;
7+
import com.github.copilot.rpc.PermissionHandler;
8+
import com.github.copilot.rpc.SessionConfig;
99

1010
import static java.lang.System.out;
1111

0 commit comments

Comments
 (0)