From d333ed0a025605c1dae2722146b365e819f44ccf Mon Sep 17 00:00:00 2001 From: fabbrik <22822543+fabbrik@users.noreply.github.com> Date: Mon, 16 Nov 2026 12:06:41 -0600 Subject: [PATCH] feat(cli): self-contained aexp binaries, an install script and a binary adoption proof (story 29.3) The release attaches single-file, self-contained aexp binaries for linux-x64, linux-arm64, osx-arm64, osx-x64 and win-x64 with SHA256SUMS (sums quoted in the notes), built by eng/publish-binaries.sh from a locked restore of the Cli project's own binaries lock file, so the tool package is untouched. scripts/install-aexp.sh (curl | sh) picks the binary for the machine, verifies its sum and puts it on PATH. CI builds the same binaries on every pull request and proves each on its own runner with no .NET installed, through the install script (a corrupted sum refused first) and the 29.2 adoption-path checks. WorkflowTests pin the jobs, the release rules and the scripts. The README leads with the path that needs no .NET. Co-Authored-By: Claude Fable 5.1 --- .github/workflows/ci.yml | 88 +++++ .github/workflows/release.yml | 86 +++- CHANGELOG.md | 9 + CONTRIBUTING.md | 5 +- README.md | 11 +- RELEASING.md | 52 ++- docs/guide/claude-code.md | 5 +- docs/guide/cli-and-mcp.md | 20 +- eng/prove-adoption-path.sh | 172 ++++++-- eng/publish-binaries.sh | 66 ++++ scripts/install-aexp.sh | 132 +++++++ .../AgentExperience.Cli.csproj | 21 + src/AgentExperience.Cli/README.md | 5 + .../packages.binaries.lock.json | 374 ++++++++++++++++++ .../Workflows/WorkflowTests.cs | 208 +++++++++- 15 files changed, 1193 insertions(+), 61 deletions(-) create mode 100755 eng/publish-binaries.sh create mode 100755 scripts/install-aexp.sh create mode 100644 src/AgentExperience.Cli/packages.binaries.lock.json diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 140f1cab..2ac11694 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -219,6 +219,94 @@ jobs: shell: bash run: eng/prove-adoption-path.sh artifacts/packages + # Story 29.3: the self-contained aexp binaries, the path that needs no .NET. eng/publish-binaries.sh builds the five + # of them (linux-x64, linux-arm64, osx-arm64, osx-x64, win-x64) from a locked restore of the binaries' own lock file, + # with the same script release.yml runs on a tag, and uploads them with their SHA256SUMS for the job below. The tool + # package is untouched: the pack job above proves that. NOT published. + binaries: + needs: build-and-test + runs-on: ubuntu-24.04 + timeout-minutes: 20 + steps: + - name: Checkout + uses: actions/checkout@v5 + + # Local development may roll forward (global.json: latestFeature). CI may not: the runner image ships + # newer SDK bands, which would otherwise win. Disabling roll-forward here makes setup-dotnet install, + # and the host select, exactly the pinned SDK. The working copy is the runner's; nothing is committed. + - name: Pin the SDK exactly (CI only) + run: | + sed -i -E 's/"rollForward": *"[^"]*"/"rollForward": "disable"/' global.json + grep -q '"rollForward": "disable"' global.json + + # Exactly global.json's SDK (asserted below). It carries the net10.0 runtime every project targets, so nothing + # else is installed. + - name: Setup .NET + uses: actions/setup-dotnet@v5 + with: + global-json-file: global.json + cache: true + cache-dependency-path: '**/packages.lock.json' + + # Belt and braces after the pin above: a different SDK fails here instead of silently winning. + - name: Assert the exact pinned SDK + run: | + pinned="$(sed -nE 's/.*"version": *"([^"]+)".*/\1/p' global.json)" + actual="$(dotnet --version)" + test "$actual" = "$pinned" || { echo "::error::SDK $actual is in use, but global.json pins $pinned"; exit 1; } + echo "SDK $actual, as pinned" + + - name: Build the self-contained binaries + run: eng/publish-binaries.sh artifacts/binaries + + - name: Upload the binaries (for the adoption-path-binary job, never published from here) + uses: actions/upload-artifact@v4 + with: + name: binaries + path: artifacts/binaries/ + retention-days: 14 + + # Story 29.3: each binary proven on its own hardware, with no .NET installed (no setup-dotnet: the runner has only + # what a stranger's machine has). The leg runs the install script a stranger runs, scripts/install-aexp.sh, against + # the binaries job's artifact as a local download base (never the network), first on a copy with a corrupted sum + # (which must install nothing), then for real; then eng/prove-adoption-path.sh's checks: init, trust, a failed and a + # verified run, recall, lessons, benefit. AEXP_EXPECT_RUNTIME makes the leg assert it got the binary for its runtime. + # The five legs are required status checks on main. + adoption-path-binary: + needs: binaries + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-24.04 + runtime: linux-x64 + - os: ubuntu-24.04-arm + runtime: linux-arm64 + - os: macos-15 + runtime: osx-arm64 + - os: macos-15-intel + runtime: osx-x64 + - os: windows-2025 + runtime: win-x64 + name: adoption-path-binary (${{ matrix.runtime }}) + timeout-minutes: 15 + steps: + - name: Checkout + uses: actions/checkout@v5 + + - name: Download the binaries the binaries job built + uses: actions/download-artifact@v4 + with: + name: binaries + path: artifacts/binaries + + - name: Install aexp through the install script and prove the adoption path + shell: bash + env: + AEXP_EXPECT_RUNTIME: ${{ matrix.runtime }} + run: eng/prove-adoption-path.sh --binaries artifacts/binaries + # The PostgreSQL matrix (story 6.3, KL-13): the storage suites, the pgvector proof, the sample's PostgreSQL # mode and the upgrades from the published previews' databases (story 12.1), on every supported major. One # variable picks both the pgvector image and the stock one, and each suite asserts the server it reached reports diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f7fe1a0c..c5d42835 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,9 +3,10 @@ name: Release # The one workflow in this repository that may publish (RELEASING.md step 10). A maintainer starts it by pushing a # version tag, and nothing else can: no branch push, pull request, schedule or manual dispatch. One tag releases all # three languages at one version, from one verified commit. The verify job re-runs the release checks on the tagged -# commit and uploads what it verified: the eight NuGet packages, and the Python sdist and wheel. After a reviewer -# approves the `nuget-release` environment, the publish job pushes exactly those NuGet files to nuget.org, then tags -# the six Go modules at the tagged commit and creates the GitHub release. After a reviewer approves the +# commit and uploads what it verified: the eight NuGet packages, the five self-contained aexp binaries with their +# SHA256SUMS (story 29.3), and the Python sdist and wheel. After a reviewer approves the `nuget-release` environment, +# the publish job pushes exactly those NuGet files to nuget.org, then tags the six Go modules at the tagged commit and +# creates the GitHub release with the binaries attached. After a reviewer approves the # `pypi-release` environment, the publish-pypi job uploads exactly the verified Python files to PyPI. # # No API key or token is stored anywhere. The publish job exchanges its GitHub OIDC token for a short-lived nuget.org @@ -255,6 +256,50 @@ jobs: - name: Verify the packages run: dotnet run eng/verify-packages.cs -- artifacts/packages + # Story 29.3: the self-contained aexp binaries, built by the script ci.yml runs on every pull request, from a + # locked restore of the binaries' own lock file. The tool package packed above is unaffected. + - name: Build the self-contained binaries + run: eng/publish-binaries.sh artifacts/binaries + + # Exactly the five binaries and their sums, the sums right, and the Linux x64 one (this runner's) carrying the + # tagged version. The other four are proven on their own hardware by ci.yml's adoption-path-binary legs on main. + - name: Check the binaries + env: + VERSION: ${{ steps.version.outputs.version }} + run: | + set -euo pipefail + ls -l artifacts/binaries + for file in aexp-linux-x64 aexp-linux-arm64 aexp-osx-arm64 aexp-osx-x64 aexp-win-x64.exe SHA256SUMS; do + test -f "artifacts/binaries/$file" || { echo "::error::artifacts/binaries has no $file"; exit 1; } + done + test "$(find artifacts/binaries -type f | wc -l)" -eq 6 || { echo "::error::artifacts/binaries must hold exactly six files"; exit 1; } + (cd artifacts/binaries && sha256sum --check --strict SHA256SUMS) + printed="$(artifacts/binaries/aexp-linux-x64 --version)" + test "$printed" = "$VERSION" || { echo "::error::aexp-linux-x64 --version prints '$printed', not $VERSION"; exit 1; } + echo "aexp $printed: five binaries and SHA256SUMS OK" + + # The release page quotes the sums, so a person can check a download against the notes as well as against the + # SHA256SUMS asset, and leads with the install script. + - name: Add the binaries to the release notes + run: | + set -euo pipefail + { + echo + echo "## Binaries" + echo + echo "Self-contained \`aexp\` for Linux (x64, arm64), macOS (Apple silicon, Intel) and Windows (x64): no .NET needed. Install the one for this machine, its SHA-256 sum checked:" + echo + echo '```bash' + echo "curl -fsSL https://raw.githubusercontent.com/fabbrik/AgentExperience.NET/main/scripts/install-aexp.sh | sh" + echo '```' + echo + echo "SHA-256 sums of the attached binaries (\`SHA256SUMS\`):" + echo + echo '```' + cat artifacts/binaries/SHA256SUMS + echo '```' + } >> artifacts/release-notes/notes.md + # The Python distribution (python/). uv is pinned to one release, with its checksum, and nothing is cached: a # release restores from the lock file alone. - name: Setup uv and Python @@ -357,6 +402,14 @@ jobs: if-no-files-found: error retention-days: 30 + - name: Upload the binaries + uses: actions/upload-artifact@v4 + with: + name: binaries + path: artifacts/binaries/ + if-no-files-found: error + retention-days: 30 + # Kept for 90 days, the most GitHub allows: re-running publish-pypi needs it (RELEASING.md). - name: Upload the verified Python distribution uses: actions/upload-artifact@v4 @@ -392,6 +445,24 @@ jobs: name: release-notes path: artifacts/release-notes + - name: Download the binaries + uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 + with: + name: binaries + path: artifacts/binaries + + # The five binaries and SHA256SUMS verify built, and nothing else, with their sums checked again here, just + # before they are attached to the release (as the Python distribution's are before its upload). + - name: Check the binaries are the tagged version + run: | + set -euo pipefail + ls -l artifacts/binaries + for file in aexp-linux-x64 aexp-linux-arm64 aexp-osx-arm64 aexp-osx-x64 aexp-win-x64.exe SHA256SUMS; do + test -f "artifacts/binaries/$file" || { echo "::error::artifacts/binaries has no $file"; exit 1; } + done + test "$(find artifacts/binaries -type f | wc -l)" -eq 6 || { echo "::error::artifacts/binaries must hold exactly six files"; exit 1; } + (cd artifacts/binaries && sha256sum --check --strict SHA256SUMS) + # Eight packages and eight symbol packages, all at the version the tag names, and nothing else. - name: Check the packages are the tagged version env: @@ -487,7 +558,9 @@ jobs: exit 1 done - # Only after the push and the Go tags. An existing release (a re-run) is left untouched. + # Only after the push and the Go tags, with the five binaries and SHA256SUMS attached. An existing release (a + # re-run) keeps its notes and gets its assets completed: the checked binaries are uploaded again, replacing any + # of the same name (story 29.3). - name: Create the GitHub release env: GH_TOKEN: ${{ github.token }} @@ -498,13 +571,14 @@ jobs: run: | set -euo pipefail if gh release view "$TAG" > /dev/null 2>&1; then - echo "The GitHub release $TAG already exists; leaving it as it is." + echo "The GitHub release $TAG already exists; completing its assets and leaving the rest as it is." + gh release upload "$TAG" artifacts/binaries/* --clobber exit 0 fi flags=() if [ "$PRERELEASE" = "true" ]; then flags+=(--prerelease); fi gh release create "$TAG" --verify-tag --title "AgentExperience.NET $VERSION" \ - --notes-file artifacts/release-notes/notes.md "${flags[@]}" + --notes-file artifacts/release-notes/notes.md "${flags[@]}" artifacts/binaries/* # Uploads exactly the Python files verify built and checked, through PyPI Trusted Publishing: the action exchanges # the job's GitHub OIDC token for a short-lived PyPI token, under a publisher on pypi.org that names this repository, diff --git a/CHANGELOG.md b/CHANGELOG.md index 722b3a40..6ebf852e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,15 @@ AgentExperience.NET is a **preview**. It is not production ready, and public API the `.nupkg` packed for the same commit, runs `init` and `trust` on a scratch project, finalizes a failed and a verified run, and asserts that `recall`, `lessons` and `benefit` report the lesson; the three `adoption-path` legs gate every pull request. +- **`aexp` without the .NET SDK.** Every release now attaches self-contained, single-file `aexp` binaries for + linux-x64, linux-arm64, osx-arm64, osx-x64 and win-x64 with a `SHA256SUMS` file (sums quoted in the release notes), + built by `eng/publish-binaries.sh` from a locked restore; the tool package is unchanged. The install script + `scripts/install-aexp.sh` (`curl -fsSL https://raw.githubusercontent.com/fabbrik/AgentExperience.NET/main/scripts/install-aexp.sh | sh`) + picks the binary for the machine, checks its SHA-256 sum against `SHA256SUMS` (installing nothing on a mismatch) and + puts it on PATH; `AEXP_VERSION` pins a release and `AEXP_INSTALL_DIR` the directory. CI builds the same binaries on + every pull request and proves each on its own hardware with no .NET installed (`adoption-path-binary`, five legs: + the install script against the artifact, a corrupted sum refused, then the adoption-path checks). The README leads + with this path. See [CLI and MCP](docs/guide/cli-and-mcp.md#install). ### Changed diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 340b6d42..3d79bc47 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -126,7 +126,10 @@ _sdlc/ product brief, PRD, architecture, ep - Make sure `dotnet build` and `dotnet test` pass locally. CI (`.github/workflows/ci.yml`) runs on every pull request: `build-and-test`, `pack` (with package verification), `adoption-path (ubuntu-24.04, macos-15, windows-2025)` (installs `aexp` from the packed artifact on each OS and runs `eng/prove-adoption-path.sh`: init, trust, a failed and a - verified run, recall, lessons, benefit), the `postgres` matrix (15 to 18, plaintext and + verified run, recall, lessons, benefit), `binaries` (builds the five self-contained `aexp` binaries with + `eng/publish-binaries.sh`) and `adoption-path-binary (linux-x64, linux-arm64, osx-arm64, osx-x64, win-x64)` (each + binary on its own hardware with no .NET installed: `scripts/install-aexp.sh` against the artifact, a corrupted sum + refused, then the same proof), the `postgres` matrix (15 to 18, plaintext and crypto-shredding), the MAF floor (`maf-compatibility (pinned)`), the Python port's `python` matrix (CPython 3.10 to 3.14, plus its PostgreSQL 16 and 18 legs; [python/README.md](python/README.md#running-the-tests) says how to run it locally) and the Go port's `go` matrix (the core on Go 1.24, the stores from 1.25, and the Agent Framework diff --git a/README.md b/README.md index 60f5b10d..20cdbb06 100644 --- a/README.md +++ b/README.md @@ -61,17 +61,20 @@ await agent.RunAsync("Ticket #4977: a refund is stuck on a lock again. Triage it ## Any agent: CLI and MCP -Agents outside the Agent Framework (Claude Code, Codex, Cursor, a script) get the same loop through `aexp`, a .NET tool -that is both a command line and an MCP stdio server, over a local SQLite file by default (published from the next -preview, `0.1.0-preview.19`; until then, [build it from this repository](dogfood/README.md)): +Agents outside the Agent Framework (Claude Code, Codex, Cursor, a script) get the same loop through `aexp`, one +command that is both a command line and an MCP stdio server, over a local SQLite file by default. No .NET needed: the +install script puts a self-contained binary for Linux, macOS or Windows on your PATH, its SHA-256 checked against the +release (the binaries ship with every release from the first one after this change): ```bash -dotnet tool install --global AgentExperience.Cli --prerelease +curl -fsSL https://raw.githubusercontent.com/fabbrik/AgentExperience.NET/main/scripts/install-aexp.sh | sh aexp init # in the project root: detects the test command, writes .aexp/config.json aexp trust # after you reviewed the config: a person's step claude mcp add aexp -- aexp mcp # or any MCP client: the server is `aexp mcp`, run in the project ``` +With the .NET 10 SDK, the same command is also a .NET tool: `dotnet tool install --global AgentExperience.Cli --prerelease`. + `.aexp/config.json` names the scope and the one command `aexp` may run, the verifier (`"verify": { "command": ["dotnet", "test"] }`, exit code 0 = pass), which runs only once a person has reviewed the config and approved it with `aexp trust` (an edit revokes the approval). The MCP tools `experience_recall`, diff --git a/RELEASING.md b/RELEASING.md index 327015b0..33ea7774 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -24,6 +24,12 @@ eight packages, eight symbol packages, eight API baselines — is that list; `en too. The first release that carries a package ID nuget.org has never seen needs one extra check, described under [First publish of a new package ID](#first-publish-of-a-new-package-id). +The GitHub release also carries **five self-contained `aexp` binaries** and their `SHA256SUMS` as assets (story 29.3): +`aexp-linux-x64`, `aexp-linux-arm64`, `aexp-osx-arm64`, `aexp-osx-x64` and `aexp-win-x64.exe`, built by +`eng/publish-binaries.sh` on the tagged commit (step 7a), their sums quoted in the release notes, so +`scripts/install-aexp.sh` can install `aexp` on a machine with no .NET at all. They ship from the first release after +that story's merge. + The same tag also releases the two ports, at the same version, from the same verified commit: - **Python:** the distribution `agenticexperience` (`python/`), an sdist and a wheel, on PyPI. The first release that @@ -297,6 +303,30 @@ dotnet pack --no-build --configuration Release --output artifacts/packages -p:Ag dotnet run eng/verify-packages.cs -- artifacts/packages ``` +### 7a. The self-contained binaries + +The five `aexp` binaries the release attaches (story 29.3), built by the script `release.yml` and `ci.yml` both run: +a locked restore against the binaries' own lock file (`src/AgentExperience.Cli/packages.binaries.lock.json`), then one +self-contained, single-file publish per runtime, renamed `aexp-` (`.exe` for Windows), and their `SHA256SUMS`. +The check asserts exactly six files, the sums, that the tool package was left alone (no lock file changed; step 7's +packages are unaffected), and that this machine's binary prints the version, run through the install script as a +stranger would run it, with the full adoption path behind it (`eng/prove-adoption-path.sh --binaries`: the tampered +copy refused, then init, trust, a failed and a verified run, recall, lessons, benefit; no `dotnet` call at all). + +```bash +( version="$(scripts/release-version.sh dotnet)" + rm -rf artifacts/binaries + eng/publish-binaries.sh artifacts/binaries \ + && [ "$(find artifacts/binaries -type f | wc -l)" -eq 6 ] \ + && (cd artifacts/binaries && (sha256sum --check --strict SHA256SUMS 2>/dev/null || shasum -a 256 -c SHA256SUMS)) \ + && [ -z "$(git status --porcelain -- '*packages.lock.json')" ] \ + && eng/prove-adoption-path.sh --binaries artifacts/binaries \ + && echo "Binaries OK: aexp $version" || echo "FAILED: see above" ) +``` + +`release.yml`'s `verify` job runs the build and the file, sum and version checks on its Linux runner; the other four +binaries are proven on their own hardware by CI's `adoption-path-binary` legs on `main`. + ### 8. The sample, twice, byte for byte The sample's promise is one command, no Docker, no database, no credentials, and the same transcript every time. @@ -379,9 +409,12 @@ not repeated there: they are what you ran locally, and CI's `postgres`, `maf-com version derived from `Directory.Build.props` (see [What a release is today](#what-a-release-is-today)); builds the Python sdist and wheel with a pinned `uv`, checks that they are `agenticexperience` at that version (`twine check --strict` and the wheel's metadata), and runs the Python tests; and runs `go vet` and `go test` in each Go module (the -PostgreSQL legs of both ports are not repeated: CI on `main` ran them). It builds the release notes from this -version's `CHANGELOG.md` section, and fails if there is none. Last, it uploads what it verified: the NuGet packages, -and the Python distribution as its own artifact. It publishes nothing. +PostgreSQL legs of both ports are not repeated: CI on `main` ran them). It builds the five self-contained binaries +(step 7a) and checks them: six files, `sha256sum --check --strict SHA256SUMS`, and `aexp-linux-x64 --version` printing +the tagged version. It builds the release notes from this version's `CHANGELOG.md` section, and fails if there is +none, then appends a `## Binaries` section (the install one-liner and the `SHA256SUMS` lines). Last, it uploads what +it verified: the NuGet packages, the release notes, the binaries, and the Python distribution as its own artifact. It +publishes nothing. Then **approve the deployments**, two of them. Open the run under the repository's **Actions** tab, choose **Review deployments**, select `nuget-release`, and approve. The `publish` job then: @@ -397,7 +430,10 @@ deployments**, select `nuget-release`, and approve. The `publish` job then: ten attempts, 30 seconds apart (at worst about 57 minutes for all six; the job's timeout is 75 minutes); 5. only then creates the GitHub release for the tag: a prerelease when the version has a suffix, with that version's `CHANGELOG.md` section, the Known limits table (or "None currently.") and the Documented boundaries - table from `docs/known-limits.md` as its notes. A preview's release notes say what it does not promise. + table from `docs/known-limits.md` as its notes, and the five binaries and `SHA256SUMS` (downloaded from `verify` + and their sums checked again just before, as the Python distribution's are) attached as its assets. A preview's + release notes say what it does not promise. On a re-run, an existing release keeps its notes and gets its assets + completed (`gh release upload --clobber`) instead of being left as it is. When `publish` has succeeded, the run asks for the second approval: select `pypi-release` and approve. The `publish-pypi` job downloads exactly the sdist and wheel `verify` uploaded (it checks nothing out and builds nothing), @@ -406,15 +442,15 @@ Publishing: the job's OIDC token is exchanged for a short-lived PyPI token, and `skip-existing` makes a re-run skip the files PyPI already has. If `publish` fails part-way, re-run the failed job from the Actions tab (it needs approving again): `--skip-duplicate` -skips the packages nuget.org already has, Go tags already at the commit are kept, and an existing GitHub release is -left as it is. If `publish` fails at the Go module proxy check, nuget.org and the Go tags stand, but the GitHub +skips the packages nuget.org already has, Go tags already at the commit are kept, and an existing GitHub release +keeps its notes and gets the binaries uploaded again (replacing assets of the same name). If `publish` fails at the Go module proxy check, nuget.org and the Go tags stand, but the GitHub release and PyPI wait: `publish-pypi` runs only after `publish` succeeds. Re-run `publish` (the tags are kept, and the proxy check runs again); the proxy can remember that a version was not found for up to about 30 minutes, so wait that long before re-running if the tags were only just created. If `publish-pypi` fails, nuget.org, the Go tags and the GitHub release stand; fix the cause and re-run that job alone. -A publish job can be re-run only while the artifacts `verify` uploaded are retained: 30 days for the NuGet packages -and the release notes, 90 days (the most GitHub allows) for the Python distribution. After that, delete the version tag +A publish job can be re-run only while the artifacts `verify` uploaded are retained: 30 days for the NuGet packages, +the release notes and the binaries, 90 days (the most GitHub allows) for the Python distribution. After that, delete the version tag and push it again at the same commit (step 10's commands), which runs `verify` again and rebuilds them; everything already published is skipped. If `verify` fails, nothing was published: fix the cause on `main`, delete the tag (`git push origin :refs/tags/vX` and `git tag -d vX`), and tag again. A version pushed by mistake cannot be deleted from nuget.org — diff --git a/docs/guide/claude-code.md b/docs/guide/claude-code.md index cec826e8..d9eb8631 100644 --- a/docs/guide/claude-code.md +++ b/docs/guide/claude-code.md @@ -16,11 +16,14 @@ session becomes learning material with no code and no model call of aexp's own: ## Set it up in three commands ```bash -dotnet tool install --global AgentExperience.Cli --prerelease # puts aexp on PATH, where the hooks call it +curl -fsSL https://raw.githubusercontent.com/fabbrik/AgentExperience.NET/main/scripts/install-aexp.sh | sh # puts aexp on PATH, where the hooks call it; no .NET needed aexp setup claude-code # in the project root aexp trust # after you reviewed .aexp/config.json: a person's step ``` +(With the .NET 10 SDK, `dotnet tool install --global AgentExperience.Cli --prerelease` installs the same command as a +.NET tool; see [Install](cli-and-mcp.md#install).) + `aexp setup claude-code` (add `--print` to see everything without writing anything): - **adds the hooks to `.claude/settings.json`**, merged with what is there: every existing hook, matcher and setting is diff --git a/docs/guide/cli-and-mcp.md b/docs/guide/cli-and-mcp.md index 54ebfe38..7895b030 100644 --- a/docs/guide/cli-and-mcp.md +++ b/docs/guide/cli-and-mcp.md @@ -11,15 +11,27 @@ the [injection holdout](injection.md), the [lessons view](deployment.md#seeing-w ## Install +No .NET needed. The install script detects the platform (Linux x64 or arm64, macOS Apple silicon or Intel, Windows x64), +downloads the self-contained `aexp` binary from the newest GitHub release, checks its SHA-256 sum against the release's +`SHA256SUMS` and puts it on your PATH as `~/.local/bin/aexp` (it installs nothing on a mismatch): + ```bash -dotnet tool install --global AgentExperience.Cli --prerelease +curl -fsSL https://raw.githubusercontent.com/fabbrik/AgentExperience.NET/main/scripts/install-aexp.sh | sh aexp --version aexp init # in the project root: writes .aexp/config.json and the .gitignore entry ``` -It needs the .NET 10 runtime. The SQLite file is created (owner-only) on first use. This path is proven end to end in CI -on Linux, macOS and Windows: every run installs the packed tool, runs `init` and `trust`, finalizes a failed and a -verified run, and checks that `recall`, `lessons` and `benefit` report the lesson (`eng/prove-adoption-path.sh`). +Two knobs: `AEXP_VERSION=0.1.0-preview.20` (a release's version) installs that release instead of the newest, and +`AEXP_INSTALL_DIR=/some/dir` changes where `aexp` goes. The script prints which release it chose, and fails naming the +asset when that release has no binary for the platform (releases before the binaries shipped). On Windows, run it under +Git Bash (it installs `aexp.exe`), or download `aexp-win-x64.exe` from the release page and rename it; there is no +PowerShell script yet. A musl-based Linux (Alpine) is not served: use the .NET tool below. + +With the .NET 10 SDK installed, the same command is also a .NET tool, `dotnet tool install --global AgentExperience.Cli --prerelease`, +which needs the .NET 10 runtime. The SQLite file is created (owner-only) on first use. Both paths are proven end to end +in CI: every run installs `aexp` (the binary through the install script, on each of the five runtimes with no .NET on +the runner; the packed tool on Linux, macOS and Windows), runs `init` and `trust`, finalizes a failed and a verified +run, and checks that `recall`, `lessons` and `benefit` report the lesson (`eng/prove-adoption-path.sh`). ## Configure diff --git a/eng/prove-adoption-path.sh b/eng/prove-adoption-path.sh index c55bf467..576c726c 100755 --- a/eng/prove-adoption-path.sh +++ b/eng/prove-adoption-path.sh @@ -1,38 +1,63 @@ #!/usr/bin/env bash # The adoption path, proven end to end (story 29.2). What the README promises a stranger -- install aexp, run init and -# trust, and get a verified lesson back -- is done here as that stranger would do it, from the packed tool package and -# nothing else: install the .nupkg CI packed for this commit as a global tool, then on a scratch project run -# `aexp init`, `aexp trust`, a run the configured verifier fails and a run it passes, finalize both, and assert that the -# next `aexp recall` prints the lesson, `aexp lessons` lists it and `aexp benefit` reports the holdout's estimate. Every -# assertion is on what the tool printed or wrote; nothing here reaches into the library. +# trust, and get a verified lesson back -- is done here as that stranger would do it, from what CI built for this +# commit and nothing else: install aexp, then on a scratch project run `aexp init`, `aexp trust`, a run the configured +# verifier fails and a run it passes, finalize both, and assert that the next `aexp recall` prints the lesson, +# `aexp lessons` lists it and `aexp benefit` reports the holdout's estimate. Every assertion is on what the tool printed +# or wrote; nothing here reaches into the library. # -# eng/prove-adoption-path.sh # the directory `dotnet pack --output ` filled +# eng/prove-adoption-path.sh # tool mode: the directory `dotnet pack --output ` filled +# eng/prove-adoption-path.sh --binaries # binary mode: the directory eng/publish-binaries.sh filled # -# CI runs it on Linux, macOS and Windows from the pack job's artifact, so every OS proves the same bytes (ci.yml, -# adoption-path). Locally: dotnet pack --configuration Release --output /tmp/aexp-pack -p:AgentExperienceReleaseBuild=true +# Tool mode: CI runs it on Linux, macOS and Windows from the pack job's artifact, so every OS proves the same bytes +# (ci.yml, adoption-path). Locally: dotnet pack --configuration Release --output /tmp/aexp-pack -p:AgentExperienceReleaseBuild=true # and point the script at that directory. The package is installed from that directory only, never from nuget.org, at # the version scripts/release-version.sh derives, so the published package of the same version cannot stand in. The # script refuses to run while AgentExperience.Cli is already installed as a global tool (it would uninstall yours); -# otherwise it uninstalls the tool and deletes the scratch directory when it exits, pass or fail. The trust approval is -# written to a config directory inside the scratch directory, never to yours. The verifier is the one the CLI tests use: -# it passes once the file `fixed` exists in the project (sh on Unix, cmd on Windows). +# otherwise it uninstalls the tool and deletes the scratch directory when it exits, pass or fail. +# +# Binary mode (story 29.3): no dotnet at all. The install script a stranger runs (scripts/install-aexp.sh) is run with +# AEXP_DOWNLOAD_BASE pointing at the directory (file://, never the network) and AEXP_INSTALL_DIR inside the scratch +# directory, so it picks this machine's runtime, checks the sum and installs the binary there; AEXP_EXPECT_RUNTIME=, +# when set, asserts which binary it chose. Before that, a copy of the directory with one hex digit of that binary's sum +# changed must make the install script fail and install nothing. Then the same checks as tool mode. CI runs it on five +# runners with no .NET installed (ci.yml, adoption-path-binary). +# +# In both modes the trust approval is written to a config directory inside the scratch directory, never to yours. The +# verifier is the one the CLI tests use: it passes once the file `fixed` exists in the project (sh on Unix, cmd on +# Windows). # # Exit code 0 when every check passed, 1 at the first check that did not, 2 when the proof could not start. set -euo pipefail -packages="${1:-}" -if [ -z "$packages" ] || [ ! -d "$packages" ]; then +usage() { echo "usage: eng/prove-adoption-path.sh (a directory holding AgentExperience.Cli..nupkg)" >&2 + echo " eng/prove-adoption-path.sh --binaries (a directory holding aexp- binaries and SHA256SUMS)" >&2 exit 2 -fi -packages="$(cd "$packages" && pwd)" +} + +mode=tool +packages="" +binaries="" +case "${1:-}" in + --binaries) + mode=binaries + binaries="${2:-}" + [ -n "$binaries" ] && [ -d "$binaries" ] && [ $# -eq 2 ] || usage + binaries="$(cd "$binaries" && pwd)" + ;; + "" | -*) + usage + ;; + *) + packages="$1" + [ -d "$packages" ] && [ $# -eq 1 ] || usage + packages="$(cd "$packages" && pwd)" + ;; +esac root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" version="$("$root/scripts/release-version.sh" dotnet)" -# Git Bash sets HOME on Windows, and `dotnet tool install --global` puts the shim under ~/.dotnet/tools everywhere -# (under DOTNET_CLI_HOME instead of HOME when that is set). -export PATH="${DOTNET_CLI_HOME:-$HOME}/.dotnet/tools:$PATH" - case "$(uname -s)" in MINGW*|MSYS*|CYGWIN*) windows=1 @@ -46,19 +71,31 @@ case "$(uname -s)" in ;; esac -nupkg="$packages/AgentExperience.Cli.$version.nupkg" -if [ ! -f "$nupkg" ]; then - echo "FAILED: no AgentExperience.Cli.$version.nupkg in $packages; it holds:" >&2 - ls -la "$packages" >&2 - exit 1 -fi +if [ "$mode" = tool ]; then + # Git Bash sets HOME on Windows, and `dotnet tool install --global` puts the shim under ~/.dotnet/tools everywhere + # (under DOTNET_CLI_HOME instead of HOME when that is set). + export PATH="${DOTNET_CLI_HOME:-$HOME}/.dotnet/tools:$PATH" -# Captured first: under pipefail, `grep -q` exiting early would turn awk's SIGPIPE into a failed pipeline. -global_tools="$(dotnet tool list --global)" -if printf '%s\n' "$global_tools" | awk 'NR > 2 { print tolower($1) }' | grep -qx 'agentexperience.cli'; then - echo "AgentExperience.Cli is already installed as a global tool; this proof installs and uninstalls it, so it will not run over yours." >&2 - echo "Uninstall it first (dotnet tool uninstall --global AgentExperience.Cli), or run the proof on another machine." >&2 - exit 2 + nupkg="$packages/AgentExperience.Cli.$version.nupkg" + if [ ! -f "$nupkg" ]; then + echo "FAILED: no AgentExperience.Cli.$version.nupkg in $packages; it holds:" >&2 + ls -la "$packages" >&2 + exit 1 + fi + + # Captured first: under pipefail, `grep -q` exiting early would turn awk's SIGPIPE into a failed pipeline. + global_tools="$(dotnet tool list --global)" + if printf '%s\n' "$global_tools" | awk 'NR > 2 { print tolower($1) }' | grep -qx 'agentexperience.cli'; then + echo "AgentExperience.Cli is already installed as a global tool; this proof installs and uninstalls it, so it will not run over yours." >&2 + echo "Uninstall it first (dotnet tool uninstall --global AgentExperience.Cli), or run the proof on another machine." >&2 + exit 2 + fi +else + if [ ! -f "$binaries/SHA256SUMS" ]; then + echo "FAILED: no SHA256SUMS in $binaries; it holds:" >&2 + ls -la "$binaries" >&2 + exit 1 + fi fi pass() { echo "ok: $*"; } @@ -111,7 +148,11 @@ cleanup() { fi rm -rf "$scratch" || echo "WARNING: could not remove $scratch" >&2 if [ "$status" -eq 0 ]; then - echo "Adoption path: PASSED (AgentExperience.Cli $version from $packages)" + if [ "$mode" = tool ]; then + echo "Adoption path: PASSED (tool mode: AgentExperience.Cli $version from $packages)" + else + echo "Adoption path: PASSED (binary mode: aexp $version from $binaries, no dotnet)" + fi else echo "Adoption path: FAILED (exit $status)" >&2 fi @@ -141,10 +182,69 @@ aexp_ok() { printf '%s' "$out" } -echo "Installing AgentExperience.Cli $version from $packages (and nowhere else)" -dotnet tool install --global AgentExperience.Cli --version "$version" --source "$packages" -installed=1 -command -v aexp >/dev/null || { echo "PATH=$PATH" >&2; ls -la "$HOME/.dotnet/tools" >&2 || true; fail "aexp is not on PATH after the install"; } +if [ "$mode" = tool ]; then + echo "Installing AgentExperience.Cli $version from $packages (and nowhere else)" + dotnet tool install --global AgentExperience.Cli --version "$version" --source "$packages" + installed=1 + command -v aexp >/dev/null || { echo "PATH=$PATH" >&2; ls -la "$HOME/.dotnet/tools" >&2 || true; fail "aexp is not on PATH after the install"; } +else + # The binary this machine gets: the install script decides from uname, as it would for a stranger; this is the same + # mapping, so the proof knows which line of SHA256SUMS to corrupt and which name to expect in the install line. + case "$(uname -s)-$(uname -m)" in + Linux-x86_64 | Linux-amd64) rid=linux-x64 ;; + Linux-aarch64 | Linux-arm64) rid=linux-arm64 ;; + Darwin-arm64) rid=osx-arm64 ;; + Darwin-x86_64) rid=osx-x64 ;; + MINGW*-x86_64 | MSYS*-x86_64 | CYGWIN*-x86_64) rid=win-x64 ;; + *) fail "no aexp binary is built for $(uname -s) $(uname -m)" ;; + esac + if [ "$windows" -eq 1 ]; then asset="aexp-$rid.exe"; else asset="aexp-$rid"; fi + expect_file "the binaries directory holds $asset" "$binaries/$asset" + installer="$root/scripts/install-aexp.sh" + + # curl takes file:// on every OS; on Windows the path has to be a drive path (file:///C:/...), which cygpath -m gives. + file_url() { + if [ "$windows" -eq 1 ]; then echo "file:///$(cygpath -m "$1")"; else echo "file://$1"; fi + } + + # First, the tampered copy: the same files, with one hex digit of this binary's sum changed. The install script must + # fail and install nothing (the directory it was given stays absent or empty). + mkdir -p "$scratch/tampered" + cp "$binaries"/aexp-* "$binaries/SHA256SUMS" "$scratch/tampered/" + sed -i.bak "/ $asset\$/ { +s/^0/1/ +t +s/^[0-9a-f]/0/ +}" "$scratch/tampered/SHA256SUMS" + rm -f "$scratch/tampered/SHA256SUMS.bak" + if cmp -s "$binaries/SHA256SUMS" "$scratch/tampered/SHA256SUMS"; then fail "the tampered SHA256SUMS is unchanged"; fi + tampered_status=0 + tampered_out="$(AEXP_DOWNLOAD_BASE="$(file_url "$scratch/tampered")" AEXP_INSTALL_DIR="$scratch/tampered-bin" sh "$installer" 2>&1)" || tampered_status=$? + if [ "$tampered_status" -eq 0 ]; then printf '%s\n' "$tampered_out" >&2; fail "the install script accepted a binary whose sum does not match SHA256SUMS"; fi + pass "the install script refuses a binary whose sum does not match SHA256SUMS (exit $tampered_status)" + expect_contains "the refusal names the sum mismatch" "does not match SHA256SUMS" "$tampered_out" + if [ -e "$scratch/tampered-bin" ] && [ -n "$(ls -A "$scratch/tampered-bin")" ]; then + ls -la "$scratch/tampered-bin" >&2 + fail "the install script installed something from the tampered copy" + fi + pass "nothing was installed from the tampered copy" + + # Then the real install, from the directory itself, into the scratch directory's bin, which leads PATH from here on. + echo "Installing aexp $version from $binaries through scripts/install-aexp.sh (and nowhere else)" + export PATH="$scratch/bin:$PATH" + install_out="$(AEXP_DOWNLOAD_BASE="$(file_url "$binaries")" AEXP_INSTALL_DIR="$scratch/bin" sh "$installer" 2>&1 | tr -d '\r')" \ + || { printf '%s\n' "$install_out" >&2; fail "scripts/install-aexp.sh failed"; } + printf '%s\n' "$install_out" + expect_contains "the install line names the version" "Installed aexp $version" "$install_out" + if [ -n "${AEXP_EXPECT_RUNTIME:-}" ]; then + expect_contains "the install line names the expected runtime" "($AEXP_EXPECT_RUNTIME)" "$install_out" + fi + resolved="$(command -v aexp || true)" + case "$resolved" in + "$scratch/bin/"*) pass "aexp resolves to the installed binary ($resolved)" ;; + *) fail "aexp resolves to '$resolved', not under $scratch/bin" ;; + esac +fi printed="$(aexp_ok --version)" expect_equal "aexp --version prints $version" "$version" "$printed" diff --git a/eng/publish-binaries.sh b/eng/publish-binaries.sh new file mode 100755 index 00000000..75249c4e --- /dev/null +++ b/eng/publish-binaries.sh @@ -0,0 +1,66 @@ +#!/usr/bin/env bash +# The self-contained aexp binaries (story 29.3): one file per runtime, built from the Cli project with the properties +# its csproj sets under AexpBinaries, so a person or a coding agent can get aexp with no .NET SDK or runtime on the +# machine. release.yml builds them from the tagged commit and attaches them to the GitHub release; ci.yml builds the +# same files on every pull request and proves each one on its own hardware (adoption-path-binary). Both run this +# script, as both run scripts/release-version.sh. +# +# eng/publish-binaries.sh # emptied first; then aexp-[.exe] for each runtime, and SHA256SUMS +# +# The runtimes are listed once, below, and a release test holds the list equal to the csproj's RuntimeIdentifiers. +# The restore is locked, against the binaries' own lock file (packages.binaries.lock.json; packages.lock.json is the +# tool package's and stays untouched); the publish runs with --no-restore because PublishSingleFile is set only with a +# runtime, and a locked restore with a runtime would refuse the lock file written without one. No trimming, no AOT. +# Each binary is about 40 MB, and a local run takes about a minute. The tool package is unaffected: a plain build, +# restore or pack never sees AexpBinaries. +# +# Exit code 0 when every file was built; a failed restore or publish exits non-zero. +set -euo pipefail + +out="${1:-}" +if [ -z "$out" ]; then + echo "usage: eng/publish-binaries.sh " >&2 + exit 2 +fi +root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +version="$("$root/scripts/release-version.sh" dotnet)" +project="$root/src/AgentExperience.Cli" + +# The runtimes, exactly the csproj's RuntimeIdentifiers (a release test checks). +runtimes="linux-x64 linux-arm64 osx-arm64 osx-x64 win-x64" + +rm -rf "$out" +mkdir -p "$out" +out="$(cd "$out" && pwd)" +tmp="$(mktemp -d)" +trap 'rm -rf "$tmp"' EXIT + +echo "Building aexp $version for: $runtimes" +dotnet restore "$project" --locked-mode -p:AexpBinaries=true + +for rid in $runtimes; do + echo "Publishing aexp-$rid" + dotnet publish "$project" --no-restore --configuration Release \ + -p:AexpBinaries=true -p:AexpBinaryRuntime="$rid" -p:AgentExperienceReleaseBuild=true \ + --output "$tmp/$rid" + # The publish directory also holds .pdb and .xml files; only the executable ships, renamed after its runtime. + case "$rid" in + win-*) built="$tmp/$rid/AgentExperience.Cli.exe"; name="aexp-$rid.exe" ;; + *) built="$tmp/$rid/AgentExperience.Cli"; name="aexp-$rid" ;; + esac + test -f "$built" || { echo "FAILED: dotnet publish for $rid did not produce $built" >&2; exit 1; } + cp "$built" "$out/$name" + chmod +x "$out/$name" +done + +# The sums, in sha256sum's format with bare file names, so `sha256sum -c` (or `shasum -a 256 -c`) checks them from +# inside the directory. macOS has no sha256sum; shasum writes the same format. +if command -v sha256sum >/dev/null 2>&1; then + (cd "$out" && sha256sum -- aexp-* > SHA256SUMS) +else + (cd "$out" && shasum -a 256 -- aexp-* > SHA256SUMS) +fi + +echo "Built aexp $version:" +ls -l "$out" +cat "$out/SHA256SUMS" diff --git a/scripts/install-aexp.sh b/scripts/install-aexp.sh new file mode 100755 index 00000000..58104f2e --- /dev/null +++ b/scripts/install-aexp.sh @@ -0,0 +1,132 @@ +#!/bin/sh +# Installs aexp, the AgentExperience.NET command, as a self-contained binary: no .NET SDK or runtime needed. +# +# curl -fsSL https://raw.githubusercontent.com/fabbrik/AgentExperience.NET/main/scripts/install-aexp.sh | sh +# +# It detects the platform (Linux x86_64 or aarch64, macOS arm64 or x86_64, Windows x86_64 under Git Bash, MSYS or +# Cygwin), picks the newest GitHub release (previews included), downloads the binary for the platform and the +# release's SHA256SUMS, verifies the binary's SHA-256 sum against that file, and only then puts it on PATH as +# $HOME/.local/bin/aexp (aexp.exe on Windows). Nothing is installed on a mismatch. +# +# Environment: +# AEXP_VERSION a release's version (the tag without its v, e.g. 0.1.0-preview.20) instead of the newest +# AEXP_DOWNLOAD_BASE a URL, or a file:// directory, holding aexp- and SHA256SUMS; replaces the release URL +# and needs no version lookup (eng/prove-adoption-path.sh uses it to prove a local build) +# AEXP_INSTALL_DIR where to put aexp (default: $HOME/.local/bin) +# +# POSIX sh only (dash runs `sh` on Debian): no bash features. Every fetch goes through curl, so file:// works on all +# three platforms. Any platform or release this script cannot serve is named, with the .NET tool as the alternative: +# dotnet tool install --global AgentExperience.Cli --prerelease +set -eu + +repo="fabbrik/AgentExperience.NET" +alternative="Alternatively, with the .NET 10 SDK: dotnet tool install --global AgentExperience.Cli --prerelease" + +fail() { + echo "install-aexp: $*" >&2 + echo "$alternative" >&2 + exit 1 +} + +command -v curl >/dev/null 2>&1 || fail "curl is required to download aexp." + +# The runtime, as the release names its assets. +os="$(uname -s)" +arch="$(uname -m)" +case "$os" in + Linux) + if ldd --version 2>&1 | grep -qi musl; then + fail "the binaries are built for glibc; this Linux ($arch) uses musl, which they do not support." + fi + case "$arch" in + x86_64 | amd64) rid="linux-x64" ;; + aarch64 | arm64) rid="linux-arm64" ;; + *) fail "no aexp binary is built for Linux on $arch." ;; + esac + ;; + Darwin) + case "$arch" in + arm64) rid="osx-arm64" ;; + x86_64) rid="osx-x64" ;; + *) fail "no aexp binary is built for macOS on $arch." ;; + esac + ;; + MINGW* | MSYS* | CYGWIN*) + case "$arch" in + x86_64) rid="win-x64" ;; + *) fail "no aexp binary is built for Windows on $arch." ;; + esac + ;; + *) + fail "no aexp binary is built for $os ($arch)." + ;; +esac +case "$rid" in + win-*) asset="aexp-$rid.exe"; target="aexp.exe" ;; + *) asset="aexp-$rid"; target="aexp" ;; +esac + +# Where the files come from: a given base, or the release the version names (the newest one by default). +if [ -n "${AEXP_DOWNLOAD_BASE:-}" ]; then + base="${AEXP_DOWNLOAD_BASE%/}" + version="${AEXP_VERSION:-}" + version="${version#v}" + release="the download base $base" +else + if [ -n "${AEXP_VERSION:-}" ]; then + # The tag's version, with or without the tag's leading v. + version="${AEXP_VERSION#v}" + else + # The newest release, prereleases included (the previews are), from the GitHub API; no jq. Unauthenticated, the + # API allows 60 requests an hour per address, so the failure names the way around the lookup. + releases="$(curl -fsSL "https://api.github.com/repos/$repo/releases?per_page=1")" \ + || fail "could not list the releases of $repo (the GitHub API may be rate-limited: 60 requests an hour unauthenticated). Set AEXP_VERSION to a release's version (e.g. AEXP_VERSION=0.1.0-preview.20) to skip the lookup." + version="$(printf '%s\n' "$releases" | sed -n 's/.*"tag_name": *"v\([^"]*\)".*/\1/p' | head -n 1)" + [ -n "$version" ] || fail "$repo has no release yet." + fi + release="release v$version" + base="https://github.com/$repo/releases/download/v$version" + echo "Installing aexp $version ($rid) from $release" +fi + +tmp="$(mktemp -d)" +trap 'rm -rf "$tmp"' EXIT + +# The binary and the sums, from the same place. +for file in "$asset" SHA256SUMS; do + if ! curl -fsSL -o "$tmp/$file" "$base/$file"; then + fail "$release has no $file (at $base/$file); it may predate the binaries, or not be built for $rid. Download the .exe or binary from https://github.com/$repo/releases instead, or set AEXP_VERSION to a release that has it." + fi +done + +# The sum, from the line for this asset alone, checked by the system's tool from inside the directory. A miss, or no +# line for the asset, installs nothing. +grep " $asset\$" "$tmp/SHA256SUMS" > "$tmp/one.sum" || fail "SHA256SUMS of $release has no line for $asset." +if command -v sha256sum >/dev/null 2>&1; then + (cd "$tmp" && sha256sum -c one.sum >/dev/null) || fail "the SHA-256 sum of $asset does not match SHA256SUMS; nothing was installed." +elif command -v shasum >/dev/null 2>&1; then + (cd "$tmp" && shasum -a 256 -c one.sum >/dev/null) || fail "the SHA-256 sum of $asset does not match SHA256SUMS; nothing was installed." +else + fail "neither sha256sum nor shasum is available to verify the download." +fi + +# The version the binary carries, for the install line, when no release named it. +if [ -z "$version" ]; then + chmod +x "$tmp/$asset" + version="$("$tmp/$asset" --version 2>/dev/null | tr -d '\r')" || version="unknown" +fi + +dir="${AEXP_INSTALL_DIR:-$HOME/.local/bin}" +mkdir -p "$dir" +chmod +x "$tmp/$asset" +mv -f "$tmp/$asset" "$dir/$target" || fail "could not replace $dir/$target (is aexp running? is the directory writable?)" + +echo "Installed aexp $version ($rid) to $dir/$target" +case ":$PATH:" in + *":$dir:"*) ;; + *) + echo "$dir is not on your PATH. Add it, for example:" + echo " export PATH=\"$dir:\$PATH\"" + ;; +esac +echo "Next: aexp init in your project root, then aexp trust after you reviewed .aexp/config.json." diff --git a/src/AgentExperience.Cli/AgentExperience.Cli.csproj b/src/AgentExperience.Cli/AgentExperience.Cli.csproj index 1b19a8f9..a9e90edf 100644 --- a/src/AgentExperience.Cli/AgentExperience.Cli.csproj +++ b/src/AgentExperience.Cli/AgentExperience.Cli.csproj @@ -11,6 +11,27 @@ AgentExperience.Cli + + + linux-x64;linux-arm64;osx-arm64;osx-x64;win-x64 + packages.binaries.lock.json + + + $(AexpBinaryRuntime) + true + true + true + true + true + +