@codefast/cli 0.11.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +51 -0
- package/README.md +57 -46
- package/dist/arrange/command.js +24 -25
- package/dist/arrange/domain/ast/collectors-cn.d.ts +2 -2
- package/dist/arrange/domain/ast/collectors-cn.js +2 -2
- package/dist/arrange/domain/ast/collectors-jsx.d.ts +2 -2
- package/dist/arrange/domain/ast/collectors-jsx.js +1 -1
- package/dist/arrange/domain/ast/collectors-tv.d.ts +2 -2
- package/dist/arrange/domain/ast/collectors-tv.js +5 -5
- package/dist/arrange/domain/ast/helpers.d.ts +2 -2
- package/dist/arrange/domain/ast/helpers.js +3 -4
- package/dist/arrange/domain/ast/simplify-targets.d.ts +1 -1
- package/dist/arrange/domain/ast/simplify-targets.js +5 -5
- package/dist/arrange/domain/ast/targets.d.ts +2 -2
- package/dist/arrange/domain/ast/targets.js +9 -9
- package/dist/arrange/domain/ast/translator.d.ts +1 -1
- package/dist/arrange/domain/ast/translator.js +1 -1
- package/dist/arrange/domain/constants.d.ts +1 -1
- package/dist/arrange/domain/grouping-service.d.ts +2 -2
- package/dist/arrange/domain/grouping-service.js +3 -3
- package/dist/arrange/domain/grouping.js +3 -3
- package/dist/arrange/domain/imports.d.ts +1 -1
- package/dist/arrange/domain/imports.js +2 -2
- package/dist/arrange/domain/source-text-formatters.js +1 -1
- package/dist/arrange/domain/tailwind-token.js +1 -1
- package/dist/arrange/domain/token-classifier.d.ts +1 -1
- package/dist/arrange/domain/token-classifier.js +2 -2
- package/dist/arrange/domain/types.d.ts +3 -3
- package/dist/arrange/group/cli-result.d.ts +1 -1
- package/dist/arrange/group/output.d.ts +1 -1
- package/dist/arrange/group/output.js +1 -1
- package/dist/arrange/group/suggest.d.ts +2 -2
- package/dist/arrange/group/suggest.js +2 -2
- package/dist/arrange/inspect/cli-result.d.ts +1 -1
- package/dist/arrange/inspect/domain/analyze-service.d.ts +2 -2
- package/dist/arrange/inspect/domain/analyze-service.js +7 -7
- package/dist/arrange/inspect/output.d.ts +1 -1
- package/dist/arrange/inspect/output.js +2 -2
- package/dist/arrange/inspect/run.d.ts +4 -4
- package/dist/arrange/inspect/run.js +6 -6
- package/dist/arrange/prepare.d.ts +4 -4
- package/dist/arrange/prepare.js +5 -5
- package/dist/arrange/regroup/cli-result.d.ts +1 -1
- package/dist/arrange/regroup/cli-result.js +1 -1
- package/dist/arrange/regroup/output.d.ts +2 -2
- package/dist/arrange/regroup/output.js +2 -2
- package/dist/arrange/regroup/process-file.d.ts +2 -2
- package/dist/arrange/regroup/process-file.js +3 -3
- package/dist/arrange/regroup/run.d.ts +5 -5
- package/dist/arrange/regroup/run.js +4 -4
- package/dist/arrange/resolve-target.d.ts +1 -1
- package/dist/arrange/resolve-target.js +2 -2
- package/dist/arrange/scan-target.d.ts +1 -1
- package/dist/arrange/scan-target.js +3 -3
- package/dist/arrange/simplify/cli-result.d.ts +1 -1
- package/dist/arrange/simplify/fold-targets.d.ts +3 -3
- package/dist/arrange/simplify/fold-targets.js +3 -3
- package/dist/arrange/simplify/output.d.ts +1 -1
- package/dist/arrange/simplify/output.js +1 -1
- package/dist/arrange/simplify/process-file.d.ts +3 -3
- package/dist/arrange/simplify/process-file.js +5 -5
- package/dist/arrange/simplify/run.d.ts +4 -4
- package/dist/arrange/simplify/run.js +4 -4
- package/dist/arrange/simplify/variant-classname-probe.js +1 -1
- package/dist/arrange/source-parse.d.ts +1 -1
- package/dist/arrange/source-parse.js +3 -3
- package/dist/audit/command.js +45 -28
- package/dist/audit/comments/cli-result.d.ts +1 -1
- package/dist/audit/comments/cli-result.js +1 -1
- package/dist/audit/comments/output.d.ts +1 -1
- package/dist/audit/comments/output.js +1 -1
- package/dist/audit/comments/prepare.d.ts +4 -4
- package/dist/audit/comments/prepare.js +1 -1
- package/dist/audit/comments/run.d.ts +4 -4
- package/dist/audit/comments/run.js +9 -9
- package/dist/audit/display-names/cli-result.d.ts +1 -1
- package/dist/audit/display-names/cli-result.js +1 -1
- package/dist/audit/display-names/domain/display-names.d.ts +1 -1
- package/dist/audit/display-names/output.d.ts +1 -1
- package/dist/audit/display-names/output.js +1 -1
- package/dist/audit/display-names/prepare.d.ts +4 -4
- package/dist/audit/display-names/prepare.js +1 -1
- package/dist/audit/display-names/run.d.ts +4 -4
- package/dist/audit/display-names/run.js +5 -5
- package/dist/audit/domain/types.d.ts +43 -0
- package/dist/audit/imports/cli-result.d.ts +1 -1
- package/dist/audit/imports/cli-result.js +1 -1
- package/dist/audit/imports/domain/import-policy.d.ts +1 -1
- package/dist/audit/imports/output.d.ts +1 -1
- package/dist/audit/imports/output.js +1 -1
- package/dist/audit/imports/prepare.d.ts +4 -4
- package/dist/audit/imports/prepare.js +1 -1
- package/dist/audit/imports/run.d.ts +4 -4
- package/dist/audit/imports/run.js +6 -6
- package/dist/audit/links/cli-result.d.ts +1 -1
- package/dist/audit/links/cli-result.js +1 -1
- package/dist/audit/links/domain/markdown-links.d.ts +3 -3
- package/dist/audit/links/domain/markdown-links.js +22 -8
- package/dist/audit/links/output.d.ts +1 -1
- package/dist/audit/links/output.js +1 -1
- package/dist/audit/links/prepare.d.ts +4 -4
- package/dist/audit/links/prepare.js +1 -1
- package/dist/audit/links/run.d.ts +4 -4
- package/dist/audit/links/run.js +4 -4
- package/dist/audit/prepare.d.ts +4 -4
- package/dist/audit/prepare.js +4 -4
- package/dist/audit/publish/cli-result.d.ts +13 -0
- package/dist/audit/publish/cli-result.js +22 -0
- package/dist/audit/publish/cli-schema.d.ts +18 -0
- package/dist/audit/publish/cli-schema.js +12 -0
- package/dist/audit/publish/domain/legacy-subpath.d.ts +8 -0
- package/dist/audit/publish/domain/legacy-subpath.js +22 -0
- package/dist/audit/publish/output.d.ts +7 -0
- package/dist/audit/publish/output.js +24 -0
- package/dist/audit/publish/prepare.d.ts +16 -0
- package/dist/audit/publish/prepare.js +12 -0
- package/dist/audit/publish/run.d.ts +14 -0
- package/dist/audit/publish/run.js +62 -0
- package/dist/audit/rtl/cli-result.d.ts +1 -1
- package/dist/audit/rtl/cli-result.js +1 -1
- package/dist/audit/rtl/domain/audit-file.d.ts +1 -1
- package/dist/audit/rtl/domain/audit-file.js +2 -2
- package/dist/audit/rtl/domain/tokenize.d.ts +1 -1
- package/dist/audit/rtl/output.d.ts +1 -1
- package/dist/audit/rtl/output.js +1 -1
- package/dist/audit/rtl/prepare.d.ts +4 -4
- package/dist/audit/rtl/prepare.js +5 -5
- package/dist/audit/rtl/run.d.ts +4 -4
- package/dist/audit/rtl/run.js +4 -4
- package/dist/bin.js +1 -1
- package/dist/cli.js +5 -5
- package/dist/core/cli/command-pipeline.d.ts +4 -5
- package/dist/core/cli/command-pipeline.js +7 -7
- package/dist/core/cli/format-error.d.ts +1 -1
- package/dist/core/cli/resolve-root.d.ts +3 -3
- package/dist/core/cli/resolve-root.js +3 -3
- package/dist/core/cli/result-handle.d.ts +2 -2
- package/dist/core/cli/result-handle.js +4 -4
- package/dist/core/config/define-config.d.ts +1 -1
- package/dist/core/config/loader.d.ts +2 -2
- package/dist/core/config/loader.js +2 -2
- package/dist/core/config/warnings.js +1 -1
- package/dist/core/config.d.ts +4 -4
- package/dist/core/config.js +4 -4
- package/dist/core/filesystem/node.d.ts +1 -1
- package/dist/core/schema-parse.d.ts +2 -2
- package/dist/core/schema-parse.js +2 -2
- package/dist/core/workspace/markdown-walk.d.ts +1 -1
- package/dist/core/workspace/markdown-walk.js +1 -1
- package/dist/core/workspace/package-version.d.ts +1 -1
- package/dist/core/workspace/package-version.js +2 -2
- package/dist/core/workspace/resolver.d.ts +1 -1
- package/dist/core/workspace/resolver.js +5 -5
- package/dist/core/workspace/source-walk.d.ts +1 -1
- package/dist/core/workspace/source-walk.js +1 -1
- package/dist/core/workspace/typescript-walk.d.ts +1 -1
- package/dist/core/workspace/typescript-walk.js +1 -1
- package/dist/core/workspace/walk-files.d.ts +1 -1
- package/dist/core/workspace/walk-files.js +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/dist/mirror/cli-result.d.ts +1 -1
- package/dist/mirror/cli-result.js +1 -1
- package/dist/mirror/cli-schema.d.ts +1 -1
- package/dist/mirror/command.js +7 -7
- package/dist/mirror/dist-filesystem-node.d.ts +2 -2
- package/dist/mirror/dist-filesystem-node.js +2 -2
- package/dist/mirror/domain/dirent-guard.d.ts +1 -1
- package/dist/mirror/domain/exports.d.ts +2 -2
- package/dist/mirror/domain/exports.js +1 -1
- package/dist/mirror/domain/types.d.ts +2 -2
- package/dist/mirror/output.d.ts +1 -1
- package/dist/mirror/output.js +2 -2
- package/dist/mirror/package-path.d.ts +3 -3
- package/dist/mirror/package-path.js +3 -3
- package/dist/mirror/prepare.d.ts +5 -5
- package/dist/mirror/prepare.js +4 -4
- package/dist/mirror/run.d.ts +6 -6
- package/dist/mirror/run.js +7 -7
- package/dist/mirror/supplement-exports.d.ts +1 -1
- package/dist/mirror/supplement-exports.js +2 -2
- package/dist/mirror/sync-workspace-package.d.ts +3 -3
- package/dist/mirror/sync-workspace-package.js +11 -14
- package/dist/mirror/write-exports.d.ts +2 -2
- package/dist/mirror/write-exports.js +3 -3
- package/dist/pack-slim/cli-result.d.ts +1 -1
- package/dist/pack-slim/cli-result.js +1 -1
- package/dist/pack-slim/command.js +9 -9
- package/dist/pack-slim/domain/transform.d.ts +22 -1
- package/dist/pack-slim/domain/transform.js +65 -8
- package/dist/pack-slim/output.d.ts +1 -1
- package/dist/pack-slim/output.js +1 -1
- package/dist/pack-slim/prepare.d.ts +3 -3
- package/dist/pack-slim/prepare.js +2 -2
- package/dist/pack-slim/run.d.ts +5 -5
- package/dist/pack-slim/run.js +5 -5
- package/dist/pack-slim/working-tree.d.ts +2 -2
- package/dist/pack-slim/working-tree.js +2 -2
- package/dist/tag/cli-result.d.ts +1 -1
- package/dist/tag/cli-result.js +1 -1
- package/dist/tag/cli-schema.d.ts +1 -1
- package/dist/tag/command.js +7 -7
- package/dist/tag/domain/skip-filter.d.ts +1 -1
- package/dist/tag/domain/skip-filter.js +1 -1
- package/dist/tag/domain/types.d.ts +1 -1
- package/dist/tag/domain/version-summary.d.ts +1 -1
- package/dist/tag/output.d.ts +1 -1
- package/dist/tag/output.js +1 -1
- package/dist/tag/prepare.d.ts +4 -4
- package/dist/tag/prepare.js +4 -4
- package/dist/tag/run.d.ts +4 -4
- package/dist/tag/run.js +7 -7
- package/dist/tag/target/candidates.d.ts +2 -2
- package/dist/tag/target/candidates.js +2 -2
- package/dist/tag/target/resolve-path.d.ts +1 -1
- package/dist/tag/target/runner.d.ts +2 -2
- package/dist/tag/target/runner.js +3 -3
- package/dist/tag/writer/since-writer.d.ts +2 -2
- package/dist/tag/writer/since-writer.js +1 -1
- package/dist/tag/writer/version-resolver.d.ts +1 -1
- package/dist/tag/writer/version-resolver.js +1 -1
- package/package.json +7 -7
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DIRECTION_RESOLVED_VARIANT, PHYSICAL_SIDE_VARIANT, RTL_MAPPINGS, RTL_REVERSE_MAPPINGS, RTL_SWAP_MAPPINGS, RTL_TRANSLATE_X_MAPPINGS, SLIDE_PREFIXES, } from "
|
|
2
|
-
import { collectTokens } from "
|
|
1
|
+
import { DIRECTION_RESOLVED_VARIANT, PHYSICAL_SIDE_VARIANT, RTL_MAPPINGS, RTL_REVERSE_MAPPINGS, RTL_SWAP_MAPPINGS, RTL_TRANSLATE_X_MAPPINGS, SLIDE_PREFIXES, } from "#audit/rtl/domain/mappings";
|
|
2
|
+
import { collectTokens } from "#audit/rtl/domain/tokenize";
|
|
3
3
|
/**
|
|
4
4
|
* A token satisfies an "rtl companion" requirement when the same file has a
|
|
5
5
|
* token whose variants include `rtl` and whose value matches. Variant order
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RtlClassToken } from "
|
|
1
|
+
import type { RtlClassToken } from "#audit/domain/types";
|
|
2
2
|
/**
|
|
3
3
|
* Splits a class token into [variant, value, modifier], colon/slash-aware of
|
|
4
4
|
* brackets and parens (arbitrary values like data-[side=left] or calc(...)).
|
package/dist/audit/rtl/output.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { AuditCommandPrelude } from "
|
|
2
|
-
import { AppError } from "
|
|
3
|
-
import type { Filesystem } from "
|
|
4
|
-
import type { Result } from "
|
|
1
|
+
import type { AuditCommandPrelude } from "#audit/prepare";
|
|
2
|
+
import { AppError } from "#core/errors";
|
|
3
|
+
import type { Filesystem } from "#core/filesystem/filesystem";
|
|
4
|
+
import type { Result } from "#core/result";
|
|
5
5
|
/**
|
|
6
6
|
* Loads config and resolves the scan target for `audit rtl`.
|
|
7
7
|
*
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { resolveRepoRelativePath } from "
|
|
2
|
-
import { loadCodefastConfig } from "
|
|
3
|
-
import { AppError, messageFrom } from "
|
|
4
|
-
import { err, ok } from "
|
|
5
|
-
import { resolveProjectRoot } from "
|
|
1
|
+
import { resolveRepoRelativePath } from "#audit/prepare";
|
|
2
|
+
import { loadCodefastConfig } from "#core/config";
|
|
3
|
+
import { AppError, messageFrom } from "#core/errors";
|
|
4
|
+
import { err, ok } from "#core/result";
|
|
5
|
+
import { resolveProjectRoot } from "#core/workspace/resolver";
|
|
6
6
|
/**
|
|
7
7
|
* Loads config and resolves the scan target for `audit rtl`.
|
|
8
8
|
*
|
package/dist/audit/rtl/run.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { RtlAuditResult } from "
|
|
2
|
-
import { AppError } from "
|
|
3
|
-
import type { Filesystem } from "
|
|
4
|
-
import type { Result } from "
|
|
1
|
+
import type { RtlAuditResult } from "#audit/domain/types";
|
|
2
|
+
import { AppError } from "#core/errors";
|
|
3
|
+
import type { Filesystem } from "#core/filesystem/filesystem";
|
|
4
|
+
import type { Result } from "#core/result";
|
|
5
5
|
/**
|
|
6
6
|
* Scans a target path for physical-direction Tailwind class violations.
|
|
7
7
|
*
|
package/dist/audit/rtl/run.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import { auditFileContent } from "
|
|
3
|
-
import { AppError, messageFrom } from "
|
|
4
|
-
import { err, ok } from "
|
|
5
|
-
import { walkTsxFiles } from "
|
|
2
|
+
import { auditFileContent } from "#audit/rtl/domain/audit-file";
|
|
3
|
+
import { AppError, messageFrom } from "#core/errors";
|
|
4
|
+
import { err, ok } from "#core/result";
|
|
5
|
+
import { walkTsxFiles } from "#core/workspace/typescript-walk";
|
|
6
6
|
/**
|
|
7
7
|
* Scans a target path for physical-direction Tailwind class violations.
|
|
8
8
|
*
|
package/dist/bin.js
CHANGED
package/dist/cli.js
CHANGED
|
@@ -3,11 +3,11 @@ import path from "node:path";
|
|
|
3
3
|
import process from "node:process";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
5
|
import { Command } from "commander";
|
|
6
|
-
import { createArrangeCommand } from "
|
|
7
|
-
import { createAuditCommand } from "
|
|
8
|
-
import { createMirrorCommand } from "
|
|
9
|
-
import { createPackSlimCommand } from "
|
|
10
|
-
import { createTagCommand } from "
|
|
6
|
+
import { createArrangeCommand } from "#arrange/command";
|
|
7
|
+
import { createAuditCommand } from "#audit/command";
|
|
8
|
+
import { createMirrorCommand } from "#mirror/command";
|
|
9
|
+
import { createPackSlimCommand } from "#pack-slim/command";
|
|
10
|
+
import { createTagCommand } from "#tag/command";
|
|
11
11
|
function readVersion() {
|
|
12
12
|
try {
|
|
13
13
|
const dir = path.dirname(fileURLToPath(import.meta.url));
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Command } from "commander";
|
|
2
2
|
import type { ZodType } from "zod";
|
|
3
|
-
import type { GlobalCliOptions } from "
|
|
4
|
-
import type { AppError } from "
|
|
5
|
-
import type { Filesystem } from "
|
|
6
|
-
import type { Result } from "
|
|
3
|
+
import type { GlobalCliOptions } from "#core/cli/global-options";
|
|
4
|
+
import type { AppError } from "#core/errors";
|
|
5
|
+
import type { Filesystem } from "#core/filesystem/filesystem";
|
|
6
|
+
import type { Result } from "#core/result";
|
|
7
7
|
/**
|
|
8
8
|
* The options every command shares: the `--json` machine-output flag. Per-command option shapes extend this.
|
|
9
9
|
*
|
|
@@ -52,7 +52,6 @@ export interface CommandPipeline<Prelude, Request, RunResult, Presenter = never,
|
|
|
52
52
|
readonly name: string;
|
|
53
53
|
readonly help: string;
|
|
54
54
|
} | undefined;
|
|
55
|
-
readonly jsonHelp?: string | undefined;
|
|
56
55
|
readonly configureArgv?: ((command: Command) => void) | undefined;
|
|
57
56
|
readonly prepare: CommandPrepare<Prelude>;
|
|
58
57
|
readonly guard?: ((input: {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import process from "node:process";
|
|
2
|
-
import { globalCliCommanderOptionsSchema } from "
|
|
3
|
-
import { readOptionalPositionalArg } from "
|
|
4
|
-
import { consumeCliAppError } from "
|
|
5
|
-
import { logger } from "
|
|
6
|
-
import { parseWithSchema } from "
|
|
7
|
-
const DEFAULT_JSON_HELP = "Print one JSON
|
|
2
|
+
import { globalCliCommanderOptionsSchema } from "#core/cli/global-options";
|
|
3
|
+
import { readOptionalPositionalArg } from "#core/cli/positional";
|
|
4
|
+
import { consumeCliAppError } from "#core/cli/result-handle";
|
|
5
|
+
import { logger } from "#core/logger";
|
|
6
|
+
import { parseWithSchema } from "#core/schema-parse";
|
|
7
|
+
const DEFAULT_JSON_HELP = "Print one JSON object on stdout instead of the human-readable output";
|
|
8
8
|
function readGlobalOptions(command) {
|
|
9
9
|
return (command.optsWithGlobals?.() ?? command.opts());
|
|
10
10
|
}
|
|
@@ -68,7 +68,7 @@ export function applyCommandPipeline(command, fs, pipeline) {
|
|
|
68
68
|
if (pipeline.positional) {
|
|
69
69
|
command.argument(pipeline.positional.name, pipeline.positional.help);
|
|
70
70
|
}
|
|
71
|
-
command.option("--json",
|
|
71
|
+
command.option("--json", DEFAULT_JSON_HELP, false);
|
|
72
72
|
pipeline.configureArgv?.(command);
|
|
73
73
|
command.action(makeAction(fs, pipeline));
|
|
74
74
|
return command;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { AppError } from "
|
|
2
|
-
import type { Filesystem } from "
|
|
3
|
-
import type { Result } from "
|
|
1
|
+
import { AppError } from "#core/errors";
|
|
2
|
+
import type { Filesystem } from "#core/filesystem/filesystem";
|
|
3
|
+
import type { Result } from "#core/result";
|
|
4
4
|
/**
|
|
5
5
|
* Resolves the project root as a `Result`, mapping a resolution failure to an `INFRA_FAILURE` error.
|
|
6
6
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { AppError, messageFrom } from "
|
|
2
|
-
import { err, ok } from "
|
|
3
|
-
import { resolveProjectRoot } from "
|
|
1
|
+
import { AppError, messageFrom } from "#core/errors";
|
|
2
|
+
import { err, ok } from "#core/result";
|
|
3
|
+
import { resolveProjectRoot } from "#core/workspace/resolver";
|
|
4
4
|
/**
|
|
5
5
|
* Resolves the project root as a `Result`, mapping a resolution failure to an `INFRA_FAILURE` error.
|
|
6
6
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { AppError } from "
|
|
2
|
-
import type { Result } from "
|
|
1
|
+
import type { AppError } from "#core/errors";
|
|
2
|
+
import type { Result } from "#core/result";
|
|
3
3
|
/**
|
|
4
4
|
* Narrows a `Result`, reporting a failure and setting the exit code, or logging an optional success message.
|
|
5
5
|
*
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import process from "node:process";
|
|
2
|
-
import { formatAppError } from "
|
|
3
|
-
import { CLI_EXIT_GENERAL_ERROR, CLI_EXIT_USAGE } from "
|
|
4
|
-
import { logger } from "
|
|
5
|
-
import { isVerboseCliDiagnostics } from "
|
|
2
|
+
import { formatAppError } from "#core/cli/format-error";
|
|
3
|
+
import { CLI_EXIT_GENERAL_ERROR, CLI_EXIT_USAGE } from "#core/exit-codes";
|
|
4
|
+
import { logger } from "#core/logger";
|
|
5
|
+
import { isVerboseCliDiagnostics } from "#core/verbose-diagnostics";
|
|
6
6
|
function exitCodeForAppError(error) {
|
|
7
7
|
switch (error.code) {
|
|
8
8
|
case "NOT_FOUND":
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { CodefastConfig } from "
|
|
2
|
-
import type { Filesystem } from "
|
|
1
|
+
import type { CodefastConfig } from "#core/config/schema";
|
|
2
|
+
import type { Filesystem } from "#core/filesystem/filesystem";
|
|
3
3
|
/**
|
|
4
4
|
* A loaded config together with its schema warnings and the path it was read from.
|
|
5
5
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import jiti from "jiti";
|
|
3
|
-
import { codefastConfigRootSchema } from "
|
|
4
|
-
import { ancestorDirectories } from "
|
|
3
|
+
import { codefastConfigRootSchema } from "#core/config/schema";
|
|
4
|
+
import { ancestorDirectories } from "#core/workspace/ancestor-directories";
|
|
5
5
|
function formatZodError(error, filePath) {
|
|
6
6
|
const formatted = error.issues
|
|
7
7
|
.map((issue) => {
|
package/dist/core/config.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { CodefastConfig } from "
|
|
2
|
-
import { AppError } from "
|
|
3
|
-
import type { Filesystem } from "
|
|
4
|
-
import type { Result } from "
|
|
1
|
+
import type { CodefastConfig } from "#core/config/schema";
|
|
2
|
+
import { AppError } from "#core/errors";
|
|
3
|
+
import type { Filesystem } from "#core/filesystem/filesystem";
|
|
4
|
+
import type { Result } from "#core/result";
|
|
5
5
|
/**
|
|
6
6
|
* Loads the `codefast.config.js` for a workspace root, reporting schema warnings along the way.
|
|
7
7
|
*
|
package/dist/core/config.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { loadConfigPayload } from "
|
|
2
|
-
import { reportSchemaWarnings } from "
|
|
3
|
-
import { AppError, messageFrom } from "
|
|
4
|
-
import { err, ok } from "
|
|
1
|
+
import { loadConfigPayload } from "#core/config/loader";
|
|
2
|
+
import { reportSchemaWarnings } from "#core/config/warnings";
|
|
3
|
+
import { AppError, messageFrom } from "#core/errors";
|
|
4
|
+
import { err, ok } from "#core/result";
|
|
5
5
|
/**
|
|
6
6
|
* Loads the `codefast.config.js` for a workspace root, reporting schema warnings along the way.
|
|
7
7
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ZodType } from "zod";
|
|
2
|
-
import { AppError } from "
|
|
3
|
-
import type { Result } from "
|
|
2
|
+
import { AppError } from "#core/errors";
|
|
3
|
+
import type { Result } from "#core/result";
|
|
4
4
|
/**
|
|
5
5
|
* Parses an input against a Zod schema and returns a `Result` with the value or a validation `AppError`.
|
|
6
6
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Filesystem } from "
|
|
1
|
+
import type { Filesystem } from "#core/filesystem/filesystem";
|
|
2
2
|
/**
|
|
3
3
|
* Finds the `version` of the nearest enclosing `package.json`, or null when the first
|
|
4
4
|
* one found declares none (the private workspace root is version-less by design).
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import { findNearestAncestor } from "
|
|
3
|
-
import { packageJsonFileName } from "
|
|
2
|
+
import { findNearestAncestor } from "#core/workspace/ancestor-directories";
|
|
3
|
+
import { packageJsonFileName } from "#core/workspace/well-known-files";
|
|
4
4
|
/**
|
|
5
5
|
* Finds the `version` of the nearest enclosing `package.json`, or null when the first
|
|
6
6
|
* one found declares none (the private workspace root is version-less by design).
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { parse as parseYaml } from "yaml";
|
|
3
|
-
import { messageFrom } from "
|
|
4
|
-
import { createAnyGlobMatcher } from "
|
|
5
|
-
import { logger } from "
|
|
6
|
-
import { findNearestAncestor } from "
|
|
7
|
-
import { packageJsonFileName, workspaceYamlFileName } from "
|
|
3
|
+
import { messageFrom } from "#core/errors";
|
|
4
|
+
import { createAnyGlobMatcher } from "#core/glob";
|
|
5
|
+
import { logger } from "#core/logger";
|
|
6
|
+
import { findNearestAncestor } from "#core/workspace/ancestor-directories";
|
|
7
|
+
import { packageJsonFileName, workspaceYamlFileName } from "#core/workspace/well-known-files";
|
|
8
8
|
/**
|
|
9
9
|
* Resolves the project root: the `pnpm-workspace.yaml` directory, or the nearest `package.json` for a single package.
|
|
10
10
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import { walkFiles } from "
|
|
2
|
+
import { walkFiles } from "#core/workspace/walk-files";
|
|
3
3
|
// Ignore files carry the divider convention over `#` comments — the content rules stay code-only.
|
|
4
4
|
const ignoreFileNames = new Set([
|
|
5
5
|
".gitignore",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import { defaultSkipDirectoryNames } from "
|
|
2
|
+
import { defaultSkipDirectoryNames } from "#core/workspace/skip-directories";
|
|
3
3
|
/**
|
|
4
4
|
* Every file under a root the predicate accepts, skipping build output and vendored trees.
|
|
5
5
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The `@codefast/cli` public API: run the CLI in-process, and author a typed `codefast.config.*`.
|
|
3
3
|
*/
|
|
4
|
-
export { runCli } from "
|
|
5
|
-
export { defineConfig } from "
|
|
6
|
-
export type { CodefastAfterWriteHook, CodefastArrangeConfig, CodefastConfig, CodefastTagConfig, MirrorConfig, } from "
|
|
4
|
+
export { runCli } from "#cli";
|
|
5
|
+
export { defineConfig } from "#core/config/define-config";
|
|
6
|
+
export type { CodefastAfterWriteHook, CodefastArrangeConfig, CodefastConfig, CodefastTagConfig, MirrorConfig, } from "#core/config/schema";
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The `@codefast/cli` public API: run the CLI in-process, and author a typed `codefast.config.*`.
|
|
3
3
|
*/
|
|
4
|
-
export { runCli } from "
|
|
5
|
-
export { defineConfig } from "
|
|
4
|
+
export { runCli } from "#cli";
|
|
5
|
+
export { defineConfig } from "#core/config/define-config";
|
package/dist/mirror/command.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Command } from "commander";
|
|
2
|
-
import { applyCommandPipeline } from "
|
|
3
|
-
import { nodeFilesystem } from "
|
|
4
|
-
import { exitCodeForMirrorSyncResult, formatMirrorSyncJsonOutput } from "
|
|
5
|
-
import { mirrorSyncRunRequestSchema } from "
|
|
6
|
-
import { MirrorSyncProgressPresenter } from "
|
|
7
|
-
import { prepareMirrorSync } from "
|
|
8
|
-
import { runMirrorSync } from "
|
|
2
|
+
import { applyCommandPipeline } from "#core/cli/command-pipeline";
|
|
3
|
+
import { nodeFilesystem } from "#core/filesystem/node";
|
|
4
|
+
import { exitCodeForMirrorSyncResult, formatMirrorSyncJsonOutput } from "#mirror/cli-result";
|
|
5
|
+
import { mirrorSyncRunRequestSchema } from "#mirror/cli-schema";
|
|
6
|
+
import { MirrorSyncProgressPresenter } from "#mirror/output";
|
|
7
|
+
import { prepareMirrorSync } from "#mirror/prepare";
|
|
8
|
+
import { runMirrorSync } from "#mirror/run";
|
|
9
9
|
const mirrorPipeline = {
|
|
10
10
|
positional: { name: "[package]", help: "Optional package path relative to repo root (e.g. packages/ui)" },
|
|
11
11
|
schema: mirrorSyncRunRequestSchema,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Filesystem } from "
|
|
2
|
-
import type { DistFilesystem } from "
|
|
1
|
+
import type { Filesystem } from "#core/filesystem/filesystem";
|
|
2
|
+
import type { DistFilesystem } from "#mirror/domain/dist-filesystem";
|
|
3
3
|
/**
|
|
4
4
|
* Creates the `DistFilesystem` the mirror scan uses, backed by a `Filesystem`.
|
|
5
5
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import { isDirentList } from "
|
|
3
|
-
import { normalizePath } from "
|
|
2
|
+
import { isDirentList } from "#mirror/domain/dirent-guard";
|
|
3
|
+
import { normalizePath } from "#mirror/domain/path-normalizer";
|
|
4
4
|
/**
|
|
5
5
|
* Creates the `DistFilesystem` the mirror scan uses, backed by a `Filesystem`.
|
|
6
6
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DirectoryEntry } from "
|
|
1
|
+
import type { DirectoryEntry } from "#core/filesystem/filesystem";
|
|
2
2
|
/**
|
|
3
3
|
* Narrow `fs.promises.readdir` overload result to `Dirent[]` when `withFileTypes: true`.
|
|
4
4
|
* Accepts both historical checks (`isFile` / `isDirectory`) in one guard.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { DistFilesystem } from "
|
|
2
|
-
import type { GenerateExportsResult } from "
|
|
1
|
+
import type { DistFilesystem } from "#mirror/domain/dist-filesystem";
|
|
2
|
+
import type { GenerateExportsResult } from "#mirror/domain/types";
|
|
3
3
|
/**
|
|
4
4
|
* Creates a transform that strips a configured prefix from export paths, or `null` when none is set.
|
|
5
5
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as nodePath from "node:path";
|
|
2
|
-
import { PACKAGE_JSON_EXPORT, VALID_DTS_EXTENSIONS, VALID_JS_EXTENSIONS } from "
|
|
2
|
+
import { PACKAGE_JSON_EXPORT, VALID_DTS_EXTENSIONS, VALID_JS_EXTENSIONS } from "#mirror/domain/constants";
|
|
3
3
|
function groupDistFilesByModule(relativeDistFiles) {
|
|
4
4
|
const distModulesByPath = new Map();
|
|
5
5
|
for (const relativeDistFile of relativeDistFiles) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { GlobalCliOptions } from "
|
|
2
|
-
import type { CodefastConfig } from "
|
|
1
|
+
import type { GlobalCliOptions } from "#core/cli/global-options";
|
|
2
|
+
import type { CodefastConfig } from "#core/config/schema";
|
|
3
3
|
/**
|
|
4
4
|
* One conditional exports entry, keyed by resolution condition.
|
|
5
5
|
*
|
package/dist/mirror/output.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { GlobalStats, MirrorProcessingModeInput, MirrorSyncProgressListener, PackageStats } from "
|
|
1
|
+
import type { GlobalStats, MirrorProcessingModeInput, MirrorSyncProgressListener, PackageStats } from "#mirror/domain/types";
|
|
2
2
|
/**
|
|
3
3
|
* A progress listener that renders mirror run events through the CLI reporter.
|
|
4
4
|
*
|
package/dist/mirror/output.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import process from "node:process";
|
|
2
|
-
import { messageFrom } from "
|
|
3
|
-
import { logger } from "
|
|
2
|
+
import { messageFrom } from "#core/errors";
|
|
3
|
+
import { logger } from "#core/logger";
|
|
4
4
|
const cliLogger = logger;
|
|
5
5
|
/**
|
|
6
6
|
* A progress listener that renders mirror run events through the CLI reporter.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { AppError } from "
|
|
2
|
-
import type { Filesystem } from "
|
|
3
|
-
import type { Result } from "
|
|
1
|
+
import { AppError } from "#core/errors";
|
|
2
|
+
import type { Filesystem } from "#core/filesystem/filesystem";
|
|
3
|
+
import type { Result } from "#core/result";
|
|
4
4
|
/**
|
|
5
5
|
* Resolves the optional positional package argument to a root-relative path, or `undefined` when absent.
|
|
6
6
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import { AppError } from "
|
|
3
|
-
import { err, ok } from "
|
|
4
|
-
import { normalizePath } from "
|
|
2
|
+
import { AppError } from "#core/errors";
|
|
3
|
+
import { err, ok } from "#core/result";
|
|
4
|
+
import { normalizePath } from "#mirror/domain/path-normalizer";
|
|
5
5
|
/**
|
|
6
6
|
* Resolves the optional positional package argument to a root-relative path, or `undefined` when absent.
|
|
7
7
|
*
|
package/dist/mirror/prepare.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { GlobalCliOptions } from "
|
|
2
|
-
import type { AppError } from "
|
|
3
|
-
import type { Filesystem } from "
|
|
4
|
-
import type { Result } from "
|
|
5
|
-
import type { MirrorSyncCommandPrelude } from "
|
|
1
|
+
import type { GlobalCliOptions } from "#core/cli/global-options";
|
|
2
|
+
import type { AppError } from "#core/errors";
|
|
3
|
+
import type { Filesystem } from "#core/filesystem/filesystem";
|
|
4
|
+
import type { Result } from "#core/result";
|
|
5
|
+
import type { MirrorSyncCommandPrelude } from "#mirror/domain/types";
|
|
6
6
|
/**
|
|
7
7
|
* Resolves the repo root, config, and package filter into the prelude a mirror run starts from.
|
|
8
8
|
*
|
package/dist/mirror/prepare.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { resolveProjectRootResult } from "
|
|
2
|
-
import { loadCodefastConfig } from "
|
|
3
|
-
import { ok } from "
|
|
4
|
-
import { resolveMirrorPackageFromCliArg } from "
|
|
1
|
+
import { resolveProjectRootResult } from "#core/cli/resolve-root";
|
|
2
|
+
import { loadCodefastConfig } from "#core/config";
|
|
3
|
+
import { ok } from "#core/result";
|
|
4
|
+
import { resolveMirrorPackageFromCliArg } from "#mirror/package-path";
|
|
5
5
|
/**
|
|
6
6
|
* Resolves the repo root, config, and package filter into the prelude a mirror run starts from.
|
|
7
7
|
*
|