Skip to content

Commit 346a38e

Browse files
brunoborgesCopilot
andauthored
Create README.md for GitHub Copilot SDK for Java (#967)
* Create README.md for GitHub Copilot SDK for Java Added README.md for GitHub Copilot SDK for Java with usage instructions and resources. * Update java/README.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Clarify SDK status and repository information in README Updated README to clarify SDK status and repository location. --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 4d26e30 commit 346a38e

File tree

1 file changed

+82
-0
lines changed

1 file changed

+82
-0
lines changed

java/README.md

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# GitHub Copilot SDK for Java
2+
3+
Java SDK for programmatic control of GitHub Copilot CLI via JSON-RPC.
4+
5+
> **📦 The Java SDK is maintained in a separate repository: [`github/copilot-sdk-java`](https://github.com/github/copilot-sdk-java)**
6+
>
7+
> **Note:** This SDK is in technical preview and may change in breaking ways.
8+
9+
[![Build](https://github.com/github/copilot-sdk-java/actions/workflows/build-test.yml/badge.svg)](https://github.com/github/copilot-sdk-java/actions/workflows/build-test.yml)
10+
[![Maven Central](https://img.shields.io/maven-central/v/com.github/copilot-sdk-java)](https://central.sonatype.com/artifact/com.github/copilot-sdk-java)
11+
[![Java 17+](https://img.shields.io/badge/Java-17%2B-blue?logo=openjdk&logoColor=white)](https://openjdk.org/)
12+
[![Documentation](https://img.shields.io/badge/docs-online-brightgreen)](https://github.github.io/copilot-sdk-java/)
13+
[![Javadoc](https://javadoc.io/badge2/com.github/copilot-sdk-java/javadoc.svg)](https://javadoc.io/doc/com.github/copilot-sdk-java/latest/index.html)
14+
15+
## Quick Start
16+
17+
```java
18+
import com.github.copilot.sdk.CopilotClient;
19+
import com.github.copilot.sdk.events.AssistantMessageEvent;
20+
import com.github.copilot.sdk.events.SessionIdleEvent;
21+
import com.github.copilot.sdk.json.MessageOptions;
22+
import com.github.copilot.sdk.json.PermissionHandler;
23+
import com.github.copilot.sdk.json.SessionConfig;
24+
25+
public class QuickStart {
26+
public static void main(String[] args) throws Exception {
27+
// Create and start client
28+
try (var client = new CopilotClient()) {
29+
client.start().get();
30+
31+
// Create a session (onPermissionRequest is required)
32+
var session = client.createSession(
33+
new SessionConfig()
34+
.setModel("gpt-5")
35+
.setOnPermissionRequest(PermissionHandler.APPROVE_ALL)
36+
).get();
37+
38+
var done = new java.util.concurrent.CompletableFuture<Void>();
39+
40+
// Handle events
41+
session.on(AssistantMessageEvent.class, msg ->
42+
System.out.println(msg.getData().content()));
43+
session.on(SessionIdleEvent.class, idle ->
44+
done.complete(null));
45+
46+
// Send a message and wait for completion
47+
session.send(new MessageOptions().setPrompt("What is 2+2?"));
48+
done.get();
49+
}
50+
}
51+
}
52+
```
53+
54+
## Try it with JBang
55+
56+
Run the SDK without setting up a full project using [JBang](https://www.jbang.dev/):
57+
58+
```bash
59+
jbang https://github.com/github/copilot-sdk-java/blob/main/jbang-example.java
60+
```
61+
62+
## Documentation & Resources
63+
64+
| Resource | Link |
65+
|----------|------|
66+
| **Full Documentation** | [github.github.io/copilot-sdk-java](https://github.github.io/copilot-sdk-java/) |
67+
| **Getting Started Guide** | [Documentation](https://github.github.io/copilot-sdk-java/latest/documentation.html) |
68+
| **API Reference (Javadoc)** | [javadoc.io](https://javadoc.io/doc/com.github/copilot-sdk-java/latest/index.html) |
69+
| **MCP Servers Integration** | [MCP Guide](https://github.github.io/copilot-sdk-java/latest/mcp.html) |
70+
| **Cookbook** | [Recipes](https://github.com/github/copilot-sdk-java/tree/main/src/site/markdown/cookbook) |
71+
| **Source Code** | [github/copilot-sdk-java](https://github.com/github/copilot-sdk-java) |
72+
| **Issues & Feature Requests** | [GitHub Issues](https://github.com/github/copilot-sdk-java/issues) |
73+
| **Releases** | [GitHub Releases](https://github.com/github/copilot-sdk-java/releases) |
74+
| **Copilot Instructions** | [copilot-sdk-java.instructions.md](https://github.com/github/copilot-sdk-java/blob/main/instructions/copilot-sdk-java.instructions.md) |
75+
76+
## Contributing
77+
78+
Contributions are welcome! Please see the [Contributing Guide](https://github.com/github/copilot-sdk-java/blob/main/CONTRIBUTING.md) in the GitHub Copilot SDK for Java repository.
79+
80+
## License
81+
82+
MIT — see [LICENSE](https://github.com/github/copilot-sdk-java/blob/main/LICENSE) for details.

0 commit comments

Comments
 (0)