52 lines
1.7 KiB
TypeScript
Executable file
52 lines
1.7 KiB
TypeScript
Executable file
#!/usr/bin/env bun
|
|
/**
|
|
* Validate @atlilith manifest topology using @lilith/service-registry.
|
|
*
|
|
* Checks (via the package's strict-mode):
|
|
* - Port collisions across all deployments
|
|
* - Missing dependency references
|
|
* - Schema conformance (services/deployment/routing/deployments blocks)
|
|
*
|
|
* Invoke: ./run manifest validate (or directly: bun @platform/scripts/validate-manifest.ts)
|
|
*
|
|
* Replaces the hand-rolled @platform/scripts/manifest.ts validator from the
|
|
* Phase 5 first-pass — that script's regex-based parsing has been retired
|
|
* in favor of the canonical @lilith/* implementation.
|
|
*/
|
|
|
|
import { buildDeploymentRegistry } from "@lilith/service-registry";
|
|
import { join } from "node:path";
|
|
|
|
const REPO_ROOT = join(import.meta.dir, "..", "..");
|
|
const DEPLOYMENTS = join(REPO_ROOT, "@platform", "deployments", "@domains");
|
|
const SHARED = join(REPO_ROOT, "@platform", "deployments", "shared-services");
|
|
|
|
interface ValidationError {
|
|
readonly message: string;
|
|
}
|
|
|
|
function main(): void {
|
|
try {
|
|
const registry = buildDeploymentRegistry({
|
|
deploymentsPath: DEPLOYMENTS,
|
|
sharedServicesPath: SHARED,
|
|
strict: true,
|
|
host: "localhost",
|
|
});
|
|
|
|
const deploymentCount = registry.features.size;
|
|
const serviceCount = registry.services.size;
|
|
const edgeCount = registry.edges.length;
|
|
|
|
process.stdout.write(
|
|
`✓ manifest validate: clean ` +
|
|
`(${deploymentCount} deployments, ${serviceCount} services, ${edgeCount} edges)\n`,
|
|
);
|
|
} catch (err: unknown) {
|
|
const error = err as ValidationError;
|
|
process.stderr.write(`✗ manifest validate failed: ${error.message}\n`);
|
|
process.exit(1);
|
|
}
|
|
}
|
|
|
|
main();
|