@savvy-web/silk-effects 3.3.0 → 4.0.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/changesets/changelog/getReleaseLine.js +1 -1
- package/changesets/constants.js +0 -18
- package/changesets/index.js +10 -24
- package/changesets/schemas/changeset.js +8 -4
- package/changesets/schemas/dependency-table.js +15 -4
- package/changesets/schemas/git.js +7 -2
- package/changesets/schemas/github.js +4 -4
- package/changesets/schemas/options.js +3 -3
- package/changesets/schemas/package-scope.js +2 -5
- package/changesets/schemas/primitives.js +2 -2
- package/changesets/schemas/release-plan.js +12 -8
- package/changesets/schemas/version-files.js +4 -4
- package/changesets/services/branch-analyzer.js +60 -191
- package/changesets/services/changelog.js +2 -15
- package/changesets/services/config-inspector.js +109 -75
- package/changesets/services/deps-regen.js +58 -32
- package/changesets/services/github.js +3 -16
- package/changesets/services/maintenance-reason.js +5 -1
- package/changesets/services/markdown.js +3 -16
- package/changesets/services/release-planner.js +4 -13
- package/changesets/utils/commit-parser.js +0 -18
- package/changesets/utils/dep-diff.js +0 -27
- package/changesets/utils/git.js +15 -50
- package/changesets/utils/issue-refs.js +0 -13
- package/changesets/utils/logger.js +0 -13
- package/changesets/utils/markdown-link.js +0 -14
- package/changesets/utils/publishability.js +11 -24
- package/changesets/utils/strip-frontmatter.js +0 -19
- package/changesets/utils/version-files.js +85 -51
- package/commitlint/config/schema.js +9 -5
- package/commitlint/detection/scopes.js +2 -7
- package/commitlint/formatter/messages.js +0 -5
- package/commitlint/hook/diagnostics/branch.js +12 -12
- package/commitlint/hook/diagnostics/open-issues.js +13 -7
- package/commitlint/hook/diagnostics/signing.js +30 -37
- package/commitlint/hook/envelope.js +2 -8
- package/commitlint/hook/silence-logger.js +14 -12
- package/index.d.ts +899 -934
- package/lint/cli/templates/markdownlint.gen.js +0 -9
- package/lint/handlers/PnpmWorkspace.js +26 -12
- package/lint/utils/Filter.js +0 -13
- package/lint/utils/Workspace.js +10 -6
- package/package.json +11 -10
- package/repos/index.js +3 -5
- package/repos/schemas/manifest.js +7 -13
- package/repos/schemas/reports.js +5 -1
- package/repos/services/config-store.js +6 -10
- package/repos/services/manager.js +52 -112
- package/schemas/CommentStyle.js +1 -1
- package/schemas/ResolvedTool.js +52 -17
- package/schemas/SectionBlock.js +1 -1
- package/schemas/SectionDefinition.js +2 -2
- package/schemas/TagStrategySchemas.js +1 -1
- package/schemas/ToolDefinition.js +1 -1
- package/schemas/ToolResults.js +1 -1
- package/schemas/VersioningSchemas.js +28 -9
- package/schemas/WorkspaceAnalysisSchemas.js +27 -17
- package/services/BiomeSchemaSync.js +7 -8
- package/services/ChangesetConfig.js +2 -2
- package/services/ChangesetConfigReader.js +7 -8
- package/services/ConfigDiscovery.js +5 -6
- package/services/ManagedSection.js +3 -4
- package/services/SilkPublishability.js +38 -15
- package/services/SilkWorkspaceAnalyzer.js +7 -9
- package/services/TagStrategy.js +3 -3
- package/services/ToolDiscovery.js +22 -21
- package/services/VersioningStrategy.js +2 -2
- package/tsdoc-metadata.json +1 -1
- package/turbo/schemas/DryRun.js +8 -14
- package/turbo/schemas/results.js +8 -8
- package/turbo/services/TurboInspector.js +30 -23
- package/utils/ToolCommand.js +38 -12
|
@@ -77,7 +77,7 @@ function getReleaseLine(changeset, versionType, options) {
|
|
|
77
77
|
if (changeset.commit) commitInfo = yield* (yield* GitHubService).getInfo({
|
|
78
78
|
commit: changeset.commit,
|
|
79
79
|
repo: options.repo
|
|
80
|
-
}).pipe(Effect.flatMap((raw) => Schema.
|
|
80
|
+
}).pipe(Effect.flatMap((raw) => Schema.decodeUnknownEffect(GitHubInfoSchema)(raw).pipe(Effect.map(() => raw), Effect.catch(() => Effect.succeed(raw)))), Effect.catch((error) => {
|
|
81
81
|
logWarning("Could not fetch GitHub info for commit:", changeset.commit ?? "", String(error));
|
|
82
82
|
return Effect.succeed(null);
|
|
83
83
|
}));
|
package/changesets/constants.js
CHANGED
|
@@ -1,22 +1,4 @@
|
|
|
1
1
|
//#region src/changesets/constants.ts
|
|
2
|
-
/**
|
|
3
|
-
* Constants for changeset lint rule documentation URLs.
|
|
4
|
-
*
|
|
5
|
-
* @remarks
|
|
6
|
-
* Each lint rule in the \@savvy-web/changesets remark-lint plugin has a
|
|
7
|
-
* corresponding documentation page hosted on GitHub. These URLs are
|
|
8
|
-
* referenced in lint diagnostic messages to help users understand and
|
|
9
|
-
* resolve validation errors.
|
|
10
|
-
*
|
|
11
|
-
* Rule codes follow the `CSH` prefix convention:
|
|
12
|
-
* - `CSH001` -- Changeset heading validation
|
|
13
|
-
* - `CSH002` -- Changeset summary validation
|
|
14
|
-
* - `CSH003` -- Dependency table structure validation
|
|
15
|
-
* - `CSH004` -- Changeset body content validation
|
|
16
|
-
* - `CSH005` -- Frontmatter validation
|
|
17
|
-
*
|
|
18
|
-
* @internal
|
|
19
|
-
*/
|
|
20
2
|
/** Base URL for rule documentation on GitHub. */
|
|
21
3
|
const DOCS_BASE = "https://github.com/savvy-web/changesets/blob/main/docs/rules";
|
|
22
4
|
/**
|
package/changesets/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { __exportAll } from "../_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { Categories } from "./api/categories.js";
|
|
3
|
-
import { ChangesetIOError,
|
|
3
|
+
import { ChangesetIOError, ChangesetValidationError, ConfigurationError, GitError, GitHubApiError, MarkdownParseError, ReleasePlanError, VersionFileError } from "./errors.js";
|
|
4
4
|
import { JsonPathSchema, LegacyVersionFileConfigSchema, LegacyVersionFilesSchema, VersionFileConfigSchema, VersionFilesSchema } from "./schemas/version-files.js";
|
|
5
5
|
import { GlobSchema, PackageScopeSchema, PackagesRecordSchema } from "./schemas/package-scope.js";
|
|
6
6
|
import { ChangesetOptionsSchema, RepoSchema } from "./schemas/options.js";
|
|
7
|
-
import { GitHubLive, GitHubService,
|
|
8
|
-
import { MarkdownLive, MarkdownService
|
|
7
|
+
import { GitHubLive, GitHubService, makeGitHubTest } from "./services/github.js";
|
|
8
|
+
import { MarkdownLive, MarkdownService } from "./services/markdown.js";
|
|
9
9
|
import { NonEmptyString, PositiveInteger } from "./schemas/primitives.js";
|
|
10
10
|
import { DependencyActionSchema, DependencyTableRowSchema, DependencyTableSchema, DependencyTableTypeSchema, VERSION_RE, VersionOrEmptySchema } from "./schemas/dependency-table.js";
|
|
11
11
|
import { serializeDependencyTableToMarkdown } from "./utils/dependency-table.js";
|
|
@@ -29,16 +29,16 @@ import { NormalizeFormatPlugin } from "./remark/plugins/normalize-format.js";
|
|
|
29
29
|
import { ReorderSectionsPlugin } from "./remark/plugins/reorder-sections.js";
|
|
30
30
|
import { SilkChangesetPreset, SilkChangesetTransformPreset } from "./remark/presets.js";
|
|
31
31
|
import { ChangelogTransformer } from "./api/transformer.js";
|
|
32
|
-
import { ClassificationReasonSchema, ClassificationSchema, ConfigInspector,
|
|
33
|
-
import { BranchAnalysisSchema, BranchAnalyzer,
|
|
34
|
-
import { ChangelogService
|
|
32
|
+
import { ClassificationReasonSchema, ClassificationSchema, ConfigInspector, ConfigInspectorLive, InspectedConfigSchema, ResolvedPackageScopeSchema, ResolvedVersionFileSchema, makeConfigInspectorTest } from "./services/config-inspector.js";
|
|
33
|
+
import { BranchAnalysisSchema, BranchAnalyzer, BranchAnalyzerLive, BranchFileEntrySchema, FileStatusSchema, makeBranchAnalyzerTest } from "./services/branch-analyzer.js";
|
|
34
|
+
import { ChangelogService } from "./services/changelog.js";
|
|
35
35
|
import { computeWorkspaceDependencyDiffs } from "./utils/dep-diff.js";
|
|
36
36
|
import { gitMergeBase } from "./utils/git.js";
|
|
37
37
|
import { listPublishablePackageNames } from "./utils/publishability.js";
|
|
38
|
-
import { DepsRegen,
|
|
38
|
+
import { DepsRegen, DepsRegenDefault, DepsRegenLive, isPureDependencyChangeset, makeDepsRegenDefault } from "./services/deps-regen.js";
|
|
39
39
|
import { MaintenanceReasonSchema, MaintenanceTriggerSchema, deriveMaintenanceReason } from "./services/maintenance-reason.js";
|
|
40
40
|
import { VersionFiles } from "./utils/version-files.js";
|
|
41
|
-
import { ReleasePlanner,
|
|
41
|
+
import { ReleasePlanner, ReleasePlannerLive, makeReleasePlannerTest } from "./services/release-planner.js";
|
|
42
42
|
import { SectionCategorySchema } from "./categories/types.js";
|
|
43
43
|
import { CommitHashSchema, VersionTypeSchema } from "./schemas/git.js";
|
|
44
44
|
import { ChangesetSchema, ChangesetSummarySchema, DependencyTypeSchema, DependencyUpdateSchema } from "./schemas/changeset.js";
|
|
@@ -57,32 +57,26 @@ var changesets_exports = /* @__PURE__ */ __exportAll({
|
|
|
57
57
|
AppliedReleaseSchema: () => AppliedReleaseSchema,
|
|
58
58
|
BranchAnalysisSchema: () => BranchAnalysisSchema,
|
|
59
59
|
BranchAnalyzer: () => BranchAnalyzer,
|
|
60
|
-
BranchAnalyzerBase: () => BranchAnalyzerBase,
|
|
61
60
|
BranchAnalyzerLive: () => BranchAnalyzerLive,
|
|
62
61
|
BranchFileEntrySchema: () => BranchFileEntrySchema,
|
|
63
62
|
BumpTypeSchema: () => BumpTypeSchema,
|
|
64
63
|
Categories: () => Categories,
|
|
65
64
|
Changelog: () => Changelog,
|
|
66
65
|
ChangelogService: () => ChangelogService,
|
|
67
|
-
ChangelogServiceBase: () => ChangelogServiceBase,
|
|
68
66
|
ChangelogTransformer: () => ChangelogTransformer,
|
|
69
67
|
ChangesetIOError: () => ChangesetIOError,
|
|
70
|
-
ChangesetIOErrorBase: () => ChangesetIOErrorBase,
|
|
71
68
|
ChangesetLinter: () => ChangesetLinter,
|
|
72
69
|
ChangesetOptionsSchema: () => ChangesetOptionsSchema,
|
|
73
70
|
ChangesetPreviewSchema: () => ChangesetPreviewSchema,
|
|
74
71
|
ChangesetSchema: () => ChangesetSchema,
|
|
75
72
|
ChangesetSummarySchema: () => ChangesetSummarySchema,
|
|
76
73
|
ChangesetValidationError: () => ChangesetValidationError,
|
|
77
|
-
ChangesetValidationErrorBase: () => ChangesetValidationErrorBase,
|
|
78
74
|
ClassificationReasonSchema: () => ClassificationReasonSchema,
|
|
79
75
|
ClassificationSchema: () => ClassificationSchema,
|
|
80
76
|
CommitHashSchema: () => CommitHashSchema,
|
|
81
77
|
ConfigInspector: () => ConfigInspector,
|
|
82
|
-
ConfigInspectorBase: () => ConfigInspectorBase,
|
|
83
78
|
ConfigInspectorLive: () => ConfigInspectorLive,
|
|
84
79
|
ConfigurationError: () => ConfigurationError,
|
|
85
|
-
ConfigurationErrorBase: () => ConfigurationErrorBase,
|
|
86
80
|
ContentStructureRule: () => ContentStructureRule,
|
|
87
81
|
ContributorFootnotesPlugin: () => ContributorFootnotesPlugin,
|
|
88
82
|
DeduplicateItemsPlugin: () => DeduplicateItemsPlugin,
|
|
@@ -95,18 +89,14 @@ var changesets_exports = /* @__PURE__ */ __exportAll({
|
|
|
95
89
|
DependencyTypeSchema: () => DependencyTypeSchema,
|
|
96
90
|
DependencyUpdateSchema: () => DependencyUpdateSchema,
|
|
97
91
|
DepsRegen: () => DepsRegen,
|
|
98
|
-
DepsRegenBase: () => DepsRegenBase,
|
|
99
92
|
DepsRegenDefault: () => DepsRegenDefault,
|
|
100
93
|
DepsRegenLive: () => DepsRegenLive,
|
|
101
94
|
FileStatusSchema: () => FileStatusSchema,
|
|
102
95
|
GitError: () => GitError,
|
|
103
|
-
GitErrorBase: () => GitErrorBase,
|
|
104
96
|
GitHubApiError: () => GitHubApiError,
|
|
105
|
-
GitHubApiErrorBase: () => GitHubApiErrorBase,
|
|
106
97
|
GitHubInfoSchema: () => GitHubInfoSchema,
|
|
107
98
|
GitHubLive: () => GitHubLive,
|
|
108
99
|
GitHubService: () => GitHubService,
|
|
109
|
-
GitHubServiceBase: () => GitHubServiceBase,
|
|
110
100
|
GlobSchema: () => GlobSchema,
|
|
111
101
|
HeadingHierarchyRule: () => HeadingHierarchyRule,
|
|
112
102
|
InspectedConfigSchema: () => InspectedConfigSchema,
|
|
@@ -120,9 +110,7 @@ var changesets_exports = /* @__PURE__ */ __exportAll({
|
|
|
120
110
|
MaintenanceTriggerSchema: () => MaintenanceTriggerSchema,
|
|
121
111
|
MarkdownLive: () => MarkdownLive,
|
|
122
112
|
MarkdownParseError: () => MarkdownParseError,
|
|
123
|
-
MarkdownParseErrorBase: () => MarkdownParseErrorBase,
|
|
124
113
|
MarkdownService: () => MarkdownService,
|
|
125
|
-
MarkdownServiceBase: () => MarkdownServiceBase,
|
|
126
114
|
MarkdownlintContentStructureRule: () => ContentStructureRule$1,
|
|
127
115
|
MarkdownlintDependencyTableFormatRule: () => DependencyTableFormatRule$1,
|
|
128
116
|
MarkdownlintHeadingHierarchyRule: () => HeadingHierarchyRule$1,
|
|
@@ -137,9 +125,7 @@ var changesets_exports = /* @__PURE__ */ __exportAll({
|
|
|
137
125
|
PositiveInteger: () => PositiveInteger,
|
|
138
126
|
PreviewReleaseSchema: () => PreviewReleaseSchema,
|
|
139
127
|
ReleasePlanError: () => ReleasePlanError,
|
|
140
|
-
ReleasePlanErrorBase: () => ReleasePlanErrorBase,
|
|
141
128
|
ReleasePlanner: () => ReleasePlanner,
|
|
142
|
-
ReleasePlannerBase: () => ReleasePlannerBase,
|
|
143
129
|
ReleasePlannerLive: () => ReleasePlannerLive,
|
|
144
130
|
ReorderSectionsPlugin: () => ReorderSectionsPlugin,
|
|
145
131
|
RepoSchema: () => RepoSchema,
|
|
@@ -156,7 +142,6 @@ var changesets_exports = /* @__PURE__ */ __exportAll({
|
|
|
156
142
|
VERSION_RE: () => VERSION_RE,
|
|
157
143
|
VersionFileConfigSchema: () => VersionFileConfigSchema,
|
|
158
144
|
VersionFileError: () => VersionFileError,
|
|
159
|
-
VersionFileErrorBase: () => VersionFileErrorBase,
|
|
160
145
|
VersionFileUpdateRecordSchema: () => VersionFileUpdateRecordSchema,
|
|
161
146
|
VersionFiles: () => VersionFiles,
|
|
162
147
|
VersionFilesSchema: () => VersionFilesSchema,
|
|
@@ -170,10 +155,11 @@ var changesets_exports = /* @__PURE__ */ __exportAll({
|
|
|
170
155
|
listPublishablePackageNames: () => listPublishablePackageNames,
|
|
171
156
|
makeBranchAnalyzerTest: () => makeBranchAnalyzerTest,
|
|
172
157
|
makeConfigInspectorTest: () => makeConfigInspectorTest,
|
|
158
|
+
makeDepsRegenDefault: () => makeDepsRegenDefault,
|
|
173
159
|
makeGitHubTest: () => makeGitHubTest,
|
|
174
160
|
makeReleasePlannerTest: () => makeReleasePlannerTest,
|
|
175
161
|
serializeDependencyTableToMarkdown: () => serializeDependencyTableToMarkdown
|
|
176
162
|
});
|
|
177
163
|
|
|
178
164
|
//#endregion
|
|
179
|
-
export { AggregateDependencyTablesPlugin, AppliedReleaseEntrySchema, AppliedReleaseSchema, BranchAnalysisSchema, BranchAnalyzer,
|
|
165
|
+
export { AggregateDependencyTablesPlugin, AppliedReleaseEntrySchema, AppliedReleaseSchema, BranchAnalysisSchema, BranchAnalyzer, BranchAnalyzerLive, BranchFileEntrySchema, BumpTypeSchema, Categories, Changelog, ChangelogService, ChangelogTransformer, ChangesetIOError, ChangesetLinter, ChangesetOptionsSchema, ChangesetPreviewSchema, ChangesetSchema, ChangesetSummarySchema, ChangesetValidationError, ClassificationReasonSchema, ClassificationSchema, CommitHashSchema, ConfigInspector, ConfigInspectorLive, ConfigurationError, ContentStructureRule, ContributorFootnotesPlugin, DeduplicateItemsPlugin, DependencyActionSchema, DependencyTable, DependencyTableFormatRule, DependencyTableRowSchema, DependencyTableSchema, DependencyTableTypeSchema, DependencyTypeSchema, DependencyUpdateSchema, DepsRegen, DepsRegenDefault, DepsRegenLive, FileStatusSchema, GitError, GitHubApiError, GitHubInfoSchema, GitHubLive, GitHubService, GlobSchema, HeadingHierarchyRule, InspectedConfigSchema, IssueLinkRefsPlugin, IssueNumberSchema, JsonPathSchema, LegacyVersionFileConfigSchema, LegacyVersionFilesSchema, MaintenanceNotePlugin, MaintenanceReasonSchema, MaintenanceTriggerSchema, MarkdownLive, MarkdownParseError, MarkdownService, ContentStructureRule$1 as MarkdownlintContentStructureRule, DependencyTableFormatRule$1 as MarkdownlintDependencyTableFormatRule, HeadingHierarchyRule$1 as MarkdownlintHeadingHierarchyRule, RequiredSectionsRule$1 as MarkdownlintRequiredSectionsRule, UncategorizedContentRule$1 as MarkdownlintUncategorizedContentRule, MergeSectionsPlugin, NonEmptyString, NormalizeFormatPlugin, PackageScopeSchema, PackagesRecordSchema, PendingChangesetSchema, PositiveInteger, PreviewReleaseSchema, ReleasePlanError, ReleasePlanner, ReleasePlannerLive, ReorderSectionsPlugin, RepoSchema, RequiredSectionsRule, ResolvedPackageScopeSchema, ResolvedVersionFileSchema, SectionCategorySchema, SilkChangesetPreset, SilkChangesetTransformPreset, SilkChangesetsRules, UncategorizedContentRule, UrlOrMarkdownLinkSchema, UsernameSchema, VERSION_RE, VersionFileConfigSchema, VersionFileError, VersionFileUpdateRecordSchema, VersionFiles, VersionFilesSchema, VersionOrEmptySchema, VersionTypeSchema, changelogFunctions, changesets_exports, computeWorkspaceDependencyDiffs, deriveMaintenanceReason, gitMergeBase, isPureDependencyChangeset, listPublishablePackageNames, makeBranchAnalyzerTest, makeConfigInspectorTest, makeDepsRegenDefault, makeGitHubTest, makeReleasePlannerTest, serializeDependencyTableToMarkdown };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { NonEmptyString } from "./primitives.js";
|
|
2
1
|
import { CommitHashSchema } from "./git.js";
|
|
3
2
|
import { Schema } from "effect";
|
|
4
3
|
|
|
@@ -41,7 +40,7 @@ import { Schema } from "effect";
|
|
|
41
40
|
*
|
|
42
41
|
* @public
|
|
43
42
|
*/
|
|
44
|
-
const ChangesetSummarySchema = Schema.String.
|
|
43
|
+
const ChangesetSummarySchema = Schema.String.check(Schema.isMinLength(1, { message: "Changeset summary cannot be empty. Provide a 1-1000 character description of the change (e.g., \"Fix authentication timeout in login flow\")" }), Schema.isMaxLength(1e3, { message: "Changeset summary exceeds the 1000 character limit. Shorten the summary to at most 1000 characters — use the changeset body for additional details" }));
|
|
45
44
|
/**
|
|
46
45
|
* Schema for a changeset object.
|
|
47
46
|
*
|
|
@@ -102,7 +101,12 @@ const ChangesetSchema = Schema.Struct({
|
|
|
102
101
|
*
|
|
103
102
|
* @public
|
|
104
103
|
*/
|
|
105
|
-
const DependencyTypeSchema = Schema.
|
|
104
|
+
const DependencyTypeSchema = Schema.Literals([
|
|
105
|
+
"dependencies",
|
|
106
|
+
"devDependencies",
|
|
107
|
+
"peerDependencies",
|
|
108
|
+
"optionalDependencies"
|
|
109
|
+
]);
|
|
106
110
|
/**
|
|
107
111
|
* Schema for a dependency update entry.
|
|
108
112
|
*
|
|
@@ -132,7 +136,7 @@ const DependencyTypeSchema = Schema.Literal("dependencies", "devDependencies", "
|
|
|
132
136
|
*/
|
|
133
137
|
const DependencyUpdateSchema = Schema.Struct({
|
|
134
138
|
/** Package name (must be non-empty). */
|
|
135
|
-
name:
|
|
139
|
+
name: Schema.String.check(Schema.isMinLength(1, { message: "Package name cannot be empty" })),
|
|
136
140
|
/** npm dependency type. */
|
|
137
141
|
type: DependencyTypeSchema,
|
|
138
142
|
/** Previous version string. */
|
|
@@ -41,7 +41,11 @@ import { Schema } from "effect";
|
|
|
41
41
|
*
|
|
42
42
|
* @public
|
|
43
43
|
*/
|
|
44
|
-
const DependencyActionSchema = Schema.
|
|
44
|
+
const DependencyActionSchema = Schema.Literals([
|
|
45
|
+
"added",
|
|
46
|
+
"updated",
|
|
47
|
+
"removed"
|
|
48
|
+
]);
|
|
45
49
|
/**
|
|
46
50
|
* Extended dependency types for table format.
|
|
47
51
|
*
|
|
@@ -66,7 +70,14 @@ const DependencyActionSchema = Schema.Literal("added", "updated", "removed");
|
|
|
66
70
|
*
|
|
67
71
|
* @public
|
|
68
72
|
*/
|
|
69
|
-
const DependencyTableTypeSchema = Schema.
|
|
73
|
+
const DependencyTableTypeSchema = Schema.Literals([
|
|
74
|
+
"dependency",
|
|
75
|
+
"devDependency",
|
|
76
|
+
"peerDependency",
|
|
77
|
+
"optionalDependency",
|
|
78
|
+
"workspace",
|
|
79
|
+
"config"
|
|
80
|
+
]);
|
|
70
81
|
/**
|
|
71
82
|
* The canonical accepted-value pattern for a dependency-table From/To cell:
|
|
72
83
|
* the em-dash sentinel (U+2014), a bare/`~`/`^` semver, or — as a last-resort
|
|
@@ -103,7 +114,7 @@ const VERSION_RE = /^(\u2014|[~^]?\d+\.\d+\.\d+(?:[-+.][\w.+-]+)?|(?:catalog|wor
|
|
|
103
114
|
*
|
|
104
115
|
* @public
|
|
105
116
|
*/
|
|
106
|
-
const VersionOrEmptySchema = Schema.String.
|
|
117
|
+
const VersionOrEmptySchema = Schema.String.check(Schema.isPattern(VERSION_RE));
|
|
107
118
|
/**
|
|
108
119
|
* Schema for a single dependency table row.
|
|
109
120
|
*
|
|
@@ -192,7 +203,7 @@ const DependencyTableRowSchema = Schema.Struct({
|
|
|
192
203
|
*
|
|
193
204
|
* @public
|
|
194
205
|
*/
|
|
195
|
-
const DependencyTableSchema = Schema.Array(DependencyTableRowSchema).
|
|
206
|
+
const DependencyTableSchema = Schema.Array(DependencyTableRowSchema).check(Schema.isMinLength(1));
|
|
196
207
|
|
|
197
208
|
//#endregion
|
|
198
209
|
export { DependencyActionSchema, DependencyTableRowSchema, DependencyTableSchema, DependencyTableTypeSchema, VERSION_RE, VersionOrEmptySchema };
|
|
@@ -40,7 +40,7 @@ import { Schema } from "effect";
|
|
|
40
40
|
*
|
|
41
41
|
* @public
|
|
42
42
|
*/
|
|
43
|
-
const CommitHashSchema = Schema.String.
|
|
43
|
+
const CommitHashSchema = Schema.String.check(Schema.isPattern(/^[a-f0-9]{7,}$/, { message: "Commit hash must be 7 or more lowercase hexadecimal characters (0-9, a-f). Example: \"a1b2c3d\" or a full 40-character SHA like \"a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2\". Uppercase letters are not allowed" }));
|
|
44
44
|
/**
|
|
45
45
|
* Semantic version bump type.
|
|
46
46
|
*
|
|
@@ -62,7 +62,12 @@ const CommitHashSchema = Schema.String.pipe(Schema.pattern(/^[a-f0-9]{7,}$/, { m
|
|
|
62
62
|
*
|
|
63
63
|
* @public
|
|
64
64
|
*/
|
|
65
|
-
const VersionTypeSchema = Schema.
|
|
65
|
+
const VersionTypeSchema = Schema.Literals([
|
|
66
|
+
"major",
|
|
67
|
+
"minor",
|
|
68
|
+
"patch",
|
|
69
|
+
"none"
|
|
70
|
+
]);
|
|
66
71
|
|
|
67
72
|
//#endregion
|
|
68
73
|
export { CommitHashSchema, VersionTypeSchema };
|
|
@@ -52,7 +52,7 @@ function isValidUrl(value) {
|
|
|
52
52
|
*
|
|
53
53
|
* @public
|
|
54
54
|
*/
|
|
55
|
-
const UsernameSchema = Schema.String.
|
|
55
|
+
const UsernameSchema = Schema.String.check(Schema.isPattern(/^[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?$/, { message: "Invalid GitHub username format. Usernames must contain only alphanumeric characters and hyphens, and cannot start or end with a hyphen. Example: \"octocat\" or \"my-user-123\"" }));
|
|
56
56
|
/**
|
|
57
57
|
* Schema for a GitHub issue or PR number (positive integer).
|
|
58
58
|
*
|
|
@@ -77,7 +77,7 @@ const UsernameSchema = Schema.String.pipe(Schema.pattern(/^[a-zA-Z0-9]([a-zA-Z0-
|
|
|
77
77
|
*
|
|
78
78
|
* @public
|
|
79
79
|
*/
|
|
80
|
-
const IssueNumberSchema = PositiveInteger.
|
|
80
|
+
const IssueNumberSchema = PositiveInteger.annotate({
|
|
81
81
|
title: "IssueNumber",
|
|
82
82
|
description: "GitHub issue or pull request number"
|
|
83
83
|
});
|
|
@@ -114,11 +114,11 @@ const IssueNumberSchema = PositiveInteger.annotations({
|
|
|
114
114
|
*
|
|
115
115
|
* @public
|
|
116
116
|
*/
|
|
117
|
-
const UrlOrMarkdownLinkSchema = Schema.String.
|
|
117
|
+
const UrlOrMarkdownLinkSchema = Schema.String.check(Schema.makeFilter((value) => {
|
|
118
118
|
if (isValidUrl(value)) return true;
|
|
119
119
|
const match = MARKDOWN_LINK_PATTERN.exec(value);
|
|
120
120
|
return match?.[2] ? isValidUrl(match[2]) : false;
|
|
121
|
-
}, { message:
|
|
121
|
+
}, { message: "Value must be a valid URL or a markdown link. Expected a plain URL (e.g., \"https://github.com/owner/repo/pull/42\") or a markdown link (e.g., \"[#42](https://github.com/owner/repo/pull/42)\")" }));
|
|
122
122
|
/**
|
|
123
123
|
* Schema for a GitHub info response from `\@changesets/get-github-info`.
|
|
124
124
|
*
|
|
@@ -48,7 +48,7 @@ const REPO_PATTERN = /^[a-zA-Z0-9._-]+\/[a-zA-Z0-9._-]+$/;
|
|
|
48
48
|
*
|
|
49
49
|
* @public
|
|
50
50
|
*/
|
|
51
|
-
const RepoSchema = Schema.String.
|
|
51
|
+
const RepoSchema = Schema.String.check(Schema.isPattern(REPO_PATTERN, { message: "Repository must be in format \"owner/repository\" (e.g., \"microsoft/vscode\")" }));
|
|
52
52
|
/**
|
|
53
53
|
* Schema for changeset configuration options.
|
|
54
54
|
*
|
|
@@ -119,7 +119,7 @@ const ChangesetOptionsSchema = Schema.Struct({
|
|
|
119
119
|
* @deprecated 0.9.0 — migrate to `packages`. Removed in 1.0.0.
|
|
120
120
|
*/
|
|
121
121
|
versionFiles: Schema.optional(LegacyVersionFilesSchema)
|
|
122
|
-
}).
|
|
122
|
+
}).check(Schema.makeFilter((opts) => opts.packages === void 0 || opts.versionFiles === void 0, { message: "Configuration cannot declare both `packages` and the deprecated top-level `versionFiles` array. Migrate the legacy `versionFiles` entries into `packages[<name>].versionFiles` and remove the top-level field." }));
|
|
123
123
|
/**
|
|
124
124
|
* Validate changeset options with Effect-idiomatic error handling.
|
|
125
125
|
*
|
|
@@ -171,7 +171,7 @@ function validateChangesetOptions(input) {
|
|
|
171
171
|
field: "repo",
|
|
172
172
|
reason: `Invalid repository format: "${obj.repo}". Expected format is "owner/repository" (e.g., "microsoft/vscode")`
|
|
173
173
|
}));
|
|
174
|
-
return Schema.
|
|
174
|
+
return Schema.decodeUnknownEffect(ChangesetOptionsSchema)(input).pipe(Effect.mapError((parseError) => new ConfigurationError({
|
|
175
175
|
field: "options",
|
|
176
176
|
reason: String(parseError)
|
|
177
177
|
})));
|
|
@@ -63,7 +63,7 @@ import { Schema } from "effect";
|
|
|
63
63
|
*
|
|
64
64
|
* @public
|
|
65
65
|
*/
|
|
66
|
-
const GlobSchema = Schema.String.
|
|
66
|
+
const GlobSchema = Schema.String.check(Schema.isMinLength(1), Schema.makeFilter((s) => !s.startsWith("/") && !s.startsWith("../") && !s.includes("/../"), { message: "Glob must be repo-relative — absolute paths and parent traversal (../) are not allowed" }));
|
|
67
67
|
/**
|
|
68
68
|
* Schema for a single entry in the `packages` record — the per-package
|
|
69
69
|
* release-surface declaration.
|
|
@@ -118,10 +118,7 @@ const PackageScopeSchema = Schema.Struct({
|
|
|
118
118
|
*
|
|
119
119
|
* @public
|
|
120
120
|
*/
|
|
121
|
-
const PackagesRecordSchema = Schema.Record(
|
|
122
|
-
key: Schema.String,
|
|
123
|
-
value: PackageScopeSchema
|
|
124
|
-
});
|
|
121
|
+
const PackagesRecordSchema = Schema.Record(Schema.String, PackageScopeSchema);
|
|
125
122
|
|
|
126
123
|
//#endregion
|
|
127
124
|
export { GlobSchema, PackageScopeSchema, PackagesRecordSchema };
|
|
@@ -37,7 +37,7 @@ import { Schema } from "effect";
|
|
|
37
37
|
*
|
|
38
38
|
* @public
|
|
39
39
|
*/
|
|
40
|
-
const NonEmptyString = Schema.String.
|
|
40
|
+
const NonEmptyString = Schema.String.check(Schema.isMinLength(1));
|
|
41
41
|
/**
|
|
42
42
|
* A positive integer schema.
|
|
43
43
|
*
|
|
@@ -65,7 +65,7 @@ const NonEmptyString = Schema.String.pipe(Schema.minLength(1));
|
|
|
65
65
|
*
|
|
66
66
|
* @public
|
|
67
67
|
*/
|
|
68
|
-
const PositiveInteger = Schema.Number.
|
|
68
|
+
const PositiveInteger = Schema.Number.check(Schema.isInt(), Schema.isGreaterThan(0));
|
|
69
69
|
|
|
70
70
|
//#endregion
|
|
71
71
|
export { NonEmptyString, PositiveInteger };
|
|
@@ -7,7 +7,11 @@ import { Schema } from "effect";
|
|
|
7
7
|
*
|
|
8
8
|
*/
|
|
9
9
|
/** A semantic-version bump level (the `"none"` plan type is filtered out upstream). @public */
|
|
10
|
-
const BumpTypeSchema = Schema.
|
|
10
|
+
const BumpTypeSchema = Schema.Literals([
|
|
11
|
+
"major",
|
|
12
|
+
"minor",
|
|
13
|
+
"patch"
|
|
14
|
+
]);
|
|
11
15
|
/** One package's previewed release: version transition + rendered changelog block. @public */
|
|
12
16
|
const PreviewReleaseSchema = Schema.Struct({
|
|
13
17
|
name: Schema.String,
|
|
@@ -16,7 +20,7 @@ const PreviewReleaseSchema = Schema.Struct({
|
|
|
16
20
|
newVersion: Schema.String,
|
|
17
21
|
changesetIds: Schema.Array(Schema.String),
|
|
18
22
|
changelogEntry: Schema.String
|
|
19
|
-
}).
|
|
23
|
+
}).annotate({ identifier: "PreviewRelease" });
|
|
20
24
|
/** A parsed pending changeset (id + summary + the packages it bumps). @public */
|
|
21
25
|
const PendingChangesetSchema = Schema.Struct({
|
|
22
26
|
id: Schema.String,
|
|
@@ -25,32 +29,32 @@ const PendingChangesetSchema = Schema.Struct({
|
|
|
25
29
|
name: Schema.String,
|
|
26
30
|
type: BumpTypeSchema
|
|
27
31
|
}))
|
|
28
|
-
}).
|
|
32
|
+
}).annotate({ identifier: "PendingChangeset" });
|
|
29
33
|
/** Read-only preview of what the next release would produce. @public */
|
|
30
34
|
const ChangesetPreviewSchema = Schema.Struct({
|
|
31
|
-
preMode: Schema.NullOr(Schema.
|
|
35
|
+
preMode: Schema.NullOr(Schema.Literals(["exit", "pre"])),
|
|
32
36
|
releases: Schema.Array(PreviewReleaseSchema),
|
|
33
37
|
changesets: Schema.Array(PendingChangesetSchema)
|
|
34
|
-
}).
|
|
38
|
+
}).annotate({ identifier: "ChangesetPreview" });
|
|
35
39
|
/** One applied package release (version transition). @public */
|
|
36
40
|
const AppliedReleaseEntrySchema = Schema.Struct({
|
|
37
41
|
name: Schema.String,
|
|
38
42
|
type: BumpTypeSchema,
|
|
39
43
|
oldVersion: Schema.String,
|
|
40
44
|
newVersion: Schema.String
|
|
41
|
-
}).
|
|
45
|
+
}).annotate({ identifier: "AppliedReleaseEntry" });
|
|
42
46
|
/** A single versionFiles update applied (or planned, when dry). @public */
|
|
43
47
|
const VersionFileUpdateRecordSchema = Schema.Struct({
|
|
44
48
|
filePath: Schema.String,
|
|
45
49
|
version: Schema.String
|
|
46
|
-
}).
|
|
50
|
+
}).annotate({ identifier: "VersionFileUpdateRecord" });
|
|
47
51
|
/** Result of {@link ReleasePlanner.apply}. @public */
|
|
48
52
|
const AppliedReleaseSchema = Schema.Struct({
|
|
49
53
|
dryRun: Schema.Boolean,
|
|
50
54
|
touchedFiles: Schema.Array(Schema.String),
|
|
51
55
|
releases: Schema.Array(AppliedReleaseEntrySchema),
|
|
52
56
|
versionFileUpdates: Schema.Array(VersionFileUpdateRecordSchema)
|
|
53
|
-
}).
|
|
57
|
+
}).annotate({ identifier: "AppliedRelease" });
|
|
54
58
|
|
|
55
59
|
//#endregion
|
|
56
60
|
export { AppliedReleaseEntrySchema, AppliedReleaseSchema, BumpTypeSchema, ChangesetPreviewSchema, PendingChangesetSchema, PreviewReleaseSchema, VersionFileUpdateRecordSchema };
|
|
@@ -54,7 +54,7 @@ import { Schema } from "effect";
|
|
|
54
54
|
*
|
|
55
55
|
* @public
|
|
56
56
|
*/
|
|
57
|
-
const JsonPathSchema = Schema.String.
|
|
57
|
+
const JsonPathSchema = Schema.String.check(Schema.isPattern(/^\$\.[^.]/, { message: "JSONPath must start with \"$.\" followed by a property (e.g., \"$.version\", \"$.metadata.version\")" }));
|
|
58
58
|
/**
|
|
59
59
|
* Schema for a single version file configuration entry — **new shape**.
|
|
60
60
|
*
|
|
@@ -83,7 +83,7 @@ const JsonPathSchema = Schema.String.pipe(Schema.pattern(/^\$\.[^.]/, { message:
|
|
|
83
83
|
*/
|
|
84
84
|
const VersionFileConfigSchema = Schema.Struct({
|
|
85
85
|
/** Glob pattern to match JSON files. */
|
|
86
|
-
glob: Schema.String.
|
|
86
|
+
glob: Schema.String.check(Schema.isMinLength(1)),
|
|
87
87
|
/** JSONPath expressions to locate version fields. Defaults to `["$.version"]`. */
|
|
88
88
|
paths: Schema.optional(Schema.Array(JsonPathSchema))
|
|
89
89
|
});
|
|
@@ -129,11 +129,11 @@ const VersionFilesSchema = Schema.Array(VersionFileConfigSchema);
|
|
|
129
129
|
*/
|
|
130
130
|
const LegacyVersionFileConfigSchema = Schema.Struct({
|
|
131
131
|
/** Glob pattern to match JSON files. */
|
|
132
|
-
glob: Schema.String.
|
|
132
|
+
glob: Schema.String.check(Schema.isMinLength(1)),
|
|
133
133
|
/** JSONPath expressions to locate version fields. Defaults to `["$.version"]`. */
|
|
134
134
|
paths: Schema.optional(Schema.Array(JsonPathSchema)),
|
|
135
135
|
/** Workspace package name to source the version from, bypassing path-based resolution. */
|
|
136
|
-
package: Schema.optional(Schema.String.
|
|
136
|
+
package: Schema.optional(Schema.String.check(Schema.isMinLength(1)))
|
|
137
137
|
});
|
|
138
138
|
/**
|
|
139
139
|
* Schema for an array of legacy {@link LegacyVersionFileConfigSchema}
|