diff --git a/.agents/AGENTS.md b/.agents/AGENTS.md
index 7bd7fb5..75a0c20 100644
--- a/.agents/AGENTS.md
+++ b/.agents/AGENTS.md
@@ -42,4 +42,6 @@ Push a `v*` tag matching the `[workspace.package]` version in the root `Cargo.to
`release-npm.yml` ("Code Release npm") runs on the same tag and publishes `@ondeinference/onde-code` (a Node launcher in `packaging/npm/onde-code`) plus five platform packages, `@ondeinference/onde-code-{darwin-arm64,darwin-x64,linux-x64,linux-arm64,windows-x64}`. Auth is npm Trusted Publishing; npm authenticates with OIDC, not a token. Trusted Publishers are configured per package (all six point at `release-npm.yml`), so a new package needs one before its first CI publish; run `packaging/npm/scripts/setup-trusted-publishing.sh` to create and attach them. Verify with `npm view @ondeinference/onde-code version`.
+`release-nuget.yml` ("Code Release NuGet") runs on the same tag and publishes `Onde.Code`, a .NET tool (`packaging/nuget/onde-code`) that bundles the five binaries and launches the one for the host. Auth is NuGet Trusted Publishing: nuget.org needs a policy for this repo and `release-nuget.yml`, and the `NUGET_USER` repo secret holds the profile name that owns the package. Its jobs check out `inputs.tag`, so a manual dispatch only works for tags that already contain `packaging/nuget/`. Verify with `https://api.nuget.org/v3-flatcontainer/onde.code/index.json`.
+
**winget:** `release-winget.yml` files the Package Request issue with `WINGET_ISSUE_TOKEN` (`public_repo`), then opens the manifest PR with `WINGET_PR_TOKEN`, a classic PAT with `public_repo`, `read:org`, `read:discussion`, and `workflow`. The first three cover forking and the `gh pr edit` GraphQL query. `workflow` is there because wingetcreate fast-forwards the token owner's fork before it branches, and GitHub refuses that sync once an upstream commit changes a file under `.github/workflows`. "The forked repository could not be synced with the upstream commits" can mean the PAT lacks `workflow`, or that the fork has simply drifted too far behind upstream; add the scope, or sync the fork by hand and rerun.
diff --git a/.github/workflows/release-nuget.yml b/.github/workflows/release-nuget.yml
new file mode 100644
index 0000000..afcf7ae
--- /dev/null
+++ b/.github/workflows/release-nuget.yml
@@ -0,0 +1,349 @@
+name: Code Release NuGet
+
+# Publishes Onde.Code, a .NET tool that bundles the native onde-code binaries, on the same v*
+# tag that release-github.yml and release-npm.yml build from.
+#
+# Auth is NuGet Trusted Publishing (OIDC), so no long-lived API key is stored. nuget.org needs a
+# trusted publishing policy for this repository and workflow (release-nuget.yml), and the
+# NUGET_USER repo secret must hold the nuget.org profile name that owns the package.
+
+on:
+ push:
+ tags: ["v*"]
+ workflow_dispatch:
+ inputs:
+ tag:
+ description: "Release tag (e.g. v1.0.4)"
+ required: true
+
+concurrency:
+ # A re-pushed or re-dispatched tag fires this a second time. Queue the
+ # duplicate behind the original instead of cancelling it: cancelling a run
+ # mid-publish can leave a channel half-uploaded, whereas a queued duplicate
+ # just hits the "already published" check and exits clean.
+ group: ${{ github.workflow }}-${{ github.event.inputs.tag || github.ref_name }}
+ cancel-in-progress: false
+
+permissions:
+ contents: read
+
+env:
+ CARGO_TERM_COLOR: always
+ DOTNET_VERSION: 8.0.x
+ NUGET_PACKAGE_ID: Onde.Code
+
+jobs:
+ # The launcher's version comes from the tag, but the binary reports CARGO_PKG_VERSION, so a
+ # mismatch would publish a package that lies about its version.
+ verify-version:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v6
+ with:
+ ref: ${{ github.event.inputs.tag || github.ref }}
+ - name: Tag matches Cargo.toml
+ shell: bash
+ env:
+ TAG: ${{ github.event.inputs.tag || github.ref_name }}
+ run: |
+ crate=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -1)
+ if [ "$TAG" != "v$crate" ]; then
+ echo "::error::tag $TAG does not match Cargo.toml version $crate"
+ exit 1
+ fi
+
+ build-native-binaries:
+ name: Build native binary (${{ matrix.build.NAME }})
+ needs: verify-version
+ runs-on: ${{ matrix.build.OS }}
+ strategy:
+ fail-fast: false
+ matrix:
+ build:
+ - { NAME: darwin-arm64, OS: macos-latest, TARGET: aarch64-apple-darwin }
+ - { NAME: darwin-x64, OS: macos-15-intel, TARGET: x86_64-apple-darwin }
+ - { NAME: linux-x64, OS: ubuntu-latest, TARGET: x86_64-unknown-linux-gnu }
+ - { NAME: linux-arm64, OS: ubuntu-24.04-arm, TARGET: aarch64-unknown-linux-gnu }
+ - { NAME: windows-x64, OS: windows-latest, TARGET: x86_64-pc-windows-msvc }
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v6
+ with:
+ ref: ${{ github.event.inputs.tag || github.ref }}
+
+ - name: Install Rust toolchain
+ uses: dtolnay/rust-toolchain@stable
+ with:
+ targets: ${{ matrix.build.TARGET }}
+
+ - name: Setup Rust cache
+ uses: Swatinem/rust-cache@v2
+ with:
+ key: nuget-${{ matrix.build.TARGET }}
+
+ # --bin keeps the test-only fake-mcp-server out of the package.
+ - name: Build binary
+ shell: bash
+ run: cargo build --locked --release -p onde-code --bin onde-code --target ${{ matrix.build.TARGET }}
+
+ # The exe must not import the VC++ runtime DLLs (see .cargo/config.toml), or it fails to
+ # load on a machine without the redistributable.
+ - name: Check static CRT
+ if: matrix.build.NAME == 'windows-x64'
+ shell: pwsh
+ run: ./packaging/windows/check-static-crt.ps1 -Path target/${{ matrix.build.TARGET }}/release/onde-code.exe
+
+ - name: Prepare artifact
+ shell: bash
+ env:
+ BUILD_NAME: ${{ matrix.build.NAME }}
+ run: |
+ executable_name="onde-code"
+ if [[ "${BUILD_NAME}" == windows-* ]]; then
+ executable_name="onde-code.exe"
+ fi
+
+ mkdir -p "nuget-artifacts/native/${{ matrix.build.NAME }}"
+ cp "target/${{ matrix.build.TARGET }}/release/${executable_name}" \
+ "nuget-artifacts/native/${{ matrix.build.NAME }}/${executable_name}"
+
+ - name: Upload native artifact
+ uses: actions/upload-artifact@v4
+ with:
+ name: nuget-native-${{ matrix.build.NAME }}
+ path: nuget-artifacts/native
+
+ pack-nuget:
+ name: Pack NuGet .NET tool
+ runs-on: ubuntu-latest
+ needs: build-native-binaries
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v6
+ with:
+ ref: ${{ github.event.inputs.tag || github.ref }}
+
+ - name: Set the release version
+ shell: bash
+ run: |
+ if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then
+ release_version="${GITHUB_REF_NAME#v}"
+ else
+ release_version="${{ github.event.inputs.tag }}"
+ release_version="${release_version#v}"
+ fi
+ echo "RELEASE_VERSION=${release_version}" >> "$GITHUB_ENV"
+
+ - name: Download native artifacts
+ uses: actions/download-artifact@v4
+ with:
+ pattern: nuget-native-*
+ path: packaging/nuget/onde-code/native
+ merge-multiple: true
+
+ - name: Setup .NET SDK
+ uses: actions/setup-dotnet@v4
+ with:
+ dotnet-version: ${{ env.DOTNET_VERSION }}
+
+ - name: Pack .NET tool
+ shell: bash
+ run: |
+ dotnet pack packaging/nuget/onde-code/OndeCode.csproj \
+ --configuration Release \
+ --output packaging/nuget/dist \
+ -p:PackageVersion="${RELEASE_VERSION}"
+
+ # All five binaries ship in one package, so this sits closer to nuget.org's
+ # 250 MB ceiling than the single-platform npm and PyPI artifacts do. Fail
+ # here with a clear message rather than at `dotnet nuget push`, where the
+ # error is just "the package file exceeds the size limit".
+ - name: Check package size against the NuGet limit
+ shell: bash
+ run: |
+ package="$(find packaging/nuget/dist -name '*.nupkg' | head -n 1)"
+ size_bytes="$(wc -c < "${package}")"
+ limit_bytes=$((250 * 1024 * 1024))
+
+ echo "Package: ${package}"
+ echo "Size: $((size_bytes / 1024 / 1024)) MiB"
+
+ if [ "${size_bytes}" -gt "${limit_bytes}" ]; then
+ echo "::error::${package} is over nuget.org's 250 MB package limit. Split the tool into RID-specific packages (.NET 10 DotnetToolRidPackage) instead of bundling every target." >&2
+ exit 1
+ fi
+
+ - name: Upload package artifact
+ uses: actions/upload-artifact@v4
+ with:
+ name: nuget-package
+ path: packaging/nuget/dist/*.nupkg
+
+ smoke-test:
+ name: Smoke test (${{ matrix.os }})
+ runs-on: ${{ matrix.os }}
+ needs: pack-nuget
+ strategy:
+ fail-fast: false
+ matrix:
+ os:
+ - ubuntu-latest
+ - windows-latest
+ - macos-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v6
+ with:
+ ref: ${{ github.event.inputs.tag || github.ref }}
+
+ - name: Set the release version
+ shell: bash
+ run: |
+ if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then
+ release_version="${GITHUB_REF_NAME#v}"
+ else
+ release_version="${{ github.event.inputs.tag }}"
+ release_version="${release_version#v}"
+ fi
+ echo "RELEASE_VERSION=${release_version}" >> "$GITHUB_ENV"
+
+ - name: Download package artifact
+ uses: actions/download-artifact@v4
+ with:
+ name: nuget-package
+ path: packaging/nuget/dist
+
+ - name: Setup .NET SDK
+ uses: actions/setup-dotnet@v4
+ with:
+ dotnet-version: ${{ env.DOTNET_VERSION }}
+
+ - name: Install tool from local package
+ shell: pwsh
+ run: |
+ $packageSource = (Resolve-Path "packaging/nuget/dist").Path
+ @"
+
+
+
@@ -35,6 +36,7 @@ It is one static binary written in Rust, and it also accepts any OpenAI API comp
```sh
npm install -g @ondeinference/onde-code # pulls in the binary for your platform
+dotnet tool install -g Onde.Code # or as a .NET tool
npx @ondeinference/onde-code --acp # or run it without installing, from an editor
```
diff --git a/docs/install.md b/docs/install.md
index fd3cfdf..f0c3fde 100644
--- a/docs/install.md
+++ b/docs/install.md
@@ -30,6 +30,16 @@ install:
npx @ondeinference/onde-code --acp
```
+## NuGet (.NET tool)
+
+```sh
+dotnet tool install --global Onde.Code
+```
+
+The package bundles the binaries for macOS, Linux and Windows x64, plus macOS and Linux arm64,
+so it is larger than the npm packages. There is no Windows arm64 build, and the launcher says so
+when it runs there.
+
## winget
```sh
diff --git a/packaging/nuget/onde-code/OndeCode.csproj b/packaging/nuget/onde-code/OndeCode.csproj
new file mode 100644
index 0000000..edca8b3
--- /dev/null
+++ b/packaging/nuget/onde-code/OndeCode.csproj
@@ -0,0 +1,42 @@
+