@codefast/cli 0.10.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 +84 -0
- package/README.md +66 -41
- package/dist/arrange/command.js +99 -136
- 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 +23 -28
- package/dist/arrange/domain/ast/targets.d.ts +2 -2
- package/dist/arrange/domain/ast/targets.js +9 -9
- package/dist/arrange/{typescript-ast-translator.d.ts → domain/ast/translator.d.ts} +6 -5
- package/dist/arrange/{typescript-ast-translator.js → domain/ast/translator.js} +20 -23
- 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 +7 -0
- package/dist/arrange/group/cli-result.js +12 -0
- package/dist/arrange/group/cli-schema.d.ts +17 -0
- package/dist/arrange/group/cli-schema.js +13 -0
- package/dist/arrange/group/output.d.ts +7 -0
- package/dist/arrange/group/output.js +10 -0
- package/dist/arrange/group/suggest.d.ts +8 -0
- package/dist/arrange/{suggest.js → group/suggest.js} +2 -2
- package/dist/arrange/inspect/cli-result.d.ts +7 -0
- package/dist/arrange/inspect/cli-result.js +8 -0
- package/dist/arrange/inspect/cli-schema.d.ts +15 -0
- package/dist/arrange/inspect/cli-schema.js +9 -0
- package/dist/arrange/{domain → inspect/domain}/analyze-service.d.ts +2 -2
- package/dist/arrange/{domain → inspect/domain}/analyze-service.js +7 -7
- package/dist/arrange/inspect/output.d.ts +7 -0
- package/dist/arrange/inspect/output.js +42 -0
- package/dist/arrange/inspect/run.d.ts +10 -0
- package/dist/arrange/{analyze.js → inspect/run.js} +7 -7
- package/dist/arrange/prepare.d.ts +13 -0
- package/dist/arrange/{workspace.js → prepare.js} +9 -12
- package/dist/arrange/regroup/cli-result.d.ts +13 -0
- package/dist/arrange/regroup/cli-result.js +23 -0
- package/dist/arrange/regroup/cli-schema.d.ts +20 -0
- package/dist/arrange/regroup/cli-schema.js +14 -0
- package/dist/arrange/regroup/output.d.ts +14 -0
- package/dist/arrange/regroup/output.js +72 -0
- package/dist/arrange/{process-file.d.ts → regroup/process-file.d.ts} +3 -3
- package/dist/arrange/{process-file.js → regroup/process-file.js} +3 -3
- package/dist/arrange/regroup/run.d.ts +11 -0
- package/dist/arrange/{sync.js → regroup/run.js} +5 -5
- package/dist/arrange/resolve-target.d.ts +2 -2
- package/dist/arrange/resolve-target.js +2 -2
- package/dist/arrange/scan-target.d.ts +2 -2
- package/dist/arrange/scan-target.js +3 -3
- package/dist/arrange/simplify/cli-result.d.ts +7 -0
- package/dist/arrange/simplify/cli-result.js +8 -0
- package/dist/arrange/simplify/cli-schema.d.ts +17 -0
- package/dist/arrange/simplify/cli-schema.js +11 -0
- package/dist/arrange/simplify/fold-targets.d.ts +13 -0
- package/dist/arrange/simplify/fold-targets.js +139 -0
- package/dist/arrange/simplify/output.d.ts +7 -0
- package/dist/arrange/simplify/output.js +15 -0
- package/dist/arrange/simplify/process-file.d.ts +13 -0
- package/dist/arrange/simplify/process-file.js +49 -0
- package/dist/arrange/simplify/run.d.ts +14 -0
- package/dist/arrange/simplify/run.js +38 -0
- package/dist/arrange/simplify/variant-classname-probe.d.ts +35 -0
- package/dist/arrange/simplify/variant-classname-probe.js +95 -0
- package/dist/arrange/source-parse.d.ts +1 -1
- package/dist/arrange/source-parse.js +3 -3
- package/dist/audit/command.js +152 -212
- package/dist/audit/comments/cli-result.d.ts +13 -0
- package/dist/audit/comments/cli-result.js +22 -0
- package/dist/audit/comments/cli-schema.d.ts +19 -0
- package/dist/audit/comments/cli-schema.js +13 -0
- package/dist/audit/comments/output.d.ts +7 -0
- package/dist/audit/comments/output.js +27 -0
- package/dist/audit/comments/prepare.d.ts +16 -0
- package/dist/audit/comments/prepare.js +12 -0
- package/dist/audit/{run-comments.d.ts → comments/run.d.ts} +5 -5
- package/dist/audit/{run-comments.js → comments/run.js} +9 -9
- package/dist/audit/display-names/cli-result.d.ts +13 -0
- package/dist/audit/display-names/cli-result.js +22 -0
- package/dist/audit/display-names/cli-schema.d.ts +18 -0
- package/dist/audit/display-names/cli-schema.js +12 -0
- package/dist/audit/{domain → display-names/domain}/display-names.d.ts +1 -1
- package/dist/audit/display-names/output.d.ts +7 -0
- package/dist/audit/display-names/output.js +21 -0
- package/dist/audit/display-names/prepare.d.ts +16 -0
- package/dist/audit/display-names/prepare.js +12 -0
- package/dist/audit/display-names/run.d.ts +14 -0
- package/dist/audit/{run-display-names.js → display-names/run.js} +5 -5
- package/dist/audit/domain/types.d.ts +43 -0
- package/dist/audit/imports/cli-result.d.ts +13 -0
- package/dist/audit/imports/cli-result.js +22 -0
- package/dist/audit/imports/cli-schema.d.ts +18 -0
- package/dist/audit/imports/cli-schema.js +12 -0
- package/dist/audit/{domain → imports/domain}/import-policy.d.ts +3 -3
- package/dist/audit/{domain → imports/domain}/import-policy.js +4 -11
- package/dist/audit/imports/output.d.ts +7 -0
- package/dist/audit/imports/output.js +21 -0
- package/dist/audit/imports/prepare.d.ts +16 -0
- package/dist/audit/imports/prepare.js +12 -0
- package/dist/audit/imports/run.d.ts +14 -0
- package/dist/audit/{run-imports.js → imports/run.js} +6 -6
- package/dist/audit/links/cli-result.d.ts +13 -0
- package/dist/audit/links/cli-result.js +22 -0
- package/dist/audit/links/cli-schema.d.ts +18 -0
- package/dist/audit/links/cli-schema.js +12 -0
- package/dist/audit/{domain → links/domain}/markdown-links.d.ts +3 -3
- package/dist/audit/{domain → links/domain}/markdown-links.js +22 -8
- package/dist/audit/links/output.d.ts +7 -0
- package/dist/audit/links/output.js +21 -0
- package/dist/audit/links/prepare.d.ts +16 -0
- package/dist/audit/links/prepare.js +12 -0
- package/dist/audit/links/run.d.ts +14 -0
- package/dist/audit/{run-links.js → links/run.js} +4 -4
- package/dist/audit/prepare.d.ts +13 -52
- package/dist/audit/prepare.js +13 -136
- 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 +13 -0
- package/dist/audit/rtl/cli-result.js +22 -0
- package/dist/audit/rtl/cli-schema.d.ts +18 -0
- package/dist/audit/rtl/cli-schema.js +12 -0
- package/dist/audit/{domain → rtl/domain}/audit-file.d.ts +1 -1
- package/dist/audit/{domain → rtl/domain}/audit-file.js +2 -2
- package/dist/audit/{domain → rtl/domain}/tokenize.d.ts +1 -1
- package/dist/audit/rtl/output.d.ts +7 -0
- package/dist/audit/rtl/output.js +21 -0
- package/dist/audit/rtl/prepare.d.ts +13 -0
- package/dist/audit/rtl/prepare.js +41 -0
- package/dist/audit/rtl/run.d.ts +14 -0
- package/dist/audit/{run.js → 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 +90 -0
- package/dist/core/cli/command-pipeline.js +83 -0
- package/dist/core/cli/format-error.d.ts +1 -1
- package/dist/core/cli/global-options.d.ts +1 -1
- package/dist/core/cli/global-options.js +1 -1
- package/dist/core/cli/resolve-root.d.ts +9 -0
- package/dist/core/cli/resolve-root.js +16 -0
- package/dist/core/cli/result-handle.d.ts +3 -9
- package/dist/core/cli/result-handle.js +4 -17
- package/dist/core/config/define-config.d.ts +1 -1
- package/dist/core/config/loader.d.ts +3 -3
- package/dist/core/config/loader.js +2 -2
- package/dist/core/config/schema.d.ts +1 -1
- package/dist/core/config/schema.js +1 -1
- package/dist/core/config/warnings.js +1 -1
- package/dist/core/config.d.ts +5 -5
- package/dist/core/config.js +4 -4
- package/dist/core/filesystem/{port.d.ts → filesystem.d.ts} +1 -1
- package/dist/core/filesystem/node.d.ts +3 -3
- package/dist/core/filesystem/node.js +1 -1
- package/dist/core/schema-parse.d.ts +2 -2
- package/dist/core/schema-parse.js +2 -2
- package/dist/core/source-text-edit.d.ts +14 -0
- package/dist/core/source-text-edit.js +22 -0
- package/dist/core/workspace/markdown-walk.d.ts +2 -2
- package/dist/core/workspace/markdown-walk.js +1 -1
- package/dist/core/workspace/package-version.d.ts +2 -2
- package/dist/core/workspace/package-version.js +2 -2
- package/dist/core/workspace/resolver.d.ts +3 -3
- package/dist/core/workspace/resolver.js +5 -5
- package/dist/core/workspace/source-walk.d.ts +2 -2
- package/dist/core/workspace/source-walk.js +1 -1
- package/dist/core/workspace/typescript-walk.d.ts +2 -2
- package/dist/core/workspace/typescript-walk.js +1 -1
- package/dist/core/workspace/walk-files.d.ts +2 -2
- 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 +2 -2
- package/dist/mirror/cli-schema.js +1 -1
- package/dist/mirror/command.js +36 -65
- package/dist/mirror/dist-filesystem-node.d.ts +8 -0
- package/dist/mirror/{dist-filesystem-impl.js → dist-filesystem-node.js} +3 -3
- 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 +59 -2
- package/dist/mirror/output.d.ts +1 -3
- package/dist/mirror/output.js +127 -2
- package/dist/mirror/package-path.d.ts +5 -5
- package/dist/mirror/package-path.js +3 -3
- package/dist/mirror/prepare.d.ts +6 -6
- package/dist/mirror/prepare.js +8 -12
- package/dist/mirror/run.d.ts +12 -0
- package/dist/mirror/{sync.js → run.js} +7 -7
- package/dist/mirror/supplement-exports.d.ts +3 -3
- package/dist/mirror/supplement-exports.js +2 -2
- package/dist/mirror/sync-workspace-package.d.ts +4 -4
- package/dist/mirror/sync-workspace-package.js +11 -14
- package/dist/mirror/write-exports.d.ts +3 -3
- 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/cli-schema.d.ts +1 -1
- package/dist/pack-slim/cli-schema.js +1 -1
- package/dist/pack-slim/command.js +36 -71
- 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 +21 -0
- package/dist/pack-slim/prepare.js +14 -0
- package/dist/pack-slim/{sync.d.ts → run.d.ts} +6 -6
- package/dist/pack-slim/{sync.js → 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 +8 -2
- package/dist/tag/cli-result.js +15 -2
- package/dist/tag/cli-schema.d.ts +4 -4
- package/dist/tag/cli-schema.js +3 -4
- package/dist/tag/command.js +34 -61
- package/dist/tag/domain/skip-filter.d.ts +13 -0
- package/dist/tag/domain/skip-filter.js +29 -0
- package/dist/tag/domain/types.d.ts +22 -2
- package/dist/tag/domain/version-summary.d.ts +13 -0
- package/dist/tag/domain/version-summary.js +24 -0
- package/dist/tag/output.d.ts +4 -4
- package/dist/tag/output.js +7 -10
- package/dist/tag/prepare.d.ts +5 -5
- package/dist/tag/prepare.js +5 -5
- package/dist/tag/run.d.ts +10 -0
- package/dist/tag/{sync.js → run.js} +23 -53
- package/dist/tag/target/candidates.d.ts +8 -0
- package/dist/tag/{target-candidates.js → target/candidates.js} +3 -3
- package/dist/tag/{resolve-target-path.d.ts → target/resolve-path.d.ts} +2 -2
- package/dist/tag/target/runner.d.ts +8 -0
- package/dist/tag/{target-runner.js → target/runner.js} +3 -3
- package/dist/tag/{since-writer.d.ts → writer/since-writer.d.ts} +3 -3
- package/dist/tag/{since-writer.js → writer/since-writer.js} +1 -1
- package/dist/tag/{version-resolver.d.ts → writer/version-resolver.d.ts} +2 -2
- package/dist/tag/{version-resolver.js → writer/version-resolver.js} +1 -1
- package/package.json +15 -7
- package/dist/arrange/analyze.d.ts +0 -10
- package/dist/arrange/cli-schema.d.ts +0 -50
- package/dist/arrange/cli-schema.js +0 -34
- package/dist/arrange/output.d.ts +0 -26
- package/dist/arrange/output.js +0 -127
- package/dist/arrange/simplify-process-file.d.ts +0 -11
- package/dist/arrange/simplify-process-file.js +0 -30
- package/dist/arrange/simplify-sync.d.ts +0 -13
- package/dist/arrange/simplify-sync.js +0 -30
- package/dist/arrange/suggest.d.ts +0 -8
- package/dist/arrange/sync.d.ts +0 -11
- package/dist/arrange/workspace.d.ts +0 -13
- package/dist/audit/cli-schema.d.ts +0 -93
- package/dist/audit/cli-schema.js +0 -66
- package/dist/audit/output.d.ts +0 -91
- package/dist/audit/output.js +0 -213
- package/dist/audit/run-display-names.d.ts +0 -14
- package/dist/audit/run-imports.d.ts +0 -14
- package/dist/audit/run-links.d.ts +0 -14
- package/dist/audit/run.d.ts +0 -14
- package/dist/mirror/dist-filesystem-impl.d.ts +0 -8
- package/dist/mirror/sync-reporter.d.ts +0 -60
- package/dist/mirror/sync-reporter.js +0 -128
- package/dist/mirror/sync-types.d.ts +0 -43
- package/dist/mirror/sync-types.js +0 -1
- package/dist/mirror/sync.d.ts +0 -12
- package/dist/tag/sync.d.ts +0 -42
- package/dist/tag/target-candidates.d.ts +0 -8
- package/dist/tag/target-runner.d.ts +0 -8
- /package/dist/audit/{domain → comments/domain}/comment-content.d.ts +0 -0
- /package/dist/audit/{domain → comments/domain}/comment-content.js +0 -0
- /package/dist/audit/{domain → comments/domain}/comment-dividers.d.ts +0 -0
- /package/dist/audit/{domain → comments/domain}/comment-dividers.js +0 -0
- /package/dist/audit/{domain → comments/domain}/link-references.d.ts +0 -0
- /package/dist/audit/{domain → comments/domain}/link-references.js +0 -0
- /package/dist/audit/{domain → comments/domain}/since-versions.d.ts +0 -0
- /package/dist/audit/{domain → comments/domain}/since-versions.js +0 -0
- /package/dist/audit/{domain → comments/domain}/tsdoc-syntax.d.ts +0 -0
- /package/dist/audit/{domain → comments/domain}/tsdoc-syntax.js +0 -0
- /package/dist/audit/{domain → display-names/domain}/display-names.js +0 -0
- /package/dist/audit/{domain → rtl/domain}/mappings.d.ts +0 -0
- /package/dist/audit/{domain → rtl/domain}/mappings.js +0 -0
- /package/dist/audit/{domain → rtl/domain}/tokenize.js +0 -0
- /package/dist/core/filesystem/{port.js → filesystem.js} +0 -0
- /package/dist/tag/{resolve-target-path.js → target/resolve-path.js} +0 -0
package/dist/tag/cli-schema.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as z from "zod";
|
|
2
2
|
/**
|
|
3
|
-
* Zod schema validating a `
|
|
3
|
+
* Zod schema validating a `TagRunRequest`.
|
|
4
4
|
*
|
|
5
5
|
* @since 0.3.16-canary.0
|
|
6
6
|
*/
|
|
7
|
-
export const
|
|
7
|
+
export const tagRunRequestSchema = z.object({
|
|
8
8
|
rootDir: z.string().min(1),
|
|
9
9
|
write: z.boolean(),
|
|
10
|
-
json: z.boolean().optional(),
|
|
11
10
|
targetPath: z.string().optional(),
|
|
12
11
|
skipPackages: z.array(z.string()).optional(),
|
|
13
12
|
config: z.unknown().optional(),
|
package/dist/tag/command.js
CHANGED
|
@@ -1,70 +1,43 @@
|
|
|
1
|
-
import process from "node:process";
|
|
2
1
|
import { Command } from "commander";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
import { applyCommandPipeline } from "#core/cli/command-pipeline";
|
|
3
|
+
import { nodeFilesystem } from "#core/filesystem/node";
|
|
4
|
+
import { exitCodeForTagResult, formatTagJsonOutput } from "#tag/cli-result";
|
|
5
|
+
import { tagRunRequestSchema } from "#tag/cli-schema";
|
|
6
|
+
import { presentTagResult, TagProgressPresenter } from "#tag/output";
|
|
7
|
+
import { prepareTag } from "#tag/prepare";
|
|
8
|
+
import { runTag } from "#tag/run";
|
|
9
|
+
const tagPipeline = {
|
|
10
|
+
positional: { name: "[target]", help: "Directory or file to tag (default: auto-discover workspace packages)" },
|
|
11
|
+
schema: tagRunRequestSchema,
|
|
12
|
+
configureArgv: (command) => {
|
|
13
|
+
command.option("--dry-run", "Show summary without writing files", false);
|
|
14
|
+
},
|
|
15
|
+
prepare: (fs, input) => prepareTag(fs, { currentWorkingDirectory: input.currentWorkingDirectory, rawTarget: input.rawArg }),
|
|
16
|
+
buildRequest: ({ prelude, opts }) => {
|
|
17
|
+
const tagConfig = prelude.config.tag ?? {};
|
|
18
|
+
return {
|
|
19
|
+
rootDir: prelude.rootDir,
|
|
20
|
+
write: !opts.dryRun,
|
|
21
|
+
targetPath: prelude.resolvedTargetPath,
|
|
22
|
+
skipPackages: tagConfig.skipPackages,
|
|
23
|
+
config: tagConfig,
|
|
24
|
+
};
|
|
25
|
+
},
|
|
26
|
+
createPresenter: () => new TagProgressPresenter(),
|
|
27
|
+
run: (fs, request, presenter) => runTag(fs, { ...request, listener: presenter }),
|
|
28
|
+
presentHuman: ({ result, prelude }) => {
|
|
29
|
+
presentTagResult(result, prelude.rootDir);
|
|
30
|
+
},
|
|
31
|
+
formatJson: ({ result, prelude }) => formatTagJsonOutput(result, prelude.rootDir),
|
|
32
|
+
exitCode: exitCodeForTagResult,
|
|
33
|
+
};
|
|
13
34
|
/**
|
|
14
35
|
* Creates the `tag` subcommand, which stamps `@since` tags on exported declarations.
|
|
15
36
|
*
|
|
16
37
|
* @since 0.3.16-canary.0
|
|
17
38
|
*/
|
|
18
39
|
export function createTagCommand() {
|
|
19
|
-
const cmd = new Command("tag")
|
|
20
|
-
|
|
21
|
-
.argument("[target]", "Directory or file to tag (default: auto-discover workspace packages)")
|
|
22
|
-
.option("--dry-run", "Show summary without writing files", false)
|
|
23
|
-
.option("--json", "Print one JSON summary on stdout (suppresses human progress)", false)
|
|
24
|
-
.action(async (target, opts) => {
|
|
25
|
-
const prelude = await prepareTagSync(nodeFilesystem, {
|
|
26
|
-
currentWorkingDirectory: process.cwd(),
|
|
27
|
-
rawTarget: readOptionalPositionalArg(target),
|
|
28
|
-
});
|
|
29
|
-
if (!consumeCliAppError(prelude)) {
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
const { rootDir, config, resolvedTargetPath } = prelude.value;
|
|
33
|
-
const tagConfig = config.tag ?? {};
|
|
34
|
-
const parsed = parseWithSchema(tagSyncRunRequestSchema, {
|
|
35
|
-
rootDir,
|
|
36
|
-
write: !opts.dryRun,
|
|
37
|
-
json: opts.json,
|
|
38
|
-
targetPath: resolvedTargetPath,
|
|
39
|
-
skipPackages: tagConfig.skipPackages,
|
|
40
|
-
config: tagConfig,
|
|
41
|
-
});
|
|
42
|
-
if (!consumeCliAppError(parsed)) {
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
const progressPresenter = new TagSyncProgressPresenter();
|
|
46
|
-
const tagOutcome = await runTagSync(nodeFilesystem, {
|
|
47
|
-
...parsed.value,
|
|
48
|
-
listener: parsed.value.json ? undefined : progressPresenter,
|
|
49
|
-
});
|
|
50
|
-
if (!consumeCliAppError(tagOutcome)) {
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
if (parsed.value.json) {
|
|
54
|
-
logger.out(formatTagSyncJsonOutput(tagOutcome.value, rootDir));
|
|
55
|
-
process.exitCode = exitCodeForTagSyncResult(tagOutcome.value);
|
|
56
|
-
}
|
|
57
|
-
else {
|
|
58
|
-
process.exitCode = presentTagSyncResult(tagOutcome.value, rootDir);
|
|
59
|
-
}
|
|
60
|
-
});
|
|
40
|
+
const cmd = new Command("tag").description("Add @since <version> JSDoc tags to exported declarations");
|
|
41
|
+
applyCommandPipeline(cmd, nodeFilesystem, tagPipeline);
|
|
61
42
|
return cmd;
|
|
62
|
-
}
|
|
63
|
-
function formatTagSyncJsonOutput(result, rootDir) {
|
|
64
|
-
return JSON.stringify({
|
|
65
|
-
schemaVersion: 1,
|
|
66
|
-
ok: result.hookError === null,
|
|
67
|
-
cwd: rootDir,
|
|
68
|
-
result,
|
|
69
|
-
});
|
|
70
43
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { TagTargetCandidate } from "#tag/domain/types";
|
|
2
|
+
/**
|
|
3
|
+
* Partitions tag target candidates into those to tag and those to skip, matching each candidate's
|
|
4
|
+
* package name against `skipPackages` as glob patterns.
|
|
5
|
+
*
|
|
6
|
+
* @remarks Candidates without a package name (e.g. an explicit-target path) are never skipped.
|
|
7
|
+
*
|
|
8
|
+
* @since 0.5.0-canary.0
|
|
9
|
+
*/
|
|
10
|
+
export declare function filterSkippedCandidates(targetCandidates: Array<TagTargetCandidate>, skipPackages: ReadonlyArray<string> | undefined): {
|
|
11
|
+
includedCandidates: Array<TagTargetCandidate>;
|
|
12
|
+
skippedPackages: Array<string>;
|
|
13
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { createAnyGlobMatcher } from "#core/glob";
|
|
2
|
+
/**
|
|
3
|
+
* Partitions tag target candidates into those to tag and those to skip, matching each candidate's
|
|
4
|
+
* package name against `skipPackages` as glob patterns.
|
|
5
|
+
*
|
|
6
|
+
* @remarks Candidates without a package name (e.g. an explicit-target path) are never skipped.
|
|
7
|
+
*
|
|
8
|
+
* @since 0.5.0-canary.0
|
|
9
|
+
*/
|
|
10
|
+
export function filterSkippedCandidates(targetCandidates, skipPackages) {
|
|
11
|
+
if (!skipPackages || skipPackages.length === 0) {
|
|
12
|
+
return {
|
|
13
|
+
includedCandidates: targetCandidates,
|
|
14
|
+
skippedPackages: [],
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
const isSkipped = createAnyGlobMatcher(skipPackages);
|
|
18
|
+
const includedCandidates = [];
|
|
19
|
+
const skippedPackages = [];
|
|
20
|
+
for (const candidate of targetCandidates) {
|
|
21
|
+
const packageName = candidate.packageName;
|
|
22
|
+
if (packageName && isSkipped(packageName)) {
|
|
23
|
+
skippedPackages.push(packageName);
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
includedCandidates.push(candidate);
|
|
27
|
+
}
|
|
28
|
+
return { includedCandidates, skippedPackages };
|
|
29
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CodefastConfig } from "
|
|
1
|
+
import type { CodefastConfig } from "#core/config/schema";
|
|
2
2
|
/**
|
|
3
3
|
* Per-file outcome of a tag run.
|
|
4
4
|
*
|
|
@@ -85,7 +85,7 @@ export interface TagProgressListener {
|
|
|
85
85
|
*
|
|
86
86
|
* @since 0.3.16-canary.0
|
|
87
87
|
*/
|
|
88
|
-
export type
|
|
88
|
+
export type TagResult = {
|
|
89
89
|
mode: "applied" | "dry-run";
|
|
90
90
|
selectedTargets: Array<TagResolvedTarget>;
|
|
91
91
|
skippedPackages: Array<string>;
|
|
@@ -108,4 +108,24 @@ export interface TagCommandPrelude {
|
|
|
108
108
|
readonly config: CodefastConfig;
|
|
109
109
|
readonly resolvedTargetPath: string | undefined;
|
|
110
110
|
}
|
|
111
|
+
/**
|
|
112
|
+
* The inputs a tag run is invoked with.
|
|
113
|
+
*
|
|
114
|
+
* @since 0.3.16-canary.0
|
|
115
|
+
*/
|
|
116
|
+
export type TagRunRequest = {
|
|
117
|
+
rootDir: string;
|
|
118
|
+
write: boolean;
|
|
119
|
+
targetPath?: string | undefined;
|
|
120
|
+
skipPackages?: Array<string> | undefined;
|
|
121
|
+
config?: unknown;
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* A run request paired with an optional progress listener.
|
|
125
|
+
*
|
|
126
|
+
* @since 0.3.16-canary.0
|
|
127
|
+
*/
|
|
128
|
+
export type TagExecutionInput = TagRunRequest & {
|
|
129
|
+
readonly listener?: TagProgressListener | undefined;
|
|
130
|
+
};
|
|
111
131
|
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { TagTargetExecutionResult } from "#tag/domain/types";
|
|
2
|
+
/**
|
|
3
|
+
* Collects the distinct, non-empty package versions stamped across a run's target results.
|
|
4
|
+
*
|
|
5
|
+
* @since 0.11.0
|
|
6
|
+
*/
|
|
7
|
+
export declare function extractDistinctVersions(targetResults: Array<TagTargetExecutionResult>): Set<string>;
|
|
8
|
+
/**
|
|
9
|
+
* Summarizes a set of versions as `"none"`, the single version, or `"mixed"`.
|
|
10
|
+
*
|
|
11
|
+
* @since 0.11.0
|
|
12
|
+
*/
|
|
13
|
+
export declare function summarizeVersions(distinctVersions: Set<string>): string;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Collects the distinct, non-empty package versions stamped across a run's target results.
|
|
3
|
+
*
|
|
4
|
+
* @since 0.11.0
|
|
5
|
+
*/
|
|
6
|
+
export function extractDistinctVersions(targetResults) {
|
|
7
|
+
return new Set(targetResults
|
|
8
|
+
.map((targetResult) => targetResult.result?.version)
|
|
9
|
+
.filter((version) => typeof version === "string" && version.length > 0));
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Summarizes a set of versions as `"none"`, the single version, or `"mixed"`.
|
|
13
|
+
*
|
|
14
|
+
* @since 0.11.0
|
|
15
|
+
*/
|
|
16
|
+
export function summarizeVersions(distinctVersions) {
|
|
17
|
+
if (distinctVersions.size === 0) {
|
|
18
|
+
return "none";
|
|
19
|
+
}
|
|
20
|
+
if (distinctVersions.size > 1) {
|
|
21
|
+
return "mixed";
|
|
22
|
+
}
|
|
23
|
+
return distinctVersions.values().next().value ?? "none";
|
|
24
|
+
}
|
package/dist/tag/output.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import type { TagProgressListener, TagResolvedTarget,
|
|
1
|
+
import type { TagProgressListener, TagResolvedTarget, TagResult, TagTargetExecutionResult } from "#tag/domain/types";
|
|
2
2
|
/**
|
|
3
3
|
* A progress listener that prints a line as each tag target starts and completes.
|
|
4
4
|
*
|
|
5
5
|
* @since 0.3.16-canary.0
|
|
6
6
|
*/
|
|
7
|
-
export declare class
|
|
7
|
+
export declare class TagProgressPresenter implements TagProgressListener {
|
|
8
8
|
onTargetStarted(target: TagResolvedTarget): void;
|
|
9
9
|
onTargetCompleted(target: TagResolvedTarget, result: TagTargetExecutionResult): void;
|
|
10
10
|
private static formatProgress;
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
|
-
* Prints a tag run's target table, warnings, and summary
|
|
13
|
+
* Prints a tag run's target table, warnings, and summary to the human reader.
|
|
14
14
|
*
|
|
15
15
|
* @since 0.3.16-canary.0
|
|
16
16
|
*/
|
|
17
|
-
export declare function
|
|
17
|
+
export declare function presentTagResult(result: TagResult, rootDir: string): void;
|
package/dist/tag/output.js
CHANGED
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { logger } from "#/core/logger";
|
|
3
|
-
import { exitCodeForTagSyncResult } from "#/tag/cli-result";
|
|
1
|
+
import { logger } from "#core/logger";
|
|
4
2
|
/**
|
|
5
3
|
* A progress listener that prints a line as each tag target starts and completes.
|
|
6
4
|
*
|
|
7
5
|
* @since 0.3.16-canary.0
|
|
8
6
|
*/
|
|
9
|
-
export class
|
|
7
|
+
export class TagProgressPresenter {
|
|
10
8
|
onTargetStarted(target) {
|
|
11
|
-
logger.out(
|
|
9
|
+
logger.out(TagProgressPresenter.formatProgress({ type: "target-started", target }));
|
|
12
10
|
}
|
|
13
11
|
onTargetCompleted(target, result) {
|
|
14
|
-
logger.out(
|
|
12
|
+
logger.out(TagProgressPresenter.formatProgress({ type: "target-completed", target, result }));
|
|
15
13
|
}
|
|
16
14
|
static formatProgress(event) {
|
|
17
15
|
const targetDisplayName = (target) => target.packageName ?? target.rootRelativeTargetPath;
|
|
@@ -29,22 +27,21 @@ const colors = {
|
|
|
29
27
|
yellow: "\x1b[33m",
|
|
30
28
|
};
|
|
31
29
|
/**
|
|
32
|
-
* Prints a tag run's target table, warnings, and summary
|
|
30
|
+
* Prints a tag run's target table, warnings, and summary to the human reader.
|
|
33
31
|
*
|
|
34
32
|
* @since 0.3.16-canary.0
|
|
35
33
|
*/
|
|
36
|
-
export function
|
|
34
|
+
export function presentTagResult(result, rootDir) {
|
|
37
35
|
logger.out(formatTargetTable(result.selectedTargets, rootDir));
|
|
38
36
|
if (result.selectedTargets.length === 0) {
|
|
39
37
|
logger.err("No packages found in workspace. Check your pnpm-workspace.yaml or provide an explicit target path.");
|
|
40
|
-
return
|
|
38
|
+
return;
|
|
41
39
|
}
|
|
42
40
|
const warningsAndErrorsSection = formatWarningsAndErrors(result);
|
|
43
41
|
if (warningsAndErrorsSection) {
|
|
44
42
|
logger.err(warningsAndErrorsSection);
|
|
45
43
|
}
|
|
46
44
|
logger.out(formatSummary(result));
|
|
47
|
-
return exitCodeForTagSyncResult(result);
|
|
48
45
|
}
|
|
49
46
|
function withColorizedLine(line, colorCode) {
|
|
50
47
|
return `${colorCode}${line}${colorReset}`;
|
package/dist/tag/prepare.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import type { AppError } from "
|
|
2
|
-
import type {
|
|
3
|
-
import type { Result } from "
|
|
4
|
-
import type { TagCommandPrelude } from "
|
|
1
|
+
import type { AppError } from "#core/errors";
|
|
2
|
+
import type { Filesystem } from "#core/filesystem/filesystem";
|
|
3
|
+
import type { Result } from "#core/result";
|
|
4
|
+
import type { TagCommandPrelude } from "#tag/domain/types";
|
|
5
5
|
/**
|
|
6
6
|
* Resolves the repo root, config, and optional target path into the prelude a tag run starts from.
|
|
7
7
|
*
|
|
8
8
|
* @since 0.3.16-canary.0
|
|
9
9
|
*/
|
|
10
|
-
export declare function
|
|
10
|
+
export declare function prepareTag(fs: Filesystem, args: {
|
|
11
11
|
readonly currentWorkingDirectory: string;
|
|
12
12
|
readonly rawTarget: string | undefined;
|
|
13
13
|
}): Promise<Result<TagCommandPrelude, AppError>>;
|
package/dist/tag/prepare.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { loadCodefastConfig } from "
|
|
2
|
-
import { ok } from "
|
|
3
|
-
import { resolveProjectRoot } from "
|
|
4
|
-
import { resolveProvidedTagTargetPath } from "
|
|
1
|
+
import { loadCodefastConfig } from "#core/config";
|
|
2
|
+
import { ok } from "#core/result";
|
|
3
|
+
import { resolveProjectRoot } from "#core/workspace/resolver";
|
|
4
|
+
import { resolveProvidedTagTargetPath } from "#tag/target/resolve-path";
|
|
5
5
|
/**
|
|
6
6
|
* Resolves the repo root, config, and optional target path into the prelude a tag run starts from.
|
|
7
7
|
*
|
|
8
8
|
* @since 0.3.16-canary.0
|
|
9
9
|
*/
|
|
10
|
-
export async function
|
|
10
|
+
export async function prepareTag(fs, args) {
|
|
11
11
|
let rootDir;
|
|
12
12
|
try {
|
|
13
13
|
rootDir = resolveProjectRoot(args.currentWorkingDirectory, fs).rootDir;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AppError } from "#core/errors";
|
|
2
|
+
import type { Filesystem } from "#core/filesystem/filesystem";
|
|
3
|
+
import type { Result } from "#core/result";
|
|
4
|
+
import type { TagExecutionInput, TagResult } from "#tag/domain/types";
|
|
5
|
+
/**
|
|
6
|
+
* Applies `@since` tags across the selected targets and returns the aggregate result.
|
|
7
|
+
*
|
|
8
|
+
* @since 0.3.16-canary.0
|
|
9
|
+
*/
|
|
10
|
+
export declare function runTag(fs: Filesystem, input: TagExecutionInput): Promise<Result<TagResult, AppError>>;
|
|
@@ -1,26 +1,37 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import { AppError } from "
|
|
3
|
-
import { messageFrom } from "
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
2
|
+
import { AppError } from "#core/errors";
|
|
3
|
+
import { messageFrom } from "#core/errors";
|
|
4
|
+
import { err, ok } from "#core/result";
|
|
5
|
+
import { filterSkippedCandidates } from "#tag/domain/skip-filter";
|
|
6
|
+
import { extractDistinctVersions, summarizeVersions } from "#tag/domain/version-summary";
|
|
7
|
+
import { resolveTagTargetCandidates } from "#tag/target/candidates";
|
|
8
|
+
import { runTagOnTarget } from "#tag/target/runner";
|
|
8
9
|
/**
|
|
9
|
-
*
|
|
10
|
+
* Applies `@since` tags across the selected targets and returns the aggregate result.
|
|
10
11
|
*
|
|
11
12
|
* @since 0.3.16-canary.0
|
|
12
13
|
*/
|
|
13
|
-
export async function
|
|
14
|
+
export async function runTag(fs, input) {
|
|
14
15
|
try {
|
|
15
16
|
const tagConfig = input.config;
|
|
16
17
|
const targetCandidates = await resolveTagTargetCandidates(fs, input.rootDir, input.targetPath);
|
|
17
18
|
const { includedCandidates, skippedPackages } = filterSkippedCandidates(targetCandidates, input.skipPackages);
|
|
18
19
|
const selectedTargets = includedCandidates.map((candidate) => resolveTargetSelection(fs, candidate, input.rootDir));
|
|
19
20
|
const targetExecutionResults = await Promise.all(selectedTargets.map((resolvedTarget) => runOnResolvedTarget(fs, resolvedTarget, input.write, input.listener)));
|
|
20
|
-
const allFileResults =
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
const allFileResults = [];
|
|
22
|
+
let filesScanned = 0;
|
|
23
|
+
let filesChanged = 0;
|
|
24
|
+
let taggedDeclarations = 0;
|
|
25
|
+
for (const targetResult of targetExecutionResults) {
|
|
26
|
+
const runResult = targetResult.result;
|
|
27
|
+
if (runResult === null) {
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
allFileResults.push(...runResult.fileResults);
|
|
31
|
+
filesScanned += runResult.filesScanned;
|
|
32
|
+
filesChanged += runResult.filesChanged;
|
|
33
|
+
taggedDeclarations += runResult.taggedDeclarations;
|
|
34
|
+
}
|
|
24
35
|
const modifiedFiles = allFileResults.filter((entry) => entry.changed).map((entry) => entry.filePath);
|
|
25
36
|
const hookError = input.write && modifiedFiles.length > 0
|
|
26
37
|
? await runTagOnAfterWriteHook(tagConfig?.onAfterWrite, modifiedFiles)
|
|
@@ -57,20 +68,6 @@ async function runTagOnAfterWriteHook(hook, modifiedFiles) {
|
|
|
57
68
|
return `[tag] onAfterWrite hook failed: ${messageFrom(caughtHookError)}`;
|
|
58
69
|
}
|
|
59
70
|
}
|
|
60
|
-
function summarizeVersions(distinctVersions) {
|
|
61
|
-
if (distinctVersions.size === 0) {
|
|
62
|
-
return "none";
|
|
63
|
-
}
|
|
64
|
-
if (distinctVersions.size > 1) {
|
|
65
|
-
return "mixed";
|
|
66
|
-
}
|
|
67
|
-
return distinctVersions.values().next().value ?? "none";
|
|
68
|
-
}
|
|
69
|
-
function extractDistinctVersions(targetResults) {
|
|
70
|
-
return new Set(targetResults
|
|
71
|
-
.map((targetResult) => targetResult.result?.version)
|
|
72
|
-
.filter((version) => typeof version === "string" && version.length > 0));
|
|
73
|
-
}
|
|
74
71
|
function chooseWorkspacePackageTargetPath(fs, candidate) {
|
|
75
72
|
if (candidate.source !== "workspace-package") {
|
|
76
73
|
return {
|
|
@@ -103,33 +100,6 @@ function resolveTargetSelection(fs, candidate, rootDir) {
|
|
|
103
100
|
packageName: candidate.packageName,
|
|
104
101
|
};
|
|
105
102
|
}
|
|
106
|
-
/**
|
|
107
|
-
* Partition tag target candidates into those to tag and those to skip, matching
|
|
108
|
-
* each candidate's package name against `skipPackages` as glob patterns.
|
|
109
|
-
* Candidates without a package name (e.g. an explicit-target path) are never skipped.
|
|
110
|
-
*
|
|
111
|
-
* @since 0.5.0-canary.0
|
|
112
|
-
*/
|
|
113
|
-
export function filterSkippedCandidates(targetCandidates, skipPackages) {
|
|
114
|
-
if (!skipPackages || skipPackages.length === 0) {
|
|
115
|
-
return {
|
|
116
|
-
includedCandidates: targetCandidates,
|
|
117
|
-
skippedPackages: [],
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
const isSkipped = createAnyGlobMatcher(skipPackages);
|
|
121
|
-
const includedCandidates = [];
|
|
122
|
-
const skippedPackages = [];
|
|
123
|
-
for (const candidate of targetCandidates) {
|
|
124
|
-
const packageName = candidate.packageName;
|
|
125
|
-
if (packageName && isSkipped(packageName)) {
|
|
126
|
-
skippedPackages.push(packageName);
|
|
127
|
-
continue;
|
|
128
|
-
}
|
|
129
|
-
includedCandidates.push(candidate);
|
|
130
|
-
}
|
|
131
|
-
return { includedCandidates, skippedPackages };
|
|
132
|
-
}
|
|
133
103
|
async function runOnResolvedTarget(fs, resolvedTarget, write, listener) {
|
|
134
104
|
listener?.onTargetStarted(resolvedTarget);
|
|
135
105
|
const absoluteTargetPath = path.resolve(resolvedTarget.targetPath);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Filesystem } from "#core/filesystem/filesystem";
|
|
2
|
+
import type { TagTargetCandidate } from "#tag/domain/types";
|
|
3
|
+
/**
|
|
4
|
+
* Resolves the candidate targets for a tag run: the explicit target, or the discovered workspace packages.
|
|
5
|
+
*
|
|
6
|
+
* @since 0.3.16-canary.0
|
|
7
|
+
*/
|
|
8
|
+
export declare function resolveTagTargetCandidates(fs: Filesystem, rootDir: string, explicitTarget: string | undefined): Promise<Array<TagTargetCandidate>>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import
|
|
3
|
-
import { listWorkspacePackageDirectories } from "
|
|
4
|
-
import { packageJsonFileName } from "
|
|
2
|
+
import * as z from "zod";
|
|
3
|
+
import { listWorkspacePackageDirectories } from "#core/workspace/resolver";
|
|
4
|
+
import { packageJsonFileName } from "#core/workspace/well-known-files";
|
|
5
5
|
const packageJsonNameSchema = z.looseObject({
|
|
6
6
|
name: z.string().min(1).optional(),
|
|
7
7
|
});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Filesystem } from "#core/filesystem/filesystem";
|
|
2
2
|
/**
|
|
3
3
|
* Canonicalizes the user-provided target path, or returns `undefined` when none was given.
|
|
4
4
|
*
|
|
5
5
|
* @since 0.3.16-canary.0
|
|
6
6
|
*/
|
|
7
|
-
export declare function resolveProvidedTagTargetPath(fs:
|
|
7
|
+
export declare function resolveProvidedTagTargetPath(fs: Filesystem, args: {
|
|
8
8
|
readonly currentWorkingDirectory: string;
|
|
9
9
|
readonly rawTarget: string | undefined;
|
|
10
10
|
}): string | undefined;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Filesystem } from "#core/filesystem/filesystem";
|
|
2
|
+
import type { TagRunOptions, TagRunResult } from "#tag/domain/types";
|
|
3
|
+
/**
|
|
4
|
+
* Stamps `@since` tags across one target's TypeScript files and returns the run result.
|
|
5
|
+
*
|
|
6
|
+
* @since 0.3.16-canary.0
|
|
7
|
+
*/
|
|
8
|
+
export declare function runTagOnTarget(fs: Filesystem, targetPath: string, opts: TagRunOptions): TagRunResult;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import { walkTsxFiles } from "
|
|
3
|
-
import { TagSinceWriter } from "
|
|
4
|
-
import { resolveNearestPackageVersion } from "
|
|
2
|
+
import { walkTsxFiles } from "#core/workspace/typescript-walk";
|
|
3
|
+
import { TagSinceWriter } from "#tag/writer/since-writer";
|
|
4
|
+
import { resolveNearestPackageVersion } from "#tag/writer/version-resolver";
|
|
5
5
|
/**
|
|
6
6
|
* Stamps `@since` tags across one target's TypeScript files and returns the run result.
|
|
7
7
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { TagFileResult } from "
|
|
1
|
+
import type { Filesystem } from "#core/filesystem/filesystem";
|
|
2
|
+
import type { TagFileResult } from "#tag/domain/types";
|
|
3
3
|
/**
|
|
4
4
|
* The writer that adds missing `@since` tags to a file's exported declarations.
|
|
5
5
|
*
|
|
@@ -8,7 +8,7 @@ import type { TagFileResult } from "#/tag/domain/types";
|
|
|
8
8
|
export declare class TagSinceWriter {
|
|
9
9
|
private readonly fs;
|
|
10
10
|
private readonly sinceDocumentationTag;
|
|
11
|
-
constructor(fs:
|
|
11
|
+
constructor(fs: Filesystem);
|
|
12
12
|
applySinceTagsToFile(filePath: string, version: string, write: boolean): TagFileResult;
|
|
13
13
|
/**
|
|
14
14
|
* The taggable declaration a top-level statement introduces, resolving the
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { parseSync } from "oxc-parser";
|
|
2
|
-
import { applyEditsDescending, indentOfLineContaining } from "
|
|
2
|
+
import { applyEditsDescending, indentOfLineContaining } from "#core/source-text-edit";
|
|
3
3
|
/**
|
|
4
4
|
* Top-level statement kinds that carry a `@since` tag: function, class, interface,
|
|
5
5
|
* type alias, enum, and variable declaration.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Filesystem } from "#core/filesystem/filesystem";
|
|
2
2
|
/**
|
|
3
3
|
* Returns the `version` of the nearest enclosing `package.json` above a target path.
|
|
4
4
|
*
|
|
5
5
|
* @since 0.3.16-canary.0
|
|
6
6
|
*/
|
|
7
|
-
export declare function resolveNearestPackageVersion(fs:
|
|
7
|
+
export declare function resolveNearestPackageVersion(fs: Filesystem, targetPath: string): string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codefast/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "Developer CLI for the Codefast monorepo (arrange, audit, mirror, pack-slim, tag)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"module": "./dist/index.js",
|
|
36
36
|
"types": "./dist/index.d.ts",
|
|
37
37
|
"imports": {
|
|
38
|
-
"
|
|
38
|
+
"#*": {
|
|
39
39
|
"types": "./dist/*.d.ts",
|
|
40
40
|
"default": "./dist/*.js"
|
|
41
41
|
}
|
|
@@ -51,15 +51,23 @@
|
|
|
51
51
|
"access": "public"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@microsoft/tsdoc": "^0.
|
|
54
|
+
"@microsoft/tsdoc": "^0.17.0",
|
|
55
55
|
"commander": "^15.0.0",
|
|
56
56
|
"jiti": "^2.7.0",
|
|
57
|
-
"oxc-parser": "^0.
|
|
57
|
+
"oxc-parser": "^0.150.0",
|
|
58
58
|
"picomatch": "^4.0.7",
|
|
59
|
-
"yaml": "^2.9.
|
|
60
|
-
"zod": "^4.5
|
|
59
|
+
"yaml": "^2.9.1",
|
|
60
|
+
"zod": "^4.6.5"
|
|
61
|
+
},
|
|
62
|
+
"peerDependencies": {
|
|
63
|
+
"typescript": "^7.0.2"
|
|
64
|
+
},
|
|
65
|
+
"peerDependenciesMeta": {
|
|
66
|
+
"typescript": {
|
|
67
|
+
"optional": true
|
|
68
|
+
}
|
|
61
69
|
},
|
|
62
70
|
"engines": {
|
|
63
|
-
"node": ">=
|
|
71
|
+
"node": ">=22.12.0"
|
|
64
72
|
}
|
|
65
73
|
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { AnalyzeReport } from "#/arrange/domain/types";
|
|
2
|
-
import { AppError } from "#/core/errors";
|
|
3
|
-
import type { FilesystemPort } from "#/core/filesystem/port";
|
|
4
|
-
import type { Result } from "#/core/result";
|
|
5
|
-
/**
|
|
6
|
-
* Scans a directory's arrange targets and returns the accumulated analyze report.
|
|
7
|
-
*
|
|
8
|
-
* @since 0.3.16-canary.0
|
|
9
|
-
*/
|
|
10
|
-
export declare function analyzeDirectory(fs: FilesystemPort, analyzeRootPath: string): Result<AnalyzeReport, AppError>;
|