relizy 1.4.5 → 1.4.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.mjs CHANGED
@@ -5,7 +5,7 @@ import process from 'node:process';
5
5
  import { fileURLToPath } from 'node:url';
6
6
  import { printBanner, logger } from '@maz-ui/node';
7
7
  import { Command } from 'commander';
8
- import { aq as isInCI, ar as getCIName, b as bump, c as changelog, g as publish, e as providerRelease, h as social, p as prComment, r as release } from './shared/relizy.-Cr2hO3N.mjs';
8
+ import { ay as isInCI, az as getCIName, b as bump, c as changelog, g as publish, e as providerRelease, h as social, p as prComment, r as release } from './shared/relizy.d-S4lcvu.mjs';
9
9
  import 'node:child_process';
10
10
  import '@maz-ui/utils';
11
11
  import 'c12';
package/dist/index.d.mts CHANGED
@@ -69,6 +69,7 @@ declare function getDefaultConfig(): {
69
69
  ai: AIConfig;
70
70
  logLevel: LogLevel;
71
71
  safetyCheck: boolean;
72
+ detectRewrittenTags: boolean;
72
73
  };
73
74
  /**
74
75
  * Merge user types with defaults: each user-defined entry replaces the default entirely.
@@ -88,19 +89,41 @@ type ResolvedRelizyConfig = ResolvedConfig & {
88
89
  declare function defineConfig(config: RelizyConfig): RelizyConfig;
89
90
 
90
91
  /**
91
- * Generate changelog for a specific package
92
+ * Controls which sections of the rendered changelog are produced.
93
+ * Each flag defaults to `true`. `compareLink` and `contributors` are
94
+ * additionally suppressed when `minify: true` (see `generateChangelog`).
92
95
  */
93
- declare function generateChangelog({ pkg, config, dryRun, newVersion, minify, }: {
96
+ interface ChangelogInclude {
97
+ title?: boolean;
98
+ compareLink?: boolean;
99
+ body?: boolean;
100
+ contributors?: boolean;
101
+ }
102
+ /**
103
+ * Generate the changelog string for a single package.
104
+ *
105
+ * - Fetches commits internally using `changelog: true`, so types that only
106
+ * declare a `title` (e.g. `docs: { title: '📖 Documentation' }`) are
107
+ * included even though they don't trigger a version bump. Callers must
108
+ * provide `pkg.path` — `pkg.commits` is no longer consumed.
109
+ * - `include` toggles which sections appear in the output. `compareLink`
110
+ * and `contributors` are also skipped when `minify` is true.
111
+ * - `transformBody` is invoked between body rendering and final assembly,
112
+ * used by provider releases to plug an AI rewrite step on the body only.
113
+ */
114
+ declare function generateChangelog({ pkg, config, dryRun, newVersion, minify, include, transformBody, }: {
94
115
  pkg: {
95
116
  fromTag?: string;
96
117
  name: string;
118
+ path: string;
97
119
  newVersion?: string;
98
- commits: GitCommit[];
99
120
  };
100
121
  config: ResolvedRelizyConfig;
101
122
  dryRun: boolean;
102
123
  newVersion: string;
103
124
  minify?: boolean;
125
+ include?: ChangelogInclude;
126
+ transformBody?: (body: string) => Promise<string> | string;
104
127
  }): Promise<string>;
105
128
  /**
106
129
  * Write changelog to file
@@ -188,6 +211,44 @@ declare function getCurrentGitBranch(cwd: string): string;
188
211
  declare function getCurrentGitRef(cwd: string): string;
189
212
  declare function getShortCommitSha(cwd: string, length?: number): string;
190
213
 
214
+ /**
215
+ * Returns true when `ancestor` is an ancestor of `descendant` (i.e. reachable
216
+ * from it). Uses `git merge-base --is-ancestor`, which exits 0 when true and
217
+ * non-zero otherwise. Any error (e.g. unknown ref) is treated as "not an
218
+ * ancestor".
219
+ */
220
+ declare function isAncestor(ancestor: string, descendant: string, cwd?: string): Promise<boolean>;
221
+ /**
222
+ * Returns the subject (first line) of the commit a ref points to, or null.
223
+ */
224
+ declare function getCommitSubject(ref: string, cwd?: string): Promise<string | null>;
225
+ /**
226
+ * Find the most recent commit reachable from `to` whose subject matches
227
+ * `subject` literally. Used to locate the "twin" of a release commit that was
228
+ * rewritten by a rebase (the orphaned tag still points to the old commit).
229
+ */
230
+ declare function findReachableCommitBySubject(subject: string, to: string, cwd?: string): Promise<string | null>;
231
+ /**
232
+ * Returns true when a tag with the given name exists locally.
233
+ */
234
+ declare function tagExists(tag: string, cwd?: string): Promise<boolean>;
235
+ /**
236
+ * Move an annotated tag to a different commit locally (force). Never rewrites
237
+ * any commit; only the tag pointer moves.
238
+ */
239
+ declare function retagAnnotatedLocal({ tag, commit, message, signed, cwd, logLevel, }: {
240
+ tag: string;
241
+ commit: string;
242
+ message: string;
243
+ signed?: boolean;
244
+ cwd?: string;
245
+ logLevel?: LogLevel;
246
+ }): Promise<void>;
247
+ /**
248
+ * Force-push a single tag to origin. Used only after explicit confirmation.
249
+ */
250
+ declare function pushTagForce(tag: string, cwd?: string, logLevel?: LogLevel): Promise<void>;
251
+
191
252
  declare function github(options: ProviderReleaseOptions): Promise<PostedRelease[]>;
192
253
 
193
254
  interface GitlabRelease {
@@ -355,13 +416,14 @@ interface RootPackage extends ReadPackage {
355
416
  commits: GitCommit[];
356
417
  newVersion?: string;
357
418
  }
358
- declare function getRootPackage({ config, force, from, to, suffix, changelog, }: {
419
+ declare function getRootPackage({ config, force, from, to, suffix, changelog, dryRun, }: {
359
420
  config: ResolvedRelizyConfig;
360
421
  force: boolean;
361
422
  from: string;
362
423
  to: string;
363
424
  suffix: string | undefined;
364
425
  changelog: boolean;
426
+ dryRun?: boolean;
365
427
  }): Promise<RootPackage>;
366
428
  declare function readPackages({ cwd, patterns, ignorePackageNames, includePrivates, }: {
367
429
  cwd: string;
@@ -369,21 +431,42 @@ declare function readPackages({ cwd, patterns, ignorePackageNames, includePrivat
369
431
  ignorePackageNames: NonNullable<ResolvedRelizyConfig['monorepo']>['ignorePackageNames'];
370
432
  includePrivates?: boolean;
371
433
  }): ReadPackage[];
372
- declare function getPackages({ config, suffix, force, includeAll, }: {
434
+ declare function getPackages({ config, suffix, force, includeAll, dryRun, }: {
373
435
  config: ResolvedRelizyConfig;
374
436
  suffix: string | undefined;
375
437
  force: boolean;
376
438
  includeAll?: boolean;
439
+ dryRun?: boolean;
377
440
  }): Promise<PackageBase[]>;
378
- declare function getPackageCommits({ pkg, from, to, config, changelog, }: {
441
+ declare function getPackageCommits({ pkg, from, to, config, changelog, dryRun, }: {
379
442
  pkg: ReadPackage;
380
443
  from: string;
381
444
  to: string;
382
445
  config: ResolvedRelizyConfig;
383
446
  changelog: boolean;
447
+ dryRun?: boolean;
384
448
  }): Promise<GitCommit[]>;
385
449
  declare function hasLernaJson(rootDir: string): boolean;
386
450
 
451
+ /** Test helper: clear the per-process decision cache. */
452
+ declare function resetRewrittenTagCache(): void;
453
+ /**
454
+ * Ensure the resolved `from` tag is reachable from `to`. When it is not (a
455
+ * rewritten / orphaned tag), explain the situation and either prompt the user
456
+ * or auto-correct, depending on the configured strategy. Returns the effective
457
+ * `from` to use (the original tag, the rebound tag, or the equivalent commit
458
+ * SHA for an ephemeral correction).
459
+ *
460
+ * No commit is ever rewritten; the only mutation possible is moving a tag.
461
+ */
462
+ declare function reconcileFromTag({ from, to, config, dryRun, }: {
463
+ from: string;
464
+ to: string;
465
+ config: ResolvedRelizyConfig;
466
+ pkg?: ReadPackage;
467
+ dryRun?: boolean;
468
+ }): Promise<string>;
469
+
387
470
  /**
388
471
  * Get Slack token from config
389
472
  * Priority: social.slack.credentials > config.tokens.slack > environment variables (handled in config.ts)
@@ -541,11 +624,12 @@ declare function isBumpedPackage(pkg: PackageBase): pkg is PackageBase & {
541
624
  declare function filterOutPrivatePackages<T extends {
542
625
  private: boolean;
543
626
  }>(packages: T[]): T[];
544
- declare function getPackagesOrBumpedPackages({ config, bumpResult, suffix, force, }: {
627
+ declare function getPackagesOrBumpedPackages({ config, bumpResult, suffix, force, dryRun, }: {
545
628
  config: ResolvedRelizyConfig;
546
629
  bumpResult: BumpResultTruthy | undefined;
547
630
  suffix: string | undefined;
548
631
  force: boolean;
632
+ dryRun?: boolean;
549
633
  }): Promise<PackageBase[]>;
550
634
 
551
635
  declare function isGraduatingToStableBetweenVersion(version: string, newVersion: string): boolean;
@@ -1742,6 +1826,7 @@ type HookConfig = {
1742
1826
  * Relizy configuration
1743
1827
  * @see https://relizy.dev/config/overview
1744
1828
  */
1829
+ type OnRewrittenTag = 'prompt' | 'ephemeral' | 'rebind' | 'error';
1745
1830
  interface RelizyConfig extends Partial<Omit<ChangelogConfig$1, 'output' | 'templates' | 'publish' | 'types' | 'tokens'>> {
1746
1831
  /**
1747
1832
  * Project name
@@ -1823,6 +1908,24 @@ interface RelizyConfig extends Partial<Omit<ChangelogConfig$1, 'output' | 'templ
1823
1908
  * @default true
1824
1909
  */
1825
1910
  safetyCheck?: boolean;
1911
+ /**
1912
+ * Detect when the resolved `from` tag points to a commit that is no longer
1913
+ * reachable from `to` (typically because the history was rebased after the
1914
+ * tag was created). When enabled, relizy explains the situation and either
1915
+ * prompts or auto-corrects, avoiding bloated changelogs and over-bumping.
1916
+ * @default true
1917
+ */
1918
+ detectRewrittenTags?: boolean;
1919
+ /**
1920
+ * Strategy applied when a rewritten/orphaned `from` tag is detected.
1921
+ * Defaults to `prompt` interactively, or `ephemeral` when non-interactive
1922
+ * (`--yes` / no TTY / CI).
1923
+ * - `prompt`: interactive selection.
1924
+ * - `ephemeral`: use the reachable equivalent commit for this run only.
1925
+ * - `rebind`: move the local tag onto the equivalent commit (no push).
1926
+ * - `error`: throw and stop.
1927
+ */
1928
+ onRewrittenTag?: OnRewrittenTag;
1826
1929
  }
1827
1930
 
1828
1931
  declare function bump(options?: Partial<BumpOptions>): Promise<BumpResult>;
@@ -1875,5 +1978,5 @@ declare function socialSafetyCheck({ config }: {
1875
1978
  }): Promise<void>;
1876
1979
  declare function social(options?: Partial<SocialOptions>): Promise<SocialResult>;
1877
1980
 
1878
- export { NEW_PACKAGE_MARKER, PR_COMMENT_MARKER, buildChangelogBody, buildCommentBody, buildCompareLink, buildContributors, bump, capReleaseTypeForZeroMajor, changelog, checkGitStatusIfDirty, collectContributorNames, collectPackageBumps, confirmBump, createCommitAndTags, createGitlabRelease, defineConfig, detectGitProvider, detectPackageManager, detectPullRequest, determinePublishTag, determineReleaseType, determineSemverChange, executeBuildCmd, executeFormatCmd, executeHook, expandPackagesToBumpWithDependents, extractChangelogSummary, extractVersionFromPackageTag, extractVersionFromTag, fetchGitTags, filterOutPrivatePackages, findGitHubPR, findGitLabMR, formatChangelogForSlack, formatPackagesForSlack, formatSlackMessage, formatTweetMessage, generateChangelog, generateMarkDown, getAuthCommand, getBumpedIndependentPackages, getBumpedPackageIndependently, getCIName, getCanaryVersion, getCurrentGitBranch, getCurrentGitRef, getDefaultConfig, getDependentsOf, getFirstCommit, getGitStatus, getIndependentTag, getLastPackageTag, getLastRepoTag, getLastStableTag, getLastTag, getModifiedReleaseFilePatterns, getPackageCommits, getPackageDependencies, getPackageNewVersion, getPackages, getPackagesOrBumpedPackages, getPackagesToPublishInIndependentMode, getPackagesToPublishInSelectiveMode, getPreid, getReleaseUrl, getRootPackage, getShortCommitSha, getSlackToken, getSlackWebhookUrl, getTwitterCredentials, github, gitlab, hasLernaJson, isBumpedPackage, isChangedPreid, isGraduating, isGraduatingToStableBetweenVersion, isInCI, isPrerelease, isPrereleaseReleaseType, isStableReleaseType, isTagVersionCompatibleWithCurrent, loadRelizyConfig, mergeTypes, parseChangelogMarkdown, parseGitRemoteUrl, postPrComment, postReleaseToSlack, postReleaseToTwitter, prComment, providerRelease, providerReleaseSafetyCheck, publish, publishPackage, publishSafetyCheck, pushCommitAndTags, readPackageJson, readPackages, release, resolveTags, rollbackModifiedFiles, shouldFilterPrereleaseTags, social, socialSafetyCheck, topologicalSort, updateLernaVersion, writeChangelogToFile, writeVersion };
1879
- export type { AIConfig, AIPromptTarget, AIProviderName, AISocialConfig, AISystemPromptOverrides, AITargetConfig, BumpConfig, BumpOptions, BumpResult, BumpResultFalsy, BumpResultTruthy, ChangelogConfig, ChangelogOptions, ClaudeCodeProviderOptions, ConfigType, GitProvider, GitlabRelease, GitlabReleaseResponse, HookConfig, HookStep, HookType, MonorepoConfig, PackageBase, PackageBumpEntry, PackageManager, PostedRelease, PrCommentConfig, PrCommentMode, PrCommentOptions, PrCommentStatus, ProviderReleaseOptions, ProviderReleaseResult, PublishConfig, PublishOptions, PublishResponse, PullRequestInfo, ReadPackage, Reference, ReleaseConfig, ReleaseContext, ReleaseOptions, RelizyConfig, RepoConfig, ResolvedConfig, ResolvedRelizyConfig, ResolvedTags, ResolvedTwitterCredentials, RootPackage, SlackCredentials, SlackOptions, SlackPackageEntry, SlackSocialConfig, SocialConfig, SocialNetworkResult, SocialOptions, SocialResult, Step, TemplatesConfig, TokensConfig, TwitterCredentials, TwitterOptions, TwitterSocialConfig, VersionMode };
1981
+ export { NEW_PACKAGE_MARKER, PR_COMMENT_MARKER, buildChangelogBody, buildCommentBody, buildCompareLink, buildContributors, bump, capReleaseTypeForZeroMajor, changelog, checkGitStatusIfDirty, collectContributorNames, collectPackageBumps, confirmBump, createCommitAndTags, createGitlabRelease, defineConfig, detectGitProvider, detectPackageManager, detectPullRequest, determinePublishTag, determineReleaseType, determineSemverChange, executeBuildCmd, executeFormatCmd, executeHook, expandPackagesToBumpWithDependents, extractChangelogSummary, extractVersionFromPackageTag, extractVersionFromTag, fetchGitTags, filterOutPrivatePackages, findGitHubPR, findGitLabMR, findReachableCommitBySubject, formatChangelogForSlack, formatPackagesForSlack, formatSlackMessage, formatTweetMessage, generateChangelog, generateMarkDown, getAuthCommand, getBumpedIndependentPackages, getBumpedPackageIndependently, getCIName, getCanaryVersion, getCommitSubject, getCurrentGitBranch, getCurrentGitRef, getDefaultConfig, getDependentsOf, getFirstCommit, getGitStatus, getIndependentTag, getLastPackageTag, getLastRepoTag, getLastStableTag, getLastTag, getModifiedReleaseFilePatterns, getPackageCommits, getPackageDependencies, getPackageNewVersion, getPackages, getPackagesOrBumpedPackages, getPackagesToPublishInIndependentMode, getPackagesToPublishInSelectiveMode, getPreid, getReleaseUrl, getRootPackage, getShortCommitSha, getSlackToken, getSlackWebhookUrl, getTwitterCredentials, github, gitlab, hasLernaJson, isAncestor, isBumpedPackage, isChangedPreid, isGraduating, isGraduatingToStableBetweenVersion, isInCI, isPrerelease, isPrereleaseReleaseType, isStableReleaseType, isTagVersionCompatibleWithCurrent, loadRelizyConfig, mergeTypes, parseChangelogMarkdown, parseGitRemoteUrl, postPrComment, postReleaseToSlack, postReleaseToTwitter, prComment, providerRelease, providerReleaseSafetyCheck, publish, publishPackage, publishSafetyCheck, pushCommitAndTags, pushTagForce, readPackageJson, readPackages, reconcileFromTag, release, resetRewrittenTagCache, resolveTags, retagAnnotatedLocal, rollbackModifiedFiles, shouldFilterPrereleaseTags, social, socialSafetyCheck, tagExists, topologicalSort, updateLernaVersion, writeChangelogToFile, writeVersion };
1982
+ export type { AIConfig, AIPromptTarget, AIProviderName, AISocialConfig, AISystemPromptOverrides, AITargetConfig, BumpConfig, BumpOptions, BumpResult, BumpResultFalsy, BumpResultTruthy, ChangelogConfig, ChangelogInclude, ChangelogOptions, ClaudeCodeProviderOptions, ConfigType, GitProvider, GitlabRelease, GitlabReleaseResponse, HookConfig, HookStep, HookType, MonorepoConfig, OnRewrittenTag, PackageBase, PackageBumpEntry, PackageManager, PostedRelease, PrCommentConfig, PrCommentMode, PrCommentOptions, PrCommentStatus, ProviderReleaseOptions, ProviderReleaseResult, PublishConfig, PublishOptions, PublishResponse, PullRequestInfo, ReadPackage, Reference, ReleaseConfig, ReleaseContext, ReleaseOptions, RelizyConfig, RepoConfig, ResolvedConfig, ResolvedRelizyConfig, ResolvedTags, ResolvedTwitterCredentials, RootPackage, SlackCredentials, SlackOptions, SlackPackageEntry, SlackSocialConfig, SocialConfig, SocialNetworkResult, SocialOptions, SocialResult, Step, TemplatesConfig, TokensConfig, TwitterCredentials, TwitterOptions, TwitterSocialConfig, VersionMode };
package/dist/index.d.ts CHANGED
@@ -69,6 +69,7 @@ declare function getDefaultConfig(): {
69
69
  ai: AIConfig;
70
70
  logLevel: LogLevel;
71
71
  safetyCheck: boolean;
72
+ detectRewrittenTags: boolean;
72
73
  };
73
74
  /**
74
75
  * Merge user types with defaults: each user-defined entry replaces the default entirely.
@@ -88,19 +89,41 @@ type ResolvedRelizyConfig = ResolvedConfig & {
88
89
  declare function defineConfig(config: RelizyConfig): RelizyConfig;
89
90
 
90
91
  /**
91
- * Generate changelog for a specific package
92
+ * Controls which sections of the rendered changelog are produced.
93
+ * Each flag defaults to `true`. `compareLink` and `contributors` are
94
+ * additionally suppressed when `minify: true` (see `generateChangelog`).
92
95
  */
93
- declare function generateChangelog({ pkg, config, dryRun, newVersion, minify, }: {
96
+ interface ChangelogInclude {
97
+ title?: boolean;
98
+ compareLink?: boolean;
99
+ body?: boolean;
100
+ contributors?: boolean;
101
+ }
102
+ /**
103
+ * Generate the changelog string for a single package.
104
+ *
105
+ * - Fetches commits internally using `changelog: true`, so types that only
106
+ * declare a `title` (e.g. `docs: { title: '📖 Documentation' }`) are
107
+ * included even though they don't trigger a version bump. Callers must
108
+ * provide `pkg.path` — `pkg.commits` is no longer consumed.
109
+ * - `include` toggles which sections appear in the output. `compareLink`
110
+ * and `contributors` are also skipped when `minify` is true.
111
+ * - `transformBody` is invoked between body rendering and final assembly,
112
+ * used by provider releases to plug an AI rewrite step on the body only.
113
+ */
114
+ declare function generateChangelog({ pkg, config, dryRun, newVersion, minify, include, transformBody, }: {
94
115
  pkg: {
95
116
  fromTag?: string;
96
117
  name: string;
118
+ path: string;
97
119
  newVersion?: string;
98
- commits: GitCommit[];
99
120
  };
100
121
  config: ResolvedRelizyConfig;
101
122
  dryRun: boolean;
102
123
  newVersion: string;
103
124
  minify?: boolean;
125
+ include?: ChangelogInclude;
126
+ transformBody?: (body: string) => Promise<string> | string;
104
127
  }): Promise<string>;
105
128
  /**
106
129
  * Write changelog to file
@@ -188,6 +211,44 @@ declare function getCurrentGitBranch(cwd: string): string;
188
211
  declare function getCurrentGitRef(cwd: string): string;
189
212
  declare function getShortCommitSha(cwd: string, length?: number): string;
190
213
 
214
+ /**
215
+ * Returns true when `ancestor` is an ancestor of `descendant` (i.e. reachable
216
+ * from it). Uses `git merge-base --is-ancestor`, which exits 0 when true and
217
+ * non-zero otherwise. Any error (e.g. unknown ref) is treated as "not an
218
+ * ancestor".
219
+ */
220
+ declare function isAncestor(ancestor: string, descendant: string, cwd?: string): Promise<boolean>;
221
+ /**
222
+ * Returns the subject (first line) of the commit a ref points to, or null.
223
+ */
224
+ declare function getCommitSubject(ref: string, cwd?: string): Promise<string | null>;
225
+ /**
226
+ * Find the most recent commit reachable from `to` whose subject matches
227
+ * `subject` literally. Used to locate the "twin" of a release commit that was
228
+ * rewritten by a rebase (the orphaned tag still points to the old commit).
229
+ */
230
+ declare function findReachableCommitBySubject(subject: string, to: string, cwd?: string): Promise<string | null>;
231
+ /**
232
+ * Returns true when a tag with the given name exists locally.
233
+ */
234
+ declare function tagExists(tag: string, cwd?: string): Promise<boolean>;
235
+ /**
236
+ * Move an annotated tag to a different commit locally (force). Never rewrites
237
+ * any commit; only the tag pointer moves.
238
+ */
239
+ declare function retagAnnotatedLocal({ tag, commit, message, signed, cwd, logLevel, }: {
240
+ tag: string;
241
+ commit: string;
242
+ message: string;
243
+ signed?: boolean;
244
+ cwd?: string;
245
+ logLevel?: LogLevel;
246
+ }): Promise<void>;
247
+ /**
248
+ * Force-push a single tag to origin. Used only after explicit confirmation.
249
+ */
250
+ declare function pushTagForce(tag: string, cwd?: string, logLevel?: LogLevel): Promise<void>;
251
+
191
252
  declare function github(options: ProviderReleaseOptions): Promise<PostedRelease[]>;
192
253
 
193
254
  interface GitlabRelease {
@@ -355,13 +416,14 @@ interface RootPackage extends ReadPackage {
355
416
  commits: GitCommit[];
356
417
  newVersion?: string;
357
418
  }
358
- declare function getRootPackage({ config, force, from, to, suffix, changelog, }: {
419
+ declare function getRootPackage({ config, force, from, to, suffix, changelog, dryRun, }: {
359
420
  config: ResolvedRelizyConfig;
360
421
  force: boolean;
361
422
  from: string;
362
423
  to: string;
363
424
  suffix: string | undefined;
364
425
  changelog: boolean;
426
+ dryRun?: boolean;
365
427
  }): Promise<RootPackage>;
366
428
  declare function readPackages({ cwd, patterns, ignorePackageNames, includePrivates, }: {
367
429
  cwd: string;
@@ -369,21 +431,42 @@ declare function readPackages({ cwd, patterns, ignorePackageNames, includePrivat
369
431
  ignorePackageNames: NonNullable<ResolvedRelizyConfig['monorepo']>['ignorePackageNames'];
370
432
  includePrivates?: boolean;
371
433
  }): ReadPackage[];
372
- declare function getPackages({ config, suffix, force, includeAll, }: {
434
+ declare function getPackages({ config, suffix, force, includeAll, dryRun, }: {
373
435
  config: ResolvedRelizyConfig;
374
436
  suffix: string | undefined;
375
437
  force: boolean;
376
438
  includeAll?: boolean;
439
+ dryRun?: boolean;
377
440
  }): Promise<PackageBase[]>;
378
- declare function getPackageCommits({ pkg, from, to, config, changelog, }: {
441
+ declare function getPackageCommits({ pkg, from, to, config, changelog, dryRun, }: {
379
442
  pkg: ReadPackage;
380
443
  from: string;
381
444
  to: string;
382
445
  config: ResolvedRelizyConfig;
383
446
  changelog: boolean;
447
+ dryRun?: boolean;
384
448
  }): Promise<GitCommit[]>;
385
449
  declare function hasLernaJson(rootDir: string): boolean;
386
450
 
451
+ /** Test helper: clear the per-process decision cache. */
452
+ declare function resetRewrittenTagCache(): void;
453
+ /**
454
+ * Ensure the resolved `from` tag is reachable from `to`. When it is not (a
455
+ * rewritten / orphaned tag), explain the situation and either prompt the user
456
+ * or auto-correct, depending on the configured strategy. Returns the effective
457
+ * `from` to use (the original tag, the rebound tag, or the equivalent commit
458
+ * SHA for an ephemeral correction).
459
+ *
460
+ * No commit is ever rewritten; the only mutation possible is moving a tag.
461
+ */
462
+ declare function reconcileFromTag({ from, to, config, dryRun, }: {
463
+ from: string;
464
+ to: string;
465
+ config: ResolvedRelizyConfig;
466
+ pkg?: ReadPackage;
467
+ dryRun?: boolean;
468
+ }): Promise<string>;
469
+
387
470
  /**
388
471
  * Get Slack token from config
389
472
  * Priority: social.slack.credentials > config.tokens.slack > environment variables (handled in config.ts)
@@ -541,11 +624,12 @@ declare function isBumpedPackage(pkg: PackageBase): pkg is PackageBase & {
541
624
  declare function filterOutPrivatePackages<T extends {
542
625
  private: boolean;
543
626
  }>(packages: T[]): T[];
544
- declare function getPackagesOrBumpedPackages({ config, bumpResult, suffix, force, }: {
627
+ declare function getPackagesOrBumpedPackages({ config, bumpResult, suffix, force, dryRun, }: {
545
628
  config: ResolvedRelizyConfig;
546
629
  bumpResult: BumpResultTruthy | undefined;
547
630
  suffix: string | undefined;
548
631
  force: boolean;
632
+ dryRun?: boolean;
549
633
  }): Promise<PackageBase[]>;
550
634
 
551
635
  declare function isGraduatingToStableBetweenVersion(version: string, newVersion: string): boolean;
@@ -1742,6 +1826,7 @@ type HookConfig = {
1742
1826
  * Relizy configuration
1743
1827
  * @see https://relizy.dev/config/overview
1744
1828
  */
1829
+ type OnRewrittenTag = 'prompt' | 'ephemeral' | 'rebind' | 'error';
1745
1830
  interface RelizyConfig extends Partial<Omit<ChangelogConfig$1, 'output' | 'templates' | 'publish' | 'types' | 'tokens'>> {
1746
1831
  /**
1747
1832
  * Project name
@@ -1823,6 +1908,24 @@ interface RelizyConfig extends Partial<Omit<ChangelogConfig$1, 'output' | 'templ
1823
1908
  * @default true
1824
1909
  */
1825
1910
  safetyCheck?: boolean;
1911
+ /**
1912
+ * Detect when the resolved `from` tag points to a commit that is no longer
1913
+ * reachable from `to` (typically because the history was rebased after the
1914
+ * tag was created). When enabled, relizy explains the situation and either
1915
+ * prompts or auto-corrects, avoiding bloated changelogs and over-bumping.
1916
+ * @default true
1917
+ */
1918
+ detectRewrittenTags?: boolean;
1919
+ /**
1920
+ * Strategy applied when a rewritten/orphaned `from` tag is detected.
1921
+ * Defaults to `prompt` interactively, or `ephemeral` when non-interactive
1922
+ * (`--yes` / no TTY / CI).
1923
+ * - `prompt`: interactive selection.
1924
+ * - `ephemeral`: use the reachable equivalent commit for this run only.
1925
+ * - `rebind`: move the local tag onto the equivalent commit (no push).
1926
+ * - `error`: throw and stop.
1927
+ */
1928
+ onRewrittenTag?: OnRewrittenTag;
1826
1929
  }
1827
1930
 
1828
1931
  declare function bump(options?: Partial<BumpOptions>): Promise<BumpResult>;
@@ -1875,5 +1978,5 @@ declare function socialSafetyCheck({ config }: {
1875
1978
  }): Promise<void>;
1876
1979
  declare function social(options?: Partial<SocialOptions>): Promise<SocialResult>;
1877
1980
 
1878
- export { NEW_PACKAGE_MARKER, PR_COMMENT_MARKER, buildChangelogBody, buildCommentBody, buildCompareLink, buildContributors, bump, capReleaseTypeForZeroMajor, changelog, checkGitStatusIfDirty, collectContributorNames, collectPackageBumps, confirmBump, createCommitAndTags, createGitlabRelease, defineConfig, detectGitProvider, detectPackageManager, detectPullRequest, determinePublishTag, determineReleaseType, determineSemverChange, executeBuildCmd, executeFormatCmd, executeHook, expandPackagesToBumpWithDependents, extractChangelogSummary, extractVersionFromPackageTag, extractVersionFromTag, fetchGitTags, filterOutPrivatePackages, findGitHubPR, findGitLabMR, formatChangelogForSlack, formatPackagesForSlack, formatSlackMessage, formatTweetMessage, generateChangelog, generateMarkDown, getAuthCommand, getBumpedIndependentPackages, getBumpedPackageIndependently, getCIName, getCanaryVersion, getCurrentGitBranch, getCurrentGitRef, getDefaultConfig, getDependentsOf, getFirstCommit, getGitStatus, getIndependentTag, getLastPackageTag, getLastRepoTag, getLastStableTag, getLastTag, getModifiedReleaseFilePatterns, getPackageCommits, getPackageDependencies, getPackageNewVersion, getPackages, getPackagesOrBumpedPackages, getPackagesToPublishInIndependentMode, getPackagesToPublishInSelectiveMode, getPreid, getReleaseUrl, getRootPackage, getShortCommitSha, getSlackToken, getSlackWebhookUrl, getTwitterCredentials, github, gitlab, hasLernaJson, isBumpedPackage, isChangedPreid, isGraduating, isGraduatingToStableBetweenVersion, isInCI, isPrerelease, isPrereleaseReleaseType, isStableReleaseType, isTagVersionCompatibleWithCurrent, loadRelizyConfig, mergeTypes, parseChangelogMarkdown, parseGitRemoteUrl, postPrComment, postReleaseToSlack, postReleaseToTwitter, prComment, providerRelease, providerReleaseSafetyCheck, publish, publishPackage, publishSafetyCheck, pushCommitAndTags, readPackageJson, readPackages, release, resolveTags, rollbackModifiedFiles, shouldFilterPrereleaseTags, social, socialSafetyCheck, topologicalSort, updateLernaVersion, writeChangelogToFile, writeVersion };
1879
- export type { AIConfig, AIPromptTarget, AIProviderName, AISocialConfig, AISystemPromptOverrides, AITargetConfig, BumpConfig, BumpOptions, BumpResult, BumpResultFalsy, BumpResultTruthy, ChangelogConfig, ChangelogOptions, ClaudeCodeProviderOptions, ConfigType, GitProvider, GitlabRelease, GitlabReleaseResponse, HookConfig, HookStep, HookType, MonorepoConfig, PackageBase, PackageBumpEntry, PackageManager, PostedRelease, PrCommentConfig, PrCommentMode, PrCommentOptions, PrCommentStatus, ProviderReleaseOptions, ProviderReleaseResult, PublishConfig, PublishOptions, PublishResponse, PullRequestInfo, ReadPackage, Reference, ReleaseConfig, ReleaseContext, ReleaseOptions, RelizyConfig, RepoConfig, ResolvedConfig, ResolvedRelizyConfig, ResolvedTags, ResolvedTwitterCredentials, RootPackage, SlackCredentials, SlackOptions, SlackPackageEntry, SlackSocialConfig, SocialConfig, SocialNetworkResult, SocialOptions, SocialResult, Step, TemplatesConfig, TokensConfig, TwitterCredentials, TwitterOptions, TwitterSocialConfig, VersionMode };
1981
+ export { NEW_PACKAGE_MARKER, PR_COMMENT_MARKER, buildChangelogBody, buildCommentBody, buildCompareLink, buildContributors, bump, capReleaseTypeForZeroMajor, changelog, checkGitStatusIfDirty, collectContributorNames, collectPackageBumps, confirmBump, createCommitAndTags, createGitlabRelease, defineConfig, detectGitProvider, detectPackageManager, detectPullRequest, determinePublishTag, determineReleaseType, determineSemverChange, executeBuildCmd, executeFormatCmd, executeHook, expandPackagesToBumpWithDependents, extractChangelogSummary, extractVersionFromPackageTag, extractVersionFromTag, fetchGitTags, filterOutPrivatePackages, findGitHubPR, findGitLabMR, findReachableCommitBySubject, formatChangelogForSlack, formatPackagesForSlack, formatSlackMessage, formatTweetMessage, generateChangelog, generateMarkDown, getAuthCommand, getBumpedIndependentPackages, getBumpedPackageIndependently, getCIName, getCanaryVersion, getCommitSubject, getCurrentGitBranch, getCurrentGitRef, getDefaultConfig, getDependentsOf, getFirstCommit, getGitStatus, getIndependentTag, getLastPackageTag, getLastRepoTag, getLastStableTag, getLastTag, getModifiedReleaseFilePatterns, getPackageCommits, getPackageDependencies, getPackageNewVersion, getPackages, getPackagesOrBumpedPackages, getPackagesToPublishInIndependentMode, getPackagesToPublishInSelectiveMode, getPreid, getReleaseUrl, getRootPackage, getShortCommitSha, getSlackToken, getSlackWebhookUrl, getTwitterCredentials, github, gitlab, hasLernaJson, isAncestor, isBumpedPackage, isChangedPreid, isGraduating, isGraduatingToStableBetweenVersion, isInCI, isPrerelease, isPrereleaseReleaseType, isStableReleaseType, isTagVersionCompatibleWithCurrent, loadRelizyConfig, mergeTypes, parseChangelogMarkdown, parseGitRemoteUrl, postPrComment, postReleaseToSlack, postReleaseToTwitter, prComment, providerRelease, providerReleaseSafetyCheck, publish, publishPackage, publishSafetyCheck, pushCommitAndTags, pushTagForce, readPackageJson, readPackages, reconcileFromTag, release, resetRewrittenTagCache, resolveTags, retagAnnotatedLocal, rollbackModifiedFiles, shouldFilterPrereleaseTags, social, socialSafetyCheck, tagExists, topologicalSort, updateLernaVersion, writeChangelogToFile, writeVersion };
1982
+ export type { AIConfig, AIPromptTarget, AIProviderName, AISocialConfig, AISystemPromptOverrides, AITargetConfig, BumpConfig, BumpOptions, BumpResult, BumpResultFalsy, BumpResultTruthy, ChangelogConfig, ChangelogInclude, ChangelogOptions, ClaudeCodeProviderOptions, ConfigType, GitProvider, GitlabRelease, GitlabReleaseResponse, HookConfig, HookStep, HookType, MonorepoConfig, OnRewrittenTag, PackageBase, PackageBumpEntry, PackageManager, PostedRelease, PrCommentConfig, PrCommentMode, PrCommentOptions, PrCommentStatus, ProviderReleaseOptions, ProviderReleaseResult, PublishConfig, PublishOptions, PublishResponse, PullRequestInfo, ReadPackage, Reference, ReleaseConfig, ReleaseContext, ReleaseOptions, RelizyConfig, RepoConfig, ResolvedConfig, ResolvedRelizyConfig, ResolvedTags, ResolvedTwitterCredentials, RootPackage, SlackCredentials, SlackOptions, SlackPackageEntry, SlackSocialConfig, SocialConfig, SocialNetworkResult, SocialOptions, SocialResult, Step, TemplatesConfig, TokensConfig, TwitterCredentials, TwitterOptions, TwitterSocialConfig, VersionMode };
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { ak as NEW_PACKAGE_MARKER, $ as PR_COMMENT_MARKER, M as buildChangelogBody, a as buildCommentBody, L as buildCompareLink, O as buildContributors, b as bump, ay as capReleaseTypeForZeroMajor, c as changelog, v as checkGitStatusIfDirty, N as collectContributorNames, X as collectPackageBumps, aM as confirmBump, B as createCommitAndTags, J as createGitlabRelease, k as defineConfig, y as detectGitProvider, R as detectPackageManager, _ as detectPullRequest, S as determinePublishTag, aA as determineReleaseType, az as determineSemverChange, at as executeBuildCmd, as as executeFormatCmd, ap as executeHook, q as expandPackagesToBumpWithDependents, ad as extractChangelogSummary, aE as extractVersionFromPackageTag, aP as extractVersionFromTag, x as fetchGitTags, av as filterOutPrivatePackages, Y as findGitHubPR, Z as findGitLabMR, a9 as formatChangelogForSlack, aa as formatPackagesForSlack, ab as formatSlackMessage, an as formatTweetMessage, i as generateChangelog, P as generateMarkDown, V as getAuthCommand, aN as getBumpedIndependentPackages, aL as getBumpedPackageIndependently, ar as getCIName, aQ as getCanaryVersion, F as getCurrentGitBranch, G as getCurrentGitRef, j as getDefaultConfig, o as getDependentsOf, E as getFirstCommit, u as getGitStatus, af as getIndependentTag, aj as getLastPackageTag, ai as getLastRepoTag, ag as getLastStableTag, ah as getLastTag, A as getModifiedReleaseFilePatterns, a5 as getPackageCommits, n as getPackageDependencies, aC as getPackageNewVersion, a4 as getPackages, aw as getPackagesOrBumpedPackages, U as getPackagesToPublishInIndependentMode, T as getPackagesToPublishInSelectiveMode, aJ as getPreid, ae as getReleaseUrl, a2 as getRootPackage, H as getShortCommitSha, a7 as getSlackToken, a8 as getSlackWebhookUrl, am as getTwitterCredentials, I as github, K as gitlab, a6 as hasLernaJson, au as isBumpedPackage, aK as isChangedPreid, aI as isGraduating, ax as isGraduatingToStableBetweenVersion, aq as isInCI, aF as isPrerelease, aH as isPrereleaseReleaseType, aG as isStableReleaseType, aR as isTagVersionCompatibleWithCurrent, l as loadRelizyConfig, m as mergeTypes, Q as parseChangelogMarkdown, z as parseGitRemoteUrl, a0 as postPrComment, ac as postReleaseToSlack, ao as postReleaseToTwitter, p as prComment, e as providerRelease, d as providerReleaseSafetyCheck, g as publish, W as publishPackage, f as publishSafetyCheck, C as pushCommitAndTags, a1 as readPackageJson, a3 as readPackages, r as release, al as resolveTags, D as rollbackModifiedFiles, aO as shouldFilterPrereleaseTags, h as social, s as socialSafetyCheck, t as topologicalSort, aD as updateLernaVersion, w as writeChangelogToFile, aB as writeVersion } from './shared/relizy.-Cr2hO3N.mjs';
1
+ export { as as NEW_PACKAGE_MARKER, a5 as PR_COMMENT_MARKER, S as buildChangelogBody, a as buildCommentBody, R as buildCompareLink, U as buildContributors, b as bump, aG as capReleaseTypeForZeroMajor, c as changelog, v as checkGitStatusIfDirty, T as collectContributorNames, a1 as collectPackageBumps, aU as confirmBump, B as createCommitAndTags, P as createGitlabRelease, k as defineConfig, y as detectGitProvider, X as detectPackageManager, a4 as detectPullRequest, Y as determinePublishTag, aI as determineReleaseType, aH as determineSemverChange, aB as executeBuildCmd, aA as executeFormatCmd, ax as executeHook, q as expandPackagesToBumpWithDependents, al as extractChangelogSummary, aM as extractVersionFromPackageTag, aX as extractVersionFromTag, x as fetchGitTags, aD as filterOutPrivatePackages, a2 as findGitHubPR, a3 as findGitLabMR, K as findReachableCommitBySubject, ah as formatChangelogForSlack, ai as formatPackagesForSlack, aj as formatSlackMessage, av as formatTweetMessage, i as generateChangelog, V as generateMarkDown, $ as getAuthCommand, aV as getBumpedIndependentPackages, aT as getBumpedPackageIndependently, az as getCIName, aY as getCanaryVersion, J as getCommitSubject, F as getCurrentGitBranch, G as getCurrentGitRef, j as getDefaultConfig, o as getDependentsOf, E as getFirstCommit, u as getGitStatus, an as getIndependentTag, ar as getLastPackageTag, aq as getLastRepoTag, ao as getLastStableTag, ap as getLastTag, A as getModifiedReleaseFilePatterns, ab as getPackageCommits, n as getPackageDependencies, aK as getPackageNewVersion, aa as getPackages, aE as getPackagesOrBumpedPackages, _ as getPackagesToPublishInIndependentMode, Z as getPackagesToPublishInSelectiveMode, aR as getPreid, am as getReleaseUrl, a8 as getRootPackage, H as getShortCommitSha, af as getSlackToken, ag as getSlackWebhookUrl, au as getTwitterCredentials, O as github, Q as gitlab, ac as hasLernaJson, I as isAncestor, aC as isBumpedPackage, aS as isChangedPreid, aQ as isGraduating, aF as isGraduatingToStableBetweenVersion, ay as isInCI, aN as isPrerelease, aP as isPrereleaseReleaseType, aO as isStableReleaseType, aZ as isTagVersionCompatibleWithCurrent, l as loadRelizyConfig, m as mergeTypes, W as parseChangelogMarkdown, z as parseGitRemoteUrl, a6 as postPrComment, ak as postReleaseToSlack, aw as postReleaseToTwitter, p as prComment, e as providerRelease, d as providerReleaseSafetyCheck, g as publish, a0 as publishPackage, f as publishSafetyCheck, C as pushCommitAndTags, N as pushTagForce, a7 as readPackageJson, a9 as readPackages, ae as reconcileFromTag, r as release, ad as resetRewrittenTagCache, at as resolveTags, M as retagAnnotatedLocal, D as rollbackModifiedFiles, aW as shouldFilterPrereleaseTags, h as social, s as socialSafetyCheck, L as tagExists, t as topologicalSort, aL as updateLernaVersion, w as writeChangelogToFile, aJ as writeVersion } from './shared/relizy.d-S4lcvu.mjs';
2
2
  import '@maz-ui/node';
3
3
  import 'node:child_process';
4
4
  import 'node:process';