@solid-stack/builder 1.1.2 → 1.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/dist/bin.js +229 -153
  2. package/dist/bin.js.map +1 -1
  3. package/dist/commands/mesh/commands/up/command.d.ts.map +1 -1
  4. package/dist/commands/service/commands/up/command.d.ts.map +1 -1
  5. package/dist/commands/service/commands/up/handler.d.ts.map +1 -1
  6. package/dist/core/RunOptions.d.ts +3 -2
  7. package/dist/core/RunOptions.d.ts.map +1 -1
  8. package/dist/core/buildSchema.d.ts +8 -0
  9. package/dist/core/buildSchema.d.ts.map +1 -1
  10. package/dist/core/compileEnvironment.d.ts +3 -1
  11. package/dist/core/compileEnvironment.d.ts.map +1 -1
  12. package/dist/core/mesh/MeshRunOptions.d.ts +1 -0
  13. package/dist/core/mesh/MeshRunOptions.d.ts.map +1 -1
  14. package/dist/core/mesh/checkers/checkMeshJson.d.ts.map +1 -1
  15. package/dist/core/mesh/compileMeshEnvironment.d.ts +1 -0
  16. package/dist/core/mesh/compileMeshEnvironment.d.ts.map +1 -1
  17. package/dist/core/mesh/runners/runMeshDev.d.ts.map +1 -1
  18. package/dist/core/mesh/runners/runMeshProd.d.ts.map +1 -1
  19. package/dist/core/mesh/runners/runMeshTest.d.ts.map +1 -1
  20. package/dist/core/mesh/runners/runMeshTestE2e.d.ts.map +1 -1
  21. package/dist/core/runners/runDev.d.ts.map +1 -1
  22. package/dist/core/runners/runProd.d.ts.map +1 -1
  23. package/dist/core/runners/runTestE2e.d.ts.map +1 -1
  24. package/dist/core/runners/runTestUnit.d.ts.map +1 -1
  25. package/dist/index.js +231 -154
  26. package/dist/index.js.map +1 -1
  27. package/dist/templates/docker/docker-compose.e2e.yml +2 -2
  28. package/dist/types/index.d.ts +3 -0
  29. package/dist/types/index.d.ts.map +1 -1
  30. package/dist/utils/extractBuildDeps.d.ts.map +1 -1
  31. package/package.json +1 -1
  32. package/schemas/build-schema.json +7 -0
  33. package/templates/docker/docker-compose.e2e.yml +2 -2
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Command } from 'commander';
2
- import pc20 from 'picocolors';
2
+ import pc22 from 'picocolors';
3
3
  import fs, { existsSync, readFileSync, unlinkSync, mkdirSync, writeFileSync, statSync } from 'fs';
4
4
  import path13 from 'path';
5
5
  import { spawnSync, spawn } from 'child_process';
@@ -159,7 +159,7 @@ function runStep(executable, args, projectDir, ctx) {
159
159
  if (stderr) process.stderr.write(stderr);
160
160
  if (result.error || result.status !== 0) {
161
161
  console.error("\n" + "=".repeat(60));
162
- console.error(pc20.red(`\u{1F6A8} INFRASTRUCTURE CHECK FAILED \u{1F6A8}`));
162
+ console.error(pc22.red(`\u{1F6A8} INFRASTRUCTURE CHECK FAILED \u{1F6A8}`));
163
163
  console.error("=".repeat(60));
164
164
  console.error(`Failed Step : ${ctx.stepName}`);
165
165
  if (ctx.targetFile) {
@@ -197,12 +197,12 @@ function checkDockerfile(buildJson, projectDir) {
197
197
  );
198
198
  }
199
199
  console.log(
200
- pc20.yellow(`\u26A0\uFE0F No ${dockerfileRel} found in project directory. Skipping Dockerfile checks.`)
200
+ pc22.yellow(`\u26A0\uFE0F No ${dockerfileRel} found in project directory. Skipping Dockerfile checks.`)
201
201
  );
202
202
  return;
203
203
  }
204
204
  const content = readFileSync(dockerfilePath, "utf-8");
205
- console.log(pc20.cyan(`
205
+ console.log(pc22.cyan(`
206
206
  \u{1F50D} Linting Dockerfile (${dockerfileRel})...`));
207
207
  runStep(
208
208
  "docker",
@@ -225,7 +225,7 @@ function checkDockerfileContract(buildJson, projectDir) {
225
225
  if (!existsSync(dockerfilePath) || !existsSync(policyDir)) {
226
226
  return;
227
227
  }
228
- console.log(pc20.cyan(`
228
+ console.log(pc22.cyan(`
229
229
  \u{1F50D} Validating Dockerfile Contract (${policyRel})...`));
230
230
  runStep(
231
231
  "docker",
@@ -293,7 +293,7 @@ function checkYamlFiles(buildJson, projectDir) {
293
293
  return;
294
294
  }
295
295
  console.log(
296
- pc20.cyan(
296
+ pc22.cyan(
297
297
  `
298
298
  \u{1F50D} Validating Declared YAML Files (${declaredFiles.length} file${declaredFiles.length === 1 ? "" : "s"})...`
299
299
  )
@@ -350,7 +350,7 @@ function checkComposeContract(buildJson, projectDir) {
350
350
  }
351
351
  }
352
352
  const relativePaths = existingFiles.map((f) => f.relativePath);
353
- console.log(pc20.cyan(`
353
+ console.log(pc22.cyan(`
354
354
  \u{1F50D} Validating Compose Contract (${policyRel})...`));
355
355
  runStep(
356
356
  "docker",
@@ -386,7 +386,7 @@ function checkInfra(projectDir = process.cwd()) {
386
386
  checkDockerfileContract(buildJson, absProjectDir);
387
387
  checkYamlFiles(buildJson, absProjectDir);
388
388
  checkComposeContract(buildJson, absProjectDir);
389
- console.log(pc20.green("\n\u2705 All infrastructure and contract checks passed.\n"));
389
+ console.log(pc22.green("\n\u2705 All infrastructure and contract checks passed.\n"));
390
390
  }
391
391
  function checkDependencies() {
392
392
  const composeCheck = spawnSync(
@@ -428,7 +428,7 @@ function checkDependencies() {
428
428
  const count = (networkCheck.stdout || "").trim().split("\n").filter(Boolean).length;
429
429
  if (count > 25) {
430
430
  console.warn(
431
- pc20.yellow(
431
+ pc22.yellow(
432
432
  `
433
433
  \u26A0\uFE0F High Docker Network Count Warning: Detected ${count} networks. Docker's default address pool can become exhausted, resulting in "could not find an available, non-overlapping IPv4 address pool" errors.
434
434
  To resolve, run "builder prune" or "docker network prune -f", or configure default-address-pools in /etc/docker/daemon.json.
@@ -535,20 +535,6 @@ function checkMeshJson(mesh) {
535
535
  }
536
536
  const services = result.data.services;
537
537
  const serviceKeys = new Set(Object.keys(services));
538
- const seenPorts = /* @__PURE__ */ new Map();
539
- for (const [serviceName, serviceConfig] of Object.entries(services)) {
540
- if (serviceConfig.port) {
541
- const portNum = Number(serviceConfig.port);
542
- if (!isNaN(portNum)) {
543
- if (seenPorts.has(portNum)) {
544
- throw new ScriptError(
545
- `Host port collision in mesh.json: Port ${portNum} is declared by both "${seenPorts.get(portNum)}" and "${serviceName}".`
546
- );
547
- }
548
- seenPorts.set(portNum, serviceName);
549
- }
550
- }
551
- }
552
538
  const graph = /* @__PURE__ */ new Map();
553
539
  for (const sName of serviceKeys) {
554
540
  graph.set(sName, /* @__PURE__ */ new Set());
@@ -629,8 +615,8 @@ function checkMeshServices(mesh, meshDir = process.cwd()) {
629
615
  const absMeshDir = resolveProjectDir(meshDir);
630
616
  const serviceNames = Object.keys(mesh.services);
631
617
  console.log(
632
- pc20.bold(
633
- pc20.cyan(
618
+ pc22.bold(
619
+ pc22.cyan(
634
620
  `
635
621
  \u{1F50D} Checking Mesh Services (${serviceNames.length} service${serviceNames.length === 1 ? "" : "s"})...`
636
622
  )
@@ -664,7 +650,7 @@ function checkMeshServices(mesh, meshDir = process.cwd()) {
664
650
  );
665
651
  }
666
652
  console.log(
667
- pc20.bold(pc20.blue(`
653
+ pc22.bold(pc22.blue(`
668
654
  --- Validating Infrastructure for [${serviceName}] ---`))
669
655
  );
670
656
  checkInfra(serviceDir);
@@ -698,7 +684,7 @@ function checkMeshTester(mesh, meshDir = process.cwd(), options = {}) {
698
684
  );
699
685
  }
700
686
  console.log(
701
- pc20.bold(pc20.cyan(`
687
+ pc22.bold(pc22.cyan(`
702
688
  \u{1F50D} Checking E2E Tester (${testerConfig.path})...`))
703
689
  );
704
690
  const composeRel = testerConfig.compose || "docker-compose.yml";
@@ -728,7 +714,7 @@ function checkMeshTester(mesh, meshDir = process.cwd(), options = {}) {
728
714
  );
729
715
  }
730
716
  const dockerfileContent = readFileSync(dockerfilePath, "utf-8");
731
- console.log(pc20.cyan(`
717
+ console.log(pc22.cyan(`
732
718
  \u{1F50D} Linting E2E Tester Dockerfile (${dockerfileRel})...`));
733
719
  runStep(
734
720
  "docker",
@@ -744,7 +730,7 @@ function checkMeshTester(mesh, meshDir = process.cwd(), options = {}) {
744
730
  const dockerfilePolicyDir = path13.resolve(absTesterDir, dockerfilePolicyRel);
745
731
  if (existsSync(dockerfilePolicyDir)) {
746
732
  console.log(
747
- pc20.cyan(
733
+ pc22.cyan(
748
734
  `
749
735
  \u{1F50D} Validating Tester Dockerfile Contract (${dockerfilePolicyRel})...`
750
736
  )
@@ -774,7 +760,7 @@ function checkMeshTester(mesh, meshDir = process.cwd(), options = {}) {
774
760
  const composePolicyDir = path13.resolve(absTesterDir, composePolicyRel);
775
761
  if (existsSync(composePolicyDir)) {
776
762
  console.log(
777
- pc20.cyan(`
763
+ pc22.cyan(`
778
764
  \u{1F50D} Validating Tester Compose Contract (${composePolicyRel})...`)
779
765
  );
780
766
  runStep(
@@ -799,7 +785,7 @@ function checkMeshTester(mesh, meshDir = process.cwd(), options = {}) {
799
785
  { stepName: "E2E Tester Compose Contract", targetFile: composeRel }
800
786
  );
801
787
  }
802
- console.log(pc20.green(`\u2705 E2E tester configuration and contracts verified.
788
+ console.log(pc22.green(`\u2705 E2E tester configuration and contracts verified.
803
789
  `));
804
790
  }
805
791
 
@@ -810,8 +796,8 @@ function checkMesh(meshDir = process.cwd(), options = {}) {
810
796
  checkMeshServices(mesh, absMeshDir);
811
797
  checkMeshTester(mesh, absMeshDir, { required: Boolean(options.requireTester) });
812
798
  console.log(
813
- pc20.bold(
814
- pc20.green("\n\u{1F389} All mesh infrastructure, services, and contract checks passed!\n")
799
+ pc22.bold(
800
+ pc22.green("\n\u{1F389} All mesh infrastructure, services, and contract checks passed!\n")
815
801
  )
816
802
  );
817
803
  }
@@ -862,7 +848,8 @@ var extractBuildDeps = (buildJson, projectDir = process.cwd()) => {
862
848
  z.string(),
863
849
  z.object({
864
850
  path: z.string(),
865
- service: z.string().optional()
851
+ service: z.string().optional(),
852
+ port: z.union([z.number(), z.string()]).optional()
866
853
  })
867
854
  )
868
855
  });
@@ -879,7 +866,8 @@ var extractBuildDeps = (buildJson, projectDir = process.cwd()) => {
879
866
  return {
880
867
  path: path13.resolve(projectDir, service.path),
881
868
  name,
882
- serviceName: service.service
869
+ serviceName: service.service,
870
+ port: service.port
883
871
  };
884
872
  }
885
873
  );
@@ -1152,24 +1140,44 @@ function compileMeshEnvironment(mode, rawMeshDir = process.cwd(), options = {})
1152
1140
  const globalDepAliasToProvider = /* @__PURE__ */ new Map();
1153
1141
  const INTERNAL_PORT = 3e3;
1154
1142
  const serviceUrls = /* @__PURE__ */ new Map();
1143
+ const allocatedPorts = /* @__PURE__ */ new Map();
1144
+ function claimPort(portVal, ownerDesc) {
1145
+ if (!portVal) return;
1146
+ const portStr = String(portVal);
1147
+ const hostPort = portStr.includes(":") ? portStr.split(":")[0] : portStr;
1148
+ if (!hostPort) return;
1149
+ if (allocatedPorts.has(hostPort)) {
1150
+ throw new ScriptError(
1151
+ `\u274C Port Collision Detected: Host port ${hostPort} is requested by both [${allocatedPorts.get(hostPort)}] and [${ownerDesc}].`
1152
+ );
1153
+ }
1154
+ allocatedPorts.set(hostPort, ownerDesc);
1155
+ }
1155
1156
  for (const [serviceName, serviceConfig] of Object.entries(mesh.services)) {
1156
1157
  const serviceDir = path13.resolve(meshDir, serviceConfig.path);
1157
1158
  const serviceBuildJson = getBuildJson(serviceDir);
1159
+ const serviceDeps = extractBuildDeps(serviceBuildJson, serviceDir);
1158
1160
  let publicPort = null;
1159
1161
  if (serviceConfig.port !== void 0 && serviceConfig.port !== null && serviceConfig.port !== "") {
1160
- const p = Number(serviceConfig.port);
1161
- if (!isNaN(p) && p > 0) {
1162
- publicPort = p;
1163
- }
1162
+ publicPort = serviceConfig.port;
1163
+ claimPort(publicPort, `mesh service "${serviceName}"`);
1164
1164
  } else if (serviceConfig.preservePort && serviceBuildJson.port) {
1165
- const p = Number(serviceBuildJson.port);
1166
- if (!isNaN(p) && p > 0) {
1167
- publicPort = p;
1165
+ publicPort = serviceBuildJson.port;
1166
+ claimPort(publicPort, `mesh service "${serviceName}" (via preservePort)`);
1167
+ }
1168
+ const provideMap = {
1169
+ ...serviceConfig.replaceMocks || {},
1170
+ ...serviceConfig.provideDependency || {}
1171
+ };
1172
+ for (const dep of serviceDeps) {
1173
+ if (!provideMap[dep.name] && !(mesh.dependencies && mesh.dependencies[dep.name]) && dep.port) {
1174
+ claimPort(dep.port, `local dependency "${dep.name}" of service "${serviceName}"`);
1168
1175
  }
1169
1176
  }
1177
+ const hostPort = publicPort ? String(publicPort).includes(":") ? String(publicPort).split(":")[0] : String(publicPort) : null;
1170
1178
  serviceUrls.set(serviceName, {
1171
1179
  networkUrl: `http://${serviceName}:${INTERNAL_PORT}`,
1172
- publicUrl: publicPort ? `http://localhost:${publicPort}` : null
1180
+ publicUrl: hostPort ? `http://localhost:${hostPort}` : null
1173
1181
  });
1174
1182
  }
1175
1183
  function escapeRegExp(string) {
@@ -1179,6 +1187,13 @@ function compileMeshEnvironment(mode, rawMeshDir = process.cwd(), options = {})
1179
1187
  if (typeof value !== "string") {
1180
1188
  return value;
1181
1189
  }
1190
+ if (!options.silenceWarnings && context.includes("Tester") && value.includes(".network_url")) {
1191
+ console.warn(
1192
+ pc22.yellow(`
1193
+ \u26A0\uFE0F WARNING: You are passing a '.network_url' template to the E2E tester ("${value}"). Since the tester runs in 'network_mode: host', it cannot resolve internal Docker DNS. Use '.public_url' instead. (Mute with --silence-warnings)
1194
+ `)
1195
+ );
1196
+ }
1182
1197
  let interpolated = value;
1183
1198
  for (const [sName, urls] of serviceUrls.entries()) {
1184
1199
  interpolated = interpolated.replace(
@@ -1446,6 +1461,10 @@ function compileMeshEnvironment(mode, rawMeshDir = process.cwd(), options = {})
1446
1461
  delete resolvedMock.container_name;
1447
1462
  normalizeDependsOn(resolvedMock);
1448
1463
  applyInternalMockDependsOnMapping(resolvedMock, sidecarMapping);
1464
+ if (dep.port) {
1465
+ const portMapping = String(dep.port).includes(":") ? String(dep.port) : `${dep.port}:3000`;
1466
+ resolvedMock.ports = [...resolvedMock.ports || [], portMapping];
1467
+ }
1449
1468
  resolvedMock.networks = {
1450
1469
  [`${serviceName}_net`]: {
1451
1470
  aliases: [depKey, namespacedDepKey]
@@ -1509,11 +1528,8 @@ function compileMeshEnvironment(mode, rawMeshDir = process.cwd(), options = {})
1509
1528
  );
1510
1529
  delete resolvedTester.container_name;
1511
1530
  normalizeDependsOn(resolvedTester);
1512
- resolvedTester.networks = {
1513
- mesh: {
1514
- aliases: [tKey, ...tKey === firstKey ? ["tester"] : []]
1515
- }
1516
- };
1531
+ resolvedTester.network_mode = "host";
1532
+ delete resolvedTester.networks;
1517
1533
  if (tKey === firstKey) {
1518
1534
  resolvedTester.depends_on = resolvedTester.depends_on || {};
1519
1535
  for (const sName of Object.keys(mesh.services)) {
@@ -1841,12 +1857,12 @@ async function teardownCompose(yamlConfig, projectDir, options = {}) {
1841
1857
  if (result.error) {
1842
1858
  if (!silent) {
1843
1859
  console.error(
1844
- pc20.red(`Failed to run docker compose down: ${result.error.message}`)
1860
+ pc22.red(`Failed to run docker compose down: ${result.error.message}`)
1845
1861
  );
1846
1862
  }
1847
1863
  } else if (result.status !== 0 && !silent) {
1848
1864
  console.error(
1849
- pc20.red(
1865
+ pc22.red(
1850
1866
  `Docker compose down exited with non-zero status code: ${result.status}`
1851
1867
  )
1852
1868
  );
@@ -1989,7 +2005,7 @@ async function handleMeshDown(rawStage = "dev", options = {}) {
1989
2005
  );
1990
2006
  }
1991
2007
  console.log(
1992
- pc20.cyan(`
2008
+ pc22.cyan(`
1993
2009
  \u{1F9F9} Stopping and tearing down global mesh environment [${stage}]...`)
1994
2010
  );
1995
2011
  if (options.debug) {
@@ -1998,7 +2014,7 @@ async function handleMeshDown(rawStage = "dev", options = {}) {
1998
2014
  const includeTester = stage === "test" || stage === "test-e2e";
1999
2015
  const { yaml } = compileMeshEnvironment(mode, meshDir, { includeTester });
2000
2016
  console.log(
2001
- pc20.yellow("\nFinal merged Mesh YAML configuration:\n"),
2017
+ pc22.yellow("\nFinal merged Mesh YAML configuration:\n"),
2002
2018
  redactYamlSecrets(yaml)
2003
2019
  );
2004
2020
  } catch {
@@ -2018,7 +2034,7 @@ async function handleMeshDown(rawStage = "dev", options = {}) {
2018
2034
  }
2019
2035
  clearRunState(meshDir);
2020
2036
  console.log(
2021
- pc20.green(`\u2705 Global mesh environment [${stage}] stopped and removed.
2037
+ pc22.green(`\u2705 Global mesh environment [${stage}] stopped and removed.
2022
2038
  `)
2023
2039
  );
2024
2040
  return 0;
@@ -2101,7 +2117,7 @@ async function checkHostPortCollisions(ports) {
2101
2117
  const inUse = await isPortInUse(port);
2102
2118
  if (inUse) {
2103
2119
  console.warn(
2104
- pc20.yellow(
2120
+ pc22.yellow(
2105
2121
  `
2106
2122
  \u26A0\uFE0F Host Port Conflict Warning: Port ${port} is already in use on the host (e.g. by another running stage or process). Docker Compose may fail to bind to this port.
2107
2123
  `
@@ -2167,22 +2183,24 @@ async function runCompose(args, yamlConfig, projectDir, options = {}) {
2167
2183
  // src/core/mesh/runners/runMeshDev.ts
2168
2184
  async function runMeshDev(options = {}) {
2169
2185
  const meshDir = resolveProjectDir(options.projectDir);
2170
- console.log(pc20.cyan(`
2186
+ console.log(pc22.cyan(`
2171
2187
  \u{1F680} Starting Global DEV Mesh Environment...`));
2172
2188
  if (!options.skipChecks) {
2173
2189
  checkMesh(meshDir, { requireTester: false });
2174
2190
  }
2175
- const { yaml } = compileMeshEnvironment("dev", meshDir);
2191
+ const { yaml } = compileMeshEnvironment("dev", meshDir, {
2192
+ silenceWarnings: options.silenceWarnings
2193
+ });
2176
2194
  const parsed = parse(yaml);
2177
2195
  const projectName = parsed?.name || "mesh-dev";
2178
2196
  if (options.debug) {
2179
2197
  console.log(
2180
- pc20.yellow("\nFinal merged Mesh Dev YAML configuration:\n"),
2198
+ pc22.yellow("\nFinal merged Mesh Dev YAML configuration:\n"),
2181
2199
  redactYamlSecrets(yaml)
2182
2200
  );
2183
2201
  }
2184
2202
  if (options.dryRun) {
2185
- console.log(pc20.green("Dry run complete. Compose was not started."));
2203
+ console.log(pc22.green("Dry run complete. Compose was not started."));
2186
2204
  return 0;
2187
2205
  }
2188
2206
  const hostPorts = extractHostPorts(yaml);
@@ -2211,22 +2229,24 @@ async function runMeshDev(options = {}) {
2211
2229
  }
2212
2230
  async function runMeshProd(options = {}) {
2213
2231
  const meshDir = resolveProjectDir(options.projectDir);
2214
- console.log(pc20.cyan(`
2232
+ console.log(pc22.cyan(`
2215
2233
  \u{1F3ED} Starting Global PROD Mesh Environment...`));
2216
2234
  if (!options.skipChecks) {
2217
2235
  checkMesh(meshDir, { requireTester: false });
2218
2236
  }
2219
- const { yaml } = compileMeshEnvironment("prod", meshDir);
2237
+ const { yaml } = compileMeshEnvironment("prod", meshDir, {
2238
+ silenceWarnings: options.silenceWarnings
2239
+ });
2220
2240
  const parsed = parse(yaml);
2221
2241
  const projectName = parsed?.name || "mesh-prod";
2222
2242
  if (options.debug) {
2223
2243
  console.log(
2224
- pc20.yellow("\nFinal merged Mesh Prod YAML configuration:\n"),
2244
+ pc22.yellow("\nFinal merged Mesh Prod YAML configuration:\n"),
2225
2245
  redactYamlSecrets(yaml)
2226
2246
  );
2227
2247
  }
2228
2248
  if (options.dryRun) {
2229
- console.log(pc20.green("Dry run complete. Compose was not started."));
2249
+ console.log(pc22.green("Dry run complete. Compose was not started."));
2230
2250
  return 0;
2231
2251
  }
2232
2252
  const hostPorts = extractHostPorts(yaml);
@@ -2554,7 +2574,7 @@ function getDockerComposeTemplate(filename) {
2554
2574
  }
2555
2575
 
2556
2576
  // src/core/compileEnvironment.ts
2557
- var compileEnvironment = (environment, projectDir = process.cwd()) => {
2577
+ var compileEnvironment = (environment, projectDir = process.cwd(), options = {}) => {
2558
2578
  const absProjectDir = resolveProjectDir(projectDir);
2559
2579
  const buildJson = getBuildJson(absProjectDir);
2560
2580
  const overrides = extractOverrides(buildJson, absProjectDir);
@@ -2637,6 +2657,7 @@ var compileEnvironment = (environment, projectDir = process.cwd()) => {
2637
2657
  case "e2e": {
2638
2658
  const prodPath = getDockerComposeTemplate("docker-compose.prod.yml");
2639
2659
  const e2ePath = getDockerComposeTemplate("docker-compose.e2e.yml");
2660
+ const standalonePath = getDockerComposeTemplate("docker-compose.standalone.yml");
2640
2661
  composeFlags.push("-f", prodPath);
2641
2662
  filesUsed.push(prodPath);
2642
2663
  if (overrides.prod) {
@@ -2649,6 +2670,8 @@ var compileEnvironment = (environment, projectDir = process.cwd()) => {
2649
2670
  filesUsed.push(dep.path);
2650
2671
  }
2651
2672
  }
2673
+ composeFlags.push("-f", standalonePath);
2674
+ filesUsed.push(standalonePath);
2652
2675
  composeFlags.push("-f", e2ePath);
2653
2676
  filesUsed.push(e2ePath);
2654
2677
  if (overrides.e2e) {
@@ -2707,12 +2730,21 @@ ${explanation}`);
2707
2730
  urlRegistry.set(buildJson.name, urlRegistry.get("app"));
2708
2731
  }
2709
2732
  for (const dep of dependencies) {
2733
+ const depPortStr = dep.port ? String(dep.port) : null;
2734
+ const depHostPort = depPortStr ? depPortStr.includes(":") ? depPortStr.split(":")[0] : depPortStr : null;
2710
2735
  urlRegistry.set(dep.name, {
2711
2736
  networkUrl: `http://${dep.name}:${INTERNAL_PORT}`,
2712
- publicUrl: null
2737
+ publicUrl: depHostPort ? `http://localhost:${depHostPort}` : null
2713
2738
  });
2714
2739
  }
2715
2740
  const interpolateEnv = (val, context) => {
2741
+ if (!options.silenceWarnings && context.includes("Tester") && val.includes(".network_url")) {
2742
+ console.warn(
2743
+ pc22.yellow(`
2744
+ \u26A0\uFE0F WARNING: You are passing a '.network_url' template to the E2E tester ("${val}"). Since the tester runs in 'network_mode: host', it cannot resolve internal Docker DNS. Use '.public_url' instead. (Mute with --silence-warnings)
2745
+ `)
2746
+ );
2747
+ }
2716
2748
  let output = val;
2717
2749
  for (const [sName, urls] of urlRegistry.entries()) {
2718
2750
  const escaped = sName.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
@@ -2729,9 +2761,20 @@ ${explanation}`);
2729
2761
  }
2730
2762
  const unresolvedMatch = output.match(/\$\{([^}]+?)\.(network_url|public_url)\}/);
2731
2763
  if (unresolvedMatch) {
2732
- throw new ScriptError(
2733
- `[${context}] Unresolved template variable: ${unresolvedMatch[0]}. Check build.json dependencies.`
2734
- );
2764
+ const variable = unresolvedMatch[0];
2765
+ const targetService = unresolvedMatch[1];
2766
+ const type = unresolvedMatch[2];
2767
+ if (!urlRegistry.has(targetService)) {
2768
+ throw new ScriptError(
2769
+ `[${context}] Unresolved template variable: ${variable}. Check build.json dependencies.`
2770
+ );
2771
+ } else if (type === "public_url") {
2772
+ throw new ScriptError(
2773
+ `[${context}] Unresolved template variable: ${variable}. Service "${targetService}" does not expose a public port (missing 'port' explicitly defined in build.json).`
2774
+ );
2775
+ } else {
2776
+ throw new ScriptError(`[${context}] Unresolved template variable: ${variable}.`);
2777
+ }
2735
2778
  }
2736
2779
  return output;
2737
2780
  };
@@ -2765,6 +2808,20 @@ ${explanation}`);
2765
2808
  yml.services.tester.environment[k] = interpolateEnv(v, "Tester EnvOverrides");
2766
2809
  }
2767
2810
  }
2811
+ if (yml.services) {
2812
+ for (const dep of dependencies) {
2813
+ if (dep.port) {
2814
+ let targetSvc = dep.serviceName && yml.services[dep.serviceName] ? dep.serviceName : dep.name;
2815
+ if (!yml.services[targetSvc]) {
2816
+ targetSvc = Object.keys(yml.services).find((k) => k !== "app" && k !== "tester") || targetSvc;
2817
+ }
2818
+ if (yml.services[targetSvc]) {
2819
+ const portMapping = String(dep.port).includes(":") ? String(dep.port) : `${dep.port}:3000`;
2820
+ yml.services[targetSvc].ports = [...yml.services[targetSvc].ports || [], portMapping];
2821
+ }
2822
+ }
2823
+ }
2824
+ }
2768
2825
  attachName(yml, projectName);
2769
2826
  const finalYamlConfig = stringify(yml);
2770
2827
  return finalYamlConfig;
@@ -2773,23 +2830,25 @@ ${explanation}`);
2773
2830
  // src/core/runners/runTestUnit.ts
2774
2831
  var runTestUnit = async (options) => {
2775
2832
  if (!options.skipBanner) {
2776
- console.log(pc20.bold(pc20.blue(`
2833
+ console.log(pc22.bold(pc22.blue(`
2777
2834
  ========================================`)));
2778
- console.log(pc20.bold(pc20.blue(`\u{1F9EA} STAGE: UNIT & ISOLATED TESTS`)));
2779
- console.log(pc20.bold(pc20.blue(`========================================
2835
+ console.log(pc22.bold(pc22.blue(`\u{1F9EA} STAGE: UNIT & ISOLATED TESTS`)));
2836
+ console.log(pc22.bold(pc22.blue(`========================================
2780
2837
  `)));
2781
2838
  }
2782
- const finalYamlConfig = compileEnvironment("test", options.projectDir);
2839
+ const finalYamlConfig = compileEnvironment("test", options.projectDir, {
2840
+ silenceWarnings: options.silenceWarnings
2841
+ });
2783
2842
  const parsed = parse(finalYamlConfig);
2784
2843
  const projectName = parsed?.name || "test";
2785
2844
  if (options.debug) {
2786
2845
  console.log(
2787
- pc20.yellow("Final merged YAML configuration:\n"),
2846
+ pc22.yellow("Final merged YAML configuration:\n"),
2788
2847
  redactYamlSecrets(finalYamlConfig)
2789
2848
  );
2790
2849
  }
2791
2850
  if (options.dryRun) {
2792
- console.log(pc20.green("[DRY-RUN] Unit tests simulated. Compose was not started."));
2851
+ console.log(pc22.green("[DRY-RUN] Unit tests simulated. Compose was not started."));
2793
2852
  return 0;
2794
2853
  }
2795
2854
  await teardownCompose(finalYamlConfig, options.projectDir, {
@@ -2814,11 +2873,11 @@ var runTestUnit = async (options) => {
2814
2873
  clearRunState(options.projectDir);
2815
2874
  }
2816
2875
  if (status === 0) {
2817
- console.log(pc20.bold(pc20.green(`
2876
+ console.log(pc22.bold(pc22.green(`
2818
2877
  \u2705 Unit tests passed successfully.
2819
2878
  `)));
2820
2879
  } else {
2821
- console.error(pc20.red(`
2880
+ console.error(pc22.red(`
2822
2881
  \u274C Unit tests failed with exit code ${status}.
2823
2882
  `));
2824
2883
  }
@@ -2826,23 +2885,25 @@ var runTestUnit = async (options) => {
2826
2885
  };
2827
2886
  var runTestE2e = async (options) => {
2828
2887
  if (!options.skipBanner) {
2829
- console.log(pc20.bold(pc20.blue(`
2888
+ console.log(pc22.bold(pc22.blue(`
2830
2889
  ========================================`)));
2831
- console.log(pc20.bold(pc20.blue(`\u{1F6A6} STAGE: INTEGRATED E2E TESTS`)));
2832
- console.log(pc20.bold(pc20.blue(`========================================
2890
+ console.log(pc22.bold(pc22.blue(`\u{1F6A6} STAGE: INTEGRATED E2E TESTS`)));
2891
+ console.log(pc22.bold(pc22.blue(`========================================
2833
2892
  `)));
2834
2893
  }
2835
- const finalYamlConfig = compileEnvironment("e2e", options.projectDir);
2894
+ const finalYamlConfig = compileEnvironment("e2e", options.projectDir, {
2895
+ silenceWarnings: options.silenceWarnings
2896
+ });
2836
2897
  const parsed = parse(finalYamlConfig);
2837
2898
  const projectName = parsed?.name || "e2e";
2838
2899
  if (options.debug) {
2839
2900
  console.log(
2840
- pc20.yellow("Final merged YAML configuration:\n"),
2901
+ pc22.yellow("Final merged YAML configuration:\n"),
2841
2902
  redactYamlSecrets(finalYamlConfig)
2842
2903
  );
2843
2904
  }
2844
2905
  if (options.dryRun) {
2845
- console.log(pc20.green("[DRY-RUN] E2E tests simulated. Compose was not started."));
2906
+ console.log(pc22.green("[DRY-RUN] E2E tests simulated. Compose was not started."));
2846
2907
  return 0;
2847
2908
  }
2848
2909
  await teardownCompose(finalYamlConfig, options.projectDir, {
@@ -2873,11 +2934,11 @@ var runTestE2e = async (options) => {
2873
2934
  clearRunState(options.projectDir);
2874
2935
  }
2875
2936
  if (status === 0) {
2876
- console.log(pc20.bold(pc20.green(`
2937
+ console.log(pc22.bold(pc22.green(`
2877
2938
  \u2705 E2E tests passed successfully.
2878
2939
  `)));
2879
2940
  } else {
2880
- console.error(pc20.red(`
2941
+ console.error(pc22.red(`
2881
2942
  \u274C E2E tests failed with exit code ${status}.
2882
2943
  `));
2883
2944
  }
@@ -2886,15 +2947,15 @@ var runTestE2e = async (options) => {
2886
2947
 
2887
2948
  // src/core/runners/runTest.ts
2888
2949
  var runTest = async (options) => {
2889
- console.log(pc20.bold(pc20.blue(`
2950
+ console.log(pc22.bold(pc22.blue(`
2890
2951
  ========================================`)));
2891
- console.log(pc20.bold(pc20.blue(`\u{1F9EA} [1/2] STAGE: UNIT & ISOLATED TESTS`)));
2892
- console.log(pc20.bold(pc20.blue(`========================================
2952
+ console.log(pc22.bold(pc22.blue(`\u{1F9EA} [1/2] STAGE: UNIT & ISOLATED TESTS`)));
2953
+ console.log(pc22.bold(pc22.blue(`========================================
2893
2954
  `)));
2894
2955
  const unitStatus = await runTestUnit({ ...options, skipBanner: true });
2895
2956
  if (unitStatus !== 0) {
2896
2957
  console.error(
2897
- pc20.red(
2958
+ pc22.red(
2898
2959
  `
2899
2960
  \u274C [1/2] Unit tests failed with exit code ${unitStatus}. Aborting E2E tests.
2900
2961
  `
@@ -2903,29 +2964,29 @@ var runTest = async (options) => {
2903
2964
  return unitStatus;
2904
2965
  }
2905
2966
  console.log(
2906
- pc20.bold(pc20.green(`
2967
+ pc22.bold(pc22.green(`
2907
2968
  \u2705 [1/2] Unit tests passed successfully.
2908
2969
  `))
2909
2970
  );
2910
- console.log(pc20.bold(pc20.blue(`========================================`)));
2911
- console.log(pc20.bold(pc20.blue(`\u{1F6A6} [2/2] STAGE: INTEGRATED E2E TESTS`)));
2912
- console.log(pc20.bold(pc20.blue(`========================================
2971
+ console.log(pc22.bold(pc22.blue(`========================================`)));
2972
+ console.log(pc22.bold(pc22.blue(`\u{1F6A6} [2/2] STAGE: INTEGRATED E2E TESTS`)));
2973
+ console.log(pc22.bold(pc22.blue(`========================================
2913
2974
  `)));
2914
2975
  const e2eStatus = await runTestE2e({ ...options, skipBanner: true });
2915
2976
  if (e2eStatus !== 0) {
2916
2977
  console.error(
2917
- pc20.red(`
2978
+ pc22.red(`
2918
2979
  \u274C [2/2] E2E tests failed with exit code ${e2eStatus}.
2919
2980
  `)
2920
2981
  );
2921
2982
  return e2eStatus;
2922
2983
  }
2923
- console.log(pc20.bold(pc20.green(`
2984
+ console.log(pc22.bold(pc22.green(`
2924
2985
  \u2705 [2/2] E2E tests passed successfully.
2925
2986
  `)));
2926
2987
  console.log(
2927
- pc20.bold(
2928
- pc20.green(`\u{1F389} All test stages (unit + e2e) completed successfully!
2988
+ pc22.bold(
2989
+ pc22.green(`\u{1F389} All test stages (unit + e2e) completed successfully!
2929
2990
  `)
2930
2991
  )
2931
2992
  );
@@ -2933,16 +2994,17 @@ var runTest = async (options) => {
2933
2994
  };
2934
2995
  async function runMeshTestE2e(options = {}) {
2935
2996
  const meshDir = resolveProjectDir(options.projectDir);
2936
- console.log(pc20.bold(pc20.blue(`
2997
+ console.log(pc22.bold(pc22.blue(`
2937
2998
  ========================================`)));
2938
- console.log(pc20.bold(pc20.blue(`\u{1F6A6} [MESH] STAGE: GLOBAL INTEGRATED E2E TESTS`)));
2939
- console.log(pc20.bold(pc20.blue(`========================================
2999
+ console.log(pc22.bold(pc22.blue(`\u{1F6A6} [MESH] STAGE: GLOBAL INTEGRATED E2E TESTS`)));
3000
+ console.log(pc22.bold(pc22.blue(`========================================
2940
3001
  `)));
2941
3002
  if (!options.skipChecks) {
2942
3003
  checkMesh(meshDir, { requireTester: true });
2943
3004
  }
2944
3005
  const { yaml, testerServiceName } = compileMeshEnvironment("prod", meshDir, {
2945
- includeTester: true
3006
+ includeTester: true,
3007
+ silenceWarnings: options.silenceWarnings
2946
3008
  });
2947
3009
  if (!testerServiceName) {
2948
3010
  throw new ScriptError(
@@ -2951,12 +3013,12 @@ async function runMeshTestE2e(options = {}) {
2951
3013
  }
2952
3014
  if (options.debug) {
2953
3015
  console.log(
2954
- pc20.yellow("\nFinal merged Mesh E2E YAML configuration:\n"),
3016
+ pc22.yellow("\nFinal merged Mesh E2E YAML configuration:\n"),
2955
3017
  redactYamlSecrets(yaml)
2956
3018
  );
2957
3019
  }
2958
3020
  if (options.dryRun) {
2959
- console.log(pc20.green("[DRY-RUN] Global E2E test simulated. Compose was not started."));
3021
+ console.log(pc22.green("[DRY-RUN] Global E2E test simulated. Compose was not started."));
2960
3022
  return 0;
2961
3023
  }
2962
3024
  const parsed = parse(yaml);
@@ -2982,16 +3044,16 @@ async function runMeshTestE2e(options = {}) {
2982
3044
  { removeVolumes: true }
2983
3045
  );
2984
3046
  } finally {
2985
- console.log(pc20.cyan("\n\u{1F9F9} Cleaning up global mesh containers and volumes..."));
3047
+ console.log(pc22.cyan("\n\u{1F9F9} Cleaning up global mesh containers and volumes..."));
2986
3048
  await teardownCompose(yaml, meshDir, { removeVolumes: true });
2987
3049
  clearRunState(meshDir);
2988
3050
  }
2989
3051
  if (status === 0) {
2990
- console.log(pc20.bold(pc20.green(`
3052
+ console.log(pc22.bold(pc22.green(`
2991
3053
  \u2705 Global E2E tests passed successfully.
2992
3054
  `)));
2993
3055
  } else {
2994
- console.error(pc20.red(`
3056
+ console.error(pc22.red(`
2995
3057
  \u274C Global E2E tests failed with exit code ${status}.
2996
3058
  `));
2997
3059
  }
@@ -3001,44 +3063,45 @@ async function runMeshTestE2e(options = {}) {
3001
3063
  // src/core/mesh/runners/runMeshTest.ts
3002
3064
  async function runMeshTest(options = {}) {
3003
3065
  const meshDir = resolveProjectDir(options.projectDir);
3004
- console.log(pc20.bold(pc20.blue(`
3066
+ console.log(pc22.bold(pc22.blue(`
3005
3067
  ========================================`)));
3006
- console.log(pc20.bold(pc20.blue(`\u{1F9EA} GLOBAL MESH TEST PIPELINE`)));
3007
- console.log(pc20.bold(pc20.blue(`========================================
3068
+ console.log(pc22.bold(pc22.blue(`\u{1F9EA} GLOBAL MESH TEST PIPELINE`)));
3069
+ console.log(pc22.bold(pc22.blue(`========================================
3008
3070
  `)));
3009
3071
  if (!options.skipChecks) {
3010
3072
  checkMesh(meshDir, { requireTester: true });
3011
3073
  }
3012
3074
  const mesh = getMeshJson(meshDir);
3013
- console.log(pc20.bold(pc20.blue(`
3075
+ console.log(pc22.bold(pc22.blue(`
3014
3076
  ========================================`)));
3015
3077
  console.log(
3016
- pc20.bold(
3017
- pc20.blue(`\u{1F9EA} [1/2] STAGE: LOCAL SUBMODULE TEST SUITES (Unit & Isolated E2E)`)
3078
+ pc22.bold(
3079
+ pc22.blue(`\u{1F9EA} [1/2] STAGE: LOCAL SUBMODULE TEST SUITES (Unit & Isolated E2E)`)
3018
3080
  )
3019
3081
  );
3020
- console.log(pc20.bold(pc20.blue(`========================================
3082
+ console.log(pc22.bold(pc22.blue(`========================================
3021
3083
  `)));
3022
3084
  for (const [serviceName, serviceConfig] of Object.entries(mesh.services)) {
3023
3085
  const serviceDir = path13.resolve(meshDir, serviceConfig.path);
3024
3086
  console.log(
3025
- pc20.bold(pc20.cyan(`
3087
+ pc22.bold(pc22.cyan(`
3026
3088
  -> Running full test suite for [${serviceName}] in isolation...`))
3027
3089
  );
3028
3090
  if (options.dryRun) {
3029
3091
  console.log(
3030
- pc20.green(`[DRY-RUN] Full isolated tests for ${serviceName} simulated.`)
3092
+ pc22.green(`[DRY-RUN] Full isolated tests for ${serviceName} simulated.`)
3031
3093
  );
3032
3094
  continue;
3033
3095
  }
3034
3096
  const serviceStatus = await runTest({
3035
3097
  projectDir: serviceDir,
3036
3098
  debug: Boolean(options.debug),
3037
- detach: Boolean(options.detach)
3099
+ detach: Boolean(options.detach),
3100
+ silenceWarnings: options.silenceWarnings
3038
3101
  });
3039
3102
  if (serviceStatus !== 0) {
3040
3103
  console.error(
3041
- pc20.red(
3104
+ pc22.red(
3042
3105
  `
3043
3106
  \u274C Isolated tests failed for service [${serviceName}] with exit code ${serviceStatus}. Aborting global E2E tests.
3044
3107
  `
@@ -3047,27 +3110,27 @@ async function runMeshTest(options = {}) {
3047
3110
  return serviceStatus;
3048
3111
  }
3049
3112
  console.log(
3050
- pc20.bold(pc20.green(`
3113
+ pc22.bold(pc22.green(`
3051
3114
  \u2705 Isolated tests passed for service: [${serviceName}]
3052
3115
  `))
3053
3116
  );
3054
3117
  }
3055
- console.log(pc20.bold(pc20.blue(`
3118
+ console.log(pc22.bold(pc22.blue(`
3056
3119
  ========================================`)));
3057
3120
  console.log(
3058
- pc20.bold(
3059
- pc20.blue(`\u{1F6A6} [2/2] STAGE: INTEGRATED PRODUCTION MESH & GLOBAL E2E ASSERTIONS`)
3121
+ pc22.bold(
3122
+ pc22.blue(`\u{1F6A6} [2/2] STAGE: INTEGRATED PRODUCTION MESH & GLOBAL E2E ASSERTIONS`)
3060
3123
  )
3061
3124
  );
3062
- console.log(pc20.bold(pc20.blue(`========================================
3125
+ console.log(pc22.bold(pc22.blue(`========================================
3063
3126
  `)));
3064
3127
  const e2eStatus = await runMeshTestE2e({ ...options, skipChecks: true });
3065
3128
  if (e2eStatus !== 0) {
3066
3129
  return e2eStatus;
3067
3130
  }
3068
3131
  console.log(
3069
- pc20.bold(
3070
- pc20.green(`\u{1F389} Entire global mesh test pipeline (unit, local e2e, and global e2e) completed successfully!
3132
+ pc22.bold(
3133
+ pc22.green(`\u{1F389} Entire global mesh test pipeline (unit, local e2e, and global e2e) completed successfully!
3071
3134
  `)
3072
3135
  )
3073
3136
  );
@@ -3075,10 +3138,10 @@ async function runMeshTest(options = {}) {
3075
3138
  }
3076
3139
  async function runMeshTestUnit(options = {}) {
3077
3140
  const meshDir = resolveProjectDir(options.projectDir);
3078
- console.log(pc20.bold(pc20.blue(`
3141
+ console.log(pc22.bold(pc22.blue(`
3079
3142
  ========================================`)));
3080
- console.log(pc20.bold(pc20.blue(`\u{1F9EA} [MESH] STAGE: ISOLATED UNIT TESTS`)));
3081
- console.log(pc20.bold(pc20.blue(`========================================
3143
+ console.log(pc22.bold(pc22.blue(`\u{1F9EA} [MESH] STAGE: ISOLATED UNIT TESTS`)));
3144
+ console.log(pc22.bold(pc22.blue(`========================================
3082
3145
  `)));
3083
3146
  if (!options.skipChecks) {
3084
3147
  checkMesh(meshDir, { requireTester: false });
@@ -3087,11 +3150,11 @@ async function runMeshTestUnit(options = {}) {
3087
3150
  for (const [serviceName, serviceConfig] of Object.entries(mesh.services)) {
3088
3151
  const serviceDir = path13.resolve(meshDir, serviceConfig.path);
3089
3152
  console.log(
3090
- pc20.cyan(`
3153
+ pc22.cyan(`
3091
3154
  -> Running isolated unit tests for service: [${serviceName}]...`)
3092
3155
  );
3093
3156
  if (options.dryRun) {
3094
- console.log(pc20.green(`[DRY-RUN] Unit tests for ${serviceName} simulated.`));
3157
+ console.log(pc22.green(`[DRY-RUN] Unit tests for ${serviceName} simulated.`));
3095
3158
  continue;
3096
3159
  }
3097
3160
  const unitStatus = await runTestUnit({
@@ -3102,20 +3165,20 @@ async function runMeshTestUnit(options = {}) {
3102
3165
  });
3103
3166
  if (unitStatus !== 0) {
3104
3167
  console.error(
3105
- pc20.red(`
3168
+ pc22.red(`
3106
3169
  \u274C Unit tests failed for service [${serviceName}] with exit code ${unitStatus}.
3107
3170
  `)
3108
3171
  );
3109
3172
  return unitStatus;
3110
3173
  }
3111
3174
  console.log(
3112
- pc20.bold(pc20.green(`
3175
+ pc22.bold(pc22.green(`
3113
3176
  \u2705 Isolated unit tests passed for service: [${serviceName}]
3114
3177
  `))
3115
3178
  );
3116
3179
  }
3117
3180
  console.log(
3118
- pc20.bold(pc20.green(`\u{1F389} All mesh service unit tests completed successfully!
3181
+ pc22.bold(pc22.green(`\u{1F389} All mesh service unit tests completed successfully!
3119
3182
  `))
3120
3183
  );
3121
3184
  return 0;
@@ -3157,6 +3220,9 @@ var registerMeshUpCommand = (cmd) => {
3157
3220
  ).option(
3158
3221
  "--skip-checks",
3159
3222
  "Skip hadolint and conftest pre-flight checks"
3223
+ ).option(
3224
+ "--silence-warnings",
3225
+ "Silence non-critical warnings like URL templating hints"
3160
3226
  ).option(
3161
3227
  "-C, --project-dir <dir>",
3162
3228
  "Mesh project directory containing mesh.json (defaults to cwd)"
@@ -3176,7 +3242,8 @@ Examples:
3176
3242
  debug: options.debug,
3177
3243
  detach: options.detach,
3178
3244
  dryRun: options.dryRun,
3179
- skipChecks: options.skipChecks
3245
+ skipChecks: options.skipChecks,
3246
+ silenceWarnings: options.silenceWarnings
3180
3247
  });
3181
3248
  if (exitCode !== 0) {
3182
3249
  process.exit(exitCode);
@@ -3196,7 +3263,7 @@ var registerMeshCommand = (program) => {
3196
3263
  registerMeshCheckCommand(meshCmd);
3197
3264
  };
3198
3265
  async function handlePrune(options = {}) {
3199
- console.log(pc20.cyan("\n\u{1F9F9} Pruning stopped Compose containers and unused networks..."));
3266
+ console.log(pc22.cyan("\n\u{1F9F9} Pruning stopped Compose containers and unused networks..."));
3200
3267
  const rmContainers = spawnSync("docker", ["container", "prune", "-f"], {
3201
3268
  stdio: "inherit",
3202
3269
  encoding: "utf-8"
@@ -3216,13 +3283,13 @@ async function handlePrune(options = {}) {
3216
3283
  });
3217
3284
  }
3218
3285
  if (options.volumes) {
3219
- console.log(pc20.cyan("\u{1F9F9} Pruning dangling volumes..."));
3286
+ console.log(pc22.cyan("\u{1F9F9} Pruning dangling volumes..."));
3220
3287
  spawnSync("docker", ["volume", "prune", "-f"], {
3221
3288
  stdio: "inherit",
3222
3289
  encoding: "utf-8"
3223
3290
  });
3224
3291
  }
3225
- console.log(pc20.green("\u2705 Docker environment pruned successfully.\n"));
3292
+ console.log(pc22.green("\u2705 Docker environment pruned successfully.\n"));
3226
3293
  return 0;
3227
3294
  }
3228
3295
 
@@ -3247,7 +3314,7 @@ async function handleServiceDown(rawStage = "dev", options = {}) {
3247
3314
  );
3248
3315
  }
3249
3316
  console.log(
3250
- pc20.cyan(`
3317
+ pc22.cyan(`
3251
3318
  \u{1F9F9} Stopping and tearing down service environment [${stage}]...`)
3252
3319
  );
3253
3320
  if (options.debug) {
@@ -3258,7 +3325,7 @@ async function handleServiceDown(rawStage = "dev", options = {}) {
3258
3325
  else if (stage === "test-e2e") env = "e2e";
3259
3326
  const finalYamlConfig = compileEnvironment(env, projectDir);
3260
3327
  console.log(
3261
- pc20.yellow("Final merged YAML configuration:\n"),
3328
+ pc22.yellow("Final merged YAML configuration:\n"),
3262
3329
  redactYamlSecrets(finalYamlConfig)
3263
3330
  );
3264
3331
  } catch {
@@ -3278,7 +3345,7 @@ async function handleServiceDown(rawStage = "dev", options = {}) {
3278
3345
  }
3279
3346
  clearRunState(projectDir);
3280
3347
  console.log(
3281
- pc20.green(`\u2705 Service environment [${stage}] stopped and removed.
3348
+ pc22.green(`\u2705 Service environment [${stage}] stopped and removed.
3282
3349
  `)
3283
3350
  );
3284
3351
  return 0;
@@ -3316,18 +3383,20 @@ Examples:
3316
3383
  );
3317
3384
  };
3318
3385
  var runDev = async (options) => {
3319
- console.log(pc20.cyan(`\u{1F680} Starting DEV environment...`));
3320
- const finalYamlConfig = compileEnvironment("dev", options.projectDir);
3386
+ console.log(pc22.cyan(`\u{1F680} Starting DEV environment...`));
3387
+ const finalYamlConfig = compileEnvironment("dev", options.projectDir, {
3388
+ silenceWarnings: options.silenceWarnings
3389
+ });
3321
3390
  const parsed = parse(finalYamlConfig);
3322
3391
  const projectName = parsed?.name || "dev";
3323
3392
  if (options.debug) {
3324
3393
  console.log(
3325
- pc20.yellow("Final merged YAML configuration:\n"),
3394
+ pc22.yellow("Final merged YAML configuration:\n"),
3326
3395
  redactYamlSecrets(finalYamlConfig)
3327
3396
  );
3328
3397
  }
3329
3398
  if (options.dryRun) {
3330
- console.log(pc20.green("Dry run complete. Compose was not started."));
3399
+ console.log(pc22.green("Dry run complete. Compose was not started."));
3331
3400
  return 0;
3332
3401
  }
3333
3402
  const hostPorts = extractHostPorts(finalYamlConfig);
@@ -3357,18 +3426,20 @@ var runDev = async (options) => {
3357
3426
  return status;
3358
3427
  };
3359
3428
  var runProd = async (options) => {
3360
- console.log(pc20.cyan(`\u{1F3ED} Starting PROD environment...`));
3361
- const finalYamlConfig = compileEnvironment("prod", options.projectDir);
3429
+ console.log(pc22.cyan(`\u{1F3ED} Starting PROD environment...`));
3430
+ const finalYamlConfig = compileEnvironment("prod", options.projectDir, {
3431
+ silenceWarnings: options.silenceWarnings
3432
+ });
3362
3433
  const parsed = parse(finalYamlConfig);
3363
3434
  const projectName = parsed?.name || "prod";
3364
3435
  if (options.debug) {
3365
3436
  console.log(
3366
- pc20.yellow("Final merged YAML configuration:\n"),
3437
+ pc22.yellow("Final merged YAML configuration:\n"),
3367
3438
  redactYamlSecrets(finalYamlConfig)
3368
3439
  );
3369
3440
  }
3370
3441
  if (options.dryRun) {
3371
- console.log(pc20.green("Dry run complete. Compose was not started."));
3442
+ console.log(pc22.green("Dry run complete. Compose was not started."));
3372
3443
  return 0;
3373
3444
  }
3374
3445
  const hostPorts = extractHostPorts(finalYamlConfig);
@@ -3406,7 +3477,8 @@ async function handleServiceUp(rawStage, options = {}) {
3406
3477
  projectDir,
3407
3478
  debug: Boolean(options.debug),
3408
3479
  detach: Boolean(options.detach),
3409
- dryRun: Boolean(options.dryRun)
3480
+ dryRun: Boolean(options.dryRun),
3481
+ silenceWarnings: Boolean(options.silenceWarnings)
3410
3482
  };
3411
3483
  if (stage === "dev") {
3412
3484
  return await runDev(runOptions);
@@ -3438,6 +3510,9 @@ var registerUpCommand = (cmd) => {
3438
3510
  ).option(
3439
3511
  "--skip-checks",
3440
3512
  "Skip hadolint and conftest pre-flight checks"
3513
+ ).option(
3514
+ "--silence-warnings",
3515
+ "Silence non-critical warnings like URL templating hints"
3441
3516
  ).option(
3442
3517
  "-C, --project-dir <dir>",
3443
3518
  "Service project directory (defaults to cwd)"
@@ -3457,7 +3532,8 @@ Examples:
3457
3532
  debug: options.debug,
3458
3533
  detach: options.detach,
3459
3534
  dryRun: options.dryRun,
3460
- skipChecks: options.skipChecks
3535
+ skipChecks: options.skipChecks,
3536
+ silenceWarnings: options.silenceWarnings
3461
3537
  });
3462
3538
  if (exitCode !== 0) {
3463
3539
  process.exit(exitCode);
@@ -3510,10 +3586,10 @@ async function runCli(argv = process.argv) {
3510
3586
  (arg) => arg === "-h" || arg === "--help" || arg === "-V" || arg === "--version"
3511
3587
  );
3512
3588
  if (!isHelpOrVersion && argv.length > 2) {
3513
- console.log(pc20.dim(`builder v${version}`));
3589
+ console.log(pc22.dim(`builder v${version}`));
3514
3590
  }
3515
3591
  if (argv.length <= 2) {
3516
- console.log(pc20.dim(`builder v${version}
3592
+ console.log(pc22.dim(`builder v${version}
3517
3593
  `));
3518
3594
  cli.outputHelp();
3519
3595
  return;
@@ -3536,20 +3612,20 @@ async function runCli(argv = process.argv) {
3536
3612
  if (err instanceof ScriptError) {
3537
3613
  exitCode = err.exitCode;
3538
3614
  const formatted = err.message.startsWith("\u274C") ? err.message : `\u274C ${err.message}`;
3539
- console.error(pc20.red(`
3615
+ console.error(pc22.red(`
3540
3616
  ${formatted}
3541
3617
  `));
3542
3618
  if (isVerbose && err.stack) {
3543
- console.error(pc20.dim(err.stack));
3619
+ console.error(pc22.dim(err.stack));
3544
3620
  }
3545
3621
  } else {
3546
3622
  const message = errorMessage(err);
3547
3623
  const formatted = message.startsWith("\u274C") ? message : `\u274C Error: ${message}`;
3548
- console.error(pc20.red(`
3624
+ console.error(pc22.red(`
3549
3625
  ${formatted}
3550
3626
  `));
3551
3627
  if (isVerbose && err instanceof Error && err.stack) {
3552
- console.error(pc20.dim(err.stack));
3628
+ console.error(pc22.dim(err.stack));
3553
3629
  }
3554
3630
  }
3555
3631
  if (process.env.VITEST) {
@@ -3564,7 +3640,8 @@ var buildPolicyConfigSchema = z.object({
3564
3640
  }).strict().describe("Policy configurations for infra/contract verification");
3565
3641
  var buildDependencySchema = z.object({
3566
3642
  path: z.string({ required_error: 'Dependency "path" is required' }).describe("Relative path to mock Docker Compose file"),
3567
- service: z.string().optional().describe("Target service name in the mock compose file")
3643
+ service: z.string().optional().describe("Target service name in the mock compose file"),
3644
+ port: z.union([z.number(), z.string()]).optional().describe("Host port to map to this dependency locally")
3568
3645
  }).strict().describe("Service dependency specification");
3569
3646
  var buildOverrideSchema = z.object({
3570
3647
  path: z.string({ required_error: 'Override "path" is required' }).describe("Relative path to the environment stage override file")