gitverse-release 3.2.0 → 3.3.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/types.d.ts CHANGED
@@ -18,6 +18,18 @@ export interface ReleaseConfig {
18
18
  * Настройки версионирования
19
19
  */
20
20
  versioning?: VersioningConfig;
21
+ /**
22
+ * Настройки GitVerse Release
23
+ */
24
+ gitverse?: GitVerseConfig;
25
+ /**
26
+ * Настройки retry механизма
27
+ */
28
+ retry?: RetryConfig;
29
+ /**
30
+ * Настройки генерации commitlint конфига
31
+ */
32
+ commitlint?: CommitlintGeneratorConfig;
21
33
  }
22
34
  /**
23
35
  * Конфигурация monorepo
@@ -78,6 +90,10 @@ export interface ChangelogConfig {
78
90
  * Конфигурация Git операций
79
91
  */
80
92
  export interface GitConfig {
93
+ /**
94
+ * Команда для выполнения перед коммитом (например: "bun run format")
95
+ */
96
+ beforeCommit?: string;
81
97
  /**
82
98
  * Создавать ли коммит с изменениями
83
99
  */
@@ -346,3 +362,138 @@ export interface ReleaseResult {
346
362
  */
347
363
  warnings: string[];
348
364
  }
365
+ /**
366
+ * Конфигурация GitVerse Release
367
+ */
368
+ export interface GitVerseConfig {
369
+ /**
370
+ * Включить создание релиза через GitVerse API
371
+ * Требует переменную окружения GITVERSE_TOKEN
372
+ */
373
+ enabled: boolean;
374
+ /**
375
+ * Прерывать процесс релиза при ошибке создания release (после retry)
376
+ * Если false, ошибки логируются как warnings
377
+ */
378
+ failOnError: boolean;
379
+ /**
380
+ * Проверять существование релиза перед созданием (идемпотентность)
381
+ * Позволяет безопасно перезапускать pipeline
382
+ */
383
+ checkExisting: boolean;
384
+ }
385
+ /**
386
+ * Конфигурация retry механизма
387
+ */
388
+ export interface RetryConfig {
389
+ /**
390
+ * Включить retry с экспоненциальным backoff
391
+ */
392
+ enabled: boolean;
393
+ /**
394
+ * Максимальное количество попыток
395
+ */
396
+ maxAttempts: number;
397
+ /**
398
+ * Начальная задержка между попытками (мс)
399
+ */
400
+ initialDelay: number;
401
+ /**
402
+ * Максимальная задержка между попытками (мс)
403
+ * Ограничивает рост экспоненциального backoff
404
+ */
405
+ maxDelay: number;
406
+ /**
407
+ * Список операций для retry
408
+ */
409
+ operations: RetryOperation[];
410
+ }
411
+ /**
412
+ * Типы операций для retry
413
+ */
414
+ export type RetryOperation = "push" | "createRelease";
415
+ /**
416
+ * Конфигурация для генерации commitlint конфига
417
+ */
418
+ export interface CommitlintGeneratorConfig {
419
+ /**
420
+ * Путь для вывода commitlint конфига
421
+ * @default "commitlint.config.ts"
422
+ */
423
+ output: string;
424
+ /**
425
+ * Формат выходного файла
426
+ * @default "ts"
427
+ */
428
+ format: "ts" | "js" | "json";
429
+ /**
430
+ * Дополнительные scopes помимо package names
431
+ * @default ["deps", "ci", "docs"]
432
+ */
433
+ scopes: string[];
434
+ /**
435
+ * Требовать обязательный scope
436
+ * @default false
437
+ */
438
+ scopeRequired: boolean;
439
+ /**
440
+ * Максимальная длина header
441
+ * @default 100
442
+ */
443
+ headerMaxLength: number;
444
+ /**
445
+ * Добавлять комментарии в сгенерированный файл
446
+ * @default true
447
+ */
448
+ comments: boolean;
449
+ }
450
+ /**
451
+ * Опции для генерации commitlint конфига (CLI)
452
+ */
453
+ export interface GenerateCommitlintOptions {
454
+ /**
455
+ * Путь к release конфигу
456
+ * @default ".gitversereleaserc.json"
457
+ */
458
+ configPath?: string;
459
+ /**
460
+ * Путь для вывода commitlint конфига
461
+ * @default "commitlint.config.ts"
462
+ */
463
+ output?: string;
464
+ /**
465
+ * Формат выходного файла
466
+ * @default "ts"
467
+ */
468
+ format?: "ts" | "js" | "json";
469
+ /**
470
+ * Дополнительные scopes помимо package names
471
+ * @default ["deps", "ci", "docs"]
472
+ */
473
+ scopes?: string[];
474
+ /**
475
+ * Требовать обязательный scope
476
+ * @default false
477
+ */
478
+ scopeRequired?: boolean;
479
+ /**
480
+ * Максимальная длина header
481
+ * @default 100
482
+ */
483
+ headerMaxLength?: number;
484
+ /**
485
+ * Добавлять комментарии в сгенерированный файл
486
+ * @default true
487
+ */
488
+ comments?: boolean;
489
+ /**
490
+ * Dry-run режим (preview без записи)
491
+ * @default false
492
+ */
493
+ dryRun?: boolean;
494
+ /**
495
+ * Подробный вывод
496
+ * @default false
497
+ */
498
+ verbose?: boolean;
499
+ }
@@ -2,7 +2,7 @@ import type { ChangelogConfig, ChangelogGenerateOptions, ConventionalCommit } fr
2
2
  /**
3
3
  * Генерирует CHANGELOG для версии
4
4
  */
5
- export declare function generateChangelog(options: ChangelogGenerateOptions, config: ChangelogConfig): string;
5
+ export declare function generateChangelog(options: ChangelogGenerateOptions, config: ChangelogConfig, packageName?: string): string;
6
6
  /**
7
7
  * Обновляет CHANGELOG файл, добавляя новую версию в начало
8
8
  */
@@ -11,4 +11,4 @@ export declare function updateChangelogFile(changelogPath: string, newEntry: str
11
11
  * Генерирует CHANGELOG текст для GitVerse Release
12
12
  * (компактный формат без markdown заголовков, но с полной информацией)
13
13
  */
14
- export declare function generateReleaseNotes(commits: ConventionalCommit[], config: ChangelogConfig, repoUrl?: string): string;
14
+ export declare function generateReleaseNotes(commits: ConventionalCommit[], config: ChangelogConfig, repoUrl?: string, packageName?: string): string;
@@ -0,0 +1,5 @@
1
+ import type { GenerateCommitlintOptions, ReleaseConfig } from "../types";
2
+ /**
3
+ * Генерирует commitlint конфиг из release конфига
4
+ */
5
+ export declare function generateCommitlint(config: Required<ReleaseConfig>, options?: GenerateCommitlintOptions): Promise<void>;
@@ -1,4 +1,14 @@
1
1
  import type { GitRepoInfo } from "../types";
2
+ /**
3
+ * Выполняет команду shell
4
+ */
5
+ export declare function executeCommand(command: string): Promise<string>;
6
+ /**
7
+ * Выполняет beforeCommit hook
8
+ * Возвращает true если хук выполнился успешно
9
+ * Возвращает false если хук упал с ошибкой
10
+ */
11
+ export declare function runBeforeCommitHook(command: string): Promise<boolean>;
2
12
  /**
3
13
  * Получает информацию о Git репозитории
4
14
  *
@@ -44,8 +54,20 @@ export declare function createTag(tag: string, message: string): Promise<void>;
44
54
  export declare function pushChanges(tag?: string): Promise<void>;
45
55
  /**
46
56
  * Проверяет, что рабочая директория чистая
57
+ *
58
+ * Формат git status --porcelain: "XY PATH"
59
+ * X = status in staging area (index)
60
+ * Y = status in working tree
61
+ *
62
+ * Staged изменения (X != ' ') допустимы - они войдут в коммит релиза
63
+ * Unstaged изменения (Y != ' ') запрещены - нужно закоммитить или stash
47
64
  */
48
65
  export declare function isWorkingTreeClean(): Promise<boolean>;
66
+ /**
67
+ * Добавляет все измененные файлы в staging area
68
+ * Используется после успешного выполнения beforeCommit хука
69
+ */
70
+ export declare function addChangedFiles(): Promise<void>;
49
71
  /**
50
72
  * Проверяет, что тег существует
51
73
  */
@@ -0,0 +1,35 @@
1
+ import type { RetryConfig } from "../types";
2
+ /**
3
+ * Опции для retry функции
4
+ */
5
+ export interface RetryOptions {
6
+ /**
7
+ * Максимальное количество попыток
8
+ */
9
+ maxAttempts: number;
10
+ /**
11
+ * Начальная задержка (мс)
12
+ */
13
+ initialDelay: number;
14
+ /**
15
+ * Максимальная задержка (мс)
16
+ */
17
+ maxDelay: number;
18
+ /**
19
+ * Название операции для логирования
20
+ */
21
+ operationName?: string;
22
+ }
23
+ /**
24
+ * Выполняет функцию с retry механизмом и экспоненциальным backoff
25
+ *
26
+ * @param fn - Асинхронная функция для выполнения
27
+ * @param options - Опции retry
28
+ * @returns Результат выполнения функции
29
+ * @throws Последняя ошибка после всех попыток
30
+ */
31
+ export declare function retry<T>(fn: () => Promise<T>, options: RetryOptions): Promise<T>;
32
+ /**
33
+ * Создаёт функцию retry с предустановленными настройками из конфига
34
+ */
35
+ export declare function createRetryFunction(config: RetryConfig): <T>(fn: () => Promise<T>, operationName?: string) => Promise<T>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gitverse-release",
3
- "version": "3.2.0",
3
+ "version": "3.3.0",
4
4
  "description": "Conventional Commits release automation tool for GitVerse",
5
5
  "keywords": [
6
6
  "gitverse",
@@ -14,7 +14,7 @@
14
14
  ],
15
15
  "homepage": "https://gitverse.ru/rainypixel/gitverse-sdk#readme",
16
16
  "bugs": {
17
- "url": "https://gitverse.ru/rainypixel/gitverse-sdk/issues"
17
+ "url": "https://gitverse.ru/RainyPixel/gitverse-sdk/tasktracker"
18
18
  },
19
19
  "repository": {
20
20
  "type": "git",
@@ -40,6 +40,7 @@
40
40
  },
41
41
  "files": [
42
42
  "dist",
43
+ "schema.json",
43
44
  "README.md"
44
45
  ],
45
46
  "scripts": {
@@ -50,7 +51,7 @@
50
51
  "typecheck": "tsc --noEmit"
51
52
  },
52
53
  "dependencies": {
53
- "gitverse-api-sdk": "2.0.1"
54
+ "gitverse-api-sdk": "4.0.1"
54
55
  },
55
56
  "devDependencies": {
56
57
  "@types/bun": "1.3.0",
package/schema.json ADDED
@@ -0,0 +1,289 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "additionalProperties": false,
4
+ "description": "Configuration file for gitverse-release tool",
5
+ "properties": {
6
+ "changelog": {
7
+ "default": {
8
+ "showAuthor": true,
9
+ "showHash": true,
10
+ "types": {}
11
+ },
12
+ "description": "CHANGELOG generation settings",
13
+ "properties": {
14
+ "showAuthor": {
15
+ "default": true,
16
+ "description": "Show commit author in changelog entries",
17
+ "type": "boolean"
18
+ },
19
+ "showHash": {
20
+ "default": true,
21
+ "description": "Show commit hash in changelog entries",
22
+ "type": "boolean"
23
+ },
24
+ "types": {
25
+ "additionalProperties": {
26
+ "type": "string"
27
+ },
28
+ "default": {
29
+ "build": "🏗️ Build System",
30
+ "chore": "🔧 Chores",
31
+ "ci": "👷 CI/CD",
32
+ "docs": "📝 Documentation",
33
+ "feat": "✨ Features",
34
+ "fix": "🐛 Bug Fixes",
35
+ "perf": "⚡ Performance",
36
+ "refactor": "♻️ Refactoring",
37
+ "revert": "⏪ Reverts",
38
+ "style": "💄 Styling",
39
+ "test": "✅ Tests"
40
+ },
41
+ "description": "Mapping of commit types to changelog section titles",
42
+ "type": "object"
43
+ }
44
+ },
45
+ "type": "object"
46
+ },
47
+ "commitlint": {
48
+ "default": {
49
+ "comments": true,
50
+ "format": "ts",
51
+ "headerMaxLength": 100,
52
+ "output": "commitlint.config.ts",
53
+ "scopeRequired": false,
54
+ "scopes": ["deps", "ci", "docs"]
55
+ },
56
+ "description": "Commitlint config generation settings",
57
+ "properties": {
58
+ "comments": {
59
+ "default": true,
60
+ "description": "Include explanatory comments in generated config",
61
+ "type": "boolean"
62
+ },
63
+ "format": {
64
+ "default": "ts",
65
+ "description": "Output format for commitlint config",
66
+ "enum": ["ts", "js", "json"],
67
+ "type": "string"
68
+ },
69
+ "headerMaxLength": {
70
+ "default": 100,
71
+ "description": "Maximum commit header length",
72
+ "type": "number"
73
+ },
74
+ "output": {
75
+ "default": "commitlint.config.ts",
76
+ "description": "Output path for generated commitlint config",
77
+ "type": "string"
78
+ },
79
+ "scopeRequired": {
80
+ "default": false,
81
+ "description": "Whether scope is required in commit messages",
82
+ "type": "boolean"
83
+ },
84
+ "scopes": {
85
+ "default": ["deps", "ci", "docs"],
86
+ "description": "Additional scopes beyond monorepo package names",
87
+ "items": {
88
+ "type": "string"
89
+ },
90
+ "type": "array"
91
+ }
92
+ },
93
+ "type": "object"
94
+ },
95
+ "git": {
96
+ "default": {
97
+ "commitChanges": true,
98
+ "commitMessage": "chore(release): {{package}} v{{version}} [skip ci]",
99
+ "push": true,
100
+ "tagMessage": "Release {{package}} v{{version}}"
101
+ },
102
+ "description": "Git operations configuration",
103
+ "properties": {
104
+ "beforeCommit": {
105
+ "description": "Command to run before creating commit (e.g., 'bun run format', 'npm run lint:fix'). Useful for formatting changed files",
106
+ "examples": ["bun run format", "npm run lint:fix", "prettier --write ."],
107
+ "type": "string"
108
+ },
109
+ "commitChanges": {
110
+ "default": true,
111
+ "description": "Create git commit with version changes",
112
+ "type": "boolean"
113
+ },
114
+ "commitMessage": {
115
+ "default": "chore(release): {{package}} v{{version}} [skip ci]",
116
+ "description": "Commit message template. Supports {{package}} and {{version}} placeholders",
117
+ "type": "string"
118
+ },
119
+ "push": {
120
+ "default": true,
121
+ "description": "Push changes and tags to remote repository",
122
+ "type": "boolean"
123
+ },
124
+ "tagMessage": {
125
+ "default": "Release {{package}} v{{version}}",
126
+ "description": "Git tag message template. Supports {{package}} and {{version}} placeholders",
127
+ "type": "string"
128
+ }
129
+ },
130
+ "type": "object"
131
+ },
132
+ "gitverse": {
133
+ "default": {
134
+ "checkExisting": true,
135
+ "enabled": true,
136
+ "failOnError": true
137
+ },
138
+ "description": "GitVerse release creation settings",
139
+ "properties": {
140
+ "checkExisting": {
141
+ "default": true,
142
+ "description": "Check if release already exists before creating. Enables idempotent pipeline runs",
143
+ "type": "boolean"
144
+ },
145
+ "enabled": {
146
+ "default": true,
147
+ "description": "Enable GitVerse release creation via API. Requires GITVERSE_TOKEN environment variable",
148
+ "type": "boolean"
149
+ },
150
+ "failOnError": {
151
+ "default": true,
152
+ "description": "Fail the entire release process if GitVerse release creation fails (after retries). When false, release creation errors are logged as warnings",
153
+ "type": "boolean"
154
+ }
155
+ },
156
+ "type": "object"
157
+ },
158
+ "monorepo": {
159
+ "default": {
160
+ "enabled": false,
161
+ "packages": []
162
+ },
163
+ "description": "Monorepo configuration for managing multiple packages",
164
+ "properties": {
165
+ "enabled": {
166
+ "default": false,
167
+ "description": "Enable monorepo mode. When true, requires --package flag in CLI",
168
+ "type": "boolean"
169
+ },
170
+ "packages": {
171
+ "default": [],
172
+ "description": "List of packages in the monorepo",
173
+ "items": {
174
+ "properties": {
175
+ "changelog": {
176
+ "default": "CHANGELOG.md",
177
+ "description": "Path to CHANGELOG file relative to package directory",
178
+ "type": "string"
179
+ },
180
+ "name": {
181
+ "description": "Short package name used in CLI (e.g., 'sdk', 'release')",
182
+ "type": "string"
183
+ },
184
+ "packageName": {
185
+ "description": "Package name in package.json (e.g., 'gitverse-api-sdk')",
186
+ "type": "string"
187
+ },
188
+ "path": {
189
+ "description": "Relative path to package directory from repository root",
190
+ "type": "string"
191
+ },
192
+ "tagPrefix": {
193
+ "description": "Git tag prefix for this package (e.g., 'v', 'sdk-v', 'release-v')",
194
+ "type": "string"
195
+ }
196
+ },
197
+ "required": ["name", "path", "packageName", "tagPrefix"],
198
+ "type": "object"
199
+ },
200
+ "type": "array"
201
+ }
202
+ },
203
+ "type": "object"
204
+ },
205
+ "retry": {
206
+ "default": {
207
+ "enabled": true,
208
+ "initialDelay": 2000,
209
+ "maxAttempts": 5,
210
+ "maxDelay": 30000,
211
+ "operations": ["push", "createRelease"]
212
+ },
213
+ "description": "Retry mechanism for network operations (push, API calls)",
214
+ "properties": {
215
+ "enabled": {
216
+ "default": true,
217
+ "description": "Enable retry mechanism with exponential backoff",
218
+ "type": "boolean"
219
+ },
220
+ "initialDelay": {
221
+ "default": 2000,
222
+ "description": "Initial delay between retries in milliseconds",
223
+ "maximum": 10000,
224
+ "minimum": 100,
225
+ "type": "integer"
226
+ },
227
+ "maxAttempts": {
228
+ "default": 5,
229
+ "description": "Maximum number of retry attempts",
230
+ "maximum": 10,
231
+ "minimum": 1,
232
+ "type": "integer"
233
+ },
234
+ "maxDelay": {
235
+ "default": 30000,
236
+ "description": "Maximum delay between retries in milliseconds (caps exponential backoff)",
237
+ "maximum": 60000,
238
+ "minimum": 1000,
239
+ "type": "integer"
240
+ },
241
+ "operations": {
242
+ "default": ["push", "createRelease"],
243
+ "description": "List of operations to retry",
244
+ "items": {
245
+ "enum": ["push", "createRelease"],
246
+ "type": "string"
247
+ },
248
+ "type": "array",
249
+ "uniqueItems": true
250
+ }
251
+ },
252
+ "type": "object"
253
+ },
254
+ "versioning": {
255
+ "default": {
256
+ "allowPrerelease": false,
257
+ "preMajorMode": "auto",
258
+ "prereleasePrefix": "beta",
259
+ "tagPrefix": "v"
260
+ },
261
+ "description": "Semantic versioning configuration",
262
+ "properties": {
263
+ "allowPrerelease": {
264
+ "default": false,
265
+ "description": "Allow prerelease versions (e.g., 1.0.0-beta.0)",
266
+ "type": "boolean"
267
+ },
268
+ "preMajorMode": {
269
+ "default": "auto",
270
+ "description": "Pre-major version bump behavior for BREAKING CHANGES: 'auto' (< 1.0.0 → minor, >= 1.0.0 → major), 'enabled' (always minor), 'disabled' (always major), or version string (e.g., '2.0.0')",
271
+ "type": "string"
272
+ },
273
+ "prereleasePrefix": {
274
+ "default": "beta",
275
+ "description": "Prerelease identifier prefix (e.g., 'beta', 'alpha', 'rc')",
276
+ "type": "string"
277
+ },
278
+ "tagPrefix": {
279
+ "default": "v",
280
+ "description": "Git tag prefix (e.g., 'v', 'sdk-v'). Only used in single-package mode",
281
+ "type": "string"
282
+ }
283
+ },
284
+ "type": "object"
285
+ }
286
+ },
287
+ "title": "GitVerse Release Configuration",
288
+ "type": "object"
289
+ }