git-semver-tagger 1.9.23 → 1.9.25

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 CHANGED
@@ -31,12 +31,149 @@ tagger calculate-version # Now it should be available via NPM's path on your she
31
31
 
32
32
  The `calculate-version` command will generate a new version number based on all of the commits since the last tag, and output as a string.
33
33
 
34
+ **Basic usage:**
35
+ ```bash
36
+ tagger calculate-version
37
+ ```
38
+
39
+ **Output:** `1.2.3-SNAPSHOT`
40
+
34
41
  ### Tag
35
42
 
36
43
  The `tag` command will create a tag with the given version and push it back to the repository.
37
44
 
38
45
  We recommend this command only is run after the build is validated. Use discernment to decide if it should happen before publication of artifacts, or afterward.
39
46
 
47
+ **Basic usage:**
48
+ ```bash
49
+ tagger tag --version 1.2.3 --release-branch main
50
+ ```
51
+
52
+ ## Structured Output
53
+
54
+ Both commands support machine-readable JSON output for CI/CD pipelines and automation scripts via the `--format` flag.
55
+
56
+ ### Format Options
57
+
58
+ - `--format=text` (default): Human-readable text output
59
+ - `--format=json`: Structured JSON output
60
+
61
+ ### Calculate Version JSON Output
62
+
63
+ **Example command:**
64
+ ```bash
65
+ tagger calculate-version --format=json
66
+ ```
67
+
68
+ **Success response:**
69
+ ```json
70
+ {
71
+ "status": "success",
72
+ "data": {
73
+ "version": "1.2.3-SNAPSHOT",
74
+ "snapshot": true,
75
+ "snapshotReasons": [
76
+ "DIRTY",
77
+ "AHEAD"
78
+ ]
79
+ }
80
+ }
81
+ ```
82
+
83
+ **Error response:**
84
+ ```json
85
+ {
86
+ "status": "error",
87
+ "error": "HEAD is detached (not pointing at any branch)",
88
+ "code": "CONFIGURATION_ERROR"
89
+ }
90
+ ```
91
+
92
+ **Fields:**
93
+ - `status`: `"success"` or `"error"`
94
+ - `data.version`: Calculated semantic version string
95
+ - `data.snapshot`: Boolean indicating if this is a snapshot version
96
+ - `data.snapshotReasons`: Array of reasons why this is a snapshot (e.g., `"DIRTY"`, `"AHEAD"`)
97
+ - `error`: Human-readable error message (only in error responses)
98
+ - `code`: Machine-readable error code (only in error responses)
99
+
100
+ ### Tag JSON Output
101
+
102
+ **Example command:**
103
+ ```bash
104
+ tagger tag --version 1.2.3 --release-branch main --format=json
105
+ ```
106
+
107
+ **Success response:**
108
+ ```json
109
+ {
110
+ "status": "success",
111
+ "data": {
112
+ "tag": "1.2.3"
113
+ }
114
+ }
115
+ ```
116
+
117
+ **Error response:**
118
+ ```json
119
+ {
120
+ "status": "error",
121
+ "error": "Failed to create tag",
122
+ "code": "TAG_ERROR"
123
+ }
124
+ ```
125
+
126
+ **Fields:**
127
+ - `status`: `"success"` or `"error"`
128
+ - `data.tag`: The tag name that was created
129
+ - `error`: Human-readable error message (only in error responses)
130
+ - `code`: Machine-readable error code (only in error responses)
131
+
132
+ ### Error Codes
133
+
134
+ - `CONFIGURATION_ERROR`: Invalid configuration or repository state (e.g., detached HEAD)
135
+ - `TAG_ERROR`: Failed to create or push tag
136
+
137
+ ### CI Integration Examples
138
+
139
+ **Extract version in GitHub Actions:**
140
+ ```yaml
141
+ - name: Calculate version
142
+ id: version
143
+ run: |
144
+ VERSION=$(tagger calculate-version --format=json | jq -r '.data.version')
145
+ echo "version=$VERSION" >> $GITHUB_OUTPUT
146
+
147
+ - name: Use version
148
+ run: echo "Building version ${{ steps.version.outputs.version }}"
149
+ ```
150
+
151
+ **Extract version in bash:**
152
+ ```bash
153
+ # Get version
154
+ VERSION=$(tagger calculate-version --format=json 2>/dev/null | jq -r '.data.version')
155
+
156
+ # Check if snapshot
157
+ IS_SNAPSHOT=$(tagger calculate-version --format=json 2>/dev/null | jq -r '.data.snapshot')
158
+
159
+ if [ "$IS_SNAPSHOT" = "true" ]; then
160
+ echo "This is a snapshot build"
161
+ fi
162
+ ```
163
+
164
+ **Error handling:**
165
+ ```bash
166
+ OUTPUT=$(tagger calculate-version --format=json 2>&1)
167
+ STATUS=$(echo "$OUTPUT" | jq -r '.status')
168
+
169
+ if [ "$STATUS" = "error" ]; then
170
+ ERROR_MSG=$(echo "$OUTPUT" | jq -r '.error')
171
+ ERROR_CODE=$(echo "$OUTPUT" | jq -r '.code')
172
+ echo "Error ($ERROR_CODE): $ERROR_MSG"
173
+ exit 1
174
+ fi
175
+ ```
176
+
40
177
  ### Help
41
178
 
42
179
  For a full listing of the available options in the program, please use the built-in help command.
@@ -66,10 +66,10 @@
66
66
  return new MordantHelpFormatter(it);
67
67
  }
68
68
  function installMordant$lambda$lambda_0(it) {
69
- return MultiplatformSystem_instance.k1y(it);
69
+ return MultiplatformSystem_instance.l1y(it);
70
70
  }
71
71
  function installMordant$lambda$lambda_1(it) {
72
- var tmp0_elvis_lhs = MultiplatformSystem_instance.m1y(it);
72
+ var tmp0_elvis_lhs = MultiplatformSystem_instance.n1y(it);
73
73
  var tmp;
74
74
  if (tmp0_elvis_lhs == null) {
75
75
  throw new FileNotFound(it);
@@ -79,14 +79,14 @@
79
79
  return tmp;
80
80
  }
81
81
  function installMordant$lambda$lambda_2(it) {
82
- MultiplatformSystem_instance.l1y(it);
82
+ MultiplatformSystem_instance.m1y(it);
83
83
  return Unit_instance;
84
84
  }
85
85
  function installMordant$lambda$lambda_3(context, message, trailingNewline, err) {
86
86
  if (trailingNewline) {
87
- get_terminal(context).k28(message, VOID, VOID, VOID, VOID, err);
87
+ get_terminal(context).l28(message, VOID, VOID, VOID, VOID, err);
88
88
  } else {
89
- get_terminal(context).i28(message, VOID, VOID, VOID, VOID, err);
89
+ get_terminal(context).j28(message, VOID, VOID, VOID, VOID, err);
90
90
  }
91
91
  return Unit_instance;
92
92
  }
@@ -117,21 +117,21 @@
117
117
  }
118
118
  function MordantHelpFormatter$formatHelp$lambda(this$0, $error, $prolog, $epilog, $parameters, $programName) {
119
119
  return function ($this$verticalLayout) {
120
- $this$verticalLayout.a25(1);
121
- $this$verticalLayout.x24(this$0.p1i($error, $prolog, $epilog, $parameters, $programName));
120
+ $this$verticalLayout.b25(1);
121
+ $this$verticalLayout.y24(this$0.p1i($error, $prolog, $epilog, $parameters, $programName));
122
122
  return Unit_instance;
123
123
  };
124
124
  }
125
125
  function MordantHelpFormatter$renderUsage$lambda($prog, $usageParts) {
126
126
  return function ($this$definitionList) {
127
- $this$definitionList.u28($prog, Text_init_$Create$($usageParts, Whitespace_NORMAL_getInstance()));
128
- $this$definitionList.o28_1 = true;
129
- $this$definitionList.r28(1);
127
+ $this$definitionList.v28($prog, Text_init_$Create$($usageParts, Whitespace_NORMAL_getInstance()));
128
+ $this$definitionList.p28_1 = true;
129
+ $this$definitionList.s28(1);
130
130
  return Unit_instance;
131
131
  };
132
132
  }
133
133
  function MordantHelpFormatter$renderProlog$lambda($this$withPadding) {
134
- $this$withPadding.x26_1 = 2;
134
+ $this$withPadding.y26_1 = 2;
135
135
  return Unit_instance;
136
136
  }
137
137
  function MordantHelpFormatter$renderParameters$lambda(this$0, $parameters) {
@@ -139,31 +139,31 @@
139
139
  var _iterator__ex2g4s = this$0.c1k($parameters).r();
140
140
  while (_iterator__ex2g4s.s()) {
141
141
  var section = _iterator__ex2g4s.t();
142
- $this$definitionList.u28(section.w1h_1, section.x1h_1);
142
+ $this$definitionList.v28(section.w1h_1, section.x1h_1);
143
143
  }
144
144
  return Unit_instance;
145
145
  };
146
146
  }
147
147
  function MordantHelpFormatter$renderOptionGroup$lambda($this$withPadding) {
148
- $this$withPadding.u26_1 = 1;
149
- $this$withPadding.x26_1 = 2;
150
- $this$withPadding.w26_1 = 1;
148
+ $this$withPadding.v26_1 = 1;
149
+ $this$withPadding.y26_1 = 2;
150
+ $this$withPadding.x26_1 = 1;
151
151
  return Unit_instance;
152
152
  }
153
153
  function MordantHelpFormatter$renderOptionGroup$lambda_0($markdown, this$0, $options) {
154
154
  return function ($this$verticalLayout) {
155
- $this$verticalLayout.z24($markdown);
156
- $this$verticalLayout.z24(this$0.m1k($options));
155
+ $this$verticalLayout.a25($markdown);
156
+ $this$verticalLayout.a25(this$0.m1k($options));
157
157
  return Unit_instance;
158
158
  };
159
159
  }
160
160
  function MordantHelpFormatter$buildParameterList$lambda($rows, this$0) {
161
161
  return function ($this$definitionList) {
162
- $this$definitionList.o28_1 = true;
162
+ $this$definitionList.p28_1 = true;
163
163
  var _iterator__ex2g4s = $rows.r();
164
164
  while (_iterator__ex2g4s.s()) {
165
165
  var row = _iterator__ex2g4s.t();
166
- $this$definitionList.v28(this$0.h1l(row), this$0.i1l(row));
166
+ $this$definitionList.w28(this$0.i1l(row), this$0.j1l(row));
167
167
  }
168
168
  return Unit_instance;
169
169
  };
@@ -174,18 +174,18 @@
174
174
  showRequiredTag = showRequiredTag === VOID ? false : showRequiredTag;
175
175
  AbstractHelpFormatter.call(this, context, requiredOptionMarker, showDefaultValues, showRequiredTag);
176
176
  }
177
- protoOf(MordantHelpFormatter).z29 = function () {
178
- return get_terminal(this.d1i_1).t21_1;
177
+ protoOf(MordantHelpFormatter).a2a = function () {
178
+ return get_terminal(this.d1i_1).u21_1;
179
179
  };
180
180
  protoOf(MordantHelpFormatter).t1b = function (error, prolog, epilog, parameters, programName) {
181
181
  var widget = verticalLayout(MordantHelpFormatter$formatHelp$lambda(this, error, prolog, epilog, parameters, programName));
182
- return get_terminal(this.d1i_1).l28(widget);
182
+ return get_terminal(this.d1i_1).m28(widget);
183
183
  };
184
184
  protoOf(MordantHelpFormatter).r1i = function (parameters, error) {
185
185
  return Text_init_$Create$(this.v1i(parameters, error));
186
186
  };
187
187
  protoOf(MordantHelpFormatter).q1i = function (parameters, programName) {
188
- var title = this.a2a(this.o1i().c1l());
188
+ var title = this.b2a(this.o1i().d1l());
189
189
  var prog = title + ' ' + programName;
190
190
  var usageParts = this.z1i(parameters);
191
191
  var tmp;
@@ -198,11 +198,11 @@
198
198
  return tmp;
199
199
  };
200
200
  protoOf(MordantHelpFormatter).s1i = function (prolog) {
201
- var tmp = this.b2a(prolog);
201
+ var tmp = this.c2a(prolog);
202
202
  return withPadding(tmp, false, MordantHelpFormatter$renderProlog$lambda);
203
203
  };
204
204
  protoOf(MordantHelpFormatter).u1i = function (epilog) {
205
- return this.b2a(epilog);
205
+ return this.c2a(epilog);
206
206
  };
207
207
  protoOf(MordantHelpFormatter).t1i = function (parameters) {
208
208
  return definitionList(MordantHelpFormatter$renderParameters$lambda(this, parameters));
@@ -220,7 +220,7 @@
220
220
  var options = destination;
221
221
  if (help == null)
222
222
  return this.m1k(options);
223
- var tmp = this.b2a(help);
223
+ var tmp = this.c2a(help);
224
224
  var markdown = withPadding(tmp, false, MordantHelpFormatter$renderOptionGroup$lambda);
225
225
  return verticalLayout(MordantHelpFormatter$renderOptionGroup$lambda_0(markdown, this, options));
226
226
  };
@@ -230,36 +230,36 @@
230
230
  return '<' + name.toLowerCase() + '>';
231
231
  };
232
232
  protoOf(MordantHelpFormatter).k1k = function (name) {
233
- return this.z29().i21('danger').g1u(name);
233
+ return this.a2a().j21('danger').h1u(name);
234
234
  };
235
235
  protoOf(MordantHelpFormatter).t1k = function (name) {
236
- return this.z29().i21('muted').g1u(name);
236
+ return this.a2a().j21('muted').h1u(name);
237
237
  };
238
238
  protoOf(MordantHelpFormatter).j1i = function (name) {
239
- return this.z29().i21('info').g1u(name);
239
+ return this.a2a().j21('info').h1u(name);
240
240
  };
241
241
  protoOf(MordantHelpFormatter).m1i = function (name) {
242
- return this.z29().i21('info').g1u(name);
242
+ return this.a2a().j21('info').h1u(name);
243
243
  };
244
244
  protoOf(MordantHelpFormatter).n1i = function (name) {
245
- return this.z29().i21('info').g1u(name);
245
+ return this.a2a().j21('info').h1u(name);
246
246
  };
247
247
  protoOf(MordantHelpFormatter).b1k = function (title) {
248
- return this.z29().i21('warning').g1u(title);
248
+ return this.a2a().j21('warning').h1u(title);
249
249
  };
250
- protoOf(MordantHelpFormatter).a2a = function (title) {
251
- return this.z29().i21('warning').g1u(title);
250
+ protoOf(MordantHelpFormatter).b2a = function (title) {
251
+ return this.a2a().j21('warning').h1u(title);
252
252
  };
253
253
  protoOf(MordantHelpFormatter).x1i = function (title) {
254
- return this.z29().i21('danger').g1u(title);
254
+ return this.a2a().j21('danger').h1u(title);
255
255
  };
256
256
  protoOf(MordantHelpFormatter).c1j = function (parameter) {
257
- return this.z29().i21('muted').g1u(parameter);
257
+ return this.a2a().j21('muted').h1u(parameter);
258
258
  };
259
259
  protoOf(MordantHelpFormatter).v1k = function (metavar) {
260
- return this.z29().i21('warning').x1x(this.z29().i21('muted')).g1u(metavar);
260
+ return this.a2a().j21('warning').y1x(this.a2a().j21('muted')).h1u(metavar);
261
261
  };
262
- protoOf(MordantHelpFormatter).h1l = function (row) {
262
+ protoOf(MordantHelpFormatter).i1l = function (row) {
263
263
  var tmp;
264
264
  // Inline function 'kotlin.text.isNullOrEmpty' call
265
265
  var this_0 = row.a1i_1;
@@ -281,13 +281,13 @@
281
281
  var termPrefix = tmp;
282
282
  return Text_init_$Create$(termPrefix + row.y1h_1, Whitespace_PRE_WRAP_getInstance());
283
283
  };
284
- protoOf(MordantHelpFormatter).i1l = function (row) {
285
- return isBlank(row.z1h_1) ? Text_init_$Create$('') : this.b2a(row.z1h_1);
284
+ protoOf(MordantHelpFormatter).j1l = function (row) {
285
+ return isBlank(row.z1h_1) ? Text_init_$Create$('') : this.c2a(row.z1h_1);
286
286
  };
287
287
  protoOf(MordantHelpFormatter).m1k = function (rows) {
288
288
  return definitionList(MordantHelpFormatter$buildParameterList$lambda(rows, this));
289
289
  };
290
- protoOf(MordantHelpFormatter).b2a = function (text) {
290
+ protoOf(MordantHelpFormatter).c2a = function (text) {
291
291
  return Text_init_$Create$(replace(text, '\n\n', '\x85\x85'), Whitespace_NORMAL_getInstance());
292
292
  };
293
293
  //region block: exports