@hugojosefson/cli 0.11.0 → 0.13.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 (214) hide show
  1. package/README.md +1 -1
  2. package/esm/deno.js +16 -8
  3. package/esm/hj.js +19 -0
  4. package/esm/node_modules/@conventional-changelog/template/LICENSE.md +21 -0
  5. package/esm/node_modules/@conventional-changelog/template/README.md +66 -0
  6. package/esm/node_modules/@conventional-changelog/template/dist/elements.d.ts +78 -0
  7. package/esm/node_modules/@conventional-changelog/template/dist/elements.d.ts.map +1 -0
  8. package/esm/node_modules/@conventional-changelog/template/dist/elements.js +132 -0
  9. package/esm/node_modules/@conventional-changelog/template/dist/index.d.ts +6 -0
  10. package/esm/node_modules/@conventional-changelog/template/dist/index.d.ts.map +1 -0
  11. package/esm/node_modules/@conventional-changelog/template/dist/index.js +5 -0
  12. package/esm/node_modules/@conventional-changelog/template/dist/legacy.d.ts +20 -0
  13. package/esm/node_modules/@conventional-changelog/template/dist/legacy.d.ts.map +1 -0
  14. package/esm/node_modules/@conventional-changelog/template/dist/legacy.js +22 -0
  15. package/esm/node_modules/@conventional-changelog/template/dist/references.d.ts +43 -0
  16. package/esm/node_modules/@conventional-changelog/template/dist/references.d.ts.map +1 -0
  17. package/esm/node_modules/@conventional-changelog/template/dist/references.js +82 -0
  18. package/esm/node_modules/@conventional-changelog/template/dist/templates.d.ts +74 -0
  19. package/esm/node_modules/@conventional-changelog/template/dist/templates.d.ts.map +1 -0
  20. package/esm/node_modules/@conventional-changelog/template/dist/templates.js +125 -0
  21. package/esm/node_modules/@conventional-changelog/template/dist/types/commit.d.ts +37 -0
  22. package/esm/node_modules/@conventional-changelog/template/dist/types/commit.d.ts.map +1 -0
  23. package/esm/node_modules/@conventional-changelog/template/dist/types/commit.js +2 -0
  24. package/esm/node_modules/@conventional-changelog/template/dist/types/context.d.ts +113 -0
  25. package/esm/node_modules/@conventional-changelog/template/dist/types/context.d.ts.map +1 -0
  26. package/esm/node_modules/@conventional-changelog/template/dist/types/context.js +2 -0
  27. package/esm/node_modules/@conventional-changelog/template/dist/types/index.d.ts +4 -0
  28. package/esm/node_modules/@conventional-changelog/template/dist/types/index.d.ts.map +1 -0
  29. package/esm/node_modules/@conventional-changelog/template/dist/types/index.js +2 -0
  30. package/esm/node_modules/@conventional-changelog/template/dist/types/utils.d.ts +2 -0
  31. package/esm/node_modules/@conventional-changelog/template/dist/types/utils.d.ts.map +1 -0
  32. package/esm/node_modules/@conventional-changelog/template/dist/types/utils.js +2 -0
  33. package/esm/node_modules/@conventional-changelog/template/package.json +38 -0
  34. package/esm/node_modules/@simple-libs/stream-utils/LICENSE +21 -0
  35. package/esm/node_modules/@simple-libs/stream-utils/README.md +79 -0
  36. package/esm/node_modules/@simple-libs/stream-utils/dist/index.d.ts +51 -0
  37. package/esm/node_modules/@simple-libs/stream-utils/dist/index.d.ts.map +1 -0
  38. package/esm/node_modules/@simple-libs/stream-utils/dist/index.js +116 -0
  39. package/esm/node_modules/@simple-libs/stream-utils/package.json +38 -0
  40. package/esm/node_modules/argue-cli/LICENSE +21 -0
  41. package/esm/node_modules/argue-cli/README.md +239 -0
  42. package/esm/node_modules/argue-cli/dist/args.d.ts +30 -0
  43. package/esm/node_modules/argue-cli/dist/args.d.ts.map +1 -0
  44. package/esm/node_modules/argue-cli/dist/argv.d.ts +14 -0
  45. package/esm/node_modules/argue-cli/dist/argv.d.ts.map +1 -0
  46. package/esm/node_modules/argue-cli/dist/core.d.ts +24 -0
  47. package/esm/node_modules/argue-cli/dist/core.d.ts.map +1 -0
  48. package/esm/node_modules/argue-cli/dist/index.d.ts +6 -0
  49. package/esm/node_modules/argue-cli/dist/index.d.ts.map +1 -0
  50. package/esm/node_modules/argue-cli/dist/index.js +254 -0
  51. package/esm/node_modules/argue-cli/dist/index.js.map +1 -0
  52. package/esm/node_modules/argue-cli/dist/options.d.ts +9 -0
  53. package/esm/node_modules/argue-cli/dist/options.d.ts.map +1 -0
  54. package/esm/node_modules/argue-cli/dist/types.d.ts +16 -0
  55. package/esm/node_modules/argue-cli/dist/types.d.ts.map +1 -0
  56. package/esm/node_modules/argue-cli/dist/utils.d.ts +24 -0
  57. package/esm/node_modules/argue-cli/dist/utils.d.ts.map +1 -0
  58. package/esm/node_modules/argue-cli/package.json +34 -0
  59. package/esm/node_modules/conventional-changelog-core/node_modules/conventional-changelog-writer/LICENSE.md +21 -0
  60. package/esm/node_modules/conventional-changelog-core/node_modules/conventional-changelog-writer/README.md +369 -0
  61. package/esm/node_modules/conventional-changelog-core/node_modules/conventional-changelog-writer/package.json +53 -0
  62. package/esm/node_modules/conventional-changelog-core/node_modules/conventional-commits-filter/LICENSE +21 -0
  63. package/esm/node_modules/conventional-changelog-core/node_modules/conventional-commits-filter/README.md +184 -0
  64. package/esm/node_modules/conventional-changelog-core/node_modules/conventional-commits-filter/package.json +31 -0
  65. package/esm/node_modules/conventional-changelog-core/node_modules/conventional-commits-parser/LICENSE.md +21 -0
  66. package/esm/node_modules/conventional-changelog-core/node_modules/conventional-commits-parser/README.md +383 -0
  67. package/esm/node_modules/conventional-changelog-core/node_modules/conventional-commits-parser/package.json +47 -0
  68. package/esm/node_modules/conventional-changelog-writer/README.md +49 -342
  69. package/esm/node_modules/conventional-changelog-writer/dist/cli/index.d.ts +3 -0
  70. package/esm/node_modules/conventional-changelog-writer/dist/cli/index.d.ts.map +1 -0
  71. package/esm/node_modules/conventional-changelog-writer/dist/cli/index.js +68 -0
  72. package/esm/node_modules/conventional-changelog-writer/dist/cli/utils.d.ts +4 -0
  73. package/esm/node_modules/conventional-changelog-writer/dist/cli/utils.d.ts.map +1 -0
  74. package/esm/node_modules/conventional-changelog-writer/dist/cli/utils.js +39 -0
  75. package/esm/node_modules/conventional-changelog-writer/dist/commit.d.ts +10 -0
  76. package/esm/node_modules/conventional-changelog-writer/dist/commit.d.ts.map +1 -0
  77. package/esm/node_modules/conventional-changelog-writer/dist/commit.js +43 -0
  78. package/esm/node_modules/conventional-changelog-writer/dist/context.d.ts +27 -0
  79. package/esm/node_modules/conventional-changelog-writer/dist/context.d.ts.map +1 -0
  80. package/esm/node_modules/conventional-changelog-writer/dist/context.js +134 -0
  81. package/esm/node_modules/conventional-changelog-writer/dist/index.d.ts +7 -0
  82. package/esm/node_modules/conventional-changelog-writer/dist/index.d.ts.map +1 -0
  83. package/esm/node_modules/conventional-changelog-writer/dist/index.js +6 -0
  84. package/esm/node_modules/conventional-changelog-writer/dist/options.d.ts +25 -0
  85. package/esm/node_modules/conventional-changelog-writer/dist/options.d.ts.map +1 -0
  86. package/esm/node_modules/conventional-changelog-writer/dist/options.js +79 -0
  87. package/esm/node_modules/conventional-changelog-writer/dist/template.d.ts +10 -0
  88. package/esm/node_modules/conventional-changelog-writer/dist/template.d.ts.map +1 -0
  89. package/esm/node_modules/conventional-changelog-writer/dist/template.js +18 -0
  90. package/esm/node_modules/conventional-changelog-writer/dist/types/index.d.ts +8 -0
  91. package/esm/node_modules/conventional-changelog-writer/dist/types/index.d.ts.map +1 -0
  92. package/esm/node_modules/conventional-changelog-writer/dist/types/index.js +2 -0
  93. package/esm/node_modules/conventional-changelog-writer/dist/types/options.d.ts +122 -0
  94. package/esm/node_modules/conventional-changelog-writer/dist/types/options.d.ts.map +1 -0
  95. package/esm/node_modules/conventional-changelog-writer/dist/types/options.js +2 -0
  96. package/esm/node_modules/conventional-changelog-writer/dist/types/utils.d.ts +9 -0
  97. package/esm/node_modules/conventional-changelog-writer/dist/types/utils.d.ts.map +1 -0
  98. package/esm/node_modules/conventional-changelog-writer/dist/types/utils.js +2 -0
  99. package/esm/node_modules/conventional-changelog-writer/dist/utils.d.ts +20 -0
  100. package/esm/node_modules/conventional-changelog-writer/dist/utils.d.ts.map +1 -0
  101. package/esm/node_modules/conventional-changelog-writer/dist/utils.js +70 -0
  102. package/esm/node_modules/conventional-changelog-writer/dist/writers.d.ts +29 -0
  103. package/esm/node_modules/conventional-changelog-writer/dist/writers.d.ts.map +1 -0
  104. package/esm/node_modules/conventional-changelog-writer/dist/writers.js +94 -0
  105. package/esm/node_modules/conventional-changelog-writer/package.json +24 -26
  106. package/esm/node_modules/conventional-commits-filter/README.md +51 -170
  107. package/esm/node_modules/conventional-commits-filter/dist/RevertedCommitsFilter.d.ts +17 -0
  108. package/esm/node_modules/conventional-commits-filter/dist/RevertedCommitsFilter.d.ts.map +1 -0
  109. package/esm/node_modules/conventional-commits-filter/dist/RevertedCommitsFilter.js +46 -0
  110. package/esm/node_modules/conventional-commits-filter/dist/filters.d.ts +19 -0
  111. package/esm/node_modules/conventional-commits-filter/dist/filters.d.ts.map +1 -0
  112. package/esm/node_modules/conventional-commits-filter/dist/filters.js +34 -0
  113. package/esm/node_modules/conventional-commits-filter/dist/index.d.ts +4 -0
  114. package/esm/node_modules/conventional-commits-filter/dist/index.d.ts.map +1 -0
  115. package/esm/node_modules/conventional-commits-filter/dist/index.js +3 -0
  116. package/esm/node_modules/conventional-commits-filter/dist/types.d.ts +6 -0
  117. package/esm/node_modules/conventional-commits-filter/dist/types.d.ts.map +1 -0
  118. package/esm/node_modules/conventional-commits-filter/dist/types.js +2 -0
  119. package/esm/node_modules/conventional-commits-filter/dist/utils.d.ts +16 -0
  120. package/esm/node_modules/conventional-commits-filter/dist/utils.d.ts.map +1 -0
  121. package/esm/node_modules/conventional-commits-filter/dist/utils.js +43 -0
  122. package/esm/node_modules/conventional-commits-filter/package.json +22 -16
  123. package/esm/node_modules/conventional-commits-parser/README.md +49 -353
  124. package/esm/node_modules/conventional-commits-parser/dist/CommitParser.d.ts +40 -0
  125. package/esm/node_modules/conventional-commits-parser/dist/CommitParser.d.ts.map +1 -0
  126. package/esm/node_modules/conventional-commits-parser/dist/CommitParser.js +319 -0
  127. package/esm/node_modules/conventional-commits-parser/dist/cli/index.d.ts +3 -0
  128. package/esm/node_modules/conventional-commits-parser/dist/cli/index.d.ts.map +1 -0
  129. package/esm/node_modules/conventional-commits-parser/dist/cli/index.js +67 -0
  130. package/esm/node_modules/conventional-commits-parser/dist/cli/options.d.ts +3 -0
  131. package/esm/node_modules/conventional-commits-parser/dist/cli/options.d.ts.map +1 -0
  132. package/esm/node_modules/conventional-commits-parser/dist/cli/options.js +40 -0
  133. package/esm/node_modules/conventional-commits-parser/dist/cli/utils.d.ts +5 -0
  134. package/esm/node_modules/conventional-commits-parser/dist/cli/utils.d.ts.map +1 -0
  135. package/esm/node_modules/conventional-commits-parser/dist/cli/utils.js +49 -0
  136. package/esm/node_modules/conventional-commits-parser/dist/index.d.ts +4 -0
  137. package/esm/node_modules/conventional-commits-parser/dist/index.d.ts.map +1 -0
  138. package/esm/node_modules/conventional-commits-parser/dist/index.js +3 -0
  139. package/esm/node_modules/conventional-commits-parser/dist/options.d.ts +3 -0
  140. package/esm/node_modules/conventional-commits-parser/dist/options.d.ts.map +1 -0
  141. package/esm/node_modules/conventional-commits-parser/dist/options.js +27 -0
  142. package/esm/node_modules/conventional-commits-parser/dist/regex.d.ts +8 -0
  143. package/esm/node_modules/conventional-commits-parser/dist/regex.d.ts.map +1 -0
  144. package/esm/node_modules/conventional-commits-parser/dist/regex.js +63 -0
  145. package/esm/node_modules/conventional-commits-parser/dist/stream.d.ts +14 -0
  146. package/esm/node_modules/conventional-commits-parser/dist/stream.d.ts.map +1 -0
  147. package/esm/node_modules/conventional-commits-parser/dist/stream.js +38 -0
  148. package/esm/node_modules/conventional-commits-parser/dist/types.d.ts +100 -0
  149. package/esm/node_modules/conventional-commits-parser/dist/types.d.ts.map +1 -0
  150. package/esm/node_modules/conventional-commits-parser/dist/types.js +2 -0
  151. package/esm/node_modules/conventional-commits-parser/dist/utils.d.ts +41 -0
  152. package/esm/node_modules/conventional-commits-parser/dist/utils.d.ts.map +1 -0
  153. package/esm/node_modules/conventional-commits-parser/dist/utils.js +75 -0
  154. package/esm/node_modules/conventional-commits-parser/package.json +22 -23
  155. package/esm/src/cli/command-help.js +15 -0
  156. package/esm/src/cli/repair-configuration-description.js +98 -0
  157. package/esm/src/cli/run-changelog.js +51 -0
  158. package/esm/src/cli/run-cli.js +8 -0
  159. package/esm/src/features/built-in-feature-registry.js +2 -0
  160. package/esm/src/features/changelog-feature.js +155 -0
  161. package/esm/src/features/github-ci-artifacts.js +17 -3
  162. package/esm/src/features/github-ci-runtime-matrix.js +50 -0
  163. package/esm/src/features/github-release-publish-artifacts.js +5 -4
  164. package/esm/src/features/github-release-publish-feature.js +7 -2
  165. package/esm/src/features/github-workflow-cache.js +18 -0
  166. package/esm/src/features/npm-readme-badge.js +163 -0
  167. package/esm/src/features/readme-contribution-plans.js +18 -1
  168. package/esm/src/features/workflow-deno.js +1 -1
  169. package/esm/src/package/npm-name.js +5 -0
  170. package/esm/src/readme/contribution-blocks.js +33 -6
  171. package/esm/src/release/changelog-markdown.js +41 -0
  172. package/esm/src/release/changelog.js +155 -7
  173. package/esm/src/release/format-changelog.js +15 -0
  174. package/esm/src/release/migrate-changelog.js +92 -0
  175. package/esm/src/release/publish-github.js +7 -3
  176. package/esm/src/release/publish-npm.js +2 -2
  177. package/esm/src/release/publish-tag-prepare.js +63 -78
  178. package/esm/src/release/release-history.js +53 -0
  179. package/npm-dependencies.lock.json +115 -48
  180. package/package.json +7 -5
  181. package/esm/node_modules/conventional-commits-parser/node_modules/meow/build/dependencies.js +0 -11036
  182. package/esm/node_modules/conventional-commits-parser/node_modules/meow/build/index.d.ts +0 -1416
  183. package/esm/node_modules/conventional-commits-parser/node_modules/meow/build/index.js +0 -100
  184. package/esm/node_modules/conventional-commits-parser/node_modules/meow/build/licenses.md +0 -1767
  185. package/esm/node_modules/conventional-commits-parser/node_modules/meow/build/options.js +0 -92
  186. package/esm/node_modules/conventional-commits-parser/node_modules/meow/build/parser.js +0 -84
  187. package/esm/node_modules/conventional-commits-parser/node_modules/meow/build/utils.js +0 -7
  188. package/esm/node_modules/conventional-commits-parser/node_modules/meow/build/validate.js +0 -122
  189. package/esm/node_modules/conventional-commits-parser/node_modules/meow/license +0 -9
  190. package/esm/node_modules/conventional-commits-parser/node_modules/meow/package.json +0 -107
  191. package/esm/node_modules/conventional-commits-parser/node_modules/meow/readme.md +0 -314
  192. /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core/node_modules/conventional-changelog-writer}/cli.mjs +0 -0
  193. /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core/node_modules/conventional-changelog-writer}/index.js +0 -0
  194. /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core/node_modules/conventional-changelog-writer}/lib/util.js +0 -0
  195. /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core/node_modules/conventional-changelog-writer}/templates/commit.hbs +0 -0
  196. /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core/node_modules/conventional-changelog-writer}/templates/footer.hbs +0 -0
  197. /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core/node_modules/conventional-changelog-writer}/templates/header.hbs +0 -0
  198. /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core/node_modules/conventional-changelog-writer}/templates/template.hbs +0 -0
  199. /package/esm/node_modules/{conventional-commits-filter → conventional-changelog-core/node_modules/conventional-commits-filter}/index.js +0 -0
  200. /package/esm/node_modules/{conventional-commits-parser → conventional-changelog-core/node_modules/conventional-commits-parser}/cli.mjs +0 -0
  201. /package/esm/node_modules/{conventional-commits-parser → conventional-changelog-core/node_modules/conventional-commits-parser}/index.js +0 -0
  202. /package/esm/node_modules/{conventional-commits-parser → conventional-changelog-core/node_modules/conventional-commits-parser}/lib/parser.js +0 -0
  203. /package/esm/node_modules/{conventional-commits-parser → conventional-changelog-core/node_modules/conventional-commits-parser}/lib/regex.js +0 -0
  204. /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core}/node_modules/meow/build/dependencies.js +0 -0
  205. /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core}/node_modules/meow/build/index.d.ts +0 -0
  206. /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core}/node_modules/meow/build/index.js +0 -0
  207. /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core}/node_modules/meow/build/licenses.md +0 -0
  208. /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core}/node_modules/meow/build/options.js +0 -0
  209. /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core}/node_modules/meow/build/parser.js +0 -0
  210. /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core}/node_modules/meow/build/utils.js +0 -0
  211. /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core}/node_modules/meow/build/validate.js +0 -0
  212. /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core}/node_modules/meow/license +0 -0
  213. /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core}/node_modules/meow/package.json +0 -0
  214. /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core}/node_modules/meow/readme.md +0 -0
@@ -0,0 +1,63 @@
1
+ const nomatchRegex = /(?!.*)/;
2
+ function escape(string) {
3
+ return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
4
+ }
5
+ function joinOr(parts) {
6
+ return parts
7
+ .map(val => (typeof val === 'string' ? escape(val.trim()) : val.source))
8
+ .filter(Boolean)
9
+ .join('|');
10
+ }
11
+ function getNotesRegex(noteKeywords, notesPattern) {
12
+ if (!noteKeywords) {
13
+ return nomatchRegex;
14
+ }
15
+ const noteKeywordsSelection = joinOr(noteKeywords);
16
+ if (!notesPattern) {
17
+ return new RegExp(`^(?:\\*\\s+)?(${noteKeywordsSelection}):\\s*(.*)`, 'i');
18
+ }
19
+ return notesPattern(noteKeywordsSelection);
20
+ }
21
+ function getReferencePartsRegex(issuePrefixes, issuePrefixesCaseSensitive) {
22
+ if (!issuePrefixes) {
23
+ return nomatchRegex;
24
+ }
25
+ const flags = issuePrefixesCaseSensitive ? 'g' : 'gi';
26
+ return new RegExp(`(?:.*?)??\\s*([\\w-\\.\\/]*?)??(${joinOr(issuePrefixes)})([\\w-]+)(?=\\s|$|[,;.)\\]])`, flags);
27
+ }
28
+ function getReferencesRegex(referenceActions) {
29
+ if (!referenceActions) {
30
+ // matches everything
31
+ return /()(.+)/gi;
32
+ }
33
+ const joinedKeywords = joinOr(referenceActions);
34
+ return new RegExp(`(${joinedKeywords})(?:\\s+(.*?))(?=(?:${joinedKeywords})|$)`, 'gi');
35
+ }
36
+ function getFooterTokenRegex(issuePrefixes) {
37
+ const issuePrefixSeparator = issuePrefixes
38
+ ? `|\\s+(?:${joinOr(issuePrefixes)})`
39
+ : '';
40
+ // Footers follow the git trailer convention: the token starts at the
41
+ // beginning of the line, indented `key: value` lines are not footers.
42
+ return new RegExp(`^(?:BREAKING CHANGE|[\\w-]+)(?::\\s+${issuePrefixSeparator}).+`, 'i');
43
+ }
44
+ /**
45
+ * Make the regexes used to parse a commit.
46
+ * @param options
47
+ * @returns Regexes.
48
+ */
49
+ export function getParserRegexes(options = {}) {
50
+ const notes = getNotesRegex(options.noteKeywords, options.notesPattern);
51
+ const referenceParts = getReferencePartsRegex(options.issuePrefixes, options.issuePrefixesCaseSensitive);
52
+ const references = getReferencesRegex(options.referenceActions);
53
+ const footerToken = getFooterTokenRegex(options.issuePrefixes);
54
+ return {
55
+ notes,
56
+ referenceParts,
57
+ references,
58
+ footerToken,
59
+ mentions: /@([\w-]+)/g,
60
+ url: /\b(?:https?):\/\/(?:www\.)?([-a-zA-Z0-9@:%_+.~#?&//=])+\b/
61
+ };
62
+ }
63
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVnZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvcmVnZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBS0EsTUFBTSxZQUFZLEdBQUcsUUFBUSxDQUFBO0FBRTdCLFNBQVMsTUFBTSxDQUFDLE1BQWM7SUFDNUIsT0FBTyxNQUFNLENBQUMsT0FBTyxDQUFDLHFCQUFxQixFQUFFLE1BQU0sQ0FBQyxDQUFBO0FBQ3RELENBQUM7QU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GdCQUFnQixDQUFDLENBQUE7SUFDL0QsTUFBTSxXQUFXLEdBQUcsbUJBQW1CLENBQUMsT0FBTyxDQUFDLGFBQWEsQ0FBQyxDQUFBO0lBRTlELE9BQU87UUFDTCxLQUFLO1FBQ0wsY0FBYztRQUNkLFVBQVU7UUFDVixXQUFXO1FBQ1gsUUFBUSxFQUFFLFlBQVk7UUFDdEIsR0FBRyxFQUFFLDJEQUEyRDtLQUNqRSxDQUFBO0FBQ0gsQ0FBQyJ9
@@ -0,0 +1,14 @@
1
+ import type { ParserStreamOptions } from './types.js';
2
+ /**
3
+ * Create async generator function to parse async iterable of raw commits.
4
+ * @param options - CommitParser options.
5
+ * @returns Async generator function to parse async iterable of raw commits.
6
+ */
7
+ export declare function parseCommits(options?: ParserStreamOptions): (rawCommits: Iterable<string | Buffer> | AsyncIterable<string | Buffer>) => AsyncGenerator<import("./types.js").Commit, void, unknown>;
8
+ /**
9
+ * Create stream to parse commits.
10
+ * @param options - CommitParser options.
11
+ * @returns Stream of parsed commits.
12
+ */
13
+ export declare function parseCommitsStream(options?: ParserStreamOptions): import("stream").Duplex;
14
+ //# sourceMappingURL=stream.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../src/stream.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAGrD;;;;GAIG;AACH,wBAAgB,YAAY,CAC1B,OAAO,GAAE,mBAAwB,gBAYnB,QAAQ,CAAC,MAAM,GAAG,MAAM,CAAC,GAAG,aAAa,CAAC,MAAM,GAAG,MAAM,CAAC,gEAazE;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,GAAE,mBAAwB,2BAEnE"}
@@ -0,0 +1,38 @@
1
+ import { Transform } from 'stream';
2
+ import { CommitParser } from './CommitParser.js';
3
+ /**
4
+ * Create async generator function to parse async iterable of raw commits.
5
+ * @param options - CommitParser options.
6
+ * @returns Async generator function to parse async iterable of raw commits.
7
+ */
8
+ export function parseCommits(options = {}) {
9
+ const warnOption = options.warn;
10
+ const warn = warnOption === true
11
+ ? (err) => {
12
+ throw err;
13
+ }
14
+ : warnOption
15
+ ? (err) => warnOption(err.toString())
16
+ : () => { };
17
+ return async function* parse(rawCommits) {
18
+ const parser = new CommitParser(options);
19
+ let rawCommit;
20
+ for await (rawCommit of rawCommits) {
21
+ try {
22
+ yield parser.parse(rawCommit.toString());
23
+ }
24
+ catch (err) {
25
+ warn(err);
26
+ }
27
+ }
28
+ };
29
+ }
30
+ /**
31
+ * Create stream to parse commits.
32
+ * @param options - CommitParser options.
33
+ * @returns Stream of parsed commits.
34
+ */
35
+ export function parseCommitsStream(options = {}) {
36
+ return Transform.from(parseCommits(options));
37
+ }
38
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RyZWFtLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL3N0cmVhbS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsU0FBUyxFQUFFLE1BQU0sUUFBUSxDQUFBO0FBRWxDLE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSxtQkFBbUIsQ0FBQTtBQUVoRDs7OztHQUlHO0FBQ0gsTUFBTSxVQUFVLFlBQVksQ0FDMUIsT0FBTyxHQUF3QixFQUFFO0lBRWpDLE1BQU0sVUFBVSxHQUFHLE9BQU8sQ0FBQyxJQUFJLENBQUE7SUFDL0IsTUFBTSxJQUFJLEdBQUcsVUFBVSxLQUFLLElBQUk7UUFDOUIsQ0FBQyxDQUFDLENBQUMsR0FBVSxFQUFFLEVBQUU7WUFDZixNQUFNLEdBQUcsQ0FBQTtRQUNYLENBQUM7UUFDRCxDQUFDLENBQUMsVUFBVTtZQUNWLENBQUMsQ0FBQyxDQUFDLEdBQVUsRUFBRSxFQUFFLENBQUMsVUFBVSxDQUFDLEdBQUcsQ0FBQyxRQUFRLEVBQUUsQ0FBQztZQUM1QyxDQUFDLENBQUMsR0FBRyxFQUFFLEdBQWMsQ0FBQyxDQUFBO0lBRTFCLE9BQU8sS0FBSyxTQUFTLENBQUMsQ0FBQyxLQUFLLENBQzFCLFVBQXNFO1FBRXRFLE1BQU0sTUFBTSxHQUFHLElBQUksWUFBWSxDQUFDLE9BQU8sQ0FBQyxDQUFBO1FBQ3hDLElBQUksU0FBMEIsQ0FBQTtRQUU5QixJQUFJLEtBQUssRUFBRSxTQUFTLElBQUksVUFBVSxFQUFFLENBQUM7WUFDbkMsSUFBSSxDQUFDO2dCQUNILE1BQU0sTUFBTSxDQUFDLEtBQUssQ0FBQyxTQUFTLENBQUMsUUFBUSxFQUFFLENBQUMsQ0FBQTtZQUMxQyxDQUFDO1lBQUMsT0FBTyxHQUFHLEVBQUUsQ0FBQztnQkFDYixJQUFJLENBQUMsR0FBWSxDQUFDLENBQUE7WUFDcEIsQ0FBQztRQUNILENBQUM7SUFDSCxDQUFDLENBQUE7QUFDSCxDQUFDO0FBRUQ7Ozs7R0FJRztBQUNILE1BQU0sVUFBVSxrQkFBa0IsQ0FBQyxPQUFPLEdBQXdCLEVBQUU7SUFDbEUsT0FBTyxTQUFTLENBQUMsSUFBSSxDQUFDLFlBQVksQ0FBQyxPQUFPLENBQUMsQ0FBQyxDQUFBO0FBQzlDLENBQUMifQ==
@@ -0,0 +1,100 @@
1
+ export interface ParserOptions {
2
+ /**
3
+ * Character used to comment out a line.
4
+ */
5
+ commentChar?: string;
6
+ /**
7
+ * Pattern to match merge headers. EG: branch merge, GitHub or GitLab like pull requests headers.
8
+ * When a merge header is parsed, the next line is used for conventional header parsing.
9
+ */
10
+ mergePattern?: RegExp;
11
+ /**
12
+ * Used to define what capturing group of `mergePattern`.
13
+ */
14
+ mergeCorrespondence?: string[];
15
+ /**
16
+ * Used to match header pattern.
17
+ */
18
+ headerPattern?: RegExp;
19
+ /**
20
+ * Breaking changes header pattern.
21
+ */
22
+ breakingHeaderPattern?: RegExp;
23
+ /**
24
+ * Used to define what capturing group of `headerPattern` captures what header part.
25
+ * The order of the array should correspond to the order of `headerPattern`'s capturing group.
26
+ */
27
+ headerCorrespondence?: string[];
28
+ /**
29
+ * Pattern to match what this commit reverts.
30
+ */
31
+ revertPattern?: RegExp;
32
+ /**
33
+ * Used to define what capturing group of `revertPattern` captures what reverted commit fields.
34
+ * The order of the array should correspond to the order of `revertPattern`'s capturing group.
35
+ */
36
+ revertCorrespondence?: string[];
37
+ /**
38
+ * Pattern to match other fields.
39
+ */
40
+ fieldPattern?: RegExp;
41
+ /**
42
+ * Keywords for important notes. This value is case **insensitive**.
43
+ */
44
+ noteKeywords?: (string | RegExp)[];
45
+ /**
46
+ * A function that takes `noteKeywordsSelection` and returns a `RegExp` to be matched against the notes.
47
+ */
48
+ notesPattern?(text: string): RegExp;
49
+ /**
50
+ * The prefixes of an issue. EG: In `gh-123` `gh-` is the prefix.
51
+ */
52
+ issuePrefixes?: (string | RegExp)[];
53
+ /**
54
+ * Used to define if `issuePrefixes` should be considered case sensitive.
55
+ */
56
+ issuePrefixesCaseSensitive?: boolean;
57
+ /**
58
+ * Keywords to reference an issue. This value is case **insensitive**.
59
+ */
60
+ referenceActions?: (string | RegExp)[];
61
+ }
62
+ export interface ParserStreamOptions extends ParserOptions {
63
+ /**
64
+ * What warn function to use. For example, `console.warn.bind(console)`. By default, it's a noop. If it is `true`, it will error if commit cannot be parsed (strict).
65
+ */
66
+ warn?: boolean | ((message: string) => void);
67
+ }
68
+ export interface ParserRegexes {
69
+ notes: RegExp;
70
+ referenceParts: RegExp;
71
+ references: RegExp;
72
+ footerToken: RegExp;
73
+ mentions: RegExp;
74
+ url: RegExp;
75
+ }
76
+ export interface CommitReference {
77
+ raw: string;
78
+ action: string | null;
79
+ owner: string | null;
80
+ repository: string | null;
81
+ issue: string;
82
+ prefix: string;
83
+ }
84
+ export interface CommitNote {
85
+ title: string;
86
+ text: string;
87
+ }
88
+ export type CommitMeta = Record<string, string | null>;
89
+ export interface CommitBase {
90
+ merge: string | null;
91
+ revert: CommitMeta | null;
92
+ header: string | null;
93
+ body: string | null;
94
+ footer: string | null;
95
+ notes: CommitNote[];
96
+ mentions: string[];
97
+ references: CommitReference[];
98
+ }
99
+ export type Commit = CommitBase & CommitMeta;
100
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB;;OAEG;IACH,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC9B;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB;;OAEG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B;;;OAGG;IACH,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC/B;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB;;;OAGG;IACH,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC/B;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB;;OAEG;IACH,YAAY,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAA;IAClC;;OAEG;IACH,YAAY,CAAC,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;IACnC;;OAEG;IACH,aAAa,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAA;IACnC;;OAEG;IACH,0BAA0B,CAAC,EAAE,OAAO,CAAA;IACpC;;OAEG;IACH,gBAAgB,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAA;CACvC;AAED,MAAM,WAAW,mBAAoB,SAAQ,aAAa;IACxD;;OAEG;IACH,I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3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvdHlwZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Remove leading and trailing newlines.
3
+ * @param input
4
+ * @returns String without leading and trailing newlines.
5
+ */
6
+ export declare function trimNewLines(input: string): string;
7
+ /**
8
+ * Append a newline to a string.
9
+ * @param src
10
+ * @param line
11
+ * @returns String with appended newline.
12
+ */
13
+ export declare function appendLine(src: string | null, line: string | undefined): string;
14
+ /**
15
+ * Creates a function that filters out comments lines.
16
+ * @param char
17
+ * @returns Comment filter function.
18
+ */
19
+ export declare function getCommentFilter(char: string | undefined): (line: string) => boolean;
20
+ /**
21
+ * Select lines before the scissor.
22
+ * @param lines
23
+ * @param commentChar
24
+ * @returns Lines before the scissor.
25
+ */
26
+ export declare function truncateToScissor(lines: string[], commentChar: string): string[];
27
+ /**
28
+ * Filter out GPG sign lines.
29
+ * @param line
30
+ * @returns True if the line is not a GPG sign line.
31
+ */
32
+ export declare function gpgFilter(line: string): boolean;
33
+ /**
34
+ * Assign matched correspondence to the target object.
35
+ * @param target - The target object to assign values to.
36
+ * @param matches - The RegExp match array containing the matched groups.
37
+ * @param correspondence - An array of keys that correspond to the matched groups.
38
+ * @returns The target object with assigned values.
39
+ */
40
+ export declare function assignMatchedCorrespondence(target: Record<string, string | null>, matches: RegExpMatchArray, correspondence: string[]): Record<string, string | null>;
41
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,UAiBzC;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,UAEtE;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,UAE5C,MAAM,aAElB;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,MAAM,EAAE,EACf,WAAW,EAAE,MAAM,YASpB;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,WAErC;AAED;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,EACrC,OAAO,EAAE,gBAAgB,EACzB,cAAc,EAAE,MAAM,EAAE,iCAUzB"}
@@ -0,0 +1,75 @@
1
+ const SCISSOR = '------------------------ >8 ------------------------';
2
+ /**
3
+ * Remove leading and trailing newlines.
4
+ * @param input
5
+ * @returns String without leading and trailing newlines.
6
+ */
7
+ export function trimNewLines(input) {
8
+ // To escape ReDos we should escape String#replace with regex.
9
+ const matches = input.match(/[^\r\n]/);
10
+ if (typeof matches?.index !== 'number') {
11
+ return '';
12
+ }
13
+ const firstIndex = matches.index;
14
+ let lastIndex = input.length - 1;
15
+ while (input[lastIndex] === '\r' || input[lastIndex] === '\n') {
16
+ lastIndex--;
17
+ }
18
+ return input.substring(firstIndex, lastIndex + 1);
19
+ }
20
+ /**
21
+ * Append a newline to a string.
22
+ * @param src
23
+ * @param line
24
+ * @returns String with appended newline.
25
+ */
26
+ export function appendLine(src, line) {
27
+ return src ? `${src}\n${line || ''}` : line || '';
28
+ }
29
+ /**
30
+ * Creates a function that filters out comments lines.
31
+ * @param char
32
+ * @returns Comment filter function.
33
+ */
34
+ export function getCommentFilter(char) {
35
+ return char
36
+ ? (line) => !line.startsWith(char)
37
+ : () => true;
38
+ }
39
+ /**
40
+ * Select lines before the scissor.
41
+ * @param lines
42
+ * @param commentChar
43
+ * @returns Lines before the scissor.
44
+ */
45
+ export function truncateToScissor(lines, commentChar) {
46
+ const scissorIndex = lines.indexOf(`${commentChar} ${SCISSOR}`);
47
+ if (scissorIndex === -1) {
48
+ return lines;
49
+ }
50
+ return lines.slice(0, scissorIndex);
51
+ }
52
+ /**
53
+ * Filter out GPG sign lines.
54
+ * @param line
55
+ * @returns True if the line is not a GPG sign line.
56
+ */
57
+ export function gpgFilter(line) {
58
+ return !line.match(/^\s*gpg:/);
59
+ }
60
+ /**
61
+ * Assign matched correspondence to the target object.
62
+ * @param target - The target object to assign values to.
63
+ * @param matches - The RegExp match array containing the matched groups.
64
+ * @param correspondence - An array of keys that correspond to the matched groups.
65
+ * @returns The target object with assigned values.
66
+ */
67
+ export function assignMatchedCorrespondence(target, matches, correspondence) {
68
+ const { groups } = matches;
69
+ for (let i = 0, len = correspondence.length, key; i < len; i++) {
70
+ key = correspondence[i];
71
+ target[key] = (groups ? groups[key] : matches[i + 1]) || null;
72
+ }
73
+ return target;
74
+ }
75
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvdXRpbHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsTUFBTSxPQUFPLEdBQUcsc0RBQXNELENBQUE7QUFFdEU7Ozs7R0FJRztBQUNILE1BQU0sVUFBVSxZQUFZLENBQUMsS0FBYTtJQUN4Qyw4REFBOEQ7SUFFOUQsTUFBTSxPQUFPLEdBQUcsS0FBSyxDQUFDLEtBQUssQ0FBQyxTQUFTLENBQUMsQ0FBQTtJQUV0QyxJQUFJLE9BQU8sT0FBTyxFQUFFLEtBQUssS0FBSyxRQUFRLEVBQUUsQ0FBQztRQUN2QyxPQUFPLEVBQUUsQ0FBQTtJQUNYLENBQUM7SUFFRCxNQUFNLFVBQVUsR0FBRyxPQUFPLENBQUMsS0FBSyxDQUFBO0lBQ2hDLElBQUksU0FBUyxHQUFHLEtBQUssQ0FBQyxNQUFNLEdBQUcsQ0FBQyxDQUFBO0lBRWhDLE9BQU8sS0FBSyxDQUFD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ENBQUMsQ0FBQTtBQUNyQyxDQUFDO0FBRUQ7Ozs7R0FJRztBQUNILE1BQU0sVUFBVSxTQUFTLENBQUMsSUFBWTtJQUNwQyxPQUFPLENBQUMsSUFBSSxDQUFDLEtBQUssQ0FBQyxVQUFVLENBQUMsQ0FBQTtBQUNoQyxDQUFDO0FBRUQ7Ozs7OztHQU1HO0FBQ0gsTUFBTSxVQUFVLDJCQUEyQixDQUN6QyxNQUFxQyxFQUNyQyxPQUF5QixFQUN6QixjQUF3QjtJQUV4QixNQUFNLEVBQUUsTUFBTSxFQUFFLEdBQUcsT0FBTyxDQUFBO0lBRTFCLEtBQUssSUFBSSxDQUFDLEdBQUcsQ0FBQyxFQUFFLEdBQUcsR0FBRyxjQUFjLENBQUMsTUFBTSxFQUFFLEdBQUcsRUFBRSxDQUFDLEdBQUcsR0FBRyxFQUFFLENBQUMsRUFBRSxFQUFFLENBQUM7UUFDL0QsR0FBRyxHQUFHLGNBQWMsQ0FBQyxDQUFDLENBQUMsQ0FBQTtRQUN2QixNQUFNLENBQUMsR0FBRyxDQUFDLEdBQUcsQ0FBQyxNQUFNLENBQUMsQ0FBQyxDQUFDLE1BQU0sQ0FBQyxHQUFHLENBQUMsQ0FBQyxDQUFDLENBQUMsT0FBTyxDQUFDLENBQUMsR0FBRyxDQUFDLENBQUMsQ0FBQyxJQUFJLElBQUksQ0FBQTtJQUMvRCxDQUFDO0lBRUQsT0FBTyxNQUFNLENBQUE7QUFDZixDQUFDIn0=
@@ -1,29 +1,23 @@
1
1
  {
2
2
  "name": "conventional-commits-parser",
3
- "version": "5.0.0",
4
- "description": "Parse raw conventional commits",
5
- "bugs": {
6
- "url": "https://github.com/conventional-changelog/conventional-changelog/issues"
7
- },
8
- "homepage": "https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-commits-parser#readme",
3
+ "type": "module",
4
+ "version": "7.1.2",
5
+ "description": "Parse raw conventional commits.",
9
6
  "author": {
10
7
  "name": "Steve Mao",
11
8
  "email": "maochenyan@gmail.com",
12
9
  "url": "https://github.com/stevemao"
13
10
  },
11
+ "license": "MIT",
12
+ "homepage": "https://conventional-changelog.js.org/commits-parser/",
14
13
  "repository": {
15
14
  "type": "git",
16
- "url": "https://github.com/conventional-changelog/conventional-changelog.git"
15
+ "url": "https://github.com/conventional-changelog/conventional-changelog.git",
16
+ "directory": "packages/conventional-commits-parser"
17
17
  },
18
- "license": "MIT",
19
- "engines": {
20
- "node": ">=16"
18
+ "bugs": {
19
+ "url": "https://github.com/conventional-changelog/conventional-changelog/issues"
21
20
  },
22
- "files": [
23
- "index.js",
24
- "cli.mjs",
25
- "lib"
26
- ],
27
21
  "keywords": [
28
22
  "conventional-commits-parser",
29
23
  "changelog",
@@ -32,16 +26,21 @@
32
26
  "parsing",
33
27
  "logs"
34
28
  ],
29
+ "engines": {
30
+ "node": ">=22"
31
+ },
32
+ "exports": {
33
+ "types": "./dist/index.d.ts",
34
+ "import": "./dist/index.js"
35
+ },
36
+ "files": [
37
+ "dist"
38
+ ],
35
39
  "dependencies": {
36
- "JSONStream": "^1.3.5",
37
- "is-text-path": "^2.0.0",
38
- "meow": "^12.0.1",
39
- "split2": "^4.0.0"
40
+ "@simple-libs/stream-utils": "^2.0.0",
41
+ "argue-cli": "^3.1.0"
40
42
  },
41
43
  "bin": {
42
- "conventional-commits-parser": "cli.mjs"
43
- },
44
- "devDependencies": {
45
- "forceable-tty": "^0.1.0"
44
+ "conventional-commits-parser": "./dist/cli/index.js"
46
45
  }
47
46
  }
@@ -77,6 +77,21 @@ export const commandDefinitions = {
77
77
  description: "Build bundled CLI package metadata.",
78
78
  details: "Write package metadata JSON to stdout from deno.json or deno.jsonc.",
79
79
  },
80
+ "changelog migrate": {
81
+ usage: "hj changelog migrate [--write] [--repository=owner/repo]",
82
+ description: "Preview or migrate flat changelog release sections.",
83
+ details: "Optional: normal releases extend the current changelog without changing old content, whatever its format.\nThis command prints a migration preview. It requires complete Git history and original hj release tags; custom sections remain intact.",
84
+ flags: [
85
+ [
86
+ "--write",
87
+ "Apply the migration to CHANGELOG.md after reviewing the preview.",
88
+ ],
89
+ [
90
+ "--repository=owner/repo",
91
+ "GitHub link target (default: origin remote).",
92
+ ],
93
+ ],
94
+ },
80
95
  "readme build": {
81
96
  usage: "hj readme build [input]",
82
97
  description: "Build a README from Markdown includes.",
@@ -17,12 +17,78 @@ function safeValue(value) {
17
17
  }
18
18
  return value;
19
19
  }
20
+ /** Match retained workflow steps before describing insertions or edits. */
21
+ function describeWorkflowSteps(value, before, path) {
22
+ const used = new Set();
23
+ const previous = value.map((item) => {
24
+ const index = before.findIndex((old, index) => !used.has(index) && JSON.stringify(old) === JSON.stringify(item));
25
+ if (index >= 0)
26
+ used.add(index);
27
+ return index;
28
+ });
29
+ const identity = (item) => {
30
+ if (!item || typeof item !== "object" || Array.isArray(item))
31
+ return;
32
+ for (const key of ["id", "name", "uses"]) {
33
+ const field = item[key];
34
+ if (typeof field === "string") {
35
+ const value = key === "uses" ? field.split("@")[0] : field;
36
+ return JSON.stringify([key, value]);
37
+ }
38
+ }
39
+ };
40
+ // Named steps and action upgrades retain their identity when fields change.
41
+ value.forEach((item, index) => {
42
+ if (previous[index] >= 0)
43
+ return;
44
+ const key = identity(item);
45
+ if (key === undefined)
46
+ return;
47
+ const match = before.findIndex((old, oldIndex) => !used.has(oldIndex) && identity(old) === key);
48
+ if (match >= 0) {
49
+ previous[index] = match;
50
+ used.add(match);
51
+ }
52
+ });
53
+ const remaining = before.map((_item, index) => index).filter((index) => !used.has(index));
54
+ const unmatched = previous.filter((index) => index < 0).length;
55
+ // Equal remaining counts can represent edited anonymous commands. Others stay
56
+ // explicit additions/removals instead of attributing an insertion to a step.
57
+ if (remaining.length === unmatched) {
58
+ previous.forEach((old, index) => {
59
+ if (old < 0) {
60
+ previous[index] = remaining.shift();
61
+ used.add(previous[index]);
62
+ }
63
+ });
64
+ }
65
+ const order = previous.filter((index) => index >= 0);
66
+ const sorted = [...order].sort((a, b) => a - b);
67
+ let first = 0;
68
+ let last = order.length;
69
+ while (first < last && order[first] === sorted[first])
70
+ first++;
71
+ while (last > first && order[last - 1] === sorted[last - 1])
72
+ last--;
73
+ return [
74
+ ...value.flatMap((item, index) => describeConfiguration(item, before[previous[index]], `${path}[${index}]`)),
75
+ ...before.flatMap((_item, index) => used.has(index) ? [] : [`remove ${path}[${index}]`]),
76
+ ...(first < last
77
+ ? [
78
+ `reorder retained ${path}: original indices ${order.slice(first, last).join(", ")} must appear in that order`,
79
+ ]
80
+ : []),
81
+ ];
82
+ }
20
83
  /** Omits unchanged fields so preserved custom commands and values stay private. */
21
84
  export function describeConfiguration(value, expected, path = "") {
22
85
  if (JSON.stringify(value) === JSON.stringify(expected))
23
86
  return [];
24
87
  if (sensitiveKey.test(path))
25
88
  return [`${path} = [redacted]`];
89
+ if (Array.isArray(value) && Array.isArray(expected) &&
90
+ /^jobs\..+\.steps$/.test(path))
91
+ return describeWorkflowSteps(value, expected, path);
26
92
  if (Array.isArray(value) &&
27
93
  value.some((item) => item !== null && typeof item === "object")) {
28
94
  const before = Array.isArray(expected) ? expected : [];
@@ -40,5 +106,37 @@ export function describeConfiguration(value, expected, path = "") {
40
106
  ...Object.keys(before).filter((key) => !Object.hasOwn(value, key)).map((key) => `remove ${path ? `${path}.` : ""}${key}`),
41
107
  ];
42
108
  }
109
+ if (path.endsWith(".run") && typeof value === "string" &&
110
+ typeof expected === "string") {
111
+ const changes = environmentPermissionChanges(value, expected, path);
112
+ if (changes)
113
+ return changes;
114
+ }
43
115
  return [`${path} = ${JSON.stringify(safeValue(value))}`];
44
116
  }
117
+ /** Describe a single finite env grant change only when the rest of the command is exact. */
118
+ function environmentPermissionChanges(after, before, path) {
119
+ const pattern = /(?<!\S)--allow-env=([A-Za-z_][A-Za-z0-9_]*(?:,[A-Za-z_][A-Za-z0-9_]*)*)(?=\s|$)/g;
120
+ const old = [...before.matchAll(pattern)];
121
+ const next = [...after.matchAll(pattern)];
122
+ if (old.length !== 1 || next.length !== 1 ||
123
+ before.replace(pattern, "--allow-env=<names>") !==
124
+ after.replace(pattern, "--allow-env=<names>"))
125
+ return undefined;
126
+ const previous = old[0][1].split(",");
127
+ const desired = next[0][1].split(",");
128
+ if (new Set(previous).size !== previous.length ||
129
+ new Set(desired).size !== desired.length)
130
+ return undefined;
131
+ const removed = previous.filter((name) => !desired.includes(name));
132
+ const added = desired.filter((name) => !previous.includes(name));
133
+ const retainedBefore = previous.filter((name) => desired.includes(name));
134
+ const retainedAfter = desired.filter((name) => previous.includes(name));
135
+ // Changed ordering still needs the complete replacement to describe every effect.
136
+ if (retainedBefore.join(",") !== retainedAfter.join(","))
137
+ return undefined;
138
+ return [
139
+ ...added.map((name) => `${path}: add ${name} to --allow-env`),
140
+ ...removed.map((name) => `${path}: remove ${name} from --allow-env`),
141
+ ];
142
+ }
@@ -0,0 +1,51 @@
1
+ /** Explicit changelog migration with a read-only default and guarded application. */
2
+ import * as fs from "node:fs/promises";
3
+ import { changelogRepositoryUrl } from "../release/changelog.js";
4
+ import { migrateChangelog } from "../release/migrate-changelog.js";
5
+ import { localReleaseProcess, runOrThrow, } from "../release/release-process.js";
6
+ export function parseChangelogMigration(args) {
7
+ let write = false;
8
+ let repository;
9
+ for (const arg of args) {
10
+ if (arg === "--write" && !write)
11
+ write = true;
12
+ else if (arg.startsWith("--repository=") && repository === undefined) {
13
+ repository = arg.slice("--repository=".length);
14
+ changelogRepositoryUrl(repository);
15
+ }
16
+ else {
17
+ throw new Error("expected `hj changelog migrate [--write] [--repository=owner/repo]`");
18
+ }
19
+ }
20
+ return { write, repository };
21
+ }
22
+ export async function runChangelogMigration(root, options, process = localReleaseProcess(root)) {
23
+ const path = new URL("CHANGELOG.md", root);
24
+ if (!(await fs.lstat(path)).isFile()) {
25
+ throw new Error("CHANGELOG.md must be a regular file.");
26
+ }
27
+ const oldText = await fs.readFile(path, "utf8");
28
+ let repository = options.repository;
29
+ if (!repository) {
30
+ const origin = (await runOrThrow(process, "git", ["remote", "get-url", "origin"]))
31
+ .trim();
32
+ const match = /^(?:https:\/\/github\.com\/|git@github\.com:)([\w.-]+\/[\w.-]+?)(?:\.git)?$/
33
+ .exec(origin);
34
+ if (!match) {
35
+ throw new Error("Use --repository=owner/repo or set origin to its GitHub repository.");
36
+ }
37
+ repository = match[1];
38
+ }
39
+ const nextText = await migrateChangelog(oldText, repository, process);
40
+ if (!options.write)
41
+ return nextText;
42
+ if (!(await fs.lstat(path)).isFile() ||
43
+ await fs.readFile(path, "utf8") !== oldText) {
44
+ throw new Error("CHANGELOG.md changed during migration; preview it again.");
45
+ }
46
+ if (nextText === oldText) {
47
+ return "CHANGELOG.md already uses grouped release sections.\n";
48
+ }
49
+ await fs.writeFile(path, nextText);
50
+ return "Migrated CHANGELOG.md. Review the diff before committing.\n";
51
+ }
@@ -60,6 +60,14 @@ async function runParsedCli(root, args, services = {}) {
60
60
  terminalNewline: true,
61
61
  };
62
62
  }
63
+ if (command === "changelog migrate") {
64
+ const { parseChangelogMigration, runChangelogMigration } = await import("./run-changelog.js");
65
+ const options = parseChangelogMigration(args.slice(2));
66
+ return {
67
+ output: await runChangelogMigration(root, options, services.releaseProcess),
68
+ terminalNewline: options.write,
69
+ };
70
+ }
63
71
  const usage = commandDefinitions[command].usage;
64
72
  if (command === "package build") {
65
73
  if (args.length !== 2)
@@ -1,4 +1,5 @@
1
1
  /** @module Complete built-in feature and capability registry. */
2
+ import { changelogFeature } from "./changelog-feature.js";
2
3
  import { denoCliFeature } from "./deno-cli-feature.js";
3
4
  import { denoFmtFeature } from "./deno-fmt-feature.js";
4
5
  import { denoConfigVersionFeature } from "./deno-config-version-feature.js";
@@ -20,6 +21,7 @@ import { githubMainProtectionFeature, githubMainReviewFeature, githubProtectedTa
20
21
  /** Features available without repository-specific configuration. */
21
22
  export const builtInFeatureRegistry = {
22
23
  features: [
24
+ changelogFeature,
23
25
  denoCliFeature,
24
26
  denoFmtFeature,
25
27
  denoConfigVersionFeature,