@savvy-web/silk 2.0.0 → 2.1.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.
Files changed (155) hide show
  1. package/README.md +7 -5
  2. package/changesets-changelog.cjs +10 -4
  3. package/changesets-changelog.js +54057 -1
  4. package/changesets-markdownlint.cjs +10 -4
  5. package/changesets-markdownlint.js +54057 -1
  6. package/package.json +5 -4
  7. package/tsconfig/node/dist/tsconfig.tsbuildinfo +1 -1
  8. package/_virtual/_rolldown/runtime.cjs +0 -45
  9. package/_virtual/_rolldown/runtime.js +0 -45
  10. package/packages/silk-effects/dist/dev/pkg/_virtual/_rolldown/runtime.cjs +0 -15
  11. package/packages/silk-effects/dist/dev/pkg/_virtual/_rolldown/runtime.js +0 -14
  12. package/packages/silk-effects/dist/dev/pkg/changesets/api/categories.cjs +0 -247
  13. package/packages/silk-effects/dist/dev/pkg/changesets/api/categories.js +0 -247
  14. package/packages/silk-effects/dist/dev/pkg/changesets/api/changelog.cjs +0 -134
  15. package/packages/silk-effects/dist/dev/pkg/changesets/api/changelog.js +0 -134
  16. package/packages/silk-effects/dist/dev/pkg/changesets/api/dependency-table.cjs +0 -163
  17. package/packages/silk-effects/dist/dev/pkg/changesets/api/dependency-table.js +0 -163
  18. package/packages/silk-effects/dist/dev/pkg/changesets/api/linter.cjs +0 -170
  19. package/packages/silk-effects/dist/dev/pkg/changesets/api/linter.js +0 -170
  20. package/packages/silk-effects/dist/dev/pkg/changesets/api/transformer.cjs +0 -134
  21. package/packages/silk-effects/dist/dev/pkg/changesets/api/transformer.js +0 -134
  22. package/packages/silk-effects/dist/dev/pkg/changesets/categories/index.cjs +0 -317
  23. package/packages/silk-effects/dist/dev/pkg/changesets/categories/index.js +0 -299
  24. package/packages/silk-effects/dist/dev/pkg/changesets/categories/types.cjs +0 -65
  25. package/packages/silk-effects/dist/dev/pkg/changesets/categories/types.js +0 -65
  26. package/packages/silk-effects/dist/dev/pkg/changesets/changelog/formatting.cjs +0 -114
  27. package/packages/silk-effects/dist/dev/pkg/changesets/changelog/formatting.js +0 -113
  28. package/packages/silk-effects/dist/dev/pkg/changesets/changelog/getDependencyReleaseLine.cjs +0 -118
  29. package/packages/silk-effects/dist/dev/pkg/changesets/changelog/getDependencyReleaseLine.js +0 -118
  30. package/packages/silk-effects/dist/dev/pkg/changesets/changelog/getReleaseLine.cjs +0 -122
  31. package/packages/silk-effects/dist/dev/pkg/changesets/changelog/getReleaseLine.js +0 -122
  32. package/packages/silk-effects/dist/dev/pkg/changesets/changelog/index.cjs +0 -97
  33. package/packages/silk-effects/dist/dev/pkg/changesets/changelog/index.js +0 -97
  34. package/packages/silk-effects/dist/dev/pkg/changesets/constants.cjs +0 -43
  35. package/packages/silk-effects/dist/dev/pkg/changesets/constants.js +0 -42
  36. package/packages/silk-effects/dist/dev/pkg/changesets/errors.cjs +0 -386
  37. package/packages/silk-effects/dist/dev/pkg/changesets/errors.js +0 -371
  38. package/packages/silk-effects/dist/dev/pkg/changesets/index.cjs +0 -300
  39. package/packages/silk-effects/dist/dev/pkg/changesets/index.js +0 -179
  40. package/packages/silk-effects/dist/dev/pkg/changesets/markdownlint/index.cjs +0 -34
  41. package/packages/silk-effects/dist/dev/pkg/changesets/markdownlint/index.js +0 -29
  42. package/packages/silk-effects/dist/dev/pkg/changesets/markdownlint/rules/content-structure.cjs +0 -98
  43. package/packages/silk-effects/dist/dev/pkg/changesets/markdownlint/rules/content-structure.js +0 -98
  44. package/packages/silk-effects/dist/dev/pkg/changesets/markdownlint/rules/dependency-table-format.cjs +0 -170
  45. package/packages/silk-effects/dist/dev/pkg/changesets/markdownlint/rules/dependency-table-format.js +0 -170
  46. package/packages/silk-effects/dist/dev/pkg/changesets/markdownlint/rules/heading-hierarchy.cjs +0 -61
  47. package/packages/silk-effects/dist/dev/pkg/changesets/markdownlint/rules/heading-hierarchy.js +0 -61
  48. package/packages/silk-effects/dist/dev/pkg/changesets/markdownlint/rules/required-sections.cjs +0 -54
  49. package/packages/silk-effects/dist/dev/pkg/changesets/markdownlint/rules/required-sections.js +0 -54
  50. package/packages/silk-effects/dist/dev/pkg/changesets/markdownlint/rules/uncategorized-content.cjs +0 -54
  51. package/packages/silk-effects/dist/dev/pkg/changesets/markdownlint/rules/uncategorized-content.js +0 -54
  52. package/packages/silk-effects/dist/dev/pkg/changesets/markdownlint/rules/utils.cjs +0 -31
  53. package/packages/silk-effects/dist/dev/pkg/changesets/markdownlint/rules/utils.js +0 -30
  54. package/packages/silk-effects/dist/dev/pkg/changesets/remark/plugins/aggregate-dependency-tables.cjs +0 -47
  55. package/packages/silk-effects/dist/dev/pkg/changesets/remark/plugins/aggregate-dependency-tables.js +0 -47
  56. package/packages/silk-effects/dist/dev/pkg/changesets/remark/plugins/contributor-footnotes.cjs +0 -123
  57. package/packages/silk-effects/dist/dev/pkg/changesets/remark/plugins/contributor-footnotes.js +0 -123
  58. package/packages/silk-effects/dist/dev/pkg/changesets/remark/plugins/deduplicate-items.cjs +0 -32
  59. package/packages/silk-effects/dist/dev/pkg/changesets/remark/plugins/deduplicate-items.js +0 -32
  60. package/packages/silk-effects/dist/dev/pkg/changesets/remark/plugins/issue-link-refs.cjs +0 -59
  61. package/packages/silk-effects/dist/dev/pkg/changesets/remark/plugins/issue-link-refs.js +0 -59
  62. package/packages/silk-effects/dist/dev/pkg/changesets/remark/plugins/maintenance-note.cjs +0 -61
  63. package/packages/silk-effects/dist/dev/pkg/changesets/remark/plugins/maintenance-note.js +0 -61
  64. package/packages/silk-effects/dist/dev/pkg/changesets/remark/plugins/merge-sections.cjs +0 -43
  65. package/packages/silk-effects/dist/dev/pkg/changesets/remark/plugins/merge-sections.js +0 -43
  66. package/packages/silk-effects/dist/dev/pkg/changesets/remark/plugins/normalize-format.cjs +0 -47
  67. package/packages/silk-effects/dist/dev/pkg/changesets/remark/plugins/normalize-format.js +0 -47
  68. package/packages/silk-effects/dist/dev/pkg/changesets/remark/plugins/reorder-sections.cjs +0 -34
  69. package/packages/silk-effects/dist/dev/pkg/changesets/remark/plugins/reorder-sections.js +0 -34
  70. package/packages/silk-effects/dist/dev/pkg/changesets/remark/presets.cjs +0 -120
  71. package/packages/silk-effects/dist/dev/pkg/changesets/remark/presets.js +0 -119
  72. package/packages/silk-effects/dist/dev/pkg/changesets/remark/rules/content-structure.cjs +0 -22
  73. package/packages/silk-effects/dist/dev/pkg/changesets/remark/rules/content-structure.js +0 -22
  74. package/packages/silk-effects/dist/dev/pkg/changesets/remark/rules/dependency-table-format.cjs +0 -40
  75. package/packages/silk-effects/dist/dev/pkg/changesets/remark/rules/dependency-table-format.js +0 -40
  76. package/packages/silk-effects/dist/dev/pkg/changesets/remark/rules/heading-hierarchy.cjs +0 -19
  77. package/packages/silk-effects/dist/dev/pkg/changesets/remark/rules/heading-hierarchy.js +0 -19
  78. package/packages/silk-effects/dist/dev/pkg/changesets/remark/rules/required-sections.cjs +0 -17
  79. package/packages/silk-effects/dist/dev/pkg/changesets/remark/rules/required-sections.js +0 -17
  80. package/packages/silk-effects/dist/dev/pkg/changesets/remark/rules/uncategorized-content.cjs +0 -31
  81. package/packages/silk-effects/dist/dev/pkg/changesets/remark/rules/uncategorized-content.js +0 -31
  82. package/packages/silk-effects/dist/dev/pkg/changesets/schemas/changeset.cjs +0 -148
  83. package/packages/silk-effects/dist/dev/pkg/changesets/schemas/changeset.js +0 -145
  84. package/packages/silk-effects/dist/dev/pkg/changesets/schemas/dependency-table.cjs +0 -203
  85. package/packages/silk-effects/dist/dev/pkg/changesets/schemas/dependency-table.js +0 -198
  86. package/packages/silk-effects/dist/dev/pkg/changesets/schemas/git.cjs +0 -69
  87. package/packages/silk-effects/dist/dev/pkg/changesets/schemas/git.js +0 -68
  88. package/packages/silk-effects/dist/dev/pkg/changesets/schemas/github.cjs +0 -177
  89. package/packages/silk-effects/dist/dev/pkg/changesets/schemas/github.js +0 -174
  90. package/packages/silk-effects/dist/dev/pkg/changesets/schemas/options.cjs +0 -183
  91. package/packages/silk-effects/dist/dev/pkg/changesets/schemas/options.js +0 -181
  92. package/packages/silk-effects/dist/dev/pkg/changesets/schemas/package-scope.cjs +0 -129
  93. package/packages/silk-effects/dist/dev/pkg/changesets/schemas/package-scope.js +0 -127
  94. package/packages/silk-effects/dist/dev/pkg/changesets/schemas/primitives.cjs +0 -72
  95. package/packages/silk-effects/dist/dev/pkg/changesets/schemas/primitives.js +0 -71
  96. package/packages/silk-effects/dist/dev/pkg/changesets/schemas/release-plan.cjs +0 -62
  97. package/packages/silk-effects/dist/dev/pkg/changesets/schemas/release-plan.js +0 -56
  98. package/packages/silk-effects/dist/dev/pkg/changesets/schemas/version-files.cjs +0 -154
  99. package/packages/silk-effects/dist/dev/pkg/changesets/schemas/version-files.js +0 -150
  100. package/packages/silk-effects/dist/dev/pkg/changesets/services/branch-analyzer.cjs +0 -300
  101. package/packages/silk-effects/dist/dev/pkg/changesets/services/branch-analyzer.js +0 -294
  102. package/packages/silk-effects/dist/dev/pkg/changesets/services/changelog.cjs +0 -50
  103. package/packages/silk-effects/dist/dev/pkg/changesets/services/changelog.js +0 -49
  104. package/packages/silk-effects/dist/dev/pkg/changesets/services/config-inspector.cjs +0 -489
  105. package/packages/silk-effects/dist/dev/pkg/changesets/services/config-inspector.js +0 -481
  106. package/packages/silk-effects/dist/dev/pkg/changesets/services/deps-regen.cjs +0 -375
  107. package/packages/silk-effects/dist/dev/pkg/changesets/services/deps-regen.js +0 -371
  108. package/packages/silk-effects/dist/dev/pkg/changesets/services/github.cjs +0 -160
  109. package/packages/silk-effects/dist/dev/pkg/changesets/services/github.js +0 -157
  110. package/packages/silk-effects/dist/dev/pkg/changesets/services/maintenance-reason.cjs +0 -68
  111. package/packages/silk-effects/dist/dev/pkg/changesets/services/maintenance-reason.js +0 -66
  112. package/packages/silk-effects/dist/dev/pkg/changesets/services/markdown.cjs +0 -87
  113. package/packages/silk-effects/dist/dev/pkg/changesets/services/markdown.js +0 -85
  114. package/packages/silk-effects/dist/dev/pkg/changesets/services/release-planner.cjs +0 -352
  115. package/packages/silk-effects/dist/dev/pkg/changesets/services/release-planner.js +0 -348
  116. package/packages/silk-effects/dist/dev/pkg/changesets/utils/commit-parser.cjs +0 -81
  117. package/packages/silk-effects/dist/dev/pkg/changesets/utils/commit-parser.js +0 -80
  118. package/packages/silk-effects/dist/dev/pkg/changesets/utils/dep-diff.cjs +0 -111
  119. package/packages/silk-effects/dist/dev/pkg/changesets/utils/dep-diff.js +0 -111
  120. package/packages/silk-effects/dist/dev/pkg/changesets/utils/dependency-table.cjs +0 -351
  121. package/packages/silk-effects/dist/dev/pkg/changesets/utils/dependency-table.js +0 -347
  122. package/packages/silk-effects/dist/dev/pkg/changesets/utils/git.cjs +0 -51
  123. package/packages/silk-effects/dist/dev/pkg/changesets/utils/git.js +0 -51
  124. package/packages/silk-effects/dist/dev/pkg/changesets/utils/issue-refs.cjs +0 -102
  125. package/packages/silk-effects/dist/dev/pkg/changesets/utils/issue-refs.js +0 -101
  126. package/packages/silk-effects/dist/dev/pkg/changesets/utils/jsonpath.cjs +0 -178
  127. package/packages/silk-effects/dist/dev/pkg/changesets/utils/jsonpath.js +0 -175
  128. package/packages/silk-effects/dist/dev/pkg/changesets/utils/logger.cjs +0 -51
  129. package/packages/silk-effects/dist/dev/pkg/changesets/utils/logger.js +0 -50
  130. package/packages/silk-effects/dist/dev/pkg/changesets/utils/markdown-link.cjs +0 -59
  131. package/packages/silk-effects/dist/dev/pkg/changesets/utils/markdown-link.js +0 -57
  132. package/packages/silk-effects/dist/dev/pkg/changesets/utils/publishability.cjs +0 -50
  133. package/packages/silk-effects/dist/dev/pkg/changesets/utils/publishability.js +0 -50
  134. package/packages/silk-effects/dist/dev/pkg/changesets/utils/remark-pipeline.cjs +0 -81
  135. package/packages/silk-effects/dist/dev/pkg/changesets/utils/remark-pipeline.js +0 -79
  136. package/packages/silk-effects/dist/dev/pkg/changesets/utils/section-parser.cjs +0 -94
  137. package/packages/silk-effects/dist/dev/pkg/changesets/utils/section-parser.js +0 -94
  138. package/packages/silk-effects/dist/dev/pkg/changesets/utils/strip-frontmatter.cjs +0 -47
  139. package/packages/silk-effects/dist/dev/pkg/changesets/utils/strip-frontmatter.js +0 -46
  140. package/packages/silk-effects/dist/dev/pkg/changesets/utils/version-blocks.cjs +0 -110
  141. package/packages/silk-effects/dist/dev/pkg/changesets/utils/version-blocks.js +0 -108
  142. package/packages/silk-effects/dist/dev/pkg/changesets/utils/version-files.cjs +0 -336
  143. package/packages/silk-effects/dist/dev/pkg/changesets/utils/version-files.js +0 -336
  144. package/packages/silk-effects/dist/dev/pkg/changesets/vendor/github-info.cjs +0 -77
  145. package/packages/silk-effects/dist/dev/pkg/changesets/vendor/github-info.js +0 -77
  146. package/packages/silk-effects/dist/dev/pkg/errors/ChangesetConfigError.cjs +0 -21
  147. package/packages/silk-effects/dist/dev/pkg/errors/ChangesetConfigError.js +0 -21
  148. package/packages/silk-effects/dist/dev/pkg/schemas/VersioningSchemas.cjs +0 -101
  149. package/packages/silk-effects/dist/dev/pkg/schemas/VersioningSchemas.js +0 -99
  150. package/packages/silk-effects/dist/dev/pkg/services/ChangesetConfig.cjs +0 -81
  151. package/packages/silk-effects/dist/dev/pkg/services/ChangesetConfig.js +0 -80
  152. package/packages/silk-effects/dist/dev/pkg/services/ChangesetConfigReader.cjs +0 -109
  153. package/packages/silk-effects/dist/dev/pkg/services/ChangesetConfigReader.js +0 -108
  154. package/packages/silk-effects/dist/dev/pkg/services/SilkPublishability.cjs +0 -238
  155. package/packages/silk-effects/dist/dev/pkg/services/SilkPublishability.js +0 -236
@@ -1,183 +0,0 @@
1
- const require_errors = require('../errors.cjs');
2
- const require_version_files = require('./version-files.cjs');
3
- const require_package_scope = require('./package-scope.cjs');
4
- let effect = require("effect");
5
-
6
- //#region ../silk-effects/dist/dev/pkg/changesets/schemas/options.js
7
- /**
8
- * Changeset configuration option schemas and validation.
9
- *
10
- * @remarks
11
- * Defines the schema for the options object passed to the
12
- * \@savvy-web/changesets changelog formatter in `.changeset/config.json`.
13
- * The options are specified as the second element of the changelog array:
14
- *
15
- * ```json
16
- * {
17
- * "changelog": ["@savvy-web/changesets/changelog", { "repo": "owner/repo" }]
18
- * }
19
- * ```
20
- *
21
- * @see {@link https://github.com/changesets/changesets/blob/main/docs/config-file-options.md | Changesets config docs}
22
- * @see {@link https://effect.website/docs/schema/introduction | Effect Schema documentation}
23
- *
24
- */
25
- /** Regex for `owner/repo` format, shared between schema and validation. */
26
- const REPO_PATTERN = /^[a-zA-Z0-9._-]+\/[a-zA-Z0-9._-]+$/;
27
- /**
28
- * Schema for a GitHub repository in `owner/repo` format.
29
- *
30
- * @remarks
31
- * Validates that the string matches the `owner/repository` format used
32
- * by GitHub. Both the owner and repository segments accept alphanumeric
33
- * characters, dots, underscores, and hyphens.
34
- *
35
- * @example
36
- * ```typescript
37
- * import { Schema } from "effect";
38
- * import { RepoSchema } from "@savvy-web/changesets";
39
- *
40
- * // Succeeds
41
- * Schema.decodeUnknownSync(RepoSchema)("microsoft/vscode");
42
- *
43
- * // Throws ParseError — missing slash
44
- * Schema.decodeUnknownSync(RepoSchema)("vscode");
45
- * ```
46
- *
47
- * @see {@link ChangesetOptionsSchema} which uses this for the `repo` field
48
- *
49
- * @public
50
- */
51
- const RepoSchema = effect.Schema.String.pipe(effect.Schema.pattern(REPO_PATTERN, { message: () => "Repository must be in format \"owner/repository\" (e.g., \"microsoft/vscode\")" }));
52
- /**
53
- * Schema for changeset configuration options.
54
- *
55
- * @remarks
56
- * The `repo` field is required; all other fields are optional with sensible
57
- * defaults applied by the changelog formatter at runtime.
58
- *
59
- * Two related fields describe release surfaces:
60
- *
61
- * - `packages` (new, recommended) — a record keyed by package name with
62
- * per-package `additionalScopes` and `versionFiles`. This is the shape
63
- * introduced in 0.9.0 and the only shape that will be accepted in 1.0.0.
64
- * - `versionFiles` (deprecated) — a flat array of entries each carrying
65
- * their own `package` field. Still accepted in 0.9.0 with a deprecation
66
- * warning emitted by `ConfigInspector` at config-load time; removed in
67
- * 1.0.0.
68
- *
69
- * A config that declares **both** `packages` and the deprecated
70
- * `versionFiles` field is rejected — the user must pick one.
71
- *
72
- * @example
73
- * ```typescript
74
- * import { Schema } from "effect";
75
- * import { ChangesetOptionsSchema } from "@savvy-web/changesets";
76
- * import type { ChangesetOptions } from "@savvy-web/changesets";
77
- *
78
- * // New per-package shape (recommended)
79
- * const opts: ChangesetOptions = Schema.decodeUnknownSync(ChangesetOptionsSchema)({
80
- * repo: "savvy-web/changesets",
81
- * packages: {
82
- * "@savvy-web/changesets": {
83
- * additionalScopes: ["plugin/**"],
84
- * versionFiles: [{ glob: "plugin/.claude-plugin/plugin.json", paths: ["$.version"] }],
85
- * },
86
- * },
87
- * });
88
- * ```
89
- *
90
- * @see {@link ChangesetOptions} for the inferred TypeScript type
91
- * @see {@link validateChangesetOptions} for Effect-idiomatic validation with detailed error messages
92
- * @see {@link PackagesRecordSchema} for the new `packages` shape
93
- * @see {@link LegacyVersionFilesSchema} for the deprecated `versionFiles` shape
94
- *
95
- * @public
96
- */
97
- const ChangesetOptionsSchema = effect.Schema.Struct({
98
- /** GitHub repository in `owner/repo` format. */
99
- repo: RepoSchema,
100
- /** Whether to include commit hash links in output. */
101
- commitLinks: effect.Schema.optional(effect.Schema.Boolean),
102
- /** Whether to include pull request links in output. */
103
- prLinks: effect.Schema.optional(effect.Schema.Boolean),
104
- /** Whether to include issue reference links in output. */
105
- issueLinks: effect.Schema.optional(effect.Schema.Boolean),
106
- /** Custom issue reference prefixes (e.g., `["#", "GH-"]`). */
107
- issuePrefixes: effect.Schema.optional(effect.Schema.Array(effect.Schema.String)),
108
- /**
109
- * Per-package release surfaces. Each entry declares `additionalScopes`
110
- * (globs outside the workspace dir that belong to the package) and
111
- * `versionFiles` (files bumped in lockstep with the package's version).
112
- */
113
- packages: effect.Schema.optional(require_package_scope.PackagesRecordSchema),
114
- /**
115
- * DEPRECATED. Top-level flat array of version-file entries each with
116
- * their own `package` field. Migrate to `packages[<name>].versionFiles`.
117
- * Removed in 1.0.0.
118
- *
119
- * @deprecated 0.9.0 — migrate to `packages`. Removed in 1.0.0.
120
- */
121
- versionFiles: effect.Schema.optional(require_version_files.LegacyVersionFilesSchema)
122
- }).pipe(effect.Schema.filter((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
- /**
124
- * Validate changeset options with Effect-idiomatic error handling.
125
- *
126
- * @remarks
127
- * Provides detailed, user-friendly error messages that match the prior art
128
- * from \@savvy-web/changelog. Performs manual pre-validation for `null`,
129
- * non-object, and missing `repo` before delegating to schema decoding.
130
- * This layered approach ensures that the most common misconfiguration
131
- * (missing `repo`) produces a clear, actionable message rather than a
132
- * generic schema parse error.
133
- *
134
- * @example
135
- * ```typescript
136
- * import { Effect } from "effect";
137
- * import { validateChangesetOptions, ConfigurationError } from "@savvy-web/changesets";
138
- *
139
- * const program = validateChangesetOptions({ repo: "savvy-web/changesets" }).pipe(
140
- * Effect.catchTag("ConfigurationError", (err) =>
141
- * Effect.logError(`Config invalid: ${err.message}`)
142
- * ),
143
- * );
144
- *
145
- * Effect.runPromise(program);
146
- * ```
147
- *
148
- * @param input - Raw configuration input (typically from `.changeset/config.json`)
149
- * @returns An Effect that succeeds with decoded {@link ChangesetOptions} or fails with a {@link ConfigurationError}
150
- *
151
- * @see {@link ChangesetOptionsSchema} for the expected configuration shape
152
- * @see {@link ConfigurationError} for the error type produced on validation failure
153
- *
154
- * @public
155
- */
156
- function validateChangesetOptions(input) {
157
- if (input === null || input === void 0) return effect.Effect.fail(new require_errors.ConfigurationError({
158
- field: "options",
159
- reason: "Configuration is required. Add options to your changesets config:\n\"changelog\": [\"@savvy-web/changesets\", { \"repo\": \"owner/repository\" }]"
160
- }));
161
- if (typeof input !== "object") return effect.Effect.fail(new require_errors.ConfigurationError({
162
- field: "options",
163
- reason: "Configuration must be an object"
164
- }));
165
- const obj = input;
166
- if (!("repo" in obj) || obj.repo === void 0) return effect.Effect.fail(new require_errors.ConfigurationError({
167
- field: "repo",
168
- reason: "Repository name is required. Add the \"repo\" option to your changesets config:\n\"changelog\": [\"@savvy-web/changesets\", { \"repo\": \"owner/repository\" }]"
169
- }));
170
- if (typeof obj.repo === "string" && !REPO_PATTERN.test(obj.repo)) return effect.Effect.fail(new require_errors.ConfigurationError({
171
- field: "repo",
172
- reason: `Invalid repository format: "${obj.repo}". Expected format is "owner/repository" (e.g., "microsoft/vscode")`
173
- }));
174
- return effect.Schema.decodeUnknown(ChangesetOptionsSchema)(input).pipe(effect.Effect.mapError((parseError) => new require_errors.ConfigurationError({
175
- field: "options",
176
- reason: String(parseError)
177
- })));
178
- }
179
-
180
- //#endregion
181
- exports.ChangesetOptionsSchema = ChangesetOptionsSchema;
182
- exports.RepoSchema = RepoSchema;
183
- exports.validateChangesetOptions = validateChangesetOptions;
@@ -1,181 +0,0 @@
1
- import { ConfigurationError } from "../errors.js";
2
- import { LegacyVersionFilesSchema } from "./version-files.js";
3
- import { PackagesRecordSchema } from "./package-scope.js";
4
- import { Effect, Schema } from "effect";
5
-
6
- //#region ../silk-effects/dist/dev/pkg/changesets/schemas/options.js
7
- /**
8
- * Changeset configuration option schemas and validation.
9
- *
10
- * @remarks
11
- * Defines the schema for the options object passed to the
12
- * \@savvy-web/changesets changelog formatter in `.changeset/config.json`.
13
- * The options are specified as the second element of the changelog array:
14
- *
15
- * ```json
16
- * {
17
- * "changelog": ["@savvy-web/changesets/changelog", { "repo": "owner/repo" }]
18
- * }
19
- * ```
20
- *
21
- * @see {@link https://github.com/changesets/changesets/blob/main/docs/config-file-options.md | Changesets config docs}
22
- * @see {@link https://effect.website/docs/schema/introduction | Effect Schema documentation}
23
- *
24
- */
25
- /** Regex for `owner/repo` format, shared between schema and validation. */
26
- const REPO_PATTERN = /^[a-zA-Z0-9._-]+\/[a-zA-Z0-9._-]+$/;
27
- /**
28
- * Schema for a GitHub repository in `owner/repo` format.
29
- *
30
- * @remarks
31
- * Validates that the string matches the `owner/repository` format used
32
- * by GitHub. Both the owner and repository segments accept alphanumeric
33
- * characters, dots, underscores, and hyphens.
34
- *
35
- * @example
36
- * ```typescript
37
- * import { Schema } from "effect";
38
- * import { RepoSchema } from "@savvy-web/changesets";
39
- *
40
- * // Succeeds
41
- * Schema.decodeUnknownSync(RepoSchema)("microsoft/vscode");
42
- *
43
- * // Throws ParseError — missing slash
44
- * Schema.decodeUnknownSync(RepoSchema)("vscode");
45
- * ```
46
- *
47
- * @see {@link ChangesetOptionsSchema} which uses this for the `repo` field
48
- *
49
- * @public
50
- */
51
- const RepoSchema = Schema.String.pipe(Schema.pattern(REPO_PATTERN, { message: () => "Repository must be in format \"owner/repository\" (e.g., \"microsoft/vscode\")" }));
52
- /**
53
- * Schema for changeset configuration options.
54
- *
55
- * @remarks
56
- * The `repo` field is required; all other fields are optional with sensible
57
- * defaults applied by the changelog formatter at runtime.
58
- *
59
- * Two related fields describe release surfaces:
60
- *
61
- * - `packages` (new, recommended) — a record keyed by package name with
62
- * per-package `additionalScopes` and `versionFiles`. This is the shape
63
- * introduced in 0.9.0 and the only shape that will be accepted in 1.0.0.
64
- * - `versionFiles` (deprecated) — a flat array of entries each carrying
65
- * their own `package` field. Still accepted in 0.9.0 with a deprecation
66
- * warning emitted by `ConfigInspector` at config-load time; removed in
67
- * 1.0.0.
68
- *
69
- * A config that declares **both** `packages` and the deprecated
70
- * `versionFiles` field is rejected — the user must pick one.
71
- *
72
- * @example
73
- * ```typescript
74
- * import { Schema } from "effect";
75
- * import { ChangesetOptionsSchema } from "@savvy-web/changesets";
76
- * import type { ChangesetOptions } from "@savvy-web/changesets";
77
- *
78
- * // New per-package shape (recommended)
79
- * const opts: ChangesetOptions = Schema.decodeUnknownSync(ChangesetOptionsSchema)({
80
- * repo: "savvy-web/changesets",
81
- * packages: {
82
- * "@savvy-web/changesets": {
83
- * additionalScopes: ["plugin/**"],
84
- * versionFiles: [{ glob: "plugin/.claude-plugin/plugin.json", paths: ["$.version"] }],
85
- * },
86
- * },
87
- * });
88
- * ```
89
- *
90
- * @see {@link ChangesetOptions} for the inferred TypeScript type
91
- * @see {@link validateChangesetOptions} for Effect-idiomatic validation with detailed error messages
92
- * @see {@link PackagesRecordSchema} for the new `packages` shape
93
- * @see {@link LegacyVersionFilesSchema} for the deprecated `versionFiles` shape
94
- *
95
- * @public
96
- */
97
- const ChangesetOptionsSchema = Schema.Struct({
98
- /** GitHub repository in `owner/repo` format. */
99
- repo: RepoSchema,
100
- /** Whether to include commit hash links in output. */
101
- commitLinks: Schema.optional(Schema.Boolean),
102
- /** Whether to include pull request links in output. */
103
- prLinks: Schema.optional(Schema.Boolean),
104
- /** Whether to include issue reference links in output. */
105
- issueLinks: Schema.optional(Schema.Boolean),
106
- /** Custom issue reference prefixes (e.g., `["#", "GH-"]`). */
107
- issuePrefixes: Schema.optional(Schema.Array(Schema.String)),
108
- /**
109
- * Per-package release surfaces. Each entry declares `additionalScopes`
110
- * (globs outside the workspace dir that belong to the package) and
111
- * `versionFiles` (files bumped in lockstep with the package's version).
112
- */
113
- packages: Schema.optional(PackagesRecordSchema),
114
- /**
115
- * DEPRECATED. Top-level flat array of version-file entries each with
116
- * their own `package` field. Migrate to `packages[<name>].versionFiles`.
117
- * Removed in 1.0.0.
118
- *
119
- * @deprecated 0.9.0 — migrate to `packages`. Removed in 1.0.0.
120
- */
121
- versionFiles: Schema.optional(LegacyVersionFilesSchema)
122
- }).pipe(Schema.filter((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
- /**
124
- * Validate changeset options with Effect-idiomatic error handling.
125
- *
126
- * @remarks
127
- * Provides detailed, user-friendly error messages that match the prior art
128
- * from \@savvy-web/changelog. Performs manual pre-validation for `null`,
129
- * non-object, and missing `repo` before delegating to schema decoding.
130
- * This layered approach ensures that the most common misconfiguration
131
- * (missing `repo`) produces a clear, actionable message rather than a
132
- * generic schema parse error.
133
- *
134
- * @example
135
- * ```typescript
136
- * import { Effect } from "effect";
137
- * import { validateChangesetOptions, ConfigurationError } from "@savvy-web/changesets";
138
- *
139
- * const program = validateChangesetOptions({ repo: "savvy-web/changesets" }).pipe(
140
- * Effect.catchTag("ConfigurationError", (err) =>
141
- * Effect.logError(`Config invalid: ${err.message}`)
142
- * ),
143
- * );
144
- *
145
- * Effect.runPromise(program);
146
- * ```
147
- *
148
- * @param input - Raw configuration input (typically from `.changeset/config.json`)
149
- * @returns An Effect that succeeds with decoded {@link ChangesetOptions} or fails with a {@link ConfigurationError}
150
- *
151
- * @see {@link ChangesetOptionsSchema} for the expected configuration shape
152
- * @see {@link ConfigurationError} for the error type produced on validation failure
153
- *
154
- * @public
155
- */
156
- function validateChangesetOptions(input) {
157
- if (input === null || input === void 0) return Effect.fail(new ConfigurationError({
158
- field: "options",
159
- reason: "Configuration is required. Add options to your changesets config:\n\"changelog\": [\"@savvy-web/changesets\", { \"repo\": \"owner/repository\" }]"
160
- }));
161
- if (typeof input !== "object") return Effect.fail(new ConfigurationError({
162
- field: "options",
163
- reason: "Configuration must be an object"
164
- }));
165
- const obj = input;
166
- if (!("repo" in obj) || obj.repo === void 0) return Effect.fail(new ConfigurationError({
167
- field: "repo",
168
- reason: "Repository name is required. Add the \"repo\" option to your changesets config:\n\"changelog\": [\"@savvy-web/changesets\", { \"repo\": \"owner/repository\" }]"
169
- }));
170
- if (typeof obj.repo === "string" && !REPO_PATTERN.test(obj.repo)) return Effect.fail(new ConfigurationError({
171
- field: "repo",
172
- reason: `Invalid repository format: "${obj.repo}". Expected format is "owner/repository" (e.g., "microsoft/vscode")`
173
- }));
174
- return Schema.decodeUnknown(ChangesetOptionsSchema)(input).pipe(Effect.mapError((parseError) => new ConfigurationError({
175
- field: "options",
176
- reason: String(parseError)
177
- })));
178
- }
179
-
180
- //#endregion
181
- export { ChangesetOptionsSchema, RepoSchema, validateChangesetOptions };
@@ -1,129 +0,0 @@
1
- const require_version_files = require('./version-files.cjs');
2
- let effect = require("effect");
3
-
4
- //#region ../silk-effects/dist/dev/pkg/changesets/schemas/package-scope.js
5
- /**
6
- * Schemas for the per-package release-surface configuration introduced in
7
- * \@savvy-web/changesets 0.9.0.
8
- *
9
- * @remarks
10
- * A `PackageScope` is the value side of the `packages` record on the
11
- * \@savvy-web/changesets changelog options. It tells the formatter which
12
- * non-workspace paths belong to a package's release surface (via
13
- * `additionalScopes`) and which files have their version fields bumped in
14
- * lockstep with the package (via `versionFiles`).
15
- *
16
- * ```jsonc
17
- * "changelog": [
18
- * "@savvy-web/changesets/changelog",
19
- * {
20
- * "repo": "savvy-web/changesets",
21
- * "packages": {
22
- * "@savvy-web/changesets": {
23
- * "additionalScopes": ["plugin/**"],
24
- * "versionFiles": [
25
- * { "glob": "plugin/.claude-plugin/plugin.json",
26
- * "paths": ["$.version"] }
27
- * ]
28
- * }
29
- * }
30
- * }
31
- * ]
32
- * ```
33
- *
34
- * Validation contracts that span multiple packages (no-overlap rules for
35
- * `additionalScopes`, no glob+path conflicts in `versionFiles`, unknown
36
- * package keys) are enforced by `ConfigInspector` at load time, not at the
37
- * schema level — schemas only validate per-entry shape.
38
- *
39
- * @see {@link ChangesetOptionsSchema} for the consuming options shape
40
- * @see {@link VersionFileConfigSchema} for the version-file entry shape
41
- * @see {@link https://effect.website/docs/schema/introduction | Effect Schema documentation}
42
- *
43
- */
44
- /**
45
- * Schema for a single repo-relative glob pattern.
46
- *
47
- * @remarks
48
- * Globs in `additionalScopes` must be repo-relative — absolute paths and
49
- * parent traversal (`../`) are rejected outright because they cannot be
50
- * meaningfully resolved against the project workspace. Negation patterns
51
- * (`!path/**`) are accepted; minimatch handles them at match time.
52
- *
53
- * @example
54
- * ```typescript
55
- * import { Schema } from "effect";
56
- * import { GlobSchema } from "@savvy-web/changesets";
57
- *
58
- * Schema.decodeUnknownSync(GlobSchema)("plugin/**"); // ok
59
- * Schema.decodeUnknownSync(GlobSchema)("!plugin/cache/**"); // ok (negation)
60
- * Schema.decodeUnknownSync(GlobSchema)("/absolute/path"); // throws
61
- * Schema.decodeUnknownSync(GlobSchema)("../sibling/**"); // throws
62
- * ```
63
- *
64
- * @public
65
- */
66
- const GlobSchema = effect.Schema.String.pipe(effect.Schema.minLength(1), effect.Schema.filter((s) => !s.startsWith("/") && !s.startsWith("../") && !s.includes("/../"), { message: () => "Glob must be repo-relative — absolute paths and parent traversal (../) are not allowed" }));
67
- /**
68
- * Schema for a single entry in the `packages` record — the per-package
69
- * release-surface declaration.
70
- *
71
- * @remarks
72
- * Both fields are optional. An empty object (`{}`) is a valid PackageScope
73
- * and means "this package uses only its workspace directory as its release
74
- * surface."
75
- *
76
- * - `additionalScopes` — repo-relative globs naming files outside the
77
- * package's workspace directory that belong to the package's release
78
- * surface. The contract is "a path belongs to exactly one package" — if
79
- * two packages declare overlapping additionalScopes, the config is
80
- * rejected by `ConfigInspector`.
81
- * - `versionFiles` — files whose JSON fields are bumped in lockstep with
82
- * this package's version. Each entry uses the new {@link VersionFileConfigSchema}
83
- * shape (no `package` field; the parent record key names the owner).
84
- *
85
- * @example
86
- * ```typescript
87
- * import { Schema } from "effect";
88
- * import { PackageScopeSchema } from "@savvy-web/changesets";
89
- *
90
- * const scope = Schema.decodeUnknownSync(PackageScopeSchema)({
91
- * additionalScopes: ["plugin/**", "!plugin/.cache/**"],
92
- * versionFiles: [
93
- * { glob: "plugin/.claude-plugin/plugin.json", paths: ["$.version"] },
94
- * ],
95
- * });
96
- * ```
97
- *
98
- * @see {@link PackageScope} for the inferred TypeScript type
99
- * @see {@link GlobSchema} for individual glob validation rules
100
- * @see {@link VersionFileConfigSchema} for the version-file entry shape
101
- *
102
- * @public
103
- */
104
- const PackageScopeSchema = effect.Schema.Struct({
105
- /** Repo-relative globs naming files outside the package's workspace directory that belong to its release surface. */
106
- additionalScopes: effect.Schema.optional(effect.Schema.Array(GlobSchema)),
107
- /** Files whose JSON fields are bumped in lockstep with this package's version. */
108
- versionFiles: effect.Schema.optional(effect.Schema.Array(require_version_files.VersionFileConfigSchema))
109
- });
110
- /**
111
- * Schema for the `packages` record on the changelog options.
112
- *
113
- * @remarks
114
- * Keys are package names. The schema itself does not validate that keys
115
- * resolve to known workspace packages — that check is performed by
116
- * `ConfigInspector` at config-load time, where `WorkspaceDiscovery` is
117
- * available to enumerate the workspace.
118
- *
119
- * @public
120
- */
121
- const PackagesRecordSchema = effect.Schema.Record({
122
- key: effect.Schema.String,
123
- value: PackageScopeSchema
124
- });
125
-
126
- //#endregion
127
- exports.GlobSchema = GlobSchema;
128
- exports.PackageScopeSchema = PackageScopeSchema;
129
- exports.PackagesRecordSchema = PackagesRecordSchema;
@@ -1,127 +0,0 @@
1
- import { VersionFileConfigSchema } from "./version-files.js";
2
- import { Schema } from "effect";
3
-
4
- //#region ../silk-effects/dist/dev/pkg/changesets/schemas/package-scope.js
5
- /**
6
- * Schemas for the per-package release-surface configuration introduced in
7
- * \@savvy-web/changesets 0.9.0.
8
- *
9
- * @remarks
10
- * A `PackageScope` is the value side of the `packages` record on the
11
- * \@savvy-web/changesets changelog options. It tells the formatter which
12
- * non-workspace paths belong to a package's release surface (via
13
- * `additionalScopes`) and which files have their version fields bumped in
14
- * lockstep with the package (via `versionFiles`).
15
- *
16
- * ```jsonc
17
- * "changelog": [
18
- * "@savvy-web/changesets/changelog",
19
- * {
20
- * "repo": "savvy-web/changesets",
21
- * "packages": {
22
- * "@savvy-web/changesets": {
23
- * "additionalScopes": ["plugin/**"],
24
- * "versionFiles": [
25
- * { "glob": "plugin/.claude-plugin/plugin.json",
26
- * "paths": ["$.version"] }
27
- * ]
28
- * }
29
- * }
30
- * }
31
- * ]
32
- * ```
33
- *
34
- * Validation contracts that span multiple packages (no-overlap rules for
35
- * `additionalScopes`, no glob+path conflicts in `versionFiles`, unknown
36
- * package keys) are enforced by `ConfigInspector` at load time, not at the
37
- * schema level — schemas only validate per-entry shape.
38
- *
39
- * @see {@link ChangesetOptionsSchema} for the consuming options shape
40
- * @see {@link VersionFileConfigSchema} for the version-file entry shape
41
- * @see {@link https://effect.website/docs/schema/introduction | Effect Schema documentation}
42
- *
43
- */
44
- /**
45
- * Schema for a single repo-relative glob pattern.
46
- *
47
- * @remarks
48
- * Globs in `additionalScopes` must be repo-relative — absolute paths and
49
- * parent traversal (`../`) are rejected outright because they cannot be
50
- * meaningfully resolved against the project workspace. Negation patterns
51
- * (`!path/**`) are accepted; minimatch handles them at match time.
52
- *
53
- * @example
54
- * ```typescript
55
- * import { Schema } from "effect";
56
- * import { GlobSchema } from "@savvy-web/changesets";
57
- *
58
- * Schema.decodeUnknownSync(GlobSchema)("plugin/**"); // ok
59
- * Schema.decodeUnknownSync(GlobSchema)("!plugin/cache/**"); // ok (negation)
60
- * Schema.decodeUnknownSync(GlobSchema)("/absolute/path"); // throws
61
- * Schema.decodeUnknownSync(GlobSchema)("../sibling/**"); // throws
62
- * ```
63
- *
64
- * @public
65
- */
66
- const GlobSchema = Schema.String.pipe(Schema.minLength(1), Schema.filter((s) => !s.startsWith("/") && !s.startsWith("../") && !s.includes("/../"), { message: () => "Glob must be repo-relative — absolute paths and parent traversal (../) are not allowed" }));
67
- /**
68
- * Schema for a single entry in the `packages` record — the per-package
69
- * release-surface declaration.
70
- *
71
- * @remarks
72
- * Both fields are optional. An empty object (`{}`) is a valid PackageScope
73
- * and means "this package uses only its workspace directory as its release
74
- * surface."
75
- *
76
- * - `additionalScopes` — repo-relative globs naming files outside the
77
- * package's workspace directory that belong to the package's release
78
- * surface. The contract is "a path belongs to exactly one package" — if
79
- * two packages declare overlapping additionalScopes, the config is
80
- * rejected by `ConfigInspector`.
81
- * - `versionFiles` — files whose JSON fields are bumped in lockstep with
82
- * this package's version. Each entry uses the new {@link VersionFileConfigSchema}
83
- * shape (no `package` field; the parent record key names the owner).
84
- *
85
- * @example
86
- * ```typescript
87
- * import { Schema } from "effect";
88
- * import { PackageScopeSchema } from "@savvy-web/changesets";
89
- *
90
- * const scope = Schema.decodeUnknownSync(PackageScopeSchema)({
91
- * additionalScopes: ["plugin/**", "!plugin/.cache/**"],
92
- * versionFiles: [
93
- * { glob: "plugin/.claude-plugin/plugin.json", paths: ["$.version"] },
94
- * ],
95
- * });
96
- * ```
97
- *
98
- * @see {@link PackageScope} for the inferred TypeScript type
99
- * @see {@link GlobSchema} for individual glob validation rules
100
- * @see {@link VersionFileConfigSchema} for the version-file entry shape
101
- *
102
- * @public
103
- */
104
- const PackageScopeSchema = Schema.Struct({
105
- /** Repo-relative globs naming files outside the package's workspace directory that belong to its release surface. */
106
- additionalScopes: Schema.optional(Schema.Array(GlobSchema)),
107
- /** Files whose JSON fields are bumped in lockstep with this package's version. */
108
- versionFiles: Schema.optional(Schema.Array(VersionFileConfigSchema))
109
- });
110
- /**
111
- * Schema for the `packages` record on the changelog options.
112
- *
113
- * @remarks
114
- * Keys are package names. The schema itself does not validate that keys
115
- * resolve to known workspace packages — that check is performed by
116
- * `ConfigInspector` at config-load time, where `WorkspaceDiscovery` is
117
- * available to enumerate the workspace.
118
- *
119
- * @public
120
- */
121
- const PackagesRecordSchema = Schema.Record({
122
- key: Schema.String,
123
- value: PackageScopeSchema
124
- });
125
-
126
- //#endregion
127
- export { GlobSchema, PackageScopeSchema, PackagesRecordSchema };