Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -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
69 changes: 69 additions & 0 deletions .github/workflows/publish-nuget.yml
Original file line number Diff line number Diff line change
@@ -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
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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)

Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<ItemGroup>
<ProjectReference Include="..\..\src\OpenCode.DotnetClient\OpenCode.DotnetClient.csproj" />
Expand All @@ -9,6 +9,7 @@
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
</PropertyGroup>

</Project>
Binary file added olbrasoft-opencode-client.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 23 additions & 1 deletion src/OpenCode.DotnetClient/OpenCode.DotnetClient.csproj
Original file line number Diff line number Diff line change
@@ -1,13 +1,35 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<GenerateDocumentationFile>true</GenerateDocumentationFile>

<!-- NuGet Package Properties -->
<PackageId>Olbrasoft.OpenCode.DotnetClient</PackageId>
<Version>1.0.0</Version>
<Authors>Olbrasoft</Authors>
<Company>Olbrasoft</Company>
<Description>.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.</Description>
<Copyright>© Olbrasoft 2025</Copyright>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/Olbrasoft/OpenCode.DotnetClient</PackageProjectUrl>
<RepositoryUrl>https://github.com/Olbrasoft/OpenCode.DotnetClient.git</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageTags>OpenCode;AI;Agent;NET10;API;Client;LLM;Anthropic;Claude</PackageTags>
<PackageIcon>olbrasoft-opencode-client.png</PackageIcon>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageReleaseNotes>Version 1.0.0: Initial release with session management, prompt sending, message retrieval, todo support, and SSE event streaming.</PackageReleaseNotes>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Refit" Version="9.0.2" />
</ItemGroup>

<ItemGroup>
<None Include="..\..\olbrasoft-opencode-client.png" Pack="true" PackagePath="\" />
<None Include="..\..\README.md" Pack="true" PackagePath="\" />
</ItemGroup>

</Project>
Loading