@mnci/cli 4.33.0 → 4.35.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
@@ -37,9 +37,10 @@ __export(main_exports, {
37
37
  module.exports = __toCommonJS(main_exports);
38
38
  var import_commander = require("commander");
39
39
 
40
- // src/ci-pipeline/native.use-case.ts
41
- var import_node_fs3 = require("fs");
42
- var import_node_path3 = require("path");
40
+ // src/ci-pipeline/audit.use-case.ts
41
+ var import_node_fs2 = require("fs");
42
+ var import_node_path = require("path");
43
+ var import_cross_spawn2 = __toESM(require("cross-spawn"));
43
44
 
44
45
  // src/nx-workspace/nx.client.ts
45
46
  var import_cross_spawn = __toESM(require("cross-spawn"));
@@ -206,15 +207,151 @@ function runFormatter(cwd, target = ".") {
206
207
  }
207
208
  }
208
209
 
210
+ // src/ci-pipeline/ci-environment.client.ts
211
+ var import_node_fs = require("fs");
212
+ function detectCiHost(environment) {
213
+ if (environment.GITHUB_ACTIONS === "true") {
214
+ return "github";
215
+ }
216
+ if (environment.TF_BUILD !== void 0 && environment.TF_BUILD !== "") {
217
+ return "azure";
218
+ }
219
+ return "local";
220
+ }
221
+ function pullRequestTarget(environment) {
222
+ const reference = environment.GITHUB_BASE_REF || environment.SYSTEM_PULLREQUEST_TARGETBRANCH || "";
223
+ return reference === "" ? void 0 : reference.replace("refs/heads/", "");
224
+ }
225
+ function isMainPush(environment) {
226
+ if (environment.GITHUB_ACTIONS === "true") {
227
+ return environment.GITHUB_EVENT_NAME === "push" && environment.GITHUB_REF_NAME === "main";
228
+ }
229
+ return environment.TF_BUILD !== void 0 && environment.TF_BUILD !== "" && ["IndividualCI", "BatchedCI"].includes(environment.BUILD_REASON ?? "") && environment.BUILD_SOURCEBRANCHNAME === "main";
230
+ }
231
+ function addToPath(host, environment, directory, log) {
232
+ if (host === "azure") {
233
+ log(`##vso[task.prependpath]${directory}`);
234
+ return;
235
+ }
236
+ if (host === "github" && environment.GITHUB_PATH) {
237
+ (0, import_node_fs.appendFileSync)(environment.GITHUB_PATH, `${directory}
238
+ `);
239
+ return;
240
+ }
241
+ log("Not running in a CI that reads a PATH file - skipping.");
242
+ }
243
+ function groupStart(host, title) {
244
+ switch (host) {
245
+ case "github": {
246
+ return `::group::${title}`;
247
+ }
248
+ case "azure": {
249
+ return `##[group]${title}`;
250
+ }
251
+ case "local": {
252
+ return `
253
+ \u25B8 ${title}`;
254
+ }
255
+ }
256
+ }
257
+ function groupEnd(host) {
258
+ switch (host) {
259
+ case "github": {
260
+ return "::endgroup::";
261
+ }
262
+ case "azure": {
263
+ return "##[endgroup]";
264
+ }
265
+ case "local": {
266
+ return void 0;
267
+ }
268
+ }
269
+ }
270
+
271
+ // src/ci-pipeline/audit.use-case.ts
272
+ var BLOCKING_SEVERITIES = /* @__PURE__ */ new Set(["critical", "high", "moderate"]);
273
+ var AUDIT_MAX_BUFFER = 32 * 1024 * 1024;
274
+ function onlyMajorFix(advisory) {
275
+ return typeof advisory.fixAvailable === "object" && advisory.fixAvailable.isSemVerMajor === true;
276
+ }
277
+ function classifyNpmAudit(report) {
278
+ const all = Object.values(report.vulnerabilities ?? {});
279
+ const blocking = all.filter((advisory) => Boolean(advisory.fixAvailable) && BLOCKING_SEVERITIES.has(advisory.severity) && !onlyMajorFix(advisory));
280
+ const notes = all.filter((advisory) => !blocking.includes(advisory)).map((advisory) => {
281
+ const why = advisory.fixAvailable ? onlyMajorFix(advisory) ? " - only a semver-major change would remove it (often a parent downgrade), not applied automatically" : " - fix available, below the blocking threshold" : " - NO fix available upstream, nothing to do here";
282
+ return ` note [${advisory.severity}] ${advisory.name}${why}`;
283
+ });
284
+ return { blocking, total: all.length, notes };
285
+ }
286
+ function auditNpm(result, log) {
287
+ let report;
288
+ try {
289
+ report = JSON.parse(result.stdout);
290
+ } catch {
291
+ log(`npm audit produced no JSON (exit ${result.status}) - not blocking on a broken audit.`);
292
+ return 0;
293
+ }
294
+ const { blocking, total, notes } = classifyNpmAudit(report);
295
+ for (const note of notes) {
296
+ log(note);
297
+ }
298
+ if (blocking.length === 0) {
299
+ log(`npm audit - ${total} advisory(ies), none actionable at moderate or above.`);
300
+ return 0;
301
+ }
302
+ for (const advisory of blocking) {
303
+ log(` BLOCKING [${advisory.severity}] ${advisory.name} - fix available`);
304
+ }
305
+ log("Each has a published fix. Add a targeted overrides entry in package.json rather than npm audit fix --force.");
306
+ return 1;
307
+ }
308
+ function runAudit(workspaceRoot, dependencies = {}) {
309
+ const environment = dependencies.environment ?? process.env;
310
+ const processes = dependencies.processes ?? {
311
+ run: (command, arguments_) => runShell(command, arguments_, workspaceRoot),
312
+ capture: (command, arguments_) => {
313
+ const result = import_cross_spawn2.default.sync(command, arguments_, { cwd: workspaceRoot, encoding: "utf8", maxBuffer: AUDIT_MAX_BUFFER });
314
+ return { status: result.status ?? 1, stdout: result.stdout ?? "" };
315
+ }
316
+ };
317
+ const log = dependencies.log ?? ((message) => {
318
+ console.log(message);
319
+ });
320
+ const host = detectCiHost(environment);
321
+ const closeGroup = () => {
322
+ const closing = groupEnd(host);
323
+ if (closing !== void 0) {
324
+ log(closing);
325
+ }
326
+ };
327
+ log(groupStart(host, "npm audit"));
328
+ const npm = auditNpm(processes.capture("npm", ["audit", "--json"]), log);
329
+ closeGroup();
330
+ if (npm !== 0) {
331
+ return npm;
332
+ }
333
+ if (!(0, import_node_fs2.existsSync)((0, import_node_path.join)(workspaceRoot, "requirements-dev.txt"))) {
334
+ return 0;
335
+ }
336
+ log(groupStart(host, "pip-audit (non-blocking)"));
337
+ processes.run(process.platform === "win32" ? "python" : "python3", ["-m", "pip_audit"]);
338
+ closeGroup();
339
+ return 0;
340
+ }
341
+
342
+ // src/ci-pipeline/native.use-case.ts
343
+ var import_node_fs5 = require("fs");
344
+ var import_node_path4 = require("path");
345
+
209
346
  // src/workspace-overlay/overlay.use-case.ts
210
- var import_node_fs2 = require("fs");
211
- var import_node_path2 = require("path");
347
+ var import_node_fs4 = require("fs");
348
+ var import_node_path3 = require("path");
212
349
 
213
350
  // src/file-system/file-system.client.ts
214
- var import_node_fs = require("fs");
215
- var import_node_path = require("path");
351
+ var import_node_fs3 = require("fs");
352
+ var import_node_path2 = require("path");
216
353
  function readJson(path) {
217
- return JSON.parse((0, import_node_fs.readFileSync)(path, "utf8"));
354
+ return JSON.parse((0, import_node_fs3.readFileSync)(path, "utf8"));
218
355
  }
219
356
  function stripJsonComments(text) {
220
357
  let result = "";
@@ -271,7 +408,7 @@ function stripJsonComments(text) {
271
408
  }
272
409
  function readCodeWorkspace(path) {
273
410
  try {
274
- const withoutComments = stripJsonComments((0, import_node_fs.readFileSync)(path, "utf8"));
411
+ const withoutComments = stripJsonComments((0, import_node_fs3.readFileSync)(path, "utf8"));
275
412
  return JSON.parse(withoutComments.replaceAll(/,(\s*[}\]])/g, "$1"));
276
413
  } catch {
277
414
  return void 0;
@@ -282,14 +419,14 @@ function toJson(value) {
282
419
  `;
283
420
  }
284
421
  function writeFileEnsured(path, content) {
285
- (0, import_node_fs.mkdirSync)((0, import_node_path.dirname)(path), { recursive: true });
286
- (0, import_node_fs.writeFileSync)(path, content);
422
+ (0, import_node_fs3.mkdirSync)((0, import_node_path2.dirname)(path), { recursive: true });
423
+ (0, import_node_fs3.writeFileSync)(path, content);
287
424
  }
288
425
  function markExecutable(path) {
289
- (0, import_node_fs.chmodSync)(path, 493);
426
+ (0, import_node_fs3.chmodSync)(path, 493);
290
427
  }
291
428
  function fileExists(path) {
292
- return (0, import_node_fs.existsSync)(path);
429
+ return (0, import_node_fs3.existsSync)(path);
293
430
  }
294
431
 
295
432
  // src/workspace-overlay/overlay.use-case.ts
@@ -432,9 +569,9 @@ var VSCODE_EXTENSION_TAG = "type:vscode-extension";
432
569
  var GO_RELEASE_TAG = "release:go";
433
570
  var GO_CGO_TAG = "build:cgo";
434
571
  function hasNativeGoApp(workspaceRoot) {
435
- return (0, import_node_fs2.globSync)("apps/*/project.json", { cwd: workspaceRoot }).some((projectJson) => {
572
+ return (0, import_node_fs4.globSync)("apps/*/project.json", { cwd: workspaceRoot }).some((projectJson) => {
436
573
  try {
437
- const { tags } = JSON.parse((0, import_node_fs2.readFileSync)((0, import_node_path2.join)(workspaceRoot, projectJson), "utf8"));
574
+ const { tags } = JSON.parse((0, import_node_fs4.readFileSync)((0, import_node_path3.join)(workspaceRoot, projectJson), "utf8"));
438
575
  return (tags ?? []).includes(GO_CGO_TAG);
439
576
  } catch {
440
577
  return false;
@@ -558,6 +695,10 @@ var ESLINT_CONFIG_VERSION = ">=0.1.0 <1.0.0";
558
695
  function eslintConfigSpec() {
559
696
  return process.env.MNCI_ESLINT_CONFIG_SPEC ?? ESLINT_CONFIG_VERSION;
560
697
  }
698
+ var CLI_VERSION = ">=4.0.0 <5.0.0";
699
+ function cliSpec() {
700
+ return process.env.MNCI_CLI_SPEC ?? CLI_VERSION;
701
+ }
561
702
  var ESLINT_VERSION = "^10.8.0";
562
703
  function devcontainerJson(workspaceName) {
563
704
  return `${toJson({
@@ -649,6 +790,9 @@ function eslintToolchainDependencies(nxVersion) {
649
790
  "@mnci/eslint-config": eslintConfigSpec()
650
791
  };
651
792
  }
793
+ function mnciToolchainDependencies(nxVersion) {
794
+ return { ...eslintToolchainDependencies(nxVersion), "@mnci/cli": cliSpec() };
795
+ }
652
796
  var RETIRED_FORMATTER_FILES = [
653
797
  ".prettierrc",
654
798
  ".prettierrc.json",
@@ -775,8 +919,8 @@ function isUnmodifiedMnciEslintConfig(content) {
775
919
  return code.length === 2 && code[0] === "import mnci from '@mnci/eslint-config'" && code[1] === "export default mnci({ workspaceRoot: import.meta.dirname })";
776
920
  }
777
921
  function writeEslintEntryPoint(workspaceRoot, onProgress) {
778
- const path = (0, import_node_path2.join)(workspaceRoot, ESLINT_USER_FILENAME);
779
- if ((0, import_node_fs2.existsSync)(path) && !isUnmodifiedMnciEslintConfig((0, import_node_fs2.readFileSync)(path, "utf8"))) {
922
+ const path = (0, import_node_path3.join)(workspaceRoot, ESLINT_USER_FILENAME);
923
+ if ((0, import_node_fs4.existsSync)(path) && !isUnmodifiedMnciEslintConfig((0, import_node_fs4.readFileSync)(path, "utf8"))) {
780
924
  onProgress(`${ESLINT_USER_FILENAME} \u2014 kept as it is, it is yours`);
781
925
  return;
782
926
  }
@@ -944,7 +1088,7 @@ function mnciConfig(options) {
944
1088
  };
945
1089
  }
946
1090
  function readMnciConfig(workspaceRoot) {
947
- const nxJson = readJson((0, import_node_path2.join)(workspaceRoot, "nx.json"));
1091
+ const nxJson = readJson((0, import_node_path3.join)(workspaceRoot, "nx.json"));
948
1092
  return nxJson.mnci ?? {};
949
1093
  }
950
1094
  function pythonPublishUrl(registry) {
@@ -1872,12 +2016,12 @@ var ECOSYSTEM_MANIFESTS = {
1872
2016
  };
1873
2017
  function hasEcosystemProject(workspaceRoot, roots, manifests) {
1874
2018
  return roots.some((root) => {
1875
- const base = (0, import_node_path2.join)(workspaceRoot, root);
1876
- if (!(0, import_node_fs2.existsSync)(base)) {
2019
+ const base = (0, import_node_path3.join)(workspaceRoot, root);
2020
+ if (!(0, import_node_fs4.existsSync)(base)) {
1877
2021
  return false;
1878
2022
  }
1879
- return (0, import_node_fs2.readdirSync)(base, { withFileTypes: true }).some(
1880
- (entry) => entry.isDirectory() && manifests.some((manifest) => (0, import_node_fs2.existsSync)((0, import_node_path2.join)(base, entry.name, manifest)))
2023
+ return (0, import_node_fs4.readdirSync)(base, { withFileTypes: true }).some(
2024
+ (entry) => entry.isDirectory() && manifests.some((manifest) => (0, import_node_fs4.existsSync)((0, import_node_path3.join)(base, entry.name, manifest)))
1881
2025
  );
1882
2026
  });
1883
2027
  }
@@ -1955,11 +2099,11 @@ var LOCAL_REGISTRY_SCAFFOLDING = {
1955
2099
  rootTarget: "local-registry"
1956
2100
  };
1957
2101
  function removeLocalRegistryScaffolding(workspaceRoot) {
1958
- (0, import_node_fs2.rmSync)((0, import_node_path2.join)(workspaceRoot, LOCAL_REGISTRY_SCAFFOLDING.directory), {
2102
+ (0, import_node_fs4.rmSync)((0, import_node_path3.join)(workspaceRoot, LOCAL_REGISTRY_SCAFFOLDING.directory), {
1959
2103
  recursive: true,
1960
2104
  force: true
1961
2105
  });
1962
- const manifestPath = (0, import_node_path2.join)(workspaceRoot, "package.json");
2106
+ const manifestPath = (0, import_node_path3.join)(workspaceRoot, "package.json");
1963
2107
  if (!fileExists(manifestPath)) return;
1964
2108
  const manifest = readJson(manifestPath);
1965
2109
  if (manifest.devDependencies?.[LOCAL_REGISTRY_SCAFFOLDING.devDependency] !== void 0) {
@@ -1975,23 +2119,23 @@ function removeLocalRegistryScaffolding(workspaceRoot) {
1975
2119
  }
1976
2120
  function removeNxScaffolding(workspaceRoot) {
1977
2121
  for (const entry of NX_SCAFFOLDING_TO_REMOVE) {
1978
- (0, import_node_fs2.rmSync)((0, import_node_path2.join)(workspaceRoot, entry), { recursive: true, force: true });
2122
+ (0, import_node_fs4.rmSync)((0, import_node_path3.join)(workspaceRoot, entry), { recursive: true, force: true });
1979
2123
  }
1980
2124
  removeNxAuthoredAgentFiles(workspaceRoot);
1981
2125
  removeProjectEslintConfigs(workspaceRoot);
1982
2126
  }
1983
2127
  function removeNxAuthoredAgentFiles(workspaceRoot) {
1984
- (0, import_node_fs2.rmSync)((0, import_node_path2.join)(workspaceRoot, NX_CLAUDE_SETTINGS), { force: true });
1985
- const claudeDirectory = (0, import_node_path2.join)(workspaceRoot, (0, import_node_path2.dirname)(NX_CLAUDE_SETTINGS));
1986
- if ((0, import_node_fs2.existsSync)(claudeDirectory) && (0, import_node_fs2.readdirSync)(claudeDirectory).length === 0) {
1987
- (0, import_node_fs2.rmSync)(claudeDirectory, { recursive: true, force: true });
2128
+ (0, import_node_fs4.rmSync)((0, import_node_path3.join)(workspaceRoot, NX_CLAUDE_SETTINGS), { force: true });
2129
+ const claudeDirectory = (0, import_node_path3.join)(workspaceRoot, (0, import_node_path3.dirname)(NX_CLAUDE_SETTINGS));
2130
+ if ((0, import_node_fs4.existsSync)(claudeDirectory) && (0, import_node_fs4.readdirSync)(claudeDirectory).length === 0) {
2131
+ (0, import_node_fs4.rmSync)(claudeDirectory, { recursive: true, force: true });
1988
2132
  }
1989
2133
  for (const name of NX_AUTHORED_AGENT_FILES) {
1990
- const path = (0, import_node_path2.join)(workspaceRoot, name);
1991
- if (!(0, import_node_fs2.existsSync)(path)) continue;
1992
- const kept = withoutNxAgentRules((0, import_node_fs2.readFileSync)(path, "utf8"));
2134
+ const path = (0, import_node_path3.join)(workspaceRoot, name);
2135
+ if (!(0, import_node_fs4.existsSync)(path)) continue;
2136
+ const kept = withoutNxAgentRules((0, import_node_fs4.readFileSync)(path, "utf8"));
1993
2137
  if (kept === void 0) continue;
1994
- if (kept.trim() === "") (0, import_node_fs2.rmSync)(path, { force: true });
2138
+ if (kept.trim() === "") (0, import_node_fs4.rmSync)(path, { force: true });
1995
2139
  else writeFileEnsured(path, kept);
1996
2140
  }
1997
2141
  }
@@ -2006,14 +2150,14 @@ function withoutNxAgentRules(content) {
2006
2150
  return `${content.slice(0, start)}${rest}`.replace(/^[\r\n]+/, "");
2007
2151
  }
2008
2152
  function removeIfPresent(path) {
2009
- (0, import_node_fs2.rmSync)(path, { recursive: true, force: true });
2153
+ (0, import_node_fs4.rmSync)(path, { recursive: true, force: true });
2010
2154
  }
2011
2155
  function ensureEslintCacheIgnored(workspaceRoot) {
2012
- const gitignorePath = (0, import_node_path2.join)(workspaceRoot, ".gitignore");
2156
+ const gitignorePath = (0, import_node_path3.join)(workspaceRoot, ".gitignore");
2013
2157
  if (!fileExists(gitignorePath)) {
2014
2158
  return;
2015
2159
  }
2016
- const current = (0, import_node_fs2.readFileSync)(gitignorePath, "utf8");
2160
+ const current = (0, import_node_fs4.readFileSync)(gitignorePath, "utf8");
2017
2161
  if (current.split("\n").some((line) => line.trim() === ".eslintcache")) {
2018
2162
  return;
2019
2163
  }
@@ -2028,18 +2172,18 @@ function ensureEslintCacheIgnored(workspaceRoot) {
2028
2172
  }
2029
2173
  var PYTHON_ARTEFACT_IGNORES = ["__pycache__/", "*.py[cod]"];
2030
2174
  function ensurePythonArtefactsIgnored(workspaceRoot) {
2031
- const gitignorePath = (0, import_node_path2.join)(workspaceRoot, ".gitignore");
2175
+ const gitignorePath = (0, import_node_path3.join)(workspaceRoot, ".gitignore");
2032
2176
  if (!fileExists(gitignorePath)) {
2033
2177
  return;
2034
2178
  }
2035
- const hasPython = (0, import_node_fs2.globSync)(
2179
+ const hasPython = (0, import_node_fs4.globSync)(
2036
2180
  ["python-packages/*/pyproject.toml", "apps/*/pyproject.toml", "libs/*/pyproject.toml"],
2037
2181
  { cwd: workspaceRoot }
2038
2182
  ).length > 0;
2039
2183
  if (!hasPython) {
2040
2184
  return;
2041
2185
  }
2042
- const current = (0, import_node_fs2.readFileSync)(gitignorePath, "utf8");
2186
+ const current = (0, import_node_fs4.readFileSync)(gitignorePath, "utf8");
2043
2187
  const present = new Set(current.split("\n").map((line) => line.trim()));
2044
2188
  const missing = PYTHON_ARTEFACT_IGNORES.filter((line) => !present.has(line));
2045
2189
  if (missing.length === 0) {
@@ -2059,16 +2203,16 @@ ${missing.join("\n")}
2059
2203
  );
2060
2204
  }
2061
2205
  function removeProjectEslintConfigs(workspaceRoot) {
2062
- const matches = (0, import_node_fs2.globSync)("{apps,libs,packages}/*/eslint.config.{js,mjs,cjs,ts,mts,cts}", {
2206
+ const matches = (0, import_node_fs4.globSync)("{apps,libs,packages}/*/eslint.config.{js,mjs,cjs,ts,mts,cts}", {
2063
2207
  cwd: workspaceRoot
2064
2208
  });
2065
2209
  for (const match of matches) {
2066
- (0, import_node_fs2.rmSync)((0, import_node_path2.join)(workspaceRoot, match), { force: true });
2210
+ (0, import_node_fs4.rmSync)((0, import_node_path3.join)(workspaceRoot, match), { force: true });
2067
2211
  }
2068
2212
  }
2069
2213
  function applyOverlay(workspaceRoot, options, onProgress = () => {
2070
2214
  }) {
2071
- const nxJsonPath = (0, import_node_path2.join)(workspaceRoot, "nx.json");
2215
+ const nxJsonPath = (0, import_node_path3.join)(workspaceRoot, "nx.json");
2072
2216
  const nxJson = readJson(nxJsonPath);
2073
2217
  const generators = {
2074
2218
  ...nxJson.generators,
@@ -2076,7 +2220,7 @@ function applyOverlay(workspaceRoot, options, onProgress = () => {
2076
2220
  };
2077
2221
  const sync = { ...nxJson.sync, ...SYNC_CONFIG };
2078
2222
  const mnci = { ...nxJson.mnci, ...mnciConfig(options) };
2079
- const rootManifest = readJson((0, import_node_path2.join)(workspaceRoot, "package.json"));
2223
+ const rootManifest = readJson((0, import_node_path3.join)(workspaceRoot, "package.json"));
2080
2224
  const hasPythonPlugin = (rootManifest.devDependencies ?? {})["@mnci/nx-python-pip"] !== void 0 || (rootManifest.dependencies ?? {})["@mnci/nx-python-pip"] !== void 0;
2081
2225
  const withRelease = withReleaseConfig(nxJson, options.ci);
2082
2226
  const patched = withPythonGraphPlugin(
@@ -2086,7 +2230,7 @@ function applyOverlay(workspaceRoot, options, onProgress = () => {
2086
2230
  onProgress("nx.json \u2014 release, sync, generators, shared inputs, mnci block");
2087
2231
  writeFileEnsured(nxJsonPath, toJson({ ...patched, generators, sync, mnci }));
2088
2232
  onProgress("package.json \u2014 root scripts, TS compilers, ESLint toolchain, overrides");
2089
- const manifestPath = (0, import_node_path2.join)(workspaceRoot, "package.json");
2233
+ const manifestPath = (0, import_node_path3.join)(workspaceRoot, "package.json");
2090
2234
  const manifest = readJson(manifestPath);
2091
2235
  const scripts = {
2092
2236
  ...manifest.scripts,
@@ -2098,7 +2242,7 @@ function applyOverlay(workspaceRoot, options, onProgress = () => {
2098
2242
  ...existingDevDeps,
2099
2243
  ...TS_COMPILER_DEPENDENCIES,
2100
2244
  // The preset pins `nx` itself; the ESLint plugins must match it exactly.
2101
- ...eslintToolchainDependencies(existingDevDeps?.nx ?? "latest")
2245
+ ...mnciToolchainDependencies(existingDevDeps?.nx ?? "latest")
2102
2246
  }),
2103
2247
  LOCAL_REGISTRY_SCAFFOLDING.devDependency
2104
2248
  );
@@ -2138,32 +2282,32 @@ function applyOverlay(workspaceRoot, options, onProgress = () => {
2138
2282
  `.npmrc \u2014 ${options.registry.kind === "azure-artifacts" ? "Azure Artifacts feed routing and credentials" : "public npm registry auth"}`
2139
2283
  );
2140
2284
  writeFileEnsured(
2141
- (0, import_node_path2.join)(workspaceRoot, ".npmrc"),
2285
+ (0, import_node_path3.join)(workspaceRoot, ".npmrc"),
2142
2286
  npmrcContent(options.registry, options.scope, options.npmAuth)
2143
2287
  );
2144
2288
  onProgress("commitlint.config.mjs and .husky/commit-msg \u2014 conventional commit enforcement");
2145
- writeFileEnsured((0, import_node_path2.join)(workspaceRoot, "commitlint.config.mjs"), COMMITLINT_CONFIG);
2146
- const hookPath = (0, import_node_path2.join)(workspaceRoot, ".husky/commit-msg");
2289
+ writeFileEnsured((0, import_node_path3.join)(workspaceRoot, "commitlint.config.mjs"), COMMITLINT_CONFIG);
2290
+ const hookPath = (0, import_node_path3.join)(workspaceRoot, ".husky/commit-msg");
2147
2291
  writeFileEnsured(hookPath, COMMIT_MSG_HOOK);
2148
2292
  markExecutable(hookPath);
2149
2293
  onProgress(`${ESLINT_MNCI_FILENAME} \u2014 the shared lint AND formatting opinion`);
2150
- writeFileEnsured((0, import_node_path2.join)(workspaceRoot, ESLINT_MNCI_FILENAME), ESLINT_MNCI_CONFIG);
2294
+ writeFileEnsured((0, import_node_path3.join)(workspaceRoot, ESLINT_MNCI_FILENAME), ESLINT_MNCI_CONFIG);
2151
2295
  writeEslintEntryPoint(workspaceRoot, onProgress);
2152
2296
  ensureEslintCacheIgnored(workspaceRoot);
2153
2297
  ensurePythonArtefactsIgnored(workspaceRoot);
2154
2298
  for (const retired of RETIRED_FORMATTER_FILES) {
2155
- removeIfPresent((0, import_node_path2.join)(workspaceRoot, retired));
2299
+ removeIfPresent((0, import_node_path3.join)(workspaceRoot, retired));
2156
2300
  }
2157
2301
  onProgress(".devcontainer/devcontainer.json \u2014 a local toolchain matching CI");
2158
2302
  writeFileEnsured(
2159
- (0, import_node_path2.join)(workspaceRoot, ".devcontainer/devcontainer.json"),
2303
+ (0, import_node_path3.join)(workspaceRoot, ".devcontainer/devcontainer.json"),
2160
2304
  devcontainerJson(options.workspaceName)
2161
2305
  );
2162
2306
  removeNxScaffolding(workspaceRoot);
2163
2307
  onProgress(
2164
2308
  `${options.workspaceName}.code-workspace \u2014 settings, extensions, launch configs`
2165
2309
  );
2166
- const codeWorkspacePath = (0, import_node_path2.join)(workspaceRoot, `${options.workspaceName}.code-workspace`);
2310
+ const codeWorkspacePath = (0, import_node_path3.join)(workspaceRoot, `${options.workspaceName}.code-workspace`);
2167
2311
  const existing = readCodeWorkspace(codeWorkspacePath);
2168
2312
  writeFileEnsured(
2169
2313
  codeWorkspacePath,
@@ -2175,7 +2319,7 @@ function applyOverlay(workspaceRoot, options, onProgress = () => {
2175
2319
  )
2176
2320
  );
2177
2321
  if (options.workspaceName !== "undefined") {
2178
- (0, import_node_fs2.rmSync)((0, import_node_path2.join)(workspaceRoot, "undefined.code-workspace"), { force: true });
2322
+ (0, import_node_fs4.rmSync)((0, import_node_path3.join)(workspaceRoot, "undefined.code-workspace"), { force: true });
2179
2323
  }
2180
2324
  const publishUrl = pythonPublishUrl(options.registry);
2181
2325
  const nugetUrl = nugetFeedUrl(options.registry);
@@ -2183,7 +2327,7 @@ function applyOverlay(workspaceRoot, options, onProgress = () => {
2183
2327
  if (options.ci === "azure" || options.ci === "both") {
2184
2328
  onProgress("azure-pipelines.yml \u2014 build, verify, pack and release");
2185
2329
  writeFileEnsured(
2186
- (0, import_node_path2.join)(workspaceRoot, "azure-pipelines.yml"),
2330
+ (0, import_node_path3.join)(workspaceRoot, "azure-pipelines.yml"),
2187
2331
  azurePipelinesYaml(
2188
2332
  options.agent,
2189
2333
  options.variableGroup,
@@ -2198,58 +2342,10 @@ function applyOverlay(workspaceRoot, options, onProgress = () => {
2198
2342
  if (options.ci === "github" || options.ci === "both") {
2199
2343
  onProgress(".github/workflows/ci.yml and dependabot.yml");
2200
2344
  writeFileEnsured(
2201
- (0, import_node_path2.join)(workspaceRoot, ".github/workflows/ci.yml"),
2345
+ (0, import_node_path3.join)(workspaceRoot, ".github/workflows/ci.yml"),
2202
2346
  githubActionsYaml(options.agent, publishUrl, options.registry.kind, options.ci, nugetUrl, nativeApps)
2203
2347
  );
2204
- writeFileEnsured((0, import_node_path2.join)(workspaceRoot, ".github/dependabot.yml"), dependabotConfig(workspaceRoot));
2205
- }
2206
- }
2207
-
2208
- // src/ci-pipeline/ci-environment.client.ts
2209
- function detectCiHost(environment) {
2210
- if (environment.GITHUB_ACTIONS === "true") {
2211
- return "github";
2212
- }
2213
- if (environment.TF_BUILD !== void 0 && environment.TF_BUILD !== "") {
2214
- return "azure";
2215
- }
2216
- return "local";
2217
- }
2218
- function pullRequestTarget(environment) {
2219
- const reference = environment.GITHUB_BASE_REF || environment.SYSTEM_PULLREQUEST_TARGETBRANCH || "";
2220
- return reference === "" ? void 0 : reference.replace("refs/heads/", "");
2221
- }
2222
- function isMainPush(environment) {
2223
- if (environment.GITHUB_ACTIONS === "true") {
2224
- return environment.GITHUB_EVENT_NAME === "push" && environment.GITHUB_REF_NAME === "main";
2225
- }
2226
- return environment.TF_BUILD !== void 0 && environment.TF_BUILD !== "" && ["IndividualCI", "BatchedCI"].includes(environment.BUILD_REASON ?? "") && environment.BUILD_SOURCEBRANCHNAME === "main";
2227
- }
2228
- function groupStart(host, title) {
2229
- switch (host) {
2230
- case "github": {
2231
- return `::group::${title}`;
2232
- }
2233
- case "azure": {
2234
- return `##[group]${title}`;
2235
- }
2236
- case "local": {
2237
- return `
2238
- \u25B8 ${title}`;
2239
- }
2240
- }
2241
- }
2242
- function groupEnd(host) {
2243
- switch (host) {
2244
- case "github": {
2245
- return "::endgroup::";
2246
- }
2247
- case "azure": {
2248
- return "##[endgroup]";
2249
- }
2250
- case "local": {
2251
- return void 0;
2252
- }
2348
+ writeFileEnsured((0, import_node_path3.join)(workspaceRoot, ".github/dependabot.yml"), dependabotConfig(workspaceRoot));
2253
2349
  }
2254
2350
  }
2255
2351
 
@@ -2277,26 +2373,26 @@ function runNative(workspaceRoot, dependencies = {}) {
2277
2373
  if (built !== 0) {
2278
2374
  return built;
2279
2375
  }
2280
- if (!isMainPush(environment) || !(0, import_node_fs3.existsSync)((0, import_node_path3.join)(workspaceRoot, "tools", "go-app-release.cjs"))) {
2376
+ if (!isMainPush(environment) || !(0, import_node_fs5.existsSync)((0, import_node_path4.join)(workspaceRoot, "tools", "go-app-release.cjs"))) {
2281
2377
  return 0;
2282
2378
  }
2283
2379
  return inGroup("Attach this OS's zip to the GitHub Release", "node", ["tools/go-app-release.cjs", "assets", "--native"]);
2284
2380
  }
2285
2381
 
2286
2382
  // src/ci-pipeline/pack.use-case.ts
2287
- var import_node_fs4 = require("fs");
2288
- var import_node_path4 = require("path");
2383
+ var import_node_fs6 = require("fs");
2384
+ var import_node_path5 = require("path");
2289
2385
  function hasAppToPack(workspaceRoot) {
2290
- const hasProjectJson = (0, import_node_fs4.globSync)("apps/*/project.json", { cwd: workspaceRoot }).length > 0;
2291
- const hasInlineNx = (0, import_node_fs4.globSync)("apps/*/package.json", { cwd: workspaceRoot }).some((manifest) => {
2386
+ const hasProjectJson = (0, import_node_fs6.globSync)("apps/*/project.json", { cwd: workspaceRoot }).length > 0;
2387
+ const hasInlineNx = (0, import_node_fs6.globSync)("apps/*/package.json", { cwd: workspaceRoot }).some((manifest) => {
2292
2388
  try {
2293
- const parsed = JSON.parse((0, import_node_fs4.readFileSync)((0, import_node_path4.join)(workspaceRoot, manifest), "utf8"));
2389
+ const parsed = JSON.parse((0, import_node_fs6.readFileSync)((0, import_node_path5.join)(workspaceRoot, manifest), "utf8"));
2294
2390
  return Boolean(parsed.nx);
2295
2391
  } catch {
2296
2392
  return false;
2297
2393
  }
2298
2394
  });
2299
- const hasCsproj = (0, import_node_fs4.globSync)("apps/*/*.csproj", { cwd: workspaceRoot }).length > 0;
2395
+ const hasCsproj = (0, import_node_fs6.globSync)("apps/*/*.csproj", { cwd: workspaceRoot }).length > 0;
2300
2396
  return hasProjectJson || hasInlineNx || hasCsproj;
2301
2397
  }
2302
2398
  function runPack(workspaceRoot, dependencies = {}) {
@@ -2309,7 +2405,7 @@ function runPack(workspaceRoot, dependencies = {}) {
2309
2405
  console.log(message);
2310
2406
  });
2311
2407
  const host = detectCiHost(environment);
2312
- (0, import_node_fs4.mkdirSync)((0, import_node_path4.join)(workspaceRoot, "dist", "drop"), { recursive: true });
2408
+ (0, import_node_fs6.mkdirSync)((0, import_node_path5.join)(workspaceRoot, "dist", "drop"), { recursive: true });
2313
2409
  if (!hasAppToPack(workspaceRoot)) {
2314
2410
  log("No apps to pack - skipping.");
2315
2411
  return 0;
@@ -2324,12 +2420,12 @@ function runPack(workspaceRoot, dependencies = {}) {
2324
2420
  }
2325
2421
 
2326
2422
  // src/ci-pipeline/release.use-case.ts
2327
- var import_node_fs5 = require("fs");
2328
- var import_node_path5 = require("path");
2423
+ var import_node_fs7 = require("fs");
2424
+ var import_node_path6 = require("path");
2329
2425
  var SPECIFIER = /^(?:major|minor|patch|\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?)$/;
2330
2426
  function hasTag(workspaceRoot, relativePath, tag) {
2331
2427
  try {
2332
- const parsed = JSON.parse((0, import_node_fs5.readFileSync)((0, import_node_path5.join)(workspaceRoot, relativePath), "utf8"));
2428
+ const parsed = JSON.parse((0, import_node_fs7.readFileSync)((0, import_node_path6.join)(workspaceRoot, relativePath), "utf8"));
2333
2429
  const tags = relativePath.endsWith("project.json") ? parsed.tags : parsed.nx?.tags;
2334
2430
  return Array.isArray(tags) && tags.includes(tag);
2335
2431
  } catch {
@@ -2338,12 +2434,12 @@ function hasTag(workspaceRoot, relativePath, tag) {
2338
2434
  }
2339
2435
  function releasableCounts(workspaceRoot) {
2340
2436
  return {
2341
- npm: (0, import_node_fs5.globSync)("packages/*/package.json", { cwd: workspaceRoot }).length,
2342
- csharp: (0, import_node_fs5.globSync)("packages/*/*.csproj", { cwd: workspaceRoot }).length,
2343
- python: (0, import_node_fs5.globSync)("python-packages/*/pyproject.toml", { cwd: workspaceRoot }).length,
2344
- dart: (0, import_node_fs5.globSync)("packages/*/pubspec.yaml", { cwd: workspaceRoot }).length,
2345
- vscode: (0, import_node_fs5.globSync)("apps/*/package.json", { cwd: workspaceRoot }).filter((path) => hasTag(workspaceRoot, path, VSCODE_EXTENSION_TAG)).length,
2346
- go: (0, import_node_fs5.globSync)("apps/*/project.json", { cwd: workspaceRoot }).filter((path) => hasTag(workspaceRoot, path, GO_RELEASE_TAG)).length
2437
+ npm: (0, import_node_fs7.globSync)("packages/*/package.json", { cwd: workspaceRoot }).length,
2438
+ csharp: (0, import_node_fs7.globSync)("packages/*/*.csproj", { cwd: workspaceRoot }).length,
2439
+ python: (0, import_node_fs7.globSync)("python-packages/*/pyproject.toml", { cwd: workspaceRoot }).length,
2440
+ dart: (0, import_node_fs7.globSync)("packages/*/pubspec.yaml", { cwd: workspaceRoot }).length,
2441
+ vscode: (0, import_node_fs7.globSync)("apps/*/package.json", { cwd: workspaceRoot }).filter((path) => hasTag(workspaceRoot, path, VSCODE_EXTENSION_TAG)).length,
2442
+ go: (0, import_node_fs7.globSync)("apps/*/project.json", { cwd: workspaceRoot }).filter((path) => hasTag(workspaceRoot, path, GO_RELEASE_TAG)).length
2347
2443
  };
2348
2444
  }
2349
2445
  function shallowCloneGuard(processes, log) {
@@ -2359,7 +2455,7 @@ function shallowCloneGuard(processes, log) {
2359
2455
  return 0;
2360
2456
  }
2361
2457
  function npmPreflight(workspaceRoot, registryKind, environment, processes, log) {
2362
- if (registryKind !== "npm" || (0, import_node_fs5.globSync)("packages/*/package.json", { cwd: workspaceRoot }).length === 0) {
2458
+ if (registryKind !== "npm" || (0, import_node_fs7.globSync)("packages/*/package.json", { cwd: workspaceRoot }).length === 0) {
2363
2459
  return 0;
2364
2460
  }
2365
2461
  if (!environment.NODE_AUTH_TOKEN) {
@@ -2375,7 +2471,7 @@ function npmPreflight(workspaceRoot, registryKind, environment, processes, log)
2375
2471
  return 0;
2376
2472
  }
2377
2473
  async function pypiPreflight(workspaceRoot, registryKind, environment, log, fetchStatus) {
2378
- const files = (0, import_node_fs5.globSync)("python-packages/*/pyproject.toml", { cwd: workspaceRoot });
2474
+ const files = (0, import_node_fs7.globSync)("python-packages/*/pyproject.toml", { cwd: workspaceRoot });
2379
2475
  if (registryKind !== "npm" || files.length === 0) {
2380
2476
  return 0;
2381
2477
  }
@@ -2388,7 +2484,7 @@ async function pypiPreflight(workspaceRoot, registryKind, environment, log, fetc
2388
2484
  return 1;
2389
2485
  }
2390
2486
  const names = files.map((file) => {
2391
- const text = (0, import_node_fs5.readFileSync)((0, import_node_path5.join)(workspaceRoot, file), "utf8");
2487
+ const text = (0, import_node_fs7.readFileSync)((0, import_node_path6.join)(workspaceRoot, file), "utf8");
2392
2488
  const block = text.slice(text.indexOf("[project]"));
2393
2489
  const line = block.split("\n").find((entry) => entry.trimStart().startsWith("name"));
2394
2490
  return line ? line.split("=", 2)[1].replaceAll(/[^\w.-]/gi, "") : "";
@@ -2462,7 +2558,7 @@ function runReleaseCommand(workspaceRoot, registry, counts, environment, process
2462
2558
  return processes.run("npx", ["nx", "release", ...extra, "--yes"]);
2463
2559
  }
2464
2560
  function afterRelease(workspaceRoot, processes) {
2465
- if ((0, import_node_fs5.existsSync)((0, import_node_path5.join)(workspaceRoot, "tools", "go-app-release.cjs"))) {
2561
+ if ((0, import_node_fs7.existsSync)((0, import_node_path6.join)(workspaceRoot, "tools", "go-app-release.cjs"))) {
2466
2562
  const assets = processes.run("node", ["tools/go-app-release.cjs", "assets"]);
2467
2563
  if (assets !== 0) {
2468
2564
  return assets;
@@ -2512,6 +2608,221 @@ async function runRelease(workspaceRoot, dependencies = {}) {
2512
2608
  return close(afterRelease(workspaceRoot, processes));
2513
2609
  }
2514
2610
 
2611
+ // src/ci-pipeline/setup.use-case.ts
2612
+ var import_node_fs10 = require("fs");
2613
+ var import_node_path9 = require("path");
2614
+
2615
+ // src/ci-pipeline/flutter-sdk.use-case.ts
2616
+ var import_node_fs8 = require("fs");
2617
+ var import_node_path7 = require("path");
2618
+ function flutterSdkDirectory(machine) {
2619
+ return (0, import_node_path7.join)(machine.home, `.mnci-flutter-${FLUTTER_SDK_VERSION}`);
2620
+ }
2621
+ function installFlutterSdk(workspaceRoot, processes, log, machine) {
2622
+ if (!(0, import_node_fs8.existsSync)((0, import_node_path7.join)(workspaceRoot, "pubspec.yaml"))) {
2623
+ log("No Flutter projects - skipping.");
2624
+ return 0;
2625
+ }
2626
+ if (processes.capture("flutter", ["--version"]).status === 0) {
2627
+ log("Flutter SDK already on PATH - skipping.");
2628
+ return 0;
2629
+ }
2630
+ const sdk = flutterSdkDirectory(machine);
2631
+ if ((0, import_node_fs8.existsSync)(sdk)) {
2632
+ log(`Flutter SDK already installed at ${sdk} - skipping.`);
2633
+ return 0;
2634
+ }
2635
+ return processes.run("git", ["clone", "--depth", "1", "--branch", FLUTTER_SDK_VERSION, "https://github.com/flutter/flutter.git", sdk]);
2636
+ }
2637
+ function publishFlutterSdk(workspaceRoot, host, environment, log, machine) {
2638
+ if (!(0, import_node_fs8.existsSync)((0, import_node_path7.join)(workspaceRoot, "pubspec.yaml"))) {
2639
+ log("No Flutter projects - skipping.");
2640
+ return;
2641
+ }
2642
+ const sdk = flutterSdkDirectory(machine);
2643
+ if (!(0, import_node_fs8.existsSync)(sdk)) {
2644
+ log("Flutter SDK was not installed by mnci (already on PATH) - skipping.");
2645
+ return;
2646
+ }
2647
+ addToPath(host, environment, (0, import_node_path7.join)(sdk, "bin"), log);
2648
+ }
2649
+ function resolveDartDependencies(workspaceRoot, processes, log) {
2650
+ if (!(0, import_node_fs8.existsSync)((0, import_node_path7.join)(workspaceRoot, "pubspec.yaml"))) {
2651
+ log("No Flutter projects - skipping.");
2652
+ return 0;
2653
+ }
2654
+ return processes.run("flutter", ["pub", "get"]);
2655
+ }
2656
+
2657
+ // src/ci-pipeline/go-tools.use-case.ts
2658
+ var import_node_crypto = require("crypto");
2659
+ var import_node_fs9 = require("fs");
2660
+ var import_node_os = require("os");
2661
+ var import_node_path8 = require("path");
2662
+ function currentMachine() {
2663
+ return { platform: process.platform, architecture: process.arch, home: (0, import_node_os.homedir)() };
2664
+ }
2665
+ var GOLANGCI_LINT_MODULE = "github.com/golangci/golangci-lint/v2/cmd/golangci-lint";
2666
+ function downloadGoModules(workspaceRoot, processes, log) {
2667
+ if (!(0, import_node_fs9.existsSync)((0, import_node_path8.join)(workspaceRoot, "go.mod"))) {
2668
+ log("No Go projects - skipping.");
2669
+ return 0;
2670
+ }
2671
+ return processes.run("go", ["mod", "download"]);
2672
+ }
2673
+ async function installGolangciLint(workspaceRoot, dependencies, machine) {
2674
+ const { processes, log, fetchBytes } = dependencies;
2675
+ if (!(0, import_node_fs9.existsSync)((0, import_node_path8.join)(workspaceRoot, "go.mod"))) {
2676
+ log("No Go projects - skipping.");
2677
+ return 0;
2678
+ }
2679
+ if (processes.capture("golangci-lint", ["--version"]).status === 0) {
2680
+ log("golangci-lint already installed - skipping.");
2681
+ return 0;
2682
+ }
2683
+ const version = GOLANGCI_LINT_VERSION;
2684
+ const fallback = (reason) => {
2685
+ log(`Prebuilt golangci-lint ${version} unavailable (${reason}) - building it with go install instead.`);
2686
+ return processes.run("go", ["install", `${GOLANGCI_LINT_MODULE}@v${version}`]);
2687
+ };
2688
+ const platform = { linux: "linux", darwin: "darwin", win32: "windows" }[machine.platform];
2689
+ const architecture = { x64: "amd64", arm64: "arm64" }[machine.architecture];
2690
+ if (platform === void 0 || architecture === void 0) {
2691
+ return fallback(`no prebuilt release for ${machine.platform}/${machine.architecture}`);
2692
+ }
2693
+ const gopath = processes.capture("go", ["env", "GOPATH"]);
2694
+ if (gopath.status !== 0) {
2695
+ return fallback("go env GOPATH failed");
2696
+ }
2697
+ const name = `golangci-lint-${version}-${platform}-${architecture}`;
2698
+ const file = `${name}${platform === "windows" ? ".zip" : ".tar.gz"}`;
2699
+ const base = `https://github.com/golangci/golangci-lint/releases/download/v${version}/`;
2700
+ let temporary;
2701
+ try {
2702
+ const checksumFile = await fetchBytes(`${base}golangci-lint-${version}-checksums.txt`);
2703
+ const checksums = checksumFile.toString("utf8");
2704
+ const entry = checksums.split("\n").map((line) => line.trim().split(" ").filter(Boolean)).find((parts) => parts[1] === file);
2705
+ if (entry === void 0) {
2706
+ throw new Error(`${file} is not in the release checksums`);
2707
+ }
2708
+ const archive = await fetchBytes(base + file);
2709
+ if ((0, import_node_crypto.createHash)("sha256").update(archive).digest("hex") !== entry[0]) {
2710
+ throw new Error(`checksum mismatch for ${file}`);
2711
+ }
2712
+ temporary = (0, import_node_fs9.mkdtempSync)((0, import_node_path8.join)((0, import_node_os.tmpdir)(), "golangci-lint-"));
2713
+ const archivePath = (0, import_node_path8.join)(temporary, file);
2714
+ (0, import_node_fs9.writeFileSync)(archivePath, archive);
2715
+ const tar = platform === "windows" ? (0, import_node_path8.join)(process.env.SystemRoot ?? "", "System32", "tar.exe") : "tar";
2716
+ if (processes.run(tar, ["-xf", archivePath, "-C", temporary]) !== 0) {
2717
+ throw new Error(`could not extract ${file}`);
2718
+ }
2719
+ const executable = `golangci-lint${platform === "windows" ? ".exe" : ""}`;
2720
+ const bin = (0, import_node_path8.join)(gopath.stdout.trim(), "bin");
2721
+ (0, import_node_fs9.mkdirSync)(bin, { recursive: true });
2722
+ (0, import_node_fs9.copyFileSync)((0, import_node_path8.join)(temporary, name, executable), (0, import_node_path8.join)(bin, executable));
2723
+ (0, import_node_fs9.chmodSync)((0, import_node_path8.join)(bin, executable), 493);
2724
+ log(`golangci-lint ${version} installed from its checksum-verified prebuilt release into ${bin}`);
2725
+ return 0;
2726
+ } catch (error) {
2727
+ return fallback(error instanceof Error ? error.message : String(error));
2728
+ } finally {
2729
+ if (temporary !== void 0) {
2730
+ (0, import_node_fs9.rmSync)(temporary, { recursive: true, force: true });
2731
+ }
2732
+ }
2733
+ }
2734
+ function publishGoTools(workspaceRoot, host, environment, processes, log) {
2735
+ if (!(0, import_node_fs9.existsSync)((0, import_node_path8.join)(workspaceRoot, "go.mod"))) {
2736
+ log("No Go projects - skipping.");
2737
+ return;
2738
+ }
2739
+ const gopath = processes.capture("go", ["env", "GOPATH"]);
2740
+ if (gopath.status !== 0) {
2741
+ log("Could not resolve GOPATH - skipping.");
2742
+ return;
2743
+ }
2744
+ addToPath(host, environment, (0, import_node_path8.join)(gopath.stdout.trim(), "bin"), log);
2745
+ }
2746
+
2747
+ // src/ci-pipeline/setup.use-case.ts
2748
+ function pythonCommand(machine) {
2749
+ return machine.platform === "win32" ? "python" : "python3";
2750
+ }
2751
+ function installPythonToolchain(workspaceRoot, processes, log, machine) {
2752
+ if (!(0, import_node_fs10.existsSync)((0, import_node_path9.join)(workspaceRoot, "requirements-dev.txt"))) {
2753
+ log("No Python projects - skipping.");
2754
+ return 0;
2755
+ }
2756
+ return processes.run(pythonCommand(machine), ["-m", "pip", "install", "-r", "requirements-dev.txt"]);
2757
+ }
2758
+ function installPythonProjects(workspaceRoot, processes, log, machine) {
2759
+ const editable = ["apps/*/pyproject.toml", "python-packages/*/pyproject.toml", "libs/*/pyproject.toml"].flatMap((pattern) => (0, import_node_fs10.globSync)(pattern, { cwd: workspaceRoot })).map((path) => (0, import_node_path9.dirname)(path));
2760
+ const requirements = (0, import_node_fs10.globSync)("apps/*/requirements.txt", { cwd: workspaceRoot });
2761
+ if (editable.length === 0 && requirements.length === 0) {
2762
+ log("No Python projects - skipping.");
2763
+ return 0;
2764
+ }
2765
+ return processes.run(pythonCommand(machine), [
2766
+ "-m",
2767
+ "pip",
2768
+ "install",
2769
+ "--quiet",
2770
+ ...editable.flatMap((directory) => ["-e", directory]),
2771
+ ...requirements.flatMap((file) => ["-r", file])
2772
+ ]);
2773
+ }
2774
+ async function runSetup(workspaceRoot, dependencies = {}, machine = currentMachine()) {
2775
+ const environment = dependencies.environment ?? process.env;
2776
+ const processes = dependencies.processes ?? {
2777
+ run: (command, arguments_) => runShell(command, arguments_, workspaceRoot),
2778
+ capture: (command, arguments_) => runCapture(command, arguments_, workspaceRoot)
2779
+ };
2780
+ const log = dependencies.log ?? ((message) => {
2781
+ console.log(message);
2782
+ });
2783
+ const fetchBytes = dependencies.fetchBytes ?? (async (url) => {
2784
+ const response = await fetch(url, { signal: AbortSignal.timeout(6e4) });
2785
+ if (!response.ok) {
2786
+ throw new Error(`HTTP ${response.status} for ${url}`);
2787
+ }
2788
+ return Buffer.from(await response.arrayBuffer());
2789
+ });
2790
+ const host = detectCiHost(environment);
2791
+ const step = async (title, work) => {
2792
+ log(groupStart(host, title));
2793
+ const status = await work();
2794
+ const closing = groupEnd(host);
2795
+ if (closing !== void 0) {
2796
+ log(closing);
2797
+ }
2798
+ return status;
2799
+ };
2800
+ const steps = [
2801
+ ["Install Python dependencies (ruff, pytest, build, twine)", () => installPythonToolchain(workspaceRoot, processes, log, machine)],
2802
+ ["Install Python project dependencies (editable, workspace-wide)", () => installPythonProjects(workspaceRoot, processes, log, machine)],
2803
+ ["Download Go module dependencies", () => downloadGoModules(workspaceRoot, processes, log)],
2804
+ ["Install golangci-lint", () => installGolangciLint(workspaceRoot, { processes, log, fetchBytes }, machine)],
2805
+ ["Add Go tool bin to PATH", () => {
2806
+ publishGoTools(workspaceRoot, host, environment, processes, log);
2807
+ return 0;
2808
+ }],
2809
+ ["Install the Flutter SDK", () => installFlutterSdk(workspaceRoot, processes, log, machine)],
2810
+ ["Add the Flutter SDK to PATH", () => {
2811
+ publishFlutterSdk(workspaceRoot, host, environment, log, machine);
2812
+ return 0;
2813
+ }],
2814
+ ["Resolve Dart dependencies (one pub get for the whole workspace)", () => resolveDartDependencies(workspaceRoot, processes, log)]
2815
+ ];
2816
+ for (const [title, work] of steps) {
2817
+ const status = await step(title, work);
2818
+ if (status !== 0) {
2819
+ log(`Setup stopped at: ${title}`);
2820
+ return status;
2821
+ }
2822
+ }
2823
+ return 0;
2824
+ }
2825
+
2515
2826
  // src/ci-pipeline/verify.use-case.ts
2516
2827
  function runVerify(workspaceRoot, dependencies = {}) {
2517
2828
  const environment = dependencies.environment ?? process.env;
@@ -2563,7 +2874,7 @@ function runVerify(workspaceRoot, dependencies = {}) {
2563
2874
  }
2564
2875
 
2565
2876
  // src/ci-pipeline/index.ts
2566
- var CI_PHASES = ["verify", "pack", "release", "native"];
2877
+ var CI_PHASES = ["setup", "audit", "verify", "pack", "release", "native"];
2567
2878
  function runCiPhase(phase, workspaceRoot, dependencies = {}) {
2568
2879
  switch (phase) {
2569
2880
  case "verify": {
@@ -2578,11 +2889,17 @@ function runCiPhase(phase, workspaceRoot, dependencies = {}) {
2578
2889
  case "native": {
2579
2890
  return runNative(workspaceRoot, dependencies);
2580
2891
  }
2892
+ case "setup": {
2893
+ return runSetup(workspaceRoot, dependencies);
2894
+ }
2895
+ case "audit": {
2896
+ return runAudit(workspaceRoot, dependencies);
2897
+ }
2581
2898
  }
2582
2899
  }
2583
2900
 
2584
2901
  // src/project-scaffolding/add-project.use-case.ts
2585
- var import_node_path26 = require("path");
2902
+ var import_node_path30 = require("path");
2586
2903
  var import_prompts3 = require("@inquirer/prompts");
2587
2904
 
2588
2905
  // src/project-name/project-name.validator.ts
@@ -2595,8 +2912,8 @@ function assertValidProjectName(name, label) {
2595
2912
  }
2596
2913
 
2597
2914
  // src/project-scaffolding/csharp.use-case.ts
2598
- var import_node_fs7 = require("fs");
2599
- var import_node_path7 = require("path");
2915
+ var import_node_fs12 = require("fs");
2916
+ var import_node_path11 = require("path");
2600
2917
 
2601
2918
  // src/project-scaffolding/csharp-example.algorithm.ts
2602
2919
  function csharpExampleFiles(identity) {
@@ -2637,10 +2954,10 @@ public class GreetUseCaseTests
2637
2954
  }
2638
2955
 
2639
2956
  // src/project-scaffolding/post-generation.use-case.ts
2640
- var import_node_fs6 = require("fs");
2641
- var import_node_path6 = require("path");
2957
+ var import_node_fs11 = require("fs");
2958
+ var import_node_path10 = require("path");
2642
2959
  function hasPlugin(workspaceRoot, packageName) {
2643
- const manifest = readJson((0, import_node_path6.join)(workspaceRoot, "package.json"));
2960
+ const manifest = readJson((0, import_node_path10.join)(workspaceRoot, "package.json"));
2644
2961
  const installed = { ...manifest.dependencies, ...manifest.devDependencies };
2645
2962
  return Object.hasOwn(installed, packageName);
2646
2963
  }
@@ -2679,7 +2996,7 @@ function markPublic(manifestPath) {
2679
2996
  function writeProjectReadme(projectRoot, projectName, testRunner) {
2680
2997
  const runner = testRunner === "vitest" ? "[Vitest](https://vitest.dev)" : "[Jest](https://jestjs.io)";
2681
2998
  writeFileEnsured(
2682
- (0, import_node_path6.join)(projectRoot, "README.md"),
2999
+ (0, import_node_path10.join)(projectRoot, "README.md"),
2683
3000
  [
2684
3001
  `# ${projectName}`,
2685
3002
  "",
@@ -2698,13 +3015,13 @@ function writeProjectReadme(projectRoot, projectName, testRunner) {
2698
3015
  }
2699
3016
  function removeStaleGitkeeps(workspaceRoot) {
2700
3017
  for (const scaffold of ["apps", "libs", "packages"]) {
2701
- const directory = (0, import_node_path6.join)(workspaceRoot, scaffold);
3018
+ const directory = (0, import_node_path10.join)(workspaceRoot, scaffold);
2702
3019
  try {
2703
- const holdsAProject = (0, import_node_fs6.readdirSync)(directory, { withFileTypes: true }).some(
3020
+ const holdsAProject = (0, import_node_fs11.readdirSync)(directory, { withFileTypes: true }).some(
2704
3021
  (entry) => entry.isDirectory()
2705
3022
  );
2706
3023
  if (holdsAProject) {
2707
- (0, import_node_fs6.rmSync)((0, import_node_path6.join)(directory, ".gitkeep"), { force: true });
3024
+ (0, import_node_fs11.rmSync)((0, import_node_path10.join)(directory, ".gitkeep"), { force: true });
2708
3025
  }
2709
3026
  } catch {
2710
3027
  }
@@ -2724,7 +3041,7 @@ function ensureAdmZip(workspaceRoot) {
2724
3041
  }
2725
3042
  }
2726
3043
  function defaultScope(workspaceRoot) {
2727
- const { name } = readJson((0, import_node_path6.join)(workspaceRoot, "package.json"));
3044
+ const { name } = readJson((0, import_node_path10.join)(workspaceRoot, "package.json"));
2728
3045
  const base = (name.startsWith("@") ? name.slice(1) : name).split("/", 1)[0];
2729
3046
  return `@${base}`;
2730
3047
  }
@@ -2752,14 +3069,14 @@ var ESLINT_CONFIG_FILENAMES = [
2752
3069
  ];
2753
3070
  function removeGeneratedEslintConfig(workspaceRoot, projectRoot) {
2754
3071
  for (const filename of ESLINT_CONFIG_FILENAMES) {
2755
- (0, import_node_fs6.rmSync)((0, import_node_path6.join)(workspaceRoot, projectRoot, filename), { force: true });
3072
+ (0, import_node_fs11.rmSync)((0, import_node_path10.join)(workspaceRoot, projectRoot, filename), { force: true });
2756
3073
  }
2757
- (0, import_node_fs6.rmSync)((0, import_node_path6.join)(workspaceRoot, ".vscode"), { recursive: true, force: true });
3074
+ (0, import_node_fs11.rmSync)((0, import_node_path10.join)(workspaceRoot, ".vscode"), { recursive: true, force: true });
2758
3075
  }
2759
3076
  function findCodeWorkspaceFile(workspaceRoot) {
2760
3077
  try {
2761
- const entry = (0, import_node_fs6.readdirSync)(workspaceRoot).find((file) => file.endsWith(".code-workspace"));
2762
- return entry ? (0, import_node_path6.join)(workspaceRoot, entry) : void 0;
3078
+ const entry = (0, import_node_fs11.readdirSync)(workspaceRoot).find((file) => file.endsWith(".code-workspace"));
3079
+ return entry ? (0, import_node_path10.join)(workspaceRoot, entry) : void 0;
2763
3080
  } catch {
2764
3081
  return void 0;
2765
3082
  }
@@ -2776,8 +3093,8 @@ function reshapeReactScaffold(projectRoot, name, empty = false) {
2776
3093
  reshapeScaffoldSlice(projectRoot, name, "tsx", "component", empty);
2777
3094
  }
2778
3095
  function reshapeReactAppScaffold(projectRoot) {
2779
- const appDir = (0, import_node_path6.join)(projectRoot, "src", "app");
2780
- if (!(0, import_node_fs6.existsSync)((0, import_node_path6.join)(appDir, "app.tsx"))) {
3096
+ const appDir = (0, import_node_path10.join)(projectRoot, "src", "app");
3097
+ if (!(0, import_node_fs11.existsSync)((0, import_node_path10.join)(appDir, "app.tsx"))) {
2781
3098
  return;
2782
3099
  }
2783
3100
  for (const [from, to] of [
@@ -2785,60 +3102,60 @@ function reshapeReactAppScaffold(projectRoot) {
2785
3102
  ["app.spec.tsx", "app.component.spec.tsx"],
2786
3103
  ["nx-welcome.tsx", "nx-welcome.component.tsx"]
2787
3104
  ]) {
2788
- if ((0, import_node_fs6.existsSync)((0, import_node_path6.join)(appDir, from))) {
2789
- (0, import_node_fs6.renameSync)((0, import_node_path6.join)(appDir, from), (0, import_node_path6.join)(appDir, to));
3105
+ if ((0, import_node_fs11.existsSync)((0, import_node_path10.join)(appDir, from))) {
3106
+ (0, import_node_fs11.renameSync)((0, import_node_path10.join)(appDir, from), (0, import_node_path10.join)(appDir, to));
2790
3107
  }
2791
3108
  }
2792
3109
  const rewrite = (file, from, to) => {
2793
- if ((0, import_node_fs6.existsSync)(file)) {
2794
- writeFileEnsured(file, repointSpecifier((0, import_node_fs6.readFileSync)(file, "utf8"), from, to));
3110
+ if ((0, import_node_fs11.existsSync)(file)) {
3111
+ writeFileEnsured(file, repointSpecifier((0, import_node_fs11.readFileSync)(file, "utf8"), from, to));
2795
3112
  }
2796
3113
  };
2797
- rewrite((0, import_node_path6.join)(appDir, "app.component.tsx"), "./nx-welcome", "./nx-welcome.component");
2798
- rewrite((0, import_node_path6.join)(appDir, "app.component.spec.tsx"), "./app", "./app.component");
2799
- rewrite((0, import_node_path6.join)(projectRoot, "src", "main.tsx"), "./app/app", "./app");
3114
+ rewrite((0, import_node_path10.join)(appDir, "app.component.tsx"), "./nx-welcome", "./nx-welcome.component");
3115
+ rewrite((0, import_node_path10.join)(appDir, "app.component.spec.tsx"), "./app", "./app.component");
3116
+ rewrite((0, import_node_path10.join)(projectRoot, "src", "main.tsx"), "./app/app", "./app");
2800
3117
  writeFileEnsured(
2801
- (0, import_node_path6.join)(appDir, "index.ts"),
3118
+ (0, import_node_path10.join)(appDir, "index.ts"),
2802
3119
  "export * from './app.component'\nexport { default } from './app.component'\n"
2803
3120
  );
2804
3121
  }
2805
3122
  function emptySlice(projectRoot, sliceDir) {
2806
- for (const entry of (0, import_node_fs6.readdirSync)(sliceDir)) {
2807
- (0, import_node_fs6.rmSync)((0, import_node_path6.join)(sliceDir, entry), { recursive: true, force: true });
3123
+ for (const entry of (0, import_node_fs11.readdirSync)(sliceDir)) {
3124
+ (0, import_node_fs11.rmSync)((0, import_node_path10.join)(sliceDir, entry), { recursive: true, force: true });
2808
3125
  }
2809
- writeFileEnsured((0, import_node_path6.join)(sliceDir, "index.ts"), "export {}\n");
2810
- addNxTargets((0, import_node_path6.join)(projectRoot, "package.json"), { test: { options: { passWithNoTests: true } } });
3126
+ writeFileEnsured((0, import_node_path10.join)(sliceDir, "index.ts"), "export {}\n");
3127
+ addNxTargets((0, import_node_path10.join)(projectRoot, "package.json"), { test: { options: { passWithNoTests: true } } });
2811
3128
  }
2812
3129
  function reshapeScaffoldSlice(projectRoot, name, extension, role, empty) {
2813
- const sourceDir = (0, import_node_path6.join)(projectRoot, "src");
2814
- const libDir = (0, import_node_path6.join)(sourceDir, "lib");
2815
- if (!(0, import_node_fs6.existsSync)((0, import_node_path6.join)(libDir, `${name}.${extension}`))) {
3130
+ const sourceDir = (0, import_node_path10.join)(projectRoot, "src");
3131
+ const libDir = (0, import_node_path10.join)(sourceDir, "lib");
3132
+ if (!(0, import_node_fs11.existsSync)((0, import_node_path10.join)(libDir, `${name}.${extension}`))) {
2816
3133
  return;
2817
3134
  }
2818
- const sliceDir = (0, import_node_path6.join)(sourceDir, name);
2819
- (0, import_node_fs6.mkdirSync)(sliceDir, { recursive: true });
2820
- for (const entry of (0, import_node_fs6.readdirSync)(libDir)) {
3135
+ const sliceDir = (0, import_node_path10.join)(sourceDir, name);
3136
+ (0, import_node_fs11.mkdirSync)(sliceDir, { recursive: true });
3137
+ for (const entry of (0, import_node_fs11.readdirSync)(libDir)) {
2821
3138
  if (entry === `${name}.${extension}`) {
2822
- (0, import_node_fs6.renameSync)((0, import_node_path6.join)(libDir, entry), (0, import_node_path6.join)(sliceDir, `${name}.${role}.${extension}`));
3139
+ (0, import_node_fs11.renameSync)((0, import_node_path10.join)(libDir, entry), (0, import_node_path10.join)(sliceDir, `${name}.${role}.${extension}`));
2823
3140
  } else if (entry === `${name}.spec.${extension}`) {
2824
- const renamed = (0, import_node_path6.join)(sliceDir, `${name}.${role}.spec.${extension}`);
2825
- (0, import_node_fs6.renameSync)((0, import_node_path6.join)(libDir, entry), renamed);
2826
- writeFileEnsured(renamed, repointSpecifier((0, import_node_fs6.readFileSync)(renamed, "utf8"), `./${name}`, `./${name}.${role}`));
3141
+ const renamed = (0, import_node_path10.join)(sliceDir, `${name}.${role}.spec.${extension}`);
3142
+ (0, import_node_fs11.renameSync)((0, import_node_path10.join)(libDir, entry), renamed);
3143
+ writeFileEnsured(renamed, repointSpecifier((0, import_node_fs11.readFileSync)(renamed, "utf8"), `./${name}`, `./${name}.${role}`));
2827
3144
  } else {
2828
- (0, import_node_fs6.renameSync)((0, import_node_path6.join)(libDir, entry), (0, import_node_path6.join)(sliceDir, entry));
3145
+ (0, import_node_fs11.renameSync)((0, import_node_path10.join)(libDir, entry), (0, import_node_path10.join)(sliceDir, entry));
2829
3146
  }
2830
3147
  }
2831
- const barrel = (0, import_node_path6.join)(sourceDir, "index.ts");
2832
- const esm = (0, import_node_fs6.existsSync)(barrel) && (0, import_node_fs6.readFileSync)(barrel, "utf8").includes(`./lib/${name}.js'`);
2833
- writeFileEnsured((0, import_node_path6.join)(sliceDir, "index.ts"), `export * from './${name}.${role}${esm ? ".js" : ""}'
3148
+ const barrel = (0, import_node_path10.join)(sourceDir, "index.ts");
3149
+ const esm = (0, import_node_fs11.existsSync)(barrel) && (0, import_node_fs11.readFileSync)(barrel, "utf8").includes(`./lib/${name}.js'`);
3150
+ writeFileEnsured((0, import_node_path10.join)(sliceDir, "index.ts"), `export * from './${name}.${role}${esm ? ".js" : ""}'
2834
3151
  `);
2835
- if ((0, import_node_fs6.existsSync)(barrel)) {
3152
+ if ((0, import_node_fs11.existsSync)(barrel)) {
2836
3153
  writeFileEnsured(
2837
3154
  barrel,
2838
- (0, import_node_fs6.readFileSync)(barrel, "utf8").replaceAll(`./lib/${name}.js'`, () => `./${name}/index.js'`).replaceAll(`./lib/${name}'`, () => `./${name}'`)
3155
+ (0, import_node_fs11.readFileSync)(barrel, "utf8").replaceAll(`./lib/${name}.js'`, () => `./${name}/index.js'`).replaceAll(`./lib/${name}'`, () => `./${name}'`)
2839
3156
  );
2840
3157
  }
2841
- (0, import_node_fs6.rmSync)(libDir, { recursive: true, force: true });
3158
+ (0, import_node_fs11.rmSync)(libDir, { recursive: true, force: true });
2842
3159
  if (empty) {
2843
3160
  emptySlice(projectRoot, sliceDir);
2844
3161
  } else if (role === "use-case") {
@@ -2848,7 +3165,7 @@ function reshapeScaffoldSlice(projectRoot, name, extension, role, empty) {
2848
3165
  function writeWorkedExample(sliceDir, name, esm) {
2849
3166
  const suffix = esm ? ".js" : "";
2850
3167
  writeFileEnsured(
2851
- (0, import_node_path6.join)(sliceDir, `${name}.contract.ts`),
3168
+ (0, import_node_path10.join)(sliceDir, `${name}.contract.ts`),
2852
3169
  `/** What greeting someone returns. */
2853
3170
  export interface Greeting {
2854
3171
  readonly message: string
@@ -2856,7 +3173,7 @@ export interface Greeting {
2856
3173
  `
2857
3174
  );
2858
3175
  writeFileEnsured(
2859
- (0, import_node_path6.join)(sliceDir, `${name}.use-case.ts`),
3176
+ (0, import_node_path10.join)(sliceDir, `${name}.use-case.ts`),
2860
3177
  `import type { Greeting } from './${name}.contract${suffix}'
2861
3178
 
2862
3179
  /**
@@ -2875,7 +3192,7 @@ export function greet (name: string): Greeting {
2875
3192
  `
2876
3193
  );
2877
3194
  writeFileEnsured(
2878
- (0, import_node_path6.join)(sliceDir, `${name}.use-case.spec.ts`),
3195
+ (0, import_node_path10.join)(sliceDir, `${name}.use-case.spec.ts`),
2879
3196
  `import { greet } from './${name}.use-case${suffix}'
2880
3197
 
2881
3198
  describe('greet', () => {
@@ -2886,7 +3203,7 @@ describe('greet', () => {
2886
3203
  `
2887
3204
  );
2888
3205
  writeFileEnsured(
2889
- (0, import_node_path6.join)(sliceDir, "index.ts"),
3206
+ (0, import_node_path10.join)(sliceDir, "index.ts"),
2890
3207
  `export * from './${name}.contract${suffix}'
2891
3208
  export * from './${name}.use-case${suffix}'
2892
3209
  `
@@ -2900,8 +3217,8 @@ function repointSpecifier(source, from, to) {
2900
3217
  return result;
2901
3218
  }
2902
3219
  function ensureNxPeerOverrides(workspaceRoot) {
2903
- const manifestPath = (0, import_node_path6.join)(workspaceRoot, "package.json");
2904
- if (!(0, import_node_fs6.existsSync)(manifestPath)) {
3220
+ const manifestPath = (0, import_node_path10.join)(workspaceRoot, "package.json");
3221
+ if (!(0, import_node_fs11.existsSync)(manifestPath)) {
2905
3222
  return;
2906
3223
  }
2907
3224
  const manifest = readJson(manifestPath);
@@ -2924,11 +3241,11 @@ function registerProjectCommands(workspaceRoot, name, commands) {
2924
3241
  if (commands.start) {
2925
3242
  scripts[`${name}:start`] = commands.start;
2926
3243
  }
2927
- const dependabotPath = (0, import_node_path6.join)(workspaceRoot, ".github/dependabot.yml");
2928
- if ((0, import_node_fs6.existsSync)(dependabotPath)) {
3244
+ const dependabotPath = (0, import_node_path10.join)(workspaceRoot, ".github/dependabot.yml");
3245
+ if ((0, import_node_fs11.existsSync)(dependabotPath)) {
2929
3246
  writeFileEnsured(dependabotPath, dependabotConfig(workspaceRoot));
2930
3247
  }
2931
- const manifestPath = (0, import_node_path6.join)(workspaceRoot, "package.json");
3248
+ const manifestPath = (0, import_node_path10.join)(workspaceRoot, "package.json");
2932
3249
  const manifest = readJson(manifestPath);
2933
3250
  const existingScripts = manifest.scripts ?? {};
2934
3251
  writeFileEnsured(
@@ -2966,7 +3283,7 @@ function registerProjectCommands(workspaceRoot, name, commands) {
2966
3283
  var PROJECT_MANIFEST_ROOTS = ["apps", "packages", "libs"];
2967
3284
  function rootRuntimeDependencies(workspaceRoot) {
2968
3285
  try {
2969
- return readJson((0, import_node_path6.join)(workspaceRoot, "package.json")).dependencies ?? {};
3286
+ return readJson((0, import_node_path10.join)(workspaceRoot, "package.json")).dependencies ?? {};
2970
3287
  } catch {
2971
3288
  return {};
2972
3289
  }
@@ -2978,7 +3295,7 @@ function relocateRootRuntimeDependencies(workspaceRoot, projectName, before) {
2978
3295
  return;
2979
3296
  }
2980
3297
  const manifestPath = PROJECT_MANIFEST_ROOTS.map(
2981
- (root) => (0, import_node_path6.join)(workspaceRoot, root, projectName, "package.json")
3298
+ (root) => (0, import_node_path10.join)(workspaceRoot, root, projectName, "package.json")
2982
3299
  ).find((candidate) => fileExists(candidate));
2983
3300
  if (manifestPath === void 0) {
2984
3301
  return;
@@ -2990,10 +3307,10 @@ function relocateRootRuntimeDependencies(workspaceRoot, projectName, before) {
2990
3307
  const remaining = Object.fromEntries(
2991
3308
  Object.entries(after).filter(([name]) => !added.includes(name))
2992
3309
  );
2993
- const rootManifest = readJson((0, import_node_path6.join)(workspaceRoot, "package.json"));
3310
+ const rootManifest = readJson((0, import_node_path10.join)(workspaceRoot, "package.json"));
2994
3311
  const { dependencies: _dropped, ...rest } = rootManifest;
2995
3312
  writeFileEnsured(
2996
- (0, import_node_path6.join)(workspaceRoot, "package.json"),
3313
+ (0, import_node_path10.join)(workspaceRoot, "package.json"),
2997
3314
  toJson(Object.keys(remaining).length > 0 ? { ...rest, dependencies: remaining } : rest)
2998
3315
  );
2999
3316
  logger.step(`Moved ${added.join(", ")} into ${projectName}'s own manifest`);
@@ -3032,28 +3349,28 @@ function scaffoldDotnetProject(workspaceRoot, projectRoot, identity, template) {
3032
3349
  }
3033
3350
  function writeCsharpExample(absoluteRoot, identity, kind) {
3034
3351
  if (kind === "classlib") {
3035
- (0, import_node_fs7.rmSync)((0, import_node_path7.join)(absoluteRoot, "Class1.cs"), { force: true });
3352
+ (0, import_node_fs12.rmSync)((0, import_node_path11.join)(absoluteRoot, "Class1.cs"), { force: true });
3036
3353
  }
3037
3354
  const files = csharpExampleFiles(identity);
3038
3355
  for (const [file, contents] of Object.entries(files)) {
3039
- writeFileEnsured((0, import_node_path7.join)(absoluteRoot, file), contents);
3356
+ writeFileEnsured((0, import_node_path11.join)(absoluteRoot, file), contents);
3040
3357
  }
3041
3358
  if (kind === "console") {
3042
- writeFileEnsured((0, import_node_path7.join)(absoluteRoot, "Program.cs"), csharpConsoleProgram(identity));
3359
+ writeFileEnsured((0, import_node_path11.join)(absoluteRoot, "Program.cs"), csharpConsoleProgram(identity));
3043
3360
  }
3044
3361
  }
3045
3362
  function addCsharpTestProject(workspaceRoot, projectRoot, identity) {
3046
- const name = (0, import_node_path7.basename)(projectRoot);
3363
+ const name = (0, import_node_path11.basename)(projectRoot);
3047
3364
  const testRoot = `tests/${name}`;
3048
3365
  scaffoldDotnetProject(workspaceRoot, testRoot, `${identity}.Tests`, "xunit");
3049
- (0, import_node_fs7.rmSync)((0, import_node_path7.join)(workspaceRoot, testRoot, "UnitTest1.cs"), { force: true });
3050
- writeFileEnsured((0, import_node_path7.join)(workspaceRoot, testRoot, "GreetUseCaseTests.cs"), csharpExampleTest(identity));
3366
+ (0, import_node_fs12.rmSync)((0, import_node_path11.join)(workspaceRoot, testRoot, "UnitTest1.cs"), { force: true });
3367
+ writeFileEnsured((0, import_node_path11.join)(workspaceRoot, testRoot, "GreetUseCaseTests.cs"), csharpExampleTest(identity));
3051
3368
  writeFileEnsured(
3052
- (0, import_node_path7.join)(workspaceRoot, testRoot, "project.json"),
3369
+ (0, import_node_path11.join)(workspaceRoot, testRoot, "project.json"),
3053
3370
  toJson({ name: `${name}-tests`, tags: ["type:csharp-test"] })
3054
3371
  );
3055
- const reference = (0, import_node_path7.join)(workspaceRoot, projectRoot, `${identity}.csproj`);
3056
- if (runShell("dotnet", ["add", (0, import_node_path7.join)(workspaceRoot, testRoot), "reference", reference], workspaceRoot) !== 0) {
3372
+ const reference = (0, import_node_path11.join)(workspaceRoot, projectRoot, `${identity}.csproj`);
3373
+ if (runShell("dotnet", ["add", (0, import_node_path11.join)(workspaceRoot, testRoot), "reference", reference], workspaceRoot) !== 0) {
3057
3374
  throw new Error(`dotnet add reference failed for ${testRoot}`);
3058
3375
  }
3059
3376
  }
@@ -3080,9 +3397,9 @@ function addCsharpApp(workspaceRoot, name, template = "console") {
3080
3397
  ensureAdmZip(workspaceRoot);
3081
3398
  const projectRoot = `apps/${name}`;
3082
3399
  scaffoldDotnetProject(workspaceRoot, projectRoot, pascalCase(name), template);
3083
- writeCsharpExample((0, import_node_path7.join)(workspaceRoot, projectRoot), pascalCase(name), template);
3400
+ writeCsharpExample((0, import_node_path11.join)(workspaceRoot, projectRoot), pascalCase(name), template);
3084
3401
  addCsharpTestProject(workspaceRoot, projectRoot, pascalCase(name));
3085
- addProjectJsonTargets((0, import_node_path7.join)(workspaceRoot, projectRoot, "project.json"), {
3402
+ addProjectJsonTargets((0, import_node_path11.join)(workspaceRoot, projectRoot, "project.json"), {
3086
3403
  package: csharpAppPackageTarget("csharp-app", projectRoot, name),
3087
3404
  start: csharpAppStartTarget(projectRoot)
3088
3405
  });
@@ -3175,7 +3492,7 @@ class CsharpVersionActions extends VersionActions {
3175
3492
  module.exports = CsharpVersionActions
3176
3493
  `;
3177
3494
  function writeCsharpVersionActions(workspaceRoot) {
3178
- writeFileEnsured((0, import_node_path7.join)(workspaceRoot, CSHARP_VERSION_ACTIONS_PATH), CSHARP_VERSION_ACTIONS);
3495
+ writeFileEnsured((0, import_node_path11.join)(workspaceRoot, CSHARP_VERSION_ACTIONS_PATH), CSHARP_VERSION_ACTIONS);
3179
3496
  }
3180
3497
  function addProjectJsonReleaseVersionActions(projectJsonPath) {
3181
3498
  const project = fileExists(projectJsonPath) ? readJson(projectJsonPath) : {};
@@ -3190,7 +3507,7 @@ function addProjectJsonReleaseVersionActions(projectJsonPath) {
3190
3507
  );
3191
3508
  }
3192
3509
  function addInitialVersion(csprojPath) {
3193
- const contents = (0, import_node_fs7.readFileSync)(csprojPath, "utf8");
3510
+ const contents = (0, import_node_fs12.readFileSync)(csprojPath, "utf8");
3194
3511
  writeFileEnsured(csprojPath, contents.replace("<PropertyGroup>", "<PropertyGroup>\n <Version>0.1.0</Version>"));
3195
3512
  }
3196
3513
  function csharpLibPublishTarget(projectRoot) {
@@ -3205,16 +3522,16 @@ async function addCsharpLib(workspaceRoot, name, options, kindProvided) {
3205
3522
  const projectRoot = `packages/${name}`;
3206
3523
  const identity = `${pascalScope(scope)}.${pascalCase(name)}`;
3207
3524
  scaffoldDotnetProject(workspaceRoot, projectRoot, identity, "classlib");
3208
- writeCsharpExample((0, import_node_path7.join)(workspaceRoot, projectRoot), identity, "classlib");
3525
+ writeCsharpExample((0, import_node_path11.join)(workspaceRoot, projectRoot), identity, "classlib");
3209
3526
  addCsharpTestProject(workspaceRoot, projectRoot, identity);
3210
- addInitialVersion((0, import_node_path7.join)(workspaceRoot, projectRoot, `${identity}.csproj`));
3527
+ addInitialVersion((0, import_node_path11.join)(workspaceRoot, projectRoot, `${identity}.csproj`));
3211
3528
  writeCsharpVersionActions(workspaceRoot);
3212
- addProjectJsonReleaseVersionActions((0, import_node_path7.join)(workspaceRoot, projectRoot, "project.json"));
3213
- addProjectJsonTargets((0, import_node_path7.join)(workspaceRoot, projectRoot, "project.json"), {
3529
+ addProjectJsonReleaseVersionActions((0, import_node_path11.join)(workspaceRoot, projectRoot, "project.json"));
3530
+ addProjectJsonTargets((0, import_node_path11.join)(workspaceRoot, projectRoot, "project.json"), {
3214
3531
  "nx-release-publish": csharpLibPublishTarget(projectRoot)
3215
3532
  });
3216
3533
  const registry = readMnciConfig(workspaceRoot).registry ?? { kind: "npm" };
3217
- writeFileEnsured((0, import_node_path7.join)(workspaceRoot, "nuget.config"), nugetConfigContent(registry, scope));
3534
+ writeFileEnsured((0, import_node_path11.join)(workspaceRoot, "nuget.config"), nugetConfigContent(registry, scope));
3218
3535
  registerProjectCommands(workspaceRoot, name, { build: true });
3219
3536
  }
3220
3537
  function addCsharpInternalLib(workspaceRoot, name) {
@@ -3223,7 +3540,7 @@ function addCsharpInternalLib(workspaceRoot, name) {
3223
3540
  const projectRoot = `libs/${name}`;
3224
3541
  const identity = pascalCase(name);
3225
3542
  scaffoldDotnetProject(workspaceRoot, projectRoot, identity, "classlib");
3226
- writeCsharpExample((0, import_node_path7.join)(workspaceRoot, projectRoot), identity, "classlib");
3543
+ writeCsharpExample((0, import_node_path11.join)(workspaceRoot, projectRoot), identity, "classlib");
3227
3544
  addCsharpTestProject(workspaceRoot, projectRoot, identity);
3228
3545
  registerProjectCommands(workspaceRoot, name, { build: false });
3229
3546
  logger.step(
@@ -3292,20 +3609,20 @@ function addCsharpFunctionApp(workspaceRoot, name) {
3292
3609
  const projectRoot = `apps/${name}`;
3293
3610
  const identity = pascalCase(name);
3294
3611
  scaffoldDotnetProject(workspaceRoot, projectRoot, identity, "console");
3295
- const absoluteRoot = (0, import_node_path7.join)(workspaceRoot, projectRoot);
3296
- writeFileEnsured((0, import_node_path7.join)(absoluteRoot, `${identity}.csproj`), csharpFunctionAppCsproj());
3297
- writeFileEnsured((0, import_node_path7.join)(absoluteRoot, "Program.cs"), CSHARP_FUNCTION_APP_PROGRAM);
3298
- writeFileEnsured((0, import_node_path7.join)(absoluteRoot, "Hello.cs"), csharpFunctionAppHello(identity));
3612
+ const absoluteRoot = (0, import_node_path11.join)(workspaceRoot, projectRoot);
3613
+ writeFileEnsured((0, import_node_path11.join)(absoluteRoot, `${identity}.csproj`), csharpFunctionAppCsproj());
3614
+ writeFileEnsured((0, import_node_path11.join)(absoluteRoot, "Program.cs"), CSHARP_FUNCTION_APP_PROGRAM);
3615
+ writeFileEnsured((0, import_node_path11.join)(absoluteRoot, "Hello.cs"), csharpFunctionAppHello(identity));
3299
3616
  const example = csharpExampleFiles(identity);
3300
3617
  for (const [file, contents] of Object.entries(example)) {
3301
- writeFileEnsured((0, import_node_path7.join)(absoluteRoot, file), contents);
3618
+ writeFileEnsured((0, import_node_path11.join)(absoluteRoot, file), contents);
3302
3619
  }
3303
- writeFileEnsured((0, import_node_path7.join)(absoluteRoot, "host.json"), CSHARP_FUNCTION_APP_HOST_JSON);
3620
+ writeFileEnsured((0, import_node_path11.join)(absoluteRoot, "host.json"), CSHARP_FUNCTION_APP_HOST_JSON);
3304
3621
  if (runShell("dotnet", ["restore", projectRoot], workspaceRoot) !== 0) {
3305
3622
  throw new Error(`dotnet restore failed for ${projectRoot}`);
3306
3623
  }
3307
3624
  addCsharpTestProject(workspaceRoot, projectRoot, identity);
3308
- addProjectJsonTargets((0, import_node_path7.join)(absoluteRoot, "project.json"), {
3625
+ addProjectJsonTargets((0, import_node_path11.join)(absoluteRoot, "project.json"), {
3309
3626
  package: csharpAppPackageTarget("csharp-function-app", projectRoot, name),
3310
3627
  start: csharpFunctionAppStartTarget(projectRoot)
3311
3628
  });
@@ -3313,7 +3630,7 @@ function addCsharpFunctionApp(workspaceRoot, name) {
3313
3630
  }
3314
3631
 
3315
3632
  // src/project-scaffolding/flutter.use-case.ts
3316
- var import_node_path8 = require("path");
3633
+ var import_node_path12 = require("path");
3317
3634
  function flutterAppStartTarget(name) {
3318
3635
  return {
3319
3636
  executor: "nx:run-commands",
@@ -3349,7 +3666,7 @@ function addFlutterApp(workspaceRoot, name) {
3349
3666
  prepareFlutter(workspaceRoot);
3350
3667
  ensureAdmZip(workspaceRoot);
3351
3668
  runNx(["g", "@mnci/nx-flutter:application", name, "--no-interactive"], workspaceRoot);
3352
- addProjectJsonTargets((0, import_node_path8.join)(workspaceRoot, "apps", name, "project.json"), {
3669
+ addProjectJsonTargets((0, import_node_path12.join)(workspaceRoot, "apps", name, "project.json"), {
3353
3670
  start: flutterAppStartTarget(name)
3354
3671
  });
3355
3672
  registerProjectCommands(workspaceRoot, name, { build: true, start: `nx run ${name}:start` });
@@ -3366,8 +3683,8 @@ function addFlutterInternalLib(workspaceRoot, name) {
3366
3683
  }
3367
3684
 
3368
3685
  // src/project-scaffolding/go.use-case.ts
3369
- var import_node_fs11 = require("fs");
3370
- var import_node_path12 = require("path");
3686
+ var import_node_fs16 = require("fs");
3687
+ var import_node_path16 = require("path");
3371
3688
 
3372
3689
  // src/project-scaffolding/go-example.algorithm.ts
3373
3690
  function greetingContract(packageName) {
@@ -3436,14 +3753,14 @@ function goAppExampleFiles(modulePath) {
3436
3753
  }
3437
3754
 
3438
3755
  // src/go-workspace/go-plugin.use-case.ts
3439
- var import_node_fs8 = require("fs");
3440
- var import_node_path9 = require("path");
3756
+ var import_node_fs13 = require("fs");
3757
+ var import_node_path13 = require("path");
3441
3758
  var NX_GO_PLUGIN = "@nx-go/nx-go";
3442
3759
  function hasGoProject(workspaceRoot) {
3443
- const projectFiles = ["apps", "libs", "packages"].flatMap((directory) => (0, import_node_fs8.globSync)(`${directory}/*/project.json`, { cwd: workspaceRoot }));
3760
+ const projectFiles = ["apps", "libs", "packages"].flatMap((directory) => (0, import_node_fs13.globSync)(`${directory}/*/project.json`, { cwd: workspaceRoot }));
3444
3761
  return projectFiles.some((projectFile) => {
3445
3762
  try {
3446
- const { tags } = JSON.parse((0, import_node_fs8.readFileSync)((0, import_node_path9.join)(workspaceRoot, projectFile), "utf8"));
3763
+ const { tags } = JSON.parse((0, import_node_fs13.readFileSync)((0, import_node_path13.join)(workspaceRoot, projectFile), "utf8"));
3447
3764
  return (tags ?? []).some((tag) => tag.startsWith("type:go-"));
3448
3765
  } catch {
3449
3766
  return false;
@@ -3451,7 +3768,7 @@ function hasGoProject(workspaceRoot) {
3451
3768
  });
3452
3769
  }
3453
3770
  function isNxGoPluginRegistered(workspaceRoot) {
3454
- const nxJsonPath = (0, import_node_path9.join)(workspaceRoot, "nx.json");
3771
+ const nxJsonPath = (0, import_node_path13.join)(workspaceRoot, "nx.json");
3455
3772
  if (!fileExists(nxJsonPath)) {
3456
3773
  return false;
3457
3774
  }
@@ -3478,7 +3795,7 @@ function goModulePrefix(workspaceRoot) {
3478
3795
  return result.status === 0 ? modulePrefixFromRemoteUrl(result.stdout) : void 0;
3479
3796
  }
3480
3797
  function registerNxGoPlugin(workspaceRoot) {
3481
- const nxJsonPath = (0, import_node_path9.join)(workspaceRoot, "nx.json");
3798
+ const nxJsonPath = (0, import_node_path13.join)(workspaceRoot, "nx.json");
3482
3799
  if (!fileExists(nxJsonPath)) {
3483
3800
  return false;
3484
3801
  }
@@ -3502,8 +3819,8 @@ function registerNxGoPlugin(workspaceRoot) {
3502
3819
  }
3503
3820
 
3504
3821
  // src/project-scaffolding/go-release.use-case.ts
3505
- var import_node_fs9 = require("fs");
3506
- var import_node_path10 = require("path");
3822
+ var import_node_fs14 = require("fs");
3823
+ var import_node_path14 = require("path");
3507
3824
  var GO_RELEASE_SCRIPT_PATH = "tools/go-app-release.cjs";
3508
3825
  var GO_RELEASE_SCRIPT = String.raw`#!/usr/bin/env node
3509
3826
  // Written by mnci: 'mnci add go-app --release' creates it and 'mnci upgrade'
@@ -3629,7 +3946,7 @@ var GO_RELEASE_PUBLISH_TARGET = {
3629
3946
  }
3630
3947
  };
3631
3948
  function makeGoAppReleasable(workspaceRoot, name) {
3632
- const projectJsonPath = (0, import_node_path10.join)(workspaceRoot, "apps", name, "project.json");
3949
+ const projectJsonPath = (0, import_node_path14.join)(workspaceRoot, "apps", name, "project.json");
3633
3950
  if (!fileExists(projectJsonPath)) {
3634
3951
  throw new Error(`No Go app at apps/${name}: cannot make it releasable.`);
3635
3952
  }
@@ -3650,22 +3967,22 @@ function makeGoAppReleasable(workspaceRoot, name) {
3650
3967
  }
3651
3968
  })
3652
3969
  );
3653
- writeFileEnsured((0, import_node_path10.join)(workspaceRoot, GO_RELEASE_SCRIPT_PATH), GO_RELEASE_SCRIPT);
3970
+ writeFileEnsured((0, import_node_path14.join)(workspaceRoot, GO_RELEASE_SCRIPT_PATH), GO_RELEASE_SCRIPT);
3654
3971
  }
3655
3972
  function refreshGoReleaseScript(workspaceRoot) {
3656
- const apps = (0, import_node_path10.join)(workspaceRoot, "apps");
3973
+ const apps = (0, import_node_path14.join)(workspaceRoot, "apps");
3657
3974
  let entries;
3658
3975
  try {
3659
- entries = (0, import_node_fs9.readdirSync)(apps);
3976
+ entries = (0, import_node_fs14.readdirSync)(apps);
3660
3977
  } catch {
3661
3978
  return false;
3662
3979
  }
3663
3980
  const hasReleasableApp = entries.some((entry) => {
3664
- const projectJsonPath = (0, import_node_path10.join)(apps, entry, "project.json");
3981
+ const projectJsonPath = (0, import_node_path14.join)(apps, entry, "project.json");
3665
3982
  return fileExists(projectJsonPath) && (readJson(projectJsonPath).tags ?? []).includes(GO_RELEASE_TAG);
3666
3983
  });
3667
- const path = (0, import_node_path10.join)(workspaceRoot, GO_RELEASE_SCRIPT_PATH);
3668
- if (!hasReleasableApp || fileExists(path) && (0, import_node_fs9.readFileSync)(path, "utf8") === GO_RELEASE_SCRIPT) {
3984
+ const path = (0, import_node_path14.join)(workspaceRoot, GO_RELEASE_SCRIPT_PATH);
3985
+ if (!hasReleasableApp || fileExists(path) && (0, import_node_fs14.readFileSync)(path, "utf8") === GO_RELEASE_SCRIPT) {
3669
3986
  return false;
3670
3987
  }
3671
3988
  writeFileEnsured(path, GO_RELEASE_SCRIPT);
@@ -3673,8 +3990,8 @@ function refreshGoReleaseScript(workspaceRoot) {
3673
3990
  }
3674
3991
 
3675
3992
  // src/project-scaffolding/go-web.use-case.ts
3676
- var import_node_fs10 = require("fs");
3677
- var import_node_path11 = require("path");
3993
+ var import_node_fs15 = require("fs");
3994
+ var import_node_path15 = require("path");
3678
3995
  var TARGETS_NEEDING_THE_FRONTEND = ["build", "test", "lint", "start", "build-all", "build-native"];
3679
3996
  var DEFAULT_ADDRESS = "127.0.0.1:8080";
3680
3997
  var GO_WEB_SOURCE = `package main
@@ -3752,18 +4069,18 @@ func TestWebHandlerServesTheBuiltFrontend(t *testing.T) {
3752
4069
  }
3753
4070
  `;
3754
4071
  function assertWebApp(workspaceRoot, web) {
3755
- const directory = (0, import_node_path11.join)(workspaceRoot, "apps", web);
3756
- const isReactApp = fileExists((0, import_node_path11.join)(directory, "package.json")) && (0, import_node_fs10.readdirSync)(directory).some((entry) => entry.startsWith("vite.config."));
4072
+ const directory = (0, import_node_path15.join)(workspaceRoot, "apps", web);
4073
+ const isReactApp = fileExists((0, import_node_path15.join)(directory, "package.json")) && (0, import_node_fs15.readdirSync)(directory).some((entry) => entry.startsWith("vite.config."));
3757
4074
  if (!isReactApp) {
3758
4075
  throw new Error(`--web ${web}: no React app at apps/${web}. Add it first with \`mnci add react-app ${web}\`.`);
3759
4076
  }
3760
4077
  }
3761
4078
  function webProjectName(workspaceRoot, web) {
3762
- const manifest = readJson((0, import_node_path11.join)(workspaceRoot, "apps", web, "package.json"));
4079
+ const manifest = readJson((0, import_node_path15.join)(workspaceRoot, "apps", web, "package.json"));
3763
4080
  return manifest.nx?.name ?? manifest.name ?? web;
3764
4081
  }
3765
4082
  function addApiProxy(viteConfigPath) {
3766
- const source = (0, import_node_fs10.readFileSync)(viteConfigPath, "utf8");
4083
+ const source = (0, import_node_fs15.readFileSync)(viteConfigPath, "utf8");
3767
4084
  if (source.includes("'/api'") || source.includes('"/api"')) {
3768
4085
  return false;
3769
4086
  }
@@ -3776,7 +4093,7 @@ function addApiProxy(viteConfigPath) {
3776
4093
  return true;
3777
4094
  }
3778
4095
  function wireGoAppToWeb(workspaceRoot, name, web) {
3779
- const projectJsonPath = (0, import_node_path11.join)(workspaceRoot, "apps", name, "project.json");
4096
+ const projectJsonPath = (0, import_node_path15.join)(workspaceRoot, "apps", name, "project.json");
3780
4097
  const project = readJson(projectJsonPath);
3781
4098
  const webName = webProjectName(workspaceRoot, web);
3782
4099
  const targets = project.targets ?? {};
@@ -3802,13 +4119,13 @@ function wireGoAppToWeb(workspaceRoot, name, web) {
3802
4119
  projectJsonPath,
3803
4120
  toJson({ ...project, implicitDependencies: [.../* @__PURE__ */ new Set([...project.implicitDependencies ?? [], webName])], targets })
3804
4121
  );
3805
- const directory = (0, import_node_path11.join)(workspaceRoot, "apps", name);
3806
- writeFileEnsured((0, import_node_path11.join)(directory, ".gitignore"), "/web/\n");
3807
- writeFileEnsured((0, import_node_path11.join)(directory, "web.go"), GO_WEB_SOURCE);
3808
- writeFileEnsured((0, import_node_path11.join)(directory, "main.go"), GO_WEB_MAIN);
3809
- writeFileEnsured((0, import_node_path11.join)(directory, "main_test.go"), GO_WEB_MAIN_TEST);
3810
- const viteConfig = (0, import_node_fs10.readdirSync)((0, import_node_path11.join)(workspaceRoot, "apps", web)).find((entry) => entry.startsWith("vite.config."));
3811
- if (viteConfig === void 0 || !addApiProxy((0, import_node_path11.join)(workspaceRoot, "apps", web, viteConfig))) {
4122
+ const directory = (0, import_node_path15.join)(workspaceRoot, "apps", name);
4123
+ writeFileEnsured((0, import_node_path15.join)(directory, ".gitignore"), "/web/\n");
4124
+ writeFileEnsured((0, import_node_path15.join)(directory, "web.go"), GO_WEB_SOURCE);
4125
+ writeFileEnsured((0, import_node_path15.join)(directory, "main.go"), GO_WEB_MAIN);
4126
+ writeFileEnsured((0, import_node_path15.join)(directory, "main_test.go"), GO_WEB_MAIN_TEST);
4127
+ const viteConfig = (0, import_node_fs15.readdirSync)((0, import_node_path15.join)(workspaceRoot, "apps", web)).find((entry) => entry.startsWith("vite.config."));
4128
+ if (viteConfig === void 0 || !addApiProxy((0, import_node_path15.join)(workspaceRoot, "apps", web, viteConfig))) {
3812
4129
  logger.warn(
3813
4130
  `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.`
3814
4131
  );
@@ -3842,7 +4159,7 @@ function ensureNxGoPlugin(workspaceRoot) {
3842
4159
  }
3843
4160
  }
3844
4161
  function ensureGoModule(workspaceRoot) {
3845
- if (fileExists((0, import_node_path12.join)(workspaceRoot, "go.work")) || fileExists((0, import_node_path12.join)(workspaceRoot, "go.mod"))) {
4162
+ if (fileExists((0, import_node_path16.join)(workspaceRoot, "go.work")) || fileExists((0, import_node_path16.join)(workspaceRoot, "go.mod"))) {
3846
4163
  return;
3847
4164
  }
3848
4165
  logger.step("Bootstrapping the Go workspace (go.work, one module per project)");
@@ -3850,38 +4167,38 @@ function ensureGoModule(workspaceRoot) {
3850
4167
  }
3851
4168
  function readGoModModule(goModPath) {
3852
4169
  try {
3853
- return /^module\s+(\S+)/m.exec((0, import_node_fs11.readFileSync)(goModPath, "utf8"))?.[1];
4170
+ return /^module\s+(\S+)/m.exec((0, import_node_fs16.readFileSync)(goModPath, "utf8"))?.[1];
3854
4171
  } catch {
3855
4172
  return void 0;
3856
4173
  }
3857
4174
  }
3858
4175
  function goModulePathFor(workspaceRoot, projectDir) {
3859
- const projectModule = readGoModModule((0, import_node_path12.join)(workspaceRoot, projectDir, "go.mod"));
4176
+ const projectModule = readGoModModule((0, import_node_path16.join)(workspaceRoot, projectDir, "go.mod"));
3860
4177
  if (projectModule !== void 0) {
3861
4178
  return projectModule;
3862
4179
  }
3863
- const rootModule = readGoModModule((0, import_node_path12.join)(workspaceRoot, "go.mod"));
4180
+ const rootModule = readGoModModule((0, import_node_path16.join)(workspaceRoot, "go.mod"));
3864
4181
  return rootModule === void 0 ? void 0 : `${rootModule}/${projectDir}`;
3865
4182
  }
3866
4183
  function setGoModulePath(workspaceRoot, projectDir) {
3867
4184
  const prefix = goModulePrefix(workspaceRoot);
3868
- const goModPath = (0, import_node_path12.join)(workspaceRoot, projectDir, "go.mod");
4185
+ const goModPath = (0, import_node_path16.join)(workspaceRoot, projectDir, "go.mod");
3869
4186
  if (prefix === void 0 || !fileExists(goModPath)) {
3870
4187
  return;
3871
4188
  }
3872
- const rewritten = (0, import_node_fs11.readFileSync)(goModPath, "utf8").replace(/^module\s+\S+/m, () => `module ${prefix}/${projectDir}`);
4189
+ const rewritten = (0, import_node_fs16.readFileSync)(goModPath, "utf8").replace(/^module\s+\S+/m, () => `module ${prefix}/${projectDir}`);
3873
4190
  writeFileEnsured(goModPath, rewritten);
3874
4191
  }
3875
4192
  function writeGoAppExample(workspaceRoot, projectDir) {
3876
- const goModPath = (0, import_node_path12.join)(workspaceRoot, projectDir, "go.mod");
3877
- const modulePath = fileExists(goModPath) ? /^module\s+(\S+)/m.exec((0, import_node_fs11.readFileSync)(goModPath, "utf8"))?.[1] : void 0;
4193
+ const goModPath = (0, import_node_path16.join)(workspaceRoot, projectDir, "go.mod");
4194
+ const modulePath = fileExists(goModPath) ? /^module\s+(\S+)/m.exec((0, import_node_fs16.readFileSync)(goModPath, "utf8"))?.[1] : void 0;
3878
4195
  if (modulePath === void 0) {
3879
4196
  return;
3880
4197
  }
3881
- (0, import_node_fs11.rmSync)((0, import_node_path12.join)(workspaceRoot, projectDir, "main_test.go"), { force: true });
4198
+ (0, import_node_fs16.rmSync)((0, import_node_path16.join)(workspaceRoot, projectDir, "main_test.go"), { force: true });
3882
4199
  const example = goAppExampleFiles(modulePath);
3883
4200
  for (const [relative, contents] of Object.entries(example)) {
3884
- writeFileEnsured((0, import_node_path12.join)(workspaceRoot, projectDir, relative), contents);
4201
+ writeFileEnsured((0, import_node_path16.join)(workspaceRoot, projectDir, relative), contents);
3885
4202
  }
3886
4203
  }
3887
4204
  function goTestTarget() {
@@ -3959,16 +4276,16 @@ function goNativePackageTarget(name) {
3959
4276
  }
3960
4277
  function addGoPlatformTargets(workspaceRoot) {
3961
4278
  const changed = [];
3962
- const apps = (0, import_node_path12.join)(workspaceRoot, "apps");
4279
+ const apps = (0, import_node_path16.join)(workspaceRoot, "apps");
3963
4280
  if (!fileExists(apps)) {
3964
4281
  return changed;
3965
4282
  }
3966
- for (const name of (0, import_node_fs11.readdirSync)(apps)) {
3967
- const projectJsonPath = (0, import_node_path12.join)(apps, name, "project.json");
4283
+ for (const name of (0, import_node_fs16.readdirSync)(apps)) {
4284
+ const projectJsonPath = (0, import_node_path16.join)(apps, name, "project.json");
3968
4285
  if (!fileExists(projectJsonPath)) {
3969
4286
  continue;
3970
4287
  }
3971
- const project = JSON.parse((0, import_node_fs11.readFileSync)(projectJsonPath, "utf8"));
4288
+ const project = JSON.parse((0, import_node_fs16.readFileSync)(projectJsonPath, "utf8"));
3972
4289
  const tag = (project.tags ?? []).find((each) => each === "type:go-app" || each === "type:go-function-app")?.slice("type:".length);
3973
4290
  if (tag === void 0 || (project.tags ?? []).includes(GO_CGO_TAG)) {
3974
4291
  continue;
@@ -4004,8 +4321,8 @@ function goLibraryIdentifiers(projectName) {
4004
4321
  }
4005
4322
  function reshapeGoLibraryScaffold(projectRoot, projectName) {
4006
4323
  const { packageName, fileStem } = goLibraryIdentifiers(projectName);
4007
- (0, import_node_fs11.rmSync)((0, import_node_path12.join)(projectRoot, `${projectName}.go`), { force: true });
4008
- (0, import_node_fs11.rmSync)((0, import_node_path12.join)(projectRoot, `${projectName}_test.go`), { force: true });
4324
+ (0, import_node_fs16.rmSync)((0, import_node_path16.join)(projectRoot, `${projectName}.go`), { force: true });
4325
+ (0, import_node_fs16.rmSync)((0, import_node_path16.join)(projectRoot, `${projectName}_test.go`), { force: true });
4009
4326
  const files = [
4010
4327
  [
4011
4328
  "doc.go",
@@ -4015,7 +4332,7 @@ package ${packageName}
4015
4332
  `
4016
4333
  ],
4017
4334
  [
4018
- (0, import_node_path12.join)(packageName, "doc.go"),
4335
+ (0, import_node_path16.join)(packageName, "doc.go"),
4019
4336
  `// Package ${packageName} is the starter slice of ${projectName}: rename it after
4020
4337
  // the outcome it delivers, and add one package per further outcome.
4021
4338
  package ${packageName}
@@ -4023,11 +4340,11 @@ package ${packageName}
4023
4340
  ],
4024
4341
  // The starter slice: a contract, a use case and its test (see goLibraryExampleFiles).
4025
4342
  ...Object.entries(goLibraryExampleFiles(packageName, fileStem)).map(
4026
- ([name, content]) => [(0, import_node_path12.join)(packageName, name), content]
4343
+ ([name, content]) => [(0, import_node_path16.join)(packageName, name), content]
4027
4344
  )
4028
4345
  ];
4029
4346
  for (const [relativePath, content] of files) {
4030
- const path = (0, import_node_path12.join)(projectRoot, relativePath);
4347
+ const path = (0, import_node_path16.join)(projectRoot, relativePath);
4031
4348
  if (!fileExists(path)) {
4032
4349
  writeFileEnsured(path, content);
4033
4350
  }
@@ -4065,7 +4382,7 @@ function addGoApp(workspaceRoot, name, options = {}) {
4065
4382
  if (options.web === void 0) {
4066
4383
  writeGoAppExample(workspaceRoot, `apps/${name}`);
4067
4384
  }
4068
- addProjectJsonTargets((0, import_node_path12.join)(workspaceRoot, "apps", name, "project.json"), {
4385
+ addProjectJsonTargets((0, import_node_path16.join)(workspaceRoot, "apps", name, "project.json"), {
4069
4386
  build: goBuildTarget(name),
4070
4387
  test: goTestTarget(),
4071
4388
  lint: goLintTarget(),
@@ -4105,7 +4422,7 @@ function addGoFunctionApp(workspaceRoot, name) {
4105
4422
  );
4106
4423
  setGoModulePath(workspaceRoot, `apps/${name}`);
4107
4424
  writeGoAppExample(workspaceRoot, `apps/${name}`);
4108
- addProjectJsonTargets((0, import_node_path12.join)(workspaceRoot, "apps", name, "project.json"), {
4425
+ addProjectJsonTargets((0, import_node_path16.join)(workspaceRoot, "apps", name, "project.json"), {
4109
4426
  "build": goBuildTarget(name),
4110
4427
  "test": goTestTarget(),
4111
4428
  "lint": goLintTarget(),
@@ -4129,11 +4446,11 @@ function addGoLib(workspaceRoot, name) {
4129
4446
  workspaceRoot
4130
4447
  );
4131
4448
  setGoModulePath(workspaceRoot, `packages/${name}`);
4132
- addProjectJsonTargets((0, import_node_path12.join)(workspaceRoot, "packages", name, "project.json"), {
4449
+ addProjectJsonTargets((0, import_node_path16.join)(workspaceRoot, "packages", name, "project.json"), {
4133
4450
  test: goTestTarget(),
4134
4451
  lint: goLintTarget()
4135
4452
  });
4136
- const slice = reshapeGoLibraryScaffold((0, import_node_path12.join)(workspaceRoot, "packages", name), name);
4453
+ const slice = reshapeGoLibraryScaffold((0, import_node_path16.join)(workspaceRoot, "packages", name), name);
4137
4454
  registerProjectCommands(workspaceRoot, name, { build: false });
4138
4455
  const module2 = goModulePathFor(workspaceRoot, `packages/${name}`);
4139
4456
  if (module2) {
@@ -4154,11 +4471,11 @@ function addGoInternalLib(workspaceRoot, name) {
4154
4471
  workspaceRoot
4155
4472
  );
4156
4473
  setGoModulePath(workspaceRoot, `libs/${name}`);
4157
- addProjectJsonTargets((0, import_node_path12.join)(workspaceRoot, "libs", name, "project.json"), {
4474
+ addProjectJsonTargets((0, import_node_path16.join)(workspaceRoot, "libs", name, "project.json"), {
4158
4475
  test: goTestTarget(),
4159
4476
  lint: goLintTarget()
4160
4477
  });
4161
- const slice = reshapeGoLibraryScaffold((0, import_node_path12.join)(workspaceRoot, "libs", name), name);
4478
+ const slice = reshapeGoLibraryScaffold((0, import_node_path16.join)(workspaceRoot, "libs", name), name);
4162
4479
  registerProjectCommands(workspaceRoot, name, { build: false });
4163
4480
  const module2 = goModulePathFor(workspaceRoot, `libs/${name}`);
4164
4481
  if (module2) {
@@ -4167,7 +4484,7 @@ function addGoInternalLib(workspaceRoot, name) {
4167
4484
  }
4168
4485
 
4169
4486
  // src/project-scaffolding/node.use-case.ts
4170
- var import_node_path13 = require("path");
4487
+ var import_node_path17 = require("path");
4171
4488
 
4172
4489
  // src/project-scaffolding/node-app-example.algorithm.ts
4173
4490
  var GREET_USE_CASE = `import type { Greeting } from './greeting.contract'
@@ -4290,12 +4607,12 @@ function runNodeApp(workspaceRoot, name, stack, framework) {
4290
4607
  ],
4291
4608
  workspaceRoot
4292
4609
  );
4293
- const appRoot = (0, import_node_path13.join)(workspaceRoot, "apps", name);
4610
+ const appRoot = (0, import_node_path17.join)(workspaceRoot, "apps", name);
4294
4611
  separateDeclarationOutput(appRoot);
4295
4612
  repairAssetMapping(appRoot, name);
4296
4613
  }
4297
4614
  function separateDeclarationOutput(appRoot) {
4298
- const tsconfigPath = (0, import_node_path13.join)(appRoot, "tsconfig.app.json");
4615
+ const tsconfigPath = (0, import_node_path17.join)(appRoot, "tsconfig.app.json");
4299
4616
  if (!fileExists(tsconfigPath)) {
4300
4617
  return;
4301
4618
  }
@@ -4317,7 +4634,7 @@ function separateDeclarationOutput(appRoot) {
4317
4634
  );
4318
4635
  }
4319
4636
  function repairAssetMapping(appRoot, name) {
4320
- const manifestPath = (0, import_node_path13.join)(appRoot, "package.json");
4637
+ const manifestPath = (0, import_node_path17.join)(appRoot, "package.json");
4321
4638
  if (!fileExists(manifestPath)) {
4322
4639
  return;
4323
4640
  }
@@ -4346,11 +4663,11 @@ function addNodeApp(workspaceRoot, name, stack, framework = "none") {
4346
4663
  const example = nodeAppExampleFiles(framework);
4347
4664
  if (example !== null) {
4348
4665
  for (const [relative, contents] of Object.entries(example)) {
4349
- writeFileEnsured((0, import_node_path13.join)(workspaceRoot, "apps", name, "src", relative), contents);
4666
+ writeFileEnsured((0, import_node_path17.join)(workspaceRoot, "apps", name, "src", relative), contents);
4350
4667
  }
4351
4668
  }
4352
4669
  ensureAdmZip(workspaceRoot);
4353
- addNxTargets((0, import_node_path13.join)(workspaceRoot, "apps", name, "package.json"), {
4670
+ addNxTargets((0, import_node_path17.join)(workspaceRoot, "apps", name, "package.json"), {
4354
4671
  package: nodeAppPackageTarget(name)
4355
4672
  });
4356
4673
  removeGeneratedEslintConfig(workspaceRoot, `apps/${name}`);
@@ -4419,10 +4736,10 @@ describe('greet', () => {
4419
4736
  })
4420
4737
  `;
4421
4738
  function repairNodeFunctionAppManifest(nodeFunctionAppRoot, workspaceRoot) {
4422
- const manifestPath = (0, import_node_path13.join)(nodeFunctionAppRoot, "package.json");
4739
+ const manifestPath = (0, import_node_path17.join)(nodeFunctionAppRoot, "package.json");
4423
4740
  const manifest = readJson(manifestPath);
4424
4741
  const azureFunctionsVersion = readJson(
4425
- (0, import_node_path13.join)(workspaceRoot, "node_modules/@azure/functions/package.json")
4742
+ (0, import_node_path17.join)(workspaceRoot, "node_modules/@azure/functions/package.json")
4426
4743
  ).version;
4427
4744
  const dependencies = manifest.dependencies ?? {};
4428
4745
  writeFileEnsured(
@@ -4465,20 +4782,20 @@ function nodeFunctionAppStartTarget(name) {
4465
4782
  function addNodeFunctionApp(workspaceRoot, name, stack, empty = false) {
4466
4783
  runNodeApp(workspaceRoot, name, stack, "none");
4467
4784
  ensureAzureFunctionsPackage(workspaceRoot);
4468
- const nodeFunctionAppRoot = (0, import_node_path13.join)(workspaceRoot, "apps", name);
4469
- writeFileEnsured((0, import_node_path13.join)(nodeFunctionAppRoot, "src/main.ts"), empty ? NODE_FUNCTION_APP_MAIN_EMPTY : NODE_FUNCTION_APP_MAIN);
4785
+ const nodeFunctionAppRoot = (0, import_node_path17.join)(workspaceRoot, "apps", name);
4786
+ writeFileEnsured((0, import_node_path17.join)(nodeFunctionAppRoot, "src/main.ts"), empty ? NODE_FUNCTION_APP_MAIN_EMPTY : NODE_FUNCTION_APP_MAIN);
4470
4787
  if (!empty) {
4471
- const slice = (0, import_node_path13.join)(nodeFunctionAppRoot, "src/hello");
4472
- writeFileEnsured((0, import_node_path13.join)(slice, "hello.handler.ts"), NODE_FUNCTION_APP_HELLO);
4473
- writeFileEnsured((0, import_node_path13.join)(slice, "greet.use-case.ts"), NODE_FUNCTION_APP_GREET_USE_CASE);
4474
- writeFileEnsured((0, import_node_path13.join)(slice, "greet.use-case.spec.ts"), NODE_FUNCTION_APP_GREET_SPEC);
4475
- writeFileEnsured((0, import_node_path13.join)(slice, "greeting.contract.ts"), NODE_FUNCTION_APP_GREETING_CONTRACT);
4476
- writeFileEnsured((0, import_node_path13.join)(slice, "index.ts"), NODE_FUNCTION_APP_HELLO_BARREL);
4477
- }
4478
- writeFileEnsured((0, import_node_path13.join)(nodeFunctionAppRoot, "host.json"), NODE_FUNCTION_APP_HOST_JSON);
4788
+ const slice = (0, import_node_path17.join)(nodeFunctionAppRoot, "src/hello");
4789
+ writeFileEnsured((0, import_node_path17.join)(slice, "hello.handler.ts"), NODE_FUNCTION_APP_HELLO);
4790
+ writeFileEnsured((0, import_node_path17.join)(slice, "greet.use-case.ts"), NODE_FUNCTION_APP_GREET_USE_CASE);
4791
+ writeFileEnsured((0, import_node_path17.join)(slice, "greet.use-case.spec.ts"), NODE_FUNCTION_APP_GREET_SPEC);
4792
+ writeFileEnsured((0, import_node_path17.join)(slice, "greeting.contract.ts"), NODE_FUNCTION_APP_GREETING_CONTRACT);
4793
+ writeFileEnsured((0, import_node_path17.join)(slice, "index.ts"), NODE_FUNCTION_APP_HELLO_BARREL);
4794
+ }
4795
+ writeFileEnsured((0, import_node_path17.join)(nodeFunctionAppRoot, "host.json"), NODE_FUNCTION_APP_HOST_JSON);
4479
4796
  repairNodeFunctionAppManifest(nodeFunctionAppRoot, workspaceRoot);
4480
4797
  ensureAdmZip(workspaceRoot);
4481
- addNxTargets((0, import_node_path13.join)(nodeFunctionAppRoot, "package.json"), {
4798
+ addNxTargets((0, import_node_path17.join)(nodeFunctionAppRoot, "package.json"), {
4482
4799
  package: nodeFunctionAppPackageTarget(name),
4483
4800
  prune: nodeFunctionAppPruneTarget(name),
4484
4801
  start: nodeFunctionAppStartTarget(name),
@@ -4490,11 +4807,11 @@ function addNodeFunctionApp(workspaceRoot, name, stack, empty = false) {
4490
4807
  }
4491
4808
 
4492
4809
  // src/project-scaffolding/npm-lib.use-case.ts
4493
- var import_node_path17 = require("path");
4810
+ var import_node_path21 = require("path");
4494
4811
 
4495
4812
  // src/rollup-library/repair-publishable-manifest.use-case.ts
4496
- var import_node_fs12 = require("fs");
4497
- var import_node_path14 = require("path");
4813
+ var import_node_fs17 = require("fs");
4814
+ var import_node_path18 = require("path");
4498
4815
  var WRONG_TYPES_PATH = "./dist/index.esm.d.ts";
4499
4816
  var ACTUAL_TYPES_PATH = "./dist/src/index.d.ts";
4500
4817
  var DECLARATION_MAP_EXCLUSION = "!**/*.d.ts.map";
@@ -4517,14 +4834,14 @@ function repairPublishableManifest(manifestPath) {
4517
4834
  }
4518
4835
  function repairPublishableManifests(workspaceRoot) {
4519
4836
  const changed = [];
4520
- const manifests = (0, import_node_fs12.globSync)(["packages/*/package.json", "libs/*/package.json"], {
4837
+ const manifests = (0, import_node_fs17.globSync)(["packages/*/package.json", "libs/*/package.json"], {
4521
4838
  cwd: workspaceRoot
4522
4839
  });
4523
4840
  for (const relativePath of manifests) {
4524
- const manifestPath = (0, import_node_path14.join)(workspaceRoot, relativePath);
4525
- const before = (0, import_node_fs12.readFileSync)(manifestPath, "utf8");
4841
+ const manifestPath = (0, import_node_path18.join)(workspaceRoot, relativePath);
4842
+ const before = (0, import_node_fs17.readFileSync)(manifestPath, "utf8");
4526
4843
  repairPublishableManifest(manifestPath);
4527
- const after = (0, import_node_fs12.readFileSync)(manifestPath, "utf8");
4844
+ const after = (0, import_node_fs17.readFileSync)(manifestPath, "utf8");
4528
4845
  if (after !== before) {
4529
4846
  changed.push(relativePath.replaceAll("\\", "/"));
4530
4847
  }
@@ -4533,8 +4850,8 @@ function repairPublishableManifests(workspaceRoot) {
4533
4850
  }
4534
4851
 
4535
4852
  // src/rollup-library/repair-rollup-config.use-case.ts
4536
- var import_node_fs13 = require("fs");
4537
- var import_node_path15 = require("path");
4853
+ var import_node_fs18 = require("fs");
4854
+ var import_node_path19 = require("path");
4538
4855
 
4539
4856
  // src/rollup-library/rollup-config.algorithm.ts
4540
4857
  var ROLLUP_CONFIG_PLACEHOLDER = [
@@ -4736,12 +5053,12 @@ function withUpgradedDeclarationSpecifierPlugin(config) {
4736
5053
  // src/rollup-library/repair-rollup-config.use-case.ts
4737
5054
  function repairRollupSourceMaps(workspaceRoot) {
4738
5055
  const changed = [];
4739
- const configs = (0, import_node_fs13.globSync)(["packages/*/rollup.config.cjs", "libs/*/rollup.config.cjs"], {
5056
+ const configs = (0, import_node_fs18.globSync)(["packages/*/rollup.config.cjs", "libs/*/rollup.config.cjs"], {
4740
5057
  cwd: workspaceRoot
4741
5058
  });
4742
5059
  for (const relativePath of configs) {
4743
- const configPath = (0, import_node_path15.join)(workspaceRoot, relativePath);
4744
- const before = (0, import_node_fs13.readFileSync)(configPath, "utf8");
5060
+ const configPath = (0, import_node_path19.join)(workspaceRoot, relativePath);
5061
+ const before = (0, import_node_fs18.readFileSync)(configPath, "utf8");
4745
5062
  const after = withRollupSourceMaps(before);
4746
5063
  if (after !== before) {
4747
5064
  writeFileEnsured(configPath, after);
@@ -4752,12 +5069,12 @@ function repairRollupSourceMaps(workspaceRoot) {
4752
5069
  }
4753
5070
  function upgradeDeclarationSpecifierPlugins(workspaceRoot) {
4754
5071
  const changed = [];
4755
- const configs = (0, import_node_fs13.globSync)(["packages/*/rollup.config.cjs", "libs/*/rollup.config.cjs"], {
5072
+ const configs = (0, import_node_fs18.globSync)(["packages/*/rollup.config.cjs", "libs/*/rollup.config.cjs"], {
4756
5073
  cwd: workspaceRoot
4757
5074
  });
4758
5075
  for (const relativePath of configs) {
4759
- const configPath = (0, import_node_path15.join)(workspaceRoot, relativePath);
4760
- const before = (0, import_node_fs13.readFileSync)(configPath, "utf8");
5076
+ const configPath = (0, import_node_path19.join)(workspaceRoot, relativePath);
5077
+ const before = (0, import_node_fs18.readFileSync)(configPath, "utf8");
4761
5078
  const after = withUpgradedDeclarationSpecifierPlugin(before);
4762
5079
  if (after !== before) {
4763
5080
  writeFileEnsured(configPath, after);
@@ -4767,11 +5084,11 @@ function upgradeDeclarationSpecifierPlugins(workspaceRoot) {
4767
5084
  return changed;
4768
5085
  }
4769
5086
  function repairDeclarationSpecifiers(projectRoot) {
4770
- const configPath = (0, import_node_path15.join)(projectRoot, "rollup.config.cjs");
5087
+ const configPath = (0, import_node_path19.join)(projectRoot, "rollup.config.cjs");
4771
5088
  if (!fileExists(configPath)) {
4772
5089
  return;
4773
5090
  }
4774
- const config = (0, import_node_fs13.readFileSync)(configPath, "utf8");
5091
+ const config = (0, import_node_fs18.readFileSync)(configPath, "utf8");
4775
5092
  if (!config.includes(ROLLUP_CONFIG_PLACEHOLDER)) {
4776
5093
  return;
4777
5094
  }
@@ -4780,10 +5097,10 @@ function repairDeclarationSpecifiers(projectRoot) {
4780
5097
  }
4781
5098
 
4782
5099
  // src/rollup-library/rollup-config.repository.ts
4783
- var import_node_fs14 = require("fs");
4784
- var import_node_path16 = require("path");
5100
+ var import_node_fs19 = require("fs");
5101
+ var import_node_path20 = require("path");
4785
5102
  function resolveRequireTarget(fromDir, specifier) {
4786
- const base = (0, import_node_path16.join)(fromDir, specifier);
5103
+ const base = (0, import_node_path20.join)(fromDir, specifier);
4787
5104
  return [base, `${base}.cjs`, `${base}.js`].find((candidate) => fileExists(candidate));
4788
5105
  }
4789
5106
  function resolveRollupConfigText(configPath, visited = /* @__PURE__ */ new Set()) {
@@ -4793,7 +5110,7 @@ function resolveRollupConfigText(configPath, visited = /* @__PURE__ */ new Set()
4793
5110
  visited.add(configPath);
4794
5111
  let text;
4795
5112
  try {
4796
- text = (0, import_node_fs14.readFileSync)(configPath, "utf8");
5113
+ text = (0, import_node_fs19.readFileSync)(configPath, "utf8");
4797
5114
  } catch {
4798
5115
  return "";
4799
5116
  }
@@ -4801,15 +5118,15 @@ function resolveRollupConfigText(configPath, visited = /* @__PURE__ */ new Set()
4801
5118
  text.matchAll(/require\((['"])(\.[^'"]*)\1\)/g),
4802
5119
  (match) => match[2]
4803
5120
  );
4804
- const requiredText = specifiers.map((specifier) => resolveRequireTarget((0, import_node_path16.dirname)(configPath), specifier)).filter((target) => target !== void 0).map((target) => resolveRollupConfigText(target, visited));
5121
+ const requiredText = specifiers.map((specifier) => resolveRequireTarget((0, import_node_path20.dirname)(configPath), specifier)).filter((target) => target !== void 0).map((target) => resolveRollupConfigText(target, visited));
4805
5122
  return [text, ...requiredText].join("\n");
4806
5123
  }
4807
5124
 
4808
5125
  // src/project-scaffolding/npm-lib.use-case.ts
4809
5126
  async function addNpmLib(workspaceRoot, name, options, kindProvided, stack) {
4810
5127
  const scope = options.scope ?? (kindProvided ? defaultScope(workspaceRoot) : await promptText("npm scope for the published package", defaultScope(workspaceRoot)));
4811
- const projectRoot = (0, import_node_path17.join)(workspaceRoot, "packages", name);
4812
- const manifestPath = (0, import_node_path17.join)(projectRoot, "package.json");
5128
+ const projectRoot = (0, import_node_path21.join)(workspaceRoot, "packages", name);
5129
+ const manifestPath = (0, import_node_path21.join)(projectRoot, "package.json");
4813
5130
  runGeneratorAndRepair(
4814
5131
  workspaceRoot,
4815
5132
  [
@@ -4838,8 +5155,8 @@ async function addNpmLib(workspaceRoot, name, options, kindProvided, stack) {
4838
5155
  }
4839
5156
 
4840
5157
  // src/project-scaffolding/python.use-case.ts
4841
- var import_node_fs15 = require("fs");
4842
- var import_node_path18 = require("path");
5158
+ var import_node_fs20 = require("fs");
5159
+ var import_node_path22 = require("path");
4843
5160
  function ensurePython(workspaceRoot) {
4844
5161
  const hasPython = runShell("python3", ["--version"], workspaceRoot) === 0 || runShell("python", ["--version"], workspaceRoot) === 0;
4845
5162
  if (!hasPython) {
@@ -4862,7 +5179,7 @@ function ensurePythonPipPlugin(workspaceRoot) {
4862
5179
  registerPythonGraphPlugin(workspaceRoot);
4863
5180
  }
4864
5181
  function registerPythonGraphPlugin(workspaceRoot) {
4865
- const nxJsonPath = (0, import_node_path18.join)(workspaceRoot, "nx.json");
5182
+ const nxJsonPath = (0, import_node_path22.join)(workspaceRoot, "nx.json");
4866
5183
  if (!fileExists(nxJsonPath)) {
4867
5184
  return;
4868
5185
  }
@@ -4885,7 +5202,7 @@ pytest
4885
5202
  pip-audit
4886
5203
  `;
4887
5204
  function ensureRequirementsDev(workspaceRoot) {
4888
- const requirementsDevPath = (0, import_node_path18.join)(workspaceRoot, "requirements-dev.txt");
5205
+ const requirementsDevPath = (0, import_node_path22.join)(workspaceRoot, "requirements-dev.txt");
4889
5206
  if (!fileExists(requirementsDevPath)) {
4890
5207
  writeFileEnsured(requirementsDevPath, PYTHON_REQUIREMENTS_DEV);
4891
5208
  }
@@ -4945,8 +5262,8 @@ function addPythonApp(workspaceRoot, name) {
4945
5262
  ["g", "@mnci/nx-python-pip:application", name, `--directory=apps/${name}`, "--no-interactive"],
4946
5263
  workspaceRoot
4947
5264
  );
4948
- writeFileEnsured((0, import_node_path18.join)(workspaceRoot, "apps", name, "main.py"), pythonAppMain(name));
4949
- addProjectJsonTargets((0, import_node_path18.join)(workspaceRoot, "apps", name, "project.json"), {
5265
+ writeFileEnsured((0, import_node_path22.join)(workspaceRoot, "apps", name, "main.py"), pythonAppMain(name));
5266
+ addProjectJsonTargets((0, import_node_path22.join)(workspaceRoot, "apps", name, "project.json"), {
4950
5267
  package: pythonAppPackageTarget(name),
4951
5268
  start: pythonAppStartTarget(name)
4952
5269
  });
@@ -4968,7 +5285,7 @@ function addPythonFunctionApp(workspaceRoot, name) {
4968
5285
  workspaceRoot
4969
5286
  );
4970
5287
  const moduleDirectory = pythonModuleDirectory(name);
4971
- addProjectJsonTargets((0, import_node_path18.join)(workspaceRoot, "apps", name, "project.json"), {
5288
+ addProjectJsonTargets((0, import_node_path22.join)(workspaceRoot, "apps", name, "project.json"), {
4972
5289
  package: pythonFunctionAppPackageTarget(name, moduleDirectory),
4973
5290
  start: pythonFunctionAppStartTarget(name)
4974
5291
  });
@@ -5009,7 +5326,7 @@ function addPythonInternalLib(workspaceRoot, name) {
5009
5326
  var PYTHON_PROJECT_DIRS = ["apps", "python-packages", "libs"];
5010
5327
  function findPythonProjectDirectory(workspaceRoot, name) {
5011
5328
  return PYTHON_PROJECT_DIRS.find(
5012
- (directory) => fileExists((0, import_node_path18.join)(workspaceRoot, directory, name, "pyproject.toml"))
5329
+ (directory) => fileExists((0, import_node_path22.join)(workspaceRoot, directory, name, "pyproject.toml"))
5013
5330
  );
5014
5331
  }
5015
5332
  function parseVendorEntries(pyprojectToml) {
@@ -5048,7 +5365,7 @@ async function addPythonVendor(workspaceRoot, consumer, options, kindProvided) {
5048
5365
  `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.`
5049
5366
  );
5050
5367
  }
5051
- if (!fileExists((0, import_node_path18.join)(workspaceRoot, "libs", lib, "pyproject.toml"))) {
5368
+ if (!fileExists((0, import_node_path22.join)(workspaceRoot, "libs", lib, "pyproject.toml"))) {
5052
5369
  throw new Error(
5053
5370
  `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.`
5054
5371
  );
@@ -5056,8 +5373,8 @@ async function addPythonVendor(workspaceRoot, consumer, options, kindProvided) {
5056
5373
  if (consumerDirectory === "libs" && consumer === lib) {
5057
5374
  throw new Error(`'${consumer}' cannot vendor itself.`);
5058
5375
  }
5059
- const pyprojectPath = (0, import_node_path18.join)(workspaceRoot, consumerDirectory, consumer, "pyproject.toml");
5060
- const pyprojectToml = (0, import_node_fs15.readFileSync)(pyprojectPath, "utf8");
5376
+ const pyprojectPath = (0, import_node_path22.join)(workspaceRoot, consumerDirectory, consumer, "pyproject.toml");
5377
+ const pyprojectToml = (0, import_node_fs20.readFileSync)(pyprojectPath, "utf8");
5061
5378
  if (parseVendorEntries(pyprojectToml).includes(lib)) {
5062
5379
  logger.info(`'${consumer}' already vendors '${lib}' \u2014 nothing to do.`);
5063
5380
  return;
@@ -5069,8 +5386,8 @@ async function addPythonVendor(workspaceRoot, consumer, options, kindProvided) {
5069
5386
  }
5070
5387
 
5071
5388
  // src/project-scaffolding/react-app.use-case.ts
5072
- var import_node_fs16 = require("fs");
5073
- var import_node_path19 = require("path");
5389
+ var import_node_fs21 = require("fs");
5390
+ var import_node_path23 = require("path");
5074
5391
 
5075
5392
  // src/project-scaffolding/react-app-example.algorithm.ts
5076
5393
  function reactAppExampleFiles(name) {
@@ -5187,12 +5504,12 @@ function reactAppTargets(name) {
5187
5504
  return targets;
5188
5505
  }
5189
5506
  function allowEnvFiles(workspaceRoot) {
5190
- const gitignorePath = (0, import_node_path19.join)(workspaceRoot, ".gitignore");
5507
+ const gitignorePath = (0, import_node_path23.join)(workspaceRoot, ".gitignore");
5191
5508
  if (!fileExists(gitignorePath)) {
5192
5509
  return;
5193
5510
  }
5194
5511
  const marker = "# MoNecromanCI: keep the committed per-environment Vite config (public VITE_ values)";
5195
- const current = (0, import_node_fs16.readFileSync)(gitignorePath, "utf8");
5512
+ const current = (0, import_node_fs21.readFileSync)(gitignorePath, "utf8");
5196
5513
  if (current.includes(marker)) {
5197
5514
  return;
5198
5515
  }
@@ -5219,30 +5536,30 @@ function addReactApp(workspaceRoot, name, stack) {
5219
5536
  workspaceRoot
5220
5537
  );
5221
5538
  ensureAdmZip(workspaceRoot);
5222
- const reactAppRoot = (0, import_node_path19.join)(workspaceRoot, "apps", name);
5539
+ const reactAppRoot = (0, import_node_path23.join)(workspaceRoot, "apps", name);
5223
5540
  for (const environment of REACT_ENVIRONMENTS) {
5224
- writeFileEnsured((0, import_node_path19.join)(reactAppRoot, `.env.${environment}`), reactEnvironmentFile(environment));
5541
+ writeFileEnsured((0, import_node_path23.join)(reactAppRoot, `.env.${environment}`), reactEnvironmentFile(environment));
5225
5542
  }
5226
5543
  allowEnvFiles(workspaceRoot);
5227
- addNxTargets((0, import_node_path19.join)(reactAppRoot, "package.json"), reactAppTargets(name));
5544
+ addNxTargets((0, import_node_path23.join)(reactAppRoot, "package.json"), reactAppTargets(name));
5228
5545
  reshapeReactAppScaffold(reactAppRoot);
5229
- (0, import_node_fs16.rmSync)((0, import_node_path19.join)(reactAppRoot, "src/app/nx-welcome.component.tsx"), { force: true });
5546
+ (0, import_node_fs21.rmSync)((0, import_node_path23.join)(reactAppRoot, "src/app/nx-welcome.component.tsx"), { force: true });
5230
5547
  const example = reactAppExampleFiles(name);
5231
5548
  for (const [relative, contents] of Object.entries(example)) {
5232
- writeFileEnsured((0, import_node_path19.join)(reactAppRoot, "src", relative), contents);
5549
+ writeFileEnsured((0, import_node_path23.join)(reactAppRoot, "src", relative), contents);
5233
5550
  }
5234
5551
  removeGeneratedEslintConfig(workspaceRoot, `apps/${name}`);
5235
5552
  registerProjectCommands(workspaceRoot, name, { build: true, start: `nx run ${name}:serve` });
5236
5553
  }
5237
5554
 
5238
5555
  // src/project-scaffolding/react-lib.use-case.ts
5239
- var import_node_path20 = require("path");
5556
+ var import_node_path24 = require("path");
5240
5557
  var REACT_LIB_BUNDLER = "rollup";
5241
5558
  async function addReactLib(workspaceRoot, name, options, kindProvided, stack) {
5242
5559
  ensurePlugin(workspaceRoot, "@nx/react");
5243
5560
  const scope = options.scope ?? (kindProvided ? defaultScope(workspaceRoot) : await promptText("npm scope for the published package", defaultScope(workspaceRoot)));
5244
- const projectRoot = (0, import_node_path20.join)(workspaceRoot, "packages", name);
5245
- const publishableManifest = (0, import_node_path20.join)(projectRoot, "package.json");
5561
+ const projectRoot = (0, import_node_path24.join)(workspaceRoot, "packages", name);
5562
+ const publishableManifest = (0, import_node_path24.join)(projectRoot, "package.json");
5246
5563
  runGeneratorAndRepair(
5247
5564
  workspaceRoot,
5248
5565
  [
@@ -5272,8 +5589,8 @@ async function addReactLib(workspaceRoot, name, options, kindProvided, stack) {
5272
5589
  }
5273
5590
  function addReactInternalLib(workspaceRoot, name, stack, empty = false) {
5274
5591
  ensurePlugin(workspaceRoot, "@nx/react");
5275
- const projectRoot = (0, import_node_path20.join)(workspaceRoot, "libs", name);
5276
- const privateManifest = (0, import_node_path20.join)(projectRoot, "package.json");
5592
+ const projectRoot = (0, import_node_path24.join)(workspaceRoot, "libs", name);
5593
+ const privateManifest = (0, import_node_path24.join)(projectRoot, "package.json");
5277
5594
  runGeneratorAndRepair(
5278
5595
  workspaceRoot,
5279
5596
  [
@@ -5300,8 +5617,8 @@ function addReactInternalLib(workspaceRoot, name, stack, empty = false) {
5300
5617
  }
5301
5618
 
5302
5619
  // src/project-scaffolding/vscode-extension.use-case.ts
5303
- var import_node_fs17 = require("fs");
5304
- var import_node_path21 = require("path");
5620
+ var import_node_fs22 = require("fs");
5621
+ var import_node_path25 = require("path");
5305
5622
  var VSCODE_EXTENSION_SCRIPT_PATH = "tools/vscode-extension.cjs";
5306
5623
  var VSCODE_ENGINE_FLOOR = "1.96.0";
5307
5624
  var VSCODE_SIDECAR_TARGETS = {
@@ -5486,8 +5803,8 @@ export const window = {
5486
5803
  var VSCODE_STUB_PATH = "test/vscode.stub.ts";
5487
5804
  function mapVscodeToStub(projectRoot, testRunner) {
5488
5805
  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}\` },`];
5489
- const path = (0, import_node_path21.join)(projectRoot, file);
5490
- const content = fileExists(path) ? (0, import_node_fs17.readFileSync)(path, "utf8") : "";
5806
+ const path = (0, import_node_path25.join)(projectRoot, file);
5807
+ const content = fileExists(path) ? (0, import_node_fs22.readFileSync)(path, "utf8") : "";
5491
5808
  const line = content.split("\n").find((candidate) => candidate.trim() === anchor);
5492
5809
  if (line === void 0) {
5493
5810
  throw new Error(`${file} has no "${anchor}" line to map the vscode module after; map 'vscode' to ${VSCODE_STUB_PATH} by hand.`);
@@ -5507,11 +5824,11 @@ function ensureVscodeToolchain(workspaceRoot) {
5507
5824
  }
5508
5825
  }
5509
5826
  function defaultPublisher(workspaceRoot) {
5510
- const { name } = readJson((0, import_node_path21.join)(workspaceRoot, "package.json"));
5827
+ const { name } = readJson((0, import_node_path25.join)(workspaceRoot, "package.json"));
5511
5828
  return (name ?? "publisher").replace(/^@/, "").split("/", 1)[0];
5512
5829
  }
5513
5830
  function reshapeManifest(projectRoot, name, publisher) {
5514
- const manifestPath = (0, import_node_path21.join)(projectRoot, "package.json");
5831
+ const manifestPath = (0, import_node_path25.join)(projectRoot, "package.json");
5515
5832
  const manifest = readJson(manifestPath);
5516
5833
  const { nx = {}, ...rest } = manifest;
5517
5834
  const targets = { ...nx.targets };
@@ -5575,11 +5892,11 @@ function vscodeExtensionPublishTarget(name, sidecar) {
5575
5892
  };
5576
5893
  }
5577
5894
  function addDebugLaunch(workspaceRoot, name) {
5578
- const file = (0, import_node_fs17.readdirSync)(workspaceRoot).find((entry) => entry.endsWith(".code-workspace"));
5895
+ const file = (0, import_node_fs22.readdirSync)(workspaceRoot).find((entry) => entry.endsWith(".code-workspace"));
5579
5896
  if (file === void 0) {
5580
5897
  return;
5581
5898
  }
5582
- const path = (0, import_node_path21.join)(workspaceRoot, file);
5899
+ const path = (0, import_node_path25.join)(workspaceRoot, file);
5583
5900
  const workspace = readCodeWorkspace(path) ?? {};
5584
5901
  const folder = `\${workspaceFolder:${workspace.folders?.[0]?.name ?? file.replace(/\.code-workspace$/, "")}}`;
5585
5902
  const taskLabel = `${name}: build (development)`;
@@ -5612,39 +5929,39 @@ function addDebugLaunch(workspaceRoot, name) {
5612
5929
  );
5613
5930
  }
5614
5931
  function refreshVscodeExtensionScript(workspaceRoot) {
5615
- const apps = (0, import_node_path21.join)(workspaceRoot, "apps");
5932
+ const apps = (0, import_node_path25.join)(workspaceRoot, "apps");
5616
5933
  let entries;
5617
5934
  try {
5618
- entries = (0, import_node_fs17.readdirSync)(apps);
5935
+ entries = (0, import_node_fs22.readdirSync)(apps);
5619
5936
  } catch {
5620
5937
  return false;
5621
5938
  }
5622
5939
  const hasExtension = entries.some((entry) => {
5623
- const manifestPath = (0, import_node_path21.join)(apps, entry, "package.json");
5940
+ const manifestPath = (0, import_node_path25.join)(apps, entry, "package.json");
5624
5941
  if (!fileExists(manifestPath)) {
5625
5942
  return false;
5626
5943
  }
5627
5944
  const tags = readJson(manifestPath).nx?.tags ?? [];
5628
5945
  return tags.includes(VSCODE_EXTENSION_TAG);
5629
5946
  });
5630
- const path = (0, import_node_path21.join)(workspaceRoot, VSCODE_EXTENSION_SCRIPT_PATH);
5631
- if (!hasExtension || fileExists(path) && (0, import_node_fs17.readFileSync)(path, "utf8") === VSCODE_EXTENSION_SCRIPT) {
5947
+ const path = (0, import_node_path25.join)(workspaceRoot, VSCODE_EXTENSION_SCRIPT_PATH);
5948
+ if (!hasExtension || fileExists(path) && (0, import_node_fs22.readFileSync)(path, "utf8") === VSCODE_EXTENSION_SCRIPT) {
5632
5949
  return false;
5633
5950
  }
5634
5951
  writeFileEnsured(path, VSCODE_EXTENSION_SCRIPT);
5635
5952
  return true;
5636
5953
  }
5637
5954
  function pinVscodeExtensionProjectNames(workspaceRoot) {
5638
- const apps = (0, import_node_path21.join)(workspaceRoot, "apps");
5955
+ const apps = (0, import_node_path25.join)(workspaceRoot, "apps");
5639
5956
  let entries;
5640
5957
  try {
5641
- entries = (0, import_node_fs17.readdirSync)(apps);
5958
+ entries = (0, import_node_fs22.readdirSync)(apps);
5642
5959
  } catch {
5643
5960
  return [];
5644
5961
  }
5645
5962
  const updated = [];
5646
5963
  for (const entry of entries) {
5647
- const manifestPath = (0, import_node_path21.join)(apps, entry, "package.json");
5964
+ const manifestPath = (0, import_node_path25.join)(apps, entry, "package.json");
5648
5965
  if (!fileExists(manifestPath)) {
5649
5966
  continue;
5650
5967
  }
@@ -5664,22 +5981,22 @@ function refreshLockFile(workspaceRoot, name) {
5664
5981
  }
5665
5982
  function addVscodeExtension(workspaceRoot, name, stack, options = {}) {
5666
5983
  const { sidecar } = options;
5667
- if (sidecar !== void 0 && !fileExists((0, import_node_path21.join)(workspaceRoot, "apps", sidecar, "project.json"))) {
5984
+ if (sidecar !== void 0 && !fileExists((0, import_node_path25.join)(workspaceRoot, "apps", sidecar, "project.json"))) {
5668
5985
  throw new Error(`--sidecar ${sidecar}: no Go app at apps/${sidecar}. Add it first with \`mnci add go-app ${sidecar}\`.`);
5669
5986
  }
5670
5987
  runNodeApp(workspaceRoot, name, stack, "none");
5671
5988
  ensureVscodeToolchain(workspaceRoot);
5672
- const projectRoot = (0, import_node_path21.join)(workspaceRoot, "apps", name);
5989
+ const projectRoot = (0, import_node_path25.join)(workspaceRoot, "apps", name);
5673
5990
  reshapeManifest(projectRoot, name, options.publisher ?? defaultPublisher(workspaceRoot));
5674
- addVscodeTypes((0, import_node_path21.join)(projectRoot, "tsconfig.app.json"));
5675
- addVscodeTypes((0, import_node_path21.join)(projectRoot, "tsconfig.spec.json"));
5676
- writeFileEnsured((0, import_node_path21.join)(projectRoot, "src/main.ts"), vscodeExtensionMain(name));
5677
- writeFileEnsured((0, import_node_path21.join)(projectRoot, "src/main.spec.ts"), vscodeExtensionMainSpec(name));
5678
- writeFileEnsured((0, import_node_path21.join)(projectRoot, VSCODE_STUB_PATH), VSCODE_STUB);
5991
+ addVscodeTypes((0, import_node_path25.join)(projectRoot, "tsconfig.app.json"));
5992
+ addVscodeTypes((0, import_node_path25.join)(projectRoot, "tsconfig.spec.json"));
5993
+ writeFileEnsured((0, import_node_path25.join)(projectRoot, "src/main.ts"), vscodeExtensionMain(name));
5994
+ writeFileEnsured((0, import_node_path25.join)(projectRoot, "src/main.spec.ts"), vscodeExtensionMainSpec(name));
5995
+ writeFileEnsured((0, import_node_path25.join)(projectRoot, VSCODE_STUB_PATH), VSCODE_STUB);
5679
5996
  mapVscodeToStub(projectRoot, stack.testRunner);
5680
- writeFileEnsured((0, import_node_path21.join)(projectRoot, ".vscodeignore"), VSCODE_IGNORE);
5681
- writeFileEnsured((0, import_node_path21.join)(workspaceRoot, VSCODE_EXTENSION_SCRIPT_PATH), VSCODE_EXTENSION_SCRIPT);
5682
- addNxTargets((0, import_node_path21.join)(projectRoot, "package.json"), {
5997
+ writeFileEnsured((0, import_node_path25.join)(projectRoot, ".vscodeignore"), VSCODE_IGNORE);
5998
+ writeFileEnsured((0, import_node_path25.join)(workspaceRoot, VSCODE_EXTENSION_SCRIPT_PATH), VSCODE_EXTENSION_SCRIPT);
5999
+ addNxTargets((0, import_node_path25.join)(projectRoot, "package.json"), {
5683
6000
  "package": vscodeExtensionPackageTarget(name, sidecar),
5684
6001
  "nx-release-publish": vscodeExtensionPublishTarget(name, sidecar)
5685
6002
  });
@@ -5690,12 +6007,12 @@ function addVscodeExtension(workspaceRoot, name, stack, options = {}) {
5690
6007
  }
5691
6008
 
5692
6009
  // src/dependency-management/install-dependencies.use-case.ts
5693
- var import_node_fs19 = require("fs");
5694
- var import_node_path23 = require("path");
6010
+ var import_node_fs24 = require("fs");
6011
+ var import_node_path27 = require("path");
5695
6012
 
5696
6013
  // src/dependency-management/manifest.repository.ts
5697
- var import_node_fs18 = require("fs");
5698
- var import_node_path22 = require("path");
6014
+ var import_node_fs23 = require("fs");
6015
+ var import_node_path26 = require("path");
5699
6016
  var ECOSYSTEMS = ["npm", "pip", "pub", "nuget", "go"];
5700
6017
  var ROOT_LABEL = "(root)";
5701
6018
  var MANIFEST_GLOBS = {
@@ -5728,23 +6045,23 @@ function projectOf(manifestRelativePath) {
5728
6045
  }
5729
6046
  function hasEcosystem(workspaceRoot, ecosystem) {
5730
6047
  if (ecosystem === "go") {
5731
- return fileExists((0, import_node_path22.join)(workspaceRoot, "go.mod"));
6048
+ return fileExists((0, import_node_path26.join)(workspaceRoot, "go.mod"));
5732
6049
  }
5733
6050
  if (ecosystem === "nuget") {
5734
- return (0, import_node_fs18.globSync)(MANIFEST_GLOBS.nuget, { cwd: workspaceRoot }).length > 0;
6051
+ return (0, import_node_fs23.globSync)(MANIFEST_GLOBS.nuget, { cwd: workspaceRoot }).length > 0;
5735
6052
  }
5736
6053
  const rootMarker = {
5737
6054
  npm: "package.json",
5738
6055
  pip: "requirements-dev.txt",
5739
6056
  pub: "pubspec.yaml"
5740
6057
  };
5741
- return fileExists((0, import_node_path22.join)(workspaceRoot, rootMarker[ecosystem])) || (0, import_node_fs18.globSync)(MANIFEST_GLOBS[ecosystem], { cwd: workspaceRoot }).length > 0;
6058
+ return fileExists((0, import_node_path26.join)(workspaceRoot, rootMarker[ecosystem])) || (0, import_node_fs23.globSync)(MANIFEST_GLOBS[ecosystem], { cwd: workspaceRoot }).length > 0;
5742
6059
  }
5743
6060
  function collectNpm(workspaceRoot) {
5744
6061
  const sites = [];
5745
- const relativePaths = ["package.json", ...(0, import_node_fs18.globSync)(MANIFEST_GLOBS.npm, { cwd: workspaceRoot })];
6062
+ const relativePaths = ["package.json", ...(0, import_node_fs23.globSync)(MANIFEST_GLOBS.npm, { cwd: workspaceRoot })];
5746
6063
  for (const relativePath of relativePaths) {
5747
- const manifestPath = (0, import_node_path22.join)(workspaceRoot, relativePath);
6064
+ const manifestPath = (0, import_node_path26.join)(workspaceRoot, relativePath);
5748
6065
  try {
5749
6066
  const manifest = readJson(manifestPath);
5750
6067
  sites.push(...npmManifestSites(manifest, relativePath, manifestPath));
@@ -5805,17 +6122,17 @@ function collectPip(workspaceRoot) {
5805
6122
  name: parsed.name,
5806
6123
  ecosystem: "pip",
5807
6124
  project: projectOf(relativePath),
5808
- manifestPath: (0, import_node_path22.join)(workspaceRoot, relativePath),
6125
+ manifestPath: (0, import_node_path26.join)(workspaceRoot, relativePath),
5809
6126
  section,
5810
6127
  spec: parsed.spec,
5811
6128
  rewritable: parsed.rewritable && parsed.spec !== ""
5812
6129
  });
5813
6130
  };
5814
- const pyprojectPaths = (0, import_node_fs18.globSync)(MANIFEST_GLOBS.pip, { cwd: workspaceRoot });
6131
+ const pyprojectPaths = (0, import_node_fs23.globSync)(MANIFEST_GLOBS.pip, { cwd: workspaceRoot });
5815
6132
  for (const relativePath of pyprojectPaths) {
5816
6133
  let content;
5817
6134
  try {
5818
- content = (0, import_node_fs18.readFileSync)((0, import_node_path22.join)(workspaceRoot, relativePath), "utf8");
6135
+ content = (0, import_node_fs23.readFileSync)((0, import_node_path26.join)(workspaceRoot, relativePath), "utf8");
5819
6136
  } catch {
5820
6137
  continue;
5821
6138
  }
@@ -5826,14 +6143,14 @@ function collectPip(workspaceRoot) {
5826
6143
  }
5827
6144
  const requirementsPaths = [
5828
6145
  "requirements-dev.txt",
5829
- ...(0, import_node_fs18.globSync)("apps/*/requirements.txt", { cwd: workspaceRoot })
6146
+ ...(0, import_node_fs23.globSync)("apps/*/requirements.txt", { cwd: workspaceRoot })
5830
6147
  ];
5831
6148
  for (const relativePath of requirementsPaths) {
5832
- if (!fileExists((0, import_node_path22.join)(workspaceRoot, relativePath))) {
6149
+ if (!fileExists((0, import_node_path26.join)(workspaceRoot, relativePath))) {
5833
6150
  continue;
5834
6151
  }
5835
6152
  const section = relativePath === "requirements-dev.txt" ? "devDep" : "dep";
5836
- const lines = (0, import_node_fs18.readFileSync)((0, import_node_path22.join)(workspaceRoot, relativePath), "utf8").split(/\r?\n/);
6153
+ const lines = (0, import_node_fs23.readFileSync)((0, import_node_path26.join)(workspaceRoot, relativePath), "utf8").split(/\r?\n/);
5837
6154
  for (const line of lines) {
5838
6155
  push(relativePath, section, line);
5839
6156
  }
@@ -5871,11 +6188,11 @@ function pyprojectDependencies(content) {
5871
6188
  }
5872
6189
  function collectPub(workspaceRoot) {
5873
6190
  const sites = [];
5874
- const pubspecPaths = (0, import_node_fs18.globSync)(MANIFEST_GLOBS.pub, { cwd: workspaceRoot });
6191
+ const pubspecPaths = (0, import_node_fs23.globSync)(MANIFEST_GLOBS.pub, { cwd: workspaceRoot });
5875
6192
  for (const relativePath of pubspecPaths) {
5876
6193
  let content;
5877
6194
  try {
5878
- content = (0, import_node_fs18.readFileSync)((0, import_node_path22.join)(workspaceRoot, relativePath), "utf8");
6195
+ content = (0, import_node_fs23.readFileSync)((0, import_node_path26.join)(workspaceRoot, relativePath), "utf8");
5879
6196
  } catch {
5880
6197
  continue;
5881
6198
  }
@@ -5885,7 +6202,7 @@ function collectPub(workspaceRoot) {
5885
6202
  name: entry.name,
5886
6203
  ecosystem: "pub",
5887
6204
  project: projectOf(relativePath),
5888
- manifestPath: (0, import_node_path22.join)(workspaceRoot, relativePath),
6205
+ manifestPath: (0, import_node_path26.join)(workspaceRoot, relativePath),
5889
6206
  section: block === "dependencies" ? "dep" : "devDep",
5890
6207
  spec: entry.spec,
5891
6208
  rewritable: entry.spec !== ""
@@ -5935,11 +6252,11 @@ function stripQuotes(value) {
5935
6252
  }
5936
6253
  function collectNuget(workspaceRoot) {
5937
6254
  const sites = [];
5938
- const csprojPaths = (0, import_node_fs18.globSync)(MANIFEST_GLOBS.nuget, { cwd: workspaceRoot });
6255
+ const csprojPaths = (0, import_node_fs23.globSync)(MANIFEST_GLOBS.nuget, { cwd: workspaceRoot });
5939
6256
  for (const relativePath of csprojPaths) {
5940
6257
  let content;
5941
6258
  try {
5942
- content = (0, import_node_fs18.readFileSync)((0, import_node_path22.join)(workspaceRoot, relativePath), "utf8");
6259
+ content = (0, import_node_fs23.readFileSync)((0, import_node_path26.join)(workspaceRoot, relativePath), "utf8");
5943
6260
  } catch {
5944
6261
  continue;
5945
6262
  }
@@ -5948,7 +6265,7 @@ function collectNuget(workspaceRoot) {
5948
6265
  name: entry.name,
5949
6266
  ecosystem: "nuget",
5950
6267
  project: projectOf(relativePath),
5951
- manifestPath: (0, import_node_path22.join)(workspaceRoot, relativePath),
6268
+ manifestPath: (0, import_node_path26.join)(workspaceRoot, relativePath),
5952
6269
  section: "dep",
5953
6270
  spec: entry.spec,
5954
6271
  // A plain SemVer string is rewritable; an MSBuild property reference
@@ -5973,13 +6290,13 @@ function csprojPackageReferences(content) {
5973
6290
  return entries;
5974
6291
  }
5975
6292
  function collectGo(workspaceRoot) {
5976
- const manifestPath = (0, import_node_path22.join)(workspaceRoot, "go.mod");
6293
+ const manifestPath = (0, import_node_path26.join)(workspaceRoot, "go.mod");
5977
6294
  if (!fileExists(manifestPath)) {
5978
6295
  return [];
5979
6296
  }
5980
6297
  let content;
5981
6298
  try {
5982
- content = (0, import_node_fs18.readFileSync)(manifestPath, "utf8");
6299
+ content = (0, import_node_fs23.readFileSync)(manifestPath, "utf8");
5983
6300
  } catch {
5984
6301
  return [];
5985
6302
  }
@@ -6028,7 +6345,7 @@ var PROJECT_GLOBS = {
6028
6345
  function locateProjects(workspaceRoot) {
6029
6346
  const locations = [];
6030
6347
  for (const ecosystem of ECOSYSTEMS) {
6031
- const relativePaths = (0, import_node_fs18.globSync)(PROJECT_GLOBS[ecosystem], { cwd: workspaceRoot });
6348
+ const relativePaths = (0, import_node_fs23.globSync)(PROJECT_GLOBS[ecosystem], { cwd: workspaceRoot });
6032
6349
  for (const relativePath of relativePaths) {
6033
6350
  const posix = toPosix(relativePath);
6034
6351
  const dir = posix.slice(0, posix.lastIndexOf("/"));
@@ -6036,7 +6353,7 @@ function locateProjects(workspaceRoot) {
6036
6353
  ecosystem,
6037
6354
  dir,
6038
6355
  name: dir.slice(dir.lastIndexOf("/") + 1),
6039
- manifestPath: (0, import_node_path22.join)(workspaceRoot, relativePath)
6356
+ manifestPath: (0, import_node_path26.join)(workspaceRoot, relativePath)
6040
6357
  });
6041
6358
  }
6042
6359
  }
@@ -6057,7 +6374,7 @@ function rewriteSpec(site, spec) {
6057
6374
  writeFileEnsured(site.manifestPath, toJson(manifest));
6058
6375
  return true;
6059
6376
  }
6060
- const before = (0, import_node_fs18.readFileSync)(site.manifestPath, "utf8");
6377
+ const before = (0, import_node_fs23.readFileSync)(site.manifestPath, "utf8");
6061
6378
  const after = (() => {
6062
6379
  switch (site.ecosystem) {
6063
6380
  case "pip": {
@@ -6148,13 +6465,13 @@ function escapeForRegex(value) {
6148
6465
  function isWorkspaceProject(workspaceRoot, name) {
6149
6466
  const short = name.includes("/") ? name.split("/").at(-1) : name;
6150
6467
  return ["apps", "libs", "packages"].some(
6151
- (directory) => fileExists((0, import_node_path22.join)(workspaceRoot, directory, short ?? name, "package.json"))
6468
+ (directory) => fileExists((0, import_node_path26.join)(workspaceRoot, directory, short ?? name, "package.json"))
6152
6469
  );
6153
6470
  }
6154
6471
  function isAliasedInstall(workspaceRoot, name) {
6155
6472
  try {
6156
6473
  const installed = readJson(
6157
- (0, import_node_path22.join)(workspaceRoot, "node_modules", name, "package.json")
6474
+ (0, import_node_path26.join)(workspaceRoot, "node_modules", name, "package.json")
6158
6475
  );
6159
6476
  return installed.name !== void 0 && installed.name !== name;
6160
6477
  } catch {
@@ -6165,14 +6482,14 @@ function resolvedVersion(workspaceRoot, ecosystem, name) {
6165
6482
  if (ecosystem === "npm") {
6166
6483
  try {
6167
6484
  return readJson(
6168
- (0, import_node_path22.join)(workspaceRoot, "node_modules", name, "package.json")
6485
+ (0, import_node_path26.join)(workspaceRoot, "node_modules", name, "package.json")
6169
6486
  ).version;
6170
6487
  } catch {
6171
6488
  return void 0;
6172
6489
  }
6173
6490
  }
6174
6491
  if (ecosystem === "pub") {
6175
- const lockPath = (0, import_node_path22.join)(workspaceRoot, "pubspec.lock");
6492
+ const lockPath = (0, import_node_path26.join)(workspaceRoot, "pubspec.lock");
6176
6493
  if (!fileExists(lockPath)) {
6177
6494
  return void 0;
6178
6495
  }
@@ -6180,7 +6497,7 @@ function resolvedVersion(workspaceRoot, ecosystem, name) {
6180
6497
  const match = new RegExp(
6181
6498
  String.raw`^\s{2}${escapeForRegex(name)}:[^]*?^\s+version:\s*["']?([^"'\s]+)`,
6182
6499
  "m"
6183
- ).exec((0, import_node_fs18.readFileSync)(lockPath, "utf8"));
6500
+ ).exec((0, import_node_fs23.readFileSync)(lockPath, "utf8"));
6184
6501
  return match?.[1];
6185
6502
  } catch {
6186
6503
  return void 0;
@@ -6246,7 +6563,7 @@ function resolveTarget(locations, target) {
6246
6563
  return byName[0];
6247
6564
  }
6248
6565
  function installInto(workspaceRoot, location, packages, saveDev) {
6249
- const projectDir = (0, import_node_path23.join)(workspaceRoot, location.dir);
6566
+ const projectDir = (0, import_node_path27.join)(workspaceRoot, location.dir);
6250
6567
  switch (location.ecosystem) {
6251
6568
  case "npm": {
6252
6569
  const flags = saveDev ? ["--save-dev"] : [];
@@ -6299,7 +6616,7 @@ function installInto(workspaceRoot, location, packages, saveDev) {
6299
6616
  function addPythonDependency(manifestPath, specifier) {
6300
6617
  let content;
6301
6618
  try {
6302
- content = (0, import_node_fs19.readFileSync)(manifestPath, "utf8");
6619
+ content = (0, import_node_fs24.readFileSync)(manifestPath, "utf8");
6303
6620
  } catch {
6304
6621
  logger.warn(`Could not read ${manifestPath} \u2014 skipped ${specifier}`);
6305
6622
  return;
@@ -6328,7 +6645,7 @@ function installEverything(workspaceRoot, only) {
6328
6645
  }
6329
6646
  function ecosystemPresent(workspaceRoot, ecosystem) {
6330
6647
  if (ecosystem === "go") {
6331
- return fileExists((0, import_node_path23.join)(workspaceRoot, "go.work")) || fileExists((0, import_node_path23.join)(workspaceRoot, "go.mod"));
6648
+ return fileExists((0, import_node_path27.join)(workspaceRoot, "go.work")) || fileExists((0, import_node_path27.join)(workspaceRoot, "go.mod"));
6332
6649
  }
6333
6650
  return hasEcosystem(workspaceRoot, ecosystem);
6334
6651
  }
@@ -6347,7 +6664,7 @@ function splitAtLast(value, separator) {
6347
6664
  }
6348
6665
 
6349
6666
  // src/dependency-management/sync-dependencies.use-case.ts
6350
- var import_node_path24 = require("path");
6667
+ var import_node_path28 = require("path");
6351
6668
 
6352
6669
  // src/dependency-management/semver.algorithm.ts
6353
6670
  var UPDATE_KINDS = ["patch", "minor", "major", "non-semver"];
@@ -6524,7 +6841,7 @@ function describe(finding) {
6524
6841
  return `${finding.name} \u2192 ${finding.target} (${finding.reason}); disagreeing: ${sites}`;
6525
6842
  }
6526
6843
  function runSync(workspaceRoot, options) {
6527
- if (!fileExists((0, import_node_path24.join)(workspaceRoot, "nx.json"))) {
6844
+ if (!fileExists((0, import_node_path28.join)(workspaceRoot, "nx.json"))) {
6528
6845
  throw new Error(
6529
6846
  `No nx.json found in ${workspaceRoot} \u2014 run 'mnci sync' from the workspace root.`
6530
6847
  );
@@ -6574,7 +6891,7 @@ function runSync(workspaceRoot, options) {
6574
6891
  }
6575
6892
 
6576
6893
  // src/dependency-management/update-dependencies.use-case.ts
6577
- var import_node_path25 = require("path");
6894
+ var import_node_path29 = require("path");
6578
6895
  var import_prompts2 = require("@inquirer/prompts");
6579
6896
 
6580
6897
  // src/dependency-management/registry.client.ts
@@ -6857,7 +7174,7 @@ function reinstall(workspaceRoot, ecosystems) {
6857
7174
  function hasPythonInstallScript(workspaceRoot) {
6858
7175
  try {
6859
7176
  const manifest = readJson(
6860
- (0, import_node_path25.join)(workspaceRoot, "package.json")
7177
+ (0, import_node_path29.join)(workspaceRoot, "package.json")
6861
7178
  );
6862
7179
  return manifest.scripts?.["python:install"] !== void 0;
6863
7180
  } catch {
@@ -6873,7 +7190,7 @@ function applyGoUpdates(workspaceRoot, entries) {
6873
7190
  }
6874
7191
  }
6875
7192
  async function runUp(workspaceRoot, options) {
6876
- if (!fileExists((0, import_node_path25.join)(workspaceRoot, "nx.json"))) {
7193
+ if (!fileExists((0, import_node_path29.join)(workspaceRoot, "nx.json"))) {
6877
7194
  throw new Error(`No nx.json found in ${workspaceRoot} \u2014 run 'mnci up' from the workspace root.`);
6878
7195
  }
6879
7196
  const ecosystems = resolveEcosystems(options.ecosystem);
@@ -6950,7 +7267,7 @@ var PROJECT_KINDS = [
6950
7267
  var EMPTY_KINDS = /* @__PURE__ */ new Set(["npm-lib", "internal-lib", "react-lib", "react-internal-lib", "node-function-app"]);
6951
7268
  async function runAdd(kind, name, options) {
6952
7269
  const workspaceRoot = process.cwd();
6953
- if (!fileExists((0, import_node_path26.join)(workspaceRoot, "nx.json"))) {
7270
+ if (!fileExists((0, import_node_path30.join)(workspaceRoot, "nx.json"))) {
6954
7271
  throw new Error("No nx.json found here. Run `add` from the workspace root.");
6955
7272
  }
6956
7273
  const stack = readWorkspaceStack(workspaceRoot);
@@ -7013,8 +7330,8 @@ async function runAdd(kind, name, options) {
7013
7330
  ],
7014
7331
  workspaceRoot
7015
7332
  );
7016
- markPrivate((0, import_node_path26.join)(workspaceRoot, "libs", resolvedName, "package.json"));
7017
- renameScaffoldPlaceholder((0, import_node_path26.join)(workspaceRoot, "libs", resolvedName), resolvedName, options.empty === true);
7333
+ markPrivate((0, import_node_path30.join)(workspaceRoot, "libs", resolvedName, "package.json"));
7334
+ renameScaffoldPlaceholder((0, import_node_path30.join)(workspaceRoot, "libs", resolvedName), resolvedName, options.empty === true);
7018
7335
  removeGeneratedEslintConfig(workspaceRoot, `libs/${resolvedName}`);
7019
7336
  registerProjectCommands(workspaceRoot, resolvedName, { build: true });
7020
7337
  break;
@@ -7106,7 +7423,7 @@ async function runAdd(kind, name, options) {
7106
7423
  }
7107
7424
  function readWorkspaceStack(workspaceRoot) {
7108
7425
  const nxJson = readJson(
7109
- (0, import_node_path26.join)(workspaceRoot, "nx.json")
7426
+ (0, import_node_path30.join)(workspaceRoot, "nx.json")
7110
7427
  );
7111
7428
  const stack = nxJson.mnci?.stack;
7112
7429
  return {
@@ -7155,15 +7472,15 @@ function runKinds(options) {
7155
7472
 
7156
7473
  // src/workspace-diagnostics/check-invariants.use-case.ts
7157
7474
  var import_node_child_process = require("child_process");
7158
- var import_node_fs20 = require("fs");
7159
- var import_node_path27 = require("path");
7475
+ var import_node_fs25 = require("fs");
7476
+ var import_node_path31 = require("path");
7160
7477
  var SUPPORTED_ESLINT_MAJOR = ESLINT_VERSION.replace(/^\D*/, "").split(".", 1)[0];
7161
7478
  function toPosix2(path) {
7162
7479
  return path.replaceAll("\\", "/");
7163
7480
  }
7164
7481
  function checkEslintConfigs(workspaceRoot) {
7165
- const rootConfigs = (0, import_node_fs20.globSync)("eslint.config.{js,mjs,cjs,ts,mts,cts}", { cwd: workspaceRoot });
7166
- const projectConfigs = (0, import_node_fs20.globSync)("{apps,libs,packages}/*/eslint.config.{js,mjs,cjs,ts,mts,cts}", {
7482
+ const rootConfigs = (0, import_node_fs25.globSync)("eslint.config.{js,mjs,cjs,ts,mts,cts}", { cwd: workspaceRoot });
7483
+ const projectConfigs = (0, import_node_fs25.globSync)("{apps,libs,packages}/*/eslint.config.{js,mjs,cjs,ts,mts,cts}", {
7167
7484
  cwd: workspaceRoot
7168
7485
  }).map((config) => toPosix2(config));
7169
7486
  return [
@@ -7183,10 +7500,10 @@ function checkEslintConfigs(workspaceRoot) {
7183
7500
  ];
7184
7501
  }
7185
7502
  function checkEslintEntryPointReachesTheRules(workspaceRoot) {
7186
- const rules = (0, import_node_path27.join)(workspaceRoot, ESLINT_MNCI_FILENAME);
7187
- if (!(0, import_node_fs20.existsSync)(rules)) return [];
7188
- const entryPoint = (0, import_node_path27.join)(workspaceRoot, ESLINT_USER_FILENAME);
7189
- const source = (0, import_node_fs20.existsSync)(entryPoint) ? (0, import_node_fs20.readFileSync)(entryPoint, "utf8") : "";
7503
+ const rules = (0, import_node_path31.join)(workspaceRoot, ESLINT_MNCI_FILENAME);
7504
+ if (!(0, import_node_fs25.existsSync)(rules)) return [];
7505
+ const entryPoint = (0, import_node_path31.join)(workspaceRoot, ESLINT_USER_FILENAME);
7506
+ const source = (0, import_node_fs25.existsSync)(entryPoint) ? (0, import_node_fs25.readFileSync)(entryPoint, "utf8") : "";
7190
7507
  return [
7191
7508
  {
7192
7509
  check: `${ESLINT_USER_FILENAME} imports the mnci rules`,
@@ -7199,7 +7516,7 @@ function checkEslintEntryPointReachesTheRules(workspaceRoot) {
7199
7516
  function declaredDevDependencies(workspaceRoot) {
7200
7517
  try {
7201
7518
  const manifest = readJson(
7202
- (0, import_node_path27.join)(workspaceRoot, "package.json")
7519
+ (0, import_node_path31.join)(workspaceRoot, "package.json")
7203
7520
  );
7204
7521
  return manifest.devDependencies ?? {};
7205
7522
  } catch {
@@ -7207,7 +7524,7 @@ function declaredDevDependencies(workspaceRoot) {
7207
7524
  }
7208
7525
  }
7209
7526
  function checkNoRetiredFormatter(workspaceRoot) {
7210
- const files = RETIRED_FORMATTER_FILES.filter((file) => fileExists((0, import_node_path27.join)(workspaceRoot, file)));
7527
+ const files = RETIRED_FORMATTER_FILES.filter((file) => fileExists((0, import_node_path31.join)(workspaceRoot, file)));
7211
7528
  const declared = ["prettier", "eslint-config-prettier", "oxlint", "oxfmt", "@mnci/oxlint-config"].filter((name) => declaredDevDependencies(workspaceRoot)[name] !== void 0);
7212
7529
  const stale = [...files, ...declared];
7213
7530
  if (stale.length === 0) {
@@ -7233,7 +7550,7 @@ function checkEslintPlugin(nxJson) {
7233
7550
  };
7234
7551
  }
7235
7552
  function checkResolvedEslint(workspaceRoot) {
7236
- const manifestPath = (0, import_node_path27.join)(workspaceRoot, "node_modules/eslint/package.json");
7553
+ const manifestPath = (0, import_node_path31.join)(workspaceRoot, "node_modules/eslint/package.json");
7237
7554
  if (!fileExists(manifestPath)) {
7238
7555
  return void 0;
7239
7556
  }
@@ -7251,11 +7568,11 @@ function checkResolvedEslint(workspaceRoot) {
7251
7568
  }
7252
7569
  }
7253
7570
  function checkNpmrc(workspaceRoot, registry, scope) {
7254
- const npmrcPath = (0, import_node_path27.join)(workspaceRoot, ".npmrc");
7571
+ const npmrcPath = (0, import_node_path31.join)(workspaceRoot, ".npmrc");
7255
7572
  if (!registry || !fileExists(npmrcPath)) {
7256
7573
  return void 0;
7257
7574
  }
7258
- const npmrc = (0, import_node_fs20.readFileSync)(npmrcPath, "utf8");
7575
+ const npmrc = (0, import_node_fs25.readFileSync)(npmrcPath, "utf8");
7259
7576
  if (registry.kind === "npm") {
7260
7577
  return {
7261
7578
  check: ".npmrc authenticates the public registry",
@@ -7272,11 +7589,11 @@ function checkNpmrc(workspaceRoot, registry, scope) {
7272
7589
  };
7273
7590
  }
7274
7591
  function checkNpmrcCredentialResolves(workspaceRoot, environment = process.env) {
7275
- const npmrcPath = (0, import_node_path27.join)(workspaceRoot, ".npmrc");
7592
+ const npmrcPath = (0, import_node_path31.join)(workspaceRoot, ".npmrc");
7276
7593
  if (!fileExists(npmrcPath)) {
7277
7594
  return void 0;
7278
7595
  }
7279
- const npmrc = (0, import_node_fs20.readFileSync)(npmrcPath, "utf8");
7596
+ const npmrc = (0, import_node_fs25.readFileSync)(npmrcPath, "utf8");
7280
7597
  const credentials = npmrc.split("\n").filter((line) => !line.trimStart().startsWith(";") && !line.trimStart().startsWith("#")).filter((line) => /(?:_authToken|_password|_auth)\s*=/u.test(line));
7281
7598
  const referenced = [
7282
7599
  ...new Set(
@@ -7300,13 +7617,13 @@ function checkNpmrcCredentialResolves(workspaceRoot, environment = process.env)
7300
7617
  };
7301
7618
  }
7302
7619
  function checkNpmAuthMatchesPipeline(workspaceRoot, registry) {
7303
- const npmrcPath = (0, import_node_path27.join)(workspaceRoot, ".npmrc");
7304
- const pipelinePath = (0, import_node_path27.join)(workspaceRoot, "azure-pipelines.yml");
7620
+ const npmrcPath = (0, import_node_path31.join)(workspaceRoot, ".npmrc");
7621
+ const pipelinePath = (0, import_node_path31.join)(workspaceRoot, "azure-pipelines.yml");
7305
7622
  if (registry?.kind !== "azure-artifacts" || !fileExists(npmrcPath) || !fileExists(pipelinePath)) {
7306
7623
  return void 0;
7307
7624
  }
7308
- const holdsCredentials = (0, import_node_fs20.readFileSync)(npmrcPath, "utf8").split("\n").filter((line) => !line.trimStart().startsWith(";") && !line.trimStart().startsWith("#")).some((line) => /(?:_authToken|_password|_auth)\s*=/u.test(line));
7309
- const runsTask = (0, import_node_fs20.readFileSync)(pipelinePath, "utf8").includes("npmAuthenticate@0");
7625
+ const holdsCredentials = (0, import_node_fs25.readFileSync)(npmrcPath, "utf8").split("\n").filter((line) => !line.trimStart().startsWith(";") && !line.trimStart().startsWith("#")).some((line) => /(?:_authToken|_password|_auth)\s*=/u.test(line));
7626
+ const runsTask = (0, import_node_fs25.readFileSync)(pipelinePath, "utf8").includes("npmAuthenticate@0");
7310
7627
  if (!holdsCredentials && !runsTask) {
7311
7628
  return {
7312
7629
  check: "npm auth: .npmrc and azure-pipelines.yml agree",
@@ -7351,13 +7668,13 @@ function npmjsCredentialShape(credentials, environment) {
7351
7668
  }
7352
7669
  function checkVersionActions(workspaceRoot) {
7353
7670
  const candidates = [
7354
- ...(0, import_node_fs20.globSync)("packages/*/pubspec.yaml", { cwd: workspaceRoot }),
7355
- ...(0, import_node_fs20.globSync)("packages/*/*.csproj", { cwd: workspaceRoot }),
7356
- ...(0, import_node_fs20.globSync)("python-packages/*/pyproject.toml", { cwd: workspaceRoot })
7671
+ ...(0, import_node_fs25.globSync)("packages/*/pubspec.yaml", { cwd: workspaceRoot }),
7672
+ ...(0, import_node_fs25.globSync)("packages/*/*.csproj", { cwd: workspaceRoot }),
7673
+ ...(0, import_node_fs25.globSync)("python-packages/*/pyproject.toml", { cwd: workspaceRoot })
7357
7674
  ].map((manifest) => toPosix2(manifest));
7358
7675
  return candidates.flatMap((manifest) => {
7359
7676
  const projectRoot = manifest.slice(0, manifest.lastIndexOf("/"));
7360
- const projectJsonPath = (0, import_node_path27.join)(workspaceRoot, projectRoot, "project.json");
7677
+ const projectJsonPath = (0, import_node_path31.join)(workspaceRoot, projectRoot, "project.json");
7361
7678
  let hasOverride = false;
7362
7679
  try {
7363
7680
  const projectJson = readJson(projectJsonPath);
@@ -7386,7 +7703,7 @@ function declaredTargets(workspaceRoot, projectRoot) {
7386
7703
  ]) {
7387
7704
  try {
7388
7705
  const targets = extract(
7389
- readJson((0, import_node_path27.join)(workspaceRoot, projectRoot, file))
7706
+ readJson((0, import_node_path31.join)(workspaceRoot, projectRoot, file))
7390
7707
  );
7391
7708
  if (targets && typeof targets === "object") {
7392
7709
  sources.push({
@@ -7402,8 +7719,8 @@ function declaredTargets(workspaceRoot, projectRoot) {
7402
7719
  function checkTargetFilesExist(workspaceRoot) {
7403
7720
  const projectRoots = new Set(
7404
7721
  [
7405
- ...(0, import_node_fs20.globSync)("{apps,libs,packages}/*/project.json", { cwd: workspaceRoot }),
7406
- ...(0, import_node_fs20.globSync)("{apps,libs,packages}/*/package.json", { cwd: workspaceRoot })
7722
+ ...(0, import_node_fs25.globSync)("{apps,libs,packages}/*/project.json", { cwd: workspaceRoot }),
7723
+ ...(0, import_node_fs25.globSync)("{apps,libs,packages}/*/package.json", { cwd: workspaceRoot })
7407
7724
  ].map((manifest) => toPosix2(manifest).split("/").slice(0, 2).join("/"))
7408
7725
  );
7409
7726
  return [...projectRoots].flatMap(
@@ -7418,7 +7735,7 @@ function checkOneTargetsFiles(workspaceRoot, source, targetName, target) {
7418
7735
  return TARGET_FILE_OPTIONS.flatMap((option) => {
7419
7736
  const value = target?.options?.[option];
7420
7737
  const checkable = typeof value === "string" && !value.includes("{");
7421
- if (!checkable || fileExists((0, import_node_path27.join)(workspaceRoot, value))) {
7738
+ if (!checkable || fileExists((0, import_node_path31.join)(workspaceRoot, value))) {
7422
7739
  return [];
7423
7740
  }
7424
7741
  return [
@@ -7457,15 +7774,15 @@ function checkGoPluginRegistered(workspaceRoot) {
7457
7774
  };
7458
7775
  }
7459
7776
  function checkGoWorkInSync(workspaceRoot) {
7460
- const goWorkPath = (0, import_node_path27.join)(workspaceRoot, "go.work");
7777
+ const goWorkPath = (0, import_node_path31.join)(workspaceRoot, "go.work");
7461
7778
  if (!fileExists(goWorkPath)) {
7462
7779
  return void 0;
7463
7780
  }
7464
- const contents = (0, import_node_fs20.existsSync)(goWorkPath) ? (0, import_node_fs20.readFileSync)(goWorkPath, "utf8") : "";
7781
+ const contents = (0, import_node_fs25.existsSync)(goWorkPath) ? (0, import_node_fs25.readFileSync)(goWorkPath, "utf8") : "";
7465
7782
  const blockEntries = Array.from(contents.matchAll(/(?:^|\n)\s*use\s+\(([^)]*)\)/g), (match) => match[1].split("\n")).flat();
7466
7783
  const singleEntries = Array.from(contents.matchAll(/(?:^|\n)\s*use\s+(\.\S+)/g), (match) => match[1]);
7467
7784
  const uses = [...blockEntries, ...singleEntries].map((entry) => entry.trim()).filter(Boolean);
7468
- const stale = uses.filter((entry) => !(0, import_node_fs20.existsSync)((0, import_node_path27.join)(workspaceRoot, entry, "go.mod")));
7785
+ const stale = uses.filter((entry) => !(0, import_node_fs25.existsSync)((0, import_node_path31.join)(workspaceRoot, entry, "go.mod")));
7469
7786
  return {
7470
7787
  check: "every go.work `use` entry points to a module that still exists",
7471
7788
  ok: stale.length === 0,
@@ -7481,9 +7798,9 @@ function checkNativeApps(workspaceRoot) {
7481
7798
  { file: ".github/workflows/ci.yml", marker: "native (${{ matrix.os }})" },
7482
7799
  { file: "azure-pipelines.yml", marker: "- job: native" }
7483
7800
  ];
7484
- const findings = pipelines.filter(({ file }) => fileExists((0, import_node_path27.join)(workspaceRoot, file))).map(({ file, marker }) => ({
7801
+ const findings = pipelines.filter(({ file }) => fileExists((0, import_node_path31.join)(workspaceRoot, file))).map(({ file, marker }) => ({
7485
7802
  check: `${file} builds the native apps on every OS`,
7486
- ok: (0, import_node_fs20.readFileSync)((0, import_node_path27.join)(workspaceRoot, file), "utf8").includes(marker),
7803
+ ok: (0, import_node_fs25.readFileSync)((0, import_node_path31.join)(workspaceRoot, file), "utf8").includes(marker),
7487
7804
  detail: `${file} has no native job: CI would verify a cgo app on the one agent that cannot build it`,
7488
7805
  remedy: "run `mnci upgrade`"
7489
7806
  }));
@@ -7496,7 +7813,7 @@ function checkNativeApps(workspaceRoot) {
7496
7813
  return findings;
7497
7814
  }
7498
7815
  function checkNoRootRuntimeDependencies(workspaceRoot) {
7499
- const manifestPath = (0, import_node_path27.join)(workspaceRoot, "package.json");
7816
+ const manifestPath = (0, import_node_path31.join)(workspaceRoot, "package.json");
7500
7817
  if (!fileExists(manifestPath)) {
7501
7818
  return void 0;
7502
7819
  }
@@ -7516,14 +7833,14 @@ function checkNoRootRuntimeDependencies(workspaceRoot) {
7516
7833
  };
7517
7834
  }
7518
7835
  function checkRollupSourceMaps(workspaceRoot) {
7519
- const configs = (0, import_node_fs20.globSync)(["packages/*/rollup.config.cjs", "libs/*/rollup.config.cjs"], {
7836
+ const configs = (0, import_node_fs25.globSync)(["packages/*/rollup.config.cjs", "libs/*/rollup.config.cjs"], {
7520
7837
  cwd: workspaceRoot
7521
7838
  }).map((config) => toPosix2(config));
7522
7839
  return configs.flatMap((relativePath) => {
7523
- const configPath = (0, import_node_path27.join)(workspaceRoot, relativePath);
7840
+ const configPath = (0, import_node_path31.join)(workspaceRoot, relativePath);
7524
7841
  let config;
7525
7842
  try {
7526
- config = (0, import_node_fs20.readFileSync)(configPath, "utf8");
7843
+ config = (0, import_node_fs25.readFileSync)(configPath, "utf8");
7527
7844
  } catch {
7528
7845
  return [];
7529
7846
  }
@@ -7538,11 +7855,11 @@ function checkRollupSourceMaps(workspaceRoot) {
7538
7855
  });
7539
7856
  }
7540
7857
  function checkDeclarationSpecifiers(workspaceRoot) {
7541
- const configs = (0, import_node_fs20.globSync)(["packages/*/rollup.config.cjs", "libs/*/rollup.config.cjs"], {
7858
+ const configs = (0, import_node_fs25.globSync)(["packages/*/rollup.config.cjs", "libs/*/rollup.config.cjs"], {
7542
7859
  cwd: workspaceRoot
7543
7860
  }).map((config) => toPosix2(config));
7544
7861
  return configs.flatMap((relativePath) => {
7545
- const configPath = (0, import_node_path27.join)(workspaceRoot, relativePath);
7862
+ const configPath = (0, import_node_path31.join)(workspaceRoot, relativePath);
7546
7863
  if (!fileExists(configPath)) {
7547
7864
  return [];
7548
7865
  }
@@ -7576,7 +7893,7 @@ function checkDeclarationSpecifiers(workspaceRoot) {
7576
7893
  });
7577
7894
  }
7578
7895
  function collectFindings(workspaceRoot) {
7579
- const nxJsonPath = (0, import_node_path27.join)(workspaceRoot, "nx.json");
7896
+ const nxJsonPath = (0, import_node_path31.join)(workspaceRoot, "nx.json");
7580
7897
  if (!fileExists(nxJsonPath)) {
7581
7898
  throw new Error(
7582
7899
  `No nx.json found in ${workspaceRoot} \u2014 run 'mnci doctor' from the workspace root.`
@@ -7700,11 +8017,11 @@ function runCommands(program, options) {
7700
8017
  }
7701
8018
 
7702
8019
  // src/workspace-info/list-projects.use-case.ts
7703
- var import_node_path28 = require("path");
8020
+ var import_node_path32 = require("path");
7704
8021
  var TYPE_TAG_PREFIX = "type:";
7705
8022
  function listProjects(workspaceRoot) {
7706
8023
  return locateProjects(workspaceRoot).map((location) => {
7707
- const projectJsonPath = (0, import_node_path28.join)(workspaceRoot, location.dir, "project.json");
8024
+ const projectJsonPath = (0, import_node_path32.join)(workspaceRoot, location.dir, "project.json");
7708
8025
  const project = fileExists(projectJsonPath) ? readJson(projectJsonPath) : {};
7709
8026
  const typeTag = (project.tags ?? []).find((tag) => tag.startsWith(TYPE_TAG_PREFIX));
7710
8027
  return {
@@ -7717,7 +8034,7 @@ function listProjects(workspaceRoot) {
7717
8034
  }).toSorted((a, b) => a.dir.localeCompare(b.dir));
7718
8035
  }
7719
8036
  function runProjects(workspaceRoot, options) {
7720
- if (!fileExists((0, import_node_path28.join)(workspaceRoot, "nx.json"))) {
8037
+ if (!fileExists((0, import_node_path32.join)(workspaceRoot, "nx.json"))) {
7721
8038
  throw new Error("No nx.json found here. Run `projects` from the workspace root.");
7722
8039
  }
7723
8040
  const projects = listProjects(workspaceRoot);
@@ -7731,12 +8048,12 @@ function runProjects(workspaceRoot, options) {
7731
8048
  }
7732
8049
 
7733
8050
  // src/workspace-info/read-workspace-info.use-case.ts
7734
- var import_node_path30 = require("path");
8051
+ var import_node_path34 = require("path");
7735
8052
 
7736
8053
  // src/cli-version/check-for-update.use-case.ts
7737
- var import_node_fs21 = require("fs");
7738
- var import_node_path29 = require("path");
7739
- var import_cross_spawn2 = __toESM(require("cross-spawn"));
8054
+ var import_node_fs26 = require("fs");
8055
+ var import_node_path33 = require("path");
8056
+ var import_cross_spawn3 = __toESM(require("cross-spawn"));
7740
8057
  var PACKAGE_NAME = "@mnci/cli";
7741
8058
  var REGISTRY_TIMEOUT_MS = 2e3;
7742
8059
  function checkForUpdate(currentVersion2) {
@@ -7754,7 +8071,7 @@ function checkForUpdate(currentVersion2) {
7754
8071
  }
7755
8072
  }
7756
8073
  function fetchLatestVersion() {
7757
- const result = import_cross_spawn2.default.sync("npm", ["view", PACKAGE_NAME, "version"], {
8074
+ const result = import_cross_spawn3.default.sync("npm", ["view", PACKAGE_NAME, "version"], {
7758
8075
  encoding: "utf8",
7759
8076
  timeout: REGISTRY_TIMEOUT_MS,
7760
8077
  stdio: ["ignore", "pipe", "ignore"]
@@ -7794,8 +8111,8 @@ function releaseTriple(version) {
7794
8111
  }
7795
8112
  function readCliVersion(packageDirectory) {
7796
8113
  try {
7797
- const manifestPath = (0, import_node_path29.join)(packageDirectory, "..", "package.json");
7798
- const manifest = JSON.parse((0, import_node_fs21.readFileSync)(manifestPath, "utf8"));
8114
+ const manifestPath = (0, import_node_path33.join)(packageDirectory, "..", "package.json");
8115
+ const manifest = JSON.parse((0, import_node_fs26.readFileSync)(manifestPath, "utf8"));
7799
8116
  return manifest.version ?? "0.0.0";
7800
8117
  } catch {
7801
8118
  return "0.0.0";
@@ -7805,7 +8122,7 @@ function readCliVersion(packageDirectory) {
7805
8122
  // src/workspace-info/read-workspace-info.use-case.ts
7806
8123
  function readWorkspaceInfo(workspaceRoot, cliVersion) {
7807
8124
  const latest = fetchLatestVersion() ?? null;
7808
- const isWorkspace = fileExists((0, import_node_path30.join)(workspaceRoot, "nx.json"));
8125
+ const isWorkspace = fileExists((0, import_node_path34.join)(workspaceRoot, "nx.json"));
7809
8126
  return {
7810
8127
  cli: {
7811
8128
  version: cliVersion,
@@ -7826,8 +8143,8 @@ function runInfo(workspaceRoot, cliVersion, options) {
7826
8143
  }
7827
8144
 
7828
8145
  // src/workspace-creation/adopt-directory.use-case.ts
7829
- var import_node_fs22 = require("fs");
7830
- var import_node_path31 = require("path");
8146
+ var import_node_fs27 = require("fs");
8147
+ var import_node_path35 = require("path");
7831
8148
  var NEVER_COPIED = /* @__PURE__ */ new Set([".git", "node_modules"]);
7832
8149
  var AGENT_AND_CI_ENTRIES = [
7833
8150
  "AGENTS.md",
@@ -7858,13 +8175,13 @@ var PREFLIGHT_BLOCKERS = [
7858
8175
  "packages"
7859
8176
  ];
7860
8177
  function assertAdoptableDirectory(target) {
7861
- if (!(0, import_node_fs22.existsSync)(target)) {
8178
+ if (!(0, import_node_fs27.existsSync)(target)) {
7862
8179
  throw new Error(`--into '${target}' does not exist. Create or clone it first.`);
7863
8180
  }
7864
- if (!(0, import_node_fs22.statSync)(target).isDirectory()) {
8181
+ if (!(0, import_node_fs27.statSync)(target).isDirectory()) {
7865
8182
  throw new Error(`--into '${target}' is not a directory.`);
7866
8183
  }
7867
- const blockers = PREFLIGHT_BLOCKERS.filter((entry) => (0, import_node_fs22.existsSync)((0, import_node_path31.join)(target, entry)));
8184
+ const blockers = PREFLIGHT_BLOCKERS.filter((entry) => (0, import_node_fs27.existsSync)((0, import_node_path35.join)(target, entry)));
7868
8185
  if (blockers.length > 0) {
7869
8186
  throw new Error(
7870
8187
  `--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.`
@@ -7872,15 +8189,15 @@ function assertAdoptableDirectory(target) {
7872
8189
  }
7873
8190
  }
7874
8191
  function mergeGitignore(generatedFile, targetFile) {
7875
- const existing = (0, import_node_fs22.readFileSync)(targetFile, "utf8");
8192
+ const existing = (0, import_node_fs27.readFileSync)(targetFile, "utf8");
7876
8193
  const present = new Set(existing.split("\n").map((line) => line.trim()));
7877
- const additions = (0, import_node_fs22.readFileSync)(generatedFile, "utf8").split("\n").map((line) => line.trimEnd()).filter((line) => {
8194
+ const additions = (0, import_node_fs27.readFileSync)(generatedFile, "utf8").split("\n").map((line) => line.trimEnd()).filter((line) => {
7878
8195
  const trimmed = line.trim();
7879
8196
  return trimmed !== "" && !trimmed.startsWith("#") && !present.has(trimmed);
7880
8197
  });
7881
8198
  if (additions.length === 0) return false;
7882
8199
  const separator = existing.endsWith("\n") ? "" : "\n";
7883
- (0, import_node_fs22.writeFileSync)(
8200
+ (0, import_node_fs27.writeFileSync)(
7884
8201
  targetFile,
7885
8202
  `${existing}${separator}
7886
8203
  # Added by mnci (Nx workspace)
@@ -7890,9 +8207,9 @@ ${additions.join("\n")}
7890
8207
  return true;
7891
8208
  }
7892
8209
  function adoptGeneratedWorkspace(generatedRoot, target) {
7893
- const entries = (0, import_node_fs22.readdirSync)(generatedRoot).filter((entry) => !NEVER_COPIED.has(entry));
8210
+ const entries = (0, import_node_fs27.readdirSync)(generatedRoot).filter((entry) => !NEVER_COPIED.has(entry));
7894
8211
  const collisions = entries.filter(
7895
- (entry) => (0, import_node_fs22.existsSync)((0, import_node_path31.join)(target, entry)) && !EXISTING_WINS.has(entry) && entry !== ".gitignore"
8212
+ (entry) => (0, import_node_fs27.existsSync)((0, import_node_path35.join)(target, entry)) && !EXISTING_WINS.has(entry) && entry !== ".gitignore"
7896
8213
  );
7897
8214
  if (collisions.length > 0) {
7898
8215
  throw new Error(
@@ -7901,28 +8218,28 @@ function adoptGeneratedWorkspace(generatedRoot, target) {
7901
8218
  }
7902
8219
  const result = { copied: [], kept: [], mergedGitignore: false };
7903
8220
  for (const entry of entries) {
7904
- const from = (0, import_node_path31.join)(generatedRoot, entry);
7905
- const to = (0, import_node_path31.join)(target, entry);
7906
- if (entry === ".gitignore" && (0, import_node_fs22.existsSync)(to)) {
8221
+ const from = (0, import_node_path35.join)(generatedRoot, entry);
8222
+ const to = (0, import_node_path35.join)(target, entry);
8223
+ if (entry === ".gitignore" && (0, import_node_fs27.existsSync)(to)) {
7907
8224
  result.mergedGitignore = mergeGitignore(from, to);
7908
8225
  result.kept.push(entry);
7909
8226
  continue;
7910
8227
  }
7911
- if ((0, import_node_fs22.existsSync)(to)) {
8228
+ if ((0, import_node_fs27.existsSync)(to)) {
7912
8229
  result.kept.push(entry);
7913
8230
  continue;
7914
8231
  }
7915
- (0, import_node_fs22.cpSync)(from, to, { recursive: true });
8232
+ (0, import_node_fs27.cpSync)(from, to, { recursive: true });
7916
8233
  result.copied.push(entry);
7917
8234
  }
7918
- (0, import_node_fs22.rmSync)(generatedRoot, { recursive: true, force: true });
8235
+ (0, import_node_fs27.rmSync)(generatedRoot, { recursive: true, force: true });
7919
8236
  return result;
7920
8237
  }
7921
8238
 
7922
8239
  // src/workspace-creation/create-workspace.use-case.ts
7923
- var import_node_fs23 = require("fs");
7924
- var import_node_os = require("os");
7925
- var import_node_path32 = require("path");
8240
+ var import_node_fs28 = require("fs");
8241
+ var import_node_os2 = require("os");
8242
+ var import_node_path36 = require("path");
7926
8243
  function nxCloudProviderValue(ci) {
7927
8244
  return ci === "azure" ? "azure" : "github";
7928
8245
  }
@@ -7965,9 +8282,9 @@ async function resolveRegistry(options) {
7965
8282
  return await promptRegistry();
7966
8283
  }
7967
8284
  async function runNew(name, options) {
7968
- const adoptTarget = options.into === void 0 ? void 0 : (0, import_node_path32.resolve)(process.cwd(), options.into);
8285
+ const adoptTarget = options.into === void 0 ? void 0 : (0, import_node_path36.resolve)(process.cwd(), options.into);
7969
8286
  if (adoptTarget !== void 0) assertAdoptableDirectory(adoptTarget);
7970
- const workspaceName = name ?? (adoptTarget === void 0 ? await promptText("Workspace name") : (0, import_node_path32.basename)(adoptTarget));
8287
+ const workspaceName = name ?? (adoptTarget === void 0 ? await promptText("Workspace name") : (0, import_node_path36.basename)(adoptTarget));
7971
8288
  assertValidProjectName(workspaceName, "Workspace name");
7972
8289
  const scope = options.scope ?? (options.yes ? `@${workspaceName}` : await promptText("npm scope for publishable packages", `@${workspaceName}`));
7973
8290
  const registry = await resolveRegistry(options);
@@ -7980,8 +8297,8 @@ async function runNew(name, options) {
7980
8297
  const npmAuth = resolveNpmAuth(options.npmAuth, registry, ci);
7981
8298
  const stack = await resolveStack(options);
7982
8299
  const nxCloud = options.nxCloud ?? (options.yes ? false : await promptNxCloud());
7983
- const stagingParent = adoptTarget === void 0 ? process.cwd() : (0, import_node_fs23.mkdtempSync)((0, import_node_path32.join)((0, import_node_os.tmpdir)(), "mnci-new-"));
7984
- let workspaceRoot = (0, import_node_path32.join)(stagingParent, workspaceName);
8300
+ const stagingParent = adoptTarget === void 0 ? process.cwd() : (0, import_node_fs28.mkdtempSync)((0, import_node_path36.join)((0, import_node_os2.tmpdir)(), "mnci-new-"));
8301
+ let workspaceRoot = (0, import_node_path36.join)(stagingParent, workspaceName);
7985
8302
  try {
7986
8303
  logger.step(`Creating Nx workspace '${workspaceName}' (preset: ts)`);
7987
8304
  runNpx(
@@ -8004,7 +8321,7 @@ async function runNew(name, options) {
8004
8321
  workspaceRoot = adoptTarget;
8005
8322
  }
8006
8323
  } finally {
8007
- if (adoptTarget !== void 0) (0, import_node_fs23.rmSync)(stagingParent, { recursive: true, force: true });
8324
+ if (adoptTarget !== void 0) (0, import_node_fs28.rmSync)(stagingParent, { recursive: true, force: true });
8008
8325
  }
8009
8326
  logger.step(
8010
8327
  "Applying MoNecromanCI overlay (VS Code workspace, release config, .npmrc, commitlint, pipeline, stack)"
@@ -8014,8 +8331,8 @@ async function runNew(name, options) {
8014
8331
  { workspaceName, scope, registry, agent, variableGroup, ci, stack, ...npmAuth && { npmAuth } },
8015
8332
  logger.detail
8016
8333
  );
8017
- (0, import_node_fs23.rmSync)((0, import_node_path32.join)(workspaceRoot, "node_modules"), { recursive: true, force: true });
8018
- (0, import_node_fs23.rmSync)((0, import_node_path32.join)(workspaceRoot, "package-lock.json"), { force: true });
8334
+ (0, import_node_fs28.rmSync)((0, import_node_path36.join)(workspaceRoot, "node_modules"), { recursive: true, force: true });
8335
+ (0, import_node_fs28.rmSync)((0, import_node_path36.join)(workspaceRoot, "package-lock.json"), { force: true });
8019
8336
  logger.step("Installing the toolchain (commitlint + husky + linting/formatting)");
8020
8337
  const installStatus = runShell(
8021
8338
  "npm",
@@ -8053,12 +8370,12 @@ function projectKindHintLines(kinds = PROJECT_KINDS) {
8053
8370
  }
8054
8371
 
8055
8372
  // src/workspace-creation/interactive-wizard.use-case.ts
8056
- var import_node_path34 = require("path");
8373
+ var import_node_path38 = require("path");
8057
8374
  var import_prompts4 = require("@inquirer/prompts");
8058
8375
 
8059
8376
  // src/workspace-upgrade/upgrade-workspace.use-case.ts
8060
- var import_node_fs24 = require("fs");
8061
- var import_node_path33 = require("path");
8377
+ var import_node_fs29 = require("fs");
8378
+ var import_node_path37 = require("path");
8062
8379
  function resolveRegistry2(options, persisted) {
8063
8380
  if (options.registry === "azure-artifacts" || options.organization && options.artifactsFeed) {
8064
8381
  const persistedAzure = persisted?.kind === "azure-artifacts" ? persisted : void 0;
@@ -8087,7 +8404,7 @@ function resolveWorkspaceName(workspaceRoot, persisted) {
8087
8404
  return persisted.workspaceName;
8088
8405
  }
8089
8406
  try {
8090
- const existing = (0, import_node_fs24.readdirSync)(workspaceRoot).find(
8407
+ const existing = (0, import_node_fs29.readdirSync)(workspaceRoot).find(
8091
8408
  (file) => file.endsWith(".code-workspace") && file !== "undefined.code-workspace"
8092
8409
  );
8093
8410
  if (existing) {
@@ -8095,11 +8412,11 @@ function resolveWorkspaceName(workspaceRoot, persisted) {
8095
8412
  }
8096
8413
  } catch {
8097
8414
  }
8098
- return (0, import_node_path33.basename)(workspaceRoot);
8415
+ return (0, import_node_path37.basename)(workspaceRoot);
8099
8416
  }
8100
8417
  function detectNpmAuth(workspaceRoot) {
8101
8418
  try {
8102
- return (0, import_node_fs24.readFileSync)((0, import_node_path33.join)(workspaceRoot, "azure-pipelines.yml"), "utf8").includes("npmAuthenticate@0") ? "build-identity" : void 0;
8419
+ return (0, import_node_fs29.readFileSync)((0, import_node_path37.join)(workspaceRoot, "azure-pipelines.yml"), "utf8").includes("npmAuthenticate@0") ? "build-identity" : void 0;
8103
8420
  } catch {
8104
8421
  return void 0;
8105
8422
  }
@@ -8146,7 +8463,7 @@ function resolveOverlayOptions(workspaceRoot, options, persisted) {
8146
8463
  };
8147
8464
  }
8148
8465
  function runUpgrade(workspaceRoot, options) {
8149
- if (!fileExists((0, import_node_path33.join)(workspaceRoot, "nx.json"))) {
8466
+ if (!fileExists((0, import_node_path37.join)(workspaceRoot, "nx.json"))) {
8150
8467
  throw new Error(
8151
8468
  `No nx.json found in ${workspaceRoot} \u2014 this does not look like an Nx workspace. Run 'mnci upgrade' from the workspace root.`
8152
8469
  );
@@ -8207,11 +8524,12 @@ function runUpgrade(workspaceRoot, options) {
8207
8524
  );
8208
8525
  runFormatter(workspaceRoot);
8209
8526
  logger.success("Done. Review the changes with `git diff` before committing.");
8527
+ logger.info("Run `npm install` and commit package-lock.json too: the overlay may have added or moved a dependency, and CI installs with `npm ci`, which refuses a stale lockfile.");
8210
8528
  }
8211
8529
 
8212
8530
  // src/workspace-creation/interactive-wizard.use-case.ts
8213
8531
  async function runInteractive() {
8214
- const inWorkspace = fileExists((0, import_node_path34.join)(process.cwd(), "nx.json"));
8532
+ const inWorkspace = fileExists((0, import_node_path38.join)(process.cwd(), "nx.json"));
8215
8533
  const choiceNew = { name: "Create a new monorepo", value: "new" };
8216
8534
  const choiceAdd = { name: "Add a project to this workspace", value: "add" };
8217
8535
  const choiceUpgrade = {
@@ -8264,7 +8582,7 @@ function buildProgram(cliVersion) {
8264
8582
  runDoctor(process.cwd(), options);
8265
8583
  });
8266
8584
  program.command("ci").addArgument(new import_commander.Argument("<phase>", "which phase of the pipeline to run").choices(CI_PHASES)).description(
8267
- "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. `pack` builds the per-app artifacts, `release` versions, tags and publishes, and `native` builds the apps that need a C toolchain on this OS. Exits non-zero when it fails"
8585
+ "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. `setup` installs the Python, Go and Flutter toolchains the workspace needs, `audit` fails on a known advisory that has a fix, `pack` builds the per-app artifacts, `release` versions, tags and publishes, and `native` builds the apps that need a C toolchain on this OS. Exits non-zero when it fails"
8268
8586
  ).action(async (phase) => {
8269
8587
  process.exitCode = await runCiPhase(phase, process.cwd());
8270
8588
  });