From 8676acadaa4a890cc8a8a56f1dc2506d56d7be3b Mon Sep 17 00:00:00 2001 From: Ame Date: Sun, 8 Nov 2026 01:23:53 +0800 Subject: [PATCH] refactor(scripts): remove dead scripts, relocate script specs to tests, and group into desktop/ and cli/ --- .github/workflows/cli-artifact-acceptance.yml | 17 +- .github/workflows/cli-channel-authority.yml | 2 +- .github/workflows/cli-installer-smoke.yml | 87 ++-- .github/workflows/desktop-package-smoke.yml | 34 +- .github/workflows/release-cli-benchmark.yml | 6 +- .../workflows/release-desktop-platform.yml | 14 +- .github/workflows/release-desktop-replay.yml | 8 +- .github/workflows/release.yml | 86 ++-- .github/workflows/windows-cli-preview.yml | 10 +- package.json | 53 +-- scripts/build-bun-alice-feasibility.ts | 268 ----------- scripts/build-bun-cli-feasibility.ts | 141 ------ scripts/build-bun-runtime-feasibility.ts | 444 ------------------ scripts/bun-broker-pack-fixture.ts | 182 ------- scripts/{ => cli}/build-bun-release.ts | 6 +- .../{ => cli}/build-cli-package-channels.mjs | 4 +- .../{ => cli}/build-windows-cli-preview.ts | 4 +- scripts/{ => cli}/bun-compile-options.ts | 0 scripts/{ => cli}/bun-native-pty-smoke.ts | 4 +- .../bun-release-content-identity.mjs | 0 scripts/{ => cli}/bun-toolchain.mjs | 2 +- scripts/{ => cli}/cli-aur-container-smoke.mjs | 4 +- .../{ => cli}/cli-legacy-cutover-smoke.mjs | 2 +- scripts/{ => cli}/cli-linuxbrew-smoke.mjs | 4 +- .../{ => cli}/cli-package-manager-smoke.mjs | 2 +- scripts/{ => cli}/cli-release-fixture.mjs | 2 +- .../cli-system-package-manager-smoke.mjs | 0 scripts/{ => cli}/dev-broker-binding.mjs | 0 scripts/{ => cli}/install-channel-smoke.mjs | 4 +- .../install-channel-smoke/Dockerfile | 2 +- .../{ => cli}/install-channel-smoke/run.sh | 0 scripts/{ => cli}/install-docker-smoke.mjs | 4 +- scripts/{ => cli}/install-smoke/Dockerfile | 4 +- .../{ => cli}/install-smoke/interactive.sh | 0 scripts/{ => cli}/install-smoke/run.sh | 0 scripts/{ => cli}/macho-signature.mjs | 0 .../{ => cli}/native-upgrade-acceptance.mjs | 0 scripts/{ => cli}/pack-cli-npm-packages.mjs | 2 +- .../preflight-public-cli-authority.mjs | 0 scripts/{ => cli}/prepare-cli-dev-assets.mjs | 6 +- .../{ => cli}/prepare-cli-neutral-inputs.mjs | 0 .../prepare-cli-previous-release.mjs | 0 .../{ => cli}/publish-cli-npm-packages.mjs | 0 scripts/{ => cli}/release-artifacts.mjs | 0 .../{ => cli}/release-candidate-identity.mjs | 2 +- scripts/{ => cli}/remote-smoke/Dockerfile | 2 +- scripts/{ => cli}/remote-smoke/entrypoint.sh | 0 .../{ => cli}/remote-ssh-smoke-options.mjs | 0 .../{ => cli}/remote-ssh-smoke-targets.mjs | 0 scripts/{ => cli}/remote-ssh-smoke.mjs | 12 +- .../remote-upgrade-recovery-smoke.mjs | 4 +- .../{ => cli}/select-release-candidate.mjs | 0 scripts/{ => cli}/select-release-verifier.mjs | 0 scripts/{ => cli}/sign-cli-macos.mjs | 0 scripts/{ => cli}/stage-cli-release.mjs | 2 +- scripts/{ => cli}/verify-cli-release.mjs | 2 +- .../{ => cli}/verify-public-cli-channels.mjs | 2 +- .../{ => cli}/windows-cli-package-smoke.ps1 | 2 +- .../{ => cli}/windows-cli-preview-smoke.ts | 0 .../{ => desktop}/assert-desktop-package.mjs | 2 +- scripts/{ => desktop}/build-desktop-relay.mjs | 2 +- scripts/{ => desktop}/desktop-after-pack.mjs | 0 .../desktop-candidate-receipt.mjs | 2 +- .../desktop-existing-owner-smoke.mjs | 2 +- .../desktop-package-artifact.mjs | 2 +- .../desktop-packaged-smoke-plan.mjs | 0 .../{ => desktop}/desktop-packaged-smoke.mjs | 8 +- scripts/{ => desktop}/desktop-pty-smoke.mjs | 2 +- .../{ => desktop}/desktop-smoke-process.mjs | 2 +- .../{ => desktop}/desktop-startup-smoke.mjs | 2 +- .../desktop-upgrade-smoke-lib.mjs | 0 .../{ => desktop}/desktop-upgrade-smoke.mjs | 2 +- .../prepare-desktop-release-assets.mjs | 6 +- .../smoke-packaged-toolchain.mjs | 2 +- .../{ => desktop}/vendor-managed-runtime.mjs | 7 +- .../verify-desktop-update-assets.mjs | 0 .../workspace-acceptance-ai-mock.mjs | 0 .../workspace-acceptance-receipt.mjs | 0 scripts/electron-demo/run.mjs | 2 +- scripts/fix-pty-perms.mjs | 36 -- scripts/generate-star-history.mjs | 400 ---------------- scripts/generate-star-history.spec.ts | 109 ----- scripts/guardian/shared.ts | 5 +- scripts/migrate-order-sentinels.ts | 125 ----- scripts/normalize-office-coworker-pair.py | 70 --- scripts/package-office-coworker-sheet.py | 131 ------ scripts/package-office-route-assets.py | 52 -- scripts/repair-office-alice-side-gait.py | 45 -- scripts/verify-broker-packs.ts | 6 +- scripts/windows-cli-preview.spec.ts | 83 ---- .../build-cli-package-channels.spec.mjs | 6 +- .../cli-release-fixture.spec.mjs | 8 +- .../cli-signature.spec.mjs | 6 +- .../prepare-cli-dev-assets.spec.mjs | 8 +- .../verify-cli-release.spec.mjs | 12 +- .../desktop-candidate-receipt.spec.mjs | 6 +- .../desktop-smoke-isolation.spec.ts | 2 +- .../desktop-smoke-process.spec.mjs | 2 +- .../select-release-verifier.spec.mjs | 2 +- .../tooling}/assert-desktop-package.spec.ts | 4 +- .../bun-release-content-identity.spec.mjs | 2 +- .../classify-beta-release-prep.spec.mjs | 2 +- .../tooling}/cli-aur-container-smoke.spec.mjs | 8 +- .../cli-legacy-cutover-smoke.spec.mjs | 4 +- .../tooling}/cli-linuxbrew-smoke.spec.mjs | 2 +- .../tooling}/desktop-after-pack.spec.ts | 2 +- .../tooling}/desktop-package-artifact.spec.ts | 2 +- .../desktop-packaged-smoke-plan.spec.ts | 2 +- .../desktop-upgrade-smoke-lib.spec.ts | 6 +- .../tooling}/dev-hot-reload.spec.ts | 2 +- .../integration/tooling}/dev-options.spec.ts | 2 +- .../tooling}/onboarding-ai-mock.spec.ts | 2 +- .../tooling}/onboarding-test-env.spec.ts | 2 +- .../tooling}/pack-cli-npm-packages.spec.mjs | 2 +- .../integration/tooling}/pnpm-command.spec.ts | 4 +- .../preflight-public-cli-authority.spec.mjs | 2 +- .../prepare-cli-neutral-inputs.spec.mjs | 2 +- .../prepare-desktop-release-assets.spec.ts | 8 +- .../integration/tooling}/prod-ports.spec.ts | 2 +- .../publish-cli-npm-packages.spec.mjs | 2 +- .../tooling}/release-artifacts.spec.mjs | 6 +- .../release-candidate-identity.spec.mjs | 2 +- .../remote-ssh-smoke-options.spec.mjs | 2 +- .../remote-ssh-smoke-targets.spec.mjs | 2 +- .../tooling}/runtime-process-spec.spec.ts | 2 +- .../select-release-candidate.spec.mjs | 2 +- .../integration/tooling}/shared.spec.ts | 2 +- .../tooling}/smoke-packaged-toolchain.spec.ts | 2 +- .../integration/tooling}/system-proxy.spec.ts | 8 +- .../tooling}/vendor-managed-runtime.spec.ts | 2 +- .../verify-desktop-update-assets.spec.ts | 2 +- .../verify-public-cli-channels.spec.mjs | 2 +- .../workspace-acceptance-ai-mock.spec.ts | 2 +- .../workspace-acceptance-receipt.spec.ts | 4 +- tests/tsconfig.json | 3 +- ui/public/office/coworkers/README.md | 5 +- ui/public/office/packs/README.md | 3 +- vitest.integration.config.ts | 2 +- 138 files changed, 304 insertions(+), 2406 deletions(-) delete mode 100644 scripts/build-bun-alice-feasibility.ts delete mode 100644 scripts/build-bun-cli-feasibility.ts delete mode 100644 scripts/build-bun-runtime-feasibility.ts delete mode 100644 scripts/bun-broker-pack-fixture.ts rename scripts/{ => cli}/build-bun-release.ts (99%) rename scripts/{ => cli}/build-cli-package-channels.mjs (99%) rename scripts/{ => cli}/build-windows-cli-preview.ts (98%) rename scripts/{ => cli}/bun-compile-options.ts (100%) rename scripts/{ => cli}/bun-native-pty-smoke.ts (97%) rename scripts/{ => cli}/bun-release-content-identity.mjs (100%) rename scripts/{ => cli}/bun-toolchain.mjs (88%) rename scripts/{ => cli}/cli-aur-container-smoke.mjs (97%) rename scripts/{ => cli}/cli-legacy-cutover-smoke.mjs (99%) rename scripts/{ => cli}/cli-linuxbrew-smoke.mjs (96%) rename scripts/{ => cli}/cli-package-manager-smoke.mjs (98%) rename scripts/{ => cli}/cli-release-fixture.mjs (98%) rename scripts/{ => cli}/cli-system-package-manager-smoke.mjs (100%) rename scripts/{ => cli}/dev-broker-binding.mjs (100%) rename scripts/{ => cli}/install-channel-smoke.mjs (96%) rename scripts/{ => cli}/install-channel-smoke/Dockerfile (88%) rename scripts/{ => cli}/install-channel-smoke/run.sh (100%) rename scripts/{ => cli}/install-docker-smoke.mjs (95%) rename scripts/{ => cli}/install-smoke/Dockerfile (75%) rename scripts/{ => cli}/install-smoke/interactive.sh (100%) rename scripts/{ => cli}/install-smoke/run.sh (100%) rename scripts/{ => cli}/macho-signature.mjs (100%) rename scripts/{ => cli}/native-upgrade-acceptance.mjs (100%) rename scripts/{ => cli}/pack-cli-npm-packages.mjs (98%) rename scripts/{ => cli}/preflight-public-cli-authority.mjs (100%) rename scripts/{ => cli}/prepare-cli-dev-assets.mjs (96%) rename scripts/{ => cli}/prepare-cli-neutral-inputs.mjs (100%) rename scripts/{ => cli}/prepare-cli-previous-release.mjs (100%) rename scripts/{ => cli}/publish-cli-npm-packages.mjs (100%) rename scripts/{ => cli}/release-artifacts.mjs (100%) rename scripts/{ => cli}/release-candidate-identity.mjs (98%) rename scripts/{ => cli}/remote-smoke/Dockerfile (97%) rename scripts/{ => cli}/remote-smoke/entrypoint.sh (100%) rename scripts/{ => cli}/remote-ssh-smoke-options.mjs (100%) rename scripts/{ => cli}/remote-ssh-smoke-targets.mjs (100%) rename scripts/{ => cli}/remote-ssh-smoke.mjs (98%) rename scripts/{ => cli}/remote-upgrade-recovery-smoke.mjs (96%) rename scripts/{ => cli}/select-release-candidate.mjs (100%) rename scripts/{ => cli}/select-release-verifier.mjs (100%) rename scripts/{ => cli}/sign-cli-macos.mjs (100%) rename scripts/{ => cli}/stage-cli-release.mjs (98%) rename scripts/{ => cli}/verify-cli-release.mjs (98%) rename scripts/{ => cli}/verify-public-cli-channels.mjs (98%) rename scripts/{ => cli}/windows-cli-package-smoke.ps1 (96%) rename scripts/{ => cli}/windows-cli-preview-smoke.ts (100%) rename scripts/{ => desktop}/assert-desktop-package.mjs (99%) rename scripts/{ => desktop}/build-desktop-relay.mjs (80%) rename scripts/{ => desktop}/desktop-after-pack.mjs (100%) rename scripts/{ => desktop}/desktop-candidate-receipt.mjs (98%) rename scripts/{ => desktop}/desktop-existing-owner-smoke.mjs (99%) rename scripts/{ => desktop}/desktop-package-artifact.mjs (98%) rename scripts/{ => desktop}/desktop-packaged-smoke-plan.mjs (100%) rename scripts/{ => desktop}/desktop-packaged-smoke.mjs (98%) rename scripts/{ => desktop}/desktop-pty-smoke.mjs (99%) rename scripts/{ => desktop}/desktop-smoke-process.mjs (97%) rename scripts/{ => desktop}/desktop-startup-smoke.mjs (97%) rename scripts/{ => desktop}/desktop-upgrade-smoke-lib.mjs (100%) rename scripts/{ => desktop}/desktop-upgrade-smoke.mjs (99%) rename scripts/{ => desktop}/prepare-desktop-release-assets.mjs (98%) rename scripts/{ => desktop}/smoke-packaged-toolchain.mjs (99%) rename scripts/{ => desktop}/vendor-managed-runtime.mjs (99%) rename scripts/{ => desktop}/verify-desktop-update-assets.mjs (100%) rename scripts/{ => desktop}/workspace-acceptance-ai-mock.mjs (100%) rename scripts/{ => desktop}/workspace-acceptance-receipt.mjs (100%) delete mode 100644 scripts/fix-pty-perms.mjs delete mode 100644 scripts/generate-star-history.mjs delete mode 100644 scripts/generate-star-history.spec.ts delete mode 100644 scripts/migrate-order-sentinels.ts delete mode 100644 scripts/normalize-office-coworker-pair.py delete mode 100644 scripts/package-office-coworker-sheet.py delete mode 100644 scripts/package-office-route-assets.py delete mode 100644 scripts/repair-office-alice-side-gait.py delete mode 100644 scripts/windows-cli-preview.spec.ts rename {scripts => tests/integration/tooling}/assert-desktop-package.spec.ts (99%) rename {scripts => tests/integration/tooling}/bun-release-content-identity.spec.mjs (97%) rename {scripts => tests/integration/tooling}/classify-beta-release-prep.spec.mjs (98%) rename {scripts => tests/integration/tooling}/cli-aur-container-smoke.spec.mjs (89%) rename {scripts => tests/integration/tooling}/cli-legacy-cutover-smoke.spec.mjs (96%) rename {scripts => tests/integration/tooling}/cli-linuxbrew-smoke.spec.mjs (94%) rename {scripts => tests/integration/tooling}/desktop-after-pack.spec.ts (95%) rename {scripts => tests/integration/tooling}/desktop-package-artifact.spec.ts (98%) rename {scripts => tests/integration/tooling}/desktop-packaged-smoke-plan.spec.ts (98%) rename {scripts => tests/integration/tooling}/desktop-upgrade-smoke-lib.spec.ts (98%) rename {scripts/guardian => tests/integration/tooling}/dev-hot-reload.spec.ts (96%) rename {scripts/guardian => tests/integration/tooling}/dev-options.spec.ts (94%) rename {scripts => tests/integration/tooling}/onboarding-ai-mock.spec.ts (97%) rename {scripts => tests/integration/tooling}/onboarding-test-env.spec.ts (97%) rename {scripts => tests/integration/tooling}/pack-cli-npm-packages.spec.mjs (97%) rename {scripts => tests/integration/tooling}/pnpm-command.spec.ts (94%) rename {scripts => tests/integration/tooling}/preflight-public-cli-authority.spec.mjs (99%) rename {scripts => tests/integration/tooling}/prepare-cli-neutral-inputs.spec.mjs (99%) rename {scripts => tests/integration/tooling}/prepare-desktop-release-assets.spec.ts (96%) rename {scripts/guardian => tests/integration/tooling}/prod-ports.spec.ts (98%) rename {scripts => tests/integration/tooling}/publish-cli-npm-packages.spec.mjs (98%) rename {scripts => tests/integration/tooling}/release-artifacts.spec.mjs (89%) rename {scripts => tests/integration/tooling}/release-candidate-identity.spec.mjs (97%) rename {scripts => tests/integration/tooling}/remote-ssh-smoke-options.spec.mjs (94%) rename {scripts => tests/integration/tooling}/remote-ssh-smoke-targets.spec.mjs (97%) rename {scripts/guardian => tests/integration/tooling}/runtime-process-spec.spec.ts (90%) rename {scripts => tests/integration/tooling}/select-release-candidate.spec.mjs (97%) rename {scripts/guardian => tests/integration/tooling}/shared.spec.ts (99%) rename {scripts => tests/integration/tooling}/smoke-packaged-toolchain.spec.ts (99%) rename {scripts/guardian => tests/integration/tooling}/system-proxy.spec.ts (94%) rename {scripts => tests/integration/tooling}/vendor-managed-runtime.spec.ts (98%) rename {scripts => tests/integration/tooling}/verify-desktop-update-assets.spec.ts (98%) rename {scripts => tests/integration/tooling}/verify-public-cli-channels.spec.mjs (96%) rename {scripts => tests/integration/tooling}/workspace-acceptance-ai-mock.spec.ts (94%) rename {scripts => tests/integration/tooling}/workspace-acceptance-receipt.spec.ts (94%) diff --git a/.github/workflows/cli-artifact-acceptance.yml b/.github/workflows/cli-artifact-acceptance.yml index 34099e386..e5c47c4f9 100644 --- a/.github/workflows/cli-artifact-acceptance.yml +++ b/.github/workflows/cli-artifact-acceptance.yml @@ -6,12 +6,12 @@ on: paths: - '.bun-version' - '.github/workflows/cli-artifact-acceptance.yml' - - 'scripts/bun-toolchain.mjs' - - 'scripts/macho-signature.mjs' - - 'scripts/sign-cli-macos.mjs' - - 'scripts/verify-cli-release*' - - 'scripts/build-bun-*' - - 'scripts/bun-compile-options.ts' + - 'scripts/cli/bun-toolchain.mjs' + - 'scripts/cli/macho-signature.mjs' + - 'scripts/cli/sign-cli-macos.mjs' + - 'scripts/cli/verify-cli-release*' + - 'scripts/cli/build-bun-*' + - 'scripts/cli/bun-compile-options.ts' - 'packages/cli/bin/openalice-bun.ts' workflow_dispatch: @@ -49,10 +49,9 @@ jobs: - run: pnpm install --frozen-lockfile --filter='!@traderalice/desktop' - run: pnpm build:server - run: pnpm exec vitest run tests/integration/cli-release-artifacts/cli-signature.spec.mjs tests/integration/cli-release-artifacts/verify-cli-release.spec.mjs - - run: pnpm build:bun-runtime:feasibility - run: pnpm build:bun:release - name: Verify the packaged bytes again - run: node scripts/verify-cli-release.mjs dist/bun-release + run: node scripts/cli/verify-cli-release.mjs dist/bun-release - uses: actions/upload-artifact@v4 with: name: cli-candidate-${{ matrix.platform }}-${{ matrix.arch }}-${{ github.event.pull_request.head.sha || github.sha }} @@ -82,5 +81,5 @@ jobs: - name: Verify each preserved candidate without executing macOS bytes run: | for directory in candidates/*; do - node scripts/verify-cli-release.mjs "$directory" + node scripts/cli/verify-cli-release.mjs "$directory" done diff --git a/.github/workflows/cli-channel-authority.yml b/.github/workflows/cli-channel-authority.yml index c0a471494..d129c6559 100644 --- a/.github/workflows/cli-channel-authority.yml +++ b/.github/workflows/cli-channel-authority.yml @@ -41,7 +41,7 @@ jobs: fi - name: Verify selected channel authority without publishing - run: node scripts/preflight-public-cli-authority.mjs + run: node scripts/cli/preflight-public-cli-authority.mjs env: OPENALICE_PUBLISH_HOMEBREW: ${{ inputs.homebrew }} OPENALICE_PUBLISH_AUR: ${{ inputs.aur }} diff --git a/.github/workflows/cli-installer-smoke.yml b/.github/workflows/cli-installer-smoke.yml index 5be06ea8c..49cf46b4a 100644 --- a/.github/workflows/cli-installer-smoke.yml +++ b/.github/workflows/cli-installer-smoke.yml @@ -31,41 +31,37 @@ on: - "packages/uta-protocol/**" - "src/**" - "ui/**" - - "scripts/install-docker-smoke.mjs" - - "scripts/install-channel-smoke.mjs" - - "scripts/install-channel-smoke/**" - - "scripts/install-smoke/**" - - "scripts/build-bun-cli-feasibility.ts" - - "scripts/build-bun-alice-feasibility.ts" - - "scripts/bun-broker-pack-fixture.ts" - - "scripts/build-bun-runtime-feasibility.ts" - - "scripts/build-bun-release.ts" - - "scripts/bun-toolchain.mjs" - - "scripts/macho-signature.mjs" - - "scripts/sign-cli-macos.mjs" - - "scripts/verify-cli-release.mjs" - - "scripts/build-cli-package-channels.mjs" + - "scripts/cli/install-docker-smoke.mjs" + - "scripts/cli/install-channel-smoke.mjs" + - "scripts/cli/install-channel-smoke/**" + - "scripts/cli/install-smoke/**" + - "scripts/cli/build-bun-release.ts" + - "scripts/cli/bun-toolchain.mjs" + - "scripts/cli/macho-signature.mjs" + - "scripts/cli/sign-cli-macos.mjs" + - "scripts/cli/verify-cli-release.mjs" + - "scripts/cli/build-cli-package-channels.mjs" - "tests/integration/cli-release-artifacts/build-cli-package-channels.spec.mjs" - - "scripts/pack-cli-npm-packages.mjs" - - "scripts/pack-cli-npm-packages.spec.mjs" - - "scripts/cli-package-manager-smoke.mjs" - - "scripts/cli-release-fixture.mjs" + - "scripts/cli/pack-cli-npm-packages.mjs" + - "tests/integration/tooling/pack-cli-npm-packages.spec.mjs" + - "scripts/cli/cli-package-manager-smoke.mjs" + - "scripts/cli/cli-release-fixture.mjs" - "tests/integration/cli-release-artifacts/cli-release-fixture.spec.mjs" - - "scripts/cli-system-package-manager-smoke.mjs" - - "scripts/cli-aur-container-smoke.mjs" - - "scripts/cli-aur-container-smoke.spec.mjs" - - "scripts/cli-linuxbrew-smoke.mjs" - - "scripts/cli-linuxbrew-smoke.spec.mjs" - - "scripts/cli-legacy-cutover-smoke.mjs" - - "scripts/cli-legacy-cutover-smoke.spec.mjs" - - "scripts/prepare-cli-previous-release.mjs" - - "scripts/prepare-cli-dev-assets.mjs" + - "scripts/cli/cli-system-package-manager-smoke.mjs" + - "scripts/cli/cli-aur-container-smoke.mjs" + - "tests/integration/tooling/cli-aur-container-smoke.spec.mjs" + - "scripts/cli/cli-linuxbrew-smoke.mjs" + - "tests/integration/tooling/cli-linuxbrew-smoke.spec.mjs" + - "scripts/cli/cli-legacy-cutover-smoke.mjs" + - "tests/integration/tooling/cli-legacy-cutover-smoke.spec.mjs" + - "scripts/cli/prepare-cli-previous-release.mjs" + - "scripts/cli/prepare-cli-dev-assets.mjs" - "tests/integration/cli-release-artifacts/prepare-cli-dev-assets.spec.mjs" - - "scripts/prepare-cli-neutral-inputs.mjs" - - "scripts/prepare-cli-neutral-inputs.spec.mjs" + - "scripts/cli/prepare-cli-neutral-inputs.mjs" + - "tests/integration/tooling/prepare-cli-neutral-inputs.spec.mjs" - "THIRD_PARTY_NOTICES.md" - - "scripts/remote-ssh-smoke.mjs" - - "scripts/remote-smoke/**" + - "scripts/cli/remote-ssh-smoke.mjs" + - "scripts/cli/remote-smoke/**" push: branches: [dev] @@ -151,31 +147,26 @@ jobs: - run: pnpm build:server - - run: pnpm build:bun-cli:feasibility - - - run: pnpm build:bun-alice:feasibility - - - run: pnpm build:bun-runtime:feasibility - - run: pnpm build:bun:release + - name: Accept npm and Bun installs from the current native candidate shell: bash run: | VERSION=$(node -p "require('./package.json').version") CONTENT_IDENTITY=$(node -p "require('./dist/bun-release/report.json').contentIdentity") - node scripts/build-cli-package-channels.mjs \ + node scripts/cli/build-cli-package-channels.mjs \ --input-dir dist/bun-release \ --output-dir "$RUNNER_TEMP/cli-package-channels" \ --version "$VERSION" \ --released-at "$(date -u +%Y-%m-%dT%H:%M:%SZ)" \ --npm-only - node scripts/cli-package-manager-smoke.mjs \ + node scripts/cli/cli-package-manager-smoke.mjs \ --manager npm \ --packages-dir "$RUNNER_TEMP/cli-package-channels/npm" \ --expected-version "$VERSION" \ --expected-content-identity "$CONTENT_IDENTITY" - node scripts/cli-package-manager-smoke.mjs \ + node scripts/cli/cli-package-manager-smoke.mjs \ --manager bun \ --packages-dir "$RUNNER_TEMP/cli-package-channels/npm" \ --expected-version "$VERSION" \ @@ -203,7 +194,7 @@ jobs: node-version: 22.19.0 - name: Exercise clean HTTP installer fixture - run: node scripts/install-docker-smoke.mjs + run: node scripts/cli/install-docker-smoke.mjs checkout-remote: needs: release-prep-scope @@ -236,7 +227,7 @@ jobs: run: pnpm exec turbo run build --filter=open-alice-ui... - name: Exercise clean SSH host fixture - run: node scripts/remote-ssh-smoke.mjs --skip-tui + run: node scripts/cli/remote-ssh-smoke.mjs --skip-tui build-dev-cli-neutral: if: github.event_name == 'push' @@ -261,7 +252,7 @@ jobs: - name: Prepare commit-bound neutral input receipt run: >- - node scripts/prepare-cli-neutral-inputs.mjs prepare + node scripts/cli/prepare-cli-neutral-inputs.mjs prepare --repository-root . --output-dir dist/dev-neutral-inputs --commit "$GITHUB_SHA" @@ -361,16 +352,12 @@ jobs: - name: Verify and install commit-bound neutral inputs run: >- - node scripts/prepare-cli-neutral-inputs.mjs verify + node scripts/cli/prepare-cli-neutral-inputs.mjs verify --repository-root . --input-dir dist/dev-neutral-inputs --commit "$GITHUB_SHA" --install - - name: Accept multiprocess recovery once per dev commit - if: matrix.platform == 'linux' && matrix.arch == 'x64' - run: pnpm build:bun-runtime:feasibility - - uses: actions/download-artifact@v4 with: name: dev-broker-${{ matrix.platform }}-${{ matrix.arch }} @@ -438,7 +425,7 @@ jobs: - name: Validate candidates and prepare candidate receipt run: | VERSION=$(node -p "require('./package.json').version") - node scripts/prepare-cli-dev-assets.mjs \ + node scripts/cli/prepare-cli-dev-assets.mjs \ --input-dir dist/dev-cli-candidates \ --output-dir dist/dev-cli-upload \ --commit "$GITHUB_SHA" \ @@ -661,4 +648,4 @@ jobs: if [[ -n "$EXPECTED_COMMIT" ]]; then args+=(--expected-commit "$EXPECTED_COMMIT") fi - node scripts/install-channel-smoke.mjs "${args[@]}" + node scripts/cli/install-channel-smoke.mjs "${args[@]}" diff --git a/.github/workflows/desktop-package-smoke.yml b/.github/workflows/desktop-package-smoke.yml index f390f1c1c..9c010307a 100644 --- a/.github/workflows/desktop-package-smoke.yml +++ b/.github/workflows/desktop-package-smoke.yml @@ -18,27 +18,27 @@ on: - "build/entitlements*.plist" - "package.json" - "pnpm-lock.yaml" - - "scripts/assert-desktop-package.mjs" - - "scripts/desktop-after-pack.mjs" - - "scripts/desktop-package-artifact.mjs" - - "scripts/desktop-packaged-smoke.mjs" - - "scripts/desktop-packaged-smoke-plan.mjs" - - "scripts/desktop-upgrade-smoke.mjs" - - "scripts/desktop-upgrade-smoke-lib.mjs" - - "scripts/desktop-existing-owner-smoke.mjs" + - "scripts/desktop/assert-desktop-package.mjs" + - "scripts/desktop/desktop-after-pack.mjs" + - "scripts/desktop/desktop-package-artifact.mjs" + - "scripts/desktop/desktop-packaged-smoke.mjs" + - "scripts/desktop/desktop-packaged-smoke-plan.mjs" + - "scripts/desktop/desktop-upgrade-smoke.mjs" + - "scripts/desktop/desktop-upgrade-smoke-lib.mjs" + - "scripts/desktop/desktop-existing-owner-smoke.mjs" - "scripts/build-broker-packs.ts" - "scripts/broker-pack-upgrade-smoke.ts" - "scripts/guardian/**" - "scripts/pnpm-command.mjs" - - "scripts/pnpm-command.spec.ts" - - "scripts/prepare-desktop-release-assets.mjs" - - "scripts/verify-desktop-update-assets.mjs" - - "scripts/smoke-packaged-toolchain.mjs" + - "tests/integration/tooling/pnpm-command.spec.ts" + - "scripts/desktop/prepare-desktop-release-assets.mjs" + - "scripts/desktop/verify-desktop-update-assets.mjs" + - "scripts/desktop/smoke-packaged-toolchain.mjs" - "scripts/verify-broker-packs.ts" - - "scripts/workspace-acceptance-ai-mock.mjs" - - "scripts/workspace-acceptance-receipt.mjs" - - "scripts/workspace-acceptance-receipt.spec.ts" - - "scripts/vendor-managed-runtime.mjs" + - "scripts/desktop/workspace-acceptance-ai-mock.mjs" + - "scripts/desktop/workspace-acceptance-receipt.mjs" + - "tests/integration/tooling/workspace-acceptance-receipt.spec.ts" + - "scripts/desktop/vendor-managed-runtime.mjs" - "default/**" - "src/ai-providers/**" - "src/core/**" @@ -190,7 +190,7 @@ jobs: node -e "const{existsSync}=require('fs');const{dirname,join}=require('path');const g=join(dirname(require.resolve('dugite/package.json')),'git');if(!existsSync(g)){console.error('dugite embedded git MISSING at '+g);process.exit(1)}console.log('dugite embedded git OK '+g)" - name: Verify package inspectors on the native host - run: pnpm exec vitest run scripts/assert-desktop-package.spec.ts scripts/desktop-after-pack.spec.ts scripts/smoke-packaged-toolchain.spec.ts + run: pnpm exec vitest run --config vitest.integration.config.ts tests/integration/tooling/assert-desktop-package.spec.ts tests/integration/tooling/desktop-after-pack.spec.ts tests/integration/tooling/smoke-packaged-toolchain.spec.ts - name: Build Alice + UTA + desktop shell run: pnpm electron:build diff --git a/.github/workflows/release-cli-benchmark.yml b/.github/workflows/release-cli-benchmark.yml index 5c589cde2..0cba58247 100644 --- a/.github/workflows/release-cli-benchmark.yml +++ b/.github/workflows/release-cli-benchmark.yml @@ -22,7 +22,7 @@ jobs: run: pnpm build:server - name: Prepare exact-commit inputs run: >- - node scripts/prepare-cli-neutral-inputs.mjs prepare + node scripts/cli/prepare-cli-neutral-inputs.mjs prepare --repository-root . --output-dir dist/benchmark-neutral --commit "$GITHUB_SHA" - name: Upload shared inputs @@ -66,11 +66,9 @@ jobs: - name: Verify and restore shared inputs if: matrix.mode == 'restore' run: >- - node scripts/prepare-cli-neutral-inputs.mjs verify + node scripts/cli/prepare-cli-neutral-inputs.mjs verify --repository-root . --input-dir dist/benchmark-neutral --commit "$GITHUB_SHA" --install - - name: Accept real multiprocess Runtime - run: pnpm build:bun-runtime:feasibility - name: Build and accept real native archive run: pnpm build:bun:release - name: Preserve acceptance reports only diff --git a/.github/workflows/release-desktop-platform.yml b/.github/workflows/release-desktop-platform.yml index 36b188b30..4dbf78962 100644 --- a/.github/workflows/release-desktop-platform.yml +++ b/.github/workflows/release-desktop-platform.yml @@ -139,7 +139,7 @@ jobs: RELEASE_ARCH: ${{ inputs.arch }} run: | VERSION=$(node -p "require('./package.json').version") - node scripts/prepare-desktop-release-assets.mjs build \ + node scripts/desktop/prepare-desktop-release-assets.mjs build \ --out-dir dist/electron-app \ --platform "$RELEASE_PLATFORM" \ --arch "$RELEASE_ARCH" \ @@ -161,7 +161,7 @@ jobs: - name: Record desktop candidate identity id: identity - run: node scripts/desktop-candidate-receipt.mjs create dist/electron-app + run: node scripts/desktop/desktop-candidate-receipt.mjs create dist/electron-app - name: Preserve desktop release candidate uses: actions/upload-artifact@v4 @@ -202,16 +202,16 @@ jobs: CANDIDATE_RUN: ${{ inputs.candidate-run }} CANDIDATE_TARGET: ${{ runner.os }}-${{ inputs.arch }} CANDIDATE_REHEARSAL_BRANCH: ${{ inputs.rehearsal && github.ref_name || '' }} - run: node scripts/select-release-candidate.mjs "$CANDIDATE_RUN" "$CANDIDATE_SOURCE_SHA" "$CANDIDATE_TARGET" + run: node scripts/cli/select-release-candidate.mjs "$CANDIDATE_RUN" "$CANDIDATE_SOURCE_SHA" "$CANDIDATE_TARGET" - name: Download exact selected candidate ID env: GH_TOKEN: ${{ github.token }} SELECTED_ARTIFACT_ID: ${{ steps.select.outputs.artifact-id }} shell: bash - run: node scripts/release-artifacts.mjs "$SELECTED_ARTIFACT_ID" dist/electron-app + run: node scripts/cli/release-artifacts.mjs "$SELECTED_ARTIFACT_ID" dist/electron-app - name: Verify restored product and exact bytes id: identity - run: node scripts/desktop-candidate-receipt.mjs verify-selected dist/electron-app + run: node scripts/desktop/desktop-candidate-receipt.mjs verify-selected dist/electron-app - name: Preserve unchanged candidate in this run uses: actions/upload-artifact@v4 with: @@ -258,7 +258,7 @@ jobs: path: dist/electron-app - name: Verify restored desktop candidate identity - run: node scripts/desktop-candidate-receipt.mjs verify dist/electron-app + run: node scripts/desktop/desktop-candidate-receipt.mjs verify dist/electron-app - name: Prove final desktop artifact upgrades previous release state run: >- @@ -270,7 +270,7 @@ jobs: - name: Bind upgrade acceptance to candidate identity run: >- - node scripts/desktop-candidate-receipt.mjs bind-upgrade dist/electron-app + node scripts/desktop/desktop-candidate-receipt.mjs bind-upgrade dist/electron-app "${{ runner.temp }}/openalice-desktop-upgrade.json" - name: Preserve desktop upgrade acceptance receipt diff --git a/.github/workflows/release-desktop-replay.yml b/.github/workflows/release-desktop-replay.yml index dc0816c29..bd68b366b 100644 --- a/.github/workflows/release-desktop-replay.yml +++ b/.github/workflows/release-desktop-replay.yml @@ -58,15 +58,15 @@ jobs: GH_TOKEN: ${{ github.token }} CANDIDATE_TARGET: ${{ runner.os }}-${{ inputs.arch }} CANDIDATE_REHEARSAL_BRANCH: ${{ inputs.rehearsal && github.ref_name || '' }} - run: node scripts/select-release-candidate.mjs "$CANDIDATE_RUN" "$CANDIDATE_SOURCE_SHA" "$CANDIDATE_TARGET" + run: node scripts/cli/select-release-candidate.mjs "$CANDIDATE_RUN" "$CANDIDATE_SOURCE_SHA" "$CANDIDATE_TARGET" - name: Download exact selected candidate ID env: GH_TOKEN: ${{ github.token }} SELECTED_ARTIFACT_ID: ${{ steps.candidate.outputs.artifact-id }} shell: bash - run: node scripts/release-artifacts.mjs "$SELECTED_ARTIFACT_ID" dist/electron-app + run: node scripts/cli/release-artifacts.mjs "$SELECTED_ARTIFACT_ID" dist/electron-app - name: Verify selected candidate bytes - run: node scripts/desktop-candidate-receipt.mjs verify-selected dist/electron-app + run: node scripts/desktop/desktop-candidate-receipt.mjs verify-selected dist/electron-app - uses: pnpm/action-setup@v6 - run: pnpm install --frozen-lockfile - name: Accept preserved final artifact without rebuilding @@ -79,7 +79,7 @@ jobs: - name: Bind acceptance to unchanged bytes and current verifier shell: bash run: >- - node scripts/desktop-candidate-receipt.mjs bind-upgrade dist/electron-app + node scripts/desktop/desktop-candidate-receipt.mjs bind-upgrade dist/electron-app "$RUNNER_TEMP/openalice-desktop-upgrade.json" - uses: actions/upload-artifact@v4 with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 82d3ce7ca..965af5724 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -167,7 +167,7 @@ jobs: fi BASE_URL="${DOWNLOAD_BASE_URL:-https://download.openalice.ai}" curl -fsSL "${BASE_URL%/}/${MANIFEST_PATH}" -o "$RUNNER_TEMP/openalice-intent-head.json" - HEAD_SHA256=$(node scripts/prepare-desktop-release-assets.mjs check-publication \ + HEAD_SHA256=$(node scripts/desktop/prepare-desktop-release-assets.mjs check-publication \ --head-path "$RUNNER_TEMP/openalice-intent-head.json" --version "$VERSION" \ --channel "$RELEASE_CHANNEL" --operation "$OPERATION") echo "channel_head_sha256=$HEAD_SHA256" >> "$GITHUB_OUTPUT" @@ -198,7 +198,7 @@ jobs: echo "tag=$RELEASE_TAG" >> "$GITHUB_OUTPUT" echo "channel=$RELEASE_CHANNEL" >> "$GITHUB_OUTPUT" git for-each-ref --merged="$SOURCE_SHA" --format='%(refname:short)' refs/tags > "$RUNNER_TEMP/openalice-reachable-tags.txt" - PREVIOUS_TAG=$(node scripts/prepare-desktop-release-assets.mjs previous-tag \ + PREVIOUS_TAG=$(node scripts/desktop/prepare-desktop-release-assets.mjs previous-tag \ --tags-path "$RUNNER_TEMP/openalice-reachable-tags.txt" --channel "$RELEASE_CHANNEL") if [ "$OPERATION" = "release" ] && [ -z "$PREVIOUS_TAG" ]; then echo "No previous $RELEASE_CHANNEL release tag is reachable from $SOURCE_SHA" >&2 @@ -218,7 +218,7 @@ jobs: if: steps.plan.outputs.created == 'true' env: RELEASE_VERIFIER_SHA: ${{ inputs.desktop-verifier-sha }} - run: node scripts/select-release-verifier.mjs + run: node scripts/cli/select-release-verifier.mjs - name: Generate release notes if: steps.plan.outputs.created == 'true' @@ -271,7 +271,7 @@ jobs: node-version: 22.19.0 - name: Verify every opted-in public channel before release publication - run: node scripts/preflight-public-cli-authority.mjs + run: node scripts/cli/preflight-public-cli-authority.mjs env: OPENALICE_PUBLISH_NPM: ${{ vars.OPENALICE_PUBLISH_NPM }} OPENALICE_PUBLISH_HOMEBREW: ${{ vars.OPENALICE_PUBLISH_HOMEBREW }} @@ -336,7 +336,7 @@ jobs: - run: pnpm install --frozen-lockfile --filter @traderalice/openalice-cli - name: Exercise candidate installer in a clean HTTP fixture - run: node scripts/install-docker-smoke.mjs + run: node scripts/cli/install-docker-smoke.mjs - name: Build trusted local UI for Web relay if: needs.release.outputs.channel == 'stable' @@ -344,7 +344,7 @@ jobs: - name: Exercise candidate installer through managed SSH remote if: needs.release.outputs.channel == 'stable' - run: node scripts/remote-ssh-smoke.mjs --skip-tui + run: node scripts/cli/remote-ssh-smoke.mjs --skip-tui build-cli-installer: name: Build channel-neutral CLI installer snapshot @@ -402,7 +402,7 @@ jobs: - run: pnpm build:server - name: Record commit-bound platform-neutral inputs run: >- - node scripts/prepare-cli-neutral-inputs.mjs prepare + node scripts/cli/prepare-cli-neutral-inputs.mjs prepare --repository-root . --output-dir dist/release-neutral-inputs --commit "$GITHUB_SHA" - uses: actions/upload-artifact@v4 @@ -461,14 +461,12 @@ jobs: - name: Verify and install shared CLI inputs run: >- - node scripts/prepare-cli-neutral-inputs.mjs verify + node scripts/cli/prepare-cli-neutral-inputs.mjs verify --repository-root . --input-dir dist/release-neutral-inputs --commit "$GITHUB_SHA" --install - name: Build native CLI - run: | - pnpm build:bun-runtime:feasibility - pnpm build:bun:release + run: pnpm build:bun:release - name: Install and boot the native candidate outside the checkout shell: bash @@ -500,18 +498,18 @@ jobs: run: | VERSION=$(node -p "require('./package.json').version") CONTENT_IDENTITY=$(node -p "require('./dist/bun-release/report.json').contentIdentity") - node scripts/build-cli-package-channels.mjs \ + node scripts/cli/build-cli-package-channels.mjs \ --input-dir dist/bun-release \ --output-dir "$RUNNER_TEMP/cli-package-channels" \ --version "$VERSION" \ --released-at "$(date -u +%Y-%m-%dT%H:%M:%SZ)" \ --npm-only - node scripts/cli-package-manager-smoke.mjs \ + node scripts/cli/cli-package-manager-smoke.mjs \ --manager npm \ --packages-dir "$RUNNER_TEMP/cli-package-channels/npm" \ --expected-version "$VERSION" \ --expected-content-identity "$CONTENT_IDENTITY" - node scripts/cli-package-manager-smoke.mjs \ + node scripts/cli/cli-package-manager-smoke.mjs \ --manager bun \ --packages-dir "$RUNNER_TEMP/cli-package-channels/npm" \ --expected-version "$VERSION" \ @@ -573,19 +571,19 @@ jobs: CANDIDATE_VERSION: ${{ needs.release.outputs.version }} CANDIDATE_SOURCE_SHA: ${{ needs.release.outputs.source_sha }} run: >- - node scripts/stage-cli-release.mjs dist/cli-candidates dist/release-cli + node scripts/cli/stage-cli-release.mjs dist/cli-candidates dist/release-cli "$CANDIDATE_VERSION" "$CANDIDATE_SOURCE_SHA" - name: Derive package-manager metadata from accepted archives run: | VERSION=$(node -p "require('./package.json').version") - node scripts/build-cli-package-channels.mjs \ + node scripts/cli/build-cli-package-channels.mjs \ --input-dir dist/release-cli \ --output-dir dist/cli-package-channels \ --version "$VERSION" \ --released-at "$(date -u +%Y-%m-%dT%H:%M:%SZ)" \ --require-all - node scripts/pack-cli-npm-packages.mjs \ + node scripts/cli/pack-cli-npm-packages.mjs \ --input-dir dist/cli-package-channels/npm \ --output-dir dist/cli-npm-tarballs @@ -636,7 +634,7 @@ jobs: CANDIDATE_VERSION: ${{ needs.release.outputs.version }} CANDIDATE_SOURCE_SHA: ${{ needs.release.outputs.source_sha }} run: >- - node scripts/stage-cli-release.mjs dist/cli-candidates dist/release-cli + node scripts/cli/stage-cli-release.mjs dist/cli-candidates dist/release-cli "$CANDIDATE_VERSION" "$CANDIDATE_SOURCE_SHA" - name: Install and run the accepted archive through Homebrew @@ -645,20 +643,20 @@ jobs: set -euo pipefail VERSION=$(node -p "require('./package.json').version") CURRENT_ASSET_BASE_URL=$(node -e "const{pathToFileURL}=require('url');const{resolve}=require('path');process.stdout.write(pathToFileURL(resolve('dist/release-cli')).href)") - node scripts/prepare-cli-previous-release.mjs \ + node scripts/cli/prepare-cli-previous-release.mjs \ --input-dir dist/release-cli \ --output-dir dist/cli-package-homebrew-previous \ --version "$VERSION" PREVIOUS_VERSION=$(node -p "require('./dist/cli-package-homebrew-previous/fixture.json').previousVersion") PREVIOUS_ASSET_BASE_URL=$(node -e "const{pathToFileURL}=require('url');const{resolve}=require('path');process.stdout.write(pathToFileURL(resolve('dist/cli-package-homebrew-previous')).href)") - node scripts/build-cli-package-channels.mjs \ + node scripts/cli/build-cli-package-channels.mjs \ --input-dir dist/release-cli \ --output-dir dist/cli-package-homebrew-current \ --version "$VERSION" \ --released-at "$(date -u +%Y-%m-%dT%H:%M:%SZ)" \ --asset-base-url "$CURRENT_ASSET_BASE_URL" \ --system-only - node scripts/build-cli-package-channels.mjs \ + node scripts/cli/build-cli-package-channels.mjs \ --input-dir dist/cli-package-homebrew-previous \ --output-dir dist/cli-package-homebrew-previous-channels \ --version "$PREVIOUS_VERSION" \ @@ -667,7 +665,7 @@ jobs: --system-only CURRENT_ID=$(node -e "const f=require('./dist/cli-package-homebrew-current/cli-package-channels.json');process.stdout.write(f.targets.find(t=>t.platform==='darwin'&&t.arch==='${{ matrix.arch }}').contentIdentity)") PREVIOUS_ID=$(node -e "const f=require('./dist/cli-package-homebrew-previous/fixture.json');process.stdout.write(f.targets.find(t=>t.platform==='darwin'&&t.arch==='${{ matrix.arch }}').previousContentIdentity)") - node scripts/cli-system-package-manager-smoke.mjs \ + node scripts/cli/cli-system-package-manager-smoke.mjs \ --manager brew \ --previous-version "$PREVIOUS_VERSION" \ --current-version "$VERSION" \ @@ -707,7 +705,7 @@ jobs: CANDIDATE_VERSION: ${{ needs.release.outputs.version }} CANDIDATE_SOURCE_SHA: ${{ needs.release.outputs.source_sha }} run: >- - node scripts/stage-cli-release.mjs dist/cli-candidates dist/release-cli + node scripts/cli/stage-cli-release.mjs dist/cli-candidates dist/release-cli "$CANDIDATE_VERSION" "$CANDIDATE_SOURCE_SHA" - name: Install and run the accepted archive through Linuxbrew @@ -715,19 +713,19 @@ jobs: run: | set -euo pipefail VERSION=$(node -p "require('./package.json').version") - node scripts/prepare-cli-previous-release.mjs \ + node scripts/cli/prepare-cli-previous-release.mjs \ --input-dir dist/release-cli \ --output-dir dist/cli-package-linuxbrew-previous \ --version "$VERSION" PREVIOUS_VERSION=$(node -p "require('./dist/cli-package-linuxbrew-previous/fixture.json').previousVersion") - node scripts/build-cli-package-channels.mjs \ + node scripts/cli/build-cli-package-channels.mjs \ --input-dir dist/release-cli \ --output-dir dist/cli-package-linuxbrew-current \ --version "$VERSION" \ --released-at "$(date -u +%Y-%m-%dT%H:%M:%SZ)" \ --asset-base-url file:///work/dist/release-cli \ --system-only - node scripts/build-cli-package-channels.mjs \ + node scripts/cli/build-cli-package-channels.mjs \ --input-dir dist/cli-package-linuxbrew-previous \ --output-dir dist/cli-package-linuxbrew-previous-channels \ --version "$PREVIOUS_VERSION" \ @@ -736,7 +734,7 @@ jobs: --system-only CURRENT_ID=$(node -e "const f=require('./dist/cli-package-linuxbrew-current/cli-package-channels.json');process.stdout.write(f.targets.find(t=>t.platform==='linux'&&t.arch==='${{ matrix.arch }}').contentIdentity)") PREVIOUS_ID=$(node -e "const f=require('./dist/cli-package-linuxbrew-previous/fixture.json');process.stdout.write(f.targets.find(t=>t.platform==='linux'&&t.arch==='${{ matrix.arch }}').previousContentIdentity)") - node scripts/cli-linuxbrew-smoke.mjs \ + node scripts/cli/cli-linuxbrew-smoke.mjs \ --arch "${{ matrix.arch }}" \ --previous-version "$PREVIOUS_VERSION" \ --current-version "$VERSION" \ @@ -776,7 +774,7 @@ jobs: CANDIDATE_VERSION: ${{ needs.release.outputs.version }} CANDIDATE_SOURCE_SHA: ${{ needs.release.outputs.source_sha }} run: >- - node scripts/stage-cli-release.mjs dist/cli-candidates dist/release-cli + node scripts/cli/stage-cli-release.mjs dist/cli-candidates dist/release-cli "$CANDIDATE_VERSION" "$CANDIDATE_SOURCE_SHA" - name: Build, install, and run the generated AUR package @@ -784,19 +782,19 @@ jobs: run: | set -euo pipefail VERSION=$(node -p "require('./package.json').version") - node scripts/prepare-cli-previous-release.mjs \ + node scripts/cli/prepare-cli-previous-release.mjs \ --input-dir dist/release-cli \ --output-dir dist/cli-package-aur-previous \ --version "$VERSION" PREVIOUS_VERSION=$(node -p "require('./dist/cli-package-aur-previous/fixture.json').previousVersion") - node scripts/build-cli-package-channels.mjs \ + node scripts/cli/build-cli-package-channels.mjs \ --input-dir dist/release-cli \ --output-dir dist/cli-package-aur-current \ --version "$VERSION" \ --released-at "$(date -u +%Y-%m-%dT%H:%M:%SZ)" \ --asset-base-url file:///work/dist/release-cli \ --system-only - node scripts/build-cli-package-channels.mjs \ + node scripts/cli/build-cli-package-channels.mjs \ --input-dir dist/cli-package-aur-previous \ --output-dir dist/cli-package-aur-previous-channels \ --version "$PREVIOUS_VERSION" \ @@ -805,7 +803,7 @@ jobs: --system-only CURRENT_ID=$(node -e "const f=require('./dist/cli-package-aur-current/cli-package-channels.json');process.stdout.write(f.targets.find(t=>t.platform==='linux'&&t.arch==='${{ matrix.arch }}').contentIdentity)") PREVIOUS_ID=$(node -e "const f=require('./dist/cli-package-aur-previous/fixture.json');process.stdout.write(f.targets.find(t=>t.platform==='linux'&&t.arch==='${{ matrix.arch }}').previousContentIdentity)") - node scripts/cli-aur-container-smoke.mjs \ + node scripts/cli/cli-aur-container-smoke.mjs \ --arch "${{ matrix.arch }}" \ --previous-version "$PREVIOUS_VERSION" \ --current-version "$VERSION" \ @@ -843,7 +841,7 @@ jobs: ARCHIVE=$(find dist/release-cli-linux-x64 -maxdepth 1 -name '*.tar.gz' -print -quit) SHA256=$(awk 'NR == 1 { print $1 }' "$ARCHIVE.sha256") CONTENT_IDENTITY=$(node -e "const fs=require('fs');const p=fs.readdirSync('dist/release-cli-linux-x64').find(v=>v.endsWith('.report.json'));process.stdout.write(require('./dist/release-cli-linux-x64/'+p).contentIdentity)") - node scripts/cli-legacy-cutover-smoke.mjs \ + node scripts/cli/cli-legacy-cutover-smoke.mjs \ --archive "$ARCHIVE" \ --sha256 "$SHA256" \ --expected-version "$VERSION" \ @@ -981,7 +979,7 @@ jobs: CANDIDATE_CHANNEL: ${{ needs.release.outputs.channel }} CANDIDATE_PREVIOUS_TAG: ${{ needs.release.outputs.previous_tag }} run: >- - node scripts/desktop-candidate-receipt.mjs stage + node scripts/desktop/desktop-candidate-receipt.mjs stage dist/desktop-candidates dist/desktop-receipts dist/release-assets - uses: actions/download-artifact@v4 @@ -996,7 +994,7 @@ jobs: CANDIDATE_VERSION: ${{ needs.release.outputs.version }} CANDIDATE_SOURCE_SHA: ${{ needs.release.outputs.source_sha }} run: >- - node scripts/stage-cli-release.mjs dist/cli-candidates dist/release-cli + node scripts/cli/stage-cli-release.mjs dist/cli-candidates dist/release-cli "$CANDIDATE_VERSION" "$CANDIDATE_SOURCE_SHA" - uses: actions/download-artifact@v4 @@ -1095,7 +1093,7 @@ jobs: SOURCE_REF: ${{ github.ref }} run: '[[ "$SOURCE_REF" = refs/heads/dev || "$SOURCE_REF" = refs/heads/master ]]' - name: Verify all trusted publisher connections - run: node scripts/preflight-public-cli-authority.mjs + run: node scripts/cli/preflight-public-cli-authority.mjs env: OPENALICE_PUBLISH_NPM: 'true' @@ -1144,7 +1142,7 @@ jobs: test "$(git show "$RELEASE_TAG:package.json" | jq -r .version)" = "${RELEASE_TAG#v}" - name: Verify npm authority for this explicit publication - run: node scripts/preflight-public-cli-authority.mjs + run: node scripts/cli/preflight-public-cli-authority.mjs env: OPENALICE_PUBLISH_NPM: 'true' OPENALICE_PUBLISH_HOMEBREW: 'false' @@ -1163,13 +1161,13 @@ jobs: filename="$package-${RELEASE_TAG#v}.tgz" curl --fail --location --retry 3 "$base/$filename" -o "dist/existing-npm/$filename" done - node --input-type=module -e "import { verifyCliNpmPackages } from './scripts/publish-cli-npm-packages.mjs'; verifyCliNpmPackages('dist/existing-npm');" - node scripts/verify-public-cli-channels.mjs \ + node --input-type=module -e "import { verifyCliNpmPackages } from './scripts/cli/publish-cli-npm-packages.mjs'; verifyCliNpmPackages('dist/existing-npm');" + node scripts/cli/verify-public-cli-channels.mjs \ --manifest dist/existing-npm/cli-package-channels.json \ --version "${RELEASE_TAG#v}" > dist/existing-npm/public-channel-receipt.json - name: Publish platform packages before the meta package - run: node scripts/publish-cli-npm-packages.mjs --packages-dir dist/existing-npm + run: node scripts/cli/publish-cli-npm-packages.mjs --packages-dir dist/existing-npm - name: Preserve publication receipt if: always() @@ -1215,7 +1213,7 @@ jobs: - name: Publish platform packages before the meta package run: >- - node scripts/publish-cli-npm-packages.mjs + node scripts/cli/publish-cli-npm-packages.mjs --packages-dir dist/cli-package-channels/cli-npm-tarballs verify-public-cli-channels: @@ -1242,7 +1240,7 @@ jobs: env: VERSION: ${{ needs.release.outputs.version }} run: >- - node scripts/verify-public-cli-channels.mjs + node scripts/cli/verify-public-cli-channels.mjs --manifest dist/cli-package-channels/cli-package-channels/cli-package-channels.json --version "$VERSION" > dist/cli-package-channels/public-channel-receipt.json @@ -1397,7 +1395,7 @@ jobs: TAG: ${{ needs.release.outputs.tag }} DOWNLOAD_BASE_URL: ${{ secrets.DOWNLOAD_BASE_URL }} run: | - node scripts/prepare-desktop-release-assets.mjs mirror \ + node scripts/desktop/prepare-desktop-release-assets.mjs mirror \ --out-dir dist/r2-upload \ --tag "$TAG" \ --base-url "${DOWNLOAD_BASE_URL:-https://download.openalice.ai}" \ @@ -1488,7 +1486,7 @@ jobs: # mutable feed, installer alias, or manifest changes. aws s3 cp "s3://${R2_BUCKET}/${MANIFEST_PATH}" "$RUNNER_TEMP/openalice-publish-head.json" \ --endpoint-url "$ENDPOINT" --only-show-errors - node scripts/prepare-desktop-release-assets.mjs check-publication \ + node scripts/desktop/prepare-desktop-release-assets.mjs check-publication \ --head-path "$RUNNER_TEMP/openalice-publish-head.json" --version "$VERSION" \ --channel "$RELEASE_CHANNEL" --operation "$RELEASE_OPERATION" \ --expected-sha256 "$EXPECTED_HEAD_SHA256" diff --git a/.github/workflows/windows-cli-preview.yml b/.github/workflows/windows-cli-preview.yml index bbc869bc8..a7083e9ee 100644 --- a/.github/workflows/windows-cli-preview.yml +++ b/.github/workflows/windows-cli-preview.yml @@ -93,7 +93,7 @@ jobs: path: dist/dev-neutral-inputs - name: Verify shared server inputs if: inputs.candidate_run == '' && inputs.neutral_inputs - run: node scripts/prepare-cli-neutral-inputs.mjs verify --repository-root . --input-dir dist/dev-neutral-inputs --commit "${{ github.sha }}" --install + run: node scripts/cli/prepare-cli-neutral-inputs.mjs verify --repository-root . --input-dir dist/dev-neutral-inputs --commit "${{ github.sha }}" --install - uses: actions/download-artifact@v4 if: inputs.dev_broker_packs && inputs.candidate_run == '' with: @@ -103,7 +103,7 @@ jobs: if: inputs.candidate_run == '' env: OPENALICE_DEV_COMMIT: ${{ inputs.dev_broker_packs && github.sha || '' }} - run: bun scripts/build-windows-cli-preview.ts ${{ matrix.arch }} + run: bun scripts/cli/build-windows-cli-preview.ts ${{ matrix.arch }} - name: Preserve complete candidate for reproduction id: preserve if: inputs.candidate_run == '' @@ -132,17 +132,17 @@ jobs: merge-multiple: false - name: Check native ConPTY input resize and independent termination if: inputs.native_acceptance - run: bun scripts/bun-native-pty-smoke.ts + run: bun scripts/cli/bun-native-pty-smoke.ts - name: Install and start the packaged Runtime if: ${{ !cancelled() && inputs.native_acceptance && (steps.preserve.outcome == 'success' || steps.download.outcome == 'success') }} - run: bun scripts/windows-cli-preview-smoke.ts + run: bun scripts/cli/windows-cli-preview-smoke.ts - name: Accept Windows npm and Bun native command shims if: ${{ !cancelled() && inputs.native_acceptance && inputs.channel_build && (steps.preserve.outcome == 'success' || steps.download.outcome == 'success') }} shell: pwsh run: | $candidates = @(Get-ChildItem -Recurse -Path dist/windows-cli-preview/${{ matrix.arch }} -Filter candidate.json) if ($candidates.Count -ne 1) { throw 'Expected exactly one package candidate' } - ./scripts/windows-cli-package-smoke.ps1 -CandidateDir $candidates[0].DirectoryName + ./scripts/cli/windows-cli-package-smoke.ps1 -CandidateDir $candidates[0].DirectoryName - name: Preserve native verification receipt if: always() uses: actions/upload-artifact@v6 diff --git a/package.json b/package.json index c49e36083..b031eb0fc 100644 --- a/package.json +++ b/package.json @@ -20,48 +20,45 @@ "build": "turbo run build --filter=!@traderalice/landing && tsup src/main.ts --format esm --dts", "prebuild:server": "tsx scripts/build-migration-index.ts", "build:server": "turbo run build --filter=!@traderalice/landing --filter=!@traderalice/desktop --filter=!./packages/uta-broker-* && tsup src/main.ts --format esm --dts", - "build:bun-cli:feasibility": "bun scripts/build-bun-cli-feasibility.ts", - "build:bun-alice:feasibility": "bun scripts/build-bun-alice-feasibility.ts", - "build:bun-runtime:feasibility": "bun scripts/build-bun-runtime-feasibility.ts", - "build:bun:release": "bun scripts/build-bun-release.ts", - "build:cli-package-channels": "node scripts/build-cli-package-channels.mjs", - "pack:cli-npm": "node scripts/pack-cli-npm-packages.mjs", + "build:bun:release": "bun scripts/cli/build-bun-release.ts", + "build:cli-package-channels": "node scripts/cli/build-cli-package-channels.mjs", + "pack:cli-npm": "node scripts/cli/pack-cli-npm-packages.mjs", "build:migration-index": "tsx scripts/build-migration-index.ts", "broker-packs:build": "turbo run build --filter=./packages/uta-broker-* && tsx scripts/build-broker-packs.ts && pnpm broker-packs:verify", "broker-packs:upgrade-smoke": "tsx scripts/broker-pack-upgrade-smoke.ts", "broker-packs:verify": "tsx scripts/verify-broker-packs.ts", "start": "node dist/main.js", - "electron:tsc": "pnpm -F @traderalice/desktop build && node scripts/build-desktop-relay.mjs", + "electron:tsc": "pnpm -F @traderalice/desktop build && node scripts/desktop/build-desktop-relay.mjs", "electron:build": "pnpm build && pnpm electron:tsc", "electron:smoke:demo": "node scripts/electron-demo/run.mjs --smoke", "electron:demo": "node scripts/electron-demo/run.mjs", "electron:dev": "pnpm electron:build && pnpm -F @traderalice/desktop dev", "electron:pack": "pnpm electron:build && pnpm vendor:runtime && pnpm -F @traderalice/desktop run pack", - "electron:assert-package": "node scripts/assert-desktop-package.mjs", - "electron:verify-update-assets": "node scripts/verify-desktop-update-assets.mjs", - "electron:smoke-toolchain": "node scripts/smoke-packaged-toolchain.mjs", - "electron:smoke:packaged": "node scripts/desktop-packaged-smoke.mjs", - "electron:smoke:startup": "node scripts/desktop-startup-smoke.mjs", - "electron:smoke:credential-pi": "node scripts/desktop-packaged-smoke.mjs --credential-pi", - "electron:smoke:onboarding": "node scripts/desktop-packaged-smoke.mjs --onboarding", - "electron:smoke:trading-mode": "node scripts/desktop-packaged-smoke.mjs --trading-mode", - "electron:smoke:workspace": "node scripts/desktop-packaged-smoke.mjs --workspace-acceptance", - "electron:smoke:pty": "node scripts/desktop-pty-smoke.mjs", - "electron:smoke:guardian-recovery": "node scripts/desktop-pty-smoke.mjs --guardian-recovery", - "electron:smoke:existing-owner": "node scripts/desktop-existing-owner-smoke.mjs", - "electron:smoke:upgrade": "node scripts/desktop-upgrade-smoke.mjs", - "vendor:runtime": "node scripts/vendor-managed-runtime.mjs", + "electron:assert-package": "node scripts/desktop/assert-desktop-package.mjs", + "electron:verify-update-assets": "node scripts/desktop/verify-desktop-update-assets.mjs", + "electron:smoke-toolchain": "node scripts/desktop/smoke-packaged-toolchain.mjs", + "electron:smoke:packaged": "node scripts/desktop/desktop-packaged-smoke.mjs", + "electron:smoke:startup": "node scripts/desktop/desktop-startup-smoke.mjs", + "electron:smoke:credential-pi": "node scripts/desktop/desktop-packaged-smoke.mjs --credential-pi", + "electron:smoke:onboarding": "node scripts/desktop/desktop-packaged-smoke.mjs --onboarding", + "electron:smoke:trading-mode": "node scripts/desktop/desktop-packaged-smoke.mjs --trading-mode", + "electron:smoke:workspace": "node scripts/desktop/desktop-packaged-smoke.mjs --workspace-acceptance", + "electron:smoke:pty": "node scripts/desktop/desktop-pty-smoke.mjs", + "electron:smoke:guardian-recovery": "node scripts/desktop/desktop-pty-smoke.mjs --guardian-recovery", + "electron:smoke:existing-owner": "node scripts/desktop/desktop-existing-owner-smoke.mjs", + "electron:smoke:upgrade": "node scripts/desktop/desktop-upgrade-smoke.mjs", + "vendor:runtime": "node scripts/desktop/vendor-managed-runtime.mjs", "test": "vp test run --config vitest.config.ts", "test:changed": "vp test run --config vitest.config.ts --changed origin/dev --passWithNoTests", "test:watch": "vp test --config vitest.config.ts --watch", "test:integration": "vp test run --config vitest.integration.config.ts", "test:e2e": "vp test run --config vitest.integration.config.ts tests/e2e", - "test:system:dev-stack": "node --import tsx scripts/smoke-dev-stack.ts", - "test:system:guardian": "node --import tsx scripts/smoke-guardian-recovery.ts", - "test:system:connector": "node --import tsx scripts/smoke-connector.ts", - "test:system:installer": "node scripts/smoke-cli-installer.mjs", - "test:system:installer:dev": "node scripts/smoke-cli-installer.mjs --channel dev", - "test:system:remote": "node scripts/smoke-remote-ssh.mjs", + "test:system:dev-stack": "tsx scripts/guardian/smoke.ts", + "test:system:guardian": "tsx scripts/guardian/runtime-recovery-smoke.ts", + "test:system:connector": "node scripts/connector-service-smoke.mjs", + "test:system:installer": "node scripts/cli/install-docker-smoke.mjs", + "test:system:installer:dev": "node scripts/cli/install-channel-smoke.mjs", + "test:system:remote": "node scripts/cli/remote-ssh-smoke.mjs", "test:external:readonly": "vp test run --config vitest.external.config.ts", "test:live:uta-paper": "vp test run --config vitest.uta-live.config.ts tests/integration/broker-alpaca-paper tests/integration/broker-bybit-paper tests/integration/broker-hyperliquid-paper tests/integration/broker-ibkr-paper tests/integration/broker-okx-paper tests/integration/ibkr-wire-paper", "test:live:ibkr-paper": "vp test run --config vitest.uta-live.config.ts tests/integration/broker-ibkr-paper tests/integration/ibkr-wire-paper", @@ -203,7 +200,7 @@ ] } ], - "afterPack": "../../scripts/desktop-after-pack.mjs" + "afterPack": "../../scripts/desktop/desktop-after-pack.mjs" }, "devDependencies": { "@ai-sdk/provider": "^3.0.8", diff --git a/scripts/build-bun-alice-feasibility.ts b/scripts/build-bun-alice-feasibility.ts deleted file mode 100644 index 4eed88456..000000000 --- a/scripts/build-bun-alice-feasibility.ts +++ /dev/null @@ -1,268 +0,0 @@ -import { signCliMacOS } from './sign-cli-macos.mjs' -import { requireBunVersion } from './bun-toolchain.mjs' -import { runtimeCompileOptions } from './bun-compile-options.js' -import { createServer } from 'node:net' -import { mkdir, readFile, rm, stat, writeFile } from 'node:fs/promises' -import { basename, join, resolve } from 'node:path' -import { fileURLToPath } from 'node:url' - -import { INTERNAL_BOOTSTRAP_ROLE } from '../src/workspaces/bootstrap-runtime.js' - -const repositoryRoot = fileURLToPath(new URL('..', import.meta.url)) -requireBunVersion(Bun.version) - -const outputRoot = resolve( - process.env['OPENALICE_BUN_OUTPUT_DIR'] - ?? join(repositoryRoot, 'dist/bun-alice-feasibility'), -) -const executableName = process.platform === 'win32' ? 'alice.exe' : 'alice' -const executablePath = join(outputRoot, executableName) -const ptySmokeName = process.platform === 'win32' ? 'pty-smoke.exe' : 'pty-smoke' -const ptySmokePath = join(outputRoot, ptySmokeName) -const smokeHome = join(outputRoot, 'smoke-home') -const bootstrapWorkspace = join(outputRoot, 'bootstrap-workspace') - -await rm(outputRoot, { recursive: true, force: true }) -await mkdir(outputRoot, { recursive: true }) -process.chdir(outputRoot) - -const buildStartedAt = performance.now() -const result = await Bun.build({ - entrypoints: [join(repositoryRoot, 'src/main.ts')], - compile: { - outfile: executablePath, - ...runtimeCompileOptions, - }, - define: { - 'globalThis.__OPENALICE_BUN_STANDALONE__': 'true', - }, - minify: true, -}) -const buildDurationMs = performance.now() - buildStartedAt -if (!result.success) { - for (const log of result.logs) console.error(log) - throw new Error('Bun Alice feasibility build failed') -} -if (process.platform === 'darwin') signCliMacOS(executablePath, process.arch) - -const bootstrapProbe = Bun.spawn([ - executablePath, - INTERNAL_BOOTSTRAP_ROLE, - join(repositoryRoot, 'src/workspaces/templates/chat/bootstrap.mjs'), - 'bun-feasibility', - bootstrapWorkspace, -], { - cwd: outputRoot, - env: { - HOME: smokeHome, - PATH: '', - TMPDIR: process.env['TMPDIR'] ?? '/tmp', - ELECTRON_RUN_AS_NODE: '1', - AQ_TEMPLATE_ROOT: join(repositoryRoot, 'src/workspaces/templates/chat'), - ...(process.env['LOCAL_GIT_DIRECTORY'] - ? { LOCAL_GIT_DIRECTORY: process.env['LOCAL_GIT_DIRECTORY'] } - : {}), - ...(process.env['GIT_EXEC_PATH'] - ? { GIT_EXEC_PATH: process.env['GIT_EXEC_PATH'] } - : {}), - ...(process.env['SystemRoot'] ? { SystemRoot: process.env['SystemRoot'] } : {}), - }, - stdout: 'pipe', - stderr: 'pipe', -}) -const [bootstrapExitCode, bootstrapStdout, bootstrapStderr] = await Promise.all([ - bootstrapProbe.exited, - new Response(bootstrapProbe.stdout).text(), - new Response(bootstrapProbe.stderr).text(), -]) -if (bootstrapExitCode !== 0) { - throw new Error( - `compiled Bun workspace bootstrap exited with ${bootstrapExitCode}: ${bootstrapStderr || bootstrapStdout}`, - ) -} -const [bootstrapHead, bootstrapReadme] = await Promise.all([ - readFile(join(bootstrapWorkspace, '.git/HEAD'), 'utf8'), - readFile(join(bootstrapWorkspace, 'README.md'), 'utf8'), -]) -if (!bootstrapHead.startsWith('ref: refs/heads/') || bootstrapReadme.trim().length === 0) { - throw new Error('compiled Bun workspace bootstrap did not materialize the Chat template') -} - -const ptyBuild = await Bun.build({ - entrypoints: [join(repositoryRoot, 'scripts/bun-native-pty-smoke.ts')], - compile: { - outfile: ptySmokePath, - ...runtimeCompileOptions, - }, - minify: true, -}) -if (!ptyBuild.success) { - for (const log of ptyBuild.logs) console.error(log) - throw new Error('Bun PTY feasibility build failed') -} - -if (process.platform === 'darwin') signCliMacOS(ptySmokePath, process.arch) -const ptyProbe = Bun.spawn([ptySmokePath], { - cwd: outputRoot, - env: { - HOME: smokeHome, - PATH: '', - TMPDIR: process.env['TMPDIR'] ?? '/tmp', - ...(process.env['SystemRoot'] ? { SystemRoot: process.env['SystemRoot'] } : {}), - }, - stdout: 'pipe', - stderr: 'pipe', -}) -const [ptyExitCode, ptyStdout, ptyStderr] = await Promise.all([ - ptyProbe.exited, - new Response(ptyProbe.stdout).text(), - new Response(ptyProbe.stderr).text(), -]) -if (ptyExitCode !== 0) { - throw new Error(`compiled Bun PTY smoke exited with ${ptyExitCode}: ${ptyStderr || ptyStdout}`) -} -const ptyReport = JSON.parse(ptyStdout.trim()) as { - status: string - backend: string - supportsFlowControl: boolean - pids: number[] - flowControl?: { - pid: number - bytesBeforePause: number - bytesWhilePaused: number - bytesAfterResume: number - gracefulKillWhilePaused: boolean - } -} -if ( - ptyReport.status !== 'pass' - || ptyReport.backend !== 'bun-native' - || !ptyReport.supportsFlowControl - || !ptyReport.flowControl - || ptyReport.flowControl.bytesWhilePaused !== ptyReport.flowControl.bytesBeforePause - || ptyReport.flowControl.bytesAfterResume <= ptyReport.flowControl.bytesWhilePaused - || !ptyReport.flowControl.gracefulKillWhilePaused -) { - throw new Error(`compiled Bun PTY smoke returned an invalid report: ${ptyStdout}`) -} - -const [webPort, mcpPort, utaPort, connectorPort] = await allocatePorts(4) -const startedAt = performance.now() -const child = Bun.spawn([executablePath], { - cwd: outputRoot, - env: { - HOME: smokeHome, - PATH: '', - TMPDIR: process.env['TMPDIR'] ?? '/tmp', - OPENALICE_HOME: smokeHome, - OPENALICE_APP_HOME: repositoryRoot, - OPENALICE_TRADING_MODE: 'lite', - OPENALICE_BIND_HOST: '127.0.0.1', - OPENALICE_WEB_PORT: String(webPort), - OPENALICE_MCP_PORT: String(mcpPort), - OPENALICE_UTA_PORT: String(utaPort), - OPENALICE_CONNECTOR_PORT: String(connectorPort), - }, - stdout: 'pipe', - stderr: 'pipe', -}) -const stdoutPromise = new Response(child.stdout).text() -const stderrPromise = new Response(child.stderr).text() - -let authStatus = 0 -let rootStatus = 0 -let readyDurationMs = 0 -let probeError: unknown = null -try { - const auth = await waitForHttp(`http://127.0.0.1:${webPort}/api/auth/status`, 30_000) - authStatus = auth.status - JSON.parse(auth.body) - readyDurationMs = Math.round(performance.now() - startedAt) - const root = await waitForHttp(`http://127.0.0.1:${webPort}/`, 10_000) - rootStatus = root.status - if (!root.body.includes('
')) { - throw new Error('compiled Alice root did not serve the real Web UI shell') - } -} catch (error) { - probeError = error -} finally { - child.kill('SIGTERM') -} -const exitCode = await child.exited -const stdout = await stdoutPromise -const stderr = await stderrPromise -if (exitCode !== 0) { - throw new Error(`compiled Alice exited with ${exitCode}: ${stderr || stdout}`) -} -if (probeError) { - throw new Error(`compiled Alice probe failed: ${String(probeError)}\n${stderr || stdout}`) -} -if (authStatus !== 200 || rootStatus !== 200) { - throw new Error(`compiled Alice HTTP probes failed: auth=${authStatus} root=${rootStatus}`) -} - -const executable = await stat(executablePath) -const report = { - schemaVersion: 1, - status: 'pass', - bunVersion: Bun.version, - platform: process.platform, - arch: process.arch, - executable: basename(executablePath), - executableBytes: executable.size, - buildDurationMs: Math.round(buildDurationMs), - readyDurationMs, - authStatus, - rootStatus, - pty: ptyReport, - workspaceBootstrap: { - status: 'pass', - template: 'chat', - nodeOrBunOnPath: false, - }, - smokePath: '', -} -await writeFile(join(outputRoot, 'report.json'), `${JSON.stringify(report, null, 2)}\n`) -console.log(`Bun Alice feasibility boot passed: ${executablePath}`) -console.log(JSON.stringify(report)) - -async function waitForHttp( - url: string, - timeoutMs: number, -): Promise<{ status: number; body: string }> { - const deadline = Date.now() + timeoutMs - let lastError: unknown = null - while (Date.now() < deadline) { - try { - const response = await fetch(url) - const body = await response.text() - if (response.status === 200) return { status: response.status, body } - lastError = new Error(`${url} returned ${response.status}`) - } catch (error) { - lastError = error - } - await Bun.sleep(100) - } - throw new Error(`Timed out waiting for ${url}: ${String(lastError)}`) -} - -async function allocatePorts(count: number): Promise { - const ports: number[] = [] - for (let index = 0; index < count; index += 1) { - const server = createServer() - await new Promise((resolveListen, reject) => { - server.once('error', reject) - server.listen(0, '127.0.0.1', resolveListen) - }) - const address = server.address() - if (!address || typeof address === 'string') { - server.close() - throw new Error('Could not allocate an isolated loopback port') - } - ports.push(address.port) - await new Promise((resolveClose, reject) => { - server.close((error) => error ? reject(error) : resolveClose()) - }) - } - return ports -} diff --git a/scripts/build-bun-cli-feasibility.ts b/scripts/build-bun-cli-feasibility.ts deleted file mode 100644 index 7a79e744a..000000000 --- a/scripts/build-bun-cli-feasibility.ts +++ /dev/null @@ -1,141 +0,0 @@ -import { signCliMacOS } from './sign-cli-macos.mjs' -import { requireBunVersion } from './bun-toolchain.mjs' -import { runtimeCompileOptions } from './bun-compile-options.js' -import { mkdir, readFile, rm, stat, writeFile } from 'node:fs/promises' -import { basename, join, resolve } from 'node:path' -import { fileURLToPath } from 'node:url' - -const repositoryRoot = fileURLToPath(new URL('..', import.meta.url)) -requireBunVersion(Bun.version) - -const product = JSON.parse( - await readFile(join(repositoryRoot, 'package.json'), 'utf8'), -) as { version?: unknown } -if (typeof product.version !== 'string' || product.version.length === 0) { - throw new Error('package.json must contain a version') -} - -const outputRoot = resolve( - process.env['OPENALICE_BUN_OUTPUT_DIR'] - ?? join(repositoryRoot, 'dist/bun-cli-feasibility'), -) -const executableName = process.platform === 'win32' ? 'openalice.exe' : 'openalice' -const executablePath = join(outputRoot, executableName) - -await rm(outputRoot, { recursive: true, force: true }) -await mkdir(outputRoot, { recursive: true }) -process.chdir(outputRoot) - -const buildStartedAt = performance.now() -const result = await Bun.build({ - entrypoints: [join(repositoryRoot, 'packages/cli/bin/openalice.ts')], - compile: { - outfile: executablePath, - ...runtimeCompileOptions, - }, - define: { - 'globalThis.__OPENALICE_BUILD_VERSION__': JSON.stringify(product.version), - }, - minify: true, -}) -const buildDurationMs = performance.now() - buildStartedAt - -if (!result.success) { - for (const log of result.logs) console.error(log) - throw new Error('Bun CLI feasibility build failed') -} -if (process.platform === 'darwin') signCliMacOS(executablePath, process.arch) - -const smokeEnvironment = minimalSmokeEnvironment(outputRoot) -const version = runProbe(executablePath, ['--version'], smokeEnvironment) -if (version.stdout.trim() !== product.version) { - throw new Error( - `compiled CLI reported ${JSON.stringify(version.stdout.trim())}, expected ${product.version}`, - ) -} - -const help = runProbe(executablePath, ['--help'], smokeEnvironment) -if (!help.stdout.includes('openalice')) { - throw new Error('compiled CLI help did not contain the openalice command name') -} - -const versionJson = runProbe(executablePath, ['version', '--json'], smokeEnvironment) -const versionMetadata = JSON.parse(versionJson.stdout) as { version?: unknown } -if (versionMetadata.version !== product.version) { - throw new Error('compiled CLI version metadata did not use the build-time product version') -} - -const status = runProbe( - executablePath, - ['status', '--home', join(outputRoot, 'smoke-home'), '--json'], - smokeEnvironment, -) -const statusEnvelope = JSON.parse(status.stdout) as { - ok?: unknown - result?: { status?: { class?: unknown } } -} -if (statusEnvelope.ok !== true || statusEnvelope.result?.status?.class !== 'absent') { - throw new Error('compiled CLI could not inspect an isolated absent Runtime') -} - -const executable = await stat(executablePath) -const report = { - schemaVersion: 1, - status: 'pass', - productVersion: product.version, - bunVersion: Bun.version, - platform: process.platform, - arch: process.arch, - executable: basename(executablePath), - executableBytes: executable.size, - buildDurationMs: Math.round(buildDurationMs), - versionProbeDurationMs: version.durationMs, - helpProbeDurationMs: help.durationMs, - metadataProbeDurationMs: versionJson.durationMs, - statusProbeDurationMs: status.durationMs, - smokePath: smokeEnvironment.PATH, -} -await writeFile(join(outputRoot, 'report.json'), `${JSON.stringify(report, null, 2)}\n`) - -console.log(`Bun CLI feasibility build passed: ${executablePath}`) -console.log(JSON.stringify(report)) - -function runProbe( - executable: string, - args: string[], - env: Record, -): { stdout: string; durationMs: number } { - const startedAt = performance.now() - const probe = Bun.spawnSync([executable, ...args], { - cwd: outputRoot, - env, - stdout: 'pipe', - stderr: 'pipe', - }) - const durationMs = Math.round(performance.now() - startedAt) - const stdout = probe.stdout.toString() - const stderr = probe.stderr.toString() - if (probe.exitCode !== 0) { - throw new Error( - `${basename(executable)} ${args.join(' ')} failed with ${probe.exitCode}: ${stderr || stdout}`, - ) - } - return { stdout, durationMs } -} - -function minimalSmokeEnvironment(home: string): Record { - if (process.platform === 'win32') { - return { - HOME: home, - PATH: '', - USERPROFILE: home, - ...(process.env['SystemRoot'] ? { SystemRoot: process.env['SystemRoot'] } : {}), - ...(process.env['WINDIR'] ? { WINDIR: process.env['WINDIR'] } : {}), - } - } - return { - HOME: home, - PATH: '', - TMPDIR: process.env['TMPDIR'] ?? '/tmp', - } -} diff --git a/scripts/build-bun-runtime-feasibility.ts b/scripts/build-bun-runtime-feasibility.ts deleted file mode 100644 index de01f1117..000000000 --- a/scripts/build-bun-runtime-feasibility.ts +++ /dev/null @@ -1,444 +0,0 @@ -import { signCliMacOS } from './sign-cli-macos.mjs' -import { requireBunVersion } from './bun-toolchain.mjs' -import { runtimeCompileOptions } from './bun-compile-options.js' -import { createServer } from 'node:net' -import { mkdir, readFile, rm, stat, symlink, writeFile } from 'node:fs/promises' -import { basename, join, resolve } from 'node:path' -import { fileURLToPath } from 'node:url' - -import { prepareBunBrokerPackFixture } from './bun-broker-pack-fixture.js' -import { inspectSystemDependencies } from '../packages/cli/src/system-dependencies.mjs' - -const repositoryRoot = fileURLToPath(new URL('..', import.meta.url)) -requireBunVersion(Bun.version) - -const product = JSON.parse(await readFile(join(repositoryRoot, 'package.json'), 'utf8')) as { - version?: unknown -} -if (typeof product.version !== 'string' || product.version.length === 0) { - throw new Error('package.json must contain a version') -} - -const outputRoot = resolve( - process.env['OPENALICE_BUN_OUTPUT_DIR'] - ?? join(repositoryRoot, 'dist/bun-runtime-feasibility'), -) -const executablePath = join( - outputRoot, - process.platform === 'win32' ? 'openalice.exe' : 'openalice', -) -const smokeHome = join(outputRoot, 'smoke-home') - -await rm(outputRoot, { recursive: true, force: true }) -await mkdir(join(smokeHome, 'data/config'), { recursive: true }) -await writeFile( - join(smokeHome, 'data/config/connector-service.json'), - `${JSON.stringify({ enabled: true, adapters: {} }, null, 2)}\n`, -) -const brokerPackFixture = await prepareBunBrokerPackFixture( - smokeHome, - product.version, - repositoryRoot, -) - -const buildStartedAt = performance.now() -const build = await Bun.build({ - entrypoints: [join(repositoryRoot, 'packages/cli/bin/openalice-bun.ts')], - compile: { - outfile: executablePath, - ...runtimeCompileOptions, - }, - define: { - 'globalThis.__OPENALICE_BUILD_VERSION__': JSON.stringify(product.version), - 'globalThis.__OPENALICE_BUN_STANDALONE__': 'true', - }, - minify: true, -}) -if (!build.success) { - for (const log of build.logs) console.error(log) - throw new Error('Bun multiprocess Runtime build failed') -} -if (process.platform === 'darwin') signCliMacOS(executablePath, process.arch) -const buildDurationMs = Math.round(performance.now() - buildStartedAt) - -const [webPort, mcpPort, utaPort, connectorPort] = await allocatePorts(4) -// Expose only required system tools, not the host's Node/npm/Bun installation. -const dependencyBin = join(outputRoot, 'system-bin') -await mkdir(dependencyBin, { recursive: true }) -for (const dependency of await inspectSystemDependencies()) { - if (dependency.status !== 'available' || !dependency.executable) { - throw new Error(`Runtime acceptance requires working system ${dependency.id}`) - } - await symlink(dependency.executable, join(dependencyBin, dependency.id)) -} -const smokeEnvironment = minimalSmokeEnvironment({ - home: smokeHome, - executable: executablePath, - webPort, - mcpPort, - utaPort, - connectorPort, -}) -const version = runProbe(['--version'], smokeEnvironment) -if (version.stdout.trim() !== product.version) { - throw new Error(`compiled Runtime reported version ${JSON.stringify(version.stdout.trim())}`) -} -runProbe(['setup', '--check'], smokeEnvironment) - -const runtimeStartedAt = performance.now() -const runtime = Bun.spawn([ - executablePath, - 'run', - '--home', smokeHome, - '--port', String(webPort), - '--wait', '90', - '--no-update-check', -], { - cwd: outputRoot, - env: smokeEnvironment, - stdout: 'pipe', - stderr: 'pipe', -}) -const stdoutPromise = new Response(runtime.stdout).text() -const stderrPromise = new Response(runtime.stderr).text() - -let acceptanceError: unknown = null -let initialStatus: RuntimeStatus | null = null -let recoveredStatus: RuntimeStatus | null = null -let externalBrokerPack: Awaited> | null = null -let readyDurationMs = 0 -let idleMemoryBytes: RuntimeMemoryReport | null = null -try { - await Promise.all([ - waitForHttp(`http://127.0.0.1:${webPort}/api/auth/status`, 90_000), - waitForHttp(`http://127.0.0.1:${utaPort}/__uta/health`, 90_000), - waitForHttp(`http://127.0.0.1:${connectorPort}/__connector/health`, 90_000), - ]) - initialStatus = await waitForRuntimeStatus(smokeEnvironment, (status) => ( - status.class === 'running' - && status.provider?.kind === 'bun' - && status.componentDetail?.alice?.state === 'ready' - && status.componentDetail?.uta?.state === 'ready' - && status.componentDetail?.connector?.state === 'ready' - )) - readyDurationMs = Math.round(performance.now() - runtimeStartedAt) - const projectBarsHelp = runProbe(['exec', '--home', smokeHome, 'alice', 'market', 'bars', '--help'], smokeEnvironment) - if (!projectBarsHelp.stdout.includes('--bar-id') || !projectBarsHelp.stdout.includes('--output')) { - throw new Error('Native Project CLI did not discover raw market bars through the running Alice gateway') - } - const initialPids = runtimePids(initialStatus) - if (new Set(initialPids).size !== 4) { - throw new Error(`Guardian/Alice/UTA/Connector did not have four distinct PIDs: ${initialPids}`) - } - externalBrokerPack = await waitForBrokerPackFixture(utaPort, brokerPackFixture) - await Bun.sleep(1_000) - idleMemoryBytes = await measureRuntimeMemory(initialStatus) - - const connectorPid = initialStatus.componentDetail?.connector?.pid - if (!connectorPid) throw new Error('Connector PID was missing from Runtime status') - process.kill(connectorPid, 'SIGKILL') - recoveredStatus = await waitForRuntimeStatus(smokeEnvironment, (status) => ( - status.class === 'running' - && status.componentDetail?.alice?.pid === initialStatus?.componentDetail?.alice?.pid - && status.componentDetail?.connector?.state === 'ready' - && typeof status.componentDetail?.connector?.pid === 'number' - && status.componentDetail.connector.pid !== connectorPid - ), 30_000) - - const utaPid = recoveredStatus.componentDetail?.uta?.pid - if (!utaPid) throw new Error('UTA PID was missing from Runtime status') - process.kill(utaPid, 'SIGKILL') - await waitForRuntimeStatus(smokeEnvironment, (status) => ( - status.class === 'running' - && status.componentDetail?.alice?.state === 'ready' - && status.componentDetail?.uta?.state === 'offline' - ), 15_000) - await waitForHttp(`http://127.0.0.1:${webPort}/api/auth/status`, 5_000) - await writeFile(join(smokeHome, 'data/control/restart-uta.flag'), `${Date.now()}\n`) - recoveredStatus = await waitForRuntimeStatus(smokeEnvironment, (status) => ( - status.class === 'running' - && status.componentDetail?.alice?.state === 'ready' - && status.componentDetail?.uta?.state === 'ready' - && typeof status.componentDetail?.uta?.pid === 'number' - && status.componentDetail.uta.pid !== utaPid - ), 30_000) - await waitForBrokerPackFixture(utaPort, brokerPackFixture) -} catch (error) { - acceptanceError = error -} finally { - runtime.kill('SIGTERM') -} - -const exitCode = await runtime.exited -const stdout = await stdoutPromise -const stderr = await stderrPromise -if (acceptanceError) { - throw new Error( - `Bun multiprocess acceptance failed: ${String(acceptanceError)}\n--- stdout ---\n${stdout}\n--- stderr ---\n${stderr}`, - ) -} -if (exitCode !== 0) { - throw new Error(`Bun multiprocess Runtime exited with ${exitCode}: ${stderr || stdout}`) -} -await waitForRuntimeStatus(smokeEnvironment, (status) => status.class === 'absent', 15_000) - -const executable = await stat(executablePath) -const report = { - schemaVersion: 1, - status: 'pass', - productVersion: product.version, - bunVersion: Bun.version, - platform: process.platform, - arch: process.arch, - executable: basename(executablePath), - executableBytes: executable.size, - buildDurationMs, - readyDurationMs, - coldStartReadyMs: readyDurationMs, - idleMemoryBytes, - processModel: { - guardianPid: initialStatus?.owner?.pid, - alicePid: initialStatus?.componentDetail?.alice?.pid, - utaPid: initialStatus?.componentDetail?.uta?.pid, - connectorPid: initialStatus?.componentDetail?.connector?.pid, - connectorRecoveredPid: recoveredStatus?.componentDetail?.connector?.pid, - utaRecoveredPid: recoveredStatus?.componentDetail?.uta?.pid, - }, - isolation: { - connectorRestartedWithoutAliceRestart: true, - utaFailureKeptAliceReady: true, - utaRestartedOnControlFlag: true, - runtimeLockReleasedAfterSignal: true, - }, - externalBrokerPack, - nodeOrBunOnPath: false, -} -await writeFile(join(outputRoot, 'report.json'), `${JSON.stringify(report, null, 2)}\n`) -console.log(`Bun multiprocess Runtime feasibility passed: ${executablePath}`) -console.log(JSON.stringify(report)) - -interface RuntimeStatus { - class?: string - provider?: { kind?: string } - owner?: { pid?: number } - componentDetail?: Record -} - -interface RuntimeMemoryReport { - sampleCount: number - sampleIntervalMs: number - guardian: number - alice: number - uta: number - connector: number - total: number -} - -function runtimePids(status: RuntimeStatus): number[] { - const pids = [ - status.owner?.pid, - status.componentDetail?.alice?.pid, - status.componentDetail?.uta?.pid, - status.componentDetail?.connector?.pid, - ] - if (pids.some((pid) => !Number.isInteger(pid) || (pid ?? 0) <= 0)) { - throw new Error(`Runtime status omitted a component PID: ${JSON.stringify(status)}`) - } - return pids as number[] -} - -async function measureRuntimeMemory(status: RuntimeStatus): Promise { - const pids = runtimePids(status) - const samples = new Map() - for (const pid of pids) samples.set(pid, []) - const sampleCount = 3 - const sampleIntervalMs = 500 - for (let sample = 0; sample < sampleCount; sample += 1) { - for (const pid of pids) samples.get(pid)?.push(readResidentSetBytes(pid)) - if (sample + 1 < sampleCount) await Bun.sleep(sampleIntervalMs) - } - const [guardian, alice, uta, connector] = pids.map((pid) => median(samples.get(pid) ?? [])) - return { - sampleCount, - sampleIntervalMs, - guardian, - alice, - uta, - connector, - total: guardian + alice + uta + connector, - } -} - -function readResidentSetBytes(pid: number): number { - const probe = Bun.spawnSync(['/bin/ps', '-o', 'rss=', '-p', String(pid)], { - stdout: 'pipe', - stderr: 'pipe', - }) - const residentKiB = Number.parseInt(probe.stdout.toString().trim(), 10) - if (probe.exitCode !== 0 || !Number.isFinite(residentKiB) || residentKiB <= 0) { - throw new Error(`failed to measure resident memory for PID ${pid}: ${probe.stderr.toString()}`) - } - return residentKiB * 1024 -} - -function median(values: number[]): number { - if (values.length === 0) throw new Error('cannot calculate a median without samples') - const sorted = [...values].sort((left, right) => left - right) - return sorted[Math.floor(sorted.length / 2)] -} - -async function waitForRuntimeStatus( - env: Record, - accept: (status: RuntimeStatus) => boolean, - timeoutMs = 30_000, -): Promise { - const deadline = Date.now() + timeoutMs - let last = '' - while (Date.now() < deadline) { - const probe = Bun.spawnSync([ - executablePath, - 'status', - '--home', smokeHome, - '--wait', '1', - '--json', - ], { - cwd: outputRoot, - env, - stdout: 'pipe', - stderr: 'pipe', - }) - last = probe.stdout.toString() || probe.stderr.toString() - if (probe.exitCode === 0) { - const envelope = JSON.parse(last) as { result?: { status?: RuntimeStatus } } - const status = envelope.result?.status - if (status && accept(status)) return status - } - await Bun.sleep(100) - } - throw new Error(`Timed out waiting for Runtime status: ${last}`) -} - -function runProbe(args: string[], env: Record): { stdout: string } { - const probe = Bun.spawnSync([executablePath, ...args], { - cwd: outputRoot, - env, - stdout: 'pipe', - stderr: 'pipe', - }) - const stdout = probe.stdout.toString() - if (probe.exitCode !== 0) { - throw new Error(`${basename(executablePath)} ${args.join(' ')} failed: ${probe.stderr.toString() || stdout}`) - } - return { stdout } -} - -async function waitForHttp(url: string, timeoutMs: number): Promise { - const deadline = Date.now() + timeoutMs - let lastError: unknown = null - while (Date.now() < deadline) { - try { - const response = await fetch(url) - if (response.ok) return - lastError = new Error(`${url} returned ${response.status}`) - } catch (error) { - lastError = error - } - await Bun.sleep(100) - } - throw new Error(`Timed out waiting for ${url}: ${String(lastError)}`) -} - -async function waitForBrokerPackFixture( - utaPort: number, - fixture: { - engine: string - release: string - accountId: string - sdkMarker: string - expectedLabel: string - }, - timeoutMs = 30_000, -): Promise<{ - engine: string - release: string - accountId: string - sdkMarker: string - loadedFromOpenAliceHome: true -}> { - const url = `http://127.0.0.1:${utaPort}/api/trading/uta` - const deadline = Date.now() + timeoutMs - let last = '' - while (Date.now() < deadline) { - try { - const response = await fetch(url) - last = await response.text() - if (response.ok) { - const body = JSON.parse(last) as { - utas?: Array<{ id?: string; label?: string; health?: { reach?: string } }> - } - const account = body.utas?.find((candidate) => candidate.id === fixture.accountId) - if (account?.label === fixture.expectedLabel && account.health?.reach === 'connected') { - return { - engine: fixture.engine, - release: fixture.release, - accountId: fixture.accountId, - sdkMarker: fixture.sdkMarker, - loadedFromOpenAliceHome: true, - } - } - } - } catch (error) { - last = String(error) - } - await Bun.sleep(100) - } - throw new Error(`Timed out waiting for compiled UTA to load external Broker Pack: ${last}`) -} - -function minimalSmokeEnvironment(options: { - home: string - executable: string - webPort: number - mcpPort: number - utaPort: number - connectorPort: number -}): Record { - return { - HOME: options.home, - PATH: dependencyBin, - TMPDIR: process.env['TMPDIR'] ?? '/tmp', - OPENALICE_HOME: options.home, - OPENALICE_APP_HOME: repositoryRoot, - OPENALICE_RUNTIME_PROVIDER: 'bun', - OPENALICE_RUNTIME_EXECUTABLE: options.executable, - OPENALICE_RUNTIME_CONTENT_IDENTITY: 'bun-feasibility', - OPENALICE_TRADING_MODE: 'pro', - OPENALICE_BIND_HOST: '127.0.0.1', - OPENALICE_WEB_PORT: String(options.webPort), - OPENALICE_MCP_PORT: String(options.mcpPort), - OPENALICE_UTA_PORT: String(options.utaPort), - OPENALICE_CONNECTOR_PORT: String(options.connectorPort), - OPENALICE_BROKER_PACK_ALLOW_WORKSPACE: '0', - OPENALICE_BROKER_PACK_AUTO_UPDATE: '0', - ELECTRON_RUN_AS_NODE: '1', - ...(process.env['SystemRoot'] ? { SystemRoot: process.env['SystemRoot'] } : {}), - } -} - -async function allocatePorts(count: number): Promise { - const ports: number[] = [] - for (let index = 0; index < count; index += 1) { - const server = createServer() - await new Promise((resolveListen, reject) => { - server.once('error', reject) - server.listen(0, '127.0.0.1', resolveListen) - }) - const address = server.address() - if (!address || typeof address === 'string') throw new Error('failed to allocate smoke port') - ports.push(address.port) - await new Promise((resolveClose, reject) => { - server.close((error) => error ? reject(error) : resolveClose()) - }) - } - return ports -} diff --git a/scripts/bun-broker-pack-fixture.ts b/scripts/bun-broker-pack-fixture.ts deleted file mode 100644 index f6c51690c..000000000 --- a/scripts/bun-broker-pack-fixture.ts +++ /dev/null @@ -1,182 +0,0 @@ -import { copyFile, mkdir, readdir, writeFile } from 'node:fs/promises' -import { join } from 'node:path' - -const ENGINE = 'ccxt' -const RELEASE = 'bun-external-fixture' -const ACCOUNT_ID = 'binance-readonly' -const SDK_MARKER = 'external-broker-sdk-native-v1' - -export interface BunBrokerPackFixture { - readonly engine: typeof ENGINE - readonly release: typeof RELEASE - readonly accountId: typeof ACCOUNT_ID - readonly sdkMarker: typeof SDK_MARKER - readonly expectedLabel: string -} - -/** - * Materialize a production-shaped active Broker Pack under OPENALICE_HOME. - * The Pack entry imports a dependency from its own node_modules tree so the - * compiled Bun UTA acceptance proves the external module-resolution boundary, - * not merely a standalone file URL import. - */ -export async function prepareBunBrokerPackFixture( - home: string, - productVersion: string, - repositoryRoot: string, -): Promise { - const engineRoot = join(home, 'runtime', 'broker-packs', ENGINE) - const releaseRoot = join(engineRoot, 'releases', RELEASE) - const sdkRoot = join( - releaseRoot, - 'node_modules', - '@openalice-fixture', - 'broker-sdk', - ) - await Promise.all([ - mkdir(join(home, 'data', 'config'), { recursive: true }), - mkdir(join(releaseRoot, 'dist'), { recursive: true }), - mkdir(sdkRoot, { recursive: true }), - ]) - - await Promise.all([ - writeFile( - join(home, 'data', 'config', 'trading.json'), - `${JSON.stringify({ keylessDataSources: ['binance'] }, null, 2)}\n`, - ), - writeFile( - join(engineRoot, 'active.json'), - `${JSON.stringify({ - schemaVersion: 1, - engine: ENGINE, - release: RELEASE, - activatedAt: '2026-08-29T00:00:00.000Z', - }, null, 2)}\n`, - ), - writeFile( - join(releaseRoot, 'broker-pack.json'), - `${JSON.stringify({ - schemaVersion: 1, - apiVersion: 1, - engine: ENGINE, - version: productVersion, - entry: 'dist/index.js', - contentId: RELEASE, - installedAt: '2026-08-29T00:00:00.000Z', - }, null, 2)}\n`, - ), - writeFile( - join(releaseRoot, 'package.json'), - `${JSON.stringify({ - name: '@traderalice/uta-broker-ccxt', - version: productVersion, - type: 'module', - dependencies: { - '@openalice-fixture/broker-sdk': '1.0.0', - }, - }, null, 2)}\n`, - ), - writeFile(join(releaseRoot, 'dist', 'index.js'), brokerPackModuleSource()), - writeFile( - join(sdkRoot, 'package.json'), - `${JSON.stringify({ - name: '@openalice-fixture/broker-sdk', - version: '1.0.0', - type: 'module', - exports: './index.js', - }, null, 2)}\n`, - ), - writeFile( - join(sdkRoot, 'index.js'), - nativeSdkModuleSource(), - ), - copyFile( - await resolveNativeFixtureBinary(repositoryRoot), - join(sdkRoot, 'native-addon.node'), - ), - ]) - - return { - engine: ENGINE, - release: RELEASE, - accountId: ACCOUNT_ID, - sdkMarker: SDK_MARKER, - expectedLabel: `Binance (read-only data) [${SDK_MARKER}]`, - } -} - -async function resolveNativeFixtureBinary(repositoryRoot: string): Promise { - const pnpmRoot = join(repositoryRoot, 'node_modules', '.pnpm') - const storeEntry = (await readdir(pnpmRoot)) - .find((name) => name.startsWith('dprint-node@')) - if (!storeEntry) { - throw new Error('dprint-node native fixture package is missing from node_modules') - } - const suffix = process.platform === 'darwin' - ? `darwin-${process.arch}` - : process.platform === 'linux' - ? `linux-${process.arch}-gnu` - : null - if (!suffix) throw new Error(`Bun Broker Pack native fixture does not support ${process.platform}`) - return join( - pnpmRoot, - storeEntry, - 'node_modules', - 'dprint-node', - `dprint-node.${suffix}.node`, - ) -} - -function nativeSdkModuleSource(): string { - return `import { createRequire } from 'node:module' - -const nativeAddon = createRequire(import.meta.url)('./native-addon.node') -if (typeof nativeAddon.format !== 'function') { - throw new Error('external Broker Pack native SDK did not load') -} - -export const externalSdkMarker = ${JSON.stringify(SDK_MARKER)} -` -} - -function brokerPackModuleSource(): string { - return `import { externalSdkMarker } from '@openalice-fixture/broker-sdk' - -export const BROKER_PACK_API_VERSION = 1 -export const BROKER_ENGINE = 'ccxt' -export const configSchema = { - parse(value) { - if (externalSdkMarker !== ${JSON.stringify(SDK_MARKER)}) { - throw new Error('external Broker Pack SDK did not load') - } - return value - }, -} - -export function createBroker(config) { - const unsupported = async () => { throw new Error('fixture broker operation is unavailable') } - return { - id: config.id, - label: \`${'${config.label ?? config.id}'} [${'${externalSdkMarker}'}]\`, - brokerEngine: BROKER_ENGINE, - init: async () => {}, - close: async () => {}, - searchContracts: async () => [], - getContractDetails: async () => null, - placeOrder: unsupported, - modifyOrder: unsupported, - cancelOrder: unsupported, - closePosition: unsupported, - getAccount: unsupported, - getPositions: async () => [], - getOrders: async () => [], - getOrder: async () => null, - getQuote: unsupported, - getMarketClock: unsupported, - getCapabilities: () => ({ marketData: true, trading: false }), - getNativeKey: (contract) => String(contract?.symbol ?? ''), - resolveNativeKey: (nativeKey) => ({ symbol: nativeKey }), - } -} -` -} diff --git a/scripts/build-bun-release.ts b/scripts/cli/build-bun-release.ts similarity index 99% rename from scripts/build-bun-release.ts rename to scripts/cli/build-bun-release.ts index 77e1b2b9d..1208e3b97 100644 --- a/scripts/build-bun-release.ts +++ b/scripts/cli/build-bun-release.ts @@ -21,11 +21,11 @@ import { import { basename, dirname, join, relative, resolve } from 'node:path' import { fileURLToPath } from 'node:url' -import { INTERNAL_BOOTSTRAP_ROLE } from '../src/workspaces/bootstrap-runtime.js' +import { INTERNAL_BOOTSTRAP_ROLE } from '../../src/workspaces/bootstrap-runtime.js' import { bunReleaseContentIdentity } from './bun-release-content-identity.mjs' -import { inspectSystemDependencies } from '../packages/cli/src/system-dependencies.mjs' +import { inspectSystemDependencies } from '../../packages/cli/src/system-dependencies.mjs' -const repositoryRoot = fileURLToPath(new URL('..', import.meta.url)) +const repositoryRoot = fileURLToPath(new URL('../..', import.meta.url)) requireBunVersion(Bun.version) if (!['darwin', 'linux'].includes(process.platform)) { throw new Error(`Bun CLI releases are currently supported on macOS and Linux, not ${process.platform}`) diff --git a/scripts/build-cli-package-channels.mjs b/scripts/cli/build-cli-package-channels.mjs similarity index 99% rename from scripts/build-cli-package-channels.mjs rename to scripts/cli/build-cli-package-channels.mjs index b54745736..7a5ca6db0 100644 --- a/scripts/build-cli-package-channels.mjs +++ b/scripts/cli/build-cli-package-channels.mjs @@ -1,6 +1,6 @@ #!/usr/bin/env node -import { isVersion } from '../packages/update-lifecycle/src/release-policy.ts' +import { isVersion } from '../../packages/update-lifecycle/src/release-policy.ts' import { execFileSync } from 'node:child_process' import { chmodSync, @@ -20,7 +20,7 @@ import { validateCliReleaseArchive, } from './prepare-cli-dev-assets.mjs' -const repositoryRoot = fileURLToPath(new URL('..', import.meta.url)) +const repositoryRoot = fileURLToPath(new URL('../..', import.meta.url)) const repository = 'TraderAlice/OpenAlice' const npmMetaName = 'openalice' diff --git a/scripts/build-windows-cli-preview.ts b/scripts/cli/build-windows-cli-preview.ts similarity index 98% rename from scripts/build-windows-cli-preview.ts rename to scripts/cli/build-windows-cli-preview.ts index 406b8594e..5f9cc7aa4 100644 --- a/scripts/build-windows-cli-preview.ts +++ b/scripts/cli/build-windows-cli-preview.ts @@ -1,4 +1,4 @@ -import { isVersion } from '../packages/update-lifecycle/src/release-policy.js' +import { isVersion } from '../../packages/update-lifecycle/src/release-policy.js' import { verifyCliReleaseArchive } from './verify-cli-release.mjs' import { requireBunVersion } from './bun-toolchain.mjs' import { writeDevBrokerBinding } from './dev-broker-binding.mjs' @@ -11,7 +11,7 @@ import { bunReleaseContentIdentity } from './bun-release-content-identity.mjs' // Assembly never publishes a channel. Preserve bytes before native acceptance. const channelBuild = process.env.OPENALICE_WINDOWS_CHANNEL_BUILD === '1' -const root = fileURLToPath(new URL('..', import.meta.url)) +const root = fileURLToPath(new URL('../..', import.meta.url)) const arch = process.argv[2] ?? process.arch if (!['x64', 'arm64'].includes(arch)) throw new Error(`Unsupported Windows architecture: ${arch}`) requireBunVersion(Bun.version) diff --git a/scripts/bun-compile-options.ts b/scripts/cli/bun-compile-options.ts similarity index 100% rename from scripts/bun-compile-options.ts rename to scripts/cli/bun-compile-options.ts diff --git a/scripts/bun-native-pty-smoke.ts b/scripts/cli/bun-native-pty-smoke.ts similarity index 97% rename from scripts/bun-native-pty-smoke.ts rename to scripts/cli/bun-native-pty-smoke.ts index b93308d2d..9c4f896a0 100644 --- a/scripts/bun-native-pty-smoke.ts +++ b/scripts/cli/bun-native-pty-smoke.ts @@ -1,7 +1,7 @@ import { join } from 'node:path' -import { loadPtyBackend } from '../src/workspaces/pty-runtime.js' -import type { PtyProcess } from '../src/workspaces/pty-types.js' +import { loadPtyBackend } from '../../src/workspaces/pty-runtime.js' +import type { PtyProcess } from '../../src/workspaces/pty-types.js' const backend = loadPtyBackend() if (backend.name !== 'bun-native') { diff --git a/scripts/bun-release-content-identity.mjs b/scripts/cli/bun-release-content-identity.mjs similarity index 100% rename from scripts/bun-release-content-identity.mjs rename to scripts/cli/bun-release-content-identity.mjs diff --git a/scripts/bun-toolchain.mjs b/scripts/cli/bun-toolchain.mjs similarity index 88% rename from scripts/bun-toolchain.mjs rename to scripts/cli/bun-toolchain.mjs index 7859435f4..d7ba0d1ab 100644 --- a/scripts/bun-toolchain.mjs +++ b/scripts/cli/bun-toolchain.mjs @@ -2,7 +2,7 @@ import { execFileSync } from 'node:child_process' import { readFileSync } from 'node:fs' export function pinnedBunVersion() { - const version = readFileSync(new URL('../.bun-version', import.meta.url), 'utf8').trim() + const version = readFileSync(new URL('../../.bun-version', import.meta.url), 'utf8').trim() if (!/^\d+\.\d+\.\d+$/.test(version)) throw new Error('Invalid exact .bun-version') return version } diff --git a/scripts/cli-aur-container-smoke.mjs b/scripts/cli/cli-aur-container-smoke.mjs similarity index 97% rename from scripts/cli-aur-container-smoke.mjs rename to scripts/cli/cli-aur-container-smoke.mjs index ee7361cbc..2a298cf13 100644 --- a/scripts/cli-aur-container-smoke.mjs +++ b/scripts/cli/cli-aur-container-smoke.mjs @@ -5,7 +5,7 @@ import { existsSync } from 'node:fs' import { dirname, relative, resolve, sep } from 'node:path' import { fileURLToPath, pathToFileURL } from 'node:url' -const repositoryRoot = fileURLToPath(new URL('..', import.meta.url)) +const repositoryRoot = fileURLToPath(new URL('../..', import.meta.url)) export const AUR_IMAGES = Object.freeze({ arm64: { @@ -44,7 +44,7 @@ export function runAurContainerSmoke(options) { 'CURRENT_BUILT_PACKAGE=$(find /tmp/openalice-aur-current -maxdepth 1 -name "openalice-bin-*.pkg.tar.*" -print -quit)', 'test -n "$PREVIOUS_BUILT_PACKAGE" -a -n "$CURRENT_BUILT_PACKAGE"', [ - 'exec /usr/bin/node /work/scripts/cli-system-package-manager-smoke.mjs', + 'exec /usr/bin/node /work/scripts/cli/cli-system-package-manager-smoke.mjs', '--manager aur', '--previous-version "$PREVIOUS_VERSION"', '--current-version "$CURRENT_VERSION"', diff --git a/scripts/cli-legacy-cutover-smoke.mjs b/scripts/cli/cli-legacy-cutover-smoke.mjs similarity index 99% rename from scripts/cli-legacy-cutover-smoke.mjs rename to scripts/cli/cli-legacy-cutover-smoke.mjs index b4fd24f5b..7833d582d 100644 --- a/scripts/cli-legacy-cutover-smoke.mjs +++ b/scripts/cli/cli-legacy-cutover-smoke.mjs @@ -335,7 +335,7 @@ export function parseArgs(argv) { const result = { channel: 'stable', curl: 'curl', - installer: resolve(import.meta.dirname, '..', 'install'), + installer: resolve(import.meta.dirname, '../..', 'install'), legacyversion: DEFAULT_LEGACY_VERSION, legacyinstallerurl: DEFAULT_LEGACY_INSTALLER_URL, legacyinstallersha256: DEFAULT_LEGACY_INSTALLER_SHA256, diff --git a/scripts/cli-linuxbrew-smoke.mjs b/scripts/cli/cli-linuxbrew-smoke.mjs similarity index 96% rename from scripts/cli-linuxbrew-smoke.mjs rename to scripts/cli/cli-linuxbrew-smoke.mjs index 26f60fb58..556993a6c 100644 --- a/scripts/cli-linuxbrew-smoke.mjs +++ b/scripts/cli/cli-linuxbrew-smoke.mjs @@ -5,7 +5,7 @@ import { existsSync } from 'node:fs' import { relative, resolve, sep } from 'node:path' import { fileURLToPath, pathToFileURL } from 'node:url' -const repositoryRoot = fileURLToPath(new URL('..', import.meta.url)) +const repositoryRoot = fileURLToPath(new URL('../..', import.meta.url)) export const LINUXBREW_IMAGES = Object.freeze({ arm64: { @@ -27,7 +27,7 @@ export function runLinuxbrewSmoke(options) { 'sudo apt-get update -qq', 'sudo apt-get install -y -qq nodejs >/dev/null', [ - 'exec /usr/bin/node /work/scripts/cli-system-package-manager-smoke.mjs', + 'exec /usr/bin/node /work/scripts/cli/cli-system-package-manager-smoke.mjs', '--manager brew', '--previous-version "$PREVIOUS_VERSION"', '--current-version "$CURRENT_VERSION"', diff --git a/scripts/cli-package-manager-smoke.mjs b/scripts/cli/cli-package-manager-smoke.mjs similarity index 98% rename from scripts/cli-package-manager-smoke.mjs rename to scripts/cli/cli-package-manager-smoke.mjs index 4c8667f61..57ccd2624 100644 --- a/scripts/cli-package-manager-smoke.mjs +++ b/scripts/cli/cli-package-manager-smoke.mjs @@ -20,7 +20,7 @@ import { syntheticPreviousVersion, } from './cli-release-fixture.mjs' -const packageManagerUsage = 'Usage: node scripts/cli-package-manager-smoke.mjs --manager --packages-dir --expected-version --expected-content-identity [--npm ] [--bun ] [--keep]' +const packageManagerUsage = 'Usage: node scripts/cli/cli-package-manager-smoke.mjs --manager --packages-dir --expected-version --expected-content-identity [--npm ] [--bun ] [--keep]' if (process.argv.includes('--help')) { process.stdout.write(`${packageManagerUsage}\n`) process.stdout.write('Artifact acceptance only: generate the CLI package candidates before running this command.\n') diff --git a/scripts/cli-release-fixture.mjs b/scripts/cli/cli-release-fixture.mjs similarity index 98% rename from scripts/cli-release-fixture.mjs rename to scripts/cli/cli-release-fixture.mjs index 308096cb3..601a695a0 100644 --- a/scripts/cli-release-fixture.mjs +++ b/scripts/cli/cli-release-fixture.mjs @@ -18,7 +18,7 @@ import { validateCliReleaseArchive, } from './prepare-cli-dev-assets.mjs' import { bunReleaseContentIdentity } from './bun-release-content-identity.mjs' -import { cliExecutableName } from '../packages/cli/src/release-targets.mjs' +import { cliExecutableName } from '../../packages/cli/src/release-targets.mjs' export function preparePreviousCliReleaseArchives({ inputDir, outputDir, version }) { const inputRoot = resolve(inputDir) diff --git a/scripts/cli-system-package-manager-smoke.mjs b/scripts/cli/cli-system-package-manager-smoke.mjs similarity index 100% rename from scripts/cli-system-package-manager-smoke.mjs rename to scripts/cli/cli-system-package-manager-smoke.mjs diff --git a/scripts/dev-broker-binding.mjs b/scripts/cli/dev-broker-binding.mjs similarity index 100% rename from scripts/dev-broker-binding.mjs rename to scripts/cli/dev-broker-binding.mjs diff --git a/scripts/install-channel-smoke.mjs b/scripts/cli/install-channel-smoke.mjs similarity index 96% rename from scripts/install-channel-smoke.mjs rename to scripts/cli/install-channel-smoke.mjs index 5a26960ad..46674f6cc 100644 --- a/scripts/install-channel-smoke.mjs +++ b/scripts/cli/install-channel-smoke.mjs @@ -2,7 +2,7 @@ import { spawnSync } from 'node:child_process' import { fileURLToPath } from 'node:url' -const repoRoot = fileURLToPath(new URL('..', import.meta.url)) +const repoRoot = fileURLToPath(new URL('../..', import.meta.url)) const suffix = `${process.pid}-${Date.now().toString(36)}` const image = `openalice-install-channel-smoke:${suffix}` const args = process.argv.slice(2) @@ -82,7 +82,7 @@ try { console.log(`[install-channel-smoke] building ${image}`) docker([ 'build', - '--file', 'scripts/install-channel-smoke/Dockerfile', + '--file', 'scripts/cli/install-channel-smoke/Dockerfile', '--tag', image, '.', ]) diff --git a/scripts/install-channel-smoke/Dockerfile b/scripts/cli/install-channel-smoke/Dockerfile similarity index 88% rename from scripts/install-channel-smoke/Dockerfile rename to scripts/cli/install-channel-smoke/Dockerfile index 7635bcfa9..134081ca6 100644 --- a/scripts/install-channel-smoke/Dockerfile +++ b/scripts/cli/install-channel-smoke/Dockerfile @@ -7,7 +7,7 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update \ && mkdir -p /home/smoke \ && chown smoke:smoke /home/smoke -COPY scripts/install-channel-smoke/run.sh /fixture/run.sh +COPY scripts/cli/install-channel-smoke/run.sh /fixture/run.sh RUN chmod +x /fixture/run.sh USER smoke diff --git a/scripts/install-channel-smoke/run.sh b/scripts/cli/install-channel-smoke/run.sh similarity index 100% rename from scripts/install-channel-smoke/run.sh rename to scripts/cli/install-channel-smoke/run.sh diff --git a/scripts/install-docker-smoke.mjs b/scripts/cli/install-docker-smoke.mjs similarity index 95% rename from scripts/install-docker-smoke.mjs rename to scripts/cli/install-docker-smoke.mjs index d7c43e08f..6179814f5 100644 --- a/scripts/install-docker-smoke.mjs +++ b/scripts/cli/install-docker-smoke.mjs @@ -2,7 +2,7 @@ import { spawnSync } from 'node:child_process' import { fileURLToPath } from 'node:url' -const repoRoot = fileURLToPath(new URL('..', import.meta.url)) +const repoRoot = fileURLToPath(new URL('../..', import.meta.url)) const suffix = `${process.pid}-${Date.now().toString(36)}` const image = `openalice-install-smoke:${suffix}` const args = process.argv.slice(2) @@ -52,7 +52,7 @@ try { console.log(`[install-docker-smoke] building ${image}`) docker([ 'build', - '--file', 'scripts/install-smoke/Dockerfile', + '--file', 'scripts/cli/install-smoke/Dockerfile', '--tag', image, '.', ]) diff --git a/scripts/install-smoke/Dockerfile b/scripts/cli/install-smoke/Dockerfile similarity index 75% rename from scripts/install-smoke/Dockerfile rename to scripts/cli/install-smoke/Dockerfile index daa8604fc..8b19ffeda 100644 --- a/scripts/install-smoke/Dockerfile +++ b/scripts/cli/install-smoke/Dockerfile @@ -9,8 +9,8 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update \ WORKDIR /fixture COPY --chown=smoke:smoke install /fixture/install -COPY --chown=smoke:smoke scripts/install-smoke/run.sh /fixture/run.sh -COPY --chown=smoke:smoke scripts/install-smoke/interactive.sh /fixture/interactive.sh +COPY --chown=smoke:smoke scripts/cli/install-smoke/run.sh /fixture/run.sh +COPY --chown=smoke:smoke scripts/cli/install-smoke/interactive.sh /fixture/interactive.sh USER smoke ENV HOME=/home/smoke diff --git a/scripts/install-smoke/interactive.sh b/scripts/cli/install-smoke/interactive.sh similarity index 100% rename from scripts/install-smoke/interactive.sh rename to scripts/cli/install-smoke/interactive.sh diff --git a/scripts/install-smoke/run.sh b/scripts/cli/install-smoke/run.sh similarity index 100% rename from scripts/install-smoke/run.sh rename to scripts/cli/install-smoke/run.sh diff --git a/scripts/macho-signature.mjs b/scripts/cli/macho-signature.mjs similarity index 100% rename from scripts/macho-signature.mjs rename to scripts/cli/macho-signature.mjs diff --git a/scripts/native-upgrade-acceptance.mjs b/scripts/cli/native-upgrade-acceptance.mjs similarity index 100% rename from scripts/native-upgrade-acceptance.mjs rename to scripts/cli/native-upgrade-acceptance.mjs diff --git a/scripts/pack-cli-npm-packages.mjs b/scripts/cli/pack-cli-npm-packages.mjs similarity index 98% rename from scripts/pack-cli-npm-packages.mjs rename to scripts/cli/pack-cli-npm-packages.mjs index 220e11b4e..2fabaae9e 100644 --- a/scripts/pack-cli-npm-packages.mjs +++ b/scripts/cli/pack-cli-npm-packages.mjs @@ -12,7 +12,7 @@ import { homedir } from 'node:os' import { join, parse, resolve } from 'node:path' import { fileURLToPath, pathToFileURL } from 'node:url' -const repositoryRoot = fileURLToPath(new URL('..', import.meta.url)) +const repositoryRoot = fileURLToPath(new URL('../..', import.meta.url)) export function packCliNpmPackages({ inputDir, diff --git a/scripts/preflight-public-cli-authority.mjs b/scripts/cli/preflight-public-cli-authority.mjs similarity index 100% rename from scripts/preflight-public-cli-authority.mjs rename to scripts/cli/preflight-public-cli-authority.mjs diff --git a/scripts/prepare-cli-dev-assets.mjs b/scripts/cli/prepare-cli-dev-assets.mjs similarity index 96% rename from scripts/prepare-cli-dev-assets.mjs rename to scripts/cli/prepare-cli-dev-assets.mjs index 9e8a10fb4..1db8cef29 100644 --- a/scripts/prepare-cli-dev-assets.mjs +++ b/scripts/cli/prepare-cli-dev-assets.mjs @@ -8,7 +8,7 @@ import { join, parse, resolve } from 'node:path' import { fileURLToPath, pathToFileURL } from 'node:url' import { verifyCliReleaseArchive as validateCliReleaseArchive } from './verify-cli-release.mjs' -import { CLI_RELEASE_TARGETS, cliExecutableName } from '../packages/cli/src/release-targets.mjs' +import { CLI_RELEASE_TARGETS, cliExecutableName } from '../../packages/cli/src/release-targets.mjs' import { readDevBrokerCatalog } from './dev-broker-binding.mjs' @@ -39,12 +39,12 @@ export function prepareCliDevAssets({ inputDir, outputDir, commit, version, inst mkdirSync(aliasRoot, { recursive: true }) const installerSource = resolve( - installerPath ?? fileURLToPath(new URL('../install', import.meta.url)), + installerPath ?? fileURLToPath(new URL('../../install', import.meta.url)), ) const installerBytes = readFileSync(installerSource) const installerSha256 = createHash('sha256').update(installerBytes).digest('hex') copyFileSync(installerSource, join(immutableRoot, 'install')) - const windowsInstallerSource = windowsInstallerPath ?? fileURLToPath(new URL('../install.ps1', import.meta.url)) + const windowsInstallerSource = windowsInstallerPath ?? fileURLToPath(new URL('../../install.ps1', import.meta.url)) const windowsInstallerBytes = readFileSync(windowsInstallerSource) copyFileSync(windowsInstallerSource, join(immutableRoot, 'install.ps1')) diff --git a/scripts/prepare-cli-neutral-inputs.mjs b/scripts/cli/prepare-cli-neutral-inputs.mjs similarity index 100% rename from scripts/prepare-cli-neutral-inputs.mjs rename to scripts/cli/prepare-cli-neutral-inputs.mjs diff --git a/scripts/prepare-cli-previous-release.mjs b/scripts/cli/prepare-cli-previous-release.mjs similarity index 100% rename from scripts/prepare-cli-previous-release.mjs rename to scripts/cli/prepare-cli-previous-release.mjs diff --git a/scripts/publish-cli-npm-packages.mjs b/scripts/cli/publish-cli-npm-packages.mjs similarity index 100% rename from scripts/publish-cli-npm-packages.mjs rename to scripts/cli/publish-cli-npm-packages.mjs diff --git a/scripts/release-artifacts.mjs b/scripts/cli/release-artifacts.mjs similarity index 100% rename from scripts/release-artifacts.mjs rename to scripts/cli/release-artifacts.mjs diff --git a/scripts/release-candidate-identity.mjs b/scripts/cli/release-candidate-identity.mjs similarity index 98% rename from scripts/release-candidate-identity.mjs rename to scripts/cli/release-candidate-identity.mjs index 4dab23477..acc5105cb 100644 --- a/scripts/release-candidate-identity.mjs +++ b/scripts/cli/release-candidate-identity.mjs @@ -1,4 +1,4 @@ -import { releaseChannelMatchesVersion } from '../packages/update-lifecycle/src/release-policy.ts' +import { releaseChannelMatchesVersion } from '../../packages/update-lifecycle/src/release-policy.ts' import { createHash } from 'node:crypto' import { lstatSync, readFileSync, readdirSync } from 'node:fs' import { basename, join } from 'node:path' diff --git a/scripts/remote-smoke/Dockerfile b/scripts/cli/remote-smoke/Dockerfile similarity index 97% rename from scripts/remote-smoke/Dockerfile rename to scripts/cli/remote-smoke/Dockerfile index be3731aab..85f0e57c6 100644 --- a/scripts/remote-smoke/Dockerfile +++ b/scripts/cli/remote-smoke/Dockerfile @@ -26,7 +26,7 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update \ COPY install /fixture/www/install COPY --from=builder /repo/dist/bun-release/openalice-cli-*.tar.gz /fixture/artifacts/ COPY --from=builder /repo/dist/bun-release/openalice-cli-*.tar.gz.sha256 /fixture/artifacts/ -COPY scripts/remote-smoke/entrypoint.sh /fixture/entrypoint.sh +COPY scripts/cli/remote-smoke/entrypoint.sh /fixture/entrypoint.sh RUN archive="$(find /fixture/artifacts -name 'openalice-cli-*-linux-*.tar.gz' -type f -print -quit)" \ && test -n "$archive" \ diff --git a/scripts/remote-smoke/entrypoint.sh b/scripts/cli/remote-smoke/entrypoint.sh similarity index 100% rename from scripts/remote-smoke/entrypoint.sh rename to scripts/cli/remote-smoke/entrypoint.sh diff --git a/scripts/remote-ssh-smoke-options.mjs b/scripts/cli/remote-ssh-smoke-options.mjs similarity index 100% rename from scripts/remote-ssh-smoke-options.mjs rename to scripts/cli/remote-ssh-smoke-options.mjs diff --git a/scripts/remote-ssh-smoke-targets.mjs b/scripts/cli/remote-ssh-smoke-targets.mjs similarity index 100% rename from scripts/remote-ssh-smoke-targets.mjs rename to scripts/cli/remote-ssh-smoke-targets.mjs diff --git a/scripts/remote-ssh-smoke.mjs b/scripts/cli/remote-ssh-smoke.mjs similarity index 98% rename from scripts/remote-ssh-smoke.mjs rename to scripts/cli/remote-ssh-smoke.mjs index 75790d97b..8dc17bd97 100644 --- a/scripts/remote-ssh-smoke.mjs +++ b/scripts/cli/remote-ssh-smoke.mjs @@ -7,10 +7,10 @@ import { tmpdir } from 'node:os' import { join } from 'node:path' import { fileURLToPath } from 'node:url' -import { writeAliceProjectProductStamp } from '../packages/cli/src/alice-project-product.ts' -import { planProjectTransfer } from '../packages/cli/src/project-transfer.ts' -import { sealProjectTransferJson } from '../packages/cli/src/project-transfer-secrets.ts' -import { writeProjectTransferStream } from '../packages/cli/src/project-transfer-stream.ts' +import { writeAliceProjectProductStamp } from '../../packages/cli/src/alice-project-product.ts' +import { planProjectTransfer } from '../../packages/cli/src/project-transfer.ts' +import { sealProjectTransferJson } from '../../packages/cli/src/project-transfer-secrets.ts' +import { writeProjectTransferStream } from '../../packages/cli/src/project-transfer-stream.ts' import { parseRemoteSshSmokeOptions } from './remote-ssh-smoke-options.mjs' import { verifyRemoteUpgradeRecovery } from './remote-upgrade-recovery-smoke.mjs' import { @@ -19,7 +19,7 @@ import { requireMissingAgentRuntime, } from './remote-ssh-smoke-targets.mjs' -const repoRoot = fileURLToPath(new URL('..', import.meta.url)) +const repoRoot = fileURLToPath(new URL('../..', import.meta.url)) const cliEntry = join(repoRoot, 'packages/cli/bin/openalice.ts') const suffix = `${process.pid}-${Date.now().toString(36)}` let options @@ -70,7 +70,7 @@ try { console.log(`[remote-ssh-smoke] building ${image}`) run('docker', [ 'build', - '--file', 'scripts/remote-smoke/Dockerfile', + '--file', 'scripts/cli/remote-smoke/Dockerfile', '--build-arg', `BUN_VERSION=${pinnedBunVersion()}`, '--tag', image, '.', diff --git a/scripts/remote-upgrade-recovery-smoke.mjs b/scripts/cli/remote-upgrade-recovery-smoke.mjs similarity index 96% rename from scripts/remote-upgrade-recovery-smoke.mjs rename to scripts/cli/remote-upgrade-recovery-smoke.mjs index b8bfbcd31..57b2c8f80 100644 --- a/scripts/remote-upgrade-recovery-smoke.mjs +++ b/scripts/cli/remote-upgrade-recovery-smoke.mjs @@ -3,8 +3,8 @@ import { spawn } from 'node:child_process' import { once } from 'node:events' import { join } from 'node:path' import { compareVersions } from '@traderalice/update-lifecycle' -import { connectRemote, createRemotePlan, parseRemoteArgs, probeRemoteHost } from '../packages/cli/src/remote.mjs' -import { allocateLoopbackPort, waitForOpenAlice } from '../packages/cli/src/runtime-client.mjs' +import { connectRemote, createRemotePlan, parseRemoteArgs, probeRemoteHost } from '../../packages/cli/src/remote.mjs' +import { allocateLoopbackPort, waitForOpenAlice } from '../../packages/cli/src/runtime-client.mjs' export async function verifyRemoteUpgradeRecovery({ from, to, remoteTarget, env, scratch, run, remoteJson }) { if (compareVersions(to, from) <= 0) throw new Error('Recovery acceptance requires an increasing release pair') diff --git a/scripts/select-release-candidate.mjs b/scripts/cli/select-release-candidate.mjs similarity index 100% rename from scripts/select-release-candidate.mjs rename to scripts/cli/select-release-candidate.mjs diff --git a/scripts/select-release-verifier.mjs b/scripts/cli/select-release-verifier.mjs similarity index 100% rename from scripts/select-release-verifier.mjs rename to scripts/cli/select-release-verifier.mjs diff --git a/scripts/sign-cli-macos.mjs b/scripts/cli/sign-cli-macos.mjs similarity index 100% rename from scripts/sign-cli-macos.mjs rename to scripts/cli/sign-cli-macos.mjs diff --git a/scripts/stage-cli-release.mjs b/scripts/cli/stage-cli-release.mjs similarity index 98% rename from scripts/stage-cli-release.mjs rename to scripts/cli/stage-cli-release.mjs index 6c084422c..1a9d63624 100644 --- a/scripts/stage-cli-release.mjs +++ b/scripts/cli/stage-cli-release.mjs @@ -1,7 +1,7 @@ import { copyFileSync, lstatSync, mkdirSync, readdirSync } from 'node:fs' import { dirname, join, resolve } from 'node:path' import { pathToFileURL } from 'node:url' -import { CLI_RELEASE_TARGETS } from '../packages/cli/src/release-targets.mjs' +import { CLI_RELEASE_TARGETS } from '../../packages/cli/src/release-targets.mjs' import { verifyCliReleaseArchive } from './verify-cli-release.mjs' import { downloadArtifact, latestArtifact, listRunArtifacts, recordSelection } from './release-artifacts.mjs' diff --git a/scripts/verify-cli-release.mjs b/scripts/cli/verify-cli-release.mjs similarity index 98% rename from scripts/verify-cli-release.mjs rename to scripts/cli/verify-cli-release.mjs index 9ea670876..f33834f46 100644 --- a/scripts/verify-cli-release.mjs +++ b/scripts/cli/verify-cli-release.mjs @@ -8,7 +8,7 @@ import { pathToFileURL } from 'node:url' import { bunReleaseContentIdentity } from './bun-release-content-identity.mjs' import { pinnedBunVersion } from './bun-toolchain.mjs' import { inspectMachOSignature } from './macho-signature.mjs' -import { CLI_RELEASE_TARGETS, cliExecutableName } from '../packages/cli/src/release-targets.mjs' +import { CLI_RELEASE_TARGETS, cliExecutableName } from '../../packages/cli/src/release-targets.mjs' const hash = bytes => createHash('sha256').update(bytes).digest('hex') const tarEnvironment = { ...process.env, COPYFILE_DISABLE: '1' } diff --git a/scripts/verify-public-cli-channels.mjs b/scripts/cli/verify-public-cli-channels.mjs similarity index 98% rename from scripts/verify-public-cli-channels.mjs rename to scripts/cli/verify-public-cli-channels.mjs index c261a089f..605eb73fd 100644 --- a/scripts/verify-public-cli-channels.mjs +++ b/scripts/cli/verify-public-cli-channels.mjs @@ -5,7 +5,7 @@ import { readFileSync } from 'node:fs' import { resolve } from 'node:path' import { pathToFileURL } from 'node:url' -import { CLI_RELEASE_TARGETS as TARGETS } from '../packages/cli/src/release-targets.mjs' +import { CLI_RELEASE_TARGETS as TARGETS } from '../../packages/cli/src/release-targets.mjs' export async function verifyPublicCliChannels({ manifestPath, diff --git a/scripts/windows-cli-package-smoke.ps1 b/scripts/cli/windows-cli-package-smoke.ps1 similarity index 96% rename from scripts/windows-cli-package-smoke.ps1 rename to scripts/cli/windows-cli-package-smoke.ps1 index 145658702..1cfd59ede 100644 --- a/scripts/windows-cli-package-smoke.ps1 +++ b/scripts/cli/windows-cli-package-smoke.ps1 @@ -15,7 +15,7 @@ function Get-PackFilename([string]$Json) { if ($entries.Count -ne 1 -or -not $entries[0].filename) { throw 'Invalid npm pack JSON report.' } return $entries[0].filename } -& $bun scripts/build-cli-package-channels.mjs --input-dir $CandidateDir --output-dir $packages --version $candidate.version --released-at ([DateTime]::UtcNow.ToString('o')) --npm-only +& $bun scripts/cli/build-cli-package-channels.mjs --input-dir $CandidateDir --output-dir $packages --version $candidate.version --released-at ([DateTime]::UtcNow.ToString('o')) --npm-only if ($LASTEXITCODE -ne 0) { throw 'Package generation failed.' } $platformName = "openalice-windows-$($candidate.arch)" $report = & $npm pack (Join-Path $packages "npm\$platformName") --json --pack-destination $tarballs diff --git a/scripts/windows-cli-preview-smoke.ts b/scripts/cli/windows-cli-preview-smoke.ts similarity index 100% rename from scripts/windows-cli-preview-smoke.ts rename to scripts/cli/windows-cli-preview-smoke.ts diff --git a/scripts/assert-desktop-package.mjs b/scripts/desktop/assert-desktop-package.mjs similarity index 99% rename from scripts/assert-desktop-package.mjs rename to scripts/desktop/assert-desktop-package.mjs index 5679fd6bc..a62b9b2df 100644 --- a/scripts/assert-desktop-package.mjs +++ b/scripts/desktop/assert-desktop-package.mjs @@ -7,7 +7,7 @@ import { DEFAULT_DESKTOP_PACKAGE_ROOT, resolveDesktopPackageRootArg } from './de const __filename = fileURLToPath(import.meta.url) const __dirname = dirname(__filename) -const repoRoot = resolve(__dirname, '..') +const repoRoot = resolve(__dirname, '..', '..') export const RESOURCE_ROOT_RELATIVE_CANDIDATES = [ 'mac-arm64/OpenAlice.app/Contents/Resources/runtime', diff --git a/scripts/build-desktop-relay.mjs b/scripts/desktop/build-desktop-relay.mjs similarity index 80% rename from scripts/build-desktop-relay.mjs rename to scripts/desktop/build-desktop-relay.mjs index c59152af7..89c1650b0 100644 --- a/scripts/build-desktop-relay.mjs +++ b/scripts/desktop/build-desktop-relay.mjs @@ -1,7 +1,7 @@ import { readFile } from 'node:fs/promises' import { build } from 'tsup' -const product = JSON.parse(await readFile(new URL('../package.json', import.meta.url), 'utf8')) +const product = JSON.parse(await readFile(new URL('../../package.json', import.meta.url), 'utf8')) await build({ entry: ['packages/cli/src/web-relay.ts'], diff --git a/scripts/desktop-after-pack.mjs b/scripts/desktop/desktop-after-pack.mjs similarity index 100% rename from scripts/desktop-after-pack.mjs rename to scripts/desktop/desktop-after-pack.mjs diff --git a/scripts/desktop-candidate-receipt.mjs b/scripts/desktop/desktop-candidate-receipt.mjs similarity index 98% rename from scripts/desktop-candidate-receipt.mjs rename to scripts/desktop/desktop-candidate-receipt.mjs index ed5508514..d338e2df0 100644 --- a/scripts/desktop-candidate-receipt.mjs +++ b/scripts/desktop/desktop-candidate-receipt.mjs @@ -1,7 +1,7 @@ import { appendFileSync, copyFileSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from 'node:fs' import { join, resolve } from 'node:path' import { pathToFileURL } from 'node:url' -import { createCandidateIdentity, verifyCandidateIdentity, createCandidateAcceptance, verifyCandidateAcceptance } from './release-candidate-identity.mjs' +import { createCandidateIdentity, verifyCandidateIdentity, createCandidateAcceptance, verifyCandidateAcceptance } from '../cli/release-candidate-identity.mjs' export const DESKTOP_UPGRADE_CHECKS = Object.freeze([ 'previousVersionMatched', 'previousWorkspaceSeeded', 'candidateVersionMatched', diff --git a/scripts/desktop-existing-owner-smoke.mjs b/scripts/desktop/desktop-existing-owner-smoke.mjs similarity index 99% rename from scripts/desktop-existing-owner-smoke.mjs rename to scripts/desktop/desktop-existing-owner-smoke.mjs index 33d2d0dae..d752d7adb 100644 --- a/scripts/desktop-existing-owner-smoke.mjs +++ b/scripts/desktop/desktop-existing-owner-smoke.mjs @@ -7,7 +7,7 @@ import { tmpdir } from 'node:os' import { fileURLToPath } from 'node:url' import { desktopDevExecutable, spawnDesktopSmoke, stopDesktopSmoke } from './desktop-smoke-process.mjs' -const repoRoot = fileURLToPath(new URL('..', import.meta.url)) +const repoRoot = fileURLToPath(new URL('../..', import.meta.url)) const pnpmCommand = process.platform === 'win32' ? (process.env.ComSpec ?? 'cmd.exe') : 'pnpm' const pnpmArgs = (commandArgs) => process.platform === 'win32' ? ['/d', '/s', '/c', ['pnpm.cmd', ...commandArgs].join(' ')] diff --git a/scripts/desktop-package-artifact.mjs b/scripts/desktop/desktop-package-artifact.mjs similarity index 98% rename from scripts/desktop-package-artifact.mjs rename to scripts/desktop/desktop-package-artifact.mjs index f5e3a3ec6..6200ef62a 100644 --- a/scripts/desktop-package-artifact.mjs +++ b/scripts/desktop/desktop-package-artifact.mjs @@ -5,7 +5,7 @@ import { fileURLToPath } from 'node:url' const scriptDir = dirname(fileURLToPath(import.meta.url)) -export const DEFAULT_DESKTOP_PACKAGE_ROOT = resolve(scriptDir, '..', 'dist', 'electron-app') +export const DEFAULT_DESKTOP_PACKAGE_ROOT = resolve(scriptDir, '..', '..', 'dist', 'electron-app') export const DESKTOP_PACKAGE_OWNER_MARKER = '.openalice-package-smoke-owner.json' export function resolveDesktopPackageRootArg(argv, cwd = process.cwd()) { diff --git a/scripts/desktop-packaged-smoke-plan.mjs b/scripts/desktop/desktop-packaged-smoke-plan.mjs similarity index 100% rename from scripts/desktop-packaged-smoke-plan.mjs rename to scripts/desktop/desktop-packaged-smoke-plan.mjs diff --git a/scripts/desktop-packaged-smoke.mjs b/scripts/desktop/desktop-packaged-smoke.mjs similarity index 98% rename from scripts/desktop-packaged-smoke.mjs rename to scripts/desktop/desktop-packaged-smoke.mjs index 283527d42..6c30a11c6 100644 --- a/scripts/desktop-packaged-smoke.mjs +++ b/scripts/desktop/desktop-packaged-smoke.mjs @@ -1,5 +1,5 @@ #!/usr/bin/env node -import { writeProjectWorkspaceRequest } from '../packages/cli/src/project-workspaces.ts' +import { writeProjectWorkspaceRequest } from '../../packages/cli/src/project-workspaces.ts' import { spawnSync } from 'node:child_process' import { existsSync, mkdirSync, mkdtempSync, rmSync, readFileSync } from 'node:fs' import { createServer as createNetServer } from 'node:net' @@ -12,7 +12,7 @@ import { DEFAULT_DESKTOP_PACKAGE_ROOT, } from './desktop-package-artifact.mjs' import { buildDesktopPackagedSmokePlan, desktopSmokeStateEnv } from './desktop-packaged-smoke-plan.mjs' -import { runPnpmSync } from './pnpm-command.mjs' +import { runPnpmSync } from '../pnpm-command.mjs' import { packagedElectronExecutable } from './smoke-packaged-toolchain.mjs' import { spawnDesktopSmoke, stopDesktopSmoke } from './desktop-smoke-process.mjs' import { startWorkspaceAcceptanceAiMock } from './workspace-acceptance-ai-mock.mjs' @@ -21,7 +21,7 @@ import { readWorkspaceAcceptanceReceipt, } from './workspace-acceptance-receipt.mjs' -const repoRoot = resolve(import.meta.dirname, '..') +const repoRoot = resolve(import.meta.dirname, '..', '..') const plan = buildDesktopPackagedSmokePlan(process.argv.slice(2), process.env) const { keep, @@ -265,7 +265,7 @@ async function main() { if (workspaceAcceptance) { // Seed only the durable native handoff. The real candidate process must // prove its own identity/readiness; no native installer is simulated here. - const { DesktopUpdateLifecycle } = await import('../dist/electron/update-lifecycle.js') + const { DesktopUpdateLifecycle } = await import('../../dist/electron/update-lifecycle.js') const version = JSON.parse(readFileSync(join(repoRoot, 'package.json'), 'utf8')).version await new DesktopUpdateLifecycle(env.OPENALICE_ELECTRON_SMOKE_USER_DATA, () => '0.0.0').install(version, async () => {}, async () => {}) } diff --git a/scripts/desktop-pty-smoke.mjs b/scripts/desktop/desktop-pty-smoke.mjs similarity index 99% rename from scripts/desktop-pty-smoke.mjs rename to scripts/desktop/desktop-pty-smoke.mjs index fb1530103..fbd929f82 100644 --- a/scripts/desktop-pty-smoke.mjs +++ b/scripts/desktop/desktop-pty-smoke.mjs @@ -8,7 +8,7 @@ import { tmpdir } from 'node:os' import { fileURLToPath } from 'node:url' import { desktopDevExecutable, spawnDesktopSmoke, stopDesktopSmoke } from './desktop-smoke-process.mjs' -const repoRoot = fileURLToPath(new URL('..', import.meta.url)) +const repoRoot = fileURLToPath(new URL('../..', import.meta.url)) const pnpmCommand = process.platform === 'win32' ? (process.env.ComSpec ?? 'cmd.exe') : 'pnpm' const pnpmArgs = (commandArgs) => process.platform === 'win32' ? ['/d', '/s', '/c', ['pnpm.cmd', ...commandArgs].join(' ')] diff --git a/scripts/desktop-smoke-process.mjs b/scripts/desktop/desktop-smoke-process.mjs similarity index 97% rename from scripts/desktop-smoke-process.mjs rename to scripts/desktop/desktop-smoke-process.mjs index c7b3a3e53..1b30db364 100644 --- a/scripts/desktop-smoke-process.mjs +++ b/scripts/desktop/desktop-smoke-process.mjs @@ -2,7 +2,7 @@ import { spawn, spawnSync } from 'node:child_process' import { createRequire } from 'node:module' import { readFileSync, readdirSync } from 'node:fs' -const requireDesktop = createRequire(new URL('../apps/desktop/package.json', import.meta.url)) +const requireDesktop = createRequire(new URL('../../apps/desktop/package.json', import.meta.url)) export function desktopDevExecutable() { return requireDesktop('electron') diff --git a/scripts/desktop-startup-smoke.mjs b/scripts/desktop/desktop-startup-smoke.mjs similarity index 97% rename from scripts/desktop-startup-smoke.mjs rename to scripts/desktop/desktop-startup-smoke.mjs index 94b95c713..ee4c889a7 100644 --- a/scripts/desktop-startup-smoke.mjs +++ b/scripts/desktop/desktop-startup-smoke.mjs @@ -11,7 +11,7 @@ const appPath = appPathIndex >= 0 ? process.argv[appPathIndex + 1] : null if (appPathIndex >= 0 && !appPath) throw new Error('--app-path requires the packaged executable') const connectedHomeIndex = process.argv.indexOf('--connected-home') const connectedHome = connectedHomeIndex >= 0 ? process.argv[connectedHomeIndex + 1] : null -const repoRoot = fileURLToPath(new URL('..', import.meta.url)) +const repoRoot = fileURLToPath(new URL('../..', import.meta.url)) for (const hasRecent of connectedHome ? [false] : [false, true]) { const root = await mkdtemp(join(tmpdir(), 'openalice-startup-smoke-')) let child diff --git a/scripts/desktop-upgrade-smoke-lib.mjs b/scripts/desktop/desktop-upgrade-smoke-lib.mjs similarity index 100% rename from scripts/desktop-upgrade-smoke-lib.mjs rename to scripts/desktop/desktop-upgrade-smoke-lib.mjs diff --git a/scripts/desktop-upgrade-smoke.mjs b/scripts/desktop/desktop-upgrade-smoke.mjs similarity index 99% rename from scripts/desktop-upgrade-smoke.mjs rename to scripts/desktop/desktop-upgrade-smoke.mjs index c0e48de61..18ae2eb10 100644 --- a/scripts/desktop-upgrade-smoke.mjs +++ b/scripts/desktop/desktop-upgrade-smoke.mjs @@ -36,7 +36,7 @@ import { } from './desktop-upgrade-smoke-lib.mjs' import { packagedElectronExecutable } from './smoke-packaged-toolchain.mjs' -const repoRoot = resolve(import.meta.dirname, '..') +const repoRoot = resolve(import.meta.dirname, '..', '..') const candidateVersion = process.env.CANDIDATE_VERSION || JSON.parse(readFileSync(join(repoRoot, 'package.json'), 'utf8')).version if (!/^\d+\.\d+\.\d+(?:-beta(?:\.[1-9]\d*)?)?$/.test(candidateVersion)) { diff --git a/scripts/prepare-desktop-release-assets.mjs b/scripts/desktop/prepare-desktop-release-assets.mjs similarity index 98% rename from scripts/prepare-desktop-release-assets.mjs rename to scripts/desktop/prepare-desktop-release-assets.mjs index cc5b889be..5c66de7c7 100644 --- a/scripts/prepare-desktop-release-assets.mjs +++ b/scripts/desktop/prepare-desktop-release-assets.mjs @@ -1,6 +1,6 @@ #!/usr/bin/env node -import { releaseChannelMatchesVersion, compareVersions, selectRelease } from '../packages/update-lifecycle/src/release-policy.ts' +import { releaseChannelMatchesVersion, compareVersions, selectRelease } from '../../packages/update-lifecycle/src/release-policy.ts' import { createHash } from 'node:crypto' import { copyFileSync, existsSync, mkdirSync, readFileSync, readdirSync, rmSync, writeFileSync } from 'node:fs' import { basename, join, resolve } from 'node:path' @@ -14,7 +14,9 @@ function prereleaseChannel(version) { /** Existing publication transport supplies the observed bytes. The same policy * gates intent and the last read before mutable feeds move under the workflow's - * publication lock. An observation changed during the build requires a new run. */ + * publication lock. An observation changed during the build requires a new run. + * @param {{ headBytes: Buffer, version: string, channel: string, operation: string, expectedSha256?: string }} options + */ export function checkPublicationHead({ headBytes, version, channel, operation, expectedSha256 }) { if (!['stable', 'beta'].includes(channel) || !releaseChannelMatchesVersion(channel, version)) { throw new Error('Release version does not match channel') diff --git a/scripts/smoke-packaged-toolchain.mjs b/scripts/desktop/smoke-packaged-toolchain.mjs similarity index 99% rename from scripts/smoke-packaged-toolchain.mjs rename to scripts/desktop/smoke-packaged-toolchain.mjs index bfb34faea..1ea034132 100644 --- a/scripts/smoke-packaged-toolchain.mjs +++ b/scripts/desktop/smoke-packaged-toolchain.mjs @@ -263,7 +263,7 @@ function runCommand(repoRoot, appRoot, spec) { } function main() { - const repoRoot = resolve(import.meta.dirname, '..') + const repoRoot = resolve(import.meta.dirname, '..', '..') const packageRoot = resolveDesktopPackageRootArg(process.argv.slice(2), repoRoot) const packageResult = assertDesktopPackage({ packageRoot }) const plan = buildPackagedToolchainSmokePlan(packageResult) diff --git a/scripts/vendor-managed-runtime.mjs b/scripts/desktop/vendor-managed-runtime.mjs similarity index 99% rename from scripts/vendor-managed-runtime.mjs rename to scripts/desktop/vendor-managed-runtime.mjs index 077e87208..832f19981 100644 --- a/scripts/vendor-managed-runtime.mjs +++ b/scripts/desktop/vendor-managed-runtime.mjs @@ -9,7 +9,7 @@ import { fileURLToPath, pathToFileURL } from 'node:url' const __filename = fileURLToPath(import.meta.url) const __dirname = dirname(__filename) -const repoRoot = resolve(__dirname, '..') +const repoRoot = resolve(__dirname, '..', '..') const vendorRoot = resolve(repoRoot, 'vendor') const piRoot = resolve(vendorRoot, 'pi') const manifestPath = resolve(vendorRoot, 'manifest.json') @@ -416,6 +416,11 @@ function readManifest() { } } +/** + * @param {any} [gitSpec] + * @param {any} [searchToolsSpec] + * @returns {any} + */ export function buildVendorRuntimeManifest(gitSpec = null, searchToolsSpec = null) { const manifest = { pi: { diff --git a/scripts/verify-desktop-update-assets.mjs b/scripts/desktop/verify-desktop-update-assets.mjs similarity index 100% rename from scripts/verify-desktop-update-assets.mjs rename to scripts/desktop/verify-desktop-update-assets.mjs diff --git a/scripts/workspace-acceptance-ai-mock.mjs b/scripts/desktop/workspace-acceptance-ai-mock.mjs similarity index 100% rename from scripts/workspace-acceptance-ai-mock.mjs rename to scripts/desktop/workspace-acceptance-ai-mock.mjs diff --git a/scripts/workspace-acceptance-receipt.mjs b/scripts/desktop/workspace-acceptance-receipt.mjs similarity index 100% rename from scripts/workspace-acceptance-receipt.mjs rename to scripts/desktop/workspace-acceptance-receipt.mjs diff --git a/scripts/electron-demo/run.mjs b/scripts/electron-demo/run.mjs index 5b6296b86..9715c2519 100644 --- a/scripts/electron-demo/run.mjs +++ b/scripts/electron-demo/run.mjs @@ -2,7 +2,7 @@ import { spawnSync } from 'node:child_process' import { createRequire } from 'node:module' import { fileURLToPath } from 'node:url' import { build } from 'tsup' -import { spawnDesktopSmoke, stopDesktopSmoke } from '../desktop-smoke-process.mjs' +import { spawnDesktopSmoke, stopDesktopSmoke } from '../desktop/desktop-smoke-process.mjs' const root = fileURLToPath(new URL('../../', import.meta.url)) const require = createRequire(new URL('../../apps/desktop/package.json', import.meta.url)) const flags = new Set(process.argv.slice(2)) diff --git a/scripts/fix-pty-perms.mjs b/scripts/fix-pty-perms.mjs deleted file mode 100644 index deefb3a2e..000000000 --- a/scripts/fix-pty-perms.mjs +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/env node -/** - * node-pty's prebuilt `spawn-helper` (used on macOS/Linux to fork a controlling - * terminal) sometimes lands on disk without the executable bit set, which makes - * `pty.spawn()` fail with the unhelpful `posix_spawnp failed.` error. - * - * This postinstall hook walks node-pty's prebuilds and ensures the helper is - * executable. No-op on Windows and on layouts where the file is missing. - */ -import { chmodSync, existsSync, readdirSync, statSync } from 'node:fs'; -import { createRequire } from 'node:module'; -import { dirname, join } from 'node:path'; - -if (process.platform === 'win32') process.exit(0); - -let nodePtyPkg; -try { - nodePtyPkg = createRequire(import.meta.url).resolve('node-pty/package.json'); -} catch { - process.exit(0); -} - -const prebuildsDir = join(dirname(nodePtyPkg), 'prebuilds'); -if (!existsSync(prebuildsDir)) process.exit(0); - -for (const entry of readdirSync(prebuildsDir)) { - const helper = join(prebuildsDir, entry, 'spawn-helper'); - if (!existsSync(helper)) continue; - const mode = statSync(helper).mode; - const wantedMode = mode | 0o111; - if (mode !== wantedMode) { - chmodSync(helper, wantedMode); - // eslint-disable-next-line no-console - console.log(`[fix-pty-perms] chmod +x ${helper}`); - } -} diff --git a/scripts/generate-star-history.mjs b/scripts/generate-star-history.mjs deleted file mode 100644 index 726b4d3c9..000000000 --- a/scripts/generate-star-history.mjs +++ /dev/null @@ -1,400 +0,0 @@ -#!/usr/bin/env node - -import { execFileSync } from 'node:child_process' -import { mkdirSync, writeFileSync } from 'node:fs' -import { dirname, extname, resolve } from 'node:path' -import { pathToFileURL } from 'node:url' - -const DAY_MS = 24 * 60 * 60 * 1000 -const DEFAULT_REPOSITORY = 'TraderAlice/OpenAlice' -const DEFAULT_OUTPUT = 'docs/images/star-history.svg' -const THEMES = { - light: { - backgroundStart: '#fbfffd', - backgroundEnd: '#f3faf7', - border: '#d8ebe3', - eyebrow: '#668176', - title: '#17231e', - metric: '#17231e', - label: '#6b8378', - axis: '#6f857b', - grid: '#deebe5', - tick: '#a8bdb4', - accent: '#2fa678', - accentSoft: '#7bd3b0', - areaOpacity: '0.30', - endpointStroke: '#fbfffd', - divider: '#d8e7e0', - }, - dark: { - backgroundStart: '#101a16', - backgroundEnd: '#0b1310', - border: '#294038', - eyebrow: '#89a99b', - title: '#edf7f2', - metric: '#edf7f2', - label: '#91a89d', - axis: '#82998e', - grid: '#24372f', - tick: '#476257', - accent: '#63d6aa', - accentSoft: '#8ae4bf', - areaOpacity: '0.32', - endpointStroke: '#101a16', - divider: '#2b4037', - }, -} - -function startOfUtcDay(value) { - const date = new Date(value) - return Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate()) -} - -function formatCount(value) { - return new Intl.NumberFormat('en-US').format(value) -} - -function formatCompactCount(value) { - if (value < 1_000) return String(value) - const thousands = value / 1_000 - return `${thousands >= 10 || Number.isInteger(thousands) ? thousands.toFixed(0) : thousands.toFixed(1)}k` -} - -function formatDate(value, includeDay = true) { - return new Intl.DateTimeFormat('en-US', { - month: 'short', - ...(includeDay ? { day: 'numeric' } : {}), - timeZone: 'UTC', - }).format(value) -} - -function formatFullDate(value) { - return new Intl.DateTimeFormat('en-US', { - month: 'short', - day: 'numeric', - year: 'numeric', - timeZone: 'UTC', - }).format(value) -} - -function escapeXml(value) { - return String(value) - .replaceAll('&', '&') - .replaceAll('<', '<') - .replaceAll('>', '>') - .replaceAll('"', '"') - .replaceAll("'", ''') -} - -function niceAxis(maximum, targetIntervals = 4) { - if (maximum <= 0) return { maximum: 1, step: 1 } - const roughStep = maximum / targetIntervals - const magnitude = 10 ** Math.floor(Math.log10(roughStep)) - const normalized = roughStep / magnitude - const niceNormalized = normalized <= 1 - ? 1 - : normalized <= 2 - ? 2 - : normalized <= 2.5 - ? 2.5 - : normalized <= 5 - ? 5 - : 10 - const step = niceNormalized * magnitude - return { - maximum: Math.ceil(maximum / step) * step, - step, - } -} - -export function aggregateStarHistory(timestamps) { - const sorted = timestamps - .map((value) => new Date(value)) - .filter((value) => !Number.isNaN(value.getTime())) - .sort((left, right) => left.getTime() - right.getTime()) - - if (sorted.length === 0) { - throw new Error('[star-history] GitHub returned no valid stargazer timestamps') - } - - const firstDay = startOfUtcDay(sorted[0]) - const lastDay = startOfUtcDay(sorted.at(-1)) - const dayCount = Math.floor((lastDay - firstDay) / DAY_MS) + 1 - const points = [] - let starIndex = 0 - - for (let dayIndex = 0; dayIndex < dayCount; dayIndex += 1) { - const day = firstDay + dayIndex * DAY_MS - const nextDay = day + DAY_MS - while (starIndex < sorted.length && sorted[starIndex].getTime() < nextDay) { - starIndex += 1 - } - points.push({ date: new Date(day), count: starIndex }) - } - - return points -} - -function selectDateTicks(points, plotWidth) { - const ticks = [points[0]] - const minGap = 80 - let previousX = 0 - for (let index = 1; index < points.length - 1; index += 1) { - const date = points[index].date - const x = index / (points.length - 1) * plotWidth - if (date.getUTCDate() === 1 && x - previousX >= minGap && plotWidth - x >= minGap) { - ticks.push(points[index]) - previousX = x - } - } - if (points.length > 1) ticks.push(points.at(-1)) - return ticks -} - -export function renderStarHistorySvg({ - points, - repository = DEFAULT_REPOSITORY, - generatedAt = new Date(), - theme = 'light', -}) { - if (!Array.isArray(points) || points.length === 0) { - throw new Error('[star-history] at least one aggregate point is required') - } - const palette = THEMES[theme] - if (!palette) throw new Error(`[star-history] unknown theme: ${theme}`) - - const width = 1200 - const height = 560 - const plot = { - left: 92, - right: 1144, - top: 174, - bottom: 478, - } - const plotWidth = plot.right - plot.left - const plotHeight = plot.bottom - plot.top - const total = points.at(-1).count - const axis = niceAxis(total) - const xForIndex = (index) => { - if (points.length === 1) return plot.left - return plot.left + (index / (points.length - 1)) * plotWidth - } - const yForCount = (count) => plot.bottom - (count / axis.maximum) * plotHeight - const linePath = points - .map((point, index) => `${index === 0 ? 'M' : 'L'} ${xForIndex(index).toFixed(2)} ${yForCount(point.count).toFixed(2)}`) - .join(' ') - const areaPath = `${linePath} L ${xForIndex(points.length - 1).toFixed(2)} ${plot.bottom} L ${plot.left} ${plot.bottom} Z` - const intervalCount = Math.round(axis.maximum / axis.step) - const yTicks = Array.from({ length: intervalCount + 1 }, (_, index) => index * axis.step) - const dateTicks = selectDateTicks(points, plotWidth) - const pointIndexByTime = new Map(points.map((point, index) => [point.date.getTime(), index])) - const title = `${repository} star history` - const snapshotDate = points.at(-1).date - const snapshotMonthDay = formatDate(snapshotDate).toUpperCase() - const snapshotYear = String(snapshotDate.getUTCFullYear()) - const description = `${formatCount(total)} stars in this snapshot. Daily cumulative history from ${formatFullDate(points[0].date)} through ${formatFullDate(snapshotDate)}.` - - const grid = yTicks - .map((tick) => { - const y = yForCount(tick) - return ` - - ${formatCompactCount(tick)}` - }) - .join('') - - const xAxis = dateTicks - .map((point, tickIndex) => { - const index = pointIndexByTime.get(point.date.getTime()) - const x = xForIndex(index) - const isEndpoint = tickIndex === 0 || tickIndex === dateTicks.length - 1 - return ` - - ${formatDate(point.date, isEndpoint)}` - }) - .join('') - - return ` - ${escapeXml(title)} - ${escapeXml(description)} - - ${escapeXml(repository)} - ${escapeXml(generatedAt.toISOString())} - daily cumulative active stargazers - ${theme} - - - - - - - - - - - - - - - - - - OPENALICE - Star History - - - ${formatCount(total)} - STARS AT SNAPSHOT - - ${snapshotMonthDay} - ${snapshotYear} · UTC SNAPSHOT - - - DAILY CUMULATIVE STAR HISTORY -${grid} -${xAxis} - - - - -` -} - -export async function fetchStargazerTimestamps({ - repository = DEFAULT_REPOSITORY, - token, - fetchImpl = fetch, - onPage, -}) { - if (!token) throw new Error('[star-history] a GitHub token is required') - - const timestamps = [] - const perPage = 100 - for (let page = 1; ; page += 1) { - const url = new URL(`https://api.github.com/repos/${repository}/stargazers`) - url.searchParams.set('per_page', String(perPage)) - url.searchParams.set('page', String(page)) - const response = await fetchImpl(url, { - headers: { - Accept: 'application/vnd.github.star+json', - Authorization: `Bearer ${token}`, - 'User-Agent': 'OpenAlice-Star-History', - 'X-GitHub-Api-Version': '2022-11-28', - }, - }) - - if (!response.ok) { - const detail = await response.text() - throw new Error(`[star-history] GitHub API returned ${response.status}: ${detail.slice(0, 240)}`) - } - - const pageItems = await response.json() - if (!Array.isArray(pageItems)) { - throw new Error('[star-history] GitHub API returned an unexpected response') - } - - for (const item of pageItems) { - if (typeof item?.starred_at === 'string') timestamps.push(item.starred_at) - } - onPage?.({ page, fetched: pageItems.length, total: timestamps.length }) - - if (pageItems.length < perPage) break - } - - return timestamps -} - -function resolveGitHubToken() { - const environmentToken = process.env.GH_TOKEN || process.env.GITHUB_TOKEN - if (environmentToken) return environmentToken - - try { - return execFileSync('gh', ['auth', 'token'], { - encoding: 'utf8', - stdio: ['ignore', 'pipe', 'ignore'], - }).trim() - } catch { - throw new Error('[star-history] set GH_TOKEN/GITHUB_TOKEN or authenticate with `gh auth login`') - } -} - -function parseArgs(argv) { - const values = { - repository: DEFAULT_REPOSITORY, - output: DEFAULT_OUTPUT, - darkOutput: null, - } - - for (let index = 0; index < argv.length; index += 2) { - const key = argv[index] - const value = argv[index + 1] - if (!key?.startsWith('--') || value == null) { - throw new Error(`[star-history] invalid arguments: ${argv.join(' ')}`) - } - if (key === '--repository') values.repository = value - else if (key === '--output') values.output = value - else if (key === '--dark-output') values.darkOutput = value - else throw new Error(`[star-history] unknown option: ${key}`) - } - - return values -} - -function darkOutputPath(output) { - const extension = extname(output) - if (!extension) return `${output}-dark.svg` - return `${output.slice(0, -extension.length)}-dark${extension}` -} - -async function main() { - const options = parseArgs(process.argv.slice(2)) - const token = resolveGitHubToken() - const timestamps = await fetchStargazerTimestamps({ - repository: options.repository, - token, - onPage: ({ page, total }) => { - if (page === 1 || page % 10 === 0) { - console.log(`[star-history] fetched page ${page} (${formatCount(total)} timestamps)`) - } - }, - }) - const points = aggregateStarHistory(timestamps) - const generatedAt = new Date() - const lightSvg = renderStarHistorySvg({ - points, - repository: options.repository, - generatedAt, - theme: 'light', - }) - const darkSvg = renderStarHistorySvg({ - points, - repository: options.repository, - generatedAt, - theme: 'dark', - }) - const outputPath = resolve(options.output) - const darkOutput = options.darkOutput || darkOutputPath(options.output) - const darkOutputResolved = resolve(darkOutput) - mkdirSync(dirname(outputPath), { recursive: true }) - mkdirSync(dirname(darkOutputResolved), { recursive: true }) - writeFileSync(outputPath, lightSvg) - writeFileSync(darkOutputResolved, darkSvg) - console.log(`[star-history] wrote ${options.output} and ${darkOutput} from ${formatCount(timestamps.length)} active stargazers`) -} - -if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) { - main().catch((error) => { - console.error(error instanceof Error ? error.message : error) - process.exitCode = 1 - }) -} diff --git a/scripts/generate-star-history.spec.ts b/scripts/generate-star-history.spec.ts deleted file mode 100644 index f88f093ce..000000000 --- a/scripts/generate-star-history.spec.ts +++ /dev/null @@ -1,109 +0,0 @@ -import { describe, expect, it, vi } from 'vitest' - -import { - aggregateStarHistory, - fetchStargazerTimestamps, - renderStarHistorySvg, -} from './generate-star-history.mjs' - -describe('aggregateStarHistory', () => { - it('creates a cumulative point for every UTC day without retaining user data', () => { - const points = aggregateStarHistory([ - '2026-02-21T18:00:00Z', - '2026-02-19T10:40:01Z', - '2026-02-19T20:15:00Z', - ]) - - expect(points).toEqual([ - { date: new Date('2026-02-19T00:00:00Z'), count: 2 }, - { date: new Date('2026-02-20T00:00:00Z'), count: 2 }, - { date: new Date('2026-02-21T00:00:00Z'), count: 3 }, - ]) - }) - - it('rejects empty or invalid histories', () => { - expect(() => aggregateStarHistory([])).toThrow('no valid stargazer timestamps') - expect(() => aggregateStarHistory(['not-a-date'])).toThrow('no valid stargazer timestamps') - }) -}) - -describe('fetchStargazerTimestamps', () => { - it('paginates and keeps only timestamp fields', async () => { - const firstPage = Array.from({ length: 100 }, (_, index) => ({ - starred_at: `2026-02-19T10:${String(index % 60).padStart(2, '0')}:00Z`, - user: { login: `private-user-${index}` }, - })) - const fetchImpl = vi - .fn() - .mockResolvedValueOnce({ - ok: true, - json: async () => firstPage, - }) - .mockResolvedValueOnce({ - ok: true, - json: async () => [{ starred_at: '2026-02-20T12:00:00Z', user: { login: 'last-user' } }], - }) - - const timestamps = await fetchStargazerTimestamps({ - token: 'test-token', - fetchImpl, - }) - - expect(fetchImpl).toHaveBeenCalledTimes(2) - expect(timestamps).toHaveLength(101) - expect(timestamps.at(-1)).toBe('2026-02-20T12:00:00Z') - expect(JSON.stringify(timestamps)).not.toContain('private-user') - }) -}) - -describe('renderStarHistorySvg', () => { - it('renders an accessible self-contained chart without stargazer identities', () => { - const points = aggregateStarHistory([ - '2026-02-19T10:40:01Z', - '2026-02-20T12:00:00Z', - '2026-03-20T12:00:00Z', - ]) - const svg = renderStarHistorySvg({ - points, - generatedAt: new Date('2026-03-20T13:00:00Z'), - }) - - expect(svg).toContain('TraderAlice/OpenAlice star history') - expect(svg).toContain('') - expect(svg).toContain('daily cumulative active stargazers') - expect(svg).toContain('2026-03-20T13:00:00.000Z') - expect(svg).toContain('light') - expect(svg).toContain('stop-color="#fbfffd"') - expect(svg).not.toContain('LAST 30 DAYS') - expect(svg).not.toContain('login') - expect(svg).not.toContain('starred_at') - }) - - it('keeps month labels clear of the first and last dates in a long history', () => { - const points = aggregateStarHistory(['2026-02-19T00:00:00Z', '2026-09-05T00:00:00Z']) - const svg = renderStarHistorySvg({ points }) - const labels = [...svg.matchAll(/]*>([^<]+)<\/text>/g)] - expect(labels[0][2]).toBe('Feb 19') - expect(labels.at(-1)?.[2]).toBe('Sep 5') - expect(labels.map((label) => label[2])).toContain('Aug') - for (let index = 1; index < labels.length; index++) { - expect(Number(labels[index][1]) - Number(labels[index - 1][1])).toBeGreaterThanOrEqual(80) - } - }) - - it('renders the matching dark-mode palette', () => { - const points = aggregateStarHistory([ - '2026-02-19T10:40:01Z', - '2026-03-20T12:00:00Z', - ]) - const svg = renderStarHistorySvg({ - points, - generatedAt: new Date('2026-03-20T13:00:00Z'), - theme: 'dark', - }) - - expect(svg).toContain('dark') - expect(svg).toContain('stop-color="#101a16"') - expect(svg).toContain('stroke="#63d6aa"') - }) -}) diff --git a/scripts/guardian/shared.ts b/scripts/guardian/shared.ts index 28ebc3b39..70724957b 100644 --- a/scripts/guardian/shared.ts +++ b/scripts/guardian/shared.ts @@ -476,10 +476,11 @@ export class OptionalServiceController { } private captureProcessTree(): void { - if (this.treeScanInProgress || this.child.pid == null) return + const pid = this.child.pid + if (this.treeScanInProgress || pid == null) return this.treeScanInProgress = true const current = this.child - void listDescendantPids(current.pid).then((pids) => { + void listDescendantPids(pid).then((pids) => { if (pids.length > 0) knownDescendants.set(current, pids) }).catch(() => undefined).finally(() => { this.treeScanInProgress = false }) } diff --git a/scripts/migrate-order-sentinels.ts b/scripts/migrate-order-sentinels.ts deleted file mode 100644 index 01d46a690..000000000 --- a/scripts/migrate-order-sentinels.ts +++ /dev/null @@ -1,125 +0,0 @@ -/** - * One-time migration: strip legacy UNSET_DOUBLE sentinels from persisted - * trading commits. - * - * Context: before the Decimal migration, Order's price-class fields - * (lmtPrice, auxPrice, trailStopPrice, trailingPercent, cashQty) - * defaulted to UNSET_DOUBLE = Number.MAX_VALUE. JSON.stringify serialised - * this as 1.7976931348623157e+308 into data/trading//commit.json. - * - * Post-migration the fields are Decimal with a different UNSET_DECIMAL - * sentinel (~1.7e38). TradingGit.rehydrateOrder wraps any non-null value - * via `new Decimal(String(x))`, so the old legacy sentinel rehydrates - * into a perfectly valid but absurd Decimal (~1.7e308) that slips past - * every UNSET check. Surfaces as "$179769313486231570000..." in the - * Recent Trades panel; would also blow up max-position-size guard if - * run against historical staging. - * - * Fix: delete those sentinel fields at rest. After this script, every - * price field is either a real numeric string / number or absent — - * Order's class defaults (UNSET_DECIMAL) take over on rehydrate. - * - * Idempotent — rerun is a no-op. - * - * Run: - * pnpm tsx scripts/migrate-order-sentinels.ts - */ - -import { readFileSync, writeFileSync, readdirSync, statSync, renameSync } from 'node:fs' -import { join } from 'node:path' -import { dataPath } from '../src/core/paths.js' - -const LEGACY_UNSET_DOUBLE = Number.MAX_VALUE // = 1.7976931348623157e+308 -const PRICE_FIELDS = ['lmtPrice', 'auxPrice', 'trailStopPrice', 'trailingPercent', 'cashQty'] as const - -const TRADING_DIR = dataPath('trading') - -interface Commit { - hash?: string - operations?: Array<{ - action?: string - order?: Record - changes?: Record - }> -} - -interface CommitFile { - commits?: Commit[] - head?: string -} - -function isLegacySentinel(v: unknown): boolean { - return typeof v === 'number' && v === LEGACY_UNSET_DOUBLE -} - -function cleanOrderObject(obj: Record | undefined, counter: Map): boolean { - if (!obj) return false - let dirty = false - for (const field of PRICE_FIELDS) { - if (field in obj && isLegacySentinel(obj[field])) { - delete obj[field] - counter.set(field, (counter.get(field) ?? 0) + 1) - dirty = true - } - } - return dirty -} - -function cleanFile(path: string): { dirty: boolean; counts: Map } { - const counts = new Map() - const raw = readFileSync(path, 'utf8') - const data: CommitFile = JSON.parse(raw) - let dirty = false - - for (const commit of data.commits ?? []) { - for (const op of commit.operations ?? []) { - if (cleanOrderObject(op.order, counts)) dirty = true - if (cleanOrderObject(op.changes, counts)) dirty = true - } - } - - if (dirty) { - const serialised = JSON.stringify(data, null, 2) + '\n' - const tmp = path + '.tmp' - writeFileSync(tmp, serialised, 'utf8') - renameSync(tmp, path) - } - return { dirty, counts } -} - -function main() { - let totalFiles = 0 - let changedFiles = 0 - const grandTotal = new Map() - - let entries: string[] - try { - entries = readdirSync(TRADING_DIR) - } catch (err) { - console.error(`No ${TRADING_DIR} directory found. Nothing to do.`) - return - } - - for (const entry of entries) { - const commitPath = join(TRADING_DIR, entry, 'commit.json') - let st - try { st = statSync(commitPath) } catch { continue } - if (!st.isFile()) continue - totalFiles++ - - const { dirty, counts } = cleanFile(commitPath) - const summary = [...counts.entries()].map(([k, v]) => `${k}:${v}`).join(' ') - if (dirty) { - changedFiles++ - console.log(`✓ ${entry} — stripped ${summary}`) - for (const [k, v] of counts) grandTotal.set(k, (grandTotal.get(k) ?? 0) + v) - } else { - console.log(`· ${entry} — clean`) - } - } - - console.log(`\n${changedFiles}/${totalFiles} files changed. Total stripped:`, - [...grandTotal.entries()].map(([k, v]) => `${k}=${v}`).join(', ') || '(none)') -} - -main() diff --git a/scripts/normalize-office-coworker-pair.py b/scripts/normalize-office-coworker-pair.py deleted file mode 100644 index d06b11111..000000000 --- a/scripts/normalize-office-coworker-pair.py +++ /dev/null @@ -1,70 +0,0 @@ -#!/usr/bin/env python3 -"""Normalize an existing Office coworker's idle/work pair to one visual scale.""" - -from __future__ import annotations - -import argparse -from pathlib import Path - -from PIL import Image - - -CANVAS_SIZE = (176, 176) -FIT_SIZE = (164, 164) - - -def hard_matte(image: Image.Image, threshold: int = 88) -> Image.Image: - rgba = image.convert("RGBA") - alpha = rgba.getchannel("A").point(lambda value: 255 if value >= threshold else 0) - rgba.putalpha(alpha) - return rgba - - -def trim_visible(image: Image.Image) -> Image.Image: - matte = hard_matte(image) - bounds = matte.getchannel("A").getbbox() - if bounds is None: - raise ValueError("pose has no visible pixels") - return matte.crop(bounds) - - -def compose(pose: Image.Image, scale: float) -> Image.Image: - resized = pose.resize( - (max(1, round(pose.width * scale)), max(1, round(pose.height * scale))), - Image.Resampling.NEAREST, - ) - resized = hard_matte(resized) - canvas = Image.new("RGBA", CANVAS_SIZE, (0, 0, 0, 0)) - x = (CANVAS_SIZE[0] - resized.width) // 2 - y = CANVAS_SIZE[1] - resized.height - 2 - canvas.alpha_composite(resized, (x, y)) - return canvas - - -def main() -> None: - parser = argparse.ArgumentParser() - parser.add_argument("--slug", required=True) - parser.add_argument( - "--asset-dir", - type=Path, - default=Path("ui/public/office/coworkers"), - ) - args = parser.parse_args() - - paths = ( - args.asset_dir / f"{args.slug}-desk-v1.png", - args.asset_dir / f"{args.slug}-desk-work-v1.png", - ) - poses = [trim_visible(Image.open(path)) for path in paths] - scale = min( - FIT_SIZE[0] / max(pose.width for pose in poses), - FIT_SIZE[1] / max(pose.height for pose in poses), - ) - - for path, pose in zip(paths, poses): - compose(pose, scale).save(path, optimize=True) - print(path) - - -if __name__ == "__main__": - main() diff --git a/scripts/package-office-coworker-sheet.py b/scripts/package-office-coworker-sheet.py deleted file mode 100644 index ce3ae83a9..000000000 --- a/scripts/package-office-coworker-sheet.py +++ /dev/null @@ -1,131 +0,0 @@ -#!/usr/bin/env python3 -"""Package a transparent three-pose Office coworker sheet for the UI runtime.""" - -from __future__ import annotations - -import argparse -from collections import deque -from pathlib import Path - -from PIL import Image - - -POSES = ( - ("portrait-v2", (72, 104), (66, 100)), - ("desk-v1", (176, 176), (164, 164)), - ("desk-work-v1", (176, 176), (164, 164)), -) - - -def remove_baked_checkerboard(image: Image.Image) -> Image.Image: - """Turn an edge-connected neutral checkerboard into real transparency.""" - rgba = image.convert("RGBA") - if rgba.getchannel("A").getextrema()[0] < 255: - return rgba - - pixels = rgba.load() - width, height = rgba.size - - def is_background(x: int, y: int) -> bool: - red, green, blue, _alpha = pixels[x, y] - return min(red, green, blue) >= 235 and max(red, green, blue) - min(red, green, blue) <= 10 - - queue: deque[tuple[int, int]] = deque() - visited: set[tuple[int, int]] = set() - for x in range(width): - queue.extend(((x, 0), (x, height - 1))) - for y in range(height): - queue.extend(((0, y), (width - 1, y))) - - while queue: - x, y = queue.popleft() - if (x, y) in visited or not is_background(x, y): - continue - visited.add((x, y)) - red, green, blue, _alpha = pixels[x, y] - pixels[x, y] = (red, green, blue, 0) - if x > 0: - queue.append((x - 1, y)) - if x + 1 < width: - queue.append((x + 1, y)) - if y > 0: - queue.append((x, y - 1)) - if y + 1 < height: - queue.append((x, y + 1)) - - return rgba - - -def hard_matte(image: Image.Image, threshold: int = 88) -> Image.Image: - rgba = image.convert("RGBA") - alpha = rgba.getchannel("A").point(lambda value: 255 if value >= threshold else 0) - rgba.putalpha(alpha) - return rgba - - -def trim_pose(sheet: Image.Image, index: int) -> Image.Image: - left = round(sheet.width * index / 3) - right = round(sheet.width * (index + 1) / 3) - # Generated sheets often retain a faint alpha haze around the character. - # Matte it before measuring so that invisible fringe cannot make the - # packaged character look much smaller than its coworkers. - panel = hard_matte(sheet.crop((left, 0, right, sheet.height))) - bounds = panel.getchannel("A").getbbox() - if bounds is None: - raise ValueError(f"pose {index + 1} has no visible pixels") - return panel.crop(bounds) - - -def fit_scale(image: Image.Image, fit_size: tuple[int, int]) -> float: - return min(fit_size[0] / image.width, fit_size[1] / image.height) - - -def fit_pose( - image: Image.Image, - canvas_size: tuple[int, int], - fit_size: tuple[int, int], - scale: float | None = None, -) -> Image.Image: - scale = fit_scale(image, fit_size) if scale is None else scale - resized = image.resize( - (max(1, round(image.width * scale)), max(1, round(image.height * scale))), - Image.Resampling.NEAREST, - ) - resized = hard_matte(resized) - canvas = Image.new("RGBA", canvas_size, (0, 0, 0, 0)) - x = (canvas_size[0] - resized.width) // 2 - y = canvas_size[1] - resized.height - 2 - canvas.alpha_composite(resized, (x, y)) - return canvas - - -def main() -> None: - parser = argparse.ArgumentParser() - parser.add_argument("--sheet", type=Path, required=True) - parser.add_argument("--slug", required=True) - parser.add_argument( - "--out-dir", - type=Path, - default=Path("ui/public/office/coworkers"), - ) - args = parser.parse_args() - - sheet = remove_baked_checkerboard(Image.open(args.sheet)) - args.out_dir.mkdir(parents=True, exist_ok=True) - poses = [trim_pose(sheet, index) for index in range(len(POSES))] - desk_fit = POSES[1][2] - desk_scale = min( - desk_fit[0] / max(pose.width for pose in poses[1:]), - desk_fit[1] / max(pose.height for pose in poses[1:]), - ) - - for index, (suffix, canvas_size, fit_size) in enumerate(POSES): - scale = None if index == 0 else desk_scale - packaged = fit_pose(poses[index], canvas_size, fit_size, scale) - output = args.out_dir / f"{args.slug}-{suffix}.png" - packaged.save(output, optimize=True) - print(output) - - -if __name__ == "__main__": - main() diff --git a/scripts/package-office-route-assets.py b/scripts/package-office-route-assets.py deleted file mode 100644 index e16db9d03..000000000 --- a/scripts/package-office-route-assets.py +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/env python3 -"""Package generated Office route artwork into small native-size sprites.""" - -from __future__ import annotations - -import argparse -from pathlib import Path - -from PIL import Image - - -def package(source: Path, output: Path, canvas_size: int, fit_size: int) -> None: - image = Image.open(source).convert("RGBA") - bounds = image.getchannel("A").getbbox() - if bounds is None: - raise ValueError(f"{source} has no visible pixels") - image = image.crop(bounds) - scale = min(fit_size / image.width, fit_size / image.height) - size = ( - max(1, round(image.width * scale)), - max(1, round(image.height * scale)), - ) - image = image.resize(size, Image.Resampling.BOX) - alpha = image.getchannel("A").point(lambda value: 255 if value >= 72 else 0) - image.putalpha(alpha) - - canvas = Image.new("RGBA", (canvas_size, canvas_size), (0, 0, 0, 0)) - canvas.alpha_composite( - image, - ((canvas_size - image.width) // 2, (canvas_size - image.height) // 2), - ) - output.parent.mkdir(parents=True, exist_ok=True) - canvas.save(output, optimize=True) - - -def main() -> None: - parser = argparse.ArgumentParser() - parser.add_argument("--footsteps", type=Path, required=True) - parser.add_argument("--destination", type=Path, required=True) - parser.add_argument( - "--out-dir", - type=Path, - default=Path("ui/public/office/furniture"), - ) - args = parser.parse_args() - - package(args.footsteps, args.out_dir / "route-footsteps-v1.png", 12, 10) - package(args.destination, args.out_dir / "route-destination-v1.png", 20, 18) - - -if __name__ == "__main__": - main() diff --git a/scripts/repair-office-alice-side-gait.py b/scripts/repair-office-alice-side-gait.py deleted file mode 100644 index 9308ff2ef..000000000 --- a/scripts/repair-office-alice-side-gait.py +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env python3 -"""Repair Alice's rightward Office gait from the approved leftward row.""" - -from __future__ import annotations - -import argparse -from pathlib import Path - -from PIL import Image - - -CELL_SIZE = 48 -ATLAS_SIZE = (CELL_SIZE * 3, CELL_SIZE * 4) -LEFT_ROW = 1 -RIGHT_ROW = 2 - - -def main() -> None: - parser = argparse.ArgumentParser() - parser.add_argument("atlas", type=Path) - args = parser.parse_args() - - atlas = Image.open(args.atlas).convert("RGBA") - if atlas.size != ATLAS_SIZE: - raise ValueError(f"expected {ATLAS_SIZE[0]}x{ATLAS_SIZE[1]} atlas, got {atlas.size}") - - for column in range(3): - left = column * CELL_SIZE - source = atlas.crop( - ( - left, - LEFT_ROW * CELL_SIZE, - left + CELL_SIZE, - (LEFT_ROW + 1) * CELL_SIZE, - ), - ) - mirrored = source.transpose(Image.Transpose.FLIP_LEFT_RIGHT) - atlas.paste(mirrored, (left, RIGHT_ROW * CELL_SIZE)) - - atlas.save(args.atlas, optimize=True) - print(args.atlas) - - -if __name__ == "__main__": - main() diff --git a/scripts/verify-broker-packs.ts b/scripts/verify-broker-packs.ts index 75971df09..e736e41da 100644 --- a/scripts/verify-broker-packs.ts +++ b/scripts/verify-broker-packs.ts @@ -1,7 +1,7 @@ /** Verify generated Broker Pack catalogs and import every release artifact. */ -import { signCliMacOS } from './sign-cli-macos.mjs' -import { requireBunExecutable } from './bun-toolchain.mjs' +import { signCliMacOS } from './cli/sign-cli-macos.mjs' +import { requireBunExecutable } from './cli/bun-toolchain.mjs' import { spawnSync } from 'node:child_process' import { createHash } from 'node:crypto' import { createReadStream } from 'node:fs' @@ -46,7 +46,7 @@ try { if (compiled) { requireBunExecutable('bun') const probe = resolve(tempRoot, 'probe.ts') - const options = pathToFileURL(resolve(repoRoot, 'scripts/bun-compile-options.ts')).href + const options = pathToFileURL(resolve(repoRoot, 'scripts/cli/bun-compile-options.ts')).href const builder = resolve(tempRoot, 'build.ts') compiledProbe = resolve(tempRoot, process.platform === 'win32' ? 'probe.exe' : 'probe') await writeFile(probe, ` diff --git a/scripts/windows-cli-preview.spec.ts b/scripts/windows-cli-preview.spec.ts deleted file mode 100644 index 013025a51..000000000 --- a/scripts/windows-cli-preview.spec.ts +++ /dev/null @@ -1,83 +0,0 @@ -import { readFileSync } from 'node:fs' -import { resolve } from 'node:path' -import { describe, expect, it } from 'vitest' -import YAML from 'yaml' - -const root = resolve(import.meta.dirname, '..') -const read = (file: string) => readFileSync(resolve(root, file), 'utf8') - -describe('Windows preview delivery boundary', () => { - it('is manually dispatched, independent per architecture, and cannot publish stable aliases', () => { - const workflow = YAML.parse(read('.github/workflows/windows-cli-preview.yml')) - expect(Object.keys(workflow.on)).toEqual(['workflow_dispatch', 'workflow_call']) - expect(workflow.permissions).toEqual({ contents: 'read', actions: 'read' }) - const job = workflow.jobs.preview - expect(job.needs).toBeUndefined() - expect(job.strategy['fail-fast']).toBe(false) - expect(job.strategy.matrix.include).toEqual([ - { os: 'windows-latest', arch: 'x64' }, { os: 'windows-11-arm', arch: 'arm64' }, - ]) - const steps = job.steps as Array<{ name?: string; run?: string }> - expect(steps.findIndex(s => s.name === 'Preserve complete candidate for reproduction')) - .toBeLessThan(steps.findIndex(s => s.name === 'Install and start the packaged Runtime')) - expect(steps.some(s => /pnpm test(?:\s|$)|npm publish|electron:pack/.test(s.run ?? ''))).toBe(false) - }) - - it('replays existing bytes without dependency setup, compilation, or candidate re-upload', () => { - const workflow = YAML.parse(read('.github/workflows/windows-cli-preview.yml')) - const steps = workflow.jobs.preview.steps as Array<{ uses?: string; name?: string; run?: string; if?: string; with?: Record }> - for (const step of steps.filter(s => s.uses === 'pnpm/action-setup@v6' || s.uses === 'actions/setup-node@v7' || - s.run?.startsWith('pnpm ') || s.run?.includes('build-windows-cli-preview.ts') || - s.name === 'Preserve complete candidate for reproduction')) { - expect(step.if?.split(' && ')[0]).toBe("inputs.candidate_run == ''") - } - const download = steps.find(s => s.uses === 'actions/download-artifact@v5')! - expect(download.if).toBe("inputs.candidate_run != ''") - expect(download.with?.['merge-multiple']).toBe(false) - expect(download.with?.['run-id']).toBe('${{ inputs.candidate_run }}') - for (const name of ['Install and start the packaged Runtime', 'Accept Windows npm and Bun native command shims']) { - const acceptance = steps.find(s => s.name === name)! - expect(acceptance.if).toContain('!cancelled()') - expect(acceptance.if).toContain("steps.preserve.outcome == 'success'") - expect(acceptance.if).toContain("steps.download.outcome == 'success'") - } - }) - - it('the registered installer workflow can dispatch previews without its normal manual gates or dev activation', () => { - const workflow = YAML.parse(read('.github/workflows/cli-installer-smoke.yml')) - expect(workflow.on.workflow_dispatch.inputs.windows_preview.default).toBe(false) - expect(workflow.jobs['windows-preview'].uses).toBe('./.github/workflows/windows-cli-preview.yml') - for (const job of ['release-prep-scope', 'bun-cli-feasibility', 'checkout-install', 'checkout-remote', 'dev-channel-install']) { - expect(workflow.jobs[job].if).toContain('!inputs.windows_preview') - } - for (const job of ['build-dev-cli-neutral', 'build-dev-cli', 'publish-dev-cli-candidate', 'activate-dev-cli']) { - expect(workflow.jobs[job].if).toBe("github.event_name == 'push'") - } - }) - - it('keeps the installer opt-in, checksum-bound, non-destructive, and independent of agent installation', () => { - const source = read('install-preview.ps1') - expect(source).toContain('Archive SHA-256 mismatch') - expect(source).toContain('Destination already exists') - expect(source).toContain('[IO.Directory]::Move($release, $destination)') - expect(source).toContain('if ($Plan) { return }') - expect(source).not.toMatch(/Set-ExecutionPolicy|SetEnvironmentVariable|npm install|Invoke-Expression/) - expect(source).toContain('Remove-Item -LiteralPath $stage -Recurse -Force') - expect(source).not.toContain('Remove-Item -LiteralPath $destination') - }) - - it('joins ordinary dev and release publication without adding source-test jobs', () => { - const dev = YAML.parse(read('.github/workflows/cli-installer-smoke.yml')) - const release = YAML.parse(read('.github/workflows/release.yml')) - expect(dev.jobs['build-dev-cli-windows'].with).toMatchObject({ channel_build: true, neutral_inputs: true }) - expect(dev.jobs['build-dev-cli-windows'].with.native_acceptance).toBe(false) - expect(dev.jobs['publish-dev-cli-candidate'].needs).toContain('build-dev-cli-windows') - expect(release.jobs['build-cli-windows'].with.channel_build).toBe(true) - expect(release.jobs['build-cli-windows'].with.native_acceptance).toContain("channel == 'stable'") - expect(release.jobs['publish-release'].needs).toContain('build-cli-windows') - expect(release.jobs['build-cli-package-channels'].needs).toContain('build-cli-windows') - expect(read('install.ps1')).not.toMatch(/Set-ExecutionPolicy|npm install|Invoke-Expression/) - expect(read('install.ps1')).toContain('[IO.File]::Replace($temporary, $path, $backup)') - expect(read('install.ps1')).toContain('[IO.File]::Delete($backup)') - }) -}) diff --git a/tests/integration/cli-release-artifacts/build-cli-package-channels.spec.mjs b/tests/integration/cli-release-artifacts/build-cli-package-channels.spec.mjs index 3abd33796..def47abef 100644 --- a/tests/integration/cli-release-artifacts/build-cli-package-channels.spec.mjs +++ b/tests/integration/cli-release-artifacts/build-cli-package-channels.spec.mjs @@ -1,5 +1,5 @@ import { fixtureMachO } from '../../../scripts/fixtures/macho.mjs' -import { pinnedBunVersion } from '../../../scripts/bun-toolchain.mjs' +import { pinnedBunVersion } from '../../../scripts/cli/bun-toolchain.mjs' import { createHash } from 'node:crypto' import { execFile } from 'node:child_process' import { @@ -18,8 +18,8 @@ import { promisify } from 'node:util' import { afterEach, describe, expect, it } from 'vitest' import { cliExecutableName } from '../../../packages/cli/src/release-targets.mjs' -import { bunReleaseContentIdentity } from '../../../scripts/bun-release-content-identity.mjs' -import { buildCliPackageChannels } from '../../../scripts/build-cli-package-channels.mjs' +import { bunReleaseContentIdentity } from '../../../scripts/cli/bun-release-content-identity.mjs' +import { buildCliPackageChannels } from '../../../scripts/cli/build-cli-package-channels.mjs' const execFileAsync = promisify(execFile) const version = '0.90.1' diff --git a/tests/integration/cli-release-artifacts/cli-release-fixture.spec.mjs b/tests/integration/cli-release-artifacts/cli-release-fixture.spec.mjs index fe3e4f20e..a37c5ca3e 100644 --- a/tests/integration/cli-release-artifacts/cli-release-fixture.spec.mjs +++ b/tests/integration/cli-release-artifacts/cli-release-fixture.spec.mjs @@ -1,5 +1,5 @@ import { fixtureMachO } from '../../../scripts/fixtures/macho.mjs' -import { pinnedBunVersion } from '../../../scripts/bun-toolchain.mjs' +import { pinnedBunVersion } from '../../../scripts/cli/bun-toolchain.mjs' import { createHash } from 'node:crypto' import { execFile } from 'node:child_process' import { chmod, mkdir, mkdtemp, readFile, rm, writeFile } from 'node:fs/promises' @@ -12,11 +12,11 @@ import { afterEach, describe, expect, it, vi } from 'vitest' import { preparePreviousCliReleaseArchives, syntheticPreviousVersion, -} from '../../../scripts/cli-release-fixture.mjs' +} from '../../../scripts/cli/cli-release-fixture.mjs' import { cliExecutableName } from '../../../packages/cli/src/release-targets.mjs' -import { bunReleaseContentIdentity } from '../../../scripts/bun-release-content-identity.mjs' +import { bunReleaseContentIdentity } from '../../../scripts/cli/bun-release-content-identity.mjs' -vi.mock('../../../scripts/sign-cli-macos.mjs', async () => { +vi.mock('../../../scripts/cli/sign-cli-macos.mjs', async () => { const { readFileSync, writeFileSync } = await import('node:fs') const { rehashFixtureMachO } = await import('../../../scripts/fixtures/macho.mjs') return { signCliMacOS: (path) => writeFileSync(path, rehashFixtureMachO(readFileSync(path))) } diff --git a/tests/integration/cli-release-artifacts/cli-signature.spec.mjs b/tests/integration/cli-release-artifacts/cli-signature.spec.mjs index 8fc6f0fb6..12abbee61 100644 --- a/tests/integration/cli-release-artifacts/cli-signature.spec.mjs +++ b/tests/integration/cli-release-artifacts/cli-signature.spec.mjs @@ -3,10 +3,10 @@ import { chmodSync, mkdtempSync, readFileSync, readdirSync, rmSync, writeFileSyn import { tmpdir } from 'node:os' import { join } from 'node:path' import { afterEach, describe, expect, it } from 'vitest' -import { pinnedBunVersion, requireBunExecutable, requireBunVersion } from '../../../scripts/bun-toolchain.mjs' +import { pinnedBunVersion, requireBunExecutable, requireBunVersion } from '../../../scripts/cli/bun-toolchain.mjs' import { fixtureMachO } from '../../../scripts/fixtures/macho.mjs' -import { inspectMachOSignature } from '../../../scripts/macho-signature.mjs' -import { signCliMacOS } from '../../../scripts/sign-cli-macos.mjs' +import { inspectMachOSignature } from '../../../scripts/cli/macho-signature.mjs' +import { signCliMacOS } from '../../../scripts/cli/sign-cli-macos.mjs' const roots = [] function temporary() { const root = mkdtempSync(join(tmpdir(), 'openalice-signature-test-')); roots.push(root); return root } diff --git a/tests/integration/cli-release-artifacts/prepare-cli-dev-assets.spec.mjs b/tests/integration/cli-release-artifacts/prepare-cli-dev-assets.spec.mjs index d8a70fbda..fdfa74b9d 100644 --- a/tests/integration/cli-release-artifacts/prepare-cli-dev-assets.spec.mjs +++ b/tests/integration/cli-release-artifacts/prepare-cli-dev-assets.spec.mjs @@ -1,5 +1,5 @@ import { fixtureMachO } from '../../../scripts/fixtures/macho.mjs' -import { pinnedBunVersion } from '../../../scripts/bun-toolchain.mjs' +import { pinnedBunVersion } from '../../../scripts/cli/bun-toolchain.mjs' import { createHash } from 'node:crypto' import { execFile } from 'node:child_process' import { access, chmod, mkdtemp, mkdir, readFile, rm, writeFile } from 'node:fs/promises' @@ -10,9 +10,9 @@ import { promisify } from 'node:util' import { afterEach, describe, expect, it } from 'vitest' import { cliExecutableName } from '../../../packages/cli/src/release-targets.mjs' -import { bunReleaseContentIdentity } from '../../../scripts/bun-release-content-identity.mjs' -import { writeDevBrokerBinding } from '../../../scripts/dev-broker-binding.mjs' -import { prepareCliDevAssets } from '../../../scripts/prepare-cli-dev-assets.mjs' +import { bunReleaseContentIdentity } from '../../../scripts/cli/bun-release-content-identity.mjs' +import { writeDevBrokerBinding } from '../../../scripts/cli/dev-broker-binding.mjs' +import { prepareCliDevAssets } from '../../../scripts/cli/prepare-cli-dev-assets.mjs' const execFileAsync = promisify(execFile) const version = '0.90.1' diff --git a/tests/integration/cli-release-artifacts/verify-cli-release.spec.mjs b/tests/integration/cli-release-artifacts/verify-cli-release.spec.mjs index a0e083d69..6643e2432 100644 --- a/tests/integration/cli-release-artifacts/verify-cli-release.spec.mjs +++ b/tests/integration/cli-release-artifacts/verify-cli-release.spec.mjs @@ -1,5 +1,5 @@ -import { downloadArtifact } from '../../../scripts/release-artifacts.mjs' -import { stageCliRelease } from '../../../scripts/stage-cli-release.mjs' +import { downloadArtifact } from '../../../scripts/cli/release-artifacts.mjs' +import { stageCliRelease } from '../../../scripts/cli/stage-cli-release.mjs' import { CLI_RELEASE_TARGETS } from '../../../packages/cli/src/release-targets.mjs' import { execFileSync } from 'node:child_process' import { createHash } from 'node:crypto' @@ -7,10 +7,10 @@ import { chmodSync, copyFileSync, existsSync, linkSync, mkdirSync, mkdtempSync, import { tmpdir } from 'node:os' import { basename, join } from 'node:path' import { afterEach, describe, expect, it } from 'vitest' -import { bunReleaseContentIdentity } from '../../../scripts/bun-release-content-identity.mjs' -import { pinnedBunVersion } from '../../../scripts/bun-toolchain.mjs' +import { bunReleaseContentIdentity } from '../../../scripts/cli/bun-release-content-identity.mjs' +import { pinnedBunVersion } from '../../../scripts/cli/bun-toolchain.mjs' import { fixtureMachO } from '../../../scripts/fixtures/macho.mjs' -import { verifyCliReleaseArchive, verifyCliReleaseDirectory } from '../../../scripts/verify-cli-release.mjs' +import { verifyCliReleaseArchive, verifyCliReleaseDirectory } from '../../../scripts/cli/verify-cli-release.mjs' const roots = [] const hash = bytes => createHash('sha256').update(bytes).digest('hex') @@ -39,7 +39,7 @@ describe.skipIf(process.platform === 'win32')('final CLI archive gate', () => { for (const arch of ['arm64', 'x64']) it(`verifies actual ${arch} archive bytes and signatures with a restrictive umask`, () => { const f = fixture({ arch }) expect(verifyCliReleaseArchive(f.options).signature.codeSlots).toBe(2) - execFileSync(process.execPath, ['--input-type=module', '-e', `process.umask(0o077); const { verifyCliReleaseArchive } = await import(${JSON.stringify(new URL('../../../scripts/verify-cli-release.mjs', import.meta.url).href)}); verifyCliReleaseArchive(${JSON.stringify(f.options)})`]) + execFileSync(process.execPath, ['--input-type=module', '-e', `process.umask(0o077); const { verifyCliReleaseArchive } = await import(${JSON.stringify(new URL('../../../scripts/cli/verify-cli-release.mjs', import.meta.url).href)}); verifyCliReleaseArchive(${JSON.stringify(f.options)})`]) expect(verifyCliReleaseDirectory(f.root)[0].bunVersion).toBe(pinnedBunVersion()) }) it('rejects altered resources, permissions, missing manifest coverage, and stale identity even with a fresh archive checksum', () => { diff --git a/tests/integration/desktop-receipts/desktop-candidate-receipt.spec.mjs b/tests/integration/desktop-receipts/desktop-candidate-receipt.spec.mjs index 843741ba0..1867239c3 100644 --- a/tests/integration/desktop-receipts/desktop-candidate-receipt.spec.mjs +++ b/tests/integration/desktop-receipts/desktop-candidate-receipt.spec.mjs @@ -3,7 +3,7 @@ import { tmpdir } from 'node:os' import { execFileSync } from 'node:child_process' import { join } from 'node:path' import { afterEach, describe, expect, it } from 'vitest' -import { DESKTOP_UPGRADE_CHECKS, recordDesktopCandidate, verifyDesktopCandidate, bindDesktopUpgrade, stageDesktopCandidates } from '../../../scripts/desktop-candidate-receipt.mjs' +import { DESKTOP_UPGRADE_CHECKS, recordDesktopCandidate, verifyDesktopCandidate, bindDesktopUpgrade, stageDesktopCandidates } from '../../../scripts/desktop/desktop-candidate-receipt.mjs' const roots = [] afterEach(() => { for (const path of roots.splice(0)) rmSync(path, { recursive: true, force: true }) }) @@ -43,7 +43,7 @@ describe('desktop candidate acceptance integration', () => { const rawPath = join(options.inputDirectory, 'raw-receipt.json') writeFileSync(rawPath, JSON.stringify(record.rawReceipt)) const original = readFileSync(join(record.directory, record.filename)) - execFileSync(process.execPath, [join(import.meta.dirname, '../../../scripts/desktop-candidate-receipt.mjs'), + execFileSync(process.execPath, [join(import.meta.dirname, '../../../scripts/desktop/desktop-candidate-receipt.mjs'), 'bind-upgrade', record.directory, rawPath], { env: { ...process.env, RUNNER_OS: 'macOS', CANDIDATE_ARCH: 'arm64', CANDIDATE_CHANNEL: 'stable', GITHUB_SHA: options.sourceSha, CANDIDATE_SOURCE_SHA: options.sourceSha, @@ -62,7 +62,7 @@ describe('desktop candidate acceptance integration', () => { const env = { ...process.env, RUNNER_OS: 'macOS', CANDIDATE_ARCH: 'arm64', CANDIDATE_SOURCE_SHA: options.sourceSha, CANDIDATE_VERSION: options.version, CANDIDATE_CHANNEL: 'stable', GITHUB_ENV: output } - const args = [join(import.meta.dirname, '../../../scripts/desktop-candidate-receipt.mjs'), 'verify-selected', record.directory] + const args = [join(import.meta.dirname, '../../../scripts/desktop/desktop-candidate-receipt.mjs'), 'verify-selected', record.directory] execFileSync(process.execPath, args, { env }) expect(readFileSync(output, 'utf8')).toBe(`CANDIDATE_ID=${record.expected.candidateId}\n`) rmSync(output) diff --git a/tests/integration/desktop-smoke-process/desktop-smoke-isolation.spec.ts b/tests/integration/desktop-smoke-process/desktop-smoke-isolation.spec.ts index 87a01ab77..25bb54ea8 100644 --- a/tests/integration/desktop-smoke-process/desktop-smoke-isolation.spec.ts +++ b/tests/integration/desktop-smoke-process/desktop-smoke-isolation.spec.ts @@ -4,7 +4,7 @@ import { promisify } from 'node:util' import { tmpdir } from 'node:os' import { join, resolve } from 'node:path' import { expect, it, vi } from 'vitest' -import { buildDesktopPackagedSmokePlan, desktopSmokeStateEnv } from '../../../scripts/desktop-packaged-smoke-plan.mjs' +import { buildDesktopPackagedSmokePlan, desktopSmokeStateEnv } from '../../../scripts/desktop/desktop-packaged-smoke-plan.mjs' import { piAdapter, syncPiProjectTrust } from '../../../src/workspaces/adapters/pi.js' import { buildSpawnEnv } from '../../../src/workspaces/spawn-env.js' import { ompAgentDir } from '../../../src/workspaces/adapters/omp.js' diff --git a/tests/integration/desktop-smoke-process/desktop-smoke-process.spec.mjs b/tests/integration/desktop-smoke-process/desktop-smoke-process.spec.mjs index ad6ab1e8d..0e348f26c 100644 --- a/tests/integration/desktop-smoke-process/desktop-smoke-process.spec.mjs +++ b/tests/integration/desktop-smoke-process/desktop-smoke-process.spec.mjs @@ -1,6 +1,6 @@ import { readFileSync } from 'node:fs' import { describe, expect, it, vi } from 'vitest' -import { desktopSmokeGroupAlive, spawnDesktopSmoke, stopDesktopSmoke } from '../../../scripts/desktop-smoke-process.mjs' +import { desktopSmokeGroupAlive, spawnDesktopSmoke, stopDesktopSmoke } from '../../../scripts/desktop/desktop-smoke-process.mjs' function alive(pid) { try { process.kill(pid, 0) } catch { return false } diff --git a/tests/integration/release-verifier/select-release-verifier.spec.mjs b/tests/integration/release-verifier/select-release-verifier.spec.mjs index 14bc56b21..3e60697cf 100644 --- a/tests/integration/release-verifier/select-release-verifier.spec.mjs +++ b/tests/integration/release-verifier/select-release-verifier.spec.mjs @@ -3,7 +3,7 @@ import { mkdtempSync, rmSync } from 'node:fs' import { tmpdir } from 'node:os' import { join } from 'node:path' import { afterEach, expect, it } from 'vitest' -import { selectReleaseVerifier } from '../../../scripts/select-release-verifier.mjs' +import { selectReleaseVerifier } from '../../../scripts/cli/select-release-verifier.mjs' const roots = [] afterEach(() => roots.splice(0).forEach((root) => rmSync(root, { recursive: true, force: true }))) diff --git a/scripts/assert-desktop-package.spec.ts b/tests/integration/tooling/assert-desktop-package.spec.ts similarity index 99% rename from scripts/assert-desktop-package.spec.ts rename to tests/integration/tooling/assert-desktop-package.spec.ts index bb78e2a49..f43e54609 100644 --- a/scripts/assert-desktop-package.spec.ts +++ b/tests/integration/tooling/assert-desktop-package.spec.ts @@ -7,7 +7,7 @@ import { describe, expect, it } from 'vitest' import { createPackageWithOptions, uncache } from '@electron/asar' -import { ASAR_REQUIRED_FILES, BASE_REQUIRED_FILES, assertDesktopPackage } from './assert-desktop-package.mjs' +import { ASAR_REQUIRED_FILES, BASE_REQUIRED_FILES, assertDesktopPackage } from '../../../scripts/desktop/assert-desktop-package.mjs' const PI_CLI = 'vendor/pi/node_modules/@earendil-works/pi-coding-agent/dist/cli.js' @@ -75,7 +75,7 @@ function writeSearchToolFiles(appRoot: string, platformArch: string, windows = f describe('assertDesktopPackage', () => { it.each(['mac', 'win'])('keeps the real builder %s file selection inside the app-code boundary', (platform) => { - const root = resolve(import.meta.dirname, '..') + const root = resolve(import.meta.dirname, '../../..') const desktopRequire = createRequire(join(root, 'apps/desktop/package.json')) const builderRequire = createRequire(desktopRequire.resolve('electron-builder')) const { doMergeConfigs } = builderRequire('app-builder-lib/out/util/config/config.js') diff --git a/scripts/bun-release-content-identity.spec.mjs b/tests/integration/tooling/bun-release-content-identity.spec.mjs similarity index 97% rename from scripts/bun-release-content-identity.spec.mjs rename to tests/integration/tooling/bun-release-content-identity.spec.mjs index 315693d6e..3733dbb08 100644 --- a/scripts/bun-release-content-identity.spec.mjs +++ b/tests/integration/tooling/bun-release-content-identity.spec.mjs @@ -2,7 +2,7 @@ import { createHash } from 'node:crypto' import { describe, expect, it } from 'vitest' -import { bunReleaseContentIdentity } from './bun-release-content-identity.mjs' +import { bunReleaseContentIdentity } from '../../../scripts/cli/bun-release-content-identity.mjs' describe('Bun native release content identity', () => { it.each([ diff --git a/scripts/classify-beta-release-prep.spec.mjs b/tests/integration/tooling/classify-beta-release-prep.spec.mjs similarity index 98% rename from scripts/classify-beta-release-prep.spec.mjs rename to tests/integration/tooling/classify-beta-release-prep.spec.mjs index c7365791d..fa424e09e 100644 --- a/scripts/classify-beta-release-prep.spec.mjs +++ b/tests/integration/tooling/classify-beta-release-prep.spec.mjs @@ -3,7 +3,7 @@ import { describe, expect, it } from 'vitest' import { classifyBetaReleasePrep, parseChangedFiles, -} from './classify-beta-release-prep.mjs' +} from '../../../scripts/classify-beta-release-prep.mjs' const manifests = ['package.json'] diff --git a/scripts/cli-aur-container-smoke.spec.mjs b/tests/integration/tooling/cli-aur-container-smoke.spec.mjs similarity index 89% rename from scripts/cli-aur-container-smoke.spec.mjs rename to tests/integration/tooling/cli-aur-container-smoke.spec.mjs index eef84f24e..ca8ddbbf8 100644 --- a/scripts/cli-aur-container-smoke.spec.mjs +++ b/tests/integration/tooling/cli-aur-container-smoke.spec.mjs @@ -1,7 +1,7 @@ import { describe, expect, it, vi } from 'vitest' import { spawnSync } from 'node:child_process' -import { AUR_IMAGES, parseArgs, runAurContainerSmoke } from './cli-aur-container-smoke.mjs' +import { AUR_IMAGES, parseArgs, runAurContainerSmoke } from '../../../scripts/cli/cli-aur-container-smoke.mjs' vi.mock('node:child_process', () => ({ spawnSync: vi.fn(() => ({ status: 0 })) })) @@ -12,15 +12,15 @@ describe('AUR container lifecycle smoke', () => { previousVersion: '0.91.0', currentVersion: '0.91.1', previousContentIdentity: '0123456789abcdef', currentContentIdentity: 'fedcba9876543210', - previousPackage: 'scripts/cli-aur-container-smoke.spec.mjs', - currentPackage: 'scripts/cli-aur-container-smoke.spec.mjs', + previousPackage: 'tests/integration/tooling/cli-aur-container-smoke.spec.mjs', + currentPackage: 'tests/integration/tooling/cli-aur-container-smoke.spec.mjs', }) const [command, args] = vi.mocked(spawnSync).mock.calls.at(-1) expect(command).toBe('docker') expect(args.slice(0, 2)).toEqual(['run', '--rm']) expect(args).not.toContain('--privileged') expect(args.at(-1)).toMatch(/^sed -i .*DisableSandbox.*\/etc\/pacman.conf && pacman -Syu/) - expect(args.at(-1)).toContain('exec /usr/bin/node /work/scripts/cli-system-package-manager-smoke.mjs') + expect(args.at(-1)).toContain('exec /usr/bin/node /work/scripts/cli/cli-system-package-manager-smoke.mjs') expect(args.at(-1)).not.toMatch(/SigLevel|--disable-sandbox|nodejs git/) expect(args.find((value) => value.endsWith(':/work:ro'))).toBeDefined() }) diff --git a/scripts/cli-legacy-cutover-smoke.spec.mjs b/tests/integration/tooling/cli-legacy-cutover-smoke.spec.mjs similarity index 96% rename from scripts/cli-legacy-cutover-smoke.spec.mjs rename to tests/integration/tooling/cli-legacy-cutover-smoke.spec.mjs index 4ca907a68..9e8217023 100644 --- a/scripts/cli-legacy-cutover-smoke.spec.mjs +++ b/tests/integration/tooling/cli-legacy-cutover-smoke.spec.mjs @@ -11,11 +11,11 @@ import { legacySeedEnvironment, parseArgs, verifyLegacyInstallerSha256, -} from './cli-legacy-cutover-smoke.mjs' +} from '../../../scripts/cli/cli-legacy-cutover-smoke.mjs' describe('legacy CLI cutover smoke', () => { it('uses the shipped updater for stable and direct archive cutover for beta/dev', () => { - const source = readFileSync(new URL('./cli-legacy-cutover-smoke.mjs', import.meta.url), 'utf8') + const source = readFileSync(new URL('../../../scripts/cli/cli-legacy-cutover-smoke.mjs', import.meta.url), 'utf8') expect(source).toContain("run(executable, ['update', '--yes']") expect(source).toContain("'--archive', options.archive") expect(source).toContain('fixture.assertRequests()') diff --git a/scripts/cli-linuxbrew-smoke.spec.mjs b/tests/integration/tooling/cli-linuxbrew-smoke.spec.mjs similarity index 94% rename from scripts/cli-linuxbrew-smoke.spec.mjs rename to tests/integration/tooling/cli-linuxbrew-smoke.spec.mjs index 3eb872ba1..555fe37cd 100644 --- a/scripts/cli-linuxbrew-smoke.spec.mjs +++ b/tests/integration/tooling/cli-linuxbrew-smoke.spec.mjs @@ -1,6 +1,6 @@ import { describe, expect, it } from 'vitest' -import { LINUXBREW_IMAGES, parseArgs } from './cli-linuxbrew-smoke.mjs' +import { LINUXBREW_IMAGES, parseArgs } from '../../../scripts/cli/cli-linuxbrew-smoke.mjs' describe('Linuxbrew lifecycle smoke', () => { it('pins official Homebrew images for both native Linux architectures', () => { diff --git a/scripts/desktop-after-pack.spec.ts b/tests/integration/tooling/desktop-after-pack.spec.ts similarity index 95% rename from scripts/desktop-after-pack.spec.ts rename to tests/integration/tooling/desktop-after-pack.spec.ts index 5309b225e..366da79df 100644 --- a/scripts/desktop-after-pack.spec.ts +++ b/tests/integration/tooling/desktop-after-pack.spec.ts @@ -3,7 +3,7 @@ import { tmpdir } from 'node:os' import { join } from 'node:path' import { createPackage } from '@electron/asar' import { describe, expect, it } from 'vitest' -import afterPack from './desktop-after-pack.mjs' +import afterPack from '../../../scripts/desktop/desktop-after-pack.mjs' describe('desktop product metadata projection', () => { it.each(['darwin', 'win32'])('takes %s runtime identity from the built archive', async (platform) => { diff --git a/scripts/desktop-package-artifact.spec.ts b/tests/integration/tooling/desktop-package-artifact.spec.ts similarity index 98% rename from scripts/desktop-package-artifact.spec.ts rename to tests/integration/tooling/desktop-package-artifact.spec.ts index 6188ece86..703c7cd39 100644 --- a/scripts/desktop-package-artifact.spec.ts +++ b/tests/integration/tooling/desktop-package-artifact.spec.ts @@ -10,7 +10,7 @@ import { DEFAULT_DESKTOP_PACKAGE_ROOT, DESKTOP_PACKAGE_OWNER_MARKER, resolveDesktopPackageRootArg, -} from './desktop-package-artifact.mjs' +} from '../../../scripts/desktop/desktop-package-artifact.mjs' const roots: string[] = [] diff --git a/scripts/desktop-packaged-smoke-plan.spec.ts b/tests/integration/tooling/desktop-packaged-smoke-plan.spec.ts similarity index 98% rename from scripts/desktop-packaged-smoke-plan.spec.ts rename to tests/integration/tooling/desktop-packaged-smoke-plan.spec.ts index 01e765839..c732640ee 100644 --- a/scripts/desktop-packaged-smoke-plan.spec.ts +++ b/tests/integration/tooling/desktop-packaged-smoke-plan.spec.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from 'vitest' -import { buildDesktopPackagedSmokePlan } from './desktop-packaged-smoke-plan.mjs' +import { buildDesktopPackagedSmokePlan } from '../../../scripts/desktop/desktop-packaged-smoke-plan.mjs' describe('buildDesktopPackagedSmokePlan', () => { it('keeps --onboarding as an explicitly deprecated alias with identical execution', () => { diff --git a/scripts/desktop-upgrade-smoke-lib.spec.ts b/tests/integration/tooling/desktop-upgrade-smoke-lib.spec.ts similarity index 98% rename from scripts/desktop-upgrade-smoke-lib.spec.ts rename to tests/integration/tooling/desktop-upgrade-smoke-lib.spec.ts index 2f75a9209..1ee0133d6 100644 --- a/scripts/desktop-upgrade-smoke-lib.spec.ts +++ b/tests/integration/tooling/desktop-upgrade-smoke-lib.spec.ts @@ -21,7 +21,7 @@ import { waitForChromiumProfileRelease, waitForDesktopUpgradeDocument, windowsInstallerArgs, -} from './desktop-upgrade-smoke-lib.mjs' +} from '../../../scripts/desktop/desktop-upgrade-smoke-lib.mjs' describe('installed desktop version during NSIS replacement', () => { it('observes loose-to-ASAR and subsequent in-place ASAR upgrades', async () => { @@ -93,10 +93,10 @@ describe('desktop upgrade smoke planning', () => { it('keeps the Windows builder and legacy takeover aligned with the upgrade contract', () => { const packageJson = JSON.parse( - readFileSync(new URL('../package.json', import.meta.url), 'utf8'), + readFileSync(new URL('../../../package.json', import.meta.url), 'utf8'), ) as { build: { nsis: { artifactName: string; include: string } } } const installerInclude = readFileSync( - new URL('../apps/desktop/build/installer.nsh', import.meta.url), + new URL('../../../apps/desktop/build/installer.nsh', import.meta.url), 'utf8', ) diff --git a/scripts/guardian/dev-hot-reload.spec.ts b/tests/integration/tooling/dev-hot-reload.spec.ts similarity index 96% rename from scripts/guardian/dev-hot-reload.spec.ts rename to tests/integration/tooling/dev-hot-reload.spec.ts index 24cf41e4f..c594e8495 100644 --- a/scripts/guardian/dev-hot-reload.spec.ts +++ b/tests/integration/tooling/dev-hot-reload.spec.ts @@ -6,7 +6,7 @@ import { UTA_BACKEND_WATCH_INCLUDES, buildTsxWatchArgs, isBackendHotReloadEnabled, -} from './dev-hot-reload.js' +} from '../../../scripts/guardian/dev-hot-reload.ts' describe('guardian dev backend hot reload', () => { it('is enabled by default', () => { diff --git a/scripts/guardian/dev-options.spec.ts b/tests/integration/tooling/dev-options.spec.ts similarity index 94% rename from scripts/guardian/dev-options.spec.ts rename to tests/integration/tooling/dev-options.spec.ts index cb68396e7..a940ef28a 100644 --- a/scripts/guardian/dev-options.spec.ts +++ b/tests/integration/tooling/dev-options.spec.ts @@ -2,7 +2,7 @@ import { resolve } from 'node:path' import { describe, expect, it } from 'vitest' -import { parseDevGuardianOptions } from './dev-options.js' +import { parseDevGuardianOptions } from '../../../scripts/guardian/dev-options.ts' describe('parseDevGuardianOptions', () => { it('resolves a separate development home from the checkout directory', () => { diff --git a/scripts/onboarding-ai-mock.spec.ts b/tests/integration/tooling/onboarding-ai-mock.spec.ts similarity index 97% rename from scripts/onboarding-ai-mock.spec.ts rename to tests/integration/tooling/onboarding-ai-mock.spec.ts index 9066f8713..0a8b7986c 100644 --- a/scripts/onboarding-ai-mock.spec.ts +++ b/tests/integration/tooling/onboarding-ai-mock.spec.ts @@ -4,7 +4,7 @@ import { afterEach, describe, expect, it } from 'vitest' import { ONBOARDING_AI_MOCK_KEY, createOnboardingAiMockServer, -} from './onboarding-ai-mock.js' +} from '../../../scripts/onboarding-ai-mock.ts' let closeServer: (() => Promise) | null = null diff --git a/scripts/onboarding-test-env.spec.ts b/tests/integration/tooling/onboarding-test-env.spec.ts similarity index 97% rename from scripts/onboarding-test-env.spec.ts rename to tests/integration/tooling/onboarding-test-env.spec.ts index 8d90699cc..de74898e8 100644 --- a/scripts/onboarding-test-env.spec.ts +++ b/tests/integration/tooling/onboarding-test-env.spec.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from 'vitest' import { join } from 'node:path' -import { buildOnboardingTestEnv } from './onboarding-test-env.js' +import { buildOnboardingTestEnv } from '../../../scripts/onboarding-test-env.ts' describe('buildOnboardingTestEnv', () => { it('builds an isolated fresh-run environment by default', () => { diff --git a/scripts/pack-cli-npm-packages.spec.mjs b/tests/integration/tooling/pack-cli-npm-packages.spec.mjs similarity index 97% rename from scripts/pack-cli-npm-packages.spec.mjs rename to tests/integration/tooling/pack-cli-npm-packages.spec.mjs index 7e6f8eadb..cd256fa0e 100644 --- a/scripts/pack-cli-npm-packages.spec.mjs +++ b/tests/integration/tooling/pack-cli-npm-packages.spec.mjs @@ -4,7 +4,7 @@ import { join } from 'node:path' import { afterEach, describe, expect, it } from 'vitest' -import { packCliNpmPackages } from './pack-cli-npm-packages.mjs' +import { packCliNpmPackages } from '../../../scripts/cli/pack-cli-npm-packages.mjs' const temporaryPaths = [] // This is an integration check around three real `npm pack` subprocesses. On diff --git a/scripts/pnpm-command.spec.ts b/tests/integration/tooling/pnpm-command.spec.ts similarity index 94% rename from scripts/pnpm-command.spec.ts rename to tests/integration/tooling/pnpm-command.spec.ts index e0ec086e7..9db4b02e6 100644 --- a/scripts/pnpm-command.spec.ts +++ b/tests/integration/tooling/pnpm-command.spec.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from 'vitest' -import { composePnpmCommand, runPnpmSync } from './pnpm-command.mjs' +import { composePnpmCommand, runPnpmSync } from '../../../scripts/pnpm-command.mjs' describe('composePnpmCommand', () => { it('uses a direct shell-free pnpm invocation on POSIX', () => { @@ -70,7 +70,7 @@ describe.runIf(process.platform === 'win32')('runPnpmSync on Windows', () => { expect(result.error).toBeUndefined() expect(result.status).toBe(0) - expect(JSON.parse(result.stdout)).toEqual([ + expect(JSON.parse(String(result.stdout))).toEqual([ 'C:\\Alice Work\\broker pack', 'alpha&beta', ]) diff --git a/scripts/preflight-public-cli-authority.spec.mjs b/tests/integration/tooling/preflight-public-cli-authority.spec.mjs similarity index 99% rename from scripts/preflight-public-cli-authority.spec.mjs rename to tests/integration/tooling/preflight-public-cli-authority.spec.mjs index 09789b677..c9f9d2898 100644 --- a/scripts/preflight-public-cli-authority.spec.mjs +++ b/tests/integration/tooling/preflight-public-cli-authority.spec.mjs @@ -3,7 +3,7 @@ import { describe, expect, it, vi } from 'vitest' import { NPM_PACKAGE_NAMES, preflightPublicCliAuthority, -} from './preflight-public-cli-authority.mjs' +} from '../../../scripts/cli/preflight-public-cli-authority.mjs' function response(status, body) { return { diff --git a/scripts/prepare-cli-neutral-inputs.spec.mjs b/tests/integration/tooling/prepare-cli-neutral-inputs.spec.mjs similarity index 99% rename from scripts/prepare-cli-neutral-inputs.spec.mjs rename to tests/integration/tooling/prepare-cli-neutral-inputs.spec.mjs index 73632a9f8..6676b547d 100644 --- a/scripts/prepare-cli-neutral-inputs.spec.mjs +++ b/tests/integration/tooling/prepare-cli-neutral-inputs.spec.mjs @@ -9,7 +9,7 @@ import { CLI_NEUTRAL_INPUT_ROOTS, prepareCliNeutralInputs, verifyCliNeutralInputs, -} from './prepare-cli-neutral-inputs.mjs' +} from '../../../scripts/cli/prepare-cli-neutral-inputs.mjs' const commit = '0123456789abcdef0123456789abcdef01234567' const temporaryPaths = [] diff --git a/scripts/prepare-desktop-release-assets.spec.ts b/tests/integration/tooling/prepare-desktop-release-assets.spec.ts similarity index 96% rename from scripts/prepare-desktop-release-assets.spec.ts rename to tests/integration/tooling/prepare-desktop-release-assets.spec.ts index bc602627d..c1759ad6b 100644 --- a/scripts/prepare-desktop-release-assets.spec.ts +++ b/tests/integration/tooling/prepare-desktop-release-assets.spec.ts @@ -7,7 +7,7 @@ import { join, resolve } from 'node:path' import { describe, expect, it } from 'vitest' -import { checkPublicationHead, previousReleaseTag, prepareBuildMetadata, prepareMirrorAssets } from './prepare-desktop-release-assets.mjs' +import { checkPublicationHead, previousReleaseTag, prepareBuildMetadata, prepareMirrorAssets } from '../../../scripts/desktop/prepare-desktop-release-assets.mjs' function withTempDir(run: (dir: string) => void) { const dir = mkdtempSync(join(tmpdir(), 'openalice-release-assets-')) @@ -259,11 +259,11 @@ it.skipIf(process.platform === 'win32').each([ ])('executes the publication shell with %s %s and object-store head %s', (operation, version, storeVersion, accepted) => { withTempDir((temporary) => { const dir = realpathSync(temporary) - const repo = resolve(import.meta.dirname, '..') + const repo = resolve(import.meta.dirname, '../../..') const workflow = YAML.parse(readFileSync(join(repo, '.github/workflows/release.yml'), 'utf8')) const script = workflow.jobs['mirror-release-assets'].steps.find((s: { name?: string }) => s.name === 'Mirror release assets to Cloudflare R2').run - for (const path of ['bin', 'scripts', 'packages/update-lifecycle/src', 'dist/r2-upload']) mkdirSync(join(dir, path), { recursive: true }) - for (const path of ['scripts/prepare-desktop-release-assets.mjs', 'packages/update-lifecycle/src/release-policy.ts']) copyFileSync(join(repo, path), join(dir, path)) + for (const path of ['bin', 'scripts/desktop', 'packages/update-lifecycle/src', 'dist/r2-upload']) mkdirSync(join(dir, path), { recursive: true }) + for (const path of ['scripts/desktop/prepare-desktop-release-assets.mjs', 'packages/update-lifecycle/src/release-policy.ts']) copyFileSync(join(repo, path), join(dir, path)) const intent = JSON.stringify({ channel: 'stable', version: '0.94.1' }) writeFileSync(join(dir, 'store.json'), JSON.stringify({ channel: 'stable', version: storeVersion })) writeFileSync(join(dir, 'bin/aws'), String.raw`#!/usr/bin/env node diff --git a/scripts/guardian/prod-ports.spec.ts b/tests/integration/tooling/prod-ports.spec.ts similarity index 98% rename from scripts/guardian/prod-ports.spec.ts rename to tests/integration/tooling/prod-ports.spec.ts index ad7dede76..45c7f3dcc 100644 --- a/scripts/guardian/prod-ports.spec.ts +++ b/tests/integration/tooling/prod-ports.spec.ts @@ -4,7 +4,7 @@ import { planProdPorts, readProdPortsFile, resolveProdPortConfig, -} from './prod-ports.mjs' +} from '../../../scripts/guardian/prod-ports.mjs' describe('built Guardian port planning', () => { it('retains env, file, and default provenance', () => { diff --git a/scripts/publish-cli-npm-packages.spec.mjs b/tests/integration/tooling/publish-cli-npm-packages.spec.mjs similarity index 98% rename from scripts/publish-cli-npm-packages.spec.mjs rename to tests/integration/tooling/publish-cli-npm-packages.spec.mjs index 285198808..4c18a5256 100644 --- a/scripts/publish-cli-npm-packages.spec.mjs +++ b/tests/integration/tooling/publish-cli-npm-packages.spec.mjs @@ -5,7 +5,7 @@ import { basename, join } from 'node:path' import { afterEach, describe, expect, it, vi } from 'vitest' -import { publishCliNpmPackages } from './publish-cli-npm-packages.mjs' +import { publishCliNpmPackages } from '../../../scripts/cli/publish-cli-npm-packages.mjs' const roots = [] const packageNames = [ diff --git a/scripts/release-artifacts.spec.mjs b/tests/integration/tooling/release-artifacts.spec.mjs similarity index 89% rename from scripts/release-artifacts.spec.mjs rename to tests/integration/tooling/release-artifacts.spec.mjs index 85dfe5bfd..95f5c981d 100644 --- a/scripts/release-artifacts.spec.mjs +++ b/tests/integration/tooling/release-artifacts.spec.mjs @@ -1,7 +1,7 @@ import { describe, expect, it } from 'vitest' -import { latestArtifact } from './release-artifacts.mjs' -import { selectCliArtifacts } from './stage-cli-release.mjs' -import { CLI_RELEASE_TARGETS } from '../packages/cli/src/release-targets.mjs' +import { latestArtifact } from '../../../scripts/cli/release-artifacts.mjs' +import { selectCliArtifacts } from '../../../scripts/cli/stage-cli-release.mjs' +import { CLI_RELEASE_TARGETS } from '../../../packages/cli/src/release-targets.mjs' const sourceSha = 'a'.repeat(40) const now = Date.parse('2026-10-04T00:00:00Z') diff --git a/scripts/release-candidate-identity.spec.mjs b/tests/integration/tooling/release-candidate-identity.spec.mjs similarity index 97% rename from scripts/release-candidate-identity.spec.mjs rename to tests/integration/tooling/release-candidate-identity.spec.mjs index 08a97864f..d3dea2adb 100644 --- a/scripts/release-candidate-identity.spec.mjs +++ b/tests/integration/tooling/release-candidate-identity.spec.mjs @@ -2,7 +2,7 @@ import { mkdtempSync, writeFileSync, rmSync, symlinkSync } from 'node:fs' import { tmpdir } from 'node:os' import { join } from 'node:path' import { afterEach, describe, expect, it } from 'vitest' -import { createCandidateIdentity, verifyCandidateIdentity, createCandidateAcceptance, verifyCandidateAcceptance } from './release-candidate-identity.mjs' +import { createCandidateIdentity, verifyCandidateIdentity, createCandidateAcceptance, verifyCandidateAcceptance } from '../../../scripts/cli/release-candidate-identity.mjs' const roots = [] afterEach(() => { for (const path of roots.splice(0)) rmSync(path, { recursive: true, force: true }) }) diff --git a/scripts/remote-ssh-smoke-options.spec.mjs b/tests/integration/tooling/remote-ssh-smoke-options.spec.mjs similarity index 94% rename from scripts/remote-ssh-smoke-options.spec.mjs rename to tests/integration/tooling/remote-ssh-smoke-options.spec.mjs index e76a84a25..bce5bc51f 100644 --- a/scripts/remote-ssh-smoke-options.spec.mjs +++ b/tests/integration/tooling/remote-ssh-smoke-options.spec.mjs @@ -1,6 +1,6 @@ import { describe, expect, it } from 'vitest' -import { parseRemoteSshSmokeOptions } from './remote-ssh-smoke-options.mjs' +import { parseRemoteSshSmokeOptions } from '../../../scripts/cli/remote-ssh-smoke-options.mjs' describe('parseRemoteSshSmokeOptions', () => { it('accepts pnpm argument separators', () => { diff --git a/scripts/remote-ssh-smoke-targets.spec.mjs b/tests/integration/tooling/remote-ssh-smoke-targets.spec.mjs similarity index 97% rename from scripts/remote-ssh-smoke-targets.spec.mjs rename to tests/integration/tooling/remote-ssh-smoke-targets.spec.mjs index e7ef29e33..ce5fbc258 100644 --- a/scripts/remote-ssh-smoke-targets.spec.mjs +++ b/tests/integration/tooling/remote-ssh-smoke-targets.spec.mjs @@ -4,7 +4,7 @@ import { requireBrokerAccountNeedsInstall, requireDiscoveredAgentRuntime, requireMissingAgentRuntime, -} from './remote-ssh-smoke-targets.mjs' +} from '../../../scripts/cli/remote-ssh-smoke-targets.mjs' describe('remote SSH smoke target assertions', () => { const missingRuntime = { diff --git a/scripts/guardian/runtime-process-spec.spec.ts b/tests/integration/tooling/runtime-process-spec.spec.ts similarity index 90% rename from scripts/guardian/runtime-process-spec.spec.ts rename to tests/integration/tooling/runtime-process-spec.spec.ts index e1b5241a9..e025bf3ee 100644 --- a/scripts/guardian/runtime-process-spec.spec.ts +++ b/tests/integration/tooling/runtime-process-spec.spec.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from 'vitest' -import { runtimeProcessSpec } from './runtime-process-spec.mjs' +import { runtimeProcessSpec } from '../../../scripts/guardian/runtime-process-spec.mjs' describe('runtimeProcessSpec', () => { it('re-enters the Bun standalone executable under a private role', () => { diff --git a/scripts/select-release-candidate.spec.mjs b/tests/integration/tooling/select-release-candidate.spec.mjs similarity index 97% rename from scripts/select-release-candidate.spec.mjs rename to tests/integration/tooling/select-release-candidate.spec.mjs index ca4946770..450f6a037 100644 --- a/scripts/select-release-candidate.spec.mjs +++ b/tests/integration/tooling/select-release-candidate.spec.mjs @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest' -import { selectReleaseCandidate } from './select-release-candidate.mjs' +import { selectReleaseCandidate } from '../../../scripts/cli/select-release-candidate.mjs' function fixture() { const sourceSha = 'a'.repeat(40) diff --git a/scripts/guardian/shared.spec.ts b/tests/integration/tooling/shared.spec.ts similarity index 99% rename from scripts/guardian/shared.spec.ts rename to tests/integration/tooling/shared.spec.ts index bae648b91..2f132b290 100644 --- a/scripts/guardian/shared.spec.ts +++ b/tests/integration/tooling/shared.spec.ts @@ -4,7 +4,7 @@ import { join } from 'node:path' import { afterEach, beforeEach, describe, expect, it } from 'vitest' -import { isLiteModeEnv, readPortsFile, resolveGuardianTradingMode, resolvePortConfig, resolveWindowsBin, startFlagWatcher } from './shared.js' +import { isLiteModeEnv, readPortsFile, resolveGuardianTradingMode, resolvePortConfig, resolveWindowsBin, startFlagWatcher } from '../../../scripts/guardian/shared.ts' let home: string diff --git a/scripts/smoke-packaged-toolchain.spec.ts b/tests/integration/tooling/smoke-packaged-toolchain.spec.ts similarity index 99% rename from scripts/smoke-packaged-toolchain.spec.ts rename to tests/integration/tooling/smoke-packaged-toolchain.spec.ts index fe55c96e0..e23b809cc 100644 --- a/scripts/smoke-packaged-toolchain.spec.ts +++ b/tests/integration/tooling/smoke-packaged-toolchain.spec.ts @@ -8,7 +8,7 @@ import { describe, expect, it } from 'vitest' import { buildPackagedToolchainSmokePlan, packagedElectronExecutable, -} from './smoke-packaged-toolchain.mjs' +} from '../../../scripts/desktop/smoke-packaged-toolchain.mjs' function touch(path: string) { mkdirSync(dirname(path), { recursive: true }) diff --git a/scripts/guardian/system-proxy.spec.ts b/tests/integration/tooling/system-proxy.spec.ts similarity index 94% rename from scripts/guardian/system-proxy.spec.ts rename to tests/integration/tooling/system-proxy.spec.ts index d4938dac1..8d8868183 100644 --- a/scripts/guardian/system-proxy.spec.ts +++ b/tests/integration/tooling/system-proxy.spec.ts @@ -5,9 +5,9 @@ import { parseWindowsProxyRegistryOutput, resolveGuardianProxyEnv, windowsProxyServerToRules, -} from './system-proxy.js' +} from '../../../scripts/guardian/system-proxy.ts' -const registry = (values: Record) => async (_command: string, args: readonly string[]): Promise => { +const registry = (values: Record) => async (_command: string, args: readonly string[]): Promise => { const valueName = args[args.length - 1] const value = values[valueName] if (value === undefined) throw new Error('value is not configured') @@ -184,8 +184,8 @@ describe('buildGuardianChildEnv', () => { }), }) - const utaSpecEnv = { ...result.env, OPENALICE_UTA_PORT: '47333' } - const restartedUtaSpecEnv = { ...result.env, OPENALICE_UTA_PORT: '47333' } + const utaSpecEnv: Record = { ...result.env, OPENALICE_UTA_PORT: '47333' } + const restartedUtaSpecEnv: Record = { ...result.env, OPENALICE_UTA_PORT: '47333' } expect(utaSpecEnv).toEqual(restartedUtaSpecEnv) expect(utaSpecEnv.HTTPS_PROXY).toBe('http://proxy.example:8080') expect(utaSpecEnv.OPENALICE_HOME).toBe('C:/homes/alice') diff --git a/scripts/vendor-managed-runtime.spec.ts b/tests/integration/tooling/vendor-managed-runtime.spec.ts similarity index 98% rename from scripts/vendor-managed-runtime.spec.ts rename to tests/integration/tooling/vendor-managed-runtime.spec.ts index 0d394f12e..4e2b88e10 100644 --- a/scripts/vendor-managed-runtime.spec.ts +++ b/tests/integration/tooling/vendor-managed-runtime.spec.ts @@ -6,7 +6,7 @@ import { requiredWindowsGitFiles, resolveManagedSearchToolsSpec, resolveWindowsGitRuntimeSpec, -} from './vendor-managed-runtime.mjs' +} from '../../../scripts/desktop/vendor-managed-runtime.mjs' describe('vendor managed runtime helpers', () => { it('pins the managed Pi release', () => { diff --git a/scripts/verify-desktop-update-assets.spec.ts b/tests/integration/tooling/verify-desktop-update-assets.spec.ts similarity index 98% rename from scripts/verify-desktop-update-assets.spec.ts rename to tests/integration/tooling/verify-desktop-update-assets.spec.ts index 9716d54d4..edbfb2aa7 100644 --- a/scripts/verify-desktop-update-assets.spec.ts +++ b/tests/integration/tooling/verify-desktop-update-assets.spec.ts @@ -7,7 +7,7 @@ import { afterEach, describe, expect, it } from 'vitest' import { updateMetadataName, verifyDesktopUpdateAssets, -} from './verify-desktop-update-assets.mjs' +} from '../../../scripts/desktop/verify-desktop-update-assets.mjs' const roots: string[] = [] diff --git a/scripts/verify-public-cli-channels.spec.mjs b/tests/integration/tooling/verify-public-cli-channels.spec.mjs similarity index 96% rename from scripts/verify-public-cli-channels.spec.mjs rename to tests/integration/tooling/verify-public-cli-channels.spec.mjs index 17b1a933d..ed90223e2 100644 --- a/scripts/verify-public-cli-channels.spec.mjs +++ b/tests/integration/tooling/verify-public-cli-channels.spec.mjs @@ -4,7 +4,7 @@ import { tmpdir } from 'node:os' import { join } from 'node:path' import { afterEach, describe, expect, it } from 'vitest' -import { parseArgs, verifyPublicCliChannels } from './verify-public-cli-channels.mjs' +import { parseArgs, verifyPublicCliChannels } from '../../../scripts/cli/verify-public-cli-channels.mjs' const roots = [] afterEach(() => { diff --git a/scripts/workspace-acceptance-ai-mock.spec.ts b/tests/integration/tooling/workspace-acceptance-ai-mock.spec.ts similarity index 94% rename from scripts/workspace-acceptance-ai-mock.spec.ts rename to tests/integration/tooling/workspace-acceptance-ai-mock.spec.ts index 60de6b6c5..d3fe34abf 100644 --- a/scripts/workspace-acceptance-ai-mock.spec.ts +++ b/tests/integration/tooling/workspace-acceptance-ai-mock.spec.ts @@ -5,7 +5,7 @@ import { textCompletionStream, WORKSPACE_ACCEPTANCE_AGENT_ISSUE_ID, WORKSPACE_ACCEPTANCE_ASSISTANT_TEXT, -} from './workspace-acceptance-ai-mock.mjs' +} from '../../../scripts/desktop/workspace-acceptance-ai-mock.mjs' function dataPayloads(stream: string) { return stream diff --git a/scripts/workspace-acceptance-receipt.spec.ts b/tests/integration/tooling/workspace-acceptance-receipt.spec.ts similarity index 94% rename from scripts/workspace-acceptance-receipt.spec.ts rename to tests/integration/tooling/workspace-acceptance-receipt.spec.ts index 3099aea7a..51bd039db 100644 --- a/scripts/workspace-acceptance-receipt.spec.ts +++ b/tests/integration/tooling/workspace-acceptance-receipt.spec.ts @@ -4,7 +4,7 @@ import { formatWorkspaceAcceptanceFailure, inspectWorkspaceAcceptanceReceipt, requiredWorkspaceChecks, -} from './workspace-acceptance-receipt.mjs' +} from '../../../scripts/desktop/workspace-acceptance-receipt.mjs' describe('Workspace acceptance receipt diagnostics', () => { it('keeps the renderer error and every incomplete check', () => { @@ -43,7 +43,7 @@ describe('Workspace acceptance receipt diagnostics', () => { checks.cleanupComplete = 'warning' as unknown as boolean expect(inspectWorkspaceAcceptanceReceipt({ checks }).incompleteChecks).toEqual(['cleanupComplete']) // Keep the producer's real schema tied to the consumer's required set. - const source = readFileSync(resolve(import.meta.dirname, '../apps/desktop/src/workspace-acceptance-smoke.ts'), 'utf8') + const source = readFileSync(resolve(import.meta.dirname, '../../../apps/desktop/src/workspace-acceptance-smoke.ts'), 'utf8') const declared = source.match(/readonly checks: \{([\s\S]*?)\n \}/)![1] expect([...declared.matchAll(/readonly (\w+): boolean/g)].map(match => match[1]).sort()).toEqual([...requiredWorkspaceChecks].sort()) }) diff --git a/tests/tsconfig.json b/tests/tsconfig.json index 8b3bad969..eb39676f2 100644 --- a/tests/tsconfig.json +++ b/tests/tsconfig.json @@ -19,8 +19,7 @@ "./**/*.spec.ts", "./**/*.spec.tsx", "../ui/src/vite-env.d.ts", - "../ui/src/i18n/i18n.d.ts", - "../scripts/workspace-acceptance-receipt.spec.ts" + "../ui/src/i18n/i18n.d.ts" ], "exclude": [ "../node_modules", diff --git a/ui/public/office/coworkers/README.md b/ui/public/office/coworkers/README.md index 8424223f2..07b2edd9c 100644 --- a/ui/public/office/coworkers/README.md +++ b/ui/public/office/coworkers/README.md @@ -27,10 +27,9 @@ generated full-resolution masters are intentionally not shipped at runtime. The roster now contains thirty curated identities. Six additional feminine coworkers were generated as transparent three-pose sheets: two Codex variants (field mechanic and cyber scout), a Claude botanical archivist, a Pi field mathematician, and two OpenCode variants (workshop hacker and systems analyst). Each sheet keeps one identity across a -standing portrait, seated idle pose, and seated typing pose. `scripts/package-office-coworker-sheet.py` splits those +standing portrait, seated idle pose, and seated typing pose. The packaging pipeline splits those sheets and packages hard-alpha 72x104 portraits plus 176x176 seated canvases. Packaging applies the hard-alpha matte -before measuring each pose, so faint generated fringe cannot shrink the visible character. Existing idle/work pairs -can be repacked with `scripts/normalize-office-coworker-pair.py`; both frames share one scale, fit a 164x164 visual +before measuring each pose, so faint generated fringe cannot shrink the visible character. Both seated frames share one scale, fit a 164x164 visual area, and keep the same bottom-center anchor. This keeps every seated NPC legible at map scale without resizing Alice, desks, or collision geometry. diff --git a/ui/public/office/packs/README.md b/ui/public/office/packs/README.md index 665540fb4..b36e59fb7 100644 --- a/ui/public/office/packs/README.md +++ b/ui/public/office/packs/README.md @@ -19,8 +19,7 @@ read as a floating torso at native map scale. Alice has no handed prop or asymmetric side marking, so the runtime's right-facing row is intentionally a per-frame horizontal mirror of the approved connected left-facing row. Frame order is preserved, keeping the same stride phase, scale, and shoe baseline in -both directions. `scripts/repair-office-alice-side-gait.py` owns that -deterministic repair. +both directions. Office no longer ships or loads the full Codex pet atlas. The player, map collision, and four-direction animation now have their own purpose-built asset; diff --git a/vitest.integration.config.ts b/vitest.integration.config.ts index b3496a47b..6244ff0ab 100644 --- a/vitest.integration.config.ts +++ b/vitest.integration.config.ts @@ -41,7 +41,7 @@ export default defineConfig({ name: 'node', environment: 'node', setupFiles: ['./vitest.setup.ts'], - include: ['tests/integration/**/*.spec.{ts,mjs,js}', 'tests/e2e/**/*.spec.{ts,mjs,js}', 'scripts/**/*.spec.{ts,mjs,js}'], + include: ['tests/integration/**/*.spec.{ts,mjs,js}', 'tests/e2e/**/*.spec.{ts,mjs,js}'], exclude: [ 'tests/integration/{broker-market-data,hyperliquid-market-data,ibkr-wire-readonly,market-data-providers,market-data-routes,twse-provider,broker-alpaca-paper,broker-bybit-paper,broker-hyperliquid-paper,broker-ibkr-paper,broker-okx-paper,ibkr-wire-paper,bybit-diagnostic}/**', '**/node_modules/**',