relizy 1.9.0 → 1.10.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.
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { LogLevel } from '@maz-ui/node';
2
2
  import { LanguageModel, CallSettings } from 'ai';
3
- import { RawGitCommit, GitCommit, ChangelogConfig as ChangelogConfig$1, SemverBumpType } from 'changelogen';
3
+ import { GitCommit, RawGitCommit, ChangelogConfig as ChangelogConfig$1, SemverBumpType, Reference as Reference$1 } from 'changelogen';
4
4
  import { ReleaseType } from 'semver';
5
5
  import { DeepPartial } from '@maz-ui/utils/ts-helpers/DeepPartial';
6
6
  import * as _slack_web_api from '@slack/web-api';
@@ -53,6 +53,7 @@ declare function getDefaultConfig(): {
53
53
  };
54
54
  scopeMap: {};
55
55
  release: Required<ReleaseConfig>;
56
+ commitlint: Required<Omit<CommitlintConfig, "helpUrl">> & Pick<CommitlintConfig, "helpUrl">;
56
57
  social: {
57
58
  twitter: {
58
59
  enabled: false;
@@ -137,6 +138,319 @@ declare function writeChangelogToFile({ cwd, pkg, changelog, dryRun, }: {
137
138
  dryRun: boolean;
138
139
  }): void;
139
140
 
141
+ /**
142
+ * Title of the changelog section of a commit type, `undefined` when the commits
143
+ * of this type never appear in the changelog.
144
+ */
145
+ declare function getChangelogTitle(type: string, config: ResolvedRelizyConfig): string | undefined;
146
+ /**
147
+ * The commit as written in the CHANGELOG.md files by relizy: a section with the
148
+ * commit and its body. `undefined` when the commit does not appear in the changelog.
149
+ */
150
+ declare function renderChangelogEntry(commit: GitCommit, config: ResolvedRelizyConfig): string | undefined;
151
+ /**
152
+ * Checks a changelog entry the way the release would: returns the problems that
153
+ * would make the formatting of the CHANGELOG.md files fail.
154
+ */
155
+ interface ChangelogLinter {
156
+ name: 'eslint' | 'oxc';
157
+ lint: (markdown: string) => Promise<string[]>;
158
+ }
159
+ /**
160
+ * The linter of the changelog entries of a project: its ESLint when it lints the
161
+ * CHANGELOG.md files, otherwise a syntax check of the code blocks. Loaded once per cwd.
162
+ */
163
+ declare function getChangelogLinter(cwd: string): Promise<ChangelogLinter>;
164
+
165
+ /** Character git uses for the comment lines of the edited messages */
166
+ declare function getCommentChar(cwd: string): string;
167
+ /**
168
+ * Path of the message of the commit being created: the file given to the
169
+ * `commit-msg` hook, `.git/COMMIT_EDITMSG` by default.
170
+ */
171
+ declare function getCommitMessageFile(file: string | undefined, cwd: string): string;
172
+ /** The message of the commit being created */
173
+ declare function readCommitMessageFile(file: string | undefined, cwd: string): string;
174
+ /** Files staged for the commit being created, relative to the repository root */
175
+ declare function getStagedFiles(cwd: string): string[];
176
+ interface RangeCommit {
177
+ hash: string;
178
+ message: string;
179
+ files: string[];
180
+ }
181
+ /**
182
+ * Commits reachable from `to` and not from `from`, oldest first, with their
183
+ * full message and changed files. Every commit up to `to` without `from`.
184
+ */
185
+ declare function getCommitsInRange({ from, to, cwd }: {
186
+ from?: string;
187
+ to?: string;
188
+ cwd: string;
189
+ }): RangeCommit[];
190
+ /**
191
+ * Throws a helpful error when the start of the range is not in the local
192
+ * history, e.g. in a shallow clone of the CI.
193
+ */
194
+ declare function assertRefAvailable(ref: string, cwd: string): void;
195
+ interface PullRequestTitle {
196
+ title: string;
197
+ /** `pull request` on GitHub, `merge request` on GitLab */
198
+ kind: 'pull request' | 'merge request';
199
+ }
200
+ /**
201
+ * Title of the pull/merge request of the CI run, which becomes the commit
202
+ * message of a squash merge. The draft markers of GitLab are removed.
203
+ */
204
+ declare function getPullRequestTitle(): PullRequestTitle | undefined;
205
+ interface DefaultRangeStart {
206
+ from?: string;
207
+ /** Why this start was chosen, for the logs */
208
+ reason: string;
209
+ }
210
+ /**
211
+ * Start of the commits to lint when `--from` is not given: the merge-base with
212
+ * the target branch of the pull/merge request in GitHub Actions and GitLab CI,
213
+ * otherwise the last tag, otherwise the whole history.
214
+ */
215
+ declare function resolveDefaultRangeStart({ cwd, logLevel }: {
216
+ cwd: string;
217
+ logLevel?: LogLevel;
218
+ }): Promise<DefaultRangeStart>;
219
+ interface InstalledHook {
220
+ path: string;
221
+ status: 'created' | 'replaced' | 'unchanged';
222
+ }
223
+ /**
224
+ * Write the `commit-msg` hook running `relizy commitlint`: in `.husky/` when
225
+ * husky is set up, otherwise in the hooks directory of git. An existing hook is
226
+ * only replaced with `force`.
227
+ */
228
+ declare function installCommitMsgHook({ cwd, force }: {
229
+ cwd: string;
230
+ force?: boolean;
231
+ }): InstalledHook;
232
+
233
+ /**
234
+ * A commit message split into its parts, before any conventional parsing.
235
+ */
236
+ interface CommitMessageParts {
237
+ /** Full message, comments removed, trailing blank lines trimmed */
238
+ raw: string;
239
+ header: string;
240
+ body: string;
241
+ footer: string;
242
+ /** Whether a blank line separates the header from the rest of the message */
243
+ hasLeadingBlank: boolean;
244
+ }
245
+ /**
246
+ * Remove what git strips from a message edited in the editor: the comment lines
247
+ * and everything after the scissors line of `git commit --verbose`.
248
+ */
249
+ declare function stripGitComments(message: string, commentChar?: string): string;
250
+ /**
251
+ * Split a message into header, body and footer. The footer is the last
252
+ * paragraph when it starts with a `Token: value` line: as in Conventional
253
+ * Commits, a footer value can continue on the next lines.
254
+ */
255
+ declare function splitCommitMessage(message: string): CommitMessageParts;
256
+ /**
257
+ * Whether a message must not be linted: merge commits, autosquash commits and
258
+ * the release commits of relizy (`defaultIgnores`), and the `ignores` of the config.
259
+ */
260
+ declare function isIgnoredCommitMessage(message: string, config: ResolvedRelizyConfig): boolean;
261
+
262
+ /**
263
+ * A workspace package as seen by the commit linter.
264
+ */
265
+ interface WorkspacePackage {
266
+ /** Name from the package.json, e.g. `@maz-ui/nuxt` */
267
+ name: string;
268
+ /** Path relative to the repository root, POSIX separators, e.g. `packages/nuxt` */
269
+ path: string;
270
+ /** Scopes designating the package: short name, full name and folder name */
271
+ scopes: string[];
272
+ }
273
+ /**
274
+ * Packages of the monorepo, private ones included: a commit can touch a package
275
+ * that is never published. `commitlint.packages` adds directories that relizy
276
+ * does not release (e.g. apps). `monorepo.ignored` is not applied: an ignored
277
+ * package is released by another config, it is still a valid scope.
278
+ * Empty in standalone mode without them.
279
+ */
280
+ declare function getWorkspacePackages(config: ResolvedRelizyConfig): WorkspacePackage[];
281
+ /**
282
+ * Scopes allowed by the config: the workspace packages, the `scopeMap` keys and
283
+ * `commitlint.scopes`. `undefined` when any scope is allowed (standalone mode
284
+ * without an explicit list).
285
+ */
286
+ declare function getAllowedScopes(config: ResolvedRelizyConfig, packages: WorkspacePackage[]): string[] | undefined;
287
+ /** Names of the packages containing at least one of the files */
288
+ declare function getPackagesOfFiles(files: string[], packages: WorkspacePackage[]): string[];
289
+ /** The package designated by a scope, if any */
290
+ declare function findPackageByScope(scope: string, packages: WorkspacePackage[]): WorkspacePackage | undefined;
291
+
292
+ type RuleSeverity = 'error' | 'warn' | 'off';
293
+ /**
294
+ * What a rule receives to check a commit.
295
+ */
296
+ interface RuleContext {
297
+ config: ResolvedRelizyConfig;
298
+ commit: CommitlintCommit;
299
+ parts: CommitMessageParts;
300
+ /** The commit as parsed by relizy, `undefined` when the header is not a conventional commit */
301
+ gitCommit?: GitCommit;
302
+ packages: WorkspacePackage[];
303
+ /** `undefined` when any scope is allowed */
304
+ allowedScopes?: string[];
305
+ /** Configured value of the rule, or its default value */
306
+ value: unknown;
307
+ }
308
+ /** A problem found by a rule: what is wrong, and how to fix it */
309
+ interface RuleProblem {
310
+ message: string;
311
+ fix?: string;
312
+ }
313
+ interface RuleDefinition {
314
+ severity: RuleSeverity;
315
+ value?: unknown;
316
+ /** Only run on conventional commits */
317
+ conventionalOnly?: boolean;
318
+ check: (context: RuleContext) => RuleProblem[] | Promise<RuleProblem[]>;
319
+ }
320
+ /** `type(scope)!: subject`, lowercase type, a space after the colon */
321
+ declare const STRICT_HEADER_PATTERN: RegExp;
322
+ /**
323
+ * The built-in rules, with their default severity and value.
324
+ */
325
+ declare const BUILT_IN_RULES: Record<CommitlintRuleName, RuleDefinition>;
326
+ interface NormalizedRuleConfig {
327
+ severity: RuleSeverity;
328
+ /** `undefined` when the config sets no value */
329
+ value?: unknown;
330
+ }
331
+ /**
332
+ * `'error'`, `['error', value]` or a commitlint tuple `[2, 'always', value]`.
333
+ */
334
+ declare function normalizeRuleConfig(name: string, config: CommitlintRuleConfig | undefined): NormalizedRuleConfig | undefined;
335
+
336
+ /** Documentation of the built-in rules */
337
+ declare const COMMITLINT_RULES_URL = "https://relizy.dev/commitlint/rules";
338
+ interface CommitlintProblem {
339
+ rule: string;
340
+ severity: Exclude<RuleSeverity, 'off'>;
341
+ /** What is wrong */
342
+ message: string;
343
+ /** How to fix it */
344
+ fix?: string;
345
+ /** Documentation of the rule (built-in rules only) */
346
+ url?: string;
347
+ }
348
+ interface CommitlintSuggestion {
349
+ /** The header with the safe fixes applied */
350
+ header: string;
351
+ /** Rules still failing with the suggested header */
352
+ remainingRules: string[];
353
+ }
354
+ interface CommitlintResult {
355
+ commit: CommitlintCommit;
356
+ /** Ignored commits (merge, fixup, release...) are not linted */
357
+ ignored: boolean;
358
+ /** No error (warnings allowed) */
359
+ valid: boolean;
360
+ problems: CommitlintProblem[];
361
+ /** Title of the changelog section of the commit, `undefined` when it does not appear in the changelog */
362
+ changelogTitle?: string;
363
+ /** The commit as parsed by relizy, `undefined` when the header is not a conventional commit */
364
+ gitCommit?: GitCommit;
365
+ /** A fixed header, when some errors of the header can be fixed safely */
366
+ suggestion?: CommitlintSuggestion;
367
+ }
368
+ interface LintCommitMessageOptions {
369
+ config: ResolvedRelizyConfig;
370
+ /** Changed files of the commit, relative to the repository root */
371
+ files?: string[];
372
+ hash?: string;
373
+ /** Workspace packages, read from the config when not given */
374
+ packages?: WorkspacePackage[];
375
+ /**
376
+ * Suggest a fixed header
377
+ * @default true
378
+ */
379
+ suggest?: boolean;
380
+ }
381
+ /**
382
+ * Lint a commit message with the relizy config: the same parser and types as the
383
+ * release, the workspace packages for the scopes, the changelog rendering for the body.
384
+ */
385
+ declare function lintCommitMessage(message: string, options: LintCommitMessageOptions): Promise<CommitlintResult>;
386
+
387
+ interface ReportEntry {
388
+ result: CommitlintResult;
389
+ /** Printed before the header: the short hash, or "MR title" / "PR title" */
390
+ label?: string;
391
+ /** Changelog entry of the commit, printed with `--preview` */
392
+ preview?: string;
393
+ }
394
+ interface CommitlintReport {
395
+ /** `edit`: the commit being created, `message`: a given message, `range`: commits of the history */
396
+ mode: 'edit' | 'message' | 'range';
397
+ entries: ReportEntry[];
398
+ /** Start of the linted range */
399
+ from?: string;
400
+ /** Kind of the linted pull/merge request title */
401
+ titleKind?: PullRequestTitle['kind'];
402
+ /** File of the message being created, in `edit` mode */
403
+ messageFile?: string;
404
+ helpUrl?: string;
405
+ }
406
+ interface CommitlintSummary {
407
+ errorCount: number;
408
+ warningCount: number;
409
+ }
410
+ declare function summarizeResults(results: CommitlintResult[]): CommitlintSummary;
411
+ /**
412
+ * Colors in a terminal and in the CI logs, which render them. Never for a
413
+ * program reading the output (e.g. an AI agent), nor with `NO_COLOR`.
414
+ */
415
+ declare function shouldUseColors(stream?: {
416
+ isTTY?: boolean;
417
+ }): boolean;
418
+ /** `minor bump, 🚀 Enhancements` */
419
+ declare function formatReleaseEffect(result: CommitlintResult): string;
420
+ /**
421
+ * Lines printed for a linted commit: one line when it is valid without
422
+ * warning, otherwise its header, each problem with how to fix it, and the
423
+ * suggested header.
424
+ */
425
+ declare function formatCommitResult(result: CommitlintResult, { label, colors }?: {
426
+ label?: string;
427
+ colors?: boolean;
428
+ }): string[];
429
+ /**
430
+ * How to fix the invalid commits and title, depending on where they were
431
+ * linted. The commands to run start with `$ `, so they are never wrapped.
432
+ */
433
+ declare function formatHowToFix(report: CommitlintReport): string[];
434
+ /**
435
+ * The text report: each commit, then a summary with the verdict, the
436
+ * documentation of the failing rules, the help URL and how to fix.
437
+ */
438
+ declare function formatTextReport(report: CommitlintReport, { colors, quiet }?: {
439
+ colors?: boolean;
440
+ /** Only print the commits with problems, and the summary */
441
+ quiet?: boolean;
442
+ }): string[];
443
+ /**
444
+ * The JSON report, stable for programs and AI agents: every commit with its
445
+ * effect on the release, its problems and how to fix them.
446
+ */
447
+ declare function formatJsonReport(report: CommitlintReport): string;
448
+ /**
449
+ * GitHub Actions annotations of the problems, displayed on the job summary
450
+ * and the pull request.
451
+ */
452
+ declare function formatGithubAnnotations(report: CommitlintReport): string[];
453
+
140
454
  /**
141
455
  * Get workspace dependencies of a package (only dependencies and peerDependencies, not devDependencies)
142
456
  */
@@ -661,6 +975,11 @@ declare function getPackages({ config, suffix, force, includeAll, dryRun, }: {
661
975
  includeAll?: boolean;
662
976
  dryRun?: boolean;
663
977
  }): Promise<PackageBase[]>;
978
+ declare function isAllowedCommit({ commit, type, changelog, }: {
979
+ commit: GitCommit;
980
+ type?: ConfigType;
981
+ changelog: boolean;
982
+ }): boolean;
664
983
  declare function getPackageCommits({ pkg, from, to, config, changelog, dryRun, }: {
665
984
  pkg: ReadPackage;
666
985
  from: string;
@@ -2355,6 +2674,202 @@ type HookConfig = {
2355
2674
  changelog: string;
2356
2675
  }) => string | void | null | undefined | Promise<string | void | null | undefined>;
2357
2676
  };
2677
+ /**
2678
+ * Severity of a commitlint rule: `error` (or `2`) fails the check, `warn` (or `1`)
2679
+ * reports without failing, `off` (or `0`) disables the rule.
2680
+ */
2681
+ type CommitlintRuleLevel = 'error' | 'warn' | 'off' | 0 | 1 | 2;
2682
+ /**
2683
+ * Configuration of a commitlint rule: a level, a level and a value (ESLint style),
2684
+ * or a commitlint tuple `[level, 'always', value]` to ease migrations.
2685
+ * A rule without value accepts the commitlint tuple `[level, 'always']`.
2686
+ */
2687
+ type CommitlintRuleConfig<Value = unknown> = CommitlintRuleLevel | readonly [CommitlintRuleLevel] | readonly [CommitlintRuleLevel, [Value] extends [never] ? 'always' | 'never' : Value] | readonly [CommitlintRuleLevel, 'always' | 'never', Value];
2688
+ /**
2689
+ * The built-in rules of `relizy commitlint`, with the type of their value
2690
+ * (`never` when the rule has no value).
2691
+ * @see https://relizy.dev/commitlint/rules
2692
+ */
2693
+ interface CommitlintBuiltInRules {
2694
+ /**
2695
+ * The header follows `type(scope)!: subject`.
2696
+ * @default 'error'
2697
+ */
2698
+ 'header-format': never;
2699
+ /**
2700
+ * Maximum length of the header.
2701
+ * @default ['error', 500]
2702
+ */
2703
+ 'header-max-length': number;
2704
+ /**
2705
+ * The type is one of the relizy `types`, or one of the extra types given as value.
2706
+ * @default 'error'
2707
+ */
2708
+ 'type-enum': string[];
2709
+ /**
2710
+ * The scope is a workspace package, a `scopeMap` key or one of `commitlint.scopes`.
2711
+ * @default 'error'
2712
+ */
2713
+ 'scope-enum': never;
2714
+ /**
2715
+ * The scope is required (`'always'`), forbidden (`'never'`), or required on
2716
+ * the commits bumping a version (`'when-bumping'`).
2717
+ * @default ['off', 'always']
2718
+ */
2719
+ 'scope-required': 'always' | 'never' | 'when-bumping';
2720
+ /**
2721
+ * The scope designates a package touched by the commit.
2722
+ * @default 'warn'
2723
+ */
2724
+ 'scope-matches-files': never;
2725
+ /**
2726
+ * The subject starts with a lowercase letter.
2727
+ * @default 'error'
2728
+ */
2729
+ 'subject-case': never;
2730
+ /**
2731
+ * The subject does not end with a period.
2732
+ * @default 'error'
2733
+ */
2734
+ 'subject-full-stop': never;
2735
+ /**
2736
+ * The subject describes the change, with a minimum of words or characters.
2737
+ * @default ['error', { minWords: 2, minLength: 15 }]
2738
+ */
2739
+ 'subject-meaningful': {
2740
+ minWords?: number;
2741
+ minLength?: number;
2742
+ };
2743
+ /**
2744
+ * A blank line separates the header from the body.
2745
+ * @default 'error'
2746
+ */
2747
+ 'body-leading-blank': never;
2748
+ /**
2749
+ * The body has no markdown headings, which would break the changelog.
2750
+ * @default 'error'
2751
+ */
2752
+ 'body-no-headings': never;
2753
+ /**
2754
+ * The markdown of the body is valid: code blocks closed, links with a URL.
2755
+ * @default 'error'
2756
+ */
2757
+ 'body-markdown': never;
2758
+ /**
2759
+ * The commit, rendered as in the changelogs, passes the lint of the changelogs.
2760
+ * @default 'error'
2761
+ */
2762
+ 'body-changelog-lint': never;
2763
+ /**
2764
+ * A breaking change is only declared with `!` in the header or a `BREAKING CHANGE:`
2765
+ * footer, as relizy bumps the major version wherever `breaking change:` appears.
2766
+ * @default 'error'
2767
+ */
2768
+ 'body-breaking-change': never;
2769
+ /**
2770
+ * Breaking changes are not allowed.
2771
+ * @default 'off'
2772
+ */
2773
+ 'no-breaking': never;
2774
+ }
2775
+ type CommitlintRuleName = keyof CommitlintBuiltInRules;
2776
+ /**
2777
+ * Configuration of the built-in rules, typed per rule, and of the custom rules.
2778
+ */
2779
+ type CommitlintRulesConfig = {
2780
+ [Name in keyof CommitlintBuiltInRules]?: CommitlintRuleConfig<CommitlintBuiltInRules[Name]>;
2781
+ } & Record<string, CommitlintRuleConfig>;
2782
+ /**
2783
+ * A commit message parsed by `relizy commitlint`, with the commitlint field names,
2784
+ * enriched with what relizy knows about the commit.
2785
+ */
2786
+ interface CommitlintCommit {
2787
+ /** Full message, comments removed */
2788
+ raw: string;
2789
+ /** First line of the message */
2790
+ header: string;
2791
+ /** Text between the header and the footer */
2792
+ body: string;
2793
+ /** Trailing block of `Token: value` lines (`BREAKING CHANGE:`, `Closes #12`...) */
2794
+ footer: string;
2795
+ /** Type, empty when the header is not a conventional commit */
2796
+ type: string;
2797
+ /** Scope, as written in the header */
2798
+ scope: string;
2799
+ /** Description of the header, as written */
2800
+ subject: string;
2801
+ /** Breaking change as detected by relizy (`!` or `breaking change:` in the body) */
2802
+ isBreaking: boolean;
2803
+ /** Version bump the commit triggers, computed by relizy from `types` */
2804
+ bump?: SemverBumpType;
2805
+ /** Pull request, issue and hash references found by relizy */
2806
+ references: Reference$1[];
2807
+ /** Changed files (staged files, or the files of the commit in a range), when known */
2808
+ files?: string[];
2809
+ /** Names of the workspace packages touched by `files` */
2810
+ packages?: string[];
2811
+ /** Hash of the commit, when linting a range */
2812
+ hash?: string;
2813
+ }
2814
+ interface CommitlintCustomRuleContext {
2815
+ /** Value configured for the rule (`['error', value]`) */
2816
+ value: unknown;
2817
+ /** Resolved relizy config */
2818
+ config: ResolvedRelizyConfig;
2819
+ }
2820
+ /**
2821
+ * A rule written as a function. Returns `true` when the commit is valid, an
2822
+ * error message (or `false`) otherwise, or a commitlint-style `[valid, message?]`
2823
+ * tuple so `commitlint-plugin-function-rules` rules can be copied as is.
2824
+ */
2825
+ type CommitlintCustomRule = (commit: CommitlintCommit, context: CommitlintCustomRuleContext) => CommitlintCustomRuleOutcome | Promise<CommitlintCustomRuleOutcome>;
2826
+ type CommitlintCustomRuleOutcome = boolean | string | [boolean, string?];
2827
+ interface CommitlintConfig {
2828
+ /**
2829
+ * Glob patterns of directories to treat as workspace packages for the scopes,
2830
+ * in addition to `monorepo.packages`, e.g. apps that are never released.
2831
+ * @example ['apps/*']
2832
+ */
2833
+ packages?: string[];
2834
+ /**
2835
+ * Scopes allowed in addition to the workspace packages (short name, full name
2836
+ * or folder) and the `scopeMap` keys. In standalone mode, scopes are free
2837
+ * unless this list is set.
2838
+ * @example ['ci', 'deps', 'release']
2839
+ */
2840
+ scopes?: string[];
2841
+ /**
2842
+ * Level and value of the built-in and custom rules.
2843
+ * @example { 'header-max-length': ['error', 200], 'scope-required': ['error', 'when-bumping'] }
2844
+ */
2845
+ rules?: CommitlintRulesConfig;
2846
+ /**
2847
+ * Rules written as functions, keyed by name. Their level is set in `rules`
2848
+ * and defaults to `error`.
2849
+ */
2850
+ customRules?: Record<string, CommitlintCustomRule>;
2851
+ /**
2852
+ * Messages to ignore, in addition to the default ones: a regular expression
2853
+ * tested against the header, or a function receiving the raw message.
2854
+ */
2855
+ ignores?: Array<RegExp | ((message: string) => boolean)>;
2856
+ /**
2857
+ * Ignore merge commits, `fixup!`, `squash!` and `amend!` commits, and the
2858
+ * release commits of relizy.
2859
+ * @default true
2860
+ */
2861
+ defaultIgnores?: boolean;
2862
+ /**
2863
+ * In the CI of a pull/merge request, also lint its title, which becomes the
2864
+ * commit message of a squash merge. Overridden by `--title` and `--no-title`.
2865
+ * @default false
2866
+ */
2867
+ title?: boolean;
2868
+ /**
2869
+ * URL printed with the errors, e.g. the commit guidelines of the team.
2870
+ */
2871
+ helpUrl?: string;
2872
+ }
2358
2873
  /**
2359
2874
  * Relizy configuration
2360
2875
  * @see https://relizy.dev/config/overview
@@ -2431,6 +2946,11 @@ interface RelizyConfig extends Partial<Omit<ChangelogConfig$1, 'output' | 'templ
2431
2946
  * Hooks config
2432
2947
  */
2433
2948
  hooks?: HookConfig;
2949
+ /**
2950
+ * Commit message linter (`relizy commitlint`) config
2951
+ * @see https://relizy.dev/commitlint/
2952
+ */
2953
+ commitlint?: CommitlintConfig;
2434
2954
  /**
2435
2955
  * Set log level
2436
2956
  * @default 'default'
@@ -2465,6 +2985,62 @@ declare function bump(options?: Partial<BumpOptions>): Promise<BumpResult>;
2465
2985
 
2466
2986
  declare function changelog(options?: Partial<ChangelogOptions>): Promise<void>;
2467
2987
 
2988
+ interface CommitlintOptions {
2989
+ /**
2990
+ * Lint the message of the commit being created: the file given to the
2991
+ * `commit-msg` hook, or `.git/COMMIT_EDITMSG` when `true`.
2992
+ */
2993
+ edit?: string | boolean;
2994
+ /** Lint this message */
2995
+ message?: string;
2996
+ /**
2997
+ * Lint the commits after this ref. Defaults to the merge-base with the target
2998
+ * branch of the pull/merge request in CI, otherwise the last tag.
2999
+ */
3000
+ from?: string;
3001
+ /**
3002
+ * Last commit of the range
3003
+ * @default 'HEAD'
3004
+ */
3005
+ to?: string;
3006
+ /**
3007
+ * In the CI of a pull/merge request, also lint its title, which becomes the
3008
+ * commit message of a squash merge
3009
+ * @default config.commitlint.title
3010
+ */
3011
+ title?: boolean;
3012
+ /** Print the changelog entry of each commit */
3013
+ preview?: boolean;
3014
+ /**
3015
+ * `text` for people (colors in a terminal or a CI), `json` for programs and AI agents
3016
+ * @default 'text'
3017
+ */
3018
+ format?: 'text' | 'json';
3019
+ /** In the text format, only print the commits with problems, and the summary */
3020
+ quiet?: boolean;
3021
+ /** Write the `commit-msg` hook instead of linting */
3022
+ install?: boolean;
3023
+ /** Replace an existing `commit-msg` hook with `install` */
3024
+ force?: boolean;
3025
+ /** Custom config file name (e.g. `relizy.standalone` for `relizy.standalone.config.ts`) */
3026
+ configName?: string;
3027
+ logLevel?: LogLevel;
3028
+ /** Pre-loaded config */
3029
+ config?: ResolvedRelizyConfig;
3030
+ }
3031
+ interface CommitlintRunResult extends CommitlintSummary {
3032
+ results: CommitlintResult[];
3033
+ /** The linted commits and how to fix them, unset with `install` */
3034
+ report?: CommitlintReport;
3035
+ /** Set when the hook was installed */
3036
+ hook?: InstalledHook;
3037
+ }
3038
+ /**
3039
+ * Lint commit messages with the relizy config: the commit being created
3040
+ * (`edit`), a message, or a range of commits. Errors make `errorCount` positive.
3041
+ */
3042
+ declare function commitlint(options?: CommitlintOptions): Promise<CommitlintRunResult>;
3043
+
2468
3044
  interface PrCommentOptions {
2469
3045
  prNumber?: number;
2470
3046
  dryRun?: boolean;
@@ -2542,5 +3118,5 @@ declare function socialSafetyCheck({ config }: {
2542
3118
  }): Promise<void>;
2543
3119
  declare function social(options?: Partial<SocialOptions>): Promise<SocialResult>;
2544
3120
 
2545
- export { NEW_PACKAGE_MARKER, PR_COMMENT_MARKER, SLACK_HEADER_MAX_LENGTH, SLACK_MAX_BLOCKS, SLACK_RICH_TEXT_BLOCK_MAX_LENGTH, SLACK_RICH_TEXT_MESSAGE_MAX_LENGTH, SLACK_SECTION_MAX_LENGTH, SLACK_SUMMARY_MAX_LENGTH, assertBranchUpToDateWithRemote, assertReleaseTagsAvailable, buildChangelogBody, buildCommentBody, buildCompareLink, buildContributors, buildReleaseSummary, bump, capReleaseTypeForZeroMajor, changelog, checkGitStatusIfDirty, collectContributorNames, collectPackageBumps, confirmBump, createCommitAndTags, createGitlabRelease, defineConfig, detectGitProvider, detectPackageManager, detectPullRequest, determinePublishTag, determineReleaseType, determineSemverChange, executeBuildCmd, executeFormatCmd, executeHook, expandPackagesToBumpWithDependents, extractChangelogSummary, extractVersionFromPackageTag, extractVersionFromRepoTag, extractVersionFromTag, fetchGitTags, filterOutPrivatePackages, filterPrivatePackagesUnlessIncluded, findGitHubPR, findGitLabMR, findReachableCommitBySubject, formatChangelogForSlack, formatPackagesForSlack, formatSlackMessage, formatTweetMessage, generateChangelog, generateMarkDown, getAuthCommand, getBumpedIndependentPackages, getBumpedPackageIndependently, getCIName, getCanaryVersion, getCommitChangedFiles, getCommitSubject, getCurrentGitBranch, getCurrentGitRef, getDefaultConfig, getDependentsOf, getFirstCommit, getGitDiff, getGitStatus, getGitUpstream, getIndependentTag, getLastPackageTag, getLastRepoTag, getLastStableTag, getLastTag, getModifiedReleaseFilePatterns, getNewPackageCompareBase, getNpmRegistry, getPackageCommits, getPackageDependencies, getPackageNewVersion, getPackages, getPackagesOrBumpedPackages, getPackagesToPublishInIndependentMode, getPackagesToPublishInSelectiveMode, getPreid, getReleaseTagNames, getReleaseUrl, getRootPackage, getShortCommitSha, getSlackToken, getSlackWebhookUrl, getTwitterCredentials, github, gitlab, globDirsAbsolute, hasLernaJson, isAncestor, isBumpedPackage, isChangedPreid, isCommitOnlyInIgnoredPackages, isGraduating, isGraduatingToStableBetweenVersion, isInCI, isPrerelease, isPrereleaseReleaseType, isStableReleaseType, isTagVersionCompatibleWithCurrent, isVersionAlreadyPublishedError, isVersionPublished, listTags, loadRelizyConfig, markdownToSlackMrkdwn, markdownToSlackRichText, mergeTypes, parseChangelogMarkdown, parseGitRemoteUrl, postPrComment, postReleaseToSlack, postReleaseToTwitter, prComment, providerRelease, providerReleaseSafetyCheck, publish, publishPackage, publishSafetyCheck, pushCommitAndTags, pushTagForce, readPackageJson, readPackages, reconcileFromTag, redactSecrets, release, resetRewrittenTagCache, resolveAllConfiguredRegistryTargets, resolveIgnoredPackagePaths, resolveRegistryTargetsForPackage, resolveRegistryTargetsForPackages, resolveSlackPostMaxLength, resolveTags, retagAnnotatedLocal, richTextToPlainText, rollbackModifiedFiles, shouldFilterPrereleaseTags, sliceSlackText, social, socialSafetyCheck, tagExists, topologicalSort, tryPostPrComment, updateLernaVersion, withRegistryNpmrc, writeChangelogToFile, writeVersion };
2546
- export type { AIConfig, AIExtraGuidelines, AIPromptTarget, AIProviderName, AISocialConfig, AISystemPromptOverrides, AITargetConfig, AiSdkProviderOptions, BumpConfig, BumpOptions, BumpResult, BumpResultFalsy, BumpResultTruthy, ChangelogConfig, ChangelogInclude, ChangelogOptions, ClaudeCodeProviderOptions, ConfigType, GitProvider, GitUpstream, GitlabRelease, GitlabReleaseResponse, HookConfig, HookStep, HookType, MonorepoConfig, OnRewrittenTag, PackageBase, PackageBumpEntry, PackageManager, PostedRelease, PrCommentConfig, PrCommentMode, PrCommentOptions, PrCommentStatus, ProviderReleaseOptions, ProviderReleaseResult, PublishConfig, PublishOptions, PublishResponse, PullRequestInfo, ReadPackage, Reference, RegistryTarget, ReleaseConfig, ReleaseContext, ReleaseOptions, RelizyConfig, RepoConfig, ResolvedConfig, ResolvedRelizyConfig, ResolvedTags, ResolvedTwitterCredentials, RootPackage, SlackChangelogFormat, SlackCredentials, SlackOptions, SlackPackageEntry, SlackRichTextBlock, SlackRichTextElement, SlackRichTextInline, SlackRichTextLink, SlackRichTextList, SlackRichTextPreformatted, SlackRichTextQuote, SlackRichTextSection, SlackRichTextStyle, SlackRichTextText, SlackSocialConfig, SocialConfig, SocialNetworkResult, SocialOptions, SocialResult, Step, TemplatesConfig, TokensConfig, TwitterCredentials, TwitterOptions, TwitterSocialConfig, VersionMode };
3121
+ export { BUILT_IN_RULES, COMMITLINT_RULES_URL, NEW_PACKAGE_MARKER, PR_COMMENT_MARKER, SLACK_HEADER_MAX_LENGTH, SLACK_MAX_BLOCKS, SLACK_RICH_TEXT_BLOCK_MAX_LENGTH, SLACK_RICH_TEXT_MESSAGE_MAX_LENGTH, SLACK_SECTION_MAX_LENGTH, SLACK_SUMMARY_MAX_LENGTH, STRICT_HEADER_PATTERN, assertBranchUpToDateWithRemote, assertRefAvailable, assertReleaseTagsAvailable, buildChangelogBody, buildCommentBody, buildCompareLink, buildContributors, buildReleaseSummary, bump, capReleaseTypeForZeroMajor, changelog, checkGitStatusIfDirty, collectContributorNames, collectPackageBumps, commitlint, confirmBump, createCommitAndTags, createGitlabRelease, defineConfig, detectGitProvider, detectPackageManager, detectPullRequest, determinePublishTag, determineReleaseType, determineSemverChange, executeBuildCmd, executeFormatCmd, executeHook, expandPackagesToBumpWithDependents, extractChangelogSummary, extractVersionFromPackageTag, extractVersionFromRepoTag, extractVersionFromTag, fetchGitTags, filterOutPrivatePackages, filterPrivatePackagesUnlessIncluded, findGitHubPR, findGitLabMR, findPackageByScope, findReachableCommitBySubject, formatChangelogForSlack, formatCommitResult, formatGithubAnnotations, formatHowToFix, formatJsonReport, formatPackagesForSlack, formatReleaseEffect, formatSlackMessage, formatTextReport, formatTweetMessage, generateChangelog, generateMarkDown, getAllowedScopes, getAuthCommand, getBumpedIndependentPackages, getBumpedPackageIndependently, getCIName, getCanaryVersion, getChangelogLinter, getChangelogTitle, getCommentChar, getCommitChangedFiles, getCommitMessageFile, getCommitSubject, getCommitsInRange, getCurrentGitBranch, getCurrentGitRef, getDefaultConfig, getDependentsOf, getFirstCommit, getGitDiff, getGitStatus, getGitUpstream, getIndependentTag, getLastPackageTag, getLastRepoTag, getLastStableTag, getLastTag, getModifiedReleaseFilePatterns, getNewPackageCompareBase, getNpmRegistry, getPackageCommits, getPackageDependencies, getPackageNewVersion, getPackages, getPackagesOfFiles, getPackagesOrBumpedPackages, getPackagesToPublishInIndependentMode, getPackagesToPublishInSelectiveMode, getPreid, getPullRequestTitle, getReleaseTagNames, getReleaseUrl, getRootPackage, getShortCommitSha, getSlackToken, getSlackWebhookUrl, getStagedFiles, getTwitterCredentials, getWorkspacePackages, github, gitlab, globDirsAbsolute, hasLernaJson, installCommitMsgHook, isAllowedCommit, isAncestor, isBumpedPackage, isChangedPreid, isCommitOnlyInIgnoredPackages, isGraduating, isGraduatingToStableBetweenVersion, isIgnoredCommitMessage, isInCI, isPrerelease, isPrereleaseReleaseType, isStableReleaseType, isTagVersionCompatibleWithCurrent, isVersionAlreadyPublishedError, isVersionPublished, lintCommitMessage, listTags, loadRelizyConfig, markdownToSlackMrkdwn, markdownToSlackRichText, mergeTypes, normalizeRuleConfig, parseChangelogMarkdown, parseGitRemoteUrl, postPrComment, postReleaseToSlack, postReleaseToTwitter, prComment, providerRelease, providerReleaseSafetyCheck, publish, publishPackage, publishSafetyCheck, pushCommitAndTags, pushTagForce, readCommitMessageFile, readPackageJson, readPackages, reconcileFromTag, redactSecrets, release, renderChangelogEntry, resetRewrittenTagCache, resolveAllConfiguredRegistryTargets, resolveDefaultRangeStart, resolveIgnoredPackagePaths, resolveRegistryTargetsForPackage, resolveRegistryTargetsForPackages, resolveSlackPostMaxLength, resolveTags, retagAnnotatedLocal, richTextToPlainText, rollbackModifiedFiles, shouldFilterPrereleaseTags, shouldUseColors, sliceSlackText, social, socialSafetyCheck, splitCommitMessage, stripGitComments, summarizeResults, tagExists, topologicalSort, tryPostPrComment, updateLernaVersion, withRegistryNpmrc, writeChangelogToFile, writeVersion };
3122
+ export type { AIConfig, AIExtraGuidelines, AIPromptTarget, AIProviderName, AISocialConfig, AISystemPromptOverrides, AITargetConfig, AiSdkProviderOptions, BumpConfig, BumpOptions, BumpResult, BumpResultFalsy, BumpResultTruthy, ChangelogConfig, ChangelogInclude, ChangelogLinter, ChangelogOptions, ClaudeCodeProviderOptions, CommitMessageParts, CommitlintBuiltInRules, CommitlintCommit, CommitlintConfig, CommitlintCustomRule, CommitlintCustomRuleContext, CommitlintCustomRuleOutcome, CommitlintOptions, CommitlintProblem, CommitlintReport, CommitlintResult, CommitlintRuleConfig, CommitlintRuleLevel, CommitlintRuleName, CommitlintRulesConfig, CommitlintRunResult, CommitlintSuggestion, CommitlintSummary, ConfigType, DefaultRangeStart, GitProvider, GitUpstream, GitlabRelease, GitlabReleaseResponse, HookConfig, HookStep, HookType, InstalledHook, LintCommitMessageOptions, MonorepoConfig, NormalizedRuleConfig, OnRewrittenTag, PackageBase, PackageBumpEntry, PackageManager, PostedRelease, PrCommentConfig, PrCommentMode, PrCommentOptions, PrCommentStatus, ProviderReleaseOptions, ProviderReleaseResult, PublishConfig, PublishOptions, PublishResponse, PullRequestInfo, PullRequestTitle, RangeCommit, ReadPackage, Reference, RegistryTarget, ReleaseConfig, ReleaseContext, ReleaseOptions, RelizyConfig, RepoConfig, ReportEntry, ResolvedConfig, ResolvedRelizyConfig, ResolvedTags, ResolvedTwitterCredentials, RootPackage, RuleContext, RuleDefinition, RuleProblem, RuleSeverity, SlackChangelogFormat, SlackCredentials, SlackOptions, SlackPackageEntry, SlackRichTextBlock, SlackRichTextElement, SlackRichTextInline, SlackRichTextLink, SlackRichTextList, SlackRichTextPreformatted, SlackRichTextQuote, SlackRichTextSection, SlackRichTextStyle, SlackRichTextText, SlackSocialConfig, SocialConfig, SocialNetworkResult, SocialOptions, SocialResult, Step, TemplatesConfig, TokensConfig, TwitterCredentials, TwitterOptions, TwitterSocialConfig, VersionMode, WorkspacePackage };