anyagent 0.0.3

One Rust interface to the coding agents installed on a machine.
Documentation
# Release binaries for every supported target, plus the wire schema.
# A tag `v*` publishes a GitHub release; a pull request that touches this
# file, or a manual run, builds everything and stops at the artifacts.
name: Release

on:
  push:
    tags: ["v*"]
  pull_request:
    paths: [".github/workflows/release.yml"]
  workflow_dispatch:

jobs:
  build:
    strategy:
      fail-fast: false
      matrix:
        include:
          - { target: x86_64-apple-darwin, os: macos-latest }
          - { target: aarch64-apple-darwin, os: macos-latest }
          - { target: x86_64-unknown-linux-gnu, os: ubuntu-latest }
          - { target: aarch64-unknown-linux-gnu, os: ubuntu-24.04-arm }
          - { target: x86_64-pc-windows-msvc, os: windows-latest }
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
        with:
          targets: ${{ matrix.target }}
      - run: cargo build --release --locked --bin anyagent --target ${{ matrix.target }}
      - name: Name the binary after its target
        shell: bash
        run: |
          ext=""
          [[ "${{ matrix.target }}" == *windows* ]] && ext=".exe"
          mkdir dist
          cp "target/${{ matrix.target }}/release/anyagent$ext" "dist/anyagent-${{ matrix.target }}$ext"
      - uses: actions/upload-artifact@v4
        with:
          name: anyagent-${{ matrix.target }}
          path: dist/*

  release:
    needs: build
    runs-on: macos-latest # lipo
    permissions:
      contents: write
    steps:
      - uses: actions/checkout@v4
      - uses: actions/download-artifact@v4
        with:
          path: dist
          merge-multiple: true
      - name: Universal mac binary, schema, checksums
        run: |
          lipo -create dist/anyagent-x86_64-apple-darwin dist/anyagent-aarch64-apple-darwin -output dist/anyagent-macos-universal
          cp packages/schema.json dist/schema.json
          (cd dist && shasum -a 256 * > SHA256SUMS && cat SHA256SUMS)
      - uses: actions/upload-artifact@v4
        with:
          name: release
          path: dist/*
      - if: startsWith(github.ref, 'refs/tags/')
        run: gh release create "$GITHUB_REF_NAME" dist/* --title "$GITHUB_REF_NAME" --generate-notes || gh release upload "$GITHUB_REF_NAME" dist/* --clobber
        env:
          GH_TOKEN: ${{ github.token }}

  npm:
    needs: release
    if: startsWith(github.ref, 'refs/tags/')
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: "22"
          registry-url: https://registry.npmjs.org
      - uses: actions/download-artifact@v4
        with:
          name: release
          path: dist
      - name: Each binary into its platform package, then publish all six (a rerun skips versions already on npm)
        working-directory: packages/node
        env:
          NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
        run: |
          cp ../../dist/anyagent-aarch64-apple-darwin platform/darwin-arm64/bin/anyagent
          cp ../../dist/anyagent-x86_64-apple-darwin platform/darwin-x64/bin/anyagent
          cp ../../dist/anyagent-x86_64-unknown-linux-gnu platform/linux-x64/bin/anyagent
          cp ../../dist/anyagent-aarch64-unknown-linux-gnu platform/linux-arm64/bin/anyagent
          cp ../../dist/anyagent-x86_64-pc-windows-msvc.exe platform/win32-x64/bin/anyagent.exe
          chmod +x platform/*/bin/anyagent*
          (cd anyagent && npm ci && npm run build)
          for p in platform/*/ anyagent/; do
            (cd "$p" && npm view "$(jq -r '.name + "@" + .version' package.json)" version >/dev/null 2>&1 || npm publish --access public)
          done