@eui/mcp 1.0.3
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 +846 -0
- package/dist/config/index.d.ts +6 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +6 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/loader.d.ts +27 -0
- package/dist/config/loader.d.ts.map +1 -0
- package/dist/config/loader.js +224 -0
- package/dist/config/loader.js.map +1 -0
- package/dist/config/schema.d.ts +171 -0
- package/dist/config/schema.d.ts.map +1 -0
- package/dist/config/schema.js +100 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +45 -0
- package/dist/index.js.map +1 -0
- package/dist/loader/cache-manager.d.ts +74 -0
- package/dist/loader/cache-manager.d.ts.map +1 -0
- package/dist/loader/cache-manager.js +107 -0
- package/dist/loader/cache-manager.js.map +1 -0
- package/dist/loader/documentation-loader.d.ts +57 -0
- package/dist/loader/documentation-loader.d.ts.map +1 -0
- package/dist/loader/documentation-loader.js +81 -0
- package/dist/loader/documentation-loader.js.map +1 -0
- package/dist/loader/documentation-source.d.ts +37 -0
- package/dist/loader/documentation-source.d.ts.map +1 -0
- package/dist/loader/documentation-source.js +2 -0
- package/dist/loader/documentation-source.js.map +1 -0
- package/dist/loader/errors.d.ts +34 -0
- package/dist/loader/errors.d.ts.map +1 -0
- package/dist/loader/errors.js +65 -0
- package/dist/loader/errors.js.map +1 -0
- package/dist/loader/http-client.d.ts +43 -0
- package/dist/loader/http-client.d.ts.map +1 -0
- package/dist/loader/http-client.js +144 -0
- package/dist/loader/http-client.js.map +1 -0
- package/dist/loader/index.d.ts +6 -0
- package/dist/loader/index.d.ts.map +1 -0
- package/dist/loader/index.js +5 -0
- package/dist/loader/index.js.map +1 -0
- package/dist/loader/local-documentation-source.d.ts +62 -0
- package/dist/loader/local-documentation-source.d.ts.map +1 -0
- package/dist/loader/local-documentation-source.js +190 -0
- package/dist/loader/local-documentation-source.js.map +1 -0
- package/dist/loader/path-type-detector.d.ts +34 -0
- package/dist/loader/path-type-detector.d.ts.map +1 -0
- package/dist/loader/path-type-detector.js +78 -0
- package/dist/loader/path-type-detector.js.map +1 -0
- package/dist/loader/remote-documentation-source.d.ts +112 -0
- package/dist/loader/remote-documentation-source.d.ts.map +1 -0
- package/dist/loader/remote-documentation-source.js +252 -0
- package/dist/loader/remote-documentation-source.js.map +1 -0
- package/dist/main.d.ts +3 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +211 -0
- package/dist/main.js.map +1 -0
- package/dist/mcp/index.d.ts +5 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +5 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/server.d.ts +65 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +224 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/publish/index.d.ts +8 -0
- package/dist/publish/index.d.ts.map +1 -0
- package/dist/publish/index.js +8 -0
- package/dist/publish/index.js.map +1 -0
- package/dist/publish/publish-utils.d.ts +74 -0
- package/dist/publish/publish-utils.d.ts.map +1 -0
- package/dist/publish/publish-utils.js +170 -0
- package/dist/publish/publish-utils.js.map +1 -0
- package/dist/query/component-query.d.ts +33 -0
- package/dist/query/component-query.d.ts.map +1 -0
- package/dist/query/component-query.js +63 -0
- package/dist/query/component-query.js.map +1 -0
- package/dist/query/index-builder.d.ts +79 -0
- package/dist/query/index-builder.d.ts.map +1 -0
- package/dist/query/index-builder.js +217 -0
- package/dist/query/index-builder.js.map +1 -0
- package/dist/query/index.d.ts +5 -0
- package/dist/query/index.d.ts.map +1 -0
- package/dist/query/index.js +6 -0
- package/dist/query/index.js.map +1 -0
- package/dist/query/result-formatter.d.ts +108 -0
- package/dist/query/result-formatter.d.ts.map +1 -0
- package/dist/query/result-formatter.js +165 -0
- package/dist/query/result-formatter.js.map +1 -0
- package/dist/query/search-engine.d.ts +54 -0
- package/dist/query/search-engine.d.ts.map +1 -0
- package/dist/query/search-engine.js +178 -0
- package/dist/query/search-engine.js.map +1 -0
- package/dist/test-error.ts +1 -0
- package/dist/tools/get-component-docs.d.ts +43 -0
- package/dist/tools/get-component-docs.d.ts.map +1 -0
- package/dist/tools/get-component-docs.js +55 -0
- package/dist/tools/get-component-docs.js.map +1 -0
- package/dist/tools/get-component-examples.d.ts +45 -0
- package/dist/tools/get-component-examples.d.ts.map +1 -0
- package/dist/tools/get-component-examples.js +56 -0
- package/dist/tools/get-component-examples.js.map +1 -0
- package/dist/tools/get-component-inputs.d.ts +44 -0
- package/dist/tools/get-component-inputs.d.ts.map +1 -0
- package/dist/tools/get-component-inputs.js +55 -0
- package/dist/tools/get-component-inputs.js.map +1 -0
- package/dist/tools/get-component-outputs.d.ts +44 -0
- package/dist/tools/get-component-outputs.d.ts.map +1 -0
- package/dist/tools/get-component-outputs.js +55 -0
- package/dist/tools/get-component-outputs.js.map +1 -0
- package/dist/tools/index.d.ts +7 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +8 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/list-components.d.ts +69 -0
- package/dist/tools/list-components.d.ts.map +1 -0
- package/dist/tools/list-components.js +84 -0
- package/dist/tools/list-components.js.map +1 -0
- package/dist/tools/search-components.d.ts +69 -0
- package/dist/tools/search-components.d.ts.map +1 -0
- package/dist/tools/search-components.js +98 -0
- package/dist/tools/search-components.js.map +1 -0
- package/dist/types/compodoc.d.ts +261 -0
- package/dist/types/compodoc.d.ts.map +1 -0
- package/dist/types/compodoc.js +5 -0
- package/dist/types/compodoc.js.map +1 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +5 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/circuit-breaker.d.ts +91 -0
- package/dist/utils/circuit-breaker.d.ts.map +1 -0
- package/dist/utils/circuit-breaker.js +186 -0
- package/dist/utils/circuit-breaker.js.map +1 -0
- package/dist/utils/credential-masking.d.ts +90 -0
- package/dist/utils/credential-masking.d.ts.map +1 -0
- package/dist/utils/credential-masking.js +202 -0
- package/dist/utils/credential-masking.js.map +1 -0
- package/dist/utils/error-handler.d.ts +68 -0
- package/dist/utils/error-handler.d.ts.map +1 -0
- package/dist/utils/error-handler.js +184 -0
- package/dist/utils/error-handler.js.map +1 -0
- package/dist/utils/errors.d.ts +156 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +242 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/index.d.ts +10 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +16 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/logger.d.ts +76 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +150 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/retry.d.ts +19 -0
- package/dist/utils/retry.d.ts.map +1 -0
- package/dist/utils/retry.js +81 -0
- package/dist/utils/retry.js.map +1 -0
- package/dist/version/changelog-file-utils.d.ts +69 -0
- package/dist/version/changelog-file-utils.d.ts.map +1 -0
- package/dist/version/changelog-file-utils.js +161 -0
- package/dist/version/changelog-file-utils.js.map +1 -0
- package/dist/version/changelog-utils.d.ts +98 -0
- package/dist/version/changelog-utils.d.ts.map +1 -0
- package/dist/version/changelog-utils.js +198 -0
- package/dist/version/changelog-utils.js.map +1 -0
- package/dist/version/dry-run-utils.d.ts +108 -0
- package/dist/version/dry-run-utils.d.ts.map +1 -0
- package/dist/version/dry-run-utils.js +126 -0
- package/dist/version/dry-run-utils.js.map +1 -0
- package/dist/version/git-tag-utils.d.ts +50 -0
- package/dist/version/git-tag-utils.d.ts.map +1 -0
- package/dist/version/git-tag-utils.js +66 -0
- package/dist/version/git-tag-utils.js.map +1 -0
- package/dist/version/index.d.ts +11 -0
- package/dist/version/index.d.ts.map +1 -0
- package/dist/version/index.js +11 -0
- package/dist/version/index.js.map +1 -0
- package/dist/version/release-utils.d.ts +94 -0
- package/dist/version/release-utils.d.ts.map +1 -0
- package/dist/version/release-utils.js +170 -0
- package/dist/version/release-utils.js.map +1 -0
- package/dist/version/rollback-utils.d.ts +47 -0
- package/dist/version/rollback-utils.d.ts.map +1 -0
- package/dist/version/rollback-utils.js +73 -0
- package/dist/version/rollback-utils.js.map +1 -0
- package/dist/version/version-manager.d.ts +98 -0
- package/dist/version/version-manager.d.ts.map +1 -0
- package/dist/version/version-manager.js +158 -0
- package/dist/version/version-manager.js.map +1 -0
- package/package.json +61 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dry Run Mode Utilities
|
|
3
|
+
*
|
|
4
|
+
* Provides functions for detecting and managing dry run mode in the release pipeline.
|
|
5
|
+
* Dry run mode allows testing the release process without actually publishing or making changes.
|
|
6
|
+
*
|
|
7
|
+
* Validates: Requirements 15.1
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Checks if dry run mode is enabled via environment variable.
|
|
11
|
+
*
|
|
12
|
+
* Dry run mode is enabled when the DRY_RUN environment variable is set to:
|
|
13
|
+
* - "true" (case-insensitive)
|
|
14
|
+
* - "1"
|
|
15
|
+
* - "yes" (case-insensitive)
|
|
16
|
+
*
|
|
17
|
+
* @returns true if dry run mode is enabled, false otherwise
|
|
18
|
+
*/
|
|
19
|
+
export function isDryRunEnabled() {
|
|
20
|
+
const dryRunValue = process.env.DRY_RUN;
|
|
21
|
+
if (!dryRunValue) {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
const normalizedValue = dryRunValue.toLowerCase().trim();
|
|
25
|
+
return normalizedValue === 'true' || normalizedValue === '1' || normalizedValue === 'yes';
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Gets the dry run mode status as a boolean.
|
|
29
|
+
*
|
|
30
|
+
* This is an alias for isDryRunEnabled() that provides a more explicit API.
|
|
31
|
+
*
|
|
32
|
+
* @returns true if dry run mode is enabled, false otherwise
|
|
33
|
+
*/
|
|
34
|
+
export function getDryRunMode() {
|
|
35
|
+
return isDryRunEnabled();
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Checks if the current execution should perform actual changes.
|
|
39
|
+
*
|
|
40
|
+
* This is the inverse of isDryRunEnabled() and can be used to guard
|
|
41
|
+
* operations that should only execute in non-dry-run mode.
|
|
42
|
+
*
|
|
43
|
+
* @returns true if actual changes should be made, false if in dry run mode
|
|
44
|
+
*/
|
|
45
|
+
export function shouldExecuteChanges() {
|
|
46
|
+
return !isDryRunEnabled();
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Gets the complete dry run configuration.
|
|
50
|
+
*
|
|
51
|
+
* @returns Configuration object with dry run status and raw environment value
|
|
52
|
+
*/
|
|
53
|
+
export function getDryRunConfig() {
|
|
54
|
+
return {
|
|
55
|
+
enabled: isDryRunEnabled(),
|
|
56
|
+
rawValue: process.env.DRY_RUN,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Logs a dry run action message to the console.
|
|
61
|
+
*
|
|
62
|
+
* This helper function formats and logs messages about actions that would
|
|
63
|
+
* be performed in a real release but are skipped in dry run mode.
|
|
64
|
+
*
|
|
65
|
+
* @param action - Description of the action that would be performed
|
|
66
|
+
*/
|
|
67
|
+
export function logDryRunAction(action) {
|
|
68
|
+
console.log(`[DRY RUN] Would execute: ${action}`);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Logs a dry run skip message to the console.
|
|
72
|
+
*
|
|
73
|
+
* This helper function formats and logs messages about operations that
|
|
74
|
+
* are being skipped due to dry run mode.
|
|
75
|
+
*
|
|
76
|
+
* @param operation - Description of the operation being skipped
|
|
77
|
+
*/
|
|
78
|
+
export function logDryRunSkip(operation) {
|
|
79
|
+
console.log(`[DRY RUN] Skipping: ${operation}`);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Creates a summary of actions that would be performed in a release.
|
|
83
|
+
*
|
|
84
|
+
* This function is used in dry run mode to provide a comprehensive overview
|
|
85
|
+
* of all operations that would be executed in a real release.
|
|
86
|
+
*
|
|
87
|
+
* @param actions - Array of actions that would be performed
|
|
88
|
+
* @returns Summary object with all actions and metadata
|
|
89
|
+
*
|
|
90
|
+
* Validates: Requirements 15.5
|
|
91
|
+
*/
|
|
92
|
+
export function createDryRunSummary(actions) {
|
|
93
|
+
return {
|
|
94
|
+
actions,
|
|
95
|
+
totalActions: actions.length,
|
|
96
|
+
timestamp: new Date().toISOString(),
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Displays a formatted dry run summary to the console.
|
|
101
|
+
*
|
|
102
|
+
* @param summary - The dry run summary to display
|
|
103
|
+
*/
|
|
104
|
+
export function displayDryRunSummary(summary) {
|
|
105
|
+
console.log('\n========================================');
|
|
106
|
+
console.log('DRY RUN SUMMARY');
|
|
107
|
+
console.log('========================================\n');
|
|
108
|
+
console.log(`Total Actions: ${summary.totalActions}`);
|
|
109
|
+
console.log(`Timestamp: ${summary.timestamp}\n`);
|
|
110
|
+
if (summary.actions.length === 0) {
|
|
111
|
+
console.log('No actions would be performed.\n');
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
console.log('Actions that would be performed:\n');
|
|
115
|
+
for (let i = 0; i < summary.actions.length; i++) {
|
|
116
|
+
const action = summary.actions[i];
|
|
117
|
+
console.log(`${i + 1}. [${action.type.toUpperCase()}] ${action.description}`);
|
|
118
|
+
if (action.details) {
|
|
119
|
+
for (const [key, value] of Object.entries(action.details)) {
|
|
120
|
+
console.log(` - ${key}: ${JSON.stringify(value)}`);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
console.log('\n========================================\n');
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=dry-run-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+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@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git Tag Utilities
|
|
3
|
+
*
|
|
4
|
+
* Provides functions for formatting Git tag names and annotations.
|
|
5
|
+
* Supports semantic versioning tag format (v{MAJOR}.{MINOR}.{PATCH}).
|
|
6
|
+
*/
|
|
7
|
+
import type { SemanticVersion } from './version-manager.js';
|
|
8
|
+
/**
|
|
9
|
+
* Formats a semantic version as a Git tag name.
|
|
10
|
+
*
|
|
11
|
+
* Tag format: v{MAJOR}.{MINOR}.{PATCH}
|
|
12
|
+
* Example: v1.2.3
|
|
13
|
+
*
|
|
14
|
+
* @param version - Semantic version object
|
|
15
|
+
* @returns Formatted Git tag name with 'v' prefix
|
|
16
|
+
*/
|
|
17
|
+
export declare function formatTagName(version: SemanticVersion): string;
|
|
18
|
+
/**
|
|
19
|
+
* Formats a version string as a Git tag name.
|
|
20
|
+
*
|
|
21
|
+
* @param versionString - Version string in format "MAJOR.MINOR.PATCH"
|
|
22
|
+
* @returns Formatted Git tag name with 'v' prefix
|
|
23
|
+
*/
|
|
24
|
+
export declare function formatTagNameFromString(versionString: string): string;
|
|
25
|
+
/**
|
|
26
|
+
* Formats a timestamp in ISO 8601 format.
|
|
27
|
+
*
|
|
28
|
+
* @param date - Date object to format (defaults to current date/time)
|
|
29
|
+
* @returns ISO 8601 formatted timestamp (e.g., "2024-01-15T10:30:00.000Z")
|
|
30
|
+
*/
|
|
31
|
+
export declare function formatTimestamp(date?: Date): string;
|
|
32
|
+
/**
|
|
33
|
+
* Creates a Git tag annotation message.
|
|
34
|
+
*
|
|
35
|
+
* The annotation includes the version number and timestamp in ISO 8601 format.
|
|
36
|
+
*
|
|
37
|
+
* @param version - Semantic version object
|
|
38
|
+
* @param date - Date object for the annotation (defaults to current date/time)
|
|
39
|
+
* @returns Formatted tag annotation message
|
|
40
|
+
*/
|
|
41
|
+
export declare function createTagAnnotation(version: SemanticVersion, date?: Date): string;
|
|
42
|
+
/**
|
|
43
|
+
* Creates a Git tag annotation message from a version string.
|
|
44
|
+
*
|
|
45
|
+
* @param versionString - Version string in format "MAJOR.MINOR.PATCH" or "vMAJOR.MINOR.PATCH"
|
|
46
|
+
* @param date - Date object for the annotation (defaults to current date/time)
|
|
47
|
+
* @returns Formatted tag annotation message
|
|
48
|
+
*/
|
|
49
|
+
export declare function createTagAnnotationFromString(versionString: string, date?: Date): string;
|
|
50
|
+
//# sourceMappingURL=git-tag-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-tag-utils.d.ts","sourceRoot":"","sources":["../../src/version/git-tag-utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,eAAe,GAAG,MAAM,CAE9D;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAIrE;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,IAAI,GAAE,IAAiB,GAAG,MAAM,CAE/D;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,eAAe,EAAE,IAAI,GAAE,IAAiB,GAAG,MAAM,CAI7F;AAED;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CAAC,aAAa,EAAE,MAAM,EAAE,IAAI,GAAE,IAAiB,GAAG,MAAM,CAKpG"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git Tag Utilities
|
|
3
|
+
*
|
|
4
|
+
* Provides functions for formatting Git tag names and annotations.
|
|
5
|
+
* Supports semantic versioning tag format (v{MAJOR}.{MINOR}.{PATCH}).
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Formats a semantic version as a Git tag name.
|
|
9
|
+
*
|
|
10
|
+
* Tag format: v{MAJOR}.{MINOR}.{PATCH}
|
|
11
|
+
* Example: v1.2.3
|
|
12
|
+
*
|
|
13
|
+
* @param version - Semantic version object
|
|
14
|
+
* @returns Formatted Git tag name with 'v' prefix
|
|
15
|
+
*/
|
|
16
|
+
export function formatTagName(version) {
|
|
17
|
+
return `v${version.major}.${version.minor}.${version.patch}`;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Formats a version string as a Git tag name.
|
|
21
|
+
*
|
|
22
|
+
* @param versionString - Version string in format "MAJOR.MINOR.PATCH"
|
|
23
|
+
* @returns Formatted Git tag name with 'v' prefix
|
|
24
|
+
*/
|
|
25
|
+
export function formatTagNameFromString(versionString) {
|
|
26
|
+
// Remove 'v' prefix if already present
|
|
27
|
+
const cleanVersion = versionString.startsWith('v') ? versionString.slice(1) : versionString;
|
|
28
|
+
return `v${cleanVersion}`;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Formats a timestamp in ISO 8601 format.
|
|
32
|
+
*
|
|
33
|
+
* @param date - Date object to format (defaults to current date/time)
|
|
34
|
+
* @returns ISO 8601 formatted timestamp (e.g., "2024-01-15T10:30:00.000Z")
|
|
35
|
+
*/
|
|
36
|
+
export function formatTimestamp(date = new Date()) {
|
|
37
|
+
return date.toISOString();
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Creates a Git tag annotation message.
|
|
41
|
+
*
|
|
42
|
+
* The annotation includes the version number and timestamp in ISO 8601 format.
|
|
43
|
+
*
|
|
44
|
+
* @param version - Semantic version object
|
|
45
|
+
* @param date - Date object for the annotation (defaults to current date/time)
|
|
46
|
+
* @returns Formatted tag annotation message
|
|
47
|
+
*/
|
|
48
|
+
export function createTagAnnotation(version, date = new Date()) {
|
|
49
|
+
const versionString = `${version.major}.${version.minor}.${version.patch}`;
|
|
50
|
+
const timestamp = formatTimestamp(date);
|
|
51
|
+
return `Release version ${versionString}\nCreated at: ${timestamp}`;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Creates a Git tag annotation message from a version string.
|
|
55
|
+
*
|
|
56
|
+
* @param versionString - Version string in format "MAJOR.MINOR.PATCH" or "vMAJOR.MINOR.PATCH"
|
|
57
|
+
* @param date - Date object for the annotation (defaults to current date/time)
|
|
58
|
+
* @returns Formatted tag annotation message
|
|
59
|
+
*/
|
|
60
|
+
export function createTagAnnotationFromString(versionString, date = new Date()) {
|
|
61
|
+
// Remove 'v' prefix if present
|
|
62
|
+
const cleanVersion = versionString.startsWith('v') ? versionString.slice(1) : versionString;
|
|
63
|
+
const timestamp = formatTimestamp(date);
|
|
64
|
+
return `Release version ${cleanVersion}\nCreated at: ${timestamp}`;
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=git-tag-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-tag-utils.js","sourceRoot":"","sources":["../../src/version/git-tag-utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;;;;;;;GAQG;AACH,MAAM,UAAU,aAAa,CAAC,OAAwB;IACpD,OAAO,IAAI,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;AAC/D,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB,CAAC,aAAqB;IAC3D,uCAAuC;IACvC,MAAM,YAAY,GAAG,aAAa,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC;IAC5F,OAAO,IAAI,YAAY,EAAE,CAAC;AAC5B,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,OAAa,IAAI,IAAI,EAAE;IACrD,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC;AAC5B,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAAwB,EAAE,OAAa,IAAI,IAAI,EAAE;IACnF,MAAM,aAAa,GAAG,GAAG,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;IAC3E,MAAM,SAAS,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;IACxC,OAAO,mBAAmB,aAAa,iBAAiB,SAAS,EAAE,CAAC;AACtE,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,6BAA6B,CAAC,aAAqB,EAAE,OAAa,IAAI,IAAI,EAAE;IAC1F,+BAA+B;IAC/B,MAAM,YAAY,GAAG,aAAa,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC;IAC5F,MAAM,SAAS,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;IACxC,OAAO,mBAAmB,YAAY,iBAAiB,SAAS,EAAE,CAAC;AACrE,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Version Management Module
|
|
3
|
+
*
|
|
4
|
+
* Exports utilities for semantic version management and Git tag formatting.
|
|
5
|
+
*/
|
|
6
|
+
export { parseVersion, isValidVersion, formatVersion, bumpVersion, bumpVersionString, type ReleaseType, type SemanticVersion, } from './version-manager.js';
|
|
7
|
+
export { formatTagName, formatTagNameFromString, formatTimestamp, createTagAnnotation, createTagAnnotationFromString, } from './git-tag-utils.js';
|
|
8
|
+
export { parseConventionalCommit, groupCommitsByType, isConventionalCommit, getCommitTypes, filterCommitsByType, type ConventionalCommit, type GroupedCommits, COMMIT_TYPES, } from './changelog-utils.js';
|
|
9
|
+
export { extractVersion, formatReleaseTitle, getChangelogContent, createArtifactLink, createReleasePayload, createRelease, type GitLabReleasePayload, } from './release-utils.js';
|
|
10
|
+
export { isDryRunEnabled, getDryRunMode, shouldExecuteChanges, getDryRunConfig, logDryRunAction, logDryRunSkip, type DryRunConfig, } from './dry-run-utils.js';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/version/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,YAAY,EACZ,cAAc,EACd,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,KAAK,WAAW,EAChB,KAAK,eAAe,GACrB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,aAAa,EACb,uBAAuB,EACvB,eAAe,EACf,mBAAmB,EACnB,6BAA6B,GAC9B,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,uBAAuB,EACvB,kBAAkB,EAClB,oBAAoB,EACpB,cAAc,EACd,mBAAmB,EACnB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,YAAY,GACb,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,EACpB,aAAa,EACb,KAAK,oBAAoB,GAC1B,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,eAAe,EACf,aAAa,EACb,oBAAoB,EACpB,eAAe,EACf,eAAe,EACf,aAAa,EACb,KAAK,YAAY,GAClB,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Version Management Module
|
|
3
|
+
*
|
|
4
|
+
* Exports utilities for semantic version management and Git tag formatting.
|
|
5
|
+
*/
|
|
6
|
+
export { parseVersion, isValidVersion, formatVersion, bumpVersion, bumpVersionString, } from './version-manager.js';
|
|
7
|
+
export { formatTagName, formatTagNameFromString, formatTimestamp, createTagAnnotation, createTagAnnotationFromString, } from './git-tag-utils.js';
|
|
8
|
+
export { parseConventionalCommit, groupCommitsByType, isConventionalCommit, getCommitTypes, filterCommitsByType, COMMIT_TYPES, } from './changelog-utils.js';
|
|
9
|
+
export { extractVersion, formatReleaseTitle, getChangelogContent, createArtifactLink, createReleasePayload, createRelease, } from './release-utils.js';
|
|
10
|
+
export { isDryRunEnabled, getDryRunMode, shouldExecuteChanges, getDryRunConfig, logDryRunAction, logDryRunSkip, } from './dry-run-utils.js';
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/version/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,YAAY,EACZ,cAAc,EACd,aAAa,EACb,WAAW,EACX,iBAAiB,GAGlB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,aAAa,EACb,uBAAuB,EACvB,eAAe,EACf,mBAAmB,EACnB,6BAA6B,GAC9B,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,uBAAuB,EACvB,kBAAkB,EAClB,oBAAoB,EACpB,cAAc,EACd,mBAAmB,EAGnB,YAAY,GACb,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,EACpB,aAAa,GAEd,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,eAAe,EACf,aAAa,EACb,oBAAoB,EACpB,eAAe,EACf,eAAe,EACf,aAAa,GAEd,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GitLab Release Utilities
|
|
3
|
+
*
|
|
4
|
+
* Provides functions for creating GitLab releases with proper formatting,
|
|
5
|
+
* changelog extraction, and artifact linking.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Extract version from tag name (removes 'v' prefix if present)
|
|
9
|
+
*
|
|
10
|
+
* @param tag - Git tag name (e.g., "v1.2.3" or "1.2.3")
|
|
11
|
+
* @returns Version string without 'v' prefix (e.g., "1.2.3")
|
|
12
|
+
*/
|
|
13
|
+
export declare function extractVersion(tag: string): string;
|
|
14
|
+
/**
|
|
15
|
+
* Format release title according to GitLab release conventions.
|
|
16
|
+
*
|
|
17
|
+
* Format: "Release v{version}"
|
|
18
|
+
* Example: "Release v1.2.3"
|
|
19
|
+
*
|
|
20
|
+
* @param tag - Git tag name (e.g., "v1.2.3" or "1.2.3")
|
|
21
|
+
* @returns Formatted release title
|
|
22
|
+
*/
|
|
23
|
+
export declare function formatReleaseTitle(tag: string): string;
|
|
24
|
+
/**
|
|
25
|
+
* Read and extract changelog content for the release.
|
|
26
|
+
*
|
|
27
|
+
* Extracts the most recent version section from CHANGELOG.md.
|
|
28
|
+
* The function looks for content between the first ## heading and the next ## heading.
|
|
29
|
+
*
|
|
30
|
+
* @param changelogPath - Path to CHANGELOG.md file (defaults to ./CHANGELOG.md)
|
|
31
|
+
* @returns Changelog content for the most recent version, or default message if not found
|
|
32
|
+
*/
|
|
33
|
+
export declare function getChangelogContent(changelogPath?: string): string;
|
|
34
|
+
/**
|
|
35
|
+
* Create artifact link for dist/ directory.
|
|
36
|
+
*
|
|
37
|
+
* Creates a GitLab release asset link that points to the job artifacts download URL.
|
|
38
|
+
*
|
|
39
|
+
* @param projectUrl - GitLab project URL (e.g., "https://gitlab.com/user/project")
|
|
40
|
+
* @param jobId - GitLab CI job ID
|
|
41
|
+
* @returns Asset link object for GitLab Release API
|
|
42
|
+
*/
|
|
43
|
+
export declare function createArtifactLink(projectUrl: string, jobId: string): {
|
|
44
|
+
name: string;
|
|
45
|
+
url: string;
|
|
46
|
+
link_type: string;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* GitLab Release API payload structure
|
|
50
|
+
*/
|
|
51
|
+
export interface GitLabReleasePayload {
|
|
52
|
+
tag_name: string;
|
|
53
|
+
name: string;
|
|
54
|
+
description: string;
|
|
55
|
+
assets: {
|
|
56
|
+
links: Array<{
|
|
57
|
+
name: string;
|
|
58
|
+
url: string;
|
|
59
|
+
link_type: string;
|
|
60
|
+
}>;
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Create GitLab release payload.
|
|
65
|
+
*
|
|
66
|
+
* Constructs the payload object for the GitLab Release API.
|
|
67
|
+
*
|
|
68
|
+
* @param tagName - Git tag name (e.g., "v1.2.3")
|
|
69
|
+
* @param releaseName - Release title (e.g., "Release v1.2.3")
|
|
70
|
+
* @param description - Release description (changelog content)
|
|
71
|
+
* @param assetLinks - Array of asset links
|
|
72
|
+
* @returns GitLab Release API payload
|
|
73
|
+
*/
|
|
74
|
+
export declare function createReleasePayload(tagName: string, releaseName: string, description: string, assetLinks: Array<{
|
|
75
|
+
name: string;
|
|
76
|
+
url: string;
|
|
77
|
+
link_type: string;
|
|
78
|
+
}>): GitLabReleasePayload;
|
|
79
|
+
/**
|
|
80
|
+
* Create GitLab release using the API.
|
|
81
|
+
*
|
|
82
|
+
* Makes a POST request to the GitLab Release API to create a new release.
|
|
83
|
+
* Handles common error cases including duplicate releases, authentication failures,
|
|
84
|
+
* and not found errors.
|
|
85
|
+
*
|
|
86
|
+
* @param apiUrl - GitLab API v4 URL (e.g., "https://gitlab.com/api/v4")
|
|
87
|
+
* @param projectId - GitLab project ID
|
|
88
|
+
* @param token - GitLab authentication token (CI_JOB_TOKEN)
|
|
89
|
+
* @param payload - Release payload object
|
|
90
|
+
* @returns Promise that resolves when release is created
|
|
91
|
+
* @throws Error if release creation fails
|
|
92
|
+
*/
|
|
93
|
+
export declare function createRelease(apiUrl: string, projectId: string, token: string, payload: GitLabReleasePayload): Promise<void>;
|
|
94
|
+
//# sourceMappingURL=release-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"release-utils.d.ts","sourceRoot":"","sources":["../../src/version/release-utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAElD;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAGtD;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,CA6ClE;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,MAAM,GACZ;IACD,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;CACnB,CAMA;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE;QACN,KAAK,EAAE,KAAK,CAAC;YACX,IAAI,EAAE,MAAM,CAAC;YACb,GAAG,EAAE,MAAM,CAAC;YACZ,SAAS,EAAE,MAAM,CAAC;SACnB,CAAC,CAAC;KACJ,CAAC;CACH;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,GAClE,oBAAoB,CAStB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,aAAa,CACjC,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,IAAI,CAAC,CAiDf"}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GitLab Release Utilities
|
|
3
|
+
*
|
|
4
|
+
* Provides functions for creating GitLab releases with proper formatting,
|
|
5
|
+
* changelog extraction, and artifact linking.
|
|
6
|
+
*/
|
|
7
|
+
import { readFileSync } from 'node:fs';
|
|
8
|
+
import { resolve } from 'node:path';
|
|
9
|
+
/**
|
|
10
|
+
* Extract version from tag name (removes 'v' prefix if present)
|
|
11
|
+
*
|
|
12
|
+
* @param tag - Git tag name (e.g., "v1.2.3" or "1.2.3")
|
|
13
|
+
* @returns Version string without 'v' prefix (e.g., "1.2.3")
|
|
14
|
+
*/
|
|
15
|
+
export function extractVersion(tag) {
|
|
16
|
+
return tag.startsWith('v') ? tag.substring(1) : tag;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Format release title according to GitLab release conventions.
|
|
20
|
+
*
|
|
21
|
+
* Format: "Release v{version}"
|
|
22
|
+
* Example: "Release v1.2.3"
|
|
23
|
+
*
|
|
24
|
+
* @param tag - Git tag name (e.g., "v1.2.3" or "1.2.3")
|
|
25
|
+
* @returns Formatted release title
|
|
26
|
+
*/
|
|
27
|
+
export function formatReleaseTitle(tag) {
|
|
28
|
+
const version = extractVersion(tag);
|
|
29
|
+
return `Release v${version}`;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Read and extract changelog content for the release.
|
|
33
|
+
*
|
|
34
|
+
* Extracts the most recent version section from CHANGELOG.md.
|
|
35
|
+
* The function looks for content between the first ## heading and the next ## heading.
|
|
36
|
+
*
|
|
37
|
+
* @param changelogPath - Path to CHANGELOG.md file (defaults to ./CHANGELOG.md)
|
|
38
|
+
* @returns Changelog content for the most recent version, or default message if not found
|
|
39
|
+
*/
|
|
40
|
+
export function getChangelogContent(changelogPath) {
|
|
41
|
+
const path = changelogPath || resolve(process.cwd(), 'CHANGELOG.md');
|
|
42
|
+
try {
|
|
43
|
+
const content = readFileSync(path, 'utf-8');
|
|
44
|
+
// Extract the first version section (most recent)
|
|
45
|
+
// Look for content between the first ## heading and the next ## heading
|
|
46
|
+
const lines = content.split('\n');
|
|
47
|
+
const releaseLines = [];
|
|
48
|
+
let inReleaseSection = false;
|
|
49
|
+
let foundFirstHeading = false;
|
|
50
|
+
for (const line of lines) {
|
|
51
|
+
// Skip the main title (# Changelog)
|
|
52
|
+
if (line.startsWith('# ')) {
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
// Start capturing when we hit the first ## heading
|
|
56
|
+
if (line.startsWith('## ')) {
|
|
57
|
+
if (!foundFirstHeading) {
|
|
58
|
+
foundFirstHeading = true;
|
|
59
|
+
inReleaseSection = true;
|
|
60
|
+
releaseLines.push(line);
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
// Stop when we hit the second ## heading
|
|
65
|
+
break;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
if (inReleaseSection) {
|
|
69
|
+
releaseLines.push(line);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
if (releaseLines.length === 0) {
|
|
73
|
+
return 'Release notes not available.';
|
|
74
|
+
}
|
|
75
|
+
return releaseLines.join('\n').trim();
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
return 'Release notes not available.';
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Create artifact link for dist/ directory.
|
|
83
|
+
*
|
|
84
|
+
* Creates a GitLab release asset link that points to the job artifacts download URL.
|
|
85
|
+
*
|
|
86
|
+
* @param projectUrl - GitLab project URL (e.g., "https://gitlab.com/user/project")
|
|
87
|
+
* @param jobId - GitLab CI job ID
|
|
88
|
+
* @returns Asset link object for GitLab Release API
|
|
89
|
+
*/
|
|
90
|
+
export function createArtifactLink(projectUrl, jobId) {
|
|
91
|
+
return {
|
|
92
|
+
name: 'dist',
|
|
93
|
+
url: `${projectUrl}/-/jobs/${jobId}/artifacts/download`,
|
|
94
|
+
link_type: 'package',
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Create GitLab release payload.
|
|
99
|
+
*
|
|
100
|
+
* Constructs the payload object for the GitLab Release API.
|
|
101
|
+
*
|
|
102
|
+
* @param tagName - Git tag name (e.g., "v1.2.3")
|
|
103
|
+
* @param releaseName - Release title (e.g., "Release v1.2.3")
|
|
104
|
+
* @param description - Release description (changelog content)
|
|
105
|
+
* @param assetLinks - Array of asset links
|
|
106
|
+
* @returns GitLab Release API payload
|
|
107
|
+
*/
|
|
108
|
+
export function createReleasePayload(tagName, releaseName, description, assetLinks) {
|
|
109
|
+
return {
|
|
110
|
+
tag_name: tagName,
|
|
111
|
+
name: releaseName,
|
|
112
|
+
description: description,
|
|
113
|
+
assets: {
|
|
114
|
+
links: assetLinks,
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Create GitLab release using the API.
|
|
120
|
+
*
|
|
121
|
+
* Makes a POST request to the GitLab Release API to create a new release.
|
|
122
|
+
* Handles common error cases including duplicate releases, authentication failures,
|
|
123
|
+
* and not found errors.
|
|
124
|
+
*
|
|
125
|
+
* @param apiUrl - GitLab API v4 URL (e.g., "https://gitlab.com/api/v4")
|
|
126
|
+
* @param projectId - GitLab project ID
|
|
127
|
+
* @param token - GitLab authentication token (CI_JOB_TOKEN)
|
|
128
|
+
* @param payload - Release payload object
|
|
129
|
+
* @returns Promise that resolves when release is created
|
|
130
|
+
* @throws Error if release creation fails
|
|
131
|
+
*/
|
|
132
|
+
export async function createRelease(apiUrl, projectId, token, payload) {
|
|
133
|
+
const releaseUrl = `${apiUrl}/projects/${encodeURIComponent(projectId)}/releases`;
|
|
134
|
+
const response = await fetch(releaseUrl, {
|
|
135
|
+
method: 'POST',
|
|
136
|
+
headers: {
|
|
137
|
+
'Content-Type': 'application/json',
|
|
138
|
+
'JOB-TOKEN': token,
|
|
139
|
+
},
|
|
140
|
+
body: JSON.stringify(payload),
|
|
141
|
+
});
|
|
142
|
+
if (!response.ok) {
|
|
143
|
+
const errorText = await response.text();
|
|
144
|
+
// Check for duplicate release (409 Conflict) - this is idempotent
|
|
145
|
+
if (response.status === 409) {
|
|
146
|
+
// Don't throw error for duplicate - just return silently
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
// Check for authentication errors
|
|
150
|
+
if (response.status === 401 || response.status === 403) {
|
|
151
|
+
throw new Error(`Authentication failed: ${response.status} ${response.statusText}\n` +
|
|
152
|
+
'Possible causes:\n' +
|
|
153
|
+
' - Invalid or expired CI_JOB_TOKEN\n' +
|
|
154
|
+
' - Insufficient permissions to create releases\n' +
|
|
155
|
+
' - Token does not have api scope');
|
|
156
|
+
}
|
|
157
|
+
// Check for not found (invalid project or tag)
|
|
158
|
+
if (response.status === 404) {
|
|
159
|
+
throw new Error(`Not found: ${response.status} ${response.statusText}\n` +
|
|
160
|
+
'Possible causes:\n' +
|
|
161
|
+
` - Project ID ${projectId} does not exist\n` +
|
|
162
|
+
` - Tag ${payload.tag_name} does not exist\n` +
|
|
163
|
+
' - Insufficient permissions to access the project');
|
|
164
|
+
}
|
|
165
|
+
// Generic error
|
|
166
|
+
throw new Error(`Failed to create release: ${response.status} ${response.statusText}\n` +
|
|
167
|
+
`Response: ${errorText}`);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
//# sourceMappingURL=release-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"release-utils.js","sourceRoot":"","sources":["../../src/version/release-utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,GAAW;IACxC,OAAO,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;AACtD,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,kBAAkB,CAAC,GAAW;IAC5C,MAAM,OAAO,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC;IACpC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AG,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;YACvD,MAAM,IAAI,KAAK,CACb,0BAA0B,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,UAAU,IAAI;gBAClE,oBAAoB;gBACpB,uCAAuC;gBACvC,mDAAmD;gBACnD,mCAAmC,CACtC,CAAC;QACJ,CAAC;QAED,+CAA+C;QAC/C,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;YAC5B,MAAM,IAAI,KAAK,CACb,cAAc,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,UAAU,IAAI;gBACtD,oBAAoB;gBACpB,kBAAkB,SAAS,mBAAmB;gBAC9C,WAAW,OAAO,CAAC,QAAQ,mBAAmB;gBAC9C,oDAAoD,CACvD,CAAC;QACJ,CAAC;QAED,gBAAgB;QAChB,MAAM,IAAI,KAAK,CACb,6BAA6B,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,UAAU,IAAI;YACrE,aAAa,SAAS,EAAE,CAC3B,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rollback Utilities
|
|
3
|
+
*
|
|
4
|
+
* Provides functions for rolling back to previous versions.
|
|
5
|
+
* Validates: Requirements 11.1, 11.2, 11.3, 11.5
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Result of a rollback validation
|
|
9
|
+
*/
|
|
10
|
+
export interface RollbackValidationResult {
|
|
11
|
+
valid: boolean;
|
|
12
|
+
error?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Validates a rollback version string.
|
|
16
|
+
*
|
|
17
|
+
* Checks:
|
|
18
|
+
* - Version format is valid
|
|
19
|
+
* - Version is not the current version
|
|
20
|
+
*
|
|
21
|
+
* @param rollbackVersion - The version to rollback to
|
|
22
|
+
* @param currentVersion - The current version
|
|
23
|
+
* @returns Validation result with error message if invalid
|
|
24
|
+
*
|
|
25
|
+
* Validates: Requirements 11.1, 11.2
|
|
26
|
+
*/
|
|
27
|
+
export declare function validateRollbackVersion(rollbackVersion: string, currentVersion: string): RollbackValidationResult;
|
|
28
|
+
/**
|
|
29
|
+
* Formats a rollback changelog entry.
|
|
30
|
+
*
|
|
31
|
+
* @param version - The version being rolled back to
|
|
32
|
+
* @param reason - Optional reason for the rollback
|
|
33
|
+
* @returns Formatted changelog entry
|
|
34
|
+
*
|
|
35
|
+
* Validates: Requirements 11.5
|
|
36
|
+
*/
|
|
37
|
+
export declare function formatRollbackChangelogEntry(version: string, reason?: string): string;
|
|
38
|
+
/**
|
|
39
|
+
* Generates a Git tag name for a rollback.
|
|
40
|
+
*
|
|
41
|
+
* @param version - The version being rolled back to
|
|
42
|
+
* @returns Git tag name (e.g., "v1.2.3")
|
|
43
|
+
*
|
|
44
|
+
* Validates: Requirements 11.3
|
|
45
|
+
*/
|
|
46
|
+
export declare function generateRollbackTag(version: string): string;
|
|
47
|
+
//# sourceMappingURL=rollback-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rollback-utils.d.ts","sourceRoot":"","sources":["../../src/version/rollback-utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,uBAAuB,CACrC,eAAe,EAAE,MAAM,EACvB,cAAc,EAAE,MAAM,GACrB,wBAAwB,CAqB1B;AAED;;;;;;;;GAQG;AACH,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,MAAM,GACd,MAAM,CAeR;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAG3D"}
|