diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..7bac0e2 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,31 @@ +name: Build + +on: + push: + branches: [ main, develop ] + pull_request: + branches: [ main ] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 10.0.x + + - name: Display .NET info + run: dotnet --info + + - name: Restore dependencies + run: dotnet restore + + - name: Build + run: dotnet build --configuration Release --no-restore + + - name: Test + run: dotnet test --configuration Release --no-build --verbosity normal diff --git a/.github/workflows/publish-nuget.yml b/.github/workflows/publish-nuget.yml new file mode 100644 index 0000000..a45c7cf --- /dev/null +++ b/.github/workflows/publish-nuget.yml @@ -0,0 +1,69 @@ +name: Build, Test & Publish NuGet Package + +on: + push: + branches: [ main ] + tags: [ 'v*' ] + pull_request: + branches: [ main ] + workflow_dispatch: + +permissions: + contents: read + checks: write + pull-requests: write + +env: + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true + DOTNET_CLI_TELEMETRY_OPTOUT: true + +jobs: + build-test-publish: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup .NET SDK + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 10.0.x + + - name: Display .NET info + run: dotnet --info + + - name: Restore dependencies + run: dotnet restore + + - name: Build solution + run: dotnet build --configuration Release --no-restore + + - name: Run tests + run: dotnet test --configuration Release --no-build --verbosity normal + + - name: Pack NuGet packages + if: success() + run: dotnet pack --configuration Release --no-build --output ./artifacts + + - name: List artifacts + if: success() + run: ls -lh ./artifacts/ + + - name: Publish to NuGet.org + if: success() && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')) + run: | + dotnet nuget push ./artifacts/*.nupkg \ + --source https://api.nuget.org/v3/index.json \ + --api-key ${{ secrets.NUGET_API_KEY }} \ + --skip-duplicate + + - name: Upload artifacts + if: success() + uses: actions/upload-artifact@v4 + with: + name: nuget-packages + path: ./artifacts/*.nupkg + retention-days: 30 diff --git a/README.md b/README.md index eb72a7e..1778cb8 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,9 @@ # OpenCode.DotnetClient +[![Build](https://github.com/Olbrasoft/OpenCode.DotnetClient/actions/workflows/build.yml/badge.svg)](https://github.com/Olbrasoft/OpenCode.DotnetClient/actions/workflows/build.yml) +[![Publish NuGet](https://github.com/Olbrasoft/OpenCode.DotnetClient/actions/workflows/publish-nuget.yml/badge.svg)](https://github.com/Olbrasoft/OpenCode.DotnetClient/actions/workflows/publish-nuget.yml) +[![NuGet](https://img.shields.io/nuget/v/Olbrasoft.OpenCode.DotnetClient.svg)](https://www.nuget.org/packages/Olbrasoft.OpenCode.DotnetClient/) +[![NuGet Downloads](https://img.shields.io/nuget/dt/Olbrasoft.OpenCode.DotnetClient.svg)](https://www.nuget.org/packages/Olbrasoft.OpenCode.DotnetClient/) [![.NET](https://img.shields.io/badge/.NET-10.0-blue)](https://dotnet.microsoft.com/) [![License](https://img.shields.io/badge/license-MIT-green)](LICENSE) @@ -29,6 +33,17 @@ This is a **Proof of Concept (POC)** .NET client for OpenCode API, built with: ## 📦 Installation +### NuGet Package + +```bash +dotnet add package Olbrasoft.OpenCode.DotnetClient +``` + +Or via Package Manager Console: +```powershell +Install-Package Olbrasoft.OpenCode.DotnetClient +``` + ### Prerequisites - .NET 10.0 SDK or later diff --git a/examples/OpenCode.DotnetClient.Example/OpenCode.DotnetClient.Example.csproj b/examples/OpenCode.DotnetClient.Example/OpenCode.DotnetClient.Example.csproj index 4dca036..7509acc 100644 --- a/examples/OpenCode.DotnetClient.Example/OpenCode.DotnetClient.Example.csproj +++ b/examples/OpenCode.DotnetClient.Example/OpenCode.DotnetClient.Example.csproj @@ -1,4 +1,4 @@ - + @@ -9,6 +9,7 @@ net10.0 enable enable + false diff --git a/olbrasoft-opencode-client.png b/olbrasoft-opencode-client.png new file mode 100644 index 0000000..5ff0256 Binary files /dev/null and b/olbrasoft-opencode-client.png differ diff --git a/src/OpenCode.DotnetClient/OpenCode.DotnetClient.csproj b/src/OpenCode.DotnetClient/OpenCode.DotnetClient.csproj index f47d033..ab0a5d9 100644 --- a/src/OpenCode.DotnetClient/OpenCode.DotnetClient.csproj +++ b/src/OpenCode.DotnetClient/OpenCode.DotnetClient.csproj @@ -1,13 +1,35 @@ - + net10.0 enable enable + true + + + Olbrasoft.OpenCode.DotnetClient + 1.0.0 + Olbrasoft + Olbrasoft + .NET client library for OpenCode server API. Provides type-safe HTTP client for session management, prompt sending, message retrieval, and real-time SSE event streaming. + © Olbrasoft 2025 + MIT + https://github.com/Olbrasoft/OpenCode.DotnetClient + https://github.com/Olbrasoft/OpenCode.DotnetClient.git + git + OpenCode;AI;Agent;NET10;API;Client;LLM;Anthropic;Claude + olbrasoft-opencode-client.png + README.md + Version 1.0.0: Initial release with session management, prompt sending, message retrieval, todo support, and SSE event streaming. + + + + +