aiscope 0.1.0

DevTools for your AI coding tools' memory. See what Cursor, Claude Code, and Copilot actually remember about your project — and where they disagree.
Documentation
name: release

on:
    push:
        tags:
            - "v*.*.*"
    workflow_dispatch:

        # Read-only by default; jobs opt into more.
permissions: read-all

concurrency:
    group: release-${{ github.ref }}
    cancel-in-progress: false

jobs:
    build:
        name: build (${{ matrix.target }})
        runs-on: ${{ matrix.os }}
        permissions:
            contents: read
        strategy:
            fail-fast: false
            matrix:
                include:
                    - os: ubuntu-latest
                      target: x86_64-unknown-linux-gnu
                      archive: tar.gz
                    - os: ubuntu-latest
                      target: aarch64-unknown-linux-gnu
                      archive: tar.gz
                      cross: true
                    - os: macos-latest
                      target: x86_64-apple-darwin
                      archive: tar.gz
                    - os: macos-latest
                      target: aarch64-apple-darwin
                      archive: tar.gz
                    - os: windows-latest
                      target: x86_64-pc-windows-msvc
                      archive: zip

        steps:
            - name: Checkout
              uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
              with:
                  persist-credentials: false

            - name: Install Rust toolchain
              uses: dtolnay/rust-toolchain@stable
              with:
                  targets: ${{ matrix.target }}

            - name: Cache cargo
              uses: Swatinem/rust-cache@23869a5bd66c73db3c0ac40331f3206eb23791dc # v2.9.1
              with:
                  key: ${{ matrix.target }}

            - name: Install cross (linux-aarch64 only)
              if: matrix.cross
              run: cargo install cross --locked

            - name: Build
              shell: bash
              run: |
                  if [[ "${{ matrix.cross }}" == "true" ]]; then
                    cross build --release --target ${{ matrix.target }}
                  else
                    cargo build --release --target ${{ matrix.target }}
                  fi

            - name: Package
              shell: bash
              run: |
                  set -euo pipefail
                  name="aiscope-${GITHUB_REF_NAME}-${{ matrix.target }}"
                  mkdir "$name"
                  if [[ "${{ matrix.os }}" == "windows-latest" ]]; then
                    cp "target/${{ matrix.target }}/release/aiscope.exe" "$name/"
                  else
                    cp "target/${{ matrix.target }}/release/aiscope"     "$name/"
                  fi
                  cp README.md LICENSE CHANGELOG.md "$name/"
                  if [[ "${{ matrix.archive }}" == "zip" ]]; then
                    7z a "$name.zip" "$name"
                    echo "ASSET=$name.zip" >> "$GITHUB_ENV"
                  else
                    tar czf "$name.tar.gz" "$name"
                    echo "ASSET=$name.tar.gz" >> "$GITHUB_ENV"
                  fi

            - name: Checksum
              shell: bash
              run: |
                  if [[ "${{ matrix.os }}" == "macos-latest" ]]; then
                    shasum -a 256 "$ASSET" > "$ASSET.sha256"
                  else
                    sha256sum "$ASSET" > "$ASSET.sha256"
                  fi

            - name: Upload artifact
              uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
              with:
                  name: ${{ matrix.target }}
                  path: |
                      ${{ env.ASSET }}
                      ${{ env.ASSET }}.sha256

    publish:
        name: publish github release
        needs: build
        runs-on: ubuntu-latest
        permissions:
            contents: write
        steps:
            - name: Checkout
              uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
              with:
                  persist-credentials: false

            - name: Download artifacts
              uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
              with:
                  path: dist

            - name: Create GitHub Release
              uses: softprops/action-gh-release@3bb12739c298aeb8a4eeaf626c5b8d85266b0e65 # v2.6.2
              with:
                  generate_release_notes: true
                  body_path: CHANGELOG.md
                  files: dist/*/*

    crates-io:
        name: publish crates.io
        needs: publish
        runs-on: ubuntu-latest
        if: ${{ vars.PUBLISH_CRATES_IO == 'true' }}
        permissions:
            contents: read
        steps:
            - name: Checkout
              uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
              with:
                  persist-credentials: false

            - name: Install Rust toolchain
              uses: dtolnay/rust-toolchain@stable

            - name: Publish
              env:
                  CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
              run: cargo publish --locked