relizy 1.8.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/README.md +11 -0
- package/dist/cli.mjs +50 -10
- package/dist/index.d.mts +739 -12
- package/dist/index.d.ts +739 -12
- package/dist/index.mjs +11 -6
- package/dist/shared/{relizy.BljqIKug.mjs → relizy.BY0-QHlV.mjs} +2168 -247
- package/package.json +15 -14
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 {
|
|
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;
|
|
@@ -62,7 +63,7 @@ declare function getDefaultConfig(): {
|
|
|
62
63
|
slack: {
|
|
63
64
|
enabled: boolean;
|
|
64
65
|
onlyStable: boolean;
|
|
65
|
-
|
|
66
|
+
changelogFormat: string;
|
|
66
67
|
noAuthors: boolean;
|
|
67
68
|
noPackages: boolean;
|
|
68
69
|
};
|
|
@@ -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;
|
|
@@ -705,6 +1024,17 @@ declare function getSlackToken(options: {
|
|
|
705
1024
|
declare function getSlackWebhookUrl(options: {
|
|
706
1025
|
socialWebhookUrl?: string;
|
|
707
1026
|
}): string | null;
|
|
1027
|
+
/** Default changelog budget of the `summary` format. */
|
|
1028
|
+
declare const SLACK_SUMMARY_MAX_LENGTH = 2500;
|
|
1029
|
+
/**
|
|
1030
|
+
* Resolve the changelog budget of a Slack post: `postMaxLength` when set,
|
|
1031
|
+
* otherwise 2500 chars in `summary` format and no limit in `full` format
|
|
1032
|
+
* (the message is then only bounded by Slack's 50 blocks).
|
|
1033
|
+
*/
|
|
1034
|
+
declare function resolveSlackPostMaxLength({ changelogFormat, postMaxLength }: {
|
|
1035
|
+
changelogFormat?: SlackChangelogFormat;
|
|
1036
|
+
postMaxLength?: number;
|
|
1037
|
+
}): number | undefined;
|
|
708
1038
|
/**
|
|
709
1039
|
* Format changelog for Slack (convert markdown to Slack's mrkdwn format)
|
|
710
1040
|
*/
|
|
@@ -716,9 +1046,14 @@ declare function formatChangelogForSlack(changelog: string, maxLength?: number):
|
|
|
716
1046
|
*/
|
|
717
1047
|
declare function formatPackagesForSlack(packages: PackageBumpEntry[]): string;
|
|
718
1048
|
/**
|
|
719
|
-
* Format the Slack message using blocks
|
|
1049
|
+
* Format the Slack message using blocks.
|
|
1050
|
+
* - `summary` format: the changelog is a single mrkdwn section (2500 chars by default).
|
|
1051
|
+
* - `full` format: the changelog is rendered as rich_text blocks, commit bodies
|
|
1052
|
+
* included, split per section. It is bounded by `postMaxLength` when set and
|
|
1053
|
+
* always by Slack's limits (50 blocks, ~13,200 chars for rich text messages).
|
|
1054
|
+
* Every block is kept within Slack's limits so the post is never rejected.
|
|
720
1055
|
*/
|
|
721
|
-
declare function formatSlackMessage({ projectName, version, changelog, releaseUrl, changelogUrl, template, contributors, packages, postMaxLength }: {
|
|
1056
|
+
declare function formatSlackMessage({ projectName, version, changelog, releaseUrl, changelogUrl, template, contributors, packages, postMaxLength, changelogFormat }: {
|
|
722
1057
|
template?: string;
|
|
723
1058
|
projectName: string;
|
|
724
1059
|
version: string;
|
|
@@ -728,17 +1063,112 @@ declare function formatSlackMessage({ projectName, version, changelog, releaseUr
|
|
|
728
1063
|
contributors?: string[];
|
|
729
1064
|
packages?: PackageBumpEntry[];
|
|
730
1065
|
postMaxLength?: number;
|
|
1066
|
+
changelogFormat?: SlackChangelogFormat;
|
|
731
1067
|
}): any[];
|
|
732
1068
|
/**
|
|
733
1069
|
* Post a release announcement to Slack.
|
|
734
1070
|
* Dispatches to Incoming Webhook (if `webhookUrl` is set) or Web API (`token` + `channel`).
|
|
735
1071
|
* When both are provided, the webhook takes priority.
|
|
736
1072
|
*/
|
|
737
|
-
declare function postReleaseToSlack({ version, projectName, changelog, releaseUrl, changelogUrl, channel, token, webhookUrl, template, contributors, packages, postMaxLength, dryRun, }: SlackOptions): Promise<{
|
|
1073
|
+
declare function postReleaseToSlack({ version, projectName, changelog, releaseUrl, changelogUrl, channel, token, webhookUrl, template, contributors, packages, postMaxLength, changelogFormat, dryRun, }: SlackOptions): Promise<{
|
|
738
1074
|
ok: true;
|
|
739
1075
|
transport: "webhook";
|
|
740
1076
|
} | _slack_web_api.ChatPostMessageResponse | undefined>;
|
|
741
1077
|
|
|
1078
|
+
/** Maximum number of blocks in a Slack message. */
|
|
1079
|
+
declare const SLACK_MAX_BLOCKS = 50;
|
|
1080
|
+
/** Maximum length of the text of a Slack section block. */
|
|
1081
|
+
declare const SLACK_SECTION_MAX_LENGTH = 3000;
|
|
1082
|
+
/**
|
|
1083
|
+
* Soft cap of the text carried by a single rich_text block. Slack documents no
|
|
1084
|
+
* limit for rich_text, so the section limit is reused as a conservative bound.
|
|
1085
|
+
*/
|
|
1086
|
+
declare const SLACK_RICH_TEXT_BLOCK_MAX_LENGTH = 3000;
|
|
1087
|
+
/**
|
|
1088
|
+
* Budget of the JSON of all the blocks of a message containing rich_text blocks.
|
|
1089
|
+
* Slack rejects such messages above ~13,200 characters with `msg_blocks_too_long`
|
|
1090
|
+
* (https://github.com/slackapi/bolt-js/issues/2509): measuring the JSON, which is
|
|
1091
|
+
* larger than the text Slack counts, keeps a safe margin.
|
|
1092
|
+
*/
|
|
1093
|
+
declare const SLACK_RICH_TEXT_MESSAGE_MAX_LENGTH = 11000;
|
|
1094
|
+
/** Maximum length of the text of a Slack header block. */
|
|
1095
|
+
declare const SLACK_HEADER_MAX_LENGTH = 150;
|
|
1096
|
+
interface SlackRichTextStyle {
|
|
1097
|
+
bold?: boolean;
|
|
1098
|
+
italic?: boolean;
|
|
1099
|
+
strike?: boolean;
|
|
1100
|
+
code?: boolean;
|
|
1101
|
+
}
|
|
1102
|
+
interface SlackRichTextText {
|
|
1103
|
+
type: 'text';
|
|
1104
|
+
text: string;
|
|
1105
|
+
style?: SlackRichTextStyle;
|
|
1106
|
+
}
|
|
1107
|
+
interface SlackRichTextLink {
|
|
1108
|
+
type: 'link';
|
|
1109
|
+
url: string;
|
|
1110
|
+
text?: string;
|
|
1111
|
+
style?: SlackRichTextStyle;
|
|
1112
|
+
}
|
|
1113
|
+
type SlackRichTextInline = SlackRichTextText | SlackRichTextLink;
|
|
1114
|
+
interface SlackRichTextSection {
|
|
1115
|
+
type: 'rich_text_section';
|
|
1116
|
+
elements: SlackRichTextInline[];
|
|
1117
|
+
}
|
|
1118
|
+
interface SlackRichTextList {
|
|
1119
|
+
type: 'rich_text_list';
|
|
1120
|
+
style: 'bullet' | 'ordered';
|
|
1121
|
+
indent?: number;
|
|
1122
|
+
offset?: number;
|
|
1123
|
+
elements: SlackRichTextSection[];
|
|
1124
|
+
}
|
|
1125
|
+
interface SlackRichTextQuote {
|
|
1126
|
+
type: 'rich_text_quote';
|
|
1127
|
+
elements: SlackRichTextInline[];
|
|
1128
|
+
}
|
|
1129
|
+
interface SlackRichTextPreformatted {
|
|
1130
|
+
type: 'rich_text_preformatted';
|
|
1131
|
+
elements: SlackRichTextInline[];
|
|
1132
|
+
}
|
|
1133
|
+
type SlackRichTextElement = SlackRichTextSection | SlackRichTextList | SlackRichTextQuote | SlackRichTextPreformatted;
|
|
1134
|
+
interface SlackRichTextBlock {
|
|
1135
|
+
type: 'rich_text';
|
|
1136
|
+
elements: SlackRichTextElement[];
|
|
1137
|
+
}
|
|
1138
|
+
/** Cut a text without splitting a UTF-16 surrogate pair (emoji), which Slack would render broken. */
|
|
1139
|
+
declare function sliceSlackText(text: string, length: number): string;
|
|
1140
|
+
/**
|
|
1141
|
+
* Render a markdown changelog as Slack mrkdwn.
|
|
1142
|
+
* When `maxLength` is exceeded, whole commits are dropped from the end and
|
|
1143
|
+
* replaced with an "… and N more changes" line; a single block longer than
|
|
1144
|
+
* the budget is cut instead.
|
|
1145
|
+
*/
|
|
1146
|
+
declare function markdownToSlackMrkdwn(markdown: string, { maxLength, cutCommits }?: {
|
|
1147
|
+
maxLength?: number;
|
|
1148
|
+
/** Cut the first commit that does not fit where the limit is reached, instead of dropping it whole */
|
|
1149
|
+
cutCommits?: boolean;
|
|
1150
|
+
}): string;
|
|
1151
|
+
/**
|
|
1152
|
+
* Render a markdown changelog as Slack rich_text blocks.
|
|
1153
|
+
* Commit bodies are rendered under their bullet: paragraphs as quotes, nested
|
|
1154
|
+
* lists as indented lists, code as preformatted blocks.
|
|
1155
|
+
* When `maxLength`, `maxBlocks` or `maxPayloadLength` is exceeded, the changelog
|
|
1156
|
+
* is cut where the limit is reached, even inside a commit body, with an ellipsis,
|
|
1157
|
+
* and the commits left out entirely are announced with an "… and N more changes" line.
|
|
1158
|
+
*/
|
|
1159
|
+
declare function markdownToSlackRichText(markdown: string, { maxLength, maxBlocks, maxPayloadLength, blockMaxLength, }?: {
|
|
1160
|
+
/** Maximum number of text characters of the changelog */
|
|
1161
|
+
maxLength?: number;
|
|
1162
|
+
/** Maximum number of returned blocks */
|
|
1163
|
+
maxBlocks?: number;
|
|
1164
|
+
/** Maximum length of the JSON of the returned blocks */
|
|
1165
|
+
maxPayloadLength?: number;
|
|
1166
|
+
/** Soft cap of the text characters of a single block */
|
|
1167
|
+
blockMaxLength?: number;
|
|
1168
|
+
}): SlackRichTextBlock[];
|
|
1169
|
+
/** Plain-text rendering of a rich_text block, used for dry-run previews. */
|
|
1170
|
+
declare function richTextToPlainText(block: SlackRichTextBlock): string;
|
|
1171
|
+
|
|
742
1172
|
/**
|
|
743
1173
|
* Extract a summary from changelog content
|
|
744
1174
|
*/
|
|
@@ -1470,6 +1900,10 @@ interface SocialOptions {
|
|
|
1470
1900
|
* true = force-enable AI, false = force-disable AI, undefined = use config
|
|
1471
1901
|
*/
|
|
1472
1902
|
ai?: boolean;
|
|
1903
|
+
/**
|
|
1904
|
+
* Override `social.slack.changelogFormat` for this run
|
|
1905
|
+
*/
|
|
1906
|
+
slackFormat?: SlackChangelogFormat;
|
|
1473
1907
|
/**
|
|
1474
1908
|
* Prerelease suffix, forwarded to package discovery in independent mode
|
|
1475
1909
|
* when no bump result is available (standalone `social` runs).
|
|
@@ -1738,6 +2172,10 @@ interface ReleaseOptions extends ReleaseConfig, BumpConfig, ChangelogConfig, Pub
|
|
|
1738
2172
|
* true = force-enable AI, false = force-disable AI, undefined = use config
|
|
1739
2173
|
*/
|
|
1740
2174
|
ai?: boolean;
|
|
2175
|
+
/**
|
|
2176
|
+
* Override `social.slack.changelogFormat` for this run
|
|
2177
|
+
*/
|
|
2178
|
+
slackFormat?: SlackChangelogFormat;
|
|
1741
2179
|
}
|
|
1742
2180
|
interface TwitterCredentials {
|
|
1743
2181
|
/**
|
|
@@ -1794,6 +2232,12 @@ interface SlackCredentials {
|
|
|
1794
2232
|
*/
|
|
1795
2233
|
token?: string;
|
|
1796
2234
|
}
|
|
2235
|
+
/**
|
|
2236
|
+
* Slack changelog rendering:
|
|
2237
|
+
* - `summary`: short changelog (commit titles only) in a single mrkdwn section.
|
|
2238
|
+
* - `full`: complete changelog (commit bodies and PR/issue links) rendered as rich text blocks.
|
|
2239
|
+
*/
|
|
2240
|
+
type SlackChangelogFormat = 'summary' | 'full';
|
|
1797
2241
|
interface SlackSocialConfig {
|
|
1798
2242
|
/**
|
|
1799
2243
|
* Enable Slack posting
|
|
@@ -1827,10 +2271,22 @@ interface SlackSocialConfig {
|
|
|
1827
2271
|
* Slack credentials (optional - falls back to environment variables)
|
|
1828
2272
|
*/
|
|
1829
2273
|
credentials?: SlackCredentials;
|
|
2274
|
+
/**
|
|
2275
|
+
* Changelog rendering of the Slack message.
|
|
2276
|
+
* - `summary`: commit titles only, in a single section capped at `postMaxLength`.
|
|
2277
|
+
* - `full`: commit bodies and PR/issue links included, rendered as rich text blocks
|
|
2278
|
+
* (one per changelog section). Commit bodies follow `changelog.includeCommitBody`.
|
|
2279
|
+
* Can be overridden with the `--slack-format` CLI flag.
|
|
2280
|
+
* @default 'summary'
|
|
2281
|
+
*/
|
|
2282
|
+
changelogFormat?: SlackChangelogFormat;
|
|
1830
2283
|
/**
|
|
1831
2284
|
* Maximum length (in characters) of the changelog rendered inside the Slack message.
|
|
1832
|
-
*
|
|
1833
|
-
*
|
|
2285
|
+
* When exceeded, `summary` drops the last commits, `full` cuts the changelog where the limit
|
|
2286
|
+
* is reached (even inside a commit body) with an ellipsis; the commits left out entirely are
|
|
2287
|
+
* announced with an "… and N more changes" line.
|
|
2288
|
+
* Defaults to 2500 in `summary` format (Slack's section limit is 3000) and to no limit
|
|
2289
|
+
* in `full` format, where the message is only bounded by Slack's 50 blocks.
|
|
1834
2290
|
*/
|
|
1835
2291
|
postMaxLength?: number;
|
|
1836
2292
|
/**
|
|
@@ -1878,6 +2334,12 @@ interface AiSdkProviderOptions {
|
|
|
1878
2334
|
}
|
|
1879
2335
|
type AIPromptTarget = 'providerRelease' | 'twitter' | 'slack';
|
|
1880
2336
|
type AISystemPromptOverrides = Partial<Record<AIPromptTarget, string>>;
|
|
2337
|
+
interface AIExtraGuidelines extends Partial<Record<AIPromptTarget, string>> {
|
|
2338
|
+
/**
|
|
2339
|
+
* Directives appended to every target, before the target-specific ones
|
|
2340
|
+
*/
|
|
2341
|
+
global?: string;
|
|
2342
|
+
}
|
|
1881
2343
|
interface AITargetConfig {
|
|
1882
2344
|
/**
|
|
1883
2345
|
* Enable AI for this target
|
|
@@ -1921,10 +2383,13 @@ interface AIConfig {
|
|
|
1921
2383
|
*/
|
|
1922
2384
|
fallback?: 'raw' | 'fail';
|
|
1923
2385
|
/**
|
|
1924
|
-
* Extra directives appended to
|
|
2386
|
+
* Extra directives appended to the built-in system prompts.
|
|
2387
|
+
* A string applies to every target; an object adds directives per target,
|
|
2388
|
+
* appended after the `global` ones.
|
|
1925
2389
|
* @example 'Always use emojis in the changelog'
|
|
2390
|
+
* @example { global: 'Keep package names in English.', slack: 'Mention the owning team.' }
|
|
1926
2391
|
*/
|
|
1927
|
-
extraGuidelines?: string;
|
|
2392
|
+
extraGuidelines?: string | AIExtraGuidelines;
|
|
1928
2393
|
/**
|
|
1929
2394
|
* Full replacement of the built-in system prompts.
|
|
1930
2395
|
* When set, the extraGuidelines and base prompts are ignored for that target.
|
|
@@ -2038,9 +2503,14 @@ interface SlackOptions {
|
|
|
2038
2503
|
template?: string;
|
|
2039
2504
|
/**
|
|
2040
2505
|
* Maximum chars of the changelog rendered in the message.
|
|
2041
|
-
*
|
|
2506
|
+
* Defaults to 2500 in `summary` format and to no limit in `full` format.
|
|
2042
2507
|
*/
|
|
2043
2508
|
postMaxLength?: number;
|
|
2509
|
+
/**
|
|
2510
|
+
* Changelog rendering of the message
|
|
2511
|
+
* @default 'summary'
|
|
2512
|
+
*/
|
|
2513
|
+
changelogFormat?: SlackChangelogFormat;
|
|
2044
2514
|
/**
|
|
2045
2515
|
* Contributor names (plain strings, no email/handle). Empty array or undefined → no contributors block.
|
|
2046
2516
|
*/
|
|
@@ -2204,6 +2674,202 @@ type HookConfig = {
|
|
|
2204
2674
|
changelog: string;
|
|
2205
2675
|
}) => string | void | null | undefined | Promise<string | void | null | undefined>;
|
|
2206
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
|
+
}
|
|
2207
2873
|
/**
|
|
2208
2874
|
* Relizy configuration
|
|
2209
2875
|
* @see https://relizy.dev/config/overview
|
|
@@ -2280,6 +2946,11 @@ interface RelizyConfig extends Partial<Omit<ChangelogConfig$1, 'output' | 'templ
|
|
|
2280
2946
|
* Hooks config
|
|
2281
2947
|
*/
|
|
2282
2948
|
hooks?: HookConfig;
|
|
2949
|
+
/**
|
|
2950
|
+
* Commit message linter (`relizy commitlint`) config
|
|
2951
|
+
* @see https://relizy.dev/commitlint/
|
|
2952
|
+
*/
|
|
2953
|
+
commitlint?: CommitlintConfig;
|
|
2283
2954
|
/**
|
|
2284
2955
|
* Set log level
|
|
2285
2956
|
* @default 'default'
|
|
@@ -2314,6 +2985,62 @@ declare function bump(options?: Partial<BumpOptions>): Promise<BumpResult>;
|
|
|
2314
2985
|
|
|
2315
2986
|
declare function changelog(options?: Partial<ChangelogOptions>): Promise<void>;
|
|
2316
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
|
+
|
|
2317
3044
|
interface PrCommentOptions {
|
|
2318
3045
|
prNumber?: number;
|
|
2319
3046
|
dryRun?: boolean;
|
|
@@ -2391,5 +3118,5 @@ declare function socialSafetyCheck({ config }: {
|
|
|
2391
3118
|
}): Promise<void>;
|
|
2392
3119
|
declare function social(options?: Partial<SocialOptions>): Promise<SocialResult>;
|
|
2393
3120
|
|
|
2394
|
-
export { NEW_PACKAGE_MARKER, PR_COMMENT_MARKER, 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, mergeTypes, parseChangelogMarkdown, parseGitRemoteUrl, postPrComment, postReleaseToSlack, postReleaseToTwitter, prComment, providerRelease, providerReleaseSafetyCheck, publish, publishPackage, publishSafetyCheck, pushCommitAndTags, pushTagForce, readPackageJson, readPackages, reconcileFromTag, redactSecrets, release, resetRewrittenTagCache, resolveAllConfiguredRegistryTargets, resolveIgnoredPackagePaths, resolveRegistryTargetsForPackage, resolveRegistryTargetsForPackages, resolveTags, retagAnnotatedLocal, rollbackModifiedFiles, shouldFilterPrereleaseTags, social, socialSafetyCheck, tagExists, topologicalSort, tryPostPrComment, updateLernaVersion, withRegistryNpmrc, writeChangelogToFile, writeVersion };
|
|
2395
|
-
export type { AIConfig, 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, SlackCredentials, SlackOptions, SlackPackageEntry, 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 };
|