diff --git a/.fallowrc.json b/.fallowrc.json index e9a979baa9..94413e7ce8 100644 --- a/.fallowrc.json +++ b/.fallowrc.json @@ -5,6 +5,9 @@ "tools/depgraph-view/app.js", "scripts/check-provider-plugin.mjs", "scripts/check-affected/command.ts", + // scripts/release-workspace.mjs runs it as a `node --experimental-strip-types` subprocess, + // which dependency analysis cannot follow from the exec's path string. + "scripts/release-install-hints.ts", "packages/provider-aws-device-farm/test/package-smoke.mjs", "packages/provider-browserstack/test/package-smoke.mjs", "packages/provider-browserstack/tsdown.config.ts", diff --git a/packages/maestro/package.json b/packages/maestro/package.json index 1f3c475658..f226d6ea59 100644 --- a/packages/maestro/package.json +++ b/packages/maestro/package.json @@ -1,6 +1,6 @@ { "name": "@agent-device/maestro", - "version": "0.0.0", + "version": "0.22.0-dev", "engines": { "node": ">=22.12" }, @@ -8,7 +8,6 @@ "apiVersion": 3, "replayBackend": "maestro" }, - "private": true, "license": "MIT", "repository": { "type": "git", diff --git a/packages/platform-harmonyos/package.json b/packages/platform-harmonyos/package.json index 7eb8b3bd1f..8ca3a24f03 100644 --- a/packages/platform-harmonyos/package.json +++ b/packages/platform-harmonyos/package.json @@ -1,7 +1,6 @@ { "name": "@agent-device/harmonyos", "version": "0.22.0-dev", - "private": true, "type": "module", "description": "Managed HarmonyOS platform plugin for agent-device.", "exports": { diff --git a/packages/platform-linux/package.json b/packages/platform-linux/package.json index e5fba6dc3d..513a970d31 100644 --- a/packages/platform-linux/package.json +++ b/packages/platform-linux/package.json @@ -1,7 +1,6 @@ { "name": "@agent-device/linux", "version": "0.22.0-dev", - "private": true, "type": "module", "description": "Managed Linux platform plugin for agent-device.", "exports": { diff --git a/packages/platform-vega/package.json b/packages/platform-vega/package.json index db04893236..df5fd298f1 100644 --- a/packages/platform-vega/package.json +++ b/packages/platform-vega/package.json @@ -1,7 +1,6 @@ { "name": "@agent-device/vega", "version": "0.22.0-dev", - "private": true, "type": "module", "description": "Managed Vega platform plugin for agent-device.", "exports": { diff --git a/packages/platform-web/package.json b/packages/platform-web/package.json index 51dd68a25a..2c0aebccf5 100644 --- a/packages/platform-web/package.json +++ b/packages/platform-web/package.json @@ -1,7 +1,6 @@ { "name": "@agent-device/web", "version": "0.22.0-dev", - "private": true, "type": "module", "description": "Managed web platform plugin for agent-device.", "exports": { diff --git a/packages/replay/package.json b/packages/replay/package.json index c5ce5db593..0e589310de 100644 --- a/packages/replay/package.json +++ b/packages/replay/package.json @@ -1,6 +1,6 @@ { "name": "@agent-device/replay", - "version": "0.0.0", + "version": "0.22.0-dev", "engines": { "node": ">=22.12" }, @@ -8,7 +8,6 @@ "apiVersion": 3, "replayExecution": true }, - "private": true, "sideEffects": false, "type": "module", "description": "Optional native .ad replay and test-suite execution plugin for agent-device.", @@ -40,5 +39,11 @@ } }, "access": "public" + }, + "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/callstack/agent-device.git", + "directory": "packages/replay" } } diff --git a/scripts/release-install-hints.ts b/scripts/release-install-hints.ts new file mode 100644 index 0000000000..4489bc0b60 --- /dev/null +++ b/scripts/release-install-hints.ts @@ -0,0 +1,41 @@ +/** + * Lists, one name per line, every plugin package the checked-out core tells a user to install. + * + * Core names a plugin package in three catalogs: the optional platform families ADR 0034 makes + * installable, the provider plugin catalog `connect` points at, and the replay format declarations. + * Each row becomes an `agent-device plugins add ` line in the shipped help and errors, so + * this reads the declarations those messages build from rather than a copy of them. + * `scripts/release-workspace.mjs` compares the result with the packages it packs, so a hint naming a + * package the release would not publish fails the release instead of shipping a dead command. + * + * Run from the repository root, where the workspace links resolve: + * node --experimental-strip-types scripts/release-install-hints.ts + */ +import { getReplayPluginInstallation, type ReplayFormat } from '@agent-device/ad-script'; +import { OPTIONAL_PLATFORMS } from '@agent-device/contracts/platform-module'; +import { getOptionalPlatformPluginDeclaration } from '@agent-device/contracts/plugin-installation'; +import { providerPluginDeclarations } from '../src/commands/provider-plugin-catalog.ts'; + +// Totals `ReplayFormat`, so TypeScript refuses a new replay format without an installation row — +// the same shape the optional-platform catalog enforces. +const replayFormats: Record = { ad: true, maestro: true }; + +function optionalPlatformPackages(): string[] { + return OPTIONAL_PLATFORMS.map((family) => { + const declaration = getOptionalPlatformPluginDeclaration(family); + if (!declaration) { + throw new Error(`Optional platform ${family} has no plugin installation declaration.`); + } + return declaration.package; + }); +} + +const hints = [ + ...optionalPlatformPackages(), + ...providerPluginDeclarations().map((declaration) => declaration.package), + ...(Object.keys(replayFormats) as ReplayFormat[]).map( + (id) => getReplayPluginInstallation(id).package, + ), +]; + +process.stdout.write(`${[...new Set(hints)].sort().join('\n')}\n`); diff --git a/scripts/release-workspace.mjs b/scripts/release-workspace.mjs index 23659ead61..aac537538b 100644 --- a/scripts/release-workspace.mjs +++ b/scripts/release-workspace.mjs @@ -35,9 +35,34 @@ if (command === 'sync') { ); } } + checkInstallHints(); packWorkspacePackages(); } +/** + * Fails when a plugin install hint the core prints names a package this release would not publish. + * Core's absence messages and help say `agent-device plugins add @agent-device/` for every + * family and provider moved out of it (#4866), so a hint whose package stays `"private": true` + * ships a command that cannot resolve. `release-install-hints.ts` reads the hint catalogs from + * source; this compares them with the manifests the pack step below turns into tarballs. + */ +function checkInstallHints() { + const hints = execFileSync( + process.execPath, + ['--experimental-strip-types', path.join(root, 'scripts', 'release-install-hints.ts')], + { cwd: root, encoding: 'utf8' }, + ) + .split('\n') + .filter(Boolean); + const publishedNames = new Set(publicPackages.map((pkg) => pkg.manifest.name)); + const unpublished = hints.filter((name) => !publishedNames.has(name)); + if (unpublished.length > 0) { + throw new Error( + `Install hints name ${unpublished.join(', ')}, which this release does not publish. Remove "private": true from those packages before cutting a release.`, + ); + } +} + function syncVersions() { for (const pkg of publicPackages) { if (pkg.manifest.version === version) continue; diff --git a/src/commands/provider-plugin-catalog.test.ts b/src/commands/provider-plugin-catalog.test.ts index 30e5b36279..28612bd3be 100644 --- a/src/commands/provider-plugin-catalog.test.ts +++ b/src/commands/provider-plugin-catalog.test.ts @@ -2,6 +2,7 @@ import assert from 'node:assert/strict'; import { test } from 'vitest'; import { getProviderPluginDeclaration, + providerPluginDeclarations, providerPluginHelp, providerPluginInstallCommand, } from './provider-plugin-catalog.ts'; @@ -57,6 +58,18 @@ test('a plugin that ships every release ignores the channel of the core', () => } }); +test('the catalog exposes every row, so the release check sees every install hint', () => { + const declarations = providerPluginDeclarations(); + assert.deepEqual( + declarations.map((plugin) => plugin.package), + declarations.map((plugin) => `@agent-device/${plugin.provider}`), + ); + // The release install-hint check reads this list, so a lookup answers for every row it names. + for (const plugin of declarations) { + assert.equal(getProviderPluginDeclaration(plugin.provider), plugin); + } +}); + test('help gives nightly and stable users the same plugin selectors as recovery', () => { const nightly = providerPluginHelp(NIGHTLY_0_22); const stable = providerPluginHelp('0.22.0'); diff --git a/src/commands/provider-plugin-catalog.ts b/src/commands/provider-plugin-catalog.ts index 1be956f0a9..725ee80e12 100644 --- a/src/commands/provider-plugin-catalog.ts +++ b/src/commands/provider-plugin-catalog.ts @@ -35,6 +35,11 @@ const PROVIDER_PLUGIN_CATALOG: readonly ProviderPluginDeclaration[] = [ { provider: 'tizen', package: '@agent-device/tizen', label: 'Samsung Tizen' }, ]; +/** Every catalog row, so the release check can compare each row's package with what it publishes. */ +export function providerPluginDeclarations(): readonly ProviderPluginDeclaration[] { + return PROVIDER_PLUGIN_CATALOG; +} + export function getProviderPluginDeclaration( provider: string, ): ProviderPluginDeclaration | undefined {