@contractspec/lib.contracts 1.45.2 → 1.45.4

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.
@@ -2,47 +2,47 @@ import { AnyOperationSpec, OperationSpec } from "../operations/operation.js";
2
2
  import { OperationSpecRegistry } from "../operations/registry.js";
3
3
  import "../operations/index.js";
4
4
  import "../index.js";
5
- import * as _contractspec_lib_schema102 from "@contractspec/lib.schema";
5
+ import * as _contractspec_lib_schema155 from "@contractspec/lib.schema";
6
6
  import { SchemaModel } from "@contractspec/lib.schema";
7
7
 
8
8
  //#region src/knowledge/operations.d.ts
9
9
  declare const CreateKnowledgeSource: OperationSpec<SchemaModel<{
10
10
  tenantId: {
11
- type: _contractspec_lib_schema102.FieldType<string, string>;
11
+ type: _contractspec_lib_schema155.FieldType<string, string>;
12
12
  isOptional: false;
13
13
  };
14
14
  spaceKey: {
15
- type: _contractspec_lib_schema102.FieldType<string, string>;
15
+ type: _contractspec_lib_schema155.FieldType<string, string>;
16
16
  isOptional: false;
17
17
  };
18
18
  spaceVersion: {
19
- type: _contractspec_lib_schema102.FieldType<string, string>;
19
+ type: _contractspec_lib_schema155.FieldType<string, string>;
20
20
  isOptional: false;
21
21
  };
22
22
  label: {
23
- type: _contractspec_lib_schema102.FieldType<string, string>;
23
+ type: _contractspec_lib_schema155.FieldType<string, string>;
24
24
  isOptional: false;
25
25
  };
26
26
  sourceType: {
27
- type: _contractspec_lib_schema102.FieldType<string, string>;
27
+ type: _contractspec_lib_schema155.FieldType<string, string>;
28
28
  isOptional: false;
29
29
  };
30
30
  config: {
31
- type: _contractspec_lib_schema102.FieldType<Record<string, unknown>, Record<string, unknown>>;
31
+ type: _contractspec_lib_schema155.FieldType<Record<string, unknown>, Record<string, unknown>>;
32
32
  isOptional: false;
33
33
  };
34
34
  syncSchedule: {
35
35
  type: SchemaModel<{
36
36
  enabled: {
37
- type: _contractspec_lib_schema102.FieldType<boolean, boolean>;
37
+ type: _contractspec_lib_schema155.FieldType<boolean, boolean>;
38
38
  isOptional: false;
39
39
  };
40
40
  cron: {
41
- type: _contractspec_lib_schema102.FieldType<string, string>;
41
+ type: _contractspec_lib_schema155.FieldType<string, string>;
42
42
  isOptional: true;
43
43
  };
44
44
  intervalMs: {
45
- type: _contractspec_lib_schema102.FieldType<number, number>;
45
+ type: _contractspec_lib_schema155.FieldType<number, number>;
46
46
  isOptional: true;
47
47
  };
48
48
  }>;
@@ -50,92 +50,92 @@ declare const CreateKnowledgeSource: OperationSpec<SchemaModel<{
50
50
  };
51
51
  }>, SchemaModel<{
52
52
  id: {
53
- type: _contractspec_lib_schema102.FieldType<string, string>;
53
+ type: _contractspec_lib_schema155.FieldType<string, string>;
54
54
  isOptional: false;
55
55
  };
56
56
  tenantId: {
57
- type: _contractspec_lib_schema102.FieldType<string, string>;
57
+ type: _contractspec_lib_schema155.FieldType<string, string>;
58
58
  isOptional: false;
59
59
  };
60
60
  spaceKey: {
61
- type: _contractspec_lib_schema102.FieldType<string, string>;
61
+ type: _contractspec_lib_schema155.FieldType<string, string>;
62
62
  isOptional: false;
63
63
  };
64
64
  spaceVersion: {
65
- type: _contractspec_lib_schema102.FieldType<string, string>;
65
+ type: _contractspec_lib_schema155.FieldType<string, string>;
66
66
  isOptional: false;
67
67
  };
68
68
  label: {
69
- type: _contractspec_lib_schema102.FieldType<string, string>;
69
+ type: _contractspec_lib_schema155.FieldType<string, string>;
70
70
  isOptional: false;
71
71
  };
72
72
  sourceType: {
73
- type: _contractspec_lib_schema102.FieldType<string, string>;
73
+ type: _contractspec_lib_schema155.FieldType<string, string>;
74
74
  isOptional: false;
75
75
  };
76
76
  syncSchedule: {
77
77
  type: SchemaModel<{
78
78
  enabled: {
79
- type: _contractspec_lib_schema102.FieldType<boolean, boolean>;
79
+ type: _contractspec_lib_schema155.FieldType<boolean, boolean>;
80
80
  isOptional: false;
81
81
  };
82
82
  cron: {
83
- type: _contractspec_lib_schema102.FieldType<string, string>;
83
+ type: _contractspec_lib_schema155.FieldType<string, string>;
84
84
  isOptional: true;
85
85
  };
86
86
  intervalMs: {
87
- type: _contractspec_lib_schema102.FieldType<number, number>;
87
+ type: _contractspec_lib_schema155.FieldType<number, number>;
88
88
  isOptional: true;
89
89
  };
90
90
  }>;
91
91
  isOptional: true;
92
92
  };
93
93
  lastSyncStatus: {
94
- type: _contractspec_lib_schema102.FieldType<string, string>;
94
+ type: _contractspec_lib_schema155.FieldType<string, string>;
95
95
  isOptional: true;
96
96
  };
97
97
  lastSyncAt: {
98
- type: _contractspec_lib_schema102.FieldType<Date, string>;
98
+ type: _contractspec_lib_schema155.FieldType<Date, string>;
99
99
  isOptional: true;
100
100
  };
101
101
  itemsProcessed: {
102
- type: _contractspec_lib_schema102.FieldType<number, number>;
102
+ type: _contractspec_lib_schema155.FieldType<number, number>;
103
103
  isOptional: true;
104
104
  };
105
105
  createdAt: {
106
- type: _contractspec_lib_schema102.FieldType<Date, string>;
106
+ type: _contractspec_lib_schema155.FieldType<Date, string>;
107
107
  isOptional: true;
108
108
  };
109
109
  updatedAt: {
110
- type: _contractspec_lib_schema102.FieldType<Date, string>;
110
+ type: _contractspec_lib_schema155.FieldType<Date, string>;
111
111
  isOptional: true;
112
112
  };
113
113
  }>, undefined>;
114
114
  declare const UpdateKnowledgeSource: OperationSpec<SchemaModel<{
115
115
  sourceId: {
116
- type: _contractspec_lib_schema102.FieldType<string, string>;
116
+ type: _contractspec_lib_schema155.FieldType<string, string>;
117
117
  isOptional: false;
118
118
  };
119
119
  label: {
120
- type: _contractspec_lib_schema102.FieldType<string, string>;
120
+ type: _contractspec_lib_schema155.FieldType<string, string>;
121
121
  isOptional: true;
122
122
  };
123
123
  config: {
124
- type: _contractspec_lib_schema102.FieldType<Record<string, unknown>, Record<string, unknown>>;
124
+ type: _contractspec_lib_schema155.FieldType<Record<string, unknown>, Record<string, unknown>>;
125
125
  isOptional: true;
126
126
  };
127
127
  syncSchedule: {
128
128
  type: SchemaModel<{
129
129
  enabled: {
130
- type: _contractspec_lib_schema102.FieldType<boolean, boolean>;
130
+ type: _contractspec_lib_schema155.FieldType<boolean, boolean>;
131
131
  isOptional: false;
132
132
  };
133
133
  cron: {
134
- type: _contractspec_lib_schema102.FieldType<string, string>;
134
+ type: _contractspec_lib_schema155.FieldType<string, string>;
135
135
  isOptional: true;
136
136
  };
137
137
  intervalMs: {
138
- type: _contractspec_lib_schema102.FieldType<number, number>;
138
+ type: _contractspec_lib_schema155.FieldType<number, number>;
139
139
  isOptional: true;
140
140
  };
141
141
  }>;
@@ -143,149 +143,149 @@ declare const UpdateKnowledgeSource: OperationSpec<SchemaModel<{
143
143
  };
144
144
  }>, SchemaModel<{
145
145
  id: {
146
- type: _contractspec_lib_schema102.FieldType<string, string>;
146
+ type: _contractspec_lib_schema155.FieldType<string, string>;
147
147
  isOptional: false;
148
148
  };
149
149
  tenantId: {
150
- type: _contractspec_lib_schema102.FieldType<string, string>;
150
+ type: _contractspec_lib_schema155.FieldType<string, string>;
151
151
  isOptional: false;
152
152
  };
153
153
  spaceKey: {
154
- type: _contractspec_lib_schema102.FieldType<string, string>;
154
+ type: _contractspec_lib_schema155.FieldType<string, string>;
155
155
  isOptional: false;
156
156
  };
157
157
  spaceVersion: {
158
- type: _contractspec_lib_schema102.FieldType<string, string>;
158
+ type: _contractspec_lib_schema155.FieldType<string, string>;
159
159
  isOptional: false;
160
160
  };
161
161
  label: {
162
- type: _contractspec_lib_schema102.FieldType<string, string>;
162
+ type: _contractspec_lib_schema155.FieldType<string, string>;
163
163
  isOptional: false;
164
164
  };
165
165
  sourceType: {
166
- type: _contractspec_lib_schema102.FieldType<string, string>;
166
+ type: _contractspec_lib_schema155.FieldType<string, string>;
167
167
  isOptional: false;
168
168
  };
169
169
  syncSchedule: {
170
170
  type: SchemaModel<{
171
171
  enabled: {
172
- type: _contractspec_lib_schema102.FieldType<boolean, boolean>;
172
+ type: _contractspec_lib_schema155.FieldType<boolean, boolean>;
173
173
  isOptional: false;
174
174
  };
175
175
  cron: {
176
- type: _contractspec_lib_schema102.FieldType<string, string>;
176
+ type: _contractspec_lib_schema155.FieldType<string, string>;
177
177
  isOptional: true;
178
178
  };
179
179
  intervalMs: {
180
- type: _contractspec_lib_schema102.FieldType<number, number>;
180
+ type: _contractspec_lib_schema155.FieldType<number, number>;
181
181
  isOptional: true;
182
182
  };
183
183
  }>;
184
184
  isOptional: true;
185
185
  };
186
186
  lastSyncStatus: {
187
- type: _contractspec_lib_schema102.FieldType<string, string>;
187
+ type: _contractspec_lib_schema155.FieldType<string, string>;
188
188
  isOptional: true;
189
189
  };
190
190
  lastSyncAt: {
191
- type: _contractspec_lib_schema102.FieldType<Date, string>;
191
+ type: _contractspec_lib_schema155.FieldType<Date, string>;
192
192
  isOptional: true;
193
193
  };
194
194
  itemsProcessed: {
195
- type: _contractspec_lib_schema102.FieldType<number, number>;
195
+ type: _contractspec_lib_schema155.FieldType<number, number>;
196
196
  isOptional: true;
197
197
  };
198
198
  createdAt: {
199
- type: _contractspec_lib_schema102.FieldType<Date, string>;
199
+ type: _contractspec_lib_schema155.FieldType<Date, string>;
200
200
  isOptional: true;
201
201
  };
202
202
  updatedAt: {
203
- type: _contractspec_lib_schema102.FieldType<Date, string>;
203
+ type: _contractspec_lib_schema155.FieldType<Date, string>;
204
204
  isOptional: true;
205
205
  };
206
206
  }>, undefined>;
207
207
  declare const DeleteKnowledgeSource: OperationSpec<SchemaModel<{
208
208
  sourceId: {
209
- type: _contractspec_lib_schema102.FieldType<string, string>;
209
+ type: _contractspec_lib_schema155.FieldType<string, string>;
210
210
  isOptional: false;
211
211
  };
212
212
  }>, SchemaModel<{
213
213
  success: {
214
- type: _contractspec_lib_schema102.FieldType<boolean, boolean>;
214
+ type: _contractspec_lib_schema155.FieldType<boolean, boolean>;
215
215
  isOptional: false;
216
216
  };
217
217
  }>, undefined>;
218
218
  declare const ListKnowledgeSources: OperationSpec<SchemaModel<{
219
219
  tenantId: {
220
- type: _contractspec_lib_schema102.FieldType<string, string>;
220
+ type: _contractspec_lib_schema155.FieldType<string, string>;
221
221
  isOptional: false;
222
222
  };
223
223
  spaceKey: {
224
- type: _contractspec_lib_schema102.FieldType<string, string>;
224
+ type: _contractspec_lib_schema155.FieldType<string, string>;
225
225
  isOptional: true;
226
226
  };
227
227
  }>, SchemaModel<{
228
228
  sources: {
229
229
  type: SchemaModel<{
230
230
  id: {
231
- type: _contractspec_lib_schema102.FieldType<string, string>;
231
+ type: _contractspec_lib_schema155.FieldType<string, string>;
232
232
  isOptional: false;
233
233
  };
234
234
  tenantId: {
235
- type: _contractspec_lib_schema102.FieldType<string, string>;
235
+ type: _contractspec_lib_schema155.FieldType<string, string>;
236
236
  isOptional: false;
237
237
  };
238
238
  spaceKey: {
239
- type: _contractspec_lib_schema102.FieldType<string, string>;
239
+ type: _contractspec_lib_schema155.FieldType<string, string>;
240
240
  isOptional: false;
241
241
  };
242
242
  spaceVersion: {
243
- type: _contractspec_lib_schema102.FieldType<string, string>;
243
+ type: _contractspec_lib_schema155.FieldType<string, string>;
244
244
  isOptional: false;
245
245
  };
246
246
  label: {
247
- type: _contractspec_lib_schema102.FieldType<string, string>;
247
+ type: _contractspec_lib_schema155.FieldType<string, string>;
248
248
  isOptional: false;
249
249
  };
250
250
  sourceType: {
251
- type: _contractspec_lib_schema102.FieldType<string, string>;
251
+ type: _contractspec_lib_schema155.FieldType<string, string>;
252
252
  isOptional: false;
253
253
  };
254
254
  syncSchedule: {
255
255
  type: SchemaModel<{
256
256
  enabled: {
257
- type: _contractspec_lib_schema102.FieldType<boolean, boolean>;
257
+ type: _contractspec_lib_schema155.FieldType<boolean, boolean>;
258
258
  isOptional: false;
259
259
  };
260
260
  cron: {
261
- type: _contractspec_lib_schema102.FieldType<string, string>;
261
+ type: _contractspec_lib_schema155.FieldType<string, string>;
262
262
  isOptional: true;
263
263
  };
264
264
  intervalMs: {
265
- type: _contractspec_lib_schema102.FieldType<number, number>;
265
+ type: _contractspec_lib_schema155.FieldType<number, number>;
266
266
  isOptional: true;
267
267
  };
268
268
  }>;
269
269
  isOptional: true;
270
270
  };
271
271
  lastSyncStatus: {
272
- type: _contractspec_lib_schema102.FieldType<string, string>;
272
+ type: _contractspec_lib_schema155.FieldType<string, string>;
273
273
  isOptional: true;
274
274
  };
275
275
  lastSyncAt: {
276
- type: _contractspec_lib_schema102.FieldType<Date, string>;
276
+ type: _contractspec_lib_schema155.FieldType<Date, string>;
277
277
  isOptional: true;
278
278
  };
279
279
  itemsProcessed: {
280
- type: _contractspec_lib_schema102.FieldType<number, number>;
280
+ type: _contractspec_lib_schema155.FieldType<number, number>;
281
281
  isOptional: true;
282
282
  };
283
283
  createdAt: {
284
- type: _contractspec_lib_schema102.FieldType<Date, string>;
284
+ type: _contractspec_lib_schema155.FieldType<Date, string>;
285
285
  isOptional: true;
286
286
  };
287
287
  updatedAt: {
288
- type: _contractspec_lib_schema102.FieldType<Date, string>;
288
+ type: _contractspec_lib_schema155.FieldType<Date, string>;
289
289
  isOptional: true;
290
290
  };
291
291
  }>;
@@ -295,20 +295,20 @@ declare const ListKnowledgeSources: OperationSpec<SchemaModel<{
295
295
  }>, undefined>;
296
296
  declare const TriggerKnowledgeSourceSync: OperationSpec<SchemaModel<{
297
297
  sourceId: {
298
- type: _contractspec_lib_schema102.FieldType<string, string>;
298
+ type: _contractspec_lib_schema155.FieldType<string, string>;
299
299
  isOptional: false;
300
300
  };
301
301
  }>, SchemaModel<{
302
302
  success: {
303
- type: _contractspec_lib_schema102.FieldType<boolean, boolean>;
303
+ type: _contractspec_lib_schema155.FieldType<boolean, boolean>;
304
304
  isOptional: false;
305
305
  };
306
306
  itemsProcessed: {
307
- type: _contractspec_lib_schema102.FieldType<number, number>;
307
+ type: _contractspec_lib_schema155.FieldType<number, number>;
308
308
  isOptional: true;
309
309
  };
310
310
  error: {
311
- type: _contractspec_lib_schema102.FieldType<string, string>;
311
+ type: _contractspec_lib_schema155.FieldType<string, string>;
312
312
  isOptional: true;
313
313
  };
314
314
  }>, undefined>;
@@ -0,0 +1,3 @@
1
+ import { ChangeEntry, ChangeType, ChangelogDocBlock, ChangelogEntry, ChangelogJsonExport, ChangelogResult, SemanticVersion, VersionAnalysis, VersionAnalysisResult, VersionBumpType, isChangeType, isChangelogDocBlock, isVersionBumpType } from "./types.js";
2
+ import { bumpVersion, compareVersions, determineBumpType, formatVersion, getBumpTypePriority, getMaxBumpType, isValidVersion, isVersionEqual, isVersionGreater, isVersionLess, parseVersion, parseVersionStrict, validateVersion } from "./utils.js";
3
+ export { ChangeEntry, ChangeType, ChangelogDocBlock, ChangelogEntry, ChangelogJsonExport, ChangelogResult, SemanticVersion, VersionAnalysis, VersionAnalysisResult, VersionBumpType, bumpVersion, compareVersions, determineBumpType, formatVersion, getBumpTypePriority, getMaxBumpType, isChangeType, isChangelogDocBlock, isValidVersion, isVersionBumpType, isVersionEqual, isVersionGreater, isVersionLess, parseVersion, parseVersionStrict, validateVersion };
@@ -0,0 +1,4 @@
1
+ import { isChangeType, isChangelogDocBlock, isVersionBumpType } from "./types.js";
2
+ import { bumpVersion, compareVersions, determineBumpType, formatVersion, getBumpTypePriority, getMaxBumpType, isValidVersion, isVersionEqual, isVersionGreater, isVersionLess, parseVersion, parseVersionStrict, validateVersion } from "./utils.js";
3
+
4
+ export { bumpVersion, compareVersions, determineBumpType, formatVersion, getBumpTypePriority, getMaxBumpType, isChangeType, isChangelogDocBlock, isValidVersion, isVersionBumpType, isVersionEqual, isVersionGreater, isVersionLess, parseVersion, parseVersionStrict, validateVersion };
@@ -0,0 +1,127 @@
1
+ import { DocBlock } from "../docs/types.js";
2
+
3
+ //#region src/versioning/types.d.ts
4
+
5
+ /** Version bump type based on semantic versioning */
6
+ type VersionBumpType = 'patch' | 'minor' | 'major';
7
+ /** Semantic version components */
8
+ interface SemanticVersion {
9
+ major: number;
10
+ minor: number;
11
+ patch: number;
12
+ prerelease?: string;
13
+ build?: string;
14
+ }
15
+ /** Type of change for changelog entries */
16
+ type ChangeType = 'added' | 'changed' | 'fixed' | 'removed' | 'deprecated' | 'breaking' | 'security';
17
+ /** Individual change entry */
18
+ interface ChangeEntry {
19
+ /** Type of change */
20
+ type: ChangeType;
21
+ /** Human-readable description of the change */
22
+ description: string;
23
+ /** Schema/code path changed (e.g., "io.input.email", "meta.stability") */
24
+ path?: string;
25
+ /** Related issue/ticket reference (e.g., "GH-123", "JIRA-456") */
26
+ issueRef?: string;
27
+ /** Git commit SHA for traceability */
28
+ commitSha?: string;
29
+ /** Author of the change */
30
+ author?: string;
31
+ }
32
+ /** Changelog entry for a specific version */
33
+ interface ChangelogEntry {
34
+ /** Version number (semver format) */
35
+ version: string;
36
+ /** Release date (ISO 8601 format) */
37
+ date: string;
38
+ /** Type of version bump that led to this version */
39
+ bumpType: VersionBumpType;
40
+ /** List of changes in this version */
41
+ changes: ChangeEntry[];
42
+ /** Breaking changes (subset for emphasis) */
43
+ breakingChanges?: ChangeEntry[];
44
+ /** Deprecation notices */
45
+ deprecations?: ChangeEntry[];
46
+ /** Contributors to this version */
47
+ contributors?: string[];
48
+ /** Release notes summary */
49
+ summary?: string;
50
+ }
51
+ /** DocBlock extension for per-spec changelogs */
52
+ interface ChangelogDocBlock extends DocBlock {
53
+ /** Changelog-specific kind */
54
+ kind: 'changelog';
55
+ /** Related spec key (e.g., "auth.beginSignup") */
56
+ specKey: string;
57
+ /** Current spec version */
58
+ specVersion: string;
59
+ /** Changelog entries for this spec */
60
+ entries: ChangelogEntry[];
61
+ }
62
+ /** Result of version analysis for a single spec */
63
+ interface VersionAnalysis {
64
+ /** Path to the spec file */
65
+ specPath: string;
66
+ /** Spec key (e.g., "auth.login") */
67
+ specKey: string;
68
+ /** Current version in the spec */
69
+ currentVersion: string;
70
+ /** Suggested new version based on changes */
71
+ suggestedVersion: string;
72
+ /** Suggested bump type */
73
+ bumpType: VersionBumpType;
74
+ /** Detected changes requiring version bump */
75
+ changes: ChangeEntry[];
76
+ /** Whether breaking changes were detected */
77
+ hasBreaking: boolean;
78
+ }
79
+ /** Aggregated version analysis result */
80
+ interface VersionAnalysisResult {
81
+ /** Individual spec analyses */
82
+ analyses: VersionAnalysis[];
83
+ /** Total specs analyzed */
84
+ totalSpecs: number;
85
+ /** Specs needing version bump */
86
+ specsNeedingBump: number;
87
+ /** Total breaking changes across all specs */
88
+ totalBreaking: number;
89
+ /** Git baseline used for comparison */
90
+ baseline?: string;
91
+ }
92
+ /** Result of changelog generation */
93
+ interface ChangelogResult {
94
+ /** Per-spec DocBlock entries */
95
+ specChangelogs: ChangelogDocBlock[];
96
+ /** Library-level markdown by package path */
97
+ libraryMarkdown: Map<string, string>;
98
+ /** Monorepo-level markdown */
99
+ monorepoMarkdown: string;
100
+ /** JSON format for programmatic use */
101
+ json: ChangelogJsonExport;
102
+ }
103
+ /** JSON export format for changelogs */
104
+ interface ChangelogJsonExport {
105
+ generatedAt: string;
106
+ baseline?: string;
107
+ specs: {
108
+ key: string;
109
+ version: string;
110
+ path: string;
111
+ entries: ChangelogEntry[];
112
+ }[];
113
+ libraries: {
114
+ name: string;
115
+ path: string;
116
+ version: string;
117
+ entries: ChangelogEntry[];
118
+ }[];
119
+ }
120
+ /** Check if a DocBlock is a ChangelogDocBlock */
121
+ declare function isChangelogDocBlock(doc: DocBlock): doc is ChangelogDocBlock;
122
+ /** Check if a string is a valid VersionBumpType */
123
+ declare function isVersionBumpType(value: unknown): value is VersionBumpType;
124
+ /** Check if a string is a valid ChangeType */
125
+ declare function isChangeType(value: unknown): value is ChangeType;
126
+ //#endregion
127
+ export { ChangeEntry, ChangeType, ChangelogDocBlock, ChangelogEntry, ChangelogJsonExport, ChangelogResult, SemanticVersion, VersionAnalysis, VersionAnalysisResult, VersionBumpType, isChangeType, isChangelogDocBlock, isVersionBumpType };
@@ -0,0 +1,24 @@
1
+ //#region src/versioning/types.ts
2
+ /** Check if a DocBlock is a ChangelogDocBlock */
3
+ function isChangelogDocBlock(doc) {
4
+ return doc.kind === "changelog" && "specKey" in doc && "entries" in doc;
5
+ }
6
+ /** Check if a string is a valid VersionBumpType */
7
+ function isVersionBumpType(value) {
8
+ return value === "patch" || value === "minor" || value === "major";
9
+ }
10
+ /** Check if a string is a valid ChangeType */
11
+ function isChangeType(value) {
12
+ return typeof value === "string" && [
13
+ "added",
14
+ "changed",
15
+ "fixed",
16
+ "removed",
17
+ "deprecated",
18
+ "breaking",
19
+ "security"
20
+ ].includes(value);
21
+ }
22
+
23
+ //#endregion
24
+ export { isChangeType, isChangelogDocBlock, isVersionBumpType };
@@ -0,0 +1,95 @@
1
+ import { SemanticVersion, VersionBumpType } from "./types.js";
2
+
3
+ //#region src/versioning/utils.d.ts
4
+
5
+ /**
6
+ * Parse a semantic version string into components.
7
+ *
8
+ * @param version - Version string (e.g., "1.2.3", "1.0.0-alpha.1")
9
+ * @returns Parsed SemanticVersion or null if invalid
10
+ *
11
+ * @example
12
+ * parseVersion("1.2.3") // { major: 1, minor: 2, patch: 3 }
13
+ * parseVersion("2.0.0-beta.1") // { major: 2, minor: 0, patch: 0, prerelease: "beta.1" }
14
+ */
15
+ declare function parseVersion(version: string): SemanticVersion | null;
16
+ /**
17
+ * Strictly parse a version, throwing on invalid input.
18
+ *
19
+ * @throws Error if version is not valid semver
20
+ */
21
+ declare function parseVersionStrict(version: string): SemanticVersion;
22
+ /**
23
+ * Format a SemanticVersion back to string.
24
+ *
25
+ * @example
26
+ * formatVersion({ major: 1, minor: 2, patch: 3 }) // "1.2.3"
27
+ * formatVersion({ major: 2, minor: 0, patch: 0, prerelease: "beta.1" }) // "2.0.0-beta.1"
28
+ */
29
+ declare function formatVersion(version: SemanticVersion): string;
30
+ /**
31
+ * Compare two version strings.
32
+ *
33
+ * @returns -1 if a < b, 0 if a === b, 1 if a > b
34
+ *
35
+ * @example
36
+ * compareVersions("1.0.0", "2.0.0") // -1
37
+ * compareVersions("1.2.3", "1.2.3") // 0
38
+ * compareVersions("2.0.0", "1.9.9") // 1
39
+ */
40
+ declare function compareVersions(a: string, b: string): -1 | 0 | 1;
41
+ /**
42
+ * Check if version a is greater than version b.
43
+ */
44
+ declare function isVersionGreater(a: string, b: string): boolean;
45
+ /**
46
+ * Check if version a is less than version b.
47
+ */
48
+ declare function isVersionLess(a: string, b: string): boolean;
49
+ /**
50
+ * Check if two versions are equal.
51
+ */
52
+ declare function isVersionEqual(a: string, b: string): boolean;
53
+ /**
54
+ * Bump a version by the specified type.
55
+ *
56
+ * @param current - Current version string
57
+ * @param bumpType - Type of bump: 'patch', 'minor', or 'major'
58
+ * @returns New version string
59
+ *
60
+ * @example
61
+ * bumpVersion("1.2.3", "patch") // "1.2.4"
62
+ * bumpVersion("1.2.3", "minor") // "1.3.0"
63
+ * bumpVersion("1.2.3", "major") // "2.0.0"
64
+ */
65
+ declare function bumpVersion(current: string, bumpType: VersionBumpType): string;
66
+ /**
67
+ * Determine the appropriate version bump type based on change impact.
68
+ *
69
+ * - Breaking changes → major
70
+ * - Non-breaking additions/changes → minor
71
+ * - Fixes only → patch
72
+ *
73
+ * @param hasBreaking - Whether breaking changes were detected
74
+ * @param hasNonBreaking - Whether non-breaking changes (additions, changes) were detected
75
+ * @returns Appropriate bump type
76
+ */
77
+ declare function determineBumpType(hasBreaking: boolean, hasNonBreaking: boolean): VersionBumpType;
78
+ /**
79
+ * Get sort priority for bump types (higher = more significant).
80
+ */
81
+ declare function getBumpTypePriority(bumpType: VersionBumpType): number;
82
+ /**
83
+ * Get the most significant bump type from a list.
84
+ */
85
+ declare function getMaxBumpType(bumpTypes: VersionBumpType[]): VersionBumpType | null;
86
+ /**
87
+ * Check if a string is a valid semantic version.
88
+ */
89
+ declare function isValidVersion(version: string): boolean;
90
+ /**
91
+ * Validate a version string, returning validation errors.
92
+ */
93
+ declare function validateVersion(version: string): string[];
94
+ //#endregion
95
+ export { bumpVersion, compareVersions, determineBumpType, formatVersion, getBumpTypePriority, getMaxBumpType, isValidVersion, isVersionEqual, isVersionGreater, isVersionLess, parseVersion, parseVersionStrict, validateVersion };