Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .fallowrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 1 addition & 2 deletions packages/maestro/package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
{
"name": "@agent-device/maestro",
"version": "0.0.0",
"version": "0.22.0-dev",
"engines": {
"node": ">=22.12"
},
"agent-device": {
"apiVersion": 3,
"replayBackend": "maestro"
},
"private": true,
"license": "MIT",
"repository": {
"type": "git",
Expand Down
1 change: 0 additions & 1 deletion packages/platform-harmonyos/package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
1 change: 0 additions & 1 deletion packages/platform-linux/package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
1 change: 0 additions & 1 deletion packages/platform-vega/package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
1 change: 0 additions & 1 deletion packages/platform-web/package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
9 changes: 7 additions & 2 deletions packages/replay/package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
{
"name": "@agent-device/replay",
"version": "0.0.0",
"version": "0.22.0-dev",
"engines": {
"node": ">=22.12"
},
"agent-device": {
"apiVersion": 3,
"replayExecution": true
},
"private": true,
"sideEffects": false,
"type": "module",
"description": "Optional native .ad replay and test-suite execution plugin for agent-device.",
Expand Down Expand Up @@ -40,5 +39,11 @@
}
},
"access": "public"
},
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/callstack/agent-device.git",
"directory": "packages/replay"
}
}
41 changes: 41 additions & 0 deletions scripts/release-install-hints.ts
Original file line number Diff line number Diff line change
@@ -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 <package>` 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<ReplayFormat, true> = { 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`);
25 changes: 25 additions & 0 deletions scripts/release-workspace.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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/<name>` 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;
Expand Down
13 changes: 13 additions & 0 deletions src/commands/provider-plugin-catalog.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import assert from 'node:assert/strict';
import { test } from 'vitest';
import {
getProviderPluginDeclaration,
providerPluginDeclarations,
providerPluginHelp,
providerPluginInstallCommand,
} from './provider-plugin-catalog.ts';
Expand Down Expand Up @@ -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');
Expand Down
5 changes: 5 additions & 0 deletions src/commands/provider-plugin-catalog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Loading