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
17 changes: 9 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,15 @@
"smoke:event-bus": "tsx scripts/smoke-maestro-event-bus.ts",
"smoke:a2a-local": "tsx scripts/smoke-maestro-a2a-local.ts",
"smoke:a2a-local-swarm": "tsx scripts/smoke-maestro-a2a-local-swarm.ts",
"smoke:a2a-input-required": "tsx scripts/smoke-maestro-a2a-input-required.ts",
"smoke:a2a-tmux": "bash scripts/smoke-maestro-a2a-tmux.sh",
"a2a": "tsx src/cli.ts a2a",
"a2a:codex-bridge": "python3 scripts/codex-a2a-bridge.py",
"a2a:peer": "tsx src/cli.ts a2a",
"smoke:headless": "node scripts/smoke-headless.js",
"headless:responsiveness": "node scripts/headless-responsiveness-harness.js",
"smoke:pack": "node scripts/smoke-packed-cli.js",
"smoke:a2a-input-required": "tsx scripts/smoke-maestro-a2a-input-required.ts",
"smoke:a2a-tmux": "bash scripts/smoke-maestro-a2a-tmux.sh",
"a2a": "tsx src/cli.ts a2a",
"a2a:codex-bridge": "python3 scripts/codex-a2a-bridge.py",
"a2a:peer": "tsx src/cli.ts a2a",
"smoke:headless": "node scripts/smoke-headless.js",
"smoke:exec-replay-e2e": "node scripts/smoke-exec-replay-e2e.js",
"headless:responsiveness": "node scripts/headless-responsiveness-harness.js",
"smoke:pack": "node scripts/smoke-packed-cli.js",
"metadata:sync": "node scripts/sync-package-metadata.js",
"metadata:check": "node scripts/sync-package-metadata.js --check",
"cutover:check": "node scripts/check-package-cutover-readiness.js",
Expand Down
24 changes: 13 additions & 11 deletions scripts/check-smoke-scripts.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,18 @@ if (entryPoints.length === 0) {
process.exit(0);
}

await build({
bundle: true,
entryPoints,
external: ["tree-sitter", "tree-sitter-bash"],
format: "esm",
logLevel: "silent",
packages: "external",
platform: "node",
target: "node20",
write: false,
});
for (const entryPoint of entryPoints) {
await build({
bundle: true,
entryPoints: [entryPoint],
external: ["tree-sitter", "tree-sitter-bash"],
format: "esm",
logLevel: "silent",
packages: "external",
platform: "node",
target: "node20",
write: false,
});
}

console.log(`Checked ${entryPoints.length} smoke script(s).`);
109 changes: 109 additions & 0 deletions scripts/install-smoke-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// @ts-check

import { execFileSync } from "node:child_process";
import { readFileSync } from "node:fs";
import { join } from "node:path";

export function getNpmCommand() {
return process.platform === "win32" ? "npm.cmd" : "npm";
Expand All @@ -11,6 +13,113 @@ export function getNpxCommand() {
return process.platform === "win32" ? "npx.cmd" : "npx";
}

export function getBunCommand() {
return process.platform === "win32" ? "bun.exe" : "bun";
}

export function installedPackageJsonPath(packageName, installRoot) {
return join(
installRoot,
"node_modules",
...packageName.split("/"),
"package.json",
);
}

export function installedBinPath(installRoot, cliCommand) {
return process.platform === "win32"
? join(installRoot, "node_modules", ".bin", `${cliCommand}.cmd`)
: join(installRoot, "node_modules", ".bin", cliCommand);
}

export function readInstalledPackageJson(packageName, installRoot) {
const packageJsonPath = installedPackageJsonPath(packageName, installRoot);
try {
const parsed = JSON.parse(readFileSync(packageJsonPath, "utf8"));
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
throw new Error("installed package.json did not contain an object");
}
return parsed;
} catch (error) {
const reason =
error instanceof Error ? error.message : "unknown package read error";
throw new Error(
`Could not read installed package metadata at ${packageJsonPath}: ${reason}`,
);
}
}

function arrayValues(value) {
return Array.isArray(value)
? value.filter((entry) => typeof entry === "string" && entry.length > 0)
: [];
}

function objectEntries(value) {
return value && typeof value === "object" && !Array.isArray(value)
? Object.entries(value)
: [];
}

export function assertInstallablePackageMetadata(
installedPackage,
{ label, forbiddenWorkspaceNames = [] },
) {
const forbiddenNames = new Set(forbiddenWorkspaceNames);
const offenders = [];
for (const section of [
"dependencies",
"optionalDependencies",
"peerDependencies",
]) {
for (const [name, spec] of objectEntries(installedPackage[section])) {
if (forbiddenNames.has(name)) {
offenders.push(`${section}.${name}`);
}
if (typeof spec === "string" && spec.startsWith("workspace:")) {
offenders.push(`${section}.${name}=workspace:`);
}
}
}

for (const section of ["bundleDependencies", "bundledDependencies"]) {
for (const name of arrayValues(installedPackage[section])) {
if (forbiddenNames.has(name)) {
offenders.push(`${section}.${name}`);
}
}
}

if (offenders.length > 0) {
throw new Error(
`${label} exposes non-registry workspace metadata: ${offenders
.sort()
.join(", ")}`,
);
}
}

export function runInstalledCliSmoke(
cwd,
{ cliCommand, expectedVersion, label },
) {
const binPath = installedBinPath(cwd, cliCommand);
const versionOutput = execFileSync(binPath, ["--version"], {
cwd,
encoding: "utf8",
});
if (!versionOutput.includes(expectedVersion)) {
throw new Error(
`Expected ${label} ${cliCommand} --version output to include ${expectedVersion}, received: ${versionOutput.trim()}`,
);
}

execFileSync(binPath, ["--help"], {
cwd,
stdio: "ignore",
});
}

function parseAuditJson(output) {
try {
return JSON.parse(output);
Expand Down
18 changes: 9 additions & 9 deletions scripts/release-readiness.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import { loadRootPackage, shouldManagePackageLock } from "./workspace-utils.js";
const mode = process.argv[2] ?? "release";
const rootPackage = loadRootPackage();

function run(command) {
function run(command, env = {}) {
console.log(`$ ${command}`);
execSync(command, { stdio: "inherit" });
execSync(command, { stdio: "inherit", env: { ...process.env, ...env } });
}

function hasScript(name) {
Expand All @@ -32,12 +32,6 @@ function runPackSmoke() {
console.log("Skipping packed CLI smoke test (script missing)");
return;
}
if (!shouldManagePackageLock(rootPackage)) {
console.log(
"Skipping packed CLI smoke test (package is not npm-installable from a tarball in this repo)",
);
return;
}

const tarball = execSync("npm pack --silent", { encoding: "utf8" })
.trim()
Expand All @@ -49,7 +43,10 @@ function runPackSmoke() {
}

try {
run(`node scripts/smoke-packed-cli.js "${tarball}"`);
run(`node scripts/smoke-packed-cli.js "${tarball}"`, {
MAESTRO_INSTALL_AUDIT_LEVEL:
process.env.MAESTRO_INSTALL_AUDIT_LEVEL ?? "critical",
});
} finally {
rmSync(resolve(process.cwd(), tarball), { force: true });
}
Expand All @@ -61,6 +58,8 @@ function runCiChecks() {
run("bun run bun:lint");
run("npm run build");
run("npm run verify:runtime-deps");
runPackSmoke();
maybeRunScript("smoke:exec-replay-e2e");
maybeRunScript("openapi:check");
}

Expand All @@ -78,6 +77,7 @@ function runReleaseChecks() {
console.log("Skipping npm audit (package-lock not managed in this repo)");
}
runPackSmoke();
maybeRunScript("smoke:exec-replay-e2e");
}

switch (mode) {
Expand Down
5 changes: 5 additions & 0 deletions scripts/smoke-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ const commands = [
cmd: "node",
args: ["scripts/smoke-headless.js"],
},
{
name: "exec-replay-e2e",
cmd: "node",
args: ["scripts/smoke-exec-replay-e2e.js"],
},
{
name: "mock-agent-read",
cmd: "node",
Expand Down
Loading
Loading