47 lines
2.0 KiB
TypeScript
47 lines
2.0 KiB
TypeScript
import { readFileSync } from "node:fs";
|
|
|
|
function assertCondition(condition: unknown, message: string, detail: unknown = {}): void {
|
|
if (!condition) throw new Error(`${message}: ${JSON.stringify(detail)}`);
|
|
}
|
|
|
|
const artifactRegistrySource = readFileSync("scripts/src/artifact-registry.ts", "utf8");
|
|
const deploySource = readFileSync("scripts/src/deploy.ts", "utf8");
|
|
|
|
assertCondition(
|
|
artifactRegistrySource.includes('function isLocalProvider(providerId: string): boolean'),
|
|
"artifact-registry must define an explicit local provider predicate",
|
|
);
|
|
assertCondition(
|
|
artifactRegistrySource.includes('providerId === "local"') && artifactRegistrySource.includes('providerId === "D601-local"'),
|
|
"local provider predicate must accept only explicit local aliases",
|
|
);
|
|
assertCondition(
|
|
artifactRegistrySource.includes('runCommand(["bash", "-lc", script], repoRoot, { timeoutMs })'),
|
|
"local provider must execute the generated artifact script directly with bash -lc",
|
|
);
|
|
assertCondition(
|
|
artifactRegistrySource.includes('local bash -lc <artifact-registry-${action}-readonly-script>'),
|
|
"readonly command shape must disclose local execution instead of host.ssh",
|
|
);
|
|
assertCondition(
|
|
deploySource.includes('providerId: string;'),
|
|
"deploy options must carry providerId for artifact consumers",
|
|
);
|
|
assertCondition(
|
|
deploySource.includes('providerId: optionValue(args, ["--provider-id", "--provider"]) ?? "D601"'),
|
|
"deploy apply must parse provider-id with D601 as the default",
|
|
);
|
|
assertCondition(
|
|
deploySource.includes('"--provider-id", options.providerId'),
|
|
"deploy apply must forward provider-id to artifact-registry deploy-service",
|
|
);
|
|
|
|
process.stdout.write(`${JSON.stringify({
|
|
ok: true,
|
|
checks: [
|
|
"artifact-registry supports an explicit local/D601-local provider for D601 host CLI execution",
|
|
"local provider runs the same generated scripts through bash -lc without provider SSH self-dispatch",
|
|
"deploy apply forwards --provider-id to artifact-registry consumers while defaulting to D601",
|
|
],
|
|
}, null, 2)}\n`);
|