@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,65 +0,0 @@
1
- import { Schema } from "effect";
2
-
3
- //#region ../silk-effects/dist/dev/pkg/changesets/categories/types.js
4
- /**
5
- * Section category schema and type definitions.
6
- *
7
- * @remarks
8
- * Section categories define how changes are grouped and ordered in release
9
- * notes and CHANGELOGs. Each category maps conventional commit types to a
10
- * display heading with a priority for ordering. Categories are used across
11
- * all three processing layers: remark-lint pre-validation (Layer 1),
12
- * changelog formatting (Layer 2), and remark-transform post-processing
13
- * (Layer 3).
14
- *
15
- * @see {@link CATEGORIES} for the predefined list of 13 section categories
16
- * @see {@link resolveCommitType} for mapping commit types to categories
17
- * @see {@link https://effect.website/docs/schema/introduction | Effect Schema documentation}
18
- *
19
- */
20
- /**
21
- * Schema for a section category that defines how changes are grouped in release notes.
22
- *
23
- * @remarks
24
- * A section category has four fields:
25
- * - `heading` -- the display heading used in CHANGELOG output (e.g., `"Features"`, `"Bug Fixes"`)
26
- * - `priority` -- an integer controlling display order (lower = higher priority)
27
- * - `commitTypes` -- conventional commit type prefixes that map to this category (e.g., `["feat"]`)
28
- * - `description` -- a brief human-readable description for documentation
29
- *
30
- * Categories with an empty `commitTypes` array are resolved through other means:
31
- * `BREAKING_CHANGES` is resolved via the `!` suffix on any commit type, and
32
- * `OTHER` is the fallback for unrecognized types.
33
- *
34
- * @example
35
- * ```typescript
36
- * import { Schema } from "effect";
37
- * import { SectionCategorySchema } from "@savvy-web/changesets";
38
- * import type { SectionCategory } from "@savvy-web/changesets";
39
- *
40
- * const category: SectionCategory = Schema.decodeUnknownSync(SectionCategorySchema)({
41
- * heading: "Features",
42
- * priority: 2,
43
- * commitTypes: ["feat"],
44
- * description: "New functionality",
45
- * });
46
- * ```
47
- *
48
- * @see {@link SectionCategory} for the inferred TypeScript type
49
- * @see {@link CATEGORIES} for all predefined categories
50
- *
51
- * @public
52
- */
53
- const SectionCategorySchema = Schema.Struct({
54
- /** Display heading used in CHANGELOG output. */
55
- heading: Schema.String,
56
- /** Priority for ordering (lower = higher priority). */
57
- priority: Schema.Number,
58
- /** Conventional commit types that map to this category. */
59
- commitTypes: Schema.Array(Schema.String),
60
- /** Brief description for documentation. */
61
- description: Schema.String
62
- });
63
-
64
- //#endregion
65
- export { SectionCategorySchema };
@@ -1,114 +0,0 @@
1
- const require_markdown_link = require('../utils/markdown-link.cjs');
2
-
3
- //#region ../silk-effects/dist/dev/pkg/changesets/changelog/formatting.js
4
- /**
5
- * Issue reference categories and their display labels.
6
- *
7
- * Used by {@link formatChangelogEntry} to render issue links grouped
8
- * by their relationship to the change (Closes, Fixes, Refs).
9
- *
10
- * @internal
11
- */
12
- const ISSUE_CATEGORIES = [
13
- {
14
- key: "closes",
15
- label: "Closes"
16
- },
17
- {
18
- key: "fixes",
19
- label: "Fixes"
20
- },
21
- {
22
- key: "refs",
23
- label: "Refs"
24
- }
25
- ];
26
- /**
27
- * Format a changelog entry into a markdown string with GitHub links.
28
- *
29
- * Produces the summary text followed by any issue references, each
30
- * rendered as GitHub links.
31
- *
32
- * @remarks
33
- * The output does **not** include a leading `- ` list marker — the caller
34
- * is responsible for wrapping the result in a markdown list item. Issue
35
- * references are appended on a new paragraph (double newline) when present,
36
- * grouped by category: "Closes", "Fixes", "Refs".
37
- *
38
- * Output format examples:
39
- *
40
- * Without issues: `Summary text`
41
- *
42
- * With issues: `Summary text` followed by `Closes: [#1](issue-url)`
43
- *
44
- * @param entry - The changelog entry containing summary and issue data
45
- * @param options - Must include `repo` in `owner/repo` format for link generation
46
- * @returns Formatted markdown string (without leading `- `)
47
- *
48
- * @internal
49
- */
50
- function formatChangelogEntry(entry, options) {
51
- const parts = [];
52
- parts.push(entry.summary.trim());
53
- const issueLinks = [];
54
- for (const { key, label } of ISSUE_CATEGORIES) {
55
- const numbers = entry.issues[key];
56
- if (numbers.length > 0) {
57
- const links = numbers.map((num) => `[#${num}](https://github.com/${options.repo}/issues/${num})`);
58
- issueLinks.push(`${label}: ${links.join(", ")}`);
59
- }
60
- }
61
- if (issueLinks.length > 0) parts.push(`\n\n${issueLinks.join(". ")}`);
62
- return parts.join(" ");
63
- }
64
- /**
65
- * Format pull-request reference and user attribution for a changelog entry.
66
- *
67
- * Appends a PR link and/or a "Thanks \@user!" attribution suffix to a
68
- * changelog line. The output includes a leading space when non-empty, so it
69
- * can be directly concatenated after the main entry text.
70
- *
71
- * @remarks
72
- * The `links` parameter may contain either plain URLs or markdown-formatted
73
- * links (e.g., `[#42](https://...)`). This function handles both formats
74
- * via {@link extractUrlFromMarkdown}, which strips the markdown link syntax
75
- * and extracts the raw URL.
76
- *
77
- * Output format examples:
78
- *
79
- * PR only: `[#42](pr-url)`
80
- *
81
- * PR without link: `(#42)`
82
- *
83
- * User only: `Thanks user!`
84
- *
85
- * Both: `[#42](pr-url) Thanks [user](profile-url)!`
86
- *
87
- * Neither: empty string
88
- *
89
- * @param pr - Pull request number (omit if no PR is associated)
90
- * @param user - GitHub username of the contributor (omit if unknown)
91
- * @param links - Optional pre-formatted links for the PR and user from the GitHub API
92
- * @returns Formatted attribution string (with leading space) or empty string
93
- *
94
- * @internal
95
- */
96
- function formatPRAndUserAttribution(pr, user, links) {
97
- let prReference = "";
98
- if (pr) if (links?.pull) {
99
- const pullUrl = require_markdown_link.extractUrlFromMarkdown(links.pull);
100
- prReference = ` [#${String(pr)}](${pullUrl})`;
101
- } else prReference = ` (#${String(pr)})`;
102
- if (user) {
103
- if (links?.user) {
104
- const userUrl = require_markdown_link.extractUrlFromMarkdown(links.user);
105
- return `${prReference} Thanks [@${user}](${userUrl})!`;
106
- }
107
- return `${prReference} Thanks @${user}!`;
108
- }
109
- return prReference;
110
- }
111
-
112
- //#endregion
113
- exports.formatChangelogEntry = formatChangelogEntry;
114
- exports.formatPRAndUserAttribution = formatPRAndUserAttribution;
@@ -1,113 +0,0 @@
1
- import { extractUrlFromMarkdown } from "../utils/markdown-link.js";
2
-
3
- //#region ../silk-effects/dist/dev/pkg/changesets/changelog/formatting.js
4
- /**
5
- * Issue reference categories and their display labels.
6
- *
7
- * Used by {@link formatChangelogEntry} to render issue links grouped
8
- * by their relationship to the change (Closes, Fixes, Refs).
9
- *
10
- * @internal
11
- */
12
- const ISSUE_CATEGORIES = [
13
- {
14
- key: "closes",
15
- label: "Closes"
16
- },
17
- {
18
- key: "fixes",
19
- label: "Fixes"
20
- },
21
- {
22
- key: "refs",
23
- label: "Refs"
24
- }
25
- ];
26
- /**
27
- * Format a changelog entry into a markdown string with GitHub links.
28
- *
29
- * Produces the summary text followed by any issue references, each
30
- * rendered as GitHub links.
31
- *
32
- * @remarks
33
- * The output does **not** include a leading `- ` list marker — the caller
34
- * is responsible for wrapping the result in a markdown list item. Issue
35
- * references are appended on a new paragraph (double newline) when present,
36
- * grouped by category: "Closes", "Fixes", "Refs".
37
- *
38
- * Output format examples:
39
- *
40
- * Without issues: `Summary text`
41
- *
42
- * With issues: `Summary text` followed by `Closes: [#1](issue-url)`
43
- *
44
- * @param entry - The changelog entry containing summary and issue data
45
- * @param options - Must include `repo` in `owner/repo` format for link generation
46
- * @returns Formatted markdown string (without leading `- `)
47
- *
48
- * @internal
49
- */
50
- function formatChangelogEntry(entry, options) {
51
- const parts = [];
52
- parts.push(entry.summary.trim());
53
- const issueLinks = [];
54
- for (const { key, label } of ISSUE_CATEGORIES) {
55
- const numbers = entry.issues[key];
56
- if (numbers.length > 0) {
57
- const links = numbers.map((num) => `[#${num}](https://github.com/${options.repo}/issues/${num})`);
58
- issueLinks.push(`${label}: ${links.join(", ")}`);
59
- }
60
- }
61
- if (issueLinks.length > 0) parts.push(`\n\n${issueLinks.join(". ")}`);
62
- return parts.join(" ");
63
- }
64
- /**
65
- * Format pull-request reference and user attribution for a changelog entry.
66
- *
67
- * Appends a PR link and/or a "Thanks \@user!" attribution suffix to a
68
- * changelog line. The output includes a leading space when non-empty, so it
69
- * can be directly concatenated after the main entry text.
70
- *
71
- * @remarks
72
- * The `links` parameter may contain either plain URLs or markdown-formatted
73
- * links (e.g., `[#42](https://...)`). This function handles both formats
74
- * via {@link extractUrlFromMarkdown}, which strips the markdown link syntax
75
- * and extracts the raw URL.
76
- *
77
- * Output format examples:
78
- *
79
- * PR only: `[#42](pr-url)`
80
- *
81
- * PR without link: `(#42)`
82
- *
83
- * User only: `Thanks user!`
84
- *
85
- * Both: `[#42](pr-url) Thanks [user](profile-url)!`
86
- *
87
- * Neither: empty string
88
- *
89
- * @param pr - Pull request number (omit if no PR is associated)
90
- * @param user - GitHub username of the contributor (omit if unknown)
91
- * @param links - Optional pre-formatted links for the PR and user from the GitHub API
92
- * @returns Formatted attribution string (with leading space) or empty string
93
- *
94
- * @internal
95
- */
96
- function formatPRAndUserAttribution(pr, user, links) {
97
- let prReference = "";
98
- if (pr) if (links?.pull) {
99
- const pullUrl = extractUrlFromMarkdown(links.pull);
100
- prReference = ` [#${String(pr)}](${pullUrl})`;
101
- } else prReference = ` (#${String(pr)})`;
102
- if (user) {
103
- if (links?.user) {
104
- const userUrl = extractUrlFromMarkdown(links.user);
105
- return `${prReference} Thanks [@${user}](${userUrl})!`;
106
- }
107
- return `${prReference} Thanks @${user}!`;
108
- }
109
- return prReference;
110
- }
111
-
112
- //#endregion
113
- export { formatChangelogEntry, formatPRAndUserAttribution };
@@ -1,118 +0,0 @@
1
- const require_github = require('../services/github.cjs');
2
- const require_dependency_table = require('../utils/dependency-table.cjs');
3
- let effect = require("effect");
4
-
5
- //#region ../silk-effects/dist/dev/pkg/changesets/changelog/getDependencyReleaseLine.js
6
- /**
7
- * Core formatter: getDependencyReleaseLine.
8
- *
9
- * Formats dependency update entries as a structured markdown table showing
10
- * each updated dependency's name, type, action, and version range.
11
- *
12
- * @remarks
13
- * This formatter is the companion to {@link getReleaseLine}. While
14
- * `getReleaseLine` handles individual changeset entries, this module
15
- * handles the "Updated dependencies" section that Changesets appends
16
- * when a package's dependencies are bumped as part of a release.
17
- *
18
- * The output is a `### Dependencies` h3 heading followed by a GFM
19
- * (GitHub Flavored Markdown) table with columns: `Dependency`, `Type`,
20
- * `Action`, `From`, `To`. The dependency type is inferred from the
21
- * consuming package's `package.json` fields (`dependencies`,
22
- * `devDependencies`, `peerDependencies`, `optionalDependencies`) via
23
- * the {@link inferDependencyType} helper. Downstream, the heading is
24
- * consumed by `AggregateDependencyTablesPlugin`, which locates and
25
- * merges per-package dependency tables during changelog assembly.
26
- *
27
- * ### Dependency type inference
28
- *
29
- * The {@link FIELD_MAP} constant defines the precedence order for
30
- * inferring the dependency type. The first matching field wins:
31
- *
32
- * 1. `dependencies` maps to `"dependency"`
33
- * 2. `devDependencies` maps to `"devDependency"`
34
- * 3. `peerDependencies` maps to `"peerDependency"`
35
- * 4. `optionalDependencies` maps to `"optionalDependency"`
36
- *
37
- * If the dependency is not found in any field, it defaults to `"dependency"`.
38
- *
39
- * @see {@link getReleaseLine} for the companion individual changeset formatter
40
- * @see {@link serializeDependencyTableToMarkdown} for the table serialization utility
41
- *
42
- * @internal
43
- */
44
- /**
45
- * Field-to-type mapping for inferring dependency type from `package.json`.
46
- *
47
- * Maps `package.json` dependency fields to their corresponding
48
- * `DependencyTableType` values. The order defines precedence when a
49
- * dependency name appears in multiple fields (first match wins).
50
- *
51
- * @internal
52
- */
53
- const FIELD_MAP = [
54
- ["dependencies", "dependency"],
55
- ["devDependencies", "devDependency"],
56
- ["peerDependencies", "peerDependency"],
57
- ["optionalDependencies", "optionalDependency"]
58
- ];
59
- /**
60
- * Infer the dependency table type from a package's `package.json`.
61
- *
62
- * Inspects the consuming package's `package.json` to determine which
63
- * dependency field contains the given dependency name. Returns the
64
- * corresponding `DependencyTableType` value, or `"dependency"` as a
65
- * fallback when the dependency is not found in any standard field.
66
- *
67
- * @param dep - The dependency update with its associated `packageJson`
68
- * @returns The inferred dependency type for display in the table
69
- *
70
- * @internal
71
- */
72
- function inferDependencyType(dep) {
73
- const pkg = dep.packageJson;
74
- for (const [field, type] of FIELD_MAP) {
75
- const section = pkg[field];
76
- if (typeof section === "object" && section !== null && dep.name in section) return type;
77
- }
78
- return "dependency";
79
- }
80
- /**
81
- * Format dependency release lines as a structured markdown table.
82
- *
83
- * This is the core Effect program that implements the `getDependencyReleaseLine`
84
- * contract from the Changesets API. It requires {@link GitHubService} in its
85
- * environment (currently unused but kept for API contract stability).
86
- *
87
- * @remarks
88
- * The function maps each `ModCompWithPackage` entry to a `DependencyTableRow`,
89
- * inferring the dependency type from the consuming package's `package.json`,
90
- * then delegates to `serializeDependencyTableToMarkdown` for GFM table
91
- * rendering, prefixed with a `### Dependencies` heading. Returns an empty
92
- * string when no dependencies were updated.
93
- *
94
- * The `_changesets` and `_options` parameters are part of the Changesets API
95
- * contract but are not used in the table format. They are retained for
96
- * interface compatibility.
97
- *
98
- * @param _changesets - Changesets that caused the dependency updates (unused in table format)
99
- * @param dependenciesUpdated - The list of dependencies that were updated, including old/new versions
100
- * @param _options - Validated configuration options (unused in table format)
101
- * @returns An `Effect` that resolves to a `### Dependencies` heading followed by a formatted markdown table string, or empty string if no dependencies were updated
102
- */
103
- function getDependencyReleaseLine(_changesets, dependenciesUpdated, _options) {
104
- return effect.Effect.gen(function* () {
105
- if (dependenciesUpdated.length === 0) return "";
106
- yield* require_github.GitHubService;
107
- return `### Dependencies\n\n${require_dependency_table.serializeDependencyTableToMarkdown(dependenciesUpdated.map((dep) => ({
108
- dependency: dep.name,
109
- type: inferDependencyType(dep),
110
- action: "updated",
111
- from: dep.oldVersion,
112
- to: dep.newVersion
113
- })))}`;
114
- });
115
- }
116
-
117
- //#endregion
118
- exports.getDependencyReleaseLine = getDependencyReleaseLine;
@@ -1,118 +0,0 @@
1
- import { GitHubService } from "../services/github.js";
2
- import { serializeDependencyTableToMarkdown } from "../utils/dependency-table.js";
3
- import { Effect } from "effect";
4
-
5
- //#region ../silk-effects/dist/dev/pkg/changesets/changelog/getDependencyReleaseLine.js
6
- /**
7
- * Core formatter: getDependencyReleaseLine.
8
- *
9
- * Formats dependency update entries as a structured markdown table showing
10
- * each updated dependency's name, type, action, and version range.
11
- *
12
- * @remarks
13
- * This formatter is the companion to {@link getReleaseLine}. While
14
- * `getReleaseLine` handles individual changeset entries, this module
15
- * handles the "Updated dependencies" section that Changesets appends
16
- * when a package's dependencies are bumped as part of a release.
17
- *
18
- * The output is a `### Dependencies` h3 heading followed by a GFM
19
- * (GitHub Flavored Markdown) table with columns: `Dependency`, `Type`,
20
- * `Action`, `From`, `To`. The dependency type is inferred from the
21
- * consuming package's `package.json` fields (`dependencies`,
22
- * `devDependencies`, `peerDependencies`, `optionalDependencies`) via
23
- * the {@link inferDependencyType} helper. Downstream, the heading is
24
- * consumed by `AggregateDependencyTablesPlugin`, which locates and
25
- * merges per-package dependency tables during changelog assembly.
26
- *
27
- * ### Dependency type inference
28
- *
29
- * The {@link FIELD_MAP} constant defines the precedence order for
30
- * inferring the dependency type. The first matching field wins:
31
- *
32
- * 1. `dependencies` maps to `"dependency"`
33
- * 2. `devDependencies` maps to `"devDependency"`
34
- * 3. `peerDependencies` maps to `"peerDependency"`
35
- * 4. `optionalDependencies` maps to `"optionalDependency"`
36
- *
37
- * If the dependency is not found in any field, it defaults to `"dependency"`.
38
- *
39
- * @see {@link getReleaseLine} for the companion individual changeset formatter
40
- * @see {@link serializeDependencyTableToMarkdown} for the table serialization utility
41
- *
42
- * @internal
43
- */
44
- /**
45
- * Field-to-type mapping for inferring dependency type from `package.json`.
46
- *
47
- * Maps `package.json` dependency fields to their corresponding
48
- * `DependencyTableType` values. The order defines precedence when a
49
- * dependency name appears in multiple fields (first match wins).
50
- *
51
- * @internal
52
- */
53
- const FIELD_MAP = [
54
- ["dependencies", "dependency"],
55
- ["devDependencies", "devDependency"],
56
- ["peerDependencies", "peerDependency"],
57
- ["optionalDependencies", "optionalDependency"]
58
- ];
59
- /**
60
- * Infer the dependency table type from a package's `package.json`.
61
- *
62
- * Inspects the consuming package's `package.json` to determine which
63
- * dependency field contains the given dependency name. Returns the
64
- * corresponding `DependencyTableType` value, or `"dependency"` as a
65
- * fallback when the dependency is not found in any standard field.
66
- *
67
- * @param dep - The dependency update with its associated `packageJson`
68
- * @returns The inferred dependency type for display in the table
69
- *
70
- * @internal
71
- */
72
- function inferDependencyType(dep) {
73
- const pkg = dep.packageJson;
74
- for (const [field, type] of FIELD_MAP) {
75
- const section = pkg[field];
76
- if (typeof section === "object" && section !== null && dep.name in section) return type;
77
- }
78
- return "dependency";
79
- }
80
- /**
81
- * Format dependency release lines as a structured markdown table.
82
- *
83
- * This is the core Effect program that implements the `getDependencyReleaseLine`
84
- * contract from the Changesets API. It requires {@link GitHubService} in its
85
- * environment (currently unused but kept for API contract stability).
86
- *
87
- * @remarks
88
- * The function maps each `ModCompWithPackage` entry to a `DependencyTableRow`,
89
- * inferring the dependency type from the consuming package's `package.json`,
90
- * then delegates to `serializeDependencyTableToMarkdown` for GFM table
91
- * rendering, prefixed with a `### Dependencies` heading. Returns an empty
92
- * string when no dependencies were updated.
93
- *
94
- * The `_changesets` and `_options` parameters are part of the Changesets API
95
- * contract but are not used in the table format. They are retained for
96
- * interface compatibility.
97
- *
98
- * @param _changesets - Changesets that caused the dependency updates (unused in table format)
99
- * @param dependenciesUpdated - The list of dependencies that were updated, including old/new versions
100
- * @param _options - Validated configuration options (unused in table format)
101
- * @returns An `Effect` that resolves to a `### Dependencies` heading followed by a formatted markdown table string, or empty string if no dependencies were updated
102
- */
103
- function getDependencyReleaseLine(_changesets, dependenciesUpdated, _options) {
104
- return Effect.gen(function* () {
105
- if (dependenciesUpdated.length === 0) return "";
106
- yield* GitHubService;
107
- return `### Dependencies\n\n${serializeDependencyTableToMarkdown(dependenciesUpdated.map((dep) => ({
108
- dependency: dep.name,
109
- type: inferDependencyType(dep),
110
- action: "updated",
111
- from: dep.oldVersion,
112
- to: dep.newVersion
113
- })))}`;
114
- });
115
- }
116
-
117
- //#endregion
118
- export { getDependencyReleaseLine };
@@ -1,122 +0,0 @@
1
- const require_index = require('../categories/index.cjs');
2
- const require_github = require('../services/github.cjs');
3
- const require_github$1 = require('../schemas/github.cjs');
4
- const require_commit_parser = require('../utils/commit-parser.cjs');
5
- const require_issue_refs = require('../utils/issue-refs.cjs');
6
- const require_logger = require('../utils/logger.cjs');
7
- const require_section_parser = require('../utils/section-parser.cjs');
8
- const require_formatting = require('./formatting.cjs');
9
- let effect = require("effect");
10
-
11
- //#region ../silk-effects/dist/dev/pkg/changesets/changelog/getReleaseLine.js
12
- /**
13
- * Core formatter: getReleaseLine.
14
- *
15
- * Formats a single changeset into a changelog entry. This is the primary
16
- * formatting function in the changelog pipeline, responsible for transforming
17
- * a `NewChangesetWithCommit` into structured markdown output.
18
- *
19
- * @remarks
20
- * The formatter supports two distinct input modes:
21
- *
22
- * 1. **Section-aware changesets** — When the changeset summary contains h2
23
- * headings (e.g., `## Features`, `## Bug Fixes`), each section is rendered
24
- * as an h3 heading with list items beneath it. This mode
25
- * produces multi-line output suitable for rich changelogs.
26
- *
27
- * 2. **Flat-text changesets** — When the summary is plain text without section
28
- * headings, the formatter falls back to backward-compatible single-line
29
- * output. The conventional commit type is resolved via `resolveCommitType`
30
- * to determine the changelog category.
31
- *
32
- * In both modes, the formatter:
33
- * - Fetches GitHub metadata (PR number, author) via {@link GitHubService}
34
- * - Extracts and renders issue references (Closes, Fixes, Refs)
35
- * - Appends PR and user attribution when available
36
- *
37
- * @see {@link formatChangelogEntry} for the low-level entry formatting
38
- * @see {@link formatPRAndUserAttribution} for attribution suffix generation
39
- * @see {@link getDependencyReleaseLine} for the companion dependency formatter
40
- *
41
- * @internal
42
- */
43
- /**
44
- * Format a single changeset into a markdown release line.
45
- *
46
- * This is the core Effect program that implements the `getReleaseLine` contract
47
- * from the Changesets API. It requires {@link GitHubService} in its environment
48
- * for resolving commit metadata.
49
- *
50
- * @remarks
51
- * The formatting pipeline proceeds in seven steps:
52
- *
53
- * 1. **Fetch GitHub info** — If the changeset has a commit hash, query
54
- * the {@link GitHubService} for PR number, author, and links. Failures
55
- * are caught and logged as warnings (attribution is simply omitted).
56
- * 2. **Parse sections** — Attempt to split the summary into h2-delimited
57
- * sections using `parseChangesetSections`.
58
- * 3. **Parse conventional commit** — Extract the commit type, scope, and
59
- * breaking flag from the first line of the summary.
60
- * 4. **Extract issue references** — Parse the body for `Closes #N`,
61
- * `Fixes #N`, and `Refs #N` patterns.
62
- * 5. **Build attribution** — Format PR link and user credit from GitHub info.
63
- * 6. **Section-aware output** — If sections were found, render each as an
64
- * h3 heading with list items.
65
- * 7. **Flat-text fallback** — Otherwise, produce a single `- entry` line
66
- * with the resolved category heading.
67
- *
68
- * @param changeset - The changeset to format, including commit hash and summary text
69
- * @param versionType - The semantic version bump type (`major`, `minor`, or `patch`),
70
- * used as fallback when no conventional commit type is detected
71
- * @param options - Validated configuration options (must include `repo` in `owner/repo` format)
72
- * @returns An `Effect` that resolves to a formatted markdown string
73
- */
74
- function getReleaseLine(changeset, versionType, options) {
75
- return effect.Effect.gen(function* () {
76
- let commitInfo = null;
77
- if (changeset.commit) commitInfo = yield* (yield* require_github.GitHubService).getInfo({
78
- commit: changeset.commit,
79
- repo: options.repo
80
- }).pipe(effect.Effect.flatMap((raw) => effect.Schema.decodeUnknown(require_github$1.GitHubInfoSchema)(raw).pipe(effect.Effect.map(() => raw), effect.Effect.catchAll(() => effect.Effect.succeed(raw)))), effect.Effect.catchAll((error) => {
81
- require_logger.logWarning("Could not fetch GitHub info for commit:", changeset.commit ?? "", String(error));
82
- return effect.Effect.succeed(null);
83
- }));
84
- const parsed = require_section_parser.parseChangesetSections(changeset.summary);
85
- const firstLine = changeset.summary.split("\n")[0];
86
- const commitMsg = require_commit_parser.parseCommitMessage(firstLine);
87
- const issueRefs = require_issue_refs.parseIssueReferences(changeset.summary.split("\n").slice(1).join("\n"));
88
- const attribution = commitInfo ? require_formatting.formatPRAndUserAttribution(commitInfo.pull ?? void 0, commitInfo.user ?? void 0, commitInfo.links) : "";
89
- if (parsed.sections.length > 0) {
90
- const lines = [];
91
- if (parsed.preamble) {
92
- lines.push(parsed.preamble);
93
- lines.push("");
94
- }
95
- for (const section of parsed.sections) {
96
- lines.push(`### ${section.category.heading}`);
97
- lines.push("");
98
- if (section.content) {
99
- const contentLines = section.content.split("\n");
100
- const firstContentLine = contentLines[0];
101
- if (firstContentLine.startsWith("- ") || firstContentLine.startsWith("* ")) {
102
- lines.push(firstContentLine);
103
- lines.push(...contentLines.slice(1));
104
- } else {
105
- lines.push(`- ${firstContentLine}`);
106
- lines.push(...contentLines.slice(1).map((line) => line.length > 0 ? ` ${line}` : line));
107
- }
108
- }
109
- lines.push("");
110
- }
111
- return `${lines.join("\n").trimEnd()}${attribution}`;
112
- }
113
- return `- ${require_formatting.formatChangelogEntry({
114
- type: require_index.resolveCommitType(commitMsg.type ?? versionType, commitMsg.scope, commitMsg.breaking).heading,
115
- summary: changeset.summary,
116
- issues: issueRefs
117
- }, { repo: options.repo })}${attribution}`;
118
- });
119
- }
120
-
121
- //#endregion
122
- exports.getReleaseLine = getReleaseLine;