diff --git a/package.json b/package.json index d89c7fec1b..e7e47677ee 100644 --- a/package.json +++ b/package.json @@ -234,6 +234,7 @@ "bin", "dist", "apple/snapshot-bridge", + "!apple/snapshot-bridge/README.md", "apple/fold-helper", "android/snapshot-helper/dist", "!android/snapshot-helper/dist/*.idsig", diff --git a/packages/ad-script/src/internal/__tests__/script.test.ts b/packages/ad-script/src/internal/__tests__/script.test.ts index a72a188a6c..d287c0d0c0 100644 --- a/packages/ad-script/src/internal/__tests__/script.test.ts +++ b/packages/ad-script/src/internal/__tests__/script.test.ts @@ -164,11 +164,8 @@ test('screenshot replay script round-trips a quoted --crop-on selector', () => { }); test('snapshot replay script parses full refresh flags', () => { - const ignoredLegacyFlag = '-' + 'c'; const parsed = parseReplayScriptDetailed( - ['snapshot', '-i', ignoredLegacyFlag, '--raw', '--force-full', '-d', '2', '-s', '"@e1"'].join( - ' ', - ) + '\n', + ['snapshot', '-i', '--raw', '--force-full', '-d', '2', '-s', '"@e1"'].join(' ') + '\n', ).actions; assert.deepEqual(parsed[0]?.positionals, []); @@ -186,6 +183,14 @@ test('snapshot replay script parses full refresh flags', () => { assert.equal(parsed[0]?.flags.snapshotScope, '@e1'); }); +test('snapshot unknown tokens do not consume subsequent flags', () => { + for (const token of ['--backend', '-c', '--unknown']) { + const [action] = parseReplayScriptDetailed(`snapshot ${token} --raw\n`).actions; + assert.deepEqual(action?.positionals, []); + assert.deepEqual(action?.flags, { snapshotRaw: true }); + } +}); + test('snapshot replay script writes interactive refresh flags', () => { const actions: SessionAction[] = [ { diff --git a/packages/ad-script/src/internal/script.ts b/packages/ad-script/src/internal/script.ts index 11b500c20d..af1a83048c 100644 --- a/packages/ad-script/src/internal/script.ts +++ b/packages/ad-script/src/internal/script.ts @@ -287,9 +287,6 @@ function parseReplayScriptLine(line: string): SessionAction | null { action.flags.snapshotInteractiveOnly = true; continue; } - if (token === '-c') { - continue; - } if (token === '--raw') { action.flags.snapshotRaw = true; continue; @@ -311,11 +308,6 @@ function parseReplayScriptLine(line: string): SessionAction | null { index += 1; continue; } - if (token === '--backend' && index + 1 < args.length) { - // Backward compatibility: ignore legacy snapshot backend token. - index += 1; - continue; - } } return action; } diff --git a/scripts/size-report-package.d.mts b/scripts/size-report-package.d.mts index 9b50cdc744..f50456b320 100644 --- a/scripts/size-report-package.d.mts +++ b/scripts/size-report-package.d.mts @@ -2,6 +2,7 @@ // it is not in the typechecked program). TypeScript resolves this file when a checked module // imports `./size-report-package.mjs`; keep it in step with the exports there. export type NpmPackEntry = Readonly<{ path: string; size: number }>; +export function assertSnapshotBridgeAssets(presentPaths: Iterable, context: string): void; export function assertBundledLicenseNotices( entries: readonly NpmPackEntry[], options?: Readonly<{ noticesRoot?: string; context?: string }>, diff --git a/src/daemon-provider-rental-restart.fixtures.ts b/src/daemon-provider-rental-restart.fixtures.ts index a44ba3ee56..f2bad3fc05 100644 --- a/src/daemon-provider-rental-restart.fixtures.ts +++ b/src/daemon-provider-rental-restart.fixtures.ts @@ -1,7 +1,7 @@ import fs from 'node:fs'; import path from 'node:path'; import { startDaemonRuntime } from '@agent-device/daemon'; -import { captureHostEnvironment } from '@agent-device/host-kit/process'; +import { captureHostEnvironment } from '@agent-device/host-kit/environment'; import { createDaemonRuntimeDeps } from './daemon-composition.ts'; export const rentalRestartFixturePath = new URL(import.meta.url); diff --git a/src/daemon-provider-rental-restart.test.ts b/src/daemon-provider-rental-restart.test.ts index e1e2fa2fb7..e8be8743be 100644 --- a/src/daemon-provider-rental-restart.test.ts +++ b/src/daemon-provider-rental-restart.test.ts @@ -5,7 +5,7 @@ import net from 'node:net'; import path from 'node:path'; import type { DaemonResponse } from '@agent-device/kernel/contracts'; import { startDaemonRuntime } from '@agent-device/daemon'; -import { captureHostEnvironment } from '@agent-device/host-kit/process'; +import { captureHostEnvironment } from '@agent-device/host-kit/environment'; import { mkdtempForTestSync, selectPlugin } from '@agent-device/test-kit'; import { createDaemonRuntimeDeps } from './daemon-composition.ts'; import { expect, test, vi } from 'vitest'; diff --git a/test/repo-guards/macos-helper-package-contents.test.ts b/test/repo-guards/macos-helper-package-contents.test.ts index 12007479d5..96c9d66425 100644 --- a/test/repo-guards/macos-helper-package-contents.test.ts +++ b/test/repo-guards/macos-helper-package-contents.test.ts @@ -10,6 +10,7 @@ import { macosHelperPackFailures, readMacosHelperTestTargets, } from '../../scripts/lib/macos-helper-pack.mjs'; +import { assertSnapshotBridgeAssets } from '../../scripts/size-report-package.mjs'; // The `@agent-device/macos` package ships `macos-helper` and builds it on the user's machine. Its // manifest declares the test targets, and `files` ships only each target's PackStub.swift: SwiftPM @@ -80,9 +81,15 @@ test('the macOS plugin pack is a buildable helper package with one PackStub.swif ); }); -test('the core pack carries no macOS helper', () => { +test('the core pack retains bridge assets and ships only the root README', () => { + const paths = packedPaths(repoRoot); + assertSnapshotBridgeAssets(paths, 'Core pack snapshot bridge'); assert.deepEqual( - packedPaths(repoRoot).filter((entryPath) => /(?:^|\/)macos-helper(?:\/|$)/.test(entryPath)), + paths.filter((entryPath) => /^readme(?:\.|$)/i.test(path.posix.basename(entryPath))), + ['README.md'], + ); + assert.deepEqual( + paths.filter((entryPath) => /(?:^|\/)macos-helper(?:\/|$)/.test(entryPath)), [], ); });