@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 type { ArrangeSuggestGroupsOutput } from "
|
|
2
|
-
import type { ArrangeSuggestGroupsRequest } from "
|
|
1
|
+
import type { ArrangeSuggestGroupsOutput } from "#arrange/domain/types";
|
|
2
|
+
import type { ArrangeSuggestGroupsRequest } from "#arrange/group/cli-schema";
|
|
3
3
|
/**
|
|
4
4
|
* Formats the suggested grouping for an inline class string as `arrange group` output lines.
|
|
5
5
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { suggestCnGroups, summarizeGroupBucketLabels } from "
|
|
2
|
-
import { formatArray, formatCnCall } from "
|
|
1
|
+
import { suggestCnGroups, summarizeGroupBucketLabels } from "#arrange/domain/grouping";
|
|
2
|
+
import { formatArray, formatCnCall } from "#arrange/domain/source-text-formatters";
|
|
3
3
|
/**
|
|
4
4
|
* Formats the suggested grouping for an inline class string as `arrange group` output lines.
|
|
5
5
|
*
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Rich domain: Tailwind/cn/tv analysis rules (counts, long literals, nested cn in tv).
|
|
3
3
|
* Pure orchestration of domain collectors and invariants — no I/O.
|
|
4
4
|
*/
|
|
5
|
-
import type { DomainSourceFile } from "
|
|
6
|
-
import type { AnalyzeReport } from "
|
|
5
|
+
import type { DomainSourceFile } from "#arrange/domain/ast/ast-node";
|
|
6
|
+
import type { AnalyzeReport } from "#arrange/domain/types";
|
|
7
7
|
/**
|
|
8
8
|
* Creates a zeroed analyze report ready for accumulation.
|
|
9
9
|
*
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
* Rich domain: Tailwind/cn/tv analysis rules (counts, long literals, nested cn in tv).
|
|
3
3
|
* Pure orchestration of domain collectors and invariants — no I/O.
|
|
4
4
|
*/
|
|
5
|
-
import { isDomainCallExpression, isDomainJsxAttribute, isDomainObjectLiteralExpression, forEachDomainChild, } from "
|
|
6
|
-
import { forEachStringLiteralInClassExpression } from "
|
|
7
|
-
import { jsxClassNameStaticLiteral } from "
|
|
8
|
-
import { collectCnCallsInsideTv, traverseTvObject } from "
|
|
9
|
-
import { buildKnownCnTvBindings, isCnOrTvIdentifier, lineOf } from "
|
|
10
|
-
import { LONG_STRING_TOKEN_THRESHOLD } from "
|
|
11
|
-
import { tokenizeClassString } from "
|
|
5
|
+
import { isDomainCallExpression, isDomainJsxAttribute, isDomainObjectLiteralExpression, forEachDomainChild, } from "#arrange/domain/ast/ast-node";
|
|
6
|
+
import { forEachStringLiteralInClassExpression } from "#arrange/domain/ast/collectors-cn";
|
|
7
|
+
import { jsxClassNameStaticLiteral } from "#arrange/domain/ast/collectors-jsx";
|
|
8
|
+
import { collectCnCallsInsideTv, traverseTvObject } from "#arrange/domain/ast/collectors-tv";
|
|
9
|
+
import { buildKnownCnTvBindings, isCnOrTvIdentifier, lineOf } from "#arrange/domain/ast/helpers";
|
|
10
|
+
import { LONG_STRING_TOKEN_THRESHOLD } from "#arrange/domain/constants";
|
|
11
|
+
import { tokenizeClassString } from "#arrange/domain/tailwind-token";
|
|
12
12
|
const PREVIEW_MAX_LENGTH = 72;
|
|
13
13
|
function previewText(text) {
|
|
14
14
|
return text.length > PREVIEW_MAX_LENGTH ? `${text.slice(0, PREVIEW_MAX_LENGTH)}…` : text;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import { LONG_STRING_TOKEN_THRESHOLD, MAX_REPORT_LINES } from "
|
|
3
|
-
import { logger } from "
|
|
2
|
+
import { LONG_STRING_TOKEN_THRESHOLD, MAX_REPORT_LINES } from "#arrange/domain/constants";
|
|
3
|
+
import { logger } from "#core/logger";
|
|
4
4
|
/**
|
|
5
5
|
* Presents the human-readable summary of an `arrange inspect` report.
|
|
6
6
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { AnalyzeReport } from "
|
|
2
|
-
import { AppError } from "
|
|
3
|
-
import type { Filesystem } from "
|
|
4
|
-
import type { Result } from "
|
|
1
|
+
import type { AnalyzeReport } from "#arrange/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 directory's arrange targets and returns the accumulated analyze report.
|
|
7
7
|
*
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { accumulateAnalyzeReportForSourceFile, createEmptyAnalyzeReport, } from "
|
|
2
|
-
import { scanArrangeTargets } from "
|
|
3
|
-
import { parseDomainSourceFile } from "
|
|
4
|
-
import { AppError } from "
|
|
5
|
-
import { messageFrom } from "
|
|
6
|
-
import { err, ok } from "
|
|
1
|
+
import { accumulateAnalyzeReportForSourceFile, createEmptyAnalyzeReport, } from "#arrange/inspect/domain/analyze-service";
|
|
2
|
+
import { scanArrangeTargets } from "#arrange/scan-target";
|
|
3
|
+
import { parseDomainSourceFile } from "#arrange/source-parse";
|
|
4
|
+
import { AppError } from "#core/errors";
|
|
5
|
+
import { messageFrom } from "#core/errors";
|
|
6
|
+
import { err, ok } from "#core/result";
|
|
7
7
|
/**
|
|
8
8
|
* Scans a directory's arrange targets and returns the accumulated analyze report.
|
|
9
9
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { ArrangeTargetWorkspaceAndConfig } from "
|
|
2
|
-
import { AppError } from "
|
|
3
|
-
import type { Filesystem } from "
|
|
4
|
-
import type { Result } from "
|
|
1
|
+
import type { ArrangeTargetWorkspaceAndConfig } from "#arrange/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
|
* Resolves the arrange target, repo root, and loaded config an arrange run needs.
|
|
7
7
|
*
|
package/dist/arrange/prepare.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { resolveArrangeTargetPath } from "
|
|
2
|
-
import { resolveProjectRootResult } from "
|
|
3
|
-
import { loadCodefastConfig } from "
|
|
4
|
-
import { AppError } from "
|
|
5
|
-
import { err, ok } from "
|
|
1
|
+
import { resolveArrangeTargetPath } from "#arrange/resolve-target";
|
|
2
|
+
import { resolveProjectRootResult } from "#core/cli/resolve-root";
|
|
3
|
+
import { loadCodefastConfig } from "#core/config";
|
|
4
|
+
import { AppError } from "#core/errors";
|
|
5
|
+
import { err, ok } from "#core/result";
|
|
6
6
|
/**
|
|
7
7
|
* Resolves the arrange target, repo root, and loaded config an arrange run needs.
|
|
8
8
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { GroupFileWorkPlan } from "
|
|
2
|
-
import type { ArrangeRunResult } from "
|
|
1
|
+
import type { GroupFileWorkPlan } from "#arrange/domain/grouping-service";
|
|
2
|
+
import type { ArrangeRunResult } from "#arrange/domain/types";
|
|
3
3
|
/**
|
|
4
4
|
* Presents the totals and follow-up hints for an `arrange` run.
|
|
5
5
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { lineOf } from "
|
|
2
|
-
import { logger } from "
|
|
1
|
+
import { lineOf } from "#arrange/domain/ast/helpers";
|
|
2
|
+
import { logger } from "#core/logger";
|
|
3
3
|
/**
|
|
4
4
|
* Presents the totals and follow-up hints for an `arrange` run.
|
|
5
5
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ArrangeGroupFileOptions, GroupFileResult } from "
|
|
2
|
-
import type { Filesystem } from "
|
|
1
|
+
import type { ArrangeGroupFileOptions, GroupFileResult } from "#arrange/domain/types";
|
|
2
|
+
import type { Filesystem } from "#core/filesystem/filesystem";
|
|
3
3
|
/**
|
|
4
4
|
* Runs the grouping pipeline on one file — preview or write — and returns its per-file result.
|
|
5
5
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { buildGroupFileUnwrapState, countPersistedGroupFileEdits, groupFileDryRunNoEdits, groupFileEditsTouchJsxCn, groupFilePreviewTotals, groupFileWorkHasNothingToReport, mergeGroupFileBodyText, tryBuildGroupFileWorkPlan, } from "
|
|
2
|
-
import { ensureCnImport } from "
|
|
3
|
-
import { parseDomainSourceFile } from "
|
|
1
|
+
import { buildGroupFileUnwrapState, countPersistedGroupFileEdits, groupFileDryRunNoEdits, groupFileEditsTouchJsxCn, groupFilePreviewTotals, groupFileWorkHasNothingToReport, mergeGroupFileBodyText, tryBuildGroupFileWorkPlan, } from "#arrange/domain/grouping-service";
|
|
2
|
+
import { ensureCnImport } from "#arrange/domain/imports";
|
|
3
|
+
import { parseDomainSourceFile } from "#arrange/source-parse";
|
|
4
4
|
/**
|
|
5
5
|
* Runs the grouping pipeline on one file — preview or write — and returns its per-file result.
|
|
6
6
|
*
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { ArrangeRunResult } from "
|
|
2
|
-
import type { ArrangeRunRequest } from "
|
|
3
|
-
import type { AppError } from "
|
|
4
|
-
import type { Filesystem } from "
|
|
5
|
-
import type { Result } from "
|
|
1
|
+
import type { ArrangeRunResult } from "#arrange/domain/types";
|
|
2
|
+
import type { ArrangeRunRequest } from "#arrange/regroup/cli-schema";
|
|
3
|
+
import type { AppError } from "#core/errors";
|
|
4
|
+
import type { Filesystem } from "#core/filesystem/filesystem";
|
|
5
|
+
import type { Result } from "#core/result";
|
|
6
6
|
/**
|
|
7
7
|
* Runs the grouping pipeline over every target file and returns the aggregated result.
|
|
8
8
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { processArrangeGroupFile } from "
|
|
2
|
-
import { scanArrangeTargets } from "
|
|
3
|
-
import { messageFrom } from "
|
|
4
|
-
import { ok } from "
|
|
1
|
+
import { processArrangeGroupFile } from "#arrange/regroup/process-file";
|
|
2
|
+
import { scanArrangeTargets } from "#arrange/scan-target";
|
|
3
|
+
import { messageFrom } from "#core/errors";
|
|
4
|
+
import { ok } from "#core/result";
|
|
5
5
|
async function runOnAfterWriteHook(hook, modifiedFiles) {
|
|
6
6
|
if (!hook || modifiedFiles.length === 0) {
|
|
7
7
|
return null;
|
|
@@ -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
|
* Resolves the arrange target to a canonical path, defaulting to the nearest package directory.
|
|
6
6
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import { messageFrom } from "
|
|
3
|
-
import { logger } from "
|
|
4
|
-
import { walkTsxFiles } from "
|
|
2
|
+
import { messageFrom } from "#core/errors";
|
|
3
|
+
import { logger } from "#core/logger";
|
|
4
|
+
import { walkTsxFiles } from "#core/workspace/typescript-walk";
|
|
5
5
|
const TEST_FILE_PATTERN = /\.(?:test|spec)\.[cm]?[jt]sx?$/;
|
|
6
6
|
/**
|
|
7
7
|
* Test/spec files are excluded from directory scans: arrange rewrites class strings,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** Collects cn() calls whose override classes can fold into a variant function's `className` option. */
|
|
2
|
-
import type { DomainSourceFile } from "
|
|
3
|
-
import type { PlannedSimplifyEdit } from "
|
|
4
|
-
import type { FileClassNameProbe } from "
|
|
2
|
+
import type { DomainSourceFile } from "#arrange/domain/ast/ast-node";
|
|
3
|
+
import type { PlannedSimplifyEdit } from "#arrange/domain/ast/simplify-targets";
|
|
4
|
+
import type { FileClassNameProbe } from "#arrange/simplify/variant-classname-probe";
|
|
5
5
|
/**
|
|
6
6
|
* Collects `className` fold edits for every foldable `cn(variant({…}), …)` call in a source file.
|
|
7
7
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** Collects cn() calls whose override classes can fold into a variant function's `className` option. */
|
|
2
|
-
import { forEachDomainChild, isDomainCallExpression, isDomainIdentifier, isDomainObjectLiteralExpression, isDomainPropertyAccessExpression, isDomainPropertyAssignment, isDomainTailwindClassLiteral, } from "
|
|
3
|
-
import { buildKnownCnTvBindings, isCnOrTvIdentifier, propertyAssignmentNameText } from "
|
|
4
|
-
import { escapeTsStringLiteralContent } from "
|
|
2
|
+
import { forEachDomainChild, isDomainCallExpression, isDomainIdentifier, isDomainObjectLiteralExpression, isDomainPropertyAccessExpression, isDomainPropertyAssignment, isDomainTailwindClassLiteral, } from "#arrange/domain/ast/ast-node";
|
|
3
|
+
import { buildKnownCnTvBindings, isCnOrTvIdentifier, propertyAssignmentNameText } from "#arrange/domain/ast/helpers";
|
|
4
|
+
import { escapeTsStringLiteralContent } from "#arrange/domain/source-text-formatters";
|
|
5
5
|
/** Groups a run of trailing cn() arguments, coalescing adjacent static literals into one piece. */
|
|
6
6
|
function coalesceTrailingArgs(args, sourceText) {
|
|
7
7
|
const pieces = [];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { GroupFileResult } from "
|
|
2
|
-
import type { VariantClassNameProbe } from "
|
|
3
|
-
import type { Filesystem } from "
|
|
1
|
+
import type { GroupFileResult } from "#arrange/domain/types";
|
|
2
|
+
import type { VariantClassNameProbe } from "#arrange/simplify/variant-classname-probe";
|
|
3
|
+
import type { Filesystem } from "#core/filesystem/filesystem";
|
|
4
4
|
/**
|
|
5
5
|
* Runs the simplify pass on one file — flattening class expressions and pruning an unused `cn` import.
|
|
6
6
|
*
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { collectSimplifyTargets } from "
|
|
2
|
-
import { dropCnImportIfUnused } from "
|
|
3
|
-
import { collectClassNameFoldTargets } from "
|
|
4
|
-
import { parseDomainSourceFile } from "
|
|
5
|
-
import { applyEditsDescending, dropOverlappingEdits } from "
|
|
1
|
+
import { collectSimplifyTargets } from "#arrange/domain/ast/simplify-targets";
|
|
2
|
+
import { dropCnImportIfUnused } from "#arrange/domain/imports";
|
|
3
|
+
import { collectClassNameFoldTargets } from "#arrange/simplify/fold-targets";
|
|
4
|
+
import { parseDomainSourceFile } from "#arrange/source-parse";
|
|
5
|
+
import { applyEditsDescending, dropOverlappingEdits } from "#core/source-text-edit";
|
|
6
6
|
// A file simplify can act on names `cn`/`tv` (a call or an import to prune) or carries a `class`/`className`;
|
|
7
7
|
// a source with none of these has nothing to flatten or fold, so it never needs parsing.
|
|
8
8
|
const SIMPLIFY_MARKER = /\b(?:cn|tv)\b|className|\bclass\s*[=:]/;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { ArrangeRunResult } from "
|
|
2
|
-
import type { AppError } from "
|
|
3
|
-
import type { Filesystem } from "
|
|
4
|
-
import type { Result } from "
|
|
1
|
+
import type { ArrangeRunResult } from "#arrange/domain/types";
|
|
2
|
+
import type { AppError } from "#core/errors";
|
|
3
|
+
import type { Filesystem } from "#core/filesystem/filesystem";
|
|
4
|
+
import type { Result } from "#core/result";
|
|
5
5
|
/**
|
|
6
6
|
* Runs the simplify pass over every target file and returns the aggregated result.
|
|
7
7
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { scanArrangeTargets } from "
|
|
2
|
-
import { processArrangeSimplifyFile } from "
|
|
3
|
-
import { createVariantClassNameProbe } from "
|
|
4
|
-
import { ok } from "
|
|
1
|
+
import { scanArrangeTargets } from "#arrange/scan-target";
|
|
2
|
+
import { processArrangeSimplifyFile } from "#arrange/simplify/process-file";
|
|
3
|
+
import { createVariantClassNameProbe } from "#arrange/simplify/variant-classname-probe";
|
|
4
|
+
import { ok } from "#core/result";
|
|
5
5
|
/**
|
|
6
6
|
* Runs the simplify pass over every target file and returns the aggregated result.
|
|
7
7
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Type probe that asks whether a variant function's options accept a folded `className`. */
|
|
2
|
-
import { AppError, messageFrom } from "
|
|
2
|
+
import { AppError, messageFrom } from "#core/errors";
|
|
3
3
|
// ── Type inspection ──────────────────────────────────────────────────────────────────────────────────────────────────
|
|
4
4
|
/** The type of the callee's first-parameter `className` (preferred) or `class` option, if any. */
|
|
5
5
|
function classNameOptionType(checker, optionsType) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { TypeScriptAstTranslator } from "
|
|
2
|
-
import { messageFrom } from "
|
|
3
|
-
import { logger } from "
|
|
1
|
+
import { TypeScriptAstTranslator } from "#arrange/domain/ast/translator";
|
|
2
|
+
import { messageFrom } from "#core/errors";
|
|
3
|
+
import { logger } from "#core/logger";
|
|
4
4
|
const translator = new TypeScriptAstTranslator();
|
|
5
5
|
/**
|
|
6
6
|
* Parses source text into a domain source file via the shared `oxc-parser` translator.
|
package/dist/audit/command.js
CHANGED
|
@@ -1,31 +1,36 @@
|
|
|
1
1
|
import { Command } from "commander";
|
|
2
|
-
import { exitCodeForCommentAuditResult, formatCommentAuditJsonOutput } from "
|
|
3
|
-
import { commentAuditRunRequestSchema } from "
|
|
4
|
-
import { presentCommentAuditResult } from "
|
|
5
|
-
import { prepareCommentAudit } from "
|
|
6
|
-
import { runCommentAudit } from "
|
|
7
|
-
import { exitCodeForDisplayNameAuditResult, formatDisplayNameAuditJsonOutput } from "
|
|
8
|
-
import { displayNameAuditRunRequestSchema } from "
|
|
9
|
-
import { presentDisplayNameAuditResult } from "
|
|
10
|
-
import { prepareDisplayNameAudit } from "
|
|
11
|
-
import { runDisplayNameAudit } from "
|
|
12
|
-
import { exitCodeForImportsAuditResult, formatImportsAuditJsonOutput } from "
|
|
13
|
-
import { importsAuditRunRequestSchema } from "
|
|
14
|
-
import { presentImportsAuditResult } from "
|
|
15
|
-
import { prepareImportsAudit } from "
|
|
16
|
-
import { runImportsAudit } from "
|
|
17
|
-
import { exitCodeForLinkAuditResult, formatLinkAuditJsonOutput } from "
|
|
18
|
-
import { linkAuditRunRequestSchema } from "
|
|
19
|
-
import { presentLinkAuditResult } from "
|
|
20
|
-
import { prepareLinkAudit } from "
|
|
21
|
-
import { runLinkAudit } from "
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
2
|
+
import { exitCodeForCommentAuditResult, formatCommentAuditJsonOutput } from "#audit/comments/cli-result";
|
|
3
|
+
import { commentAuditRunRequestSchema } from "#audit/comments/cli-schema";
|
|
4
|
+
import { presentCommentAuditResult } from "#audit/comments/output";
|
|
5
|
+
import { prepareCommentAudit } from "#audit/comments/prepare";
|
|
6
|
+
import { runCommentAudit } from "#audit/comments/run";
|
|
7
|
+
import { exitCodeForDisplayNameAuditResult, formatDisplayNameAuditJsonOutput } from "#audit/display-names/cli-result";
|
|
8
|
+
import { displayNameAuditRunRequestSchema } from "#audit/display-names/cli-schema";
|
|
9
|
+
import { presentDisplayNameAuditResult } from "#audit/display-names/output";
|
|
10
|
+
import { prepareDisplayNameAudit } from "#audit/display-names/prepare";
|
|
11
|
+
import { runDisplayNameAudit } from "#audit/display-names/run";
|
|
12
|
+
import { exitCodeForImportsAuditResult, formatImportsAuditJsonOutput } from "#audit/imports/cli-result";
|
|
13
|
+
import { importsAuditRunRequestSchema } from "#audit/imports/cli-schema";
|
|
14
|
+
import { presentImportsAuditResult } from "#audit/imports/output";
|
|
15
|
+
import { prepareImportsAudit } from "#audit/imports/prepare";
|
|
16
|
+
import { runImportsAudit } from "#audit/imports/run";
|
|
17
|
+
import { exitCodeForLinkAuditResult, formatLinkAuditJsonOutput } from "#audit/links/cli-result";
|
|
18
|
+
import { linkAuditRunRequestSchema } from "#audit/links/cli-schema";
|
|
19
|
+
import { presentLinkAuditResult } from "#audit/links/output";
|
|
20
|
+
import { prepareLinkAudit } from "#audit/links/prepare";
|
|
21
|
+
import { runLinkAudit } from "#audit/links/run";
|
|
22
|
+
import { exitCodeForPublishAuditResult, formatPublishAuditJsonOutput } from "#audit/publish/cli-result";
|
|
23
|
+
import { publishAuditRunRequestSchema } from "#audit/publish/cli-schema";
|
|
24
|
+
import { presentPublishAuditResult } from "#audit/publish/output";
|
|
25
|
+
import { preparePublishAudit } from "#audit/publish/prepare";
|
|
26
|
+
import { runPublishAudit } from "#audit/publish/run";
|
|
27
|
+
import { exitCodeForRtlAuditResult, formatRtlAuditJsonOutput } from "#audit/rtl/cli-result";
|
|
28
|
+
import { rtlAuditRunRequestSchema } from "#audit/rtl/cli-schema";
|
|
29
|
+
import { presentRtlAuditResult } from "#audit/rtl/output";
|
|
30
|
+
import { prepareRtlAudit } from "#audit/rtl/prepare";
|
|
31
|
+
import { runRtlAudit } from "#audit/rtl/run";
|
|
32
|
+
import { registerPipelineSubcommand } from "#core/cli/command-pipeline";
|
|
33
|
+
import { nodeFilesystem } from "#core/filesystem/node";
|
|
29
34
|
function baseAuditRequest(prelude, opts) {
|
|
30
35
|
return {
|
|
31
36
|
rootDir: prelude.rootDir,
|
|
@@ -110,6 +115,18 @@ const commentsCheck = {
|
|
|
110
115
|
command.option("--fix", "Rewrite every mechanically fixable divider in place", false);
|
|
111
116
|
},
|
|
112
117
|
};
|
|
118
|
+
const publishCheck = {
|
|
119
|
+
name: "publish",
|
|
120
|
+
description: "Report what breaks a consumer's install: #/ imports and exports/imports targets not shipped",
|
|
121
|
+
targetHelp: "Directory or file to scan (default: the repo root)",
|
|
122
|
+
schema: publishAuditRunRequestSchema,
|
|
123
|
+
prepare: preparePublishAudit,
|
|
124
|
+
buildRequest: baseAuditRequest,
|
|
125
|
+
run: (fs, request) => runPublishAudit(fs, { rootDir: request.rootDir, targetPath: request.targetPath }),
|
|
126
|
+
present: presentPublishAuditResult,
|
|
127
|
+
formatJson: formatPublishAuditJsonOutput,
|
|
128
|
+
exitCode: exitCodeForPublishAuditResult,
|
|
129
|
+
};
|
|
113
130
|
/**
|
|
114
131
|
* Adapts an `AuditCheck` descriptor onto the shared command pipeline.
|
|
115
132
|
*/
|
|
@@ -118,7 +135,6 @@ function auditCheckToPipeline(check) {
|
|
|
118
135
|
name: check.name,
|
|
119
136
|
description: check.description,
|
|
120
137
|
positional: { name: "[target]", help: check.targetHelp },
|
|
121
|
-
jsonHelp: "Print one JSON summary on stdout",
|
|
122
138
|
schema: check.schema,
|
|
123
139
|
configureArgv: check.extraOptions,
|
|
124
140
|
prepare: (fs, input) => check.prepare(fs, { currentWorkingDirectory: input.currentWorkingDirectory, rawTarget: input.rawArg }),
|
|
@@ -142,5 +158,6 @@ export function createAuditCommand() {
|
|
|
142
158
|
registerPipelineSubcommand(cmd, nodeFilesystem, auditCheckToPipeline(importsCheck));
|
|
143
159
|
registerPipelineSubcommand(cmd, nodeFilesystem, auditCheckToPipeline(displayNamesCheck));
|
|
144
160
|
registerPipelineSubcommand(cmd, nodeFilesystem, auditCheckToPipeline(commentsCheck));
|
|
161
|
+
registerPipelineSubcommand(cmd, nodeFilesystem, auditCheckToPipeline(publishCheck));
|
|
145
162
|
return cmd;
|
|
146
163
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { AuditCommandPrelude } from "
|
|
2
|
-
import type { AppError } from "
|
|
3
|
-
import type { Filesystem } from "
|
|
4
|
-
import type { Result } from "
|
|
1
|
+
import type { AuditCommandPrelude } from "#audit/prepare";
|
|
2
|
+
import type { 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 comments`.
|
|
7
7
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { CommentAuditResult } from "
|
|
2
|
-
import { AppError } from "
|
|
3
|
-
import type { Filesystem } from "
|
|
4
|
-
import type { Result } from "
|
|
1
|
+
import type { CommentAuditResult } 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
|
* Reports every comment off the repo's conventions: divider form (which `fix` rewrites), banned
|
|
7
7
|
* content — document pointers, JSDoc types, tag misuse — `{@link}` targets nothing declares, and
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import { scanCommentContent } from "
|
|
3
|
-
import { applyCommentDividerFixes, DIVIDER_COLUMN, scanCommentDividers
|
|
4
|
-
import { countHeadMentions, isPathLinkTarget, linkTargetHead, scanLinkReferences, } from "
|
|
5
|
-
import { scanImpossibleSinceTags } from "
|
|
6
|
-
import { scanTsdocSyntax } from "
|
|
7
|
-
import { AppError, messageFrom } from "
|
|
8
|
-
import { err, ok } from "
|
|
9
|
-
import { findNearestPackageVersion } from "
|
|
10
|
-
import { sourceCommentLanguage, walkSourceFiles } from "
|
|
2
|
+
import { scanCommentContent } from "#audit/comments/domain/comment-content";
|
|
3
|
+
import { applyCommentDividerFixes, DIVIDER_COLUMN, scanCommentDividers } from "#audit/comments/domain/comment-dividers";
|
|
4
|
+
import { countHeadMentions, isPathLinkTarget, linkTargetHead, scanLinkReferences, } from "#audit/comments/domain/link-references";
|
|
5
|
+
import { scanImpossibleSinceTags } from "#audit/comments/domain/since-versions";
|
|
6
|
+
import { scanTsdocSyntax } from "#audit/comments/domain/tsdoc-syntax";
|
|
7
|
+
import { AppError, messageFrom } from "#core/errors";
|
|
8
|
+
import { err, ok } from "#core/result";
|
|
9
|
+
import { findNearestPackageVersion } from "#core/workspace/package-version";
|
|
10
|
+
import { sourceCommentLanguage, walkSourceFiles } from "#core/workspace/source-walk";
|
|
11
11
|
const reasonByDefect = {
|
|
12
12
|
"bad-width": `rule does not end at column ${DIVIDER_COLUMN}`,
|
|
13
13
|
"dead-link": "{@link} target has no mention outside links — likely renamed",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** The display-name convention: a name is spelled like the TS symbol it stands for, under its owner's namespace. */
|
|
2
|
-
import type { DisplayNameViolation } from "
|
|
2
|
+
import type { DisplayNameViolation } from "#audit/domain/types";
|
|
3
3
|
/**
|
|
4
4
|
* Scans one source or markdown text for `token()`, `tag()` and module display names that break the convention.
|
|
5
5
|
*
|