{"id":41758180,"url":"https://github.com/copilot-community-sdk/copilot-sdk-java","last_synced_at":"2026-03-12T04:01:34.173Z","repository":{"id":333796419,"uuid":"1138688458","full_name":"copilot-community-sdk/copilot-sdk-java","owner":"copilot-community-sdk","description":"Java SDK for GitHub Copilot CLI","archived":false,"fork":false,"pushed_at":"2026-03-10T16:06:06.000Z","size":28685,"stargazers_count":55,"open_issues_count":6,"forks_count":10,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-03-10T21:41:04.145Z","etag":null,"topics":["copilot","github","java"],"latest_commit_sha":null,"homepage":"https://copilot-community-sdk.github.io/copilot-sdk-java/","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/copilot-community-sdk.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":"SUPPORT.md","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-01-21T01:53:02.000Z","updated_at":"2026-03-10T15:10:54.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/copilot-community-sdk/copilot-sdk-java","commit_stats":null,"previous_names":["copilot-community-sdk/copilot-sdk-java"],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/copilot-community-sdk/copilot-sdk-java","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/copilot-community-sdk%2Fcopilot-sdk-java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/copilot-community-sdk%2Fcopilot-sdk-java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/copilot-community-sdk%2Fcopilot-sdk-java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/copilot-community-sdk%2Fcopilot-sdk-java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/copilot-community-sdk","download_url":"https://codeload.github.com/copilot-community-sdk/copilot-sdk-java/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/copilot-community-sdk%2Fcopilot-sdk-java/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30415037,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-12T00:40:14.898Z","status":"online","status_checked_at":"2026-03-12T02:00:07.260Z","response_time":114,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["copilot","github","java"],"created_at":"2026-01-25T02:02:48.665Z","updated_at":"2026-03-12T04:01:34.146Z","avatar_url":"https://github.com/copilot-community-sdk.png","language":"Java","readme":"# Copilot SDK for Java\n\n[![Build](https://github.com/copilot-community-sdk/copilot-sdk-java/actions/workflows/build-test.yml/badge.svg)](https://github.com/copilot-community-sdk/copilot-sdk-java/actions/workflows/build-test.yml)\n[![Site](https://github.com/copilot-community-sdk/copilot-sdk-java/actions/workflows/deploy-site.yml/badge.svg)](https://github.com/copilot-community-sdk/copilot-sdk-java/actions/workflows/deploy-site.yml)\n[![Coverage](.github/badges/jacoco.svg)](https://copilot-community-sdk.github.io/copilot-sdk-java/snapshot/jacoco/index.html)\n[![Documentation](https://img.shields.io/badge/docs-online-brightgreen)](https://copilot-community-sdk.github.io/copilot-sdk-java/)\n[![Java 17+](https://img.shields.io/badge/Java-17%2B-blue?logo=openjdk\u0026logoColor=white)](https://openjdk.org/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n#### Latest release\n[![GitHub Release Date](https://img.shields.io/github/release-date/copilot-community-sdk/copilot-sdk-java)](https://github.com/copilot-community-sdk/copilot-sdk-java/releases)\n[![GitHub Release](https://img.shields.io/github/v/release/copilot-community-sdk/copilot-sdk-java)](https://github.com/copilot-community-sdk/copilot-sdk-java/releases)\n[![Maven Central](https://img.shields.io/maven-central/v/io.github.copilot-community-sdk/copilot-sdk)](https://central.sonatype.com/artifact/io.github.copilot-community-sdk/copilot-sdk)\n[![Documentation](https://img.shields.io/badge/docs-latest-brightgreen)](https://copilot-community-sdk.github.io/copilot-sdk-java/latest/)\n[![Javadoc](https://javadoc.io/badge2/io.github.copilot-community-sdk/copilot-sdk/javadoc.svg?q=1)](https://javadoc.io/doc/io.github.copilot-community-sdk/copilot-sdk/latest/index.html)\n\n## Background\n\n\u003e ⚠️ **Disclaimer:** This is an **unofficial, community-driven SDK** and is **not supported or endorsed by GitHub**. This SDK may change in breaking ways. Use at your own risk.\n\nJava SDK for programmatic control of GitHub Copilot CLI, enabling you to build AI-powered applications and agentic workflows.\n\n## Installation\n\n### Requirements\n\n- Java 17 or later\n- GitHub Copilot CLI 0.0.411-1 or later installed and in PATH (or provide custom `cliPath`)\n\n### Maven\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eio.github.copilot-community-sdk\u003c/groupId\u003e\n    \u003cartifactId\u003ecopilot-sdk\u003c/artifactId\u003e\n    \u003cversion\u003e1.0.11\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n### Gradle\n\n```groovy\nimplementation 'io.github.copilot-community-sdk:copilot-sdk:1.0.11'\n```\n\n## Quick Start\n\n```java\nimport com.github.copilot.sdk.*;\nimport com.github.copilot.sdk.events.*;\nimport com.github.copilot.sdk.json.*;\nimport java.util.concurrent.CompletableFuture;\n\npublic class CopilotSDK {\n    public static void main(String[] args) throws Exception {\n        // Create and start client\n        try (var client = new CopilotClient()) {\n            client.start().get();\n\n            // Create a session\n            var session = client.createSession(\n                new SessionConfig().setOnPermissionRequest(PermissionHandler.APPROVE_ALL).setModel(\"claude-sonnet-4.5\")).get();\n\n            // Handle assistant message events\n            session.on(AssistantMessageEvent.class, msg -\u003e {\n                System.out.println(msg.getData().getContent());\n            });\n\n            // Handle session usage info events\n            session.on(SessionUsageInfoEvent.class, usage -\u003e {\n                var data = usage.getData();\n                System.out.println(\"\\n--- Usage Metrics ---\");\n                System.out.println(\"Current tokens: \" + (int) data.getCurrentTokens());\n                System.out.println(\"Token limit: \" + (int) data.getTokenLimit());\n                System.out.println(\"Messages count: \" + (int) data.getMessagesLength());\n            });\n\n            // Send a message\n            var completable = session.sendAndWait(new MessageOptions().setPrompt(\"What is 2+2?\"));\n            // and wait for completion\n            completable.get();\n        }\n    }\n}\n```\n\n## Try it with JBang\n\nYou can run the SDK without setting up a full Java project, by using [JBang](https://www.jbang.dev/).\n\nSee the full source of [`jbang-example.java`](jbang-example.java) for a complete example with more features like session idle handling and usage info events.\n\nOr run it directly from the repository:\n\n```bash\njbang https://github.com/copilot-community-sdk/copilot-sdk-java/blob/latest/jbang-example.java\n```\n\n## Documentation\n\n📚 **[Full Documentation](https://copilot-community-sdk.github.io/copilot-sdk-java/)** — Complete API reference, advanced usage examples, and guides.\n\n### Quick Links\n\n- [Getting Started](https://copilot-community-sdk.github.io/copilot-sdk-java/latest/documentation.html)\n- [Javadoc API Reference](https://copilot-community-sdk.github.io/copilot-sdk-java/latest/apidocs/)\n- [MCP Servers Integration](https://copilot-community-sdk.github.io/copilot-sdk-java/latest/mcp.html)\n- [Cookbook](src/site/markdown/cookbook/) — Practical recipes for common use cases\n\n## Projects Using This SDK\n\n| Project | Description |\n|---------|-------------|\n| [JMeter Copilot Plugin](https://github.com/brunoborges/jmeter-copilot-plugin) | JMeter plugin for AI-assisted load testing |\n\n\u003e Want to add your project? Open a PR!\n\n## CI/CD Workflows\n\nThis project uses several GitHub Actions workflows for building, testing, releasing, and syncing with the upstream SDK. \n\nSee [WORKFLOWS.md](docs/WORKFLOWS.md) for a full overview and details on each workflow.\n\n## Contributing\n\nContributions are welcome! Please see the [Contributing Guide](CONTRIBUTING.md) for details.\n\n### Agentic Upstream Merge and Sync\n\nThis SDK tracks the official [Copilot SDK](https://github.com/github/copilot-sdk) (.NET reference implementation) and ports changes to Java. The upstream merge process is automated with AI assistance:\n\n**Weekly automated sync** — A [scheduled GitHub Actions workflow](.github/workflows/weekly-upstream-sync.yml) runs every Monday at 5 AM ET. It checks for new upstream commits since the last merge (tracked in [`.lastmerge`](.lastmerge)), and if changes are found, creates an issue labeled `upstream-sync` and assigns it to the GitHub Copilot coding agent. Any previously open `upstream-sync` issues are automatically closed.\n\n**Reusable prompt** — The merge workflow is defined in [`agentic-merge-upstream.prompt.md`](.github/prompts/agentic-merge-upstream.prompt.md). It can be triggered manually from:\n- **VS Code Copilot Chat** — type `/agentic-merge-upstream`\n- **GitHub Copilot CLI** — use `copilot` CLI with the same skill reference\n\n### Development Setup\n\n```bash\n# Clone the repository\ngit clone https://github.com/copilot-community-sdk/copilot-sdk-java.git\ncd copilot-sdk-java\n\n# Enable git hooks for code formatting\ngit config core.hooksPath .githooks\n\n# Build and test\nmvn clean verify\n```\n\nThe tests require the official [copilot-sdk](https://github.com/github/copilot-sdk) test harness, which is automatically cloned during build.\n\n## Support\n\nSee [SUPPORT.md](SUPPORT.md) for how to file issues and get help.\n\n## Code of Conduct\n\nThis project has adopted the [Contributor Covenant Code of Conduct](CODE_OF_CONDUCT.md). See [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) for details.\n\n## Security\n\nSee [SECURITY.md](SECURITY.md) for reporting security vulnerabilities.\n\n## License\n\nMIT — see [LICENSE](LICENSE) for details.\n\n## Acknowledgement\n\n- Initially developed with Copilot and [Bruno Borges](https://www.linkedin.com/in/brunocborges/).\n\n## Star History\n\n[![Star History Chart](https://api.star-history.com/svg?repos=copilot-community-sdk/copilot-sdk-java\u0026type=Date)](https://www.star-history.com/#copilot-community-sdk/copilot-sdk-java\u0026Date)\n\n⭐ Drop a star if you find this useful!\n","funding_links":[],"categories":["人工智能"],"sub_categories":["Spring Cloud框架"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcopilot-community-sdk%2Fcopilot-sdk-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcopilot-community-sdk%2Fcopilot-sdk-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcopilot-community-sdk%2Fcopilot-sdk-java/lists"}