MCPcopy Create free account
hub / github.com/Kilo-Org/cloud / topologicalSort

Function topologicalSort

dev/local/services.ts:631–679  ·  view source on GitHub ↗
(serviceNames: string[])

Source from the content-addressed store, hash-verified

629
630// The export warehouse is a separate database on the same local Postgres. Create it
631// with `createdb data_export` and load it from the schema repo. There is no
632// per-source fallback: without this database the first warehouse read throws and
633// export generation fails after its retries, rather than partially succeeding.
634export function localDataExportUrl(): string {
635 return `postgres://postgres:postgres@localhost:${INFRA_PORTS.postgres + portOffset}/data_export`;
636}
637
638// Docker Compose profile that gates each infra service, if any. Services not
639// listed here are part of the default profile and start with a plain `up -d`.
640const INFRA_PROFILES: Record<string, string> = { grafana: 'grafana' };
641
642export function getInfraProfile(serviceName: string): string | undefined {
643 return INFRA_PROFILES[serviceName];
644}
645
646export function getAllInfraProfiles(): string[] {
647 return [...new Set(Object.values(INFRA_PROFILES))];
648}
649
650// Wrangler's amd64 egress proxy crashes under Apple Silicon emulation. Pin its
651// arm64 manifest; keep aligned with the pinned Wrangler/Miniflare proxy version.
652const CONTAINER_EGRESS_IMAGE_ARM64 =
653 'cloudflare/proxy-everything:3cb1195@sha256:78c7910f4575a511d928d7824b1cbcaec6b7c4bf4dbb3fafaeeae3104030e73c';
654
655// Env prefix for every worker command. Wrangler reads the Hyperdrive variable
656// instead of the committed `localConnectionString`, which points at the default
657// port; without it an offset worktree's workers talk to the primary database.
658function workerEnvPrefix(): string[] {
659 const vars: string[] = [];
660 if (process.arch === 'arm64') {
661 vars.push(`MINIFLARE_CONTAINER_EGRESS_IMAGE=${CONTAINER_EGRESS_IMAGE_ARM64}`);
662 }
663 if (portOffset > 0) {
664 vars.push(`CLOUDFLARE_HYPERDRIVE_LOCAL_CONNECTION_STRING_HYPERDRIVE=${localPostgresUrl()}`);
665 vars.push(
666 `CLOUDFLARE_HYPERDRIVE_LOCAL_CONNECTION_STRING_PRIMARY_STATE_DB=${localPostgresUrl()}`,
667 `CLOUDFLARE_HYPERDRIVE_LOCAL_CONNECTION_STRING_EXPORT_WAREHOUSE_DB=${localDataExportUrl()}`
668 );
669 }
670 return vars.length > 0 ? ['env', ...vars] : [];
671}
672
673// Clear of the 3000-3009 range the web app's dev script probes.
674const AI_GATEWAY_BASE_PORT = 3010;
675
676function aiGatewayPort(): number {
677 return AI_GATEWAY_BASE_PORT + portOffset;
678}
679
680function buildServiceDefs(): ServiceDef[] {
681 const repoRoot = REPO_ROOT;
682 const defs: ServiceDef[] = [];

Callers 3

cmdUpFunction · 0.90
resolveTargetsFunction · 0.85
resolveGroupsFunction · 0.85

Calls 4

hasMethod · 0.80
pushMethod · 0.80
setMethod · 0.65
getMethod · 0.65

Tested by

no test coverage detected