@codefast/cli 0.3.15 → 0.3.16-canary.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (209) hide show
  1. package/README.md +1 -1
  2. package/dist/arrange/analyze.mjs +24 -0
  3. package/dist/{domains/arrange/presentation/presenters/arrange-cli.schema.mjs → arrange/cli-schema.mjs} +10 -1
  4. package/dist/arrange/command.mjs +106 -0
  5. package/dist/{domains/arrange/domain/arrange-analyze.domain-service.mjs → arrange/domain/analyze-service.mjs} +17 -10
  6. package/dist/{domains/arrange/domain/ast/ast-node.model.mjs → arrange/domain/ast/ast-node.mjs} +57 -3
  7. package/dist/{domains/arrange/domain/ast/collectors-cn.collector.mjs → arrange/domain/ast/collectors-cn.mjs} +21 -9
  8. package/dist/{domains/arrange/domain/ast/collectors-jsx.collector.mjs → arrange/domain/ast/collectors-jsx.mjs} +5 -2
  9. package/dist/{domains/arrange/domain/ast/collectors-tv.collector.mjs → arrange/domain/ast/collectors-tv.mjs} +21 -6
  10. package/dist/{domains/arrange/domain/ast/ast-helpers.helper.mjs → arrange/domain/ast/helpers.mjs} +26 -9
  11. package/dist/{domains/arrange/domain/ast/targets.model.mjs → arrange/domain/ast/targets.mjs} +19 -10
  12. package/dist/{domains/arrange/domain/constants.domain.mjs → arrange/domain/constants.mjs} +61 -16
  13. package/dist/{domains/arrange/domain/arrange-grouping.domain-service.mjs → arrange/domain/grouping-service.mjs} +31 -10
  14. package/dist/{domains/arrange/domain/grouping.domain.mjs → arrange/domain/grouping.mjs} +39 -18
  15. package/dist/{domains/arrange/domain/imports.domain.mjs → arrange/domain/imports.mjs} +7 -3
  16. package/dist/{domains/arrange/domain/source-text-formatters.formatter.mjs → arrange/domain/source-text-formatters.mjs} +22 -5
  17. package/dist/{domains/arrange/domain/tailwind-token.value-object.mjs → arrange/domain/tailwind-token.mjs} +12 -3
  18. package/dist/{domains/arrange/domain/tailwind-token-classifier.domain-service.mjs → arrange/domain/token-classifier.mjs} +39 -14
  19. package/dist/arrange/output.mjs +79 -0
  20. package/dist/arrange/process-file.mjs +42 -0
  21. package/dist/arrange/resolve-target.mjs +24 -0
  22. package/dist/arrange/scan-target.mjs +20 -0
  23. package/dist/arrange/source-parse.mjs +18 -0
  24. package/dist/arrange/suggest.mjs +15 -0
  25. package/dist/arrange/sync.mjs +51 -0
  26. package/dist/arrange/typescript-ast-translator.mjs +354 -0
  27. package/dist/arrange/workspace.mjs +31 -0
  28. package/dist/bin.mjs +1 -1
  29. package/dist/{program.mjs → cli.mjs} +14 -20
  30. package/dist/core/cli/format-error.mjs +15 -0
  31. package/dist/core/cli/global-options.mjs +10 -0
  32. package/dist/core/cli/positional.mjs +11 -0
  33. package/dist/core/cli/result-handle.mjs +51 -0
  34. package/dist/core/config/loader.mjs +79 -0
  35. package/dist/{domains/config/domain/codefast-config.schema.mjs → core/config/schema.mjs} +16 -2
  36. package/dist/core/config/warnings.mjs +12 -0
  37. package/dist/core/config.mjs +19 -0
  38. package/dist/{shell/domain/caught-unknown-message.value-object.mjs → core/errors.mjs} +20 -4
  39. package/dist/core/exit-codes.mjs +17 -0
  40. package/dist/core/filesystem/node.mjs +32 -0
  41. package/dist/core/logger.mjs +15 -0
  42. package/dist/{shell/domain/result.model.mjs → core/result.mjs} +7 -3
  43. package/dist/core/schema-parse.mjs +18 -0
  44. package/dist/{shell/domain/source-text-edit.support.mjs → core/source-text-edit.mjs} +14 -13
  45. package/dist/core/verbose-diagnostics.mjs +11 -0
  46. package/dist/core/workspace/resolver.mjs +177 -0
  47. package/dist/core/workspace/typescript-walk.mjs +36 -0
  48. package/dist/{domains/mirror/application/mirror-sync-cli-result.mjs → mirror/cli-result.mjs} +8 -2
  49. package/dist/{domains/mirror/presentation/presenters/mirror-cli.schema.mjs → mirror/cli-schema.mjs} +4 -1
  50. package/dist/mirror/command.mjs +57 -0
  51. package/dist/mirror/dist-filesystem-impl.mjs +42 -0
  52. package/dist/{domains/mirror/domain/constants.domain.mjs → mirror/domain/constants.mjs} +16 -1
  53. package/dist/{domains/mirror/infrastructure/guards/dirent-list.guard.mjs → mirror/domain/dirent-guard.mjs} +5 -2
  54. package/dist/{domains/mirror/domain/errors.domain.mjs → mirror/domain/errors.mjs} +7 -1
  55. package/dist/{domains/mirror/domain/generate-mirror-exports.domain-service.mjs → mirror/domain/exports.mjs} +17 -10
  56. package/dist/{domains/mirror/domain/package-display-name.policy.mjs → mirror/domain/package-display-name.mjs} +5 -2
  57. package/dist/{domains/mirror/domain/path-normalizer.value-object.mjs → mirror/domain/path-normalizer.mjs} +4 -1
  58. package/dist/mirror/output.mjs +45 -0
  59. package/dist/mirror/package-path.mjs +32 -0
  60. package/dist/mirror/prepare.mjs +33 -0
  61. package/dist/mirror/sync-reporter.mjs +104 -0
  62. package/dist/mirror/sync-workspace-package.mjs +103 -0
  63. package/dist/mirror/sync.mjs +87 -0
  64. package/dist/{domains/mirror/infrastructure/package-json-exports.repository.mjs → mirror/write-exports.mjs} +11 -7
  65. package/dist/tag/cli-result.mjs +11 -0
  66. package/dist/{domains/tag/presentation/presenters/tag-cli.schema.mjs → tag/cli-schema.mjs} +4 -1
  67. package/dist/tag/command.mjs +56 -0
  68. package/dist/tag/output.mjs +87 -0
  69. package/dist/tag/prepare.mjs +29 -0
  70. package/dist/tag/resolve-target-path.mjs +12 -0
  71. package/dist/tag/since-writer.mjs +131 -0
  72. package/dist/tag/sync.mjs +141 -0
  73. package/dist/tag/target-candidates.mjs +68 -0
  74. package/dist/tag/target-runner.mjs +26 -0
  75. package/dist/tag/version-resolver.mjs +25 -0
  76. package/package.json +11 -11
  77. package/dist/bootstrap/cli-application.module.mjs +0 -18
  78. package/dist/bootstrap/composition-root.mjs +0 -14
  79. package/dist/bootstrap/register-cli-command-trees.mjs +0 -7
  80. package/dist/domains/arrange/application/ports/outbound/arrange-target-scanner.port.mjs +0 -1
  81. package/dist/domains/arrange/application/ports/outbound/domain-source-parser.port.mjs +0 -1
  82. package/dist/domains/arrange/application/ports/outbound/file-walker.port.mjs +0 -1
  83. package/dist/domains/arrange/application/ports/presenting/present-analyze-report.presenter.mjs +0 -1
  84. package/dist/domains/arrange/application/ports/presenting/present-arrange-sync-result.presenter.mjs +0 -1
  85. package/dist/domains/arrange/application/ports/presenting/present-group-file-preview.presenter.mjs +0 -1
  86. package/dist/domains/arrange/application/requests/analyze-directory.request.mjs +0 -1
  87. package/dist/domains/arrange/application/requests/arrange-sync.request.mjs +0 -1
  88. package/dist/domains/arrange/application/requests/suggest-groups.request.mjs +0 -1
  89. package/dist/domains/arrange/application/use-cases/analyze-directory.use-case.mjs +0 -255
  90. package/dist/domains/arrange/application/use-cases/prepare-arrange-workspace.use-case.mjs +0 -264
  91. package/dist/domains/arrange/application/use-cases/run-arrange-sync.use-case.mjs +0 -274
  92. package/dist/domains/arrange/application/use-cases/suggest-cn-groups.use-case.mjs +0 -237
  93. package/dist/domains/arrange/arrange.module.mjs +0 -38
  94. package/dist/domains/arrange/composition/tokens.mjs +0 -17
  95. package/dist/domains/arrange/contracts/models.mjs +0 -1
  96. package/dist/domains/arrange/domain/tailwind-grouping.domain-service.mjs +0 -231
  97. package/dist/domains/arrange/domain/types.domain.mjs +0 -1
  98. package/dist/domains/arrange/infrastructure/adapters/arrange-file-processor.adapter.mjs +0 -267
  99. package/dist/domains/arrange/infrastructure/adapters/arrange-target-path-resolver.adapter.mjs +0 -247
  100. package/dist/domains/arrange/infrastructure/adapters/arrange-target-scanner.adapter.mjs +0 -243
  101. package/dist/domains/arrange/infrastructure/adapters/domain-source-parser.adapter.mjs +0 -241
  102. package/dist/domains/arrange/infrastructure/adapters/file-walker.adapter.mjs +0 -240
  103. package/dist/domains/arrange/infrastructure/typescript-ast-translator.mjs +0 -580
  104. package/dist/domains/arrange/presentation/cli/arrange.command.mjs +0 -465
  105. package/dist/domains/arrange/presentation/presenters/arrange-analyze.presenter.mjs +0 -252
  106. package/dist/domains/arrange/presentation/presenters/arrange-sync.presenter.mjs +0 -236
  107. package/dist/domains/arrange/presentation/presenters/group-file-preview.presenter.mjs +0 -271
  108. package/dist/domains/config/application/ports/outbound/codefast-config-schema.port.mjs +0 -1
  109. package/dist/domains/config/application/ports/outbound/config-loader.port.mjs +0 -1
  110. package/dist/domains/config/application/ports/outbound/config-warning-reporter.port.mjs +0 -1
  111. package/dist/domains/config/composition/tokens.mjs +0 -7
  112. package/dist/domains/config/domain/schema.domain.mjs +0 -1
  113. package/dist/domains/config/infrastructure/adapters/config-loader.adapter.mjs +0 -305
  114. package/dist/domains/config/infrastructure/adapters/config-warning-reporter.adapter.mjs +0 -234
  115. package/dist/domains/config/infrastructure/adapters/zod-codefast-config-schema.adapter.mjs +0 -236
  116. package/dist/domains/mirror/application/ports/inbound/prepare-mirror-sync.port.mjs +0 -1
  117. package/dist/domains/mirror/application/ports/inbound/run-mirror-sync.port.mjs +0 -1
  118. package/dist/domains/mirror/application/ports/outbound/file-system-service.port.mjs +0 -1
  119. package/dist/domains/mirror/application/ports/outbound/mirror-package-path.port.mjs +0 -1
  120. package/dist/domains/mirror/application/ports/outbound/mirror-sync-reporter.port.mjs +0 -1
  121. package/dist/domains/mirror/application/ports/outbound/package-repository.port.mjs +0 -1
  122. package/dist/domains/mirror/application/ports/outbound/sync-workspace-package.port.mjs +0 -1
  123. package/dist/domains/mirror/application/ports/presenting/present-mirror-sync-progress.presenter.mjs +0 -1
  124. package/dist/domains/mirror/application/requests/mirror-sync-execution-input.mjs +0 -1
  125. package/dist/domains/mirror/application/requests/mirror-sync.request.mjs +0 -1
  126. package/dist/domains/mirror/application/use-cases/prepare-mirror-sync.use-case.mjs +0 -263
  127. package/dist/domains/mirror/application/use-cases/run-mirror-sync.use-case.mjs +0 -317
  128. package/dist/domains/mirror/composition/tokens.mjs +0 -12
  129. package/dist/domains/mirror/contracts/models.mjs +0 -1
  130. package/dist/domains/mirror/domain/types.domain.mjs +0 -1
  131. package/dist/domains/mirror/infrastructure/adapters/file-system-service.adapter.mjs +0 -261
  132. package/dist/domains/mirror/infrastructure/adapters/mirror-package-path-resolver.adapter.mjs +0 -252
  133. package/dist/domains/mirror/infrastructure/adapters/mirror-sync-reporter.adapter.mjs +0 -322
  134. package/dist/domains/mirror/infrastructure/adapters/package-repository.adapter.mjs +0 -241
  135. package/dist/domains/mirror/infrastructure/adapters/sync-workspace-package.adapter.mjs +0 -328
  136. package/dist/domains/mirror/mirror.module.mjs +0 -26
  137. package/dist/domains/mirror/presentation/cli/mirror.command.mjs +0 -328
  138. package/dist/domains/mirror/presentation/presenters/present-mirror-sync-progress.presenter.mjs +0 -265
  139. package/dist/domains/tag/application/ports/inbound/prepare-tag-sync.port.mjs +0 -1
  140. package/dist/domains/tag/application/ports/inbound/run-tag-sync.port.mjs +0 -1
  141. package/dist/domains/tag/application/ports/outbound/tag-eligible-workspace-paths.port.mjs +0 -1
  142. package/dist/domains/tag/application/ports/outbound/tag-since-writer.port.mjs +0 -1
  143. package/dist/domains/tag/application/ports/outbound/tag-target-path-resolver.port.mjs +0 -1
  144. package/dist/domains/tag/application/ports/outbound/tag-target-runner.port.mjs +0 -1
  145. package/dist/domains/tag/application/ports/outbound/tag-version-resolver.port.mjs +0 -1
  146. package/dist/domains/tag/application/ports/presenting/present-tag-sync-progress.presenter.mjs +0 -1
  147. package/dist/domains/tag/application/ports/presenting/present-tag-sync-result.presenter.mjs +0 -1
  148. package/dist/domains/tag/application/requests/tag-sync-execution-input.mjs +0 -1
  149. package/dist/domains/tag/application/requests/tag-sync.request.mjs +0 -1
  150. package/dist/domains/tag/application/tag-sync-cli-result.mjs +0 -11
  151. package/dist/domains/tag/application/use-cases/prepare-tag-sync.use-case.mjs +0 -260
  152. package/dist/domains/tag/application/use-cases/run-tag-sync.use-case.mjs +0 -375
  153. package/dist/domains/tag/composition/tokens.mjs +0 -13
  154. package/dist/domains/tag/contracts/models.mjs +0 -1
  155. package/dist/domains/tag/domain/types.domain.mjs +0 -1
  156. package/dist/domains/tag/infrastructure/adapters/tag-since-writer.adapter.mjs +0 -348
  157. package/dist/domains/tag/infrastructure/adapters/tag-target-path-resolver.adapter.mjs +0 -235
  158. package/dist/domains/tag/infrastructure/adapters/tag-target-resolver.adapter.mjs +0 -302
  159. package/dist/domains/tag/infrastructure/adapters/tag-target-runner.adapter.mjs +0 -259
  160. package/dist/domains/tag/infrastructure/adapters/tag-version-resolver.adapter.mjs +0 -249
  161. package/dist/domains/tag/presentation/cli/tag.command.mjs +0 -325
  162. package/dist/domains/tag/presentation/presenters/present-tag-sync-progress.presenter.mjs +0 -248
  163. package/dist/domains/tag/presentation/presenters/present-tag-sync-result.presenter.mjs +0 -290
  164. package/dist/domains/tag/tag.module.mjs +0 -28
  165. package/dist/shell/application/cli-runtime.tokens.mjs +0 -18
  166. package/dist/shell/application/coordination/cli-executor.coordination.mjs +0 -1
  167. package/dist/shell/application/coordination/cli-schema-parsing.coordination.mjs +0 -1
  168. package/dist/shell/application/global-cli-options.model.mjs +0 -5
  169. package/dist/shell/application/ports/inbound/load-codefast-config.port.mjs +0 -1
  170. package/dist/shell/application/ports/outbound/cli-fs.port.mjs +0 -1
  171. package/dist/shell/application/ports/outbound/cli-logger.port.mjs +0 -1
  172. package/dist/shell/application/ports/outbound/cli-path.port.mjs +0 -1
  173. package/dist/shell/application/ports/outbound/cli-runtime.port.mjs +0 -1
  174. package/dist/shell/application/ports/outbound/cli-telemetry.port.mjs +0 -1
  175. package/dist/shell/application/ports/outbound/cli-verbose-diagnostics.port.mjs +0 -1
  176. package/dist/shell/application/ports/outbound/format-app-error.port.mjs +0 -1
  177. package/dist/shell/application/ports/outbound/global-cli-options-parse.port.mjs +0 -1
  178. package/dist/shell/application/ports/outbound/repo-root-resolver.port.mjs +0 -1
  179. package/dist/shell/application/ports/outbound/typescript-source-file-walker.port.mjs +0 -1
  180. package/dist/shell/application/ports/outbound/workspace-package-layout.port.mjs +0 -1
  181. package/dist/shell/application/ports/primary/command.port.mjs +0 -1
  182. package/dist/shell/application/services/cli-executor.service.mjs +0 -267
  183. package/dist/shell/application/services/schema-validator.service.mjs +0 -236
  184. package/dist/shell/application/use-cases/load-codefast-config.use-case.mjs +0 -243
  185. package/dist/shell/composition/tokens.mjs +0 -5
  186. package/dist/shell/contracts/cli-command-slots.mjs +0 -11
  187. package/dist/shell/domain/cli-exit-codes.domain.mjs +0 -11
  188. package/dist/shell/domain/cli-positional-arg.value-object.mjs +0 -6
  189. package/dist/shell/domain/errors.domain.mjs +0 -17
  190. package/dist/shell/infrastructure/adapters/cli-verbose-diagnostics.adapter.mjs +0 -228
  191. package/dist/shell/infrastructure/adapters/format-app-error.adapter.mjs +0 -236
  192. package/dist/shell/infrastructure/adapters/global-cli-options-parser.adapter.mjs +0 -233
  193. package/dist/shell/infrastructure/adapters/repo-root-resolver.adapter.mjs +0 -244
  194. package/dist/shell/infrastructure/adapters/typescript-source-file-walker.adapter.mjs +0 -259
  195. package/dist/shell/infrastructure/commander/commander-cli-host.adapter.mjs +0 -69
  196. package/dist/shell/infrastructure/node/node-cli-fs.adapter.mjs +0 -249
  197. package/dist/shell/infrastructure/node/node-cli-logger.adapter.mjs +0 -231
  198. package/dist/shell/infrastructure/node/node-cli-path.adapter.mjs +0 -246
  199. package/dist/shell/infrastructure/node/node-cli-runtime.adapter.mjs +0 -234
  200. package/dist/shell/infrastructure/telemetry/cli-telemetry.adapter.mjs +0 -280
  201. package/dist/shell/infrastructure/workspace/node-pnpm-workspace-package-layout.adapter.mjs +0 -385
  202. package/dist/shell/shell.module.mjs +0 -43
  203. package/dist/shell/wiring/optional-cli-port-telemetry-activation.mjs +0 -13
  204. /package/dist/{domains/arrange/application/ports/inbound/analyze-directory.port.mjs → arrange/domain/types.mjs} +0 -0
  205. /package/dist/{domains/arrange/application/ports/inbound/prepare-arrange-workspace.port.mjs → core/filesystem/port.mjs} +0 -0
  206. /package/dist/{domains/arrange/application/ports/inbound/run-arrange-sync.port.mjs → mirror/domain/dist-filesystem.mjs} +0 -0
  207. /package/dist/{domains/arrange/application/ports/inbound/suggest-cn-groups.port.mjs → mirror/domain/types.mjs} +0 -0
  208. /package/dist/{domains/arrange/application/ports/outbound/arrange-file-processor.port.mjs → mirror/sync-types.mjs} +0 -0
  209. /package/dist/{domains/arrange/application/ports/outbound/arrange-target-path-resolver.port.mjs → tag/domain/types.mjs} +0 -0
@@ -1,11 +1,12 @@
1
- import { registerCliCommandTreesOnProgram } from "./bootstrap/register-cli-command-trees.mjs";
2
- import { createCliRuntimeContainer, resolveCliCommands } from "./bootstrap/composition-root.mjs";
1
+ import { createArrangeCommand } from "./arrange/command.mjs";
2
+ import { createMirrorCommand } from "./mirror/command.mjs";
3
+ import { createTagCommand } from "./tag/command.mjs";
3
4
  import process from "node:process";
4
5
  import { readFileSync } from "node:fs";
5
6
  import path from "node:path";
6
7
  import { fileURLToPath } from "node:url";
7
8
  import { Command } from "commander";
8
- //#region src/program.ts
9
+ //#region src/cli.ts
9
10
  function readVersion() {
10
11
  try {
11
12
  const dir = path.dirname(fileURLToPath(import.meta.url));
@@ -16,25 +17,18 @@ function readVersion() {
16
17
  return "unknown";
17
18
  }
18
19
  }
19
- function createProgram(commands) {
20
+ /**
21
+ * @since 0.3.16-canary.0
22
+ */
23
+ async function runCli(argv) {
20
24
  const program = new Command();
21
25
  program.name("codefast").description("Codefast monorepo developer CLI").version(readVersion()).option("--no-color", "Disable ANSI color output").configureHelp({ sortSubcommands: true }).showHelpAfterError("(use --help for usage)");
22
- registerCliCommandTreesOnProgram(program, commands);
23
- return program;
24
- }
25
- async function runCli(argv) {
26
- const runtimeContainer = createCliRuntimeContainer();
27
- try {
28
- if (process.env.NODE_ENV !== "production") {
29
- runtimeContainer.validate();
30
- await runtimeContainer.initializeAsync();
31
- }
32
- await createProgram(resolveCliCommands(runtimeContainer)).parseAsync(argv, { from: "node" });
33
- const code = process.exitCode ?? 0;
34
- return typeof code === "number" ? code : Number(code) || 0;
35
- } finally {
36
- await runtimeContainer.dispose();
37
- }
26
+ program.addCommand(createArrangeCommand());
27
+ program.addCommand(createMirrorCommand());
28
+ program.addCommand(createTagCommand());
29
+ await program.parseAsync(argv, { from: "node" });
30
+ const code = process.exitCode ?? 0;
31
+ return typeof code === "number" ? code : Number(code) || 0;
38
32
  }
39
33
  //#endregion
40
34
  export { runCli };
@@ -0,0 +1,15 @@
1
+ //#region src/core/cli/format-error.ts
2
+ /**
3
+ * @since 0.3.16-canary.0
4
+ */
5
+ function formatAppError(error) {
6
+ const { code, message } = error;
7
+ switch (code) {
8
+ case "NOT_FOUND": return `[NOT_FOUND] ${message}`;
9
+ case "VALIDATION_ERROR": return `[VALIDATION_ERROR] ${message}`;
10
+ case "INFRA_FAILURE": return `[INFRA_FAILURE] ${message}`;
11
+ default: return `Unhandled error code: ${String(code)}`;
12
+ }
13
+ }
14
+ //#endregion
15
+ export { formatAppError };
@@ -0,0 +1,10 @@
1
+ import { z } from "zod";
2
+ //#region src/core/cli/global-options.ts
3
+ /**
4
+ * Commander global opts shape validated before mirror prelude (`color` from `--no-color`).
5
+ *
6
+ * @since 0.3.16-canary.0
7
+ */
8
+ const globalCliCommanderOptionsSchema = z.object({ color: z.boolean().optional() });
9
+ //#endregion
10
+ export { globalCliCommanderOptionsSchema };
@@ -0,0 +1,11 @@
1
+ //#region src/core/cli/positional.ts
2
+ /**
3
+ * Coerce a raw Commander positional argument to a string, or undefined when absent.
4
+ *
5
+ * @since 0.3.16-canary.0
6
+ */
7
+ function readOptionalPositionalArg(candidate) {
8
+ return typeof candidate === "string" ? candidate : void 0;
9
+ }
10
+ //#endregion
11
+ export { readOptionalPositionalArg };
@@ -0,0 +1,51 @@
1
+ import { formatAppError } from "./format-error.mjs";
2
+ import "../exit-codes.mjs";
3
+ import { logger } from "../logger.mjs";
4
+ import { isVerboseCliDiagnostics } from "../verbose-diagnostics.mjs";
5
+ import process from "node:process";
6
+ //#region src/core/cli/result-handle.ts
7
+ function exitCodeForAppError(error) {
8
+ switch (error.code) {
9
+ case "NOT_FOUND": return 1;
10
+ case "VALIDATION_ERROR": return 2;
11
+ case "INFRA_FAILURE": return 1;
12
+ default: return error.code;
13
+ }
14
+ }
15
+ /**
16
+ * @since 0.3.16-canary.0
17
+ */
18
+ function handleResult(outcome, onSuccess) {
19
+ if (!outcome.ok) {
20
+ logger.err(formatAppError(outcome.error));
21
+ if (isVerboseCliDiagnostics() && outcome.error.code === "INFRA_FAILURE" && outcome.error.cause instanceof Error && outcome.error.cause.stack !== void 0) logger.err(outcome.error.cause.stack);
22
+ process.exitCode = exitCodeForAppError(outcome.error);
23
+ return false;
24
+ }
25
+ onSuccess(outcome.value);
26
+ return true;
27
+ }
28
+ /**
29
+ * @since 0.3.16-canary.0
30
+ */
31
+ function consumeCliAppError(outcome, options) {
32
+ if (!outcome.ok) {
33
+ logger.err(formatAppError(outcome.error));
34
+ if (isVerboseCliDiagnostics() && outcome.error.code === "INFRA_FAILURE" && outcome.error.cause instanceof Error && outcome.error.cause.stack !== void 0) logger.err(outcome.error.cause.stack);
35
+ process.exitCode = exitCodeForAppError(outcome.error);
36
+ return false;
37
+ }
38
+ if (options?.successMessage !== void 0) logger.out(options.successMessage);
39
+ return true;
40
+ }
41
+ /**
42
+ * @since 0.3.16-canary.0
43
+ */
44
+ async function runCliResultAsync(outcomePromise, onSuccess) {
45
+ const outcome = await outcomePromise;
46
+ if (!consumeCliAppError(outcome)) return;
47
+ const exit = await onSuccess(outcome.value);
48
+ process.exitCode = exit === void 0 ? 0 : exit;
49
+ }
50
+ //#endregion
51
+ export { consumeCliAppError, handleResult, runCliResultAsync };
@@ -0,0 +1,79 @@
1
+ import { codefastConfigRootSchema } from "./schema.mjs";
2
+ import path from "node:path";
3
+ import jiti from "jiti";
4
+ //#region src/core/config/loader.ts
5
+ function formatZodError(error, filePath) {
6
+ const formatted = error.issues.map((issue) => {
7
+ return ` - ${issue.path.length > 0 ? issue.path.join(".") : "<root>"}: ${issue.message}`;
8
+ }).join("\n");
9
+ return `Invalid config schema in ${path.basename(filePath)}:\n${formatted}`;
10
+ }
11
+ function parseLoadedConfig(raw, filePath) {
12
+ const parsed = codefastConfigRootSchema.safeParse(raw);
13
+ if (!parsed.success) throw new Error(formatZodError(parsed.error, filePath));
14
+ return parsed.data;
15
+ }
16
+ const configJsPriority = [
17
+ "codefast.config.mjs",
18
+ "codefast.config.js",
19
+ "codefast.config.cjs"
20
+ ];
21
+ const configJson = "codefast.config.json";
22
+ const cachedLoads = /* @__PURE__ */ new Map();
23
+ function listConfigCandidates(startDir, fs) {
24
+ const candidates = [];
25
+ let current = path.resolve(startDir);
26
+ while (true) {
27
+ for (const name of configJsPriority) {
28
+ const candidate = path.join(current, name);
29
+ if (fs.existsSync(candidate)) candidates.push(candidate);
30
+ }
31
+ const jsonCandidate = path.join(current, configJson);
32
+ if (fs.existsSync(jsonCandidate)) candidates.push(jsonCandidate);
33
+ const parent = path.dirname(current);
34
+ if (parent === current) break;
35
+ current = parent;
36
+ }
37
+ return candidates;
38
+ }
39
+ async function readConfigFromPath(filePath, jitiBaseDir, fs) {
40
+ if (path.extname(filePath) === ".json") {
41
+ const content = await fs.readFile(filePath, "utf8");
42
+ return parseLoadedConfig(JSON.parse(content), filePath);
43
+ }
44
+ const moduleConfig = jiti(jitiBaseDir, {
45
+ interopDefault: true,
46
+ moduleCache: false
47
+ })(filePath);
48
+ return parseLoadedConfig(typeof moduleConfig === "object" && moduleConfig !== null && "default" in moduleConfig ? moduleConfig.default : moduleConfig, filePath);
49
+ }
50
+ async function loadOnce(startDir, fs) {
51
+ const warnings = [];
52
+ const configPaths = listConfigCandidates(startDir, fs);
53
+ if (configPaths.length === 0) return {
54
+ config: {},
55
+ warnings
56
+ };
57
+ const configPath = configPaths[0];
58
+ if (configPath === void 0) return {
59
+ config: {},
60
+ warnings
61
+ };
62
+ return {
63
+ config: await readConfigFromPath(configPath, startDir, fs),
64
+ warnings,
65
+ configPath
66
+ };
67
+ }
68
+ /**
69
+ * @since 0.3.16-canary.0
70
+ */
71
+ function loadConfigPayload(startDir, fs) {
72
+ const cacheKey = path.resolve(startDir);
73
+ if (!cachedLoads.has(cacheKey)) cachedLoads.set(cacheKey, loadOnce(cacheKey, fs));
74
+ const cached = cachedLoads.get(cacheKey);
75
+ if (cached === void 0) throw new Error("config loader cache invariant violated");
76
+ return cached;
77
+ }
78
+ //#endregion
79
+ export { loadConfigPayload };
@@ -1,6 +1,9 @@
1
1
  import { z } from "zod";
2
- //#region src/domains/config/domain/codefast-config.schema.ts
2
+ //#region src/core/config/schema.ts
3
3
  const afterWriteHookSchema = z.custom((value) => typeof value === "function", { message: "Expected a function" });
4
+ /**
5
+ * @since 0.3.16-canary.0
6
+ */
4
7
  const mirrorConfigSchema = z.object({
5
8
  skipPackages: z.array(z.string()).optional(),
6
9
  pathTransformations: z.record(z.string(), z.object({ removePrefix: z.string().optional() }).strict()).optional(),
@@ -11,12 +14,23 @@ const mirrorConfigSchema = z.object({
11
14
  forceExportFiles: z.boolean().optional()
12
15
  }).strict()])).optional()
13
16
  }).strict();
17
+ /**
18
+ * @since 0.3.16-canary.0
19
+ */
14
20
  const codefastTagConfigSchema = z.object({
15
21
  skipPackages: z.array(z.string()).optional(),
16
22
  onAfterWrite: afterWriteHookSchema.optional()
17
23
  }).strict();
24
+ /**
25
+ * @since 0.3.16-canary.0
26
+ */
18
27
  const codefastArrangeConfigSchema = z.object({ onAfterWrite: afterWriteHookSchema.optional() }).strict();
19
- /** Root `codefast.config` Zod schema — single source of truth for both validation and TS types. */ const codefastConfigRootSchema = z.object({
28
+ /**
29
+ * Root `codefast.config` Zod schema — single source of truth for both validation and TS types.
30
+ *
31
+ * @since 0.3.16-canary.0
32
+ */
33
+ const codefastConfigRootSchema = z.object({
20
34
  mirror: mirrorConfigSchema.optional(),
21
35
  tag: codefastTagConfigSchema.optional(),
22
36
  arrange: codefastArrangeConfigSchema.optional()
@@ -0,0 +1,12 @@
1
+ import { logger } from "../logger.mjs";
2
+ //#region src/core/config/warnings.ts
3
+ const yellowAnsi = "\x1B[33m";
4
+ const resetAnsi = "\x1B[0m";
5
+ /**
6
+ * @since 0.3.16-canary.0
7
+ */
8
+ function reportSchemaWarnings(warnings) {
9
+ for (const warningMessage of warnings) logger.out(`${yellowAnsi}⚠ ${warningMessage}${resetAnsi}`);
10
+ }
11
+ //#endregion
12
+ export { reportSchemaWarnings };
@@ -0,0 +1,19 @@
1
+ import { AppError, messageFrom } from "./errors.mjs";
2
+ import { err, ok } from "./result.mjs";
3
+ import { loadConfigPayload } from "./config/loader.mjs";
4
+ import { reportSchemaWarnings } from "./config/warnings.mjs";
5
+ //#region src/core/config.ts
6
+ /**
7
+ * @since 0.3.16-canary.0
8
+ */
9
+ async function loadCodefastConfig(rootDir, fs) {
10
+ try {
11
+ const { config, warnings } = await loadConfigPayload(rootDir, fs);
12
+ reportSchemaWarnings(warnings);
13
+ return ok({ config });
14
+ } catch (caughtError) {
15
+ return err(new AppError("INFRA_FAILURE", messageFrom(caughtError), caughtError));
16
+ }
17
+ }
18
+ //#endregion
19
+ export { loadCodefastConfig };
@@ -1,8 +1,24 @@
1
- //#region src/shell/domain/caught-unknown-message.value-object.ts
1
+ //#region src/core/errors.ts
2
+ /**
3
+ * @since 0.3.16-canary.0
4
+ */
5
+ var AppError = class {
6
+ name = "AppError";
7
+ code;
8
+ message;
9
+ cause;
10
+ constructor(code, message, cause) {
11
+ this.code = code;
12
+ this.message = message;
13
+ if (cause !== void 0) this.cause = cause;
14
+ }
15
+ };
2
16
  /**
3
17
  * Stable, user-facing text for values caught as `unknown`.
4
- * Avoids `String(unknown)` / `[object Object]` and satisfies strict `no-base-to-string`.
5
- */ function messageFromCaughtUnknown(value) {
18
+ *
19
+ * @since 0.3.16-canary.0
20
+ */
21
+ function messageFrom(value) {
6
22
  if (value instanceof Error) return value.message;
7
23
  if (typeof value === "string") return value;
8
24
  if (typeof value === "number" || typeof value === "bigint" || typeof value === "boolean") return String(value);
@@ -16,4 +32,4 @@
16
32
  return "[unserializable non-Error value]";
17
33
  }
18
34
  //#endregion
19
- export { messageFromCaughtUnknown };
35
+ export { AppError, messageFrom };
@@ -0,0 +1,17 @@
1
+ //#region src/core/exit-codes.ts
2
+ /**
3
+ * Process exit codes for the `codefast` CLI.
4
+ *
5
+ * @since 0.3.16-canary.0
6
+ */
7
+ const CLI_EXIT_SUCCESS = 0;
8
+ /**
9
+ * @since 0.3.16-canary.0
10
+ */
11
+ const CLI_EXIT_GENERAL_ERROR = 1;
12
+ /**
13
+ * @since 0.3.16-canary.0
14
+ */
15
+ const CLI_EXIT_USAGE = 2;
16
+ //#endregion
17
+ export { CLI_EXIT_GENERAL_ERROR, CLI_EXIT_SUCCESS, CLI_EXIT_USAGE };
@@ -0,0 +1,32 @@
1
+ import fsSync from "node:fs";
2
+ import path from "node:path";
3
+ import fsPromises from "node:fs/promises";
4
+ //#region src/core/filesystem/node.ts
5
+ /**
6
+ * @since 0.3.16-canary.0
7
+ */
8
+ const nodeFilesystem = {
9
+ existsSync: fsSync.existsSync,
10
+ statSync: fsSync.statSync,
11
+ readFileSync: fsSync.readFileSync,
12
+ writeFileSync: fsSync.writeFileSync,
13
+ readdirSync: fsSync.readdirSync,
14
+ canonicalPathSync(inputPath) {
15
+ try {
16
+ return fsSync.realpathSync.native(inputPath);
17
+ } catch {
18
+ return path.resolve(inputPath);
19
+ }
20
+ },
21
+ readFile: (filePath, enc) => fsPromises.readFile(filePath, enc),
22
+ writeFile: (filePath, data, enc) => fsPromises.writeFile(filePath, data, enc),
23
+ readdir: async (filePath, opts) => {
24
+ const raw = await fsPromises.readdir(filePath, opts);
25
+ if (!opts?.withFileTypes) return raw;
26
+ return raw;
27
+ },
28
+ rename: (oldPath, newPath) => fsPromises.rename(oldPath, newPath),
29
+ unlink: (filePath) => fsPromises.unlink(filePath)
30
+ };
31
+ //#endregion
32
+ export { nodeFilesystem };
@@ -0,0 +1,15 @@
1
+ import process from "node:process";
2
+ //#region src/core/logger.ts
3
+ /**
4
+ * @since 0.3.16-canary.0
5
+ */
6
+ const logger = {
7
+ out(line) {
8
+ process.stdout.write(`${line}\n`);
9
+ },
10
+ err(line) {
11
+ process.stderr.write(`${line}\n`);
12
+ }
13
+ };
14
+ //#endregion
15
+ export { logger };
@@ -1,12 +1,16 @@
1
- //#region src/shell/domain/result.model.ts
1
+ //#region src/core/result.ts
2
2
  /**
3
- * Lightweight functional Result type for use-case boundaries.
4
- */ function ok(value) {
3
+ * @since 0.3.16-canary.0
4
+ */
5
+ function ok(value) {
5
6
  return {
6
7
  ok: true,
7
8
  value
8
9
  };
9
10
  }
11
+ /**
12
+ * @since 0.3.16-canary.0
13
+ */
10
14
  function err(error) {
11
15
  return {
12
16
  ok: false,
@@ -0,0 +1,18 @@
1
+ import { AppError } from "./errors.mjs";
2
+ import { err, ok } from "./result.mjs";
3
+ //#region src/core/schema-parse.ts
4
+ function formatSchemaIssues(issues) {
5
+ return issues.map((issue) => {
6
+ return `${issue.path.length > 0 ? `${issue.path.join(".")}: ` : ""}${issue.message}`;
7
+ }).join("; ");
8
+ }
9
+ /**
10
+ * @since 0.3.16-canary.0
11
+ */
12
+ function parseWithSchema(schema, input) {
13
+ const parsed = schema.safeParse(input);
14
+ if (!parsed.success) return err(new AppError("VALIDATION_ERROR", formatSchemaIssues(parsed.error.issues)));
15
+ return ok(parsed.data);
16
+ }
17
+ //#endregion
18
+ export { parseWithSchema };
@@ -1,14 +1,13 @@
1
- //#region src/shell/domain/source-text-edit.support.ts
2
- /**
3
- * Pure string utilities for applying non-overlapping text edits and reading line indentation.
4
- */ function lineStartIndexContaining(source, pos) {
1
+ //#region src/core/source-text-edit.ts
2
+ function lineStartIndexContaining(source, pos) {
5
3
  const searchPos = Math.max(0, Math.min(pos, source.length));
6
4
  const prevLineBreak = Math.max(source.lastIndexOf("\n", searchPos - 1), source.lastIndexOf("\r", searchPos - 1));
7
5
  return prevLineBreak === -1 ? 0 : prevLineBreak + 1;
8
6
  }
9
7
  /**
10
- * Returns only the leading whitespace (tabs / spaces) of the line containing `pos`.
11
- */ function indentOfLineContaining(source, pos) {
8
+ * @since 0.3.16-canary.0
9
+ */
10
+ function indentOfLineContaining(source, pos) {
12
11
  const lineStart = lineStartIndexContaining(source, pos);
13
12
  let lineEnd = source.length;
14
13
  for (let i = lineStart; i < source.length; i++) {
@@ -22,17 +21,16 @@
22
21
  return /^[\t ]*/.exec(line)?.[0] ?? "";
23
22
  }
24
23
  /**
25
- * Source slice `[lineStart, pos)` for the line containing `pos`. Aligns continuation lines with
26
- * a token not at column 0 (e.g. `base: ["foo"` → prefix before the opening `"` of `"foo"`).
27
- */ function textPrefixFromLineStartToPosition(source, pos) {
24
+ * @since 0.3.16-canary.0
25
+ */
26
+ function textPrefixFromLineStartToPosition(source, pos) {
28
27
  const searchPos = Math.max(0, Math.min(pos, source.length));
29
28
  return source.slice(lineStartIndexContaining(source, searchPos), searchPos);
30
29
  }
31
30
  /**
32
- * If `tokenEnd` is followed by optional ASCII whitespace then `,`, returns the index after that
33
- * comma. Otherwise returns `tokenEnd`. Useful when a replacement already ends with `,` and the
34
- * following source comma must be absorbed.
35
- */ function endAfterOptionalCommaFollowingInSource(source, tokenEnd) {
31
+ * @since 0.3.16-canary.0
32
+ */
33
+ function endAfterOptionalCommaFollowingInSource(source, tokenEnd) {
36
34
  let index = tokenEnd;
37
35
  while (index < source.length) {
38
36
  const ch = source[index];
@@ -45,6 +43,9 @@
45
43
  }
46
44
  return tokenEnd;
47
45
  }
46
+ /**
47
+ * @since 0.3.16-canary.0
48
+ */
48
49
  function applyEditsDescending(sourceText, edits) {
49
50
  const sorted = [...edits].sort((editA, editB) => editB.start - editA.start);
50
51
  let out = sourceText;
@@ -0,0 +1,11 @@
1
+ import process from "node:process";
2
+ //#region src/core/verbose-diagnostics.ts
3
+ /**
4
+ * @since 0.3.16-canary.0
5
+ */
6
+ function isVerboseCliDiagnostics() {
7
+ const raw = process.env.CODEFAST_VERBOSE;
8
+ return raw === "1" || raw === "true";
9
+ }
10
+ //#endregion
11
+ export { isVerboseCliDiagnostics };
@@ -0,0 +1,177 @@
1
+ import { messageFrom } from "../errors.mjs";
2
+ import { logger } from "../logger.mjs";
3
+ import { globSync } from "node:fs";
4
+ import path from "node:path";
5
+ import { fileURLToPath } from "node:url";
6
+ import picomatch from "picomatch";
7
+ import { parse } from "yaml";
8
+ //#region src/core/workspace/resolver.ts
9
+ /**
10
+ * Resolve the monorepo root (directory containing `pnpm-workspace.yaml`).
11
+ *
12
+ * @since 0.3.16-canary.0
13
+ */
14
+ function findRepoRoot(fromDirectory, fs) {
15
+ const candidates = [path.dirname(fileURLToPath(import.meta.url)), fromDirectory];
16
+ for (const start of candidates) {
17
+ let dir = path.resolve(start);
18
+ for (;;) {
19
+ if (fs.existsSync(path.join(dir, "pnpm-workspace.yaml"))) return dir;
20
+ const parent = path.dirname(dir);
21
+ if (parent === dir) break;
22
+ dir = parent;
23
+ }
24
+ }
25
+ throw new Error(`Could not locate monorepo root (missing pnpm-workspace.yaml). Searched from: ${candidates.join(", ")}`);
26
+ }
27
+ const workspaceYamlFileName = "pnpm-workspace.yaml";
28
+ const defaultIncludePatterns = ["packages/*"];
29
+ const packageJsonFileName = "package.json";
30
+ function toPosix(filePath) {
31
+ return filePath.split(path.sep).join("/");
32
+ }
33
+ function isGlobPermissionError(caughtError) {
34
+ if (typeof caughtError !== "object" || caughtError === null || !("code" in caughtError)) return false;
35
+ const code = caughtError.code;
36
+ return code === "EACCES" || code === "EPERM";
37
+ }
38
+ function workspacePatternToPackageJsonGlob(pattern) {
39
+ const normalizedPattern = toPosix(pattern.trim()).replace(/\/+$/, "");
40
+ if (!normalizedPattern) return `**/${packageJsonFileName}`;
41
+ return `${normalizedPattern}/${packageJsonFileName}`;
42
+ }
43
+ function splitPnpmWorkspacePackagesArray(raw) {
44
+ const include = [];
45
+ const exclude = [];
46
+ if (!Array.isArray(raw)) return {
47
+ include,
48
+ exclude
49
+ };
50
+ for (const entry of raw) {
51
+ if (typeof entry !== "string") continue;
52
+ const trimmed = entry.trim();
53
+ if (!trimmed) continue;
54
+ if (trimmed.startsWith("!")) exclude.push(trimmed.slice(1).trim());
55
+ else include.push(trimmed);
56
+ }
57
+ return {
58
+ include,
59
+ exclude
60
+ };
61
+ }
62
+ function parsePnpmWorkspaceDocument(doc) {
63
+ const wf = workspaceYamlFileName;
64
+ if (doc === null || doc === void 0) throw new Error(`${wf} root document must be an object (got empty or null)`);
65
+ if (typeof doc !== "object" || Array.isArray(doc)) throw new Error(`${wf} root must be a mapping, not an array or scalar`);
66
+ const parsedDoc = doc;
67
+ if (!Object.prototype.hasOwnProperty.call(parsedDoc, "packages")) return {
68
+ include: [],
69
+ exclude: [],
70
+ hasPackagesKey: false,
71
+ isEmptyPackagesArray: false
72
+ };
73
+ const pkgs = parsedDoc.packages;
74
+ if (!Array.isArray(pkgs)) throw new Error(`${wf} field "packages" must be an array`);
75
+ if (pkgs.length === 0) return {
76
+ include: [],
77
+ exclude: [],
78
+ hasPackagesKey: true,
79
+ isEmptyPackagesArray: true
80
+ };
81
+ return {
82
+ ...splitPnpmWorkspacePackagesArray(pkgs),
83
+ hasPackagesKey: true,
84
+ isEmptyPackagesArray: false
85
+ };
86
+ }
87
+ async function readWorkspaceYaml(rootDir, fs) {
88
+ const wf = workspaceYamlFileName;
89
+ const workspaceYamlPath = path.join(rootDir, wf);
90
+ if (!fs.existsSync(workspaceYamlPath)) return { exists: false };
91
+ let raw;
92
+ try {
93
+ raw = await fs.readFile(workspaceYamlPath, "utf8");
94
+ } catch (caughtReadError) {
95
+ throw new Error(`Failed to read ${wf}: ${messageFrom(caughtReadError)}`);
96
+ }
97
+ let doc;
98
+ try {
99
+ doc = parse(raw);
100
+ } catch (caughtYamlParseError) {
101
+ throw new Error(`Failed to parse ${wf}: ${messageFrom(caughtYamlParseError)}`);
102
+ }
103
+ if (doc === null || doc === void 0) throw new Error(`${wf} must define a mapping at the document root`);
104
+ return {
105
+ exists: true,
106
+ doc
107
+ };
108
+ }
109
+ /**
110
+ * @since 0.3.16-canary.0
111
+ */
112
+ async function listWorkspacePackageDirectories(rootDirectoryPathAbsolute, fs, suppressGlobPermissionDiagnostics) {
113
+ const workspaceYaml = await readWorkspaceYaml(rootDirectoryPathAbsolute, fs);
114
+ const defInc = defaultIncludePatterns;
115
+ let include;
116
+ let exclude;
117
+ let layoutSource;
118
+ const hasPnpmWorkspaceYamlFile = workspaceYaml.exists;
119
+ if (!workspaceYaml.exists) {
120
+ include = [...defInc];
121
+ exclude = [];
122
+ layoutSource = "default-patterns";
123
+ } else {
124
+ const parsed = parsePnpmWorkspaceDocument(workspaceYaml.doc);
125
+ if (!parsed.hasPackagesKey) {
126
+ include = [...defInc];
127
+ exclude = [];
128
+ layoutSource = "default-patterns";
129
+ } else if (parsed.isEmptyPackagesArray) return {
130
+ packageDirectoryPathsAbsolute: [],
131
+ layoutSource: "declared-empty",
132
+ hasPnpmWorkspaceYamlFile: true
133
+ };
134
+ else {
135
+ include = parsed.include;
136
+ exclude = parsed.exclude;
137
+ layoutSource = "pnpm-workspace-yaml";
138
+ }
139
+ }
140
+ const foundRelativePosixPackageRoots = /* @__PURE__ */ new Set();
141
+ const globOpts = {
142
+ cwd: rootDirectoryPathAbsolute,
143
+ posix: true,
144
+ ...path.sep === "\\" ? { windowsPathsNoEscape: true } : {}
145
+ };
146
+ for (const pattern of include) {
147
+ const globPat = workspacePatternToPackageJsonGlob(pattern);
148
+ let matches;
149
+ try {
150
+ matches = globSync(globPat, globOpts);
151
+ } catch (caughtGlobError) {
152
+ if (isGlobPermissionError(caughtGlobError)) {
153
+ if (!suppressGlobPermissionDiagnostics) logger.out(`⚠ Skipping workspace glob "${pattern}" (${messageFrom(caughtGlobError)})`);
154
+ continue;
155
+ }
156
+ throw new Error(`Invalid workspace glob "${pattern}": ${messageFrom(caughtGlobError)}`);
157
+ }
158
+ for (const matchedPath of matches) {
159
+ const posix = toPosix(matchedPath);
160
+ const suffix = `/${packageJsonFileName}`;
161
+ if (!posix.endsWith(suffix)) continue;
162
+ const rel = posix.slice(0, -suffix.length);
163
+ if (!rel) continue;
164
+ foundRelativePosixPackageRoots.add(rel);
165
+ }
166
+ }
167
+ const excludeMatchers = exclude.map((pat) => picomatch(pat, { dot: true }));
168
+ const filteredRelative = [...foundRelativePosixPackageRoots].filter((rel) => !excludeMatchers.some((isMatch) => isMatch(rel)));
169
+ filteredRelative.sort((a, b) => a.localeCompare(b));
170
+ return {
171
+ packageDirectoryPathsAbsolute: filteredRelative.map((rel) => path.resolve(rootDirectoryPathAbsolute, rel.split("/").join(path.sep))),
172
+ layoutSource,
173
+ hasPnpmWorkspaceYamlFile
174
+ };
175
+ }
176
+ //#endregion
177
+ export { findRepoRoot, listWorkspacePackageDirectories };