@solid-stack/mason 1.0.14 → 1.0.16

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/bin.cjs CHANGED
@@ -2,7 +2,7 @@
2
2
  'use strict';
3
3
 
4
4
  var cac = require('cac');
5
- var p3 = require('@clack/prompts');
5
+ var p14 = require('@clack/prompts');
6
6
  var pc14 = require('picocolors');
7
7
  var fs9 = require('fs');
8
8
  var path2 = require('path');
@@ -32,7 +32,7 @@ function _interopNamespace(e) {
32
32
  return Object.freeze(n);
33
33
  }
34
34
 
35
- var p3__namespace = /*#__PURE__*/_interopNamespace(p3);
35
+ var p14__namespace = /*#__PURE__*/_interopNamespace(p14);
36
36
  var pc14__default = /*#__PURE__*/_interopDefault(pc14);
37
37
  var fs9__default = /*#__PURE__*/_interopDefault(fs9);
38
38
  var path2__default = /*#__PURE__*/_interopDefault(path2);
@@ -76,17 +76,17 @@ function writeFileSafely(absolutePath, content, options = {}) {
76
76
  function printGeneratedFiles(files, isDryRun = false) {
77
77
  console.log("");
78
78
  if (isDryRun) {
79
- p3__namespace.log.warn(pc14__default.default.yellow(pc14__default.default.bold("[DRY RUN PREVIEW] No files were written to disk.")));
79
+ p14__namespace.log.warn(pc14__default.default.yellow(pc14__default.default.bold("[DRY RUN PREVIEW] No files were written to disk.")));
80
80
  }
81
81
  for (const f of files) {
82
82
  if (f.action === "created") {
83
- p3__namespace.log.success(`${pc14__default.default.bold(f.relativePath)} ${pc14__default.default.dim("(created)")}`);
83
+ p14__namespace.log.success(`${pc14__default.default.bold(f.relativePath)} ${pc14__default.default.dim("(created)")}`);
84
84
  } else if (f.action === "overwritten") {
85
- p3__namespace.log.warn(`${pc14__default.default.bold(f.relativePath)} ${pc14__default.default.dim("(overwritten)")}`);
85
+ p14__namespace.log.warn(`${pc14__default.default.bold(f.relativePath)} ${pc14__default.default.dim("(overwritten)")}`);
86
86
  } else if (f.action === "skipped") {
87
- p3__namespace.log.info(`${pc14__default.default.dim(f.relativePath)} ${pc14__default.default.dim("(skipped - already exists, pass -o to overwrite)")}`);
87
+ p14__namespace.log.info(`${pc14__default.default.dim(f.relativePath)} ${pc14__default.default.dim("(skipped - already exists, pass -o to overwrite)")}`);
88
88
  } else {
89
- p3__namespace.log.info(`${pc14__default.default.bold(f.relativePath)} ${pc14__default.default.dim("(preview)")}`);
89
+ p14__namespace.log.info(`${pc14__default.default.bold(f.relativePath)} ${pc14__default.default.dim("(preview)")}`);
90
90
  }
91
91
  }
92
92
  }
@@ -1759,23 +1759,23 @@ var PromptCancelledError = class extends Error {
1759
1759
  }
1760
1760
  };
1761
1761
  function handleCancel(result) {
1762
- if (p3__namespace.isCancel(result)) {
1763
- p3__namespace.cancel("Operation cancelled.");
1762
+ if (p14__namespace.isCancel(result)) {
1763
+ p14__namespace.cancel("Operation cancelled.");
1764
1764
  throw new PromptCancelledError();
1765
1765
  }
1766
1766
  return result;
1767
1767
  }
1768
1768
  function printBanner() {
1769
1769
  console.log("");
1770
- p3__namespace.intro(pc14__default.default.bgCyan(pc14__default.default.black(" @solid-stack/mason ")));
1770
+ p14__namespace.intro(pc14__default.default.bgCyan(pc14__default.default.black(" @solid-stack/mason ")));
1771
1771
  }
1772
1772
  async function promptProperties(options = {}) {
1773
1773
  const properties = options.defaults ? [...options.defaults] : [];
1774
1774
  if (properties.length > 0) {
1775
1775
  const summary = properties.map((p16) => `${p16.name}: ${p16.type}${p16.optional ? "?" : ""}`).join(", ");
1776
- p3__namespace.log.info(pc14__default.default.dim(`Pre-configured fields: ${summary}`));
1776
+ p14__namespace.log.info(pc14__default.default.dim(`Pre-configured fields: ${summary}`));
1777
1777
  const addMore = handleCancel(
1778
- await p3__namespace.confirm({
1778
+ await p14__namespace.confirm({
1779
1779
  message: "Would you like to add custom fields/properties?",
1780
1780
  initialValue: false
1781
1781
  })
@@ -1784,10 +1784,10 @@ async function promptProperties(options = {}) {
1784
1784
  return properties;
1785
1785
  }
1786
1786
  }
1787
- p3__namespace.log.info(pc14__default.default.cyan("Enter properties (leave name blank when finished):"));
1787
+ p14__namespace.log.info(pc14__default.default.cyan("Enter properties (leave name blank when finished):"));
1788
1788
  while (true) {
1789
1789
  const name = handleCancel(
1790
- await p3__namespace.text({
1790
+ await p14__namespace.text({
1791
1791
  message: "Property name (or press Enter to finish):",
1792
1792
  placeholder: "e.g. title, email, status"
1793
1793
  })
@@ -1796,7 +1796,7 @@ async function promptProperties(options = {}) {
1796
1796
  break;
1797
1797
  }
1798
1798
  const type = handleCancel(
1799
- await p3__namespace.select({
1799
+ await p14__namespace.select({
1800
1800
  message: `Type for property "${name.trim()}":`,
1801
1801
  options: [
1802
1802
  { value: "string", label: "string" },
@@ -1813,7 +1813,7 @@ async function promptProperties(options = {}) {
1813
1813
  let finalType = type;
1814
1814
  if (type === "custom") {
1815
1815
  finalType = handleCancel(
1816
- await p3__namespace.text({
1816
+ await p14__namespace.text({
1817
1817
  message: `Enter custom type for "${name.trim()}":`,
1818
1818
  placeholder: "e.g. UserRole, string | null",
1819
1819
  validate: (val) => val && val.trim() ? void 0 : "Type cannot be empty"
@@ -1821,7 +1821,7 @@ async function promptProperties(options = {}) {
1821
1821
  );
1822
1822
  }
1823
1823
  const optional = handleCancel(
1824
- await p3__namespace.confirm({
1824
+ await p14__namespace.confirm({
1825
1825
  message: `Is "${name.trim()}" optional?`,
1826
1826
  initialValue: false
1827
1827
  })
@@ -1831,7 +1831,7 @@ async function promptProperties(options = {}) {
1831
1831
  type: finalType.trim(),
1832
1832
  optional
1833
1833
  });
1834
- p3__namespace.log.success(
1834
+ p14__namespace.log.success(
1835
1835
  pc14__default.default.green(`Added: ${name.trim()}${optional ? "?" : ""}: ${finalType.trim()}`)
1836
1836
  );
1837
1837
  }
@@ -1848,7 +1848,7 @@ async function runFeatureCommand(featureNameArg, flags = {}) {
1848
1848
  }
1849
1849
  if (!name) {
1850
1850
  name = handleCancel(
1851
- await p3__namespace.text({
1851
+ await p14__namespace.text({
1852
1852
  message: "What is the feature name?",
1853
1853
  placeholder: "e.g. users, auth, orders, billing",
1854
1854
  validate: (val) => {
@@ -1864,7 +1864,7 @@ async function runFeatureCommand(featureNameArg, flags = {}) {
1864
1864
  let targetDirRel = defaultDir;
1865
1865
  if (!flags.yes && !flags.target && !flags.dest) {
1866
1866
  targetDirRel = handleCancel(
1867
- await p3__namespace.text({
1867
+ await p14__namespace.text({
1868
1868
  message: "Target directory for the feature:",
1869
1869
  initialValue: defaultDir,
1870
1870
  defaultValue: defaultDir
@@ -1886,14 +1886,14 @@ async function runFeatureCommand(featureNameArg, flags = {}) {
1886
1886
  const customUseCases = [];
1887
1887
  if (!flags.yes) {
1888
1888
  includeExpress = handleCancel(
1889
- await p3__namespace.confirm({
1889
+ await p14__namespace.confirm({
1890
1890
  message: "Include Express Presentation layer (pxExpress routes & handlers)?",
1891
1891
  initialValue: true
1892
1892
  })
1893
1893
  );
1894
1894
  if (includeExpress) {
1895
1895
  routePath = handleCancel(
1896
- await p3__namespace.text({
1896
+ await p14__namespace.text({
1897
1897
  message: "Express route prefix:",
1898
1898
  initialValue: `/${normalizedName}`,
1899
1899
  defaultValue: `/${normalizedName}`
@@ -1901,14 +1901,14 @@ async function runFeatureCommand(featureNameArg, flags = {}) {
1901
1901
  ).trim();
1902
1902
  }
1903
1903
  includeDomain = handleCancel(
1904
- await p3__namespace.confirm({
1904
+ await p14__namespace.confirm({
1905
1905
  message: "Include Domain Entity/Entities?",
1906
1906
  initialValue: true
1907
1907
  })
1908
1908
  );
1909
1909
  if (includeDomain) {
1910
1910
  const domainInput = handleCancel(
1911
- await p3__namespace.text({
1911
+ await p14__namespace.text({
1912
1912
  message: "Domain entity name(s) (comma-separated):",
1913
1913
  initialValue: defaultEntity,
1914
1914
  defaultValue: defaultEntity,
@@ -1927,21 +1927,21 @@ async function runFeatureCommand(featureNameArg, flags = {}) {
1927
1927
  entityNames = [defaultEntity];
1928
1928
  }
1929
1929
  includeInterface = handleCancel(
1930
- await p3__namespace.confirm({
1930
+ await p14__namespace.confirm({
1931
1931
  message: `Include Domain Repository interface(s) for ${entityNames.join(", ")}?`,
1932
1932
  initialValue: true
1933
1933
  })
1934
1934
  );
1935
1935
  if (includeInterface) {
1936
1936
  includeInfra = handleCancel(
1937
- await p3__namespace.confirm({
1937
+ await p14__namespace.confirm({
1938
1938
  message: `Include Infrastructure Stub implementation(s) for ${entityNames.join(", ")}?`,
1939
1939
  initialValue: true
1940
1940
  })
1941
1941
  );
1942
1942
  }
1943
1943
  includeUseCase = handleCancel(
1944
- await p3__namespace.confirm({
1944
+ await p14__namespace.confirm({
1945
1945
  message: "Include Domain Use Cases?",
1946
1946
  initialValue: true
1947
1947
  })
@@ -1955,7 +1955,7 @@ async function runFeatureCommand(featureNameArg, flags = {}) {
1955
1955
  { value: "delete", label: "Delete (Delete<Entity>)", hint: "DELETE /:id" }
1956
1956
  ];
1957
1957
  crudOperations = handleCancel(
1958
- await p3__namespace.multiselect({
1958
+ await p14__namespace.multiselect({
1959
1959
  message: "Select standard CRUD use cases to generate:",
1960
1960
  options: crudChoices,
1961
1961
  initialValues: ["create", "read", "list", "update", "delete"],
@@ -1963,13 +1963,13 @@ async function runFeatureCommand(featureNameArg, flags = {}) {
1963
1963
  })
1964
1964
  );
1965
1965
  includeTests = handleCancel(
1966
- await p3__namespace.confirm({
1966
+ await p14__namespace.confirm({
1967
1967
  message: "Generate Vitest unit tests for use cases?",
1968
1968
  initialValue: true
1969
1969
  })
1970
1970
  );
1971
1971
  const wantCustom = handleCancel(
1972
- await p3__namespace.confirm({
1972
+ await p14__namespace.confirm({
1973
1973
  message: "Do you want to add any custom use cases to this feature?",
1974
1974
  initialValue: false
1975
1975
  })
@@ -1979,7 +1979,7 @@ async function runFeatureCommand(featureNameArg, flags = {}) {
1979
1979
  const availableIfaces = entityNames.map((e) => `I${e}Repository`);
1980
1980
  while (addMore) {
1981
1981
  const customName = handleCancel(
1982
- await p3__namespace.text({
1982
+ await p14__namespace.text({
1983
1983
  message: "Custom Use Case name:",
1984
1984
  placeholder: "e.g. ResetPassword, VerifyEmail, AssignRole",
1985
1985
  validate: (v) => v && v.trim() ? void 0 : "Use Case name cannot be empty"
@@ -1989,7 +1989,7 @@ async function runFeatureCommand(featureNameArg, flags = {}) {
1989
1989
  let selectedDeps = [];
1990
1990
  if (availableIfaces.length > 0) {
1991
1991
  selectedDeps = handleCancel(
1992
- await p3__namespace.multiselect({
1992
+ await p14__namespace.multiselect({
1993
1993
  message: `Select domain interfaces to inject into ${customUcName}:`,
1994
1994
  options: availableIfaces.map((i) => ({ value: i, label: i })),
1995
1995
  required: false
@@ -1998,7 +1998,7 @@ async function runFeatureCommand(featureNameArg, flags = {}) {
1998
1998
  }
1999
1999
  let customInputProps = [];
2000
2000
  const hasInput = handleCancel(
2001
- await p3__namespace.confirm({
2001
+ await p14__namespace.confirm({
2002
2002
  message: `Does ${customUcName} accept input arguments?`,
2003
2003
  initialValue: true
2004
2004
  })
@@ -2009,7 +2009,7 @@ async function runFeatureCommand(featureNameArg, flags = {}) {
2009
2009
  }
2010
2010
  let customOutputProps = [];
2011
2011
  const hasCustomOutput = handleCancel(
2012
- await p3__namespace.confirm({
2012
+ await p14__namespace.confirm({
2013
2013
  message: `Does ${customUcName} return custom output data?`,
2014
2014
  initialValue: false
2015
2015
  })
@@ -2019,7 +2019,7 @@ async function runFeatureCommand(featureNameArg, flags = {}) {
2019
2019
  });
2020
2020
  }
2021
2021
  const customIncludeTest = handleCancel(
2022
- await p3__namespace.confirm({
2022
+ await p14__namespace.confirm({
2023
2023
  message: `Generate Vitest unit test for ${customUcName}?`,
2024
2024
  initialValue: true
2025
2025
  })
@@ -2029,14 +2029,14 @@ async function runFeatureCommand(featureNameArg, flags = {}) {
2029
2029
  let customHttpPath = `/${toKebabCase(customUcName)}`;
2030
2030
  if (includeExpress) {
2031
2031
  customCreateHttp = handleCancel(
2032
- await p3__namespace.confirm({
2032
+ await p14__namespace.confirm({
2033
2033
  message: `Generate a matching ExpressRoute HTTP handler for ${customUcName}?`,
2034
2034
  initialValue: true
2035
2035
  })
2036
2036
  );
2037
2037
  if (customCreateHttp) {
2038
2038
  customHttpMethod = handleCancel(
2039
- await p3__namespace.select({
2039
+ await p14__namespace.select({
2040
2040
  message: "HTTP method for route:",
2041
2041
  options: [
2042
2042
  { value: "post", label: "POST" },
@@ -2049,7 +2049,7 @@ async function runFeatureCommand(featureNameArg, flags = {}) {
2049
2049
  })
2050
2050
  );
2051
2051
  customHttpPath = handleCancel(
2052
- await p3__namespace.text({
2052
+ await p14__namespace.text({
2053
2053
  message: "Route subpath (relative to feature prefix):",
2054
2054
  initialValue: `/${toKebabCase(customUcName)}`,
2055
2055
  defaultValue: `/${toKebabCase(customUcName)}`
@@ -2070,7 +2070,7 @@ async function runFeatureCommand(featureNameArg, flags = {}) {
2070
2070
  validationFields: customInputProps
2071
2071
  });
2072
2072
  addMore = handleCancel(
2073
- await p3__namespace.confirm({
2073
+ await p14__namespace.confirm({
2074
2074
  message: "Add another custom use case?",
2075
2075
  initialValue: false
2076
2076
  })
@@ -2079,7 +2079,7 @@ async function runFeatureCommand(featureNameArg, flags = {}) {
2079
2079
  }
2080
2080
  }
2081
2081
  includeDiProvider = handleCancel(
2082
- await p3__namespace.confirm({
2082
+ await p14__namespace.confirm({
2083
2083
  message: "Generate / update feature DI provider (diProvider.ts)?",
2084
2084
  initialValue: true
2085
2085
  })
@@ -2091,7 +2091,7 @@ async function runFeatureCommand(featureNameArg, flags = {}) {
2091
2091
  entityNames = [defaultEntity];
2092
2092
  }
2093
2093
  }
2094
- const s = p3__namespace.spinner();
2094
+ const s = p14__namespace.spinner();
2095
2095
  s.start(`Generating feature '${pc14__default.default.cyan(normalizedName)}'...`);
2096
2096
  const options = {
2097
2097
  name: normalizedName,
@@ -2138,7 +2138,7 @@ async function runFeatureCommand(featureNameArg, flags = {}) {
2138
2138
  }
2139
2139
  s.stop("Feature scaffolded successfully!");
2140
2140
  printGeneratedFiles(files, options.dryRun);
2141
- p3__namespace.outro(
2141
+ p14__namespace.outro(
2142
2142
  pc14__default.default.green(
2143
2143
  `\u2713 Feature '${normalizedName}' initialized in ${path2__default.default.relative(projectRoot, targetDir)} (uncommitted, unregistered)`
2144
2144
  )
@@ -2253,7 +2253,7 @@ async function runSharedCommand(sharedNameArg, flags = {}) {
2253
2253
  }
2254
2254
  if (!name) {
2255
2255
  name = handleCancel(
2256
- await p3__namespace.text({
2256
+ await p14__namespace.text({
2257
2257
  message: "What is the shared module name?",
2258
2258
  placeholder: "e.g. hasher, time, uuid, cache, logger",
2259
2259
  validate: (val) => {
@@ -2269,7 +2269,7 @@ async function runSharedCommand(sharedNameArg, flags = {}) {
2269
2269
  let targetDirRel = defaultDir;
2270
2270
  if (!flags.yes && !flags.target && !flags.dest) {
2271
2271
  targetDirRel = handleCancel(
2272
- await p3__namespace.text({
2272
+ await p14__namespace.text({
2273
2273
  message: "Target directory for the shared module:",
2274
2274
  initialValue: defaultDir,
2275
2275
  defaultValue: defaultDir
@@ -2281,20 +2281,20 @@ async function runSharedCommand(sharedNameArg, flags = {}) {
2281
2281
  let includeStub = true;
2282
2282
  if (!flags.yes) {
2283
2283
  description = handleCancel(
2284
- await p3__namespace.text({
2284
+ await p14__namespace.text({
2285
2285
  message: "Module description (optional):",
2286
2286
  placeholder: "e.g. In-memory caching and Redis port abstraction",
2287
2287
  initialValue: ""
2288
2288
  })
2289
2289
  ).trim();
2290
2290
  includeStub = handleCancel(
2291
- await p3__namespace.confirm({
2291
+ await p14__namespace.confirm({
2292
2292
  message: "Include stub implementation in infrastructure/?",
2293
2293
  initialValue: true
2294
2294
  })
2295
2295
  );
2296
2296
  }
2297
- const s = p3__namespace.spinner();
2297
+ const s = p14__namespace.spinner();
2298
2298
  s.start(`Generating shared module '${pc14__default.default.cyan(normalizedName)}'...`);
2299
2299
  const files = generateShared({
2300
2300
  name: normalizedName,
@@ -2308,7 +2308,7 @@ async function runSharedCommand(sharedNameArg, flags = {}) {
2308
2308
  });
2309
2309
  s.stop("Shared module generated successfully!");
2310
2310
  printGeneratedFiles(files, Boolean(flags.dryRun));
2311
- p3__namespace.outro(
2311
+ p14__namespace.outro(
2312
2312
  pc14__default.default.green(
2313
2313
  `\u2713 Shared module '${normalizedName}' initialized in ${path2__default.default.relative(projectRoot, targetDir)} (uncommitted, unregistered)`
2314
2314
  )
@@ -2323,14 +2323,14 @@ async function runUseCaseCommand(useCaseNameArg, flags = {}) {
2323
2323
  const featureOptions = existingFeatures.map((f) => ({ value: f, label: f }));
2324
2324
  featureOptions.push({ value: "__custom__", label: "\u270F\uFE0F Enter custom feature name..." });
2325
2325
  const selected = handleCancel(
2326
- await p3__namespace.select({
2326
+ await p14__namespace.select({
2327
2327
  message: "Select target feature:",
2328
2328
  options: featureOptions
2329
2329
  })
2330
2330
  );
2331
2331
  if (selected === "__custom__") {
2332
2332
  feature = handleCancel(
2333
- await p3__namespace.text({
2333
+ await p14__namespace.text({
2334
2334
  message: "Enter feature name:",
2335
2335
  validate: (v) => v && v.trim() ? void 0 : "Feature name cannot be empty"
2336
2336
  })
@@ -2340,7 +2340,7 @@ async function runUseCaseCommand(useCaseNameArg, flags = {}) {
2340
2340
  }
2341
2341
  } else {
2342
2342
  feature = handleCancel(
2343
- await p3__namespace.text({
2343
+ await p14__namespace.text({
2344
2344
  message: "Enter target feature name:",
2345
2345
  validate: (v) => v && v.trim() ? void 0 : "Feature name cannot be empty"
2346
2346
  })
@@ -2351,7 +2351,7 @@ async function runUseCaseCommand(useCaseNameArg, flags = {}) {
2351
2351
  let name = useCaseNameArg?.trim();
2352
2352
  if (!name) {
2353
2353
  name = handleCancel(
2354
- await p3__namespace.text({
2354
+ await p14__namespace.text({
2355
2355
  message: "Use Case name:",
2356
2356
  placeholder: "e.g. CreateUser, GetUser, CancelOrder",
2357
2357
  validate: (v) => v && v.trim() ? void 0 : "Use Case name cannot be empty"
@@ -2367,7 +2367,7 @@ async function runUseCaseCommand(useCaseNameArg, flags = {}) {
2367
2367
  label: i.name
2368
2368
  }));
2369
2369
  selectedDeps = handleCancel(
2370
- await p3__namespace.multiselect({
2370
+ await p14__namespace.multiselect({
2371
2371
  message: "Select domain interfaces to inject into use case:",
2372
2372
  options: multiOptions,
2373
2373
  required: false
@@ -2382,7 +2382,7 @@ async function runUseCaseCommand(useCaseNameArg, flags = {}) {
2382
2382
  let httpPath = "/";
2383
2383
  if (!flags.yes) {
2384
2384
  const hasInput = handleCancel(
2385
- await p3__namespace.confirm({
2385
+ await p14__namespace.confirm({
2386
2386
  message: "Does this use case accept input arguments?",
2387
2387
  initialValue: true
2388
2388
  })
@@ -2392,7 +2392,7 @@ async function runUseCaseCommand(useCaseNameArg, flags = {}) {
2392
2392
  });
2393
2393
  }
2394
2394
  const hasCustomOutput = handleCancel(
2395
- await p3__namespace.confirm({
2395
+ await p14__namespace.confirm({
2396
2396
  message: "Does this use case return custom output data?",
2397
2397
  initialValue: false
2398
2398
  })
@@ -2402,20 +2402,20 @@ async function runUseCaseCommand(useCaseNameArg, flags = {}) {
2402
2402
  });
2403
2403
  }
2404
2404
  includeTest = handleCancel(
2405
- await p3__namespace.confirm({
2405
+ await p14__namespace.confirm({
2406
2406
  message: "Generate Vitest unit test skeleton (.test.ts)?",
2407
2407
  initialValue: true
2408
2408
  })
2409
2409
  );
2410
2410
  createHttp = handleCancel(
2411
- await p3__namespace.confirm({
2411
+ await p14__namespace.confirm({
2412
2412
  message: "Generate a matching ExpressRoute HTTP handler?",
2413
2413
  initialValue: false
2414
2414
  })
2415
2415
  );
2416
2416
  if (createHttp) {
2417
2417
  httpMethod = handleCancel(
2418
- await p3__namespace.select({
2418
+ await p14__namespace.select({
2419
2419
  message: "HTTP method for route:",
2420
2420
  options: [
2421
2421
  { value: "post", label: "POST" },
@@ -2428,7 +2428,7 @@ async function runUseCaseCommand(useCaseNameArg, flags = {}) {
2428
2428
  })
2429
2429
  );
2430
2430
  httpPath = handleCancel(
2431
- await p3__namespace.text({
2431
+ await p14__namespace.text({
2432
2432
  message: "Route subpath (relative to feature prefix):",
2433
2433
  initialValue: "/",
2434
2434
  defaultValue: "/"
@@ -2436,7 +2436,7 @@ async function runUseCaseCommand(useCaseNameArg, flags = {}) {
2436
2436
  ).trim();
2437
2437
  }
2438
2438
  }
2439
- const s = p3__namespace.spinner();
2439
+ const s = p14__namespace.spinner();
2440
2440
  s.start(`Generating use case '${pc14__default.default.cyan(ucName)}'...`);
2441
2441
  const options = {
2442
2442
  name: ucName,
@@ -2469,7 +2469,7 @@ async function runUseCaseCommand(useCaseNameArg, flags = {}) {
2469
2469
  }
2470
2470
  s.stop("Use case generated successfully!");
2471
2471
  printGeneratedFiles(files, options.dryRun);
2472
- p3__namespace.outro(pc14__default.default.green(`Use case '${ucName}' created in feature '${feature}'!`));
2472
+ p14__namespace.outro(pc14__default.default.green(`Use case '${ucName}' created in feature '${feature}'!`));
2473
2473
  }
2474
2474
  async function runDomainCommand(domainNameArg, flags = {}) {
2475
2475
  const projectRoot = findProjectRoot();
@@ -2480,14 +2480,14 @@ async function runDomainCommand(domainNameArg, flags = {}) {
2480
2480
  const featureOptions = existingFeatures.map((f) => ({ value: f, label: f }));
2481
2481
  featureOptions.push({ value: "__custom__", label: "\u270F\uFE0F Enter custom feature name..." });
2482
2482
  const selected = handleCancel(
2483
- await p3__namespace.select({
2483
+ await p14__namespace.select({
2484
2484
  message: "Select target feature:",
2485
2485
  options: featureOptions
2486
2486
  })
2487
2487
  );
2488
2488
  if (selected === "__custom__") {
2489
2489
  feature = handleCancel(
2490
- await p3__namespace.text({
2490
+ await p14__namespace.text({
2491
2491
  message: "Enter feature name:",
2492
2492
  validate: (v) => v && v.trim() ? void 0 : "Feature name cannot be empty"
2493
2493
  })
@@ -2497,7 +2497,7 @@ async function runDomainCommand(domainNameArg, flags = {}) {
2497
2497
  }
2498
2498
  } else {
2499
2499
  feature = handleCancel(
2500
- await p3__namespace.text({
2500
+ await p14__namespace.text({
2501
2501
  message: "Enter target feature name:",
2502
2502
  validate: (v) => v && v.trim() ? void 0 : "Feature name cannot be empty"
2503
2503
  })
@@ -2508,7 +2508,7 @@ async function runDomainCommand(domainNameArg, flags = {}) {
2508
2508
  let name = domainNameArg?.trim();
2509
2509
  if (!name) {
2510
2510
  name = handleCancel(
2511
- await p3__namespace.text({
2511
+ await p14__namespace.text({
2512
2512
  message: "Domain model / entity name:",
2513
2513
  placeholder: "e.g. User, Order, Product, Address",
2514
2514
  validate: (v) => v && v.trim() ? void 0 : "Domain name cannot be empty"
@@ -2520,7 +2520,7 @@ async function runDomainCommand(domainNameArg, flags = {}) {
2520
2520
  let properties = [];
2521
2521
  if (!flags.yes) {
2522
2522
  kind = handleCancel(
2523
- await p3__namespace.select({
2523
+ await p14__namespace.select({
2524
2524
  message: "Select domain model type:",
2525
2525
  options: [
2526
2526
  { value: "interface", label: "TypeScript Interface (pure data structure)" },
@@ -2539,7 +2539,7 @@ async function runDomainCommand(domainNameArg, flags = {}) {
2539
2539
  defaults: kind === "valueObject" ? [{ name: "value", type: "string" }] : defaultProps
2540
2540
  });
2541
2541
  }
2542
- const s = p3__namespace.spinner();
2542
+ const s = p14__namespace.spinner();
2543
2543
  s.start(`Generating domain model '${pc14__default.default.cyan(entityName)}'...`);
2544
2544
  const options = {
2545
2545
  name: entityName,
@@ -2553,7 +2553,7 @@ async function runDomainCommand(domainNameArg, flags = {}) {
2553
2553
  const file = generateDomain(options);
2554
2554
  s.stop("Domain model generated successfully!");
2555
2555
  printGeneratedFiles([file], options.dryRun);
2556
- p3__namespace.outro(pc14__default.default.green(`Domain model '${entityName}' created in feature '${feature}'!`));
2556
+ p14__namespace.outro(pc14__default.default.green(`Domain model '${entityName}' created in feature '${feature}'!`));
2557
2557
  }
2558
2558
  async function runInfrastructureCommand(classNameArg, flags = {}) {
2559
2559
  const projectRoot = findProjectRoot();
@@ -2562,7 +2562,7 @@ async function runInfrastructureCommand(classNameArg, flags = {}) {
2562
2562
  let feature = flags.feature?.trim();
2563
2563
  if (!flags.yes && !flags.global && !flags.feature) {
2564
2564
  scope = handleCancel(
2565
- await p3__namespace.select({
2565
+ await p14__namespace.select({
2566
2566
  message: "Where should this infrastructure implementation be placed?",
2567
2567
  options: [
2568
2568
  { value: "feature", label: "Feature-level (features/<feature>/infrastructure)" },
@@ -2577,14 +2577,14 @@ async function runInfrastructureCommand(classNameArg, flags = {}) {
2577
2577
  const featureOptions = existingFeatures.map((f) => ({ value: f, label: f }));
2578
2578
  featureOptions.push({ value: "__custom__", label: "\u270F\uFE0F Enter custom feature name..." });
2579
2579
  const selected = handleCancel(
2580
- await p3__namespace.select({
2580
+ await p14__namespace.select({
2581
2581
  message: "Select target feature:",
2582
2582
  options: featureOptions
2583
2583
  })
2584
2584
  );
2585
2585
  if (selected === "__custom__") {
2586
2586
  feature = handleCancel(
2587
- await p3__namespace.text({
2587
+ await p14__namespace.text({
2588
2588
  message: "Enter feature name:",
2589
2589
  validate: (v) => v && v.trim() ? void 0 : "Feature name cannot be empty"
2590
2590
  })
@@ -2594,7 +2594,7 @@ async function runInfrastructureCommand(classNameArg, flags = {}) {
2594
2594
  }
2595
2595
  } else {
2596
2596
  feature = handleCancel(
2597
- await p3__namespace.text({
2597
+ await p14__namespace.text({
2598
2598
  message: "Enter target feature name:",
2599
2599
  validate: (v) => v && v.trim() ? void 0 : "Feature name cannot be empty"
2600
2600
  })
@@ -2607,7 +2607,7 @@ async function runInfrastructureCommand(classNameArg, flags = {}) {
2607
2607
  let name = classNameArg?.trim();
2608
2608
  if (!name) {
2609
2609
  name = handleCancel(
2610
- await p3__namespace.text({
2610
+ await p14__namespace.text({
2611
2611
  message: "Infrastructure class name:",
2612
2612
  placeholder: "e.g. StubUserRepository, PostgresUserRepository, S3FileStorage",
2613
2613
  validate: (v) => v && v.trim() ? void 0 : "Class name cannot be empty"
@@ -2626,7 +2626,7 @@ async function runInfrastructureCommand(classNameArg, flags = {}) {
2626
2626
  (i) => className.toLowerCase().includes(removeInterfacePrefix(i.name).toLowerCase())
2627
2627
  );
2628
2628
  const ifaceChoice = handleCancel(
2629
- await p3__namespace.select({
2629
+ await p14__namespace.select({
2630
2630
  message: "Does this class implement a domain interface or abstract class?",
2631
2631
  options: [
2632
2632
  ...interfaces.map((i) => ({ value: i.name, label: i.name })),
@@ -2638,7 +2638,7 @@ async function runInfrastructureCommand(classNameArg, flags = {}) {
2638
2638
  );
2639
2639
  if (ifaceChoice === "__custom__") {
2640
2640
  implementsInterface = handleCancel(
2641
- await p3__namespace.text({
2641
+ await p14__namespace.text({
2642
2642
  message: "Enter interface or abstract class name:",
2643
2643
  placeholder: "e.g. IUserRepository, BaseStorageAdapter",
2644
2644
  validate: (v) => v && v.trim() ? void 0 : "Name cannot be empty"
@@ -2649,14 +2649,14 @@ async function runInfrastructureCommand(classNameArg, flags = {}) {
2649
2649
  }
2650
2650
  } else {
2651
2651
  const wantImpl = handleCancel(
2652
- await p3__namespace.confirm({
2652
+ await p14__namespace.confirm({
2653
2653
  message: "Does this class implement a domain interface or abstract class?",
2654
2654
  initialValue: false
2655
2655
  })
2656
2656
  );
2657
2657
  if (wantImpl) {
2658
2658
  implementsInterface = handleCancel(
2659
- await p3__namespace.text({
2659
+ await p14__namespace.text({
2660
2660
  message: "Enter interface or abstract class name:",
2661
2661
  placeholder: "e.g. IUserRepository, BaseStorageAdapter",
2662
2662
  validate: (v) => v && v.trim() ? void 0 : "Name cannot be empty"
@@ -2676,7 +2676,7 @@ async function runInfrastructureCommand(classNameArg, flags = {}) {
2676
2676
  const allInterfaces = listDomainInterfaces(projectRoot);
2677
2677
  if (allInterfaces.length > 0) {
2678
2678
  const ifaceChoice = handleCancel(
2679
- await p3__namespace.select({
2679
+ await p14__namespace.select({
2680
2680
  message: "Does this class implement an interface or abstract class?",
2681
2681
  options: [
2682
2682
  ...allInterfaces.map((i) => ({ value: i.name, label: `${i.name} (${i.feature})` })),
@@ -2688,7 +2688,7 @@ async function runInfrastructureCommand(classNameArg, flags = {}) {
2688
2688
  );
2689
2689
  if (ifaceChoice === "__custom__") {
2690
2690
  implementsInterface = handleCancel(
2691
- await p3__namespace.text({
2691
+ await p14__namespace.text({
2692
2692
  message: "Enter interface or abstract class name:",
2693
2693
  placeholder: "e.g. IAuthRepository",
2694
2694
  validate: (v) => v && v.trim() ? void 0 : "Name cannot be empty"
@@ -2701,7 +2701,7 @@ async function runInfrastructureCommand(classNameArg, flags = {}) {
2701
2701
  }
2702
2702
  if (!flags.yes && !flags.kind) {
2703
2703
  kind = handleCancel(
2704
- await p3__namespace.select({
2704
+ await p14__namespace.select({
2705
2705
  message: "Select implementation kind:",
2706
2706
  options: [
2707
2707
  { value: "stub", label: "In-Memory Stub (with in-memory store and test helper methods)" },
@@ -2712,7 +2712,7 @@ async function runInfrastructureCommand(classNameArg, flags = {}) {
2712
2712
  );
2713
2713
  if (scope === "feature" && feature && implementsInterface) {
2714
2714
  registerInProvider = handleCancel(
2715
- await p3__namespace.confirm({
2715
+ await p14__namespace.confirm({
2716
2716
  message: "Register this implementation in feature diProvider.ts?",
2717
2717
  initialValue: true
2718
2718
  })
@@ -2721,7 +2721,7 @@ async function runInfrastructureCommand(classNameArg, flags = {}) {
2721
2721
  } else if (flags.yes && scope === "feature" && feature && implementsInterface) {
2722
2722
  registerInProvider = !flags.noProvider;
2723
2723
  }
2724
- const s = p3__namespace.spinner();
2724
+ const s = p14__namespace.spinner();
2725
2725
  s.start(`Generating infrastructure class '${pc14__default.default.cyan(className)}'...`);
2726
2726
  const files = [];
2727
2727
  const options = {
@@ -2757,7 +2757,7 @@ async function runInfrastructureCommand(classNameArg, flags = {}) {
2757
2757
  }
2758
2758
  s.stop("Infrastructure class generated successfully!");
2759
2759
  printGeneratedFiles(files, options.dryRun);
2760
- p3__namespace.outro(pc14__default.default.green(`Infrastructure class '${className}' created!`));
2760
+ p14__namespace.outro(pc14__default.default.green(`Infrastructure class '${className}' created!`));
2761
2761
  }
2762
2762
  async function runInterfaceCommand(interfaceNameArg, flags = {}) {
2763
2763
  const projectRoot = findProjectRoot();
@@ -2768,14 +2768,14 @@ async function runInterfaceCommand(interfaceNameArg, flags = {}) {
2768
2768
  const featureOptions = existingFeatures.map((f) => ({ value: f, label: f }));
2769
2769
  featureOptions.push({ value: "__custom__", label: "\u270F\uFE0F Enter custom feature name..." });
2770
2770
  const selected = handleCancel(
2771
- await p3__namespace.select({
2771
+ await p14__namespace.select({
2772
2772
  message: "Select target feature:",
2773
2773
  options: featureOptions
2774
2774
  })
2775
2775
  );
2776
2776
  if (selected === "__custom__") {
2777
2777
  feature = handleCancel(
2778
- await p3__namespace.text({
2778
+ await p14__namespace.text({
2779
2779
  message: "Enter feature name:",
2780
2780
  validate: (v) => v && v.trim() ? void 0 : "Feature name cannot be empty"
2781
2781
  })
@@ -2785,7 +2785,7 @@ async function runInterfaceCommand(interfaceNameArg, flags = {}) {
2785
2785
  }
2786
2786
  } else {
2787
2787
  feature = handleCancel(
2788
- await p3__namespace.text({
2788
+ await p14__namespace.text({
2789
2789
  message: "Enter target feature name:",
2790
2790
  validate: (v) => v && v.trim() ? void 0 : "Feature name cannot be empty"
2791
2791
  })
@@ -2796,7 +2796,7 @@ async function runInterfaceCommand(interfaceNameArg, flags = {}) {
2796
2796
  let name = interfaceNameArg?.trim();
2797
2797
  if (!name) {
2798
2798
  name = handleCancel(
2799
- await p3__namespace.text({
2799
+ await p14__namespace.text({
2800
2800
  message: "Domain interface name:",
2801
2801
  placeholder: "e.g. IUserRepository, IPaymentService",
2802
2802
  validate: (v) => v && v.trim() ? void 0 : "Interface name cannot be empty"
@@ -2814,7 +2814,7 @@ async function runInterfaceCommand(interfaceNameArg, flags = {}) {
2814
2814
  if (!flags.yes) {
2815
2815
  if (existingEntities.length > 0) {
2816
2816
  const selectedEntity = handleCancel(
2817
- await p3__namespace.select({
2817
+ await p14__namespace.select({
2818
2818
  message: "Select domain entity associated with this interface:",
2819
2819
  options: [
2820
2820
  ...existingEntities.map((e) => ({ value: e.name, label: e.name })),
@@ -2825,7 +2825,7 @@ async function runInterfaceCommand(interfaceNameArg, flags = {}) {
2825
2825
  );
2826
2826
  if (selectedEntity === "__custom__") {
2827
2827
  entityName = handleCancel(
2828
- await p3__namespace.text({
2828
+ await p14__namespace.text({
2829
2829
  message: "Enter entity name:",
2830
2830
  defaultValue: removeInterfacePrefix(ifaceName).replace(/Repository$|Service$/, "")
2831
2831
  })
@@ -2835,7 +2835,7 @@ async function runInterfaceCommand(interfaceNameArg, flags = {}) {
2835
2835
  }
2836
2836
  }
2837
2837
  kind = handleCancel(
2838
- await p3__namespace.select({
2838
+ await p14__namespace.select({
2839
2839
  message: "Interface definition style:",
2840
2840
  options: [
2841
2841
  { value: "abstractClass", label: "Abstract Class (Recommended - acts as DI token & type)" },
@@ -2845,7 +2845,7 @@ async function runInterfaceCommand(interfaceNameArg, flags = {}) {
2845
2845
  })
2846
2846
  );
2847
2847
  methodsPreset = handleCancel(
2848
- await p3__namespace.select({
2848
+ await p14__namespace.select({
2849
2849
  message: "Method signature preset:",
2850
2850
  options: [
2851
2851
  { value: "crud", label: "Standard CRUD (GetById, List, Create, Update, Delete)" },
@@ -2855,21 +2855,21 @@ async function runInterfaceCommand(interfaceNameArg, flags = {}) {
2855
2855
  })
2856
2856
  );
2857
2857
  generateStub = handleCancel(
2858
- await p3__namespace.confirm({
2858
+ await p14__namespace.confirm({
2859
2859
  message: "Auto-generate Infrastructure Stub implementation?",
2860
2860
  initialValue: true
2861
2861
  })
2862
2862
  );
2863
2863
  if (generateStub) {
2864
2864
  registerInProvider = handleCancel(
2865
- await p3__namespace.confirm({
2865
+ await p14__namespace.confirm({
2866
2866
  message: "Auto-register interface & stub in feature diProvider.ts?",
2867
2867
  initialValue: true
2868
2868
  })
2869
2869
  );
2870
2870
  }
2871
2871
  }
2872
- const s = p3__namespace.spinner();
2872
+ const s = p14__namespace.spinner();
2873
2873
  s.start(`Generating interface '${pc14__default.default.cyan(ifaceName)}'...`);
2874
2874
  const files = [];
2875
2875
  const options = {
@@ -2919,7 +2919,7 @@ async function runInterfaceCommand(interfaceNameArg, flags = {}) {
2919
2919
  }
2920
2920
  s.stop("Interface generated successfully!");
2921
2921
  printGeneratedFiles(files, options.dryRun);
2922
- p3__namespace.outro(pc14__default.default.green(`Interface '${ifaceName}' created in feature '${feature}'!`));
2922
+ p14__namespace.outro(pc14__default.default.green(`Interface '${ifaceName}' created in feature '${feature}'!`));
2923
2923
  }
2924
2924
  async function runHttpHandlerCommand(handlerNameArg, flags = {}) {
2925
2925
  const projectRoot = findProjectRoot();
@@ -2930,14 +2930,14 @@ async function runHttpHandlerCommand(handlerNameArg, flags = {}) {
2930
2930
  const featureOptions = existingFeatures.map((f) => ({ value: f, label: f }));
2931
2931
  featureOptions.push({ value: "__custom__", label: "\u270F\uFE0F Enter custom feature name..." });
2932
2932
  const selected = handleCancel(
2933
- await p3__namespace.select({
2933
+ await p14__namespace.select({
2934
2934
  message: "Select target feature:",
2935
2935
  options: featureOptions
2936
2936
  })
2937
2937
  );
2938
2938
  if (selected === "__custom__") {
2939
2939
  feature = handleCancel(
2940
- await p3__namespace.text({
2940
+ await p14__namespace.text({
2941
2941
  message: "Enter feature name:",
2942
2942
  validate: (v) => v && v.trim() ? void 0 : "Feature name cannot be empty"
2943
2943
  })
@@ -2947,7 +2947,7 @@ async function runHttpHandlerCommand(handlerNameArg, flags = {}) {
2947
2947
  }
2948
2948
  } else {
2949
2949
  feature = handleCancel(
2950
- await p3__namespace.text({
2950
+ await p14__namespace.text({
2951
2951
  message: "Enter target feature name:",
2952
2952
  validate: (v) => v && v.trim() ? void 0 : "Feature name cannot be empty"
2953
2953
  })
@@ -2958,7 +2958,7 @@ async function runHttpHandlerCommand(handlerNameArg, flags = {}) {
2958
2958
  let name = handlerNameArg?.trim();
2959
2959
  if (!name) {
2960
2960
  name = handleCancel(
2961
- await p3__namespace.text({
2961
+ await p14__namespace.text({
2962
2962
  message: "HTTP Route Handler class name:",
2963
2963
  placeholder: "e.g. CreateUserHttp, GetUserHttp, HealthHttp",
2964
2964
  validate: (v) => v && v.trim() ? void 0 : "Handler name cannot be empty"
@@ -2977,7 +2977,7 @@ async function runHttpHandlerCommand(handlerNameArg, flags = {}) {
2977
2977
  let validationFields = [];
2978
2978
  if (!flags.yes) {
2979
2979
  method = handleCancel(
2980
- await p3__namespace.select({
2980
+ await p14__namespace.select({
2981
2981
  message: "HTTP Method:",
2982
2982
  options: [
2983
2983
  { value: "get", label: "GET" },
@@ -2991,7 +2991,7 @@ async function runHttpHandlerCommand(handlerNameArg, flags = {}) {
2991
2991
  );
2992
2992
  const defaultPath = method === "get" ? "/" : "/";
2993
2993
  subPath = handleCancel(
2994
- await p3__namespace.text({
2994
+ await p14__namespace.text({
2995
2995
  message: "Route subpath (relative to feature prefix):",
2996
2996
  initialValue: defaultPath,
2997
2997
  defaultValue: defaultPath
@@ -3002,7 +3002,7 @@ async function runHttpHandlerCommand(handlerNameArg, flags = {}) {
3002
3002
  const ucOptions = useCases.map((u) => ({ value: u.name, label: u.name }));
3003
3003
  ucOptions.push({ value: "__none__", label: "None / Standalone Handler" });
3004
3004
  const chosenUc = handleCancel(
3005
- await p3__namespace.select({
3005
+ await p14__namespace.select({
3006
3006
  message: "Connect this handler to a domain Use Case?",
3007
3007
  options: ucOptions,
3008
3008
  initialValue: ucOptions[0]?.value
@@ -3013,7 +3013,7 @@ async function runHttpHandlerCommand(handlerNameArg, flags = {}) {
3013
3013
  }
3014
3014
  }
3015
3015
  includeValidation = handleCancel(
3016
- await p3__namespace.confirm({
3016
+ await p14__namespace.confirm({
3017
3017
  message: "Include Zod inbound request validation?",
3018
3018
  initialValue: method !== "delete"
3019
3019
  })
@@ -3021,7 +3021,7 @@ async function runHttpHandlerCommand(handlerNameArg, flags = {}) {
3021
3021
  if (includeValidation) {
3022
3022
  const defaultSource = method === "get" ? "query" : "body";
3023
3023
  validationSource = handleCancel(
3024
- await p3__namespace.select({
3024
+ await p14__namespace.select({
3025
3025
  message: "Validation data source:",
3026
3026
  options: [
3027
3027
  { value: "body", label: "req.body (for POST / PUT / PATCH payloads)" },
@@ -3035,7 +3035,7 @@ async function runHttpHandlerCommand(handlerNameArg, flags = {}) {
3035
3035
  });
3036
3036
  }
3037
3037
  }
3038
- const s = p3__namespace.spinner();
3038
+ const s = p14__namespace.spinner();
3039
3039
  s.start(`Generating HTTP handler '${pc14__default.default.cyan(className)}'...`);
3040
3040
  const options = {
3041
3041
  name: className,
@@ -3054,7 +3054,7 @@ async function runHttpHandlerCommand(handlerNameArg, flags = {}) {
3054
3054
  const files = generateHttpHandler(options);
3055
3055
  s.stop("HTTP handler generated successfully!");
3056
3056
  printGeneratedFiles(files, options.dryRun);
3057
- p3__namespace.outro(pc14__default.default.green(`HTTP handler '${className}' created in feature '${feature}'!`));
3057
+ p14__namespace.outro(pc14__default.default.green(`HTTP handler '${className}' created in feature '${feature}'!`));
3058
3058
  }
3059
3059
  function generateInjectableCode(className, dependencies = [], methods = [], implementsInterface) {
3060
3060
  const formattedDeps = dependencies.map((dep) => ({
@@ -3134,7 +3134,7 @@ async function runInjectableCommand(classNameArg, flags = {}) {
3134
3134
  let name = classNameArg?.trim();
3135
3135
  if (!name) {
3136
3136
  name = handleCancel(
3137
- await p3__namespace.text({
3137
+ await p14__namespace.text({
3138
3138
  message: "Injectable class name:",
3139
3139
  placeholder: "e.g. PasswordHasher, TokenService, UserTransformer",
3140
3140
  validate: (v) => v && v.trim() ? void 0 : "Class name cannot be empty"
@@ -3147,7 +3147,7 @@ async function runInjectableCommand(classNameArg, flags = {}) {
3147
3147
  let customPath;
3148
3148
  if (!flags.yes) {
3149
3149
  location = handleCancel(
3150
- await p3__namespace.select({
3150
+ await p14__namespace.select({
3151
3151
  message: "Select target architectural location:",
3152
3152
  options: [
3153
3153
  { value: "feature-service", label: "Feature Service (features/<feature>/services/)" },
@@ -3165,14 +3165,14 @@ async function runInjectableCommand(classNameArg, flags = {}) {
3165
3165
  const featureOptions = existingFeatures.map((f) => ({ value: f, label: f }));
3166
3166
  featureOptions.push({ value: "__custom__", label: "\u270F\uFE0F Enter custom feature name..." });
3167
3167
  const selected = handleCancel(
3168
- await p3__namespace.select({
3168
+ await p14__namespace.select({
3169
3169
  message: "Select target feature:",
3170
3170
  options: featureOptions
3171
3171
  })
3172
3172
  );
3173
3173
  if (selected === "__custom__") {
3174
3174
  feature = handleCancel(
3175
- await p3__namespace.text({
3175
+ await p14__namespace.text({
3176
3176
  message: "Enter feature name:",
3177
3177
  validate: (v) => v && v.trim() ? void 0 : "Feature name cannot be empty"
3178
3178
  })
@@ -3182,7 +3182,7 @@ async function runInjectableCommand(classNameArg, flags = {}) {
3182
3182
  }
3183
3183
  } else {
3184
3184
  feature = handleCancel(
3185
- await p3__namespace.text({
3185
+ await p14__namespace.text({
3186
3186
  message: "Enter target feature name:",
3187
3187
  validate: (v) => v && v.trim() ? void 0 : "Feature name cannot be empty"
3188
3188
  })
@@ -3192,7 +3192,7 @@ async function runInjectableCommand(classNameArg, flags = {}) {
3192
3192
  feature = toCamelCase(feature);
3193
3193
  } else if (location === "custom") {
3194
3194
  customPath = handleCancel(
3195
- await p3__namespace.text({
3195
+ await p14__namespace.text({
3196
3196
  message: "Enter destination directory path:",
3197
3197
  placeholder: "e.g. src/services or lib/utils",
3198
3198
  validate: (v) => v && v.trim() ? void 0 : "Path cannot be empty"
@@ -3203,13 +3203,13 @@ async function runInjectableCommand(classNameArg, flags = {}) {
3203
3203
  let generateInterface2 = false;
3204
3204
  if (!flags.yes) {
3205
3205
  generateInterface2 = handleCancel(
3206
- await p3__namespace.confirm({
3206
+ await p14__namespace.confirm({
3207
3207
  message: `Generate abstract class interface (I${className}) as runtime DI token?`,
3208
3208
  initialValue: false
3209
3209
  })
3210
3210
  );
3211
3211
  }
3212
- const s = p3__namespace.spinner();
3212
+ const s = p14__namespace.spinner();
3213
3213
  s.start(`Generating injectable '${pc14__default.default.cyan(className)}'...`);
3214
3214
  const options = {
3215
3215
  name: className,
@@ -3224,12 +3224,12 @@ async function runInjectableCommand(classNameArg, flags = {}) {
3224
3224
  const files = generateInjectable(options);
3225
3225
  s.stop("Injectable class generated successfully!");
3226
3226
  printGeneratedFiles(files, options.dryRun);
3227
- p3__namespace.outro(pc14__default.default.green(`Injectable '${className}' created successfully!`));
3227
+ p14__namespace.outro(pc14__default.default.green(`Injectable '${className}' created successfully!`));
3228
3228
  }
3229
3229
  async function runInteractiveMenu(flags = {}) {
3230
3230
  printBanner();
3231
3231
  const choice = handleCancel(
3232
- await p3__namespace.select({
3232
+ await p14__namespace.select({
3233
3233
  message: "What would you like to create in your architecture?",
3234
3234
  options: [
3235
3235
  {
@@ -3337,7 +3337,7 @@ async function handleCreate(type, name, flags = {}) {
3337
3337
  await runInjectableCommand(name, flags);
3338
3338
  break;
3339
3339
  default:
3340
- p3__namespace.log.error(
3340
+ p14__namespace.log.error(
3341
3341
  pc14__default.default.red(
3342
3342
  `Unknown component type: "${type}". Allowed types: feature, shared, usecase, domain, infrastructure, interface, httpHandler, injectable.`
3343
3343
  )
@@ -3562,7 +3562,7 @@ function installNpmPackages(projectRoot, packages, pm) {
3562
3562
  installCmd = `npm install ${packages.join(" ")}`;
3563
3563
  break;
3564
3564
  }
3565
- p3__namespace.log.info(`Installing missing dependencies with ${manager}: ${pc14__default.default.cyan(packages.join(", "))}`);
3565
+ p14__namespace.log.info(`Installing missing dependencies with ${manager}: ${pc14__default.default.cyan(packages.join(", "))}`);
3566
3566
  child_process.execSync(installCmd, {
3567
3567
  cwd: projectRoot,
3568
3568
  stdio: "inherit"
@@ -3606,8 +3606,8 @@ function computeDirectoryHash(dirPath, files) {
3606
3606
 
3607
3607
  // src/commands/import.ts
3608
3608
  var importPrompts = {
3609
- select: p3__namespace.select,
3610
- text: p3__namespace.text
3609
+ select: p14__namespace.select,
3610
+ text: p14__namespace.text
3611
3611
  };
3612
3612
  function rewriteImports(content, aliasMap) {
3613
3613
  if (aliasMap.size === 0) return content;
@@ -3636,126 +3636,6 @@ function getExistingModuleDir(projectRoot, modType, modName) {
3636
3636
  function checkModuleExists(projectRoot, modType, modName) {
3637
3637
  return getExistingModuleDir(projectRoot, modType, modName) !== null;
3638
3638
  }
3639
- async function resolveDependency(depType, depName, aliasMap, projectRoot, flags, importModuleRecursive, importedModules, registryBase, index) {
3640
- const folder = depType === "shared" ? "shared" : "features";
3641
- const isAlreadyImportedThisRun = importedModules.has(`${depType}:${depName}`);
3642
- if (isAlreadyImportedThisRun) return;
3643
- const programmaticAlias = flags.alias?.[depName] || flags.alias?.[`${depType}/${depName}`];
3644
- if (programmaticAlias) {
3645
- aliasMap.set(`@/${folder}/${depName}/`, `@/${folder}/${programmaticAlias}/`);
3646
- const baseDir = getModuleBaseDir(projectRoot, depType);
3647
- const displayDest = path2__default.default.relative(
3648
- projectRoot,
3649
- path2__default.default.join(baseDir, programmaticAlias)
3650
- );
3651
- p3__namespace.log.step(`Importing '${depName}' into '${displayDest}'...`);
3652
- await importModuleRecursive(depType, depName, programmaticAlias);
3653
- return;
3654
- }
3655
- const existingDir = getExistingModuleDir(projectRoot, depType, depName);
3656
- if (!existingDir) {
3657
- p3__namespace.log.info(` \u21B3 Resolving required ${depType} dependency: ${pc14__default.default.cyan(depName)}`);
3658
- await importModuleRecursive(depType, depName, depName);
3659
- return;
3660
- }
3661
- const entry = (depType === "shared" ? index?.shared : index?.features)?.find(
3662
- (item) => item.name === depName
3663
- );
3664
- let remoteIntegrity = entry?.integrity;
3665
- if (!remoteIntegrity) {
3666
- try {
3667
- const depManifest = await fetchModuleManifest(registryBase, depType, depName);
3668
- remoteIntegrity = depManifest.integrity;
3669
- } catch {
3670
- }
3671
- }
3672
- const localHash = computeDirectoryHash(existingDir);
3673
- if (remoteIntegrity && localHash === remoteIntegrity) {
3674
- p3__namespace.log.step(`\u2713 ${depType}/${depName} is up to date (reusing existing)`);
3675
- importedModules.add(`${depType}:${depName}`);
3676
- return;
3677
- }
3678
- if (flags.overwrite) {
3679
- p3__namespace.log.step(`Overwriting '${depType}/${depName}' with registry version (--overwrite)...`);
3680
- const baseDir = getModuleBaseDir(projectRoot, depType);
3681
- const targetDir = path2__default.default.join(baseDir, depName);
3682
- if (!flags.dryRun) {
3683
- if (existingDir !== targetDir) {
3684
- fs9__default.default.rmSync(existingDir, { recursive: true, force: true });
3685
- }
3686
- fs9__default.default.rmSync(targetDir, { recursive: true, force: true });
3687
- }
3688
- await importModuleRecursive(depType, depName, depName, { overwrite: true });
3689
- return;
3690
- }
3691
- if (flags.yes) {
3692
- p3__namespace.log.info(`Using existing '${depType}/${depName}'`);
3693
- importedModules.add(`${depType}:${depName}`);
3694
- return;
3695
- }
3696
- const choice = handleCancel(
3697
- await importPrompts.select({
3698
- message: `Local '${depType}/${depName}' differs from the registry version.`,
3699
- options: [
3700
- {
3701
- value: "keep_existing",
3702
- label: `Keep existing local version (Recommended)`
3703
- },
3704
- {
3705
- value: "rename",
3706
- label: "Import fresh copy under a new name (alias)"
3707
- },
3708
- {
3709
- value: "overwrite",
3710
- label: "Overwrite local version with registry version"
3711
- }
3712
- ]
3713
- })
3714
- );
3715
- if (choice === "keep_existing" || choice === "use_existing") {
3716
- p3__namespace.log.step(`Skipping '${depType}/${depName}' (keeping existing)`);
3717
- importedModules.add(`${depType}:${depName}`);
3718
- return;
3719
- }
3720
- if (choice === "rename") {
3721
- const newName = handleCancel(
3722
- await importPrompts.text({
3723
- message: "What should we name the new copy?",
3724
- placeholder: `${depName}-copy`,
3725
- validate(val) {
3726
- const v = val?.trim();
3727
- if (!v) return "Name cannot be empty";
3728
- if (v === depName) return `Name must be different from '${depName}'`;
3729
- if (!/^[a-zA-Z0-9_-]+$/.test(v)) {
3730
- return "Name can only contain alphanumeric characters, dashes, and underscores";
3731
- }
3732
- if (checkModuleExists(projectRoot, depType, v)) {
3733
- return `'${v}' already exists in ${folder}, please choose another name`;
3734
- }
3735
- }
3736
- })
3737
- ).trim();
3738
- aliasMap.set(`@/${folder}/${depName}/`, `@/${folder}/${newName}/`);
3739
- const baseDir = getModuleBaseDir(projectRoot, depType);
3740
- const displayDest = path2__default.default.relative(projectRoot, path2__default.default.join(baseDir, newName));
3741
- p3__namespace.log.step(`Importing '${depName}' into '${displayDest}'...`);
3742
- await importModuleRecursive(depType, depName, newName);
3743
- return;
3744
- }
3745
- if (choice === "overwrite") {
3746
- p3__namespace.log.step(`Overwriting '${depType}/${depName}' with registry version...`);
3747
- const baseDir = getModuleBaseDir(projectRoot, depType);
3748
- const targetDir = path2__default.default.join(baseDir, depName);
3749
- if (!flags.dryRun) {
3750
- if (existingDir !== targetDir) {
3751
- fs9__default.default.rmSync(existingDir, { recursive: true, force: true });
3752
- }
3753
- fs9__default.default.rmSync(targetDir, { recursive: true, force: true });
3754
- }
3755
- await importModuleRecursive(depType, depName, depName, { overwrite: true });
3756
- return;
3757
- }
3758
- }
3759
3639
  async function handleImport(typeArg, nameArg, flags = {}) {
3760
3640
  const projectRoot = findProjectRoot();
3761
3641
  let type = typeArg?.trim().toLowerCase();
@@ -3780,11 +3660,11 @@ async function handleImport(typeArg, nameArg, flags = {}) {
3780
3660
  );
3781
3661
  }
3782
3662
  if (type !== "shared" && type !== "feature") {
3783
- p3__namespace.log.error(pc14__default.default.red(`Invalid module type: "${typeArg}". Must be "shared" or "feature".`));
3663
+ p14__namespace.log.error(pc14__default.default.red(`Invalid module type: "${typeArg}". Must be "shared" or "feature".`));
3784
3664
  process.exit(1);
3785
3665
  }
3786
3666
  const registryBase = getRegistryBase(projectRoot, flags.registry);
3787
- const s = p3__namespace.spinner();
3667
+ const s = p14__namespace.spinner();
3788
3668
  s.start(`Connecting to registry at ${pc14__default.default.dim(registryBase)}...`);
3789
3669
  let index;
3790
3670
  try {
@@ -3792,7 +3672,7 @@ async function handleImport(typeArg, nameArg, flags = {}) {
3792
3672
  s.stop("Registry index loaded.");
3793
3673
  } catch (err) {
3794
3674
  s.stop(pc14__default.default.red("Failed to load registry index."));
3795
- p3__namespace.log.error(pc14__default.default.red(err.message || String(err)));
3675
+ p14__namespace.log.error(pc14__default.default.red(err.message || String(err)));
3796
3676
  process.exit(1);
3797
3677
  }
3798
3678
  const availableList = type === "shared" ? index.shared : index.features;
@@ -3800,7 +3680,7 @@ async function handleImport(typeArg, nameArg, flags = {}) {
3800
3680
  let name = nameArg?.trim();
3801
3681
  if (!name) {
3802
3682
  if (availableList.length === 0) {
3803
- p3__namespace.log.warn(`No ${type} modules available in the registry.`);
3683
+ p14__namespace.log.warn(`No ${type} modules available in the registry.`);
3804
3684
  return;
3805
3685
  }
3806
3686
  name = handleCancel(
@@ -3816,108 +3696,294 @@ async function handleImport(typeArg, nameArg, flags = {}) {
3816
3696
  }
3817
3697
  if (!candidateNames.includes(name)) {
3818
3698
  const closest = findClosestMatch(name, candidateNames);
3819
- p3__namespace.log.error(pc14__default.default.red(`\u274C Module '${name}' not found in the ${type} registry.`));
3699
+ p14__namespace.log.error(pc14__default.default.red(`\u274C Module '${name}' not found in the ${type} registry.`));
3820
3700
  if (closest) {
3821
- p3__namespace.log.info(pc14__default.default.yellow(`Did you mean '${pc14__default.default.cyan(closest)}'?`));
3701
+ p14__namespace.log.info(pc14__default.default.yellow(`Did you mean '${pc14__default.default.cyan(closest)}'?`));
3822
3702
  }
3823
3703
  process.exit(1);
3824
3704
  }
3825
- const importedModules = /* @__PURE__ */ new Set();
3826
- const totalWrittenFiles = [];
3827
- const requiredNpmPackages = /* @__PURE__ */ new Set();
3828
- async function importModuleRecursive(modType, registryName, targetName = registryName, options) {
3829
- const modKey = `${modType}:${targetName}`;
3830
- if (importedModules.has(modKey)) return;
3831
- p3__namespace.log.step(
3832
- `Importing ${modType}: ${pc14__default.default.cyan(targetName)}${targetName !== registryName ? pc14__default.default.dim(` (from ${registryName})`) : ""}...`
3833
- );
3705
+ const nodes = /* @__PURE__ */ new Map();
3706
+ async function discoverGraph(modType, modName) {
3707
+ const key = `${modType}:${modName}`;
3708
+ if (nodes.has(key)) return;
3834
3709
  let manifest;
3835
3710
  try {
3836
- manifest = await fetchModuleManifest(registryBase, modType, registryName);
3711
+ manifest = await fetchModuleManifest(registryBase, modType, modName);
3837
3712
  } catch (err) {
3838
- p3__namespace.log.error(pc14__default.default.red(`Failed to fetch manifest for ${modType} '${registryName}': ${err.message}`));
3713
+ p14__namespace.log.error(pc14__default.default.red(`Failed to fetch manifest for ${modType} '${modName}': ${err.message}`));
3839
3714
  process.exit(1);
3840
3715
  }
3841
- const aliasMap = /* @__PURE__ */ new Map();
3842
- if (targetName !== registryName) {
3843
- const folder2 = modType === "shared" ? "shared" : "features";
3844
- aliasMap.set(`@/${folder2}/${registryName}/`, `@/${folder2}/${targetName}/`);
3845
- }
3846
- const sharedDeps = manifest.dependencies?.shared || [];
3847
- for (const dep of sharedDeps) {
3848
- await resolveDependency(
3849
- "shared",
3850
- dep,
3851
- aliasMap,
3852
- projectRoot,
3853
- flags,
3854
- importModuleRecursive,
3855
- importedModules,
3856
- registryBase,
3857
- index
3858
- );
3716
+ nodes.set(key, {
3717
+ type: modType,
3718
+ name: modName,
3719
+ manifest
3720
+ });
3721
+ for (const dep of manifest.dependencies?.shared || []) {
3722
+ await discoverGraph("shared", dep);
3859
3723
  }
3860
- const featureDeps = manifest.dependencies?.features || [];
3861
- for (const dep of featureDeps) {
3862
- await resolveDependency(
3863
- "feature",
3864
- dep,
3865
- aliasMap,
3866
- projectRoot,
3867
- flags,
3868
- importModuleRecursive,
3869
- importedModules,
3870
- registryBase,
3871
- index
3872
- );
3724
+ for (const dep of manifest.dependencies?.features || []) {
3725
+ await discoverGraph("feature", dep);
3873
3726
  }
3874
- for (const pkg of manifest.dependencies?.npm || []) {
3875
- requiredNpmPackages.add(pkg);
3727
+ }
3728
+ await discoverGraph(type, name);
3729
+ const orderedKeys = [];
3730
+ const visiting = /* @__PURE__ */ new Set();
3731
+ const visited = /* @__PURE__ */ new Set();
3732
+ function buildTopologicalOrder(key) {
3733
+ if (visited.has(key)) return;
3734
+ if (visiting.has(key)) return;
3735
+ visiting.add(key);
3736
+ const node = nodes.get(key);
3737
+ if (node) {
3738
+ for (const dep of node.manifest.dependencies?.shared || []) {
3739
+ buildTopologicalOrder(`shared:${dep}`);
3740
+ }
3741
+ for (const dep of node.manifest.dependencies?.features || []) {
3742
+ buildTopologicalOrder(`feature:${dep}`);
3743
+ }
3876
3744
  }
3745
+ visiting.delete(key);
3746
+ visited.add(key);
3747
+ orderedKeys.push(key);
3748
+ }
3749
+ const rootKey = `${type}:${name}`;
3750
+ buildTopologicalOrder(rootKey);
3751
+ const resolutions = /* @__PURE__ */ new Map();
3752
+ const globalAliasMap = /* @__PURE__ */ new Map();
3753
+ p14__namespace.log.step(`Importing ${type}: ${pc14__default.default.cyan(name)}...`);
3754
+ for (const key of orderedKeys) {
3755
+ const node = nodes.get(key);
3756
+ const { type: modType, name: registryName, manifest } = node;
3877
3757
  const folder = modType === "shared" ? "shared" : "features";
3878
- const targetDir = path2__default.default.join(getModuleBaseDir(projectRoot, modType), targetName);
3879
- const isOverwrite = Boolean(flags.overwrite || options?.overwrite);
3880
- for (const file of manifest.files || []) {
3758
+ if (key === rootKey) {
3759
+ const programmaticAlias2 = flags.alias?.[registryName] || flags.alias?.[`${modType}/${registryName}`];
3760
+ const targetName = programmaticAlias2 || registryName;
3761
+ if (targetName !== registryName) {
3762
+ globalAliasMap.set(`@/${folder}/${registryName}/`, `@/${folder}/${targetName}/`);
3763
+ globalAliasMap.set(`@/${folder}/${registryName}`, `@/${folder}/${targetName}`);
3764
+ }
3765
+ resolutions.set(key, {
3766
+ type: modType,
3767
+ registryName,
3768
+ targetName,
3769
+ action: flags.overwrite ? "overwrite" : "download",
3770
+ manifest
3771
+ });
3772
+ continue;
3773
+ }
3774
+ const programmaticAlias = flags.alias?.[registryName] || flags.alias?.[`${modType}/${registryName}`];
3775
+ if (programmaticAlias) {
3776
+ globalAliasMap.set(`@/${folder}/${registryName}/`, `@/${folder}/${programmaticAlias}/`);
3777
+ globalAliasMap.set(`@/${folder}/${registryName}`, `@/${folder}/${programmaticAlias}`);
3778
+ const baseDir = getModuleBaseDir(projectRoot, modType);
3779
+ const displayDest = path2__default.default.relative(projectRoot, path2__default.default.join(baseDir, programmaticAlias));
3780
+ p14__namespace.log.step(`Importing '${registryName}' into '${displayDest}'...`);
3781
+ resolutions.set(key, {
3782
+ type: modType,
3783
+ registryName,
3784
+ targetName: programmaticAlias,
3785
+ action: "alias",
3786
+ manifest
3787
+ });
3788
+ continue;
3789
+ }
3790
+ const existingDir = getExistingModuleDir(projectRoot, modType, registryName);
3791
+ if (!existingDir) {
3792
+ p14__namespace.log.info(` \u21B3 Resolving required ${modType} dependency: ${pc14__default.default.cyan(registryName)}`);
3793
+ resolutions.set(key, {
3794
+ type: modType,
3795
+ registryName,
3796
+ targetName: registryName,
3797
+ action: "download",
3798
+ manifest
3799
+ });
3800
+ continue;
3801
+ }
3802
+ const entry = (modType === "shared" ? index.shared : index.features)?.find(
3803
+ (item) => item.name === registryName
3804
+ );
3805
+ const remoteIntegrity = manifest.integrity || entry?.integrity;
3806
+ const localHash = computeDirectoryHash(existingDir);
3807
+ if (remoteIntegrity && localHash === remoteIntegrity) {
3808
+ p14__namespace.log.step(`\u2713 ${modType}/${registryName} is up to date (reusing existing)`);
3809
+ resolutions.set(key, {
3810
+ type: modType,
3811
+ registryName,
3812
+ targetName: registryName,
3813
+ action: "reuse",
3814
+ manifest
3815
+ });
3816
+ continue;
3817
+ }
3818
+ if (flags.overwrite) {
3819
+ p14__namespace.log.step(`Overwriting '${modType}/${registryName}' with registry version (--overwrite)...`);
3820
+ resolutions.set(key, {
3821
+ type: modType,
3822
+ registryName,
3823
+ targetName: registryName,
3824
+ action: "overwrite",
3825
+ manifest
3826
+ });
3827
+ continue;
3828
+ }
3829
+ if (flags.yes) {
3830
+ p14__namespace.log.info(`Using existing '${modType}/${registryName}'`);
3831
+ resolutions.set(key, {
3832
+ type: modType,
3833
+ registryName,
3834
+ targetName: registryName,
3835
+ action: "reuse",
3836
+ manifest
3837
+ });
3838
+ continue;
3839
+ }
3840
+ const choice = handleCancel(
3841
+ await importPrompts.select({
3842
+ message: `Local '${modType}/${registryName}' differs from the registry version.`,
3843
+ options: [
3844
+ {
3845
+ value: "keep_existing",
3846
+ label: `Keep existing local version (Recommended)`
3847
+ },
3848
+ {
3849
+ value: "rename",
3850
+ label: "Import fresh copy under a new name (alias)"
3851
+ },
3852
+ {
3853
+ value: "overwrite",
3854
+ label: "Overwrite local version with registry version"
3855
+ }
3856
+ ]
3857
+ })
3858
+ );
3859
+ if (choice === "keep_existing" || choice === "use_existing") {
3860
+ p14__namespace.log.step(`Skipping '${modType}/${registryName}' (keeping existing)`);
3861
+ resolutions.set(key, {
3862
+ type: modType,
3863
+ registryName,
3864
+ targetName: registryName,
3865
+ action: "reuse",
3866
+ manifest
3867
+ });
3868
+ continue;
3869
+ }
3870
+ if (choice === "rename") {
3871
+ const newName = handleCancel(
3872
+ await importPrompts.text({
3873
+ message: "What should we name the new copy?",
3874
+ placeholder: `${registryName}-copy`,
3875
+ validate(val) {
3876
+ const v = val?.trim();
3877
+ if (!v) return "Name cannot be empty";
3878
+ if (v === registryName) return `Name must be different from '${registryName}'`;
3879
+ if (!/^[a-zA-Z0-9_-]+$/.test(v)) {
3880
+ return "Name can only contain alphanumeric characters, dashes, and underscores";
3881
+ }
3882
+ if (checkModuleExists(projectRoot, modType, v)) {
3883
+ return `'${v}' already exists in ${folder}, please choose another name`;
3884
+ }
3885
+ }
3886
+ })
3887
+ ).trim();
3888
+ globalAliasMap.set(`@/${folder}/${registryName}/`, `@/${folder}/${newName}/`);
3889
+ globalAliasMap.set(`@/${folder}/${registryName}`, `@/${folder}/${newName}`);
3890
+ const baseDir = getModuleBaseDir(projectRoot, modType);
3891
+ const displayDest = path2__default.default.relative(projectRoot, path2__default.default.join(baseDir, newName));
3892
+ p14__namespace.log.step(`Importing '${registryName}' into '${displayDest}'...`);
3893
+ resolutions.set(key, {
3894
+ type: modType,
3895
+ registryName,
3896
+ targetName: newName,
3897
+ action: "alias",
3898
+ manifest
3899
+ });
3900
+ continue;
3901
+ }
3902
+ if (choice === "overwrite") {
3903
+ p14__namespace.log.step(`Overwriting '${modType}/${registryName}' with registry version...`);
3904
+ resolutions.set(key, {
3905
+ type: modType,
3906
+ registryName,
3907
+ targetName: registryName,
3908
+ action: "overwrite",
3909
+ manifest
3910
+ });
3911
+ continue;
3912
+ }
3913
+ }
3914
+ const totalWrittenFiles = [];
3915
+ const requiredNpmPackages = /* @__PURE__ */ new Set();
3916
+ for (const node of nodes.values()) {
3917
+ for (const pkg of node.manifest.dependencies?.npm || []) {
3918
+ requiredNpmPackages.add(pkg);
3919
+ }
3920
+ }
3921
+ for (const key of orderedKeys) {
3922
+ const res = resolutions.get(key);
3923
+ if (res.action === "reuse") {
3924
+ continue;
3925
+ }
3926
+ const folder = res.type === "shared" ? "shared" : "features";
3927
+ const targetDir = path2__default.default.join(getModuleBaseDir(projectRoot, res.type), res.targetName);
3928
+ const isOverwrite = Boolean(flags.overwrite || res.action === "overwrite");
3929
+ if (key !== rootKey) {
3930
+ p14__namespace.log.step(
3931
+ `Importing ${res.type}: ${pc14__default.default.cyan(res.targetName)}${res.targetName !== res.registryName ? pc14__default.default.dim(` (from ${res.registryName})`) : ""}...`
3932
+ );
3933
+ }
3934
+ if (res.action === "overwrite" && !flags.dryRun) {
3935
+ const existingDir = getExistingModuleDir(projectRoot, res.type, res.targetName);
3936
+ if (existingDir && existingDir !== targetDir) {
3937
+ fs9__default.default.rmSync(existingDir, { recursive: true, force: true });
3938
+ }
3939
+ if (fs9__default.default.existsSync(targetDir)) {
3940
+ fs9__default.default.rmSync(targetDir, { recursive: true, force: true });
3941
+ }
3942
+ }
3943
+ for (const file of res.manifest.files || []) {
3881
3944
  if (file === "registry.json") continue;
3882
- const remoteFilePath = `${folder}/${registryName}/${file}`;
3945
+ const remoteFilePath = `${folder}/${res.registryName}/${file}`;
3883
3946
  const localFilePath = path2__default.default.join(targetDir, file);
3884
3947
  if (fs9__default.default.existsSync(localFilePath) && !isOverwrite) {
3885
- p3__namespace.log.warn(
3948
+ p14__namespace.log.warn(
3886
3949
  ` \u21B3 Skipping existing file: ${pc14__default.default.dim(path2__default.default.relative(projectRoot, localFilePath))} (use --overwrite to replace)`
3887
3950
  );
3888
3951
  continue;
3889
3952
  }
3890
3953
  let content = await fetchRegistryFile(registryBase, remoteFilePath);
3891
- content = rewriteImports(content, aliasMap);
3954
+ content = rewriteImports(content, globalAliasMap);
3892
3955
  if (!flags.dryRun) {
3893
3956
  fs9__default.default.mkdirSync(path2__default.default.dirname(localFilePath), { recursive: true });
3894
3957
  fs9__default.default.writeFileSync(localFilePath, content, "utf-8");
3895
3958
  }
3896
3959
  const displayPath = path2__default.default.relative(projectRoot, localFilePath);
3897
3960
  totalWrittenFiles.push(displayPath);
3898
- p3__namespace.log.message(` ${pc14__default.default.green("+")} ${displayPath}`);
3961
+ p14__namespace.log.message(` ${pc14__default.default.green("+")} ${displayPath}`);
3899
3962
  }
3900
- importedModules.add(modKey);
3901
3963
  }
3902
- await importModuleRecursive(type, name, name);
3903
3964
  const missingNpm = getMissingNpmPackages(projectRoot, Array.from(requiredNpmPackages));
3904
3965
  if (missingNpm.length > 0) {
3905
3966
  if (flags.skipInstall || flags.dryRun) {
3906
- p3__namespace.log.info(`Required npm dependencies to install: ${pc14__default.default.cyan(missingNpm.join(", "))}`);
3967
+ p14__namespace.log.info(`Required npm dependencies to install: ${pc14__default.default.cyan(missingNpm.join(", "))}`);
3907
3968
  } else {
3908
3969
  try {
3909
3970
  installNpmPackages(projectRoot, missingNpm);
3910
3971
  } catch (err) {
3911
- p3__namespace.log.warn(`Could not automatically install packages (${err.message}). Please run: npm install ${missingNpm.join(" ")}`);
3972
+ p14__namespace.log.warn(
3973
+ `Could not automatically install packages (${err.message}). Please run: npm install ${missingNpm.join(
3974
+ " "
3975
+ )}`
3976
+ );
3912
3977
  }
3913
3978
  }
3914
3979
  }
3915
3980
  if (flags.dryRun) {
3916
- p3__namespace.log.info(pc14__default.default.yellow("Dry run complete: No files were written to disk."));
3981
+ p14__namespace.log.info(pc14__default.default.yellow("Dry run complete: No files were written to disk."));
3917
3982
  } else {
3983
+ const rootRes = resolutions.get(rootKey);
3918
3984
  const baseDir = getModuleBaseDir(projectRoot, type);
3919
- const displayTarget = path2__default.default.relative(projectRoot, path2__default.default.join(baseDir, name));
3920
- p3__namespace.log.success(
3985
+ const displayTarget = path2__default.default.relative(projectRoot, path2__default.default.join(baseDir, rootRes.targetName));
3986
+ p14__namespace.log.success(
3921
3987
  pc14__default.default.green(
3922
3988
  `Successfully imported ${type} '${name}' (${totalWrittenFiles.length} file${totalWrittenFiles.length === 1 ? "" : "s"} placed in ${displayTarget})`
3923
3989
  )
@@ -3930,7 +3996,7 @@ function createCli() {
3930
3996
  const cli = cac.cac("mason");
3931
3997
  cli.command("[...args]", "Interactive scaffolding and import wizard").option("-d, --dry-run", "Preview changes without writing to disk").option("-o, --overwrite", "Overwrite existing files").option("-y, --yes", "Accept defaults and skip interactive prompts").option("--registry", "Run in registry mode").action(async (args, flags) => {
3932
3998
  if (args && args.length > 0) {
3933
- p3__namespace.log.error(
3999
+ p14__namespace.log.error(
3934
4000
  pc14__default.default.red(
3935
4001
  `Unknown command: "${args.join(" ")}". Use --help to list available commands.`
3936
4002
  )
@@ -3942,7 +4008,7 @@ function createCli() {
3942
4008
  const mode = getEffectiveMode(projectRoot, flags);
3943
4009
  if (mode === "registry") {
3944
4010
  const choice2 = handleCancel(
3945
- await p3__namespace.select({
4011
+ await p14__namespace.select({
3946
4012
  message: "\u{1F3DB}\uFE0F Mason (Registry Mode): What would you like to scaffold?",
3947
4013
  options: [
3948
4014
  {
@@ -3985,7 +4051,7 @@ function createCli() {
3985
4051
  return;
3986
4052
  }
3987
4053
  const choice = handleCancel(
3988
- await p3__namespace.select({
4054
+ await p14__namespace.select({
3989
4055
  message: "\u{1F9F1} Mason: What would you like to do?",
3990
4056
  options: [
3991
4057
  {
@@ -4053,7 +4119,7 @@ function createCli() {
4053
4119
  });
4054
4120
  }
4055
4121
  cli.help();
4056
- cli.version("1.0.14");
4122
+ cli.version("1.0.16");
4057
4123
  return cli;
4058
4124
  }
4059
4125
  function handleCliError(err) {
@@ -4061,7 +4127,7 @@ function handleCliError(err) {
4061
4127
  process.exit(0);
4062
4128
  }
4063
4129
  const message = err instanceof Error ? err.message : String(err);
4064
- p3__namespace.log.error(pc14__default.default.red(`Error: ${message}`));
4130
+ p14__namespace.log.error(pc14__default.default.red(`Error: ${message}`));
4065
4131
  process.exit(1);
4066
4132
  }
4067
4133
  async function runCli(argv = process.argv) {