diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0656d697..d1ccecab 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -83,7 +83,7 @@ jobs: pnpm --filter @codeagora/mcp pack --dry-run 2>&1 | tee .sisyphus/evidence/package-mcp-dry-run.log - name: Install desktop automation tools - if: contains(github.ref_name, '-rc.') + if: contains(github.ref_name, '-rc.') || !contains(github.ref_name, '-') run: | set -euo pipefail export PNPM_HOME="$HOME/.local/share/pnpm" @@ -95,19 +95,24 @@ jobs: cargo install tauri-webdriver-automation --version 0.1.3 fi - - name: Desktop RC evidence - if: contains(github.ref_name, '-rc.') + - name: Desktop release evidence + if: contains(github.ref_name, '-rc.') || !contains(github.ref_name, '-') run: pnpm rc:desktop-gate - - name: Validate Desktop RC version contract - if: contains(github.ref_name, '-rc.') + - name: Validate Desktop release version contract + if: contains(github.ref_name, '-rc.') || !contains(github.ref_name, '-') run: | node --input-type=module <<'NODE' import fs from 'node:fs'; - import { parseDesktopRcTag, desktopRcUpdaterManifestFilename } from './packages/desktop/scripts/desktop-artifacts.mjs'; + import { + desktopRcUpdaterManifestFilename, + parseDesktopRcTag, + parseDesktopStableTag, + } from './packages/desktop/scripts/desktop-artifacts.mjs'; const tag = process.env.GITHUB_REF_NAME; - const parsed = parseDesktopRcTag(tag); + const isRc = tag.includes('-rc.'); + const parsed = isRc ? parseDesktopRcTag(tag) : parseDesktopStableTag(tag); const packageFiles = [ 'package.json', 'packages/core/package.json', @@ -132,14 +137,17 @@ jobs: throw new Error(`Cargo.toml version does not match ${parsed.version}`); } const endpoint = tauriConfig.plugins?.updater?.endpoints?.[0] ?? ''; - const expectedManifest = desktopRcUpdaterManifestFilename(parsed.version); - if (!endpoint.endsWith(`/${expectedManifest}`)) { + const expectedManifest = isRc ? desktopRcUpdaterManifestFilename(parsed.version) : ''; + if (isRc && !endpoint.endsWith(`/${expectedManifest}`)) { throw new Error(`Updater endpoint must end with ${expectedManifest}, received ${endpoint}`); } fs.appendFileSync(process.env.GITHUB_ENV, [ - `CODEAGORA_DESKTOP_RC_RELEASE_LINE=${parsed.releaseLine}`, - `CODEAGORA_DESKTOP_RC_UPDATER_CHANNEL=desktop-${parsed.releaseLine}-rc`, - `CODEAGORA_DESKTOP_RC_UPDATER_MANIFEST=${expectedManifest}`, + `CODEAGORA_DESKTOP_RELEASE_KIND=${isRc ? 'rc' : 'stable'}`, + `CODEAGORA_DESKTOP_RELEASE_LINE=${parsed.releaseLine}`, + ...(isRc ? [ + `CODEAGORA_DESKTOP_UPDATER_CHANNEL=desktop-${parsed.releaseLine}-rc`, + `CODEAGORA_DESKTOP_UPDATER_MANIFEST=${expectedManifest}`, + ] : []), '', ].join('\n')); NODE @@ -152,9 +160,9 @@ jobs: APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }} run: | set -euo pipefail - KEYCHAIN_PATH="$RUNNER_TEMP/codeagora-desktop-rc.keychain-db" + KEYCHAIN_PATH="$RUNNER_TEMP/codeagora-desktop-${CODEAGORA_DESKTOP_RELEASE_KIND}.keychain-db" KEYCHAIN_PASSWORD="$(openssl rand -base64 32)" - CERTIFICATE_PATH="$RUNNER_TEMP/codeagora-desktop-rc.p12" + CERTIFICATE_PATH="$RUNNER_TEMP/codeagora-desktop-${CODEAGORA_DESKTOP_RELEASE_KIND}.p12" printf '%s' "$APPLE_CERTIFICATE" | base64 --decode > "$CERTIFICATE_PATH" security create-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH" security default-keychain -s "$KEYCHAIN_PATH" @@ -163,7 +171,7 @@ jobs: security import "$CERTIFICATE_PATH" -k "$KEYCHAIN_PATH" -P "$APPLE_CERTIFICATE_PASSWORD" -T /usr/bin/codesign security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH" security find-identity -v -p codesigning "$KEYCHAIN_PATH" | grep -F "$APPLE_SIGNING_IDENTITY" - echo "CODEAGORA_DESKTOP_RC_KEYCHAIN=$KEYCHAIN_PATH" >> "$GITHUB_ENV" + echo "CODEAGORA_DESKTOP_KEYCHAIN=$KEYCHAIN_PATH" >> "$GITHUB_ENV" - name: Prepare App Store Connect API key if: contains(github.ref_name, '-rc.') @@ -185,7 +193,7 @@ jobs: echo "APPLE_API_KEY_PATH=$API_KEY_FILE" >> "$GITHUB_ENV" fi - - name: Build signed notarized Desktop RC DMG + - name: Build signed notarized Desktop DMG if: contains(github.ref_name, '-rc.') env: APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }} @@ -199,6 +207,13 @@ jobs: rustup target add aarch64-apple-darwin pnpm --filter @codeagora/desktop exec tauri build --target aarch64-apple-darwin --bundles app,dmg + - name: Build unsigned Desktop preview DMG + if: ${{ !contains(github.ref_name, '-') }} + run: | + set -euo pipefail + rustup target add aarch64-apple-darwin + pnpm --filter @codeagora/desktop exec tauri build --target aarch64-apple-darwin --bundles app,dmg --config '{"bundle":{"createUpdaterArtifacts":false}}' + - name: Capture Desktop RC distribution evidence if: contains(github.ref_name, '-rc.') env: @@ -220,10 +235,28 @@ jobs: --updater "$UPDATER_PATH" \ --updater-sig "$SIG_PATH" + - name: Capture Desktop unsigned DMG evidence + if: ${{ !contains(github.ref_name, '-') }} + env: + GITHUB_RELEASE_URL: https://github.com/${{ github.repository }}/releases/tag/${{ github.ref_name }} + run: | + set -euo pipefail + APP_PATH="$(find packages/desktop/src-tauri/target/aarch64-apple-darwin/release/bundle -name 'CodeAgora.app' -type d -print -quit)" + DMG_PATH="$(find packages/desktop/src-tauri/target/aarch64-apple-darwin/release/bundle/dmg -name 'CodeAgora_*_aarch64.dmg' -type f -print -quit)" + node packages/desktop/scripts/capture-unsigned-dmg-evidence.mjs \ + --tag "${{ github.ref_name }}" \ + --release-url "$GITHUB_RELEASE_URL" \ + --app "$APP_PATH" \ + --dmg "$DMG_PATH" + - name: Desktop RC distribution gate if: contains(github.ref_name, '-rc.') run: pnpm rc:desktop-distribution-gate + - name: Desktop unsigned DMG gate + if: ${{ !contains(github.ref_name, '-') }} + run: pnpm desktop:unsigned-dmg-gate + - name: Generate evidence manifest run: | REQUIRED_TIER=$(node -e "const { readFileSync } = require('node:fs'); const version = JSON.parse(readFileSync('package.json', 'utf8')).version; process.stdout.write(version.includes('-rc.') ? 'rc' : version.includes('-') ? 'beta' : 'stable');") @@ -255,34 +288,64 @@ jobs: env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - - name: Create GitHub Release + - name: Create GitHub RC Release + if: contains(github.ref_name, '-rc.') uses: softprops/action-gh-release@v3 with: - prerelease: ${{ contains(github.ref_name, '-') }} + prerelease: true generate_release_notes: true - fail_on_unmatched_files: ${{ contains(github.ref_name, '-rc.') && 'true' || 'false' }} + fail_on_unmatched_files: true files: | packages/desktop/src-tauri/target/aarch64-apple-darwin/release/bundle/dmg/*.dmg packages/desktop/src-tauri/target/aarch64-apple-darwin/release/bundle/macos/*.tar.gz packages/desktop/src-tauri/target/aarch64-apple-darwin/release/bundle/macos/*.sig - .sisyphus/evidence/latest-*-rc.json + .sisyphus/evidence/latest-*.json .sisyphus/evidence/desktop-rc-distribution-evidence.json .sisyphus/evidence/desktop-rc-distribution-gate.log .sisyphus/evidence/evidence-manifest.json body: | Release evidence artifact: `release-evidence-${{ github.ref_name }}` - - name: Update Desktop RC updater channel - if: contains(github.ref_name, '-rc.') + - name: Create GitHub Beta Release + if: ${{ contains(github.ref_name, '-') && !contains(github.ref_name, '-rc.') }} uses: softprops/action-gh-release@v3 with: - tag_name: ${{ env.CODEAGORA_DESKTOP_RC_UPDATER_CHANNEL }} - name: Desktop ${{ env.CODEAGORA_DESKTOP_RC_RELEASE_LINE }} RC updater channel prerelease: true + generate_release_notes: true + fail_on_unmatched_files: false + files: | + .sisyphus/evidence/evidence-manifest.json + body: | + Release evidence artifact: `release-evidence-${{ github.ref_name }}` + + - name: Create GitHub Stable Release + if: ${{ !contains(github.ref_name, '-') }} + uses: softprops/action-gh-release@v3 + with: + prerelease: false + generate_release_notes: true + fail_on_unmatched_files: true + files: | + packages/desktop/src-tauri/target/aarch64-apple-darwin/release/bundle/dmg/*.dmg + .sisyphus/evidence/desktop-unsigned-dmg-evidence.json + .sisyphus/evidence/desktop-unsigned-dmg-gate.log + .sisyphus/evidence/evidence-manifest.json + body: | + Release evidence artifact: `release-evidence-${{ github.ref_name }}` + + Desktop macOS DMG is an unsigned preview build for v0.1.0. It is not Developer ID signed, not notarized, and does not enable the Tauri updater channel; macOS Gatekeeper warning is expected. + + - name: Update Desktop updater channel + if: contains(github.ref_name, '-rc.') + uses: softprops/action-gh-release@v3 + with: + tag_name: ${{ env.CODEAGORA_DESKTOP_UPDATER_CHANNEL }} + name: Desktop ${{ env.CODEAGORA_DESKTOP_RELEASE_LINE }} ${{ env.CODEAGORA_DESKTOP_RELEASE_KIND }} updater channel + prerelease: ${{ env.CODEAGORA_DESKTOP_RELEASE_KIND == 'rc' }} fail_on_unmatched_files: true - files: .sisyphus/evidence/${{ env.CODEAGORA_DESKTOP_RC_UPDATER_MANIFEST }} + files: .sisyphus/evidence/${{ env.CODEAGORA_DESKTOP_UPDATER_MANIFEST }} body: | - Line-scoped updater manifest for the ${{ env.CODEAGORA_DESKTOP_RC_RELEASE_LINE }}.x Desktop RC channel. + Line-scoped updater manifest for the ${{ env.CODEAGORA_DESKTOP_RELEASE_LINE }}.x Desktop ${{ env.CODEAGORA_DESKTOP_RELEASE_KIND }} channel. Distribution artifacts remain attached to `${{ github.ref_name }}`. - name: Verify Desktop RC GitHub release assets diff --git a/.gitignore b/.gitignore index 7b0de019..a324c899 100644 --- a/.gitignore +++ b/.gitignore @@ -94,3 +94,4 @@ benchmarks/.ca/model-quality.json # E2E test screenshots web-e2e-*.png +.vercel diff --git a/.mcp.json b/.mcp.json index 92931915..9a694e94 100644 --- a/.mcp.json +++ b/.mcp.json @@ -2,7 +2,7 @@ "mcpServers": { "codeagora": { "command": "npx", - "args": ["-y", "@codeagora/mcp@rc"] + "args": ["-y", "@codeagora/mcp"] } } } diff --git a/README.md b/README.md index bfa9621a..89e8a1dc 100644 --- a/README.md +++ b/README.md @@ -19,12 +19,12 @@ CodeAgora runs multiple LLM reviewers in parallel, lets them challenge each othe ### Published CLI ```bash -npm i -g @codeagora/review@rc +npm i -g @codeagora/review agora init git diff | agora review ``` -Current release: `0.1.0-rc.6`. +Current release: `0.1.0`. ### Source Checkout @@ -81,7 +81,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - - uses: bssm-oss/CodeAgora@v0.1.0-rc.6 + - uses: bssm-oss/CodeAgora@v0.1.0 with: github-token: ${{ secrets.GITHUB_TOKEN }} env: @@ -97,7 +97,7 @@ Use `.ca/config.json` as the default config path. See [GitHub Actions setup](doc "mcpServers": { "codeagora": { "command": "npx", - "args": ["-y", "@codeagora/mcp@rc"] + "args": ["-y", "@codeagora/mcp"] } } } diff --git a/docs/README.md b/docs/README.md index ff0052f9..07e31375 100644 --- a/docs/README.md +++ b/docs/README.md @@ -2,7 +2,7 @@ CodeAgora docs are organized by audience. -Current release: `0.1.0-rc.6`. +Current release: `0.1.0`. ## Start here @@ -37,6 +37,7 @@ Current release: `0.1.0-rc.6`. | [`for-agents/BENCHMARK_MEASUREMENT_PLAN.md`](./for-agents/BENCHMARK_MEASUREMENT_PLAN.md) | Benchmark measurement dimensions and model matrix. | | [`for-agents/BENCHMARK_RESULTS_2026_05_30.md`](./for-agents/BENCHMARK_RESULTS_2026_05_30.md) | Latest live golden-bug benchmark results and model/config comparison. | | [`for-agents/PRODUCTION_READINESS_ROADMAP.md`](./for-agents/PRODUCTION_READINESS_ROADMAP.md) | Release readiness gates and roadmap. | +| [`for-agents/STABLE_READINESS.md`](./for-agents/STABLE_READINESS.md) | Current `v0.1.0` stable readiness audit, blockers, and evidence gates. | | [`for-agents/RC6_USABILITY_ROADMAP.md`](./for-agents/RC6_USABILITY_ROADMAP.md) | rc.6 usability-hardening plan for CLI, GitHub Action, MCP, Desktop, docs, and evidence. | | [`for-agents/papers/`](./for-agents/papers/) | Topic papers for the system design. | diff --git a/docs/for-agents/DEVELOPMENT.md b/docs/for-agents/DEVELOPMENT.md index 5a55990e..7dce12fc 100644 --- a/docs/for-agents/DEVELOPMENT.md +++ b/docs/for-agents/DEVELOPMENT.md @@ -27,9 +27,9 @@ pnpm dev review path/to/diff.patch ## Release / docs pointers -- Current release line: `0.1.0-rc.6` -- Install examples should stay on `@codeagora/review@rc` and `@codeagora/mcp@rc` -- GitHub Actions examples should keep the action tag at `v0.1.0-rc.6` +- Current release line: `0.1.0` +- Install examples should stay on `@codeagora/review` and `@codeagora/mcp` +- GitHub Actions examples should keep the action tag at `v0.1.0` - User-facing setup details live in `docs/for-users/` - Architecture and contract references live in `ARCHITECTURE.md` and `AGENT_CONTRACT.md` - Move dated reports and superseded notes to `docs/archived/` diff --git a/docs/for-agents/STABLE_READINESS.md b/docs/for-agents/STABLE_READINESS.md new file mode 100644 index 00000000..a97de1e2 --- /dev/null +++ b/docs/for-agents/STABLE_READINESS.md @@ -0,0 +1,86 @@ + + +# CodeAgora v0.1.0 Stable Readiness + +Audit date: 2026-06-17 +Audit worktree: `/Users/justn/Workspaces/worktrees/CodeAgora-stable-readiness` +Audit branch: `work/stable-readiness` +Audit base SHA: `1ebd18f847c77d893b588436343e736f5274a2d9` +Target stable version: `0.1.0` +Target git tag: `v0.1.0` +Target npm dist-tag: `latest` +Target GitHub Release: non-prerelease + +## Final Verdict + +Status: `BLOCKER` + +CodeAgora code and release gates are ready for `v0.1.0` stable promotion under the unsigned Desktop preview DMG policy. Public promotion remains blocked until the release workflow publishes npm `latest` and creates the non-prerelease GitHub Release from the accepted stable SHA. `WAIVED`, known-issue acceptance, and hidden post-stable claims are not valid stable readiness states. + +Existing archived evidence can support this audit only when it names the SHA, date, exact command path, and artifact or log link. Otherwise it is historical context, not stable release evidence. + +## Current Public State + +| Check | Status | Evidence | +|---|---:|---| +| npm `@codeagora/review` `latest` dist-tag | `BLOCKER` | `npm view @codeagora/review dist-tags version --json` on 2026-06-17 returned `latest: 0.1.0-alpha.1`, `rc: 0.1.0-rc.5`, and package `version: 0.1.0-alpha.1`. | +| GitHub latest non-prerelease | `BLOCKER` | `gh release view --repo bssm-oss/CodeAgora --json tagName,isPrerelease,publishedAt,name` on 2026-06-17 returned `v0.1.0-alpha.1`, not `v0.1.0`. | +| Newest GitHub prerelease | `BLOCKER` | `gh release list --repo bssm-oss/CodeAgora --limit 10 --json tagName,isPrerelease,isLatest,publishedAt,name` on 2026-06-17 shows newest release entry `v0.1.0-rc.5`, prerelease. | +| Vercel production root | `PASS` | `pnpm evidence:vercel-production` on 2026-06-17 wrote `.sisyphus/evidence/vercel-production-evidence.json` after production deploy and verified `codeagora:commit`, `data-codeagora-site="astro"`, and the expected commit marker. | +| Vercel production crawler files | `PASS` | `pnpm evidence:vercel-production` verified `robots.txt` and `sitemap.xml` resolve with canonical production URLs. | +| Vercel production brand assets | `PASS` | `pnpm evidence:vercel-production` verified `/assets/codeagora-icon.png`, `/assets/codeagora-wordmark.png`, and `/assets/social-card.svg` resolve. | + +## Required Gates + +| Surface | Gate | Status | Required command or artifact | Stable evidence path | +|---|---|---:|---|---| +| All | Deterministic local gates | `PASS` | `pnpm typecheck`, `pnpm lint`, `pnpm build`, `pnpm test --no-file-parallelism`, `pnpm test:security`, `pnpm bench:ci`, `pnpm release:beta-smoke` | `.sisyphus/evidence/*.log` and `.sisyphus/evidence/gate-command-evidence.jsonl` | +| All | Stable manifest | `PASS` | `pnpm evidence:manifest -- --require=stable` | `.sisyphus/evidence/evidence-manifest.json` | +| CLI | Packed stable package install | `PASS` | Installed packed `@codeagora/review@0.1.0` in a temp project and ran `agora --version`, help, providers, init, and dry-run review. | `.sisyphus/evidence/cli-packed-install-smoke.json` | +| CLI | Real-user review smokes | `PASS` | Clean diff, staged diff, patch file, invalid config, missing key, provider failure, timeout runtime. | `.sisyphus/evidence/cli-live-*.json` and sidecar transcripts | +| MCP | Packed SDK tool call | `PASS` | Installed packed `@codeagora/mcp@0.1.0` and called `tools/list` plus `dry_run` through the MCP SDK client. | `.sisyphus/evidence/mcp-packed-sdk-tool-call-smoke.json` | +| MCP | Invalid input and inaccessible path | `PASS` | Ran invalid input and inaccessible repo path through the packed MCP SDK path. | `.sisyphus/evidence/mcp-packed-invalid-input-smoke.json` | +| GitHub Actions | Same-repo PR success | `PASS` | Real same-repository `pull_request` workflow success with review output from PR #585, run `27668645582`, job `81827873765`, verdict `ACCEPT`, review URL `https://github.com/bssm-oss/CodeAgora/pull/585#pullrequestreview-4512752016`. | `.sisyphus/evidence/github-action-same-repo-pr-success.json` | +| GitHub Actions | Failure and degraded paths | `PASS` | `pnpm evidence:github-action-stable` replayed fork PR, missing provider secrets, stale head, oversized diff, provider failure, and comment posting failure through focused Action runtime/reporting/smoke tests. | `.sisyphus/evidence/github-action-*-degraded.json` | +| Desktop | Unsigned preview DMG | `PASS` | macOS arm64 unsigned DMG build with explicit `signed: false`, `notarized: false`, `updaterEnabled: false`, and expected Gatekeeper warning policy | `.sisyphus/evidence/desktop-unsigned-dmg-evidence.json` and `.sisyphus/evidence/desktop-unsigned-dmg-gate.log` | +| Vercel production | Stable landing deployment | `PASS` | `pnpm evidence:vercel-production` after production deploy from stable SHA | `.sisyphus/evidence/vercel-production-evidence.json` | + +## Stable Manifest Contract + +`pnpm evidence:manifest -- --require=stable` must fail closed unless all required stable entries exist and report `evidenceMode: "real"`. + +The stable manifest now requires: + +- CLI packed install and live review evidence. +- MCP packed SDK tool-call evidence. +- GitHub Actions same-repo success plus fork, missing secrets, stale head, oversized diff, provider failure, and posting failure paths. +- Desktop unsigned preview DMG evidence and validator gate log. Developer ID signing, notarization, and Tauri updater signing are intentionally deferred for v0.1.0 and must not be claimed by the stable release. +- Vercel production evidence proving the production HTML contains the expected stable commit metadata and current Astro landing markers. + +Current stable manifest result after recording unsigned Desktop DMG evidence: + +```text +pnpm evidence:manifest -- --require=stable +Wrote .sisyphus/evidence/evidence-manifest.json +``` + +The release workflow keeps the signed/notarized/updater Desktop path RC-only. Stable tags build an unsigned macOS arm64 DMG with updater artifacts disabled, run `capture-unsigned-dmg-evidence.mjs`, and validate it with `pnpm desktop:unsigned-dmg-gate`. The GitHub Release body must state that the Desktop DMG is unsigned, not notarized, has no Tauri updater channel, and may trigger macOS Gatekeeper warnings. + +## Vercel Production Contract + +The site build stamps production-check metadata into the generated HTML: + +- `` +- `data-codeagora-site="astro"` +- `data-codeagora-commit="..."` + +`pnpm evidence:vercel-production` validates: + +- production root returns 200; +- production HTML contains Astro landing markers and the expected commit SHA; +- `/robots.txt` and `/sitemap.xml` resolve with canonical URLs; +- `/assets/codeagora-icon.png`, `/assets/codeagora-wordmark.png`, and `/assets/social-card.svg` resolve. + +## Stop Rule + +Any `BLOCKER` or `NEEDS-REPRO` stops stable promotion. Do not create `v0.1.0`, publish npm `latest`, or mark a GitHub Release as stable until every row in this document is `PASS` with linked logs or artifacts. diff --git a/docs/for-users/5_GITHUB_INTEGRATION.md b/docs/for-users/5_GITHUB_INTEGRATION.md index 6e3f7ae7..f51f4fc9 100644 --- a/docs/for-users/5_GITHUB_INTEGRATION.md +++ b/docs/for-users/5_GITHUB_INTEGRATION.md @@ -3,7 +3,7 @@ > Complete specification for PR review comments, GitHub Actions, SARIF output, and UX design. > Last updated: 2026-05-04 > -> Note: internal markers such as `codeagora-v3` are compatibility/spec examples, not current branding. For user setup, follow [GITHUB_ACTIONS_SETUP.md](./GITHUB_ACTIONS_SETUP.md) and the current `0.1.0-rc.6` release line. +> Note: internal markers such as `codeagora-v3` are compatibility/spec examples, not current branding. For user setup, follow [GITHUB_ACTIONS_SETUP.md](./GITHUB_ACTIONS_SETUP.md) and the current `0.1.0` release line. --- @@ -534,7 +534,7 @@ permissions: security-events: write steps: -- uses: bssm-oss/CodeAgora@v0.1.0-rc.6 +- uses: bssm-oss/CodeAgora@v0.1.0 with: github-token: ${{ secrets.GITHUB_TOKEN }} upload-sarif: 'true' diff --git a/docs/for-users/DEMO_RUNBOOK.md b/docs/for-users/DEMO_RUNBOOK.md index da530b65..da8e329d 100644 --- a/docs/for-users/DEMO_RUNBOOK.md +++ b/docs/for-users/DEMO_RUNBOOK.md @@ -161,7 +161,7 @@ Client config: "mcpServers": { "codeagora": { "command": "npx", - "args": ["-y", "@codeagora/mcp@rc"] + "args": ["-y", "@codeagora/mcp"] } } } @@ -239,7 +239,7 @@ jobs: fetch-depth: 0 - name: CodeAgora Review - uses: bssm-oss/CodeAgora@v0.1.0-rc.6 + uses: bssm-oss/CodeAgora@v0.1.0 with: github-token: ${{ secrets.GITHUB_TOKEN }} fail-on-reject: 'true' diff --git a/docs/for-users/DESKTOP.md b/docs/for-users/DESKTOP.md index 12010e84..6dbc6696 100644 --- a/docs/for-users/DESKTOP.md +++ b/docs/for-users/DESKTOP.md @@ -10,9 +10,9 @@ contracts used by the automation surfaces. |------|--------------------------| | Channel | Official desktop app | | Public desktop launch | Included in release readiness | -| Signing | RC distribution requires Developer ID evidence | -| Notarization | RC distribution requires accepted notarization and stapled tickets | -| Updater | RC-only static GitHub Release JSON, scoped to `desktop-X.Y-rc/latest-X.Y-rc.json` for the installed version line | +| Signing | v0.1.0 stable ships as an unsigned preview DMG | +| Notarization | v0.1.0 stable is not notarized; macOS Gatekeeper warning is expected | +| Updater | Disabled for the v0.1.0 unsigned preview DMG; RC updater JSON remains scoped to `desktop-X.Y-rc/latest-X.Y-rc.json` | | Canonical review engine | Existing CLI/core path | | Canonical sessions | Existing `.ca/sessions` artifacts | | Canonical config | Existing `.ca/config.*` schema and files | @@ -25,7 +25,7 @@ Run the desktop gate before cutting an RC: pnpm rc:desktop-gate ``` -Official macOS arm64 Desktop RC distribution also requires: +Official macOS arm64 Desktop distribution also requires: ```bash pnpm rc:desktop-distribution-gate @@ -40,6 +40,30 @@ prerelease assets. Stable Desktop distribution, stable updater channels, and npm `latest` promotion are out of scope for this RC gate. +## v0.1.0 Stable Desktop DMG + +The v0.1.0 stable release may attach a macOS arm64 Desktop DMG as an unsigned +preview artifact. That DMG is not Developer ID signed, not notarized, and does +not enable a Tauri updater channel. macOS Gatekeeper warnings are expected. + +Stable Desktop release evidence must be explicit about that policy: + +```bash +node packages/desktop/scripts/capture-unsigned-dmg-evidence.mjs +pnpm desktop:unsigned-dmg-gate +``` + +The required evidence files are: + +```txt +.sisyphus/evidence/desktop-unsigned-dmg-evidence.json +.sisyphus/evidence/desktop-unsigned-dmg-gate.log +``` + +Do not describe the v0.1.0 Desktop DMG as signed, notarized, stapled, or +auto-updatable unless a later release reintroduces those gates with fresh +evidence. + This runs: - `pnpm --filter @codeagora/desktop typecheck` @@ -68,7 +92,7 @@ The desktop smoke checks: - built `dist/index.html` and `dist/main.js` - package/Tauri version alignment -- RC updater configuration and updater artifact generation +- updater configuration and updater artifact generation - Tauri product metadata - command bridge coverage for repository, sessions, review progress, config, providers, MCP, GitHub Action setup, release evidence, export, and command diff --git a/docs/for-users/EXTENSIONS.md b/docs/for-users/EXTENSIONS.md index f3815737..d04738d5 100644 --- a/docs/for-users/EXTENSIONS.md +++ b/docs/for-users/EXTENSIONS.md @@ -3,7 +3,7 @@ Optional packages installed separately from the core `codeagora` CLI. ```bash -npm i -g @codeagora/mcp@rc # MCP server (Claude Code, Cursor, etc.) +npm i -g @codeagora/mcp # MCP server (Claude Code, Cursor, etc.) ``` ## Desktop App @@ -23,7 +23,7 @@ Exposes the full CodeAgora pipeline as an MCP server compatible with Claude Code "mcpServers": { "codeagora": { "command": "npx", - "args": ["-y", "@codeagora/mcp@rc"] + "args": ["-y", "@codeagora/mcp"] } } } diff --git a/docs/for-users/GITHUB_ACTIONS_SETUP.md b/docs/for-users/GITHUB_ACTIONS_SETUP.md index 9e9f6c42..5cdec44f 100644 --- a/docs/for-users/GITHUB_ACTIONS_SETUP.md +++ b/docs/for-users/GITHUB_ACTIONS_SETUP.md @@ -92,7 +92,7 @@ jobs: fetch-depth: 0 - name: CodeAgora Review - uses: bssm-oss/CodeAgora@v0.1.0-rc.6 + uses: bssm-oss/CodeAgora@v0.1.0 with: github-token: ${{ secrets.GITHUB_TOKEN }} fail-on-reject: 'true' @@ -170,7 +170,7 @@ Example with the recommended OpenRouter quality lineup: ```yaml - name: CodeAgora Review - uses: bssm-oss/CodeAgora@v0.1.0-rc.6 + uses: bssm-oss/CodeAgora@v0.1.0 with: github-token: ${{ secrets.GITHUB_TOKEN }} fail-on-reject: 'true' diff --git a/docs/for-users/TROUBLESHOOTING.md b/docs/for-users/TROUBLESHOOTING.md index 5a67ab28..872f87d0 100644 --- a/docs/for-users/TROUBLESHOOTING.md +++ b/docs/for-users/TROUBLESHOOTING.md @@ -73,13 +73,13 @@ The PR diff exceeds the configured limit (default: 5000 lines). Options: "mcpServers": { "codeagora": { "command": "npx", - "args": ["-y", "@codeagora/mcp@rc"] + "args": ["-y", "@codeagora/mcp"] } } } ``` 2. Restart Claude Code -3. Check that `npx -y @codeagora/mcp@rc` starts without errors +3. Check that `npx -y @codeagora/mcp` starts without errors ### "repo_path is outside the allowed repository boundary" - `repo_path` is optional, but when provided it must point to the exact workspace root or a real directory inside the current repository checkout. diff --git a/package.json b/package.json index 8f70cf8e..1772ee3c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@codeagora/review", - "version": "0.1.0-rc.6", + "version": "0.1.0", "type": "module", "description": "Multi-LLM code review pipeline — parallel reviewers, structured debate, consensus verdict", "license": "MIT", @@ -56,6 +56,7 @@ "desktop:visual-qa": "pnpm --filter @codeagora/desktop visual:qa", "rc:desktop-gate": "node scripts/desktop-release-gate-runner.mjs", "rc:desktop-distribution-gate": "node scripts/desktop-rc-distribution-gate.mjs", + "desktop:unsigned-dmg-gate": "node scripts/desktop-unsigned-dmg-gate.mjs", "evidence:manifest": "node scripts/evidence-manifest.mjs", "evidence:gate-status": "node scripts/release-gate-evaluator.mjs", "evidence:security-smoke": "node scripts/security-evidence-smoke.mjs", @@ -63,6 +64,8 @@ "evidence:github-security": "node scripts/github-security-evidence.mjs", "evidence:desktop-security": "node scripts/desktop-security-evidence.mjs", "evidence:github-action-pr-smoke": "node scripts/github-action-pr-smoke-recorder.mjs", + "evidence:github-action-stable": "node scripts/github-action-stable-evidence.mjs", + "evidence:vercel-production": "node scripts/vercel-production-evidence.mjs", "smoke:cli-clean-diff": "node scripts/cli-clean-diff-smoke.mjs", "smoke:cli-staged-diff": "node scripts/cli-clean-diff-smoke.mjs --fixture staged-diff", "smoke:cli-patch-file": "node scripts/cli-clean-diff-smoke.mjs --fixture patch-file", diff --git a/packages/cli/package.json b/packages/cli/package.json index df1a1769..d27a9c1b 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@codeagora/cli", - "version": "0.1.0-rc.6", + "version": "0.1.0", "type": "module", "main": "./dist/index.js", "types": "./dist/index.d.ts", diff --git a/packages/cli/src/tests/agent-contract.test.ts b/packages/cli/src/tests/agent-contract.test.ts index 0fc70fd9..9470e9c5 100644 --- a/packages/cli/src/tests/agent-contract.test.ts +++ b/packages/cli/src/tests/agent-contract.test.ts @@ -236,6 +236,11 @@ describe('CLI exit code classification', () => { expect(classifyCliErrorExitCode(new Error('Invalid output format'))).toBe(2); expect(classifyCliErrorExitCode(new Error('OPENAI_API_KEY not set'))).toBe(2); expect(classifyCliErrorExitCode(new Error('Missing key for provider credential'))).toBe(2); + expect(classifyCliErrorExitCode(new Error([ + 'All reviewers failed (forfeited or errored) due to provider/API failures.', + "- r1 (openrouter/xiaomi/mimo-v2.5): auth: Auth error (permanent): API key not found for provider 'openrouter'. Set OPENROUTER_API_KEY environment variable.", + 'Recovery hint: check provider API keys, quota/rate limits, network connectivity, and circuit breaker status with `agora doctor --live`.', + ].join('\n')))).toBe(2); }); it('classifies runtime errors as exit code 3', () => { diff --git a/packages/cli/src/utils/errors.ts b/packages/cli/src/utils/errors.ts index 71fa462f..e133925a 100644 --- a/packages/cli/src/utils/errors.ts +++ b/packages/cli/src/utils/errors.ts @@ -53,6 +53,15 @@ export function formatError(error: Error, verbose: boolean): string { */ export function classifyCliErrorExitCode(error: Error): CliExitCode { const msg = error.message.toLowerCase(); + if ( + msg.includes('api key not found') || + msg.includes('no-api-key') || + msg.includes('missing key') || + msg.includes('not set') || + /set [a-z0-9_]+_api_key environment variable/.test(msg) + ) { + return 2; + } if ( msg.includes('provider/api failures') || msg.includes('all reviewers failed') || @@ -74,9 +83,6 @@ export function classifyCliErrorExitCode(error: Error): CliExitCode { msg.includes('json') || msg.includes('yaml') || msg.includes('api key') || - msg.includes('no-api-key') || - msg.includes('missing key') || - msg.includes('not set') || msg.includes('credential') || msg.includes('environment variable') ) { diff --git a/packages/core/package.json b/packages/core/package.json index 969423ff..dd85504e 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@codeagora/core", - "version": "0.1.0-rc.6", + "version": "0.1.0", "type": "module", "main": "./dist/index.js", "exports": { diff --git a/packages/desktop/package.json b/packages/desktop/package.json index 637c57dc..bbbe9f20 100644 --- a/packages/desktop/package.json +++ b/packages/desktop/package.json @@ -1,6 +1,6 @@ { "name": "@codeagora/desktop", - "version": "0.1.0-rc.6", + "version": "0.1.0", "private": true, "type": "module", "description": "CodeAgora desktop app - official human-facing local UI for sessions, config, and review runs", diff --git a/packages/desktop/scripts/capture-stable-distribution-evidence.mjs b/packages/desktop/scripts/capture-stable-distribution-evidence.mjs new file mode 100644 index 00000000..f4d7f372 --- /dev/null +++ b/packages/desktop/scripts/capture-stable-distribution-evidence.mjs @@ -0,0 +1,275 @@ +#!/usr/bin/env node +import crypto from 'node:crypto'; +import fs from 'node:fs'; +import path from 'node:path'; +import { execFileSync, spawnSync } from 'node:child_process'; +import { + DESKTOP_STABLE_DISTRIBUTION_EVIDENCE_FILENAME, + DESKTOP_STABLE_DISTRIBUTION_EVIDENCE_SCHEMA_VERSION, + DESKTOP_STABLE_UPDATER_PLATFORM, + MACOS_ARM64_ARCH, + MACOS_DESKTOP_PLATFORM, + desktopStableUpdaterManifestFilename, + parseDesktopStableTag, + parseDesktopStableVersion, + validateDesktopStableDistributionEvidence, +} from './desktop-artifacts.mjs'; + +const packageRoot = path.resolve(import.meta.dirname, '..'); +const repoRoot = path.resolve(packageRoot, '..', '..'); +const evidenceRoot = path.join(repoRoot, '.sisyphus', 'evidence'); + +function parseArgs(argv) { + const options = { + tag: process.env.GITHUB_REF_NAME, + releaseUrl: process.env.GITHUB_RELEASE_URL, + appPath: process.env.CODEAGORA_DESKTOP_APP_PATH, + dmgPath: process.env.CODEAGORA_DESKTOP_DMG_PATH, + updaterPath: process.env.CODEAGORA_DESKTOP_UPDATER_PATH, + updaterSignaturePath: process.env.CODEAGORA_DESKTOP_UPDATER_SIGNATURE_PATH, + updaterManifestUrl: process.env.CODEAGORA_DESKTOP_UPDATER_MANIFEST_URL, + output: path.join(evidenceRoot, DESKTOP_STABLE_DISTRIBUTION_EVIDENCE_FILENAME), + }; + + for (let index = 0; index < argv.length; index++) { + const arg = argv[index]; + if (arg === '--tag') options.tag = argv[++index]; + else if (arg?.startsWith('--tag=')) options.tag = arg.slice('--tag='.length); + else if (arg === '--release-url') options.releaseUrl = argv[++index]; + else if (arg?.startsWith('--release-url=')) options.releaseUrl = arg.slice('--release-url='.length); + else if (arg === '--app') options.appPath = argv[++index]; + else if (arg?.startsWith('--app=')) options.appPath = arg.slice('--app='.length); + else if (arg === '--dmg') options.dmgPath = argv[++index]; + else if (arg?.startsWith('--dmg=')) options.dmgPath = arg.slice('--dmg='.length); + else if (arg === '--updater') options.updaterPath = argv[++index]; + else if (arg?.startsWith('--updater=')) options.updaterPath = arg.slice('--updater='.length); + else if (arg === '--updater-sig') options.updaterSignaturePath = argv[++index]; + else if (arg?.startsWith('--updater-sig=')) options.updaterSignaturePath = arg.slice('--updater-sig='.length); + else if (arg === '--updater-manifest-url') options.updaterManifestUrl = argv[++index]; + else if (arg?.startsWith('--updater-manifest-url=')) options.updaterManifestUrl = arg.slice('--updater-manifest-url='.length); + else if (arg === '--output') options.output = argv[++index]; + else if (arg?.startsWith('--output=')) options.output = arg.slice('--output='.length); + else if (arg !== '--') throw new Error(`Unknown argument: ${arg}`); + } + return options; +} + +function readJson(filePath) { + return JSON.parse(fs.readFileSync(filePath, 'utf8')); +} + +function sha256(filePath) { + const absolute = path.resolve(filePath); + const stat = fs.statSync(absolute); + if (!stat.isDirectory()) { + return crypto.createHash('sha256').update(fs.readFileSync(absolute)).digest('hex'); + } + + const hash = crypto.createHash('sha256'); + const visit = (dir) => { + for (const entry of fs.readdirSync(dir).sort()) { + const current = path.join(dir, entry); + const relativePath = path.relative(absolute, current); + const currentStat = fs.statSync(current); + hash.update(relativePath); + hash.update(currentStat.mode.toString(8)); + if (currentStat.isDirectory()) { + visit(current); + } else if (currentStat.isFile()) { + hash.update(fs.readFileSync(current)); + } + } + }; + visit(absolute); + return hash.digest('hex'); +} + +function relative(filePath) { + return path.relative(repoRoot, path.resolve(filePath)); +} + +function requiredFile(filePath, label) { + if (!filePath) throw new Error(`${label} path is required`); + const absolute = path.resolve(filePath); + if (!fs.existsSync(absolute)) throw new Error(`${label} is missing: ${absolute}`); + return absolute; +} + +function runOutput(file, args, options = {}) { + return execFileSync(file, args, { + cwd: repoRoot, + encoding: 'utf8', + stdio: ['ignore', 'pipe', 'pipe'], + ...options, + }); +} + +function parseCodesignDetails(appPath) { + const result = spawnSync('codesign', ['-dv', '--verbose=4', appPath], { + cwd: repoRoot, + encoding: 'utf8', + }); + const details = `${result.stdout ?? ''}${result.stderr ?? ''}`; + if (result.status !== 0) { + throw new Error(`codesign metadata capture failed for ${appPath}: ${details}`); + } + const authority = [...details.matchAll(/^Authority=(.+)$/gm)].map((match) => match[1].trim()); + const teamIdentifier = /^TeamIdentifier=(.+)$/m.exec(details)?.[1]?.trim() ?? process.env.APPLE_TEAM_ID ?? null; + const identifier = /^Identifier=(.+)$/m.exec(details)?.[1]?.trim() ?? null; + const hardenedRuntime = /^Runtime Version=/m.test(details) || /\bruntime\b/i.test(details); + + return { + status: 'accepted', + authority, + teamIdentifier, + identifier, + hardenedRuntime, + verifyDeepStrict: true, + spctlAssess: true, + }; +} + +function readInfoPlist(appPath) { + const plistPath = path.join(appPath, 'Contents', 'Info.plist'); + return { + CFBundleShortVersionString: runOutput('/usr/libexec/PlistBuddy', ['-c', 'Print :CFBundleShortVersionString', plistPath]).trim(), + CFBundleVersion: runOutput('/usr/libexec/PlistBuddy', ['-c', 'Print :CFBundleVersion', plistPath]).trim(), + CFBundleIdentifier: runOutput('/usr/libexec/PlistBuddy', ['-c', 'Print :CFBundleIdentifier', plistPath]).trim(), + }; +} + +function readTauriUpdaterPublicKey() { + const tauriConfig = readJson(path.join(packageRoot, 'src-tauri', 'tauri.conf.json')); + const publicKey = tauriConfig.plugins?.updater?.pubkey; + if (typeof publicKey !== 'string' || publicKey.trim().length === 0) { + throw new Error('Tauri updater public key is missing from src-tauri/tauri.conf.json'); + } + return publicKey; +} + +function githubReleaseDownloadBaseUrl(releaseUrl) { + const normalized = releaseUrl.replace(/\/$/, ''); + if (normalized.includes('/releases/download/')) return normalized; + if (normalized.includes('/releases/tag/')) return normalized.replace('/releases/tag/', '/releases/download/'); + return `${normalized}/download`; +} + +function writeStableUpdaterManifest({ version, releaseUrl, updaterPath, updaterSignaturePath, outputUrl }) { + const signatureContent = fs.readFileSync(updaterSignaturePath, 'utf8').trim(); + const downloadBaseUrl = githubReleaseDownloadBaseUrl(releaseUrl); + const artifactUrl = `${downloadBaseUrl}/${path.basename(updaterPath)}`; + const manifest = { + version, + pub_date: new Date().toISOString(), + platforms: { + [DESKTOP_STABLE_UPDATER_PLATFORM]: { + signature: signatureContent, + url: artifactUrl, + }, + }, + }; + const filename = desktopStableUpdaterManifestFilename(version); + const manifestPath = path.join(evidenceRoot, filename); + fs.writeFileSync(manifestPath, `${JSON.stringify(manifest, null, 2)}\n`, 'utf8'); + return { + filename, + path: manifestPath, + url: outputUrl ?? `${downloadBaseUrl}/${filename}`, + json: manifest, + }; +} + +function main() { + const options = parseArgs(process.argv.slice(2)); + const parsed = options.tag ? parseDesktopStableTag(options.tag) : parseDesktopStableVersion(readJson(path.join(packageRoot, 'package.json')).version); + const releaseUrl = options.releaseUrl ?? `https://github.com/bssm-oss/CodeAgora/releases/tag/${parsed.gitTag}`; + const appPath = requiredFile(options.appPath, 'macOS app bundle'); + const dmgPath = requiredFile(options.dmgPath, 'macOS DMG'); + const updaterPath = requiredFile(options.updaterPath, 'updater artifact'); + const updaterSignaturePath = requiredFile(options.updaterSignaturePath, 'updater signature'); + const manifest = writeStableUpdaterManifest({ + version: parsed.version, + releaseUrl, + updaterPath, + updaterSignaturePath, + outputUrl: options.updaterManifestUrl, + }); + const infoPlist = readInfoPlist(appPath); + + runOutput('codesign', ['--verify', '--deep', '--strict', '--verbose=2', appPath]); + runOutput('spctl', ['--assess', '--type', 'execute', '--verbose=4', appPath]); + runOutput('xcrun', ['stapler', 'validate', appPath]); + runOutput('xcrun', ['stapler', 'validate', dmgPath]); + + const evidence = { + schemaVersion: DESKTOP_STABLE_DISTRIBUTION_EVIDENCE_SCHEMA_VERSION, + generatedAt: new Date().toISOString(), + evidenceMode: 'real', + version: parsed.version, + gitTag: parsed.gitTag, + npmDistTag: parsed.npmDistTag, + target: { + platform: MACOS_DESKTOP_PLATFORM, + arch: MACOS_ARM64_ARCH, + }, + app: { + path: relative(appPath), + sha256: sha256(appPath), + bundleIdentifier: infoPlist.CFBundleIdentifier, + infoPlist, + }, + dmg: { + path: relative(dmgPath), + sha256: sha256(dmgPath), + }, + codesign: parseCodesignDetails(appPath), + notarization: { + status: 'accepted', + ticketStapled: true, + appTicketStapled: true, + dmgTicketStapled: true, + }, + updater: { + releaseLine: parsed.releaseLine, + publicKey: readTauriUpdaterPublicKey(), + artifact: { + path: relative(updaterPath), + sha256: sha256(updaterPath), + }, + signature: { + path: relative(updaterSignaturePath), + content: fs.readFileSync(updaterSignaturePath, 'utf8').trim(), + }, + manifest: { + filename: manifest.filename, + path: relative(manifest.path), + url: manifest.url, + sha256: sha256(manifest.path), + json: manifest.json, + }, + }, + githubRelease: { + tag: parsed.gitTag, + prerelease: false, + url: releaseUrl, + assets: [ + path.basename(dmgPath), + path.basename(updaterPath), + path.basename(updaterSignaturePath), + manifest.filename, + DESKTOP_STABLE_DISTRIBUTION_EVIDENCE_FILENAME, + ], + }, + }; + + const validation = validateDesktopStableDistributionEvidence(evidence); + if (!validation.valid) { + throw new Error(`Generated Desktop stable distribution evidence is invalid: ${validation.errors.join('; ')}`); + } + + fs.mkdirSync(path.dirname(path.resolve(options.output)), { recursive: true }); + fs.writeFileSync(path.resolve(options.output), `${JSON.stringify(evidence, null, 2)}\n`, 'utf8'); + console.log(`Desktop stable distribution evidence written to ${relative(options.output)}`); +} + +main(); diff --git a/packages/desktop/scripts/capture-unsigned-dmg-evidence.mjs b/packages/desktop/scripts/capture-unsigned-dmg-evidence.mjs new file mode 100644 index 00000000..6bc9009c --- /dev/null +++ b/packages/desktop/scripts/capture-unsigned-dmg-evidence.mjs @@ -0,0 +1,195 @@ +#!/usr/bin/env node +import crypto from 'node:crypto'; +import fs from 'node:fs'; +import path from 'node:path'; +import { execFileSync } from 'node:child_process'; +import { + DESKTOP_UNSIGNED_DMG_EVIDENCE_FILENAME, + DESKTOP_UNSIGNED_DMG_EVIDENCE_SCHEMA_VERSION, + MACOS_ARM64_ARCH, + MACOS_DESKTOP_PLATFORM, + parseDesktopStableTag, + parseDesktopStableVersion, + validateDesktopUnsignedDmgEvidence, +} from './desktop-artifacts.mjs'; + +const packageRoot = path.resolve(import.meta.dirname, '..'); +const repoRoot = path.resolve(packageRoot, '..', '..'); +const evidenceRoot = path.join(repoRoot, '.sisyphus', 'evidence'); +const defaultBundleRoot = path.join( + packageRoot, + 'src-tauri', + 'target', + 'aarch64-apple-darwin', + 'release', + 'bundle', +); + +function parseArgs(argv) { + const options = { + tag: process.env.GITHUB_REF_NAME, + releaseUrl: process.env.GITHUB_RELEASE_URL, + appPath: process.env.CODEAGORA_DESKTOP_APP_PATH, + dmgPath: process.env.CODEAGORA_DESKTOP_DMG_PATH, + output: path.join(evidenceRoot, DESKTOP_UNSIGNED_DMG_EVIDENCE_FILENAME), + }; + + for (let index = 0; index < argv.length; index++) { + const arg = argv[index]; + if (arg === '--tag') options.tag = argv[++index]; + else if (arg?.startsWith('--tag=')) options.tag = arg.slice('--tag='.length); + else if (arg === '--release-url') options.releaseUrl = argv[++index]; + else if (arg?.startsWith('--release-url=')) options.releaseUrl = arg.slice('--release-url='.length); + else if (arg === '--app') options.appPath = argv[++index]; + else if (arg?.startsWith('--app=')) options.appPath = arg.slice('--app='.length); + else if (arg === '--dmg') options.dmgPath = argv[++index]; + else if (arg?.startsWith('--dmg=')) options.dmgPath = arg.slice('--dmg='.length); + else if (arg === '--output') options.output = argv[++index]; + else if (arg?.startsWith('--output=')) options.output = arg.slice('--output='.length); + else if (arg !== '--') throw new Error(`Unknown argument: ${arg}`); + } + return options; +} + +function readJson(filePath) { + return JSON.parse(fs.readFileSync(filePath, 'utf8')); +} + +function sha256(filePath) { + const absolute = path.resolve(filePath); + const stat = fs.statSync(absolute); + if (!stat.isDirectory()) { + return crypto.createHash('sha256').update(fs.readFileSync(absolute)).digest('hex'); + } + + const hash = crypto.createHash('sha256'); + const visit = (dir) => { + for (const entry of fs.readdirSync(dir).sort()) { + const current = path.join(dir, entry); + const relativePath = path.relative(absolute, current); + const currentStat = fs.statSync(current); + hash.update(relativePath); + hash.update(currentStat.mode.toString(8)); + if (currentStat.isDirectory()) { + visit(current); + } else if (currentStat.isFile()) { + hash.update(fs.readFileSync(current)); + } + } + }; + visit(absolute); + return hash.digest('hex'); +} + +function relative(filePath) { + return path.relative(repoRoot, path.resolve(filePath)); +} + +function findFirst(root, predicate) { + if (!fs.existsSync(root)) return null; + const visit = (dir) => { + for (const entry of fs.readdirSync(dir).sort()) { + const current = path.join(dir, entry); + const stat = fs.statSync(current); + if (predicate(current, stat)) return current; + if (stat.isDirectory() && !current.endsWith('.app')) { + const found = visit(current); + if (found) return found; + } + } + return null; + }; + return visit(root); +} + +function requiredPath(filePath, label) { + if (!filePath) throw new Error(`${label} path is required`); + const absolute = path.resolve(filePath); + if (!fs.existsSync(absolute)) throw new Error(`${label} is missing: ${absolute}`); + return absolute; +} + +function runOutput(file, args) { + return execFileSync(file, args, { + cwd: repoRoot, + encoding: 'utf8', + stdio: ['ignore', 'pipe', 'pipe'], + }); +} + +function readInfoPlist(appPath) { + const plistPath = path.join(appPath, 'Contents', 'Info.plist'); + return { + CFBundleShortVersionString: runOutput('/usr/libexec/PlistBuddy', ['-c', 'Print :CFBundleShortVersionString', plistPath]).trim(), + CFBundleVersion: runOutput('/usr/libexec/PlistBuddy', ['-c', 'Print :CFBundleVersion', plistPath]).trim(), + CFBundleIdentifier: runOutput('/usr/libexec/PlistBuddy', ['-c', 'Print :CFBundleIdentifier', plistPath]).trim(), + }; +} + +function main() { + const options = parseArgs(process.argv.slice(2)); + const parsed = options.tag + ? parseDesktopStableTag(options.tag) + : parseDesktopStableVersion(readJson(path.join(packageRoot, 'package.json')).version); + const releaseUrl = options.releaseUrl ?? `https://github.com/bssm-oss/CodeAgora/releases/tag/${parsed.gitTag}`; + const appPath = requiredPath( + options.appPath ?? findFirst(defaultBundleRoot, (candidate, stat) => stat.isDirectory() && candidate.endsWith('CodeAgora.app')), + 'macOS app bundle', + ); + const dmgPath = requiredPath( + options.dmgPath ?? findFirst(path.join(defaultBundleRoot, 'dmg'), (candidate, stat) => stat.isFile() && /CodeAgora_.*_aarch64\.dmg$/.test(path.basename(candidate))), + 'macOS unsigned DMG', + ); + const infoPlist = readInfoPlist(appPath); + + const evidence = { + schemaVersion: DESKTOP_UNSIGNED_DMG_EVIDENCE_SCHEMA_VERSION, + generatedAt: new Date().toISOString(), + evidenceMode: 'real', + version: parsed.version, + gitTag: parsed.gitTag, + npmDistTag: parsed.npmDistTag, + target: { + platform: MACOS_DESKTOP_PLATFORM, + arch: MACOS_ARM64_ARCH, + }, + app: { + path: relative(appPath), + sha256: sha256(appPath), + bundleIdentifier: infoPlist.CFBundleIdentifier, + infoPlist, + }, + dmg: { + path: relative(dmgPath), + sha256: sha256(dmgPath), + }, + distributionPolicy: { + signed: false, + notarized: false, + updaterEnabled: false, + gatekeeperWarning: true, + supportTier: 'preview', + note: 'v0.1.0 Desktop is distributed as an unsigned preview DMG; macOS Gatekeeper warning is expected.', + }, + githubRelease: { + tag: parsed.gitTag, + prerelease: false, + url: releaseUrl, + assets: [ + path.basename(dmgPath), + DESKTOP_UNSIGNED_DMG_EVIDENCE_FILENAME, + ], + }, + }; + + const validation = validateDesktopUnsignedDmgEvidence(evidence); + if (!validation.valid) { + throw new Error(`Generated Desktop unsigned DMG evidence is invalid: ${validation.errors.join('; ')}`); + } + + fs.mkdirSync(path.dirname(path.resolve(options.output)), { recursive: true }); + fs.writeFileSync(path.resolve(options.output), `${JSON.stringify(evidence, null, 2)}\n`, 'utf8'); + console.log(`Desktop unsigned DMG evidence written to ${relative(options.output)}`); +} + +main(); diff --git a/packages/desktop/scripts/desktop-artifacts.mjs b/packages/desktop/scripts/desktop-artifacts.mjs index a4dfddd1..e3542c02 100644 --- a/packages/desktop/scripts/desktop-artifacts.mjs +++ b/packages/desktop/scripts/desktop-artifacts.mjs @@ -11,10 +11,17 @@ export const MACOS_ARM64_SIGNING_EVIDENCE_SCHEMA_VERSION = 'codeagora.desktop-ma export const MACOS_ARM64_SIGNING_EVIDENCE_FILENAME = 'desktop-macos-arm64-signing-evidence.json'; export const DESKTOP_RC_DISTRIBUTION_EVIDENCE_SCHEMA_VERSION = 'codeagora.desktop-rc-distribution-evidence.v1'; export const DESKTOP_RC_DISTRIBUTION_EVIDENCE_FILENAME = 'desktop-rc-distribution-evidence.json'; +export const DESKTOP_STABLE_DISTRIBUTION_EVIDENCE_SCHEMA_VERSION = 'codeagora.desktop-stable-distribution-evidence.v1'; +export const DESKTOP_STABLE_DISTRIBUTION_EVIDENCE_FILENAME = 'desktop-stable-distribution-evidence.json'; +export const DESKTOP_UNSIGNED_DMG_EVIDENCE_SCHEMA_VERSION = 'codeagora.desktop-unsigned-dmg-evidence.v1'; +export const DESKTOP_UNSIGNED_DMG_EVIDENCE_FILENAME = 'desktop-unsigned-dmg-evidence.json'; export const DESKTOP_RC_UPDATER_PLATFORM = 'darwin-aarch64'; +export const DESKTOP_STABLE_UPDATER_PLATFORM = DESKTOP_RC_UPDATER_PLATFORM; const RC_VERSION_PATTERN = /^(\d+)\.(\d+)\.(\d+)-rc\.(\d+)$/; const RC_TAG_PATTERN = /^v(\d+\.\d+\.\d+-rc\.\d+)$/; +const STABLE_VERSION_PATTERN = /^(\d+)\.(\d+)\.(\d+)$/; +const STABLE_TAG_PATTERN = /^v(\d+\.\d+\.\d+)$/; const SECRET_VALUE_PATTERN = /(?:api[_-]?key|token|secret|password|private[_-]?key|-----BEGIN|sk-[a-z0-9_-]+)/i; function sha256(filePath) { @@ -56,6 +63,40 @@ export function desktopRcUpdaterManifestFilename(versionOrTag) { return parsed.updaterManifestFilename; } +export function parseDesktopStableVersion(version) { + const match = typeof version === 'string' ? STABLE_VERSION_PATTERN.exec(version) : null; + if (!match) { + throw new Error( + `Desktop stable version must be npm semver X.Y.Z without prerelease or build metadata, received ${String(version ?? 'missing')}`, + ); + } + return { + version, + major: Number(match[1]), + minor: Number(match[2]), + patch: Number(match[3]), + releaseLine: `${match[1]}.${match[2]}`, + gitTag: `v${version}`, + npmDistTag: 'latest', + updaterManifestFilename: `latest-${match[1]}.${match[2]}.json`, + }; +} + +export function parseDesktopStableTag(tag) { + const match = typeof tag === 'string' ? STABLE_TAG_PATTERN.exec(tag) : null; + if (!match) { + throw new Error(`Desktop stable git tag must be vX.Y.Z, received ${String(tag ?? 'missing')}`); + } + return parseDesktopStableVersion(match[1]); +} + +export function desktopStableUpdaterManifestFilename(versionOrTag) { + const parsed = String(versionOrTag).startsWith('v') + ? parseDesktopStableTag(versionOrTag) + : parseDesktopStableVersion(versionOrTag); + return parsed.updaterManifestFilename; +} + function validUrl(value) { if (!isNonEmptyString(value)) return false; try { @@ -545,6 +586,326 @@ export function validateDesktopRcDistributionEvidence(evidence = {}, options = { }; } +function releaseLineFromStableVersion(version) { + try { + return parseDesktopStableVersion(version).releaseLine; + } catch { + return null; + } +} + +function collectStableCodesignDistributionErrors(codesign = {}) { + const errors = collectCodesignEvidenceErrors(codesign); + const authority = Array.isArray(codesign.authority) ? codesign.authority.join('\n') : String(codesign.authority ?? ''); + if (!/Developer ID Application:/i.test(authority)) { + errors.push('codesign.authority must include a Developer ID Application signing authority'); + } + if (/\bAd Hoc\b|adhoc|^-$/i.test(authority)) { + errors.push('ad-hoc signatures are not valid for Desktop stable distribution'); + } + if (codesign.verifyDeepStrict !== true) { + errors.push('codesign.verifyDeepStrict must be true'); + } + if (codesign.spctlAssess !== true) { + errors.push('codesign.spctlAssess must be true'); + } + return errors; +} + +function collectStableNotarizationDistributionErrors(notarization = {}) { + const errors = collectNotarizationEvidenceErrors(notarization); + if (notarization.appTicketStapled !== true) { + errors.push('notarization.appTicketStapled must be true'); + } + if (notarization.dmgTicketStapled !== true) { + errors.push('notarization.dmgTicketStapled must be true'); + } + return errors; +} + +export function validateDesktopStableUpdaterManifest(manifest = {}, options = {}) { + const errors = []; + const expected = parseDesktopStableVersion(options.version ?? manifest.version); + const platforms = manifest.platforms ?? {}; + const platformEntry = platforms[DESKTOP_STABLE_UPDATER_PLATFORM] ?? {}; + const version = typeof manifest.version === 'string' && manifest.version.startsWith('v') + ? manifest.version.slice(1) + : manifest.version; + + if (version !== expected.version) { + errors.push(`updater manifest version must be ${expected.version}, received ${String(manifest.version ?? 'missing')}`); + } + if (releaseLineFromStableVersion(version) !== expected.releaseLine) { + errors.push(`updater manifest version must stay on ${expected.releaseLine}.x stable line`); + } + if (!validUrl(platformEntry.url)) { + errors.push(`${DESKTOP_STABLE_UPDATER_PLATFORM}.url must be an https URL`); + } + if (!isNonEmptyString(platformEntry.signature)) { + errors.push(`${DESKTOP_STABLE_UPDATER_PLATFORM}.signature must contain the .sig file content`); + } + if (!isNonEmptyString(manifest.pub_date)) { + errors.push('updater manifest pub_date is required'); + } + if (manifest.platforms && Object.keys(platforms).some((platform) => platform !== DESKTOP_STABLE_UPDATER_PLATFORM)) { + errors.push(`updater manifest may only include ${DESKTOP_STABLE_UPDATER_PLATFORM} for this stable pipeline`); + } + + return { + valid: errors.length === 0, + version: version ?? null, + releaseLine: releaseLineFromStableVersion(version), + platform: DESKTOP_STABLE_UPDATER_PLATFORM, + url: platformEntry.url ?? null, + signaturePresent: isNonEmptyString(platformEntry.signature), + errors, + }; +} + +export function validateDesktopStableDistributionEvidence(evidence = {}, options = {}) { + const errors = []; + if (!evidence || typeof evidence !== 'object') { + return { + schemaVersion: DESKTOP_STABLE_DISTRIBUTION_EVIDENCE_SCHEMA_VERSION, + valid: false, + errors: [`Missing ${DESKTOP_STABLE_DISTRIBUTION_EVIDENCE_SCHEMA_VERSION} evidence`], + }; + } + if (evidence.schemaVersion !== DESKTOP_STABLE_DISTRIBUTION_EVIDENCE_SCHEMA_VERSION) { + errors.push( + `Expected distribution evidence schema ${DESKTOP_STABLE_DISTRIBUTION_EVIDENCE_SCHEMA_VERSION}, received ${String(evidence.schemaVersion ?? 'missing')}`, + ); + } + + let expected; + try { + expected = parseDesktopStableVersion(options.version ?? evidence.version); + } catch (error) { + errors.push(error instanceof Error ? error.message : String(error)); + expected = null; + } + if (expected && evidence.gitTag !== expected.gitTag) { + errors.push(`gitTag must be ${expected.gitTag}, received ${String(evidence.gitTag ?? 'missing')}`); + } + if (expected && evidence.npmDistTag !== 'latest') { + errors.push(`npmDistTag must be latest for ${expected.version}`); + } + if (expected && evidence.githubRelease?.prerelease !== false) { + errors.push('githubRelease.prerelease must be false'); + } + if (evidence.target?.platform !== MACOS_DESKTOP_PLATFORM || evidence.target?.arch !== MACOS_ARM64_ARCH) { + errors.push('target must be macOS arm64 only for Desktop stable distribution'); + } + + errors.push(...collectHashErrors(evidence.app, 'app')); + errors.push(...collectHashErrors(evidence.dmg, 'dmg')); + if (!isNonEmptyString(evidence.app?.bundleIdentifier)) { + errors.push('app.bundleIdentifier is required'); + } + if (!isNonEmptyString(evidence.app?.infoPlist?.CFBundleShortVersionString)) { + errors.push('app.infoPlist.CFBundleShortVersionString is required'); + } + if (!isNonEmptyString(evidence.app?.infoPlist?.CFBundleVersion)) { + errors.push('app.infoPlist.CFBundleVersion is required'); + } + if (expected && evidence.app?.infoPlist?.CFBundleShortVersionString !== expected.version) { + errors.push('app Info.plist CFBundleShortVersionString must match the stable semver version'); + } + if (expected && evidence.app?.infoPlist?.CFBundleVersion !== expected.version) { + errors.push('app Info.plist CFBundleVersion must match the stable semver version'); + } + + errors.push(...collectStableCodesignDistributionErrors(evidence.codesign)); + errors.push(...collectStableNotarizationDistributionErrors(evidence.notarization)); + + const updater = evidence.updater ?? {}; + if (!isNonEmptyString(updater.publicKey)) { + errors.push('updater.publicKey is required'); + } + if (!isNonEmptyString(updater.artifact?.path)) { + errors.push('updater.artifact.path is required'); + } + if (isNonEmptyString(updater.artifact?.path) && path.basename(updater.artifact.path) === path.basename(evidence.dmg?.path ?? '')) { + errors.push('updater.artifact.path must reference the Tauri updater app artifact, not the DMG'); + } + if (isNonEmptyString(updater.artifact?.path) && updater.artifact.path.endsWith('.dmg')) { + errors.push('updater.artifact.path must not be a DMG'); + } + if (!/^[a-f0-9]{64}$/i.test(String(updater.artifact?.sha256 ?? ''))) { + errors.push('updater.artifact.sha256 must be a SHA-256 hex digest'); + } + if (!isNonEmptyString(updater.signature?.path)) { + errors.push('updater.signature.path is required'); + } + if (!isNonEmptyString(updater.signature?.content)) { + errors.push('updater.signature.content must contain the generated .sig file content'); + } + if (expected && updater.manifest?.filename !== expected.updaterManifestFilename) { + errors.push(`updater.manifest.filename must be ${expected.updaterManifestFilename}`); + } + if (expected && updater.releaseLine !== expected.releaseLine) { + errors.push(`updater.releaseLine must be ${expected.releaseLine}`); + } + if (!validUrl(updater.manifest?.url)) { + errors.push('updater.manifest.url must be an https URL'); + } + if (updater.manifest?.json) { + try { + const manifestValidation = validateDesktopStableUpdaterManifest(updater.manifest.json, { + version: expected?.version ?? evidence.version, + }); + errors.push(...manifestValidation.errors); + const manifestArtifactUrl = manifestValidation.url ? new globalThis.URL(manifestValidation.url) : null; + if ( + manifestArtifactUrl + && isNonEmptyString(updater.artifact?.path) + && path.basename(manifestArtifactUrl.pathname) !== path.basename(updater.artifact.path) + ) { + errors.push('updater manifest URL must point to the recorded updater artifact'); + } + } catch (error) { + errors.push(error instanceof Error ? error.message : String(error)); + } + } else { + errors.push('updater.manifest.json is required'); + } + + const releaseAssets = Array.isArray(evidence.githubRelease?.assets) + ? evidence.githubRelease.assets + : []; + for (const requiredAsset of [ + evidence.dmg?.path, + updater.artifact?.path, + updater.signature?.path, + updater.manifest?.filename, + DESKTOP_STABLE_DISTRIBUTION_EVIDENCE_FILENAME, + ].filter(Boolean)) { + const basename = path.basename(requiredAsset); + if (!releaseAssets.some((asset) => asset === basename || asset?.name === basename)) { + errors.push(`githubRelease.assets must include ${basename}`); + } + } + + const secretLeaks = collectSecretLeaks(evidence); + if (secretLeaks.length > 0) { + errors.push(`distribution evidence contains secret-looking values at: ${secretLeaks.join(', ')}`); + } + + return { + schemaVersion: DESKTOP_STABLE_DISTRIBUTION_EVIDENCE_SCHEMA_VERSION, + valid: errors.length === 0, + version: evidence.version ?? null, + gitTag: evidence.gitTag ?? null, + releaseLine: expected?.releaseLine ?? null, + updaterManifestFilename: expected?.updaterManifestFilename ?? null, + errors, + }; +} + +export function validateDesktopUnsignedDmgEvidence(evidence = {}, options = {}) { + const errors = []; + if (!evidence || typeof evidence !== 'object') { + return { + schemaVersion: DESKTOP_UNSIGNED_DMG_EVIDENCE_SCHEMA_VERSION, + valid: false, + errors: [`Missing ${DESKTOP_UNSIGNED_DMG_EVIDENCE_SCHEMA_VERSION} evidence`], + }; + } + if (evidence.schemaVersion !== DESKTOP_UNSIGNED_DMG_EVIDENCE_SCHEMA_VERSION) { + errors.push( + `Expected unsigned DMG evidence schema ${DESKTOP_UNSIGNED_DMG_EVIDENCE_SCHEMA_VERSION}, received ${String(evidence.schemaVersion ?? 'missing')}`, + ); + } + if (evidence.evidenceMode !== 'real') { + errors.push(`evidenceMode must be real, received ${String(evidence.evidenceMode ?? 'missing')}`); + } + + let expected; + try { + expected = parseDesktopStableVersion(options.version ?? evidence.version); + } catch (error) { + errors.push(error instanceof Error ? error.message : String(error)); + expected = null; + } + if (expected && evidence.gitTag !== expected.gitTag) { + errors.push(`gitTag must be ${expected.gitTag}, received ${String(evidence.gitTag ?? 'missing')}`); + } + if (expected && evidence.npmDistTag !== 'latest') { + errors.push(`npmDistTag must be latest for ${expected.version}`); + } + if (expected && evidence.githubRelease?.prerelease !== false) { + errors.push('githubRelease.prerelease must be false'); + } + if (evidence.target?.platform !== MACOS_DESKTOP_PLATFORM || evidence.target?.arch !== MACOS_ARM64_ARCH) { + errors.push('target must be macOS arm64 only for unsigned Desktop stable DMG'); + } + + errors.push(...collectHashErrors(evidence.app, 'app')); + errors.push(...collectHashErrors(evidence.dmg, 'dmg')); + if (!isNonEmptyString(evidence.app?.bundleIdentifier)) { + errors.push('app.bundleIdentifier is required'); + } + if (!isNonEmptyString(evidence.app?.infoPlist?.CFBundleShortVersionString)) { + errors.push('app.infoPlist.CFBundleShortVersionString is required'); + } + if (!isNonEmptyString(evidence.app?.infoPlist?.CFBundleVersion)) { + errors.push('app.infoPlist.CFBundleVersion is required'); + } + if (expected && evidence.app?.infoPlist?.CFBundleShortVersionString !== expected.version) { + errors.push('app Info.plist CFBundleShortVersionString must match the stable semver version'); + } + if (expected && evidence.app?.infoPlist?.CFBundleVersion !== expected.version) { + errors.push('app Info.plist CFBundleVersion must match the stable semver version'); + } + + const policy = evidence.distributionPolicy ?? {}; + if (policy.signed !== false) { + errors.push('distributionPolicy.signed must be false for the v0.1.0 unsigned DMG path'); + } + if (policy.notarized !== false) { + errors.push('distributionPolicy.notarized must be false for the v0.1.0 unsigned DMG path'); + } + if (policy.updaterEnabled !== false) { + errors.push('distributionPolicy.updaterEnabled must be false for the v0.1.0 unsigned DMG path'); + } + if (policy.gatekeeperWarning !== true) { + errors.push('distributionPolicy.gatekeeperWarning must be true for unsigned macOS DMGs'); + } + if (policy.supportTier !== 'preview') { + errors.push('distributionPolicy.supportTier must be preview'); + } + if (evidence.codesign || evidence.notarization || evidence.updater) { + errors.push('unsigned DMG evidence must not include codesign, notarization, or updater claims'); + } + + const releaseAssets = Array.isArray(evidence.githubRelease?.assets) + ? evidence.githubRelease.assets + : []; + for (const requiredAsset of [ + evidence.dmg?.path, + DESKTOP_UNSIGNED_DMG_EVIDENCE_FILENAME, + ].filter(Boolean)) { + const basename = path.basename(requiredAsset); + if (!releaseAssets.some((asset) => asset === basename || asset?.name === basename)) { + errors.push(`githubRelease.assets must include ${basename}`); + } + } + + const secretLeaks = collectSecretLeaks(evidence); + if (secretLeaks.length > 0) { + errors.push(`unsigned DMG evidence contains secret-looking values at: ${secretLeaks.join(', ')}`); + } + + return { + schemaVersion: DESKTOP_UNSIGNED_DMG_EVIDENCE_SCHEMA_VERSION, + valid: errors.length === 0, + version: evidence.version ?? null, + gitTag: evidence.gitTag ?? null, + releaseLine: expected?.releaseLine ?? null, + errors, + }; +} + export function assertDesktopRcDistributionEvidence(params = {}) { const result = validateDesktopRcDistributionEvidence(params.evidence, params); if (!result.valid) { @@ -553,6 +914,14 @@ export function assertDesktopRcDistributionEvidence(params = {}) { return result; } +export function assertDesktopUnsignedDmgEvidence(params = {}) { + const result = validateDesktopUnsignedDmgEvidence(params.evidence, params); + if (!result.valid) { + throw new Error(`Invalid Desktop unsigned DMG evidence: ${result.errors.join('; ')}`); + } + return result; +} + export function readMacosArm64SigningEvidence(options = {}) { const cwd = options.cwd ?? process.cwd(); const evidenceRoot = path.resolve(cwd, options.evidenceRoot ?? path.join('.sisyphus', 'evidence')); @@ -603,6 +972,56 @@ export function readDesktopRcDistributionEvidence(options = {}) { }; } +export function readDesktopStableDistributionEvidence(options = {}) { + const cwd = options.cwd ?? process.cwd(); + const evidenceRoot = path.resolve(cwd, options.evidenceRoot ?? path.join('.sisyphus', 'evidence')); + const evidencePath = path.resolve( + cwd, + options.evidencePath ?? path.join(evidenceRoot, DESKTOP_STABLE_DISTRIBUTION_EVIDENCE_FILENAME), + ); + + if (!fs.existsSync(evidencePath)) { + return { + present: false, + path: evidencePath, + relativePath: path.relative(cwd, evidencePath), + evidence: null, + }; + } + + return { + present: true, + path: evidencePath, + relativePath: path.relative(cwd, evidencePath), + evidence: JSON.parse(fs.readFileSync(evidencePath, 'utf8')), + }; +} + +export function readDesktopUnsignedDmgEvidence(options = {}) { + const cwd = options.cwd ?? process.cwd(); + const evidenceRoot = path.resolve(cwd, options.evidenceRoot ?? path.join('.sisyphus', 'evidence')); + const evidencePath = path.resolve( + cwd, + options.evidencePath ?? path.join(evidenceRoot, DESKTOP_UNSIGNED_DMG_EVIDENCE_FILENAME), + ); + + if (!fs.existsSync(evidencePath)) { + return { + present: false, + path: evidencePath, + relativePath: path.relative(cwd, evidencePath), + evidence: null, + }; + } + + return { + present: true, + path: evidencePath, + relativePath: path.relative(cwd, evidencePath), + evidence: JSON.parse(fs.readFileSync(evidencePath, 'utf8')), + }; +} + export function locateMacosDesktopArtifact(options = {}) { const cwd = options.cwd ?? process.cwd(); const bundleRoot = path.resolve( diff --git a/packages/desktop/scripts/evidence.mjs b/packages/desktop/scripts/evidence.mjs index 6cfcf0fe..365f0109 100644 --- a/packages/desktop/scripts/evidence.mjs +++ b/packages/desktop/scripts/evidence.mjs @@ -38,6 +38,8 @@ function fileEvidence(relativePath) { const packageJson = readJson(path.join(packageRoot, 'package.json')); const tauriConfig = readJson(path.join(packageRoot, 'src-tauri', 'tauri.conf.json')); const main = fs.readFileSync(path.join(packageRoot, 'src-tauri', 'src', 'main.rs'), 'utf8'); +const isRcVersion = String(packageJson.version).includes('-rc.'); +const updaterManifest = isRcVersion ? 'latest-0.1-rc.json' : 'latest-0.1.json'; const macosArm64Artifact = locateMacosDesktopArtifact({ cwd: repoRoot, bundleRoot: path.join(packageRoot, 'src-tauri', 'target', 'release', 'bundle'), @@ -118,8 +120,8 @@ const manifest = { notarization: macosArm64SigningValidation.valid ? 'valid-macos-arm64-release-evidence' : 'missing-or-invalid-macos-arm64-release-evidence', - updater: 'enabled-for-line-scoped-rc-updates', - updaterManifest: 'latest-0.1-rc.json', + updater: isRcVersion ? 'enabled-for-line-scoped-rc-updates' : 'enabled-for-line-scoped-stable-updates', + updaterManifest, packageSmoke: 'pnpm --filter @codeagora/desktop smoke', appE2e: 'pnpm --filter @codeagora/desktop app:e2e', macosWebdriverE2e: 'pnpm --filter @codeagora/desktop macos:webdriver-e2e (debug .app bundle)', diff --git a/packages/desktop/scripts/smoke.mjs b/packages/desktop/scripts/smoke.mjs index 8912f04e..74b9e80b 100644 --- a/packages/desktop/scripts/smoke.mjs +++ b/packages/desktop/scripts/smoke.mjs @@ -22,6 +22,8 @@ const tauriConfig = readJson('src-tauri/tauri.conf.json'); const capabilities = readJson('src-tauri/capabilities/default.json'); const cargoToml = readText('src-tauri/Cargo.toml'); const main = readText('src-tauri/src/main.rs'); +const isRcVersion = String(packageJson.version).includes('-rc.'); +const expectedUpdaterManifest = isRcVersion ? 'latest-0.1-rc.json' : 'latest-0.1.json'; assert(fs.existsSync(path.join(root, 'dist/index.html')), 'dist/index.html is missing'); assert(fs.existsSync(path.join(root, 'dist/main.js')), 'dist/main.js is missing'); @@ -45,10 +47,13 @@ assert(tauriConfig.version === packageJson.version, 'Tauri config version does n assert(tauriConfig.productName === 'CodeAgora', 'Unexpected Tauri product name'); assert(tauriConfig.app?.withGlobalTauri === true, 'Tauri global API must be enabled for the MCP bridge'); assert(typeof tauriConfig.app?.security?.csp === 'string' && tauriConfig.app.security.csp.includes("default-src 'self'"), 'Tauri CSP must be enabled for desktop RC gates'); -assert(tauriConfig.bundle?.createUpdaterArtifacts === true, 'Tauri updater artifacts must be generated for Desktop RC distribution'); -assert(Array.isArray(tauriConfig.bundle?.targets) && tauriConfig.bundle.targets.includes('dmg'), 'Desktop RC distribution must build a macOS DMG target'); -assert(tauriConfig.plugins?.updater?.endpoints?.[0]?.endsWith('/latest-0.1-rc.json'), 'Desktop RC updater endpoint must be scoped to latest-0.1-rc.json'); -assert(typeof tauriConfig.plugins?.updater?.pubkey === 'string' && tauriConfig.plugins.updater.pubkey.length > 40, 'Desktop RC updater public key is missing'); +assert(tauriConfig.bundle?.createUpdaterArtifacts === true, 'Tauri updater artifacts must be generated for Desktop distribution'); +assert(Array.isArray(tauriConfig.bundle?.targets) && tauriConfig.bundle.targets.includes('dmg'), 'Desktop distribution must build a macOS DMG target'); +assert( + tauriConfig.plugins?.updater?.endpoints?.[0]?.endsWith(`/${expectedUpdaterManifest}`), + `Desktop updater endpoint must be scoped to ${expectedUpdaterManifest}`, +); +assert(typeof tauriConfig.plugins?.updater?.pubkey === 'string' && tauriConfig.plugins.updater.pubkey.length > 40, 'Desktop updater public key is missing'); assert(capabilities[0]?.permissions?.includes('mcp-bridge:default'), 'MCP bridge permission is missing'); assert(capabilities[0]?.permissions?.includes('updater:allow-check'), 'Updater check permission is missing'); assert(capabilities[0]?.permissions?.includes('updater:allow-download-and-install'), 'Updater install permission is missing'); diff --git a/packages/desktop/src-tauri/Cargo.lock b/packages/desktop/src-tauri/Cargo.lock index 00351d81..1a15011a 100644 --- a/packages/desktop/src-tauri/Cargo.lock +++ b/packages/desktop/src-tauri/Cargo.lock @@ -561,7 +561,7 @@ dependencies = [ [[package]] name = "codeagora-desktop" -version = "0.1.0-rc.6" +version = "0.1.0" dependencies = [ "regex", "serde", diff --git a/packages/desktop/src-tauri/Cargo.toml b/packages/desktop/src-tauri/Cargo.toml index 8db28517..eef2477a 100644 --- a/packages/desktop/src-tauri/Cargo.toml +++ b/packages/desktop/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "codeagora-desktop" -version = "0.1.0-rc.6" +version = "0.1.0" edition = "2021" [features] diff --git a/packages/desktop/src-tauri/tauri.conf.json b/packages/desktop/src-tauri/tauri.conf.json index 7177d683..18ca025f 100644 --- a/packages/desktop/src-tauri/tauri.conf.json +++ b/packages/desktop/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "https://schema.tauri.app/config/2", "productName": "CodeAgora", - "version": "0.1.0-rc.6", + "version": "0.1.0", "identifier": "dev.codeagora.desktop", "build": { "beforeBuildCommand": "pnpm --filter @codeagora/desktop build", @@ -41,7 +41,7 @@ "updater": { "pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IEUyNjAwRTYzMkZDNkYxQjYKUldTMjhjWXZZdzVnNGwzcnFsRDZQRnlMa24vSjRKQjlncW9OTXNUeUJNdlhYeUZMdjBXTXkyQWEK", "endpoints": [ - "https://github.com/bssm-oss/CodeAgora/releases/download/desktop-0.1-rc/latest-0.1-rc.json" + "https://github.com/bssm-oss/CodeAgora/releases/download/desktop-0.1/latest-0.1.json" ], "windows": { "installMode": "passive" diff --git a/packages/github/package.json b/packages/github/package.json index 965286ff..09e8b980 100644 --- a/packages/github/package.json +++ b/packages/github/package.json @@ -1,6 +1,6 @@ { "name": "@codeagora/github", - "version": "0.1.0-rc.6", + "version": "0.1.0", "type": "module", "main": "./dist/index.js", "exports": { diff --git a/packages/github/src/tests/action-runtime.test.ts b/packages/github/src/tests/action-runtime.test.ts index 4a4db6b8..bd4cad67 100644 --- a/packages/github/src/tests/action-runtime.test.ts +++ b/packages/github/src/tests/action-runtime.test.ts @@ -1208,6 +1208,112 @@ describe('GitHub Action runtime', () => { await rm(tempDir, { recursive: true, force: true }); }); + it('skips stale-head posting after review mapping when the PR head moved', async () => { + const { mkdtemp, readFile, rm, writeFile } = await vi.importActual('node:fs/promises'); + const tempDir = await mkdtemp(path.join(os.tmpdir(), 'codeagora-action-runtime-')); + const outputFile = path.join(tempDir, 'output.txt'); + const summaryFile = path.join(tempDir, 'summary.md'); + const diffFile = path.join(tempDir, 'diff.patch'); + const sarifFile = path.join(tempDir, 'results.sarif'); + const eventFile = path.join(tempDir, 'event.json'); + const appKit = { + auth: 'app', + checks: { + listForRef: vi.fn(), + create: vi.fn(), + update: vi.fn(), + }, + }; + + process.env.GITHUB_OUTPUT = outputFile; + process.env.GITHUB_STEP_SUMMARY = summaryFile; + process.env.GITHUB_TOKEN = 'ghp_test'; + process.env.OPENROUTER_API_KEY = 'provider-secret'; + process.env.GITHUB_EVENT_NAME = 'pull_request'; + process.env.GITHUB_EVENT_PATH = eventFile; + await writeFile(eventFile, JSON.stringify({ pull_request: { head: { sha: eventHeadSha } } })); + + vi.mocked(mocks.parseActionInputs).mockReturnValue({ + repo: 'owner/repo', + sha: inputSha, + pr: 42, + diff: diffFile, + token: 'ghp_test', + configPath: '.ca/config.json', + baseSha: 'base123', + maxDiffLines: 0, + failOnReject: true, + postResults: true, + reporterMode: 'check-run', + baseRepo: 'owner/repo', + headRepo: 'owner/repo', + checkRunName: 'CodeAgora Review', + } as never); + vi.mocked(mocks.determineActionPolicy).mockReturnValue({ + degraded: false, + shouldRunReview: true, + shouldPostResults: true, + verdictOverride: undefined, + } as never); + vi.mocked(mocks.validateActionDiffPath).mockResolvedValue(diffFile); + vi.mocked(mocks.validateActionOutputPath).mockResolvedValue(sarifFile); + vi.mocked(mocks.readFile).mockResolvedValue('diff --git a/src/app.ts b/src/app.ts\n+changed'); + vi.mocked(mocks.loadConfigFile).mockResolvedValue({ github: { sarifOutputPath: sarifFile } } as never); + vi.mocked(mocks.runPipeline).mockResolvedValue({ + status: 'success', + summary: { + decision: 'REJECT', + reasoning: 'blocking issue', + totalReviewers: 3, + forfeitedReviewers: 0, + severityCounts: { CRITICAL: 1 }, + topIssues: [], + totalDiscussions: 0, + resolved: 0, + escalated: 0, + }, + sessionId: 'session-stale-head', + date: '2026-06-08', + evidenceDocs: [], + discussions: [], + } as never); + vi.mocked(mocks.createAppOctokit).mockResolvedValue(appKit as never); + vi.mocked(mocks.fetchPrMetadata).mockResolvedValue({ headSha: 'new-head-sha' } as never); + vi.mocked(mocks.isStaleHead).mockReturnValue(true); + vi.mocked(mocks.mapToGitHubReview).mockReturnValue({ + commit_id: eventHeadSha, + event: 'REQUEST_CHANGES', + verdict: 'REJECT', + body: 'configured PR-facing review', + comments: [], + } as never); + vi.mocked(mocks.writeFile).mockResolvedValue(undefined); + + await import('../action.js'); + await new Promise((resolve) => setImmediate(resolve)); + + expect(mocks.runPipeline).toHaveBeenCalled(); + expect(mocks.mapToGitHubReview).toHaveBeenCalled(); + expect(mocks.fetchPrMetadata).toHaveBeenCalled(); + expect(mocks.isStaleHead).toHaveBeenCalledWith(eventHeadSha, 'new-head-sha'); + expect(mocks.postReview).not.toHaveBeenCalled(); + expect(mocks.setCommitStatus).not.toHaveBeenCalled(); + expect(mocks.handleNeedsHuman).not.toHaveBeenCalled(); + expect(mocks.writeFile).not.toHaveBeenCalled(); + + const output = await readFile(outputFile, 'utf-8'); + expect(output).toContain('degraded=true'); + expect(output).toContain('degraded-reason=stale-head-sha'); + expect(output).toContain('verdict=SKIPPED'); + + const summary = await readFile(summaryFile, 'utf-8'); + expect(summary).toContain('CodeAgora review skipped'); + expect(summary).toContain('Reason: `stale-head-sha`'); + expect(summary).toContain('new-head-sha'); + + await rm(tempDir, { recursive: true, force: true }); + }); + it('posts only the commit-status reporter when configured', async () => { const { mkdtemp, readFile, rm, writeFile } = await vi.importActual('node:fs/promises'); const tempDir = await mkdtemp(path.join(os.tmpdir(), 'codeagora-action-runtime-')); diff --git a/packages/mcp/README.md b/packages/mcp/README.md index 73350f43..9153a5a9 100644 --- a/packages/mcp/README.md +++ b/packages/mcp/README.md @@ -14,7 +14,7 @@ pnpm --filter @codeagora/mcp pack --dry-run For published installs, users can run the package with: ```bash -npx -y @codeagora/mcp@rc +npx -y @codeagora/mcp ``` ## Client Configuration @@ -24,7 +24,7 @@ npx -y @codeagora/mcp@rc "mcpServers": { "codeagora": { "command": "npx", - "args": ["-y", "@codeagora/mcp@rc"] + "args": ["-y", "@codeagora/mcp"] } } } diff --git a/packages/mcp/package.json b/packages/mcp/package.json index 5e8b0781..3b7e00db 100644 --- a/packages/mcp/package.json +++ b/packages/mcp/package.json @@ -1,6 +1,6 @@ { "name": "@codeagora/mcp", - "version": "0.1.0-rc.6", + "version": "0.1.0", "description": "CodeAgora MCP server — Claude Code integration for AI-powered code review", "type": "module", "license": "MIT", diff --git a/packages/shared/package.json b/packages/shared/package.json index 6569e030..7c54e811 100644 --- a/packages/shared/package.json +++ b/packages/shared/package.json @@ -1,6 +1,6 @@ { "name": "@codeagora/shared", - "version": "0.1.0-rc.6", + "version": "0.1.0", "type": "module", "main": "./dist/index.js", "exports": { diff --git a/packages/shared/src/action-preset.ts b/packages/shared/src/action-preset.ts index 27470288..5d98570d 100644 --- a/packages/shared/src/action-preset.ts +++ b/packages/shared/src/action-preset.ts @@ -9,7 +9,7 @@ export interface WorkflowTemplateOptions extends ActionPresetOptions { localAction?: boolean; } -export const CODEAGORA_ACTION_REF = 'bssm-oss/CodeAgora@v0.1.0-rc.6'; +export const CODEAGORA_ACTION_REF = 'bssm-oss/CodeAgora@v0.1.0'; export const CODEAGORA_WORKFLOW_MAX_DIFF_LINES = 10000; export const ACTION_CHEAP_PRESET = { diff --git a/packages/shared/src/data/github-actions-template.yml b/packages/shared/src/data/github-actions-template.yml index f43f4b9f..64e70d3e 100644 --- a/packages/shared/src/data/github-actions-template.yml +++ b/packages/shared/src/data/github-actions-template.yml @@ -160,7 +160,7 @@ jobs: - name: CodeAgora Review if: steps.fork-check.outputs.skip != 'true' && steps.key-check.outputs.skip != 'true' - uses: bssm-oss/CodeAgora@v0.1.0-rc.6 + uses: bssm-oss/CodeAgora@v0.1.0 with: github-token: ${{ secrets.GITHUB_TOKEN }} fail-on-reject: 'true' diff --git a/packages/site/package.json b/packages/site/package.json index 6241b67d..72302af9 100644 --- a/packages/site/package.json +++ b/packages/site/package.json @@ -1,6 +1,6 @@ { "name": "@codeagora/site", - "version": "0.1.0-rc.6", + "version": "0.1.0", "private": true, "type": "module", "scripts": { @@ -9,4 +9,3 @@ "smoke": "node scripts/smoke.mjs" } } - diff --git a/packages/site/scripts/smoke.mjs b/packages/site/scripts/smoke.mjs index 2c8d4ddc..2a330a00 100644 --- a/packages/site/scripts/smoke.mjs +++ b/packages/site/scripts/smoke.mjs @@ -38,7 +38,7 @@ const css = ( const requiredCopy = [ "CodeAgora", - "npm i -g @codeagora/review@rc", + "npm i -g @codeagora/review", "GitHub Action", "MCP", "Desktop", @@ -68,6 +68,9 @@ const requiredSeo = [ 'property="og:image:width"', 'name="twitter:card"', 'name="application-name"', + 'name="codeagora:commit"', + 'data-codeagora-site="astro"', + 'data-codeagora-commit=', '"@type":"FAQPage"', '"@type":"BreadcrumbList"', 'type="application/ld+json"', diff --git a/packages/site/src/pages/index.astro b/packages/site/src/pages/index.astro index 34549638..c3a16d78 100644 --- a/packages/site/src/pages/index.astro +++ b/packages/site/src/pages/index.astro @@ -2,8 +2,12 @@ import "../styles/site.css"; import siteScriptUrl from "../scripts/site.js?url"; -const version = "0.1.0-rc.6"; +const version = "0.1.0"; const canonicalUrl = "https://codeagora.vercel.app/"; +const rawDeploymentCommitSha = (process.env.CODEAGORA_STABLE_SHA ?? process.env.VERCEL_GIT_COMMIT_SHA ?? "").trim(); +const deploymentCommitSha = /^[0-9a-f]{40}$/i.test(rawDeploymentCommitSha) + ? rawDeploymentCommitSha.toLowerCase() + : "unknown"; const schema = { "@context": "https://schema.org", "@graph": [ @@ -36,7 +40,7 @@ const schema = { "GitHub Action pull request automation", "MCP server for AI IDEs and coding agents", "CLI diff review", - "Desktop RC local review UI" + "Desktop app local review UI" ], offers: { "@type": "Offer", price: "0", priceCurrency: "USD" }, sameAs: [ @@ -70,7 +74,7 @@ const schema = { name: "Desktop은 안정판인가요?", acceptedAnswer: { "@type": "Answer", - text: "현재 Desktop은 RC 경로입니다. 이 랜딩 페이지는 안정판 Desktop 배포나 안정판 업데이트 채널을 약속하지 않습니다." + text: "Desktop은 공식 지원 표면이지만, macOS 서명, 공증, 업데이트 채널 evidence가 통과해야 stable 배포로 판정합니다." } } ] @@ -141,7 +145,7 @@ const surfaces = [ ["CLI", "내 컴퓨터에서 바로 코드 변경을 리뷰합니다.", "터미널"], ["GitHub Action", "Pull Request마다 같은 판정 기준을 자동으로 붙입니다.", "팀 리뷰"], ["MCP", "Cursor, Antigravity 같은 AI 개발 환경이 CodeAgora를 도구로 호출합니다.", "AI IDE"], - ["Desktop RC", "로컬 리뷰 세션과 결과를 화면에서 확인하는 출시 준비 버전입니다.", "로컬 UI"] + ["Desktop app", "로컬 리뷰 세션과 결과를 화면에서 확인하는 공식 UI입니다.", "로컬 UI"] ]; const faqs = [ @@ -150,7 +154,7 @@ const faqs = [ ["하나의 AI 리뷰와 무엇이 다른가요?", "한 모델의 답을 그대로 믿지 않고 여러 주장과 근거를 비교합니다. 그래서 그럴듯하지만 틀린 지적을 줄이는 데 초점을 둡니다."], ["비용은 어떻게 되나요?", "CodeAgora 자체는 MIT 오픈소스입니다. OpenAI, Anthropic, OpenRouter 같은 외부 모델을 쓰면 해당 공급자의 API 비용이 발생할 수 있습니다."], ["GitHub Action에 쓸 수 있나요?", "네. Pull Request마다 같은 리뷰 기준을 자동으로 붙일 수 있습니다."], - ["Desktop은 안정판인가요?", "현재 데스크톱 앱은 RC, 즉 출시 준비 단계입니다. 안정적인 팀 흐름은 CLI와 GitHub Action부터 시작하는 것을 권장합니다."] + ["Desktop은 안정판인가요?", "Desktop은 공식 지원 표면입니다. 다만 stable 배포 판정은 macOS 서명, 공증, 업데이트 채널 evidence가 모두 통과해야 합니다."] ]; const escapeHtml = (value) => @@ -221,11 +225,11 @@ next action: review local backend policy`), } ]; -const cliCommand = escapeHtml(`$ npm i -g @codeagora/review@rc +const cliCommand = escapeHtml(`$ npm i -g @codeagora/review $ agora init $ git diff | agora review`); -const actionCommand = escapeHtml(`uses: bssm-oss/CodeAgora@v0.1.0-rc.6 +const actionCommand = escapeHtml(`uses: bssm-oss/CodeAgora@v0.1.0 with: github-token: secrets.GITHUB_TOKEN env: @@ -235,18 +239,18 @@ const mcpCommand = escapeHtml(`{ "mcpServers": { "codeagora": { "command": "npx", - "args": ["-y", "@codeagora/mcp@rc"] + "args": ["-y", "@codeagora/mcp"] } } }`); -const desktopCommand = escapeHtml(`Desktop RC +const desktopCommand = escapeHtml(`Desktop app - local review session viewer - same CLI/MCP/GitHub verdict semantics - Desktop 정식 배포는 준비 중`); const commandLogs = { - cli: ["resolve package @rc", "load .ca/config", "read git diff", "write verdict artifact"], + cli: ["resolve package latest", "load .ca/config", "read git diff", "write verdict artifact"], action: ["checkout pull request", "redact fork secrets", "run reviewers", "post review summary"], mcp: ["start stdio server", "list review tools", "accept diff payload", "return compact verdict"], desktop: ["open local session", "load review history", "inspect evidence", "export decision note"] @@ -265,6 +269,7 @@ const commandLogs = { + @@ -290,7 +295,7 @@ const commandLogs = { - +