@mnci/cli 4.20.0 → 4.21.0

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.
package/dist/cli.js CHANGED
@@ -280,6 +280,10 @@ function runPack(workspaceRoot, dependencies = {}) {
280
280
  return status;
281
281
  }
282
282
 
283
+ // src/ci-pipeline/release.use-case.ts
284
+ var import_node_fs4 = require("fs");
285
+ var import_node_path4 = require("path");
286
+
283
287
  // src/workspace-overlay/overlay.use-case.ts
284
288
  var import_node_fs3 = require("fs");
285
289
  var import_node_path3 = require("path");
@@ -2278,6 +2282,180 @@ function applyOverlay(workspaceRoot, options, onProgress = () => {
2278
2282
  }
2279
2283
  }
2280
2284
 
2285
+ // src/ci-pipeline/release.use-case.ts
2286
+ var SPECIFIER = /^(?:major|minor|patch|\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?)$/;
2287
+ function hasTag(workspaceRoot, relativePath, tag) {
2288
+ try {
2289
+ const parsed = JSON.parse((0, import_node_fs4.readFileSync)((0, import_node_path4.join)(workspaceRoot, relativePath), "utf8"));
2290
+ const tags = relativePath.endsWith("project.json") ? parsed.tags : parsed.nx?.tags;
2291
+ return Array.isArray(tags) && tags.includes(tag);
2292
+ } catch {
2293
+ return false;
2294
+ }
2295
+ }
2296
+ function releasableCounts(workspaceRoot) {
2297
+ return {
2298
+ npm: (0, import_node_fs4.globSync)("packages/*/package.json", { cwd: workspaceRoot }).length,
2299
+ csharp: (0, import_node_fs4.globSync)("packages/*/*.csproj", { cwd: workspaceRoot }).length,
2300
+ python: (0, import_node_fs4.globSync)("python-packages/*/pyproject.toml", { cwd: workspaceRoot }).length,
2301
+ dart: (0, import_node_fs4.globSync)("packages/*/pubspec.yaml", { cwd: workspaceRoot }).length,
2302
+ vscode: (0, import_node_fs4.globSync)("apps/*/package.json", { cwd: workspaceRoot }).filter((path) => hasTag(workspaceRoot, path, VSCODE_EXTENSION_TAG)).length,
2303
+ go: (0, import_node_fs4.globSync)("apps/*/project.json", { cwd: workspaceRoot }).filter((path) => hasTag(workspaceRoot, path, GO_RELEASE_TAG)).length
2304
+ };
2305
+ }
2306
+ function shallowCloneGuard(processes, log) {
2307
+ const result = processes.capture("git", ["rev-parse", "--is-shallow-repository"]);
2308
+ if (result.status !== 0) {
2309
+ log("Could not determine whether this checkout has full history (git rev-parse --is-shallow-repository failed) - refusing to release. " + result.stdout.trim());
2310
+ return 1;
2311
+ }
2312
+ if (result.stdout.trim() === "true") {
2313
+ log("This checkout is a shallow clone. nx release resolves the current version of each package from its git tag, and silently falls back to the permanently-stale on-disk version when a tag cannot be found - which can propose, and publish, a version DOWNGRADE. Fetch full history before releasing - set fetchDepth (Azure) or fetch-depth (GitHub) to 0.");
2314
+ return 1;
2315
+ }
2316
+ return 0;
2317
+ }
2318
+ function npmPreflight(workspaceRoot, registryKind, environment, processes, log) {
2319
+ if (registryKind !== "npm" || (0, import_node_fs4.globSync)("packages/*/package.json", { cwd: workspaceRoot }).length === 0) {
2320
+ return 0;
2321
+ }
2322
+ if (!environment.NODE_AUTH_TOKEN) {
2323
+ log("NPM_TOKEN is empty or unset, so the publish would fail AFTER nx release has already tagged. Add it as a repository secret named exactly NPM_TOKEN - under Actions, not the Dependabot or Codespaces tab, and not an Environment secret. Use an npm Automation token - a Publish token is refused by 2FA in CI.");
2324
+ return 1;
2325
+ }
2326
+ const whoami = processes.capture("npm", ["whoami", "--registry=https://registry.npmjs.org/"]);
2327
+ if (whoami.status !== 0) {
2328
+ log("NPM_TOKEN is set but the registry rejected it - " + whoami.stdout.trim() + ". Check that it has not expired and that it grants publish rights on this scope.");
2329
+ return 1;
2330
+ }
2331
+ log("npm auth OK as " + whoami.stdout.trim());
2332
+ return 0;
2333
+ }
2334
+ async function pypiPreflight(workspaceRoot, registryKind, environment, log, fetchStatus) {
2335
+ const files = (0, import_node_fs4.globSync)("python-packages/*/pyproject.toml", { cwd: workspaceRoot });
2336
+ if (registryKind !== "npm" || files.length === 0) {
2337
+ return 0;
2338
+ }
2339
+ if (!environment.PYPI_TOKEN) {
2340
+ log("PYPI_TOKEN is empty or unset, so the publish would fail AFTER nx release has already tagged. Add it as a repository secret named exactly PYPI_TOKEN - under Actions, not the Dependabot or Codespaces tab, and not an Environment secret.");
2341
+ return 1;
2342
+ }
2343
+ if (!environment.PYPI_TOKEN.startsWith("pypi-")) {
2344
+ log("PYPI_TOKEN does not look like a PyPI API token - every one of them begins with pypi-. A password or a truncated paste is rejected only at upload time, which is AFTER nx release has tagged.");
2345
+ return 1;
2346
+ }
2347
+ const names = files.map((file) => {
2348
+ const text = (0, import_node_fs4.readFileSync)((0, import_node_path4.join)(workspaceRoot, file), "utf8");
2349
+ const block = text.slice(text.indexOf("[project]"));
2350
+ const line = block.split("\n").find((entry) => entry.trimStart().startsWith("name"));
2351
+ return line ? line.split("=", 2)[1].replaceAll(/[^\w.-]/gi, "") : "";
2352
+ }).filter(Boolean);
2353
+ const fresh = [];
2354
+ for (const name of names) {
2355
+ try {
2356
+ const status = await fetchStatus("https://pypi.org/pypi/" + name.toLowerCase().replaceAll(/[-_.]+/g, "-") + "/json");
2357
+ if (status === 404) {
2358
+ fresh.push(name);
2359
+ }
2360
+ } catch {
2361
+ log("Could not reach PyPI to check " + name + " - continuing.");
2362
+ }
2363
+ }
2364
+ if (fresh.length > 0) {
2365
+ log("NOTE - this release may CREATE " + fresh.length + " new PyPI project(s) - " + fresh.join(", ") + ". Project creation is rate limited per account, and a 429 there arrives AFTER nx release has tagged - leaving those versions tagged with nothing published, and skipped forever. If that happens, delete the tags for the versions that did not publish before releasing again.");
2366
+ }
2367
+ return 0;
2368
+ }
2369
+ function applyPublishCredentials(workspaceRoot, registry, counts, environment, log) {
2370
+ const pythonUrl = pythonPublishUrl(registry);
2371
+ const nugetUrl = nugetFeedUrl(registry);
2372
+ if (counts.python > 0) {
2373
+ if (pythonUrl !== void 0) {
2374
+ if (!environment.PAT) {
2375
+ log("This workspace has " + counts.python + " Python package(s) to publish to Azure Artifacts but PAT is empty. Add your base64-encoded Azure DevOps PAT as a secret named PAT, or remove the Python packages from release.projects.");
2376
+ return 1;
2377
+ }
2378
+ environment.TWINE_REPOSITORY_URL = pythonUrl;
2379
+ environment.TWINE_USERNAME = "AzureArtifacts";
2380
+ environment.TWINE_PASSWORD = Buffer.from(environment.PAT, "base64").toString();
2381
+ } else if (registry.kind === "npm") {
2382
+ environment.TWINE_USERNAME = "__token__";
2383
+ environment.TWINE_PASSWORD = environment.PYPI_TOKEN;
2384
+ environment.TWINE_NON_INTERACTIVE = "1";
2385
+ }
2386
+ }
2387
+ if (nugetUrl !== void 0 && counts.csharp > 0) {
2388
+ if (!environment.PAT) {
2389
+ log("This workspace has " + counts.csharp + " C# package(s) to publish to Azure Artifacts but PAT is empty. Add your base64-encoded Azure DevOps PAT as a secret named PAT, or remove the C# packages from release.projects.");
2390
+ return 1;
2391
+ }
2392
+ environment.NUGET_PAT = Buffer.from(environment.PAT, "base64").toString();
2393
+ }
2394
+ return 0;
2395
+ }
2396
+ function runReleaseCommand(workspaceRoot, registry, counts, environment, processes, log) {
2397
+ const total = counts.npm + counts.python + counts.csharp + counts.dart + counts.vscode + counts.go;
2398
+ if (total === 0) {
2399
+ log("Nothing to release - skipping.");
2400
+ return 0;
2401
+ }
2402
+ const specifier = environment.RELEASE_SPECIFIER ?? "";
2403
+ const extra = [];
2404
+ if (specifier !== "") {
2405
+ if (!SPECIFIER.test(specifier)) {
2406
+ log("RELEASE_SPECIFIER value '" + specifier + "' is invalid - use major, minor, patch, or an exact version like 1.2.3.");
2407
+ return 1;
2408
+ }
2409
+ if (/^(?:major|minor|patch)$/.test(specifier) && total > 1) {
2410
+ log("RELEASE_SPECIFIER is a keyword ('" + specifier + "') but this workspace has " + total + " releasable packages - a keyword under-bumps interdependent packages, because nx computes the dependency-bump pass from a stale cached version. Set RELEASE_SPECIFIER to an exact version instead, or clear it.");
2411
+ return 1;
2412
+ }
2413
+ extra.push(specifier);
2414
+ }
2415
+ const credentials = applyPublishCredentials(workspaceRoot, registry, counts, environment, log);
2416
+ if (credentials !== 0) {
2417
+ return credentials;
2418
+ }
2419
+ return processes.run("npx", ["nx", "release", ...extra, "--yes"]);
2420
+ }
2421
+ async function runRelease(workspaceRoot, dependencies = {}) {
2422
+ const environment = dependencies.environment ?? process.env;
2423
+ const processes = dependencies.processes ?? {
2424
+ run: (command, arguments_) => runShell(command, arguments_, workspaceRoot),
2425
+ capture: (command, arguments_) => runCapture(command, arguments_, workspaceRoot)
2426
+ };
2427
+ const log = dependencies.log ?? ((message) => {
2428
+ console.log(message);
2429
+ });
2430
+ const fetchStatus = dependencies.fetchStatus ?? (async (url) => {
2431
+ const response = await fetch(url, { signal: AbortSignal.timeout(1e4) });
2432
+ return response.status;
2433
+ });
2434
+ const host = detectCiHost(environment);
2435
+ const registry = readMnciConfig(workspaceRoot).registry ?? { kind: "npm" };
2436
+ log(groupStart(host, "Release"));
2437
+ const close = (status) => {
2438
+ const closing = groupEnd(host);
2439
+ if (closing !== void 0) {
2440
+ log(closing);
2441
+ }
2442
+ return status;
2443
+ };
2444
+ const shallow = shallowCloneGuard(processes, log);
2445
+ if (shallow !== 0) {
2446
+ return close(shallow);
2447
+ }
2448
+ const npm = npmPreflight(workspaceRoot, registry.kind, environment, processes, log);
2449
+ if (npm !== 0) {
2450
+ return close(npm);
2451
+ }
2452
+ const pypi = await pypiPreflight(workspaceRoot, registry.kind, environment, log, fetchStatus);
2453
+ if (pypi !== 0) {
2454
+ return close(pypi);
2455
+ }
2456
+ return close(runReleaseCommand(workspaceRoot, registry, releasableCounts(workspaceRoot), environment, processes, log));
2457
+ }
2458
+
2281
2459
  // src/ci-pipeline/verify.use-case.ts
2282
2460
  function runVerify(workspaceRoot, dependencies = {}) {
2283
2461
  const environment = dependencies.environment ?? process.env;
@@ -2329,7 +2507,7 @@ function runVerify(workspaceRoot, dependencies = {}) {
2329
2507
  }
2330
2508
 
2331
2509
  // src/ci-pipeline/index.ts
2332
- var CI_PHASES = ["verify", "pack"];
2510
+ var CI_PHASES = ["verify", "pack", "release"];
2333
2511
  function runCiPhase(phase, workspaceRoot, dependencies = {}) {
2334
2512
  switch (phase) {
2335
2513
  case "verify": {
@@ -2338,11 +2516,14 @@ function runCiPhase(phase, workspaceRoot, dependencies = {}) {
2338
2516
  case "pack": {
2339
2517
  return runPack(workspaceRoot, dependencies);
2340
2518
  }
2519
+ case "release": {
2520
+ return runRelease(workspaceRoot, dependencies);
2521
+ }
2341
2522
  }
2342
2523
  }
2343
2524
 
2344
2525
  // src/project-scaffolding/add-project.use-case.ts
2345
- var import_node_path24 = require("path");
2526
+ var import_node_path25 = require("path");
2346
2527
  var import_prompts3 = require("@inquirer/prompts");
2347
2528
 
2348
2529
  // src/project-name/project-name.validator.ts
@@ -2355,14 +2536,14 @@ function assertValidProjectName(name, label) {
2355
2536
  }
2356
2537
 
2357
2538
  // src/project-scaffolding/csharp.use-case.ts
2358
- var import_node_fs5 = require("fs");
2359
- var import_node_path5 = require("path");
2539
+ var import_node_fs6 = require("fs");
2540
+ var import_node_path6 = require("path");
2360
2541
 
2361
2542
  // src/project-scaffolding/post-generation.use-case.ts
2362
- var import_node_fs4 = require("fs");
2363
- var import_node_path4 = require("path");
2543
+ var import_node_fs5 = require("fs");
2544
+ var import_node_path5 = require("path");
2364
2545
  function hasPlugin(workspaceRoot, packageName) {
2365
- const manifest = readJson((0, import_node_path4.join)(workspaceRoot, "package.json"));
2546
+ const manifest = readJson((0, import_node_path5.join)(workspaceRoot, "package.json"));
2366
2547
  const installed = { ...manifest.dependencies, ...manifest.devDependencies };
2367
2548
  return Object.hasOwn(installed, packageName);
2368
2549
  }
@@ -2401,7 +2582,7 @@ function markPublic(manifestPath) {
2401
2582
  function writeProjectReadme(projectRoot, projectName, testRunner) {
2402
2583
  const runner = testRunner === "vitest" ? "[Vitest](https://vitest.dev)" : "[Jest](https://jestjs.io)";
2403
2584
  writeFileEnsured(
2404
- (0, import_node_path4.join)(projectRoot, "README.md"),
2585
+ (0, import_node_path5.join)(projectRoot, "README.md"),
2405
2586
  [
2406
2587
  `# ${projectName}`,
2407
2588
  "",
@@ -2420,13 +2601,13 @@ function writeProjectReadme(projectRoot, projectName, testRunner) {
2420
2601
  }
2421
2602
  function removeStaleGitkeeps(workspaceRoot) {
2422
2603
  for (const scaffold of ["apps", "libs", "packages"]) {
2423
- const directory = (0, import_node_path4.join)(workspaceRoot, scaffold);
2604
+ const directory = (0, import_node_path5.join)(workspaceRoot, scaffold);
2424
2605
  try {
2425
- const holdsAProject = (0, import_node_fs4.readdirSync)(directory, { withFileTypes: true }).some(
2606
+ const holdsAProject = (0, import_node_fs5.readdirSync)(directory, { withFileTypes: true }).some(
2426
2607
  (entry) => entry.isDirectory()
2427
2608
  );
2428
2609
  if (holdsAProject) {
2429
- (0, import_node_fs4.rmSync)((0, import_node_path4.join)(directory, ".gitkeep"), { force: true });
2610
+ (0, import_node_fs5.rmSync)((0, import_node_path5.join)(directory, ".gitkeep"), { force: true });
2430
2611
  }
2431
2612
  } catch {
2432
2613
  }
@@ -2446,7 +2627,7 @@ function ensureAdmZip(workspaceRoot) {
2446
2627
  }
2447
2628
  }
2448
2629
  function defaultScope(workspaceRoot) {
2449
- const { name } = readJson((0, import_node_path4.join)(workspaceRoot, "package.json"));
2630
+ const { name } = readJson((0, import_node_path5.join)(workspaceRoot, "package.json"));
2450
2631
  const base = (name.startsWith("@") ? name.slice(1) : name).split("/", 1)[0];
2451
2632
  return `@${base}`;
2452
2633
  }
@@ -2474,14 +2655,14 @@ var ESLINT_CONFIG_FILENAMES = [
2474
2655
  ];
2475
2656
  function removeGeneratedEslintConfig(workspaceRoot, projectRoot) {
2476
2657
  for (const filename of ESLINT_CONFIG_FILENAMES) {
2477
- (0, import_node_fs4.rmSync)((0, import_node_path4.join)(workspaceRoot, projectRoot, filename), { force: true });
2658
+ (0, import_node_fs5.rmSync)((0, import_node_path5.join)(workspaceRoot, projectRoot, filename), { force: true });
2478
2659
  }
2479
- (0, import_node_fs4.rmSync)((0, import_node_path4.join)(workspaceRoot, ".vscode"), { recursive: true, force: true });
2660
+ (0, import_node_fs5.rmSync)((0, import_node_path5.join)(workspaceRoot, ".vscode"), { recursive: true, force: true });
2480
2661
  }
2481
2662
  function findCodeWorkspaceFile(workspaceRoot) {
2482
2663
  try {
2483
- const entry = (0, import_node_fs4.readdirSync)(workspaceRoot).find((file) => file.endsWith(".code-workspace"));
2484
- return entry ? (0, import_node_path4.join)(workspaceRoot, entry) : void 0;
2664
+ const entry = (0, import_node_fs5.readdirSync)(workspaceRoot).find((file) => file.endsWith(".code-workspace"));
2665
+ return entry ? (0, import_node_path5.join)(workspaceRoot, entry) : void 0;
2485
2666
  } catch {
2486
2667
  return void 0;
2487
2668
  }
@@ -2492,42 +2673,42 @@ function projectTask(name, kind) {
2492
2673
  return kind === "start" ? { ...base, isBackground: true } : { ...base, group: kind };
2493
2674
  }
2494
2675
  function renameScaffoldPlaceholder(projectRoot, name) {
2495
- const sourceDir = (0, import_node_path4.join)(projectRoot, "src");
2496
- const placeholder = (0, import_node_path4.join)(sourceDir, "lib", `${name}.ts`);
2497
- if (!(0, import_node_fs4.existsSync)(placeholder)) {
2676
+ const sourceDir = (0, import_node_path5.join)(projectRoot, "src");
2677
+ const placeholder = (0, import_node_path5.join)(sourceDir, "lib", `${name}.ts`);
2678
+ if (!(0, import_node_fs5.existsSync)(placeholder)) {
2498
2679
  return;
2499
2680
  }
2500
- const sliceDir = (0, import_node_path4.join)(sourceDir, name);
2501
- (0, import_node_fs4.mkdirSync)(sliceDir, { recursive: true });
2502
- (0, import_node_fs4.renameSync)(placeholder, (0, import_node_path4.join)(sliceDir, `${name}.use-case.ts`));
2503
- const spec = (0, import_node_path4.join)(sourceDir, "lib", `${name}.spec.ts`);
2504
- if ((0, import_node_fs4.existsSync)(spec)) {
2505
- const renamed = (0, import_node_path4.join)(sliceDir, `${name}.use-case.spec.ts`);
2506
- (0, import_node_fs4.renameSync)(spec, renamed);
2681
+ const sliceDir = (0, import_node_path5.join)(sourceDir, name);
2682
+ (0, import_node_fs5.mkdirSync)(sliceDir, { recursive: true });
2683
+ (0, import_node_fs5.renameSync)(placeholder, (0, import_node_path5.join)(sliceDir, `${name}.use-case.ts`));
2684
+ const spec = (0, import_node_path5.join)(sourceDir, "lib", `${name}.spec.ts`);
2685
+ if ((0, import_node_fs5.existsSync)(spec)) {
2686
+ const renamed = (0, import_node_path5.join)(sliceDir, `${name}.use-case.spec.ts`);
2687
+ (0, import_node_fs5.renameSync)(spec, renamed);
2507
2688
  writeFileEnsured(
2508
2689
  renamed,
2509
2690
  // The spec still sits beside the implementation, so only its role suffix changes.
2510
- repointSpecifier((0, import_node_fs4.readFileSync)(renamed, "utf8"), `./${name}`, `./${name}.use-case`)
2691
+ repointSpecifier((0, import_node_fs5.readFileSync)(renamed, "utf8"), `./${name}`, `./${name}.use-case`)
2511
2692
  );
2512
2693
  }
2513
- const barrel = (0, import_node_path4.join)(sourceDir, "index.ts");
2514
- const esm = (0, import_node_fs4.existsSync)(barrel) && (0, import_node_fs4.readFileSync)(barrel, "utf8").includes(`./lib/${name}.js'`);
2515
- writeFileEnsured((0, import_node_path4.join)(sliceDir, "index.ts"), `export * from './${name}.use-case${esm ? ".js" : ""}'
2694
+ const barrel = (0, import_node_path5.join)(sourceDir, "index.ts");
2695
+ const esm = (0, import_node_fs5.existsSync)(barrel) && (0, import_node_fs5.readFileSync)(barrel, "utf8").includes(`./lib/${name}.js'`);
2696
+ writeFileEnsured((0, import_node_path5.join)(sliceDir, "index.ts"), `export * from './${name}.use-case${esm ? ".js" : ""}'
2516
2697
  `);
2517
- if ((0, import_node_fs4.existsSync)(barrel)) {
2698
+ if ((0, import_node_fs5.existsSync)(barrel)) {
2518
2699
  writeFileEnsured(
2519
2700
  barrel,
2520
- (0, import_node_fs4.readFileSync)(barrel, "utf8").replaceAll(`./lib/${name}.js'`, () => `./${name}/index.js'`).replaceAll(`./lib/${name}'`, () => `./${name}'`)
2701
+ (0, import_node_fs5.readFileSync)(barrel, "utf8").replaceAll(`./lib/${name}.js'`, () => `./${name}/index.js'`).replaceAll(`./lib/${name}'`, () => `./${name}'`)
2521
2702
  );
2522
2703
  }
2523
- (0, import_node_fs4.rmSync)((0, import_node_path4.join)(sourceDir, "lib"), { recursive: true, force: true });
2704
+ (0, import_node_fs5.rmSync)((0, import_node_path5.join)(sourceDir, "lib"), { recursive: true, force: true });
2524
2705
  }
2525
2706
  function repointSpecifier(source, from, to) {
2526
2707
  return source.replaceAll(`${from}'`, () => `${to}'`).replaceAll(`${from}.js'`, () => `${to}.js'`);
2527
2708
  }
2528
2709
  function ensureNxPeerOverrides(workspaceRoot) {
2529
- const manifestPath = (0, import_node_path4.join)(workspaceRoot, "package.json");
2530
- if (!(0, import_node_fs4.existsSync)(manifestPath)) {
2710
+ const manifestPath = (0, import_node_path5.join)(workspaceRoot, "package.json");
2711
+ if (!(0, import_node_fs5.existsSync)(manifestPath)) {
2531
2712
  return;
2532
2713
  }
2533
2714
  const manifest = readJson(manifestPath);
@@ -2550,11 +2731,11 @@ function registerProjectCommands(workspaceRoot, name, commands) {
2550
2731
  if (commands.start) {
2551
2732
  scripts[`${name}:start`] = commands.start;
2552
2733
  }
2553
- const dependabotPath = (0, import_node_path4.join)(workspaceRoot, ".github/dependabot.yml");
2554
- if ((0, import_node_fs4.existsSync)(dependabotPath)) {
2734
+ const dependabotPath = (0, import_node_path5.join)(workspaceRoot, ".github/dependabot.yml");
2735
+ if ((0, import_node_fs5.existsSync)(dependabotPath)) {
2555
2736
  writeFileEnsured(dependabotPath, dependabotConfig(workspaceRoot));
2556
2737
  }
2557
- const manifestPath = (0, import_node_path4.join)(workspaceRoot, "package.json");
2738
+ const manifestPath = (0, import_node_path5.join)(workspaceRoot, "package.json");
2558
2739
  const manifest = readJson(manifestPath);
2559
2740
  const existingScripts = manifest.scripts ?? {};
2560
2741
  writeFileEnsured(
@@ -2592,7 +2773,7 @@ function registerProjectCommands(workspaceRoot, name, commands) {
2592
2773
  var PROJECT_MANIFEST_ROOTS = ["apps", "packages", "libs"];
2593
2774
  function rootRuntimeDependencies(workspaceRoot) {
2594
2775
  try {
2595
- return readJson((0, import_node_path4.join)(workspaceRoot, "package.json")).dependencies ?? {};
2776
+ return readJson((0, import_node_path5.join)(workspaceRoot, "package.json")).dependencies ?? {};
2596
2777
  } catch {
2597
2778
  return {};
2598
2779
  }
@@ -2604,7 +2785,7 @@ function relocateRootRuntimeDependencies(workspaceRoot, projectName, before) {
2604
2785
  return;
2605
2786
  }
2606
2787
  const manifestPath = PROJECT_MANIFEST_ROOTS.map(
2607
- (root) => (0, import_node_path4.join)(workspaceRoot, root, projectName, "package.json")
2788
+ (root) => (0, import_node_path5.join)(workspaceRoot, root, projectName, "package.json")
2608
2789
  ).find((candidate) => fileExists(candidate));
2609
2790
  if (manifestPath === void 0) {
2610
2791
  return;
@@ -2616,10 +2797,10 @@ function relocateRootRuntimeDependencies(workspaceRoot, projectName, before) {
2616
2797
  const remaining = Object.fromEntries(
2617
2798
  Object.entries(after).filter(([name]) => !added.includes(name))
2618
2799
  );
2619
- const rootManifest = readJson((0, import_node_path4.join)(workspaceRoot, "package.json"));
2800
+ const rootManifest = readJson((0, import_node_path5.join)(workspaceRoot, "package.json"));
2620
2801
  const { dependencies: _dropped, ...rest } = rootManifest;
2621
2802
  writeFileEnsured(
2622
- (0, import_node_path4.join)(workspaceRoot, "package.json"),
2803
+ (0, import_node_path5.join)(workspaceRoot, "package.json"),
2623
2804
  toJson(Object.keys(remaining).length > 0 ? { ...rest, dependencies: remaining } : rest)
2624
2805
  );
2625
2806
  logger.step(`Moved ${added.join(", ")} into ${projectName}'s own manifest`);
@@ -2679,7 +2860,7 @@ function addCsharpApp(workspaceRoot, name, template = "console") {
2679
2860
  ensureAdmZip(workspaceRoot);
2680
2861
  const projectRoot = `apps/${name}`;
2681
2862
  scaffoldDotnetProject(workspaceRoot, projectRoot, pascalCase(name), template);
2682
- addProjectJsonTargets((0, import_node_path5.join)(workspaceRoot, projectRoot, "project.json"), {
2863
+ addProjectJsonTargets((0, import_node_path6.join)(workspaceRoot, projectRoot, "project.json"), {
2683
2864
  package: csharpAppPackageTarget("csharp-app", projectRoot, name),
2684
2865
  start: csharpAppStartTarget(projectRoot)
2685
2866
  });
@@ -2772,7 +2953,7 @@ class CsharpVersionActions extends VersionActions {
2772
2953
  module.exports = CsharpVersionActions
2773
2954
  `;
2774
2955
  function writeCsharpVersionActions(workspaceRoot) {
2775
- writeFileEnsured((0, import_node_path5.join)(workspaceRoot, CSHARP_VERSION_ACTIONS_PATH), CSHARP_VERSION_ACTIONS);
2956
+ writeFileEnsured((0, import_node_path6.join)(workspaceRoot, CSHARP_VERSION_ACTIONS_PATH), CSHARP_VERSION_ACTIONS);
2776
2957
  }
2777
2958
  function addProjectJsonReleaseVersionActions(projectJsonPath) {
2778
2959
  const project = fileExists(projectJsonPath) ? readJson(projectJsonPath) : {};
@@ -2787,7 +2968,7 @@ function addProjectJsonReleaseVersionActions(projectJsonPath) {
2787
2968
  );
2788
2969
  }
2789
2970
  function addInitialVersion(csprojPath) {
2790
- const contents = (0, import_node_fs5.readFileSync)(csprojPath, "utf8");
2971
+ const contents = (0, import_node_fs6.readFileSync)(csprojPath, "utf8");
2791
2972
  writeFileEnsured(csprojPath, contents.replace("<PropertyGroup>", "<PropertyGroup>\n <Version>0.1.0</Version>"));
2792
2973
  }
2793
2974
  function csharpLibPublishTarget(projectRoot) {
@@ -2802,14 +2983,14 @@ async function addCsharpLib(workspaceRoot, name, options, kindProvided) {
2802
2983
  const projectRoot = `packages/${name}`;
2803
2984
  const identity = `${pascalScope(scope)}.${pascalCase(name)}`;
2804
2985
  scaffoldDotnetProject(workspaceRoot, projectRoot, identity, "classlib");
2805
- addInitialVersion((0, import_node_path5.join)(workspaceRoot, projectRoot, `${identity}.csproj`));
2986
+ addInitialVersion((0, import_node_path6.join)(workspaceRoot, projectRoot, `${identity}.csproj`));
2806
2987
  writeCsharpVersionActions(workspaceRoot);
2807
- addProjectJsonReleaseVersionActions((0, import_node_path5.join)(workspaceRoot, projectRoot, "project.json"));
2808
- addProjectJsonTargets((0, import_node_path5.join)(workspaceRoot, projectRoot, "project.json"), {
2988
+ addProjectJsonReleaseVersionActions((0, import_node_path6.join)(workspaceRoot, projectRoot, "project.json"));
2989
+ addProjectJsonTargets((0, import_node_path6.join)(workspaceRoot, projectRoot, "project.json"), {
2809
2990
  "nx-release-publish": csharpLibPublishTarget(projectRoot)
2810
2991
  });
2811
2992
  const registry = readMnciConfig(workspaceRoot).registry ?? { kind: "npm" };
2812
- writeFileEnsured((0, import_node_path5.join)(workspaceRoot, "nuget.config"), nugetConfigContent(registry, scope));
2993
+ writeFileEnsured((0, import_node_path6.join)(workspaceRoot, "nuget.config"), nugetConfigContent(registry, scope));
2813
2994
  registerProjectCommands(workspaceRoot, name, { build: true });
2814
2995
  }
2815
2996
  function addCsharpInternalLib(workspaceRoot, name) {
@@ -2885,15 +3066,15 @@ function addCsharpFunctionApp(workspaceRoot, name) {
2885
3066
  const projectRoot = `apps/${name}`;
2886
3067
  const identity = pascalCase(name);
2887
3068
  scaffoldDotnetProject(workspaceRoot, projectRoot, identity, "console");
2888
- const absoluteRoot = (0, import_node_path5.join)(workspaceRoot, projectRoot);
2889
- writeFileEnsured((0, import_node_path5.join)(absoluteRoot, `${identity}.csproj`), csharpFunctionAppCsproj());
2890
- writeFileEnsured((0, import_node_path5.join)(absoluteRoot, "Program.cs"), CSHARP_FUNCTION_APP_PROGRAM);
2891
- writeFileEnsured((0, import_node_path5.join)(absoluteRoot, "Hello.cs"), csharpFunctionAppHello(identity));
2892
- writeFileEnsured((0, import_node_path5.join)(absoluteRoot, "host.json"), CSHARP_FUNCTION_APP_HOST_JSON);
3069
+ const absoluteRoot = (0, import_node_path6.join)(workspaceRoot, projectRoot);
3070
+ writeFileEnsured((0, import_node_path6.join)(absoluteRoot, `${identity}.csproj`), csharpFunctionAppCsproj());
3071
+ writeFileEnsured((0, import_node_path6.join)(absoluteRoot, "Program.cs"), CSHARP_FUNCTION_APP_PROGRAM);
3072
+ writeFileEnsured((0, import_node_path6.join)(absoluteRoot, "Hello.cs"), csharpFunctionAppHello(identity));
3073
+ writeFileEnsured((0, import_node_path6.join)(absoluteRoot, "host.json"), CSHARP_FUNCTION_APP_HOST_JSON);
2893
3074
  if (runShell("dotnet", ["restore", projectRoot], workspaceRoot) !== 0) {
2894
3075
  throw new Error(`dotnet restore failed for ${projectRoot}`);
2895
3076
  }
2896
- addProjectJsonTargets((0, import_node_path5.join)(absoluteRoot, "project.json"), {
3077
+ addProjectJsonTargets((0, import_node_path6.join)(absoluteRoot, "project.json"), {
2897
3078
  package: csharpAppPackageTarget("csharp-function-app", projectRoot, name),
2898
3079
  start: csharpFunctionAppStartTarget(projectRoot)
2899
3080
  });
@@ -2901,7 +3082,7 @@ function addCsharpFunctionApp(workspaceRoot, name) {
2901
3082
  }
2902
3083
 
2903
3084
  // src/project-scaffolding/flutter.use-case.ts
2904
- var import_node_path6 = require("path");
3085
+ var import_node_path7 = require("path");
2905
3086
  function flutterAppStartTarget(name) {
2906
3087
  return {
2907
3088
  executor: "nx:run-commands",
@@ -2937,7 +3118,7 @@ function addFlutterApp(workspaceRoot, name) {
2937
3118
  prepareFlutter(workspaceRoot);
2938
3119
  ensureAdmZip(workspaceRoot);
2939
3120
  runNx(["g", "@mnci/nx-flutter:application", name, "--no-interactive"], workspaceRoot);
2940
- addProjectJsonTargets((0, import_node_path6.join)(workspaceRoot, "apps", name, "project.json"), {
3121
+ addProjectJsonTargets((0, import_node_path7.join)(workspaceRoot, "apps", name, "project.json"), {
2941
3122
  start: flutterAppStartTarget(name)
2942
3123
  });
2943
3124
  registerProjectCommands(workspaceRoot, name, { build: true, start: `nx run ${name}:start` });
@@ -2954,18 +3135,18 @@ function addFlutterInternalLib(workspaceRoot, name) {
2954
3135
  }
2955
3136
 
2956
3137
  // src/project-scaffolding/go.use-case.ts
2957
- var import_node_fs9 = require("fs");
2958
- var import_node_path10 = require("path");
3138
+ var import_node_fs10 = require("fs");
3139
+ var import_node_path11 = require("path");
2959
3140
 
2960
3141
  // src/go-workspace/go-plugin.use-case.ts
2961
- var import_node_fs6 = require("fs");
2962
- var import_node_path7 = require("path");
3142
+ var import_node_fs7 = require("fs");
3143
+ var import_node_path8 = require("path");
2963
3144
  var NX_GO_PLUGIN = "@nx-go/nx-go";
2964
3145
  function hasGoProject(workspaceRoot) {
2965
- const projectFiles = ["apps", "libs", "packages"].flatMap((directory) => (0, import_node_fs6.globSync)(`${directory}/*/project.json`, { cwd: workspaceRoot }));
3146
+ const projectFiles = ["apps", "libs", "packages"].flatMap((directory) => (0, import_node_fs7.globSync)(`${directory}/*/project.json`, { cwd: workspaceRoot }));
2966
3147
  return projectFiles.some((projectFile) => {
2967
3148
  try {
2968
- const { tags } = JSON.parse((0, import_node_fs6.readFileSync)((0, import_node_path7.join)(workspaceRoot, projectFile), "utf8"));
3149
+ const { tags } = JSON.parse((0, import_node_fs7.readFileSync)((0, import_node_path8.join)(workspaceRoot, projectFile), "utf8"));
2969
3150
  return (tags ?? []).some((tag) => tag.startsWith("type:go-"));
2970
3151
  } catch {
2971
3152
  return false;
@@ -2973,7 +3154,7 @@ function hasGoProject(workspaceRoot) {
2973
3154
  });
2974
3155
  }
2975
3156
  function isNxGoPluginRegistered(workspaceRoot) {
2976
- const nxJsonPath = (0, import_node_path7.join)(workspaceRoot, "nx.json");
3157
+ const nxJsonPath = (0, import_node_path8.join)(workspaceRoot, "nx.json");
2977
3158
  if (!fileExists(nxJsonPath)) {
2978
3159
  return false;
2979
3160
  }
@@ -3000,7 +3181,7 @@ function goModulePrefix(workspaceRoot) {
3000
3181
  return result.status === 0 ? modulePrefixFromRemoteUrl(result.stdout) : void 0;
3001
3182
  }
3002
3183
  function registerNxGoPlugin(workspaceRoot) {
3003
- const nxJsonPath = (0, import_node_path7.join)(workspaceRoot, "nx.json");
3184
+ const nxJsonPath = (0, import_node_path8.join)(workspaceRoot, "nx.json");
3004
3185
  if (!fileExists(nxJsonPath)) {
3005
3186
  return false;
3006
3187
  }
@@ -3024,8 +3205,8 @@ function registerNxGoPlugin(workspaceRoot) {
3024
3205
  }
3025
3206
 
3026
3207
  // src/project-scaffolding/go-release.use-case.ts
3027
- var import_node_fs7 = require("fs");
3028
- var import_node_path8 = require("path");
3208
+ var import_node_fs8 = require("fs");
3209
+ var import_node_path9 = require("path");
3029
3210
  var GO_RELEASE_SCRIPT_PATH = "tools/go-app-release.cjs";
3030
3211
  var GO_RELEASE_SCRIPT = String.raw`#!/usr/bin/env node
3031
3212
  // Written by mnci: 'mnci add go-app --release' creates it and 'mnci upgrade'
@@ -3151,7 +3332,7 @@ var GO_RELEASE_PUBLISH_TARGET = {
3151
3332
  }
3152
3333
  };
3153
3334
  function makeGoAppReleasable(workspaceRoot, name) {
3154
- const projectJsonPath = (0, import_node_path8.join)(workspaceRoot, "apps", name, "project.json");
3335
+ const projectJsonPath = (0, import_node_path9.join)(workspaceRoot, "apps", name, "project.json");
3155
3336
  if (!fileExists(projectJsonPath)) {
3156
3337
  throw new Error(`No Go app at apps/${name}: cannot make it releasable.`);
3157
3338
  }
@@ -3172,22 +3353,22 @@ function makeGoAppReleasable(workspaceRoot, name) {
3172
3353
  }
3173
3354
  })
3174
3355
  );
3175
- writeFileEnsured((0, import_node_path8.join)(workspaceRoot, GO_RELEASE_SCRIPT_PATH), GO_RELEASE_SCRIPT);
3356
+ writeFileEnsured((0, import_node_path9.join)(workspaceRoot, GO_RELEASE_SCRIPT_PATH), GO_RELEASE_SCRIPT);
3176
3357
  }
3177
3358
  function refreshGoReleaseScript(workspaceRoot) {
3178
- const apps = (0, import_node_path8.join)(workspaceRoot, "apps");
3359
+ const apps = (0, import_node_path9.join)(workspaceRoot, "apps");
3179
3360
  let entries;
3180
3361
  try {
3181
- entries = (0, import_node_fs7.readdirSync)(apps);
3362
+ entries = (0, import_node_fs8.readdirSync)(apps);
3182
3363
  } catch {
3183
3364
  return false;
3184
3365
  }
3185
3366
  const hasReleasableApp = entries.some((entry) => {
3186
- const projectJsonPath = (0, import_node_path8.join)(apps, entry, "project.json");
3367
+ const projectJsonPath = (0, import_node_path9.join)(apps, entry, "project.json");
3187
3368
  return fileExists(projectJsonPath) && (readJson(projectJsonPath).tags ?? []).includes(GO_RELEASE_TAG);
3188
3369
  });
3189
- const path = (0, import_node_path8.join)(workspaceRoot, GO_RELEASE_SCRIPT_PATH);
3190
- if (!hasReleasableApp || fileExists(path) && (0, import_node_fs7.readFileSync)(path, "utf8") === GO_RELEASE_SCRIPT) {
3370
+ const path = (0, import_node_path9.join)(workspaceRoot, GO_RELEASE_SCRIPT_PATH);
3371
+ if (!hasReleasableApp || fileExists(path) && (0, import_node_fs8.readFileSync)(path, "utf8") === GO_RELEASE_SCRIPT) {
3191
3372
  return false;
3192
3373
  }
3193
3374
  writeFileEnsured(path, GO_RELEASE_SCRIPT);
@@ -3195,8 +3376,8 @@ function refreshGoReleaseScript(workspaceRoot) {
3195
3376
  }
3196
3377
 
3197
3378
  // src/project-scaffolding/go-web.use-case.ts
3198
- var import_node_fs8 = require("fs");
3199
- var import_node_path9 = require("path");
3379
+ var import_node_fs9 = require("fs");
3380
+ var import_node_path10 = require("path");
3200
3381
  var TARGETS_NEEDING_THE_FRONTEND = ["build", "test", "lint", "start", "build-all", "build-native"];
3201
3382
  var DEFAULT_ADDRESS = "127.0.0.1:8080";
3202
3383
  var GO_WEB_SOURCE = `package main
@@ -3274,18 +3455,18 @@ func TestWebHandlerServesTheBuiltFrontend(t *testing.T) {
3274
3455
  }
3275
3456
  `;
3276
3457
  function assertWebApp(workspaceRoot, web) {
3277
- const directory = (0, import_node_path9.join)(workspaceRoot, "apps", web);
3278
- const isReactApp = fileExists((0, import_node_path9.join)(directory, "package.json")) && (0, import_node_fs8.readdirSync)(directory).some((entry) => entry.startsWith("vite.config."));
3458
+ const directory = (0, import_node_path10.join)(workspaceRoot, "apps", web);
3459
+ const isReactApp = fileExists((0, import_node_path10.join)(directory, "package.json")) && (0, import_node_fs9.readdirSync)(directory).some((entry) => entry.startsWith("vite.config."));
3279
3460
  if (!isReactApp) {
3280
3461
  throw new Error(`--web ${web}: no React app at apps/${web}. Add it first with \`mnci add react-app ${web}\`.`);
3281
3462
  }
3282
3463
  }
3283
3464
  function webProjectName(workspaceRoot, web) {
3284
- const manifest = readJson((0, import_node_path9.join)(workspaceRoot, "apps", web, "package.json"));
3465
+ const manifest = readJson((0, import_node_path10.join)(workspaceRoot, "apps", web, "package.json"));
3285
3466
  return manifest.nx?.name ?? manifest.name ?? web;
3286
3467
  }
3287
3468
  function addApiProxy(viteConfigPath) {
3288
- const source = (0, import_node_fs8.readFileSync)(viteConfigPath, "utf8");
3469
+ const source = (0, import_node_fs9.readFileSync)(viteConfigPath, "utf8");
3289
3470
  if (source.includes("'/api'") || source.includes('"/api"')) {
3290
3471
  return false;
3291
3472
  }
@@ -3298,7 +3479,7 @@ function addApiProxy(viteConfigPath) {
3298
3479
  return true;
3299
3480
  }
3300
3481
  function wireGoAppToWeb(workspaceRoot, name, web) {
3301
- const projectJsonPath = (0, import_node_path9.join)(workspaceRoot, "apps", name, "project.json");
3482
+ const projectJsonPath = (0, import_node_path10.join)(workspaceRoot, "apps", name, "project.json");
3302
3483
  const project = readJson(projectJsonPath);
3303
3484
  const webName = webProjectName(workspaceRoot, web);
3304
3485
  const targets = project.targets ?? {};
@@ -3324,13 +3505,13 @@ function wireGoAppToWeb(workspaceRoot, name, web) {
3324
3505
  projectJsonPath,
3325
3506
  toJson({ ...project, implicitDependencies: [.../* @__PURE__ */ new Set([...project.implicitDependencies ?? [], webName])], targets })
3326
3507
  );
3327
- const directory = (0, import_node_path9.join)(workspaceRoot, "apps", name);
3328
- writeFileEnsured((0, import_node_path9.join)(directory, ".gitignore"), "/web/\n");
3329
- writeFileEnsured((0, import_node_path9.join)(directory, "web.go"), GO_WEB_SOURCE);
3330
- writeFileEnsured((0, import_node_path9.join)(directory, "main.go"), GO_WEB_MAIN);
3331
- writeFileEnsured((0, import_node_path9.join)(directory, "main_test.go"), GO_WEB_MAIN_TEST);
3332
- const viteConfig = (0, import_node_fs8.readdirSync)((0, import_node_path9.join)(workspaceRoot, "apps", web)).find((entry) => entry.startsWith("vite.config."));
3333
- if (viteConfig === void 0 || !addApiProxy((0, import_node_path9.join)(workspaceRoot, "apps", web, viteConfig))) {
3508
+ const directory = (0, import_node_path10.join)(workspaceRoot, "apps", name);
3509
+ writeFileEnsured((0, import_node_path10.join)(directory, ".gitignore"), "/web/\n");
3510
+ writeFileEnsured((0, import_node_path10.join)(directory, "web.go"), GO_WEB_SOURCE);
3511
+ writeFileEnsured((0, import_node_path10.join)(directory, "main.go"), GO_WEB_MAIN);
3512
+ writeFileEnsured((0, import_node_path10.join)(directory, "main_test.go"), GO_WEB_MAIN_TEST);
3513
+ const viteConfig = (0, import_node_fs9.readdirSync)((0, import_node_path10.join)(workspaceRoot, "apps", web)).find((entry) => entry.startsWith("vite.config."));
3514
+ if (viteConfig === void 0 || !addApiProxy((0, import_node_path10.join)(workspaceRoot, "apps", web, viteConfig))) {
3334
3515
  logger.warn(
3335
3516
  `Could not add the /api proxy to apps/${web}'s Vite config: add \`server: { proxy: { '/api': 'http://${DEFAULT_ADDRESS}' } }\` yourself, so \`nx run ${name}:dev\` reaches the Go server.`
3336
3517
  );
@@ -3364,7 +3545,7 @@ function ensureNxGoPlugin(workspaceRoot) {
3364
3545
  }
3365
3546
  }
3366
3547
  function ensureGoModule(workspaceRoot) {
3367
- if (fileExists((0, import_node_path10.join)(workspaceRoot, "go.work")) || fileExists((0, import_node_path10.join)(workspaceRoot, "go.mod"))) {
3548
+ if (fileExists((0, import_node_path11.join)(workspaceRoot, "go.work")) || fileExists((0, import_node_path11.join)(workspaceRoot, "go.mod"))) {
3368
3549
  return;
3369
3550
  }
3370
3551
  logger.step("Bootstrapping the Go workspace (go.work, one module per project)");
@@ -3372,26 +3553,26 @@ function ensureGoModule(workspaceRoot) {
3372
3553
  }
3373
3554
  function readGoModModule(goModPath) {
3374
3555
  try {
3375
- return /^module\s+(\S+)/m.exec((0, import_node_fs9.readFileSync)(goModPath, "utf8"))?.[1];
3556
+ return /^module\s+(\S+)/m.exec((0, import_node_fs10.readFileSync)(goModPath, "utf8"))?.[1];
3376
3557
  } catch {
3377
3558
  return void 0;
3378
3559
  }
3379
3560
  }
3380
3561
  function goModulePathFor(workspaceRoot, projectDir) {
3381
- const projectModule = readGoModModule((0, import_node_path10.join)(workspaceRoot, projectDir, "go.mod"));
3562
+ const projectModule = readGoModModule((0, import_node_path11.join)(workspaceRoot, projectDir, "go.mod"));
3382
3563
  if (projectModule !== void 0) {
3383
3564
  return projectModule;
3384
3565
  }
3385
- const rootModule = readGoModModule((0, import_node_path10.join)(workspaceRoot, "go.mod"));
3566
+ const rootModule = readGoModModule((0, import_node_path11.join)(workspaceRoot, "go.mod"));
3386
3567
  return rootModule === void 0 ? void 0 : `${rootModule}/${projectDir}`;
3387
3568
  }
3388
3569
  function setGoModulePath(workspaceRoot, projectDir) {
3389
3570
  const prefix = goModulePrefix(workspaceRoot);
3390
- const goModPath = (0, import_node_path10.join)(workspaceRoot, projectDir, "go.mod");
3571
+ const goModPath = (0, import_node_path11.join)(workspaceRoot, projectDir, "go.mod");
3391
3572
  if (prefix === void 0 || !fileExists(goModPath)) {
3392
3573
  return;
3393
3574
  }
3394
- const rewritten = (0, import_node_fs9.readFileSync)(goModPath, "utf8").replace(/^module\s+\S+/m, () => `module ${prefix}/${projectDir}`);
3575
+ const rewritten = (0, import_node_fs10.readFileSync)(goModPath, "utf8").replace(/^module\s+\S+/m, () => `module ${prefix}/${projectDir}`);
3395
3576
  writeFileEnsured(goModPath, rewritten);
3396
3577
  }
3397
3578
  function goTestTarget() {
@@ -3469,16 +3650,16 @@ function goNativePackageTarget(name) {
3469
3650
  }
3470
3651
  function addGoPlatformTargets(workspaceRoot) {
3471
3652
  const changed = [];
3472
- const apps = (0, import_node_path10.join)(workspaceRoot, "apps");
3653
+ const apps = (0, import_node_path11.join)(workspaceRoot, "apps");
3473
3654
  if (!fileExists(apps)) {
3474
3655
  return changed;
3475
3656
  }
3476
- for (const name of (0, import_node_fs9.readdirSync)(apps)) {
3477
- const projectJsonPath = (0, import_node_path10.join)(apps, name, "project.json");
3657
+ for (const name of (0, import_node_fs10.readdirSync)(apps)) {
3658
+ const projectJsonPath = (0, import_node_path11.join)(apps, name, "project.json");
3478
3659
  if (!fileExists(projectJsonPath)) {
3479
3660
  continue;
3480
3661
  }
3481
- const project = JSON.parse((0, import_node_fs9.readFileSync)(projectJsonPath, "utf8"));
3662
+ const project = JSON.parse((0, import_node_fs10.readFileSync)(projectJsonPath, "utf8"));
3482
3663
  const tag = (project.tags ?? []).find((each) => each === "type:go-app" || each === "type:go-function-app")?.slice("type:".length);
3483
3664
  if (tag === void 0 || (project.tags ?? []).includes(GO_CGO_TAG)) {
3484
3665
  continue;
@@ -3514,8 +3695,8 @@ function goLibraryIdentifiers(projectName) {
3514
3695
  }
3515
3696
  function reshapeGoLibraryScaffold(projectRoot, projectName) {
3516
3697
  const { packageName, functionName, fileStem } = goLibraryIdentifiers(projectName);
3517
- (0, import_node_fs9.rmSync)((0, import_node_path10.join)(projectRoot, `${projectName}.go`), { force: true });
3518
- (0, import_node_fs9.rmSync)((0, import_node_path10.join)(projectRoot, `${projectName}_test.go`), { force: true });
3698
+ (0, import_node_fs10.rmSync)((0, import_node_path11.join)(projectRoot, `${projectName}.go`), { force: true });
3699
+ (0, import_node_fs10.rmSync)((0, import_node_path11.join)(projectRoot, `${projectName}_test.go`), { force: true });
3519
3700
  const files = [
3520
3701
  [
3521
3702
  "doc.go",
@@ -3525,14 +3706,14 @@ package ${packageName}
3525
3706
  `
3526
3707
  ],
3527
3708
  [
3528
- (0, import_node_path10.join)(packageName, "doc.go"),
3709
+ (0, import_node_path11.join)(packageName, "doc.go"),
3529
3710
  `// Package ${packageName} is the starter slice of ${projectName}: rename it after
3530
3711
  // the outcome it delivers, and add one package per further outcome.
3531
3712
  package ${packageName}
3532
3713
  `
3533
3714
  ],
3534
3715
  [
3535
- (0, import_node_path10.join)(packageName, `${fileStem}_use_case.go`),
3716
+ (0, import_node_path11.join)(packageName, `${fileStem}_use_case.go`),
3536
3717
  `package ${packageName}
3537
3718
 
3538
3719
  // ${functionName} is the generator's sample behaviour, kept so the slice builds and tests.
@@ -3542,7 +3723,7 @@ func ${functionName}(name string) string {
3542
3723
  `
3543
3724
  ],
3544
3725
  [
3545
- (0, import_node_path10.join)(packageName, `${fileStem}_use_case_test.go`),
3726
+ (0, import_node_path11.join)(packageName, `${fileStem}_use_case_test.go`),
3546
3727
  `package ${packageName}
3547
3728
 
3548
3729
  import "testing"
@@ -3556,7 +3737,7 @@ func Test${functionName}(t *testing.T) {
3556
3737
  ]
3557
3738
  ];
3558
3739
  for (const [relativePath, content] of files) {
3559
- const path = (0, import_node_path10.join)(projectRoot, relativePath);
3740
+ const path = (0, import_node_path11.join)(projectRoot, relativePath);
3560
3741
  if (!fileExists(path)) {
3561
3742
  writeFileEnsured(path, content);
3562
3743
  }
@@ -3591,7 +3772,7 @@ function addGoApp(workspaceRoot, name, options = {}) {
3591
3772
  workspaceRoot
3592
3773
  );
3593
3774
  setGoModulePath(workspaceRoot, `apps/${name}`);
3594
- addProjectJsonTargets((0, import_node_path10.join)(workspaceRoot, "apps", name, "project.json"), {
3775
+ addProjectJsonTargets((0, import_node_path11.join)(workspaceRoot, "apps", name, "project.json"), {
3595
3776
  build: goBuildTarget(name),
3596
3777
  test: goTestTarget(),
3597
3778
  lint: goLintTarget(),
@@ -3630,7 +3811,7 @@ function addGoFunctionApp(workspaceRoot, name) {
3630
3811
  workspaceRoot
3631
3812
  );
3632
3813
  setGoModulePath(workspaceRoot, `apps/${name}`);
3633
- addProjectJsonTargets((0, import_node_path10.join)(workspaceRoot, "apps", name, "project.json"), {
3814
+ addProjectJsonTargets((0, import_node_path11.join)(workspaceRoot, "apps", name, "project.json"), {
3634
3815
  "build": goBuildTarget(name),
3635
3816
  "test": goTestTarget(),
3636
3817
  "lint": goLintTarget(),
@@ -3654,11 +3835,11 @@ function addGoLib(workspaceRoot, name) {
3654
3835
  workspaceRoot
3655
3836
  );
3656
3837
  setGoModulePath(workspaceRoot, `packages/${name}`);
3657
- addProjectJsonTargets((0, import_node_path10.join)(workspaceRoot, "packages", name, "project.json"), {
3838
+ addProjectJsonTargets((0, import_node_path11.join)(workspaceRoot, "packages", name, "project.json"), {
3658
3839
  test: goTestTarget(),
3659
3840
  lint: goLintTarget()
3660
3841
  });
3661
- const slice = reshapeGoLibraryScaffold((0, import_node_path10.join)(workspaceRoot, "packages", name), name);
3842
+ const slice = reshapeGoLibraryScaffold((0, import_node_path11.join)(workspaceRoot, "packages", name), name);
3662
3843
  registerProjectCommands(workspaceRoot, name, { build: false });
3663
3844
  const module2 = goModulePathFor(workspaceRoot, `packages/${name}`);
3664
3845
  if (module2) {
@@ -3679,11 +3860,11 @@ function addGoInternalLib(workspaceRoot, name) {
3679
3860
  workspaceRoot
3680
3861
  );
3681
3862
  setGoModulePath(workspaceRoot, `libs/${name}`);
3682
- addProjectJsonTargets((0, import_node_path10.join)(workspaceRoot, "libs", name, "project.json"), {
3863
+ addProjectJsonTargets((0, import_node_path11.join)(workspaceRoot, "libs", name, "project.json"), {
3683
3864
  test: goTestTarget(),
3684
3865
  lint: goLintTarget()
3685
3866
  });
3686
- const slice = reshapeGoLibraryScaffold((0, import_node_path10.join)(workspaceRoot, "libs", name), name);
3867
+ const slice = reshapeGoLibraryScaffold((0, import_node_path11.join)(workspaceRoot, "libs", name), name);
3687
3868
  registerProjectCommands(workspaceRoot, name, { build: false });
3688
3869
  const module2 = goModulePathFor(workspaceRoot, `libs/${name}`);
3689
3870
  if (module2) {
@@ -3692,7 +3873,7 @@ function addGoInternalLib(workspaceRoot, name) {
3692
3873
  }
3693
3874
 
3694
3875
  // src/project-scaffolding/node.use-case.ts
3695
- var import_node_path11 = require("path");
3876
+ var import_node_path12 = require("path");
3696
3877
  function ensurePlugin2(workspaceRoot, packageName) {
3697
3878
  if (hasPlugin(workspaceRoot, packageName)) {
3698
3879
  return;
@@ -3716,12 +3897,12 @@ function runNodeApp(workspaceRoot, name, stack, framework) {
3716
3897
  ],
3717
3898
  workspaceRoot
3718
3899
  );
3719
- const appRoot = (0, import_node_path11.join)(workspaceRoot, "apps", name);
3900
+ const appRoot = (0, import_node_path12.join)(workspaceRoot, "apps", name);
3720
3901
  separateDeclarationOutput(appRoot);
3721
3902
  repairAssetMapping(appRoot, name);
3722
3903
  }
3723
3904
  function separateDeclarationOutput(appRoot) {
3724
- const tsconfigPath = (0, import_node_path11.join)(appRoot, "tsconfig.app.json");
3905
+ const tsconfigPath = (0, import_node_path12.join)(appRoot, "tsconfig.app.json");
3725
3906
  if (!fileExists(tsconfigPath)) {
3726
3907
  return;
3727
3908
  }
@@ -3743,7 +3924,7 @@ function separateDeclarationOutput(appRoot) {
3743
3924
  );
3744
3925
  }
3745
3926
  function repairAssetMapping(appRoot, name) {
3746
- const manifestPath = (0, import_node_path11.join)(appRoot, "package.json");
3927
+ const manifestPath = (0, import_node_path12.join)(appRoot, "package.json");
3747
3928
  if (!fileExists(manifestPath)) {
3748
3929
  return;
3749
3930
  }
@@ -3770,7 +3951,7 @@ function nodeAppPackageTarget(name) {
3770
3951
  function addNodeApp(workspaceRoot, name, stack, framework = "none") {
3771
3952
  runNodeApp(workspaceRoot, name, stack, framework);
3772
3953
  ensureAdmZip(workspaceRoot);
3773
- addNxTargets((0, import_node_path11.join)(workspaceRoot, "apps", name, "package.json"), {
3954
+ addNxTargets((0, import_node_path12.join)(workspaceRoot, "apps", name, "package.json"), {
3774
3955
  package: nodeAppPackageTarget(name)
3775
3956
  });
3776
3957
  removeGeneratedEslintConfig(workspaceRoot, `apps/${name}`);
@@ -3826,10 +4007,10 @@ describe('buildGreeting', () => {
3826
4007
  })
3827
4008
  `;
3828
4009
  function repairNodeFunctionAppManifest(nodeFunctionAppRoot, workspaceRoot) {
3829
- const manifestPath = (0, import_node_path11.join)(nodeFunctionAppRoot, "package.json");
4010
+ const manifestPath = (0, import_node_path12.join)(nodeFunctionAppRoot, "package.json");
3830
4011
  const manifest = readJson(manifestPath);
3831
4012
  const azureFunctionsVersion = readJson(
3832
- (0, import_node_path11.join)(workspaceRoot, "node_modules/@azure/functions/package.json")
4013
+ (0, import_node_path12.join)(workspaceRoot, "node_modules/@azure/functions/package.json")
3833
4014
  ).version;
3834
4015
  const dependencies = manifest.dependencies ?? {};
3835
4016
  writeFileEnsured(
@@ -3872,21 +4053,21 @@ function nodeFunctionAppStartTarget(name) {
3872
4053
  function addNodeFunctionApp(workspaceRoot, name, stack) {
3873
4054
  runNodeApp(workspaceRoot, name, stack, "none");
3874
4055
  ensureAzureFunctionsPackage(workspaceRoot);
3875
- const nodeFunctionAppRoot = (0, import_node_path11.join)(workspaceRoot, "apps", name);
3876
- writeFileEnsured((0, import_node_path11.join)(nodeFunctionAppRoot, "src/main.ts"), NODE_FUNCTION_APP_MAIN);
3877
- writeFileEnsured((0, import_node_path11.join)(nodeFunctionAppRoot, "src/functions/hello.ts"), NODE_FUNCTION_APP_HELLO);
4056
+ const nodeFunctionAppRoot = (0, import_node_path12.join)(workspaceRoot, "apps", name);
4057
+ writeFileEnsured((0, import_node_path12.join)(nodeFunctionAppRoot, "src/main.ts"), NODE_FUNCTION_APP_MAIN);
4058
+ writeFileEnsured((0, import_node_path12.join)(nodeFunctionAppRoot, "src/functions/hello.ts"), NODE_FUNCTION_APP_HELLO);
3878
4059
  writeFileEnsured(
3879
- (0, import_node_path11.join)(nodeFunctionAppRoot, "src/functions/greeting.ts"),
4060
+ (0, import_node_path12.join)(nodeFunctionAppRoot, "src/functions/greeting.ts"),
3880
4061
  NODE_FUNCTION_APP_GREETING
3881
4062
  );
3882
4063
  writeFileEnsured(
3883
- (0, import_node_path11.join)(nodeFunctionAppRoot, "src/functions/greeting.spec.ts"),
4064
+ (0, import_node_path12.join)(nodeFunctionAppRoot, "src/functions/greeting.spec.ts"),
3884
4065
  NODE_FUNCTION_APP_GREETING_SPEC
3885
4066
  );
3886
- writeFileEnsured((0, import_node_path11.join)(nodeFunctionAppRoot, "host.json"), NODE_FUNCTION_APP_HOST_JSON);
4067
+ writeFileEnsured((0, import_node_path12.join)(nodeFunctionAppRoot, "host.json"), NODE_FUNCTION_APP_HOST_JSON);
3887
4068
  repairNodeFunctionAppManifest(nodeFunctionAppRoot, workspaceRoot);
3888
4069
  ensureAdmZip(workspaceRoot);
3889
- addNxTargets((0, import_node_path11.join)(nodeFunctionAppRoot, "package.json"), {
4070
+ addNxTargets((0, import_node_path12.join)(nodeFunctionAppRoot, "package.json"), {
3890
4071
  package: nodeFunctionAppPackageTarget(name),
3891
4072
  prune: nodeFunctionAppPruneTarget(name),
3892
4073
  start: nodeFunctionAppStartTarget(name)
@@ -3896,11 +4077,11 @@ function addNodeFunctionApp(workspaceRoot, name, stack) {
3896
4077
  }
3897
4078
 
3898
4079
  // src/project-scaffolding/npm-lib.use-case.ts
3899
- var import_node_path15 = require("path");
4080
+ var import_node_path16 = require("path");
3900
4081
 
3901
4082
  // src/rollup-library/repair-publishable-manifest.use-case.ts
3902
- var import_node_fs10 = require("fs");
3903
- var import_node_path12 = require("path");
4083
+ var import_node_fs11 = require("fs");
4084
+ var import_node_path13 = require("path");
3904
4085
  var WRONG_TYPES_PATH = "./dist/index.esm.d.ts";
3905
4086
  var ACTUAL_TYPES_PATH = "./dist/src/index.d.ts";
3906
4087
  var DECLARATION_MAP_EXCLUSION = "!**/*.d.ts.map";
@@ -3923,14 +4104,14 @@ function repairPublishableManifest(manifestPath) {
3923
4104
  }
3924
4105
  function repairPublishableManifests(workspaceRoot) {
3925
4106
  const changed = [];
3926
- const manifests = (0, import_node_fs10.globSync)(["packages/*/package.json", "libs/*/package.json"], {
4107
+ const manifests = (0, import_node_fs11.globSync)(["packages/*/package.json", "libs/*/package.json"], {
3927
4108
  cwd: workspaceRoot
3928
4109
  });
3929
4110
  for (const relativePath of manifests) {
3930
- const manifestPath = (0, import_node_path12.join)(workspaceRoot, relativePath);
3931
- const before = (0, import_node_fs10.readFileSync)(manifestPath, "utf8");
4111
+ const manifestPath = (0, import_node_path13.join)(workspaceRoot, relativePath);
4112
+ const before = (0, import_node_fs11.readFileSync)(manifestPath, "utf8");
3932
4113
  repairPublishableManifest(manifestPath);
3933
- const after = (0, import_node_fs10.readFileSync)(manifestPath, "utf8");
4114
+ const after = (0, import_node_fs11.readFileSync)(manifestPath, "utf8");
3934
4115
  if (after !== before) {
3935
4116
  changed.push(relativePath.replaceAll("\\", "/"));
3936
4117
  }
@@ -3939,8 +4120,8 @@ function repairPublishableManifests(workspaceRoot) {
3939
4120
  }
3940
4121
 
3941
4122
  // src/rollup-library/repair-rollup-config.use-case.ts
3942
- var import_node_fs11 = require("fs");
3943
- var import_node_path13 = require("path");
4123
+ var import_node_fs12 = require("fs");
4124
+ var import_node_path14 = require("path");
3944
4125
 
3945
4126
  // src/rollup-library/rollup-config.algorithm.ts
3946
4127
  var ROLLUP_CONFIG_PLACEHOLDER = [
@@ -4142,12 +4323,12 @@ function withUpgradedDeclarationSpecifierPlugin(config) {
4142
4323
  // src/rollup-library/repair-rollup-config.use-case.ts
4143
4324
  function repairRollupSourceMaps(workspaceRoot) {
4144
4325
  const changed = [];
4145
- const configs = (0, import_node_fs11.globSync)(["packages/*/rollup.config.cjs", "libs/*/rollup.config.cjs"], {
4326
+ const configs = (0, import_node_fs12.globSync)(["packages/*/rollup.config.cjs", "libs/*/rollup.config.cjs"], {
4146
4327
  cwd: workspaceRoot
4147
4328
  });
4148
4329
  for (const relativePath of configs) {
4149
- const configPath = (0, import_node_path13.join)(workspaceRoot, relativePath);
4150
- const before = (0, import_node_fs11.readFileSync)(configPath, "utf8");
4330
+ const configPath = (0, import_node_path14.join)(workspaceRoot, relativePath);
4331
+ const before = (0, import_node_fs12.readFileSync)(configPath, "utf8");
4151
4332
  const after = withRollupSourceMaps(before);
4152
4333
  if (after !== before) {
4153
4334
  writeFileEnsured(configPath, after);
@@ -4158,12 +4339,12 @@ function repairRollupSourceMaps(workspaceRoot) {
4158
4339
  }
4159
4340
  function upgradeDeclarationSpecifierPlugins(workspaceRoot) {
4160
4341
  const changed = [];
4161
- const configs = (0, import_node_fs11.globSync)(["packages/*/rollup.config.cjs", "libs/*/rollup.config.cjs"], {
4342
+ const configs = (0, import_node_fs12.globSync)(["packages/*/rollup.config.cjs", "libs/*/rollup.config.cjs"], {
4162
4343
  cwd: workspaceRoot
4163
4344
  });
4164
4345
  for (const relativePath of configs) {
4165
- const configPath = (0, import_node_path13.join)(workspaceRoot, relativePath);
4166
- const before = (0, import_node_fs11.readFileSync)(configPath, "utf8");
4346
+ const configPath = (0, import_node_path14.join)(workspaceRoot, relativePath);
4347
+ const before = (0, import_node_fs12.readFileSync)(configPath, "utf8");
4167
4348
  const after = withUpgradedDeclarationSpecifierPlugin(before);
4168
4349
  if (after !== before) {
4169
4350
  writeFileEnsured(configPath, after);
@@ -4173,11 +4354,11 @@ function upgradeDeclarationSpecifierPlugins(workspaceRoot) {
4173
4354
  return changed;
4174
4355
  }
4175
4356
  function repairDeclarationSpecifiers(projectRoot) {
4176
- const configPath = (0, import_node_path13.join)(projectRoot, "rollup.config.cjs");
4357
+ const configPath = (0, import_node_path14.join)(projectRoot, "rollup.config.cjs");
4177
4358
  if (!fileExists(configPath)) {
4178
4359
  return;
4179
4360
  }
4180
- const config = (0, import_node_fs11.readFileSync)(configPath, "utf8");
4361
+ const config = (0, import_node_fs12.readFileSync)(configPath, "utf8");
4181
4362
  if (!config.includes(ROLLUP_CONFIG_PLACEHOLDER)) {
4182
4363
  return;
4183
4364
  }
@@ -4186,10 +4367,10 @@ function repairDeclarationSpecifiers(projectRoot) {
4186
4367
  }
4187
4368
 
4188
4369
  // src/rollup-library/rollup-config.repository.ts
4189
- var import_node_fs12 = require("fs");
4190
- var import_node_path14 = require("path");
4370
+ var import_node_fs13 = require("fs");
4371
+ var import_node_path15 = require("path");
4191
4372
  function resolveRequireTarget(fromDir, specifier) {
4192
- const base = (0, import_node_path14.join)(fromDir, specifier);
4373
+ const base = (0, import_node_path15.join)(fromDir, specifier);
4193
4374
  return [base, `${base}.cjs`, `${base}.js`].find((candidate) => fileExists(candidate));
4194
4375
  }
4195
4376
  function resolveRollupConfigText(configPath, visited = /* @__PURE__ */ new Set()) {
@@ -4199,7 +4380,7 @@ function resolveRollupConfigText(configPath, visited = /* @__PURE__ */ new Set()
4199
4380
  visited.add(configPath);
4200
4381
  let text;
4201
4382
  try {
4202
- text = (0, import_node_fs12.readFileSync)(configPath, "utf8");
4383
+ text = (0, import_node_fs13.readFileSync)(configPath, "utf8");
4203
4384
  } catch {
4204
4385
  return "";
4205
4386
  }
@@ -4207,15 +4388,15 @@ function resolveRollupConfigText(configPath, visited = /* @__PURE__ */ new Set()
4207
4388
  text.matchAll(/require\((['"])(\.[^'"]*)\1\)/g),
4208
4389
  (match) => match[2]
4209
4390
  );
4210
- const requiredText = specifiers.map((specifier) => resolveRequireTarget((0, import_node_path14.dirname)(configPath), specifier)).filter((target) => target !== void 0).map((target) => resolveRollupConfigText(target, visited));
4391
+ const requiredText = specifiers.map((specifier) => resolveRequireTarget((0, import_node_path15.dirname)(configPath), specifier)).filter((target) => target !== void 0).map((target) => resolveRollupConfigText(target, visited));
4211
4392
  return [text, ...requiredText].join("\n");
4212
4393
  }
4213
4394
 
4214
4395
  // src/project-scaffolding/npm-lib.use-case.ts
4215
4396
  async function addNpmLib(workspaceRoot, name, options, kindProvided, stack) {
4216
4397
  const scope = options.scope ?? (kindProvided ? defaultScope(workspaceRoot) : await promptText("npm scope for the published package", defaultScope(workspaceRoot)));
4217
- const projectRoot = (0, import_node_path15.join)(workspaceRoot, "packages", name);
4218
- const manifestPath = (0, import_node_path15.join)(projectRoot, "package.json");
4398
+ const projectRoot = (0, import_node_path16.join)(workspaceRoot, "packages", name);
4399
+ const manifestPath = (0, import_node_path16.join)(projectRoot, "package.json");
4219
4400
  runGeneratorAndRepair(
4220
4401
  workspaceRoot,
4221
4402
  [
@@ -4244,8 +4425,8 @@ async function addNpmLib(workspaceRoot, name, options, kindProvided, stack) {
4244
4425
  }
4245
4426
 
4246
4427
  // src/project-scaffolding/python.use-case.ts
4247
- var import_node_fs13 = require("fs");
4248
- var import_node_path16 = require("path");
4428
+ var import_node_fs14 = require("fs");
4429
+ var import_node_path17 = require("path");
4249
4430
  function ensurePython(workspaceRoot) {
4250
4431
  const hasPython = runShell("python3", ["--version"], workspaceRoot) === 0 || runShell("python", ["--version"], workspaceRoot) === 0;
4251
4432
  if (!hasPython) {
@@ -4268,7 +4449,7 @@ function ensurePythonPipPlugin(workspaceRoot) {
4268
4449
  registerPythonGraphPlugin(workspaceRoot);
4269
4450
  }
4270
4451
  function registerPythonGraphPlugin(workspaceRoot) {
4271
- const nxJsonPath = (0, import_node_path16.join)(workspaceRoot, "nx.json");
4452
+ const nxJsonPath = (0, import_node_path17.join)(workspaceRoot, "nx.json");
4272
4453
  if (!fileExists(nxJsonPath)) {
4273
4454
  return;
4274
4455
  }
@@ -4291,7 +4472,7 @@ pytest
4291
4472
  pip-audit
4292
4473
  `;
4293
4474
  function ensureRequirementsDev(workspaceRoot) {
4294
- const requirementsDevPath = (0, import_node_path16.join)(workspaceRoot, "requirements-dev.txt");
4475
+ const requirementsDevPath = (0, import_node_path17.join)(workspaceRoot, "requirements-dev.txt");
4295
4476
  if (!fileExists(requirementsDevPath)) {
4296
4477
  writeFileEnsured(requirementsDevPath, PYTHON_REQUIREMENTS_DEV);
4297
4478
  }
@@ -4351,8 +4532,8 @@ function addPythonApp(workspaceRoot, name) {
4351
4532
  ["g", "@mnci/nx-python-pip:application", name, `--directory=apps/${name}`, "--no-interactive"],
4352
4533
  workspaceRoot
4353
4534
  );
4354
- writeFileEnsured((0, import_node_path16.join)(workspaceRoot, "apps", name, "main.py"), pythonAppMain(name));
4355
- addProjectJsonTargets((0, import_node_path16.join)(workspaceRoot, "apps", name, "project.json"), {
4535
+ writeFileEnsured((0, import_node_path17.join)(workspaceRoot, "apps", name, "main.py"), pythonAppMain(name));
4536
+ addProjectJsonTargets((0, import_node_path17.join)(workspaceRoot, "apps", name, "project.json"), {
4356
4537
  package: pythonAppPackageTarget(name),
4357
4538
  start: pythonAppStartTarget(name)
4358
4539
  });
@@ -4374,7 +4555,7 @@ function addPythonFunctionApp(workspaceRoot, name) {
4374
4555
  workspaceRoot
4375
4556
  );
4376
4557
  const moduleDirectory = pythonModuleDirectory(name);
4377
- addProjectJsonTargets((0, import_node_path16.join)(workspaceRoot, "apps", name, "project.json"), {
4558
+ addProjectJsonTargets((0, import_node_path17.join)(workspaceRoot, "apps", name, "project.json"), {
4378
4559
  package: pythonFunctionAppPackageTarget(name, moduleDirectory),
4379
4560
  start: pythonFunctionAppStartTarget(name)
4380
4561
  });
@@ -4415,7 +4596,7 @@ function addPythonInternalLib(workspaceRoot, name) {
4415
4596
  var PYTHON_PROJECT_DIRS = ["apps", "python-packages", "libs"];
4416
4597
  function findPythonProjectDirectory(workspaceRoot, name) {
4417
4598
  return PYTHON_PROJECT_DIRS.find(
4418
- (directory) => fileExists((0, import_node_path16.join)(workspaceRoot, directory, name, "pyproject.toml"))
4599
+ (directory) => fileExists((0, import_node_path17.join)(workspaceRoot, directory, name, "pyproject.toml"))
4419
4600
  );
4420
4601
  }
4421
4602
  function parseVendorEntries(pyprojectToml) {
@@ -4454,7 +4635,7 @@ async function addPythonVendor(workspaceRoot, consumer, options, kindProvided) {
4454
4635
  `No Python project named '${consumer}' with a pyproject.toml found (checked apps/, python-packages/, libs/). A Python function app has no pyproject.toml \u2014 there is nothing to vendor into.`
4455
4636
  );
4456
4637
  }
4457
- if (!fileExists((0, import_node_path16.join)(workspaceRoot, "libs", lib, "pyproject.toml"))) {
4638
+ if (!fileExists((0, import_node_path17.join)(workspaceRoot, "libs", lib, "pyproject.toml"))) {
4458
4639
  throw new Error(
4459
4640
  `No internal Python library named '${lib}' found at libs/${lib}/pyproject.toml. Only an internal library (added via 'mnci add python-internal-lib') can be vendored.`
4460
4641
  );
@@ -4462,8 +4643,8 @@ async function addPythonVendor(workspaceRoot, consumer, options, kindProvided) {
4462
4643
  if (consumerDirectory === "libs" && consumer === lib) {
4463
4644
  throw new Error(`'${consumer}' cannot vendor itself.`);
4464
4645
  }
4465
- const pyprojectPath = (0, import_node_path16.join)(workspaceRoot, consumerDirectory, consumer, "pyproject.toml");
4466
- const pyprojectToml = (0, import_node_fs13.readFileSync)(pyprojectPath, "utf8");
4646
+ const pyprojectPath = (0, import_node_path17.join)(workspaceRoot, consumerDirectory, consumer, "pyproject.toml");
4647
+ const pyprojectToml = (0, import_node_fs14.readFileSync)(pyprojectPath, "utf8");
4467
4648
  if (parseVendorEntries(pyprojectToml).includes(lib)) {
4468
4649
  logger.info(`'${consumer}' already vendors '${lib}' \u2014 nothing to do.`);
4469
4650
  return;
@@ -4475,8 +4656,8 @@ async function addPythonVendor(workspaceRoot, consumer, options, kindProvided) {
4475
4656
  }
4476
4657
 
4477
4658
  // src/project-scaffolding/react-app.use-case.ts
4478
- var import_node_fs14 = require("fs");
4479
- var import_node_path17 = require("path");
4659
+ var import_node_fs15 = require("fs");
4660
+ var import_node_path18 = require("path");
4480
4661
  var REACT_ENVIRONMENTS = ["dev", "uat", "prod"];
4481
4662
  function reactEnvironmentFile(environment) {
4482
4663
  return `# Vite compiles VITE_-prefixed vars into the '${environment}' bundle at build time.
@@ -4513,12 +4694,12 @@ function reactAppTargets(name) {
4513
4694
  return targets;
4514
4695
  }
4515
4696
  function allowEnvFiles(workspaceRoot) {
4516
- const gitignorePath = (0, import_node_path17.join)(workspaceRoot, ".gitignore");
4697
+ const gitignorePath = (0, import_node_path18.join)(workspaceRoot, ".gitignore");
4517
4698
  if (!fileExists(gitignorePath)) {
4518
4699
  return;
4519
4700
  }
4520
4701
  const marker = "# MoNecromanCI: keep the committed per-environment Vite config (public VITE_ values)";
4521
- const current = (0, import_node_fs14.readFileSync)(gitignorePath, "utf8");
4702
+ const current = (0, import_node_fs15.readFileSync)(gitignorePath, "utf8");
4522
4703
  if (current.includes(marker)) {
4523
4704
  return;
4524
4705
  }
@@ -4545,24 +4726,24 @@ function addReactApp(workspaceRoot, name, stack) {
4545
4726
  workspaceRoot
4546
4727
  );
4547
4728
  ensureAdmZip(workspaceRoot);
4548
- const reactAppRoot = (0, import_node_path17.join)(workspaceRoot, "apps", name);
4729
+ const reactAppRoot = (0, import_node_path18.join)(workspaceRoot, "apps", name);
4549
4730
  for (const environment of REACT_ENVIRONMENTS) {
4550
- writeFileEnsured((0, import_node_path17.join)(reactAppRoot, `.env.${environment}`), reactEnvironmentFile(environment));
4731
+ writeFileEnsured((0, import_node_path18.join)(reactAppRoot, `.env.${environment}`), reactEnvironmentFile(environment));
4551
4732
  }
4552
4733
  allowEnvFiles(workspaceRoot);
4553
- addNxTargets((0, import_node_path17.join)(reactAppRoot, "package.json"), reactAppTargets(name));
4734
+ addNxTargets((0, import_node_path18.join)(reactAppRoot, "package.json"), reactAppTargets(name));
4554
4735
  removeGeneratedEslintConfig(workspaceRoot, `apps/${name}`);
4555
4736
  registerProjectCommands(workspaceRoot, name, { build: true, start: `nx run ${name}:serve` });
4556
4737
  }
4557
4738
 
4558
4739
  // src/project-scaffolding/react-lib.use-case.ts
4559
- var import_node_path18 = require("path");
4740
+ var import_node_path19 = require("path");
4560
4741
  var REACT_LIB_BUNDLER = "rollup";
4561
4742
  async function addReactLib(workspaceRoot, name, options, kindProvided, stack) {
4562
4743
  ensurePlugin(workspaceRoot, "@nx/react");
4563
4744
  const scope = options.scope ?? (kindProvided ? defaultScope(workspaceRoot) : await promptText("npm scope for the published package", defaultScope(workspaceRoot)));
4564
- const projectRoot = (0, import_node_path18.join)(workspaceRoot, "packages", name);
4565
- const publishableManifest = (0, import_node_path18.join)(projectRoot, "package.json");
4745
+ const projectRoot = (0, import_node_path19.join)(workspaceRoot, "packages", name);
4746
+ const publishableManifest = (0, import_node_path19.join)(projectRoot, "package.json");
4566
4747
  runGeneratorAndRepair(
4567
4748
  workspaceRoot,
4568
4749
  [
@@ -4591,8 +4772,8 @@ async function addReactLib(workspaceRoot, name, options, kindProvided, stack) {
4591
4772
  }
4592
4773
  function addReactInternalLib(workspaceRoot, name, stack) {
4593
4774
  ensurePlugin(workspaceRoot, "@nx/react");
4594
- const projectRoot = (0, import_node_path18.join)(workspaceRoot, "libs", name);
4595
- const privateManifest = (0, import_node_path18.join)(projectRoot, "package.json");
4775
+ const projectRoot = (0, import_node_path19.join)(workspaceRoot, "libs", name);
4776
+ const privateManifest = (0, import_node_path19.join)(projectRoot, "package.json");
4596
4777
  runGeneratorAndRepair(
4597
4778
  workspaceRoot,
4598
4779
  [
@@ -4618,8 +4799,8 @@ function addReactInternalLib(workspaceRoot, name, stack) {
4618
4799
  }
4619
4800
 
4620
4801
  // src/project-scaffolding/vscode-extension.use-case.ts
4621
- var import_node_fs15 = require("fs");
4622
- var import_node_path19 = require("path");
4802
+ var import_node_fs16 = require("fs");
4803
+ var import_node_path20 = require("path");
4623
4804
  var VSCODE_EXTENSION_SCRIPT_PATH = "tools/vscode-extension.cjs";
4624
4805
  var VSCODE_ENGINE_FLOOR = "1.96.0";
4625
4806
  var VSCODE_SIDECAR_TARGETS = {
@@ -4804,8 +4985,8 @@ export const window = {
4804
4985
  var VSCODE_STUB_PATH = "test/vscode.stub.ts";
4805
4986
  function mapVscodeToStub(projectRoot, testRunner) {
4806
4987
  const [file, anchor, mapping] = testRunner === "jest" ? ["jest.config.cts", "testEnvironment: 'node',", `moduleNameMapper: { '^vscode$': '<rootDir>/${VSCODE_STUB_PATH}' },`] : ["vitest.config.mts", "environment: 'node',", `alias: { vscode: \`\${import.meta.dirname}/${VSCODE_STUB_PATH}\` },`];
4807
- const path = (0, import_node_path19.join)(projectRoot, file);
4808
- const content = fileExists(path) ? (0, import_node_fs15.readFileSync)(path, "utf8") : "";
4988
+ const path = (0, import_node_path20.join)(projectRoot, file);
4989
+ const content = fileExists(path) ? (0, import_node_fs16.readFileSync)(path, "utf8") : "";
4809
4990
  const line = content.split("\n").find((candidate) => candidate.trim() === anchor);
4810
4991
  if (line === void 0) {
4811
4992
  throw new Error(`${file} has no "${anchor}" line to map the vscode module after; map 'vscode' to ${VSCODE_STUB_PATH} by hand.`);
@@ -4825,11 +5006,11 @@ function ensureVscodeToolchain(workspaceRoot) {
4825
5006
  }
4826
5007
  }
4827
5008
  function defaultPublisher(workspaceRoot) {
4828
- const { name } = readJson((0, import_node_path19.join)(workspaceRoot, "package.json"));
5009
+ const { name } = readJson((0, import_node_path20.join)(workspaceRoot, "package.json"));
4829
5010
  return (name ?? "publisher").replace(/^@/, "").split("/", 1)[0];
4830
5011
  }
4831
5012
  function reshapeManifest(projectRoot, name, publisher) {
4832
- const manifestPath = (0, import_node_path19.join)(projectRoot, "package.json");
5013
+ const manifestPath = (0, import_node_path20.join)(projectRoot, "package.json");
4833
5014
  const manifest = readJson(manifestPath);
4834
5015
  const { nx = {}, ...rest } = manifest;
4835
5016
  const targets = { ...nx.targets };
@@ -4893,11 +5074,11 @@ function vscodeExtensionPublishTarget(name, sidecar) {
4893
5074
  };
4894
5075
  }
4895
5076
  function addDebugLaunch(workspaceRoot, name) {
4896
- const file = (0, import_node_fs15.readdirSync)(workspaceRoot).find((entry) => entry.endsWith(".code-workspace"));
5077
+ const file = (0, import_node_fs16.readdirSync)(workspaceRoot).find((entry) => entry.endsWith(".code-workspace"));
4897
5078
  if (file === void 0) {
4898
5079
  return;
4899
5080
  }
4900
- const path = (0, import_node_path19.join)(workspaceRoot, file);
5081
+ const path = (0, import_node_path20.join)(workspaceRoot, file);
4901
5082
  const workspace = readCodeWorkspace(path) ?? {};
4902
5083
  const folder = `\${workspaceFolder:${workspace.folders?.[0]?.name ?? file.replace(/\.code-workspace$/, "")}}`;
4903
5084
  const taskLabel = `${name}: build (development)`;
@@ -4930,39 +5111,39 @@ function addDebugLaunch(workspaceRoot, name) {
4930
5111
  );
4931
5112
  }
4932
5113
  function refreshVscodeExtensionScript(workspaceRoot) {
4933
- const apps = (0, import_node_path19.join)(workspaceRoot, "apps");
5114
+ const apps = (0, import_node_path20.join)(workspaceRoot, "apps");
4934
5115
  let entries;
4935
5116
  try {
4936
- entries = (0, import_node_fs15.readdirSync)(apps);
5117
+ entries = (0, import_node_fs16.readdirSync)(apps);
4937
5118
  } catch {
4938
5119
  return false;
4939
5120
  }
4940
5121
  const hasExtension = entries.some((entry) => {
4941
- const manifestPath = (0, import_node_path19.join)(apps, entry, "package.json");
5122
+ const manifestPath = (0, import_node_path20.join)(apps, entry, "package.json");
4942
5123
  if (!fileExists(manifestPath)) {
4943
5124
  return false;
4944
5125
  }
4945
5126
  const tags = readJson(manifestPath).nx?.tags ?? [];
4946
5127
  return tags.includes(VSCODE_EXTENSION_TAG);
4947
5128
  });
4948
- const path = (0, import_node_path19.join)(workspaceRoot, VSCODE_EXTENSION_SCRIPT_PATH);
4949
- if (!hasExtension || fileExists(path) && (0, import_node_fs15.readFileSync)(path, "utf8") === VSCODE_EXTENSION_SCRIPT) {
5129
+ const path = (0, import_node_path20.join)(workspaceRoot, VSCODE_EXTENSION_SCRIPT_PATH);
5130
+ if (!hasExtension || fileExists(path) && (0, import_node_fs16.readFileSync)(path, "utf8") === VSCODE_EXTENSION_SCRIPT) {
4950
5131
  return false;
4951
5132
  }
4952
5133
  writeFileEnsured(path, VSCODE_EXTENSION_SCRIPT);
4953
5134
  return true;
4954
5135
  }
4955
5136
  function pinVscodeExtensionProjectNames(workspaceRoot) {
4956
- const apps = (0, import_node_path19.join)(workspaceRoot, "apps");
5137
+ const apps = (0, import_node_path20.join)(workspaceRoot, "apps");
4957
5138
  let entries;
4958
5139
  try {
4959
- entries = (0, import_node_fs15.readdirSync)(apps);
5140
+ entries = (0, import_node_fs16.readdirSync)(apps);
4960
5141
  } catch {
4961
5142
  return [];
4962
5143
  }
4963
5144
  const updated = [];
4964
5145
  for (const entry of entries) {
4965
- const manifestPath = (0, import_node_path19.join)(apps, entry, "package.json");
5146
+ const manifestPath = (0, import_node_path20.join)(apps, entry, "package.json");
4966
5147
  if (!fileExists(manifestPath)) {
4967
5148
  continue;
4968
5149
  }
@@ -4982,22 +5163,22 @@ function refreshLockFile(workspaceRoot, name) {
4982
5163
  }
4983
5164
  function addVscodeExtension(workspaceRoot, name, stack, options = {}) {
4984
5165
  const { sidecar } = options;
4985
- if (sidecar !== void 0 && !fileExists((0, import_node_path19.join)(workspaceRoot, "apps", sidecar, "project.json"))) {
5166
+ if (sidecar !== void 0 && !fileExists((0, import_node_path20.join)(workspaceRoot, "apps", sidecar, "project.json"))) {
4986
5167
  throw new Error(`--sidecar ${sidecar}: no Go app at apps/${sidecar}. Add it first with \`mnci add go-app ${sidecar}\`.`);
4987
5168
  }
4988
5169
  runNodeApp(workspaceRoot, name, stack, "none");
4989
5170
  ensureVscodeToolchain(workspaceRoot);
4990
- const projectRoot = (0, import_node_path19.join)(workspaceRoot, "apps", name);
5171
+ const projectRoot = (0, import_node_path20.join)(workspaceRoot, "apps", name);
4991
5172
  reshapeManifest(projectRoot, name, options.publisher ?? defaultPublisher(workspaceRoot));
4992
- addVscodeTypes((0, import_node_path19.join)(projectRoot, "tsconfig.app.json"));
4993
- addVscodeTypes((0, import_node_path19.join)(projectRoot, "tsconfig.spec.json"));
4994
- writeFileEnsured((0, import_node_path19.join)(projectRoot, "src/main.ts"), vscodeExtensionMain(name));
4995
- writeFileEnsured((0, import_node_path19.join)(projectRoot, "src/main.spec.ts"), vscodeExtensionMainSpec(name));
4996
- writeFileEnsured((0, import_node_path19.join)(projectRoot, VSCODE_STUB_PATH), VSCODE_STUB);
5173
+ addVscodeTypes((0, import_node_path20.join)(projectRoot, "tsconfig.app.json"));
5174
+ addVscodeTypes((0, import_node_path20.join)(projectRoot, "tsconfig.spec.json"));
5175
+ writeFileEnsured((0, import_node_path20.join)(projectRoot, "src/main.ts"), vscodeExtensionMain(name));
5176
+ writeFileEnsured((0, import_node_path20.join)(projectRoot, "src/main.spec.ts"), vscodeExtensionMainSpec(name));
5177
+ writeFileEnsured((0, import_node_path20.join)(projectRoot, VSCODE_STUB_PATH), VSCODE_STUB);
4997
5178
  mapVscodeToStub(projectRoot, stack.testRunner);
4998
- writeFileEnsured((0, import_node_path19.join)(projectRoot, ".vscodeignore"), VSCODE_IGNORE);
4999
- writeFileEnsured((0, import_node_path19.join)(workspaceRoot, VSCODE_EXTENSION_SCRIPT_PATH), VSCODE_EXTENSION_SCRIPT);
5000
- addNxTargets((0, import_node_path19.join)(projectRoot, "package.json"), {
5179
+ writeFileEnsured((0, import_node_path20.join)(projectRoot, ".vscodeignore"), VSCODE_IGNORE);
5180
+ writeFileEnsured((0, import_node_path20.join)(workspaceRoot, VSCODE_EXTENSION_SCRIPT_PATH), VSCODE_EXTENSION_SCRIPT);
5181
+ addNxTargets((0, import_node_path20.join)(projectRoot, "package.json"), {
5001
5182
  "package": vscodeExtensionPackageTarget(name, sidecar),
5002
5183
  "nx-release-publish": vscodeExtensionPublishTarget(name, sidecar)
5003
5184
  });
@@ -5008,12 +5189,12 @@ function addVscodeExtension(workspaceRoot, name, stack, options = {}) {
5008
5189
  }
5009
5190
 
5010
5191
  // src/dependency-management/install-dependencies.use-case.ts
5011
- var import_node_fs17 = require("fs");
5012
- var import_node_path21 = require("path");
5192
+ var import_node_fs18 = require("fs");
5193
+ var import_node_path22 = require("path");
5013
5194
 
5014
5195
  // src/dependency-management/manifest.repository.ts
5015
- var import_node_fs16 = require("fs");
5016
- var import_node_path20 = require("path");
5196
+ var import_node_fs17 = require("fs");
5197
+ var import_node_path21 = require("path");
5017
5198
  var ECOSYSTEMS = ["npm", "pip", "pub", "nuget", "go"];
5018
5199
  var ROOT_LABEL = "(root)";
5019
5200
  var MANIFEST_GLOBS = {
@@ -5046,23 +5227,23 @@ function projectOf(manifestRelativePath) {
5046
5227
  }
5047
5228
  function hasEcosystem(workspaceRoot, ecosystem) {
5048
5229
  if (ecosystem === "go") {
5049
- return fileExists((0, import_node_path20.join)(workspaceRoot, "go.mod"));
5230
+ return fileExists((0, import_node_path21.join)(workspaceRoot, "go.mod"));
5050
5231
  }
5051
5232
  if (ecosystem === "nuget") {
5052
- return (0, import_node_fs16.globSync)(MANIFEST_GLOBS.nuget, { cwd: workspaceRoot }).length > 0;
5233
+ return (0, import_node_fs17.globSync)(MANIFEST_GLOBS.nuget, { cwd: workspaceRoot }).length > 0;
5053
5234
  }
5054
5235
  const rootMarker = {
5055
5236
  npm: "package.json",
5056
5237
  pip: "requirements-dev.txt",
5057
5238
  pub: "pubspec.yaml"
5058
5239
  };
5059
- return fileExists((0, import_node_path20.join)(workspaceRoot, rootMarker[ecosystem])) || (0, import_node_fs16.globSync)(MANIFEST_GLOBS[ecosystem], { cwd: workspaceRoot }).length > 0;
5240
+ return fileExists((0, import_node_path21.join)(workspaceRoot, rootMarker[ecosystem])) || (0, import_node_fs17.globSync)(MANIFEST_GLOBS[ecosystem], { cwd: workspaceRoot }).length > 0;
5060
5241
  }
5061
5242
  function collectNpm(workspaceRoot) {
5062
5243
  const sites = [];
5063
- const relativePaths = ["package.json", ...(0, import_node_fs16.globSync)(MANIFEST_GLOBS.npm, { cwd: workspaceRoot })];
5244
+ const relativePaths = ["package.json", ...(0, import_node_fs17.globSync)(MANIFEST_GLOBS.npm, { cwd: workspaceRoot })];
5064
5245
  for (const relativePath of relativePaths) {
5065
- const manifestPath = (0, import_node_path20.join)(workspaceRoot, relativePath);
5246
+ const manifestPath = (0, import_node_path21.join)(workspaceRoot, relativePath);
5066
5247
  try {
5067
5248
  const manifest = readJson(manifestPath);
5068
5249
  sites.push(...npmManifestSites(manifest, relativePath, manifestPath));
@@ -5123,17 +5304,17 @@ function collectPip(workspaceRoot) {
5123
5304
  name: parsed.name,
5124
5305
  ecosystem: "pip",
5125
5306
  project: projectOf(relativePath),
5126
- manifestPath: (0, import_node_path20.join)(workspaceRoot, relativePath),
5307
+ manifestPath: (0, import_node_path21.join)(workspaceRoot, relativePath),
5127
5308
  section,
5128
5309
  spec: parsed.spec,
5129
5310
  rewritable: parsed.rewritable && parsed.spec !== ""
5130
5311
  });
5131
5312
  };
5132
- const pyprojectPaths = (0, import_node_fs16.globSync)(MANIFEST_GLOBS.pip, { cwd: workspaceRoot });
5313
+ const pyprojectPaths = (0, import_node_fs17.globSync)(MANIFEST_GLOBS.pip, { cwd: workspaceRoot });
5133
5314
  for (const relativePath of pyprojectPaths) {
5134
5315
  let content;
5135
5316
  try {
5136
- content = (0, import_node_fs16.readFileSync)((0, import_node_path20.join)(workspaceRoot, relativePath), "utf8");
5317
+ content = (0, import_node_fs17.readFileSync)((0, import_node_path21.join)(workspaceRoot, relativePath), "utf8");
5137
5318
  } catch {
5138
5319
  continue;
5139
5320
  }
@@ -5144,14 +5325,14 @@ function collectPip(workspaceRoot) {
5144
5325
  }
5145
5326
  const requirementsPaths = [
5146
5327
  "requirements-dev.txt",
5147
- ...(0, import_node_fs16.globSync)("apps/*/requirements.txt", { cwd: workspaceRoot })
5328
+ ...(0, import_node_fs17.globSync)("apps/*/requirements.txt", { cwd: workspaceRoot })
5148
5329
  ];
5149
5330
  for (const relativePath of requirementsPaths) {
5150
- if (!fileExists((0, import_node_path20.join)(workspaceRoot, relativePath))) {
5331
+ if (!fileExists((0, import_node_path21.join)(workspaceRoot, relativePath))) {
5151
5332
  continue;
5152
5333
  }
5153
5334
  const section = relativePath === "requirements-dev.txt" ? "devDep" : "dep";
5154
- const lines = (0, import_node_fs16.readFileSync)((0, import_node_path20.join)(workspaceRoot, relativePath), "utf8").split(/\r?\n/);
5335
+ const lines = (0, import_node_fs17.readFileSync)((0, import_node_path21.join)(workspaceRoot, relativePath), "utf8").split(/\r?\n/);
5155
5336
  for (const line of lines) {
5156
5337
  push(relativePath, section, line);
5157
5338
  }
@@ -5189,11 +5370,11 @@ function pyprojectDependencies(content) {
5189
5370
  }
5190
5371
  function collectPub(workspaceRoot) {
5191
5372
  const sites = [];
5192
- const pubspecPaths = (0, import_node_fs16.globSync)(MANIFEST_GLOBS.pub, { cwd: workspaceRoot });
5373
+ const pubspecPaths = (0, import_node_fs17.globSync)(MANIFEST_GLOBS.pub, { cwd: workspaceRoot });
5193
5374
  for (const relativePath of pubspecPaths) {
5194
5375
  let content;
5195
5376
  try {
5196
- content = (0, import_node_fs16.readFileSync)((0, import_node_path20.join)(workspaceRoot, relativePath), "utf8");
5377
+ content = (0, import_node_fs17.readFileSync)((0, import_node_path21.join)(workspaceRoot, relativePath), "utf8");
5197
5378
  } catch {
5198
5379
  continue;
5199
5380
  }
@@ -5203,7 +5384,7 @@ function collectPub(workspaceRoot) {
5203
5384
  name: entry.name,
5204
5385
  ecosystem: "pub",
5205
5386
  project: projectOf(relativePath),
5206
- manifestPath: (0, import_node_path20.join)(workspaceRoot, relativePath),
5387
+ manifestPath: (0, import_node_path21.join)(workspaceRoot, relativePath),
5207
5388
  section: block === "dependencies" ? "dep" : "devDep",
5208
5389
  spec: entry.spec,
5209
5390
  rewritable: entry.spec !== ""
@@ -5253,11 +5434,11 @@ function stripQuotes(value) {
5253
5434
  }
5254
5435
  function collectNuget(workspaceRoot) {
5255
5436
  const sites = [];
5256
- const csprojPaths = (0, import_node_fs16.globSync)(MANIFEST_GLOBS.nuget, { cwd: workspaceRoot });
5437
+ const csprojPaths = (0, import_node_fs17.globSync)(MANIFEST_GLOBS.nuget, { cwd: workspaceRoot });
5257
5438
  for (const relativePath of csprojPaths) {
5258
5439
  let content;
5259
5440
  try {
5260
- content = (0, import_node_fs16.readFileSync)((0, import_node_path20.join)(workspaceRoot, relativePath), "utf8");
5441
+ content = (0, import_node_fs17.readFileSync)((0, import_node_path21.join)(workspaceRoot, relativePath), "utf8");
5261
5442
  } catch {
5262
5443
  continue;
5263
5444
  }
@@ -5266,7 +5447,7 @@ function collectNuget(workspaceRoot) {
5266
5447
  name: entry.name,
5267
5448
  ecosystem: "nuget",
5268
5449
  project: projectOf(relativePath),
5269
- manifestPath: (0, import_node_path20.join)(workspaceRoot, relativePath),
5450
+ manifestPath: (0, import_node_path21.join)(workspaceRoot, relativePath),
5270
5451
  section: "dep",
5271
5452
  spec: entry.spec,
5272
5453
  // A plain SemVer string is rewritable; an MSBuild property reference
@@ -5291,13 +5472,13 @@ function csprojPackageReferences(content) {
5291
5472
  return entries;
5292
5473
  }
5293
5474
  function collectGo(workspaceRoot) {
5294
- const manifestPath = (0, import_node_path20.join)(workspaceRoot, "go.mod");
5475
+ const manifestPath = (0, import_node_path21.join)(workspaceRoot, "go.mod");
5295
5476
  if (!fileExists(manifestPath)) {
5296
5477
  return [];
5297
5478
  }
5298
5479
  let content;
5299
5480
  try {
5300
- content = (0, import_node_fs16.readFileSync)(manifestPath, "utf8");
5481
+ content = (0, import_node_fs17.readFileSync)(manifestPath, "utf8");
5301
5482
  } catch {
5302
5483
  return [];
5303
5484
  }
@@ -5346,7 +5527,7 @@ var PROJECT_GLOBS = {
5346
5527
  function locateProjects(workspaceRoot) {
5347
5528
  const locations = [];
5348
5529
  for (const ecosystem of ECOSYSTEMS) {
5349
- const relativePaths = (0, import_node_fs16.globSync)(PROJECT_GLOBS[ecosystem], { cwd: workspaceRoot });
5530
+ const relativePaths = (0, import_node_fs17.globSync)(PROJECT_GLOBS[ecosystem], { cwd: workspaceRoot });
5350
5531
  for (const relativePath of relativePaths) {
5351
5532
  const posix = toPosix(relativePath);
5352
5533
  const dir = posix.slice(0, posix.lastIndexOf("/"));
@@ -5354,7 +5535,7 @@ function locateProjects(workspaceRoot) {
5354
5535
  ecosystem,
5355
5536
  dir,
5356
5537
  name: dir.slice(dir.lastIndexOf("/") + 1),
5357
- manifestPath: (0, import_node_path20.join)(workspaceRoot, relativePath)
5538
+ manifestPath: (0, import_node_path21.join)(workspaceRoot, relativePath)
5358
5539
  });
5359
5540
  }
5360
5541
  }
@@ -5375,7 +5556,7 @@ function rewriteSpec(site, spec) {
5375
5556
  writeFileEnsured(site.manifestPath, toJson(manifest));
5376
5557
  return true;
5377
5558
  }
5378
- const before = (0, import_node_fs16.readFileSync)(site.manifestPath, "utf8");
5559
+ const before = (0, import_node_fs17.readFileSync)(site.manifestPath, "utf8");
5379
5560
  const after = (() => {
5380
5561
  switch (site.ecosystem) {
5381
5562
  case "pip": {
@@ -5466,13 +5647,13 @@ function escapeForRegex(value) {
5466
5647
  function isWorkspaceProject(workspaceRoot, name) {
5467
5648
  const short = name.includes("/") ? name.split("/").at(-1) : name;
5468
5649
  return ["apps", "libs", "packages"].some(
5469
- (directory) => fileExists((0, import_node_path20.join)(workspaceRoot, directory, short ?? name, "package.json"))
5650
+ (directory) => fileExists((0, import_node_path21.join)(workspaceRoot, directory, short ?? name, "package.json"))
5470
5651
  );
5471
5652
  }
5472
5653
  function isAliasedInstall(workspaceRoot, name) {
5473
5654
  try {
5474
5655
  const installed = readJson(
5475
- (0, import_node_path20.join)(workspaceRoot, "node_modules", name, "package.json")
5656
+ (0, import_node_path21.join)(workspaceRoot, "node_modules", name, "package.json")
5476
5657
  );
5477
5658
  return installed.name !== void 0 && installed.name !== name;
5478
5659
  } catch {
@@ -5483,14 +5664,14 @@ function resolvedVersion(workspaceRoot, ecosystem, name) {
5483
5664
  if (ecosystem === "npm") {
5484
5665
  try {
5485
5666
  return readJson(
5486
- (0, import_node_path20.join)(workspaceRoot, "node_modules", name, "package.json")
5667
+ (0, import_node_path21.join)(workspaceRoot, "node_modules", name, "package.json")
5487
5668
  ).version;
5488
5669
  } catch {
5489
5670
  return void 0;
5490
5671
  }
5491
5672
  }
5492
5673
  if (ecosystem === "pub") {
5493
- const lockPath = (0, import_node_path20.join)(workspaceRoot, "pubspec.lock");
5674
+ const lockPath = (0, import_node_path21.join)(workspaceRoot, "pubspec.lock");
5494
5675
  if (!fileExists(lockPath)) {
5495
5676
  return void 0;
5496
5677
  }
@@ -5498,7 +5679,7 @@ function resolvedVersion(workspaceRoot, ecosystem, name) {
5498
5679
  const match = new RegExp(
5499
5680
  String.raw`^\s{2}${escapeForRegex(name)}:[^]*?^\s+version:\s*["']?([^"'\s]+)`,
5500
5681
  "m"
5501
- ).exec((0, import_node_fs16.readFileSync)(lockPath, "utf8"));
5682
+ ).exec((0, import_node_fs17.readFileSync)(lockPath, "utf8"));
5502
5683
  return match?.[1];
5503
5684
  } catch {
5504
5685
  return void 0;
@@ -5564,7 +5745,7 @@ function resolveTarget(locations, target) {
5564
5745
  return byName[0];
5565
5746
  }
5566
5747
  function installInto(workspaceRoot, location, packages, saveDev) {
5567
- const projectDir = (0, import_node_path21.join)(workspaceRoot, location.dir);
5748
+ const projectDir = (0, import_node_path22.join)(workspaceRoot, location.dir);
5568
5749
  switch (location.ecosystem) {
5569
5750
  case "npm": {
5570
5751
  const flags = saveDev ? ["--save-dev"] : [];
@@ -5617,7 +5798,7 @@ function installInto(workspaceRoot, location, packages, saveDev) {
5617
5798
  function addPythonDependency(manifestPath, specifier) {
5618
5799
  let content;
5619
5800
  try {
5620
- content = (0, import_node_fs17.readFileSync)(manifestPath, "utf8");
5801
+ content = (0, import_node_fs18.readFileSync)(manifestPath, "utf8");
5621
5802
  } catch {
5622
5803
  logger.warn(`Could not read ${manifestPath} \u2014 skipped ${specifier}`);
5623
5804
  return;
@@ -5646,7 +5827,7 @@ function installEverything(workspaceRoot, only) {
5646
5827
  }
5647
5828
  function ecosystemPresent(workspaceRoot, ecosystem) {
5648
5829
  if (ecosystem === "go") {
5649
- return fileExists((0, import_node_path21.join)(workspaceRoot, "go.work")) || fileExists((0, import_node_path21.join)(workspaceRoot, "go.mod"));
5830
+ return fileExists((0, import_node_path22.join)(workspaceRoot, "go.work")) || fileExists((0, import_node_path22.join)(workspaceRoot, "go.mod"));
5650
5831
  }
5651
5832
  return hasEcosystem(workspaceRoot, ecosystem);
5652
5833
  }
@@ -5665,7 +5846,7 @@ function splitAtLast(value, separator) {
5665
5846
  }
5666
5847
 
5667
5848
  // src/dependency-management/sync-dependencies.use-case.ts
5668
- var import_node_path22 = require("path");
5849
+ var import_node_path23 = require("path");
5669
5850
 
5670
5851
  // src/dependency-management/semver.algorithm.ts
5671
5852
  var UPDATE_KINDS = ["patch", "minor", "major", "non-semver"];
@@ -5842,7 +6023,7 @@ function describe(finding) {
5842
6023
  return `${finding.name} \u2192 ${finding.target} (${finding.reason}); disagreeing: ${sites}`;
5843
6024
  }
5844
6025
  function runSync(workspaceRoot, options) {
5845
- if (!fileExists((0, import_node_path22.join)(workspaceRoot, "nx.json"))) {
6026
+ if (!fileExists((0, import_node_path23.join)(workspaceRoot, "nx.json"))) {
5846
6027
  throw new Error(
5847
6028
  `No nx.json found in ${workspaceRoot} \u2014 run 'mnci sync' from the workspace root.`
5848
6029
  );
@@ -5892,7 +6073,7 @@ function runSync(workspaceRoot, options) {
5892
6073
  }
5893
6074
 
5894
6075
  // src/dependency-management/update-dependencies.use-case.ts
5895
- var import_node_path23 = require("path");
6076
+ var import_node_path24 = require("path");
5896
6077
  var import_prompts2 = require("@inquirer/prompts");
5897
6078
 
5898
6079
  // src/dependency-management/registry.client.ts
@@ -6175,7 +6356,7 @@ function reinstall(workspaceRoot, ecosystems) {
6175
6356
  function hasPythonInstallScript(workspaceRoot) {
6176
6357
  try {
6177
6358
  const manifest = readJson(
6178
- (0, import_node_path23.join)(workspaceRoot, "package.json")
6359
+ (0, import_node_path24.join)(workspaceRoot, "package.json")
6179
6360
  );
6180
6361
  return manifest.scripts?.["python:install"] !== void 0;
6181
6362
  } catch {
@@ -6191,7 +6372,7 @@ function applyGoUpdates(workspaceRoot, entries) {
6191
6372
  }
6192
6373
  }
6193
6374
  async function runUp(workspaceRoot, options) {
6194
- if (!fileExists((0, import_node_path23.join)(workspaceRoot, "nx.json"))) {
6375
+ if (!fileExists((0, import_node_path24.join)(workspaceRoot, "nx.json"))) {
6195
6376
  throw new Error(`No nx.json found in ${workspaceRoot} \u2014 run 'mnci up' from the workspace root.`);
6196
6377
  }
6197
6378
  const ecosystems = resolveEcosystems(options.ecosystem);
@@ -6267,7 +6448,7 @@ var PROJECT_KINDS = [
6267
6448
  ];
6268
6449
  async function runAdd(kind, name, options) {
6269
6450
  const workspaceRoot = process.cwd();
6270
- if (!fileExists((0, import_node_path24.join)(workspaceRoot, "nx.json"))) {
6451
+ if (!fileExists((0, import_node_path25.join)(workspaceRoot, "nx.json"))) {
6271
6452
  throw new Error("No nx.json found here. Run `add` from the workspace root.");
6272
6453
  }
6273
6454
  const stack = readWorkspaceStack(workspaceRoot);
@@ -6327,8 +6508,8 @@ async function runAdd(kind, name, options) {
6327
6508
  ],
6328
6509
  workspaceRoot
6329
6510
  );
6330
- markPrivate((0, import_node_path24.join)(workspaceRoot, "libs", resolvedName, "package.json"));
6331
- renameScaffoldPlaceholder((0, import_node_path24.join)(workspaceRoot, "libs", resolvedName), resolvedName);
6511
+ markPrivate((0, import_node_path25.join)(workspaceRoot, "libs", resolvedName, "package.json"));
6512
+ renameScaffoldPlaceholder((0, import_node_path25.join)(workspaceRoot, "libs", resolvedName), resolvedName);
6332
6513
  removeGeneratedEslintConfig(workspaceRoot, `libs/${resolvedName}`);
6333
6514
  registerProjectCommands(workspaceRoot, resolvedName, { build: true });
6334
6515
  break;
@@ -6420,7 +6601,7 @@ async function runAdd(kind, name, options) {
6420
6601
  }
6421
6602
  function readWorkspaceStack(workspaceRoot) {
6422
6603
  const nxJson = readJson(
6423
- (0, import_node_path24.join)(workspaceRoot, "nx.json")
6604
+ (0, import_node_path25.join)(workspaceRoot, "nx.json")
6424
6605
  );
6425
6606
  const stack = nxJson.mnci?.stack;
6426
6607
  return {
@@ -6430,15 +6611,15 @@ function readWorkspaceStack(workspaceRoot) {
6430
6611
 
6431
6612
  // src/workspace-diagnostics/check-invariants.use-case.ts
6432
6613
  var import_node_child_process = require("child_process");
6433
- var import_node_fs18 = require("fs");
6434
- var import_node_path25 = require("path");
6614
+ var import_node_fs19 = require("fs");
6615
+ var import_node_path26 = require("path");
6435
6616
  var SUPPORTED_ESLINT_MAJOR = ESLINT_VERSION.replace(/^\D*/, "").split(".", 1)[0];
6436
6617
  function toPosix2(path) {
6437
6618
  return path.replaceAll("\\", "/");
6438
6619
  }
6439
6620
  function checkEslintConfigs(workspaceRoot) {
6440
- const rootConfigs = (0, import_node_fs18.globSync)("eslint.config.{js,mjs,cjs,ts,mts,cts}", { cwd: workspaceRoot });
6441
- const projectConfigs = (0, import_node_fs18.globSync)("{apps,libs,packages}/*/eslint.config.{js,mjs,cjs,ts,mts,cts}", {
6621
+ const rootConfigs = (0, import_node_fs19.globSync)("eslint.config.{js,mjs,cjs,ts,mts,cts}", { cwd: workspaceRoot });
6622
+ const projectConfigs = (0, import_node_fs19.globSync)("{apps,libs,packages}/*/eslint.config.{js,mjs,cjs,ts,mts,cts}", {
6442
6623
  cwd: workspaceRoot
6443
6624
  }).map((config) => toPosix2(config));
6444
6625
  return [
@@ -6458,10 +6639,10 @@ function checkEslintConfigs(workspaceRoot) {
6458
6639
  ];
6459
6640
  }
6460
6641
  function checkEslintEntryPointReachesTheRules(workspaceRoot) {
6461
- const rules = (0, import_node_path25.join)(workspaceRoot, ESLINT_MNCI_FILENAME);
6462
- if (!(0, import_node_fs18.existsSync)(rules)) return [];
6463
- const entryPoint = (0, import_node_path25.join)(workspaceRoot, ESLINT_USER_FILENAME);
6464
- const source = (0, import_node_fs18.existsSync)(entryPoint) ? (0, import_node_fs18.readFileSync)(entryPoint, "utf8") : "";
6642
+ const rules = (0, import_node_path26.join)(workspaceRoot, ESLINT_MNCI_FILENAME);
6643
+ if (!(0, import_node_fs19.existsSync)(rules)) return [];
6644
+ const entryPoint = (0, import_node_path26.join)(workspaceRoot, ESLINT_USER_FILENAME);
6645
+ const source = (0, import_node_fs19.existsSync)(entryPoint) ? (0, import_node_fs19.readFileSync)(entryPoint, "utf8") : "";
6465
6646
  return [
6466
6647
  {
6467
6648
  check: `${ESLINT_USER_FILENAME} imports the mnci rules`,
@@ -6474,7 +6655,7 @@ function checkEslintEntryPointReachesTheRules(workspaceRoot) {
6474
6655
  function declaredDevDependencies(workspaceRoot) {
6475
6656
  try {
6476
6657
  const manifest = readJson(
6477
- (0, import_node_path25.join)(workspaceRoot, "package.json")
6658
+ (0, import_node_path26.join)(workspaceRoot, "package.json")
6478
6659
  );
6479
6660
  return manifest.devDependencies ?? {};
6480
6661
  } catch {
@@ -6482,7 +6663,7 @@ function declaredDevDependencies(workspaceRoot) {
6482
6663
  }
6483
6664
  }
6484
6665
  function checkNoRetiredFormatter(workspaceRoot) {
6485
- const files = RETIRED_FORMATTER_FILES.filter((file) => fileExists((0, import_node_path25.join)(workspaceRoot, file)));
6666
+ const files = RETIRED_FORMATTER_FILES.filter((file) => fileExists((0, import_node_path26.join)(workspaceRoot, file)));
6486
6667
  const declared = ["prettier", "eslint-config-prettier", "oxlint", "oxfmt", "@mnci/oxlint-config"].filter((name) => declaredDevDependencies(workspaceRoot)[name] !== void 0);
6487
6668
  const stale = [...files, ...declared];
6488
6669
  if (stale.length === 0) {
@@ -6508,7 +6689,7 @@ function checkEslintPlugin(nxJson) {
6508
6689
  };
6509
6690
  }
6510
6691
  function checkResolvedEslint(workspaceRoot) {
6511
- const manifestPath = (0, import_node_path25.join)(workspaceRoot, "node_modules/eslint/package.json");
6692
+ const manifestPath = (0, import_node_path26.join)(workspaceRoot, "node_modules/eslint/package.json");
6512
6693
  if (!fileExists(manifestPath)) {
6513
6694
  return void 0;
6514
6695
  }
@@ -6526,11 +6707,11 @@ function checkResolvedEslint(workspaceRoot) {
6526
6707
  }
6527
6708
  }
6528
6709
  function checkNpmrc(workspaceRoot, registry, scope) {
6529
- const npmrcPath = (0, import_node_path25.join)(workspaceRoot, ".npmrc");
6710
+ const npmrcPath = (0, import_node_path26.join)(workspaceRoot, ".npmrc");
6530
6711
  if (!registry || !fileExists(npmrcPath)) {
6531
6712
  return void 0;
6532
6713
  }
6533
- const npmrc = (0, import_node_fs18.readFileSync)(npmrcPath, "utf8");
6714
+ const npmrc = (0, import_node_fs19.readFileSync)(npmrcPath, "utf8");
6534
6715
  if (registry.kind === "npm") {
6535
6716
  return {
6536
6717
  check: ".npmrc authenticates the public registry",
@@ -6547,11 +6728,11 @@ function checkNpmrc(workspaceRoot, registry, scope) {
6547
6728
  };
6548
6729
  }
6549
6730
  function checkNpmrcCredentialResolves(workspaceRoot, environment = process.env) {
6550
- const npmrcPath = (0, import_node_path25.join)(workspaceRoot, ".npmrc");
6731
+ const npmrcPath = (0, import_node_path26.join)(workspaceRoot, ".npmrc");
6551
6732
  if (!fileExists(npmrcPath)) {
6552
6733
  return void 0;
6553
6734
  }
6554
- const npmrc = (0, import_node_fs18.readFileSync)(npmrcPath, "utf8");
6735
+ const npmrc = (0, import_node_fs19.readFileSync)(npmrcPath, "utf8");
6555
6736
  const credentials = npmrc.split("\n").filter((line) => !line.trimStart().startsWith(";") && !line.trimStart().startsWith("#")).filter((line) => /(?:_authToken|_password|_auth)\s*=/u.test(line));
6556
6737
  const referenced = [
6557
6738
  ...new Set(
@@ -6575,13 +6756,13 @@ function checkNpmrcCredentialResolves(workspaceRoot, environment = process.env)
6575
6756
  };
6576
6757
  }
6577
6758
  function checkNpmAuthMatchesPipeline(workspaceRoot, registry) {
6578
- const npmrcPath = (0, import_node_path25.join)(workspaceRoot, ".npmrc");
6579
- const pipelinePath = (0, import_node_path25.join)(workspaceRoot, "azure-pipelines.yml");
6759
+ const npmrcPath = (0, import_node_path26.join)(workspaceRoot, ".npmrc");
6760
+ const pipelinePath = (0, import_node_path26.join)(workspaceRoot, "azure-pipelines.yml");
6580
6761
  if (registry?.kind !== "azure-artifacts" || !fileExists(npmrcPath) || !fileExists(pipelinePath)) {
6581
6762
  return void 0;
6582
6763
  }
6583
- const holdsCredentials = (0, import_node_fs18.readFileSync)(npmrcPath, "utf8").split("\n").filter((line) => !line.trimStart().startsWith(";") && !line.trimStart().startsWith("#")).some((line) => /(?:_authToken|_password|_auth)\s*=/u.test(line));
6584
- const runsTask = (0, import_node_fs18.readFileSync)(pipelinePath, "utf8").includes("npmAuthenticate@0");
6764
+ const holdsCredentials = (0, import_node_fs19.readFileSync)(npmrcPath, "utf8").split("\n").filter((line) => !line.trimStart().startsWith(";") && !line.trimStart().startsWith("#")).some((line) => /(?:_authToken|_password|_auth)\s*=/u.test(line));
6765
+ const runsTask = (0, import_node_fs19.readFileSync)(pipelinePath, "utf8").includes("npmAuthenticate@0");
6585
6766
  if (!holdsCredentials && !runsTask) {
6586
6767
  return {
6587
6768
  check: "npm auth: .npmrc and azure-pipelines.yml agree",
@@ -6626,13 +6807,13 @@ function npmjsCredentialShape(credentials, environment) {
6626
6807
  }
6627
6808
  function checkVersionActions(workspaceRoot) {
6628
6809
  const candidates = [
6629
- ...(0, import_node_fs18.globSync)("packages/*/pubspec.yaml", { cwd: workspaceRoot }),
6630
- ...(0, import_node_fs18.globSync)("packages/*/*.csproj", { cwd: workspaceRoot }),
6631
- ...(0, import_node_fs18.globSync)("python-packages/*/pyproject.toml", { cwd: workspaceRoot })
6810
+ ...(0, import_node_fs19.globSync)("packages/*/pubspec.yaml", { cwd: workspaceRoot }),
6811
+ ...(0, import_node_fs19.globSync)("packages/*/*.csproj", { cwd: workspaceRoot }),
6812
+ ...(0, import_node_fs19.globSync)("python-packages/*/pyproject.toml", { cwd: workspaceRoot })
6632
6813
  ].map((manifest) => toPosix2(manifest));
6633
6814
  return candidates.flatMap((manifest) => {
6634
6815
  const projectRoot = manifest.slice(0, manifest.lastIndexOf("/"));
6635
- const projectJsonPath = (0, import_node_path25.join)(workspaceRoot, projectRoot, "project.json");
6816
+ const projectJsonPath = (0, import_node_path26.join)(workspaceRoot, projectRoot, "project.json");
6636
6817
  let hasOverride = false;
6637
6818
  try {
6638
6819
  const projectJson = readJson(projectJsonPath);
@@ -6661,7 +6842,7 @@ function declaredTargets(workspaceRoot, projectRoot) {
6661
6842
  ]) {
6662
6843
  try {
6663
6844
  const targets = extract(
6664
- readJson((0, import_node_path25.join)(workspaceRoot, projectRoot, file))
6845
+ readJson((0, import_node_path26.join)(workspaceRoot, projectRoot, file))
6665
6846
  );
6666
6847
  if (targets && typeof targets === "object") {
6667
6848
  sources.push({
@@ -6677,8 +6858,8 @@ function declaredTargets(workspaceRoot, projectRoot) {
6677
6858
  function checkTargetFilesExist(workspaceRoot) {
6678
6859
  const projectRoots = new Set(
6679
6860
  [
6680
- ...(0, import_node_fs18.globSync)("{apps,libs,packages}/*/project.json", { cwd: workspaceRoot }),
6681
- ...(0, import_node_fs18.globSync)("{apps,libs,packages}/*/package.json", { cwd: workspaceRoot })
6861
+ ...(0, import_node_fs19.globSync)("{apps,libs,packages}/*/project.json", { cwd: workspaceRoot }),
6862
+ ...(0, import_node_fs19.globSync)("{apps,libs,packages}/*/package.json", { cwd: workspaceRoot })
6682
6863
  ].map((manifest) => toPosix2(manifest).split("/").slice(0, 2).join("/"))
6683
6864
  );
6684
6865
  return [...projectRoots].flatMap(
@@ -6693,7 +6874,7 @@ function checkOneTargetsFiles(workspaceRoot, source, targetName, target) {
6693
6874
  return TARGET_FILE_OPTIONS.flatMap((option) => {
6694
6875
  const value = target?.options?.[option];
6695
6876
  const checkable = typeof value === "string" && !value.includes("{");
6696
- if (!checkable || fileExists((0, import_node_path25.join)(workspaceRoot, value))) {
6877
+ if (!checkable || fileExists((0, import_node_path26.join)(workspaceRoot, value))) {
6697
6878
  return [];
6698
6879
  }
6699
6880
  return [
@@ -6730,15 +6911,15 @@ function checkGoPluginRegistered(workspaceRoot) {
6730
6911
  };
6731
6912
  }
6732
6913
  function checkGoWorkInSync(workspaceRoot) {
6733
- const goWorkPath = (0, import_node_path25.join)(workspaceRoot, "go.work");
6914
+ const goWorkPath = (0, import_node_path26.join)(workspaceRoot, "go.work");
6734
6915
  if (!fileExists(goWorkPath)) {
6735
6916
  return void 0;
6736
6917
  }
6737
- const contents = (0, import_node_fs18.existsSync)(goWorkPath) ? (0, import_node_fs18.readFileSync)(goWorkPath, "utf8") : "";
6918
+ const contents = (0, import_node_fs19.existsSync)(goWorkPath) ? (0, import_node_fs19.readFileSync)(goWorkPath, "utf8") : "";
6738
6919
  const blockEntries = Array.from(contents.matchAll(/(?:^|\n)\s*use\s+\(([^)]*)\)/g), (match) => match[1].split("\n")).flat();
6739
6920
  const singleEntries = Array.from(contents.matchAll(/(?:^|\n)\s*use\s+(\.\S+)/g), (match) => match[1]);
6740
6921
  const uses = [...blockEntries, ...singleEntries].map((entry) => entry.trim()).filter(Boolean);
6741
- const stale = uses.filter((entry) => !(0, import_node_fs18.existsSync)((0, import_node_path25.join)(workspaceRoot, entry, "go.mod")));
6922
+ const stale = uses.filter((entry) => !(0, import_node_fs19.existsSync)((0, import_node_path26.join)(workspaceRoot, entry, "go.mod")));
6742
6923
  return {
6743
6924
  check: "every go.work `use` entry points to a module that still exists",
6744
6925
  ok: stale.length === 0,
@@ -6754,9 +6935,9 @@ function checkNativeApps(workspaceRoot) {
6754
6935
  { file: ".github/workflows/ci.yml", marker: "native (${{ matrix.os }})" },
6755
6936
  { file: "azure-pipelines.yml", marker: "- job: native" }
6756
6937
  ];
6757
- const findings = pipelines.filter(({ file }) => fileExists((0, import_node_path25.join)(workspaceRoot, file))).map(({ file, marker }) => ({
6938
+ const findings = pipelines.filter(({ file }) => fileExists((0, import_node_path26.join)(workspaceRoot, file))).map(({ file, marker }) => ({
6758
6939
  check: `${file} builds the native apps on every OS`,
6759
- ok: (0, import_node_fs18.readFileSync)((0, import_node_path25.join)(workspaceRoot, file), "utf8").includes(marker),
6940
+ ok: (0, import_node_fs19.readFileSync)((0, import_node_path26.join)(workspaceRoot, file), "utf8").includes(marker),
6760
6941
  detail: `${file} has no native job: CI would verify a cgo app on the one agent that cannot build it`,
6761
6942
  remedy: "run `mnci upgrade`"
6762
6943
  }));
@@ -6769,7 +6950,7 @@ function checkNativeApps(workspaceRoot) {
6769
6950
  return findings;
6770
6951
  }
6771
6952
  function checkNoRootRuntimeDependencies(workspaceRoot) {
6772
- const manifestPath = (0, import_node_path25.join)(workspaceRoot, "package.json");
6953
+ const manifestPath = (0, import_node_path26.join)(workspaceRoot, "package.json");
6773
6954
  if (!fileExists(manifestPath)) {
6774
6955
  return void 0;
6775
6956
  }
@@ -6789,14 +6970,14 @@ function checkNoRootRuntimeDependencies(workspaceRoot) {
6789
6970
  };
6790
6971
  }
6791
6972
  function checkRollupSourceMaps(workspaceRoot) {
6792
- const configs = (0, import_node_fs18.globSync)(["packages/*/rollup.config.cjs", "libs/*/rollup.config.cjs"], {
6973
+ const configs = (0, import_node_fs19.globSync)(["packages/*/rollup.config.cjs", "libs/*/rollup.config.cjs"], {
6793
6974
  cwd: workspaceRoot
6794
6975
  }).map((config) => toPosix2(config));
6795
6976
  return configs.flatMap((relativePath) => {
6796
- const configPath = (0, import_node_path25.join)(workspaceRoot, relativePath);
6977
+ const configPath = (0, import_node_path26.join)(workspaceRoot, relativePath);
6797
6978
  let config;
6798
6979
  try {
6799
- config = (0, import_node_fs18.readFileSync)(configPath, "utf8");
6980
+ config = (0, import_node_fs19.readFileSync)(configPath, "utf8");
6800
6981
  } catch {
6801
6982
  return [];
6802
6983
  }
@@ -6811,11 +6992,11 @@ function checkRollupSourceMaps(workspaceRoot) {
6811
6992
  });
6812
6993
  }
6813
6994
  function checkDeclarationSpecifiers(workspaceRoot) {
6814
- const configs = (0, import_node_fs18.globSync)(["packages/*/rollup.config.cjs", "libs/*/rollup.config.cjs"], {
6995
+ const configs = (0, import_node_fs19.globSync)(["packages/*/rollup.config.cjs", "libs/*/rollup.config.cjs"], {
6815
6996
  cwd: workspaceRoot
6816
6997
  }).map((config) => toPosix2(config));
6817
6998
  return configs.flatMap((relativePath) => {
6818
- const configPath = (0, import_node_path25.join)(workspaceRoot, relativePath);
6999
+ const configPath = (0, import_node_path26.join)(workspaceRoot, relativePath);
6819
7000
  if (!fileExists(configPath)) {
6820
7001
  return [];
6821
7002
  }
@@ -6849,7 +7030,7 @@ function checkDeclarationSpecifiers(workspaceRoot) {
6849
7030
  });
6850
7031
  }
6851
7032
  function collectFindings(workspaceRoot) {
6852
- const nxJsonPath = (0, import_node_path25.join)(workspaceRoot, "nx.json");
7033
+ const nxJsonPath = (0, import_node_path26.join)(workspaceRoot, "nx.json");
6853
7034
  if (!fileExists(nxJsonPath)) {
6854
7035
  throw new Error(
6855
7036
  `No nx.json found in ${workspaceRoot} \u2014 run 'mnci doctor' from the workspace root.`
@@ -6897,8 +7078,8 @@ function runDoctor(workspaceRoot) {
6897
7078
  }
6898
7079
 
6899
7080
  // src/workspace-creation/adopt-directory.use-case.ts
6900
- var import_node_fs19 = require("fs");
6901
- var import_node_path26 = require("path");
7081
+ var import_node_fs20 = require("fs");
7082
+ var import_node_path27 = require("path");
6902
7083
  var NEVER_COPIED = /* @__PURE__ */ new Set([".git", "node_modules"]);
6903
7084
  var AGENT_AND_CI_ENTRIES = [
6904
7085
  "AGENTS.md",
@@ -6929,13 +7110,13 @@ var PREFLIGHT_BLOCKERS = [
6929
7110
  "packages"
6930
7111
  ];
6931
7112
  function assertAdoptableDirectory(target) {
6932
- if (!(0, import_node_fs19.existsSync)(target)) {
7113
+ if (!(0, import_node_fs20.existsSync)(target)) {
6933
7114
  throw new Error(`--into '${target}' does not exist. Create or clone it first.`);
6934
7115
  }
6935
- if (!(0, import_node_fs19.statSync)(target).isDirectory()) {
7116
+ if (!(0, import_node_fs20.statSync)(target).isDirectory()) {
6936
7117
  throw new Error(`--into '${target}' is not a directory.`);
6937
7118
  }
6938
- const blockers = PREFLIGHT_BLOCKERS.filter((entry) => (0, import_node_fs19.existsSync)((0, import_node_path26.join)(target, entry)));
7119
+ const blockers = PREFLIGHT_BLOCKERS.filter((entry) => (0, import_node_fs20.existsSync)((0, import_node_path27.join)(target, entry)));
6939
7120
  if (blockers.length > 0) {
6940
7121
  throw new Error(
6941
7122
  `--into '${target}' already holds ${blockers.join(", ")}, so it is a project already. Use \`mnci upgrade\` to re-apply the overlay to an existing workspace, or point --into at an empty checkout.`
@@ -6943,15 +7124,15 @@ function assertAdoptableDirectory(target) {
6943
7124
  }
6944
7125
  }
6945
7126
  function mergeGitignore(generatedFile, targetFile) {
6946
- const existing = (0, import_node_fs19.readFileSync)(targetFile, "utf8");
7127
+ const existing = (0, import_node_fs20.readFileSync)(targetFile, "utf8");
6947
7128
  const present = new Set(existing.split("\n").map((line) => line.trim()));
6948
- const additions = (0, import_node_fs19.readFileSync)(generatedFile, "utf8").split("\n").map((line) => line.trimEnd()).filter((line) => {
7129
+ const additions = (0, import_node_fs20.readFileSync)(generatedFile, "utf8").split("\n").map((line) => line.trimEnd()).filter((line) => {
6949
7130
  const trimmed = line.trim();
6950
7131
  return trimmed !== "" && !trimmed.startsWith("#") && !present.has(trimmed);
6951
7132
  });
6952
7133
  if (additions.length === 0) return false;
6953
7134
  const separator = existing.endsWith("\n") ? "" : "\n";
6954
- (0, import_node_fs19.writeFileSync)(
7135
+ (0, import_node_fs20.writeFileSync)(
6955
7136
  targetFile,
6956
7137
  `${existing}${separator}
6957
7138
  # Added by mnci (Nx workspace)
@@ -6961,9 +7142,9 @@ ${additions.join("\n")}
6961
7142
  return true;
6962
7143
  }
6963
7144
  function adoptGeneratedWorkspace(generatedRoot, target) {
6964
- const entries = (0, import_node_fs19.readdirSync)(generatedRoot).filter((entry) => !NEVER_COPIED.has(entry));
7145
+ const entries = (0, import_node_fs20.readdirSync)(generatedRoot).filter((entry) => !NEVER_COPIED.has(entry));
6965
7146
  const collisions = entries.filter(
6966
- (entry) => (0, import_node_fs19.existsSync)((0, import_node_path26.join)(target, entry)) && !EXISTING_WINS.has(entry) && entry !== ".gitignore"
7147
+ (entry) => (0, import_node_fs20.existsSync)((0, import_node_path27.join)(target, entry)) && !EXISTING_WINS.has(entry) && entry !== ".gitignore"
6967
7148
  );
6968
7149
  if (collisions.length > 0) {
6969
7150
  throw new Error(
@@ -6972,28 +7153,28 @@ function adoptGeneratedWorkspace(generatedRoot, target) {
6972
7153
  }
6973
7154
  const result = { copied: [], kept: [], mergedGitignore: false };
6974
7155
  for (const entry of entries) {
6975
- const from = (0, import_node_path26.join)(generatedRoot, entry);
6976
- const to = (0, import_node_path26.join)(target, entry);
6977
- if (entry === ".gitignore" && (0, import_node_fs19.existsSync)(to)) {
7156
+ const from = (0, import_node_path27.join)(generatedRoot, entry);
7157
+ const to = (0, import_node_path27.join)(target, entry);
7158
+ if (entry === ".gitignore" && (0, import_node_fs20.existsSync)(to)) {
6978
7159
  result.mergedGitignore = mergeGitignore(from, to);
6979
7160
  result.kept.push(entry);
6980
7161
  continue;
6981
7162
  }
6982
- if ((0, import_node_fs19.existsSync)(to)) {
7163
+ if ((0, import_node_fs20.existsSync)(to)) {
6983
7164
  result.kept.push(entry);
6984
7165
  continue;
6985
7166
  }
6986
- (0, import_node_fs19.cpSync)(from, to, { recursive: true });
7167
+ (0, import_node_fs20.cpSync)(from, to, { recursive: true });
6987
7168
  result.copied.push(entry);
6988
7169
  }
6989
- (0, import_node_fs19.rmSync)(generatedRoot, { recursive: true, force: true });
7170
+ (0, import_node_fs20.rmSync)(generatedRoot, { recursive: true, force: true });
6990
7171
  return result;
6991
7172
  }
6992
7173
 
6993
7174
  // src/workspace-creation/create-workspace.use-case.ts
6994
- var import_node_fs20 = require("fs");
7175
+ var import_node_fs21 = require("fs");
6995
7176
  var import_node_os = require("os");
6996
- var import_node_path27 = require("path");
7177
+ var import_node_path28 = require("path");
6997
7178
  function nxCloudProviderValue(ci) {
6998
7179
  return ci === "azure" ? "azure" : "github";
6999
7180
  }
@@ -7036,9 +7217,9 @@ async function resolveRegistry(options) {
7036
7217
  return await promptRegistry();
7037
7218
  }
7038
7219
  async function runNew(name, options) {
7039
- const adoptTarget = options.into === void 0 ? void 0 : (0, import_node_path27.resolve)(process.cwd(), options.into);
7220
+ const adoptTarget = options.into === void 0 ? void 0 : (0, import_node_path28.resolve)(process.cwd(), options.into);
7040
7221
  if (adoptTarget !== void 0) assertAdoptableDirectory(adoptTarget);
7041
- const workspaceName = name ?? (adoptTarget === void 0 ? await promptText("Workspace name") : (0, import_node_path27.basename)(adoptTarget));
7222
+ const workspaceName = name ?? (adoptTarget === void 0 ? await promptText("Workspace name") : (0, import_node_path28.basename)(adoptTarget));
7042
7223
  assertValidProjectName(workspaceName, "Workspace name");
7043
7224
  const scope = options.scope ?? (options.yes ? `@${workspaceName}` : await promptText("npm scope for publishable packages", `@${workspaceName}`));
7044
7225
  const registry = await resolveRegistry(options);
@@ -7051,8 +7232,8 @@ async function runNew(name, options) {
7051
7232
  const npmAuth = resolveNpmAuth(options.npmAuth, registry, ci);
7052
7233
  const stack = await resolveStack(options);
7053
7234
  const nxCloud = options.nxCloud ?? (options.yes ? false : await promptNxCloud());
7054
- const stagingParent = adoptTarget === void 0 ? process.cwd() : (0, import_node_fs20.mkdtempSync)((0, import_node_path27.join)((0, import_node_os.tmpdir)(), "mnci-new-"));
7055
- let workspaceRoot = (0, import_node_path27.join)(stagingParent, workspaceName);
7235
+ const stagingParent = adoptTarget === void 0 ? process.cwd() : (0, import_node_fs21.mkdtempSync)((0, import_node_path28.join)((0, import_node_os.tmpdir)(), "mnci-new-"));
7236
+ let workspaceRoot = (0, import_node_path28.join)(stagingParent, workspaceName);
7056
7237
  try {
7057
7238
  logger.step(`Creating Nx workspace '${workspaceName}' (preset: ts)`);
7058
7239
  runNpx(
@@ -7075,7 +7256,7 @@ async function runNew(name, options) {
7075
7256
  workspaceRoot = adoptTarget;
7076
7257
  }
7077
7258
  } finally {
7078
- if (adoptTarget !== void 0) (0, import_node_fs20.rmSync)(stagingParent, { recursive: true, force: true });
7259
+ if (adoptTarget !== void 0) (0, import_node_fs21.rmSync)(stagingParent, { recursive: true, force: true });
7079
7260
  }
7080
7261
  logger.step(
7081
7262
  "Applying MoNecromanCI overlay (VS Code workspace, release config, .npmrc, commitlint, pipeline, stack)"
@@ -7085,8 +7266,8 @@ async function runNew(name, options) {
7085
7266
  { workspaceName, scope, registry, agent, variableGroup, ci, stack, ...npmAuth && { npmAuth } },
7086
7267
  logger.detail
7087
7268
  );
7088
- (0, import_node_fs20.rmSync)((0, import_node_path27.join)(workspaceRoot, "node_modules"), { recursive: true, force: true });
7089
- (0, import_node_fs20.rmSync)((0, import_node_path27.join)(workspaceRoot, "package-lock.json"), { force: true });
7269
+ (0, import_node_fs21.rmSync)((0, import_node_path28.join)(workspaceRoot, "node_modules"), { recursive: true, force: true });
7270
+ (0, import_node_fs21.rmSync)((0, import_node_path28.join)(workspaceRoot, "package-lock.json"), { force: true });
7090
7271
  logger.step("Installing the toolchain (commitlint + husky + linting/formatting)");
7091
7272
  const installStatus = runShell(
7092
7273
  "npm",
@@ -7124,12 +7305,12 @@ function projectKindHintLines(kinds = PROJECT_KINDS) {
7124
7305
  }
7125
7306
 
7126
7307
  // src/workspace-creation/interactive-wizard.use-case.ts
7127
- var import_node_path29 = require("path");
7308
+ var import_node_path30 = require("path");
7128
7309
  var import_prompts4 = require("@inquirer/prompts");
7129
7310
 
7130
7311
  // src/workspace-upgrade/upgrade-workspace.use-case.ts
7131
- var import_node_fs21 = require("fs");
7132
- var import_node_path28 = require("path");
7312
+ var import_node_fs22 = require("fs");
7313
+ var import_node_path29 = require("path");
7133
7314
  function resolveRegistry2(options, persisted) {
7134
7315
  if (options.registry === "azure-artifacts" || options.organization && options.artifactsFeed) {
7135
7316
  const persistedAzure = persisted?.kind === "azure-artifacts" ? persisted : void 0;
@@ -7158,7 +7339,7 @@ function resolveWorkspaceName(workspaceRoot, persisted) {
7158
7339
  return persisted.workspaceName;
7159
7340
  }
7160
7341
  try {
7161
- const existing = (0, import_node_fs21.readdirSync)(workspaceRoot).find(
7342
+ const existing = (0, import_node_fs22.readdirSync)(workspaceRoot).find(
7162
7343
  (file) => file.endsWith(".code-workspace") && file !== "undefined.code-workspace"
7163
7344
  );
7164
7345
  if (existing) {
@@ -7166,11 +7347,11 @@ function resolveWorkspaceName(workspaceRoot, persisted) {
7166
7347
  }
7167
7348
  } catch {
7168
7349
  }
7169
- return (0, import_node_path28.basename)(workspaceRoot);
7350
+ return (0, import_node_path29.basename)(workspaceRoot);
7170
7351
  }
7171
7352
  function detectNpmAuth(workspaceRoot) {
7172
7353
  try {
7173
- return (0, import_node_fs21.readFileSync)((0, import_node_path28.join)(workspaceRoot, "azure-pipelines.yml"), "utf8").includes("npmAuthenticate@0") ? "build-identity" : void 0;
7354
+ return (0, import_node_fs22.readFileSync)((0, import_node_path29.join)(workspaceRoot, "azure-pipelines.yml"), "utf8").includes("npmAuthenticate@0") ? "build-identity" : void 0;
7174
7355
  } catch {
7175
7356
  return void 0;
7176
7357
  }
@@ -7217,7 +7398,7 @@ function resolveOverlayOptions(workspaceRoot, options, persisted) {
7217
7398
  };
7218
7399
  }
7219
7400
  function runUpgrade(workspaceRoot, options) {
7220
- if (!fileExists((0, import_node_path28.join)(workspaceRoot, "nx.json"))) {
7401
+ if (!fileExists((0, import_node_path29.join)(workspaceRoot, "nx.json"))) {
7221
7402
  throw new Error(
7222
7403
  `No nx.json found in ${workspaceRoot} \u2014 this does not look like an Nx workspace. Run 'mnci upgrade' from the workspace root.`
7223
7404
  );
@@ -7282,7 +7463,7 @@ function runUpgrade(workspaceRoot, options) {
7282
7463
 
7283
7464
  // src/workspace-creation/interactive-wizard.use-case.ts
7284
7465
  async function runInteractive() {
7285
- const inWorkspace = fileExists((0, import_node_path29.join)(process.cwd(), "nx.json"));
7466
+ const inWorkspace = fileExists((0, import_node_path30.join)(process.cwd(), "nx.json"));
7286
7467
  const choiceNew = { name: "Create a new monorepo", value: "new" };
7287
7468
  const choiceAdd = { name: "Add a project to this workspace", value: "add" };
7288
7469
  const choiceUpgrade = {
@@ -7303,8 +7484,8 @@ async function runInteractive() {
7303
7484
  }
7304
7485
 
7305
7486
  // src/cli-version/check-for-update.use-case.ts
7306
- var import_node_fs22 = require("fs");
7307
- var import_node_path30 = require("path");
7487
+ var import_node_fs23 = require("fs");
7488
+ var import_node_path31 = require("path");
7308
7489
  var import_cross_spawn2 = __toESM(require("cross-spawn"));
7309
7490
  var PACKAGE_NAME = "@mnci/cli";
7310
7491
  var REGISTRY_TIMEOUT_MS = 2e3;
@@ -7360,8 +7541,8 @@ function releaseTriple(version) {
7360
7541
  }
7361
7542
  function readCliVersion(packageDirectory) {
7362
7543
  try {
7363
- const manifestPath = (0, import_node_path30.join)(packageDirectory, "..", "package.json");
7364
- const manifest = JSON.parse((0, import_node_fs22.readFileSync)(manifestPath, "utf8"));
7544
+ const manifestPath = (0, import_node_path31.join)(packageDirectory, "..", "package.json");
7545
+ const manifest = JSON.parse((0, import_node_fs23.readFileSync)(manifestPath, "utf8"));
7365
7546
  return manifest.version ?? "0.0.0";
7366
7547
  } catch {
7367
7548
  return "0.0.0";
@@ -7402,8 +7583,8 @@ function buildProgram(cliVersion) {
7402
7583
  });
7403
7584
  program.command("ci").addArgument(new import_commander.Argument("<phase>", "which phase of the pipeline to run").choices(CI_PHASES)).description(
7404
7585
  "Run a phase of the CI pipeline here, the same way CI runs it: `verify` is the sync check and then every project (or, in a pull request, the affected ones) through lint, typecheck, test and build. Exits non-zero when it fails"
7405
- ).action((phase) => {
7406
- process.exitCode = runCiPhase(phase, process.cwd());
7586
+ ).action(async (phase) => {
7587
+ process.exitCode = await runCiPhase(phase, process.cwd());
7407
7588
  });
7408
7589
  program.command("sync").description(
7409
7590
  "Make every project agree: converge external dependency ranges declared at more than one version, then run 'nx sync' for TypeScript project references. Go is a no-op \u2014 one root go.mod means one version of every module"