diff --git a/.github/templates/index.html b/.github/templates/index.html index 04f83dfca0..db4c788868 100644 --- a/.github/templates/index.html +++ b/.github/templates/index.html @@ -22,7 +22,7 @@

GitHub Copilot SDK for Java

View on GitHub - + View on Maven Central @@ -37,14 +37,14 @@

GitHub Copilot SDK for Java

-

Available Versions

+

Available versions

    @@ -53,15 +53,22 @@

    Available Versions

+
+ +
+
    + +
+
+
+
Latest stable release
-
-
- Development snapshot -
@@ -79,7 +86,7 @@

Available Versions

· Maven Central · - MIT License + MIT License

Built with ❤️ by Microsoft and GitHub Copilot

diff --git a/.github/workflows/deploy-site.yml b/.github/workflows/deploy-site.yml index 528b9b03dd..ae35e3e9f0 100644 --- a/.github/workflows/deploy-site.yml +++ b/.github/workflows/deploy-site.yml @@ -80,39 +80,47 @@ jobs: echo "Compiling Java source from tag ${{ inputs.monorepo_tag }}" mvn clean compile test -DskipTests=false -Dcheckstyle.skip=true -B - # 5. Build the Maven Site using THIS repo's pom.xml + src/site/ + # 5. Update hardcoded version strings in site content + # Cookbook files and other markdown pages embed JBang //DEPS lines with + # hardcoded artifact versions for direct browsing on GitHub. Update them + # to the version being released. (${project.version} references are + # handled by Maven resource filtering during mvn site.) + - name: Update version strings in site content + run: | + VERSION="${{ inputs.version }}" + echo "Updating copilot-sdk-java version references to ${VERSION}" + find src/site/markdown -name "*.md" -type f -exec \ + sed -i "s|copilot-sdk-java:[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\(-[a-z][a-z0-9-]*\.[0-9][0-9]*\)*|copilot-sdk-java:${VERSION}|g" {} \; + + # 6. Build the Maven Site using THIS repo's pom.xml + src/site/ - name: Build documentation site run: | - echo "Building site for version ${{ env.DEPLOY_VERSION }}" + echo "Building site for version ${{ inputs.version }}" mvn site -Dsite.version=${{ inputs.version }} -B - # 6. Checkout gh-pages branch from this (standalone) repo - - name: Checkout gh-pages branch - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - with: - ref: gh-pages - path: site - continue-on-error: true - - - name: Initialize site if needed + # 7. Prepare gh-pages deployment directory + - name: Prepare gh-pages directory run: | - if [ ! -d "site/.git" ]; then - rm -rf site + # Try to clone existing gh-pages branch (shallow) + git clone --depth 1 --branch gh-pages \ + "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git" \ + site 2>/dev/null || { + echo "No gh-pages branch exists yet, creating fresh" mkdir -p site cd site git init git checkout -b gh-pages - git remote add origin "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git" - fi + } - # 7. Copy generated site to version directory + # 8. Copy generated site to version directory - name: Deploy version documentation run: | - echo "Deploying documentation for version ${DEPLOY_VERSION}" + VERSION="${{ inputs.version }}" + echo "Deploying documentation for version ${VERSION}" - rm -rf "site/${DEPLOY_VERSION}" - mkdir -p "site/${DEPLOY_VERSION}" - cp -r target/site/* "site/${DEPLOY_VERSION}/" + rm -rf "site/${VERSION}" + mkdir -p "site/${VERSION}" + cp -r target/site/* "site/${VERSION}/" # Also publish as /latest/ if requested if [[ "${{ inputs.publish_as_latest }}" == "true" ]]; then @@ -121,47 +129,58 @@ jobs: cp -r target/site/* "site/latest/" fi - # 8. Copy version index page from templates + # 9. Copy version index page from templates - name: Copy version index page run: | cp .github/templates/index.html site/index.html cp .github/templates/styles.css site/styles.css - # 9. Update version list based on directories present in gh-pages + # 10. Update version list based on directories present in gh-pages - name: Update version list from deployed directories run: | cd site MONOREPO_URL="https://github.com/github/copilot-sdk" - STANDALONE_URL="https://github.com/github/copilot-sdk-java" + CURRENT_VERSION="${{ inputs.version }}" - VERSIONS=$(ls -d */ 2>/dev/null | sed 's|/||' | grep -E '^[0-9]+\.[0-9]+' | sort -Vr || true) + # Community releases: versions that existed before the monorepo era. + # These are all versions that are NOT the current deploy version. + # They go into the "Community releases" collapsible section. + COMMUNITY_VERSIONS="1.0.9 1.0.8 1.0.7 1.0.6 1.0.5 1.0.4 1.0.3 1.0.2 1.0.1 1.0.0-beta-java.4 1.0.0-beta-java.3 1.0.0-beta-java.2 1.0.0-beta-java.1 1.0.0-beta-10-java.0 1.0.0-beta-8-java.0 0.3.0-java.2" + STANDALONE_URL="https://github.com/github/copilot-sdk-java" - HAS_SNAPSHOT=$([ -d "snapshot" ] && echo "true" || echo "false") + # Current version (the one just deployed) + CURRENT_HTML='
  • Version '"${CURRENT_VERSION}"'documentation ↗release notes ↗latest
  • ' - CURRENT_HTML="" + # Older releases: previous monorepo releases (all version dirs that + # are NOT the current version and NOT in the community list) OLDER_HTML="" - IS_FIRST_VERSION="true" - - if [ "$HAS_SNAPSHOT" = "true" ]; then - CURRENT_HTML+='
  • Development (main branch)documentation ↗changelog ↗snapshot
  • ' - fi - - for v in $VERSIONS; do + ALL_VERSIONS=$(ls -d */ 2>/dev/null | sed 's|/||' | grep -E '^[0-9]+\.[0-9]+' | sort -Vr || true) + for v in $ALL_VERSIONS; do + # Skip current version + [[ "$v" == "$CURRENT_VERSION" ]] && continue + # Skip community versions + echo "$COMMUNITY_VERSIONS" | tr ' ' '\n' | grep -qx "$v" && continue + # Skip snapshot/latest dirs + [[ "$v" == "snapshot" || "$v" == "latest" ]] && continue RELEASE_URL="${MONOREPO_URL}/releases/tag/java/v${v}" + OLDER_HTML+='
  • '"$v"'documentation ↗release notes ↗
  • ' + done - if [ "$IS_FIRST_VERSION" = "true" ]; then - CURRENT_HTML+='
  • Version '"$v"'documentation ↗release notes ↗latest
  • ' - IS_FIRST_VERSION="false" - else - OLDER_HTML+='
  • '"$v"'documentation ↗release notes ↗
  • ' + # Community releases + COMMUNITY_HTML="" + for v in $COMMUNITY_VERSIONS; do + if [ -d "$v" ]; then + RELEASE_URL="${STANDALONE_URL}/releases/tag/v${v}" + COMMUNITY_HTML+='
  • '"$v"'documentation ↗release notes ↗
  • ' fi done - sed -i "s||$CURRENT_HTML|" index.html + sed -i "s||$CURRENT_HTML|" index.html sed -i "s||$OLDER_HTML|" index.html + sed -i "s||$COMMUNITY_HTML|" index.html - # 10. Overlay custom JaCoCo CSS + # 11. Overlay custom JaCoCo CSS - name: Overlay custom JaCoCo CSS run: | cd site @@ -175,7 +194,7 @@ jobs: done fi - # 11. Push to gh-pages + # 12. Push to gh-pages - name: Deploy to GitHub Pages run: | cd site @@ -187,10 +206,10 @@ jobs: git add -A - COMMIT_MSG="Deploy documentation: ${DEPLOY_VERSION} (from ${{ inputs.monorepo_tag }})" + COMMIT_MSG="Deploy documentation: ${{ inputs.version }} (from ${{ inputs.monorepo_tag }})" git diff --staged --quiet || git commit -m "$COMMIT_MSG" - git push -u origin gh-pages --force + git push origin gh-pages --force env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/pom.xml b/pom.xml index 09fe864bd0..e34688255d 100644 --- a/pom.xml +++ b/pom.xml @@ -51,6 +51,24 @@ 2.21 provided + + com.fasterxml.jackson.core + jackson-core + 2.21.3 + provided + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + 2.21.3 + provided + + + com.github.spotbugs + spotbugs-annotations + 4.9.8 + provided + @@ -171,8 +189,11 @@ maven-javadoc-plugin 3.11.2 - ${monorepo.java.dir}/src/main/java + ${monorepo.java.dir}/src/main/java:${monorepo.java.dir}/src/generated/java com.github.copilot + false + false + none diff --git a/src/site/markdown/cookbook/README.md b/src/site/markdown/cookbook/README.md index 0b51c03776..2601a427ee 100644 --- a/src/site/markdown/cookbook/README.md +++ b/src/site/markdown/cookbook/README.md @@ -31,7 +31,7 @@ For other installation methods, see the [JBang installation guide](https://www.j ## Contributing -Add a new recipe by creating a markdown file in this folder and linking it above. Follow repository guidance in the [main README](https://github.com/github/copilot-sdk-java#contributing). +Add a new recipe by creating a markdown file in this folder and linking it above. Follow repository guidance in the [main README](https://github.com/github/copilot-sdk#contributing). ## Status diff --git a/src/site/markdown/cookbook/error-handling.md b/src/site/markdown/cookbook/error-handling.md index 0f07e10ff5..0a1af8af49 100644 --- a/src/site/markdown/cookbook/error-handling.md +++ b/src/site/markdown/cookbook/error-handling.md @@ -30,7 +30,7 @@ jbang BasicErrorHandling.java **Code:** ```java -//DEPS com.github:copilot-sdk-java:1.0.0-beta-8-java.0 +//DEPS com.github:copilot-sdk-java:1.0.0 import com.github.copilot.CopilotClient; import com.github.copilot.generated.AssistantMessageEvent; import com.github.copilot.rpc.MessageOptions; @@ -64,7 +64,7 @@ public class BasicErrorHandling { ## Handling specific error types ```java -//DEPS com.github:copilot-sdk-java:1.0.0-beta-8-java.0 +//DEPS com.github:copilot-sdk-java:1.0.0 import com.github.copilot.CopilotClient; import java.util.concurrent.ExecutionException; @@ -99,7 +99,7 @@ public class SpecificErrorHandling { ## Timeout handling ```java -//DEPS com.github:copilot-sdk-java:1.0.0-beta-8-java.0 +//DEPS com.github:copilot-sdk-java:1.0.0 import com.github.copilot.CopilotSession; import com.github.copilot.generated.AssistantMessageEvent; import com.github.copilot.rpc.MessageOptions; @@ -130,7 +130,7 @@ public class TimeoutHandling { ## Aborting a request ```java -//DEPS com.github:copilot-sdk-java:1.0.0-beta-8-java.0 +//DEPS com.github:copilot-sdk-java:1.0.0 import com.github.copilot.CopilotSession; import com.github.copilot.rpc.MessageOptions; import java.util.concurrent.Executors; @@ -162,7 +162,7 @@ public class AbortRequest { ## Graceful shutdown ```java -//DEPS com.github:copilot-sdk-java:1.0.0-beta-8-java.0 +//DEPS com.github:copilot-sdk-java:1.0.0 import com.github.copilot.CopilotClient; public class GracefulShutdown { @@ -192,7 +192,7 @@ public class GracefulShutdown { ## Try-with-resources pattern ```java -//DEPS com.github:copilot-sdk-java:1.0.0-beta-8-java.0 +//DEPS com.github:copilot-sdk-java:1.0.0 import com.github.copilot.CopilotClient; import com.github.copilot.generated.AssistantMessageEvent; import com.github.copilot.rpc.MessageOptions; @@ -224,7 +224,7 @@ public class TryWithResources { ## Handling tool errors ```java -//DEPS com.github:copilot-sdk-java:1.0.0-beta-8-java.0 +//DEPS com.github:copilot-sdk-java:1.0.0 import com.github.copilot.CopilotClient; import com.github.copilot.generated.AssistantMessageEvent; import com.github.copilot.rpc.MessageOptions; diff --git a/src/site/markdown/cookbook/managing-local-files.md b/src/site/markdown/cookbook/managing-local-files.md index 2e986850e1..52947a1264 100644 --- a/src/site/markdown/cookbook/managing-local-files.md +++ b/src/site/markdown/cookbook/managing-local-files.md @@ -34,7 +34,7 @@ jbang ManagingLocalFiles.java **Code:** ```java -//DEPS com.github:copilot-sdk-java:1.0.0-beta-8-java.0 +//DEPS com.github:copilot-sdk-java:1.0.0 import com.github.copilot.CopilotClient; import com.github.copilot.generated.AssistantMessageEvent; import com.github.copilot.generated.SessionIdleEvent; @@ -161,7 +161,7 @@ session.send(new MessageOptions().setPrompt(prompt)); ## Interactive file organization ```java -//DEPS com.github:copilot-sdk-java:1.0.0-beta-8-java.0 +//DEPS com.github:copilot-sdk-java:1.0.0 import java.io.BufferedReader; import java.io.InputStreamReader; diff --git a/src/site/markdown/cookbook/multiple-sessions.md b/src/site/markdown/cookbook/multiple-sessions.md index 653f8edeff..5b3d9fe6b2 100644 --- a/src/site/markdown/cookbook/multiple-sessions.md +++ b/src/site/markdown/cookbook/multiple-sessions.md @@ -30,7 +30,7 @@ jbang MultipleSessions.java **Code:** ```java -//DEPS com.github:copilot-sdk-java:1.0.0-beta-8-java.0 +//DEPS com.github:copilot-sdk-java:1.0.0 import com.github.copilot.CopilotClient; import com.github.copilot.generated.AssistantMessageEvent; import com.github.copilot.rpc.MessageOptions; @@ -123,7 +123,7 @@ try { ## Managing session lifecycle with CompletableFuture ```java -//DEPS com.github:copilot-sdk-java:1.0.0-beta-8-java.0 +//DEPS com.github:copilot-sdk-java:1.0.0 import java.util.concurrent.CompletableFuture; import java.util.List; @@ -176,7 +176,7 @@ pool so that SDK work does not compete with the rest of your application for common-pool threads: ```java -//DEPS com.github:copilot-sdk-java:${project.version} +//DEPS com.github:copilot-sdk-java:1.0.0 import com.github.copilot.CopilotClient; import com.github.copilot.rpc.CopilotClientOptions; import com.github.copilot.rpc.SessionConfig; diff --git a/src/site/markdown/cookbook/persisting-sessions.md b/src/site/markdown/cookbook/persisting-sessions.md index 478502e887..1b1f52542d 100644 --- a/src/site/markdown/cookbook/persisting-sessions.md +++ b/src/site/markdown/cookbook/persisting-sessions.md @@ -30,7 +30,7 @@ jbang PersistingSessions.java **Code:** ```java -//DEPS com.github:copilot-sdk-java:1.0.0-beta-8-java.0 +//DEPS com.github:copilot-sdk-java:1.0.0 import com.github.copilot.CopilotClient; import com.github.copilot.generated.AssistantMessageEvent; import com.github.copilot.rpc.MessageOptions; @@ -127,7 +127,7 @@ public class DeleteSession { ## Getting session history ```java -//DEPS com.github:copilot-sdk-java:1.0.0-beta-8-java.0 +//DEPS com.github:copilot-sdk-java:1.0.0 import com.github.copilot.CopilotClient; import com.github.copilot.generated.AssistantMessageEvent; import com.github.copilot.generated.UserMessageEvent; @@ -162,7 +162,7 @@ public class SessionHistory { ## Complete example with session management ```java -//DEPS com.github:copilot-sdk-java:1.0.0-beta-8-java.0 +//DEPS com.github:copilot-sdk-java:1.0.0 import java.util.Scanner; public class SessionManager { diff --git a/src/site/markdown/cookbook/pr-visualization.md b/src/site/markdown/cookbook/pr-visualization.md index 7f45b94883..910bfe1c38 100644 --- a/src/site/markdown/cookbook/pr-visualization.md +++ b/src/site/markdown/cookbook/pr-visualization.md @@ -34,7 +34,7 @@ jbang PRVisualization.java github/copilot-sdk ## Full example: PRVisualization.java ```java -//DEPS com.github:copilot-sdk-java:1.0.0-beta-8-java.0 +//DEPS com.github:copilot-sdk-java:1.0.0 import com.github.copilot.CopilotClient; import com.github.copilot.generated.AssistantMessageEvent; import com.github.copilot.generated.ToolExecutionStartEvent; diff --git a/src/site/markdown/index.md b/src/site/markdown/index.md index 645645d4bc..7819c5f05e 100644 --- a/src/site/markdown/index.md +++ b/src/site/markdown/index.md @@ -8,8 +8,8 @@ Welcome to the documentation for the **GitHub Copilot SDK for Java** — a Java ### Requirements -- Java 17 or later -- GitHub Copilot CLI 1.0.17 or later installed and in PATH (or provide custom `cliPath`) +- Java 17 or later. **JDK 25 recommended**. The distributed jar is a multi-release jar (MR-JAR) and is compiled on JDK 25 with `maven.compiler.release` set to 17. This means, when run on JDK 25 and later, the SDK automatically uses virtual threads for its default internal executor. +- GitHub Copilot CLI 1.0.55 or later installed and in PATH (or provide custom `cliPath`) ### Installation @@ -118,6 +118,6 @@ jbang hello-copilot.java ## Source Code -- [GitHub Repository](https://github.com/github/copilot-sdk-java) -- [Issue Tracker](https://github.com/github/copilot-sdk-java/issues) -- [Contributing Guide](https://github.com/github/copilot-sdk-java/blob/main/CONTRIBUTING.md) +- [GitHub Repository](https://github.com/github/copilot-sdk) +- [Issue Tracker](https://github.com/github/copilot-sdk/issues) +- [Contributing Guide](https://github.com/github/copilot-sdk/blob/main/CONTRIBUTING.md)