@williamthorsen/release-kit 5.4.0 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/README.md +12 -12
  3. package/dist/esm/.cache +1 -1
  4. package/dist/esm/assertCleanWorkingTree.js +9 -14
  5. package/dist/esm/bin/release-kit.js +202 -229
  6. package/dist/esm/buildChangelogEntries.d.ts +2 -2
  7. package/dist/esm/buildChangelogEntries.js +142 -149
  8. package/dist/esm/buildDependencyGraph.d.ts +1 -1
  9. package/dist/esm/buildDependencyGraph.js +60 -59
  10. package/dist/esm/buildEmptyReleaseEntry.d.ts +1 -1
  11. package/dist/esm/buildEmptyReleaseEntry.js +12 -15
  12. package/dist/esm/buildReleaseSummary.d.ts +1 -1
  13. package/dist/esm/buildReleaseSummary.js +23 -26
  14. package/dist/esm/buildSyntheticChangelogEntry.d.ts +1 -1
  15. package/dist/esm/buildSyntheticChangelogEntry.js +9 -12
  16. package/dist/esm/bumpAllVersions.d.ts +1 -1
  17. package/dist/esm/bumpAllVersions.js +51 -52
  18. package/dist/esm/bumpVersion.d.ts +1 -1
  19. package/dist/esm/bumpVersion.js +25 -28
  20. package/dist/esm/changelogJsonFile.d.ts +1 -1
  21. package/dist/esm/changelogJsonFile.js +59 -62
  22. package/dist/esm/changelogJsonUtils.d.ts +1 -1
  23. package/dist/esm/changelogJsonUtils.js +35 -32
  24. package/dist/esm/changelogOverrides.d.ts +1 -1
  25. package/dist/esm/changelogOverrides.js +374 -377
  26. package/dist/esm/checkWorkTypesDrift.js +104 -99
  27. package/dist/esm/collectPolicyViolations.d.ts +2 -2
  28. package/dist/esm/collectPolicyViolations.js +11 -14
  29. package/dist/esm/commitCommand.js +48 -53
  30. package/dist/esm/compareVersions.js +20 -23
  31. package/dist/esm/createGithubRelease.js +56 -59
  32. package/dist/esm/createGithubReleaseCommand.js +21 -29
  33. package/dist/esm/createTags.js +57 -56
  34. package/dist/esm/decideRelease.d.ts +2 -2
  35. package/dist/esm/decideRelease.js +27 -41
  36. package/dist/esm/defaults.d.ts +3 -3
  37. package/dist/esm/defaults.js +36 -48
  38. package/dist/esm/deleteFileIfExists.js +10 -12
  39. package/dist/esm/deriveWorkspaceConfig.d.ts +1 -1
  40. package/dist/esm/deriveWorkspaceConfig.js +34 -36
  41. package/dist/esm/detectPackageManager.js +35 -37
  42. package/dist/esm/detectUndeclaredTagPrefixes.js +41 -40
  43. package/dist/esm/determineBumpFromCommits.d.ts +2 -2
  44. package/dist/esm/determineBumpFromCommits.js +25 -29
  45. package/dist/esm/determineBumpType.d.ts +1 -1
  46. package/dist/esm/determineBumpType.js +31 -32
  47. package/dist/esm/discoverWorkspaces.js +38 -40
  48. package/dist/esm/format.js +6 -11
  49. package/dist/esm/generateChangelogs.d.ts +1 -1
  50. package/dist/esm/generateChangelogs.js +13 -17
  51. package/dist/esm/getCommitsSinceTarget.d.ts +1 -1
  52. package/dist/esm/getCommitsSinceTarget.js +54 -55
  53. package/dist/esm/hasPrettierConfig.js +33 -35
  54. package/dist/esm/help/prepareHelp.d.ts +2 -0
  55. package/dist/esm/help/prepareHelp.js +26 -0
  56. package/dist/esm/index.d.ts +4 -4
  57. package/dist/esm/index.js +2 -8
  58. package/dist/esm/init/checks.js +28 -32
  59. package/dist/esm/init/detectRepoType.js +12 -15
  60. package/dist/esm/init/initCommand.js +60 -54
  61. package/dist/esm/init/parseJsonRecord.js +9 -11
  62. package/dist/esm/init/scaffold.d.ts +1 -1
  63. package/dist/esm/init/scaffold.js +32 -38
  64. package/dist/esm/init/templates.d.ts +1 -1
  65. package/dist/esm/init/templates.js +16 -22
  66. package/dist/esm/injectReleaseNotesIntoReadme.js +42 -49
  67. package/dist/esm/injectSection.js +17 -27
  68. package/dist/esm/loadConfig.d.ts +1 -1
  69. package/dist/esm/loadConfig.js +206 -225
  70. package/dist/esm/parseCommitMessage.d.ts +1 -1
  71. package/dist/esm/parseCommitMessage.js +72 -76
  72. package/dist/esm/parseRequestedTags.js +6 -9
  73. package/dist/esm/prepareCommand.d.ts +32 -1
  74. package/dist/esm/prepareCommand.js +225 -271
  75. package/dist/esm/previewTagPrefixes.d.ts +1 -1
  76. package/dist/esm/previewTagPrefixes.js +101 -96
  77. package/dist/esm/propagateBumps.d.ts +2 -2
  78. package/dist/esm/propagateBumps.js +48 -50
  79. package/dist/esm/publish.d.ts +2 -2
  80. package/dist/esm/publish.js +22 -28
  81. package/dist/esm/publishCommand.js +75 -86
  82. package/dist/esm/pushCommand.js +33 -40
  83. package/dist/esm/pushRelease.d.ts +1 -1
  84. package/dist/esm/pushRelease.js +21 -24
  85. package/dist/esm/readCurrentVersion.js +13 -17
  86. package/dist/esm/releasePrepare.d.ts +1 -1
  87. package/dist/esm/releasePrepare.js +213 -231
  88. package/dist/esm/releasePrepareMono.d.ts +2 -2
  89. package/dist/esm/releasePrepareMono.js +434 -493
  90. package/dist/esm/releasePrepareProject.d.ts +2 -2
  91. package/dist/esm/releasePrepareProject.js +143 -153
  92. package/dist/esm/renderChangelogMarkdown.d.ts +1 -1
  93. package/dist/esm/renderChangelogMarkdown.js +20 -24
  94. package/dist/esm/renderReleaseNotes.d.ts +1 -1
  95. package/dist/esm/renderReleaseNotes.js +50 -55
  96. package/dist/esm/reportPrepare.d.ts +1 -1
  97. package/dist/esm/reportPrepare.js +230 -231
  98. package/dist/esm/resolveCliffConfigPath.js +18 -23
  99. package/dist/esm/resolveCommandTags.d.ts +1 -1
  100. package/dist/esm/resolveCommandTags.js +47 -44
  101. package/dist/esm/resolveReleaseNotesConfig.d.ts +1 -1
  102. package/dist/esm/resolveReleaseNotesConfig.js +39 -41
  103. package/dist/esm/resolveReleaseTags.d.ts +1 -1
  104. package/dist/esm/resolveReleaseTags.js +39 -40
  105. package/dist/esm/runGitCliff.js +27 -30
  106. package/dist/esm/showTagPrefixesCommand.js +48 -70
  107. package/dist/esm/stripEmojiPrefix.js +2 -5
  108. package/dist/esm/stripScope.js +18 -21
  109. package/dist/esm/sync-labels/generateCommand.d.ts +1 -1
  110. package/dist/esm/sync-labels/generateCommand.js +51 -52
  111. package/dist/esm/sync-labels/initCommand.js +46 -47
  112. package/dist/esm/sync-labels/loadSyncLabelsConfig.d.ts +1 -1
  113. package/dist/esm/sync-labels/loadSyncLabelsConfig.js +46 -52
  114. package/dist/esm/sync-labels/presets.d.ts +1 -1
  115. package/dist/esm/sync-labels/presets.js +40 -43
  116. package/dist/esm/sync-labels/resolveLabels.d.ts +1 -1
  117. package/dist/esm/sync-labels/resolveLabels.js +28 -35
  118. package/dist/esm/sync-labels/syncCommand.js +30 -30
  119. package/dist/esm/sync-labels/templates.d.ts +1 -1
  120. package/dist/esm/sync-labels/templates.js +23 -26
  121. package/dist/esm/sync-labels/types.js +1 -0
  122. package/dist/esm/syncWorkTypes.js +83 -81
  123. package/dist/esm/tagCommand.js +12 -21
  124. package/dist/esm/typeGuards.js +4 -8
  125. package/dist/esm/types.js +66 -60
  126. package/dist/esm/validateConfig.d.ts +1 -1
  127. package/dist/esm/validateConfig.js +109 -115
  128. package/dist/esm/validateOnlyExcludesStrandedDependents.d.ts +2 -2
  129. package/dist/esm/validateOnlyExcludesStrandedDependents.js +97 -91
  130. package/dist/esm/validateOverridesCommand.d.ts +2 -2
  131. package/dist/esm/validateOverridesCommand.js +111 -111
  132. package/dist/esm/workTypesData.js +57 -60
  133. package/dist/esm/workTypesUtils.js +16 -21
  134. package/dist/esm/writeReleaseNotesPreviews.js +55 -57
  135. package/package.json +2 -6
@@ -1,8 +1,9 @@
1
1
  #!/usr/bin/env node
2
- import { parseArgs, readPackageVersion, translateParseError } from "@williamthorsen/nmr-core";
2
+ import { parseArgsOrExit, readPackageVersion, reportError } from '@williamthorsen/nmr-core';
3
3
  import { checkWorkTypesDrift } from "../checkWorkTypesDrift.js";
4
4
  import { commitCommand } from "../commitCommand.js";
5
5
  import { createGithubReleaseCommand } from "../createGithubReleaseCommand.js";
6
+ import { showPrepareHelp } from "../help/prepareHelp.js";
6
7
  import { initCommand } from "../init/initCommand.js";
7
8
  import { prepareCommand } from "../prepareCommand.js";
8
9
  import { publishCommand } from "../publishCommand.js";
@@ -16,7 +17,7 @@ import { tagCommand } from "../tagCommand.js";
16
17
  import { validateOverridesCommand } from "../validateOverridesCommand.js";
17
18
  const VERSION = readPackageVersion(import.meta.url);
18
19
  function showUsage() {
19
- console.info(`
20
+ console.info(`
20
21
  Usage: release-kit <command> [options]
21
22
 
22
23
  Commands:
@@ -38,7 +39,7 @@ Options:
38
39
  `);
39
40
  }
40
41
  function showSyncLabelsHelp() {
41
- console.info(`
42
+ console.info(`
42
43
  Usage: release-kit sync-labels <subcommand> [options]
43
44
 
44
45
  Manage GitHub label synchronization via preset and custom label definitions.
@@ -53,7 +54,7 @@ Options:
53
54
  `);
54
55
  }
55
56
  function showSyncLabelsInitHelp() {
56
- console.info(`
57
+ console.info(`
57
58
  Usage: release-kit sync-labels init [options]
58
59
 
59
60
  Scaffold the sync-labels caller workflow and config file, auto-discover workspaces
@@ -66,7 +67,7 @@ Options:
66
67
  `);
67
68
  }
68
69
  function showSyncLabelsGenerateHelp() {
69
- console.info(`
70
+ console.info(`
70
71
  Usage: release-kit sync-labels generate
71
72
 
72
73
  Regenerate .github/labels.yaml from .config/sync-labels.config.ts.
@@ -76,7 +77,7 @@ Options:
76
77
  `);
77
78
  }
78
79
  function showSyncLabelsSyncHelp() {
79
- console.info(`
80
+ console.info(`
80
81
  Usage: release-kit sync-labels sync
81
82
 
82
83
  Trigger the sync-labels GitHub Actions workflow via the gh CLI.
@@ -86,7 +87,7 @@ Options:
86
87
  `);
87
88
  }
88
89
  function showInitHelp() {
89
- console.info(`
90
+ console.info(`
90
91
  Usage: release-kit init [options]
91
92
 
92
93
  Initialize release-kit in the current repository.
@@ -99,26 +100,8 @@ Options:
99
100
  --help, -h Show this help message
100
101
  `);
101
102
  }
102
- function showPrepareHelp() {
103
- console.info(`
104
- Usage: release-kit prepare [options]
105
-
106
- Run release preparation with automatic workspace discovery.
107
-
108
- Options:
109
- --dry-run Run without modifying any files
110
- --bump=major|minor|patch Override the bump type for all workspaces
111
- --set-version=X.Y.Z Set an explicit version; bypasses commit-derived bumps. Requires --only in monorepo mode.
112
- --no-git-checks, -n Skip the clean-working-tree check
113
- --only=name1,name2 Only process the named workspaces (comma-separated, monorepo only)
114
- --with-release-notes Also write per-workspace release-notes previews under {workspacePath}/docs/
115
- (docs/README.v{version}.md and docs/RELEASE_NOTES.v{version}.md).
116
- Recommended .gitignore entry: packages/*/docs/*.v*.md (or docs/*.v*.md).
117
- --help, -h Show this help message
118
- `);
119
- }
120
103
  function showCommitHelp() {
121
- console.info(`
104
+ console.info(`
122
105
  Usage: release-kit commit [options]
123
106
 
124
107
  Stage all changes and create the release commit using tags and summary
@@ -130,7 +113,7 @@ Options:
130
113
  `);
131
114
  }
132
115
  function showTagHelp() {
133
- console.info(`
116
+ console.info(`
134
117
  Usage: release-kit tag [options]
135
118
 
136
119
  Create annotated git tags from the tags file produced by \`prepare\`.
@@ -142,7 +125,7 @@ Options:
142
125
  `);
143
126
  }
144
127
  function showPushHelp() {
145
- console.info(`
128
+ console.info(`
146
129
  Usage: release-kit push [options]
147
130
 
148
131
  Push the release commit and each tag individually, ensuring GitHub Actions
@@ -156,7 +139,7 @@ Options:
156
139
  `);
157
140
  }
158
141
  function showCreateGithubReleaseHelp() {
159
- console.info(`
142
+ console.info(`
160
143
  Usage: release-kit create-github-release [options]
161
144
 
162
145
  Create GitHub Releases from changelog.json for tags on HEAD.
@@ -168,7 +151,7 @@ Options:
168
151
  `);
169
152
  }
170
153
  function showShowTagPrefixesHelp() {
171
- console.info(`
154
+ console.info(`
172
155
  Usage: release-kit show-tag-prefixes [options]
173
156
 
174
157
  Print a per-workspace table of derived tag prefixes, tag counts, and declared
@@ -181,7 +164,7 @@ Options:
181
164
  `);
182
165
  }
183
166
  function showOverridesHelp() {
184
- console.info(`
167
+ console.info(`
185
168
  Usage: release-kit overrides <subcommand> [options]
186
169
 
187
170
  Manage editorial changelog overrides.
@@ -194,14 +177,14 @@ Options:
194
177
  `);
195
178
  }
196
179
  function showOverridesValidateHelp() {
197
- console.info(`
180
+ console.info(`
198
181
  Usage: release-kit overrides validate
199
182
 
200
183
  Validate every \`.meta/changelog-overrides.json\` file across the project and per-workspace
201
184
  scopes. Reports schema/parse errors, ambiguous-prefix errors, and stale-key warnings.
202
185
 
203
186
  Exit codes:
204
- 0 Clean \u2014 no errors, no stale keys
187
+ 0 Clean — no errors, no stale keys
205
188
  1 Stale-key warnings only (no errors)
206
189
  2 Schema/parse or ambiguous-prefix errors (errors dominate)
207
190
 
@@ -210,7 +193,7 @@ Options:
210
193
  `);
211
194
  }
212
195
  function showWorkTypesHelp() {
213
- console.info(`
196
+ console.info(`
214
197
  Usage: release-kit work-types <subcommand>
215
198
 
216
199
  Manage the canonical work-types taxonomy used by changelog and release-notes generation.
@@ -220,7 +203,7 @@ Subcommands:
220
203
  sync Overwrite the local work-types.json with the upstream contents
221
204
 
222
205
  Exit codes (check):
223
- 0 Match (or upstream missing \u2014 transitional warning printed)
206
+ 0 Match (or upstream missing — transitional warning printed)
224
207
  1 Drift detected
225
208
  2 Network error
226
209
  3 Schema mismatch
@@ -230,7 +213,7 @@ Options:
230
213
  `);
231
214
  }
232
215
  function showWorkTypesCheckHelp() {
233
- console.info(`
216
+ console.info(`
234
217
  Usage: release-kit work-types check
235
218
 
236
219
  Compare the local work-types.json against the upstream codeassembly canonical and report
@@ -242,7 +225,7 @@ Options:
242
225
  `);
243
226
  }
244
227
  function showWorkTypesSyncHelp() {
245
- console.info(`
228
+ console.info(`
246
229
  Usage: release-kit work-types sync
247
230
 
248
231
  Fetch the upstream work-types.json, validate its top-level shape, and overwrite the local
@@ -253,7 +236,7 @@ Options:
253
236
  `);
254
237
  }
255
238
  function showPublishHelp() {
256
- console.info(`
239
+ console.info(`
257
240
  Usage: release-kit publish [options]
258
241
 
259
242
  Publish packages that have release tags on HEAD. Operates only on workspaces where
@@ -271,228 +254,218 @@ Options:
271
254
  const args = process.argv.slice(2);
272
255
  const command = args[0];
273
256
  const flags = args.slice(1);
274
- if (command === "--version" || command === "-V") {
275
- console.info(VERSION);
276
- process.exit(0);
277
- }
278
- if (command === "--help" || command === "-h" || command === void 0) {
279
- showUsage();
280
- process.exit(0);
281
- }
282
- if (command === "prepare") {
283
- if (flags.some((f) => f === "--help" || f === "-h")) {
284
- showPrepareHelp();
257
+ if (command === '--version' || command === '-V') {
258
+ console.info(VERSION);
285
259
  process.exit(0);
286
- }
287
- await prepareCommand(flags);
288
- process.exit(0);
289
260
  }
290
- if (command === "commit") {
291
- if (flags.some((f) => f === "--help" || f === "-h")) {
292
- showCommitHelp();
261
+ if (command === '--help' || command === '-h' || command === undefined) {
262
+ showUsage();
293
263
  process.exit(0);
294
- }
295
- try {
296
- commitCommand(flags);
297
- } catch (error) {
298
- console.error(error instanceof Error ? error.message : String(error));
299
- process.exit(1);
300
- }
301
- process.exit(0);
302
264
  }
303
- if (command === "tag") {
304
- if (flags.some((f) => f === "--help" || f === "-h")) {
305
- showTagHelp();
265
+ if (command === 'prepare') {
266
+ if (flags.some((f) => f === '--help' || f === '-h')) {
267
+ showPrepareHelp();
268
+ process.exit(0);
269
+ }
270
+ await prepareCommand(flags);
306
271
  process.exit(0);
307
- }
308
- tagCommand(flags);
309
- process.exit(0);
310
272
  }
311
- if (command === "push") {
312
- if (flags.some((f) => f === "--help" || f === "-h")) {
313
- showPushHelp();
273
+ if (command === 'commit') {
274
+ if (flags.some((f) => f === '--help' || f === '-h')) {
275
+ showCommitHelp();
276
+ process.exit(0);
277
+ }
278
+ try {
279
+ commitCommand(flags);
280
+ }
281
+ catch (error) {
282
+ reportError(error instanceof Error ? error.message : String(error));
283
+ process.exit(1);
284
+ }
314
285
  process.exit(0);
315
- }
316
- await pushCommand(flags);
317
- process.exit(0);
318
286
  }
319
- if (command === "create-github-release") {
320
- if (flags.some((f) => f === "--help" || f === "-h")) {
321
- showCreateGithubReleaseHelp();
287
+ if (command === 'tag') {
288
+ if (flags.some((f) => f === '--help' || f === '-h')) {
289
+ showTagHelp();
290
+ process.exit(0);
291
+ }
292
+ tagCommand(flags);
322
293
  process.exit(0);
323
- }
324
- await createGithubReleaseCommand(flags);
325
- process.exit(0);
326
294
  }
327
- if (command === "publish") {
328
- if (flags.some((f) => f === "--help" || f === "-h")) {
329
- showPublishHelp();
295
+ if (command === 'push') {
296
+ if (flags.some((f) => f === '--help' || f === '-h')) {
297
+ showPushHelp();
298
+ process.exit(0);
299
+ }
300
+ await pushCommand(flags);
330
301
  process.exit(0);
331
- }
332
- await publishCommand(flags);
333
- process.exit(0);
334
302
  }
335
- if (command === "show-tag-prefixes") {
336
- if (flags.some((f) => f === "--help" || f === "-h")) {
337
- showShowTagPrefixesHelp();
303
+ if (command === 'create-github-release') {
304
+ if (flags.some((f) => f === '--help' || f === '-h')) {
305
+ showCreateGithubReleaseHelp();
306
+ process.exit(0);
307
+ }
308
+ await createGithubReleaseCommand(flags);
338
309
  process.exit(0);
339
- }
340
- if (flags.length > 0) {
341
- console.error(`Error: Unknown option: ${flags[0]}`);
342
- process.exit(1);
343
- }
344
- const exitCode = await showTagPrefixesCommand();
345
- process.exit(exitCode);
346
310
  }
347
- if (command === "init") {
348
- if (flags.some((f) => f === "--help" || f === "-h")) {
349
- showInitHelp();
311
+ if (command === 'publish') {
312
+ if (flags.some((f) => f === '--help' || f === '-h')) {
313
+ showPublishHelp();
314
+ process.exit(0);
315
+ }
316
+ await publishCommand(flags);
350
317
  process.exit(0);
351
- }
352
- const initFlagSchema = {
353
- dryRun: { long: "--dry-run", type: "boolean" },
354
- force: { long: "--force", type: "boolean" },
355
- withConfig: { long: "--with-config", type: "boolean" }
356
- };
357
- let parsed;
358
- try {
359
- parsed = parseArgs(flags, initFlagSchema);
360
- } catch (error) {
361
- console.error(`Error: ${translateParseError(error)}`);
362
- process.exit(1);
363
- }
364
- const { dryRun, force, withConfig } = parsed.flags;
365
- const exitCode = initCommand({ dryRun, force, withConfig });
366
- process.exit(exitCode);
367
318
  }
368
- if (command === "sync-labels") {
369
- const subcommand = flags[0];
370
- const subflags = flags.slice(1);
371
- if (subcommand === "--help" || subcommand === "-h" || subcommand === void 0) {
372
- showSyncLabelsHelp();
373
- process.exit(0);
374
- }
375
- if (subcommand === "init") {
376
- if (subflags.some((f) => f === "--help" || f === "-h")) {
377
- showSyncLabelsInitHelp();
378
- process.exit(0);
319
+ if (command === 'show-tag-prefixes') {
320
+ if (flags.some((f) => f === '--help' || f === '-h')) {
321
+ showShowTagPrefixesHelp();
322
+ process.exit(0);
379
323
  }
380
- const syncLabelsInitFlagSchema = {
381
- dryRun: { long: "--dry-run", type: "boolean" },
382
- force: { long: "--force", type: "boolean" }
383
- };
384
- let syncParsed;
385
- try {
386
- syncParsed = parseArgs(subflags, syncLabelsInitFlagSchema);
387
- } catch (error) {
388
- console.error(`Error: ${translateParseError(error)}`);
389
- process.exit(1);
390
- }
391
- const { dryRun, force } = syncParsed.flags;
392
- const exitCode = await syncLabelsInitCommand({ dryRun, force });
393
- process.exit(exitCode);
394
- }
395
- if (subcommand === "generate") {
396
- if (subflags.some((f) => f === "--help" || f === "-h")) {
397
- showSyncLabelsGenerateHelp();
398
- process.exit(0);
399
- }
400
- if (subflags.length > 0) {
401
- console.error(`Error: Unknown option: ${subflags[0]}`);
402
- process.exit(1);
324
+ if (flags.length > 0) {
325
+ reportError(`Unknown option: ${flags[0]}`);
326
+ process.exit(1);
403
327
  }
404
- const exitCode = await generateCommand();
328
+ const exitCode = await showTagPrefixesCommand();
405
329
  process.exit(exitCode);
406
- }
407
- if (subcommand === "sync") {
408
- if (subflags.some((f) => f === "--help" || f === "-h")) {
409
- showSyncLabelsSyncHelp();
410
- process.exit(0);
411
- }
412
- if (subflags.length > 0) {
413
- console.error(`Error: Unknown option: ${subflags[0]}`);
414
- process.exit(1);
330
+ }
331
+ if (command === 'init') {
332
+ if (flags.some((f) => f === '--help' || f === '-h')) {
333
+ showInitHelp();
334
+ process.exit(0);
415
335
  }
416
- const exitCode = syncLabelsCommand();
336
+ const initFlagSchema = {
337
+ dryRun: { long: '--dry-run', type: 'boolean' },
338
+ force: { long: '--force', type: 'boolean' },
339
+ withConfig: { long: '--with-config', type: 'boolean' },
340
+ };
341
+ const { dryRun, force, withConfig } = parseArgsOrExit(flags, initFlagSchema).flags;
342
+ const exitCode = initCommand({ dryRun, force, withConfig });
417
343
  process.exit(exitCode);
418
- }
419
- console.error(`Error: Unknown subcommand: ${subcommand}`);
420
- showSyncLabelsHelp();
421
- process.exit(1);
422
344
  }
423
- if (command === "overrides") {
424
- const subcommand = flags[0];
425
- const subflags = flags.slice(1);
426
- if (subcommand === "--help" || subcommand === "-h" || subcommand === void 0) {
427
- showOverridesHelp();
428
- process.exit(0);
429
- }
430
- if (subcommand === "validate") {
431
- if (subflags.some((f) => f === "--help" || f === "-h")) {
432
- showOverridesValidateHelp();
433
- process.exit(0);
345
+ if (command === 'sync-labels') {
346
+ const subcommand = flags[0];
347
+ const subflags = flags.slice(1);
348
+ if (subcommand === '--help' || subcommand === '-h' || subcommand === undefined) {
349
+ showSyncLabelsHelp();
350
+ process.exit(0);
434
351
  }
435
- if (subflags.length > 0) {
436
- console.error(`Error: Unknown option: ${subflags[0]}`);
437
- process.exit(1);
352
+ if (subcommand === 'init') {
353
+ if (subflags.some((f) => f === '--help' || f === '-h')) {
354
+ showSyncLabelsInitHelp();
355
+ process.exit(0);
356
+ }
357
+ const syncLabelsInitFlagSchema = {
358
+ dryRun: { long: '--dry-run', type: 'boolean' },
359
+ force: { long: '--force', type: 'boolean' },
360
+ };
361
+ const { dryRun, force } = parseArgsOrExit(subflags, syncLabelsInitFlagSchema).flags;
362
+ const exitCode = await syncLabelsInitCommand({ dryRun, force });
363
+ process.exit(exitCode);
438
364
  }
439
- const result = await validateOverridesCommand();
440
- if (result.exitCode === 0) {
441
- console.info(result.message);
442
- } else {
443
- console.error(result.message);
365
+ if (subcommand === 'generate') {
366
+ if (subflags.some((f) => f === '--help' || f === '-h')) {
367
+ showSyncLabelsGenerateHelp();
368
+ process.exit(0);
369
+ }
370
+ if (subflags.length > 0) {
371
+ reportError(`Unknown option: ${subflags[0]}`);
372
+ process.exit(1);
373
+ }
374
+ const exitCode = await generateCommand();
375
+ process.exit(exitCode);
444
376
  }
445
- process.exit(result.exitCode);
446
- }
447
- console.error(`Error: Unknown subcommand: ${subcommand}`);
448
- showOverridesHelp();
449
- process.exit(1);
450
- }
451
- if (command === "work-types") {
452
- const subcommand = flags[0];
453
- const subflags = flags.slice(1);
454
- if (subcommand === "--help" || subcommand === "-h" || subcommand === void 0) {
455
- showWorkTypesHelp();
456
- process.exit(0);
457
- }
458
- if (subcommand === "check") {
459
- if (subflags.some((f) => f === "--help" || f === "-h")) {
460
- showWorkTypesCheckHelp();
461
- process.exit(0);
377
+ if (subcommand === 'sync') {
378
+ if (subflags.some((f) => f === '--help' || f === '-h')) {
379
+ showSyncLabelsSyncHelp();
380
+ process.exit(0);
381
+ }
382
+ if (subflags.length > 0) {
383
+ reportError(`Unknown option: ${subflags[0]}`);
384
+ process.exit(1);
385
+ }
386
+ const exitCode = syncLabelsCommand();
387
+ process.exit(exitCode);
462
388
  }
463
- if (subflags.length > 0) {
464
- console.error(`Error: Unknown option: ${subflags[0]}`);
465
- process.exit(1);
389
+ reportError(`Unknown subcommand: ${subcommand}`);
390
+ showSyncLabelsHelp();
391
+ process.exit(1);
392
+ }
393
+ if (command === 'overrides') {
394
+ const subcommand = flags[0];
395
+ const subflags = flags.slice(1);
396
+ if (subcommand === '--help' || subcommand === '-h' || subcommand === undefined) {
397
+ showOverridesHelp();
398
+ process.exit(0);
466
399
  }
467
- const result = await checkWorkTypesDrift();
468
- if (result.exitCode === 0) {
469
- console.info(result.message);
470
- } else {
471
- console.error(result.message);
400
+ if (subcommand === 'validate') {
401
+ if (subflags.some((f) => f === '--help' || f === '-h')) {
402
+ showOverridesValidateHelp();
403
+ process.exit(0);
404
+ }
405
+ if (subflags.length > 0) {
406
+ reportError(`Unknown option: ${subflags[0]}`);
407
+ process.exit(1);
408
+ }
409
+ const result = await validateOverridesCommand();
410
+ if (result.exitCode === 0) {
411
+ console.info(result.message);
412
+ }
413
+ else {
414
+ process.stderr.write(`${result.message}\n`);
415
+ }
416
+ process.exit(result.exitCode);
472
417
  }
473
- process.exit(result.exitCode);
474
- }
475
- if (subcommand === "sync") {
476
- if (subflags.some((f) => f === "--help" || f === "-h")) {
477
- showWorkTypesSyncHelp();
478
- process.exit(0);
418
+ reportError(`Unknown subcommand: ${subcommand}`);
419
+ showOverridesHelp();
420
+ process.exit(1);
421
+ }
422
+ if (command === 'work-types') {
423
+ const subcommand = flags[0];
424
+ const subflags = flags.slice(1);
425
+ if (subcommand === '--help' || subcommand === '-h' || subcommand === undefined) {
426
+ showWorkTypesHelp();
427
+ process.exit(0);
479
428
  }
480
- if (subflags.length > 0) {
481
- console.error(`Error: Unknown option: ${subflags[0]}`);
482
- process.exit(1);
429
+ if (subcommand === 'check') {
430
+ if (subflags.some((f) => f === '--help' || f === '-h')) {
431
+ showWorkTypesCheckHelp();
432
+ process.exit(0);
433
+ }
434
+ if (subflags.length > 0) {
435
+ reportError(`Unknown option: ${subflags[0]}`);
436
+ process.exit(1);
437
+ }
438
+ const result = await checkWorkTypesDrift();
439
+ if (result.exitCode === 0) {
440
+ console.info(result.message);
441
+ }
442
+ else {
443
+ process.stderr.write(`${result.message}\n`);
444
+ }
445
+ process.exit(result.exitCode);
483
446
  }
484
- const result = await syncWorkTypes();
485
- if (result.exitCode === 0) {
486
- console.info(result.message);
487
- } else {
488
- console.error(result.message);
447
+ if (subcommand === 'sync') {
448
+ if (subflags.some((f) => f === '--help' || f === '-h')) {
449
+ showWorkTypesSyncHelp();
450
+ process.exit(0);
451
+ }
452
+ if (subflags.length > 0) {
453
+ reportError(`Unknown option: ${subflags[0]}`);
454
+ process.exit(1);
455
+ }
456
+ const result = await syncWorkTypes();
457
+ if (result.exitCode === 0) {
458
+ console.info(result.message);
459
+ }
460
+ else {
461
+ process.stderr.write(`${result.message}\n`);
462
+ }
463
+ process.exit(result.exitCode);
489
464
  }
490
- process.exit(result.exitCode);
491
- }
492
- console.error(`Error: Unknown subcommand: ${subcommand}`);
493
- showWorkTypesHelp();
494
- process.exit(1);
465
+ reportError(`Unknown subcommand: ${subcommand}`);
466
+ showWorkTypesHelp();
467
+ process.exit(1);
495
468
  }
496
- console.error(`Error: Unknown command: ${command}`);
469
+ reportError(`Unknown command: ${command}`);
497
470
  showUsage();
498
471
  process.exit(1);
@@ -1,4 +1,4 @@
1
- import type { GenerateChangelogOptions } from './generateChangelogs.ts';
2
- import type { ChangelogEntry, ReleaseConfig } from './types.ts';
1
+ import type { GenerateChangelogOptions } from './generateChangelogs.js';
2
+ import type { ChangelogEntry, ReleaseConfig } from './types.js';
3
3
  export declare function stripGroupDecorations(group: string): string;
4
4
  export declare function buildChangelogEntries(config: Pick<ReleaseConfig, 'cliffConfigPath' | 'changelogJson'>, tag: string, options?: GenerateChangelogOptions): ChangelogEntry[];